@@ -11,10 +11,13 @@ use alloy::{
11
11
EthSendBundle ,
12
12
} ,
13
13
} ;
14
- use revm:: primitives:: { EVMError , ExecutionResult , SpecId } ;
14
+ use revm:: {
15
+ primitives:: { EVMError , ExecutionResult , SpecId } ,
16
+ Database , DatabaseCommit ,
17
+ } ;
15
18
16
19
/// Possible errors that can occur while driving a bundle.
17
- pub enum BundleError < Db : revm :: Database > {
20
+ pub enum BundleError < Db : Database > {
18
21
/// The block number of the bundle does not match the block number of the revm block configuration.
19
22
BlockNumberMismatch ,
20
23
/// The timestamp of the bundle is out of range.
@@ -38,7 +41,7 @@ pub enum BundleError<Db: revm::Database> {
38
41
} ,
39
42
}
40
43
41
- impl < Db : revm :: Database > core:: fmt:: Display for BundleError < Db > {
44
+ impl < Db : Database > core:: fmt:: Display for BundleError < Db > {
42
45
fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
43
46
match self {
44
47
Self :: BlockNumberMismatch => {
@@ -58,25 +61,25 @@ impl<Db: revm::Database> core::fmt::Display for BundleError<Db> {
58
61
}
59
62
}
60
63
61
- impl < Db : revm :: Database > From < alloy:: eips:: eip2718:: Eip2718Error > for BundleError < Db > {
64
+ impl < Db : Database > From < alloy:: eips:: eip2718:: Eip2718Error > for BundleError < Db > {
62
65
fn from ( err : alloy:: eips:: eip2718:: Eip2718Error ) -> Self {
63
66
Self :: TransactionDecodingError ( err)
64
67
}
65
68
}
66
69
67
- impl < Db : revm :: Database > From < alloy:: primitives:: SignatureError > for BundleError < Db > {
70
+ impl < Db : Database > From < alloy:: primitives:: SignatureError > for BundleError < Db > {
68
71
fn from ( err : alloy:: primitives:: SignatureError ) -> Self {
69
72
Self :: TransactionSenderRecoveryError ( err)
70
73
}
71
74
}
72
75
73
- impl < Db : revm :: Database > From < EVMError < Db :: Error > > for BundleError < Db > {
76
+ impl < Db : Database > From < EVMError < Db :: Error > > for BundleError < Db > {
74
77
fn from ( inner : EVMError < Db :: Error > ) -> Self {
75
78
Self :: EVMError { inner }
76
79
}
77
80
}
78
81
79
- impl < Db : revm :: Database > std:: error:: Error for BundleError < Db > {
82
+ impl < Db : Database > std:: error:: Error for BundleError < Db > {
80
83
fn source ( & self ) -> Option < & ( dyn std:: error:: Error + ' static ) > {
81
84
match self {
82
85
Self :: TransactionDecodingError ( err) => Some ( err) ,
@@ -86,7 +89,7 @@ impl<Db: revm::Database> std::error::Error for BundleError<Db> {
86
89
}
87
90
}
88
91
89
- impl < Db : revm :: Database > core:: fmt:: Debug for BundleError < Db > {
92
+ impl < Db : Database > core:: fmt:: Debug for BundleError < Db > {
90
93
fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
91
94
match self {
92
95
Self :: TimestampOutOfRange => write ! ( f, "TimestampOutOfRange" ) ,
@@ -141,7 +144,7 @@ where
141
144
142
145
impl < B , R > BundleProcessor < B , R > {
143
146
/// Decode and validate the transactions in the bundle, performing EIP4844 gas checks.
144
- pub fn decode_and_validate_txs < Db : revm :: Database > (
147
+ pub fn decode_and_validate_txs < Db : Database + DatabaseCommit > (
145
148
txs : & [ Bytes ] ,
146
149
) -> Result < Vec < TxEnvelope > , BundleError < Db > > {
147
150
let txs = txs
@@ -175,7 +178,7 @@ impl BundleProcessor<EthCallBundle, EthCallBundleResponse> {
175
178
}
176
179
177
180
/// Process a bundle transaction and accumulate the results into a [EthCallBundleTransactionResult].
178
- pub fn process_call_bundle_tx < Db : revm :: Database > (
181
+ pub fn process_call_bundle_tx < Db : Database + DatabaseCommit > (
179
182
tx : & TxEnvelope ,
180
183
pre_sim_coinbase_balance : U256 ,
181
184
post_sim_coinbase_balance : U256 ,
@@ -257,9 +260,9 @@ impl BundleProcessor<EthCallBundle, EthCallBundleResponse> {
257
260
}
258
261
259
262
impl < Ext > BundleDriver < Ext > for BundleProcessor < EthCallBundle , EthCallBundleResponse > {
260
- type Error < Db : revm :: Database > = BundleError < Db > ;
263
+ type Error < Db : Database + DatabaseCommit > = BundleError < Db > ;
261
264
262
- fn run_bundle < ' a , Db : revm :: Database + revm:: DatabaseCommit > (
265
+ fn run_bundle < ' a , Db : Database + revm:: DatabaseCommit > (
263
266
& mut self ,
264
267
trevm : crate :: EvmNeedsTx < ' a , Ext , Db > ,
265
268
) -> DriveBundleResult < ' a , Ext , Db , Self > {
@@ -389,7 +392,7 @@ impl<Ext> BundleDriver<Ext> for BundleProcessor<EthCallBundle, EthCallBundleResp
389
392
}
390
393
}
391
394
392
- fn post_bundle < Db : revm :: Database + revm:: DatabaseCommit > (
395
+ fn post_bundle < Db : Database + revm:: DatabaseCommit > (
393
396
& mut self ,
394
397
_trevm : & crate :: EvmNeedsTx < ' _ , Ext , Db > ,
395
398
) -> Result < ( ) , Self :: Error < Db > > {
@@ -398,9 +401,9 @@ impl<Ext> BundleDriver<Ext> for BundleProcessor<EthCallBundle, EthCallBundleResp
398
401
}
399
402
400
403
impl < Ext > BundleDriver < Ext > for BundleProcessor < EthSendBundle , EthBundleHash > {
401
- type Error < Db : revm :: Database > = BundleError < Db > ;
404
+ type Error < Db : Database + DatabaseCommit > = BundleError < Db > ;
402
405
403
- fn run_bundle < ' a , Db : revm :: Database + revm:: DatabaseCommit > (
406
+ fn run_bundle < ' a , Db : Database + revm:: DatabaseCommit > (
404
407
& mut self ,
405
408
trevm : crate :: EvmNeedsTx < ' a , Ext , Db > ,
406
409
) -> DriveBundleResult < ' a , Ext , Db , Self > {
@@ -476,7 +479,7 @@ impl<Ext> BundleDriver<Ext> for BundleProcessor<EthSendBundle, EthBundleHash> {
476
479
}
477
480
}
478
481
479
- fn post_bundle < Db : revm :: Database + revm:: DatabaseCommit > (
482
+ fn post_bundle < Db : Database + revm:: DatabaseCommit > (
480
483
& mut self ,
481
484
_trevm : & crate :: EvmNeedsTx < ' _ , Ext , Db > ,
482
485
) -> Result < ( ) , Self :: Error < Db > > {
@@ -541,9 +544,9 @@ impl From<EthCallBundle> for BundleBlockFiller {
541
544
}
542
545
543
546
impl < Ext > BundleDriver < Ext > for EthCallBundle {
544
- type Error < Db : revm :: Database > = BundleError < Db > ;
547
+ type Error < Db : Database + DatabaseCommit > = BundleError < Db > ;
545
548
546
- fn run_bundle < ' a , Db : revm :: Database + revm:: DatabaseCommit > (
549
+ fn run_bundle < ' a , Db : Database + revm:: DatabaseCommit > (
547
550
& mut self ,
548
551
trevm : crate :: EvmNeedsTx < ' a , Ext , Db > ,
549
552
) -> DriveBundleResult < ' a , Ext , Db , Self > {
@@ -619,7 +622,7 @@ impl<Ext> BundleDriver<Ext> for EthCallBundle {
619
622
}
620
623
}
621
624
622
- fn post_bundle < Db : revm :: Database + revm:: DatabaseCommit > (
625
+ fn post_bundle < Db : Database + revm:: DatabaseCommit > (
623
626
& mut self ,
624
627
_trevm : & crate :: EvmNeedsTx < ' _ , Ext , Db > ,
625
628
) -> Result < ( ) , Self :: Error < Db > > {
@@ -631,9 +634,9 @@ impl<Ext> BundleDriver<Ext> for EthCallBundle {
631
634
/// This allows us to drive a bundle of transactions and accumulate the resulting state in the EVM.
632
635
/// Allows to simply take an [EthSendBundle] and get the resulting EVM state.
633
636
impl < Ext > BundleDriver < Ext > for EthSendBundle {
634
- type Error < Db : revm :: Database > = BundleError < Db > ;
637
+ type Error < Db : Database + DatabaseCommit > = BundleError < Db > ;
635
638
636
- fn run_bundle < ' a , Db : revm :: Database + revm:: DatabaseCommit > (
639
+ fn run_bundle < ' a , Db : Database + revm:: DatabaseCommit > (
637
640
& mut self ,
638
641
trevm : crate :: EvmNeedsTx < ' a , Ext , Db > ,
639
642
) -> DriveBundleResult < ' a , Ext , Db , Self > {
@@ -724,7 +727,7 @@ impl<Ext> BundleDriver<Ext> for EthSendBundle {
724
727
Ok ( t)
725
728
}
726
729
727
- fn post_bundle < Db : revm :: Database + revm:: DatabaseCommit > (
730
+ fn post_bundle < Db : Database + revm:: DatabaseCommit > (
728
731
& mut self ,
729
732
_trevm : & crate :: EvmNeedsTx < ' _ , Ext , Db > ,
730
733
) -> Result < ( ) , Self :: Error < Db > > {
0 commit comments