{"item":"a","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 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[15] = 400000000000000000 | (uint256(2000000000000000) << 160); 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            // Process variance is propagated inside the censored update.\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        // Censored assumed-density posterior. No external or future inputs.\n        uint256 arbProbability;\n        (fastHat, uncertainty, arbProbability) = _posterior(PosteriorInput(\n            fastHat, uncertainty, pImplied, spot, slots[2] >> 64,\n            lambdaHat, wmul(uint80(slots[15]), 314593414073877952), prevBidFee, prevAskFee, firstInStep, silent, trade.isBuy,\n            trade.reserveY > 0 ? wdiv(trade.amountY, trade.reserveY) : 0\n        ));\n        slots[13] = uncertainty;\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 originalLambda = lambdaHat; uint256 originalSize = sizeHat;\n\n        if (167337836421205824 > 0) {\n            uint256 packedFlow = slots[15];\n            uint256 rate = uint80(packedFlow);\n            uint256 count = uint80(packedFlow >> 80);\n            uint256 meanSize = uint80(packedFlow >> 160);\n            if (rate == 0) rate = 400000000000000000;\n            if (meanSize == 0) meanSize = 2000000000000000;\n            if (isNewStep) {\n                uint256 inst = count / silent;\n                if (inst > 3 * WAD) inst = 3 * WAD;\n                uint256 retention = _powWad(999000000000000000, silent > 64 ? 64 : silent);\n                rate = wmul(rate, retention) + wmul(inst, WAD-retention);\n                count = 0;\n            }\n            uint256 weight = firstInStep ? WAD-arbProbability : WAD;\n            uint256 correctedWeight = weight;\n            if (2 == 2) {\n                uint256 missing = wmul(feeUsed, 196030880396139429888);\n                if (missing > 333333333333333376) missing = 333333333333333376;\n                correctedWeight = wdiv(weight, WAD-missing);\n            }\n            count += correctedWeight;\n            uint256 learning = wmul(WAD-999000000000000000, weight);\n            meanSize = _blend(meanSize, tradeRatio, learning);\n            slots[15]=rate | (count << 80) | (meanSize << 160);\n            uint256 retailRate = wmul(rate, 314593414073877952);\n            uint256 retailSize = 2 == 0 ? sizeHat : wmul(meanSize,1883296158119298304);\n            lambdaHat = _blend(lambdaHat,retailRate,167337836421205824);\n            sizeHat = _blend(sizeHat,retailSize,167337836421205824);\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        lambdaHat = originalLambda; sizeHat = originalSize;\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        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\n    struct PosteriorInput {\n        uint256 mu; uint256 v; uint256 obs; uint256 spot; uint256 preSpot;\n        uint256 activity; uint256 cleaned; uint256 bid; uint256 ask; bool first; uint256 silent; bool buy; uint256 size;\n    }\n    function _posterior(PosteriorInput memory x) internal pure returns (uint256, uint256, uint256) {\n        if (x.mu == 0) x.mu = x.spot;\n        if (x.v < 10000000000) x.v = 10000000000;\n        uint256 lo = wmul(x.preSpot, WAD-x.bid);\n        uint256 hi = wdiv(x.preSpot, WAD-x.ask);\n        if (x.first) {\n            if (x.silent>1 && x.preSpot>0) {\n                uint256 elapsed=x.silent>8?8:x.silent;\n                x.v += 902500000000*(elapsed-1);\n                (x.mu,x.v)=_band(x.mu,x.v,lo,hi);\n            }\n            x.v+=902500000000;\n        }\n        uint256 mRetail = x.mu;\n        uint256 vRetail = x.v;\n        // A missing own-pool trade is a censored price observation.\n        if (x.first && x.preSpot > 0) {\n            (mRetail, vRetail) = _band(x.mu, x.v, lo, hi);\n        }\n        if (!x.first) {\n            // A later print is retail. Only an interior route is an observation\n            // of the other pool, with explicit observation uncertainty.\n            uint256 fee = x.buy ? x.bid : x.ask;\n            if (fee > 30 * BPS) {\n                uint256 normal = x.buy ? wdiv(wmul(x.spot, WAD-fee), WAD-30*BPS)\n                    : wdiv(wmul(x.spot, WAD-30*BPS), WAD-fee);\n                uint256 residual = wdiv(absDiff(normal, x.mu),x.mu);\n                uint256 noise = 9000000000000 + wmul(residual,residual);\n                uint256 k = wdiv(x.v,x.v+noise);\n                return (_blend(x.mu,normal,k),wmul(x.v,WAD-k),0);\n            }\n            return (x.mu,x.v,0);\n        }\n        uint256 e = wdiv(absDiff(x.obs,x.mu),x.mu);\n        uint256 totalV = x.v + 22500000000;\n        uint256 z = wdiv(wmul(e,e),totalV);\n        uint256 density = _powWad(wdiv(WAD,WAD+z/8),4);\n        uint256 odds = wmul(density,wdiv(4000000000000000,_isqrt(totalV*WAD)));\n        if (x.size > 3000000000000000) odds = wmul(odds,4*WAD/10);\n        if (x.silent > 1) odds = wmul(odds,8*WAD/10);\n        uint256 sd = _isqrt(x.v*WAD);\n        uint256 width = wdiv(hi-lo,x.mu);\n        uint256 distance = x.mu<lo?lo-x.mu:(x.mu>hi?x.mu-hi:0);\n        uint256 zBand = wdiv(wdiv(distance,x.mu),sd);\n        uint256 mass = wmul(wdiv(width,width+2*sd),wdiv(WAD,WAD+wmul(zBand,zBand)));\n        if (mass < WAD/100) mass = WAD/100;\n        odds = wdiv(odds,mass);\n\n        uint256 cleaned = x.cleaned > 1000000000000000 ? x.cleaned : 1000000000000000;\n        uint256 ratio = wdiv(x.activity, cleaned);\n        if (ratio < 50000000000000000) ratio = 50000000000000000;\n        if (ratio > 20*WAD) ratio = 20*WAD;\n        ratio = wdiv(WAD, ratio);\n        for (uint256 j=0; j<4; j++) ratio = _isqrt(ratio*WAD);\n        odds = wmul(odds, _powWad(ratio, 7));\n        odds = wmul(odds, 1195992335013039616);\n        uint256 prob = wdiv(odds,WAD+odds);\n        uint256 kArb = wdiv(x.v,totalV);\n        uint256 mArb = _blend(x.mu,x.obs,kArb);\n        uint256 mean = _blend(mRetail,mArb,prob);\n        uint256 between = wdiv(absDiff(mArb,mRetail),x.mu);\n        uint256 variance = wmul(prob,wmul(x.v,WAD-kArb)) + wmul(WAD-prob,vRetail)\n            + wmul(wmul(prob,WAD-prob),wmul(between,between));\n        if (variance > 100000000000000) variance = 100000000000000;\n        return (mean,variance,prob);\n    }\n    function _blend(uint256 a,uint256 b,uint256 w) internal pure returns(uint256) {\n        return b>=a ? a+wmul(b-a,w) : a-wmul(a-b,w);\n    }\n    function _band(uint256 mu,uint256 v,uint256 lo,uint256 hi) internal pure returns(uint256,uint256) {\n        // Soft interval likelihood avoids discontinuities at quadrature nodes.\n        uint256 sd=wmul(mu,_isqrt(v*WAD));\n        uint256[3] memory acc;\n        for(uint256 j=0;j<7;j++) {\n            uint256 p=j<3 ? (mu>(3-j)*sd?mu-(3-j)*sd:1) : mu+(j-3)*sd;\n            uint256 w=j==3?72:(j==2||j==4?45:(j==1||j==5?10:1));\n            uint256 distance=p<lo?lo-p:(p>hi?p-hi:0);\n            uint256 z=sd>0?wdiv(distance,sd):0;\n            uint256 likelihood=wdiv(WAD,WAD+4*wmul(z,z));\n            w=wmul(w*WAD,likelihood);\n            acc[0]+=w;acc[1]+=wmul(w,p);\n            uint256 d=wdiv(absDiff(p,mu),mu);\n            acc[2]+=wmul(w,wmul(d,d));\n        }\n        uint256 m=wdiv(acc[1],acc[0]);\n        uint256 d=wdiv(absDiff(m,mu),mu);\n        uint256 second=wdiv(acc[2],acc[0]);\n        return(m,second>wmul(d,d)?second-wmul(d,d):10000000000);\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    function getName() external pure override returns (string memory) { return \"censored_10\"; }\n}\n","sha256":"e1d5770ed1f046b8eaaceb1957fb7c129b3c0d9ca1d6b0dc8f00ef8ed2f9071e","params":{"gamma":-0.4375,"prior_scale":1.1959923350130397,"mix":0.16733783642120584,"rate_scale":0.314593414073878,"rs2_params_exact":[2,0.3424067991934183,0.999,0.36638342491340714,1.8832961581192982,196.03088039613942,1.5],"rs2_parameter_order":["kind","mix","decay","rate_scale","size_scale","correction","cap"]},"mechanism":{"family":"RS2 posterior odds with cleaned-rate correction","formula":"arb_odds = V10_odds * prior_scale * clamp(activity / max(cleaned_rate * rate_scale, 0.001), 0.05, 20)^gamma","activity":"lambdaHat after its existing elapsed-step update","cleaned_rate":"previous slots[15] uint80 rate, before current-trade posterior weighting; RS2 estimator update is unchanged","fallback_reason":"V10 _posterior has no explicit activity-rate prior to blend. Used the requested odds-scaling fallback.","gamma_grid":"nearest 1/16 in [-2,2], four WAD integer square roots then integer power; inverse ratio for negative gamma","scope":"Only first-print arb-vs-retail posterior odds are scaled; RS2 fee-flow mix and rate_scale are searched. Other parameters remain params_exact.","null_check":"gamma=0 and prior_scale=1 with RS2 mix/rate_scale reproduce RS2 SHA256 exactly"},"log":[{"params":{"gamma":-1.0,"prior_scale":1.0801356843162604,"mix":0.341160096951962,"rate_scale":0.6652984608256611},"sha256":"1404ee18ce6f825a8e76aa50c57e0dbea6e0658f5a31eb6f3d4121f4f71b6258","block":[880000,880063],"n":64,"mean_diff":-0.12336824998785278,"se":0.08165129864716432,"max_ok":null,"init_max_ok":null,"oog":0,"other_halts":0,"fitness":null,"generation":0,"status":"discarded: gas maxima parser used wrong role case; not used for CMA or top-three selection"},{"params":{"gamma":-1.0625,"prior_scale":1.332330449997252,"mix":0.359282677803641,"rate_scale":0.37142414859490125},"sha256":"77ab7c0792582e2cf69f9b94f6bee28a9aa09bc75654d44a875a952d17fbeaf7","block":[880000,880063],"n":64,"mean_diff":-0.25284979351051806,"se":0.09628741572627005,"max_ok":null,"init_max_ok":null,"oog":0,"other_halts":0,"fitness":null,"generation":0,"status":"discarded: gas maxima parser used wrong role case; not used for CMA or top-three selection"},{"params":{"gamma":-1.0,"prior_scale":1.0801356843162604,"mix":0.341160096951962,"rate_scale":0.6652984608256611},"sha256":"1404ee18ce6f825a8e76aa50c57e0dbea6e0658f5a31eb6f3d4121f4f71b6258","block":[880064,880127],"n":64,"mean_diff":-0.06258037748090217,"se":0.0833878229852433,"max_ok":207508,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.06258037748090217,"generation":0},{"params":{"gamma":-1.0625,"prior_scale":1.332330449997252,"mix":0.359282677803641,"rate_scale":0.37142414859490125},"sha256":"77ab7c0792582e2cf69f9b94f6bee28a9aa09bc75654d44a875a952d17fbeaf7","block":[880064,880127],"n":64,"mean_diff":-0.30619486474352975,"se":0.09153285826340345,"max_ok":207654,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.30619486474352975,"generation":0},{"params":{"gamma":-1.0625,"prior_scale":0.6080307926006288,"mix":0.213236048456377,"rate_scale":1.0730137542392886},"sha256":"d455c9489bcd0503c6d4248553d596b4994bf32b0a7a9f7f737e55d7e3d6e6e3","block":[880064,880127],"n":64,"mean_diff":-0.43779853151731185,"se":0.0987232261983866,"max_ok":206451,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.43779853151731185,"generation":0},{"params":{"gamma":0.6875,"prior_scale":0.8367856547826804,"mix":0.24402097287669322,"rate_scale":1.5164177181074971},"sha256":"1fd5861f938812304ed0339585175633ce4e2d322f6516a855624c0cf55922c4","block":[880064,880127],"n":64,"mean_diff":-1.1528597695917693,"se":0.16163376373734978,"max_ok":206341,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-1.1528597695917693,"generation":0},{"params":{"gamma":0.75,"prior_scale":0.7589828261186066,"mix":0.3154586455864463,"rate_scale":0.10992964308439437},"sha256":"999a3fb1d0f77eb0d7de3b64ba11abc34cf63fd7ace04280ee0ad8470b8b7a02","block":[880064,880127],"n":64,"mean_diff":-0.4386344296827618,"se":0.1284856317477929,"max_ok":207386,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.4386344296827618,"generation":0},{"params":{"gamma":0.125,"prior_scale":1.2637449575980098,"mix":0.29292633288837805,"rate_scale":0.5864749169968143},"sha256":"1859a36bdb299b03c31d3dc50ee5b2f86da260d71a6ed91d87d4c784f34e5117","block":[880064,880127],"n":64,"mean_diff":0.030881549157300903,"se":0.08530500151329186,"max_ok":206868,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.030881549157300903,"generation":0},{"params":{"gamma":0.4375,"prior_scale":1.2350522968277704,"mix":0.22892866199789347,"rate_scale":0.23419273728951942},"sha256":"44d66cf854fd2b294f715795c022f39db14500c67d890959ff4847bf39c08a4d","block":[880064,880127],"n":64,"mean_diff":-0.046428182608139856,"se":0.08095651951343917,"max_ok":207313,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.046428182608139856,"generation":0},{"params":{"gamma":1.5625,"prior_scale":0.944209581636445,"mix":0.3477911562573514,"rate_scale":0.6291885823823087},"sha256":"eb86addb61a5cb01662825354729a2ecf496ef4aaa3689457615e0fdd9f9ee24","block":[880064,880127],"n":64,"mean_diff":-0.48350719518963015,"se":0.09908916182791223,"max_ok":207711,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.48350719518963015,"generation":0},{"params":{"gamma":-0.4375,"prior_scale":0.8830757198081829,"mix":0.6444878363141947,"rate_scale":1.1390711955396207},"sha256":"fec6c125a33def04e98f6ee3df8b2780d62894766fc13fc1f0cbd9abc00317df","block":[880064,880127],"n":64,"mean_diff":-2.9817965015765635,"se":0.24429891157896266,"max_ok":206177,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-2.9817965015765635,"generation":0},{"params":{"gamma":-0.875,"prior_scale":1.0195497385561252,"mix":0.1103094525110753,"rate_scale":0.586538099535193},"sha256":"39303c34f5ff420e8a428a16566d23c1d8e754d5aebd1b0a6324f21811de8fdf","block":[880064,880127],"n":64,"mean_diff":-0.054853341667731925,"se":0.06511243304271677,"max_ok":207617,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.054853341667731925,"generation":0},{"params":{"gamma":-0.0625,"prior_scale":1.6185290528789187,"mix":0.2270540884351023,"rate_scale":1.250195721667926},"sha256":"ce4b9b7b5cb6c0f0f2bd92e895463990062debe492c771f5854fd0b5ee150a07","block":[880128,880191],"n":64,"mean_diff":-0.7855559661086575,"se":0.12642042084884686,"max_ok":204139,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.7855559661086575,"generation":1},{"params":{"gamma":-0.8125,"prior_scale":1.2387976869938124,"mix":0.26213476949435516,"rate_scale":0.540456177172502},"sha256":"992af2bd48102a7177beb3b38d0b0b2951f594e65c2bdf2d779b15fda28422b0","block":[880128,880191],"n":64,"mean_diff":0.17492015315429477,"se":0.06865476776960208,"max_ok":204670,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.17492015315429477,"generation":1},{"params":{"gamma":0.625,"prior_scale":1.355744835892202,"mix":0.1658143924524622,"rate_scale":0.22716975976683085},"sha256":"442bf44f812ce5c1f32497164d32b4b691abe73bc629b09541d279ba3b679abc","block":[880128,880191],"n":64,"mean_diff":-0.38538035294308326,"se":0.08021276951205344,"max_ok":204800,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.38538035294308326,"generation":1},{"params":{"gamma":-0.4375,"prior_scale":1.1959923350130397,"mix":0.16733783642120584,"rate_scale":0.314593414073878},"sha256":"e1d5770ed1f046b8eaaceb1957fb7c129b3c0d9ca1d6b0dc8f00ef8ed2f9071e","block":[880128,880191],"n":64,"mean_diff":0.21621254620114527,"se":0.05682931862645107,"max_ok":204459,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.21621254620114527,"generation":1},{"params":{"gamma":-1.3125,"prior_scale":1.4154231500511345,"mix":0.2860896699442512,"rate_scale":0.20749262344999497},"sha256":"56021260bc35ee331872e74065e5fe6e02179431e9717e170ca25bc0b436b064","block":[880128,880191],"n":64,"mean_diff":-1.3185609929786821,"se":0.12580996290150862,"max_ok":203586,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-1.3185609929786821,"generation":1},{"params":{"gamma":0.25,"prior_scale":1.3352972582025364,"mix":0.21662161118114767,"rate_scale":0.2799870933491598},"sha256":"7b444f1089b6561c086afc2237639b6cbb46c7fbd7b1db32b3fda176a64055dc","block":[880128,880191],"n":64,"mean_diff":0.034789984646211636,"se":0.06701847513142686,"max_ok":204304,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.034789984646211636,"generation":1},{"params":{"gamma":0.6875,"prior_scale":1.4212684599390504,"mix":0.4719088646847114,"rate_scale":0.9989322131460717},"sha256":"1d6b0aeabb1c7f0915839168ee3c4e783f5b6703b8f690930af0c830b2b573dd","block":[880128,880191],"n":64,"mean_diff":-1.1931919479290354,"se":0.1522623549996677,"max_ok":204884,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-1.1931919479290354,"generation":1},{"params":{"gamma":0.125,"prior_scale":1.0827734229259578,"mix":0.20196184836182615,"rate_scale":0.18868820796206015},"sha256":"080326e8081acfa4a58339bf809a7e8fd1880f012b4b6b667a4ddec783a5124b","block":[880128,880191],"n":64,"mean_diff":0.17424363769659124,"se":0.06577085292784177,"max_ok":203955,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.17424363769659124,"generation":1},{"params":{"gamma":0.0,"prior_scale":1.2527684225511315,"mix":0.4317663241311585,"rate_scale":1.1688930138067564},"sha256":"3af712e031254185afd3865c0b33a5107e0a9b39f83b853b820b495fcd37ba14","block":[880128,880191],"n":64,"mean_diff":-1.7408662747470842,"se":0.1715054291207068,"max_ok":198941,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-1.7408662747470842,"generation":1},{"params":{"gamma":-0.0625,"prior_scale":1.3158161583271846,"mix":0.06561825603483071,"rate_scale":0.1599484047174331},"sha256":"1654330e5f2cd62b9e07dd210a66957fcdfea15f51b28fa7bd71837543d9ed7f","block":[880128,880191],"n":64,"mean_diff":0.052513426900820726,"se":0.043000635552912655,"max_ok":203791,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.052513426900820726,"generation":1},{"params":{"gamma":-1.125,"prior_scale":1.241649837125502,"mix":0.1074180227213913,"rate_scale":0.04113921435387035},"sha256":"5121848942238a1df8907e1e67a3d61a1ff1cad2eb1831828334f84fa8a347fd","block":[880192,880255],"n":64,"mean_diff":-3.25287259606215,"se":0.14943540763121582,"max_ok":203448,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-3.25287259606215,"generation":2},{"params":{"gamma":-0.4375,"prior_scale":0.7681631862471734,"mix":0.19188310117497281,"rate_scale":0.5301623252960553},"sha256":"ac15fc427f4837aa4adbf47bccd1fab058c7b5a5847b51b30712b71be9f1910e","block":[880192,880255],"n":64,"mean_diff":0.08800804699121567,"se":0.06780477946140588,"max_ok":203186,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.08800804699121567,"generation":2},{"params":{"gamma":0.375,"prior_scale":0.9232745478864319,"mix":0.14351667121561754,"rate_scale":0.609654263089482},"sha256":"b64ba8cbab6eb7510850da3139a0e3e89a6500ce7badf2478bd6399bf2db60cf","block":[880192,880255],"n":64,"mean_diff":0.0920723314125107,"se":0.05173740868765127,"max_ok":202993,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.0920723314125107,"generation":2},{"params":{"gamma":0.4375,"prior_scale":1.141450577233259,"mix":0.2290455687229124,"rate_scale":0.3741768633785886},"sha256":"4d3a824c9afbaf69d21a59694093a901a01e978f3c42d83e3ab105f468b73001","block":[880192,880255],"n":64,"mean_diff":-0.005646950533840567,"se":0.06794869907076004,"max_ok":203131,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.005646950533840567,"generation":2},{"params":{"gamma":-0.625,"prior_scale":1.0682467951044727,"mix":0.017627100792018728,"rate_scale":0.2372403523458161},"sha256":"a8c70fd96c9545ebca52c209c3e2edbe1ef2823f170ac2d7f9f1cac75530faa8","block":[880192,880255],"n":64,"mean_diff":-0.3568797561081478,"se":0.08470815339327217,"max_ok":203263,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.3568797561081478,"generation":2},{"params":{"gamma":-1.0625,"prior_scale":1.0212898075060899,"mix":0.06083527867983487,"rate_scale":0.8894851236629203},"sha256":"23a83427419c2ff99fff8576764fc9f0e029c34943d13fba7ce7186f0c0f2061","block":[880192,880255],"n":64,"mean_diff":-0.025478525844369493,"se":0.049584974749675444,"max_ok":203482,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.025478525844369493,"generation":2},{"params":{"gamma":-0.4375,"prior_scale":1.2158983101853549,"mix":0.19633982544839929,"rate_scale":0.196718571456213},"sha256":"82cf9feac734fae6526904f4e9c1dfb5a8d4c8df9824f4b8348df4b3a3a6cc33","block":[880192,880255],"n":64,"mean_diff":0.09373845409814141,"se":0.07136153815460299,"max_ok":203176,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.09373845409814141,"generation":2},{"params":{"gamma":-0.5625,"prior_scale":1.3112701095276063,"mix":0.13217371168561284,"rate_scale":0.8427689102057432},"sha256":"e5deb2e3fcd64afd0f363a53734880d740f2ecc0a423bc94cd69205e8852d74d","block":[880192,880255],"n":64,"mean_diff":-0.002293612495118502,"se":0.05715730562740286,"max_ok":203273,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.002293612495118502,"generation":2},{"params":{"gamma":-0.6875,"prior_scale":1.456046382289907,"mix":0.03508751788262573,"rate_scale":0.4115154440318295},"sha256":"0e171550e20b9cd532605075847454f98795d2a31821ed4190dbe2382a4c81a9","block":[880192,880255],"n":64,"mean_diff":0.023482411867787434,"se":0.05481555866286955,"max_ok":203379,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.023482411867787434,"generation":2},{"params":{"gamma":-0.0625,"prior_scale":1.4579219838469608,"mix":0.3552210586326812,"rate_scale":0.16720928926323492},"sha256":"f455588b06c3f6c08e05721343cac7a873b9cedccedc0d59ac288edd77e244b6","block":[880192,880255],"n":64,"mean_diff":0.0846483911186704,"se":0.07911458125604384,"max_ok":202535,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.0846483911186704,"generation":2},{"params":{"gamma":-0.625,"prior_scale":1.3702776911785954,"mix":0.12689351894672746,"rate_scale":0.23518633179266296},"sha256":"e6e02093708a6b4a2b2db94459b5dbc68a184a36d13c108a615eccb5a349d0d7","block":[880256,880319],"n":64,"mean_diff":-0.23875231531230057,"se":0.13439787724379804,"max_ok":204341,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.23875231531230057,"generation":3},{"params":{"gamma":0.25,"prior_scale":1.183545085962094,"mix":0.04658600732173811,"rate_scale":0.12688798928157424},"sha256":"016430622e392ce1cdd0a9b6ad06c78b4fe8de6cf3b4ae7df0eda50c70d05b8e","block":[880256,880319],"n":64,"mean_diff":-0.24988208288741198,"se":0.12038160552793364,"max_ok":204115,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.24988208288741198,"generation":3},{"params":{"gamma":0.375,"prior_scale":0.981640003710007,"mix":0.12257832524826655,"rate_scale":0.18944934924758605},"sha256":"463af85c3592699b5bfd87596b9d6890d39042ca8276030de0257857a533f401","block":[880256,880319],"n":64,"mean_diff":-0.18874389378707956,"se":0.12778386887953816,"max_ok":204075,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.18874389378707956,"generation":3},{"params":{"gamma":0.375,"prior_scale":0.7478755943056776,"mix":0.2236189656452461,"rate_scale":0.3459406105022505},"sha256":"cff6bdd004ef401e87d50319651a84f4f2ad7ce62a5dc511f7718f64cbac99ac","block":[880256,880319],"n":64,"mean_diff":-0.017388933914437743,"se":0.12448795509449645,"max_ok":204089,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.017388933914437743,"generation":3},{"params":{"gamma":-0.0625,"prior_scale":1.1877923417954643,"mix":0.17063510947481794,"rate_scale":0.4919123371219655},"sha256":"e7ca2319a03ea40ec0523f2364fa76970d05429f19b76c3b24cef377eb38395a","block":[880256,880319],"n":64,"mean_diff":-0.01838974543477967,"se":0.11295671267947623,"max_ok":203619,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":-0.01838974543477967,"generation":3},{"params":{"gamma":-0.125,"prior_scale":1.3313667916141767,"mix":0.0811825969166224,"rate_scale":0.25570872608827383},"sha256":"92a2a30b5eb0eb3c234a0140b0fb70be8d561c852f6f28ccc9468867b93c8a8c","block":[880256,880319],"n":64,"mean_diff":0.11166076766465238,"se":0.03945021223049646,"max_ok":203831,"init_max_ok":243099,"oog":0,"other_halts":0,"fitness":0.11166076766465238,"generation":3}],"recheck":{"seeds":{"first":884000,"last":884255,"n":256},"candidates":[{"params":{"gamma":-0.4375,"prior_scale":1.1959923350130397,"mix":0.16733783642120584,"rate_scale":0.314593414073878},"sha256":"e1d5770ed1f046b8eaaceb1957fb7c129b3c0d9ca1d6b0dc8f00ef8ed2f9071e","seeds":[884000,884255],"paired":{"n":256,"mean_diff":0.07378480781543661,"se":0.03331698675363763,"worst":[{"seed":884252,"d":-2.817841399647932},{"seed":884128,"d":-1.5940656064295808},{"seed":884166,"d":-1.1951589769031443},{"seed":884066,"d":-1.141313793022448},{"seed":884029,"d":-1.0588444648982431}]},"retail_edge_delta":{"mean":1.066740650227799,"se":0.032794700650194714},"arb_edge_delta":{"mean":-0.9929558424123572,"se":0.014956688161814329},"reconciliation_max_abs":1.1368683772161603e-13,"gas":{"max_ok":205429,"init_max_ok":243099,"oog":0,"other_halts":0,"valid":true}},{"params":{"gamma":-0.8125,"prior_scale":1.2387976869938124,"mix":0.26213476949435516,"rate_scale":0.540456177172502},"sha256":"992af2bd48102a7177beb3b38d0b0b2951f594e65c2bdf2d779b15fda28422b0","seeds":[884000,884255],"paired":{"n":256,"mean_diff":0.07090049372952589,"se":0.033690338546729925,"worst":[{"seed":884252,"d":-2.79985273517525},{"seed":884240,"d":-1.610211094707097},{"seed":884166,"d":-1.5989988906312647},{"seed":884015,"d":-1.0723737429105995},{"seed":884066,"d":-0.9116262179769592}]},"retail_edge_delta":{"mean":0.7331601890264918,"se":0.03159789743947524},"arb_edge_delta":{"mean":-0.6622596952969673,"se":0.015935162795222172},"reconciliation_max_abs":2.2737367544323206e-13,"gas":{"max_ok":205642,"init_max_ok":243099,"oog":0,"other_halts":0,"valid":true}},{"params":{"gamma":0.125,"prior_scale":1.0827734229259578,"mix":0.20196184836182615,"rate_scale":0.18868820796206015},"sha256":"080326e8081acfa4a58339bf809a7e8fd1880f012b4b6b667a4ddec783a5124b","seeds":[884000,884255],"paired":{"n":256,"mean_diff":0.07190823496136955,"se":0.032283060179178855,"worst":[{"seed":884252,"d":-3.4426860368774896},{"seed":884137,"d":-1.92468432519928},{"seed":884158,"d":-1.1127052624643738},{"seed":884234,"d":-1.029548560010312},{"seed":884112,"d":-1.0226702394246558}]},"retail_edge_delta":{"mean":0.8451124832317092,"se":0.03282826818054536},"arb_edge_delta":{"mean":-0.7732042482703398,"se":0.01610691821933287},"reconciliation_max_abs":1.1368683772161603e-13,"gas":{"max_ok":206639,"init_max_ok":243099,"oog":0,"other_halts":0,"valid":true}}],"freeze":{"sha256":"e1d5770ed1f046b8eaaceb1957fb7c129b3c0d9ca1d6b0dc8f00ef8ed2f9071e","params":{"gamma":-0.4375,"prior_scale":1.1959923350130397,"mix":0.16733783642120584,"rate_scale":0.314593414073878},"selection":"highest paired mean vs V10 on 884000..884255 among the top three valid search candidates","frozen_before_held_out":true}},"held_out":{"seeds":{"first":885000,"last":885511,"n":512},"vs_v10":{"n":512,"mean_diff":0.09144631988730889,"se":0.02246205623664221,"worst":[{"seed":885387,"d":-1.7154553959147734},{"seed":885114,"d":-1.2881859899260917},{"seed":885439,"d":-1.185673694812749},{"seed":885368,"d":-1.1344254737776964},{"seed":885324,"d":-1.116021799915984}]},"vs_rs2":{"n":512,"mean_diff":-0.10186244191330396,"se":0.022746843027335054,"worst":[{"seed":885401,"d":-4.034386355553579},{"seed":885137,"d":-2.3978931909537664},{"seed":885265,"d":-1.6740447344262748},{"seed":885368,"d":-1.6436031733971959},{"seed":885440,"d":-1.5734320059318634}]},"retail_edge_delta":{"vs_v10":{"mean":1.1079200178701136,"se":0.023803113737823112},"vs_rs2":{"mean":-0.4171379955662933,"se":0.023071255645269302}},"arb_edge_delta":{"vs_v10":{"mean":-1.016473697982806,"se":0.009769588316183138},"vs_rs2":{"mean":0.31527555365299076,"se":0.00994528341033354}},"reconciliation_max_abs":{"vs_v10":1.1368683772161603e-13,"vs_rs2":1.1368683772161603e-13},"arm_gas":{"frozen":{"max_ok":206156,"init_max_ok":243099,"oog":0,"other_halts":0,"valid":true},"rs2":{"max_ok":200257,"init_max_ok":243099,"oog":0,"other_halts":0,"valid":true},"v10":{"max_ok":192826,"init_max_ok":220981,"oog":0,"other_halts":0,"valid":true}},"arm_sha256":{"frozen":"e1d5770ed1f046b8eaaceb1957fb7c129b3c0d9ca1d6b0dc8f00ef8ed2f9071e","rs2":"f24b6ca198b744c380842c3a17964a6dc21f311bb04984b26733afa3fee8eaf2","v10":"cd9bdb45ab0537ad25c4fd90ca8618898cef6386de3df65f192eaef65fbca245"},"arm_mean_edge":{"frozen":527.2927935835941,"rs2":527.3946560255074,"v10":527.2013472637068},"rs2_vs_v10":{"paired":{"n":512,"mean_diff":0.19330876180061285,"se":0.02692941164798913,"worst":[{"seed":885306,"d":-3.2587486108627672},{"seed":885393,"d":-1.3617781693904476},{"seed":885169,"d":-1.2190938085501557},{"seed":885150,"d":-1.203126952226512},{"seed":885499,"d":-1.1340797504313969}]},"retail_edge_delta":{"mean":1.525058013436407,"se":0.028580489513260636},"arb_edge_delta":{"mean":-1.3317492516357967,"se":0.012418137275953707},"reconciliation_max_abs":1.1368683772161603e-13}},"gas":{"max_ok":206156,"init_max_ok":243099,"oog":0,"other_halts":0},"generator_source":"def generate_rs2_base(base,p):\n kind,mix,decay,scale,sscale,correction=p\n mix=int(mix*1e18);decay=int(decay*1e18)\n s=base.replace('(fastHat, uncertainty) = _posterior','uint256 arbProbability;\\n        (fastHat, uncertainty, arbProbability) = _posterior')\n s=s.replace('internal pure returns (uint256, uint256) {\\n        if (x.mu', 'internal pure returns (uint256, uint256, uint256) {\\n        if (x.mu')\n s=s.replace('wmul(x.v,WAD-k));','wmul(x.v,WAD-k),0);').replace('return (x.mu,x.v);','return (x.mu,x.v,0);').replace('return (mean,variance);','return (mean,variance,prob);')\n insert=f'''\n        if ({mix} > 0) {{\n            uint256 packedFlow = slots[15];\n            uint256 rate = uint80(packedFlow);\n            uint256 count = uint80(packedFlow >> 80);\n            uint256 meanSize = uint80(packedFlow >> 160);\n            if (rate == 0) rate = 400000000000000000;\n            if (meanSize == 0) meanSize = 2000000000000000;\n            if (isNewStep) {{\n                uint256 inst = count / silent;\n                if (inst > 3 * WAD) inst = 3 * WAD;\n                uint256 retention = _powWad({decay}, silent > 64 ? 64 : silent);\n                rate = wmul(rate, retention) + wmul(inst, WAD-retention);\n                count = 0;\n            }}\n            uint256 weight = firstInStep ? WAD-arbProbability : WAD;\n            uint256 correctedWeight = weight;\n            if ({kind} == 2) {{\n                uint256 missing = wmul(feeUsed, {int(correction*1e18)});\n                if (missing > WAD/2) missing = WAD/2;\n                correctedWeight = wdiv(weight, WAD-missing);\n            }}\n            count += correctedWeight;\n            uint256 learning = wmul(WAD-{decay}, weight);\n            meanSize = _blend(meanSize, tradeRatio, learning);\n            slots[15]=rate | (count << 80) | (meanSize << 160);\n            uint256 retailRate = wmul(rate, {int(scale*1e18)});\n            uint256 retailSize = {kind} == 0 ? sizeHat : wmul(meanSize,{int(sscale*1e18)});\n            lambdaHat = _blend(lambdaHat,retailRate,{mix});\n            sizeHat = _blend(sizeHat,retailSize,{mix});\n        }}\n'''\n s=s.replace('        uint256 flowSize =', '        uint256 originalLambda = lambdaHat; uint256 originalSize = sizeHat;\\n'+insert+'        uint256 flowSize =')\n s=s.replace('        uint256 dirDev;', '        lambdaHat = originalLambda; sizeHat = originalSize;\\n        uint256 dirDev;')\n s=s.replace(\"slots[13] = 902500000000;\", \"slots[15] = 400000000000000000 | (uint256(2000000000000000) << 160); slots[13] = 902500000000;\") if mix else s\n return s\n\n# --- cap extension (7th parameter); cap==2.0 reproduces RS1 byte-for-byte ---\ndef generate7(base,p):\n    p=list(p); kind=int(round(p[0])); cap=float(p[6]) if len(p)>6 else 2.0\n    s=generate_rs2_base(base,[kind]+[float(x) for x in p[1:6]])\n    if cap!=2.0:\n        old='if (missing > WAD/2) missing = WAD/2;'\n        assert old in s or float(p[1])==0\n        m=int((1-1/cap)*1e18)\n        s=s.replace(old,f'if (missing > {m}) missing = {m};')\n    return s\n\nimport math\n\ndef generate(base, exact, gamma, prior_scale, mix, rate_scale):\n    p=list(exact);p[1]=float(mix);p[3]=float(rate_scale)\n    s=generate7(base,p)\n    # Preserve exact RS2 source for the null mechanism.\n    if gamma==0 and prior_scale==1:\n        return s\n    g=int(round(float(gamma)*16))\n    if g and mix==0:\n        # A zero fee-flow blend must not turn off the posterior's rate estimator.\n        s=s.replace('if (0 > 0) {', 'if (true) {')\n        s=s.replace('slots[13] = 902500000000;', 'slots[15] = 400000000000000000 | (uint256(2000000000000000) << 160); slots[13] = 902500000000;')\n    if g:\n        s=s.replace('uint256 bid; uint256 ask; bool first;', 'uint256 activity; uint256 cleaned; uint256 bid; uint256 ask; bool first;')\n        s=s.replace('            prevBidFee, prevAskFee, firstInStep, silent, trade.isBuy,',f'            lambdaHat, wmul(uint80(slots[15]), {int(rate_scale*1e18)}), prevBidFee, prevAskFee, firstInStep, silent, trade.isBuy,')\n        expression='''\n        uint256 cleaned = x.cleaned > 1000000000000000 ? x.cleaned : 1000000000000000;\n        uint256 ratio = wdiv(x.activity, cleaned);\n        if (ratio < 50000000000000000) ratio = 50000000000000000;\n        if (ratio > 20*WAD) ratio = 20*WAD;\n'''\n        if g<0:expression+='        ratio = wdiv(WAD, ratio);\\n'\n        # Sixteenth power via four correctly rounded-down square roots, then integer power.\n        expression+='        for (uint256 j=0; j<4; j++) ratio = _isqrt(ratio*WAD);\\n'\n        expression+=f'        odds = wmul(odds, _powWad(ratio, {abs(g)}));\\n'\n    else:expression=''\n    if prior_scale!=1:expression+=f'        odds = wmul(odds, {int(prior_scale*1e18)});\\n'\n    s=s.replace('        uint256 prob = wdiv(odds,WAD+odds);',expression+'        uint256 prob = wdiv(odds,WAD+odds);')\n    return s\n\nRS2_PARAMS_EXACT = [2, 0.3424067991934183, 0.999, 0.36638342491340714, 1.8832961581192982, 196.03088039613942, 1.5]\n\ndef build(v10_code, params):\n    return generate(v10_code, RS2_PARAMS_EXACT, **{k:params[k] for k in ('gamma','prior_scale','mix','rate_scale')})\n","notes":{"board_claim":null,"comparison_scope":"Item-specific local comparison to V10 and RS2 only; no STACK confirmation and no seeds >=5000000 were used. No board-performance claim.","protocol":"Each arm alone vs VanillaStrategy; amm_sim_rs.run_batch(arm, VanillaStrategy, configs, 8); gas_stats reset/read per <=20-seed chunk. 10000 steps/config; default_rng(seed) draws size then rate then sigma, pinned simulator seed convention. SE = sample sd(ddof=1)/sqrt(n).","setup":{"commit":"6b6921f8d463314aa7c96234e1be25a25245f704","simulator_wheel_sha256":"aedb68280aca34c110968f00148387c95885207913fb2cf19a1ab4c5cfd6887a","solc":"0.8.24","starter_validation_passed":true},"calibration":{"strategy":"CH","source_sha256":"6dd68f77a70900319460215374143dbd5d924198450a46d9f5f91f6b1e3d35c3","seeds":[0,999],"n":1000,"mean_edge":525.5258821780834,"expected_mean_edge":525.5258821780834,"difference":0.0},"input_sha256_verified":{"rs2":"f24b6ca198b744c380842c3a17964a6dc21f311bb04984b26733afa3fee8eaf2","v10":"cd9bdb45ab0537ad25c4fd90ca8618898cef6386de3df65f192eaef65fbca245"},"validation":{"returncode":0,"stdout":"Validating strategy...\nCompiling strategy...\nStrategy 'censored_10' validated successfully!\n","stderr":""},"search":{"optimizer":"numpy CMA-ES, default_rng(41), population 10, mu 5, sigma0 .2, reflected unit box, log rank weights, full covariance adaptation","unit_box_order":["gamma","prior_scale","mix","rate_scale"],"ranges":[[-2,2],[0.5,2],[0,0.9],[0.02,3]],"initial_unit_mean":[0.5,0.3333333333333333,0.3804519991037981,0.1162360486286601],"generation_sizes":{"0":10,"1":10,"2":10,"3":6},"block_policy":"fresh 64-seed block per generation shared across its population and V10 (CRN); no block reuse across generations","deadline":"25-minute search cap included parser repair time; no new candidate launched after deadline","run_summary":{"elapsed":1218.1340288240463,"evaluations":36,"generations":4},"gas_rejection":"any halt, afterSwap max_ok >=235000, or afterInitialize max_ok >=245000 gives fitness -1000","search_max_ok":207711,"search_init_max_ok":243099,"search_oog":0,"search_other_halts":0},"repair":"Initial 880000..880063 attempts were discarded after detecting case-sensitive gas role parsing; two preserved preliminary measurements are marked discarded with unknown gas maxima. Additional interrupted/unrecorded attempts were excluded; no unavailable gas maxima are claimed. Scored search restarted on 880064; original deadline retained. Separate RS2 gas probe used seed 883999 and did not affect selection.","gas_scope":"Top-level gas aggregates frozen source only across scored search, recheck and held-out; arm_gas includes each held-out arm. All callback halts counted including getName. Per-evaluation gas maxima are submission callbacks; halt counts cover both roles.","decomposition":"Retail and arb edge deltas use the supplied V10 harness reconstruction of arb profit from prior pool spot/fees and current fair price; retail=edge-arb. Fees are outside reserves; decomposition reconciles per seed.","selection":"Top three distinct valid source hashes by search paired mean vs V10; best valid recheck mean frozen before held-out. Held-out used once; no post-held-out changes.","assessment":"The frozen candidate underperformed RS2 on held-out seeds. Its arb-edge improvement was outweighed by lower retail edge. This run does not establish a better strategy than RS2; no board improvement claim."}}