Module context

Module context 

Source
Expand description

Engine context management and EVM instantiation for debugging.

This module provides the core EngineContext struct that consolidates all debugging data and state needed for time travel debugging and expression evaluation. The context serves as the primary data structure passed to the JSON-RPC server and contains all analysis results, snapshots, artifacts, and execution state.

§Core Components

§EngineContext

The EngineContext is the central data structure that encapsulates:

  • Fork Information: Network and block context for the debugging session
  • EVM Environment: Configuration, block, and transaction environments
  • Snapshots: Merged opcode-level and hook-based execution snapshots
  • Artifacts: Original and recompiled contract artifacts with source code
  • Analysis Results: Instrumentation points and debugging metadata
  • Execution Trace: Call hierarchy and frame structure

§EVM Instantiation

The context provides methods to create derived EVMs for expression evaluation:

  • Snapshot-specific EVMs: Create EVM instances at any execution point
  • Transaction replay: Send mock transactions in derived state
  • Function calls: Invoke contract functions for expression evaluation

§Workflow Integration

  1. Context Building: Constructed after analysis and snapshot collection
  2. Finalization: Processes traces and pre-evaluates state variables
  3. Server Integration: Passed to JSON-RPC server for debugging API
  4. Expression Evaluation: Used to create derived EVMs for real-time evaluation

§Thread Safety

The EngineContext is designed to be thread-safe and can be shared across multiple debugging clients through Arc wrapping. All database operations use read-only snapshots to ensure debugging session integrity.

Structs§

EngineContext
Complete debugging context containing all analysis results and state snapshots