pub trait LoadPendingBlock: EthApiTypes<Error: FromEvmError<Self::Evm>, RpcConvert: RpcConvert<Network = Self::NetworkTypes>> + RpcNodeCore {
// Required methods
fn pending_block(&self) -> &Mutex<Option<PendingBlock<Self::Primitives>>>;
fn pending_env_builder(&self) -> &dyn PendingEnvBuilder<Self::Evm>;
// Provided methods
fn pending_block_kind(&self) -> PendingBlockKind { ... }
fn pending_block_env_and_cfg(
&self,
) -> Result<PendingBlockEnv<Self::Evm>, Self::Error> { ... }
fn next_env_attributes(
&self,
parent: &SealedHeader<ProviderHeader<Self::Provider>>,
) -> Result<<Self::Evm as ConfigureEvm>::NextBlockEnvCtx, Self::Error> { ... }
fn local_pending_state(
&self,
) -> impl Future<Output = Result<Option<StateProviderBox>, Self::Error>> + Send
where Self: SpawnBlocking { ... }
fn local_pending_block_or_state(
&self,
) -> impl Future<Output = Result<Option<PendingStateSource<Self::Primitives>>, 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 build_pool_pending_block(
&self,
parent: SealedHeader<ProviderHeader<Self::Provider>>,
evm_env: EvmEnvFor<Self::Evm>,
) -> 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<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>> { ... }
fn build_block(
&self,
parent: &SealedHeader<ProviderHeader<Self::Provider>>,
) -> Result<ExecutedBlock<Self::Primitives>, Self::Error>
where Self::Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
EthApiError: From<ProviderError> { ... }
}Expand description
Loads a provider pending block or builds one from the transaction pool.
Behaviour shared by several eth_ RPC methods, not exclusive to eth_ blocks RPC methods.
Required Methods§
Sourcefn pending_block(&self) -> &Mutex<Option<PendingBlock<Self::Primitives>>>
fn pending_block(&self) -> &Mutex<Option<PendingBlock<Self::Primitives>>>
Returns a handle to the pending block.
Data access in default (L1) trait method implementations.
Sourcefn pending_env_builder(&self) -> &dyn PendingEnvBuilder<Self::Evm>
fn pending_env_builder(&self) -> &dyn PendingEnvBuilder<Self::Evm>
Returns a PendingEnvBuilder for the pending block.
Provided Methods§
Sourcefn pending_block_kind(&self) -> PendingBlockKind
fn pending_block_kind(&self) -> PendingBlockKind
Returns the pending block kind.
Sourcefn pending_block_env_and_cfg(
&self,
) -> Result<PendingBlockEnv<Self::Evm>, Self::Error>
fn pending_block_env_and_cfg( &self, ) -> Result<PendingBlockEnv<Self::Evm>, Self::Error>
Returns the pending block environment and its origin.
Uses the provider’s pending block when available; otherwise derives the next block environment from the latest header. This method performs synchronous provider reads.
Sourcefn next_env_attributes(
&self,
parent: &SealedHeader<ProviderHeader<Self::Provider>>,
) -> Result<<Self::Evm as ConfigureEvm>::NextBlockEnvCtx, Self::Error>
fn next_env_attributes( &self, parent: &SealedHeader<ProviderHeader<Self::Provider>>, ) -> Result<<Self::Evm as ConfigureEvm>::NextBlockEnvCtx, Self::Error>
Returns ConfigureEvm::NextBlockEnvCtx for building a local pending block.
Sourcefn local_pending_state(
&self,
) -> impl Future<Output = Result<Option<StateProviderBox>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
fn local_pending_state(
&self,
) -> impl Future<Output = Result<Option<StateProviderBox>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
Returns a StateProviderBox on a mem-pool built pending block overlaying latest.
This is used by state_at_block_id and, by default, by
Self::local_pending_block_or_state. This method’s default opens the provider state on a
blocking task after building the pending block.
Sourcefn local_pending_block_or_state(
&self,
) -> impl Future<Output = Result<Option<PendingStateSource<Self::Primitives>>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
fn local_pending_block_or_state(
&self,
) -> impl Future<Output = Result<Option<PendingStateSource<Self::Primitives>>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
Selects the local pending source for state RPCs.
By default, delegates to Self::local_pending_state so existing chain-specific overrides
continue to apply. Implementations can return PendingStateSource::Block to defer opening
the block’s state provider until the state RPC’s blocking task. Returning None falls back
to the provider’s pending state.
Sourcefn pool_pending_block(
&self,
) -> impl Future<Output = Result<Option<PendingBlock<Self::Primitives>>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
fn pool_pending_block(
&self,
) -> impl Future<Output = Result<Option<PendingBlock<Self::Primitives>>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
Returns a cached or newly built pending block from the transaction pool.
Returns None if local pending blocks are disabled or the provider has an actual pending
block. Resolves the environment before awaiting the cache lock, then may spawn a blocking
task to build the block. Callers must await this outside a blocking task.
Sourcefn build_pool_pending_block(
&self,
parent: SealedHeader<ProviderHeader<Self::Provider>>,
evm_env: EvmEnvFor<Self::Evm>,
) -> impl Future<Output = Result<Option<PendingBlock<Self::Primitives>>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
fn build_pool_pending_block(
&self,
parent: SealedHeader<ProviderHeader<Self::Provider>>,
evm_env: EvmEnvFor<Self::Evm>,
) -> impl Future<Output = Result<Option<PendingBlock<Self::Primitives>>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
Returns a cached or newly built pending block for the given parent and environment.
Holds the async cache lock while rebuilding, which may spawn blocking work. The resolved parent and environment let callers reuse the result of their provider lookup.
Sourcefn local_pending_block(
&self,
) -> impl Future<Output = Result<Option<BlockAndReceipts<Self::Primitives>>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
Self::Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
fn local_pending_block(
&self,
) -> impl Future<Output = Result<Option<BlockAndReceipts<Self::Primitives>>, Self::Error>> + Sendwhere
Self: SpawnBlocking,
Self::Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
When enabled, returns the provider’s pending block or builds one from the pool.
Sourcefn build_block(
&self,
parent: &SealedHeader<ProviderHeader<Self::Provider>>,
) -> Result<ExecutedBlock<Self::Primitives>, Self::Error>where
Self::Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
EthApiError: From<ProviderError>,
fn build_block(
&self,
parent: &SealedHeader<ProviderHeader<Self::Provider>>,
) -> Result<ExecutedBlock<Self::Primitives>, Self::Error>where
Self::Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
EthApiError: From<ProviderError>,
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".