diff --git a/crates/node/builder/src/launch/common.rs b/crates/node/builder/src/launch/common.rs index 83ba10e213044..ac2339fa6cfc0 100644 --- a/crates/node/builder/src/launch/common.rs +++ b/crates/node/builder/src/launch/common.rs @@ -939,7 +939,6 @@ where EthApiClient::< alloy_rpc_types::Transaction, alloy_rpc_types::Block, - alloy_rpc_types::Header, alloy_rpc_types::Receipt, >::chain_id(&client) .await diff --git a/crates/rpc/rpc-builder/src/lib.rs b/crates/rpc/rpc-builder/src/lib.rs index 6ee3f9fd0c85e..385b92af3d0b0 100644 --- a/crates/rpc/rpc-builder/src/lib.rs +++ b/crates/rpc/rpc-builder/src/lib.rs @@ -194,7 +194,6 @@ use reth_rpc::{ use reth_rpc_api::servers::*; use reth_rpc_eth_api::{ helpers::{Call, EthApiSpec, EthTransactions, LoadPendingBlock, TraceExt}, - types::RpcHeader, EthApiServer, EthApiTypes, FullEthApiServer, RpcBlock, RpcReceipt, RpcTransaction, }; use reth_rpc_eth_types::{EthConfig, EthStateCache, EthSubscriptionIdProvider}; @@ -1073,7 +1072,6 @@ where EthApi: EthApiServer< RpcTransaction, RpcBlock, - RpcHeader, RpcReceipt, > + EthApiTypes, BlockExecutor: BlockExecutorProvider, diff --git a/crates/rpc/rpc-builder/tests/it/http.rs b/crates/rpc/rpc-builder/tests/it/http.rs index a5e2e61f236ee..89aafce9f36fb 100644 --- a/crates/rpc/rpc-builder/tests/it/http.rs +++ b/crates/rpc/rpc-builder/tests/it/http.rs @@ -173,24 +173,16 @@ where .unwrap(); // Implemented - EthApiClient::::protocol_version(client).await.unwrap(); - EthApiClient::::chain_id(client).await.unwrap(); - EthApiClient::::accounts(client).await.unwrap(); - EthApiClient::::get_account( - client, - address, - block_number.into(), - ) - .await - .unwrap(); - EthApiClient::::block_number(client).await.unwrap(); - EthApiClient::::get_code(client, address, None) - .await - .unwrap(); - EthApiClient::::send_raw_transaction(client, tx) + EthApiClient::::protocol_version(client).await.unwrap(); + EthApiClient::::chain_id(client).await.unwrap(); + EthApiClient::::accounts(client).await.unwrap(); + EthApiClient::::get_account(client, address, block_number.into()) .await .unwrap(); - EthApiClient::::fee_history( + EthApiClient::::block_number(client).await.unwrap(); + EthApiClient::::get_code(client, address, None).await.unwrap(); + EthApiClient::::send_raw_transaction(client, tx).await.unwrap(); + EthApiClient::::fee_history( client, U64::from(0), block_number, @@ -198,13 +190,11 @@ where ) .await .unwrap(); - EthApiClient::::balance(client, address, None) - .await - .unwrap(); - EthApiClient::::transaction_count(client, address, None) + EthApiClient::::balance(client, address, None).await.unwrap(); + EthApiClient::::transaction_count(client, address, None) .await .unwrap(); - EthApiClient::::storage_at( + EthApiClient::::storage_at( client, address, U256::default().into(), @@ -212,79 +202,64 @@ where ) .await .unwrap(); - EthApiClient::::block_by_hash(client, hash, false) + EthApiClient::::block_by_hash(client, hash, false).await.unwrap(); + EthApiClient::::block_by_number(client, block_number, false) .await .unwrap(); - EthApiClient::::block_by_number( + EthApiClient::::block_transaction_count_by_number( client, block_number, - false, ) .await .unwrap(); - EthApiClient::::block_transaction_count_by_number( - client, - block_number, - ) - .await - .unwrap(); - EthApiClient::::block_transaction_count_by_hash( - client, hash, - ) - .await - .unwrap(); - EthApiClient::::block_uncles_count_by_hash(client, hash) + EthApiClient::::block_transaction_count_by_hash(client, hash) .await .unwrap(); - EthApiClient::::block_uncles_count_by_number( - client, - block_number, - ) - .await - .unwrap(); - EthApiClient::::uncle_by_block_hash_and_index( - client, hash, index, - ) - .await - .unwrap(); - EthApiClient::::uncle_by_block_number_and_index( + EthApiClient::::block_uncles_count_by_hash(client, hash) + .await + .unwrap(); + EthApiClient::::block_uncles_count_by_number(client, block_number) + .await + .unwrap(); + EthApiClient::::uncle_by_block_hash_and_index(client, hash, index) + .await + .unwrap(); + EthApiClient::::uncle_by_block_number_and_index( client, block_number, index, ) .await .unwrap(); - EthApiClient::::sign(client, address, bytes.clone()) + EthApiClient::::sign(client, address, bytes.clone()) .await .unwrap_err(); - EthApiClient::::sign_typed_data( - client, address, typed_data, - ) - .await - .unwrap_err(); - EthApiClient::::transaction_by_hash(client, tx_hash) + EthApiClient::::sign_typed_data(client, address, typed_data) + .await + .unwrap_err(); + EthApiClient::::transaction_by_hash(client, tx_hash) .await .unwrap(); - EthApiClient::::transaction_by_block_hash_and_index( + EthApiClient::::transaction_by_block_hash_and_index( client, hash, index, ) .await .unwrap(); - EthApiClient::::transaction_by_block_number_and_index( + EthApiClient::::transaction_by_block_number_and_index( client, block_number, index, ) .await .unwrap(); - EthApiClient::::create_access_list( + EthApiClient::::create_access_list( client, call_request.clone(), Some(block_number.into()), ) .await .unwrap(); - EthApiClient::::estimate_gas( + EthApiClient::::estimate_gas( client, call_request.clone(), Some(block_number.into()), @@ -292,7 +267,7 @@ where ) .await .unwrap(); - EthApiClient::::call( + EthApiClient::::call( client, call_request.clone(), Some(block_number.into()), @@ -301,41 +276,38 @@ where ) .await .unwrap(); - EthApiClient::::syncing(client).await.unwrap(); - EthApiClient::::send_transaction( - client, - transaction_request, - ) - .await - .unwrap_err(); - EthApiClient::::hashrate(client).await.unwrap(); - EthApiClient::::submit_hashrate( + EthApiClient::::syncing(client).await.unwrap(); + EthApiClient::::send_transaction(client, transaction_request) + .await + .unwrap_err(); + EthApiClient::::hashrate(client).await.unwrap(); + EthApiClient::::submit_hashrate( client, U256::default(), B256::default(), ) .await .unwrap(); - EthApiClient::::gas_price(client).await.unwrap_err(); - EthApiClient::::max_priority_fee_per_gas(client) + EthApiClient::::gas_price(client).await.unwrap_err(); + EthApiClient::::max_priority_fee_per_gas(client) .await .unwrap_err(); - EthApiClient::::get_proof(client, address, vec![], None) + EthApiClient::::get_proof(client, address, vec![], None) .await .unwrap(); // Unimplemented assert!(is_unimplemented( - EthApiClient::::author(client).await.err().unwrap() + EthApiClient::::author(client).await.err().unwrap() )); assert!(is_unimplemented( - EthApiClient::::is_mining(client).await.err().unwrap() + EthApiClient::::is_mining(client).await.err().unwrap() )); assert!(is_unimplemented( - EthApiClient::::get_work(client).await.err().unwrap() + EthApiClient::::get_work(client).await.err().unwrap() )); assert!(is_unimplemented( - EthApiClient::::submit_work( + EthApiClient::::submit_work( client, B64::default(), B256::default(), @@ -346,13 +318,10 @@ where .unwrap() )); assert!(is_unimplemented( - EthApiClient::::sign_transaction( - client, - call_request.clone() - ) - .await - .err() - .unwrap() + EthApiClient::::sign_transaction(client, call_request.clone()) + .await + .err() + .unwrap() )); } diff --git a/crates/rpc/rpc-builder/tests/it/middleware.rs b/crates/rpc/rpc-builder/tests/it/middleware.rs index 780daf4de1706..0e2186e56eeb6 100644 --- a/crates/rpc/rpc-builder/tests/it/middleware.rs +++ b/crates/rpc/rpc-builder/tests/it/middleware.rs @@ -1,5 +1,5 @@ use crate::utils::{test_address, test_rpc_builder}; -use alloy_rpc_types_eth::{Block, Header, Receipt, Transaction}; +use alloy_rpc_types_eth::{Block, Receipt, Transaction}; use jsonrpsee::{ server::{middleware::rpc::RpcServiceT, RpcServiceBuilder}, types::Request, @@ -75,7 +75,7 @@ async fn test_rpc_middleware() { .unwrap(); let client = handle.http_client().unwrap(); - EthApiClient::::protocol_version(&client).await.unwrap(); + EthApiClient::::protocol_version(&client).await.unwrap(); let count = mylayer.count.load(Ordering::Relaxed); assert_eq!(count, 1); } diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 38d9b3ae97eef..66bc5a44d2db9 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -8,8 +8,8 @@ use alloy_rpc_types::{ serde_helpers::JsonStorageKey, simulate::{SimulatePayload, SimulatedBlock}, state::{EvmOverrides, StateOverride}, - BlockOverrides, Bundle, EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Index, - StateContext, SyncStatus, Work, + BlockOverrides, Bundle, EIP1186AccountProofResponse, EthCallResponse, FeeHistory, Header, + Index, StateContext, SyncStatus, Work, }; use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee::{core::RpcResult, proc_macros::rpc}; @@ -19,7 +19,6 @@ use tracing::trace; use crate::{ helpers::{EthApiSpec, EthBlocks, EthCall, EthFees, EthState, EthTransactions, FullEthApi}, - types::RpcHeader, RpcBlock, RpcReceipt, RpcTransaction, }; @@ -29,7 +28,6 @@ pub trait FullEthApiServer: EthApiServer< RpcTransaction, RpcBlock, - RpcHeader, RpcReceipt, > + FullEthApi + Clone @@ -40,7 +38,6 @@ impl FullEthApiServer for T where T: EthApiServer< RpcTransaction, RpcBlock, - RpcHeader, RpcReceipt, > + FullEthApi + Clone @@ -50,7 +47,7 @@ impl FullEthApiServer for T where /// Eth rpc interface: #[cfg_attr(not(feature = "client"), rpc(server, namespace = "eth"))] #[cfg_attr(feature = "client", rpc(server, client, namespace = "eth"))] -pub trait EthApi { +pub trait EthApi { /// Returns the protocol version encoded as a string. #[method(name = "protocolVersion")] async fn protocol_version(&self) -> RpcResult; @@ -204,11 +201,11 @@ pub trait EthApi { /// Returns the block's header at given number. #[method(name = "getHeaderByNumber")] - async fn header_by_number(&self, hash: BlockNumberOrTag) -> RpcResult>; + async fn header_by_number(&self, hash: BlockNumberOrTag) -> RpcResult>; /// Returns the block's header at given hash. #[method(name = "getHeaderByHash")] - async fn header_by_hash(&self, hash: B256) -> RpcResult>; + async fn header_by_hash(&self, hash: B256) -> RpcResult>; /// `eth_simulateV1` executes an arbitrary number of transactions on top of the requested state. /// The transactions are packed into individual blocks. Overrides can be provided. @@ -369,7 +366,6 @@ impl EthApiServer< RpcTransaction, RpcBlock, - RpcHeader, RpcReceipt, > for T where @@ -611,16 +607,13 @@ where } /// Handler for: `eth_getHeaderByNumber` - async fn header_by_number( - &self, - block_number: BlockNumberOrTag, - ) -> RpcResult>> { + async fn header_by_number(&self, block_number: BlockNumberOrTag) -> RpcResult> { trace!(target: "rpc::eth", ?block_number, "Serving eth_getHeaderByNumber"); Ok(EthBlocks::rpc_block_header(self, block_number.into()).await?) } /// Handler for: `eth_getHeaderByHash` - async fn header_by_hash(&self, hash: B256) -> RpcResult>> { + async fn header_by_hash(&self, hash: B256) -> RpcResult> { trace!(target: "rpc::eth", ?hash, "Serving eth_getHeaderByHash"); Ok(EthBlocks::rpc_block_header(self, hash.into()).await?) } diff --git a/crates/rpc/rpc-eth-api/src/helpers/block.rs b/crates/rpc/rpc-eth-api/src/helpers/block.rs index 3cf46b7fea7cf..090f2ab0d562c 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/block.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/block.rs @@ -8,9 +8,7 @@ use reth_primitives::{BlockId, Receipt, SealedBlock, SealedBlockWithSenders}; use reth_provider::{BlockIdReader, BlockReader, BlockReaderIdExt, HeaderProvider}; use reth_rpc_types_compat::block::from_block; -use crate::{ - node::RpcNodeCoreExt, types::RpcHeader, FromEthApiError, FullEthApiTypes, RpcBlock, RpcReceipt, -}; +use crate::{node::RpcNodeCoreExt, FromEthApiError, FullEthApiTypes, RpcBlock, RpcReceipt}; use super::{LoadPendingBlock, LoadReceipt, SpawnBlocking}; @@ -26,7 +24,7 @@ pub trait EthBlocks: LoadBlock { fn rpc_block_header( &self, block_id: BlockId, - ) -> impl Future>, Self::Error>> + Send + ) -> impl Future, Self::Error>> + Send where Self: FullEthApiTypes, { @@ -194,7 +192,7 @@ pub trait EthBlocks: LoadBlock { let block = Block::uncle_from_header(uncle); Block { header: Header { - inner: block.header.inner.into(), + inner: block.header.inner, size: block.header.size, total_difficulty: block.header.total_difficulty, hash: block.header.hash, diff --git a/crates/rpc/rpc-eth-api/src/types.rs b/crates/rpc/rpc-eth-api/src/types.rs index a8dbb1eaab4a4..620f4523d21a9 100644 --- a/crates/rpc/rpc-eth-api/src/types.rs +++ b/crates/rpc/rpc-eth-api/src/types.rs @@ -2,12 +2,11 @@ use std::{ error::Error, - fmt::{self, Debug}, + fmt::{self}, }; use alloy_network::Network; use alloy_rpc_types::Block; -use jsonrpsee::core::{DeserializeOwned, Serialize}; use reth_rpc_types_compat::TransactionCompat; use crate::{AsEthApiError, FromEthApiError, FromEvmError}; @@ -23,18 +22,7 @@ pub trait EthApiTypes: Send + Sync + Clone { + Send + Sync; /// Blockchain primitive types, specific to network, e.g. block and transaction. - type NetworkTypes: Network< - Header: Send - + Sync - + Clone - + Debug - + Unpin - + From - + Serialize - + DeserializeOwned - + 'static, - HeaderResponse = alloy_rpc_types::Header<::Header>, - >; + type NetworkTypes: Network; /// Conversion methods for transaction RPC type. type TransactionCompat: Send + Sync + Clone + fmt::Debug; @@ -45,11 +33,8 @@ pub trait EthApiTypes: Send + Sync + Clone { /// Adapter for network specific transaction type. pub type RpcTransaction = ::TransactionResponse; -/// Adapter for network specific header type. -pub type RpcHeader = ::HeaderResponse; - /// Adapter for network specific block type. -pub type RpcBlock = Block, RpcHeader>; +pub type RpcBlock = Block, ::HeaderResponse>; /// Adapter for network specific receipt type. pub type RpcReceipt = ::ReceiptResponse; diff --git a/crates/rpc/rpc-eth-types/src/simulate.rs b/crates/rpc/rpc-eth-types/src/simulate.rs index 95cce2af7461e..95111931619d9 100644 --- a/crates/rpc/rpc-eth-types/src/simulate.rs +++ b/crates/rpc/rpc-eth-types/src/simulate.rs @@ -1,9 +1,9 @@ //! Utilities for serving `eth_simulateV1` -use alloy_consensus::{BlockHeader, Transaction as _, TxEip4844Variant, TxType, TypedTransaction}; +use alloy_consensus::{Transaction as _, TxEip4844Variant, TxType, TypedTransaction}; use alloy_rpc_types::{ simulate::{SimCallResult, SimulateError, SimulatedBlock}, - Block, BlockTransactionsKind, Header, + Block, BlockTransactionsKind, }; use alloy_rpc_types_eth::transaction::TransactionRequest; use jsonrpsee_types::ErrorObject; @@ -170,7 +170,7 @@ where /// Handles outputs of the calls execution and builds a [`SimulatedBlock`]. #[expect(clippy::complexity)] -pub fn build_block>( +pub fn build_block( results: Vec<(Address, ExecutionResult)>, transactions: Vec, block_env: &BlockEnv, @@ -179,7 +179,7 @@ pub fn build_block>>, tx_resp_builder: &T, -) -> Result>>, EthApiError> { +) -> Result>, EthApiError> { let mut calls: Vec = Vec::with_capacity(results.len()); let mut senders = Vec::with_capacity(results.len()); let mut receipts = Vec::with_capacity(results.len()); @@ -305,6 +305,6 @@ pub fn build_block(block, total_difficulty, txs_kind, None, tx_resp_builder)?; + let block = from_block::(block, total_difficulty, txs_kind, None, tx_resp_builder)?; Ok(SimulatedBlock { inner: block, calls }) } diff --git a/crates/rpc/rpc-testing-util/src/debug.rs b/crates/rpc/rpc-testing-util/src/debug.rs index e1574552699db..97fe008fa97c1 100644 --- a/crates/rpc/rpc-testing-util/src/debug.rs +++ b/crates/rpc/rpc-testing-util/src/debug.rs @@ -7,7 +7,7 @@ use std::{ }; use alloy_primitives::{TxHash, B256}; -use alloy_rpc_types::{Block, Header, Transaction}; +use alloy_rpc_types::{Block, Transaction}; use alloy_rpc_types_eth::transaction::TransactionRequest; use alloy_rpc_types_trace::{ common::TraceResult, @@ -77,7 +77,7 @@ pub trait DebugApiExt { impl DebugApiExt for T where - T: EthApiClient + DebugApiClient + Sync, + T: EthApiClient + DebugApiClient + Sync, { type Provider = T; diff --git a/crates/rpc/rpc-testing-util/tests/it/trace.rs b/crates/rpc/rpc-testing-util/tests/it/trace.rs index 6077d773839ee..b0fccefbb464c 100644 --- a/crates/rpc/rpc-testing-util/tests/it/trace.rs +++ b/crates/rpc/rpc-testing-util/tests/it/trace.rs @@ -1,7 +1,7 @@ //! Integration tests for the trace API. use alloy_primitives::map::HashSet; -use alloy_rpc_types::{Block, Header, Transaction}; +use alloy_rpc_types::{Block, Transaction}; use alloy_rpc_types_trace::{ filter::TraceFilter, parity::TraceType, tracerequest::TraceCallRequest, }; @@ -113,7 +113,7 @@ async fn debug_trace_block_entire_chain() { let client = HttpClientBuilder::default().build(url).unwrap(); let current_block: u64 = - >::block_number(&client) + >::block_number(&client) .await .unwrap() .try_into() diff --git a/crates/rpc/rpc-types-compat/src/block.rs b/crates/rpc/rpc-types-compat/src/block.rs index 17133ada9c534..c56c51f5ad2c1 100644 --- a/crates/rpc/rpc-types-compat/src/block.rs +++ b/crates/rpc/rpc-types-compat/src/block.rs @@ -1,6 +1,6 @@ //! Compatibility functions for rpc `Block` type. -use alloy_consensus::{BlockHeader, Sealed}; +use alloy_consensus::Sealed; use alloy_primitives::{B256, U256}; use alloy_rlp::Encodable; use alloy_rpc_types::{ @@ -14,19 +14,19 @@ use crate::{transaction::from_recovered_with_block_context, TransactionCompat}; /// [`BlockTransactionsKind`] /// /// If a `block_hash` is provided, then this is used, otherwise the block hash is computed. -pub fn from_block>( +pub fn from_block( block: BlockWithSenders, total_difficulty: U256, kind: BlockTransactionsKind, block_hash: Option, tx_resp_builder: &T, -) -> Result>, BlockError> { +) -> Result, BlockError> { match kind { BlockTransactionsKind::Hashes => { - Ok(from_block_with_tx_hashes::(block, total_difficulty, block_hash)) + Ok(from_block_with_tx_hashes::(block, total_difficulty, block_hash)) } BlockTransactionsKind::Full => { - from_block_full::(block, total_difficulty, block_hash, tx_resp_builder) + from_block_full::(block, total_difficulty, block_hash, tx_resp_builder) } } } @@ -36,11 +36,11 @@ pub fn from_block>( +pub fn from_block_with_tx_hashes( block: BlockWithSenders, total_difficulty: U256, block_hash: Option, -) -> Block> { +) -> Block { let block_hash = block_hash.unwrap_or_else(|| block.header.hash_slow()); let transactions = block.body.transactions().map(|tx| tx.hash()).collect(); @@ -58,12 +58,12 @@ pub fn from_block_with_tx_hashes>( +pub fn from_block_full( mut block: BlockWithSenders, total_difficulty: U256, block_hash: Option, tx_resp_builder: &T, -) -> Result>, BlockError> { +) -> Result, BlockError> { let block_hash = block_hash.unwrap_or_else(|| block.block.header.hash_slow()); let block_number = block.block.number; let base_fee_per_gas = block.block.base_fee_per_gas; @@ -111,13 +111,13 @@ pub fn from_primitive_with_hash(primitive_header: reth_primitives::SealedHeader) } #[inline] -fn from_block_with_transactions>( +fn from_block_with_transactions( block_length: usize, block_hash: B256, block: PrimitiveBlock, total_difficulty: U256, transactions: BlockTransactions, -) -> Block> { +) -> Block { let withdrawals = block .header .withdrawals_root @@ -127,7 +127,7 @@ fn from_block_with_transactions, RpcBlock, - RpcHeader, RpcReceipt, > + FullEthApiTypes, EthFilter: EthFilterApiServer>, diff --git a/crates/rpc/rpc/src/eth/core.rs b/crates/rpc/rpc/src/eth/core.rs index 9ad655bf68516..98ac9e9f4094f 100644 --- a/crates/rpc/rpc/src/eth/core.rs +++ b/crates/rpc/rpc/src/eth/core.rs @@ -549,7 +549,7 @@ mod tests { /// Invalid block range #[tokio::test] async fn test_fee_history_empty() { - let response = as EthApiServer<_, _, _, _>>::fee_history( + let response = as EthApiServer<_, _, _>>::fee_history( &build_test_eth_api(NoopProvider::default()), U64::from(1), BlockNumberOrTag::Latest, @@ -571,7 +571,7 @@ mod tests { let (eth_api, _, _) = prepare_eth_api(newest_block, oldest_block, block_count, MockEthProvider::default()); - let response = as EthApiServer<_, _, _, _>>::fee_history( + let response = as EthApiServer<_, _, _>>::fee_history( ð_api, U64::from(newest_block + 1), newest_block.into(), @@ -594,7 +594,7 @@ mod tests { let (eth_api, _, _) = prepare_eth_api(newest_block, oldest_block, block_count, MockEthProvider::default()); - let response = as EthApiServer<_, _, _, _>>::fee_history( + let response = as EthApiServer<_, _, _>>::fee_history( ð_api, U64::from(1), (newest_block + 1000).into(), @@ -617,7 +617,7 @@ mod tests { let (eth_api, _, _) = prepare_eth_api(newest_block, oldest_block, block_count, MockEthProvider::default()); - let response = as EthApiServer<_, _, _, _>>::fee_history( + let response = as EthApiServer<_, _, _>>::fee_history( ð_api, U64::from(0), newest_block.into(), diff --git a/crates/rpc/rpc/src/otterscan.rs b/crates/rpc/rpc/src/otterscan.rs index 8806ab803bfe0..7a7ac8923bdb9 100644 --- a/crates/rpc/rpc/src/otterscan.rs +++ b/crates/rpc/rpc/src/otterscan.rs @@ -1,7 +1,7 @@ use alloy_consensus::{BlockHeader, Transaction}; use alloy_network::{ReceiptResponse, TransactionResponse}; use alloy_primitives::{Address, Bytes, TxHash, B256, U256}; -use alloy_rpc_types::{BlockTransactions, TransactionReceipt}; +use alloy_rpc_types::{BlockTransactions, Header, TransactionReceipt}; use alloy_rpc_types_trace::{ otterscan::{ BlockDetails, ContractCreator, InternalOperation, OperationType, OtsBlockTransactions, @@ -15,7 +15,6 @@ use reth_primitives::{BlockId, BlockNumberOrTag}; use reth_rpc_api::{EthApiServer, OtterscanServer}; use reth_rpc_eth_api::{ helpers::{EthTransactions, TraceExt}, - types::RpcHeader, FullEthApiTypes, RpcBlock, RpcReceipt, RpcTransaction, TransactionCompat, }; use reth_rpc_eth_types::{utils::binary_search, EthApiError}; @@ -50,7 +49,7 @@ where &self, block: RpcBlock, receipts: Vec>, - ) -> RpcResult>> { + ) -> RpcResult { // blob fee is burnt, so we don't need to calculate it let total_fees = receipts .iter() @@ -62,23 +61,18 @@ where } #[async_trait] -impl OtterscanServer, RpcHeader> - for OtterscanApi +impl OtterscanServer, Header> for OtterscanApi where Eth: EthApiServer< RpcTransaction, RpcBlock, - RpcHeader, RpcReceipt, > + EthTransactions + TraceExt + 'static, { /// Handler for `{ots,erigon}_getHeaderByNumber` - async fn get_header_by_number( - &self, - block_number: u64, - ) -> RpcResult>> { + async fn get_header_by_number(&self, block_number: u64) -> RpcResult> { self.eth.header_by_number(BlockNumberOrTag::Number(block_number)).await } @@ -171,10 +165,7 @@ where } /// Handler for `ots_getBlockDetails` - async fn get_block_details( - &self, - block_number: u64, - ) -> RpcResult>> { + async fn get_block_details(&self, block_number: u64) -> RpcResult> { let block_id = block_number.into(); let block = self.eth.block_by_number(block_id, true); let block_id = block_id.into(); @@ -187,10 +178,7 @@ where } /// Handler for `getBlockDetailsByHash` - async fn get_block_details_by_hash( - &self, - block_hash: B256, - ) -> RpcResult>> { + async fn get_block_details_by_hash(&self, block_hash: B256) -> RpcResult> { let block = self.eth.block_by_hash(block_hash, true); let block_id = block_hash.into(); let receipts = self.eth.block_receipts(block_id); @@ -207,9 +195,7 @@ where block_number: u64, page_number: usize, page_size: usize, - ) -> RpcResult< - OtsBlockTransactions, RpcHeader>, - > { + ) -> RpcResult, Header>> { let block_id = block_number.into(); // retrieve full block and its receipts let block = self.eth.block_by_number(block_id, true);