# B1: port-3 confirmation Port-3 wins this assigned block on mean edge: **+0.591535510 versus t03** (SE **0.080163631**) and **+1.423840922 versus IB** (SE **0.097610136**), each paired over **256 seeds**. Its deployed code is **18,466 bytes**; observed afterSwap peak is **205,740 gas**, with **0 OutOfGas**. These are fresh local real-engine measurements, not the earlier artifact’s results or a guarantee on other seeds. ## Setup | Step | Result | |---|---| | Clone and checkout | Passed: [amm-challenge](https://github.com/benedictbrady/amm-challenge/tree/6b6921f8d463314aa7c96234e1be25a25245f704), commit `6b6921f8d463314aa7c96234e1be25a25245f704` | | Location | Workspace `test/scratch/amm-challenge/`; no checkout in `/tmp` | | Supplied setup script | Saved as checkout `scratch/setup.sh`; `sh scratch/setup.sh` run once, exit 0 | | Wheel | `amm_sim_rs-0.1.0.post1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl` | | Wheel SHA-256 | `aedb68280aca34c110968f00148387c95885207913fb2cf19a1ab4c5cfd6887a`: matched | | Python and dependencies | CPython 3.12.16; amm-sim-rs 0.1.0.post1; numpy 2.5.4; numba 0.68.1; cma 4.5.0; py-solc-x 2.1.0; pyrevm 0.3.7; install passed | | Editable challenge install / solcx | Passed / Solidity 0.8.24 installed | | Starter validation | `Strategy 'StarterStrategy' validated successfully!` | | Port-3 validation | `Strategy 'TaylorGaussianPlainCoarse' validated successfully!` | | Engine work | 24 successful invocations: 8 chunks × 32 seeds × 3 strategies; 8 workers each | | Seed discipline | Only 9601024–9601279 inclusive; each strategy/seed evaluated once; no tuning or retries | All subsequent toolchain commands were prefixed with `. scratch/env.sh &&`. Port validation command: `timeout 470 amm-match validate contracts/src/Strategy.sol`, exit 0. Compilation command: `timeout 470 python scratch/confirm.py compile`, exit 0. Each engine command was `timeout 470 python scratch/confirm.py KIND START`, with KIND in `port,t03,ib` and START in `9601024,9601056,9601088,9601120,9601152,9601184,9601216,9601248`; all exited 0. Outputs and seed-consumption markers were written under checkout `scratch/`. Every shell command finished within eight minutes. ## Exact sources and compilation Port source was extracted verbatim from the `### contracts/src/Strategy.sol` Solidity block in [port-3](https://api.imd.fun/artifacts/0dbcc10af41b3c3467ff0d9b9cb64c81328fcf18295f9be06b2d81bb98874067), retaining its trailing newline and Taylor (gtmcknight) credit. t03 and IB were decoded with `zlib.decompress(base64.b64decode(code_zb64))` from [t03](https://api.imd.fun/artifacts/2333ecf28d4356bd232b85c1e55842e94e1ada05e1cd067830b5625dfdbc5336) and [IB](https://api.imd.fun/artifacts/afd5183e9ff3235334e041c00b0cd19079599a2c6464db95f8c1586712105557). No source edits were made. Hashes below were measured locally and checked against the requested pins. Compilation used the pinned challenge `SolidityCompiler`: Solidity 0.8.24, optimizer 200 runs, viaIR, Paris EVM. | Strategy | Source SHA-256 | Deployed bytes | |---|---|---:| | port | `62930b8e68277c69fc1acfba18de781e684d7fc6daac8dc562b8210dc3932ac1` | 18466 | | t03 | `cb6d945511e1e10af78baa64c2a6cb25806f0998403ce6440654bfc3c70092d9` | 14654 | | ib | `301941829a44bb60977bb28181a5e4bfa6544f3696763f987054789b2611d686` | 14528 | | vanilla | `62d40ccef0de99a385e332a36ddf9cbd1da73eda06bd7954492a9880cb91a572` | 640 | ## Method and mean edge Each candidate ran alone against the unchanged [VanillaStrategy](https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/contracts/src/VanillaStrategy.sol), whose fee is 30 bps. Each invocation called `amm_sim_rs.run_batch(list(candidate_creation_bytecode), list(vanilla_creation_bytecode), configs, 8)`. Edge is `result.edges["submission"]`, in engine edge units, not basis points and not submission-minus-normalizer edge. There was no direct candidate-vs-candidate simulation. Configuration follows the pinned [MatchRunner._build_configs](https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/competition/match.py) and [baseline configuration](https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/competition/config.py): for seed i, `np.random.default_rng(seed=i)` draws uniform retail mean size [19,21], then arrival rate [0.6,1.0], then GBM sigma [0.000882,0.001008]. The resulting SimulationConfig has seed i, 10,000 steps, initial price 100, initial X 100, initial Y 10,000, mu 0, dt 1, retail size sigma 1.2 and buy probability 0.5. This direct transcription avoids allocating millions of unused configs. The same configurations were independently constructed for each strategy. | Strategy | n | Mean edge | Sum of measured batch seconds | |---|---:|---:|---:| | port | 256 | 524.519153658 | 208.669 | | t03 | 256 | 523.927618148 | 273.448 | | ib | 256 | 523.095312735 | 273.492 | ## Paired differences Computed from full-precision engine results at matching seed: diff = port − comparator; SE = sample standard deviation (ddof=1) / sqrt(n). Wins count strictly positive differences. `worst5` means the five smallest differences. CSV rounding below was applied only after all statistics. | Pair | n | mean_diff | se | Wins | Losses | Ties | |---|---:|---:|---:|---:|---:|---:| | port-3 − t03 | 256 | 0.591535510 | 0.080163631 | 169 | 87 | 0 | | port-3 − ib | 256 | 1.423840922 | 0.097610136 | 214 | 42 | 0 | Worst five, port-3 − t03: | Seed | Diff | |---:|---:| | 9601188 | -2.337912933 | | 9601073 | -2.329408262 | | 9601141 | -1.954440988 | | 9601067 | -1.843126514 | | 9601139 | -1.663897409 | Worst five, port-3 − ib: | Seed | Diff | |---:|---:| | 9601073 | -1.998686022 | | 9601170 | -1.956481524 | | 9601188 | -1.697546471 | | 9601139 | -1.475476598 | | 9601120 | -1.433372088 | ## Gas Collected with `amm_sim_rs.gas_stats_reset()` immediately before and `amm_sim_rs.gas_stats()` immediately after every batch. Counters are summed across chunks, peak is max of `max_ok_gas`, and mean is total `sum_ok_gas` / total `ok`. All calls succeeded. All `oog`, `revert`, `other_halt`, `tx_error`, and `bad_return` counters were zero for both roles and every callback in every batch. | Strategy (Submission) | afterSwap calls = ok | oog | Peak gas | Mean gas | sum_ok_gas | |---|---:|---:|---:|---:|---:| | port | 2741584 | 0 | 205740 | 95479.811536 | 261765923630 | | t03 | 2779692 | 0 | 237493 | 135553.079583 | 376795810893 | | ib | 2757297 | 0 | 236928 | 135217.731441 | 372835445250 | Remaining callback aggregates (to make clear which entries of gas_stats were used): | Run | Role | Callback | Calls = ok | Peak gas | Mean gas | |---|---|---|---:|---:|---:| | port | Baseline | afterInitialize | 256 | 21796 | 21796.000000 | | port | Baseline | afterSwap | 2825173 | 22592 | 22562.672908 | | port | Baseline | getName | 256 | 21526 | 21526.000000 | | port | Submission | afterInitialize | 256 | 141957 | 141957.000000 | | port | Submission | getName | 256 | 21524 | 21524.000000 | | t03 | Baseline | afterInitialize | 256 | 21796 | 21796.000000 | | t03 | Baseline | afterSwap | 2743203 | 22592 | 22562.761716 | | t03 | Baseline | getName | 256 | 21526 | 21526.000000 | | t03 | Submission | afterInitialize | 256 | 243234 | 243234.000000 | | t03 | Submission | getName | 256 | 21742 | 21742.000000 | | ib | Baseline | afterInitialize | 256 | 21796 | 21796.000000 | | ib | Baseline | afterSwap | 2744766 | 22592 | 22562.778204 | | ib | Baseline | getName | 256 | 21526 | 21526.000000 | | ib | Submission | afterInitialize | 256 | 243227 | 243227.000000 | | ib | Submission | getName | 256 | 21735 | 21735.000000 | Port-3 satisfies the 24,576-byte deployed-size limit and the 245,000-gas afterSwap limit on these observed runs. This sample cannot establish the worst case over all possible callbacks. ## Per-seed CSV ```csv seed,port,t03,ib 9601024,391.159,391.832,391.878 9601025,581.010,581.270,578.725 9601026,442.943,442.389,441.498 9601027,552.099,552.071,550.794 9601028,594.943,592.925,594.218 9601029,559.319,559.296,558.646 9601030,574.322,573.880,573.439 9601031,606.899,606.446,605.984 9601032,601.147,599.649,600.126 9601033,622.182,620.782,619.498 9601034,760.384,757.446,756.414 9601035,524.605,524.863,523.785 9601036,588.414,588.024,586.494 9601037,403.904,405.221,403.912 9601038,362.470,364.008,363.623 9601039,366.465,365.600,364.528 9601040,492.979,491.639,490.703 9601041,424.690,425.108,425.099 9601042,393.258,394.515,394.121 9601043,573.783,571.736,571.385 9601044,409.831,410.250,409.727 9601045,633.273,631.447,630.324 9601046,491.325,491.708,490.200 9601047,612.786,611.003,610.655 9601048,451.830,451.117,450.068 9601049,402.589,402.437,401.346 9601050,398.261,397.657,396.761 9601051,526.171,524.401,523.879 9601052,577.691,578.654,576.495 9601053,609.629,609.439,607.626 9601054,566.021,564.590,564.535 9601055,552.423,551.996,551.502 9601056,545.803,543.903,542.715 9601057,426.580,427.472,426.460 9601058,378.643,379.785,378.634 9601059,554.841,552.871,551.113 9601060,576.642,574.482,574.532 9601061,414.233,415.175,414.069 9601062,541.710,541.580,539.670 9601063,410.954,411.959,411.501 9601064,495.419,494.609,493.953 9601065,393.109,394.604,393.795 9601066,545.170,543.636,543.209 9601067,447.425,449.268,447.585 9601068,609.587,608.819,607.433 9601069,559.682,560.111,559.753 9601070,405.887,405.638,405.429 9601071,459.249,459.601,459.708 9601072,556.577,556.404,554.699 9601073,595.083,597.413,597.082 9601074,725.355,723.535,723.016 9601075,358.758,358.858,357.976 9601076,425.331,426.104,425.854 9601077,543.614,544.426,543.561 9601078,510.184,510.371,509.348 9601079,441.067,440.854,440.173 9601080,547.617,546.158,544.827 9601081,479.215,478.062,477.958 9601082,571.609,569.575,569.961 9601083,600.323,599.272,599.034 9601084,447.168,446.601,445.807 9601085,517.326,517.387,516.650 9601086,424.874,423.461,420.114 9601087,508.276,508.878,509.170 9601088,456.588,457.539,456.248 9601089,759.481,756.940,756.545 9601090,433.076,432.795,432.720 9601091,481.960,482.415,481.777 9601092,564.838,565.027,564.691 9601093,368.511,369.532,369.355 9601094,596.142,594.701,594.646 9601095,603.533,602.565,601.358 9601096,443.305,442.691,440.585 9601097,784.704,779.128,778.987 9601098,468.202,468.285,465.839 9601099,661.670,660.805,660.167 9601100,424.251,424.609,423.088 9601101,545.862,543.589,542.578 9601102,561.862,559.484,558.812 9601103,406.325,407.235,407.036 9601104,601.086,600.999,599.251 9601105,605.528,604.481,603.530 9601106,657.109,657.382,656.459 9601107,530.855,530.824,529.956 9601108,436.916,437.973,438.038 9601109,486.040,485.861,485.287 9601110,573.925,573.493,572.210 9601111,402.854,404.058,403.201 9601112,431.396,431.489,430.375 9601113,496.717,494.830,494.390 9601114,553.418,553.647,553.092 9601115,388.993,388.210,388.269 9601116,554.462,552.394,550.190 9601117,589.412,588.838,586.708 9601118,551.723,550.298,548.072 9601119,567.698,567.466,565.782 9601120,521.724,523.247,523.158 9601121,455.630,454.925,453.979 9601122,611.416,609.962,608.647 9601123,511.534,511.666,511.327 9601124,565.142,562.986,561.027 9601125,474.798,473.760,472.677 9601126,564.467,561.345,562.019 9601127,592.962,590.435,589.656 9601128,545.707,543.774,542.536 9601129,671.631,668.590,668.086 9601130,424.989,425.996,426.193 9601131,697.178,694.838,694.186 9601132,588.250,586.969,585.262 9601133,669.897,668.948,667.441 9601134,432.862,431.944,431.286 9601135,536.521,535.897,534.982 9601136,511.715,511.667,511.782 9601137,413.725,413.241,413.232 9601138,605.402,604.458,604.707 9601139,393.057,394.721,394.532 9601140,542.046,539.935,539.967 9601141,389.328,391.282,390.680 9601142,425.710,426.153,425.522 9601143,670.128,667.191,666.325 9601144,619.703,618.553,616.999 9601145,573.686,572.767,573.945 9601146,616.868,613.104,612.524 9601147,528.282,525.964,525.804 9601148,510.845,510.437,508.789 9601149,514.916,514.874,513.766 9601150,517.887,517.567,516.986 9601151,718.165,717.677,716.738 9601152,501.719,500.914,500.167 9601153,440.393,440.600,440.063 9601154,518.704,517.656,517.283 9601155,534.275,532.947,532.933 9601156,690.763,687.745,686.124 9601157,635.538,634.535,632.174 9601158,419.515,419.035,417.528 9601159,453.281,454.540,453.228 9601160,687.000,683.316,683.076 9601161,534.064,532.692,532.288 9601162,594.741,593.915,592.685 9601163,515.230,514.780,513.785 9601164,518.283,516.954,516.760 9601165,566.269,566.282,564.869 9601166,590.503,590.219,589.010 9601167,419.372,420.058,419.658 9601168,601.320,599.773,598.357 9601169,712.190,709.062,706.646 9601170,529.614,531.123,531.570 9601171,579.949,577.476,578.012 9601172,521.581,519.612,518.864 9601173,465.849,464.230,463.812 9601174,406.511,407.124,405.398 9601175,394.902,395.456,392.472 9601176,597.066,596.337,596.106 9601177,448.725,449.236,448.163 9601178,476.010,474.352,473.384 9601179,406.499,407.844,407.293 9601180,746.627,745.958,744.689 9601181,565.834,564.505,564.409 9601182,447.936,448.110,445.807 9601183,409.485,409.601,409.180 9601184,771.450,769.293,768.969 9601185,622.224,620.348,619.482 9601186,628.554,627.152,624.731 9601187,576.914,574.516,573.632 9601188,349.572,351.910,351.270 9601189,365.313,364.849,363.744 9601190,464.578,463.640,462.807 9601191,424.163,423.048,422.931 9601192,426.615,427.082,426.951 9601193,556.369,553.996,552.900 9601194,499.972,499.870,498.154 9601195,393.006,394.546,394.161 9601196,600.434,600.999,599.344 9601197,436.397,436.666,436.483 9601198,513.672,512.855,512.403 9601199,498.967,496.962,497.824 9601200,427.820,428.114,427.103 9601201,476.211,476.429,475.652 9601202,697.221,694.685,694.556 9601203,382.330,382.192,381.757 9601204,335.674,337.242,336.386 9601205,482.475,482.233,482.241 9601206,571.913,571.114,569.576 9601207,471.362,472.125,470.979 9601208,476.206,477.650,476.970 9601209,422.539,421.553,420.806 9601210,563.876,562.631,563.145 9601211,494.314,494.492,493.494 9601212,558.707,559.619,559.657 9601213,512.143,512.913,511.226 9601214,544.742,542.860,542.588 9601215,610.338,609.345,607.673 9601216,582.621,580.893,581.168 9601217,425.213,424.896,424.986 9601218,413.242,414.059,412.828 9601219,474.847,474.956,470.768 9601220,646.962,644.157,644.576 9601221,624.405,624.796,623.628 9601222,511.827,510.477,509.302 9601223,470.213,469.072,468.517 9601224,511.350,512.273,512.550 9601225,374.220,374.233,373.433 9601226,676.193,672.889,670.896 9601227,509.124,510.546,509.577 9601228,530.123,530.913,530.323 9601229,625.878,622.142,621.914 9601230,490.798,490.161,489.249 9601231,463.387,462.031,462.775 9601232,428.478,428.321,428.754 9601233,584.270,583.863,583.645 9601234,467.724,467.627,467.388 9601235,449.050,450.525,450.050 9601236,485.287,484.459,483.734 9601237,631.180,629.881,628.377 9601238,480.165,479.846,478.864 9601239,503.971,502.874,502.802 9601240,536.305,536.286,534.937 9601241,480.924,481.464,481.305 9601242,852.777,853.930,854.087 9601243,517.932,516.158,516.084 9601244,570.141,568.916,568.846 9601245,530.278,529.450,528.573 9601246,520.866,521.888,520.166 9601247,477.048,476.882,476.634 9601248,481.027,479.502,479.346 9601249,511.337,510.450,510.409 9601250,458.752,458.777,457.418 9601251,590.603,589.699,587.934 9601252,496.286,494.116,493.092 9601253,615.884,614.440,612.505 9601254,569.883,567.602,566.277 9601255,438.156,439.665,437.594 9601256,389.078,389.428,388.592 9601257,547.375,545.563,545.052 9601258,505.858,506.095,506.049 9601259,440.807,439.916,439.429 9601260,431.826,431.886,430.887 9601261,594.304,593.819,594.306 9601262,568.456,567.082,567.114 9601263,735.625,735.200,733.962 9601264,645.724,642.451,640.748 9601265,592.921,591.466,590.468 9601266,522.889,523.229,521.747 9601267,556.012,555.222,554.037 9601268,542.041,540.728,539.574 9601269,423.515,424.655,422.760 9601270,489.175,489.380,488.565 9601271,614.890,616.170,614.866 9601272,473.663,473.099,472.565 9601273,654.680,653.907,652.532 9601274,654.369,651.863,651.907 9601275,594.709,592.436,592.746 9601276,728.529,727.603,726.474 9601277,432.055,432.022,431.159 9601278,443.948,443.356,432.588 9601279,529.184,526.138,526.800 ``` ## Problems and scope No setup, validation, compilation, engine, or callback failures. One preliminary attempt treated the port artifact as JSON; it is Markdown, so extraction was corrected before validation or scoring. One validation launch used the workspace root and failed to find `scratch/env.sh`; it was corrected to the checkout root before any seeds were consumed. No engine call was retried. This item confirms the existing port as-is; it does not re-run replica gates P/Q/F, redesign the tables, or claim those gates from this measurement. No Foundry build or static analyzers were run: this was unchanged-source confirmation using the specified compiler/validator and real engine, rather than a contract modification. Tool presence checked: forge and aderyn available; slither absent. No public transaction or signature was performed. Checks on this deliverable: all 24 batch outputs marked done; exactly 256 distinct seeds per strategy, matching the assigned range; zero error counters; source hashes matched; all six source quotes re-fetched and matched; JSON parsed; CSV has all 256 rows; output byte limit checked. Local engine outputs are the evidence for the new numerical measurements, not external source claims. Only the two requested report files are delivered; scratch environments and inputs are temporary measurement scaffolding.