@@ -6,7 +6,7 @@ use alloy_primitives::{
66 Address , B256 , Bytes , TxKind , U256 ,
77 map:: foldhash:: { HashMap , HashSet , HashSetExt } ,
88} ;
9- use alloy_sol_types:: { ContractError , Error , Revert , SolCall , SolError , SolInterface } ;
9+ use alloy_sol_types:: { ContractError , Revert , SolCall , SolError , SolInterface } ;
1010use core:: fmt:: Debug ;
1111use op_alloy_consensus:: OpTypedTransaction ;
1212use op_alloy_rpc_types:: OpTransactionRequest ;
@@ -30,7 +30,6 @@ use revm::{
3030 inspector:: NoOpInspector ,
3131 state:: Account ,
3232} ;
33- use std:: borrow:: Cow ;
3433use tracing:: warn;
3534
3635use crate :: {
@@ -154,7 +153,7 @@ pub trait BuilderTransactions<ExtraCtx: Debug + Default = (), Extra: Debug + Def
154153 top_of_block : bool ,
155154 ) -> Result < Vec < BuilderTransactionCtx > , BuilderTransactionError > ;
156155
157- fn simulate_builder_txs_with_new_state (
156+ fn simulate_builder_txs_with_state_copy (
158157 & self ,
159158 state_provider : impl StateProvider + Clone ,
160159 info : & mut ExecutionInfo < Extra > ,
@@ -181,7 +180,7 @@ pub trait BuilderTransactions<ExtraCtx: Debug + Default = (), Extra: Debug + Def
181180 top_of_block : bool ,
182181 ) -> Result < Vec < BuilderTransactionCtx > , BuilderTransactionError > {
183182 {
184- let builder_txs = self . simulate_builder_txs_with_new_state (
183+ let builder_txs = self . simulate_builder_txs_with_state_copy (
185184 state_provider,
186185 info,
187186 builder_ctx,
@@ -300,7 +299,7 @@ pub trait BuilderTransactions<ExtraCtx: Debug + Default = (), Extra: Debug + Def
300299 Ok ( ( ) )
301300 }
302301
303- fn simulate_call < T : SolCall , E : SolInterface > (
302+ fn simulate_call < T : SolCall , E : SolInterface + Debug > (
304303 & self ,
305304 tx : OpTransactionRequest ,
306305 expected_logs : Vec < B256 > ,
@@ -359,20 +358,16 @@ pub trait BuilderTransactions<ExtraCtx: Debug + Default = (), Extra: Debug + Def
359358 }
360359 ExecutionResult :: Revert { output, .. } => {
361360 let revert = ContractError :: < E > :: abi_decode ( & output)
362- . and_then ( |reason| {
363- reason
364- . try_into ( )
365- . map_err ( |_| Error :: Other ( Cow :: Borrowed ( "failed to convert to revert" ) ) )
366- } )
361+ . map ( |reason| Revert :: from ( format ! ( "{reason:?}" ) ) )
367362 . or_else ( |_| Revert :: abi_decode ( & output) )
368363 . unwrap_or_else ( |_| {
369364 Revert :: from ( format ! ( "unknown revert: {}" , hex:: encode( & output) ) )
370365 } ) ;
371366 Err ( BuilderTransactionError :: TransactionReverted ( to, revert) )
372367 }
373- ExecutionResult :: Halt { reason, .. } => Err ( BuilderTransactionError :: other (
374- BuilderTransactionError :: TransactionHalted ( to, reason) ,
375- ) ) ,
368+ ExecutionResult :: Halt { reason, .. } => {
369+ Err ( BuilderTransactionError :: TransactionHalted ( to, reason) )
370+ }
376371 }
377372 }
378373}
0 commit comments