Skip to content

Commit 87ac959

Browse files
committed
feat: add impl for 4 byte
1 parent d12592d commit 87ac959

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ alloy = { version = "1.0.25", default-features = false, features = [
4545
] }
4646

4747
revm = { version = "27.1", default-features = false }
48+
revm-inspectors = { version = "0.27.1", optional = true }
4849

4950
dashmap = { version = "6.1.0", optional = true }
5051
tracing = { version = "0.1.41", optional = true }
@@ -69,6 +70,7 @@ default = [
6970
"call",
7071
"concurrent-db",
7172
"estimate_gas",
73+
"tracing-inspectors",
7274
"revm/std",
7375
"revm/c-kzg",
7476
"revm/blst",
@@ -111,3 +113,4 @@ full_env_cfg = [
111113
"optional_eip3607",
112114
"optional_no_base_fee",
113115
]
116+
tracing-inspectors = ["dep:revm-inspectors", "alloy/rpc-types-trace"]

src/inspectors/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ pub use layer::Layered;
44
mod timeout;
55
pub use timeout::TimeLimit;
66

7+
#[cfg(feature = "tracing-inspectors")]
8+
mod tracing;
9+
710
mod set;
811
pub use set::InspectorSet;
912

src/inspectors/tracing.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
use crate::{helpers::Ctx, inspectors::InspectorWithOutput};
2+
use alloy::rpc::types::trace::geth::FourByteFrame;
3+
use revm::Database;
4+
use revm_inspectors::tracing::FourByteInspector;
5+
6+
impl<Db: Database> InspectorWithOutput<Ctx<Db>> for FourByteInspector {
7+
type Output = FourByteFrame;
8+
9+
fn has_output(&self) -> bool {
10+
self.inner().len() > 0
11+
}
12+
13+
fn reset_output(&mut self) {
14+
*self = Self::default();
15+
}
16+
17+
fn take_output(&mut self) -> Self::Output {
18+
std::mem::take(self).into()
19+
}
20+
}

0 commit comments

Comments
 (0)