{"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    uint256 constant SIDE_RET = 953597000000000000;\n    uint256 constant SIDE_LO = 345154888256104896;\n    int256 constant SIDE_MIX = 76447400000000000;\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            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 sideRate;\n        uint256 originalLambda = lambdaHat; uint256 originalSize = sizeHat;\n\n        if (463539000000000000 > 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, 366383424913407168);\n            uint256 retailSize = 2 == 0 ? sizeHat : wmul(meanSize,2673810000000000000);\n            sideRate = retailRate;\n            lambdaHat = _blend(lambdaHat,retailRate,463539000000000000);\n            sizeHat = _blend(sizeHat,retailSize,463539000000000000);\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        (int256 dBid, int256 dAsk) = _sideDeltas(trade.isBuy, firstInStep ? WAD - arbProbability : WAD, lambdaHat, sizeHat, sideRate);\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        bidFee = _addSigned(bidFee, dBid); askFee = _addSigned(askFee, dAsk);\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\n    function _sideDeltas(bool isBuy, uint256 weight, uint256 lam, uint256 size, uint256 rate)\n        internal returns (int256 dBid, int256 dAsk) {\n        uint256 p = slots[16];\n        uint256 bw = uint128(p);\n        uint256 w = p >> 128;\n        if (w == 0) { bw = WAD; w = 2 * WAD; }\n        bw = wmul(bw, SIDE_RET); w = wmul(w, SIDE_RET);\n        if (isBuy) bw += weight;\n        w += weight;\n        slots[16] = bw | (w << 128);\n        uint256 s = wdiv(bw, w);\n        if (s < SIDE_LO) s = SIDE_LO;\n        if (s > WAD - SIDE_LO) s = WAD - SIDE_LO;\n        uint256 base = rate == 0 ? lam : rate;\n        int256 coef = int256(LAMBDA_COEF + wmul(FLOW_SIZE_COEF, size));\n        int256 dB = int256(wmul(2 * s, base)) - int256(lam);\n        int256 dA = int256(wmul(2 * (WAD - s), base)) - int256(lam);\n        dBid = coef * dB / int256(WAD) * SIDE_MIX / int256(WAD);\n        dAsk = coef * dA / int256(WAD) * SIDE_MIX / int256(WAD);\n        if (!isBuy) { /* hit side is ask: same per-side rule */ }\n    }\n    function _addSigned(uint256 fee, int256 d) internal pure returns (uint256) {\n        if (d >= 0) return fee + uint256(d);\n        uint256 m = uint256(-d);\n        return fee > m ? fee - m : 0;\n    }\n    struct PosteriorInput {\n        uint256 mu; uint256 v; uint256 obs; uint256 spot; uint256 preSpot;\n        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        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": "daf3834688116f4a6bfacc13ee94cd1e927ed5522440c15125c1f958a585e149", "params": {"side_mix": 0.0764474, "side_retention": 0.953597, "side_cap": 1.89725, "mix": 0.463539, "size_scale": 2.67381}, "params_note": "others at RS2 params_exact (structure 2, retention 0.999, rate_scale 0.36638342491340714, slope 196.03088039613942, cap 1.5)", "mechanism": "Slot 16 (lazy init, no init gas): decayed (side_retention per own fill) posterior-weighted (weight 1-arbProbability for first fill in step, else 1) count of retail buys over total, prior 1/2. Share clamped to [1/(1+side_cap), side_cap/(1+side_cap)]. Bid side lambda input moves by side_mix toward 2*share*rate, ask side toward 2*(1-share)*rate (rate = RS2 retailRate; per-side fee delta = (LAMBDA_COEF+FLOW_SIZE_COEF*sizeHat)*side_mix*(target-lambdaMixed)), added to each side fee after skew, before stale shift/tail compression. Hit side = side of the fill just made; each side uses its own direction share. side_mix=0 returns RS2 code byte-exact (checked).", "log": [{"params": {"side_mix": -0.158121, "side_retention": 0.955223, "side_cap": 2.24285, "mix": 0.167411, "size_scale": 2.45137}, "sha256": "e5f591712f6b08be65117e9245a933630ba9db04dbd61669e054a0aeeca27872", "block": [860000, 860004], "n": 5, "mean_diff": -0.7993453241130737, "se": 0.1362656762369126, "max_ok": 200847, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.102023, "side_retention": 0.965594, "side_cap": 2.10897, "mix": 0.551561, "size_scale": 1.18936}, "sha256": "b3d65bac59884ae8258f3dae4e1f13cdae19855690265bf2d21877938a193850", "block": [860000, 860004], "n": 5, "mean_diff": -2.320742544837276, "se": 0.3686428599516757, "max_ok": 200957, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.71044, "side_retention": 0.973974, "side_cap": 1.76002, "mix": 0.46123, "size_scale": 2.21243}, "sha256": "645b3441b368522e3ef2cf7eeeaf178a46a4ecea200f88731cc4c3e2140df4c0", "block": [860000, 860004], "n": 5, "mean_diff": -6.270723706767683, "se": 0.5241834180066325, "max_ok": 200957, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.698305, "side_retention": 0.961842, "side_cap": 1.76584, "mix": 0.297398, "size_scale": 1.43753}, "sha256": "5b1d92aa65ec2a6e99ad4aa29f12a847afae5bccb703a95857a99a92baee8c49", "block": [860000, 860004], "n": 5, "mean_diff": -2.688938410263552, "se": 0.513527172015058, "max_ok": 200847, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.171234, "side_retention": 0.951383, "side_cap": 2.03869, "mix": 0.0617527, "size_scale": 1.68446}, "sha256": "dce7d0414a85e8860845fa6e0e5d4c541976e6b29bf179e0b69898fe98fb06f4", "block": [860000, 860004], "n": 5, "mean_diff": -0.5695701077941635, "se": 0.20782062839184698, "max_ok": 202653, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.537924, "side_retention": 0.92456, "side_cap": 1.86122, "mix": 0.496354, "size_scale": 2.35013}, "sha256": "c648f8b3b5b31c01ecfc78e456820fb7e24a85653dc1bb49fda1e3ef6540562a", "block": [860000, 860004], "n": 5, "mean_diff": -1.9825206778078837, "se": 0.3873729199828449, "max_ok": 200847, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.241863, "side_retention": 0.935756, "side_cap": 1.66904, "mix": 0.368093, "size_scale": 2.57642}, "sha256": "eae54e85068fc6b67f2514f3b50a7606b25a35860fe0bbc0ae3340af7160c631", "block": [860000, 860004], "n": 5, "mean_diff": -1.3448803457532221, "se": 0.3072066953489056, "max_ok": 200847, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.00721994, "side_retention": 0.963791, "side_cap": 2.12616, "mix": 0.613153, "size_scale": 0.398349}, "sha256": "a25dc4c4bdaff96ee90a77f8df6651165a0c53226aaa2bec6ed2ad6e58441890", "block": [860000, 860004], "n": 5, "mean_diff": -5.068470219223082, "se": 0.6107109411940806, "max_ok": 200967, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.852414, "side_retention": 0.945985, "side_cap": 2.25462, "mix": 0.268501, "size_scale": 2.19838}, "sha256": "b8150fd2a1a3f70fa319db1811887b079ef7dd782560eeec145ea4ea55b00a9c", "block": [860000, 860004], "n": 5, "mean_diff": -5.72602382452493, "se": 0.7870863066980668, "max_ok": 200847, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.469418, "side_retention": 0.924788, "side_cap": 1.71337, "mix": 0.493838, "size_scale": 2.39861}, "sha256": "c862a7a103e2bbb2c853075475a3cb4e381d54943dc1dd37632c5f1bc2f262e4", "block": [860000, 860004], "n": 5, "mean_diff": -1.6787782737650787, "se": 0.31385695248351436, "max_ok": 200847, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.118032, "side_retention": 0.935685, "side_cap": 1.88207, "mix": 0.314522, "size_scale": 1.70988}, "sha256": "a5d005b32ddd5d945a95baca217386f3913cc208fb0877669a2f7688dfb691eb", "block": [860005, 860009], "n": 5, "mean_diff": -0.08206483573354717, "se": 0.3877529518780128, "max_ok": 200945, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.320087, "side_retention": 0.938082, "side_cap": 2.06455, "mix": 0.374977, "size_scale": 2.01762}, "sha256": "7bbfe0caf49a5c4abdf3629f750cc455c9f8d53a875774651b723aaec2a38852", "block": [860005, 860009], "n": 5, "mean_diff": -0.4452101671990363, "se": 0.5285847800615111, "max_ok": 200835, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.469357, "side_retention": 0.942787, "side_cap": 2.03467, "mix": 0.134604, "size_scale": 2.26921}, "sha256": "d5a25249f2d7c05aae11b05a03d6be5a7460963af9aedb7e3393bc428f479d8c", "block": [860005, 860009], "n": 5, "mean_diff": -2.985065292103866, "se": 0.575530105562598, "max_ok": 200835, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.193906, "side_retention": 0.942667, "side_cap": 2.17092, "mix": 0.0, "size_scale": 3.33221}, "sha256": "60956ad85714f9f379d0741f2ff96829744327928549508046f4014ccd7123a4", "block": [860005, 860009], "n": 5, "mean_diff": -0.20318188712234359, "se": 0.04751261334239626, "max_ok": 193478, "init_max_ok": 220975, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.812036, "side_retention": 0.952418, "side_cap": 1.19953, "mix": 0.314726, "size_scale": 1.98598}, "sha256": "ff4c7aa51aa0463384526514bdd2b431c1e3c67fe2c5a1fda678c21f436ffe4b", "block": [860005, 860009], "n": 5, "mean_diff": -5.160374588712341, "se": 0.5852679798384367, "max_ok": 200835, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.33648, "side_retention": 0.975358, "side_cap": 1.77028, "mix": 0.360941, "size_scale": 2.51084}, "sha256": "a7f01d1e8756be98987558a1830f98d73def074661570f57262296e4c1fa02db", "block": [860005, 860009], "n": 5, "mean_diff": -1.4078543846932916, "se": 0.604138357580025, "max_ok": 200835, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.421516, "side_retention": 0.951282, "side_cap": 2.25872, "mix": 0.201656, "size_scale": 1.56473}, "sha256": "019172c161a64aa11f3d8d8ea0a10049b0a07379d6d7b928a48a1c81fed5e16c", "block": [860005, 860009], "n": 5, "mean_diff": -1.533379911412999, "se": 0.3778214281088419, "max_ok": 200835, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.0372603, "side_retention": 0.961154, "side_cap": 2.17872, "mix": 0.461468, "size_scale": 1.89299}, "sha256": "b3236440c075877d7c1edec20ce1fcb3940b3be84a71c35c8ee81a7baaba0ded", "block": [860005, 860009], "n": 5, "mean_diff": 0.062144292144660086, "se": 0.47527698836575716, "max_ok": 200835, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.121938, "side_retention": 0.936929, "side_cap": 2.45843, "mix": 0.140956, "size_scale": 2.24703}, "sha256": "32d7e6a5c8b9aac75e030b3d437900a87ccb716036434f555afaebe5c031fd92", "block": [860005, 860009], "n": 5, "mean_diff": -0.4885274408845248, "se": 0.2434626042198276, "max_ok": 200835, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.0764474, "side_retention": 0.953597, "side_cap": 1.89725, "mix": 0.463539, "size_scale": 2.67381}, "sha256": "daf3834688116f4a6bfacc13ee94cd1e927ed5522440c15125c1f958a585e149", "block": [860005, 860009], "n": 5, "mean_diff": 0.13302425913425395, "se": 0.42633120859787205, "max_ok": 200945, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.2782, "side_retention": 0.947898, "side_cap": 2.12102, "mix": 0.556297, "size_scale": 2.3543}, "sha256": "76321eceb485b623f0f635984535fe236f489fb5ef1d3fe22ed9c7610f015990", "block": [860010, 860014], "n": 5, "mean_diff": -0.5191439357754234, "se": 0.33288855604573764, "max_ok": 206522, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.273588, "side_retention": 0.978962, "side_cap": 1.91933, "mix": 0.362087, "size_scale": 2.90048}, "sha256": "d0bd72672e6b75cdc384d04b7dd52caa9429bed8ac2ebc9da6237c056060c1e1", "block": [860010, 860014], "n": 5, "mean_diff": -1.4431718703984984, "se": 0.5223898534226474, "max_ok": 195398, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.247272, "side_retention": 0.950124, "side_cap": 2.02972, "mix": 0.45769, "size_scale": 2.19579}, "sha256": "f5ae39113850ec3934d0d4c2fed01de25229f90fde7454be0e42e60017347305", "block": [860010, 860014], "n": 5, "mean_diff": -0.31987934966567766, "se": 0.2720260116111394, "max_ok": 206530, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.712381, "side_retention": 0.932772, "side_cap": 1.89889, "mix": 0.443051, "size_scale": 2.30151}, "sha256": "c2e11e35374cf0164b8afe4850b92dab419a1f0abc6e7f3fc8ba5a764b8244a1", "block": [860010, 860014], "n": 5, "mean_diff": -3.1608398819923424, "se": 0.894139327147661, "max_ok": 195398, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.000727031, "side_retention": 0.967429, "side_cap": 1.7829, "mix": 0.471074, "size_scale": 2.08955}, "sha256": "f8524450ad4467ba8d534c81388e2ec901b7102ef1648898d44a7d044aa5989e", "block": [860010, 860014], "n": 5, "mean_diff": 0.4016553173042894, "se": 0.12242859753468725, "max_ok": 195508, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.303666, "side_retention": 0.994277, "side_cap": 2.20301, "mix": 0.430217, "size_scale": 3.41078}, "sha256": "dea20e4ae392325c8535076b57093949e5abd4d642ff841356e09adb5c48ada4", "block": [860010, 860014], "n": 5, "mean_diff": -2.581980170577458, "se": 0.8006616359962748, "max_ok": 195398, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.199777, "side_retention": 0.940512, "side_cap": 1.98296, "mix": 0.365839, "size_scale": 2.04529}, "sha256": "e86f1179b473ad1f323f6c6e4593a596f153c79856953aed80503f8756e5343b", "block": [860010, 860014], "n": 5, "mean_diff": 0.13206236321768755, "se": 0.24931410381975916, "max_ok": 195398, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.344541, "side_retention": 0.935491, "side_cap": 1.49072, "mix": 0.401265, "size_scale": 2.45985}, "sha256": "30521e2b50448440b289ccbc98b5f5e682080aa722752fa4e2dc95658fefa101", "block": [860010, 860014], "n": 5, "mean_diff": -0.5136345502693302, "se": 0.30442316352673, "max_ok": 206541, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": -0.263335, "side_retention": 0.961841, "side_cap": 2.1111, "mix": 0.465976, "size_scale": 1.86595}, "sha256": "a14d814df8a46a193a42aa8fec145126c7e6b5dcb34f8dad601e3e6a44a8565c", "block": [860010, 860014], "n": 5, "mean_diff": 0.3439768869589102, "se": 0.11700489069228344, "max_ok": 195398, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, {"params": {"side_mix": 0.492645, "side_retention": 0.943402, "side_cap": 2.61552, "mix": 0.3269, "size_scale": 3.49518}, "sha256": "92b0fe6063d5c6233a858a7a7407213fc897130cc0ada3604139ac1725d4feef", "block": [860010, 860014], "n": 5, "mean_diff": -0.7779710358425745, "se": 0.3379751150771491, "max_ok": 202821, "init_max_ok": 243093, "oog": 0, "other_halts": 0}], "recheck": {"seeds": "864000..864007", "note": "top 3 by search score; frozen = best recheck mean_diff", "results": [{"params": {"side_mix": 0.000727031, "side_retention": 0.967429, "side_cap": 1.7829, "mix": 0.471074, "size_scale": 2.08955}, "sha256": "f8524450ad4467ba8d534c81388e2ec901b7102ef1648898d44a7d044aa5989e", "search_idx": 24, "block": [864000, 864007], "n": 8, "mean_diff": 0.132595670483326, "se": 0.1438625647710064, "max_ok": 195214, "init_max_ok": 243093, "oog": 0}, {"params": {"side_mix": -0.263335, "side_retention": 0.961841, "side_cap": 2.1111, "mix": 0.465976, "size_scale": 1.86595}, "sha256": "a14d814df8a46a193a42aa8fec145126c7e6b5dcb34f8dad601e3e6a44a8565c", "search_idx": 28, "block": [864000, 864007], "n": 8, "mean_diff": -0.040167936852888886, "se": 0.16614566774481604, "max_ok": 195104, "init_max_ok": 243093, "oog": 0}, {"params": {"side_mix": 0.0764474, "side_retention": 0.953597, "side_cap": 1.89725, "mix": 0.463539, "size_scale": 2.67381}, "sha256": "daf3834688116f4a6bfacc13ee94cd1e927ed5522440c15125c1f958a585e149", "search_idx": 19, "block": [864000, 864007], "n": 8, "mean_diff": 0.13968589078129412, "se": 0.16712309101841435, "max_ok": 195214, "init_max_ok": 243093, "oog": 0}]}, "held_out": {"seeds": "865000..865023", "vs_v10": {"n": 24, "mean_diff": 0.06338239472125196, "se": 0.11395889581637947, "worst": [{"seed": 865013, "d": -1.1297765856054411}, {"seed": 865001, "d": -0.8501786059488268}, {"seed": 865023, "d": -0.8138430663251484}, {"seed": 865011, "d": -0.6821158383421562}, {"seed": 865004, "d": -0.3882505315547178}]}, "vs_rs2": {"n": 24, "mean_diff": -0.04561139017795549, "se": 0.06459981309104645, "worst": [{"seed": 865015, "d": -0.6306465910088264}, {"seed": 865005, "d": -0.5591342664172316}, {"seed": 865020, "d": -0.5562397258589726}, {"seed": 865017, "d": -0.42442127132653695}, {"seed": 865023, "d": -0.30126918883672715}]}, "retail_edge_delta": {"vs_v10": {"mean": 1.3832291599067073, "se": 0.10623366340558371}, "vs_rs2": {"mean": -0.06648632486763262, "se": 0.07346179951777347}}, "arb_edge_delta": {"vs_v10": {"mean": -1.3198467651854475, "se": 0.04787550561295214}, "vs_rs2": {"mean": 0.02087493468968275, "se": 0.02894400365628438}}, "arm_gas": {"frozen": {"max_ok": 221504, "init_max_ok": 243093, "oog": 0, "other_halts": 0}, "rs2": {"max_ok": 197184, "init_max_ok": 243099, "oog": 0, "other_halts": 0}, "v10": {"max_ok": 190536, "init_max_ok": 220981, "oog": 0, "other_halts": 0}}}, "gas": {"max_ok": 221504, "init_max_ok": 243093, "oog": 0, "other_halts": 0, "search_max_ok": 206541, "search_oog_total": 0}, "generator_source": "import json\nV10=open('/home/seat/.identitymd/work/e64e1149-e582-4058-afdd-d41f6f53789c/26b3356e-c87b-431a-82e3-d22ae4a560ae/test/scratch/ammc/../art/v10.sol').read()\nRS2=json.load(open(\"/home/seat/.identitymd/work/e64e1149-e582-4058-afdd-d41f6f53789c/26b3356e-c87b-431a-82e3-d22ae4a560ae/test/scratch/ammc/../art/19f2ec857df536e8ab62ab1da89ec6623332521ce46849f15bccff402c63e1e5.json\"))\nexec(open('/home/seat/.identitymd/work/e64e1149-e582-4058-afdd-d41f6f53789c/26b3356e-c87b-431a-82e3-d22ae4a560ae/test/scratch/ammc/../art/rs2_generator_source.py').read())\nPE=RS2['params_exact']  # structure,mix,retention,rate_scale,size_scale,slope,cap\nNAMES=['side_mix','side_retention','side_cap','mix','size_scale']\nHELPER='''\n    function _sideDeltas(bool isBuy, uint256 weight, uint256 lam, uint256 size, uint256 rate)\n        internal returns (int256 dBid, int256 dAsk) {\n        uint256 p = slots[16];\n        uint256 bw = uint128(p);\n        uint256 w = p >> 128;\n        if (w == 0) { bw = WAD; w = 2 * WAD; }\n        bw = wmul(bw, SIDE_RET); w = wmul(w, SIDE_RET);\n        if (isBuy) bw += weight;\n        w += weight;\n        slots[16] = bw | (w << 128);\n        uint256 s = wdiv(bw, w);\n        if (s < SIDE_LO) s = SIDE_LO;\n        if (s > WAD - SIDE_LO) s = WAD - SIDE_LO;\n        uint256 base = rate == 0 ? lam : rate;\n        int256 coef = int256(LAMBDA_COEF + wmul(FLOW_SIZE_COEF, size));\n        int256 dB = int256(wmul(2 * s, base)) - int256(lam);\n        int256 dA = int256(wmul(2 * (WAD - s), base)) - int256(lam);\n        dBid = coef * dB / int256(WAD) * SIDE_MIX / int256(WAD);\n        dAsk = coef * dA / int256(WAD) * SIDE_MIX / int256(WAD);\n        if (!isBuy) { /* hit side is ask: same per-side rule */ }\n    }\n    function _addSigned(uint256 fee, int256 d) internal pure returns (uint256) {\n        if (d >= 0) return fee + uint256(d);\n        uint256 m = uint256(-d);\n        return fee > m ? fee - m : 0;\n    }\n'''\ndef gen(p):\n    \"\"\"p=[side_mix, side_retention, side_cap, mix, size_scale]; side_mix==0 -> RS2 byte-exact\"\"\"\n    sm,sr,sc,mix,ss=[float(x) for x in p]\n    q=list(PE); q[1]=mix; q[4]=ss\n    if sm==0 and mix==PE[1] and ss==PE[4]: return RS2['code']\n    s=generate7(V10,q)\n    if sm==0: return s\n    lo=int(1e18/(1+sc))\n    consts=f'''    uint256 constant SIDE_RET = {int(sr*1e18)};\n    uint256 constant SIDE_LO = {lo};\n    int256 constant SIDE_MIX = {int(sm*1e18)};\n'''\n    s=s.replace('    function afterInitialize',consts+'    function afterInitialize',1)\n    s=s.replace('        uint256 originalLambda = lambdaHat;','        uint256 sideRate;\\n        uint256 originalLambda = lambdaHat;',1)\n    s=s.replace('            lambdaHat = _blend(lambdaHat,retailRate,','            sideRate = retailRate;\\n            lambdaHat = _blend(lambdaHat,retailRate,',1)\n    s=s.replace('        lambdaHat = originalLambda; sizeHat = originalSize;',\n      '        (int256 dBid, int256 dAsk) = _sideDeltas(trade.isBuy, firstInStep ? WAD - arbProbability : WAD, lambdaHat, sizeHat, sideRate);\\n        lambdaHat = originalLambda; sizeHat = originalSize;',1)\n    a='        {\\n            uint256 staleHat'\n    assert a in s\n    s=s.replace(a,'        bidFee = _addSigned(bidFee, dBid); askFee = _addSigned(askFee, dAsk);\\n'+a,1)\n    s=s.replace('    struct PosteriorInput',HELPER+'    struct PosteriorInput',1)\n    return s\n", "notes": ["SCALE-DOWN: this machine ran ~9 s per simulated seed with no parallel speedup (8 processes gave same total throughput, solc compile ~17 s), so the brief protocol was impossible in the time. Done instead: CMA-ES (own numpy, default_rng(31), pop 10, mu 5, sigma0 0.2, unit box, 5 dims: side_mix -1..1, side_retention .9..0.9999, side_cap 1..3, mix 0..0.9, size_scale .3..4) for 3 generations on 5-seed CRN blocks 860000..860014 (not 64-seed, not 25 min) = 30 candidate evals; recheck on 864000..864007 (8 seeds, not 256); held-out 865000..865023 (24 seeds, not 512). All statistics are therefore very noisy; no conclusion about a gain over RS2 is supported.", "Search scores were mostly negative (large side_mix hurt; the best points had side_mix near 0), consistent with per-side retail state not helping in this form. The frozen candidate has small side_mix 0.076; its held-out difference vs RS2 is within noise (see se).", "side_cap interpretation: cap = max ratio of one side to the other (share clamp 1/(1+cap)..cap/(1+cap)); brief left it ambiguous. \"Hit side\" literal reading (share for hit side regardless of direction) was not used; each side uses its own direction share.", "Frozen chosen by best recheck mean_diff (0.140, se 0.167) over search idx 24 (0.133) and 28 (-0.040); frozen was fixed before held-out. Held-out gas max_ok is higher than RS2 (first fill writes new slot 16: +~20k) but < 235000; init unchanged vs RS2 band (243093 < 245000). No OOG in any run. Compile validated with amm-match validate.", "Retail/arb deltas computed with V10 harness decomposition. No board claim. Workspace clone sits at test/scratch/ammc; a stray partial ./ammc directory may remain from a failed move (undeletable, read-only mount)."]}