@@ -6,7 +6,6 @@ use alloy_rpc_types_mev::{EthCallBundle, EthCallBundleResponse, EthCallBundleTra
6
6
use jsonrpsee:: core:: RpcResult ;
7
7
use reth_chainspec:: EthChainSpec ;
8
8
use reth_evm:: { env:: EvmEnv , ConfigureEvm , ConfigureEvmEnv } ;
9
- use reth_primitives:: PooledTransaction ;
10
9
use reth_primitives_traits:: SignedTransaction ;
11
10
use reth_provider:: { ChainSpecProvider , HeaderProvider } ;
12
11
use reth_revm:: database:: StateProviderDatabase ;
@@ -16,7 +15,9 @@ use reth_rpc_eth_api::{
16
15
} ;
17
16
use reth_rpc_eth_types:: { utils:: recover_raw_transaction, EthApiError , RpcInvalidTransactionError } ;
18
17
use reth_tasks:: pool:: BlockingTaskGuard ;
19
- use reth_transaction_pool:: { PoolPooledTx , PoolTransaction , PoolTx , TransactionPool } ;
18
+ use reth_transaction_pool:: {
19
+ EthBlobTransactionSidecar , EthPoolTransaction , PoolPooledTx , PoolTransaction , TransactionPool ,
20
+ } ;
20
21
use revm:: {
21
22
db:: { CacheDB , DatabaseCommit , DatabaseRef } ,
22
23
primitives:: { ResultAndState , TxEnv } ,
@@ -44,11 +45,7 @@ impl<Eth> EthBundle<Eth> {
44
45
45
46
impl < Eth > EthBundle < Eth >
46
47
where
47
- Eth : EthTransactions <
48
- Pool : TransactionPool < Transaction : PoolTransaction < Pooled = PooledTransaction > > ,
49
- > + LoadPendingBlock
50
- + Call
51
- + ' static ,
48
+ Eth : EthTransactions + LoadPendingBlock + Call + ' static ,
52
49
{
53
50
/// Simulates a bundle of transactions at the top of a given block number with the state of
54
51
/// another (or the same) block. This can be used to simulate future blocks with the current
@@ -88,12 +85,11 @@ where
88
85
. map ( |tx| recover_raw_transaction :: < PoolPooledTx < Eth :: Pool > > ( & tx) )
89
86
. collect :: < Result < Vec < _ > , _ > > ( ) ?
90
87
. into_iter ( )
91
- . map ( |tx| tx. to_components ( ) )
92
88
. collect :: < Vec < _ > > ( ) ;
93
89
94
90
// Validate that the bundle does not contain more than MAX_BLOB_NUMBER_PER_BLOCK blob
95
91
// transactions.
96
- if transactions. iter ( ) . filter_map ( |( tx , _ ) | tx. blob_gas_used ( ) ) . sum :: < u64 > ( ) >
92
+ if transactions. iter ( ) . filter_map ( |tx | tx. blob_gas_used ( ) ) . sum :: < u64 > ( ) >
97
93
MAX_BLOB_GAS_PER_BLOCK
98
94
{
99
95
return Err ( EthApiError :: InvalidParams (
@@ -185,18 +181,23 @@ where
185
181
let mut results = Vec :: with_capacity ( transactions. len ( ) ) ;
186
182
let mut transactions = transactions. into_iter ( ) . peekable ( ) ;
187
183
188
- while let Some ( ( tx, signer) ) = transactions. next ( ) {
189
- // Verify that the given blob data, commitments, and proofs are all valid for
190
- // this transaction.
191
- if let PooledTransaction :: Eip4844 ( ref tx) = tx {
192
- tx. tx ( ) . validate_blob ( EnvKzgSettings :: Default . get ( ) ) . map_err ( |e| {
193
- Eth :: Error :: from_eth_err ( EthApiError :: InvalidParams ( e. to_string ( ) ) )
194
- } ) ?;
195
- }
196
-
197
- let tx: PoolPooledTx < Eth :: Pool > = tx;
198
- let tx = PoolTx :: < Eth :: Pool > :: pooled_into_consensus ( tx) ;
199
- // let tx = PoolConsensusTx::<Eth::Pool>::Trafrom(tx);
184
+ while let Some ( tx) = transactions. next ( ) {
185
+ let signer = tx. signer ( ) ;
186
+ let tx = {
187
+ let mut tx: <Eth :: Pool as TransactionPool >:: Transaction = tx. into ( ) ;
188
+
189
+ if let EthBlobTransactionSidecar :: Present ( sidecar) = tx. take_blob ( ) {
190
+ tx. validate_blob ( & sidecar, EnvKzgSettings :: Default . get ( ) ) . map_err (
191
+ |e| {
192
+ Eth :: Error :: from_eth_err ( EthApiError :: InvalidParams (
193
+ e. to_string ( ) ,
194
+ ) )
195
+ } ,
196
+ ) ?;
197
+ }
198
+
199
+ tx. into_consensus ( )
200
+ } ;
200
201
201
202
hasher. update ( * tx. tx_hash ( ) ) ;
202
203
let gas_price = tx. effective_gas_price ( basefee) ;
@@ -278,11 +279,7 @@ where
278
279
#[ async_trait:: async_trait]
279
280
impl < Eth > EthCallBundleApiServer for EthBundle < Eth >
280
281
where
281
- Eth : EthTransactions <
282
- Pool : TransactionPool < Transaction : PoolTransaction < Pooled = PooledTransaction > > ,
283
- > + LoadPendingBlock
284
- + Call
285
- + ' static ,
282
+ Eth : EthTransactions + LoadPendingBlock + Call + ' static ,
286
283
{
287
284
async fn call_bundle ( & self , request : EthCallBundle ) -> RpcResult < EthCallBundleResponse > {
288
285
Self :: call_bundle ( self , request) . await . map_err ( Into :: into)
0 commit comments