Enrich M3 sim sub-specs with 11 discovered frameworks and 360:1 minimum speed

- M3 hub: add L3 invariant (360:1 minimum sim speed), six-horizon time table
- M3a: add Heston stochastic vol, rough volatility (fBM), HMM regime detection,
  DCC-GARCH copula, jump-diffusion; six-horizon mapping
- M3b: add Hegselmann-Krause bounded confidence, complex contagion, bandit-
  replicator hybrid, MFG (HJB+FP), pump-and-dump 3-type ABM; six-horizon mapping
- M3c: add six-horizon time table
- M3d: add Kolokoltsov adversarial (non-linear FP + WENO), DSMFG bilevel
  optimization, cross-chain adversarial arbitrage; six-horizon mapping
- M3e: add kinked lending rate model, DeXposure inter-protocol credit network,
  composable yield optimizer; six-horizon mapping
- M3f: add MFG for validator populations, six-horizon time table
- M3g: add Almgren-Chriss optimal execution, six-horizon mapping
- CLAUDE.md: add subagent productivity note

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-07-13 21:29:38 +00:00
parent 98a6f9a0b1
commit 1da2fa19c6
9 changed files with 412 additions and 146 deletions
+74 -29
View File
@@ -1,69 +1,114 @@
# M3d — MEV & adversarial extraction sims
## 1. Component
Maximal Extractable Value simulation: models **transaction ordering as an optimization problem**,
**Priority Gas Auctions (PGA) as all-pay auctions**, and **block building as a multidimensional
knapsack problem**. Pops here are **searcher bots, block builders, and validators** competing for
extractable value. Grounded in ACM MEV game theory [3] and knapsack auction literature [4,5].
Maximal Extractable Value and adversarial simulation: models **transaction ordering as an
optimization problem**, **Priority Gas Auctions (PGA) as all-pay auctions**, **block building as a
multidimensional knapsack problem**, **cross-chain adversarial arbitrage**, and **Dynamic
Stackelberg Mean-Field Games (DSMFG) for protocol-level adversarial policy**. Pops here are
**searcher bots, block builders, validators, cross-chain arbitrageurs, and adversarial
manipulators** competing for extractable value across **six concurrent time horizons**.
Grounded in ACM MEV game theory [3], knapsack auction literature [4,5], Kolokoltsov adversarial
dynamics (non-linear Fokker-Planck with WENO shock capturing), and DSMFG bilevel optimization
(leader policy + follower MFG equilibrium).
## 2. Status / certainty
DESIGN-FIRST · ABSENT. PGA-as-all-pay-auction model C4 (ACM [3]); knapsack formulation C4
(Cornell [4,5]); simulation parameterization C1.
DESIGN-FIRST · ABSENT. PGA-as-all-pay-auction C4 (ACM [3]); knapsack formulation C4 (Cornell
[4,5]); cross-chain arbitrage C4 (ACM SIGMETRICS 2025, 5.5x growth since Dencun); DSMFG bilevel
optimization C3 (emerging — SMFRL solvers); Kolokoltsov adversarial C3 (non-linear Fokker-Planck;
WENO discretization established but crypto application novel). Parameterization C1.
## 3. Language & location
TBD · `src/economy/sims/mev/`. Needs combinatorial optimization (for knapsack) and continuous-time
auction modeling. Python (PuLP/OR-Tools for optimization), Rust, or Julia.
TBD · `src/economy/sims/mev/`. Needs combinatorial optimization (PuLP/OR-Tools for knapsack),
continuous-time auction modeling, PDE solvers (WENO for shock-capturing in adversarial dynamics),
and bilevel optimization (DSMFG). Python, Rust, or Julia.
## 4. Does / does-not
- **Does:** simulate Priority Gas Auctions where multiple searcher bots compete for the same
arbitrage opportunity $V$ by bidding gas fees $g$ in a continuous-time all-pay auction; model
block building as a multidimensional knapsack problem (scarce block space, heterogeneous
transaction values/sizes); simulate endogenous selection cutoffs under paid-priority ordering;
predict MEV exposure for proposed trades; produce bounded predictions on extraction risk and
optimal gas strategies.
- **Does-not:** extract MEV itself (this is a simulator, not a searcher); model AMM mechanics
(M3c handles pool math); model social dynamics (M3b).
model **cross-chain adversarial arbitrage** with inventory vs. bridge execution trade-off:
$\pi_{\text{inv}} = (P_{\text{src}} - P_{\text{dst}} - \text{slippage} - \text{gas}) \times q$
vs. $\pi_{\text{bridge}} = (P_{\text{src}} - P_{\text{dst}} - \text{fee} -
\text{depreciation}(\Delta t)) \times q$ where bridge latency $\Delta t \approx 242$s vs.
inventory $\Delta t \approx 9$s; solve **Dynamic Stackelberg MFG** for adversarial policy
design — bilevel optimization where a leader (protocol/regulator) sets policy and followers
(searchers) respond as an MFG equilibrium: the leader solves
$\min_\alpha J_L(\alpha, m^*(\alpha))$ subject to $m^*(\alpha)$ being the MFG Nash equilibrium
of followers under policy $\alpha$; model **Kolokoltsov adversarial dynamics** via non-linear
Fokker-Planck: $\partial_t m + \nabla \cdot (b(x,m)m) = \frac{1}{2}\nabla^2(\sigma^2 m)$
with WENO shock-capturing for discontinuous adversarial strategies; predict MEV exposure for
proposed trades; produce bounded predictions on extraction risk across all six time horizons.
- **Does-not:** extract MEV itself (simulator, not a searcher); model AMM pool math (M3c);
model social dynamics (M3b); execute cross-chain bridges (Marketplace does).
## 5. Interface contract
- Implements `query(PredictionQuery) -> BoundedPrediction` per M3 hub.
- **Output bounds:** extraction probability ranges and gas cost intervals.
Example: `{ value: 0.23, lower_bound: 0.11, upper_bound: 0.38, confidence: 0.80,
time_horizon: "next_block", sim_type: "mev_adversarial" }` — probability this trade gets
sandwiched.
Example: `{ value: 14.7, lower_bound: 8.2, upper_bound: 22.5, confidence: 0.75,
time_horizon: "next_block", sim_type: "mev_adversarial" }` — optimal gas bid (gwei) for
a given opportunity.
- **Output bounds:** extraction probability ranges, gas cost intervals, cross-chain profit
bounds, DSMFG equilibrium stability ranges.
- **Time-horizon mapping** (all run concurrently, ≥ 360:1 speed):
| Horizon | Primary models | Update cadence |
|---------|---------------|----------------|
| Tick–hourly | PGA auctions, sandwich detection, cross-chain arb | Every block |
| Daily | Knapsack builder strategies, MEV landscape | Hourly roll |
| Weekly | Searcher population dynamics, cross-chain flow patterns | Daily roll |
| Monthly | DSMFG policy equilibria, adversarial strategy evolution | Weekly roll |
| Annual | Kolokoltsov adversarial long-run dynamics | Monthly roll |
| 5-year | Structural MEV regime shifts, protocol-level policy effects | Quarterly roll |
- Examples:
`{ value: 0.23, lower_bound: 0.11, upper_bound: 0.38, confidence: 0.80,
time_horizon: "next_block", sim_type: "mev_adversarial" }` — sandwich probability.
`{ value: 14.7, lower_bound: 8.2, upper_bound: 22.5, confidence: 0.75,
time_horizon: "next_block", sim_type: "mev_adversarial" }` — optimal gas bid (gwei).
`{ value: 0.034, lower_bound: 0.018, upper_bound: 0.052, confidence: 0.82,
time_horizon: "1h", sim_type: "mev_adversarial" }` — cross-chain arb profit (ETH).
- **Prediction types:** `sandwich_probability`, `frontrun_risk`, `optimal_gas_bid`,
`block_inclusion_probability`, `mev_exposure`.
- Calibration: ingests `on_chain_event` (mempool-like data) and `price_tick` from M2.
`block_inclusion_probability`, `mev_exposure`, `cross_chain_arb_profit`,
`adversarial_policy_stability`, `searcher_population_shift`.
- Calibration: ingests `on_chain_event` (mempool-like data), `price_tick`, and cross-chain
bridge state from M2.
## 6. Dependencies & stubs
- M2 Data Feeds — on-chain events and gas data; *stub:* canned mempool snapshots.
- M2 Data Feeds — on-chain events, gas data, cross-chain state; *stub:* canned snapshots.
- M3 Sims hub — lifecycle management; *stub:* manual init.
- M3c AMM sims — pool state for arbitrage opportunity detection; *stub:* fixed pool state.
## 7. Invariants / laws
- **L1 (C4):** PGA is modeled as an **all-pay auction** — all bidders pay their gas whether they
- **L1 (C5):** PGA is modeled as an **all-pay auction** — all bidders pay their gas whether they
win or not. The sim must capture this cost structure (not winner-pays-only).
- **L2 (C4):** block building is a **knapsack problem, not a queue** — builders optimize for
- **L2 (C5):** block building is a **knapsack problem, not a queue** — builders optimize for
total extracted value subject to gas limit constraints, not first-come-first-served.
- **L3 (C3):** MEV exposure predictions are **pre-trade** — traders query this sim *before*
- **L3 (C4):** MEV exposure predictions are **pre-trade** — traders query this sim *before*
submitting to the Marketplace to understand their extraction risk.
- **L4 (C4):** cross-chain arb models **both execution paths** — inventory (fast, capital-
intensive) and bridge (slow, capital-light) — never assumes one dominates.
- **L5 (C3):** DSMFG solutions are **bilevel** — the leader's optimal policy depends on the
followers' MFG equilibrium, which itself depends on the leader's policy. Fixed-point iteration
or SMFRL solvers required.
## 8. Build steps
1. Implement the PGA all-pay auction model (N searchers, opportunity value V, gas bids).
2. Implement the block-building knapsack solver.
3. Add sandwich/frontrun detection heuristics.
4. Wire M2 on-chain data → calibration of searcher population and gas dynamics.
5. Wire pre-trade query interface for Traders.
4. Implement cross-chain arb model (inventory vs. bridge, latency, MEV exposure).
5. Implement Kolokoltsov non-linear Fokker-Planck with WENO discretization.
6. Implement DSMFG bilevel solver (leader policy + follower MFG equilibrium).
7. Wire M2 on-chain + cross-chain data → calibration.
8. Wire pre-trade query interface for Traders.
## 9. Tests
All-pay: losing bidders still pay gas cost. Knapsack: builder selects optimal transaction set
under gas limit. Sandwich: known sandwich-vulnerable trade flagged; non-vulnerable trade clear.
Bounds: all outputs bounded. Pre-trade: query does not submit any transaction.
Cross-chain: inventory path preferred when latency advantage exceeds capital cost. DSMFG: leader
policy converges to fixed point with follower equilibrium. Kolokoltsov: WENO captures shock
discontinuities in adversarial strategy distribution. Bounds: all outputs bounded. Pre-trade:
query does not submit any transaction. Speed: sim advances ≥ 360:1.
## 10. Open items
- Mempool data access (public mempool? private order flow?).
- Which MEV types to model initially (sandwich, backrun, liquidation, JIT?).
- Multi-block MEV (cross-block extraction strategies).
- Integration with M3c (arbitrage opportunities arise from AMM pool state).
- DSMFG solver choice (SMFRL? fictitious play? direct bilevel optimization?).
- WENO order for Kolokoltsov (3rd? 5th? tradeoff with compute budget).
- Which L2s/bridges to model for cross-chain (Arbitrum? Optimism? Base?).