1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
//! Core traits for revm-trace functionality
//!
//! This module defines the fundamental traits that power the tracing system:
//! - Reset: For managing inspector state
//! - TraceOutput: For converting inspector state to output
//! - TraceInspector: Combined trait for full inspector functionality
/// Re-export core REVM traits for user convenience
///
/// These re-exports allow users to access essential REVM traits directly
/// through revm-trace, without having to:
/// - Add explicit revm dependency in their Cargo.toml
/// - Manage version compatibility between revm and revm-trace
/// - Import traits from multiple crates
///
/// # Example
/// ```
/// use revm_trace::{Inspector, Database};
///
/// struct MyInspector;
///
/// impl<DB: Database> Inspector<DB> for MyInspector {
/// // Implementation...
/// }
/// ```
///
/// Instead of:
/// ```ignore
/// // In Cargo.toml:
/// // revm = "x.y.z" // Need to ensure version compatibility
///
/// use revm::{Inspector, Database};
/// ```
pub use ;
use crate;
use crate EvmError;
/// Defines how an inspector can reset its internal state
///
/// This trait is crucial for inspectors that maintain state between transactions
/// and need to clear that state before processing a new transaction.
///
/// # Example
/// ```
/// use revm_trace::Reset;
///
/// struct MyInspector {
/// call_count: u32,
/// gas_used: u64,
/// }
///
/// impl Reset for MyInspector {
/// fn reset(&mut self) {
/// self.call_count = 0;
/// self.gas_used = 0;
/// }
/// }
/// ```
/// Defines how an inspector converts its state to a specific output type
///
/// This trait allows inspectors to provide their collected data in a
/// standardized format, making it easier to process and analyze results.
///
/// # Type Parameters
/// * `Output` - The type that this inspector produces as its final result
///
/// # Example
/// ```
/// use revm_trace::TraceOutput;
///
/// struct MyInspector {
/// gas_used: u64,
/// }
///
/// impl TraceOutput for MyInspector {
/// type Output = u64;
///
/// fn get_output(&self) -> Self::Output {
/// self.gas_used
/// }
/// }
/// ```
/// Combined trait for full inspector functionality
///
/// This trait combines the core REVM `Inspector` trait with our custom
/// `Reset` and `TraceOutput` traits to provide complete tracing capabilities.
///
/// # Type Parameters
/// * `DB` - The database type used by the inspector
///
/// # Requirements
/// Implementing types must satisfy:
/// - REVM's `Inspector<DB>` trait for basic inspection
/// - `Reset` for state management
/// - `TraceOutput` for result formatting
/// Blanket implementation for any type implementing required traits
///
/// This implementation automatically provides `TraceInspector` for any type
/// that implements all the required traits, reducing boilerplate code.
/// Defines standard transaction processing capabilities
///
/// This trait establishes a standardized flow for transaction processing:
/// 1. Transaction preparation and validation
/// 2. Execution in EVM
/// 3. Result collection and state management
///
/// Implementors must follow this standard flow to ensure consistent behavior
/// across different execution contexts.