@@ -139,6 +139,7 @@ impl SubmitTask {
139
139
// Retry loop
140
140
let result = loop {
141
141
let span = debug_span ! (
142
+ parent: None ,
142
143
"SubmitTask::retrying_send" ,
143
144
retries = bumpable. bump_count( ) ,
144
145
nonce = bumpable. req( ) . nonce,
@@ -231,11 +232,13 @@ impl SubmitTask {
231
232
let host_block_number = self . constants . rollup_block_to_host_block_num ( ru_block_number) ;
232
233
233
234
let span = debug_span ! (
234
- "SubmitTask::loop" ,
235
+ parent: None ,
236
+ "SubmitTask::task_future::transaction_prep" ,
235
237
ru_block_number,
236
238
host_block_number,
237
239
block_tx_count = sim_result. block. tx_count( ) ,
238
240
) ;
241
+
239
242
let guard = span. enter ( ) ;
240
243
241
244
debug ! ( ru_block_number, "submit channel received block" ) ;
@@ -249,22 +252,26 @@ impl SubmitTask {
249
252
// drop guard before await
250
253
drop ( guard) ;
251
254
255
+ // Fetch the previous host block, not the current host block which is currently being built
256
+ let prev_host_block = host_block_number - 1 ;
257
+
252
258
let Ok ( Some ( prev_host) ) = self
253
259
. provider ( )
254
- . get_block_by_number ( host_block_number . into ( ) )
260
+ . get_block_by_number ( prev_host_block . into ( ) )
255
261
. into_future ( )
256
262
. instrument ( span. clone ( ) )
257
263
. await
258
264
else {
259
- let _guard = span. enter ( ) ;
260
- warn ! ( ru_block_number, host_block_number, "failed to get previous host block" ) ;
265
+ span. in_scope ( || {
266
+ warn ! ( ru_block_number, host_block_number, "failed to get previous host block" )
267
+ } ) ;
261
268
continue ;
262
269
} ;
263
270
264
271
// Prep the span we'll use for the transaction submission
265
272
let submission_span = debug_span ! (
266
- parent: span,
267
- "SubmitTask::tx_submission " ,
273
+ parent: & span,
274
+ "SubmitTask::task_future::transaction_submission " ,
268
275
tx_count = sim_result. block. tx_count( ) ,
269
276
host_block_number,
270
277
ru_block_number,
@@ -285,7 +292,9 @@ impl SubmitTask {
285
292
{
286
293
Ok ( bumpable) => bumpable,
287
294
Err ( error) => {
288
- error ! ( %error, "failed to prepare transaction for submission" ) ;
295
+ submission_span. in_scope ( || {
296
+ error ! ( %error, "failed to prepare transaction for submission" ) ;
297
+ } ) ;
289
298
continue ;
290
299
}
291
300
} ;
@@ -294,15 +303,19 @@ impl SubmitTask {
294
303
if let Err ( error) =
295
304
self . sim_with_call ( bumpable. req ( ) ) . instrument ( submission_span. clone ( ) ) . await
296
305
{
297
- error ! ( %error, "simulation failed for transaction" ) ;
306
+ submission_span. in_scope ( || {
307
+ error ! ( %error, "simulation failed for transaction" ) ;
308
+ } ) ;
298
309
continue ;
299
310
} ;
300
311
301
312
// Now send the transaction
302
313
if let Err ( error) =
303
314
self . retrying_send ( bumpable, 3 ) . instrument ( submission_span. clone ( ) ) . await
304
315
{
305
- error ! ( %error, "error dispatching block to host chain" ) ;
316
+ submission_span. in_scope ( || {
317
+ error ! ( %error, "error dispatching block to host chain" ) ;
318
+ } ) ;
306
319
continue ;
307
320
}
308
321
}
0 commit comments