{
  "blocked": null,
  "valid": true,
  "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 = 128000000000000000;\n    uint256 constant DIR_TOX_COEF = 640000000000000000;\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            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 skewRatio = tradeRatio;\n            uint256 cleanSize = uint80(slots[15] >> 160);\n            if (cleanSize == 0) cleanSize = 2000000000000000;\n            uint256 skewCap = wmul(cleanSize, 8000000000000000000);\n            if (skewRatio > skewCap) skewRatio = skewCap;\n            uint256 push = skewRatio * DIR_IMPACT_MULT;\n            if (push > WAD / 4) push = WAD / 4;\n            push = wmul(push, 0 + wmul(1000000000000000000, arbProbability));\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 (342406799193418304 > 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,1883296158119298304);\n            lambdaHat = _blend(lambdaHat,retailRate,342406799193418304);\n            sizeHat = _blend(sizeHat,retailSize,342406799193418304);\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 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": "8fd9c0118ad132be7f077b2277cecdd4fa785faafdc1a35edae06b02aaa408fa",
  "params": {
    "a": 0.0,
    "k": 8.0,
    "gain": 64.0
  },
  "mechanism": "For each trade above RS2's original signal threshold, multiply the saturated direction push by a + (1-a)*p, using RS2's posterior arbitrage probability p. Before forming that push, cap its trade ratio at k times the previously stored posterior-cleaned mean size in slot 15, and multiply DIR_COEF and DIR_TOX_COEF by the common gain.",
  "source": {
    "url": "https://benedict.dev/optimization-arena-learnings",
    "quote": "skewing based on information from the arbs"
  },
  "search": {
    "method": "Grid with fixed opening probes and seed-87 shuffled remaining Cartesian grid",
    "rng_seed": 87,
    "budget_seconds": 1500,
    "elapsed_seconds": 1647.9599876850843,
    "evaluations": 15,
    "blocks": [
      [
        990000,
        990063
      ],
      [
        990064,
        990127
      ]
    ],
    "aux_evaluations": 2,
    "n_per_evaluation": 64,
    "pairing": "All candidates and RS2 separately against VanillaStrategy, common simulation seeds; RS2 baseline cached.",
    "primary_grid": {
      "a": [
        0,
        0.25,
        0.5,
        0.75,
        1
      ],
      "k": [
        0.5,
        1,
        2,
        4,
        8
      ],
      "gain": [
        0.5,
        1,
        2,
        4,
        8,
        16
      ]
    },
    "extension_grid": {
      "a": [
        0
      ],
      "k": [
        8
      ],
      "gain": [
        32,
        64,
        128
      ],
      "seeds": [
        990064,
        990127
      ],
      "shared_deadline": true
    },
    "best": {
      "params": {
        "a": 0.0,
        "k": 8.0,
        "gain": 64.0
      },
      "paired": {
        "n": 64,
        "mean_diff": 0.4646256499039616,
        "se": 0.12239828142105712,
        "worst": [
          {
            "seed": 990073,
            "d": -1.8005232798363409
          },
          {
            "seed": 990112,
            "d": -1.6016566751960681
          },
          {
            "seed": 990064,
            "d": -1.585412612638379
          },
          {
            "seed": 990074,
            "d": -1.4559553986563856
          },
          {
            "seed": 990070,
            "d": -0.7753726530073664
          }
        ]
      },
      "valid": true,
      "seeds": [
        990064,
        990127
      ],
      "gas": {
        "max_ok": 200184,
        "init_max_ok": 243099,
        "oog": 0,
        "revert": 0,
        "other_halt": 0,
        "tx_error": 0,
        "bad_return": 0
      }
    },
    "top_three": [
      {
        "params": {
          "a": 0.0,
          "k": 8.0,
          "gain": 64.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.4646256499039616,
          "se": 0.12239828142105712,
          "worst": [
            {
              "seed": 990073,
              "d": -1.8005232798363409
            },
            {
              "seed": 990112,
              "d": -1.6016566751960681
            },
            {
              "seed": 990064,
              "d": -1.585412612638379
            },
            {
              "seed": 990074,
              "d": -1.4559553986563856
            },
            {
              "seed": 990070,
              "d": -0.7753726530073664
            }
          ]
        },
        "valid": true,
        "seeds": [
          990064,
          990127
        ],
        "gas": {
          "max_ok": 200184,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.0,
          "k": 8.0,
          "gain": 16.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.20572333023335787,
          "se": 0.04198670623414535,
          "worst": [
            {
              "seed": 990057,
              "d": -0.5386519797193614
            },
            {
              "seed": 990062,
              "d": -0.3650998658443996
            },
            {
              "seed": 990026,
              "d": -0.3430611609430798
            },
            {
              "seed": 990036,
              "d": -0.2830679974708801
            },
            {
              "seed": 990049,
              "d": -0.2629648997581171
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199799,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 1.0,
          "k": 8.0,
          "gain": 4.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.1199160893186928,
          "se": 0.04248684948862137,
          "worst": [
            {
              "seed": 990016,
              "d": -0.7312874408229391
            },
            {
              "seed": 990049,
              "d": -0.3801792262786421
            },
            {
              "seed": 990047,
              "d": -0.32528615605815503
            },
            {
              "seed": 990031,
              "d": -0.3090575590271101
            },
            {
              "seed": 990058,
              "d": -0.27895885556739586
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199668,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      }
    ],
    "evaluations_log": [
      {
        "params": {
          "a": 0.0,
          "k": 2.0,
          "gain": 4.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.020478309304603926,
          "se": 0.033053930594608545,
          "worst": [
            {
              "seed": 990062,
              "d": -0.7894210114352518
            },
            {
              "seed": 990032,
              "d": -0.5263294505159593
            },
            {
              "seed": 990056,
              "d": -0.4251303804400095
            },
            {
              "seed": 990009,
              "d": -0.39090027776478564
            },
            {
              "seed": 990057,
              "d": -0.33514547793032534
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199818,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.0,
          "k": 8.0,
          "gain": 4.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.03591661382292699,
          "se": 0.033095813783630953,
          "worst": [
            {
              "seed": 990062,
              "d": -0.7765986200423072
            },
            {
              "seed": 990032,
              "d": -0.48934199231371167
            },
            {
              "seed": 990056,
              "d": -0.40678999400665816
            },
            {
              "seed": 990057,
              "d": -0.3379883097952643
            },
            {
              "seed": 990009,
              "d": -0.3203200253211662
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199807,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.5,
          "k": 2.0,
          "gain": 2.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.03865055533739259,
          "se": 0.021706508530675427,
          "worst": [
            {
              "seed": 990062,
              "d": -0.5113083556606739
            },
            {
              "seed": 990024,
              "d": -0.20778132811153682
            },
            {
              "seed": 990040,
              "d": -0.20026226619268073
            },
            {
              "seed": 990028,
              "d": -0.17585007948048315
            },
            {
              "seed": 990018,
              "d": -0.16350688003649338
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199860,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.25,
          "k": 4.0,
          "gain": 4.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.09328524695105678,
          "se": 0.024976717851500022,
          "worst": [
            {
              "seed": 990062,
              "d": -0.37798648802669277
            },
            {
              "seed": 990032,
              "d": -0.2961937798137342
            },
            {
              "seed": 990040,
              "d": -0.2613222395976891
            },
            {
              "seed": 990024,
              "d": -0.1911907282772063
            },
            {
              "seed": 990057,
              "d": -0.1910908777001623
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199851,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 1.0,
          "k": 8.0,
          "gain": 1.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.03392256073528532,
          "se": 0.012645782304049093,
          "worst": [
            {
              "seed": 990062,
              "d": -0.29257476185949827
            },
            {
              "seed": 990040,
              "d": -0.25181465114422963
            },
            {
              "seed": 990024,
              "d": -0.17512744391012802
            },
            {
              "seed": 990018,
              "d": -0.08030834777247264
            },
            {
              "seed": 990005,
              "d": -0.07245096808605922
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199656,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.0,
          "k": 0.5,
          "gain": 8.0
        },
        "paired": {
          "n": 64,
          "mean_diff": -0.015013807181655459,
          "se": 0.030946513739647755,
          "worst": [
            {
              "seed": 990062,
              "d": -0.8630627867362932
            },
            {
              "seed": 990056,
              "d": -0.4893954616896963
            },
            {
              "seed": 990009,
              "d": -0.4778295893365794
            },
            {
              "seed": 990032,
              "d": -0.4588061654641251
            },
            {
              "seed": 990057,
              "d": -0.325200399101675
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199834,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.75,
          "k": 4.0,
          "gain": 2.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.07353804988416535,
          "se": 0.023111282677154933,
          "worst": [
            {
              "seed": 990062,
              "d": -0.2820717006863447
            },
            {
              "seed": 990055,
              "d": -0.25843672796258943
            },
            {
              "seed": 990007,
              "d": -0.22006173004052698
            },
            {
              "seed": 990005,
              "d": -0.18195530224045342
            },
            {
              "seed": 990024,
              "d": -0.17847256899403874
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199846,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.0,
          "k": 8.0,
          "gain": 16.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.20572333023335787,
          "se": 0.04198670623414535,
          "worst": [
            {
              "seed": 990057,
              "d": -0.5386519797193614
            },
            {
              "seed": 990062,
              "d": -0.3650998658443996
            },
            {
              "seed": 990026,
              "d": -0.3430611609430798
            },
            {
              "seed": 990036,
              "d": -0.2830679974708801
            },
            {
              "seed": 990049,
              "d": -0.2629648997581171
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199799,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.5,
          "k": 1.0,
          "gain": 8.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.11755876017377354,
          "se": 0.028487789094229728,
          "worst": [
            {
              "seed": 990026,
              "d": -0.4560168190674858
            },
            {
              "seed": 990049,
              "d": -0.392061704937646
            },
            {
              "seed": 990062,
              "d": -0.33486237455514356
            },
            {
              "seed": 990033,
              "d": -0.18323203661850584
            },
            {
              "seed": 990007,
              "d": -0.18137231521166086
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199900,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 1.0,
          "k": 0.5,
          "gain": 4.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.02831384991732655,
          "se": 0.02167826683474341,
          "worst": [
            {
              "seed": 990062,
              "d": -0.5409384636652703
            },
            {
              "seed": 990011,
              "d": -0.24090966194080465
            },
            {
              "seed": 990033,
              "d": -0.22397626000861237
            },
            {
              "seed": 990018,
              "d": -0.2055143156821373
            },
            {
              "seed": 990056,
              "d": -0.202823070538102
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199675,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 1.0,
          "k": 8.0,
          "gain": 4.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.1199160893186928,
          "se": 0.04248684948862137,
          "worst": [
            {
              "seed": 990016,
              "d": -0.7312874408229391
            },
            {
              "seed": 990049,
              "d": -0.3801792262786421
            },
            {
              "seed": 990047,
              "d": -0.32528615605815503
            },
            {
              "seed": 990031,
              "d": -0.3090575590271101
            },
            {
              "seed": 990058,
              "d": -0.27895885556739586
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199668,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.5,
          "k": 0.5,
          "gain": 0.5
        },
        "paired": {
          "n": 64,
          "mean_diff": -0.0420425521121528,
          "se": 0.024629643941976895,
          "worst": [
            {
              "seed": 990062,
              "d": -0.6724339598668507
            },
            {
              "seed": 990040,
              "d": -0.32895861508347934
            },
            {
              "seed": 990023,
              "d": -0.31896503753443994
            },
            {
              "seed": 990020,
              "d": -0.2963935259684263
            },
            {
              "seed": 990018,
              "d": -0.2833598844949847
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199885,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.0,
          "k": 0.5,
          "gain": 2.0
        },
        "paired": {
          "n": 64,
          "mean_diff": -0.051445622455981166,
          "se": 0.028302391182227948,
          "worst": [
            {
              "seed": 990062,
              "d": -0.7825722594073454
            },
            {
              "seed": 990056,
              "d": -0.5546478933649723
            },
            {
              "seed": 990018,
              "d": -0.41531652660057716
            },
            {
              "seed": 990040,
              "d": -0.33043200071625733
            },
            {
              "seed": 990023,
              "d": -0.32390761621161346
            }
          ]
        },
        "valid": true,
        "seeds": [
          990000,
          990063
        ],
        "gas": {
          "max_ok": 199830,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.0,
          "k": 8.0,
          "gain": 64.0
        },
        "paired": {
          "n": 64,
          "mean_diff": 0.4646256499039616,
          "se": 0.12239828142105712,
          "worst": [
            {
              "seed": 990073,
              "d": -1.8005232798363409
            },
            {
              "seed": 990112,
              "d": -1.6016566751960681
            },
            {
              "seed": 990064,
              "d": -1.585412612638379
            },
            {
              "seed": 990074,
              "d": -1.4559553986563856
            },
            {
              "seed": 990070,
              "d": -0.7753726530073664
            }
          ]
        },
        "valid": true,
        "seeds": [
          990064,
          990127
        ],
        "gas": {
          "max_ok": 200184,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.0,
          "k": 8.0,
          "gain": 128.0
        },
        "paired": {
          "n": 64,
          "mean_diff": -0.5426124044747889,
          "se": 0.22474015417795293,
          "worst": [
            {
              "seed": 990071,
              "d": -5.268258496567569
            },
            {
              "seed": 990112,
              "d": -4.209526349947851
            },
            {
              "seed": 990073,
              "d": -3.3057261254899686
            },
            {
              "seed": 990070,
              "d": -3.152395897277188
            },
            {
              "seed": 990074,
              "d": -3.0507400473557595
            }
          ]
        },
        "valid": true,
        "seeds": [
          990064,
          990127
        ],
        "gas": {
          "max_ok": 200253,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      }
    ]
  },
  "recheck": {
    "seeds": [
      993000,
      993255
    ],
    "n_each": 256,
    "results": [
      {
        "params": {
          "a": 0.0,
          "k": 8.0,
          "gain": 64.0
        },
        "paired": {
          "n": 256,
          "mean_diff": 0.3206445025592368,
          "se": 0.050455137650273256,
          "worst": [
            {
              "seed": 993146,
              "d": -2.323908292238116
            },
            {
              "seed": 993228,
              "d": -2.1809256517115045
            },
            {
              "seed": 993225,
              "d": -1.825940339318663
            },
            {
              "seed": 993105,
              "d": -1.5296565697427127
            },
            {
              "seed": 993163,
              "d": -1.3680159006598842
            }
          ]
        },
        "valid": true,
        "gas": {
          "max_ok": 200639,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 0.0,
          "k": 8.0,
          "gain": 16.0
        },
        "paired": {
          "n": 256,
          "mean_diff": 0.26088588173950256,
          "se": 0.02719992692578005,
          "worst": [
            {
              "seed": 993105,
              "d": -1.9596858934139618
            },
            {
              "seed": 993146,
              "d": -1.114604484741676
            },
            {
              "seed": 993228,
              "d": -0.9283669663932415
            },
            {
              "seed": 993075,
              "d": -0.7614141157187078
            },
            {
              "seed": 993212,
              "d": -0.6131034045986326
            }
          ]
        },
        "valid": true,
        "gas": {
          "max_ok": 200639,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      },
      {
        "params": {
          "a": 1.0,
          "k": 8.0,
          "gain": 4.0
        },
        "paired": {
          "n": 256,
          "mean_diff": 0.13464950758224425,
          "se": 0.0211478484310594,
          "worst": [
            {
              "seed": 993017,
              "d": -2.373523135679079
            },
            {
              "seed": 993097,
              "d": -0.8873666218792664
            },
            {
              "seed": 993029,
              "d": -0.7892513107047989
            },
            {
              "seed": 993117,
              "d": -0.6984268746199405
            },
            {
              "seed": 993147,
              "d": -0.5042760003401554
            }
          ]
        },
        "valid": true,
        "gas": {
          "max_ok": 200488,
          "init_max_ok": 243099,
          "oog": 0,
          "revert": 0,
          "other_halt": 0,
          "tx_error": 0,
          "bad_return": 0
        }
      }
    ],
    "selection": "Largest valid paired mean on 993000..993255; no held-out selection"
  },
  "held_out": {
    "reference": "RS2",
    "seeds": [
      994000,
      994511
    ],
    "n": 512,
    "mean_diff": 0.3053162324788391,
    "se": 0.03415373327286404,
    "worst": [
      {
        "seed": 994083,
        "d": -2.1953896726931816
      },
      {
        "seed": 994128,
        "d": -2.0751560221143563
      },
      {
        "seed": 994433,
        "d": -2.0194745551781352
      },
      {
        "seed": 994114,
        "d": -1.883641621756965
      },
      {
        "seed": 994245,
        "d": -1.8276814329824447
      }
    ],
    "valid": true,
    "candidate_mean": 525.1655694365768,
    "rs2_mean": 524.860253204098,
    "frozen_before_held_out": true
  },
  "retail_edge_delta": {
    "mean": -1.8896580209702858,
    "se": 0.03699503084968884
  },
  "arb_edge_delta": {
    "mean": 2.194974253449122,
    "se": 0.028873468704483488
  },
  "gas": {
    "max_ok": 200640,
    "init_max_ok": 243099,
    "oog": 0,
    "revert": 0,
    "other_halt": 0,
    "tx_error": 0,
    "bad_return": 0,
    "scope": "Frozen candidate: search, recheck, and held-out; errors counted for both roles.",
    "held_out": {
      "max_ok": 200640,
      "init_max_ok": 243099,
      "oog": 0,
      "revert": 0,
      "other_halt": 0,
      "tx_error": 0,
      "bad_return": 0
    },
    "rs2_held_out": {
      "max_ok": 200269,
      "init_max_ok": 243099,
      "oog": 0,
      "revert": 0,
      "other_halt": 0,
      "tx_error": 0,
      "bad_return": 0
    },
    "held_out_raw_counters": [
      {
        "role": "Baseline",
        "callback": "afterInitialize",
        "calls": 512,
        "ok": 512,
        "max_ok_gas": 21796,
        "sum_ok_gas": 11159552,
        "oog": 0,
        "revert": 0,
        "other_halt": 0,
        "tx_error": 0,
        "bad_return": 0
      },
      {
        "role": "Baseline",
        "callback": "afterSwap",
        "calls": 5492165,
        "ok": 5492165,
        "max_ok_gas": 22592,
        "sum_ok_gas": 123919687000,
        "oog": 0,
        "revert": 0,
        "other_halt": 0,
        "tx_error": 0,
        "bad_return": 0
      },
      {
        "role": "Baseline",
        "callback": "getName",
        "calls": 512,
        "ok": 512,
        "max_ok_gas": 21526,
        "sum_ok_gas": 11021312,
        "oog": 0,
        "revert": 0,
        "other_halt": 0,
        "tx_error": 0,
        "bad_return": 0
      },
      {
        "role": "Submission",
        "callback": "afterInitialize",
        "calls": 512,
        "ok": 512,
        "max_ok_gas": 243099,
        "sum_ok_gas": 124466688,
        "oog": 0,
        "revert": 0,
        "other_halt": 0,
        "tx_error": 0,
        "bad_return": 0
      },
      {
        "role": "Submission",
        "callback": "afterSwap",
        "calls": 5253625,
        "ok": 5253625,
        "max_ok_gas": 200640,
        "sum_ok_gas": 618350710004,
        "oog": 0,
        "revert": 0,
        "other_halt": 0,
        "tx_error": 0,
        "bad_return": 0
      },
      {
        "role": "Submission",
        "callback": "getName",
        "calls": 512,
        "ok": 512,
        "max_ok_gas": 21607,
        "sum_ok_gas": 11062784,
        "oog": 0,
        "revert": 0,
        "other_halt": 0,
        "tx_error": 0,
        "bad_return": 0
      }
    ],
    "search_all_evaluations_max_ok": 200253,
    "search_all_evaluations_oog": 0
  },
  "validation": {
    "neutral": {
      "params": {
        "a": 1,
        "k": null,
        "gain": 1
      },
      "seeds": [
        994600,
        994631
      ],
      "n": 32,
      "mean_diff": 0.0,
      "se": 0.0,
      "worst": [
        {
          "seed": 994600,
          "d": 0.0
        },
        {
          "seed": 994601,
          "d": 0.0
        },
        {
          "seed": 994602,
          "d": 0.0
        },
        {
          "seed": 994603,
          "d": 0.0
        },
        {
          "seed": 994604,
          "d": 0.0
        }
      ],
      "edges_identical": true,
      "valid": true,
      "gas": {
        "max_ok": 197265,
        "init_max_ok": 243099,
        "oog": 0,
        "revert": 0,
        "other_halt": 0,
        "tx_error": 0,
        "bad_return": 0
      }
    },
    "CH": {
      "seeds": [
        0,
        999
      ],
      "n": 1000,
      "mean": 525.5258821780834,
      "expected_mean": 525.5258821780834,
      "absolute_error": 0.0
    },
    "initialization_body_unchanged": true,
    "decomposition_reconciliation_max_abs": 1.1368683772161603e-13
  },
  "generator_source": "def generate(base,a=1.,k=None,gain=1.):\n s=base\n new='uint256 skewRatio = tradeRatio;'\n if k is not None:\n  new+=f'\\n            uint256 cleanSize = uint80(slots[15] >> 160);\\n            if (cleanSize == 0) cleanSize = 2000000000000000;\\n            uint256 skewCap = wmul(cleanSize, {int(round(k*1e18))});\\n            if (skewRatio > skewCap) skewRatio = skewCap;'\n new+='\\n            uint256 push = skewRatio * DIR_IMPACT_MULT;'\n s=s.replace('uint256 push = tradeRatio * DIR_IMPACT_MULT;',new)\n if a!=1:\n  s=s.replace('if (push > WAD / 4) push = WAD / 4;',f'if (push > WAD / 4) push = WAD / 4;\\n            push = wmul(push, {int(round(a*1e18))} + wmul({int(round((1-a)*1e18))}, arbProbability));')\n if gain!=1:\n  s=s.replace('uint256 constant DIR_COEF = 20 * BPS;',f'uint256 constant DIR_COEF = {int(round(20*1e14*gain))};')\n  s=s.replace('uint256 constant DIR_TOX_COEF = 100 * BPS;',f'uint256 constant DIR_TOX_COEF = {int(round(100*1e14*gain))};')\n return s\n",
  "generator_base_url": "https://api.imd.fun/artifacts/19f2ec857df536e8ab62ab1da89ec6623332521ce46849f15bccff402c63e1e5",
  "generator_base_sha256": "f24b6ca198b744c380842c3a17964a6dc21f311bb04984b26733afa3fee8eaf2",
  "notes": [
    "Measured result; no leaderboard submission was made.",
    "Search used paired 64-seed blocks within the requested range and a shared 25-minute dispatch budget; the last dispatched simulations could finish after that budget. All selection was complete before the held-out block.",
    "The cleaned size cap reads the previous packed meanSize from slot 15 before the current trade updates it. The original activity, size, toxicity, and stale-price mechanisms are retained.",
    "The generator takes the exact RS2 code as its base argument; neutral means a=1, k=None, gain=1. Gain scales the two direction-state coefficients, not the separate stale-price shift.",
    "Retail and arbitrage edge deltas are reconstructed using the requested harness decomposition with initial fee 0.0004; their seedwise sum reconciles to total paired edge.",
    "Pinned simulator wheel sha256 aedb68280aca34c110968f00148387c95885207913fb2cf19a1ab4c5cfd6887a; checkout 6b6921f8d463314aa7c96234e1be25a25245f704; Solidity 0.8.24; run_batch threads=8; gas counters reset per 20-seed chunk."
  ]
}