Skip to main content

engine_model/
lib.rs

1use serde::{Deserialize, Serialize};
2
3/// Core execution event emitted by the Stylus debug engine.
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct ExecutionEvent {
6    pub step: u64,
7    pub opcode: String,
8    /// Gas consumed by this individual operation.
9    pub gas_used: u64,
10    pub stack: Vec<Value>,
11    pub memory: MemorySnapshot,
12    pub storage_diff: Vec<StorageChange>,
13    pub source_line: Option<String>,
14}
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
17pub struct Value {
18    pub hex: String,
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct MemorySnapshot {
23    pub bytes: Vec<u8>,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
27pub struct StorageChange {
28    pub key: String,
29    pub old: Option<String>,
30    pub new: Option<String>,
31}
32
33/// High‑level debug session configuration.
34#[derive(Debug, Clone, Serialize, Deserialize)]
35pub struct DebugConfig {
36    pub contract_path: String,
37    pub entrypoint: String,
38    /// Optional breakpoints expressed as "file:line" or symbolic form.
39    pub breakpoints: Vec<String>,
40}