{
 "item": "phase",
 "batch": "e03-pilot-rerun",
 "summary": "Rerun of the phase (unknown-next-event mixture) fee-rule pilot, measured this time under the corrected OOG rule. Every variant in the brief's band (retail quote 28..36 bps, retail weight 0.3..0.9) loses to V2; the best, a flat 0.9/0.1 mixture of a 28 bps retail quote and V2's arb-style fee with the stale-price lean, is -5.87 +/- 0.08 edge per seed vs V2 on 2000 fresh holdout seeds (valid: OOG count equals V2's on the same seeds, no reverts). A constant 35 bps quote with no lean loses ~179/seed, so the stale-price lean, not the midpoint level, carries almost all of V2's edge; this family cannot deliver the +5.0 needed for top 10. Negative result.",
 "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;\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 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            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            bool secondPrint = !firstInStep && stepTradeCount == 1;\n            bool sameDir = false;\n            if (secondPrint) {\n                bool up2 = pImplied >= pHat;\n                uint256 d1 = slots[12];\n                if (d1 != 0) { sameDir = (d1 == 1) == up2; }\n                if (sameDir) alpha = PHAT_ALPHA_SAME;\n            }\n            if (firstInStep) { slots[11] = pHat; 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            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        // Policy mixture: continuing retail flow versus a new-step arbitrage.\n        // The next event is unobserved; gate only on the history available now.\n        uint256 retailWeight = 90 * WAD / 100;\n        if (stepTradeCount >= 2) retailWeight = retailWeight * 100 / 100;\n        if (stepTradeCount >= 3) retailWeight = retailWeight * 100 / 100;\n        bool aligned = (trade.isBuy && spot >= pHat) || (!trade.isBuy && spot < pHat);\n        if (aligned) retailWeight = retailWeight * 100 / 100;\n        if (silent > 1) retailWeight = retailWeight * 100 / 100;\n\n        uint256 flowSize = wmul(lambdaHat, sizeHat);\n        uint256 retailMid = 28 * BPS;\n        uint256 arbMid = BASE_FEE + wmul(600000000000000000, sigmaHat)\n            + wmul(LAMBDA_COEF, lambdaHat) + wmul(FLOW_SIZE_COEF, flowSize)\n            + wmul(ACT_COEF, actEma) + wmul(TOX_COEF, toxSignal);\n        uint256 mid = wmul(retailWeight, retailMid) + wmul(WAD - retailWeight, arbMid);\n        uint256 staleHat = wmul(pHat, 700000000000000000) + wmul(fastHat, 300000000000000000);\n        uint256 deviation = wdiv(absDiff(spot, staleHat), staleHat);\n        if (deviation > TOX_CAP) deviation = TOX_CAP;\n        uint256 shiftCoef = wmul(retailWeight, 85 * WAD / 100)\n            + wmul(WAD - retailWeight, 60 * WAD / 100);\n        uint256 shift = wmul(deviation, shiftCoef);\n        uint256 bidFee; uint256 askFee;\n        if (spot >= staleHat) {\n            bidFee = mid + shift;\n            askFee = mid > shift ? mid - shift : 0;\n        } else {\n            askFee = mid + shift;\n            bidFee = mid > shift ? mid - shift : 0;\n        }\n        // Only the arb component pays the price-impact protection premium.\n        if (aligned) {\n            uint256 boost = wmul(WAD - retailWeight, wmul(TRADE_TOX_BOOST, tradeRatio));\n            if (trade.isBuy) bidFee += boost; else askFee += boost;\n        }\n        bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_PROTECT));\n        askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_PROTECT));\n\n        slots[0] = bidFee; slots[1] = askFee; slots[2] = trade.timestamp;\n        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    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\n    function getName() external pure override returns (string memory) { return \"phase_r28_w90_flat\"; }\n}\n",
 "sha256": "474130d061ff868ae16982f22ad194dc6ea2ea2413ceacfc719346695ab31aa7",
 "name": "phase_r28_w90_flat",
 "validate": "amm-match validate: Strategy 'phase_r28_w90_flat' validated successfully!",
 "design": {
  "base": "Candidate build 4438d3e1 (sha256 55da243087ca8e6e2fa9bf278001034bdd507c826b0a31cad9ac1b41334ddbef): V2's estimators (pHat, fastHat, sigmaHat, lambdaHat, sizeHat, actEma, toxEma, uncertainty) kept; V2's fee mapping replaced by a mixture of a retail-facing quote and an arb-facing quote.",
  "fee_rule": "retailWeight w (constant, 'flat': no decay with within-step count, no alignment or silent-gap multiplier). retailMid = R bps constant (R=28). arbMid = 4bps + 0.6*sigmaHat + 12bps*lambdaHat + 0.4842*lambdaHat*sizeHat + 9.1843*actEma + 0.03*toxEma. mid = w*retailMid + (1-w)*arbMid. staleHat = 0.7*pHat + 0.3*fastHat; deviation = |spot-staleHat|/staleHat capped 20%; shift = deviation*(0.85*w + 0.60*(1-w)); the side the spot has drifted toward quotes mid+shift, the other mid-shift (floored at 0). Aligned trades add (1-w)*0.35*tradeRatio to the hit side. Tail compression above 600 bps at slope 0.93, then clampFee.",
  "gas_trim": "dirState estimator (unread by this mapping) removed with its slot-3 read/write and _decayCentered; afterInitialize zero writes removed; dead REVERT_U/oppDir code and unused local removed (needed to avoid via-IR stack-too-deep). afterSwap max_ok 240,852 vs V2 244,198 on holdout; init 198,826 vs 236,377.",
  "inputs": "Only TradeInfo fields, stored state, within-step count and the observed timestamp gap. The true price and the seed are never read.",
  "retail_quote_band": "Retail-facing quote R*w + (1-w)*arbMid; with R=28 and w=0.9 the retail component is at the bottom of the 28..36 band; screening showed lower R and higher w monotonically better within the band (36 < 32 < 28 bps; 0.3 < 0.5 < 0.7 < 0.9), i.e. the family improves as it approaches a lean-only rule and still loses.",
  "why_it_loses": "Anchors on seeds 50000..50255: constant 35 bps, no lean = -179.5 +/- 3.0 vs V2; 35 bps with lean only (shift 0.85*deviation) = -12.3 +/- 0.16. The lean against the stale-price deviation (arb protection) is what V2's edge rests on; blending in a fixed retail midpoint only removes V2's state-dependent level terms and costs 6..17 per seed."
 },
 "tuning": [
  {
   "id": "phase_r35_const",
   "stage": "screen",
   "params": {
    "weight": 100,
    "retail_bps": 35,
    "count_mult": 100,
    "aligned_mult": 100,
    "silent_mult": 100,
    "retail_shift": 0
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -179.490504637484,
   "se": 2.9902731210569993,
   "gas_max_ok": 239892,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r35_lean",
   "stage": "screen",
   "params": {
    "weight": 100,
    "retail_bps": 35,
    "count_mult": 100,
    "aligned_mult": 100,
    "silent_mult": 100,
    "retail_shift": 85
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -12.285903885342949,
   "se": 0.1567401716203625,
   "gas_max_ok": 239997,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r36_w90",
   "stage": "screen",
   "params": {
    "weight": 90,
    "retail_bps": 36
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -14.172060269689519,
   "se": 0.16221092831220582,
   "gas_max_ok": 239995,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r32_w90",
   "stage": "screen",
   "params": {
    "weight": 90,
    "retail_bps": 32
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -10.930726283498721,
   "se": 0.13275284731634032,
   "gas_max_ok": 239995,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r34_w90_flat",
   "stage": "screen",
   "params": {
    "weight": 90,
    "retail_bps": 34,
    "count_mult": 100,
    "aligned_mult": 100,
    "silent_mult": 100
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -10.891168298351866,
   "se": 0.14387359085492574,
   "gas_max_ok": 239997,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r28_w90",
   "stage": "screen",
   "params": {
    "weight": 90,
    "retail_bps": 28
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -8.113529057109929,
   "se": 0.11406435622119061,
   "gas_max_ok": 239995,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r28_w70",
   "stage": "screen",
   "params": {
    "weight": 70,
    "retail_bps": 28
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -10.425954917052813,
   "se": 0.13083630389415676,
   "gas_max_ok": 239989,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r32_w70",
   "stage": "screen",
   "params": {
    "weight": 70,
    "retail_bps": 32
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -13.205369841720096,
   "se": 0.15481173001199666,
   "gas_max_ok": 239989,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r32_w50",
   "stage": "screen",
   "params": {
    "weight": 50,
    "retail_bps": 32
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -17.204599116419168,
   "se": 0.190358715813802,
   "gas_max_ok": 239995,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r32_w70_flat",
   "stage": "screen",
   "params": {
    "weight": 70,
    "retail_bps": 32,
    "count_mult": 100,
    "aligned_mult": 100,
    "silent_mult": 100
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -9.857756544645992,
   "se": 0.12748796017855402,
   "gas_max_ok": 239991,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r36_w70",
   "stage": "screen",
   "params": {
    "weight": 70,
    "retail_bps": 36
   },
   "seeds": [
    50000,
    50256
   ],
   "n": 256,
   "mean_diff": -16.123457843042868,
   "se": 0.1773825970973732,
   "gas_max_ok": 239989,
   "oog": 0,
   "v2_oog": 0,
   "v2_max_ok": 243032
  },
  {
   "id": "phase_r28_w90",
   "stage": "top2",
   "params": {
    "weight": 90,
    "retail_bps": 28
   },
   "seeds": [
    52000,
    52512
   ],
   "n": 512,
   "mean_diff": -7.995102544630145,
   "se": 0.09235655213552506,
   "gas_max_ok": 240073,
   "oog": 4,
   "v2_oog": 4,
   "v2_max_ok": 243457
  },
  {
   "id": "phase_r28_w90_flat",
   "stage": "top2",
   "params": {
    "weight": 90,
    "retail_bps": 28,
    "count_mult": 100,
    "aligned_mult": 100,
    "silent_mult": 100
   },
   "seeds": [
    52000,
    52512
   ],
   "n": 512,
   "mean_diff": -5.691113514931607,
   "se": 0.07992503045280638,
   "gas_max_ok": 240075,
   "oog": 4,
   "v2_oog": 4,
   "v2_max_ok": 243457
  },
  {
   "id": "phase_r32_w70_flat",
   "stage": "top2",
   "params": {
    "weight": 70,
    "retail_bps": 32,
    "count_mult": 100,
    "aligned_mult": 100,
    "silent_mult": 100
   },
   "seeds": [
    52000,
    52512
   ],
   "n": 512,
   "mean_diff": -9.746966124231147,
   "se": 0.10399447614503668,
   "gas_max_ok": 240069,
   "oog": 4,
   "v2_oog": 4,
   "v2_max_ok": 243457
  }
 ],
 "paired": {
  "n": 2000,
  "mean_diff": -5.876322692535861,
  "se": 0.039502092198296035,
  "sd": 1.766587268177081,
  "worst": [
   {
    "seed": 4081111,
    "diff": -11.672337059223992,
    "edge": 687.3095629612485,
    "v2_edge": 698.9819000204725
   },
   {
    "seed": 4080195,
    "diff": -11.565226083317043,
    "edge": 605.7881557830128,
    "v2_edge": 617.3533818663299
   },
   {
    "seed": 4081314,
    "diff": -11.090540343096109,
    "edge": 546.1029872982374,
    "v2_edge": 557.1935276413335
   },
   {
    "seed": 4080737,
    "diff": -10.995341730060375,
    "edge": 453.2005465308543,
    "v2_edge": 464.19588826091467
   },
   {
    "seed": 4080609,
    "diff": -10.988738543007344,
    "edge": 526.3300611141966,
    "v2_edge": 537.318799657204
   }
  ],
  "candidate_mean_edge": 518.6155957306158,
  "v2_mean_edge": 524.4919184231516,
  "seeds": [
   4080000,
   4082000
  ],
  "chunks": [
   [
    4080000,
    4080500
   ],
   [
    4080500,
    4081000
   ],
   [
    4081000,
    4081500
   ],
   [
    4081500,
    4082000
   ]
  ],
  "per_chunk": [
   {
    "seeds": [
     4080000,
     4080500
    ],
    "n": 500,
    "mean_diff": -5.854682382330535,
    "se": 0.08226186042493977
   },
   {
    "seeds": [
     4080500,
     4081000
    ],
    "n": 500,
    "mean_diff": -5.860503478088024,
    "se": 0.08080378701959533
   },
   {
    "seeds": [
     4081000,
     4081500
    ],
    "n": 500,
    "mean_diff": -5.917644323200309,
    "se": 0.07587836679719465
   },
   {
    "seeds": [
     4081500,
     4082000
    ],
    "n": 500,
    "mean_diff": -5.872460586524573,
    "se": 0.07710697588421206
   }
  ],
  "note": "edge(candidate) - edge(V2) per seed, each strategy alone vs VanillaStrategy in separate run_batch calls, configs as MatchRunner._build_configs (verified equal for the slice builder), 8 workers; the 2000 seeds were run in four 500-seed chunks (per-command time cap) and combined exactly from per-chunk n/mean/sd."
 },
 "gas": {
  "max_ok": 240852,
  "oog": 37,
  "reverts": 0,
  "other_halts": 0,
  "init_max": 198826,
  "oog_by_chunk": [
   13,
   4,
   11,
   9
  ],
  "limit": 250000
 },
 "v2_gas": {
  "max_ok": 244198,
  "oog": 37,
  "reverts": 0,
  "other_halts": 0,
  "init_max": 236377,
  "oog_by_chunk": [
   13,
   4,
   11,
   9
  ],
  "limit": 250000
 },
 "valid": true,
 "valid_reason": "Requester OOG rule (02:28Z): candidate OOG count on the same seeds (37) <= V2's (37); no reverts or other halts in either; afterInitialize never OOG. Note: the ~3.4k afterSwap gas trim did not change the OOG count (identical per chunk to V2's), so the OOG events come from a rare path not covered by the trim (the requester's list also names flooring the Newton sqrt); not investigated here for time.",
 "seeds": {
  "screen": [
   50000,
   50256
  ],
  "top2": [
   52000,
   52512
  ],
  "holdout": [
   4080000,
   4082000
  ],
  "holdout_fresh": true,
  "smoke_only": [
   50000,
   50016
  ]
 },
 "screen_v2_mean_edge": 537.3266621485961,
 "decision": "Do not advance this family. Its best in-band member is -5.9 vs V2 on holdout (needs +5.0 for top 10). The useful signal for the goal: V2's edge comes from the stale-price lean; a leader-style ~35 bps flat quote only works if paired with a strong directional lean, so future rules should keep (or sharpen) the lean and work on the level term, not blend toward a fixed midpoint.",
 "method": {
  "repo": "https://github.com/benedictbrady/amm-challenge",
  "commit": "6b6921f8d463314aa7c96234e1be25a25245f704",
  "setup": "scratch/setup.sh from artifact 02c134d9 run once; scratch/instrumentation.patch applied and maturin rebuilt; V2.sol sha256 28417e116f57f1029fdd1803832e852574902c1ae7253c05657f317db76da4ab verified",
  "runs": "scratch/screen.py (reuses harness.run/paired; gas stats reset+read around each run_batch); V2 run once per seed block and paired by seed"
 },
 "blocked": null,
 "nothing_invented": "All numbers above are read from the run outputs; the candidate artifact's planned variant list was not present beyond phase00's parameters, so the grid was built here (R in 28,32,36; w in 0.3,0.5,0.7,0.9; two flat variants; two anchors; plus the flat r28/w0.9 member added at the top-2 stage after flat beat count-decayed at every tested setting). Variants r28_w30, r28_w50, r32_w30, r36_w30, r36_w50 were generated but not run for time."
}