Werracle v2.0: Constant-Storage EVM Procedural Oracles, Multi-Chain OEV Surveillance, and Formally Verified Liquidation Models
Volkan Dagli, Zerrin Dagli, Daghan Dagli
cs.CR
Sep 25, 2026 · v2
cs.AI cs.DC
TL;DR
Lean 4 with Mathlib proves 13 theorems about abstract models of an EVM decision kernel: fixed-point boundedness, Z/9Z ring properties, packing invariants and halting.
Abstract
Decentralized finance (DeFi) protocols face a severe storage and latency barrier when embedding adaptive risk scoring directly inside Ethereum Virtual Machine (EVM) smart contracts: storing 100,000 FP32 neural weights on-chain demands 250M SSTORE gas (or 80M gas via bytecode storage), while Zero-Knowledge Machine Learning (ZK-ML) incurs 10–300 s off-chain proving latency and 380k verification gas. We present Werracle v2.0, a constant-storage on-chain procedural decision kernel packed into a single 32-byte EVM storage slot (PackedSeed; 100 gas warm SLOAD) and paired with a read-only multi-chain Oracle Extractable Value (OEV) observatory. Replacing v1.0's dense 16-point loop with a 12-point, 3-plane Sparse Harmonic Tripod using native int256 unchecked Q16.16 arithmetic (WerracleTripodZMod9.sol) cuts pure view forward gas by 92.49% across a 25-vector Solidity 0.8.20 sweep – from 226,363 +/- 51 gas to 16,993 +/- 8 gas (full warm transactions: 38.5k–55.6k net gas, 4.9x–6.3x below EZKL verification). Alongside live Aurora Testnet Q16.16 parity and standalone fee-governor adapters (WerracleFeeHook.sol), we report a live read-only observatory snapshot across 12 Aave v3 chains (7-day rolling window) and Morpho Blue (5.65-day window): Chainlink SVR captures 75.0%–85.7% of meaningful Arbitrum/Base Aave liquidations (n = 7–8), whereas Ethereum L1 Aave ($125.8k, 0% SVR) and L1 Morpho Blue (1,130 markets, $899.1k liquid gross bonus, 87.2% Gate-A pre/same-block capture) remain predominantly open-race. Formal models comprise 13 core EVM-kernel Lean 4 theorems (0 sorry), 27 extended discrete-dynamics theorems locally, and 43 theorems in companion runtime-verification packages.
Problem
Embedding adaptive risk scoring in EVM smart contracts is limited by storage gas costs, and ZK-ML adds off-chain proving latency and high verification gas. DeFi liquidation competition also varies by venue, with some markets using oracle auctions and others remaining open races.
Approach
Werracle v2.0 packs a procedural decision kernel, derived from the complex quadratic map, into a single 32-byte storage slot. It evaluates a 12-point, 3-plane sparse probe using unchecked int256 Q16.16 arithmetic. A read-only observatory monitors liquidations on 12 Aave v3 chains and Morpho Blue. Lean 4/Mathlib models prove core kernel properties; the authors state these proofs cover abstract mathematical models, not the compiled bytecode.
Results
Pure view forward gas drops 92.49%, from 226,363 to 16,993 gas, and full warm transactions cost 38.5k–55.6k net gas. Chainlink SVR captures 75–85.7% of meaningful Arbitrum/Base Aave liquidations, while Ethereum L1 venues remain mostly open-race. The Lean files contain 13 core theorems with 0 sorry; the Phase-2 loop and 256-bit overflow-freedom are not yet mechanized.
| Suite | Scope | Thms |
|---|
| Core EVM Kernel (WerracleProof.lean) | Q16.16 boundedness, Z/9Z ring ideals, 32-B packing invariants, halting (≤9 steps) | 13 |
| Extended Bio-Swarm | Discrete metabolic/turnover models (no Solidity counterpart) | 27 |
| Radar v3.0.0 | External companion: cross-chain monitors | 21 |
| OrakExecRV | External companion: EIP-1153 TSTORE solver | 22 |
Decomposition of Lean 4 formal models (0 sorry)