@@ -11,6 +11,7 @@ use alloy::{
1111 rpc:: types:: TransactionRequest ,
1212 sol_types:: SolCall ,
1313} ;
14+ use futures_util:: FutureExt ;
1415use init4_bin_base:: deps:: metrics:: counter;
1516use signet_sim:: BuiltBlock ;
1617use signet_types:: { SignRequest , SignResponse } ;
@@ -103,14 +104,13 @@ impl<'a> SubmitPrep<'a> {
103104 }
104105
105106 /// Encodes the rollup block into a sidecar.
107+ #[ instrument( skip( self ) , level = "debug" ) ]
106108 async fn build_sidecar ( & self ) -> eyre:: Result < BlobTransactionSidecar > {
107- let sidecar = self . block . encode_blob :: < SimpleCoder > ( ) . build ( ) ?;
108-
109- Ok ( sidecar)
109+ self . block . encode_blob :: < SimpleCoder > ( ) . build ( ) . map_err ( Into :: into)
110110 }
111111
112112 /// Build a signature and header input for the host chain transaction.
113- async fn build_input ( & self ) -> eyre:: Result < Vec < u8 > > {
113+ async fn build_input ( & self ) -> eyre:: Result < Bytes > {
114114 let ( v, r, s) = self . quincey_signature ( ) . await ?;
115115
116116 let header = Zenith :: BlockHeader {
@@ -120,19 +120,21 @@ impl<'a> SubmitPrep<'a> {
120120 rewardAddress : self . sig_request ( ) . ru_reward_address ,
121121 blockDataHash : * self . block . contents_hash ( ) ,
122122 } ;
123- debug ! ( ?header. hostBlockNumber, "built zenith block header" ) ;
124-
125- let data = Zenith :: submitBlockCall { header, v, r, s, _4 : Bytes :: new ( ) } . abi_encode ( ) ;
123+ let call = Zenith :: submitBlockCall { header, v, r, s, _4 : Bytes :: new ( ) } ;
126124
127- Ok ( data )
125+ Ok ( call . abi_encode ( ) . into ( ) )
128126 }
129127
130128 /// Create a new transaction request for the host chain.
131129 async fn new_tx_request ( & self ) -> eyre:: Result < TransactionRequest > {
132- let nonce =
133- self . provider . get_transaction_count ( self . provider . default_signer_address ( ) ) . await ?;
130+ let nonce_fut = self
131+ . provider
132+ . get_transaction_count ( self . provider . default_signer_address ( ) )
133+ . into_future ( )
134+ . map ( |res| res. map_err ( Into :: into) ) ;
134135
135- let ( sidecar, input) = try_join ! ( self . build_sidecar( ) , self . build_input( ) ) ?;
136+ let ( nonce, sidecar, input) =
137+ try_join ! ( nonce_fut, self . build_sidecar( ) , self . build_input( ) ) ?;
136138
137139 let tx = TransactionRequest :: default ( )
138140 . with_blob_sidecar ( sidecar)
@@ -144,7 +146,6 @@ impl<'a> SubmitPrep<'a> {
144146 }
145147
146148 /// Prepares a transaction for submission to the host chain.
147- #[ instrument( skip_all, level = "debug" ) ]
148149 pub async fn prep_transaction ( self , prev_host : & Header ) -> eyre:: Result < Bumpable > {
149150 let req = self . new_tx_request ( ) . in_current_span ( ) . await ?;
150151 Ok ( Bumpable :: new ( req, prev_host) )
0 commit comments