{
  "approach": "Volatility-adaptive fees, rerun with the pinned Rust simulator. The literal standalone mechanism was measured and rejected against YQ. Final code retains YQ and adds a small centered volatility residual and inventory skew; this is a measured candidate, not an automatic recommendation to replace YQ.",
  "tried": [
    {
      "variant": "Vol.sol",
      "code_sha256": "581450a075ae5a7172874a6dbf4306e5320903e49bed1302f3996a2e4537902f",
      "description": "Requested standalone: 15/16 squared-return EWMA, 34..50 bps variance map and capped 2 bps linear X-inventory skew.",
      "tuning_paired": {
        "reference": "YQ 00fae418",
        "seed_start": 0,
        "n": 2000,
        "mean_diff": -154.55084714987257,
        "se": 0.8651918153595245,
        "worst": [
          {
            "seed": 1349,
            "diff": -378.8048110505182
          },
          {
            "seed": 334,
            "diff": -341.14271070084715
          },
          {
            "seed": 715,
            "diff": -330.3984116204604
          },
          {
            "seed": 66,
            "diff": -313.5161192908049
          },
          {
            "seed": 1220,
            "diff": -310.7930359925368
          }
        ]
      },
      "score": {
        "n": 2000,
        "mean_edge": 368.7638239291607,
        "se": 1.3002713430042008,
        "seed_start": 0
      }
    },
    {
      "variant": "Hybrid.sol",
      "code_sha256": "9307536feab4c5abfef33ccbe9023c25ed7c945d8137b2cb347b76aae5a2cafd",
      "description": "Keep YQ and add one-sixteenth of the mapped fee deviation from 42 bps to fMid, plus the same inventory skew. Defer variance and implied-price initialization to first new-step swap to fit initialization gas.",
      "tuning_paired": {
        "reference": "YQ 00fae418",
        "seed_start": 0,
        "n": 2000,
        "mean_diff": -0.05485097921756065,
        "se": 0.006969232295036243,
        "worst": [
          {
            "seed": 1899,
            "diff": -1.602992958291452
          },
          {
            "seed": 1024,
            "diff": -1.3409944479182059
          },
          {
            "seed": 258,
            "diff": -1.2717127221785631
          },
          {
            "seed": 611,
            "diff": -1.2159443221862603
          },
          {
            "seed": 1462,
            "diff": -1.183171375735924
          }
        ]
      },
      "score": {
        "n": 2000,
        "mean_edge": 523.2598200998167,
        "se": 1.9795652646586048,
        "seed_start": 0
      }
    }
  ],
  "next": [
    "Retain YQ unless the fresh paired gain exceeds twice its standard error; promotion decision is recorded below.",
    "Investigate observation bias: first trade can be retail, and timestamp gaps make implied-price return variance differ from per-step GBM variance.",
    "On tuning seeds only, compare elapsed-time-normalized variance with slower EWMA smoothing before another independent confirmation block."
  ],
  "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    // --- decay / update constants ---\n    uint256 constant ELAPSED_CAP = 8;\n    uint256 constant SIGNAL_THRESHOLD = WAD / 500; // ~20 bps of reserve\n    uint256 constant DIR_DECAY = 800000000000000000; // 0.80\n    uint256 constant ACT_DECAY = 700000000000000000; // 0.70\n    uint256 constant SIZE_DECAY = 700000000000000000; // 0.70\n    uint256 constant TOX_DECAY = 910000000000000000; // 0.91\n    uint256 constant SIGMA_DECAY = 824000000000000000; // 0.824\n    uint256 constant LAMBDA_DECAY = 990000000000000000; // 0.99\n    uint256 constant SIZE_BLEND_DECAY = 818000000000000000; // 0.818\n    uint256 constant TOX_BLEND_DECAY = 51000000000000000; // 0.051\n    uint256 constant ACT_BLEND_DECAY = 985000000000000000; // 0.985\n    uint256 constant PHAT_ALPHA = 260000000000000000; // 0.26\n    uint256 constant PHAT_ALPHA_RETAIL = 50000000000000000; // 0.05\n    uint256 constant DIR_IMPACT_MULT = 2;\n\n    // --- Adaptive Shock Gate ---\n    uint256 constant GATE_SIGMA_MULT = 10 * WAD;\n    uint256 constant MIN_GATE = 30000000000000000; // 0.03 WAD\n\n    // --- Cubic Toxicity ---\n    uint256 constant TOX_CUBIC_COEF = 15000 * BPS;\n\n    // --- Trade-Tox Boost ---\n    uint256 constant TRADE_TOX_BOOST = 2500 * BPS;\n\n    // --- Asymmetric Stale Dir ---\n    uint256 constant STALE_ATTRACT_FRAC = 1124000000000000000; // 1.124\n\n    // --- state caps ---\n    uint256 constant RET_CAP = WAD / 10; // 10%\n    uint256 constant TOX_CAP = WAD / 5; // 20%\n    uint256 constant TRADE_RATIO_CAP = WAD / 5; // 20%\n    uint256 constant LAMBDA_CAP = 5 * WAD; // max 5 trades/step estimate\n    uint256 constant STEP_COUNT_CAP = 64; // guardrail\n\n    // --- fee model constants ---\n    uint256 constant BASE_FEE = 3 * BPS;\n    uint256 constant SIGMA_COEF = 200000000000000000; // 0.20\n    uint256 constant LAMBDA_COEF = 12 * BPS;\n    uint256 constant FLOW_SIZE_COEF = 4842 * BPS;\n    uint256 constant TOX_COEF = 250 * BPS;\n    uint256 constant TOX_QUAD_COEF = 11700 * 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 = 500 * BPS;\n    uint256 constant TAIL_SLOPE_PROTECT = 930000000000000000; // 0.93\n    uint256 constant TAIL_SLOPE_ATTRACT = 955000000000000000; // 0.955\n\n    // slots[0] = bid fee\n    // slots[1] = ask fee\n    // slots[2] = last timestamp\n    // slots[3] = dirState (centered at WAD, [0, 2*WAD])\n    // slots[4] = actEma\n    // slots[5] = pHat\n    // slots[6] = sigmaHat\n    // slots[7] = lambdaHat\n    // slots[8] = sizeHat\n    // slots[9] = toxEma\n    // slots[10] = stepTradeCount (raw integer)\n\n    function afterInitialize(uint256 initialX, uint256 initialY) external override returns (uint256, uint256) {\n        slots[0] = BASE_FEE;\n        slots[1] = BASE_FEE;\n        slots[2] = 0;\n        slots[3] = WAD; // neutral direction\n        slots[4] = 0;\n        slots[5] = initialX > 0 ? wdiv(initialY, initialX) : 100 * WAD;\n        slots[6] = 950000000000000; // 0.095% initial sigma guess\n        slots[7] = 800000000000000000; // 0.8 initial arrival-rate guess\n        slots[8] = 2000000000000000; // 0.2% reserve-size ratio guess\n        slots[9] = 0;\n        slots[10] = 0;\n        slots[13] = initialX;\n        return (BASE_FEE, BASE_FEE);\n    }\n\n    function afterSwap(TradeInfo calldata trade) external override returns (uint256, uint256) {\n        uint256 prevBidFee = slots[0];\n        uint256 prevAskFee = slots[1];\n        uint256 lastTs = slots[2];\n        uint256 dirState = slots[3];\n        uint256 actEma = slots[4];\n        uint256 pHat = slots[5];\n        uint256 sigmaHat = slots[6];\n        uint256 lambdaHat = slots[7];\n        uint256 sizeHat = slots[8];\n        uint256 toxEma = slots[9];\n        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\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\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\n            stepTradeCount = 0;\n        }\n\n        bool firstInStep = stepTradeCount == 0;\n\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) {\n            pImplied = spot;\n        } else {\n            pImplied = trade.isBuy ? wmul(spot, gamma) : wdiv(spot, gamma);\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 adaptiveGate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (adaptiveGate < MIN_GATE) adaptiveGate = MIN_GATE;\n            if (ret <= adaptiveGate) {\n                pHat = wmul(pHat, WAD - alpha) + wmul(pImplied, alpha);\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        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\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\n            actEma = wmul(actEma, ACT_BLEND_DECAY) + wmul(tradeRatio, WAD - ACT_BLEND_DECAY);\n\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\n        fMid = fMid + wmul(SIGMA_TOX_COEF, wmul(sigmaHat, toxSignal));\n\n        // Cubic toxicity\n        {\n            uint256 toxCubed = wmul(toxSignal, wmul(toxSignal, toxSignal));\n            fMid = fMid + wmul(TOX_CUBIC_COEF, toxCubed);\n        }\n\n        if (isNewStep) {\n            uint256 r = slots[11] > 0 ? wdiv(absDiff(pImplied, slots[11]), slots[11]) : 0;\n            if (slots[12] == 0) slots[12] = 897000000000;\n            if (r < WAD / 100) slots[12] = (15 * slots[12] + wmul(r,r)) / 16;\n            slots[11] = pImplied;\n        }\n        uint256 v = slots[12];\n        uint256 vf = v <= 778000000000 ? 34*BPS : v >= 1016000000000 ? 50*BPS : 34*BPS+(v-778000000000)*16*BPS/238000000000;\n        fMid = vf >= 42*BPS ? fMid+(vf-42*BPS)/16 : fMid-(42*BPS-vf)/16;\n\n        uint256 dirDev;\n        bool sellPressure;\n        if (dirState >= WAD) {\n            dirDev = dirState - WAD;\n            sellPressure = true;\n        } else {\n            dirDev = WAD - dirState;\n            sellPressure = false;\n        }\n\n        uint256 skew = wmul(DIR_COEF, dirDev) + wmul(DIR_TOX_COEF, wmul(dirDev, toxSignal));\n\n        uint256 bidFee;\n        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        // Directional protection using stale-price sign\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        // Trade-aligned toxicity boost\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) {\n                    bidFee = bidFee + tradeBoost;\n                } else {\n                    askFee = askFee + tradeBoost;\n                }\n            }\n        }\n\n        {\n            uint256 inv = 2*BPS*absDiff(trade.reserveX,slots[13])/slots[13];\n            if (inv > 2*BPS) inv = 2*BPS;\n            if (trade.reserveX >= slots[13]) {\n                bidFee += inv; askFee = askFee > inv ? askFee-inv : 0;\n            } else {\n                askFee += inv; bidFee = bidFee > inv ? bidFee-inv : 0;\n            }\n        }\n\n        // Asymmetric tail compression\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;\n        slots[1] = askFee;\n        slots[2] = trade.timestamp;\n        slots[3] = dirState;\n        slots[4] = actEma;\n        slots[5] = pHat;\n        slots[6] = sigmaHat;\n        slots[7] = lambdaHat;\n        slots[8] = sizeHat;\n        slots[9] = toxEma;\n        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) {\n            return WAD + wmul(centered - WAD, mul);\n        }\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) {\n        return \"vol-redo-yq\";\n    }\n}\n",
  "code_sha256": "9307536feab4c5abfef33ccbe9023c25ed7c945d8137b2cb347b76aae5a2cafd",
  "delta": "Apply to original YQ lines in reverse order; line is 1-based, delete that many lines starting there, insert the literal string before that line:\n[{\"line\":84,\"delete\":0,\"insert\":\"        slots[13] = initialX;\\n\"},{\"line\":187,\"delete\":0,\"insert\":\"        if (isNewStep) {\\n            uint256 r = slots[11] > 0 ? wdiv(absDiff(pImplied, slots[11]), slots[11]) : 0;\\n            if (slots[12] == 0) slots[12] = 897000000000;\\n            if (r < WAD / 100) slots[12] = (15 * slots[12] + wmul(r,r)) / 16;\\n            slots[11] = pImplied;\\n        }\\n        uint256 v = slots[12];\\n        uint256 vf = v <= 778000000000 ? 34*BPS : v >= 1016000000000 ? 50*BPS : 34*BPS+(v-778000000000)*16*BPS/238000000000;\\n        fMid = vf >= 42*BPS ? fMid+(vf-42*BPS)/16 : fMid-(42*BPS-vf)/16;\\n\\n\"},{\"line\":232,\"delete\":0,\"insert\":\"            }\\n        }\\n\\n        {\\n            uint256 inv = 2*BPS*absDiff(trade.reserveX,slots[13])/slots[13];\\n            if (inv > 2*BPS) inv = 2*BPS;\\n            if (trade.reserveX >= slots[13]) {\\n                bidFee += inv; askFee = askFee > inv ? askFee-inv : 0;\\n            } else {\\n                askFee += inv; bidFee = bidFee > inv ? bidFee-inv : 0;\\n\"},{\"line\":283,\"delete\":1,\"insert\":\"        return \\\"vol-redo-yq\\\";\\n\"}]",
  "score": {
    "n": 1000,
    "mean_edge": 524.578460936211,
    "se": 2.78343481160079,
    "seed_start": 0
  },
  "paired": {
    "reference": "YQ 00fae418",
    "seed_start": 400000,
    "n": 2000,
    "mean_diff": -0.06131702895843119,
    "se": 0.007363302173449584,
    "worst": [
      {
        "seed": 401203,
        "diff": -1.5294148248188435
      },
      {
        "seed": 401900,
        "diff": -1.4657572219730355
      },
      {
        "seed": 401395,
        "diff": -1.4345033236259042
      },
      {
        "seed": 401766,
        "diff": -1.3977471809416784
      },
      {
        "seed": 400992,
        "diff": -1.2897079681038122
      }
    ]
  },
  "starter_paired": {
    "reference": "contracts/src/StarterStrategy.sol (fixed 50 bps)",
    "seed_start": 100000,
    "n": 2000,
    "mean_diff": 154.62618280206496,
    "se": 0.9454514582136643,
    "worst": [
      {
        "seed": 101573,
        "diff": 75.03452228066635
      },
      {
        "seed": 100645,
        "diff": 75.80935511139808
      },
      {
        "seed": 100631,
        "diff": 79.95210623418757
      },
      {
        "seed": 100236,
        "diff": 80.049741236345
      },
      {
        "seed": 100274,
        "diff": 80.70736503639768
      }
    ]
  },
  "standalone_starter_paired": {
    "reference": "contracts/src/StarterStrategy.sol (fixed 50 bps)",
    "seed_start": 100000,
    "n": 2000,
    "mean_diff": -0.042172143832238065,
    "se": 0.0010217458691983126,
    "worst": [
      {
        "seed": 100642,
        "diff": -0.6145640484656383
      },
      {
        "seed": 101715,
        "diff": -0.5675166189050742
      },
      {
        "seed": 101132,
        "diff": -0.5670935574373175
      },
      {
        "seed": 101761,
        "diff": -0.5654364379650474
      },
      {
        "seed": 101157,
        "diff": -0.5244398436460642
      }
    ]
  },
  "seconds_per_simulation": 0.26625434210174714,
  "validate_ok": true,
  "blocked": null,
  "citations": [
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/README.md",
      "use": "Pinned simulator setup instructions."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_competition/competition/match.py",
      "use": "Canonical NumPy per-seed parameter draw order and explicit Rust seed construction."
    },
    {
      "url": "https://raw.githubusercontent.com/jiayaoqijia/amm-challenge-yq/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/contracts/src/Strategy.sol",
      "use": "Exact YQ reference source; SHA-256 independently verified locally."
    },
    {
      "url": "https://raw.githubusercontent.com/jiayaoqijia/amm-challenge-yq/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/README.md",
      "use": "Public YQ write-up: existing layered fee decomposition and latent-state architecture."
    },
    {
      "url": "https://raw.githubusercontent.com/dipankar/amm-challenge/main/ANALYSIS.md",
      "use": "Public experimental write-up: motivates estimating implied fair price rather than treating the first trade as certainly arbitrage."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/contracts/src/AMMStrategyBase.sol",
      "use": "Official base contract clamps fees to 10%."
    },
    {
      "url": "https://raw.githubusercontent.com/benedictbrady/amm-challenge/6b6921f8d463314aa7c96234e1be25a25245f704/amm_sim_rs/src/evm/strategy.rs",
      "use": "Pinned Rust runner enforces 250000 gas per swap call."
    }
  ],
  "method": {
    "engine_commit": "6b6921f8d463314aa7c96234e1be25a25245f704",
    "steps_per_simulation": 10000,
    "comparison": "Each contract is independently simulated against the fixed 30 bps normalizer on identical seeds and hyperparameters; difference is candidate submission edge minus reference submission edge.",
    "parameter_draws": "np.random.default_rng(seed): mean size U(19,21), arrival rate U(0.6,1.0), sigma U(0.000882,0.001008), in that order.",
    "standard_error": "Sample standard deviation (ddof=1) of per-seed edges or paired differences divided by sqrt(n).",
    "worst": "Five most negative candidate-minus-reference per-seed differences.",
    "selection": "Two tuning variants, seeds 0..1999 only. Hybrid frozen before observing evaluation data; no later parameter changes. Score seeds 0..999 are a subset of tuning, not fresh evidence.",
    "runtime_recovery": "Several concurrent batch-100 processes exited 137. Preserved complete checkpoints were resumed in batches of 20 with two workers initially and four after memory pressure eased, sequentially. No seed was omitted or duplicated.",
    "timing": "Wall seconds spent in Rust run_batch divided by simulation count; concurrent local measurements share CPU, so not exclusive-core latency.",
    "never_run": "900000..909999"
  },
  "checks": {
    "toolchain": "Fresh clone, exact pinned checkout, editable Python install, maturin develop --release, YQ reference amm-match validate passed.",
    "candidate_validation": "Both standalone and final hybrid passed amm-match validate. Both passed initialization plus 256 targeted swap calls with the 250000 gas execution limit. Full measured simulations use the same Rust call gas limit.",
    "repair": "Initial hybrid initializing three additional slots failed with OutOfGas at initialization; only initialX is now initialized there and the other two states are deferred to first new-step swap. Repaired variant validated and measured.",
    "storage_slots": [
      0,
      1,
      2,
      3,
      4,
      5,
      6,
      7,
      8,
      9,
      10,
      11,
      12,
      13
    ],
    "imports": [
      "./AMMStrategyBase.sol",
      "./IAMMStrategy.sol"
    ],
    "history_loops": "None added; inherited YQ logarithmic capped-elapsed decay helper retained.",
    "fee_limit": "YQ clampFee retained, maximum 10%.",
    "delta_rebuild": "Exact reconstruction from the required YQ source verified."
  },
  "promotion": {
    "promoted": false,
    "threshold": "fresh mean_diff > 2 * se",
    "ranked_promotions": [],
    "retained_best_sha256": "00fae418c49cd681ad0879c6f96ebed0163fab5a660b38030f11e6947a39afd4"
  },
  "scoreboard": {
    "reference": {
      "file": "YQ",
      "code_sha256": "00fae418c49cd681ad0879c6f96ebed0163fab5a660b38030f11e6947a39afd4",
      "score": {
        "n": 1000,
        "mean_edge": 524.6271111458854,
        "se": 2.784901273048286,
        "seed_start": 0
      }
    },
    "candidate": {
      "file": "Hybrid.sol",
      "code_sha256": "9307536feab4c5abfef33ccbe9023c25ed7c945d8137b2cb347b76aae5a2cafd",
      "score": {
        "n": 1000,
        "mean_edge": 524.578460936211,
        "se": 2.78343481160079,
        "seed_start": 0
      }
    },
    "promotions_in_this_item": 0
  },
  "limitations": [
    "Fair price inferred from a retail trade is only a proxy. The estimator does not classify trades or normalize for elapsed steps.",
    "Inventory skew is 2 bps times absolute relative X-reserve deviation from initial X, capped at 2 bps; excess X raises bid fee and lowers ask fee.",
    "Hybrid variance starts from 8.97e-7 and decays once on its first new-step observation before later squared-return updates.",
    "No claim about current leaderboard position follows from these local measurements."
  ]
}
