diff --git a/crates/firehose-protos/src/ethereum_v2.rs b/crates/firehose-protos/src/ethereum_v2/eth_block.rs similarity index 88% rename from crates/firehose-protos/src/ethereum_v2.rs rename to crates/firehose-protos/src/ethereum_v2/eth_block.rs index e183442c..8784c1ef 100644 --- a/crates/firehose-protos/src/ethereum_v2.rs +++ b/crates/firehose-protos/src/ethereum_v2/eth_block.rs @@ -1,20 +1,14 @@ -//! Firehose Ethereum-related data structures and operations. -//! See the protobuffer definitions section of the README for more information. -//! +use super::Block; use alloy_primitives::{Address, Bloom, FixedBytes, Uint}; use ethportal_api::types::execution::header::Header; use prost::Message; use prost_wkt_types::Any; -use reth_primitives::TxType; -use transaction_trace::Type; use crate::{ error::ProtosError, firehose::v2::{Response, SingleBlockResponse}, }; -tonic::include_proto!("sf.ethereum.r#type.v2"); - impl TryFrom<&Block> for Header { type Error = ProtosError; @@ -94,28 +88,6 @@ impl TryFrom<&Block> for Header { } } -impl From for TxType { - fn from(tx_type: Type) -> Self { - use TxType::*; - use Type::*; - - match tx_type { - TrxTypeLegacy => Legacy, - TrxTypeAccessList => Eip2930, - TrxTypeDynamicFee => Eip1559, - TrxTypeBlob => Eip4844, - TrxTypeArbitrumDeposit => unimplemented!(), - TrxTypeArbitrumUnsigned => unimplemented!(), - TrxTypeArbitrumContract => unimplemented!(), - TrxTypeArbitrumRetry => unimplemented!(), - TrxTypeArbitrumSubmitRetryable => unimplemented!(), - TrxTypeArbitrumInternal => unimplemented!(), - TrxTypeArbitrumLegacy => unimplemented!(), - TrxTypeOptimismDeposit => unimplemented!(), - } - } -} - fn decode_block(response: M) -> Result where M: MessageWithBlock, @@ -159,6 +131,10 @@ impl TryFrom for Block { #[cfg(test)] mod tests { + use ethportal_api::Header; + + use crate::ethereum_v2::BlockHeader; + use super::*; #[test] diff --git a/crates/firehose-protos/src/ethereum_v2/mod.rs b/crates/firehose-protos/src/ethereum_v2/mod.rs new file mode 100644 index 00000000..8e40ba30 --- /dev/null +++ b/crates/firehose-protos/src/ethereum_v2/mod.rs @@ -0,0 +1,8 @@ +//! Firehose Ethereum-related data structures and operations. +//! See the protobuffer definitions section of the README for more information. +//! + +pub mod eth_block; +pub mod transaction; + +tonic::include_proto!("sf.ethereum.r#type.v2"); diff --git a/crates/firehose-protos/src/ethereum_v2/transaction.rs b/crates/firehose-protos/src/ethereum_v2/transaction.rs new file mode 100644 index 00000000..1454d6d3 --- /dev/null +++ b/crates/firehose-protos/src/ethereum_v2/transaction.rs @@ -0,0 +1,25 @@ +use reth_primitives::TxType; + +use super::transaction_trace::Type; + +impl From for TxType { + fn from(tx_type: Type) -> Self { + use TxType::*; + use Type::*; + + match tx_type { + TrxTypeLegacy => Legacy, + TrxTypeAccessList => Eip2930, + TrxTypeDynamicFee => Eip1559, + TrxTypeBlob => Eip4844, + TrxTypeArbitrumDeposit => unimplemented!(), + TrxTypeArbitrumUnsigned => unimplemented!(), + TrxTypeArbitrumContract => unimplemented!(), + TrxTypeArbitrumRetry => unimplemented!(), + TrxTypeArbitrumSubmitRetryable => unimplemented!(), + TrxTypeArbitrumInternal => unimplemented!(), + TrxTypeArbitrumLegacy => unimplemented!(), + TrxTypeOptimismDeposit => unimplemented!(), + } + } +}