@@ -32,7 +32,7 @@ macro_rules! spawn_provider_send {
3232 let p = $provider. clone( ) ;
3333 let t = $tx. clone( ) ;
3434 tokio:: spawn( async move {
35- p. send_tx_envelope( t) . await . inspect_err( |e| {
35+ p. send_tx_envelope( t) . in_current_span ( ) . await . inspect_err( |e| {
3636 warn!( %e, "error in transaction broadcast" )
3737 } )
3838 } . instrument( $span. clone( ) ) )
@@ -44,17 +44,13 @@ macro_rules! spawn_provider_send {
4444macro_rules! check_slot_still_valid {
4545 ( $self: expr, $initial_slot: expr, $span: expr) => {
4646 if !$self. slot_still_valid( $initial_slot) {
47- $span. in_scope( || {
48- debug!(
49- current_slot = $self
50- . config
51- . slot_calculator
52- . current_slot( )
53- . expect( "host chain has started" ) ,
54- initial_slot = $initial_slot,
55- "slot changed before submission - skipping block"
56- )
57- } ) ;
47+ span_debug!(
48+ $span,
49+ current_slot =
50+ $self. config. slot_calculator. current_slot( ) . expect( "host chain has started" ) ,
51+ initial_slot = $initial_slot,
52+ "slot changed before submission - skipping block"
53+ ) ;
5854 counter!( "builder.slot_missed" ) . increment( 1 ) ;
5955 return Ok ( ControlFlow :: Skip ) ;
6056 }
@@ -115,7 +111,7 @@ impl BuilderHelperTask {
115111 // Set up a span for the send operation. We'll add this to the spawned
116112 // tasks
117113 let span = debug_span ! ( "BuilderHelperTask::send_transaction" , tx_hash = %tx. hash( ) ) ;
118- span_scoped ! ( span, debug! ( "sending transaction to network" ) ) ;
114+ span_debug ! ( span, "sending transaction to network" ) ;
119115
120116 // send the tx via the primary host_provider
121117 let fut = spawn_provider_send ! ( self . provider( ) , & tx, & span) ;
@@ -127,30 +123,29 @@ impl BuilderHelperTask {
127123
128124 // send the in-progress transaction over the outbound_tx_channel
129125 if self . outbound_tx_channel . send ( * tx. tx_hash ( ) ) . is_err ( ) {
130- span_scoped ! ( span, error! ( "receipts task gone" ) ) ;
126+ span_error ! ( span, "receipts task gone" ) ;
131127 }
132128
133129 if let Err ( error) = fut. await ? {
134130 // Detect and handle transaction underprice errors
135131 if matches ! ( error, TransportError :: ErrorResp ( ref err) if err. code == -32603 ) {
136- span_scoped ! (
132+ span_debug ! (
137133 span,
138- debug!( %error, "underpriced transaction error - retrying tx with gas bump" )
134+ %error,
135+ "underpriced transaction error - retrying tx with gas bump"
139136 ) ;
140137 return Ok ( ControlFlow :: Retry ) ;
141138 }
142139
143140 // Unknown error, log and skip
144- span_scoped ! ( span, error! ( %error, "Primary tx broadcast failed" ) ) ;
141+ span_error ! ( span, %error, "Primary tx broadcast failed" ) ;
145142 return Ok ( ControlFlow :: Skip ) ;
146143 }
147144
148- span_scoped ! (
145+ span_info ! (
149146 span,
150- info!(
151147 tx_hash = %tx. tx_hash( ) ,
152148 "dispatched to network"
153- )
154149 ) ;
155150
156151 Ok ( ControlFlow :: Done )
@@ -190,9 +185,7 @@ impl BuilderHelperTask {
190185 . send_transaction ( req)
191186 . instrument ( span. clone ( ) )
192187 . await
193- . inspect_err ( |error| {
194- span_scoped ! ( span, error!( %error, "error sending transaction" ) )
195- } )
188+ . inspect_err ( |error| span_error ! ( span, %error, "error sending transaction" ) )
196189 . unwrap_or ( ControlFlow :: Retry ) ;
197190
198191 let guard = span. entered ( ) ;
@@ -261,11 +254,11 @@ impl BuilderHelperTask {
261254
262255 let span = sim_result. sim_env . span . clone ( ) ;
263256
264- span_scoped ! ( span, debug! ( "submit channel received block" ) ) ;
257+ span_debug ! ( span, "submit channel received block" ) ;
265258
266259 // Don't submit empty blocks
267260 if sim_result. block . is_empty ( ) {
268- span_scoped ! ( span, debug! ( "received empty block - skipping" ) ) ;
261+ span_debug ! ( span, "received empty block - skipping" ) ;
269262 continue ;
270263 }
271264
0 commit comments