Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reuse alloy Log type #5548

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/revm/revm-inspectors/src/tracing/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::tracing::{
types::{CallKind, LogCallOrder, RawLog},
types::{CallKind, LogCallOrder},
utils::get_create_address,
};
use alloy_primitives::{Address, Bytes, B256, U256};
use alloy_primitives::{Address, Bytes, Log, B256, U256};
pub use arena::CallTraceArena;
use revm::{
inspectors::GasInspector,
Expand Down Expand Up @@ -408,7 +408,7 @@ where

if self.config.record_logs {
trace.ordering.push(LogCallOrder::Log(trace.logs.len()));
trace.logs.push(RawLog { topics: topics.to_vec(), data: data.clone() });
trace.logs.push(Log::new_unchecked(topics.to_vec(), data.clone()));
}
}

Expand Down
18 changes: 5 additions & 13 deletions crates/revm/revm-inspectors/src/tracing/types.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//! Types for representing call trace items.

use crate::tracing::{config::TraceStyle, utils::convert_memory};
use alloy_primitives::{Address, Bytes, B256, U256, U64};
pub use alloy_primitives::Log;
use alloy_primitives::{Address, Bytes, U256, U64};
use alloy_sol_types::decode_revert_reason;
use reth_rpc_types::trace::{
geth::{CallFrame, CallLogFrame, GethDefaultTracingOptions, StructLog},
Expand Down Expand Up @@ -128,8 +129,8 @@ pub struct CallTraceNode {
pub idx: usize,
/// The call trace
pub trace: CallTrace,
/// Logs
pub logs: Vec<RawLog>,
/// Recorded logs, if enabled
pub logs: Vec<Log>,
/// Ordering of child calls and logs
pub ordering: Vec<LogCallOrder>,
}
Expand Down Expand Up @@ -357,7 +358,7 @@ impl CallTraceNode {
.iter()
.map(|log| CallLogFrame {
address: Some(self.execution_address()),
topics: Some(log.topics.clone()),
topics: Some(log.topics().to_vec()),
data: Some(log.data.clone()),
})
.collect();
Expand Down Expand Up @@ -489,15 +490,6 @@ pub enum LogCallOrder {
Call(usize),
}

/// Ethereum log.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct RawLog {
/// Indexed event params are represented as log topics.
pub topics: Vec<B256>,
/// Others are just plain data.
pub data: Bytes,
}

/// Represents a tracked call step during execution
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CallTraceStep {
Expand Down