{
  "approach": "Deepen CH with a post-gap cap on decayed toxEma. Hypothesis: a previous fee band bounds stale toxicity carryover after a quiet gap, letting current observed toxicity drive fees. Change no signal decays except the separately tested ELAPSED_CAP variants. Replace the inherited exponentiation loop with equivalent fixed operations for bounded elapsed <= 16 to meet the no-loops requirement. Select the largest paired tuning mean, freeze its source hash before holdout, and evaluate it once on fresh seeds. Holdout clears the promotion threshold.",
  "tried": [
    {
      "variant": "halfband",
      "seeds": [
        10000,
        10499
      ],
      "n": 500,
      "mean_diff": 0.01711321676884131,
      "se": 0.005971851484355658,
      "code_sha256": "9781c46564db3abc7c47b4716f3440feb019c028371dad999940cbbef88030ca",
      "worst": [
        {
          "seed": 10216,
          "diff": -0.49055049383002824
        },
        {
          "seed": 10204,
          "diff": -0.4064009644193902
        },
        {
          "seed": 10103,
          "diff": -0.38411575720579094
        },
        {
          "seed": 10249,
          "diff": -0.3488663936471994
        },
        {
          "seed": 10005,
          "diff": -0.3465068118058525
        }
      ],
      "description": "elapsedRaw > 1: cap decayed toxEma at (prevBidFee + prevAskFee)/2; ELAPSED_CAP=8."
    },
    {
      "variant": "protect",
      "seeds": [
        10000,
        10499
      ],
      "n": 500,
      "mean_diff": 0.0,
      "se": 0.0,
      "code_sha256": "71ca9ddd92cfeea6b64aed62593c38eb0843fd6a5d341d79df9f91a4455dd138",
      "worst": [
        {
          "seed": 10000,
          "diff": 0.0
        },
        {
          "seed": 10001,
          "diff": 0.0
        },
        {
          "seed": 10002,
          "diff": 0.0
        },
        {
          "seed": 10003,
          "diff": 0.0
        },
        {
          "seed": 10004,
          "diff": 0.0
        }
      ],
      "description": "elapsedRaw > 1: cap decayed toxEma at max(prevBidFee,prevAskFee), defining the protect fee as the larger previous fee; ELAPSED_CAP=8."
    },
    {
      "variant": "halfband15",
      "seeds": [
        10000,
        10499
      ],
      "n": 500,
      "mean_diff": 0.0056787787323283965,
      "se": 0.002216010941611738,
      "code_sha256": "8dcbbd917de41d086da2ccde224a864a07eebbe3bee4ff4f1fdb07dedc6fe351",
      "worst": [
        {
          "seed": 10468,
          "diff": -0.31330457924400434
        },
        {
          "seed": 10307,
          "diff": -0.30556650188759704
        },
        {
          "seed": 10420,
          "diff": -0.23225220099095623
        },
        {
          "seed": 10232,
          "diff": -0.1836913374982032
        },
        {
          "seed": 10086,
          "diff": -0.17786312399255166
        }
      ],
      "description": "elapsedRaw > 1: cap decayed toxEma at 1.5 times the previous half-band; ELAPSED_CAP=8."
    },
    {
      "variant": "gap2",
      "seeds": [
        10000,
        10499
      ],
      "n": 500,
      "mean_diff": 0.0058819696979817305,
      "se": 0.0039676297034122185,
      "code_sha256": "463363754bcd4805d31e498e9a03ffddb9fa48a73a148a528a4b1a85850320c3",
      "worst": [
        {
          "seed": 10317,
          "diff": -0.5293385350034896
        },
        {
          "seed": 10005,
          "diff": -0.3145528709248424
        },
        {
          "seed": 10110,
          "diff": -0.29275988371432504
        },
        {
          "seed": 10200,
          "diff": -0.2629679678045136
        },
        {
          "seed": 10304,
          "diff": -0.2537542941980746
        }
      ],
      "description": "elapsedRaw > 2: cap decayed toxEma at the previous half-band; ELAPSED_CAP=8."
    },
    {
      "variant": "halfband_elapsed4",
      "seeds": [
        10000,
        10499
      ],
      "n": 500,
      "mean_diff": 0.013554407577121083,
      "se": 0.006620620676034431,
      "code_sha256": "2c1c299e4f7b8e624e998125dc0e3490a91dbb5de467877b7b3bb1367e493308",
      "worst": [
        {
          "seed": 10265,
          "diff": -0.5651597728162869
        },
        {
          "seed": 10204,
          "diff": -0.43297418698170986
        },
        {
          "seed": 10356,
          "diff": -0.3972018639065027
        },
        {
          "seed": 10103,
          "diff": -0.38652483105209967
        },
        {
          "seed": 10236,
          "diff": -0.3571561080665333
        }
      ],
      "description": "Same half-band cap after elapsedRaw > 1; ELAPSED_CAP=4."
    },
    {
      "variant": "halfband_elapsed12",
      "seeds": [
        10000,
        10499
      ],
      "n": 500,
      "mean_diff": 0.016447729433503356,
      "se": 0.006252729651350902,
      "code_sha256": "888c2532a0a89d8a90b73b1625d94eb8bac009221e3403f1f4831860ef79c6fc",
      "worst": [
        {
          "seed": 10216,
          "diff": -0.501288328911869
        },
        {
          "seed": 10265,
          "diff": -0.44865619204904306
        },
        {
          "seed": 10103,
          "diff": -0.4356197428140831
        },
        {
          "seed": 10204,
          "diff": -0.405819476580632
        },
        {
          "seed": 10495,
          "diff": -0.3474544691648589
        }
      ],
      "description": "Same half-band cap after elapsedRaw > 1; ELAPSED_CAP=12."
    },
    {
      "variant": "halfband_elapsed16",
      "seeds": [
        10000,
        10499
      ],
      "n": 500,
      "mean_diff": 0.015005027346159864,
      "se": 0.006325964157177531,
      "code_sha256": "c48542ea1edc74e6857daede23701f97e7dad592d9ef28806055238ebe088d5a",
      "worst": [
        {
          "seed": 10216,
          "diff": -0.5014149460291719
        },
        {
          "seed": 10265,
          "diff": -0.44917607386435066
        },
        {
          "seed": 10103,
          "diff": -0.43378451242745086
        },
        {
          "seed": 10204,
          "diff": -0.4067651105007144
        },
        {
          "seed": 10014,
          "diff": -0.3888476689791105
        }
      ],
      "description": "Same half-band cap after elapsedRaw > 1; ELAPSED_CAP=16."
    }
  ],
  "next": "Submit this candidate for merged replication; do not infer official leaderboard performance from local seeds.",
  "code": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.24;\n\nimport {AMMStrategyBase} from \"./AMMStrategyBase.sol\";\nimport {TradeInfo} from \"./IAMMStrategy.sol\";\n\ncontract Strategy is AMMStrategyBase {\n    uint256 constant ELAPSED_CAP = 8;\n    uint256 constant SIGNAL_THRESHOLD = WAD / 650;\n    uint256 constant DIR_DECAY = 750000000000000000;\n    uint256 constant ACT_DECAY = 530000000000000000;\n    uint256 constant SIZE_DECAY = 530000000000000000;\n    uint256 constant TOX_DECAY = 910000000000000000;\n    uint256 constant SIGMA_DECAY = 690000000000000000;\n    uint256 constant LAMBDA_DECAY = 990000000000000000;\n    uint256 constant SIZE_BLEND_DECAY = 828000000000000000;\n    uint256 constant TOX_BLEND_DECAY = 51000000000000000;\n    uint256 constant ACT_BLEND_DECAY = 985000000000000000;\n    uint256 constant PHAT_ALPHA = 270000000000000000;\n    uint256 constant PHAT_ALPHA_RETAIL = 60000000000000000;\n    uint256 constant DIR_IMPACT_MULT = 4;\n    uint256 constant GATE_SIGMA_MULT = 7200000000000000000;\n    uint256 constant MIN_GATE = 30000000000000000;\n    uint256 constant TRADE_TOX_BOOST = 3500 * BPS;\n    uint256 constant STALE_ATTRACT_FRAC = 1050000000000000000;\n    uint256 constant RET_CAP = WAD / 35;\n    uint256 constant TOX_CAP = WAD / 5;\n    uint256 constant TRADE_RATIO_CAP = WAD / 5;\n    uint256 constant LAMBDA_CAP = 1820000000000000000;\n    uint256 constant STEP_COUNT_CAP = 64;\n    uint256 constant BASE_FEE = 4 * BPS;\n    uint256 constant SIGMA_COEF = 200000000000000000;\n    uint256 constant LAMBDA_COEF = 12 * BPS;\n    uint256 constant FLOW_SIZE_COEF = 4842 * BPS;\n    uint256 constant TOX_COEF = 300 * BPS;\n    uint256 constant TOX_QUAD_COEF = 15000 * BPS;\n    uint256 constant ACT_COEF = 91843 * BPS;\n    uint256 constant DIR_COEF = 20 * BPS;\n    uint256 constant DIR_TOX_COEF = 100 * BPS;\n    uint256 constant STALE_DIR_COEF = 6850 * BPS;\n    uint256 constant SIGMA_TOX_COEF = 500 * BPS;\n    uint256 constant TAIL_KNEE = 600 * BPS;\n    uint256 constant TAIL_SLOPE_PROTECT = 930000000000000000;\n    uint256 constant TAIL_SLOPE_ATTRACT = 850000000000000000;\n\n    function afterInitialize(uint256 initialX, uint256 initialY) external override returns (uint256, uint256) {\n        slots[0] = BASE_FEE; slots[1] = BASE_FEE; slots[2] = 0; slots[3] = WAD; slots[4] = 0;\n        slots[5] = initialX > 0 ? wdiv(initialY, initialX) : 100 * WAD;\n        slots[6] = 950000000000000; slots[7] = 800000000000000000; slots[8] = 2000000000000000;\n        slots[9] = 0; slots[10] = 0;\n        return (BASE_FEE, BASE_FEE);\n    }\n\n    function afterSwap(TradeInfo calldata trade) external override returns (uint256, uint256) {\n        uint256 prevBidFee = slots[0]; uint256 prevAskFee = slots[1]; uint256 lastTs = slots[2];\n        uint256 dirState = slots[3]; uint256 actEma = slots[4]; uint256 pHat = slots[5];\n        uint256 sigmaHat = slots[6]; uint256 lambdaHat = slots[7]; uint256 sizeHat = slots[8];\n        uint256 toxEma = slots[9]; uint256 stepTradeCount = slots[10];\n\n        bool isNewStep = trade.timestamp > lastTs;\n        if (isNewStep) {\n            uint256 elapsedRaw = trade.timestamp - lastTs;\n            uint256 elapsed = elapsedRaw > ELAPSED_CAP ? ELAPSED_CAP : elapsedRaw;\n            dirState = _decayCentered(dirState, DIR_DECAY, elapsed);\n            actEma = wmul(actEma, _powWad(ACT_DECAY, elapsed));\n            sizeHat = wmul(sizeHat, _powWad(SIZE_DECAY, elapsed));\n            toxEma = wmul(toxEma, _powWad(TOX_DECAY, elapsed));\n            if (elapsedRaw > 1) { uint256 hb = (prevBidFee + prevAskFee) / 2; if (toxEma > hb) toxEma = hb; }\n            if (stepTradeCount > 0 && elapsedRaw > 0) {\n                uint256 lambdaInst = (stepTradeCount * WAD) / elapsedRaw;\n                if (lambdaInst > LAMBDA_CAP) lambdaInst = LAMBDA_CAP;\n                lambdaHat = wmul(lambdaHat, LAMBDA_DECAY) + wmul(lambdaInst, WAD - LAMBDA_DECAY);\n            }\n            stepTradeCount = 0;\n        }\n\n        bool firstInStep = stepTradeCount == 0;\n        uint256 spot = trade.reserveX > 0 ? wdiv(trade.reserveY, trade.reserveX) : pHat;\n        if (pHat == 0) pHat = spot;\n\n        uint256 feeUsed = trade.isBuy ? prevBidFee : prevAskFee;\n        uint256 gamma = feeUsed < WAD ? WAD - feeUsed : 0;\n        uint256 pImplied;\n        if (gamma == 0) { pImplied = spot; }\n        else { pImplied = trade.isBuy ? wmul(spot, gamma) : wdiv(spot, gamma); }\n\n        {\n            uint256 ret = pHat > 0 ? wdiv(absDiff(pImplied, pHat), pHat) : 0;\n            uint256 alpha = firstInStep ? PHAT_ALPHA : PHAT_ALPHA_RETAIL;\n            uint256 adaptiveGate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (adaptiveGate < MIN_GATE) adaptiveGate = MIN_GATE;\n            if (ret <= adaptiveGate) { pHat = wmul(pHat, WAD - alpha) + wmul(pImplied, alpha); }\n            if (firstInStep) {\n                if (ret > RET_CAP) ret = RET_CAP;\n                sigmaHat = wmul(sigmaHat, SIGMA_DECAY) + wmul(ret, WAD - SIGMA_DECAY);\n            }\n        }\n\n        uint256 tradeRatio = trade.reserveY > 0 ? wdiv(trade.amountY, trade.reserveY) : 0;\n        if (tradeRatio > TRADE_RATIO_CAP) tradeRatio = TRADE_RATIO_CAP;\n\n        if (tradeRatio > SIGNAL_THRESHOLD) {\n            uint256 push = tradeRatio * DIR_IMPACT_MULT;\n            if (push > WAD / 4) push = WAD / 4;\n            if (trade.isBuy) {\n                dirState = dirState + push;\n                if (dirState > 2 * WAD) dirState = 2 * WAD;\n            } else {\n                dirState = dirState > push ? dirState - push : 0;\n            }\n            actEma = wmul(actEma, ACT_BLEND_DECAY) + wmul(tradeRatio, WAD - ACT_BLEND_DECAY);\n            sizeHat = wmul(sizeHat, SIZE_BLEND_DECAY) + wmul(tradeRatio, WAD - SIZE_BLEND_DECAY);\n            if (sizeHat > WAD) sizeHat = WAD;\n        }\n\n        uint256 tox = pHat > 0 ? wdiv(absDiff(spot, pHat), pHat) : 0;\n        if (tox > TOX_CAP) tox = TOX_CAP;\n        toxEma = wmul(toxEma, TOX_BLEND_DECAY) + wmul(tox, WAD - TOX_BLEND_DECAY);\n        uint256 toxSignal = toxEma;\n\n        stepTradeCount = stepTradeCount + 1;\n        if (stepTradeCount > STEP_COUNT_CAP) stepTradeCount = STEP_COUNT_CAP;\n\n        uint256 flowSize = wmul(lambdaHat, sizeHat);\n        uint256 fBase = BASE_FEE + wmul(SIGMA_COEF, sigmaHat) + wmul(LAMBDA_COEF, lambdaHat) + wmul(FLOW_SIZE_COEF, flowSize);\n        uint256 fMid = fBase + wmul(TOX_COEF, toxSignal) + wmul(TOX_QUAD_COEF, wmul(toxSignal, toxSignal)) + wmul(ACT_COEF, actEma);\n        fMid = fMid + wmul(SIGMA_TOX_COEF, wmul(sigmaHat, toxSignal));\n\n        uint256 dirDev; bool sellPressure;\n        if (dirState >= WAD) { dirDev = dirState - WAD; sellPressure = true; }\n        else { dirDev = WAD - dirState; sellPressure = false; }\n\n        uint256 skew = wmul(DIR_COEF, dirDev) + wmul(DIR_TOX_COEF, wmul(dirDev, toxSignal));\n        uint256 bidFee; uint256 askFee;\n        if (sellPressure) {\n            bidFee = fMid + skew;\n            askFee = fMid > skew ? fMid - skew : 0;\n        } else {\n            askFee = fMid + skew;\n            bidFee = fMid > skew ? fMid - skew : 0;\n        }\n\n        {\n            uint256 staleShift = wmul(STALE_DIR_COEF, toxSignal);\n            uint256 attractShift = wmul(staleShift, STALE_ATTRACT_FRAC);\n            if (spot >= pHat) {\n                bidFee = bidFee + staleShift;\n                askFee = askFee > attractShift ? askFee - attractShift : 0;\n            } else {\n                askFee = askFee + staleShift;\n                bidFee = bidFee > attractShift ? bidFee - attractShift : 0;\n            }\n        }\n\n        {\n            bool tradeAligned = (trade.isBuy && spot >= pHat) || (!trade.isBuy && spot < pHat);\n            if (tradeAligned) {\n                uint256 tradeBoost = wmul(TRADE_TOX_BOOST, tradeRatio);\n                if (trade.isBuy) { bidFee = bidFee + tradeBoost; }\n                else { askFee = askFee + tradeBoost; }\n            }\n        }\n\n        if (sellPressure) {\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_PROTECT));\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_ATTRACT));\n        } else {\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_PROTECT));\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_ATTRACT));\n        }\n\n        slots[0] = bidFee; slots[1] = askFee; slots[2] = trade.timestamp;\n        slots[3] = dirState; slots[4] = actEma; slots[5] = pHat;\n        slots[6] = sigmaHat; slots[7] = lambdaHat; slots[8] = sizeHat;\n        slots[9] = toxEma; slots[10] = stepTradeCount;\n\n        return (bidFee, askFee);\n    }\n\n    function _compressTailWithSlope(uint256 fee, uint256 slope) internal pure returns (uint256) {\n        if (fee <= TAIL_KNEE) return fee;\n        return TAIL_KNEE + wmul(fee - TAIL_KNEE, slope);\n    }\n\n    function _powWad(uint256 factor, uint256 exp) internal pure returns (uint256 result) {\n        result = WAD;\n        // elapsed is capped at 16 or less; five bits suffice.\n        if (exp & 1 != 0) result = wmul(result, factor);\n        factor = wmul(factor, factor);\n        if (exp & 2 != 0) result = wmul(result, factor);\n        factor = wmul(factor, factor);\n        if (exp & 4 != 0) result = wmul(result, factor);\n        factor = wmul(factor, factor);\n        if (exp & 8 != 0) result = wmul(result, factor);\n        factor = wmul(factor, factor);\n        if (exp & 16 != 0) result = wmul(result, factor);\n    }\n\n    function _decayCentered(uint256 centered, uint256 decayFactor, uint256 elapsed) internal pure returns (uint256) {\n        uint256 mul = _powWad(decayFactor, elapsed);\n        if (centered >= WAD) { return WAD + wmul(centered - WAD, mul); }\n        uint256 below = wmul(WAD - centered, mul);\n        return below < WAD ? WAD - below : 0;\n    }\n\n    function getName() external pure override returns (string memory) { return \"no_cubic\"; }\n}\n",
  "code_sha256": "bac270759b77568f690e0f5d28e3a886f4494222efe72214d3a21eddcebcf2ec",
  "delta": "--- CH.sol\n+++ Strategy.sol\n@@ -67,2 +67,3 @@\n             toxEma = wmul(toxEma, _powWad(TOX_DECAY, elapsed));\n+            if (elapsedRaw > 1) { uint256 hb = (prevBidFee + prevAskFee) / 2; if (toxEma > hb) toxEma = hb; }\n             if (stepTradeCount > 0 && elapsedRaw > 0) {\n@@ -185,7 +186,12 @@\n         result = WAD;\n-        while (exp > 0) {\n-            if (exp & 1 == 1) result = wmul(result, factor);\n-            factor = wmul(factor, factor);\n-            exp >>= 1;\n-        }\n+        // elapsed is capped at 16 or less; five bits suffice.\n+        if (exp & 1 != 0) result = wmul(result, factor);\n+        factor = wmul(factor, factor);\n+        if (exp & 2 != 0) result = wmul(result, factor);\n+        factor = wmul(factor, factor);\n+        if (exp & 4 != 0) result = wmul(result, factor);\n+        factor = wmul(factor, factor);\n+        if (exp & 8 != 0) result = wmul(result, factor);\n+        factor = wmul(factor, factor);\n+        if (exp & 16 != 0) result = wmul(result, factor);\n     }\n",
  "score": {
    "seed_start": 0,
    "n": 1000,
    "mean_edge": 525.5508794406641,
    "se": 2.7893552697201334
  },
  "paired": {
    "reference": "CH 6dd68f77",
    "seed_start": 600000,
    "n": 2000,
    "mean_diff": 0.02539990175997937,
    "se": 0.003663599553393786,
    "worst": [
      {
        "seed": 601125,
        "diff": -0.9857669360943646,
        "candidate_edge": 625.8386962263226,
        "reference_edge": 626.8244631624169
      },
      {
        "seed": 601628,
        "diff": -0.5248756672638137,
        "candidate_edge": 578.7803426889575,
        "reference_edge": 579.3052183562213
      },
      {
        "seed": 601870,
        "diff": -0.49610798761864316,
        "candidate_edge": 641.0292953346003,
        "reference_edge": 641.525403322219
      },
      {
        "seed": 601757,
        "diff": -0.49529003812040173,
        "candidate_edge": 532.6385945719885,
        "reference_edge": 533.1338846101089
      },
      {
        "seed": 601730,
        "diff": -0.4813687547310792,
        "candidate_edge": 518.4583148610495,
        "reference_edge": 518.9396836157806
      }
    ]
  },
  "paired_starter": {
    "reference": "Pinned official StarterStrategy: fixed 50 bps",
    "reference_code_sha256": "8f2cea337f6736105f58c6758da6c3ebf002951d34492bcd5b7101bef2d1e7f3",
    "seed_start": 600000,
    "n": 2000,
    "mean_diff": 155.82488221694044,
    "se": 0.9092283763099809,
    "worst": [
      {
        "seed": 600945,
        "diff": 76.91666869026409,
        "candidate_edge": 327.3542413968084,
        "reference_edge": 250.4375727065443
      },
      {
        "seed": 601402,
        "diff": 78.68772377648389,
        "candidate_edge": 342.1125494511739,
        "reference_edge": 263.42482567469
      },
      {
        "seed": 600215,
        "diff": 79.36361453112914,
        "candidate_edge": 344.41934009096093,
        "reference_edge": 265.0557255598318
      },
      {
        "seed": 601394,
        "diff": 80.27814482077846,
        "candidate_edge": 325.569708617053,
        "reference_edge": 245.29156379627452
      },
      {
        "seed": 600250,
        "diff": 80.43386766903222,
        "candidate_edge": 326.90546305008985,
        "reference_edge": 246.47159538105763
      }
    ]
  },
  "seconds_per_simulation": 0.441535798089928,
  "validate_ok": true,
  "blocked": null,
  "citations": [
    {
      "url": "https://raw.githubusercontent.com/ChengHua926/amm-challenge/d34a5199c59a4c44d5336a25f1436b4ae1f21104/contracts/src/Strategy.sol",
      "supports": "CH reference source and unchanged baseline parameters."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/competition/match.py",
      "supports": "Pinned simulator implementation used for local measurements."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/competition/config.py",
      "supports": "Pinned simulator implementation used for local measurements."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_sim_rs/src/simulation/engine.rs",
      "supports": "Pinned simulator implementation used for local measurements."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_sim_rs/src/evm/strategy.rs",
      "supports": "Pinned simulator implementation used for local measurements."
    },
    {
      "url": "https://raw.githubusercontent.com/jiayaoqijia/amm-challenge-yq/main/README.md",
      "supports": "YQ public architecture notes: asymmetric stale-direction discount."
    },
    {
      "url": "https://medium.com/@crypto_algebra/amm-fee-challenge-notes-from-our-run-on-optimization-arena-4e980dbbd699",
      "supports": "Public write-up background: first-trade arbitrage ordering. Quotation read via web retrieval; a direct HTTP quote check returned 403."
    },
    {
      "url": "https://raw.githubusercontent.com/dipankar/amm-challenge/main/ANALYSIS.md",
      "supports": "Public methodology post-mortem: fair-price inference from observed trades; background only, no quoted performance used."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/contracts/src/StarterStrategy.sol",
      "supports": "Pinned simulator implementation used for local measurements."
    }
  ],
  "measurement": {
    "engine_commit": "6b6921f8d463314aa7c96234e1be25a25245f704",
    "reference_sha256": "6dd68f77a70900319460215374143dbd5d924198450a46d9f5f91f6b1e3d35c3",
    "opponent": "VanillaStrategy: fixed 30 bps, independently for CH and the candidate; CH and candidate do not compete with each other.",
    "configs": "10,000 steps. Per seed: numpy.default_rng(seed), uniform size 19..21, then arrival rate 0.6..1.0, then sigma 0.000882..0.001008. Other fields identical to MatchRunner._build_configs. Rust price seed=seed, retail seed=seed+1.",
    "statistic": "Arithmetic mean of per-seed submission edges; paired diff=candidate-CH; SE=sample SD(ddof=1)/sqrt(n). Worst entries are the five smallest signed holdout differences.",
    "tuning_seeds": "10000..10499; 500 paired simulations for each of seven variants. The item-specific >=500 tuning instruction was used; tuning comparisons are not 2,000-simulation promotion evidence.",
    "selection": {
      "variant": "halfband",
      "tuning_only": true,
      "tuning_code_sha256": "9781c46564db3abc7c47b4716f3440feb019c028371dad999940cbbef88030ca",
      "loop_removal": "Equivalent fixed five-bit exponentiation for elapsed <= 16; applied before freeze to satisfy no-loops requirement.",
      "sha256": "bac270759b77568f690e0f5d28e3a886f4494222efe72214d3a21eddcebcf2ec",
      "frozen_at_utc": "2026-11-07T05:04:35.704619+00:00",
      "selection_rule": "Largest mean paired gain versus CH among the seven prespecified tuning variants on seeds 10000..10499. Holdout not inspected during selection."
    },
    "holdout": "600000..601999 in chunks of 25; candidate measured once after freeze; no retuning and no seeds 900000..909999 used.",
    "ch_score_check": {
      "seed_start": 0,
      "n": 1000,
      "measured_mean": 525.5258821780834,
      "brief_expected_mean": 525.525882178,
      "difference": 8.344613888766617e-11
    },
    "performance": "seconds_per_simulation is accumulated run_batch wall time for both 2,000-run holdout legs divided by 4,000; includes contention, excludes compilation/config creation.",
    "timing": {
      "candidate_holdout_seconds": 985.490860824706,
      "reference_holdout_seconds": 780.6523315350059,
      "candidate_score_seconds": 709.2952275327407,
      "starter_holdout_seconds": 615.3146903144661
    },
    "limitations": "Local simulation estimates only. No official submission or leaderboard claim. The starter comparison uses the pinned official fixed-50-bps StarterStrategy, independently against the same fixed-30-bps normalizer; it reuses the frozen candidate holdout edges and is not used for selection. The inherited exponentiation loop was unrolled without changing any of 500 paired tuning-seed edges; no loops or new storage remain."
  },
  "checks": {
    "loop_removal_paired_verification": {
      "seed_start": 10000,
      "n": 500,
      "all_edges_bit_identical": true
    },
    "validate_ok": true,
    "starter_validate_ok": true,
    "ch_validate_ok": true,
    "config_equivalence": "All MatchRunner._build_configs fields exactly match for seeds 0..9.",
    "cap_boundary_cases": 216,
    "final_candidate_boundary_cases": 54,
    "gas": "All boundary calls successfully execute with a 250000 gas limit; no numerical peak-gas estimate claimed. Rust uses the same 250000 call limit.",
    "storage": "Compiler storage policy passes; source uses slots 0..10 and boundary cases leave 11..31 zero.",
    "loops": "No loops. CH exponentiation loop replaced with fixed operations for the five possible exponent bits; no history loop."
  },
  "scoreboard": {
    "best": {
      "code_sha256": "bac270759b77568f690e0f5d28e3a886f4494222efe72214d3a21eddcebcf2ec",
      "score_n": 1000,
      "mean_edge": 525.5508794406641
    },
    "previous_best": {
      "code_sha256": "6dd68f77a70900319460215374143dbd5d924198450a46d9f5f91f6b1e3d35c3",
      "score_n": 1000,
      "mean_edge": 525.5258821780834
    },
    "candidate": {
      "code_sha256": "bac270759b77568f690e0f5d28e3a886f4494222efe72214d3a21eddcebcf2ec",
      "score_n": 1000,
      "mean_edge": 525.5508794406641
    },
    "promotion": true,
    "promotion_rule": "Frozen fresh-holdout mean_diff > 2*SE.",
    "promotions_ranked": [
      {
        "rank": 1,
        "variant": "halfband",
        "code_sha256": "bac270759b77568f690e0f5d28e3a886f4494222efe72214d3a21eddcebcf2ec",
        "n": 2000,
        "mean_diff": 0.02539990175997937,
        "se": 0.003663599553393786,
        "mean_diff_over_official_starter": 155.82488221694044,
        "se_over_official_starter": 0.9092283763099809
      }
    ],
    "tuning_ranked": [
      {
        "rank": 1,
        "variant": "halfband",
        "seeds": [
          10000,
          10499
        ],
        "n": 500,
        "mean_diff": 0.01711321676884131,
        "se": 0.005971851484355658,
        "code_sha256": "9781c46564db3abc7c47b4716f3440feb019c028371dad999940cbbef88030ca",
        "worst": [
          {
            "seed": 10216,
            "diff": -0.49055049383002824
          },
          {
            "seed": 10204,
            "diff": -0.4064009644193902
          },
          {
            "seed": 10103,
            "diff": -0.38411575720579094
          },
          {
            "seed": 10249,
            "diff": -0.3488663936471994
          },
          {
            "seed": 10005,
            "diff": -0.3465068118058525
          }
        ],
        "description": "elapsedRaw > 1: cap decayed toxEma at (prevBidFee + prevAskFee)/2; ELAPSED_CAP=8."
      },
      {
        "rank": 2,
        "variant": "halfband_elapsed12",
        "seeds": [
          10000,
          10499
        ],
        "n": 500,
        "mean_diff": 0.016447729433503356,
        "se": 0.006252729651350902,
        "code_sha256": "888c2532a0a89d8a90b73b1625d94eb8bac009221e3403f1f4831860ef79c6fc",
        "worst": [
          {
            "seed": 10216,
            "diff": -0.501288328911869
          },
          {
            "seed": 10265,
            "diff": -0.44865619204904306
          },
          {
            "seed": 10103,
            "diff": -0.4356197428140831
          },
          {
            "seed": 10204,
            "diff": -0.405819476580632
          },
          {
            "seed": 10495,
            "diff": -0.3474544691648589
          }
        ],
        "description": "Same half-band cap after elapsedRaw > 1; ELAPSED_CAP=12."
      },
      {
        "rank": 3,
        "variant": "halfband_elapsed16",
        "seeds": [
          10000,
          10499
        ],
        "n": 500,
        "mean_diff": 0.015005027346159864,
        "se": 0.006325964157177531,
        "code_sha256": "c48542ea1edc74e6857daede23701f97e7dad592d9ef28806055238ebe088d5a",
        "worst": [
          {
            "seed": 10216,
            "diff": -0.5014149460291719
          },
          {
            "seed": 10265,
            "diff": -0.44917607386435066
          },
          {
            "seed": 10103,
            "diff": -0.43378451242745086
          },
          {
            "seed": 10204,
            "diff": -0.4067651105007144
          },
          {
            "seed": 10014,
            "diff": -0.3888476689791105
          }
        ],
        "description": "Same half-band cap after elapsedRaw > 1; ELAPSED_CAP=16."
      },
      {
        "rank": 4,
        "variant": "halfband_elapsed4",
        "seeds": [
          10000,
          10499
        ],
        "n": 500,
        "mean_diff": 0.013554407577121083,
        "se": 0.006620620676034431,
        "code_sha256": "2c1c299e4f7b8e624e998125dc0e3490a91dbb5de467877b7b3bb1367e493308",
        "worst": [
          {
            "seed": 10265,
            "diff": -0.5651597728162869
          },
          {
            "seed": 10204,
            "diff": -0.43297418698170986
          },
          {
            "seed": 10356,
            "diff": -0.3972018639065027
          },
          {
            "seed": 10103,
            "diff": -0.38652483105209967
          },
          {
            "seed": 10236,
            "diff": -0.3571561080665333
          }
        ],
        "description": "Same half-band cap after elapsedRaw > 1; ELAPSED_CAP=4."
      },
      {
        "rank": 5,
        "variant": "gap2",
        "seeds": [
          10000,
          10499
        ],
        "n": 500,
        "mean_diff": 0.0058819696979817305,
        "se": 0.0039676297034122185,
        "code_sha256": "463363754bcd4805d31e498e9a03ffddb9fa48a73a148a528a4b1a85850320c3",
        "worst": [
          {
            "seed": 10317,
            "diff": -0.5293385350034896
          },
          {
            "seed": 10005,
            "diff": -0.3145528709248424
          },
          {
            "seed": 10110,
            "diff": -0.29275988371432504
          },
          {
            "seed": 10200,
            "diff": -0.2629679678045136
          },
          {
            "seed": 10304,
            "diff": -0.2537542941980746
          }
        ],
        "description": "elapsedRaw > 2: cap decayed toxEma at the previous half-band; ELAPSED_CAP=8."
      },
      {
        "rank": 6,
        "variant": "halfband15",
        "seeds": [
          10000,
          10499
        ],
        "n": 500,
        "mean_diff": 0.0056787787323283965,
        "se": 0.002216010941611738,
        "code_sha256": "8dcbbd917de41d086da2ccde224a864a07eebbe3bee4ff4f1fdb07dedc6fe351",
        "worst": [
          {
            "seed": 10468,
            "diff": -0.31330457924400434
          },
          {
            "seed": 10307,
            "diff": -0.30556650188759704
          },
          {
            "seed": 10420,
            "diff": -0.23225220099095623
          },
          {
            "seed": 10232,
            "diff": -0.1836913374982032
          },
          {
            "seed": 10086,
            "diff": -0.17786312399255166
          }
        ],
        "description": "elapsedRaw > 1: cap decayed toxEma at 1.5 times the previous half-band; ELAPSED_CAP=8."
      },
      {
        "rank": 7,
        "variant": "protect",
        "seeds": [
          10000,
          10499
        ],
        "n": 500,
        "mean_diff": 0.0,
        "se": 0.0,
        "code_sha256": "71ca9ddd92cfeea6b64aed62593c38eb0843fd6a5d341d79df9f91a4455dd138",
        "worst": [
          {
            "seed": 10000,
            "diff": 0.0
          },
          {
            "seed": 10001,
            "diff": 0.0
          },
          {
            "seed": 10002,
            "diff": 0.0
          },
          {
            "seed": 10003,
            "diff": 0.0
          },
          {
            "seed": 10004,
            "diff": 0.0
          }
        ],
        "description": "elapsedRaw > 1: cap decayed toxEma at max(prevBidFee,prevAskFee), defining the protect fee as the larger previous fee; ELAPSED_CAP=8."
      }
    ]
  }
}
