@@ -17,7 +17,7 @@ use revm::{
1717 inspector:: NoOpInspector ,
1818 state:: Account ,
1919} ;
20- use std:: sync:: OnceLock ;
20+ use std:: sync:: { Arc , atomic :: AtomicBool } ;
2121use tracing:: { debug, info} ;
2222
2323use crate :: {
@@ -66,7 +66,7 @@ pub struct FlashtestationsBuilderTx {
6666 // Builder proof version
6767 builder_proof_version : u8 ,
6868 // Whether the workload and address has been registered
69- registered : OnceLock < bool > ,
69+ registered : Arc < AtomicBool > ,
7070 // Whether block proofs are enabled
7171 enable_block_proofs : bool ,
7272}
@@ -91,7 +91,7 @@ impl FlashtestationsBuilderTx {
9191 registry_address : args. registry_address ,
9292 builder_policy_address : args. builder_policy_address ,
9393 builder_proof_version : args. builder_proof_version ,
94- registered : OnceLock :: new ( ) ,
94+ registered : Arc :: new ( AtomicBool :: new ( args . registered ) ) ,
9595 enable_block_proofs : args. enable_block_proofs ,
9696 }
9797 }
@@ -178,7 +178,7 @@ impl FlashtestationsBuilderTx {
178178 /// keccak256(abi.encode(parentHash, blockNumber, timestamp, transactionHashes))
179179 /// https://github.com/flashbots/rollup-boost/blob/main/specs/flashtestations.md#block-building-process
180180 fn compute_block_content_hash (
181- transactions : Vec < OpTransactionSigned > ,
181+ transactions : & [ OpTransactionSigned ] ,
182182 parent_hash : B256 ,
183183 block_number : u64 ,
184184 timestamp : u64 ,
@@ -475,7 +475,7 @@ impl FlashtestationsBuilderTx {
475475 > ,
476476 ) -> Result < Option < BuilderTransactionCtx > , BuilderTransactionError > {
477477 let block_content_hash = Self :: compute_block_content_hash (
478- transactions. clone ( ) ,
478+ & transactions,
479479 ctx. parent_hash ( ) ,
480480 ctx. block_number ( ) ,
481481 ctx. timestamp ( ) ,
@@ -545,11 +545,12 @@ impl FlashtestationsBuilderTx {
545545 match self . register_tee_service_tx ( ctx, & mut evm) {
546546 Ok ( ( _, registered) ) => {
547547 if registered {
548- let _ = self . registered . set ( registered) ;
548+ self . registered
549+ . store ( true , std:: sync:: atomic:: Ordering :: SeqCst ) ;
549550 }
550551 Ok ( ( ) )
551552 }
552- Err ( e) => Err ( BuilderTransactionError :: other ( e ) ) ,
553+ Err ( e) => Err ( e ) ,
553554 }
554555 }
555556}
@@ -563,7 +564,7 @@ impl<ExtraCtx: Debug + Default> BuilderTransactions<ExtraCtx> for Flashtestation
563564 db : & mut State < impl Database > ,
564565 ) -> Result < Vec < BuilderTransactionCtx > , BuilderTransactionError > {
565566 // set registered simulating against the committed state
566- if !self . registered . get ( ) . unwrap_or ( & false ) {
567+ if !self . registered . load ( std :: sync :: atomic :: Ordering :: SeqCst ) {
567568 self . set_registered ( state_provider. clone ( ) , ctx) ?;
568569 }
569570
@@ -583,7 +584,7 @@ impl<ExtraCtx: Debug + Default> BuilderTransactions<ExtraCtx> for Flashtestation
583584
584585 let mut builder_txs = Vec :: < BuilderTransactionCtx > :: new ( ) ;
585586
586- if !self . registered . get ( ) . unwrap_or ( & false ) {
587+ if !self . registered . load ( std :: sync :: atomic :: Ordering :: SeqCst ) {
587588 info ! ( target: "flashtestations" , "tee service not registered yet, attempting to register" ) ;
588589 builder_txs. extend ( self . fund_tee_service_tx ( ctx, & mut evm) ?) ;
589590 let ( register_tx, _) = self . register_tee_service_tx ( ctx, & mut evm) ?;
0 commit comments