{
 "item": "s1",
 "batch": "e03-pos-scale",
 "summary": "Position-in-step quoting inside V2 does NOT gain. Blending both sides toward a constant retail quote R with w=s*P(next trade is same-step retail) loses -14 to -57 per sim on every grid point (loss ~ linear in s, nearly independent of R): the cut lands mostly on the protecting (higher) side, and when no retail follows, the next step's arb pays the lowered fee. Attracting-side-only blending almost never triggers (that side is already <= R) and is worth ~+0.007, i.e. nothing. Frozen candidate (attracting side, R=34, s=0.5) on 2000 fresh holdout seeds: +0.0091 +- 0.0020 vs V2, of which +0.0022 comes from the gas trims alone (V2 OOGs 50 times on these seeds, candidate 0). Far from the +5.0 needed for top 10.",
 "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 = 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[16];\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 (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 = _sqrt(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\n        (bidFee, askFee) = _posBlend(bidFee, askFee, stepTradeCount, lambdaHat);\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[16] = spot;\n        slots[9] = toxEma; slots[10] = stepTradeCount;\n\n        return (bidFee, askFee);\n    }\n\n    // Position-in-step quoting: the returned fees price the NEXT trade. Retail orders per\n    // step ~ Poisson(lambda); after k prints in this step (first assumed to be the arb), the next\n    // trade is another same-step retail order with prob P(N >= k | N >= k-1). Blend each side\n    // toward a retail quote R by w = S * that probability, never raising a fee.\n    function _posBlend(uint256 bidFee, uint256 askFee, uint256 k, uint256 lambdaHat) internal pure returns (uint256, uint256) {\n        uint256 R = 34 * BPS;\n        uint256 lam = lambdaHat * 750 / 1000;\n        uint256 pj = _powWad(WAD - lam / 16, 16);\n        uint256 m = k > 0 ? k - 1 : 0;\n        if (m > 4) m = 4;\n        uint256 cdf = 0;\n        for (uint256 j = 0; j < m; j++) { cdf += pj; pj = pj * lam / ((j + 1) * WAD); }\n        uint256 tail = WAD > cdf ? WAD - cdf : 0;\n        if (tail <= pj) return (bidFee, askFee);\n        uint256 w = wmul(50 * WAD / 100, wdiv(tail - pj, tail));\n        if (bidFee <= askFee) { if (bidFee > R) bidFee -= wmul(w, bidFee - R); }\n        else { if (askFee > R) askFee -= wmul(w, askFee - R); }\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 _sqrt(uint256 x) internal pure returns (uint256 y) {\n        if (x == 0) return 0;\n        uint256 r = 1; uint256 t = x;\n        if (t >= 1 << 128) { t >>= 128; r <<= 64; }\n        if (t >= 1 << 64) { t >>= 64; r <<= 32; }\n        if (t >= 1 << 32) { t >>= 32; r <<= 16; }\n        if (t >= 1 << 16) { t >>= 16; r <<= 8; }\n        if (t >= 1 << 8) { t >>= 8; r <<= 4; }\n        if (t >= 1 << 4) { t >>= 4; r <<= 2; }\n        if (t >= 1 << 2) { r <<= 1; }\n        y = r << 1;\n        uint256 z = (x / y + y) / 2;\n        while (z < y) { y = z; z = (x / z + z) / 2; }\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    function getName() external pure override returns (string memory) { return \"no_cubic\"; }\n}\n",
 "sha256": "e4f9f3ff036dc2d0a26a3590ff8246daad6846ead816bd1f5e75caa569c34298",
 "design": "V2 with (1) gas trims that leave behavior identical to V2 when V2 does not OOG: afterInitialize zero writes dropped; dead slots[11] write and the REVERT_U(=0) branch removed; Babylonian sqrt started from a power-of-two upper bound (same floor result, far fewer iterations). (2) After V2's final clamped bidFee/askFee: k = prints this step incl. this one, first print assumed to be the arb, so m=min(k-1,4) retail seen; lambda_r = 0.75*lambdaHat; P = P(N>=m+1 | N>=m) for N~Poisson(lambda_r), exp(-x) ~ (1-x/16)^16; w = s*P; on the lower-fee (attracting) side only, if fee > R then fee -= w*(fee-R). Fees are never raised. Frozen: R=34 bps, s=0.5.",
 "tuning": [
  {
   "id": "b_28_50@90000-90256",
   "params": {
    "R_bps": 28,
    "s": 0.5,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -16.1359,
   "se": 0.3908,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_28_75@90000-90256",
   "params": {
    "R_bps": 28,
    "s": 0.75,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -33.6346,
   "se": 0.6666,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_28_100@90000-90256",
   "params": {
    "R_bps": 28,
    "s": 1.0,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -56.5896,
   "se": 1.0357,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_30_50@90000-90256",
   "params": {
    "R_bps": 30,
    "s": 0.5,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -15.5279,
   "se": 0.3867,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_30_75@90000-90256",
   "params": {
    "R_bps": 30,
    "s": 0.75,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -32.3301,
   "se": 0.6564,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_30_100@90000-90256",
   "params": {
    "R_bps": 30,
    "s": 1.0,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -54.3845,
   "se": 1.0206,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_32_50@90000-90256",
   "params": {
    "R_bps": 32,
    "s": 0.5,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -14.9375,
   "se": 0.3834,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_32_75@90000-90256",
   "params": {
    "R_bps": 32,
    "s": 0.75,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -31.0514,
   "se": 0.6482,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_32_100@90000-90256",
   "params": {
    "R_bps": 32,
    "s": 1.0,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -52.1901,
   "se": 0.9875,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_34_50@90000-90256",
   "params": {
    "R_bps": 34,
    "s": 0.5,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -14.4073,
   "se": 0.3793,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_34_75@90000-90256",
   "params": {
    "R_bps": 34,
    "s": 0.75,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -29.9,
   "se": 0.6465,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_34_100@90000-90256",
   "params": {
    "R_bps": 34,
    "s": 1.0,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -50.1906,
   "se": 0.9774,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "a_34_50@90000-90256",
   "params": {
    "R_bps": 34,
    "s": 0.5,
    "sides": "attracting (lower-fee side) only",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": 0.0059,
   "se": 0.0038,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "a_34_25@90000-90256",
   "params": {
    "R_bps": 34,
    "s": 0.25,
    "sides": "attracting (lower-fee side) only",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": 0.003,
   "se": 0.0023,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "b_36_25@90000-90256",
   "params": {
    "R_bps": 36,
    "s": 0.25,
    "sides": "both",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": -4.21,
   "se": 0.1807,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "a_36_25@90000-90256",
   "params": {
    "R_bps": 36,
    "s": 0.25,
    "sides": "attracting (lower-fee side) only",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 256,
   "mean_diff": 0.003,
   "se": 0.0019,
   "oog": 0,
   "v2_oog": 0
  },
  {
   "id": "a_34_50@92000-92512",
   "params": {
    "R_bps": 34,
    "s": 0.5,
    "sides": "attracting (lower-fee side) only",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 512,
   "mean_diff": 0.0111,
   "se": 0.0036,
   "oog": 0,
   "v2_oog": 13
  },
  {
   "id": "a_34_25@92000-92512",
   "params": {
    "R_bps": 34,
    "s": 0.25,
    "sides": "attracting (lower-fee side) only",
    "lambda_retail": "0.75*lambdaHat"
   },
   "n": 512,
   "mean_diff": 0.0054,
   "se": 0.0028,
   "oog": 0,
   "v2_oog": 13
  }
 ],
 "frozen": "a_34_50 (attracting side only, R=34 bps, s=0.5); chosen as best of 16 screened, confirmed on 92000..92511 (+0.0111 +- 0.0036)",
 "paired": {
  "n": 2000,
  "mean_diff": 0.00912789245689291,
  "se": 0.001966565521904298,
  "sd": 0.08794748378370724,
  "worst": [
   {
    "seed": 4160505,
    "diff": -0.46881704359708465,
    "edge": 486.5841469417705,
    "v2_edge": 487.05296398536757
   },
   {
    "seed": 4160698,
    "diff": -0.4241797138644188,
    "edge": 626.5787269882777,
    "v2_edge": 627.0029067021421
   },
   {
    "seed": 4160406,
    "diff": -0.42241951495043395,
    "edge": 452.60125252904277,
    "v2_edge": 453.0236720439932
   },
   {
    "seed": 4161922,
    "diff": -0.37440101537754344,
    "edge": 583.0798558942712,
    "v2_edge": 583.4542569096487
   },
   {
    "seed": 4161523,
    "diff": -0.37177063789954445,
    "edge": 654.1590124465516,
    "v2_edge": 654.5307830844512
   }
  ]
 },
 "gas": {
  "max_ok": 237051,
  "oog": 0,
  "reverts": 0,
  "other_halts": 0,
  "init_max": 220920,
  "afterSwap_calls": 20686075
 },
 "v2_gas": {
  "max_ok": 244137,
  "oog": 50,
  "reverts": 0,
  "other_halts": 0,
  "init_max": 236377,
  "afterSwap_calls": 20683922
 },
 "valid": "candidate oog 0 <= V2 oog 50 on the same holdout seeds (valid under the 02:28Z rule); the harness's strict rule marks the V2 run itself invalid for its OOGs",
 "control_trim_only": {
  "desc": "V2 + gas trims only (no fee change), same holdout",
  "sha256": "93f31737c484fd7a35ac3565a793a78e6ca4ad9603a97e1d09b1f10daa306043",
  "n": 2000,
  "mean_diff": 0.0021563681100151373,
  "se": 0.0007249924641561697,
  "n_nonzero": 22,
  "oog": 0,
  "max_ok": 235486,
  "note": "edges identical to V2 on all seeds except the 22 where V2 OOGs; 128-seed check 90000..90127 gave diff exactly 0"
 },
 "v2_mean_edge_holdout": 525.2822817594434,
 "seeds": {
  "screen": [
   90000,
   90256
  ],
  "stage2": [
   92000,
   92512
  ],
  "holdout": [
   4160000,
   4162000
  ],
  "holdout_fresh": true
 },
 "validate": "amm-match validate: Strategy 'no_cubic' validated successfully!",
 "method": "amm-challenge @6b6921f8, scratch/setup.sh + instrumentation.patch from artifact 02c134d9...; per strategy one amm_sim_rs.run_batch(X, Vanilla, configs, 8) with configs from the harness's build_configs (MatchRunner._build_configs); V2 run once per seed block and every candidate paired against it by seed.",
 "blocked": null
}