Skip to content

Commit

Permalink
chore(clippy): fix the very complex type used (#11689)
Browse files Browse the repository at this point in the history
Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
jsvisa and mattsse authored Oct 12, 2024
1 parent 53bd687 commit 67c5725
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 7 additions & 2 deletions crates/rpc/rpc-eth-api/src/helpers/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -108,15 +113,15 @@ 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;

/// Helper method that loads a bock and all its receipts.
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,
{
Expand Down
6 changes: 4 additions & 2 deletions crates/rpc/rpc-eth-api/src/helpers/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
{
Expand Down

0 comments on commit 67c5725

Please sign in to comment.