Skip to main content

Crate degenbot_simulation

Crate degenbot_simulation 

Source
Expand description

The simulation engine — the in-process revm EVM handle + its DB stack.

ADR-019 D4/D7 (decision R — strategy/engine separation): this crate owns the engine (BlockSimHandle, the layered DB, apply_simulation_overrides, AccessListCollector, WarmCodeCache). The strategy — the 7-call pre/post-balance bundle, compute_priority_fee, decode_balance, SimResult, dispatch_profitable_results, SimulateContext, SimulatePath, FailBuckets, the calldata builders — relocated to the degenbot-arbitrage crate, which drives the borrowed &mut evm the engine exposes via BlockSimHandle::evm_mut.

§Standalone-Rust consumer

cargo add degenbot-simulation reaches the in-process engine surface with zero pyo3 dependency (ADR-005 standalone-core).

Re-exports§

pub use oracle::call_bytes;
pub use oracle::decode_error_string;
pub use oracle::deploy;
pub use oracle::load_foundry_creation_bytecode;
pub use oracle::native_balance_of;
pub use oracle::new_fixture_evm;
pub use oracle::parse_foundry_creation_bytecode;
pub use oracle::read_address;
pub use oracle::seed_slots;
pub use oracle::selector;
pub use oracle::set_code_size_limits;
pub use oracle::set_disable_nonce_check;
pub use oracle::set_native_balance;
pub use oracle::transact;
pub use oracle::FixtureEvm;
pub use oracle::TxSpec;
pub use oracle::Verdict;
pub use sim::evm::apply_simulation_overrides;
pub use sim::evm::divergence_probe;
pub use sim::evm::emit_access_list_from_state;
pub use sim::evm::AccessListCollector;
pub use sim::evm::BaseFeeSource;
pub use sim::evm::BlockEvm;
pub use sim::evm::BlockSimHandle;
pub use sim::evm::BotStateDb;
pub use sim::evm::CallFrame;
pub use sim::evm::CallTrace;
pub use sim::evm::CallTraceHandle;
pub use sim::evm::CallTraceInspector;
pub use sim::evm::CapturedSwap;
pub use sim::evm::CountingFrameDb;
pub use sim::evm::FrameOutcome;
pub use sim::evm::FrameRpcCounter;
pub use sim::evm::ProductionBlockDb;
pub use sim::evm::ReplayFrameError;
pub use sim::evm::ReplayOutcome;
pub use sim::evm::ReplayStatus;
pub use sim::evm::ReplayableTx;
pub use sim::evm::ScratchBlock;
pub use sim::evm::ScratchDb;
pub use sim::evm::ScratchEvm;
pub use sim::evm::SimInspector;
pub use sim::evm::SimulationOverrideParams;
pub use sim::evm::StorageMemo;
pub use sim::evm::SwapEventCaptureHandle;
pub use sim::evm::SwapEventCaptureInspector;
pub use sim::evm::SwapFamily;
pub use sim::evm::WarmCodeCache;
pub use sim::evm::WarmCodeCacheInner;
pub use sim::evm::WARM_CODE_CACHE_TTL_BLOCKS;

Modules§

harness
The executor grammar harness (UQOAHA): deploy the real cmd_executor + synthesized pools into a fresh revm CacheDB, run a path’s encode_cmd_stream payload through execute(), and report whether it executes + which pools it touched. The missing third correctness tool — byte parity can’t prove runtime behavior, and live sim needs a captured mainnet path. See harness for the API. Executor grammar harness (UQOAHA).
oracle
Contract-agnostic in-process revm fixture driver — deploy a pinned contract artifact, run staged calls, seed storage slots, drive a call, classify the verdict (Revert vs Halt), and read back output + logs. The shared spine of the tier-3 on-chain oracles and any per-contract (user) investigation harness. See oracle for the API. Contract-agnostic in-process revm fixture driver — deploy a pinned contract artifact, run staged calls, resolve addresses, seed storage slots, drive a call, and classify the verdict (Solidity Revert vs a verbless Halt), then read back output + logs.
sim
The in-process revm engine + its DB stack (the EVM handle, overrides, AL collector, warm cache). The settlement-arbitrage strategy relocated to degenbot-arbitrage (ADR-019 D4/D7, decision R). Simulation domain — the in-process revm engine.