LoadPendingBlock

Trait LoadPendingBlock 

Source
pub trait LoadPendingBlock: EthApiTypes + RpcNodeCore
where Self::Error: FromEvmError<Self::Evm>, Self::RpcConvert: RpcConvert<Network = Self::NetworkTypes>,
{ // Required methods fn pending_block(&self) -> &Mutex<Option<PendingBlock<Self::Primitives>>>; fn pending_env_builder( &self, ) -> &(dyn PendingEnvBuilder<Self::Evm> + 'static); fn pending_block_kind(&self) -> PendingBlockKind; // Provided methods fn pending_block_env_and_cfg( &self, ) -> Result<PendingBlockEnv<Self::Evm>, Self::Error> { ... } fn next_env_attributes( &self, parent: &SealedHeader<<Self::Provider as HeaderProvider>::Header>, ) -> Result<<Self::Evm as ConfigureEvm>::NextBlockEnvCtx, Self::Error> { ... } fn local_pending_state( &self, ) -> impl Future<Output = Result<Option<Box<dyn StateProvider + Send>>, Self::Error>> + Send where Self: SpawnBlocking { ... } fn pool_pending_block( &self, ) -> impl Future<Output = Result<Option<PendingBlock<Self::Primitives>>, Self::Error>> + Send where Self: SpawnBlocking { ... } fn local_pending_block( &self, ) -> impl Future<Output = Result<Option<BlockAndReceipts<Self::Primitives>>, Self::Error>> + Send where Self: SpawnBlocking, Self::Pool: TransactionPool, <Self::Pool as TransactionPool>::Transaction: PoolTransaction<Consensus = <Self::Provider as TransactionsProvider>::Transaction> { ... } fn build_block( &self, parent: &SealedHeader<<Self::Provider as HeaderProvider>::Header>, ) -> Result<ExecutedBlock<Self::Primitives>, Self::Error> where Self::Pool: TransactionPool, <Self::Pool as TransactionPool>::Transaction: PoolTransaction<Consensus = <Self::Provider as TransactionsProvider>::Transaction>, EthApiError: From<ProviderError> { ... } }
Available on crate feature rpc only.
Expand description

Loads a pending block from database.

Behaviour shared by several eth_ RPC methods, not exclusive to eth_ blocks RPC methods.

Required Methods§

Source

fn pending_block(&self) -> &Mutex<Option<PendingBlock<Self::Primitives>>>

Returns a handle to the pending block.

Data access in default (L1) trait method implementations.

Source

fn pending_env_builder(&self) -> &(dyn PendingEnvBuilder<Self::Evm> + 'static)

Returns a PendingEnvBuilder for the pending block.

Source

fn pending_block_kind(&self) -> PendingBlockKind

Returns the pending block kind

Provided Methods§

Source

fn pending_block_env_and_cfg( &self, ) -> Result<PendingBlockEnv<Self::Evm>, Self::Error>

Configures the PendingBlockEnv for the pending block

If no pending block is available, this will derive it from the latest block

Source

fn next_env_attributes( &self, parent: &SealedHeader<<Self::Provider as HeaderProvider>::Header>, ) -> Result<<Self::Evm as ConfigureEvm>::NextBlockEnvCtx, Self::Error>

Returns ConfigureEvm::NextBlockEnvCtx for building a local pending block.

Source

fn local_pending_state( &self, ) -> impl Future<Output = Result<Option<Box<dyn StateProvider + Send>>, Self::Error>> + Send
where Self: SpawnBlocking,

Returns a StateProviderBox on a mem-pool built pending block overlaying latest.

Source

fn pool_pending_block( &self, ) -> impl Future<Output = Result<Option<PendingBlock<Self::Primitives>>, Self::Error>> + Send
where Self: SpawnBlocking,

Returns a mem-pool built pending block.

Source

fn local_pending_block( &self, ) -> impl Future<Output = Result<Option<BlockAndReceipts<Self::Primitives>>, Self::Error>> + Send

Returns the locally built pending block

Source

fn build_block( &self, parent: &SealedHeader<<Self::Provider as HeaderProvider>::Header>, ) -> Result<ExecutedBlock<Self::Primitives>, Self::Error>

Builds a locally derived pending block using the configured provider and pool.

This is used when no execution-layer pending block is available and a pending block is derived from the latest canonical header, using the provided parent.

Withdrawals and any fork-specific behavior (such as EIP-4788 pre-block contract calls) are determined by the EVM environment and chain specification used during construction.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<N, Rpc> LoadPendingBlock for EthApi<N, Rpc>
where N: RpcNodeCore, EthApiError: FromEvmError<<N as RpcNodeCore>::Evm>, Rpc: RpcConvert<Primitives = <N as RpcNodeCore>::Primitives, Error = EthApiError>,

Source§

impl<N, Rpc> LoadPendingBlock for OpEthApi<N, Rpc>
where N: RpcNodeCore, OpEthApiError: FromEvmError<<N as RpcNodeCore>::Evm>, Rpc: RpcConvert<Primitives = <N as RpcNodeCore>::Primitives, Error = OpEthApiError>,