Skip to main content

Crate degenbot_executor

Crate degenbot_executor 

Source
Expand description

The cmd_executor command-stream grammar — solver result → the bytes the on-chain cmd_executor.execute(bytes, config) contract runs.

A pyo3-free core leaf (ADR-005 standalone surface) with two modules:

§Warmup-slot storage layout

  • WETH9 balanceOf at mapping slot 3 (name@0, symbol@1, decimals@2 — all occupy storage, not constant).
  • PoolManager ERC6909 balanceOf at mapping slot 4 (C3 linearization of PoolManager is ProtocolFees, ERC6909Claims, …: owner@0, pendingOwner@1, isOperator@2, protocolFeesAccrued@3, balanceOf@4).
  • ERC6909 id = uint160(currency) per CurrencyLibrary.toId() — the native id is uint160(address(0)) = 0.

WarmupSlots carries the three computed slot addresses only (U256); the warmed balance values + the eth_simulateV1 {address: {"stateDiff": {slot_hex: value_hex}}} dict shape are a thin PyO3 adapter concern, not a core one.

§Parity

The warmup slots are byte-for-byte parity vs cmd_executor.initialize()’s storage layout (§4.2) — canonical mainnet WETH (0xC02…) / PoolManager (0x0000…444c). The grammar’s byte-identity is pinned by the golden corpus + the revm runtime matrix (degenbot-simulation).

Modules§

composers
2-hop + N-hop command-stream path composers.
config
The execute(commands, config) ABI config uint256 packing.
encoders
Command-stream primitives — opcode constants, AddressTable, and a pub fn enc_* builder for every opcode (0x00–0x59, 0xFF).
grammar_ledger
Executor grammar — full axis model + a ledger-validator that makes the two real bug classes unrepresentable (ADR-029 D1/D2, D5).
grammar_plan
The Plan walker — the deep, stable half of the grammar (grammar_shape.rs split, ERP6ES / candidate 2 of architecture-review-1786663110.html).
grammar_shape
Builders — the per-family dispatch surface + validator gate (grammar_shape.rs split, ERP6ES / candidate 2 of architecture-review-1786663110.html).
grammar_walker
ADR-031 D6 — the sole facts-driven Plan producer .

Structs§

WarmupSlots
The three computed warmup slot addresses for eth_simulateV1 stateDiff overrides.

Constants§

POOL_MANAGER_ERC6909_BALANCE_OF_SLOT
The PoolManager ERC6909 balanceOf mapping storage slot (C3 linearization: owner@0, pendingOwner@1, isOperator@2, protocolFeesAccrued@3, balanceOf@4).
WETH9_BALANCE_OF_SLOT
The WETH9 balanceOf mapping storage slot (name@0, symbol@1, decimals@2, balanceOf@3).

Functions§

compute_simulation_warmup_slots
Compute the three eth_simulateV1 warmup slot addresses that replicate the effect of cmd_executor.initialize().
erc6909_id
Derive the ERC6909 token id for a currency: uint160(currency) per CurrencyLibrary.toId() (the low 160 bits of the address’s integer form).
mapping_slot
Compute a Solidity mapping storage slot: keccak256(key ‖ base_slot), both 32-byte big-endian.
nested_mapping_slot
Compute the storage slot for mapping[key1][key2] at base_slot: mapping_slot(mapping_slot(base_slot, key1), key2).