{
  "delta": "Replace NP2's EWMA/second-print pHat update with a log-price Kalman estimator. slots[5]=lnP, [11]=P, [12]=previous postSpot (preSpot on next call). First print predicts P += sigmaHat^2*uncapped timestamp gap. Each print uses arb-implied log price if innovation <= c*sqrt(P); otherwise log pre-trade fee-band midpoint, R=log-band-width^2/12. Apply K=P/(P+R), lnP+=K*(z-lnP), P*=1-K. Retain NP2 process sigma EMA and 10% interior-retail recentering, synchronizing lnP afterward. Both sigma-dependent fee terms use sqrt(P); all other fee constants/rules unchanged. Initial P=(0.00095)^2; numerical noise floor=1e-18. Final Ra=0.0001 (WAD 100000000000000), c=2 (WAD 2000000000000000000).",
  "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 KALMAN_RA = 100000000000000; // log-return variance, WAD\n    uint256 constant KALMAN_C = 2000000000000000000; // innovation gate, WAD\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[2] = 0; slots[3] = WAD; slots[4] = 0;\n        slots[5] = initialX > 0 ? wdiv(initialY, initialX) : 100 * WAD;\n        slots[6] = 950000000000000; slots[7] = 800000000000000000; slots[8] = 2000000000000000;\n        slots[9] = 0; slots[10] = 0; slots[11] = 0; slots[12] = 0;\n        slots[5] = uint256(_ln(slots[5]));\n        slots[11] = wmul(slots[6], slots[6]);\n        slots[12] = initialX > 0 ? wdiv(initialY, initialX) : 100 * WAD;\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 = _exp(int256(slots[5]));\n        uint256 sigmaHat = slots[6]; uint256 lambdaHat = slots[7]; uint256 sizeHat = slots[8];\n        uint256 toxEma = slots[9]; uint256 stepTradeCount = slots[10];\n\n        bool isNewStep = trade.timestamp > lastTs;\n        if (isNewStep) {\n            uint256 elapsedRaw = trade.timestamp - lastTs;\n            uint256 elapsed = elapsedRaw > ELAPSED_CAP ? ELAPSED_CAP : elapsedRaw;\n            dirState = _decayCentered(dirState, DIR_DECAY, elapsed);\n            actEma = wmul(actEma, _powWad(ACT_DECAY, elapsed));\n            sizeHat = wmul(sizeHat, _powWad(SIZE_DECAY, elapsed));\n            toxEma = wmul(toxEma, _powWad(TOX_DECAY, elapsed));\n            if (stepTradeCount > 0 && elapsedRaw > 0) {\n                uint256 lambdaInst = (stepTradeCount * WAD) / elapsedRaw;\n                if (lambdaInst > LAMBDA_CAP) lambdaInst = LAMBDA_CAP;\n                lambdaHat = wmul(lambdaHat, LAMBDA_DECAY) + wmul(lambdaInst, WAD - LAMBDA_DECAY);\n            }\n            stepTradeCount = 0;\n        }\n\n        bool firstInStep = stepTradeCount == 0;\n        uint256 spot = trade.reserveX > 0 ? wdiv(trade.reserveY, trade.reserveX) : pHat;\n        if (pHat == 0) pHat = spot;\n\n        uint256 feeUsed = trade.isBuy ? prevBidFee : prevAskFee;\n        uint256 gamma = feeUsed < WAD ? WAD - feeUsed : 0;\n        uint256 pImplied;\n        if (gamma == 0) { pImplied = spot; }\n        else { pImplied = trade.isBuy ? wmul(spot, gamma) : wdiv(spot, gamma); }\n\n        // Kalman state is log-price and WAD-scaled log-return variance.\n        {\n            int256 lnP = int256(slots[5]);\n            uint256 variance = slots[11];\n            if (firstInStep) {\n                uint256 gap = trade.timestamp > lastTs ? trade.timestamp - lastTs : 0;\n                variance += wmul(sigmaHat, sigmaHat) * gap;\n            }\n            int256 z = _ln(pImplied);\n            uint256 noise = KALMAN_RA;\n            uint256 innovation = uint256(z >= lnP ? z - lnP : lnP - z);\n            if (innovation > wmul(KALMAN_C, _sqrtWad(variance))) {\n                // A non-arb print observes the pre-trade no-arbitrage band.\n                uint256 preSpot = slots[12];\n                int256 lo = _ln(wmul(preSpot, WAD - prevBidFee));\n                int256 hi = _ln(wdiv(preSpot, WAD - prevAskFee));\n                z = (lo + hi) / 2;\n                uint256 width = uint256(hi - lo);\n                noise = wmul(width, width) / 12;\n            }\n            if (noise == 0) noise = 1;\n            uint256 gain = wdiv(variance, variance + noise);\n            lnP += (int256(gain) * (z - lnP)) / int256(WAD);\n            variance = wmul(variance, WAD - gain);\n            slots[5] = uint256(lnP);\n            slots[11] = variance;\n            uint256 oldPHat = pHat;\n            pHat = _exp(lnP);\n            // Keep NP2's process-noise estimator separate from posterior uncertainty.\n            if (firstInStep) {\n                uint256 ret = wdiv(absDiff(pImplied, oldPHat), oldPHat);\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        // Preserve NP2 retail routing correction as a recentering of log-price.\n        slots[5] = uint256(_ln(pHat));\n        slots[12] = spot;\n        uint256 uncertainty = _sqrtWad(slots[11]);\n\n        uint256 tradeRatio = trade.reserveY > 0 ? wdiv(trade.amountY, trade.reserveY) : 0;\n        if (tradeRatio > TRADE_RATIO_CAP) tradeRatio = TRADE_RATIO_CAP;\n\n        if (tradeRatio > SIGNAL_THRESHOLD) {\n            uint256 push = tradeRatio * DIR_IMPACT_MULT;\n            if (push > WAD / 4) push = WAD / 4;\n            if (trade.isBuy) {\n                dirState = dirState + push;\n                if (dirState > 2 * WAD) dirState = 2 * WAD;\n            } else {\n                dirState = dirState > push ? dirState - push : 0;\n            }\n            actEma = wmul(actEma, ACT_BLEND_DECAY) + wmul(tradeRatio, WAD - ACT_BLEND_DECAY);\n            sizeHat = wmul(sizeHat, SIZE_BLEND_DECAY) + wmul(tradeRatio, WAD - SIZE_BLEND_DECAY);\n            if (sizeHat > WAD) sizeHat = WAD;\n        }\n\n        uint256 tox = pHat > 0 ? wdiv(absDiff(spot, pHat), pHat) : 0;\n        if (tox > TOX_CAP) tox = TOX_CAP;\n        toxEma = wmul(toxEma, TOX_BLEND_DECAY) + wmul(tox, WAD - TOX_BLEND_DECAY);\n        uint256 toxSignal = toxEma;\n\n        stepTradeCount = stepTradeCount + 1;\n        if (stepTradeCount > STEP_COUNT_CAP) stepTradeCount = STEP_COUNT_CAP;\n\n        uint256 flowSize = wmul(lambdaHat, sizeHat);\n        uint256 fBase = BASE_FEE + wmul(SIGMA_COEF, uncertainty) + 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(uncertainty, toxSignal));\n\n        uint256 dirDev; bool sellPressure;\n        if (dirState >= WAD) { dirDev = dirState - WAD; sellPressure = true; }\n        else { dirDev = WAD - dirState; sellPressure = false; }\n\n        uint256 skew = wmul(DIR_COEF, dirDev) + wmul(DIR_TOX_COEF, wmul(dirDev, toxSignal));\n        uint256 bidFee; uint256 askFee;\n        if (sellPressure) {\n            bidFee = fMid + skew;\n            askFee = fMid > skew ? fMid - skew : 0;\n        } else {\n            askFee = fMid + skew;\n            bidFee = fMid > skew ? fMid - skew : 0;\n        }\n\n        {\n            uint256 staleShift = wmul(STALE_DIR_COEF, toxSignal);\n            uint256 attractShift = wmul(staleShift, STALE_ATTRACT_FRAC);\n            if (spot >= pHat) {\n                bidFee = bidFee + staleShift;\n                askFee = askFee > attractShift ? askFee - attractShift : 0;\n            } else {\n                askFee = askFee + staleShift;\n                bidFee = bidFee > attractShift ? bidFee - attractShift : 0;\n            }\n        }\n\n        {\n            bool tradeAligned = (trade.isBuy && spot >= pHat) || (!trade.isBuy && spot < pHat);\n            if (tradeAligned) {\n                uint256 tradeBoost = wmul(TRADE_TOX_BOOST, tradeRatio);\n                if (trade.isBuy) { bidFee = bidFee + tradeBoost; }\n                else { askFee = askFee + tradeBoost; }\n            }\n        }\n\n        if (sellPressure) {\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_PROTECT));\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_ATTRACT));\n        } else {\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_PROTECT));\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_ATTRACT));\n        }\n\n        slots[0] = bidFee; slots[1] = askFee; slots[2] = trade.timestamp;\n        slots[3] = dirState; slots[4] = actEma;\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    // ln via range reduction and the atanh series; |u| <= 1/3.\n    function _ln(uint256 x) internal pure returns (int256 result) {\n        require(x > 0, \"log zero\");\n        int256 k;\n        while (x >= 2 * WAD) { x /= 2; ++k; }\n        while (x < WAD) { x *= 2; --k; }\n        int256 u = int256((x - WAD) * WAD / (x + WAD));\n        int256 u2 = u * u / int256(WAD);\n        int256 term = u;\n        int256 sum = term;\n        for (uint256 i = 3; i <= 31; i += 2) {\n            term = term * u2 / int256(WAD);\n            sum += term / int256(i);\n        }\n        return 2 * sum + k * 693147180559945309;\n    }\n\n    function _exp(int256 x) internal pure returns (uint256) {\n        int256 k = x / 693147180559945309;\n        int256 r = x - k * 693147180559945309;\n        int256 term = int256(WAD);\n        int256 sum = term;\n        for (uint256 i = 1; i <= 18; ++i) {\n            term = term * r / (int256(WAD) * int256(i));\n            sum += term;\n        }\n        require(k >= -128 && k <= 128, \"price range\");\n        return k >= 0 ? uint256(sum) << uint256(k) : uint256(sum) >> uint256(-k);\n    }\n\n    function _sqrtWad(uint256 x) internal pure returns (uint256) {\n        return sqrt(x * WAD);\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    function getName() external pure override returns (string memory) { return \"NP2_Kalman\"; }\n}\n",
  "sha256": "fe6122f90473052272296d9ef7e4603ccc9501d30d955d283e2b5e58a1a2a460",
  "np2_check": {
    "seed_start": 0,
    "n": 1000,
    "mean_edge": 526.1155722459862,
    "expected_rounded": 526.1156,
    "pass": true,
    "sha256": "51f1c1a9d4999ee460eb8bbc66880da8074b173399a4f5d71f96671482e18ac0",
    "CH_mean_edge": 525.5258821780834,
    "CH_expected": 525.525882178,
    "CH_pass": true,
    "CH_sha256": "6dd68f77a70900319460215374143dbd5d924198450a46d9f5f91f6b1e3d35c3"
  },
  "tune": {
    "seeds": {
      "screen": "10000..10099",
      "tight_gate_screen": "10000..10029",
      "finalist_selection": "10000..10499"
    },
    "best_mean_diff": -13.646362055829721,
    "best_se": 0.13683200381645474,
    "final_Ra": 0.0001,
    "final_c": 2.0,
    "screened": [
      {
        "Ra": 0.0001,
        "c": 3,
        "n": 100,
        "mean_diff": -16.039121259317902,
        "se": 0.36327010976567287
      },
      {
        "Ra": 3e-05,
        "c": 2,
        "n": 100,
        "mean_diff": -19.438843648981052,
        "se": 0.34350278990651617
      },
      {
        "Ra": 3e-05,
        "c": 3,
        "n": 100,
        "mean_diff": -26.351736302854423,
        "se": 0.5072042637408526
      },
      {
        "Ra": 1e-05,
        "c": 1,
        "n": 100,
        "mean_diff": -26.85817027239468,
        "se": 0.4989940585064274
      },
      {
        "Ra": 1e-05,
        "c": 2,
        "n": 100,
        "mean_diff": -28.65284274190196,
        "se": 0.37487218330027494
      },
      {
        "Ra": 3e-05,
        "c": 5,
        "n": 100,
        "mean_diff": -38.290787274246206,
        "se": 0.7624748799158595
      },
      {
        "Ra": 3e-06,
        "c": 2,
        "n": 100,
        "mean_diff": -38.82048614630243,
        "se": 0.44093857337466585
      },
      {
        "Ra": 1e-05,
        "c": 3,
        "n": 100,
        "mean_diff": -39.34379280944872,
        "se": 0.5504508883142147
      },
      {
        "Ra": 3e-06,
        "c": 3,
        "n": 100,
        "mean_diff": -54.48510732424698,
        "se": 0.6915234671520697
      },
      {
        "Ra": 1e-05,
        "c": 5,
        "n": 100,
        "mean_diff": -56.744325914754285,
        "se": 0.926255032758491
      },
      {
        "Ra": 1e-06,
        "c": 3,
        "n": 100,
        "mean_diff": -64.06577925372306,
        "se": 0.8692303052384462
      },
      {
        "Ra": 1e-07,
        "c": 3,
        "n": 100,
        "mean_diff": -68.99034085114671,
        "se": 0.8777164442070887
      },
      {
        "Ra": 1e-05,
        "c": 8,
        "n": 100,
        "mean_diff": -71.77603676913569,
        "se": 1.1084826613237748
      },
      {
        "Ra": 3e-06,
        "c": 5,
        "n": 100,
        "mean_diff": -73.36698122548187,
        "se": 1.032498573609631
      },
      {
        "Ra": 0.0003,
        "c": 3,
        "n": 100,
        "mean_diff": -16.24846803090923,
        "se": 0.2763100654285397
      },
      {
        "Ra": 0.0003,
        "c": 8,
        "n": 100,
        "mean_diff": -20.610182400260104,
        "se": 0.3684835013134296
      },
      {
        "Ra": 0.0001,
        "c": 1,
        "n": 100,
        "mean_diff": -23.50749860901525,
        "se": 0.5807530149641926
      },
      {
        "Ra": 0.001,
        "c": 3,
        "n": 100,
        "mean_diff": -24.11521149585534,
        "se": 0.32408265490636334
      },
      {
        "Ra": 0.0001,
        "c": 8,
        "n": 100,
        "mean_diff": -26.085352022395508,
        "se": 0.6453844168458451
      },
      {
        "Ra": 0.001,
        "c": 8,
        "n": 100,
        "mean_diff": -26.109381757369423,
        "se": 0.36614714282167393
      },
      {
        "Ra": 0.003,
        "c": 3,
        "n": 100,
        "mean_diff": -44.824922110254676,
        "se": 0.5417129501370861
      },
      {
        "Ra": 0.0001,
        "c": 0.5,
        "n": 100,
        "mean_diff": -47.62921040739207,
        "se": 0.8857612913300648
      },
      {
        "Ra": 0.0001,
        "c": 2,
        "n": 30,
        "mean_diff": -13.741713913853305,
        "se": 0.5293399162960842
      },
      {
        "Ra": 0.0001,
        "c": 1.5,
        "n": 30,
        "mean_diff": -15.202745596482403,
        "se": 0.593216530228674
      },
      {
        "Ra": 3e-05,
        "c": 1,
        "n": 30,
        "mean_diff": -25.20789084113381,
        "se": 0.9328286213681632
      },
      {
        "Ra": 1e-05,
        "c": 0.5,
        "n": 30,
        "mean_diff": -43.702041805372694,
        "se": 1.3703857545206564
      },
      {
        "Ra": 3e-05,
        "c": 0.5,
        "n": 30,
        "mean_diff": -46.65889585389831,
        "se": 1.5774761398611705
      },
      {
        "Ra": 0.0003,
        "c": 0.5,
        "n": 30,
        "mean_diff": -49.08508979251125,
        "se": 1.5400818543484576
      },
      {
        "Ra": 0.0001,
        "c": 0.25,
        "n": 30,
        "mean_diff": -64.33312817815163,
        "se": 2.0066319094612344
      },
      {
        "Ra": 0.0001,
        "c": 0.1,
        "n": 30,
        "mean_diff": -75.2390396333305,
        "se": 2.2628118601623606
      },
      {
        "Ra": 0.0001,
        "c": 0,
        "n": 30,
        "mean_diff": -79.77375421623893,
        "se": 2.439283457801311
      }
    ],
    "finalists": [
      {
        "path": "scratch/g-100000000000000-2.sol",
        "n": 500,
        "mean_diff": -13.646362055829721,
        "se": 0.13683200381645474,
        "worst": -24.130644209520597
      },
      {
        "path": "scratch/k-300000000000000-3.sol",
        "n": 500,
        "mean_diff": -16.37544595613936,
        "se": 0.12174998401182698,
        "worst": -26.425913420986603
      },
      {
        "path": "scratch/k-100000000000000-3.sol",
        "n": 500,
        "mean_diff": -16.401150447677075,
        "se": 0.1605896734953754,
        "worst": -28.234662515563855
      }
    ],
    "selection": "Highest paired mean over 500 tuning seeds among finalists; frozen before any confirmation run."
  },
  "paired": {
    "n": 2000,
    "seed_start": 2310000,
    "seed_end": 2311999,
    "mean_diff": -13.64338049411491,
    "se": 0.0675452328927238,
    "worst": [
      {
        "seed": 2310445,
        "diff": -30.536359201850132,
        "candidate_edge": 519.6567120423781,
        "np2_edge": 550.1930712442282
      },
      {
        "seed": 2311085,
        "diff": -26.992669113837792,
        "candidate_edge": 599.965857648871,
        "np2_edge": 626.9585267627087
      },
      {
        "seed": 2310171,
        "diff": -23.459192084430924,
        "candidate_edge": 649.0057894329269,
        "np2_edge": 672.4649815173578
      },
      {
        "seed": 2310535,
        "diff": -23.356974182203885,
        "candidate_edge": 664.6229316321741,
        "np2_edge": 687.979905814378
      },
      {
        "seed": 2311881,
        "diff": -22.74528651746573,
        "candidate_edge": 557.5634360583073,
        "np2_edge": 580.308722575773
      }
    ],
    "candidate_mean_edge": 512.0246669477377,
    "np2_mean_edge": 525.6680474418525,
    "confirmation_runs_per_strategy_per_seed": 1
  },
  "arb_volume": {
    "unit": "Y notional per simulation",
    "n": 2000,
    "candidate_mean": 24805.560312813966,
    "np2_mean": 24137.31254204684,
    "mean_diff": 668.2477707671262,
    "paired_se": 14.180364054135135,
    "relative_change_fraction": 0.02768525988976811
  },
  "retail_volume": {
    "unit": "Y notional per simulation",
    "n": 2000,
    "candidate_mean": 71929.55188839229,
    "np2_mean": 77227.81056475846,
    "mean_diff": -5298.258676366178,
    "paired_se": 11.014646265756271,
    "relative_change_fraction": -0.06860557922878541
  },
  "gas": {
    "source_sha256": "fe6122f90473052272296d9ef7e4603ccc9501d30d955d283e2b5e58a1a2a460",
    "init": 237433,
    "max_after_swap": 145118,
    "calls": 3000,
    "all_success": true,
    "limit": 250000,
    "scope": "Observed pyrevm EVM.result.gas_used, initialization and 3000 synthetic constant-product swaps, both sides and timestamp gaps 0/1/2/8/25. Finite stress test, not a formal worst-case bound.",
    "validate_pass": true
  },
  "blocked": null,
  "next": "Do not promote: the frozen Kalman estimator loses to NP2 on fresh paired seeds. Preserve NP2. Investigate a likelihood that distinguishes retail from arbitrage before another independently reserved confirmation block.",
  "methodology": {
    "evidence": "All numerical performance, volume, gas and check values are local measurements; source URLs document source code and simulator semantics, not independent certification.",
    "simulator_commit": "6b6921f8d463314aa7c96234e1be25a25245f704",
    "setup": "Requester item setup script run once; StarterStrategy validation passed.",
    "pairing": "Separate amm_sim_rs.run_batch runs: candidate vs VanillaStrategy(30bps), NP2 vs same VanillaStrategy. Difference is candidate submission edge minus NP2 submission edge for the same seed. Never candidate vs NP2 in a shared market.",
    "draws": "numpy.random.default_rng(seed): size U(19,21), rate U(0.6,1.0), sigma U(0.000882,0.001008), in that order. cfg.seed=seed; retail seed=seed+1.",
    "fixed_config": "10000 steps; initial_price=100, initial_x=100, initial_y=10000; gbm_mu=0; gbm_dt=1; retail_size_sigma=1.2; retail_buy_prob=0.5. Eight workers; chunks of 50.",
    "statistics": "Arithmetic mean of per-seed differences; SE=sample std(ddof=1)/sqrt(n). Worst lists five most negative paired differences. Confirmation uses the first 2000 seeds within the specified 2310000..2319999 block, once after freeze; no tuning afterward.",
    "band": "Band endpoints converted to log prices before midpoint and width calculations so measurement and variance have consistent units. Stored prior postSpot equals pre-trade spot because reserves change only on our swaps. NP2 routing correction recenters lnP without an extra variance update.",
    "tests": {
      "math_roundtrip": {
        "source_sha256": "fe6122f90473052272296d9ef7e4603ccc9501d30d955d283e2b5e58a1a2a460",
        "input_price_min": 1e-12,
        "input_price_max": 1999000000000.0,
        "cases": 100,
        "max_relative_roundtrip_error": 1.4285714285306002e-06
      },
      "kalman_update_oracle": {
        "source_sha256": "fe6122f90473052272296d9ef7e4603ccc9501d30d955d283e2b5e58a1a2a460",
        "cases": 300,
        "arb_updates": 271,
        "band_updates": 29,
        "max_abs_log_price_error": 8.881784197001252e-16,
        "oracle": "double-precision specified Kalman update, reading prior EVM state"
      }
    }
  }
}