# pa2 — port-2 real-engine confirmation Port-2 minus t03: **+1.162092943** edge (SE 0.089855036, n=256). Port-2 minus IB: **+1.951497398** (SE 0.094620590, n=256). All values below are measurements from this run; prior artifacts supply code and setup, not these scores. ## Candidate and setup Policy credit: Taylor (gtmcknight). Extracted the **third fenced block overall (zero-based index 2), the sole `solidity` block**, from the [port-2 result](https://api.imd.fun/artifacts/e8c967d6358da0fd53117891357f19a1d684225bd71a5e302b6e299c85f1286c). Saved the entire block interior, including its terminal newline, byte-exact as `contracts/src/Strategy.sol` in the temporary pinned checkout. No strategy or table changes. - SHA-256: `7e2d9c157a7725c2875eea31e5741938fb9eafef5a3442710573f1b1a87faf17`. - `amm-match validate contracts/src/Strategy.sol`: **PASS**, output `Strategy 'TaylorGaussianPlain2' validated successfully!`. - `getName()`: `TaylorGaussianPlain2`. - Compiled deployed runtime: **18,484 bytes**, below 24,576. Linux x86_64. Checkout commit `6b6921f8d463314aa7c96234e1be25a25245f704`. Used the [port-3 Setup script](https://api.imd.fun/artifacts/0dbcc10af41b3c3467ff0d9b9cb64c81328fcf18295f9be06b2d81bb98874067), executed once from the checkout root; wheel SHA-256 matched `aedb68280aca34c110968f00148387c95885207913fb2cf19a1ab4c5cfd6887a`, setup and StarterStrategy validation passed. An initial shell invocation from the repository root could not find `scratch/setup.sh`; it executed no setup steps. The actual script then ran successfully from the checkout root. Subsequent toolchain commands prefixed `. scratch/env.sh &&`. Compilation used the unchanged [pinned compiler](https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/evm/compiler.py): solc 0.8.24, optimizer 200 runs, viaIR, Paris. Comparators were decoded by base64 then zlib from their `code_zb64` fields: [t03](https://api.imd.fun/artifacts/2333ecf28d4356bd232b85c1e55842e94e1ada05e1cd067830b5625dfdbc5336), SHA-256 `cb6d945511e1e10af78baa64c2a6cb25806f0998403ce6440654bfc3c70092d9`; [IB](https://api.imd.fun/artifacts/afd5183e9ff3235334e041c00b0cd19079599a2c6464db95f8c1586712105557), SHA-256 `301941829a44bb60977bb28181a5e4bfa6544f3696763f987054789b2611d686`. Both hashes match the assignment. ## Method Each arm independently faced the [pinned 30 bps VanillaStrategy](https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/contracts/src/VanillaStrategy.sol) using `amm_sim_rs.run_batch(X, VanillaStrategy, configs, 8)`. Score is `result.edges['submission']`. Configurations transcribe [MatchRunner._build_configs](https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/competition/match.py) with the [pinned defaults](https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/competition/config.py): `default_rng(seed)` draws retail size, arrival rate, then sigma, and simulation seed equals that seed. Each market has 10,000 steps. No candidate-versus-comparator head-to-head simulation was used. Ran exactly seeds **9609472..9609727**, once per arm, in eight contiguous chunks of 32. Order: all candidate chunks, all t03 chunks, then all IB chunks. A reservation file was written before each invocation; no chunk was rerun. Every engine command used `timeout 470` (under eight minutes). `gas_stats_reset()` immediately preceded each chunk; `gas_stats()` immediately followed it. Gas figures below select only `role=Submission, callback=afterSwap`, excluding Vanilla and other callbacks. No extra scoring seeds were consumed. This is a scoring-only confirmation of unchanged port-2; gates P/Q/F were not rerun here. ## Paired results | Difference | n | Mean difference | SE (sample SD / √n) | Candidate mean | Comparator mean | |---|---:|---:|---:|---:|---:| | candidate − t03 | 256 | 1.162092943 | 0.089855036 | 522.178314149 | 521.016221207 | | candidate − IB | 256 | 1.951497398 | 0.094620590 | 522.178314149 | 520.226816751 | **Candidate minus t03 extremes** (seed, difference; sorted by difference): | Rank | worst5 | best5 | |---:|---|---| | 1 | (9609473, -2.772220831) | (9609680, 7.333444106) | | 2 | (9609596, -2.284981230) | (9609613, 4.816563946) | | 3 | (9609633, -2.003525222) | (9609666, 4.649463185) | | 4 | (9609531, -1.983874625) | (9609549, 4.596239465) | | 5 | (9609562, -1.976913432) | (9609678, 4.478780125) | **Candidate minus IB extremes** (seed, difference; sorted by difference): | Rank | worst5 | best5 | |---:|---|---| | 1 | (9609571, -1.917072953) | (9609680, 6.669302943) | | 2 | (9609633, -1.865438164) | (9609600, 6.639013520) | | 3 | (9609596, -1.710827929) | (9609591, 5.704524762) | | 4 | (9609531, -1.647195017) | (9609678, 5.615890092) | | 5 | (9609473, -1.325283675) | (9609549, 5.556920771) | ## afterSwap gas | Arm | Calls | OutOfGas | Reverts | Peak gas | Mean gas | Total gas | |---|---:|---:|---:|---:|---:|---:| | candidate | 2730156 | 0 | 0 | 227141 | 126989.208173452 | 346700348630 | | t03 | 2753145 | 0 | 0 | 235259 | 135717.795760485 | 373650770809 | | IB | 2732394 | 0 | 0 | 234802 | 135374.932531326 | 369897653399 | Mean gas = summed `sum_ok_gas` / summed `ok`, weighted by callback count. Every call succeeded; other_halt, tx_error and bad_return were also zero in every chunk. Candidate peak meets the 245,000 limit on these seeds. | Seeds (inclusive) | Candidate calls | Candidate total gas | Candidate peak | t03 peak | IB peak | |---|---:|---:|---:|---:|---:| | 9609472..9609503 | 337919 | 43017058631 | 224628 | 235247 | 234802 | | 9609504..9609535 | 338569 | 43044477805 | 224444 | 232676 | 231929 | | 9609536..9609567 | 338308 | 43037728364 | 220044 | 235247 | 234712 | | 9609568..9609599 | 349586 | 44149712745 | 224762 | 235259 | 234692 | | 9609600..9609631 | 347360 | 43958368540 | 224288 | 232387 | 234736 | | 9609632..9609663 | 335932 | 42839259655 | 224762 | 232576 | 231962 | | 9609664..9609695 | 352642 | 44434532658 | 226071 | 214118 | 213593 | | 9609696..9609727 | 329840 | 42219210232 | 227141 | 232470 | 231941 | All chunk OutOfGas and revert counts were zero for all three arms. ## Timing and completeness | Arm | Seeds run | Engine seconds | Seconds per seed | Seeds not run | |---|---:|---:|---:|---| | candidate | 256 | 259.305331272 | 1.012911450 | None | | t03 | 256 | 188.086361994 | 0.734712352 | None | | IB | 256 | 150.660860850 | 0.588518988 | None | Timing is elapsed `run_batch` wall time at eight workers, excluding compilation/setup; seconds per seed divides summed chunk time by 256. All 768 arm-seed observations completed. No missing, imputed, or substituted scores. | Seeds | Candidate seconds | t03 seconds | IB seconds | |---|---:|---:|---:| | 9609472..9609503 | 29.898959258 | 23.795074717 | 18.806579584 | | 9609504..9609535 | 29.900713095 | 23.781363547 | 18.514639167 | | 9609536..9609567 | 37.525933239 | 24.608109665 | 18.653545866 | | 9609568..9609599 | 30.832278789 | 24.838314810 | 18.936045030 | | 9609600..9609631 | 32.921230916 | 24.513779167 | 19.364293952 | | 9609632..9609663 | 30.627576882 | 26.877518266 | 18.678347671 | | 9609664..9609695 | 33.970448372 | 20.668114565 | 18.210405799 | | 9609696..9609727 | 33.628190721 | 19.004087256 | 19.497003781 | ## Per-seed CSV Full-precision engine scores were used for statistics; display is rounded to nine decimal places. ```csv seed,candidate,t03,IB 9609472,426.284907827,425.909902310,424.366959423 9609473,391.678151917,394.450372749,393.003435593 9609474,580.547358107,578.898337105,578.617586816 9609475,596.537652343,594.772889223,591.321864688 9609476,386.787806128,385.730831369,385.668248286 9609477,492.432775382,491.977768326,491.620523740 9609478,555.058208993,553.050315876,552.991647853 9609479,578.217034410,574.799082660,573.576725320 9609480,526.206045692,522.535565594,522.422254383 9609481,360.737788392,360.611491386,360.476365518 9609482,390.088918926,389.019552561,388.306282239 9609483,529.837647096,529.589385823,528.928253903 9609484,533.588621549,532.374951590,533.404185515 9609485,593.788507736,593.388986084,592.955113154 9609486,621.041958113,617.857064611,618.435974929 9609487,497.475336737,496.646477629,496.323149377 9609488,604.316556591,602.848122972,601.591398405 9609489,513.518597704,511.501259111,509.320241365 9609490,438.905201837,437.929028311,436.943912083 9609491,644.648344276,642.725097727,640.939235098 9609492,535.955303553,536.169408129,535.449797576 9609493,500.805202504,498.511974520,498.990828800 9609494,616.364229409,616.486391403,616.201500296 9609495,479.732162210,479.276019148,477.844253340 9609496,539.068210078,538.434290413,537.992348412 9609497,520.410839265,518.848159385,517.491419696 9609498,475.988170254,476.561531744,475.801796531 9609499,566.921504918,564.873003105,564.057779305 9609500,507.235326464,505.215087288,505.162484774 9609501,510.526653961,510.532795810,510.444831739 9609502,393.966894997,395.380055188,394.203798711 9609503,459.573333340,458.219977549,458.669911550 9609504,520.055974846,519.458132053,518.129961300 9609505,402.985491324,402.598594636,402.174709349 9609506,533.313766092,531.983213325,532.134112097 9609507,509.224257516,508.938954515,508.439100242 9609508,652.791192924,649.646853509,649.381789929 9609509,529.948009973,527.544891560,528.111267268 9609510,583.512730252,582.211731804,582.367981179 9609511,568.134190185,567.540237527,564.972711042 9609512,469.848841680,469.632365537,468.653336931 9609513,618.307035170,618.441598173,617.433183409 9609514,415.621224351,415.098996477,414.170800207 9609515,491.465590152,490.202835380,489.167408818 9609516,411.412467164,409.499849092,409.598936945 9609517,685.267591555,682.805875775,682.173658095 9609518,652.726222215,649.968712783,647.362258397 9609519,621.702747458,620.101278238,619.982332575 9609520,590.936164807,589.502669541,588.039181493 9609521,444.556165585,444.879463557,443.311046513 9609522,681.488379805,679.423025206,678.840713781 9609523,406.686789594,406.354029018,405.466929420 9609524,422.356166233,420.919927474,419.832877944 9609525,633.853585112,634.435020973,634.122363939 9609526,467.851493013,466.557773544,466.256583266 9609527,339.880859288,341.184760064,340.456859722 9609528,583.630955058,581.414944485,581.110110583 9609529,470.698208448,469.439413250,469.904059156 9609530,541.101592831,537.915973866,537.706465683 9609531,392.836808625,394.820683250,394.484003641 9609532,403.993190259,403.912086027,402.894962274 9609533,554.295071483,553.035078939,552.297017264 9609534,497.202376297,497.042964674,496.103487886 9609535,424.124138108,424.337938882,424.433365788 9609536,405.294757640,406.640918038,405.566107647 9609537,513.432605250,512.818658519,511.517497277 9609538,483.272841724,481.864418218,481.742336543 9609539,681.706587972,678.425641790,676.969282819 9609540,537.887861711,536.147624731,535.727548900 9609541,378.618078271,378.407032206,377.695151526 9609542,434.687954848,434.577165166,434.214169585 9609543,577.322090090,573.721897711,574.386356999 9609544,731.598402570,728.721048060,727.114579680 9609545,486.712429030,486.425806525,486.044681878 9609546,475.593110673,474.243507836,474.181976541 9609547,509.450378407,508.777648761,507.889871146 9609548,445.283864605,443.801492918,442.651592352 9609549,569.528105127,564.931865662,563.971184356 9609550,487.856373358,487.324883778,486.538783673 9609551,518.659443319,517.618801640,516.708165888 9609552,377.066629479,377.197154091,377.099292591 9609553,376.997499815,378.295608864,377.928234771 9609554,606.705657395,607.066975926,605.694928951 9609555,648.859356312,645.339153852,645.262039650 9609556,528.391918681,528.478262390,526.894659201 9609557,397.299023355,396.580372808,395.688592049 9609558,524.771880316,522.320539585,521.443351652 9609559,514.414200721,513.979512400,513.079068298 9609560,650.440991881,647.193083154,645.422540140 9609561,634.916385041,633.024211630,632.020450346 9609562,488.485740020,490.462653452,489.192573023 9609563,446.464432792,446.078636622,445.756872446 9609564,666.170408257,662.671492386,662.930780510 9609565,535.979453065,532.639785463,533.185710765 9609566,482.162255941,481.530719381,480.031627419 9609567,532.397766532,529.948065445,528.462871742 9609568,517.810207465,516.574361921,515.546779376 9609569,617.896873957,617.137508836,614.424500360 9609570,501.258679722,499.466168743,499.022625063 9609571,410.285011424,411.696636335,412.202084378 9609572,469.950276621,471.062240786,470.766961304 9609573,626.232762875,624.747423992,623.189160611 9609574,490.101132843,489.136742388,487.513671850 9609575,379.557045469,378.700996056,377.960343670 9609576,656.377361251,653.459075459,652.986668291 9609577,755.418011767,753.520451398,751.905929893 9609578,568.916565165,567.846351430,566.102388580 9609579,503.277982309,503.672945472,502.605818421 9609580,406.033053743,406.058528000,405.497656324 9609581,715.635109761,712.514359611,711.371608008 9609582,477.761012767,476.882729758,476.419030744 9609583,510.649408999,508.851811779,508.141665805 9609584,495.941300358,494.131243542,493.847628785 9609585,515.516062182,514.928187643,514.063556345 9609586,607.073977020,604.359006121,603.442415366 9609587,451.838091925,452.425401357,450.787295090 9609588,549.463529412,547.719018760,547.087913788 9609589,624.713991578,620.684710324,620.399523932 9609590,683.473613333,681.537268824,681.292781010 9609591,606.081548767,602.315411762,600.377024005 9609592,399.864420769,398.973394714,397.976542245 9609593,513.290344304,511.880261699,511.342930251 9609594,535.879799590,534.193002918,533.732116989 9609595,636.326666121,632.206766317,632.543864047 9609596,380.755025048,383.040006278,382.465852977 9609597,635.852763556,632.978982222,633.438649324 9609598,645.647664789,642.609200224,641.509410736 9609599,576.474705170,575.782524994,574.354700142 9609600,782.313275116,778.615127219,775.674261596 9609601,533.961686076,532.062411542,529.796791719 9609602,580.795386461,580.154953145,579.399938127 9609603,600.906872353,598.171088270,598.156415054 9609604,385.853190941,385.981948082,385.125083321 9609605,595.984068020,594.638027205,591.502513672 9609606,604.353430572,601.274264986,599.183529915 9609607,556.803233525,556.217335438,555.466220095 9609608,435.614265111,436.179246224,434.621639291 9609609,525.840300681,524.939791652,525.431499169 9609610,437.330772685,435.843950467,434.093962456 9609611,635.316917191,634.149642133,633.050135278 9609612,543.145945646,541.530611073,540.523106306 9609613,678.112108628,673.295544682,673.119047044 9609614,476.074901090,474.099695962,474.169735730 9609615,482.361584360,480.586615795,480.006901473 9609616,494.223650415,493.589131849,493.253641908 9609617,437.220516435,437.308940151,436.262788590 9609618,549.051957497,546.639759097,545.128289409 9609619,508.364122815,504.845298456,504.980147689 9609620,468.187236189,467.819646168,466.490857155 9609621,666.611268531,665.966768513,663.523027480 9609622,465.923960431,464.183053289,463.326576226 9609623,389.566221494,390.015533934,388.916728853 9609624,519.009181991,519.225901448,519.393959659 9609625,402.378631839,401.729811614,401.086016209 9609626,556.261020203,554.529632700,554.048262078 9609627,482.754420929,482.168592288,481.387495794 9609628,497.883672350,496.763768520,495.487901049 9609629,460.308895151,459.906939226,459.884987682 9609630,550.732256075,550.723995826,549.096125611 9609631,636.917225035,634.934105639,634.009048172 9609632,504.656642891,505.156451715,504.935571726 9609633,574.497733313,576.501258535,576.363171477 9609634,497.575850383,496.554015124,495.794791643 9609635,431.859432913,432.350113480,432.032013080 9609636,448.223512409,446.569570715,446.243378349 9609637,433.064807340,432.769292029,432.257308992 9609638,472.720173149,471.630018372,471.744344594 9609639,584.048393535,582.936344539,581.236895451 9609640,487.681642008,487.674772686,487.774588157 9609641,614.986309400,613.648667730,612.745916497 9609642,432.523133660,433.601311916,431.639986328 9609643,616.425468945,613.692901002,614.125964138 9609644,457.222178003,457.486987043,453.848357647 9609645,412.015069705,412.544154307,411.703989719 9609646,526.765109599,525.582997247,525.434473008 9609647,426.523270733,425.874491222,425.795747229 9609648,507.227665376,503.910047446,504.615172629 9609649,561.285558213,560.253957035,559.154815922 9609650,435.257595370,435.123901168,435.135596286 9609651,560.214606173,560.386612099,559.317888793 9609652,408.578227061,408.312024342,407.654258202 9609653,596.202764129,593.519173040,591.717015734 9609654,441.117235910,440.689271784,442.042930401 9609655,495.285800188,494.134581085,492.246473772 9609656,606.185862823,603.758937634,603.006443951 9609657,391.877055916,392.250668257,391.403300348 9609658,499.974003979,499.312266793,499.583579986 9609659,508.572303461,505.088716612,505.028420880 9609660,636.387436772,633.638161449,632.736130271 9609661,650.471008458,649.056856908,647.098279171 9609662,420.973135834,420.639143753,419.830146573 9609663,501.820035405,503.159212815,500.833528848 9609664,504.334278238,503.640543271,502.245543212 9609665,494.196280138,491.742547204,491.991699937 9609666,525.104516522,520.455053337,520.183454638 9609667,505.954517594,504.120531128,504.004948222 9609668,579.093916768,577.553340584,577.604331950 9609669,412.721921948,410.971366750,410.064991499 9609670,811.274259243,810.468950590,810.022480914 9609671,605.811301856,604.799427818,603.467896162 9609672,568.505122840,567.583235350,565.759122392 9609673,613.159703809,609.390052760,608.465865561 9609674,486.070462197,484.994529844,484.607189664 9609675,729.051047241,730.635794264,729.189504744 9609676,400.837017598,401.088550691,400.578171175 9609677,484.957687535,484.766385700,483.607337223 9609678,724.653133977,720.174353852,719.037243884 9609679,612.588633103,608.237445583,607.961398818 9609680,729.153206140,721.819762035,722.483903197 9609681,563.983955176,561.079169074,560.902747916 9609682,494.246355278,493.129629772,493.394516926 9609683,602.127338567,602.280651578,600.980851070 9609684,484.842048174,485.731505335,485.184811057 9609685,487.377566842,486.520515732,484.816568875 9609686,506.604892561,506.469647428,506.764214598 9609687,529.941314417,528.481950854,527.537945824 9609688,563.721823871,563.103355740,561.634940038 9609689,468.533553341,467.665899563,466.384756831 9609690,637.046706336,635.292317593,634.419269549 9609691,488.789658276,486.374456024,486.149875964 9609692,610.961270002,610.465443272,609.892159408 9609693,499.110646576,498.798064622,498.050951183 9609694,431.517816964,430.457147487,430.416140727 9609695,487.839872630,487.306283775,486.675658419 9609696,417.869334097,418.896543180,417.501597992 9609697,469.528117534,467.461743052,465.905225130 9609698,564.831551133,563.646246696,563.267380129 9609699,530.052743328,527.334440834,526.692268661 9609700,447.222924662,445.984655668,445.106284617 9609701,418.164122091,417.551224146,416.187119906 9609702,522.573858465,521.171292705,519.982065904 9609703,588.051882215,586.593516882,586.956604781 9609704,600.552611756,599.355189510,598.341318638 9609705,478.044444418,477.845010373,476.416140009 9609706,344.936557669,345.638194047,345.095939679 9609707,447.270162845,445.853769011,444.643235791 9609708,514.181860447,512.598623174,512.196293524 9609709,573.075444853,570.477432493,570.189774365 9609710,445.825774152,447.207354133,444.512652825 9609711,534.000954594,532.109136920,531.390441522 9609712,591.598928002,588.024343936,587.940358354 9609713,634.836165975,635.414142707,632.317802335 9609714,567.797303556,564.528291340,563.241401383 9609715,462.097303691,461.852649587,460.448147635 9609716,508.750159531,508.074468079,506.552133236 9609717,568.878774540,566.813073645,565.561811542 9609718,382.976649440,383.473856958,381.830409222 9609719,384.558052286,383.878275853,384.223843896 9609720,475.512376315,475.806862672,474.826129272 9609721,463.744583856,461.256367306,461.028587596 9609722,552.535516826,553.205391456,552.214185675 9609723,514.376239338,512.676863470,512.243730676 9609724,672.602733554,671.476028458,670.866935154 9609725,455.214941934,454.225863954,452.694970147 9609726,431.461572010,431.060090420,429.628040777 9609727,384.194740026,382.843356617,382.534990181 ``` ## Executed scoring harness The following local harness compiled the retrieved source without modifications and ran each reserved chunk. Temporary dependencies and raw chunk files lived under exempt `test/scratch/`; the report contains all requested delivered measurements. ```python import sys,json,time,hashlib from pathlib import Path import numpy as np import amm_sim_rs from amm_competition.evm.compiler import SolidityCompiler from amm_competition.competition.config import BASELINE_VARIANCE,build_base_config P=Path('scratch') if sys.argv[1]=='compile': out={} for name,file,contract in [('candidate','Strategy','Strategy'),('t03','t03','Strategy'),('IB','ib','Strategy'),('vanilla','VanillaStrategy','VanillaStrategy')]: data=Path(f'contracts/src/{file}.sol').read_bytes();c=SolidityCompiler().compile(data.decode(),contract_name=contract) assert c.success,c.errors out[name]={'creation':c.bytecode.hex(),'runtime_bytes':len(c.deployed_bytecode),'sha256':hashlib.sha256(data).hexdigest()} (P/'compiled.json').write_text(json.dumps(out));print(json.dumps({k:{a:b for a,b in v.items() if a!='creation'} for k,v in out.items()})) else: kind=sys.argv[1];start=int(sys.argv[2]);end=min(start+32,9609728) assert kind in ['candidate','t03','IB'] and 9609472<=start