@@ -4,7 +4,7 @@ use crate::{
44 utils,
55} ;
66use alloy:: {
7- consensus:: { Header , SimpleCoder } ,
7+ consensus:: { BlobTransactionSidecar , Header , SimpleCoder } ,
88 network:: { TransactionBuilder , TransactionBuilder4844 } ,
99 primitives:: { B256 , Bytes , U256 } ,
1010 providers:: { Provider , WalletProvider } ,
@@ -15,6 +15,7 @@ use init4_bin_base::deps::metrics::counter;
1515use signet_sim:: BuiltBlock ;
1616use signet_types:: { SignRequest , SignResponse } ;
1717use signet_zenith:: Zenith ;
18+ use tokio:: try_join;
1819use tracing:: { Instrument , debug, error, instrument, warn} ;
1920
2021/// Preparation logic for transactions issued to the host chain by the
@@ -101,8 +102,15 @@ impl<'a> SubmitPrep<'a> {
101102 self . quincey_resp ( ) . await . map ( |resp| & resp. sig ) . map ( utils:: extract_signature_components)
102103 }
103104
104- /// Encodes the sidecar and then builds the 4844 blob transaction from the provided header and signature values.
105- async fn build_blob_tx ( & self ) -> eyre:: Result < TransactionRequest > {
105+ /// Encodes the rollup block into a sidecar.
106+ async fn build_sidecar ( & self ) -> eyre:: Result < BlobTransactionSidecar > {
107+ let sidecar = self . block . encode_blob :: < SimpleCoder > ( ) . build ( ) ?;
108+
109+ Ok ( sidecar)
110+ }
111+
112+ /// Build a signature and header input for the host chain transaction.
113+ async fn build_input ( & self ) -> eyre:: Result < Vec < u8 > > {
106114 let ( v, r, s) = self . quincey_signature ( ) . await ?;
107115
108116 let header = Zenith :: BlockHeader {
@@ -116,21 +124,19 @@ impl<'a> SubmitPrep<'a> {
116124
117125 let data = Zenith :: submitBlockCall { header, v, r, s, _4 : Bytes :: new ( ) } . abi_encode ( ) ;
118126
119- let sidecar = self . block . encode_blob :: < SimpleCoder > ( ) . build ( ) ?;
120-
121- Ok ( TransactionRequest :: default ( ) . with_blob_sidecar ( sidecar) . with_input ( data) )
127+ Ok ( data)
122128 }
123129
130+ /// Create a new transaction request for the host chain.
124131 async fn new_tx_request ( & self ) -> eyre:: Result < TransactionRequest > {
125132 let nonce =
126133 self . provider . get_transaction_count ( self . provider . default_signer_address ( ) ) . await ?;
127134
128- debug ! ( nonce , "assigned nonce to rollup block transaction" ) ;
135+ let ( sidecar , input ) = try_join ! ( self . build_sidecar ( ) , self . build_input ( ) ) ? ;
129136
130- // Create a blob transaction with the blob header and signature values and return it
131- let tx = self
132- . build_blob_tx ( )
133- . await ?
137+ let tx = TransactionRequest :: default ( )
138+ . with_blob_sidecar ( sidecar)
139+ . with_input ( input)
134140 . with_to ( self . config . constants . host_zenith ( ) )
135141 . with_nonce ( nonce) ;
136142
0 commit comments