chore(clippy): fix the very complex type used (#11689)

Signed-off-by: jsvisa <delweng@gmail.com>
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Delweng
2024-10-13 02:53:33 +08:00
committed by GitHub
parent 53bd6872db
commit 67c5725077
2 changed files with 11 additions and 4 deletions

View File

@@ -13,6 +13,11 @@ use crate::{FromEthApiError, FullEthApiTypes, RpcBlock, RpcReceipt};
use super::{LoadPendingBlock, LoadReceipt, SpawnBlocking};
/// Result type of the fetched block receipts.
pub type BlockReceiptsResult<N, E> = Result<Option<Vec<RpcReceipt<N>>>, E>;
/// Result type of the fetched block and its receipts.
pub type BlockAndReceiptsResult<E> = Result<Option<(SealedBlock, Arc<Vec<Receipt>>)>, E>;
/// Block related functions for the [`EthApiServer`](crate::EthApiServer) trait in the
/// `eth_` namespace.
pub trait EthBlocks: LoadBlock {
@@ -108,7 +113,7 @@ pub trait EthBlocks: LoadBlock {
fn block_receipts(
&self,
block_id: BlockId,
) -> impl Future<Output = Result<Option<Vec<RpcReceipt<Self::NetworkTypes>>>, Self::Error>> + Send
) -> impl Future<Output = BlockReceiptsResult<Self::NetworkTypes, Self::Error>> + Send
where
Self: LoadReceipt;
@@ -116,7 +121,7 @@ pub trait EthBlocks: LoadBlock {
fn load_block_and_receipts(
&self,
block_id: BlockId,
) -> impl Future<Output = Result<Option<(SealedBlock, Arc<Vec<Receipt>>)>, Self::Error>> + Send
) -> impl Future<Output = BlockAndReceiptsResult<Self::Error>> + Send
where
Self: LoadReceipt,
{

View File

@@ -41,6 +41,9 @@ use tracing::trace;
use super::{LoadBlock, LoadPendingBlock, LoadState, LoadTransaction, SpawnBlocking, Trace};
/// Result type for `eth_simulateV1` RPC method.
pub type SimulatedBlocksResult<N, E> = Result<Vec<SimulatedBlock<RpcBlock<N>>>, E>;
/// Execution related functions for the [`EthApiServer`](crate::EthApiServer) trait in
/// the `eth_` namespace.
pub trait EthCall: Call + LoadPendingBlock {
@@ -62,8 +65,7 @@ pub trait EthCall: Call + LoadPendingBlock {
&self,
payload: SimulatePayload,
block: Option<BlockId>,
) -> impl Future<Output = Result<Vec<SimulatedBlock<RpcBlock<Self::NetworkTypes>>>, Self::Error>>
+ Send
) -> impl Future<Output = SimulatedBlocksResult<Self::NetworkTypes, Self::Error>> + Send
where
Self: LoadBlock + FullEthApiTypes,
{