chore(op-sdk): Relax trait bounds on TraceApi methods not accessing mempool (#15752)

This commit is contained in:
Emilia Hane
2025-05-02 10:41:11 +02:00
committed by GitHub
parent c91d2cae77
commit 4cd714e8d8
5 changed files with 148 additions and 112 deletions

View File

@@ -13,9 +13,10 @@ use futures::Future;
use reth_node_api::BlockBody;
use reth_primitives_traits::{RecoveredBlock, SealedBlock};
use reth_provider::{
BlockIdReader, BlockReader, BlockReaderIdExt, ProviderHeader, ProviderReceipt,
BlockIdReader, BlockReader, BlockReaderIdExt, ProviderHeader, ProviderReceipt, ProviderTx,
};
use reth_rpc_types_compat::block::from_block;
use reth_transaction_pool::{PoolTransaction, TransactionPool};
use std::sync::Arc;
/// Result type of the fetched block receipts.
@@ -116,6 +117,8 @@ pub trait EthBlocks: LoadBlock {
) -> impl Future<Output = BlockAndReceiptsResult<Self>> + Send
where
Self: LoadReceipt,
Self::Pool:
TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
{
async move {
if block_id.is_pending() {
@@ -199,7 +202,13 @@ pub trait EthBlocks: LoadBlock {
/// Loads a block from database.
///
/// Behaviour shared by several `eth_` RPC methods, not exclusive to `eth_` blocks RPC methods.
pub trait LoadBlock: LoadPendingBlock + SpawnBlocking + RpcNodeCoreExt {
pub trait LoadBlock:
LoadPendingBlock
+ SpawnBlocking
+ RpcNodeCoreExt<
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
>
{
/// Returns the block object for the given block id.
#[expect(clippy::type_complexity)]
fn recovered_block(

View File

@@ -45,7 +45,6 @@ pub trait LoadPendingBlock:
Provider: BlockReaderIdExt<Receipt: Receipt>
+ ChainSpecProvider<ChainSpec: EthChainSpec + EthereumHardforks>
+ StateProviderFactory,
Pool: TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
Evm: ConfigureEvm<
Primitives: NodePrimitives<
BlockHeader = ProviderHeader<Self::Provider>,
@@ -136,6 +135,8 @@ pub trait LoadPendingBlock:
> + Send
where
Self: SpawnBlocking,
Self::Pool:
TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
{
async move {
let pending = self.pending_block_env_and_cfg()?;
@@ -203,6 +204,8 @@ pub trait LoadPendingBlock:
Self::Error,
>
where
Self::Pool:
TransactionPool<Transaction: PoolTransaction<Consensus = ProviderTx<Self::Provider>>>,
EthApiError: From<ProviderError>,
{
let state_provider = self