# pa3: port-2 (TaylorGaussianPlain2) on real-engine seeds 9609728..9609983, paired against t03 and IB The policy comes from **Taylor (gtmcknight)**'s dynamic-programming solution ([amm-sim @4812a63, research/solved](https://github.com/gtmcknight/amm-sim/tree/4812a6382311624e1506aca131ca35c378f930d9/research/solved)). This item only measures the port-2 Solidity port. It does not change it. **Headline (n=256, all seeds run once in every arm):** the candidate minus t03 is **+1.059790755** edge (se 0.091697940), and the candidate wins 202 of 256 seeds. The candidate minus IB is **+1.714796180** (se 0.115925993), and the candidate wins 231 of 256. Over 2,725,265 calls, the candidate's afterSwap had **0 OutOfGas** and **0 reverts**, with a peak of **226,563** gas (at most 245,000 allowed). Its runtime size is **18,484 bytes**. ## Platform and setup - The platform is Linux x86_64. - amm-challenge was cloned and checked out at `6b6921f8d463314aa7c96234e1be25a25245f704` inside the workspace. - The setup script is the 8-line `sh` block in port-3's result ([artifact 0dbcc10a…](https://api.imdnotdead.fun/artifacts/0dbcc10af41b3c3467ff0d9b9cb64c81328fcf18295f9be06b2d81bb98874067), under "The exact setup script executed:"). It is identical to the goal's script. It was saved as `scratch/setup.sh` and run once from the checkout root, and it exited 0. - The wheel sha256 `aedb6828…887a` matched. `amm-match validate contracts/src/StarterStrategy.sol` passed. Later commands were prefixed with `. scratch/env.sh &&`. ## (1) Candidate | field | value | |---|---| | source | [artifact e8c967d6…](https://api.imdnotdead.fun/artifacts/e8c967d6358da0fd53117891357f19a1d684225bd71a5e302b6e299c85f1286c), section `### Strategy.sol`. This is the only Solidity block in the artifact (it has one `contract Strategy` occurrence), fenced from line 79 to line 280 of the artifact text. I took the content lines 80–279 verbatim, ending with one trailing LF. | | sha256 of contracts/src/Strategy.sol | `7e2d9c157a7725c2875eea31e5741938fb9eafef5a3442710573f1b1a87faf17` | | validation | **pass**: `Strategy 'TaylorGaussianPlain2' validated successfully!` | | getName() | `TaylorGaussianPlain2` | | runtime (deployed) bytes | **18,484**, as expected. It was compiled with the challenge's SolidityCompiler (solc 0.8.24). | | header credit | `// Gaussian plain-table AMM policy ported from Taylor (gtmcknight), amm-sim` | The comparators were decoded from the zlib-compressed base64 `code_zb64` field: - t03 has sha256 `cb6d945511e1e10af78baa64c2a6cb25806f0998403ce6440654bfc3c70092d9`, which matches the brief. It validates (`censored_10`) and has 14,654 runtime bytes. - IB has sha256 `301941829a44bb60977bb28181a5e4bfa6544f3696763f987054789b2611d686`, which matches the brief. It validates (`inputs_b`) and has 14,528 runtime bytes. ## Method - Each strategy ran alone against the 30 bps `VanillaStrategy` (contracts/src/VanillaStrategy.sol) with `amm_sim_rs.run_batch(X, VanillaStrategy, configs, 8)`. - Config for seed s: `np.random.default_rng(seed=s)` draws `uniform` retail_mean_size, then retail_arrival_rate, then gbm_sigma from `BASELINE_VARIANCE`. All other fields come from `build_base_config(seed=None)`, and the sim seed is s. The builder copies `MatchRunner._build_configs` with i replaced by the seed. I checked it field by field against `MatchRunner(n_simulations=3)._build_configs()` for i=0,1,2, and it was identical. - Score is `edges['submission']`. - Runs went in chunks of 32 seeds (8 chunks per arm). Each chunk was its own process, and every command took under 30 s. `gas_stats_reset()` was called before each chunk and `gas_stats()` after it. - The order was: candidate on all seeds, then t03 on all seeds, then IB on all seeds. The runner refused to rerun any (arm, chunk), so each seed ran exactly once per arm. Per-seed JSON is kept under scratch/. ## (2) Paired results cand: n=256 mean=514.657594 sec/seed=0.519 total_s=132.8 t03: n=256 mean=513.597803 sec/seed=0.345 total_s=88.2 IB: n=256 mean=512.942798 sec/seed=0.352 total_s=90.2 cand-t03: n=256 mean_diff=1.059790755 se=0.091697940 sd=1.467167 wins=202 cand_mean=514.657593950 t03_mean=513.597803195 cand-IB: n=256 mean_diff=1.714796180 se=0.115925993 sd=1.854816 wins=231 cand_mean=514.657593950 IB_mean=512.942797770 | pair | n | mean_diff | se (sd/√n) | sample sd | candidate wins | candidate mean | comparator mean | |---|---:|---:|---:|---:|---:|---:|---:| | candidate − t03 | 256 | 1.059790755 | 0.091697940 | 1.467167 | 202/256 | 514.657593950 | 513.597803195 | | candidate − IB | 256 | 1.714796180 | 0.115925993 | 1.854816 | 231/256 | 514.657593950 | 512.942797770 | - **candidate − t03** worst5 (seed, diff): (9609765, -7.600373), (9609860, -2.181002), (9609956, -1.727644), (9609933, -1.679171), (9609758, -1.599530) - **candidate − t03** best5 (seed, diff): (9609830, 6.907612), (9609973, 4.740971), (9609895, 4.724182), (9609831, 4.655702), (9609977, 4.546710) - **candidate − IB** worst5 (seed, diff): (9609765, -17.631353), (9609766, -1.374429), (9609956, -1.328573), (9609819, -0.944634), (9609860, -0.921185) - **candidate − IB** best5 (seed, diff): (9609830, 7.077572), (9609831, 6.406077), (9609937, 5.740074), (9609973, 5.734011), (9609780, 5.587739) Seed 9609765 is the largest loss in both pairs: −7.600373 vs t03 and −17.631353 vs IB. Its config is retail_mean_size 20.180, retail_arrival_rate 0.9008, and gbm_sigma 0.000889. The edges were candidate 796.558097571, t03 804.158470162, and IB 814.189450370. I did not investigate the cause. ## (3) Gas (Submission role, afterSwap, summed over the 8 chunks) | arm | calls | ok | OutOfGas | revert | other_halt / tx_error / bad_return | peak gas | mean gas (ok) | |---|---:|---:|---:|---:|---|---:|---:| | candidate | 2725265 | 2725265 | 0 | 0 | 0 / 0 / 0 | 226563 | 127070.63 | | t03 | 2746447 | 2746447 | 0 | 0 | 0 / 0 / 0 | 237441 | 135757.94 | | IB | 2726409 | 2726409 | 0 | 0 | 0 / 0 / 0 | 234946 | 135415.42 | - candidate afterSwap peak per chunk (chunk start: peak (calls)): 9609728: 225058 (342596 calls); 9609760: 225150 (345579 calls); 9609792: 226071 (339487 calls); 9609824: 224762 (342119 calls); 9609856: 226563 (333164 calls); 9609888: 224644 (334011 calls); 9609920: 226071 (341477 calls); 9609952: 224536 (346832 calls) - t03 afterSwap peak per chunk (chunk start: peak (calls)): 9609728: 232419 (344894 calls); 9609760: 212166 (347530 calls); 9609792: 232494 (342168 calls); 9609824: 232735 (344082 calls); 9609856: 235515 (337281 calls); 9609888: 237441 (337504 calls); 9609920: 232703 (343943 calls); 9609952: 235556 (349045 calls) - IB afterSwap peak per chunk (chunk start: peak (calls)): 9609728: 231941 (342107 calls); 9609760: 211565 (344526 calls); 9609792: 231850 (339528 calls); 9609824: 232014 (342005 calls); 9609856: 234946 (335031 calls); 9609888: 231969 (335356 calls); 9609920: 232014 (341649 calls); 9609952: 234864 (346207 calls) - The candidate's afterInitialize peak was 72,760 gas in every chunk, with 0 failures. The candidate's peak afterSwap of 226,563 leaves 18,437 gas of margin under 245,000. ## (4) Per-seed CSV (submission edge, 9 decimals) Columns are seed, candidate, t03, IB. No cell is empty, because every seed ran in all three arms. ```csv seed,candidate,t03,IB 9609728,666.643076820,663.860405729,663.528338406 9609729,409.754105198,410.037290912,409.569076879 9609730,598.368320031,596.109113053,596.119242559 9609731,609.662946358,607.302838975,606.723462157 9609732,389.003024227,387.760911658,386.918738791 9609733,562.390160034,558.926549578,558.129346921 9609734,504.367562479,501.747278380,501.969057841 9609735,423.002628825,423.954834205,423.161940379 9609736,464.269053973,463.116252559,462.246913669 9609737,618.112279553,614.489786718,614.389675690 9609738,484.227986732,482.223458132,481.333117985 9609739,579.182418170,576.835318377,576.669669226 9609740,608.347379127,607.598125732,606.682165151 9609741,401.915809036,401.907036353,401.293261484 9609742,608.820457749,606.216541324,605.448418073 9609743,415.186861514,414.098488824,412.562487603 9609744,426.733822001,426.672380945,425.818724964 9609745,427.140373395,427.357886962,426.257678674 9609746,468.814307101,468.187308831,467.626115420 9609747,579.310950720,577.011611493,575.991423330 9609748,415.566707458,415.355928006,414.890278978 9609749,590.226458360,587.650156819,587.989071365 9609750,506.721248695,504.545380038,504.315533969 9609751,498.103433524,496.684992965,495.971193028 9609752,609.775167396,606.067715864,604.772909079 9609753,621.595249337,622.649145491,622.147458274 9609754,578.493444974,577.087677385,576.791243698 9609755,596.619259861,595.807235279,596.082071030 9609756,389.416775206,389.072214962,388.387288126 9609757,531.619196445,532.115827150,531.348947632 9609758,469.229106043,470.828635805,470.108551311 9609759,370.501443718,369.885840791,369.852595858 9609760,615.681333322,614.921228189,614.305215522 9609761,512.133025187,511.567530499,510.367935015 9609762,502.646880465,501.611731438,501.525054373 9609763,611.589105375,609.795982406,610.561183415 9609764,386.866271546,387.905549140,386.936514284 9609765,796.558097571,804.158470162,814.189450370 9609766,385.420420546,386.586637147,386.794849208 9609767,403.180064904,402.365608178,402.196122377 9609768,464.335136076,464.153527242,463.357370749 9609769,480.658703815,479.971445382,478.007416946 9609770,683.964748178,682.961085344,683.674231702 9609771,469.810431330,469.590386821,466.568168898 9609772,450.816602818,449.307095806,450.052100504 9609773,446.785331055,446.715032099,446.250645975 9609774,382.729479205,382.902412486,380.795349811 9609775,693.725137348,690.664719272,688.608412105 9609776,568.774261290,566.524357639,565.915919236 9609777,574.647789463,572.936154937,571.977421302 9609778,599.184684528,596.794133160,595.847322836 9609779,444.411676545,443.908878284,443.335717876 9609780,573.745974885,569.312380426,568.158236204 9609781,487.835355923,487.971758339,486.548895943 9609782,403.018973497,402.123560419,401.330226173 9609783,573.189124184,572.674093328,571.806222905 9609784,480.595836970,479.568293453,478.269368739 9609785,666.477208491,663.831360863,662.784526715 9609786,504.279723266,503.927477823,502.389914002 9609787,490.755115230,487.717576984,487.405482737 9609788,387.659160497,387.954954185,387.508270249 9609789,488.628292549,485.634698033,484.029510302 9609790,481.919959511,481.431635872,481.454086154 9609791,579.612166776,580.062304773,578.283158712 9609792,481.570517425,479.835964328,479.178728835 9609793,360.150025945,360.898713719,360.619326462 9609794,457.133769127,457.294457477,456.366211435 9609795,461.388854904,461.400444792,460.829252976 9609796,436.293120551,435.419173360,434.554177980 9609797,718.683655568,719.004378908,716.568658546 9609798,686.826566695,683.111655264,683.086853926 9609799,617.900664549,615.478355875,614.898236276 9609800,428.275532735,427.390544101,427.260336919 9609801,368.279224740,367.528934974,366.473311830 9609802,503.062675942,500.997180887,501.249257067 9609803,503.097037810,502.714408086,501.287674288 9609804,615.802133760,614.648821702,613.583419999 9609805,431.234146672,430.769713260,429.687172544 9609806,613.970324602,611.764235489,610.587881426 9609807,462.868398511,462.463494057,460.471053752 9609808,543.761156422,542.001400953,541.741295511 9609809,686.156141340,683.105756227,683.516634642 9609810,462.622431603,461.699082724,460.448913915 9609811,570.458062715,569.192910883,569.206265604 9609812,605.663711629,605.848909517,603.321530880 9609813,381.758743660,381.278754989,381.183314064 9609814,642.127691674,640.823770868,639.929965946 9609815,390.719068402,390.534401796,390.105012508 9609816,546.105850363,545.264294136,544.885439020 9609817,633.262009819,632.198787768,631.939901605 9609818,401.074623874,400.195409642,399.655792185 9609819,439.460644000,440.791928221,440.405278414 9609820,416.439376098,416.110942059,414.561691139 9609821,557.600018120,556.233103391,555.860659095 9609822,572.102849381,569.999487935,569.747902718 9609823,632.606204133,628.947755916,627.687356933 9609824,343.842078885,344.096420724,344.022925058 9609825,613.024004799,611.710282107,610.540635782 9609826,364.705191778,364.446672637,364.102617177 9609827,490.897827506,490.792573975,491.019956770 9609828,439.857467865,437.953014741,436.674690827 9609829,415.932519967,415.740273300,413.638827146 9609830,703.313740408,696.406128748,696.236168441 9609831,621.054517436,616.398815344,614.648440175 9609832,682.022128894,677.637049256,676.962855736 9609833,536.764119770,537.055696932,536.210433141 9609834,599.763283635,598.048648920,598.124912612 9609835,636.915952802,634.895601272,635.157183499 9609836,555.883768875,555.307695727,554.045523636 9609837,528.534159507,525.806355421,525.591127040 9609838,474.606094566,472.851250825,472.420525745 9609839,501.498755610,497.716363872,497.688578481 9609840,540.596166183,539.256318762,538.430223974 9609841,400.620209291,400.591926355,397.954521622 9609842,511.914105111,510.278813969,510.080364819 9609843,469.850684751,469.204885719,467.413595638 9609844,586.034309928,583.873840833,583.115231710 9609845,556.020370266,552.396412953,553.847659836 9609846,388.263697715,388.501126094,387.751100699 9609847,575.276335589,574.691074387,574.763495739 9609848,498.059182509,496.669198996,497.446095156 9609849,525.266969334,524.126867840,523.169996804 9609850,463.992843362,464.502027622,463.111542471 9609851,559.542925288,559.611927201,558.306018128 9609852,598.458622584,596.204099411,595.749853490 9609853,444.311093657,443.732020224,443.219363309 9609854,465.195477747,464.531118162,464.371271858 9609855,535.267100754,534.909228606,533.921142072 9609856,434.362822063,433.940681373,433.141617197 9609857,421.992330150,420.807501621,419.997204325 9609858,430.183754096,428.886222433,427.633592937 9609859,681.010739151,679.480599251,679.041675464 9609860,352.063938735,354.244940363,352.985123793 9609861,372.828375763,373.511964906,372.220602946 9609862,397.628857838,396.833119952,396.864282277 9609863,509.873621384,509.833259709,507.040736523 9609864,622.777980067,623.577953508,622.392644549 9609865,561.803134824,559.882138343,560.124238820 9609866,563.175591721,561.099231674,560.386376788 9609867,375.262871510,375.559591148,375.053753297 9609868,528.508819326,526.409151191,526.334681272 9609869,548.722415770,547.722126648,547.142293848 9609870,481.906285527,480.508802061,478.442664665 9609871,427.006544367,424.818789447,425.119806411 9609872,499.608988616,499.844969290,499.876478610 9609873,531.516555447,530.964442237,529.593853678 9609874,438.424221933,437.478430628,437.262533582 9609875,434.805047076,435.757889179,434.958456376 9609876,483.205030674,482.269271872,481.369146597 9609877,510.464211967,509.360119210,509.064321645 9609878,606.006681266,604.532284719,603.720960022 9609879,547.693448055,548.559318227,547.954972862 9609880,768.199698535,764.553914690,765.015218485 9609881,388.999952244,389.859061470,389.596575096 9609882,530.626650930,529.398555618,529.555954990 9609883,645.790822590,641.505898432,640.665424639 9609884,453.063475031,450.845113617,450.793221125 9609885,396.147348196,397.022224966,396.790153555 9609886,511.313142758,511.245494963,510.017775401 9609887,400.157496459,399.517901222,398.899919572 9609888,602.100293093,599.607068370,600.198277857 9609889,413.464280525,412.862258844,411.473106389 9609890,582.041292160,581.245394198,580.220948059 9609891,650.070793680,649.334754352,649.149541436 9609892,492.543867193,492.586348553,492.749283517 9609893,396.820345088,396.852049013,396.175328209 9609894,582.860489406,579.979901943,579.534855082 9609895,588.882403603,584.158221805,584.837088537 9609896,497.999825645,496.414524139,497.093079656 9609897,475.167117784,474.924397427,474.880331692 9609898,548.786754511,546.406678103,545.227958042 9609899,462.395296745,461.465159919,460.995857695 9609900,401.552626427,400.553385500,400.583704942 9609901,719.522545769,720.100866545,719.555999320 9609902,585.896277206,585.511078977,584.085849393 9609903,467.656304809,466.649428707,465.895004045 9609904,553.679373342,551.229010392,550.002291060 9609905,599.353416817,597.107257195,595.839571442 9609906,387.923590734,386.899515624,386.049804642 9609907,585.446933524,585.242207012,584.130812988 9609908,526.312679239,526.380200594,526.696860114 9609909,381.173322480,380.093956747,379.703819157 9609910,431.828971581,431.007968030,430.062317521 9609911,423.893817428,424.815196451,423.496863922 9609912,397.417683616,395.881471773,394.419736294 9609913,489.648321789,488.688366511,488.291600585 9609914,537.161361779,537.164514284,535.706330708 9609915,449.095727358,448.223429734,446.840739207 9609916,436.190568748,436.139626469,435.323559255 9609917,404.208633359,403.796755897,403.024459607 9609918,416.310227756,416.383913102,415.540373263 9609919,673.835984283,669.651485267,668.849919133 9609920,460.000701478,460.066669933,458.916708631 9609921,614.398267951,611.608184291,610.178656932 9609922,476.417776890,473.728865882,474.509531817 9609923,458.827240153,457.108327672,456.366565034 9609924,488.650573891,487.940334316,485.406218043 9609925,448.349904073,449.125304724,448.595041200 9609926,481.970388876,480.339955265,479.684044033 9609927,488.140735223,486.052745902,485.681793012 9609928,419.047271072,418.703683414,417.372839342 9609929,365.341518563,365.959970784,365.535180694 9609930,589.098282697,588.016653626,587.440364742 9609931,750.788620007,748.909649791,748.314951432 9609932,470.241924657,469.168463584,468.743441473 9609933,453.393794177,455.072965052,453.279316677 9609934,579.161162942,577.247567726,576.539309246 9609935,434.894339257,434.142525821,433.492657897 9609936,530.627337427,529.382987752,527.680419559 9609937,600.302842995,595.985218879,594.562769170 9609938,646.162145014,643.933781909,642.378018843 9609939,514.484853252,514.536446740,514.155875496 9609940,576.125376879,574.529860449,573.903174145 9609941,554.518995903,552.312642515,552.854471934 9609942,417.910653049,418.348554973,417.668418363 9609943,561.881017805,561.880576242,561.339261257 9609944,497.510914336,495.132604568,493.694389270 9609945,393.484922003,393.338363851,392.752809379 9609946,576.174963474,575.272842073,574.845778920 9609947,410.090443982,410.567649424,410.159886903 9609948,508.960720131,507.979926205,507.212280872 9609949,511.936556544,510.808410482,510.532172651 9609950,629.624689670,628.697387133,628.719428517 9609951,515.042885164,514.987390086,514.130989785 9609952,471.373208377,470.863666577,471.166280888 9609953,344.126951416,344.245469281,344.050097548 9609954,527.272161277,526.294791649,526.069773821 9609955,483.107021633,483.569014057,482.806612666 9609956,427.220375679,428.948019210,428.548948866 9609957,637.868588401,636.068509176,636.091558045 9609958,724.422042906,722.010973931,720.723758406 9609959,638.752741590,636.621111203,636.501712466 9609960,552.583984286,552.136587950,550.423437590 9609961,582.034893342,580.389702324,580.470644941 9609962,453.688275731,453.646755140,452.152970938 9609963,481.709866742,482.547212610,478.977642076 9609964,544.477289289,542.780980883,541.096448149 9609965,595.045093199,592.798973355,592.186073518 9609966,701.766185084,699.773544561,697.778176272 9609967,391.561799496,390.870811453,390.561867016 9609968,553.240399384,551.187676548,551.296970496 9609969,439.355140384,439.264715102,438.534244294 9609970,392.012062541,391.842081360,391.312553485 9609971,448.663278453,448.722120982,448.968304745 9609972,594.689784737,593.269851877,593.453820810 9609973,655.330333126,650.589362299,649.596321769 9609974,601.967447582,601.241644924,599.159030251 9609975,511.566447050,510.466077265,509.995714418 9609976,628.398069849,626.437420630,625.674966542 9609977,606.091340488,601.544630373,602.104533481 9609978,599.401012303,597.567723925,596.853966424 9609979,411.949619505,411.362065536,410.251536135 9609980,436.121697739,436.780521812,436.265052240 9609981,624.559747190,622.242433579,622.152901492 9609982,534.894989967,534.985548562,533.727717627 9609983,446.660375851,446.286619722,445.098606439 ``` ## (5) Timing and seeds not run - The figures are `run_batch` wall time with 8 workers, measured on this machine. The candidate took 132.8 s for 256 seeds, which is **0.519 s/seed**. t03 took 88.2 s (**0.345 s/seed**), and IB took 90.2 s (**0.352 s/seed**). - **Seeds not run: none.** All 256 seeds (9609728..9609983) ran exactly once each for candidate, t03 and IB. No other engine seed was consumed. ## Notes - The numbers above are measured, and nothing was filled in. The se is the sample standard deviation of the paired diffs divided by √256. - These seeds are fresh for this item. The earlier figure for port 2 (+1.4143, n=64, seeds 9510064..9510127) came from its own author's seeds, which were also used in debugging. On these 256 blind seeds the gain over t03 is smaller, +1.06 ± 0.09, but still clearly positive.