diff --git a/crates/rpc/rpc-eth-api/src/core.rs b/crates/rpc/rpc-eth-api/src/core.rs index 30c51a9f7e86..f5dac6d79169 100644 --- a/crates/rpc/rpc-eth-api/src/core.rs +++ b/crates/rpc/rpc-eth-api/src/core.rs @@ -15,8 +15,8 @@ use reth_rpc_types::{ serde_helpers::JsonStorageKey, simulate::{SimBlock, SimulatedBlock}, state::{EvmOverrides, StateOverride}, - AnyTransactionReceipt, BlockOverrides, Bundle, EIP1186AccountProofResponse, EthCallResponse, - FeeHistory, Header, Index, RichBlock, StateContext, SyncStatus, Transaction, + AnyTransactionReceipt, Block, BlockOverrides, Bundle, EIP1186AccountProofResponse, + EthCallResponse, FeeHistory, Header, Index, RichBlock, StateContext, SyncStatus, Transaction, TransactionRequest, Work, }; use tracing::trace; @@ -102,7 +102,7 @@ pub trait EthApi { &self, hash: B256, index: Index, - ) -> RpcResult>; + ) -> RpcResult>; /// Returns an uncle block of the given block and index. #[method(name = "getUncleByBlockNumberAndIndex")] @@ -110,7 +110,7 @@ pub trait EthApi { &self, number: BlockNumberOrTag, index: Index, - ) -> RpcResult>; + ) -> RpcResult>; /// Returns the EIP-2718 encoded transaction if it exists. /// @@ -449,7 +449,7 @@ where &self, hash: B256, index: Index, - ) -> RpcResult> { + ) -> RpcResult> { trace!(target: "rpc::eth", ?hash, ?index, "Serving eth_getUncleByBlockHashAndIndex"); Ok(EthBlocks::ommer_by_block_and_index(self, hash.into(), index).await?) } @@ -459,7 +459,7 @@ where &self, number: BlockNumberOrTag, index: Index, - ) -> RpcResult> { + ) -> RpcResult> { trace!(target: "rpc::eth", ?number, ?index, "Serving eth_getUncleByBlockNumberAndIndex"); Ok(EthBlocks::ommer_by_block_and_index(self, number.into(), index).await?) } diff --git a/crates/rpc/rpc-eth-api/src/helpers/block.rs b/crates/rpc/rpc-eth-api/src/helpers/block.rs index 0058ca021cfc..accf5089b422 100644 --- a/crates/rpc/rpc-eth-api/src/helpers/block.rs +++ b/crates/rpc/rpc-eth-api/src/helpers/block.rs @@ -6,7 +6,7 @@ use futures::Future; use reth_primitives::{BlockId, Receipt, SealedBlock, SealedBlockWithSenders, TransactionMeta}; use reth_provider::{BlockIdReader, BlockReader, BlockReaderIdExt, HeaderProvider}; use reth_rpc_eth_types::{EthApiError, EthStateCache, ReceiptBuilder}; -use reth_rpc_types::{AnyTransactionReceipt, Header, Index, RichBlock}; +use reth_rpc_types::{AnyTransactionReceipt, Block, Header, Index, RichBlock}; use reth_rpc_types_compat::block::{from_block, uncle_block_from_header}; use crate::FromEthApiError; @@ -187,7 +187,7 @@ pub trait EthBlocks: LoadBlock { &self, block_id: BlockId, index: Index, - ) -> impl Future, Self::Error>> + Send { + ) -> impl Future, Self::Error>> + Send { async move { let uncles = if block_id.is_pending() { // Pending block can be fetched directly without need for caching @@ -202,11 +202,7 @@ pub trait EthBlocks: LoadBlock { } .unwrap_or_default(); - let uncle = uncles - .into_iter() - .nth(index.into()) - .map(|header| uncle_block_from_header(header).into()); - Ok(uncle) + Ok(uncles.into_iter().nth(index.into()).map(uncle_block_from_header)) } } }