diff --git a/Cargo.toml b/Cargo.toml index efb2096..a3bac53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,10 +30,10 @@ clippy.lint_groups_priority = "allow" [dependencies] # eth -alloy-sol-types = "0.7" -alloy-primitives = "0.7" -alloy-rpc-types = { version = "0.2", features = ["eth", "trace"] } -revm = { version = "13", default-features = false, features = ["std"] } +alloy-sol-types = "0.8" +alloy-primitives = "0.8" +alloy-rpc-types = { version = "0.3", features = ["eth", "trace"] } +revm = { version = "14", default-features = false, features = ["std"] } anstyle = "1.0" colorchoice = "1.0" diff --git a/src/tracing/builder/parity.rs b/src/tracing/builder/parity.rs index 0e0726b..de584ba 100644 --- a/src/tracing/builder/parity.rs +++ b/src/tracing/builder/parity.rs @@ -464,6 +464,8 @@ where Ok(()) } +/// Populates [StateDiff] given iterator over [Account]s and a [DatabaseRef]. +/// /// Loops over all state accounts in the accounts diff that contains all accounts that are included /// in the [ExecutionResult] state map and compares the balance and nonce against what's in the /// `db`, which should point to the beginning of the transaction. diff --git a/src/tracing/mod.rs b/src/tracing/mod.rs index 657f8b4..ae04e3b 100644 --- a/src/tracing/mod.rs +++ b/src/tracing/mod.rs @@ -528,7 +528,7 @@ where if self.config.record_logs { let trace = self.last_trace(); trace.ordering.push(TraceMemberOrder::Log(trace.logs.len())); - trace.logs.push(CallLog::from(log.clone())); + trace.logs.push(CallLog::from(log.clone()).with_position(trace.children.len() as u64)); } } diff --git a/src/tracing/types.rs b/src/tracing/types.rs index 8262395..4f3fea0 100644 --- a/src/tracing/types.rs +++ b/src/tracing/types.rs @@ -164,12 +164,27 @@ pub struct CallLog { pub raw_log: LogData, /// Optional complementary decoded log data. pub decoded: DecodedCallLog, + /// The position of the log relative to subcalls within the same trace. + pub position: u64, } impl From for CallLog { /// Converts a [`Log`] into a [`CallLog`]. fn from(log: Log) -> Self { - Self { raw_log: log.data, decoded: DecodedCallLog { name: None, params: None } } + Self { + position: Default::default(), + raw_log: log.data, + decoded: DecodedCallLog { name: None, params: None }, + } + } +} + +impl CallLog { + /// Sets the position of the log. + #[inline] + pub fn with_position(mut self, position: u64) -> Self { + self.position = position; + self } } @@ -411,6 +426,7 @@ impl CallTraceNode { address: Some(self.execution_address()), topics: Some(log.raw_log.topics().to_vec()), data: Some(log.raw_log.data.clone()), + position: Some(log.position), }) .collect(); }