Skip to content

Commit

Permalink
moving Log::from_primitive to rpc compat crate (#4968)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
  • Loading branch information
i-m-aditya and mattsse committed Nov 8, 2023
1 parent 7ab58e2 commit 0a6d447
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
2 changes: 2 additions & 0 deletions crates/rpc/rpc-types-compat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ pub mod transaction;
pub use transaction::*;
pub mod engine;
pub use engine::*;
pub mod log;
pub use log::*;
16 changes: 16 additions & 0 deletions crates/rpc/rpc-types-compat/src/log.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! Compatibility functions for rpc `Log` type.

/// Creates a new rpc Log from a primitive log type from DB
pub fn from_primitive_log(log: reth_primitives::Log) -> reth_rpc_types::Log {
reth_rpc_types::Log {
address: log.address,
topics: log.topics,
data: log.data,
block_hash: None,
block_number: None,
transaction_hash: None,
transaction_index: None,
log_index: None,
removed: false,
}
}
17 changes: 0 additions & 17 deletions crates/rpc/rpc-types/src/eth/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,6 @@ pub struct Log {
pub removed: bool,
}

impl Log {
/// Creates a new rpc Log from a primitive log type from DB
pub fn from_primitive(log: reth_primitives::Log) -> Self {
Self {
address: log.address,
topics: log.topics,
data: log.data,
block_hash: None,
block_number: None,
transaction_hash: None,
transaction_index: None,
log_index: None,
removed: false,
}
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down

0 comments on commit 0a6d447

Please sign in to comment.