{
  "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 PHAT_ALPHA_SAME = 120000000000000000;\n    uint256 constant REVERT_U = 0;\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[3] = WAD; \n        slots[5] = initialX > 0 ? wdiv(initialY, initialX) : 100 * WAD;\n        slots[6] = 950000000000000; slots[7] = 800000000000000000; slots[8] = 2000000000000000;\n        slots[13] = 902500000000; slots[14] = slots[5]; \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 = uint64(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        uint256 sigmaForFast = sigmaHat;\n        uint256 fastHat = slots[14];\n        uint256 uncertainty = slots[13];\n        uint256 silent = trade.timestamp > lastTs ? trade.timestamp - lastTs : 0;\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 (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            uncertainty += wmul(sigmaForFast, sigmaForFast) * elapsedRaw;\n            if (uncertainty > 100000000000000) uncertainty = 100000000000000;\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        // S: infer a no-trade interval center from the last post-trade spot.\n        uint256 silenceScale = WAD;\n        if (firstInStep && silent > 1) {\n            uint256 g = silent - 1;\n            if (g > 1) g = 1;\n            uint256 w = WAD - _powWad(800000000000000000, g);\n            uint256 s = slots[2] >> 64;\n            if (s == 0) s = pHat;\n            uint256 c = (wmul(s, WAD - prevBidFee) + wdiv(s, WAD - prevAskFee)) / 2;\n            if (c >= pHat) pHat += wmul(w, c - pHat);\n            else pHat -= wmul(w, pHat - c);\n            silenceScale = WAD - wmul(300000000000000000, w);\n        }\n\n        {\n            uint256 ret = pHat > 0 ? wdiv(absDiff(pImplied, pHat), pHat) : 0;\n            uint256 alpha = firstInStep ? PHAT_ALPHA : PHAT_ALPHA_RETAIL;\n            uint256 prePhat = pHat;\n            bool secondPrint = !firstInStep && stepTradeCount == 1;\n            bool sameDir = false; bool oppDir = false;\n            if (secondPrint) {\n                bool up2 = pImplied >= pHat;\n                uint256 d1 = slots[12];\n                if (d1 != 0) { sameDir = (d1 == 1) == up2; oppDir = !sameDir; }\n                if (sameDir) alpha = PHAT_ALPHA_SAME;\n            }\n            if (firstInStep) { slots[12] = pImplied >= pHat ? 1 : 2; }\n            uint256 adaptiveGate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (adaptiveGate < MIN_GATE) adaptiveGate = MIN_GATE;\n            alpha = wmul(alpha, silenceScale);\n            adaptiveGate = wmul(adaptiveGate, silenceScale);\n            if (ret <= adaptiveGate) { pHat = wmul(pHat, WAD - alpha) + wmul(pImplied, alpha); }\n            if (oppDir && REVERT_U > 0) {\n                uint256 pre = slots[11];\n                if (pre > pHat) pHat = pHat + wmul(pre - pHat, REVERT_U);\n                else pHat = pHat - wmul(pHat - pre, REVERT_U);\n            }\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        // Interior retail routing equalizes fee-adjusted marginal prices.\n        // Subsequent trades in a step cannot be the initial arbitrage trade.\n        if (!firstInStep && feeUsed > 30 * BPS && gamma > 0) {\n            uint256 normalSpot = trade.isBuy\n                ? wdiv(wmul(spot, gamma), WAD - 30 * BPS)\n                : wdiv(wmul(spot, WAD - 30 * BPS), gamma);\n            pHat = wmul(pHat, 90 * WAD / 100) + wmul(normalSpot, 10 * WAD / 100);\n        }\n\n        {\n            uint256 ret = fastHat > 0 ? wdiv(absDiff(pImplied, fastHat), fastHat) : 0;\n            uint256 alpha;\n            if (firstInStep) {\n                uint256 processSigma = sigmaForFast;\n                uint256 obsVar = uncertainty + wmul(processSigma, processSigma);\n                uint256 probArb;\n                uint256 z2 = wdiv(wmul(ret, ret), obsVar);\n                uint256 density = _powWad(wdiv(WAD, WAD + z2 / 16), 8);\n                uint256 sigmaObs = _isqrt(obsVar * WAD);\n                uint256 odds = wmul(density, wdiv(6700000000000000, sigmaObs));\n                bool arbFlag = ret <= wmul(sigmaForFast, 1220000000000000000);\n                uint256 prior = arbFlag ? 650000000000000000 : 400000000000000000;\n                uint256 tr = trade.reserveY > 0 ? wdiv(trade.amountY, trade.reserveY) : 0;\n                if (tr > 3000000000000000) prior = wmul(prior, 6 * WAD / 10);\n                if (silent > 1) prior = wmul(prior, 8 * WAD / 10);\n                odds = wmul(odds, wdiv(prior, WAD - prior));\n                probArb = wdiv(odds, WAD + odds);\n                alpha = wmul(probArb, 600000000000000000) + wmul(WAD - probArb, 80000000000000000);\n                slots[15] = pImplied >= fastHat ? 1 : 2;\n                uncertainty = wmul(uncertainty, WAD - alpha);\n            } else {\n                if ((slots[15] == 1) == (pImplied >= fastHat)) alpha = PHAT_ALPHA_RETAIL;\n            }\n            uint256 gate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (gate < MIN_GATE) gate = MIN_GATE;\n            if (ret <= gate) fastHat = wmul(fastHat, WAD - alpha) + wmul(pImplied, alpha);\n            slots[13] = uncertainty;\n        }\n\n        if (!firstInStep && feeUsed > 30 * BPS && gamma > 0) {\n            uint256 normalObs = trade.isBuy\n                ? wdiv(wmul(spot, gamma), WAD - 30 * BPS)\n                : wdiv(wmul(spot, WAD - 30 * BPS), gamma);\n            if ((slots[15] == 1) == (normalObs >= fastHat)) {\n                fastHat = wmul(fastHat, 9 * WAD / 10) + wmul(normalObs, WAD / 10);\n            }\n        }\n        slots[14] = fastHat;\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 staleHat = wmul(pHat, 700000000000000000) + wmul(fastHat, 300000000000000000);\n            uint256 staleTox = wdiv(absDiff(spot, staleHat), staleHat);\n            if (staleTox > TOX_CAP) staleTox = TOX_CAP;\n            uint256 staleShift = wmul(STALE_DIR_COEF, staleTox);\n            uint256 attractShift = wmul(staleShift, STALE_ATTRACT_FRAC);\n            if (spot >= staleHat) {\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        // Preserve the stale mapping, capping only the non-exposed side.\n        if (bidFee > askFee && askFee > 36 * BPS) askFee = 36 * BPS;\n        else if (askFee > bidFee && bidFee > 36 * BPS) bidFee = 36 * BPS;\n\n        slots[0] = bidFee; slots[1] = askFee; slots[2] = (spot << 64) | 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        while (exp > 0) {\n            if (exp & 1 == 1) result = wmul(result, factor);\n            factor = wmul(factor, factor);\n            exp >>= 1;\n        }\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    // Floor square root: bit-length seed and seven Newton steps (all uint256).\n    function _isqrt(uint256 x) internal pure returns (uint256 r) {\n        if (x == 0) return 0;\n        unchecked {\n            uint256 y = x;\n            r = 1;\n            if (y >> 128 != 0) { y >>= 128; r <<= 64; }\n            if (y >> 64 != 0) { y >>= 64; r <<= 32; }\n            if (y >> 32 != 0) { y >>= 32; r <<= 16; }\n            if (y >> 16 != 0) { y >>= 16; r <<= 8; }\n            if (y >> 8 != 0) { y >>= 8; r <<= 4; }\n            if (y >> 4 != 0) { y >>= 4; r <<= 2; }\n            if (y >> 2 != 0) { r <<= 1; }\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            uint256 t = x / r;\n            return r < t ? r : t;\n        }\n    }\n\n    function getName() external pure override returns (string memory) { return \"no_cubic\"; }\n}\n",
  "sha256": "4d91a9de8abd4adfed1b58ab995c9c2a3a79e1266e1b3a14dc4f0ea0b7159ce3",
  "base_sha256": "610c1905e7dd5559b84e40a3b2d6f8e0b53a7b0ac7574ae33b6c1770a28367cb",
  "comparator_sha256": "28417e116f57f1029fdd1803832e852574902c1ae7253c05657f317db76da4ab",
  "selected": {
    "id": "cap_30",
    "params": {
      "mode": "cap",
      "F0_bps": 30
    }
  },
  "variants": [
    {
      "id": "floor_28",
      "params": {
        "mode": "floor",
        "F0_bps": 28
      },
      "sha256": "af20b325659f4c9543ad186084f7fd2edb85e27c386fd5ec23533a03e7e91a47",
      "phase": "screen",
      "n": 256,
      "mean_diff": -24.419198548026667,
      "se": 0.30251284543938384,
      "oog": 0,
      "v2_oog": 1,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "floor_30",
      "params": {
        "mode": "floor",
        "F0_bps": 30
      },
      "sha256": "761c4a9f05893bcc52b1de19710950fa4a29b99ce16cf6ca938fb7cd130668e9",
      "phase": "screen",
      "n": 256,
      "mean_diff": -25.29660158323802,
      "se": 0.298532498476591,
      "oog": 0,
      "v2_oog": 1,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "floor_32",
      "params": {
        "mode": "floor",
        "F0_bps": 32
      },
      "sha256": "3a95a67dcdf9b9d326ea2519bd33cebb5b9e097356c9dc7e8c711ee542fb2840",
      "phase": "screen",
      "n": 256,
      "mean_diff": -26.60428477384718,
      "se": 0.2980553444450357,
      "oog": 0,
      "v2_oog": 1,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "floor_34",
      "params": {
        "mode": "floor",
        "F0_bps": 34
      },
      "sha256": "b9f3d43f894e9ebeee1dab6c8ce09810369a2bcc7c8899b0edef89590c98e3a9",
      "phase": "screen",
      "n": 256,
      "mean_diff": -27.951844174946537,
      "se": 0.2995031313452829,
      "oog": 0,
      "v2_oog": 1,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "active_floor_28",
      "params": {
        "mode": "active_floor",
        "F0_bps": 28
      },
      "sha256": "5e07d785ef6aab64c1dfae7e30a4b270545ab8a3b58954cf820739520131b77e",
      "phase": "screen",
      "n": 256,
      "mean_diff": -24.419198548026667,
      "se": 0.30251284543938384,
      "oog": 0,
      "v2_oog": 1,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "active_floor_30",
      "params": {
        "mode": "active_floor",
        "F0_bps": 30
      },
      "sha256": "15ff802f8a571bc25c091db7f0c59f11ec036fd201c68fadb4e1403ebff70e8a",
      "phase": "screen",
      "n": 256,
      "mean_diff": -25.29660158323802,
      "se": 0.298532498476591,
      "oog": 0,
      "v2_oog": 1,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "active_floor_32",
      "params": {
        "mode": "active_floor",
        "F0_bps": 32
      },
      "sha256": "6963c04f5a5942fc4687c277617692569690acac770f92a8414709168c8257c8",
      "phase": "screen",
      "n": 256,
      "mean_diff": -26.60428477384718,
      "se": 0.2980553444450357,
      "oog": 0,
      "v2_oog": 1,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "active_floor_34",
      "params": {
        "mode": "active_floor",
        "F0_bps": 34
      },
      "sha256": "a828214bb8a39fbe8551af9526997e62ed6babb532d25335d084f3d5cf5e3024",
      "phase": "screen",
      "n": 256,
      "mean_diff": -27.951844174946537,
      "se": 0.2995031313452829,
      "oog": 0,
      "v2_oog": 1,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "cap_30",
      "params": {
        "mode": "cap",
        "F0_bps": 30
      },
      "sha256": "4d91a9de8abd4adfed1b58ab995c9c2a3a79e1266e1b3a14dc4f0ea0b7159ce3",
      "phase": "screen",
      "n": 256,
      "mean_diff": 0.026711764117092418,
      "se": 0.005571333971853078,
      "oog": 0,
      "v2_oog": 1,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "cap_30",
      "params": {
        "mode": "cap",
        "F0_bps": 30
      },
      "sha256": "4d91a9de8abd4adfed1b58ab995c9c2a3a79e1266e1b3a14dc4f0ea0b7159ce3",
      "phase": "semifinal",
      "n": 512,
      "mean_diff": 0.017741785445384517,
      "se": 0.004465141620488652,
      "oog": 0,
      "v2_oog": 8,
      "valid": true,
      "validation": "amm-match validate passed"
    },
    {
      "id": "floor_28",
      "params": {
        "mode": "floor",
        "F0_bps": 28
      },
      "sha256": "af20b325659f4c9543ad186084f7fd2edb85e27c386fd5ec23533a03e7e91a47",
      "phase": "semifinal",
      "n": 512,
      "mean_diff": -24.83950960754202,
      "se": 0.21926838734854365,
      "oog": 0,
      "v2_oog": 8,
      "valid": true,
      "validation": "amm-match validate passed"
    }
  ],
  "paired": {
    "label": "candidate_minus_V2",
    "n": 2000,
    "mean_diff": 0.008045870245341973,
    "se": 0.002538206386477691,
    "sd": 0.1135120404217644,
    "n_nonzero": 2000,
    "max_abs_diff": 1.2051473337569405,
    "worst": [
      {
        "seed": 4350435,
        "diff": -1.2051473337569405,
        "edge_a": 622.6091942044202,
        "edge_b": 623.8143415381771
      },
      {
        "seed": 4350586,
        "diff": -1.1776813762869551,
        "edge_a": 687.8285915246512,
        "edge_b": 689.0062729009381
      },
      {
        "seed": 4350060,
        "diff": -1.040844040634397,
        "edge_a": 654.7638940855171,
        "edge_b": 655.8047381261515
      },
      {
        "seed": 4350026,
        "diff": -0.7198022607983603,
        "edge_a": 536.7123038920344,
        "edge_b": 537.4321061528327
      },
      {
        "seed": 4351290,
        "diff": -0.7167990571290375,
        "edge_a": 712.8897711570562,
        "edge_b": 713.6065702141852
      }
    ]
  },
  "split": {
    "cand": {
      "retail": 553.263541322128,
      "arb": -27.56066531553525
    },
    "v2": {
      "retail": 553.2529892337586,
      "arb": -27.558159097411174
    },
    "terciles": [
      {
        "n": 667,
        "mean_diff": 0.005728251030476365,
        "se": 0.0024322557159224116,
        "v2_retail_volume_y_min": 55986.15640322939,
        "v2_retail_volume_y_max": 70654.61280824397
      },
      {
        "n": 667,
        "mean_diff": 0.015319925397694594,
        "se": 0.0043127536868860575,
        "v2_retail_volume_y_min": 70659.68156452873,
        "v2_retail_volume_y_max": 81494.92991725134
      },
      {
        "n": 666,
        "mean_diff": 0.0030819922118527276,
        "se": 0.005782954716190069,
        "v2_retail_volume_y_min": 81509.56821286795,
        "v2_retail_volume_y_max": 98634.78777765152
      }
    ]
  },
  "gas": {
    "max_ok": 213312,
    "max_ok_all_callbacks": 220944,
    "oog": 0,
    "reverts": 0,
    "other_halts": 0,
    "init_max": 220944,
    "tx_errors": 0,
    "bad_returns": 0,
    "swap_calls": 20650997,
    "oog_seeds": []
  },
  "v2_gas": {
    "max_ok": 244149,
    "max_ok_all_callbacks": 244149,
    "oog": 31,
    "reverts": 0,
    "other_halts": 0,
    "init_max": 236377,
    "tx_errors": 0,
    "bad_returns": 0,
    "swap_calls": 20645733,
    "oog_seeds": [
      [
        4350055,
        3
      ],
      [
        4350062,
        1
      ],
      [
        4350157,
        1
      ],
      [
        4350220,
        2
      ],
      [
        4350282,
        2
      ],
      [
        4350332,
        2
      ],
      [
        4350491,
        1
      ],
      [
        4350569,
        2
      ],
      [
        4350784,
        2
      ],
      [
        4350908,
        2
      ],
      [
        4350986,
        2
      ],
      [
        4351220,
        1
      ],
      [
        4351369,
        2
      ],
      [
        4351463,
        1
      ],
      [
        4351539,
        2
      ],
      [
        4351659,
        1
      ],
      [
        4351670,
        3
      ],
      [
        4351926,
        1
      ]
    ]
  },
  "seeds": {
    "screen": {
      "from_inclusive": 70000,
      "to_inclusive": 70255,
      "n": 256
    },
    "semifinal": {
      "from_inclusive": 72000,
      "to_inclusive": 72511,
      "n": 512
    },
    "holdout": {
      "from_inclusive": 4350000,
      "to_inclusive": 4351999,
      "n": 2000
    }
  },
  "valid": true,
  "blocked": null,
  "invalid_reasons": [],
  "diagnostics": {
    "v2_oog_seed_pairs": {
      "n": 18,
      "mean_diff": 0.19351687505936058,
      "se": 0.06772424156058153
    },
    "v2_no_oog_seed_pairs": {
      "n": 1982,
      "mean_diff": 0.006361471614336759,
      "se": 0.0024583493911691403
    },
    "interpretation": "Comparison includes gas trims as well as fee changes; not an isolated estimate of the fee mapping alone."
  },
  "method": {
    "simulator_commit": "6b6921f8d463314aa7c96234e1be25a25245f704",
    "steps": 10000,
    "afterSwap_gas_cap": 250000,
    "workers": 8,
    "market": "Each strategy separately versus VanillaStrategy; never candidate and V2 in the same market.",
    "configs": "MatchRunner draws: default_rng(seed), size, rate, sigma; price seed=seed; retail seed=seed+1.",
    "paired": "Candidate submission edge minus exact V2 submission edge per seed. SE = sample standard deviation of paired differences / sqrt(n).",
    "split": "Means of retail-only and arb-only submission edge, not volume or normalized by Vanilla.",
    "terciles": "Ascending V2 submission retail_volume_y on holdout; array_split into 667,667,666, ties by seed.",
    "gas": "Holdout only. max_ok is successful afterSwap gas maximum. init_max is successful afterInitialize gas maximum. OOG counted across callbacks, including V2 failures. Original keep-previous-fees fallback unchanged.",
    "freeze": "Candidate source and SHA-256 saved before either holdout run; no holdout seed reused for tuning.",
    "freeze_unix_time": 1794109500.6970336,
    "floor": "Keep estimators including silence inference. Snapshot fees before staleShift/attractShift, retain tradeBoost, apply original tail compression and clamp, then max(F0, no-stale fee) on the side having the lower final V2 fee. Equal final V2 fees are unchanged. Active floor gate: silent > 1 or staleShift > 0.",
    "cap": "The single cap variant uses F0=30bps: keeps stale shift and min(non-exposed final V2 fee,36bps). Equal fees unchanged.",
    "selection": "Top two by 256-seed paired mean, preferring valid runs; better 512-seed paired mean frozen.",
    "observed_reconciliation_error_max": 7.844391802791506e-12,
    "gas_counter_reconciliation": true,
    "normalizer_failures": 0
  },
  "checks": {
    "harness_selftests": {
      "matchrunner_equal_10000_10031": true,
      "far_block_len": 4,
      "far_block_seconds": 0.0001,
      "allocation_scales_with_n": true,
      "far_seed_equals_single": true,
      "validity_cases": {
        "cand_oog_equal_v2_valid": true,
        "cand_oog_less_valid": true,
        "cand_oog_more_invalid": true,
        "v2_oog_alone_not_invalid": true,
        "revert_invalid": true,
        "ref_revert_invalid": true,
        "vanilla_oog_invalid": true,
        "vanilla_other_invalid": true,
        "incomplete_invalid": true,
        "control_oog_match_valid": true,
        "control_oog_mismatch_invalid": true
      },
      "all_pass": true
    },
    "variant_validation_count": 9,
    "base_hash_matches": true,
    "comparator_hash_matches": true,
    "holdout_complete": true
  }
}
