{"item":"b","blocked":null,"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 SH_KAP = 162527256975635392;\n    uint256 constant SH_KM = 428427008448629568;\n    uint256 constant SH_SM = 9219750525550601216;\n    uint256 constant SH_WA = 52060042365473;\n    uint256 constant ELAPSED_CAP = 8;\n    uint256 constant SIGNAL_THRESHOLD = WAD / 650;\n    uint256 constant DIR_DECAY = 750000000000000000;\n    uint256 constant ACT_DECAY = 530000000000000000;\n    uint256 constant SIZE_DECAY = 530000000000000000;\n    uint256 constant TOX_DECAY = 910000000000000000;\n    uint256 constant SIGMA_DECAY = 690000000000000000;\n    uint256 constant LAMBDA_DECAY = 990000000000000000;\n    uint256 constant SIZE_BLEND_DECAY = 828000000000000000;\n    uint256 constant TOX_BLEND_DECAY = 51000000000000000;\n    uint256 constant ACT_BLEND_DECAY = 985000000000000000;\n    uint256 constant PHAT_ALPHA = 270000000000000000;\n    uint256 constant PHAT_ALPHA_RETAIL = 60000000000000000;\n    uint256 constant PHAT_ALPHA_SAME = 120000000000000000;\n    uint256 constant REVERT_U = 0;\n    uint256 constant DIR_IMPACT_MULT = 4;\n    uint256 constant GATE_SIGMA_MULT = 7200000000000000000;\n    uint256 constant MIN_GATE = 30000000000000000;\n    uint256 constant TRADE_TOX_BOOST = 3500 * BPS;\n    uint256 constant STALE_ATTRACT_FRAC = 1050000000000000000;\n    uint256 constant RET_CAP = WAD / 35;\n    uint256 constant TOX_CAP = WAD / 5;\n    uint256 constant TRADE_RATIO_CAP = WAD / 5;\n    uint256 constant LAMBDA_CAP = 1820000000000000000;\n    uint256 constant STEP_COUNT_CAP = 64;\n    uint256 constant BASE_FEE = 4 * BPS;\n    uint256 constant SIGMA_COEF = 200000000000000000;\n    uint256 constant LAMBDA_COEF = 12 * BPS;\n    uint256 constant FLOW_SIZE_COEF = 4842 * BPS;\n    uint256 constant TOX_COEF = 300 * BPS;\n    uint256 constant TOX_QUAD_COEF = 15000 * BPS;\n    uint256 constant ACT_COEF = 91843 * BPS;\n    uint256 constant DIR_COEF = 20 * BPS;\n    uint256 constant DIR_TOX_COEF = 100 * BPS;\n    uint256 constant STALE_DIR_COEF = 6850 * BPS;\n    uint256 constant SIGMA_TOX_COEF = 500 * BPS;\n    uint256 constant TAIL_KNEE = 600 * BPS;\n    uint256 constant TAIL_SLOPE_PROTECT = 930000000000000000;\n    uint256 constant TAIL_SLOPE_ATTRACT = 850000000000000000;\n\n    function afterInitialize(uint256 initialX, uint256 initialY) external override returns (uint256, uint256) {\n        slots[0] = BASE_FEE; slots[1] = BASE_FEE; slots[3] = WAD; \n        slots[5] = initialX > 0 ? wdiv(initialY, initialX) : 100 * WAD;\n        slots[6] = 950000000000000; slots[7] = 800000000000000000; slots[8] = 2000000000000000;\n        slots[13] = 902500000000; slots[14] = slots[5]; \n        return (BASE_FEE, BASE_FEE);\n    }\n\n    function afterSwap(TradeInfo calldata trade) external override returns (uint256, uint256) {\n        uint256 prevBidFee = slots[0]; uint256 prevAskFee = slots[1]; uint256 lastTs = uint64(slots[2]);\n        uint256 dirState = slots[3]; uint256 actEma = slots[4]; uint256 pHat = slots[5];\n        uint256 sigmaHat = slots[6]; uint256 lambdaHat = slots[7]; uint256 sizeHat = slots[8];\n        uint256 toxEma = slots[9]; uint256 stepTradeCount = slots[10];\n\n        uint256 sigmaForFast = sigmaHat;\n        uint256 fastHat = slots[14];\n        uint256 uncertainty = slots[13];\n        uint256 silent = trade.timestamp > lastTs ? trade.timestamp - lastTs : 0;\n        bool isNewStep = trade.timestamp > lastTs;\n        if (isNewStep) {\n            uint256 elapsedRaw = trade.timestamp - lastTs;\n            uint256 elapsed = elapsedRaw > ELAPSED_CAP ? ELAPSED_CAP : elapsedRaw;\n            dirState = _decayCentered(dirState, DIR_DECAY, elapsed);\n            actEma = wmul(actEma, _powWad(ACT_DECAY, elapsed));\n            sizeHat = wmul(sizeHat, _powWad(SIZE_DECAY, elapsed));\n            toxEma = wmul(toxEma, _powWad(TOX_DECAY, elapsed));\n            if (stepTradeCount > 0 && elapsedRaw > 0) {\n                uint256 lambdaInst = (stepTradeCount * WAD) / elapsedRaw;\n                if (lambdaInst > LAMBDA_CAP) lambdaInst = LAMBDA_CAP;\n                lambdaHat = wmul(lambdaHat, LAMBDA_DECAY) + wmul(lambdaInst, WAD - LAMBDA_DECAY);\n            }\n            uncertainty += wmul(sigmaForFast, sigmaForFast) * elapsedRaw;\n            if (uncertainty > 100000000000000) uncertainty = 100000000000000;\n            stepTradeCount = 0;\n        }\n\n        bool firstInStep = stepTradeCount == 0;\n        uint256 spot = trade.reserveX > 0 ? wdiv(trade.reserveY, trade.reserveX) : pHat;\n        if (pHat == 0) pHat = spot;\n\n        uint256 feeUsed = trade.isBuy ? prevBidFee : prevAskFee;\n        uint256 gamma = feeUsed < WAD ? WAD - feeUsed : 0;\n        uint256 pImplied;\n        if (gamma == 0) { pImplied = spot; }\n        else { pImplied = trade.isBuy ? wmul(spot, gamma) : wdiv(spot, gamma); }\n\n        // S: infer a no-trade interval center from the last post-trade spot.\n        uint256 silenceScale = WAD;\n        if (firstInStep && silent > 1) {\n            uint256 g = silent - 1;\n            if (g > 1) g = 1;\n            uint256 w = WAD - _powWad(800000000000000000, g);\n            uint256 s = slots[2] >> 64;\n            if (s == 0) s = pHat;\n            uint256 c = (wmul(s, WAD - prevBidFee) + wdiv(s, WAD - prevAskFee)) / 2;\n            if (c >= pHat) pHat += wmul(w, c - pHat);\n            else pHat -= wmul(w, pHat - c);\n            silenceScale = WAD - wmul(300000000000000000, w);\n        }\n\n        {\n            uint256 ret = pHat > 0 ? wdiv(absDiff(pImplied, pHat), pHat) : 0;\n            uint256 alpha = firstInStep ? PHAT_ALPHA : PHAT_ALPHA_RETAIL;\n            uint256 prePhat = pHat;\n            bool secondPrint = !firstInStep && stepTradeCount == 1;\n            bool sameDir = false; bool oppDir = false;\n            if (secondPrint) {\n                bool up2 = pImplied >= pHat;\n                uint256 d1 = slots[12];\n                if (d1 != 0) { sameDir = (d1 == 1) == up2; oppDir = !sameDir; }\n                if (sameDir) alpha = PHAT_ALPHA_SAME;\n            }\n            if (firstInStep) { slots[12] = pImplied >= pHat ? 1 : 2; }\n            uint256 adaptiveGate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (adaptiveGate < MIN_GATE) adaptiveGate = MIN_GATE;\n            alpha = wmul(alpha, silenceScale);\n            adaptiveGate = wmul(adaptiveGate, silenceScale);\n            if (ret <= adaptiveGate) { pHat = wmul(pHat, WAD - alpha) + wmul(pImplied, alpha); }\n            if (oppDir && REVERT_U > 0) {\n                uint256 pre = slots[11];\n                if (pre > pHat) pHat = pHat + wmul(pre - pHat, REVERT_U);\n                else pHat = pHat - wmul(pHat - pre, REVERT_U);\n            }\n            if (firstInStep) {\n                if (ret > RET_CAP) ret = RET_CAP;\n                sigmaHat = wmul(sigmaHat, SIGMA_DECAY) + wmul(ret, WAD - SIGMA_DECAY);\n            }\n        }\n\n        // Interior retail routing equalizes fee-adjusted marginal prices.\n        // Subsequent trades in a step cannot be the initial arbitrage trade.\n        if (!firstInStep && feeUsed > 30 * BPS && gamma > 0) {\n            uint256 normalSpot = trade.isBuy\n                ? wdiv(wmul(spot, gamma), WAD - 30 * BPS)\n                : wdiv(wmul(spot, WAD - 30 * BPS), gamma);\n            pHat = wmul(pHat, 90 * WAD / 100) + wmul(normalSpot, 10 * WAD / 100);\n        }\n\n        {\n            uint256 ret = fastHat > 0 ? wdiv(absDiff(pImplied, fastHat), fastHat) : 0;\n            uint256 alpha;\n            if (firstInStep) {\n                uint256 processSigma = sigmaForFast;\n                uint256 obsVar = uncertainty + wmul(processSigma, processSigma);\n                uint256 probArb;\n                uint256 z2 = wdiv(wmul(ret, ret), obsVar);\n                uint256 density = _powWad(wdiv(WAD, WAD + z2 / 16), 8);\n                uint256 sigmaObs = _isqrt(obsVar * WAD);\n                uint256 odds = wmul(density, wdiv(6700000000000000, sigmaObs));\n                bool arbFlag = ret <= wmul(sigmaForFast, 1220000000000000000);\n                uint256 prior = arbFlag ? 650000000000000000 : 400000000000000000;\n                uint256 tr = trade.reserveY > 0 ? wdiv(trade.amountY, trade.reserveY) : 0;\n                if (tr > 3000000000000000) prior = wmul(prior, 6 * WAD / 10);\n                if (silent > 1) prior = wmul(prior, 8 * WAD / 10);\n                odds = wmul(odds, wdiv(prior, WAD - prior));\n                probArb = wdiv(odds, WAD + odds);\n                alpha = wmul(probArb, 600000000000000000) + wmul(WAD - probArb, 80000000000000000);\n                slots[15] = pImplied >= fastHat ? 1 : 2;\n                uncertainty = wmul(uncertainty, WAD - alpha);\n            } else {\n                if ((slots[15] == 1) == (pImplied >= fastHat)) alpha = PHAT_ALPHA_RETAIL;\n            }\n            uint256 gate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (gate < MIN_GATE) gate = MIN_GATE;\n            if (ret <= gate) fastHat = wmul(fastHat, WAD - alpha) + wmul(pImplied, alpha);\n            slots[13] = uncertainty;\n        }\n\n        if (!firstInStep && feeUsed > 30 * BPS && gamma > 0) {\n            uint256 normalObs = trade.isBuy\n                ? wdiv(wmul(spot, gamma), WAD - 30 * BPS)\n                : wdiv(wmul(spot, WAD - 30 * BPS), gamma);\n            if ((slots[15] == 1) == (normalObs >= fastHat)) {\n                fastHat = wmul(fastHat, 9 * WAD / 10) + wmul(normalObs, WAD / 10);\n            }\n        }\n        slots[14] = fastHat;\n        uint256 tradeRatio = trade.reserveY > 0 ? wdiv(trade.amountY, trade.reserveY) : 0;\n        if (tradeRatio > TRADE_RATIO_CAP) tradeRatio = TRADE_RATIO_CAP;\n\n        if (tradeRatio > SIGNAL_THRESHOLD) {\n            uint256 push = tradeRatio * DIR_IMPACT_MULT;\n            if (push > WAD / 4) push = WAD / 4;\n            if (trade.isBuy) {\n                dirState = dirState + push;\n                if (dirState > 2 * WAD) dirState = 2 * WAD;\n            } else {\n                dirState = dirState > push ? dirState - push : 0;\n            }\n            actEma = wmul(actEma, ACT_BLEND_DECAY) + wmul(tradeRatio, WAD - ACT_BLEND_DECAY);\n            sizeHat = wmul(sizeHat, SIZE_BLEND_DECAY) + wmul(tradeRatio, WAD - SIZE_BLEND_DECAY);\n            if (sizeHat > WAD) sizeHat = WAD;\n        }\n\n        uint256 tox = pHat > 0 ? wdiv(absDiff(spot, pHat), pHat) : 0;\n        if (tox > TOX_CAP) tox = TOX_CAP;\n        toxEma = wmul(toxEma, TOX_BLEND_DECAY) + wmul(tox, WAD - TOX_BLEND_DECAY);\n        uint256 toxSignal = toxEma;\n\n        stepTradeCount = stepTradeCount + 1;\n        if (stepTradeCount > STEP_COUNT_CAP) stepTradeCount = STEP_COUNT_CAP;\n\n        uint256 flowSize = wmul(lambdaHat, sizeHat);\n        uint256 fBase = BASE_FEE + wmul(SIGMA_COEF, sigmaHat) + wmul(LAMBDA_COEF, lambdaHat) + wmul(FLOW_SIZE_COEF, flowSize);\n        uint256 fMid = fBase + wmul(TOX_COEF, toxSignal) + wmul(TOX_QUAD_COEF, wmul(toxSignal, toxSignal)) + wmul(ACT_COEF, actEma);\n        fMid = fMid + wmul(SIGMA_TOX_COEF, wmul(sigmaHat, toxSignal));\n\n        uint256 dirDev; bool sellPressure;\n        if (dirState >= WAD) { dirDev = dirState - WAD; sellPressure = true; }\n        else { dirDev = WAD - dirState; sellPressure = false; }\n\n        uint256 skew = wmul(DIR_COEF, dirDev) + wmul(DIR_TOX_COEF, wmul(dirDev, toxSignal));\n        uint256 bidFee; uint256 askFee;\n        if (sellPressure) {\n            bidFee = fMid + skew;\n            askFee = fMid > skew ? fMid - skew : 0;\n        } else {\n            askFee = fMid + skew;\n            bidFee = fMid > skew ? fMid - skew : 0;\n        }\n\n        {\n            uint256 staleHat = wmul(pHat, 700000000000000000) + wmul(fastHat, 300000000000000000);\n            uint256 staleTox = wdiv(absDiff(spot, staleHat), staleHat);\n            if (staleTox > TOX_CAP) staleTox = TOX_CAP;\n            uint256 staleShift = wmul(STALE_DIR_COEF, staleTox);\n            uint256 attractShift = wmul(staleShift, STALE_ATTRACT_FRAC);\n            if (spot >= staleHat) {\n                bidFee = bidFee + staleShift;\n                askFee = askFee > attractShift ? askFee - attractShift : 0;\n            } else {\n                askFee = askFee + staleShift;\n                bidFee = bidFee > attractShift ? bidFee - attractShift : 0;\n            }\n        }\n\n        {\n            bool tradeAligned = (trade.isBuy && spot >= pHat) || (!trade.isBuy && spot < pHat);\n            if (tradeAligned) {\n                uint256 tradeBoost = wmul(TRADE_TOX_BOOST, tradeRatio);\n                if (!firstInStep && tradeBoost > 16 * BPS) tradeBoost = 16 * BPS;\n                if (trade.isBuy) { bidFee = bidFee + tradeBoost; }\n                else { askFee = askFee + tradeBoost; }\n            }\n        }\n\n        (bidFee, askFee) = _shadow(bidFee, askFee, pHat, spot, sigmaHat, uncertainty, lambdaHat, sizeHat, trade.reserveY);\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        if (firstInStep) {\n            if (askFee > bidFee && bidFee > 30 * BPS) bidFee = 30 * BPS;\n            else if (bidFee > askFee && askFee > 30 * BPS) askFee = 30 * BPS;\n        }\n\n        if (bidFee > askFee && askFee > 36 * BPS) askFee = 36 * BPS;\n        else if (askFee > bidFee && bidFee > 36 * BPS) bidFee = 36 * BPS;\n\n        slots[0] = bidFee; slots[1] = askFee; slots[2] = (spot << 64) | trade.timestamp;\n        slots[3] = dirState; slots[4] = actEma; slots[5] = pHat;\n        slots[6] = sigmaHat; slots[7] = lambdaHat; slots[8] = sizeHat;\n        slots[9] = toxEma; slots[10] = stepTradeCount;\n\n        return (bidFee, askFee);\n    }\n\n    function _compressTailWithSlope(uint256 fee, uint256 slope) internal pure returns (uint256) {\n        if (fee <= TAIL_KNEE) return fee;\n        return TAIL_KNEE + wmul(fee - TAIL_KNEE, slope);\n    }\n\n    function _powWad(uint256 factor, uint256 exp) internal pure returns (uint256 result) {\n        result = WAD;\n        while (exp > 0) {\n            if (exp & 1 == 1) result = wmul(result, factor);\n            factor = wmul(factor, factor);\n            exp >>= 1;\n        }\n    }\n\n    function _decayCentered(uint256 centered, uint256 decayFactor, uint256 elapsed) internal pure returns (uint256) {\n        uint256 mul = _powWad(decayFactor, elapsed);\n        if (centered >= WAD) { return WAD + wmul(centered - WAD, mul); }\n        uint256 below = wmul(WAD - centered, mul);\n        return below < WAD ? WAD - below : 0;\n    }\n\n    // Floor square root: bit-length seed and seven Newton steps (all uint256).\n    function _isqrt(uint256 x) internal pure returns (uint256 r) {\n        if (x == 0) return 0;\n        unchecked {\n            uint256 y = x;\n            r = 1;\n            if (y >> 128 != 0) { y >>= 128; r <<= 64; }\n            if (y >> 64 != 0) { y >>= 64; r <<= 32; }\n            if (y >> 32 != 0) { y >>= 32; r <<= 16; }\n            if (y >> 16 != 0) { y >>= 16; r <<= 8; }\n            if (y >> 8 != 0) { y >>= 8; r <<= 4; }\n            if (y >> 4 != 0) { y >>= 4; r <<= 2; }\n            if (y >> 2 != 0) { r <<= 1; }\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            r = (r + x / r) >> 1;\n            uint256 t = x / r;\n            return r < t ? r : t;\n        }\n    }\n\n    // Shadow objective. All quantities use signed 1e18 fixed point.\n    struct Moment { int256 first; int256 second; }\n    struct ShadowState { int256 mu; int256 sd; int256 variance; int256 k; int256 flow; int256 risk; }\n    function _normal(int256 z) internal pure returns (int256 phi, int256 cdf) {\n        unchecked {\n            int256 az = z < 0 ? -z : z;\n            if (az >= 8e18) return (0, z > 0 ? int256(1e18) : int256(0));\n            // exp(-z*z/2): reciprocal Taylor on [0,2], then four squares.\n            int256 h = az * az / 32e18;\n            int256 term = 1e18;\n            int256 e = term;\n            for (int256 j=1; j<=10; ++j) { term = term*h/(j*1e18); e += term; }\n            e = 1e36/e;\n            e=e*e/1e18; e=e*e/1e18; e=e*e/1e18; e=e*e/1e18;\n            phi = e * 398942280401432678 / 1e18;\n            int256 t = 1e36/(1e18+231641900000000000*az/1e18);\n            int256 q = 1330274429000000000;\n            q = -1821255978000000000+t*q/1e18;\n            q = 1781477937000000000+t*q/1e18;\n            q = -356563782000000000+t*q/1e18;\n            q = 319381530000000000+t*q/1e18;\n            q = phi*(t*q/1e18)/1e18;\n            cdf = z >= 0 ? int256(1e18)-q : q;\n        }\n    }\n    function _moment(int256 m, int256 sd, int256 variance) internal pure returns (Moment memory v) {\n        unchecked {\n            (int256 phi, int256 cdf) = _normal(m*1e18/sd);\n            v.first = (m*cdf+sd*phi)/1e18;\n            v.second = ((m*m/1e18+variance)*cdf+(m*sd/1e18)*phi)/1e18;\n            if (v.first<0) v.first=0;\n            if (v.second<0) v.second=0;\n        }\n    }\n    function _objective(int256 b, int256 a, Moment memory mb, Moment memory ma, ShadowState memory s) internal pure returns (int256) {\n        unchecked {\n            int256 tau=s.mu-ma.first+mb.first;\n            int256 va=a-tau; int256 vb=b+tau;\n            int256 sa=5e17+s.k*(3e15-va)/1e18;\n            int256 sb=5e17+s.k*(3e15-vb)/1e18;\n            sa=sa<0?int256(0):(sa>1e18?int256(1e18):sa);\n            sb=sb<0?int256(0):(sb>1e18?int256(1e18):sb);\n            return s.flow*((sa*va+sb*vb)/1e18)/1e18-s.risk*(ma.second+mb.second)/1e18;\n        }\n    }\n    function _shadow(uint256 b0, uint256 a0, uint256 ph, uint256 spot, uint256 sigma, uint256 uncertainty, uint256 lam, uint256 size, uint256 y) internal pure returns (uint256, uint256) {\n        if (SH_KAP==0 || spot==0 || size==0) return (b0,a0);\n        ShadowState memory s;\n        s.mu=(int256(ph)-int256(spot))*1e18/int256(spot);\n        s.variance=int256(SH_SM*(sigma*sigma/1e18+uncertainty)/1e18);\n        if (s.variance<1) s.variance=1;\n        s.sd=int256(_isqrt(uint256(s.variance)*1e18));\n        s.k=int256(SH_KM*1e18/(4*size));\n        s.flow=int256(lam*size/2e18);\n        s.risk=int256(SH_WA*y/4e18);\n        int256 b=int256(b0); int256 a=int256(a0);\n        int256[3] memory bs=[b,b+int256(3e14),b>3e14?b-int256(3e14):int256(0)];\n        int256[3] memory az=[a,a+int256(3e14),a>3e14?a-int256(3e14):int256(0)];\n        Moment memory mb=_moment(-s.mu-b,s.sd,s.variance);\n        Moment memory ma=_moment(s.mu-a,s.sd,s.variance);\n        int256 best=_objective(b,a,mb,ma,s); int256 bj=b; int256 aj=a;\n        for (uint256 j=1;j<3;++j) {\n            Moment memory v=_moment(-s.mu-bs[j],s.sd,s.variance);\n            int256 obj=_objective(bs[j],a,v,ma,s);\n            if (obj>best) { best=obj; bj=bs[j]; aj=a; }\n            v=_moment(s.mu-az[j],s.sd,s.variance);\n            obj=_objective(b,az[j],mb,v,s);\n            if (obj>best) { best=obj; bj=b; aj=az[j]; }\n        }\n        return (uint256(b+int256(SH_KAP)*(bj-b)/1e18),uint256(a+int256(SH_KAP)*(aj-a)/1e18));\n    }\n\n    function getName() external pure override returns (string memory) { return \"no_cubic\"; }\n}\n","sha256":"0cedfc21bec98c29a673edc8fb02a38849bfe7a0de5ab33afeadbcc47ebb02d3","params":{"kap":0.1625272569756354,"km":0.4284270084486296,"sm":9.219750525550602,"wa":5.206004236547325e-05},"evaluations":16,"log":{"numerical_decomposition_check":{"samples":200000,"rng_seed":982345,"relative_k_perturbation":1e-13,"max_volume_difference":0.00018125606200849933,"max_edge_difference":5.080584444903252e-12,"volume_tolerance":0.001},"reference_check":{"seeds":[0,1000],"n":1000,"mean_edge":525.5258821780834,"expected":525.5258821780834,"gas":{"max_ok":151647,"oog":0,"other_failures":0}},"parity":{"seeds":[620000,620032],"paired":{"n":32,"mean_diff":0.0,"se":0.0,"worst":0.0},"stack_gas":{"max_ok":211507,"oog":0,"other_failures":0},"zero_gas":{"max_ok":211511,"oog":0,"other_failures":0}},"pilot":{"seeds":[620000,620032],"paired":{"n":32,"mean_diff":-0.11048691591966531},"gas":{"max_ok":233619,"oog":0,"other_failures":0}},"search":{"seeds":[620000,620064],"budget_seconds":1800,"cma_seed":2,"pop":10,"mu":5,"three_pairs":false,"wall_seconds":1856.7744807340205,"generations_completed":1,"evaluations":16},"evaluations":[{"id":1,"generation":0,"params":{"kap":0.5377387662714521,"km":0.6582313898380323,"sm":0.7185996907068685,"wa":1.418232228953263e-05},"paired":{"n":64,"mean_diff":-0.19776614663812353,"se":0.06275316513443434,"worst":-1.5691881110157055},"gas":{"max_ok":233732,"oog":0,"other_failures":0},"valid":true,"elapsed":211.38881637807935,"sha256":"43c29df6bf126a71de1a7df85acd02e7a253521d79a3a0accd3df9abdb0d57d3"},{"id":2,"generation":0,"params":{"kap":0.8084183980515124,"km":2.4976060613097943,"sm":0.7707908066828858,"wa":0.00018571541132750806},"paired":{"n":64,"mean_diff":-0.5659286360285734,"se":0.0797166622273846,"worst":-2.21536438230396},"gas":{"max_ok":233704,"oog":0,"other_failures":0},"valid":true,"elapsed":420.51933312695473,"sha256":"ebe471b1f6d584e5fb3794a78f699fa326625fc8f06a0791fe19e9af8e55d1d7"},{"id":3,"generation":0,"params":{"kap":0.5560061232110288,"km":0.6420697931435869,"sm":2.1859575289387925,"wa":7.800125752388874e-05},"paired":{"n":64,"mean_diff":-0.2883019708189236,"se":0.07194275475400655,"worst":-1.631296027288272},"gas":{"max_ok":233754,"oog":0,"other_failures":0},"valid":true,"elapsed":586.319952497026,"sha256":"14fbbc835f7680a3e0a6b076200bd3398f5c284ee59d42ee07af1d70220541e4"},{"id":4,"generation":0,"params":{"kap":0.43461185719421985,"km":0.5306156173750577,"sm":1.4390259440907192,"wa":9.23708769658355e-05},"paired":{"n":64,"mean_diff":-0.19794758572950588,"se":0.06411088392502251,"worst":-1.5135162719624304},"gas":{"max_ok":233750,"oog":0,"other_failures":0},"valid":true,"elapsed":686.4580940990709,"sha256":"c7d8aa785a4fe3727f94492415eeb232b4c9a74dcf5f3944240ed813ee15045b"},{"id":5,"generation":0,"params":{"kap":0.6073605810920791,"km":0.615236482991834,"sm":1.1067881669975634,"wa":4.8977007399722554e-05},"paired":{"n":64,"mean_diff":-0.3491915294626704,"se":0.07347926215292908,"worst":-1.8670435082663062},"gas":{"max_ok":233754,"oog":0,"other_failures":0},"valid":true,"elapsed":781.4052064379212,"sha256":"71ed4e765702a1f80638523852d8afcd8a264ac11b98f679ef754cdb6f777d01"},{"id":6,"generation":0,"params":{"kap":0.6622130538565041,"km":1.1623316950944,"sm":1.3027231528152126,"wa":0.00013887487062473646},"paired":{"n":64,"mean_diff":-0.39380174614161323,"se":0.07797222513391497,"worst":-1.663416405013777},"gas":{"max_ok":233637,"oog":0,"other_failures":0},"valid":true,"elapsed":876.8364129608963,"sha256":"1704c0a9c6330866a556cfe9b5471c69ee6032a307a4dc5f8be92a989352f2d0"},{"id":7,"generation":0,"params":{"kap":0.30818762814628053,"km":1.8711342483612887,"sm":5.182887091991793,"wa":2.696166880435283e-05},"paired":{"n":64,"mean_diff":-0.15975725364238524,"se":0.04216920590867966,"worst":-0.8766241920944822},"gas":{"max_ok":233732,"oog":0,"other_failures":0},"valid":true,"elapsed":968.7725321019534,"sha256":"95c39858b036d69fad9d43ff14e84863c9ec162f5dafb327f624fc33667103bf"},{"id":8,"generation":0,"params":{"kap":0.20044279702629061,"km":0.3000323037094352,"sm":1.9604364259621843,"wa":0.00011084609547783917},"paired":{"n":64,"mean_diff":-0.09142565359648458,"se":0.03562350148686582,"worst":-0.96304302482406},"gas":{"max_ok":233754,"oog":0,"other_failures":0},"valid":true,"elapsed":1064.289751542965,"sha256":"a91a91c9b3caf4f3050a6d87f9c3c86e4c62eedd9e22ce6702ca222b01f3375e"},{"id":9,"generation":0,"params":{"kap":0.7032190167623055,"km":1.7823713518846633,"sm":1.1834778686720995,"wa":0.00012551191598954176},"paired":{"n":64,"mean_diff":-0.45498859116097723,"se":0.08151917849956673,"worst":-1.9839244071554276},"gas":{"max_ok":233637,"oog":0,"other_failures":0},"valid":true,"elapsed":1155.6249612860847,"sha256":"6d5b6cfecef567aa5ed90f35f18bc274c0ca55ee022fe01d0daffe7b34ffb18e"},{"id":10,"generation":0,"params":{"kap":0.46609998854015666,"km":2.003244605842296,"sm":0.4050386560373367,"wa":7.135612074561553e-05},"paired":{"n":64,"mean_diff":-0.23896545007607184,"se":0.05686951195359408,"worst":-1.3853771801250332},"gas":{"max_ok":233725,"oog":0,"other_failures":0},"valid":true,"elapsed":1248.9980117499363,"sha256":"a45150000975aaeccca557d07aa31c2e4b67a96e9dfbd520f9ca54ecc2aa7402"},{"id":11,"generation":1,"params":{"kap":0.3382736690876555,"km":1.6093515732699812,"sm":2.1528149661798848,"wa":0.00032192677158547384},"paired":{"n":64,"mean_diff":-0.144816099479395,"se":0.05174670161955467,"worst":-1.1589120433220046},"gas":{"max_ok":233750,"oog":0,"other_failures":0},"valid":true,"elapsed":1353.7967578400858,"sha256":"15f4269903910f5cee13bc9b0e4f9f2e82f62eed1a313525f200e2afd2fbc6d3"},{"id":12,"generation":1,"params":{"kap":0.1625272569756354,"km":0.4284270084486296,"sm":9.219750525550602,"wa":5.206004236547325e-05},"paired":{"n":64,"mean_diff":-0.03553555618511606,"se":0.02912188033361984,"worst":-0.5324415072726651},"gas":{"max_ok":233732,"oog":0,"other_failures":0},"valid":true,"elapsed":1460.3624729230069,"sha256":"0cedfc21bec98c29a673edc8fb02a38849bfe7a0de5ab33afeadbcc47ebb02d3"},{"id":13,"generation":1,"params":{"kap":0.7932538851438491,"km":1.536366889734924,"sm":4.199955030610708,"wa":9.489449344115819e-05},"paired":{"n":64,"mean_diff":-0.5488718585381509,"se":0.07990137042569576,"worst":-1.9888181078394496},"gas":{"max_ok":233736,"oog":0,"other_failures":0},"valid":true,"elapsed":1566.5459912959486,"sha256":"99a513be57717926d595e5504e5e2fbaf57dc197d0460fc8b061c44cb0e9973b"},{"id":14,"generation":1,"params":{"kap":0.1466710889875664,"km":0.8445283552872838,"sm":6.513531343412083,"wa":5.368537570002498e-05},"paired":{"n":64,"mean_diff":-0.02582090767444356,"se":0.027414420973794117,"worst":-0.41759107006373597},"gas":{"max_ok":233736,"oog":0,"other_failures":0},"valid":true,"elapsed":1666.0909690870903,"sha256":"79d54902926061bcec3142b61aa1439db92be37a075e9fab38ee5ce6cefe13a1"},{"id":15,"generation":1,"params":{"kap":0.14532894520186232,"km":1.9755534502650964,"sm":0.48036779389035694,"wa":9.407142797294288e-05},"paired":{"n":64,"mean_diff":-0.03337343293250061,"se":0.0288325027632008,"worst":-0.8208107259198414},"gas":{"max_ok":233729,"oog":0,"other_failures":0},"valid":true,"elapsed":1762.2953100348823,"sha256":"8029d0c78cea74c166f429e4a8a1a8784beac2715c39b17d84a8fa6e96bd5cbe"},{"id":16,"generation":1,"params":{"kap":0.23674436256846568,"km":0.6773783243655241,"sm":1.2496659388544642,"wa":5.546680076635785e-05},"paired":{"n":64,"mean_diff":-0.1293719131911022,"se":0.04000498945038315,"worst":-0.8770468997523722},"gas":{"max_ok":233750,"oog":0,"other_failures":0},"valid":true,"elapsed":1856.773400880862,"sha256":"ef0ee4835a40dce8c6adae362a558ed48819e1b19f14c766eb77a442b59077e7"}],"frozen_id":12,"validation":"Validating strategy...\nCompiling strategy...\nStrategy 'no_cubic' validated successfully!","held_out_per_seed_differences":[-0.5586298728244401,-0.7756908638300501,-0.3426793436665321,-0.2751131678969614,-0.6246950702824279,0.19615759283050238,0.04296741090871592,-0.05684731180036806,0.15186570292900115,0.02552675034667118,0.36257298381383407,0.18860711192877488,0.14732016108104062,0.26332339143141326,-0.2293020801852208,-0.14778560006232055,-0.025433565466641994,0.3015161937934181,0.0389574380192812,-0.20250382329697914,0.02985036090660742,0.1427609505168448,0.16774597082371656,-0.10860180891631899,0.19044391018223905,-0.039363960245623275,0.043640036133638205,-0.33281129723570757,-0.6836398148060425,-0.3048860723976077,-0.13188547850876375,0.33247160198163783,-0.23128557156763918,0.2073373407626491,-0.11491159628405967,-0.4627608663299725,-0.4264424730299652,0.09865767399099923,0.2648368729589947,-0.12579976511455015,-0.07326594593030222,-0.8175105567728451,-0.052047130936614394,-0.27892028354028753,-0.15631027870790604,0.049595372946953376,0.22942909344305917,0.08794390524604978,-0.1663481650518861,0.13897777385420795,-0.03718802979119573,-0.869252928197966,0.3493817440586895,0.21074355976008974,-0.12884705458537837,0.2147134040977221,-0.31369093581281504,0.24153519251518674,-0.05107528947564788,0.21361850135025406,0.3769452358754961,0.24677665372951196,-0.05658678638087622,-0.21589332396376903,-0.07343441551438445,0.07333744518291496,-0.3397320321294046,-0.15451154902007147,-0.820343512660429,-0.22077541578994442,0.02096452715960595,-0.10172128071718589,0.5533059956411535,-0.027745318601660074,-0.41042914483534787,0.48562080625208637,0.13467887350884666,0.19297109342051044,0.270682702337524,-0.06688210866570898,0.13506344448342134,0.04492076841773951,-0.3588170784165641,-0.28101529454863794,0.4225655961099619,-0.042211352839160554,-0.7662337872022817,0.2582452046059416,0.08553872255140504,0.344530840817697,0.06486533462032185,-0.23047761803718458,-0.0580891318365957,-0.38600978969515154,0.021847852226073883,-0.14114144379789195,-0.31191395582709447,-0.3226558888960085,-0.5210050368933707,0.01935225152908515,-0.12629419289788757,0.013083352642297541,-0.05580680533478244,0.11507940779983983,0.018089502132056623,-0.23870459061208749,0.026418337196787434,0.019015540505733952,0.07001125847693856,-0.3977384836282454,-0.12505476753585754,0.2127277975030779,0.24036695322018886,-0.32561667193965604,0.20225545080842267,-0.8719640384404101,-0.3356030961667784,0.5187636486720066,-0.2004832945747239,0.14853163225092203,0.23000583742958725,-0.11326987791892407,0.15150596784474146,-0.4527638377969083,0.1746185898871886,-0.2444730067686578,0.06356584659727105,0.203614552822728,-0.12019436212068513,-0.330491029674306,-0.21548585648179142,0.2215073610447007,-0.23290163332421798,-0.25978117422147307,-0.0638319265324867,-0.16291532702371114,0.54080941796758,0.20585371246193063,-0.06126157671610599,-0.002943878281485013,-0.09712281924714716,-0.7587735729448468,-0.12425802073778414,-0.15767408868623534,-0.1292016064364816,-0.2007858663767479,0.17717089630082228,0.23505508252890195,0.5568267546930201,0.2916737293693359,0.06716272858966477,-0.18065587006594797,-0.4017789205597637,0.030947920688561226,0.31324911010835876,-0.5345844044119303,-0.5716963173227896,-0.25679960903789834,0.35507050009562136,-0.0227389851403359,-0.02108241176415504,-0.15980564321159818,0.11704279369752157,0.05096704626555493,-0.10697652768050148,0.1627591781274873,-0.10890350128266846,0.0945264192068862,-0.5194815464466842,-0.27379131617601615,-0.15826359426250747,0.07228779208662672,0.28335545737218126,0.06274747909640155,-0.32725883000267686,0.27619242069090433,0.191787284127372,0.191498105682399,0.0075858075639985145,-0.15982387420876876,-0.09454826870387478,-0.5932081595800582,-0.16527500532077966,-0.6852922305261586,-0.11378366264921169,-0.02323797459951038,0.21411247232560982,-0.054723339650990965,-0.22197467986836728,0.2250730688266458,-0.23971884653121833,-0.14330674709435698,0.04076950008527547,-0.037604658414693404,-0.23732343152698832,-0.18446089432245572,-0.01366072486257508,0.10693862109695829,0.2743114767509951,0.12690356759856058,-0.32352949048413393,-0.019876842340750045,0.27794176488100675,-0.5792928899265917,-0.030311193639590783,0.27762027868391215,-0.3032976879382545,-0.4462521736608096,-0.18888913999080614,-0.5160067076328687,0.5124121451356132,0.15890328841061319,-0.1527915457772906,-0.49048621075763776,-0.22799308522513684,-1.3226643032148786,0.19699579423627256,0.7196260899651179,-0.038780336253125824,0.2795086001783602,0.14620659540923953,0.05829726389913503,0.011423887224793816,-0.00309158457673675,0.009037403402373911,-0.4035068147632046,-0.5753774930838063,-0.2601830670409413,-0.4144743171832488,1.0377663747385668,-0.07411413908238274,-0.12774108386486205,-0.025109158401448894,0.32271460683580244,0.2914905667216203,0.12764736531244125,-0.06404301720817784,-0.06330910345752727,0.3802344240932598,0.16791805029208717,0.5193095804814902,-0.06814780594470449,0.3327753227749213,0.015273236024086145,0.0809626835311974,-0.24380347930753032,0.40211295520930435,0.12139733199154534,0.09621394762325508,-0.0986999820499932,0.022355101036964697,-0.016144145326848047,-0.05451553836064704,-0.2098781791945612,0.20402566600057526,-0.0868409005188937,0.1226763953467298,-0.18432734404535722,-0.14555507564352865,-0.3026376938114481,0.07537880100187522,-0.48765560592516977,-0.08884044143411529,-0.39527340153620116,-0.1205696931256739,0.2101632695923854,-0.05400961834396867,-0.08871870153291184,0.6081921033961635,0.186230822739617,-0.01878609921379848,-0.32173122450649316,-0.4666080986747829,0.5123296923671319,-0.04298594290287383,0.5783169146894807,-0.3466625677409638,-0.07953809871065687,0.36951183497126294,0.16107264313541236,0.034838155702118456,-0.07823670745881373,0.0916888882013609,0.15219670314576206,0.3581533710431586,-0.3864651617520849,0.450813429585196,-0.26356717831242804,0.4165350463234745,0.11809167985808244,-0.1430678733734112,0.00518054221129205,0.14837549441659803,-0.07337077691022387,-0.29588423738789515,-0.23976267344619373,0.11743800205221078,0.3783680812938428,-0.2220945973193693,-0.27519170356640643,0.6502848308123248,0.049030393126088256,0.03334929225917449,-0.15918211633498913,-0.14222136113716033,-0.1407422552609887,0.20479700235080145,-0.10099647079869101,-0.03822268639066806,0.7358662854426257,-0.05418909897468893,0.03645426808736829,0.4160712360583716,-0.07767239395252545,0.34168075366937956,0.21907740664585162,-0.44219531807073054,0.21689242141758314,-0.7768141309937846,0.22140600754244133,0.08683403245441923,-0.21700660562413532,0.11662268260846531,-0.19195646662024046,0.19812278294307362,-0.3035907648916236,-0.07555227971431577,0.14498634320739257,-0.3136422194075976,-0.2991544887796067,0.08394462308257289,-0.06864584083564296,0.04242251064528091,0.09978196568238218,0.08553661714029204,0.3239500504548687,0.1295510582251609,-0.11826488989572681,-0.47707659398759006,0.23069779506215582,-0.7027594882174526,-0.42100263768929835,-0.42421505090550227,0.6440732302947936,-0.05043365560914026,0.2878585804952536,0.15765334072796122,0.008449630015547882,-0.12191287798520989,-0.10644603904506766,0.19269877636838828,0.10157244354707018,-0.27946743857125966,0.1941221516681253,0.1203822960971479,0.287691035221485,-0.4669124853800213,0.05128704381729676,-0.20596385455235122,-0.08967291738122185,0.29740840317037964,-0.17019038042337797,-0.31792661448889703,0.2852399846434537,-0.004857090090581551,0.18027310392301388,-0.6825511541733249,-0.3475966079547561,-0.013731843410994315,0.08589240694698219,0.22420318421382035,-0.04144286749783532,-0.30659765797076943,0.02076037581281298,0.11035897679659001,0.30233985045731515,0.19218341557575513,-0.3998531258814637,-0.2225111779433746,0.032514822606913185,-0.0635185423003577,-0.17593661298315055,-0.13294346238433263,-0.021770697206818568,-0.3684373087741619,-0.2288394521177679,-0.4306116082862559,0.11656085662883697,-0.5330832874409452,0.1106486690358679,-0.6509600930320403,-0.047716148478741616,-0.2515822499714204,-0.15428289093756575,-0.1030911198938611,-0.10098867138628975,-0.15689488197006085,0.04303850170470014,-0.09398112725784813,-0.16507852712470594,-0.23426424953845526,-0.32444056400288446,0.42956860182050605,-0.2586971153870081,0.09519549423816898,0.18004508844342126,0.401344000905965,0.3232888175149924,-0.2263489289177869,-0.0661710619282303,0.06733285109703502,-0.03946684609644535,-0.12728166977717592,0.1584024378993263,0.1224555338366713,0.07115478644095674,-0.02099454766027975,-0.2095838412641342,-0.003243451598336833,-0.12539932836108392,-0.1805801938275522,0.07709414662542713,-0.2216925710411033,0.5376127208572825,-0.14042390751808398,-0.31668162629921426,-0.21347184782325712,0.04762723088799703,-0.4094134374594205,0.22180693897939818,-0.39656473090445843,-0.2768437570634319,-0.23514844763258225,0.03538130613776502,0.1338211273904335,-0.03895543028033899,0.13198281989582483,-0.5347488555001405,-0.004386582400798034,0.12688528434466662,0.45493228341206304,0.05365515222825934,-0.1733812845347984,-0.1904107369246617,-0.021247464878854316,-0.2997817841779238,-0.41152293409095364,-0.1288497913042761,-0.28425355270087493,-0.9398176891786534,0.2392657300294445,-0.08443803861644028,-0.2574148360262143,-0.11294259597548262,-0.012207400229954146,0.10090726054403376,-0.26757935533248656,0.15216347460886936,0.17869680022346301,-0.18719807812146882,-0.18129898796712496,0.21723546905792546,-0.32678280198319953,-0.12948171330538116,0.1992397551416616,0.0473729186651326,0.23145886361862722,0.2777956116984228,0.22404383486610868,-0.13502561284485637,0.05445518247381642,-0.3066256119738,-1.5613396514796705,0.09196671260173161,0.39948917313489574,-0.04354620161495859,-0.7685688551546264,0.41821873122478337,-0.04675988918393159,-0.23226580251503037,-0.2982320443396702,0.1612169138667241,-0.25637653661544846,0.1213779569250164,0.1621222968828988,0.11203506557467335,-0.027779753768754745,0.12060085035074053,0.16065264050473615,-0.38818684030479744,-0.3871126444792026,-0.15174943165618515,0.04898483896886319,0.325281390453938,-0.18381303441077534,-0.07942789373151982,-0.2134882132978646,0.31679329725864136,-0.05319971955930214,0.293015563519873,-0.06292815695337595,-0.3946083099488078,-0.21889195193693922,0.0521561432682347,-0.24830980527565316,-0.4708558592373038,-0.0976197957096474,0.14862543760352764,-0.1748795551690705,-0.08174208657334248,0.21207501661035622,0.15633264826482218]},"recheck":[{"seeds":[621000,621256],"paired":{"n":256,"mean_diff":-0.047935725222928216,"se":0.016661243169417535,"worst":-1.622632051127141},"gas":{"candidate":{"max_ok":233709,"oog":0,"other_failures":0},"stack":{"max_ok":211588,"oog":0,"other_failures":0}},"valid":true,"mean_edge":{"candidate":516.2851007691631,"stack":516.333036494386},"id":14,"params":{"kap":0.1466710889875664,"km":0.8445283552872838,"sm":6.513531343412083,"wa":5.368537570002498e-05}},{"seeds":[621000,621256],"paired":{"n":256,"mean_diff":-0.06110318985329832,"se":0.01679670298737299,"worst":-1.7067785102312314},"gas":{"candidate":{"max_ok":233817,"oog":0,"other_failures":0},"stack":{"max_ok":211588,"oog":0,"other_failures":0}},"valid":true,"mean_edge":{"candidate":516.2719333045327,"stack":516.333036494386},"id":15,"params":{"kap":0.14532894520186232,"km":1.9755534502650964,"sm":0.48036779389035694,"wa":9.407142797294288e-05}},{"seeds":[621000,621256],"paired":{"n":256,"mean_diff":-0.03830360969203861,"se":0.01738698101476868,"worst":-1.6106227001912998},"gas":{"candidate":{"max_ok":233709,"oog":0,"other_failures":0},"stack":{"max_ok":211588,"oog":0,"other_failures":0}},"valid":true,"mean_edge":{"candidate":516.294732884694,"stack":516.333036494386},"id":12,"params":{"kap":0.1625272569756354,"km":0.4284270084486296,"sm":9.219750525550602,"wa":5.206004236547325e-05}}],"held_out":{"seeds":[630000,630512],"paired":{"n":512,"mean_diff":-0.04513793151763412,"se":0.012969337368919887,"worst":-1.5613396514796705},"gas":{"candidate":{"max_ok":233712,"oog":0,"other_failures":0},"stack":{"max_ok":211576,"oog":0,"other_failures":0}},"valid":true,"mean_edge":{"candidate":528.0318822893537,"stack":528.0770202208712},"arb_edge_delta":0.46179260788959176,"retail_edge_delta":-0.5069305394072259,"arb_volume_reconstruction_max_abs_error":0.00010590935562504455},"retail_edge_delta":-0.5069305394072259,"arb_edge_delta":0.46179260788959176,"gas":{"max_ok":233732,"oog":0},"confirm":null,"notes":["STACK code downloaded from the specified artifact; SHA-256 matched 2eaafc7960e520b8a7fd322ec8afaff8fa677c730228a961efb509cc30b25719. Pinned setup succeeded, wheel checksum passed, StarterStrategy validated.","Compilation used the pinned SolidityCompiler: solc 0.8.24, optimizer 200 runs, viaIR, Paris EVM. The delivered code depends only on the challenge-provided AMMStrategyBase.sol and IAMMStrategy.sol.","Each arm ran independently against VanillaStrategy via amm_sim_rs.run_batch(...,8), in contiguous 32-seed chunks to bound memory. All seeds retained. Config draws use default_rng(seed): uniform size [19,21], rate [0.6,1.0], sigma [0.000882,0.001008]; 10,000 steps; price seed=seed and retail seed=seed+1.","STACK retained verbatim apart from inserting parameter constants, the shadow call immediately after tradeBoost, and pure helper functions. Original tail compression and fee caps still follow the shadow call. kap=0 matched all 32 per-seed STACK edges exactly on [620000,620032).","Objective uses literal STACK sizeHat (reserve-relative fraction) and current reserveY in WAD. wa absorbs the relative weighting. Positive-part squared terms mean E[(g-fa)_+^2] and E[(-g-fb)_+^2]. Normal moments use a deterministic CDF polynomial and reciprocal Taylor exponential; numerical grid [-8,8] max absolute pdf/cdf errors were 2.35e-14/7.452e-8. Distribution tails beyond 8 standard deviations are truncated. Zero variance is floored to 1e-18; zero sizeHat or spot leaves the STACK pair unchanged.","Candidate neighbours are base and four single-side +/-3bp changes, with fees floored at zero before blending; strict objective improvements break ties in base, bid+, ask+, bid-, ask- order. Five-pair pilot max afterSwap gas was 233619; three-pair fallback was not required.","CMA-ES: numpy RNG seed 2, population 10, mu 5, positive log weights, full covariance adaptation. Initial transformed mean [0,0,0,log(0.0001)], global sigma 0.8. kap=sigmoid(x0), km=exp(x1), sm=exp(x2), wa=exp(x3); clipping bounds [-8,8], [-8,6], [-8,6], [-20,2]. Search budget 1800 seconds; any final in-flight full evaluation was completed. Best three valid CRN candidates were rechecked; best recheck mean was frozen before validation and held-out evaluation.","Arbitrage edge reconstructed from previous end-of-step spot and fees, current fair price, and constant k=1000000 using the pinned simulator closed-form arbitrage sizing and fee-on-input quotes. Retail edge=total edge-arbitrage edge. Volume reconstruction was checked against reported arb volume with 0.001 quote-unit absolute tolerance per seed. The initial 0.00001 tolerance was too strict: a 200,000-case near-zero-profit numerical test with 1e-13 relative k perturbations produced volume differences up to 0.0001813 while edge differences stayed below 5.1e-12. The simulator tests profit>0, so floating-point sign flips can change tiny trade volumes. Actual maximum volume discrepancy is reported. The tolerance was repaired by postprocessing the saved results; held-out simulations were not repeated. The initial fee is 4bp on both sides.","Paired se is sample standard deviation of per-seed candidate-minus-STACK differences divided by sqrt(n). worst is the minimum per-seed difference. Seed ranges are half-open. Gas max_ok refers only to successful submission afterSwap calls; separate callback counters also checked for reverts, other halts, transaction errors, and malformed returns.","The held-out confirmation gate did not pass; [5034000,5036000) remains untouched. No leaderboard result is claimed."]}
