Expand description
EDB Engine - Advanced Ethereum smart contract debugging and analysis engine.
This crate provides the core debugging engine for EDB (Ethereum Debugger), enabling detailed analysis and debugging of smart contract execution at both opcode and source levels. The engine supports real-time expression evaluation, comprehensive snapshot management, and advanced debugging features for Ethereum smart contracts.
ยงKey Features
ยง๐ Multi-Level Debugging
- Opcode-level debugging: Step through EVM bytecode execution
- Source-level debugging: Debug using original Solidity source code
- Hybrid debugging: Switch seamlessly between opcode and source views
ยง๐ธ Snapshot System
- Capture execution state at any point during contract execution
- Navigate forward/backward through execution history
- Support for both hook-based and opcode-based snapshots
ยงโก Real-time Expression Evaluation
- Evaluate Solidity-like expressions against any execution snapshot
- Access variables, function calls, storage, and blockchain context
- Support for complex expressions with type casting and operations
ยง๐ JSON-RPC API
- Complete debugging API for frontend integration
- WebSocket and HTTP support for real-time debugging
- Comprehensive error handling and protocol compliance
ยง๐ Advanced Analysis
- Contract instrumentation for debugging hooks
- Source code analysis and mapping
- ABI resolution and type inference
- Storage layout analysis
ยงCore Modules
analysis- Source code analysis and contract instrumentationcore- Core engine types and execution managementcontext- Engine context and state managementeval- Expression evaluation systeminspector- EVM execution inspectors for data collectioninstrumentation- Contract instrumentation and code generationrpc- JSON-RPC debugging APIsnapshot- Snapshot management and analysistweak- Runtime contract modification for debuggingutils- Utility functions and helpers
ยงQuick Start
โ
use edb_engine::{EngineContext, DebugRpcServer};
use revm::primitives::Address;
// Create engine context with debugging data
let context = EngineContext::new(db, snapshots, trace, artifacts);
// Start RPC server for debugging API
let server = DebugRpcServer::new(context);
let handle = server.start().await?;
println!("Debug server running on port {}", handle.port());ยงArchitecture
The EDB engine follows a modular architecture:
- Data Collection: Inspectors collect execution data during EVM execution
- Snapshot Management: Captured data is organized into navigable snapshots
- Expression Evaluation: Real-time evaluation against snapshot data
- API Layer: JSON-RPC interface exposes all debugging functionality
- Analysis: Deep contract analysis for enhanced debugging experience
Re-exportsยง
pub use core::*;pub use context::*;pub use eval::*;pub use inspector::*;pub use instrumentation::*;pub use rpc::*;pub use snapshot::*;pub use tweak::*;pub use utils::*;
Modulesยง
- analysis
- Source code analysis and contract instrumentation (internal module).
- context
- Engine context management and EVM instantiation for debugging.
- core
- Core engine functionality for transaction analysis and debugging.
- eval
- Expression evaluation system for EDB.
- inspector
- EVM execution inspectors for debugging and analysis.
- instrumentation
- Contract instrumentation and code generation (internal module).
- rpc
- JSON-RPC server for EDB debugging control and inspection.
- snapshot
- Unified snapshot management for time travel debugging
- tweak
- Contract bytecode modification for debugging through creation transaction replay.
- utils
- Utility functions and helpers for the EDB engine.
Macrosยง
- etherscan_
rate_ limit_ guard - Automaticall pause the request if the rate limit is reached and resume it after the rate limit is reset.