# qtr2-spans: upper-bound binary span searches Credit: Taylor (gtmcknight), solved Gaussian filter and qm policy, pinned amm-sim `4812a6382311624e1506aca131ca35c378f930d9`. Coefficient tables, policy, rounding, and evaluation arithmetic are unchanged. Only the two span scans change. This report contains the exact patch and executable reconstruction/replay/engine scripts. No board submission was made. Candidate runtime: **19,965 bytes**; engine `afterSwap` peak: **189,174 gas**, **0 OOG**, versus qtr2 **191,821**. Candidate/qtr2 engine edges are exactly identical on all 128 assigned seeds. P passes. Applied-fee F passes 50 × 2,000 callbacks for each arm, with byte-identical candidate/qtr2 outputs. **Literal uncapped-reference F does not pass**: see the explicit raw-reference discrepancy below. Nothing is fabricated; no unmeasured board improvement is claimed. Inputs: [qt1 and qmref](https://api.imdnotdead.fun/artifacts/8a6e303b662e1a5ea9bb47f31acedd3988ef65b3ddb66d074517aa59ad41ca40), [qtr2 R](https://api.imdnotdead.fun/artifacts/18ca35cb47390b8e8c289b240d7836804692998ad64f84ef248c43d61e199f0b), [spline blob](https://api.imdnotdead.fun/artifacts/17d249ab0c33fc44931d9b105cf3f9e3846a560bd518b67310c2a56defacdecc), [Taylor README](https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/README.md), [replica clamp](https://raw.githubusercontent.com/gtmcknight/amm-sim/4812a6382311624e1506aca131ca35c378f930d9/research/solved/replica2.py), [challenge compiler](https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/evm/compiler.py), [config construction](https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/competition/match.py). All numerical results below are this run’s measurements, with underlying per-seed and raw gas records included. Published measurements in the artifacts are not substituted for local results. ## Patch and invariants Both loops compute the upper bound: the count of interior knots `<= xu`. At each iteration the answer remains in `[q,hi]`; `mid` is always below `ni`, including across packed-word lane 15/16. Sorted decoded knot arrays were checked. Equality advances the lower bound exactly as the original scan, preserving the knot-boundary convention. No helper call, table word, knot decoding expression, basis evaluation, interpolation, fee conversion, or arithmetic order after the search changes. Existing Taylor credit in the Solidity header is retained. The full candidate is reconstructed byte-for-byte with `prepare.py` below from R; its hash is asserted. ```diff --- qtr2.sol +++ candidate.sol @@ -106,8 +106,12 @@ // Clamped cubic B-spline at integer x: span m (coefficients m-3..m) and the 4 nonzero bases N (WAD), Cox-de Boor. function basis(uint256[87] memory W,uint256 base,uint256 ni,uint256 last,uint256 x,int256[4] memory N) internal pure returns(uint256 m){ unchecked { int256 xu=int256(x)*U;int256 lastU=int256(last)*U;uint256 w0=W[base];uint256 w1=W[base+1]; - uint256 q; - while(q>((q&15)<<4))&0xffff)*int256(K64)<=xu)q++; + uint256 q;uint256 hi=ni; + while(q>1; + if(int256(((mid<16?w0:w1)>>((mid&15)<<4))&0xffff)*int256(K64)<=xu)q=mid+1; + else hi=mid; + } m=3+q; int256 l1=xu-kn(w0,w1,ni,lastU,m);int256 r1=kn(w0,w1,ni,lastU,m+1)-xu; int256 l2=xu-kn(w0,w1,ni,lastU,m-1);int256 r2=kn(w0,w1,ni,lastU,m+2)-xu; @@ -116,8 +120,12 @@ } } function basisPair(uint256[87] memory W,uint256 base,uint256 ni,uint256 last,uint256 x,int256[4] memory N,int256[4] memory M) internal pure returns(uint256 m){ unchecked { int256 xu=int256(x)*U;int256 lastU=int256(last)*U;uint256 w0=W[base];uint256 w1=W[base+1]; - uint256 q; - while(q>((q&15)<<4))&0xffff)*int256(K64)<=xu)q++; + uint256 q;uint256 hi=ni; + while(q>1; + if(int256(((mid<16?w0:w1)>>((mid&15)<<4))&0xffff)*int256(K64)<=xu)q=mid+1; + else hi=mid; + } m=3+q; int256 l1=xu-kn(w0,w1,ni,lastU,m);int256 r1=kn(w0,w1,ni,lastU,m+1)-xu; int256 l2=xu-kn(w0,w1,ni,lastU,m-1);int256 r2=kn(w0,w1,ni,lastU,m+2)-xu; ``` ## Hashes, compiler and validation Compilation used the pinned challenge compiler: solc 0.8.24, optimizer 200 runs, viaIR, Paris EVM. The prescribed setup ran once and succeeded, including the pinned wheel checksum and StarterStrategy validation. `amm-match validate` passed independently for qt1, qtr2 and candidate. No configuration or library file was changed. Frozen sources were used by every engine invocation. | Arm | Source SHA-256 | Runtime bytes | Creation bytes | Compile seconds | |---|---|---:|---:|---:| | qt1 | `c68887cff61180e12ba2b1ceb333edf76a830f91f63b5d775a8806fb9ec08aca` | 20605 | 20633 | 12.575940 | | qtr2 | `7b99afae570ef1627b0163fb21411f14c496b005a07c3966cc7323906dee664f` | 19945 | 19973 | 15.986592 | | candidate | `bbf63364ed407fc3a94ec3b4cc02223b6855b1b9c083e6e7a7566a2ba70e24b5` | 19965 | 19993 | 14.743710 | qt1: runtime SHA-256 `79c8d6c305ec6dfc29770b27cfb15b6cbd57b1fb01a23309cf8c131ca5c70189`; creation SHA-256 `0af76fa66572167378c48100a70dcd8e64b58eb28cdd94b2e3456c95f367445f`. qtr2: runtime SHA-256 `701582155a1688b1441b1febaa6398f994dba9561ed8627955837582aba4663b`; creation SHA-256 `25f31fc74127ba7059142f7af574fca16ad14e63011c7bbf2646f3def7cf9274`. candidate: runtime SHA-256 `33ebe81f946d64e6d0b19c0a5439e0656295e08eda08a38634d3b934f51e3a44`; creation SHA-256 `0cf6f7891958c6286b0b2e211650c4c228c22c0346a5161513034df629317cbd`. Blob SHA-256: `3ac7cb8811ecfb6a17f499aa4e9b70dd55f7fb6432b3aec3b904e11a3dece38e`, 10,167 bytes. Both requested Q/R source hashes matched before editing. Hashes identify extracted code blocks including their trailing newline, rather than the artifact Markdown. ## P and span checks Before editing, plain `python3 -I gates.py` in Taylor’s `research/solved` reproduced all 12 published values at six decimals: ```text seed perfect-info gaussian+plain gaussian+qm lattice+qm 10000 448.261189 443.455598 443.522608 443.663520 10001 576.779199 571.463409 571.623551 571.977293 10002 531.886497 525.168028 525.865859 526.411631 ``` Span equivalence: all reachable integer row/column positions, plus each decoded interior knot and ±1 WAD unit, passed. This checks the search itself; the EVM replay below checks the complete contract. No new Python policy/reference was introduced, so no policy-selection Gate Q run was performed: 60000..61023 and 10000..12047 scoring were not used for a new reference. Search equivalence is the scope of this item. ```json {"cases": 2172, "rows": [{"table": "T0c", "base": 0, "ni": 20, "cases": 381}, {"table": "T0c", "base": 2, "ni": 6, "cases": 31}, {"table": "T1s", "base": 0, "ni": 20, "cases": 381}, {"table": "T1s", "base": 2, "ni": 10, "cases": 79}, {"table": "T1c", "base": 0, "ni": 14, "cases": 363}, {"table": "T1c", "base": 2, "ni": 8, "cases": 71}, {"table": "T2s", "base": 0, "ni": 20, "cases": 381}, {"table": "T2s", "base": 2, "ni": 10, "cases": 79}, {"table": "T2c", "base": 0, "ni": 8, "cases": 345}, {"table": "T2c", "base": 2, "ni": 4, "cases": 61}]} ``` ## F: complete applied-fee replay, explicit raw-reference limitation 50 fresh deployments per arm; seeds 70000..70049; first 2,000 callbacks per seed; QMRef drives the replica. Init 100/10,000; amounts/reserves `int(float*1e18)`; 245,000 gas per call. Both init fees and both callback fees checked. Candidate/qtr2 init and callback return bytes compared exactly. First applied-fee mismatch would assert immediately; none occurred. Each arm completed 100,050 calls including init (200,100 fee comparisons); 300,150 calls total. There were zero differing candidate/qtr2 callbacks. Applied-reference threshold is 0.01 bps. | Arm | Maximum applied error, bps | Replay peak gas | Mean callback gas | |---|---:|---:|---:| | qt1 | 5.825917152673353e-06 | 194051 | 124776.88952 | | qtr2 | 5.8261143826010553e-06 | 173599 | 109292.64352 | | candidate | 5.8261143826010553e-06 | 171050 | 107433.95890 | The replica clamps returned fees to `[0,0.1]` before applying them. QMRef returns an uncapped fee and separately stores a capped fee internally. Literal raw QMRef equality is therefore a different check and **fails for the pinned qt1 too**, without any candidate policy change. Reference-only scan found the first raw/applied divergence at seed 70026, zero-based callback 1702: raw bid 0.12000793358465078 versus applied bid 0.1, ask 0. The raw replayer stops at this first mismatch for qt1. Thus the brief’s F is met under engine-applied fee semantics, but cannot honestly be marked passed under literal uncapped-return semantics. The binary-search patch does not alter this existing behavior. ```json {"callbacks": 100000, "max_raw_vs_applied_bps": 200.07933584650777, "first": {"seed": 70026, "callback_zero_based": 1702, "raw": [0.12000793358465078, 0.0], "applied": [0.1, 0.0]}} ``` ```text (70026, 1702, 'qt1', 200.07933584650777, [0.1, 0.0], (0.12000793358465078, 0.0)) ``` Per-seed F records. Columns `e1/e2` are maximum bps errors for qt1/qtr2; candidate error equals qtr2. `p1/p2/pc` are callback peaks; `g1/g2/gc` are callback gas sums. Each row has 2,000 callbacks. All 50 candidate/qtr2 SHA-256 output digests match; aggregate digest of concatenated per-seed digest bytes follows the table. | Seed | e1 | e2=ec | p1 | p2 | pc | g1 | g2 | gc | |---:|---:|---:|---:|---:|---:|---:|---:|---:| | 70000 | 1.504892704e-06 | 1.504899868e-06 | 177686 | 161288 | 159221 | 253658209 | 221856196 | 218276697 | | 70001 | 2.057228762e-06 | 2.057191743e-06 | 164724 | 141559 | 137469 | 247491765 | 216462961 | 213206249 | | 70002 | 1.169479369e-06 | 1.169478689e-06 | 183919 | 173599 | 171050 | 252063831 | 220531097 | 216860777 | | 70003 | 1.010698808e-06 | 1.010717638e-06 | 157420 | 137747 | 136976 | 246741486 | 216154590 | 211870933 | | 70004 | 8.586412007e-07 | 8.586398129e-07 | 179427 | 154706 | 151014 | 253026277 | 221349221 | 218037016 | | 70005 | 3.139264004e-06 | 3.139257704e-06 | 168818 | 147487 | 146874 | 247973172 | 216799105 | 213476109 | | 70006 | 9.931862624e-07 | 9.931528343e-07 | 173151 | 148719 | 146760 | 246904551 | 216686330 | 212683026 | | 70007 | 1.259004437e-06 | 1.25900056e-06 | 177385 | 150606 | 150885 | 248930898 | 217459561 | 213723802 | | 70008 | 1.032838697e-06 | 1.032839088e-06 | 170449 | 147376 | 143480 | 253707027 | 221659219 | 218133951 | | 70009 | 2.461148455e-06 | 2.461149704e-06 | 173173 | 155429 | 152745 | 246644496 | 215805830 | 212361227 | | 70010 | 1.669996012e-06 | 1.670230432e-06 | 181614 | 160239 | 158662 | 250724541 | 219565745 | 215607898 | | 70011 | 1.398047862e-06 | 1.398021763e-06 | 176658 | 148649 | 148873 | 250877536 | 219761838 | 215826900 | | 70012 | 1.948056231e-06 | 1.948054921e-06 | 177685 | 154048 | 151062 | 251797664 | 219698331 | 216402576 | | 70013 | 1.220106741e-06 | 1.220079367e-06 | 176753 | 155653 | 155040 | 251247178 | 219935131 | 216334949 | | 70014 | 2.61733053e-06 | 2.61732422e-06 | 170701 | 153190 | 147218 | 246623592 | 215665439 | 212465141 | | 70015 | 1.932937118e-06 | 1.932946307e-06 | 172644 | 146890 | 145948 | 249425458 | 218548089 | 214562428 | | 70016 | 1.505698361e-06 | 1.50586582e-06 | 185884 | 166183 | 163180 | 253766817 | 222397982 | 218570874 | | 70017 | 1.040364969e-06 | 1.040367039e-06 | 161597 | 144942 | 140142 | 246049157 | 215797714 | 212004406 | | 70018 | 1.339194268e-06 | 1.339162917e-06 | 164646 | 139693 | 138528 | 247161101 | 217607988 | 213422700 | | 70019 | 1.196801616e-06 | 1.196780713e-06 | 170993 | 148086 | 146717 | 246613011 | 215715143 | 212504610 | | 70020 | 1.166405045e-06 | 1.166407717e-06 | 183612 | 160549 | 159180 | 249192014 | 218715688 | 215355528 | | 70021 | 1.633158313e-06 | 1.633093656e-06 | 161906 | 143640 | 141271 | 245481713 | 215567272 | 211053081 | | 70022 | 1.666808161e-06 | 1.666815022e-06 | 172142 | 154535 | 151851 | 250556422 | 219000932 | 215528837 | | 70023 | 8.806449407e-07 | 8.806448279e-07 | 166739 | 141680 | 141053 | 247436710 | 217216171 | 213079710 | | 70024 | 1.160399207e-06 | 1.160383803e-06 | 160412 | 136766 | 134231 | 246595351 | 217619292 | 212767562 | | 70025 | 1.892756357e-06 | 1.892760436e-06 | 175092 | 153400 | 151762 | 252986321 | 222253204 | 218109274 | | 70026 | 1.255554856e-06 | 1.255635656e-06 | 164423 | 143435 | 142822 | 248612396 | 216904920 | 213887209 | | 70027 | 1.066476135e-06 | 1.066481391e-06 | 168660 | 142474 | 142272 | 250978063 | 219846688 | 216317116 | | 70028 | 1.299794473e-06 | 1.299795332e-06 | 167353 | 148876 | 148110 | 248404402 | 216537746 | 213355592 | | 70029 | 1.047254462e-06 | 1.047255485e-06 | 166488 | 144903 | 142368 | 250826520 | 220179074 | 215838472 | | 70030 | 1.298256164e-06 | 1.298251524e-06 | 173157 | 150300 | 146618 | 252864265 | 221297928 | 217478690 | | 70031 | 5.825917153e-06 | 5.826114383e-06 | 164676 | 151644 | 149779 | 250032454 | 219689705 | 216002378 | | 70032 | 1.447751745e-06 | 1.447747894e-06 | 194051 | 170246 | 167377 | 247289363 | 216747446 | 212641543 | | 70033 | 3.452615277e-06 | 3.452617046e-06 | 164225 | 145566 | 142289 | 244518398 | 214029283 | 210257148 | | 70034 | 1.616777268e-06 | 1.616678943e-06 | 166841 | 148236 | 146263 | 246805375 | 216142282 | 211741894 | | 70035 | 1.281937434e-06 | 1.281936115e-06 | 174524 | 152117 | 151117 | 252190642 | 220693634 | 217247912 | | 70036 | 2.479442589e-06 | 2.479427557e-06 | 168401 | 145513 | 146656 | 247792341 | 217088949 | 213124277 | | 70037 | 9.456477832e-07 | 9.456478265e-07 | 160844 | 136162 | 134121 | 247544068 | 216402697 | 212975921 | | 70038 | 1.077874396e-06 | 1.077875176e-06 | 169717 | 150752 | 149233 | 247582271 | 217193720 | 213650249 | | 70039 | 2.878124843e-06 | 2.878142243e-06 | 160664 | 140527 | 137978 | 246705885 | 215560889 | 212725861 | | 70040 | 1.22793031e-06 | 1.227887635e-06 | 176904 | 155902 | 155568 | 252754648 | 220948368 | 217685285 | | 70041 | 1.793553136e-06 | 1.793559129e-06 | 179603 | 159194 | 157968 | 249120015 | 218285558 | 214312292 | | 70042 | 9.61884062e-07 | 9.618916427e-07 | 166652 | 145498 | 142488 | 249986833 | 219259925 | 215703958 | | 70043 | 1.120697927e-06 | 1.120640941e-06 | 179704 | 156092 | 153907 | 250317096 | 219842935 | 216102115 | | 70044 | 1.705090583e-06 | 1.705083852e-06 | 170320 | 144934 | 143304 | 251912589 | 220134477 | 216810596 | | 70045 | 2.296948846e-06 | 2.296941144e-06 | 172990 | 154809 | 151127 | 249053015 | 219074980 | 214604610 | | 70046 | 1.541815308e-06 | 1.5418185e-06 | 182825 | 160794 | 155320 | 249717787 | 219427999 | 215426944 | | 70047 | 1.006558881e-06 | 1.006588441e-06 | 172084 | 151269 | 150490 | 253788115 | 221601502 | 217916505 | | 70048 | 1.401727163e-06 | 1.401738222e-06 | 170017 | 150771 | 149545 | 252446827 | 221121286 | 217799458 | | 70049 | 1.030229712e-06 | 1.030229513e-06 | 176483 | 149885 | 146773 | 252769286 | 221422292 | 217563604 | qt1 aggregate output digest: `24e86409eb180128aa83cd01e4ce7015cdd60b5c6e47ca7d450f368eefede7fa`. qtr2 aggregate output digest: `18198a0afd24edab5c5129cd21170db67f457e3892a1760652b2ebbc50070f38`. candidate aggregate output digest: `18198a0afd24edab5c5129cd21170db67f457e3892a1760652b2ebbc50070f38`. ## Engine: all assigned seeds, no reruns Each arm alone versus the compiled 30 bps VanillaStrategy, `run_batch(...,8)`. Seeds 9800448..9800575 inclusive, each once per arm, four chunks of 32. All three sources differ, so none was deduplicated. Config generation was checked against pinned `MatchRunner._build_configs`; defaults vary mean size, arrival rate, and sigma using `np.random.default_rng(seed)`. Each chunk reserves a started checkpoint before calling the engine; no engine range was rerun. Reset/read gas statistics independently per arm/chunk. Raw gas records include baseline and submission roles. No call exceeded eight minutes; each engine invocation’s measured time is below. No board-score extrapolation is made. | Arm | Mean edge | afterSwap peak | afterSwap mean gas | OOG | |---|---:|---:|---:|---:| | qt1 | 535.869760405198 | 208928 | 137877.649482 | 0 | | qtr2 | 535.869835523088 | 191821 | 127181.894068 | 0 | | candidate | 535.869835523088 | 189174 | 125346.709314 | 0 | Paired results versus qt1; SE = sample standard deviation of differences / sqrt(n), worst5 = five smallest (seed,diff): ```json {"arm": "qtr2", "n": 128, "mean_diff": 7.511789012415448e-05, "se": 9.250347746245123e-05, "worst5": [[9800575, -0.006326762812193465], [9800523, -7.660264600417577e-08], [9800503, -2.3436541596311145e-10], [9800498, -2.326032699784264e-10], [9800560, -2.191882231272757e-10]]} ``` ```json {"arm": "candidate", "n": 128, "mean_diff": 7.511789012415448e-05, "se": 9.250347746245123e-05, "worst5": [[9800575, -0.006326762812193465], [9800523, -7.660264600417577e-08], [9800503, -2.3436541596311145e-10], [9800498, -2.326032699784264e-10], [9800560, -2.191882231272757e-10]]} ``` Candidate − qtr2: n=128, mean_diff=0, SE=0; all submission and normalizer edges identical. This is a gas optimization, with no demonstrated edge gain over qtr2. Per-seed raw edges. Candidate submission and normalizer columns equal qtr2 exactly and are deduplicated as `qtr2=candidate`. Full-precision float representations: | Seed | qt1 submission | qtr2=candidate submission | qt1 normalizer | qtr2=candidate normalizer | |---:|---:|---:|---:|---:| | 9800448 | 509.74467276062563 | 509.74467276059704 | 338.1759843091145 | 338.1759843091392 | | 9800449 | 631.1507736933534 | 631.1507736931586 | 398.58118859483045 | 398.58118859482266 | | 9800450 | 664.449119503204 | 664.4491195032464 | 428.43133509632736 | 428.4313350964862 | | 9800451 | 477.35033173874194 | 477.3503317386227 | 289.2530042539079 | 289.2530042538936 | | 9800452 | 459.1787949373619 | 459.1787949375317 | 310.00772246824323 | 310.00772246823357 | | 9800453 | 551.5041017306944 | 551.5041017305794 | 339.50086320923066 | 339.500863209207 | | 9800454 | 605.6550890314459 | 605.6550890313422 | 424.31904022533587 | 424.3190402253418 | | 9800455 | 521.7627384059814 | 521.7627384059427 | 353.4322240877813 | 353.4322240877487 | | 9800456 | 387.53567734664387 | 387.53567734674283 | 276.5196223890419 | 276.51962238905367 | | 9800457 | 606.5091152458741 | 606.5091152459333 | 408.15759531452346 | 408.15759531454864 | | 9800458 | 552.855638340242 | 552.8556383402706 | 370.69893312092506 | 370.6989331210214 | | 9800459 | 584.3226652332457 | 584.3226652331555 | 380.47235683515913 | 380.4723568351993 | | 9800460 | 484.75476510642557 | 484.75476510638333 | 345.58447700837934 | 345.5844770083496 | | 9800461 | 359.97279789894463 | 359.97279789931116 | 254.65224025167186 | 254.65224025193427 | | 9800462 | 493.1459348643273 | 493.1459348643695 | 329.3044839746133 | 329.30448397463095 | | 9800463 | 480.44824640044925 | 480.4482464004225 | 306.12053674244567 | 306.1205367424512 | | 9800464 | 528.2110720275176 | 528.2110720277431 | 336.98904944387607 | 336.9890494438109 | | 9800465 | 514.0155529510313 | 514.0155529509628 | 350.05039199985833 | 350.0503920000153 | | 9800466 | 484.11641169309354 | 484.119594895575 | 331.20933369657143 | 331.20453891738947 | | 9800467 | 584.7471380086243 | 584.7471380084405 | 407.6738172293111 | 407.67381722919276 | | 9800468 | 631.5377789263558 | 631.5377789264184 | 411.3029530712149 | 411.3029530712723 | | 9800469 | 602.7747592263045 | 602.7757189177073 | 395.70334511702276 | 395.6921718354116 | | 9800470 | 655.2733973035973 | 655.2733973036471 | 416.09226266638063 | 416.0922626662502 | | 9800471 | 486.16792079926387 | 486.1679207991665 | 307.3411533183331 | 307.34115331816116 | | 9800472 | 685.3311748103629 | 685.3311748103644 | 445.800469677834 | 445.80046967801576 | | 9800473 | 562.0651926057899 | 562.0651926056719 | 387.91564471018756 | 387.9156447101446 | | 9800474 | 489.86704233420977 | 489.8670423342664 | 337.3947369506051 | 337.39473695076174 | | 9800475 | 463.677725956685 | 463.67772595671795 | 302.99308264279944 | 302.9930826428351 | | 9800476 | 442.0827728180997 | 442.0827728180534 | 282.05577172581815 | 282.05577172566655 | | 9800477 | 640.44085408031 | 640.4408540803557 | 415.84651989601406 | 415.84651989609546 | | 9800478 | 485.08714443751666 | 485.0871444374007 | 317.4783296186054 | 317.47832961856136 | | 9800479 | 439.06762028081147 | 439.067620280896 | 317.46359926596494 | 317.4635992659295 | | 9800480 | 723.4602518322017 | 723.4602518322912 | 442.85396919199064 | 442.85396919191516 | | 9800481 | 499.6908094235257 | 499.6908094234319 | 318.076201699957 | 318.07620169984637 | | 9800482 | 622.4011272653648 | 622.4011272654615 | 410.94826356870743 | 410.94826356881146 | | 9800483 | 535.7401576212943 | 535.7401576212284 | 363.0492085909151 | 363.04920859104016 | | 9800484 | 408.59142537509274 | 408.5914253751723 | 283.7762949852887 | 283.77629498533275 | | 9800485 | 400.68012112928693 | 400.6801211292749 | 280.2206979144792 | 280.22069791455715 | | 9800486 | 654.490079607205 | 654.4900796072236 | 388.45237881982996 | 388.45237881989124 | | 9800487 | 452.3329010784377 | 452.3329010787126 | 315.5240249841089 | 315.52402498396765 | | 9800488 | 546.718980973592 | 546.7189809736394 | 377.2453481280481 | 377.2453481280943 | | 9800489 | 524.2744039377371 | 524.2744039376723 | 352.09780236740164 | 352.0978023671861 | | 9800490 | 560.3965543522688 | 560.3965543524822 | 363.7434604124288 | 363.7434604124761 | | 9800491 | 673.3188833157196 | 673.3188833155923 | 403.15365152143505 | 403.1536515213906 | | 9800492 | 548.9347271553664 | 548.9347271553139 | 337.1270182507752 | 337.127018250662 | | 9800493 | 490.79693547632496 | 490.7969354762108 | 347.1148738326057 | 347.1148738326695 | | 9800494 | 485.41396357051894 | 485.41396357041094 | 359.1994067877886 | 359.19940678780017 | | 9800495 | 450.93763862000145 | 450.93763862012725 | 307.10861699533984 | 307.1086169953029 | | 9800496 | 665.5858801232528 | 665.5858801233082 | 416.738156513705 | 416.73815651365953 | | 9800497 | 488.5184524316459 | 488.51845243159926 | 348.7458232133059 | 348.74582321328506 | | 9800498 | 537.0856308631068 | 537.0856308628742 | 355.01908390367265 | 355.0190839035931 | | 9800499 | 670.3667696769174 | 670.3667696771694 | 418.9910754293477 | 418.99107542930244 | | 9800500 | 664.5207245452567 | 664.5207245453756 | 430.2756119905237 | 430.27561199071425 | | 9800501 | 511.08596958555887 | 511.08596958543563 | 328.75695579652154 | 328.7569557962216 | | 9800502 | 518.3569475945242 | 518.3569475943506 | 324.7530035214326 | 324.7530035213845 | | 9800503 | 432.4762529802981 | 432.47625298006375 | 294.43932584895754 | 294.4393258491116 | | 9800504 | 536.572844831816 | 536.5728448316378 | 372.83281085224684 | 372.83281085225536 | | 9800505 | 653.2100012417751 | 653.2100012419041 | 441.4367404401216 | 441.43674044023845 | | 9800506 | 537.287609503418 | 537.2876095035541 | 328.9465787675 | 328.9465788088214 | | 9800507 | 449.428199728866 | 449.4281997289655 | 326.4446962097407 | 326.44469620990105 | | 9800508 | 511.78421380099627 | 511.7842138012444 | 324.72455066890154 | 324.72455066903734 | | 9800509 | 624.912513821299 | 624.9125138213216 | 384.8536243996799 | 384.85362439949483 | | 9800510 | 666.4514429831863 | 666.4514429833253 | 449.76889389643105 | 449.76889389645766 | | 9800511 | 614.2012281267777 | 614.2012281267902 | 426.01283568100695 | 426.0128356811515 | | 9800512 | 618.5481837900769 | 618.5481837900927 | 433.93096609287323 | 433.9309660925145 | | 9800513 | 556.399538082836 | 556.3995380827276 | 315.37018485813286 | 315.37018485831794 | | 9800514 | 475.5448157105437 | 475.5448157105864 | 333.652386145166 | 333.65238614496786 | | 9800515 | 690.2850599938778 | 690.2850599937506 | 411.8270213414046 | 411.82702134141664 | | 9800516 | 490.590614326094 | 490.5906143259044 | 301.79317958541236 | 301.79317958558556 | | 9800517 | 442.239327710538 | 442.2393277104841 | 317.9987068750602 | 317.9987068750329 | | 9800518 | 538.1358403638072 | 538.1358403637402 | 380.0137224070946 | 380.0137224070639 | | 9800519 | 492.5700223802129 | 492.5700223801541 | 348.76756080887947 | 348.7675608089963 | | 9800520 | 540.4196483730564 | 540.4196483731369 | 376.54318206818704 | 376.5431820682127 | | 9800521 | 539.6855892933803 | 539.6855892933648 | 360.62122384158965 | 360.6212238415811 | | 9800522 | 430.4110350549925 | 430.42028067094634 | 302.11779643704375 | 302.12061651652556 | | 9800523 | 669.2027004213984 | 669.2027003447957 | 415.3166933026867 | 415.31669335067477 | | 9800524 | 539.9215480163665 | 539.9215480163031 | 313.87213318652135 | 313.87213318643103 | | 9800525 | 437.4947304875043 | 437.49473048743414 | 296.7732396619309 | 296.7732396620884 | | 9800526 | 409.0816464529662 | 409.08164645275554 | 271.09344323862285 | 271.0934432386234 | | 9800527 | 612.2510969882254 | 612.2510969881865 | 442.29303090815165 | 442.29303090840136 | | 9800528 | 377.57067993140896 | 377.57067993150594 | 262.4093185312134 | 262.4093185313252 | | 9800529 | 401.6460751682777 | 401.64607516825316 | 275.5461758571892 | 275.5461758571468 | | 9800530 | 615.8362398977114 | 615.83623989765 | 358.69434807353167 | 358.694348073467 | | 9800531 | 663.9072586951072 | 663.9072586950803 | 440.5051768200455 | 440.50517682028845 | | 9800532 | 610.7626670058537 | 610.7626670057875 | 412.0297104894886 | 412.02971048942953 | | 9800533 | 522.3769612613689 | 522.3769612612994 | 355.62544672418505 | 355.6254467242305 | | 9800534 | 585.0541881206984 | 585.0541881207115 | 394.28460391408925 | 394.28460391413 | | 9800535 | 672.9922747860307 | 672.9922747860347 | 423.5296262986316 | 423.529626298421 | | 9800536 | 750.7490957899711 | 750.7490957900865 | 431.44809155065997 | 431.4480915507603 | | 9800537 | 585.8687661189083 | 585.8687661189463 | 408.00269960342814 | 408.0026996034927 | | 9800538 | 498.79369166217083 | 498.79369166220766 | 325.82720686561316 | 325.8272068655368 | | 9800539 | 557.7350164662162 | 557.736289896721 | 351.0569179000879 | 351.0574623771474 | | 9800540 | 650.462923895366 | 650.4629238952298 | 415.26045425009255 | 415.2604542501828 | | 9800541 | 373.7811488784511 | 373.7811488782566 | 265.52026767981437 | 265.5202676799039 | | 9800542 | 588.8032469461428 | 588.8032469462 | 412.0008548937206 | 412.00085489376534 | | 9800543 | 390.56177863216243 | 390.5617786320804 | 270.50905870838545 | 270.5090587084264 | | 9800544 | 614.6184942545723 | 614.6184942545983 | 420.7588214369846 | 420.7588214371437 | | 9800545 | 423.8442382445889 | 423.84423824472873 | 287.25331252791955 | 287.2533125279638 | | 9800546 | 595.7804969451067 | 595.7804969449876 | 407.3907634489429 | 407.39076344913235 | | 9800547 | 538.7521053525672 | 538.7521053524857 | 381.58048732223716 | 381.580487322182 | | 9800548 | 408.94335000788146 | 408.94335000784304 | 291.90704459346114 | 291.90704459347035 | | 9800549 | 551.4758197088106 | 551.4758197088113 | 374.79220697243466 | 374.7922069725087 | | 9800550 | 391.556496171129 | 391.55649617107423 | 269.26806825192585 | 269.26806825212424 | | 9800551 | 657.916768603248 | 657.91676860327 | 416.7659177734769 | 416.76591777330117 | | 9800552 | 449.01233852146686 | 449.0123385214232 | 322.33105776716013 | 322.3310577670868 | | 9800553 | 416.4424753394563 | 416.44247533948567 | 262.89473244062077 | 262.8947324407398 | | 9800554 | 580.2204930761089 | 580.2204930760312 | 366.23321721660125 | 366.2332172167845 | | 9800555 | 615.8405578713582 | 615.8405578714802 | 420.62270985053635 | 420.62270985057944 | | 9800556 | 596.36519071065 | 596.3664706991331 | 414.71474331433075 | 414.7109168572783 | | 9800557 | 442.74740520713215 | 442.7474052072676 | 283.02709491289113 | 283.02709491299464 | | 9800558 | 414.0131093021195 | 414.0131093019673 | 283.61902270524956 | 283.619022705205 | | 9800559 | 461.0863682994259 | 461.086368300714 | 307.4656669473858 | 307.4656669472406 | | 9800560 | 644.3150271296797 | 644.3150271294605 | 427.24168573139576 | 427.2416857314611 | | 9800561 | 587.4913852602833 | 587.4913852602749 | 372.5747752418528 | 372.5747752419204 | | 9800562 | 491.736473671624 | 491.7364736716426 | 334.78917086884223 | 334.7891708689952 | | 9800563 | 570.1341548238479 | 570.1341548238036 | 371.7045309118779 | 371.70453091183845 | | 9800564 | 429.11844412914377 | 429.11844412900416 | 298.5687846798166 | 298.5687846797809 | | 9800565 | 533.4164647017135 | 533.4164647017142 | 365.6775227331768 | 365.6775227333006 | | 9800566 | 656.6807228766924 | 656.680722876815 | 457.3119813245669 | 457.31198132442876 | | 9800567 | 377.01207921819355 | 377.012079218122 | 269.6967956797231 | 269.6967956795822 | | 9800568 | 352.84732294766036 | 352.84732294770646 | 255.03725544094414 | 255.03725544095678 | | 9800569 | 770.5344446131944 | 770.5344446132531 | 439.718268693398 | 439.7182686936307 | | 9800570 | 395.9996481619788 | 395.99964816214543 | 264.118584837809 | 264.11858483794254 | | 9800571 | 560.07762168764 | 560.0776216876649 | 298.9437502949147 | 298.94375029498275 | | 9800572 | 510.77854612959817 | 510.7785461295719 | 318.51573702854165 | 318.5157370286033 | | 9800573 | 507.46536879199476 | 507.4653687921124 | 329.02363812011464 | 329.02363812011697 | | 9800574 | 531.1608859328519 | 531.1608859327893 | 356.3736932835731 | 356.37369328372944 | | 9800575 | 459.43396040215293 | 459.42763363934074 | 319.96861777811506 | 319.98110466220874 | ### Raw gas_stats and chunk timing Unmodified `gas_stats()` arrays; each object names its half-open seed interval and elapsed seconds. No aggregated substitution for raw records: ```json {"arm":"qt1","start":9800448,"end":9800480,"seconds":16.37539553642273,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":347864,"ok":347864,"max_ok_gas":22592,"sum_ok_gas":7848769252,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":90858,"sum_ok_gas":2907456,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":350971,"ok":350971,"max_ok_gas":208490,"sum_ok_gas":48409039510,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21579,"sum_ok_gas":690528,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"qt1","start":9800480,"end":9800512,"seconds":20.209267377853394,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":356606,"ok":356606,"max_ok_gas":22592,"sum_ok_gas":8046016936,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":90858,"sum_ok_gas":2907456,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":358969,"ok":358969,"max_ok_gas":206363,"sum_ok_gas":49419853179,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21579,"sum_ok_gas":690528,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"qt1","start":9800512,"end":9800544,"seconds":22.19726014137268,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":352911,"ok":352911,"max_ok_gas":22592,"sum_ok_gas":7962635580,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":90858,"sum_ok_gas":2907456,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":355913,"ok":355913,"max_ok_gas":208928,"sum_ok_gas":49044609072,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21579,"sum_ok_gas":690528,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"qt1","start":9800544,"end":9800576,"seconds":23.73729681968689,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":341723,"ok":341723,"max_ok_gas":22592,"sum_ok_gas":7710177412,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":90858,"sum_ok_gas":2907456,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":345288,"ok":345288,"max_ok_gas":206276,"sum_ok_gas":47691302407,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21579,"sum_ok_gas":690528,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"qtr2","start":9800448,"end":9800480,"seconds":18.413697004318237,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":347863,"ok":347863,"max_ok_gas":22592,"sum_ok_gas":7848742496,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":92008,"sum_ok_gas":2944256,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":350971,"ok":350971,"max_ok_gas":191821,"sum_ok_gas":44648832769,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21648,"sum_ok_gas":692736,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"qtr2","start":9800480,"end":9800512,"seconds":21.246323823928833,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":356607,"ok":356607,"max_ok_gas":22592,"sum_ok_gas":8046029232,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":92008,"sum_ok_gas":2944256,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":358969,"ok":358969,"max_ok_gas":187932,"sum_ok_gas":45584343359,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21648,"sum_ok_gas":692736,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"qtr2","start":9800512,"end":9800544,"seconds":20.21041440963745,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":352912,"ok":352912,"max_ok_gas":22592,"sum_ok_gas":7962664088,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":92008,"sum_ok_gas":2944256,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":355914,"ok":355914,"max_ok_gas":188097,"sum_ok_gas":45250564903,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21648,"sum_ok_gas":692736,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"qtr2","start":9800544,"end":9800576,"seconds":17.328961849212646,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":341723,"ok":341723,"max_ok_gas":22592,"sum_ok_gas":7710172156,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":92008,"sum_ok_gas":2944256,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":345288,"ok":345288,"max_ok_gas":189427,"sum_ok_gas":43987971328,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21648,"sum_ok_gas":692736,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"candidate","start":9800448,"end":9800480,"seconds":22.16162109375,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":347863,"ok":347863,"max_ok_gas":22592,"sum_ok_gas":7848742496,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":92008,"sum_ok_gas":2944256,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":350971,"ok":350971,"max_ok_gas":189174,"sum_ok_gas":44001813824,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21648,"sum_ok_gas":692736,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"candidate","start":9800480,"end":9800512,"seconds":20.577051401138306,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":356607,"ok":356607,"max_ok_gas":22592,"sum_ok_gas":8046029232,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":92008,"sum_ok_gas":2944256,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":358969,"ok":358969,"max_ok_gas":186563,"sum_ok_gas":44927165114,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21648,"sum_ok_gas":692736,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"candidate","start":9800512,"end":9800544,"seconds":18.707510709762573,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":352912,"ok":352912,"max_ok_gas":22592,"sum_ok_gas":7962664088,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":92008,"sum_ok_gas":2944256,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":355914,"ok":355914,"max_ok_gas":186794,"sum_ok_gas":44594972021,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21648,"sum_ok_gas":692736,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ```json {"arm":"candidate","start":9800544,"end":9800576,"seconds":15.983200311660767,"gas":[{"role":"Baseline","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":21796,"sum_ok_gas":697472,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"afterSwap","calls":341723,"ok":341723,"max_ok_gas":22592,"sum_ok_gas":7710172156,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Baseline","callback":"getName","calls":32,"ok":32,"max_ok_gas":21526,"sum_ok_gas":688832,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterInitialize","calls":32,"ok":32,"max_ok_gas":92008,"sum_ok_gas":2944256,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"afterSwap","calls":345288,"ok":345288,"max_ok_gas":187508,"sum_ok_gas":43358055116,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0},{"role":"Submission","callback":"getName","calls":32,"ok":32,"max_ok_gas":21648,"sum_ok_gas":692736,"oog":0,"revert":0,"other_halt":0,"tx_error":0,"bad_return":0}]} ``` ## Scripts and reproduction All scratch state used for this work stayed in the task workspace under `test/scratch/qtr2/`; none used `/tmp`. Checkout layout is `challenge/` and `replica/` siblings. The scripts below live in `challenge/scratch/`. Dependencies are the assignment’s pinned challenge, Taylor source, compiler, and prescribed wheel/setup environment; binaries and installed environments are not included in these two requested text outputs. An offline verifier needs that prescribed environment provisioned; the report does not claim to bundle the runtime. Only the exact patch/reconstruction and harness source are delivered here. No additional downloaded content is executed as instructions. Run the supplied setup once at pinned challenge root (the original run succeeded); prefix later commands `. scratch/env.sh && `. The setup script actually used: ```sh set -eu;R=$PWD/scratch;mkdir -p $R/tmp $R/bin $R/solcx echo "export TMPDIR=$R/tmp XDG_CACHE_HOME=$R/xc UV_CACHE_DIR=$R/uvc UV_PYTHON_INSTALL_DIR=$R/uvpy SOLCX_BINARY_PATH=$R/solcx VIRTUAL_ENV=$PWD/.venv PATH=$PWD/.venv/bin:$R/bin:\$PATH" >$R/env.sh;. $R/env.sh command -v uv >/dev/null||{ curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-gnu.tar.gz|tar --no-same-owner -xz -C $R/tmp;cp $R/tmp/uv-*/uv $R/bin/;} W=amm_sim_rs-0.1.0.post1-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl;curl -LsSf https://github.com/gtmcknight/amm-sim/releases/download/sim-6b6921f8/$W -o $R/$W echo "aedb68280aca34c110968f00148387c95885207913fb2cf19a1ab4c5cfd6887a $R/$W"|sha256sum -c - uv venv --python 3.12 .venv;uv pip install $R/$W numpy numba cma py-solc-x==2.1.0 pyrevm==0.3.7;uv pip install --no-deps -e . python -c "import solcx;solcx.install_solc('0.8.24')" amm-match validate contracts/src/StarterStrategy.sol ``` Retrieve the pinned artifact documents into `scratch/Q`, `scratch/R`, `scratch/spline`, using curl, then run `prepare.py`. It verifies both source hashes and the blob and creates exactly the frozen candidate. Example download commands: ```sh curl -sS -L -A 'Mozilla/5.0' 'https://api.imdnotdead.fun/artifacts/8a6e303b662e1a5ea9bb47f31acedd3988ef65b3ddb66d074517aa59ad41ca40' -o scratch/Q curl -sS -L -A 'Mozilla/5.0' 'https://api.imdnotdead.fun/artifacts/18ca35cb47390b8e8c289b240d7836804692998ad64f84ef248c43d61e199f0b' -o scratch/R curl -sS -L -A 'Mozilla/5.0' 'https://api.imdnotdead.fun/artifacts/17d249ab0c33fc44931d9b105cf3f9e3846a560bd518b67310c2a56defacdecc' -o scratch/spline ``` ### prepare.py ```python # Run at pinned challenge checkout root, after fetching Q, R, spline into scratch/. import re,hashlib,base64,difflib from pathlib import Path p=Path('scratch') for name,doc,h in [('qt1','Q','c68887cff61180e12ba2b1ceb333edf76a830f91f63b5d775a8806fb9ec08aca'),('qtr2','R','7b99afae570ef1627b0163fb21411f14c496b005a07c3966cc7323906dee664f')]: s=re.search(r'```solidity\n(.*?)```',(p/doc).read_text(),re.S)[1] assert hashlib.sha256(s.encode()).hexdigest()==h (p/(name+'.sol')).write_text(s) a=''' uint256 q; while(q>((q&15)<<4))&0xffff)*int256(K64)<=xu)q++; ''' b=''' uint256 q;uint256 hi=ni; while(q>1; if(int256(((mid<16?w0:w1)>>((mid&15)<<4))&0xffff)*int256(K64)<=xu)q=mid+1; else hi=mid; } ''' s=(p/'qtr2.sol').read_text();assert s.count(a)==2 s=s.replace(a,b);assert hashlib.sha256(s.encode()).hexdigest()=='bbf63364ed407fc3a94ec3b4cc02223b6855b1b9c083e6e7a7566a2ba70e24b5' (p/'candidate.sol').write_text(s) (p/'qmref.py').write_text(re.search(r'```python\n(.*?)```',(p/'Q').read_text(),re.S)[1]) b=base64.b64decode(re.search(r'## Data:.*?```\n(.*?)```',(p/'spline').read_text(),re.S)[1]) assert hashlib.sha256(b).hexdigest()=='3ac7cb8811ecfb6a17f499aa4e9b70dd55f7fb6432b3aec3b904e11a3dece38e' (p/'blob.bin').write_bytes(b) ``` ### check.py ```python import sys,json,hashlib,time from pathlib import Path from decimal import Decimal sys.path.insert(0,str(Path(__file__).resolve().parent)) HERE=Path(__file__).resolve().parent from amm_competition.evm.compiler import SolidityCompiler from amm_competition.evm.executor import EVMStrategyExecutor def compiled(path): s=Path(path).read_text();h=hashlib.sha256(s.encode()).hexdigest();p=HERE/(h+'.json') if p.exists(): return json.loads(p.read_text()) t=time.time();c=SolidityCompiler().compile(s) if not c.success: raise RuntimeError(c.errors) d={'creation':c.bytecode.hex(),'runtime':c.deployed_bytecode.hex(),'sha256':h,'seconds':time.time()-t} p.write_text(json.dumps(d));print('compiled',h,len(c.deployed_bytecode),d['seconds'],flush=True);return d def call(e,values,init=False): data=bytes.fromhex('837aef47' if init else 'c2babb57')+b''.join(int(v).to_bytes(32,'big') for v in values) out=e.evm.message_call(caller=e.CALLER_ADDRESS,to=e.deployed_address,calldata=data,value=0,gas=245000) assert len(out)==64 return [int.from_bytes(out[k:k+32],'big')/1e18 for k in (0,32)] ``` ### spancheck.py ```python # Exhaustive reachable integer-grid span equivalence plus fractional-knot boundaries. import re,json from pathlib import Path s=Path('scratch/qtr2.sol').read_text();rows=[] for tag,nr,nc,last in [('T0c',24,10,12),('T1s',24,14,48),('T1c',18,12,48),('T2s',24,14,48),('T2c',12,8,48)]: body=s.split('function '+tag+'(')[1].split('} }')[0] W={int(i):int(v,16) for i,v in re.findall(r'W\[(\d+)\]=0x([0-9a-f]+)',body)} for base,ni,end in [(0,nr-4,320),(2,nc-4,last)]: knots=[((W.get(base+(q>=16),0)>>((q&15)*16))&65535)*10**18//64 for q in range(ni)] assert knots==sorted(knots) xs=set(x*10**18 for x in range(end+1))|{v+d for v in knots for d in (-1,0,1)} for x in xs: q=0 while q>1 if knots[mid]<=x:lo=mid+1 else:hi=mid assert lo==q rows.append(dict(table=tag,base=base,ni=ni,cases=len(xs))) print(json.dumps({'cases':sum(r['cases'] for r in rows),'rows':rows})) ``` ### replay.py ```python # Taylor (gtmcknight) reference; binary-span replay harness. import sys,json,time,hashlib from check import compiled,HERE from amm_competition.evm.executor import EVMStrategyExecutor sys.path.insert(0,str(HERE.parents[1]/'replica/research/solved')) import replica2 as R from qmref import QMRef class Stop(Exception):pass def call(e,vals,init=False): data=bytes.fromhex('837aef47' if init else 'c2babb57')+b''.join(int(v).to_bytes(32,'big') for v in vals) out=e.evm.message_call(caller=e.CALLER_ADDRESS,to=e.deployed_address,calldata=data,value=0,gas=245000) assert len(out)==64,('invalid result',out) return out def fees(out):return [int.from_bytes(out[k:k+32],'big')/1e18 for k in (0,32)] def replay(seed,codes): es={k:EVMStrategyExecutor(bytes.fromhex(c['creation'])) for k,c in codes.items()} pol=QMRef(str(HERE/'blob.bin'));ref=pol.init() maxerr={k:0. for k in codes};peak={k:0 for k in codes};sums={k:0 for k in codes};hashes={k:hashlib.sha256() for k in codes};n=0 initouts={} for k,e in es.items(): out=call(e,[100*10**18,10000*10**18],True);initouts[k]=out err=max(abs(a-b)*1e4 for a,b in zip(fees(out),ref));assert err<=.01,(seed,'init',k,err) maxerr[k]=err assert initouts['candidate']==initouts['qtr2'] orig=pol.on_trade def record(*args): nonlocal n f=orig(*args);buy,ax,ay,t,x,y,*_=args vals=[buy,int(ax*1e18),int(ay*1e18),t,int(x*1e18),int(y*1e18)];outs={} for k,e in es.items(): out=call(e,vals);outs[k]=out;hashes[k].update(out);gas=e.evm.result.gas_used;peak[k]=max(peak[k],gas);sums[k]+=gas err=max(abs(a-R.clampf(b))*1e4 for a,b in zip(fees(out),f)) assert err<=.01,(seed,n,k,err,fees(out),f) maxerr[k]=max(maxerr[k],err) assert outs['candidate']==outs['qtr2'],(seed,n,'raw mismatch') n+=1 if n==2000:raise Stop() return f pol.on_trade=record try:R.run(seed,pol) except Stop:pass assert n==2000 return dict(seed=seed,n=n,max_error_bps=maxerr,peak=peak,sum_gas=sums,sha256={k:h.hexdigest() for k,h in hashes.items()}) if __name__=='__main__': a,b=map(int,sys.argv[1:]);codes={k:compiled('scratch/'+k+'.sol') for k in ('qt1','qtr2','candidate')};rows=[];t=time.time() for seed in range(a,b): r=replay(seed,codes);rows.append(r);print(json.dumps(r),flush=True) (HERE/f'F_{a}_{b}.json').write_text(json.dumps({'rows':rows,'seconds':time.time()-t})) ``` ### refbounds.py ```python import sys,json from pathlib import Path HERE=Path(__file__).resolve().parent sys.path.insert(0,str(HERE));sys.path.insert(0,str(HERE.parents[1]/'replica/research/solved')) from qmref import QMRef import replica2 as R class Stop(Exception):pass maxdiff=0.;count=0;first=None for seed in range(70000,70050): p=QMRef(str(HERE/'blob.bin'));orig=p.on_trade;n=0 def check(*args): global maxdiff,count,n,first f=orig(*args) if first is None and max(abs(a-R.clampf(a))*1e4 for a in f)>.01:first=dict(seed=seed,callback_zero_based=n,raw=f,applied=[R.clampf(a) for a in f]) maxdiff=max(maxdiff,*(abs(a-R.clampf(a))*1e4 for a in f));count+=1;n+=1 if n==2000:raise Stop() return f p.on_trade=check try:R.run(seed,p) except Stop:pass assert n==2000 print(json.dumps(dict(callbacks=count,max_raw_vs_applied_bps=maxdiff,first=first))) ``` ### engine.py ```python import sys,json,math,time,hashlib from pathlib import Path import amm_sim_rs from amm_competition.competition.match import MatchRunner from amm_competition.competition.config import BASELINE_VARIANCE,build_base_config from amm_competition.evm.compiler import SolidityCompiler from check import compiled,HERE def vanilla(): s=Path('contracts/src/VanillaStrategy.sol').read_text() c=SolidityCompiler().compile(s,contract_name='VanillaStrategy') assert c.success,c.errors return c.bytecode def configs(start,end): # _build_configs seeds parameter variability with np.default_rng(i). # Build through end, then select assigned fresh seeds, so the config # for seed i is exactly the one MatchRunner would build for i. # Equivalent direct transcription avoids allocating 9.5M configs. import numpy as np base=build_base_config(seed=None);v=BASELINE_VARIANCE;out=[] for seed in range(start,end): rng=np.random.default_rng(seed) size=rng.uniform(v.retail_mean_size_min,v.retail_mean_size_max) rate=rng.uniform(v.retail_arrival_rate_min,v.retail_arrival_rate_max) sig=rng.uniform(v.gbm_sigma_min,v.gbm_sigma_max) out.append(amm_sim_rs.SimulationConfig(n_steps=base.n_steps,initial_price=base.initial_price,initial_x=base.initial_x,initial_y=base.initial_y,gbm_mu=base.gbm_mu,gbm_sigma=sig,gbm_dt=base.gbm_dt,retail_arrival_rate=rate,retail_mean_size=size,retail_size_sigma=base.retail_size_sigma,retail_buy_prob=base.retail_buy_prob,seed=seed)) return out if __name__=='__main__': kind=sys.argv[1];start,end=map(int,sys.argv[2:4]) assert 9800448<=start