From 30d48cc97fa3c73f8bfdc18261e29156f438ac2d Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Tue, 17 Dec 2024 14:33:14 +0100 Subject: [PATCH] fix: call bundle recursion (#13425) --- crates/rpc/rpc-builder/tests/it/http.rs | 5 +++-- crates/rpc/rpc/src/eth/bundle.rs | 15 ++++++--------- crates/transaction-pool/src/traits.rs | 2 ++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/rpc/rpc-builder/tests/it/http.rs b/crates/rpc/rpc-builder/tests/it/http.rs index 357e3135e0..776de6fc04 100644 --- a/crates/rpc/rpc-builder/tests/it/http.rs +++ b/crates/rpc/rpc-builder/tests/it/http.rs @@ -22,8 +22,8 @@ use reth_network_peers::NodeRecord; use reth_primitives::Receipt; use reth_rpc_api::{ clients::{AdminApiClient, EthApiClient}, - DebugApiClient, EthFilterApiClient, NetApiClient, OtterscanClient, TraceApiClient, - Web3ApiClient, + DebugApiClient, EthCallBundleApiClient, EthFilterApiClient, NetApiClient, OtterscanClient, + TraceApiClient, Web3ApiClient, }; use reth_rpc_server_types::RethRpcModule; use serde::{de::DeserializeOwned, Deserialize, Serialize}; @@ -352,6 +352,7 @@ where .err() .unwrap() )); + EthCallBundleApiClient::call_bundle(client, Default::default()).await.unwrap_err(); } async fn test_basic_debug_calls(client: &C) diff --git a/crates/rpc/rpc/src/eth/bundle.rs b/crates/rpc/rpc/src/eth/bundle.rs index 5c3a5e09a5..30dd3b4a09 100644 --- a/crates/rpc/rpc/src/eth/bundle.rs +++ b/crates/rpc/rpc/src/eth/bundle.rs @@ -16,7 +16,7 @@ use reth_rpc_eth_api::{ }; use reth_rpc_eth_types::{utils::recover_raw_transaction, EthApiError, RpcInvalidTransactionError}; use reth_tasks::pool::BlockingTaskGuard; -use reth_transaction_pool::{PoolConsensusTx, PoolPooledTx, PoolTransaction, TransactionPool}; +use reth_transaction_pool::{PoolPooledTx, PoolTransaction, PoolTx, TransactionPool}; use revm::{ db::{CacheDB, DatabaseCommit, DatabaseRef}, primitives::{ResultAndState, TxEnv}, @@ -45,12 +45,7 @@ impl EthBundle { impl EthBundle where Eth: EthTransactions< - Pool: TransactionPool< - Transaction: PoolTransaction< - Consensus: From, - Pooled = PooledTransaction, - >, - >, + Pool: TransactionPool>, > + LoadPendingBlock + Call + 'static, @@ -199,7 +194,9 @@ where })?; } - let tx: PoolConsensusTx = tx.into(); + let tx: PoolPooledTx = tx; + let tx = PoolTx::::pooled_into_consensus(tx); + // let tx = PoolConsensusTx::::Trafrom(tx); hasher.update(*tx.tx_hash()); let gas_price = tx.effective_gas_price(basefee); @@ -288,7 +285,7 @@ where + 'static, { async fn call_bundle(&self, request: EthCallBundle) -> RpcResult { - self.call_bundle(request).await.map_err(Into::into) + Self::call_bundle(self, request).await.map_err(Into::into) } } diff --git a/crates/transaction-pool/src/traits.rs b/crates/transaction-pool/src/traits.rs index dca8ed0d3e..f0ae45945a 100644 --- a/crates/transaction-pool/src/traits.rs +++ b/crates/transaction-pool/src/traits.rs @@ -40,6 +40,8 @@ use tokio::sync::mpsc::Receiver; /// The `PeerId` type. pub type PeerId = alloy_primitives::B512; +/// Helper type alias to access [`PoolTransaction`] for a given [`TransactionPool`]. +pub type PoolTx

=

::Transaction; /// Helper type alias to access [`PoolTransaction::Consensus`] for a given [`TransactionPool`]. pub type PoolConsensusTx

= <

::Transaction as PoolTransaction>::Consensus;