{
  "approach": "Replicate the strongest measured public implementation: jiayaoqijia YQ, unchanged. Eleven slots maintain bid/ask, timestamp, fair-price estimate, volatility, arrival rate, size, toxicity, activity, direction and per-step count. Reconstruct fee-band-implied price using the previous fee; blend first-in-step observations at 26% and later observations at 5%, behind a sigma-dependent outlier gate. Decay signals on elapsed steps. Fees combine a flow/volatility base, nonlinear toxicity and activity widening, directional pressure, asymmetric stale-price protection/discount, trade-aligned boosts, and tail compression. There is no direct fair-price observation or explicit arb label; these are estimators. Reject both Dipankar candidates on paired training results and freeze YQ before holdout evaluation.",
  "tried": [
    {
      "candidate": "YQ exact public replica",
      "code_sha256": "00fae418c49cd681ad0879c6f96ebed0163fab5a660b38030f11e6947a39afd4",
      "status": "selected; only promotion is starter to YQ on untouched holdout",
      "paired": {
        "reference": "contracts/src/StarterStrategy.sol",
        "seed_start": 100000,
        "n": 2000,
        "mean_diff": 154.69298561513727,
        "se": 0.9461910610703154,
        "worst": [
          {
            "seed": 101573,
            "diff": 74.78247174667234
          },
          {
            "seed": 100645,
            "diff": 75.81076833047553
          },
          {
            "seed": 100236,
            "diff": 79.79124592449145
          },
          {
            "seed": 100631,
            "diff": 80.0246636409841
          },
          {
            "seed": 100274,
            "diff": 80.76542703368204
          }
        ]
      }
    },
    {
      "candidate": "Dipankar WinningV5",
      "code_sha256": "dc8dff6827ecc6aadecfe9936edd4fa8b48fc402dc2fa5257503f0feb822bd05",
      "status": "rejected",
      "paired": {
        "reference": "YQ replica",
        "seed_start": 2000,
        "n": 2000,
        "mean_diff": -232.87566931165858,
        "se": 1.1826898210430972,
        "worst": [
          {
            "seed": 3582,
            "diff": -509.6713173769786
          },
          {
            "seed": 2174,
            "diff": -480.5693889497866
          },
          {
            "seed": 3713,
            "diff": -452.7082049224798
          },
          {
            "seed": 2870,
            "diff": -444.9147117609877
          },
          {
            "seed": 2284,
            "diff": -441.8432962912183
          }
        ]
      }
    },
    {
      "candidate": "Dipankar SigmaAdaptive",
      "code_sha256": "84da373d4ecc47b5ecaa96adfcc432ad62825a0c608e7529404fa8a0184cdf90",
      "status": "rejected",
      "paired": {
        "reference": "YQ replica",
        "seed_start": 4000,
        "n": 2000,
        "mean_diff": -5.051805931911498,
        "se": 0.04138743061523041,
        "worst": [
          {
            "seed": 4124,
            "diff": -17.44880691331548
          },
          {
            "seed": 4750,
            "diff": -16.87529654792621
          },
          {
            "seed": 4057,
            "diff": -13.22761169353521
          },
          {
            "seed": 4967,
            "diff": -12.881273799611108
          },
          {
            "seed": 4543,
            "diff": -12.744033365881478
          }
        ]
      }
    }
  ],
  "next": [
    "Ablate YQ flow/activity terms with 2000 paired tuning seeds and a separate fresh confirmation set.",
    "Replace the generic first-trade implied-price blend with a probabilistic arb/retail mixture constrained by the fee band.",
    "Estimate normalizer-relative spot and retail arrival conditional on idle gaps to adapt the attract-side discount."
  ],
  "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    // --- decay / update constants ---\n    uint256 constant ELAPSED_CAP = 8;\n    uint256 constant SIGNAL_THRESHOLD = WAD / 500; // ~20 bps of reserve\n    uint256 constant DIR_DECAY = 800000000000000000; // 0.80\n    uint256 constant ACT_DECAY = 700000000000000000; // 0.70\n    uint256 constant SIZE_DECAY = 700000000000000000; // 0.70\n    uint256 constant TOX_DECAY = 910000000000000000; // 0.91\n    uint256 constant SIGMA_DECAY = 824000000000000000; // 0.824\n    uint256 constant LAMBDA_DECAY = 990000000000000000; // 0.99\n    uint256 constant SIZE_BLEND_DECAY = 818000000000000000; // 0.818\n    uint256 constant TOX_BLEND_DECAY = 51000000000000000; // 0.051\n    uint256 constant ACT_BLEND_DECAY = 985000000000000000; // 0.985\n    uint256 constant PHAT_ALPHA = 260000000000000000; // 0.26\n    uint256 constant PHAT_ALPHA_RETAIL = 50000000000000000; // 0.05\n    uint256 constant DIR_IMPACT_MULT = 2;\n\n    // --- Adaptive Shock Gate ---\n    uint256 constant GATE_SIGMA_MULT = 10 * WAD;\n    uint256 constant MIN_GATE = 30000000000000000; // 0.03 WAD\n\n    // --- Cubic Toxicity ---\n    uint256 constant TOX_CUBIC_COEF = 15000 * BPS;\n\n    // --- Trade-Tox Boost ---\n    uint256 constant TRADE_TOX_BOOST = 2500 * BPS;\n\n    // --- Asymmetric Stale Dir ---\n    uint256 constant STALE_ATTRACT_FRAC = 1124000000000000000; // 1.124\n\n    // --- state caps ---\n    uint256 constant RET_CAP = WAD / 10; // 10%\n    uint256 constant TOX_CAP = WAD / 5; // 20%\n    uint256 constant TRADE_RATIO_CAP = WAD / 5; // 20%\n    uint256 constant LAMBDA_CAP = 5 * WAD; // max 5 trades/step estimate\n    uint256 constant STEP_COUNT_CAP = 64; // guardrail\n\n    // --- fee model constants ---\n    uint256 constant BASE_FEE = 3 * BPS;\n    uint256 constant SIGMA_COEF = 200000000000000000; // 0.20\n    uint256 constant LAMBDA_COEF = 12 * BPS;\n    uint256 constant FLOW_SIZE_COEF = 4842 * BPS;\n    uint256 constant TOX_COEF = 250 * BPS;\n    uint256 constant TOX_QUAD_COEF = 11700 * 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 = 500 * BPS;\n    uint256 constant TAIL_SLOPE_PROTECT = 930000000000000000; // 0.93\n    uint256 constant TAIL_SLOPE_ATTRACT = 955000000000000000; // 0.955\n\n    // slots[0] = bid fee\n    // slots[1] = ask fee\n    // slots[2] = last timestamp\n    // slots[3] = dirState (centered at WAD, [0, 2*WAD])\n    // slots[4] = actEma\n    // slots[5] = pHat\n    // slots[6] = sigmaHat\n    // slots[7] = lambdaHat\n    // slots[8] = sizeHat\n    // slots[9] = toxEma\n    // slots[10] = stepTradeCount (raw integer)\n\n    function afterInitialize(uint256 initialX, uint256 initialY) external override returns (uint256, uint256) {\n        slots[0] = BASE_FEE;\n        slots[1] = BASE_FEE;\n        slots[2] = 0;\n        slots[3] = WAD; // neutral direction\n        slots[4] = 0;\n        slots[5] = initialX > 0 ? wdiv(initialY, initialX) : 100 * WAD;\n        slots[6] = 950000000000000; // 0.095% initial sigma guess\n        slots[7] = 800000000000000000; // 0.8 initial arrival-rate guess\n        slots[8] = 2000000000000000; // 0.2% reserve-size ratio guess\n        slots[9] = 0;\n        slots[10] = 0;\n        return (BASE_FEE, BASE_FEE);\n    }\n\n    function afterSwap(TradeInfo calldata trade) external override returns (uint256, uint256) {\n        uint256 prevBidFee = slots[0];\n        uint256 prevAskFee = slots[1];\n        uint256 lastTs = slots[2];\n        uint256 dirState = slots[3];\n        uint256 actEma = slots[4];\n        uint256 pHat = slots[5];\n        uint256 sigmaHat = slots[6];\n        uint256 lambdaHat = slots[7];\n        uint256 sizeHat = slots[8];\n        uint256 toxEma = slots[9];\n        uint256 stepTradeCount = slots[10];\n\n        bool isNewStep = trade.timestamp > lastTs;\n        if (isNewStep) {\n            uint256 elapsedRaw = trade.timestamp - lastTs;\n            uint256 elapsed = elapsedRaw > ELAPSED_CAP ? ELAPSED_CAP : elapsedRaw;\n\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\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\n            stepTradeCount = 0;\n        }\n\n        bool firstInStep = stepTradeCount == 0;\n\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) {\n            pImplied = spot;\n        } else {\n            pImplied = trade.isBuy ? wmul(spot, gamma) : wdiv(spot, gamma);\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 adaptiveGate = wmul(sigmaHat, GATE_SIGMA_MULT);\n            if (adaptiveGate < MIN_GATE) adaptiveGate = MIN_GATE;\n            if (ret <= adaptiveGate) {\n                pHat = wmul(pHat, WAD - alpha) + wmul(pImplied, alpha);\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        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\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\n            actEma = wmul(actEma, ACT_BLEND_DECAY) + wmul(tradeRatio, WAD - ACT_BLEND_DECAY);\n\n            sizeHat = wmul(sizeHat, SIZE_BLEND_DECAY) + wmul(tradeRatio, WAD - SIZE_BLEND_DECAY);\n            if (sizeHat > WAD) sizeHat = WAD;\n        }\n\n        uint256 tox = pHat > 0 ? wdiv(absDiff(spot, pHat), pHat) : 0;\n        if (tox > TOX_CAP) tox = TOX_CAP;\n        toxEma = wmul(toxEma, TOX_BLEND_DECAY) + wmul(tox, WAD - TOX_BLEND_DECAY);\n        uint256 toxSignal = toxEma;\n\n        stepTradeCount = stepTradeCount + 1;\n        if (stepTradeCount > STEP_COUNT_CAP) stepTradeCount = STEP_COUNT_CAP;\n\n        uint256 flowSize = wmul(lambdaHat, sizeHat);\n        uint256 fBase = BASE_FEE + wmul(SIGMA_COEF, sigmaHat) + wmul(LAMBDA_COEF, lambdaHat) + wmul(FLOW_SIZE_COEF, flowSize);\n        uint256 fMid = fBase + wmul(TOX_COEF, toxSignal) + wmul(TOX_QUAD_COEF, wmul(toxSignal, toxSignal)) + wmul(ACT_COEF, actEma);\n\n        fMid = fMid + wmul(SIGMA_TOX_COEF, wmul(sigmaHat, toxSignal));\n\n        // Cubic toxicity\n        {\n            uint256 toxCubed = wmul(toxSignal, wmul(toxSignal, toxSignal));\n            fMid = fMid + wmul(TOX_CUBIC_COEF, toxCubed);\n        }\n\n        uint256 dirDev;\n        bool sellPressure;\n        if (dirState >= WAD) {\n            dirDev = dirState - WAD;\n            sellPressure = true;\n        } else {\n            dirDev = WAD - dirState;\n            sellPressure = false;\n        }\n\n        uint256 skew = wmul(DIR_COEF, dirDev) + wmul(DIR_TOX_COEF, wmul(dirDev, toxSignal));\n\n        uint256 bidFee;\n        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        // Directional protection using stale-price sign\n        {\n            uint256 staleShift = wmul(STALE_DIR_COEF, toxSignal);\n            uint256 attractShift = wmul(staleShift, STALE_ATTRACT_FRAC);\n            if (spot >= pHat) {\n                bidFee = bidFee + staleShift;\n                askFee = askFee > attractShift ? askFee - attractShift : 0;\n            } else {\n                askFee = askFee + staleShift;\n                bidFee = bidFee > attractShift ? bidFee - attractShift : 0;\n            }\n        }\n\n        // Trade-aligned toxicity boost\n        {\n            bool tradeAligned = (trade.isBuy && spot >= pHat) || (!trade.isBuy && spot < pHat);\n            if (tradeAligned) {\n                uint256 tradeBoost = wmul(TRADE_TOX_BOOST, tradeRatio);\n                if (trade.isBuy) {\n                    bidFee = bidFee + tradeBoost;\n                } else {\n                    askFee = askFee + tradeBoost;\n                }\n            }\n        }\n\n        // Asymmetric tail compression\n        if (sellPressure) {\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_PROTECT));\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_ATTRACT));\n        } else {\n            askFee = clampFee(_compressTailWithSlope(askFee, TAIL_SLOPE_PROTECT));\n            bidFee = clampFee(_compressTailWithSlope(bidFee, TAIL_SLOPE_ATTRACT));\n        }\n\n        slots[0] = bidFee;\n        slots[1] = askFee;\n        slots[2] = trade.timestamp;\n        slots[3] = dirState;\n        slots[4] = actEma;\n        slots[5] = pHat;\n        slots[6] = sigmaHat;\n        slots[7] = lambdaHat;\n        slots[8] = sizeHat;\n        slots[9] = toxEma;\n        slots[10] = stepTradeCount;\n\n        return (bidFee, askFee);\n    }\n\n    function _compressTailWithSlope(uint256 fee, uint256 slope) internal pure returns (uint256) {\n        if (fee <= TAIL_KNEE) return fee;\n        return TAIL_KNEE + wmul(fee - TAIL_KNEE, slope);\n    }\n\n    function _powWad(uint256 factor, uint256 exp) internal pure returns (uint256 result) {\n        result = WAD;\n        while (exp > 0) {\n            if (exp & 1 == 1) result = wmul(result, factor);\n            factor = wmul(factor, factor);\n            exp >>= 1;\n        }\n    }\n\n    function _decayCentered(uint256 centered, uint256 decayFactor, uint256 elapsed) internal pure returns (uint256) {\n        uint256 mul = _powWad(decayFactor, elapsed);\n        if (centered >= WAD) {\n            return WAD + wmul(centered - WAD, mul);\n        }\n        uint256 below = wmul(WAD - centered, mul);\n        return below < WAD ? WAD - below : 0;\n    }\n\n    function getName() external pure override returns (string memory) {\n        return \"yq\";\n    }\n}\n",
  "code_sha256": "00fae418c49cd681ad0879c6f96ebed0163fab5a660b38030f11e6947a39afd4",
  "score": {
    "n": 1000,
    "mean_edge": 524.6271111458843,
    "seed_start": 0,
    "se": 2.784901273048285
  },
  "paired": {
    "reference": "contracts/src/StarterStrategy.sol",
    "seed_start": 100000,
    "n": 2000,
    "mean_diff": 154.69298561513727,
    "se": 0.9461910610703154,
    "worst": [
      {
        "seed": 101573,
        "diff": 74.78247174667234
      },
      {
        "seed": 100645,
        "diff": 75.81076833047553
      },
      {
        "seed": 100236,
        "diff": 79.79124592449145
      },
      {
        "seed": 100631,
        "diff": 80.0246636409841
      },
      {
        "seed": 100274,
        "diff": 80.76542703368204
      }
    ]
  },
  "seconds_per_simulation": 0.1029910074044019,
  "validate_ok": true,
  "citations": [
    {
      "url": "https://github.com/jiayaoqijia/amm-challenge-yq/blob/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/contracts/src/Strategy.sol",
      "role": "Delivered source, byte-for-byte replication; SPDX MIT"
    },
    {
      "url": "https://github.com/jiayaoqijia/amm-challenge-yq/blob/3e9dc7d5a6192c88b562a0f8d9c172ca566ec94d/README.md",
      "role": "Public mechanism write-up and self-reported 523.21 board score, not independently verified"
    },
    {
      "url": "https://github.com/dipankar/amm-challenge/blob/c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab/contracts/README.md",
      "role": "Historical WinningV1-V5 lineage index"
    },
    {
      "url": "https://github.com/dipankar/amm-challenge/blob/c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab/contracts/src/SigmaAdaptiveStrategy.sol",
      "role": "Newer public candidate, measured and rejected"
    },
    {
      "url": "https://github.com/dipankar/amm-challenge/blob/c588ae6c47fc9af2063c9bb1f2efbeb0dd276dab/ANALYSIS.md",
      "role": "Public post-mortem on state estimation versus trade classification"
    },
    {
      "url": "https://medium.com/@crypto_algebra/amm-fee-challenge-notes-from-our-run-on-optimization-arena-4e980dbbd699",
      "role": "Public first-party write-up: latent environment estimation, asymmetric fees, and first-trade ordering; no Solidity source supplied"
    },
    {
      "url": "https://github.com/benedictbrady/amm-challenge/tree/6b6921f8d463314aa7c96234e1be25a25245f704",
      "role": "Pinned compiler, validator, simulator, starter and normalizer"
    }
  ],
  "changed": [
    "candidates/public-replica/Strategy.sol",
    "candidates/public-replica/result.json",
    "candidates/public-replica/NOTES.md",
    "artifacts/goal/batches/r1/items/public-replica/result.json"
  ],
  "checks": [
    {
      "command": "Fetch each public contract at its recorded immutable GitHub commit and compare with the downloaded bytes",
      "result": "All three matched; the delivered YQ file matches its public source SHA-256 exactly"
    },
    {
      "command": "Compare the offset-zero config builder to MatchRunner._build_configs for seeds 0..19",
      "result": "All twelve config fields matched exactly for every seed"
    },
    {
      "command": "git clone https://github.com/benedictbrady/amm-challenge test/scratch/public-replica/simulator; git -C test/scratch/public-replica/simulator checkout 6b6921f8d463314aa7c96234e1be25a25245f704",
      "result": "Pinned checkout verified"
    },
    {
      "command": "uv venv test/scratch/public-replica/venv; uv pip install --python test/scratch/public-replica/venv/bin/python maturin numpy py-solc-x pyrevm -e test/scratch/public-replica/simulator",
      "result": "Installed checkout-local dependencies"
    },
    {
      "command": "maturin develop --uv --release --manifest-path test/scratch/public-replica/simulator/amm_sim_rs/Cargo.toml",
      "result": "Release engine built and installed"
    },
    {
      "command": "amm-match validate candidates/public-replica/Strategy.sol",
      "result": "Validating strategy...\nCompiling strategy...\nStrategy 'yq' validated successfully!"
    },
    {
      "command": "amm-match run candidates/public-replica/Strategy.sol --simulations 20",
      "result": "Validating strategy...\nCompiling strategy...\nStrategy: yq\n\nRunning 20 simulations...\n\nyq Edge: 560.15; matches first 20 seed results from the custom runner to printed precision"
    },
    {
      "command": "amm-match validate test/scratch/public-replica/sigma.sol; amm-match validate test/scratch/public-replica/dipankar.sol",
      "result": "SigmaAdaptive and WinningV5 validated successfully"
    },
    {
      "command": "python test/scratch/public-replica/check_calls.py candidates/public-replica/Strategy.sol",
      "result": {
        "calls": 10000,
        "seed": 7,
        "init_gas": 185532,
        "max_swap_gas": 92805,
        "max_gas_case": 0,
        "fee_bounds_ok": true,
        "all_calls_success": true
      }
    },
    {
      "command": "python test/scratch/public-replica/check_calls.py test/scratch/public-replica/sigma.sol; python test/scratch/public-replica/check_calls.py test/scratch/public-replica/dipankar.sol",
      "result": {
        "SigmaAdaptive": {
          "calls": 10000,
          "seed": 7,
          "init_gas": 176674,
          "max_swap_gas": 101182,
          "max_gas_case": 0,
          "fee_bounds_ok": true,
          "all_calls_success": true
        },
        "WinningV5": {
          "calls": 10000,
          "seed": 7,
          "init_gas": 88125,
          "max_swap_gas": 46350,
          "max_gas_case": 0,
          "fee_bounds_ok": true,
          "all_calls_success": true
        }
      }
    },
    {
      "command": "python test/scratch/public-replica/measure.py --candidate candidates/public-replica/Strategy.sol --reference test/scratch/public-replica/simulator/contracts/src/StarterStrategy.sol --start 90000 --n 20 --out test/scratch/public-replica/pilot.json",
      "result": {
        "n": 20,
        "seconds": {
          "candidate": 2.0752567388117313,
          "reference": 0.9979317300021648
        },
        "projected_2000_pair_seconds": 307.3188468813896
      }
    },
    {
      "command": "python test/scratch/public-replica/measure.py --candidate candidates/public-replica/Strategy.sol --reference test/scratch/public-replica/dipankar.sol --start 2000 --n 2000 --out test/scratch/public-replica/yq-vs-dip.json",
      "result": {
        "reference": "WinningV5",
        "seed_start": 2000,
        "n": 2000,
        "mean_diff": 232.87566931165858,
        "se": 1.1826898210430972,
        "worst": [
          {
            "seed": 2505,
            "diff": 122.98384106711953
          },
          {
            "seed": 3010,
            "diff": 124.96769052474102
          },
          {
            "seed": 2504,
            "diff": 126.73546533039524
          },
          {
            "seed": 2951,
            "diff": 127.66119225362115
          },
          {
            "seed": 3083,
            "diff": 128.4113517865482
          }
        ]
      }
    },
    {
      "command": "python test/scratch/public-replica/measure.py --candidate test/scratch/public-replica/sigma.sol --reference candidates/public-replica/Strategy.sol --start 4000 --n 2000 --out test/scratch/public-replica/sigma-vs-yq.json",
      "result": {
        "reference": "YQ replica",
        "seed_start": 4000,
        "n": 2000,
        "mean_diff": -5.051805931911498,
        "se": 0.04138743061523041,
        "worst": [
          {
            "seed": 4124,
            "diff": -17.44880691331548
          },
          {
            "seed": 4750,
            "diff": -16.87529654792621
          },
          {
            "seed": 4057,
            "diff": -13.22761169353521
          },
          {
            "seed": 4967,
            "diff": -12.881273799611108
          },
          {
            "seed": 4543,
            "diff": -12.744033365881478
          }
        ]
      }
    },
    {
      "command": "python test/scratch/public-replica/measure.py --candidate candidates/public-replica/Strategy.sol --start 0 --n 1000 --out test/scratch/public-replica/score.json",
      "result": {
        "n": 1000,
        "mean_edge": 524.6271111458843
      }
    },
    {
      "command": "python test/scratch/public-replica/measure.py --candidate candidates/public-replica/Strategy.sol --reference test/scratch/public-replica/simulator/contracts/src/StarterStrategy.sol --start 100000 --n 2000 --out test/scratch/public-replica/final.json",
      "result": {
        "reference": "contracts/src/StarterStrategy.sol",
        "seed_start": 100000,
        "n": 2000,
        "mean_diff": 154.69298561513727,
        "se": 0.9461910610703154,
        "worst": [
          {
            "seed": 101573,
            "diff": 74.78247174667234
          },
          {
            "seed": 100645,
            "diff": 75.81076833047553
          },
          {
            "seed": 100236,
            "diff": 79.79124592449145
          },
          {
            "seed": 100631,
            "diff": 80.0246636409841
          },
          {
            "seed": 100274,
            "diff": 80.76542703368204
          }
        ]
      }
    },
    {
      "command": "python3 test/scratch/public-replica/finalize.py; inline Python delivery audit",
      "result": "PASS: identical JSON copies; embedded source and SHA-256 match frozen Strategy.sol; 2000 unique contiguous fresh seeds; paired SE and worst five recomputed; gain exceeds twice SE; JSON below 64000 bytes; only allowed paths in git status; all deliverables untracked."
    }
  ],
  "failures_and_repairs": [
    {
      "command": "UV_INSTALL_DIR=... sh uv-install.sh; RUSTUP_HOME=... CARGO_HOME=... sh rust-install.sh",
      "failure": "Installers initially failed: mktemp could not create /tmp/tmp.XXXXXXXXXX.",
      "repair": "Set TMPDIR to checkout-local scratch/tmp and reran successfully.",
      "file_line": null
    },
    {
      "command": "maturin develop --release --manifest-path test/scratch/public-replica/simulator/amm_sim_rs/Cargo.toml",
      "failure": "UV venv has no pip; maturin failed to find pip.",
      "repair": "Reran with --uv; release build succeeded.",
      "file_line": null
    }
  ],
  "holdout_score": {
    "n": 2000,
    "mean_edge": 524.1942870525012,
    "reference_mean_edge": 369.50130143736396
  },
  "timing": {
    "workers": 8,
    "pilot": {
      "candidate": 2.0752567388117313,
      "reference": 0.9979317300021648
    },
    "final": {
      "candidate": 205.9820148088038,
      "reference": 88.21291747316718
    },
    "paired_seconds_per_seed": 0.14709746614098548,
    "note": "Wall seconds per simulation amortized over batches and eight workers; concurrent training jobs shared resources. Compilation excluded."
  },
  "previous_best": {
    "reference": "contracts/src/StarterStrategy.sol",
    "reason": "This item had no inherited dynamic incumbent. YQ is the sole promotion; starter is both requested reference and previous best."
  },
  "limitations": [
    "Public leaderboard claims are not local measurements and the live board was not independently verified.",
    "No claim to reach rank 1: this item supplies a measured public starting point.",
    "The base validator checks compilation and initialization, not all afterSwap paths; 10000 extra gas-limited swap calls were tested.",
    "No two unsuccessful optimization rounds were attempted: this bounded item is one public-replication round."
  ]
}
