@@ -417,7 +417,6 @@ impl SubmitTask {
417
417
418
418
// Retry loop
419
419
let result = loop {
420
- // Log the retry attempt
421
420
let span = debug_span ! ( "SubmitTask::retrying_handle_inbound" , retries) ;
422
421
423
422
let inbound_result =
@@ -431,6 +430,7 @@ impl SubmitTask {
431
430
debug ! ( slot_number, "403 detected - skipping slot" ) ;
432
431
return Ok ( ControlFlow :: Skip ) ;
433
432
} else {
433
+ // Otherwise, log error and retry
434
434
error ! ( error = %err, "error handling inbound block" ) ;
435
435
}
436
436
@@ -515,7 +515,7 @@ impl SubmitTask {
515
515
516
516
// Only attempt each block number once
517
517
if result. block . block_number ( ) == last_block_attempted {
518
- debug ! ( "block number is unchanged from last attempt - skipping" ) ;
518
+ debug ! ( block_number = result . block . block_number ( ) , "block number is unchanged from last attempt - skipping" ) ;
519
519
continue ;
520
520
}
521
521
@@ -541,20 +541,25 @@ impl SubmitTask {
541
541
542
542
/// Calculates gas parameters based on the block environment and retry count.
543
543
fn calculate_gas ( retry_count : usize , block_env : & BlockEnv ) -> ( u128 , u128 , u128 ) {
544
- if let Some ( blob_excess ) = block_env . blob_excess_gas_and_price {
545
- debug ! ( ?blob_excess , "using blob excess gas and price from block env" ) ;
546
- let blob_basefee = blob_excess . blob_gasprice ;
547
-
548
- let ( max_fee_per_gas , max_priority_fee_per_gas , max_fee_per_blob_gas ) =
549
- bump_gas_from_retries ( retry_count , block_env . basefee , blob_basefee ) ;
550
-
551
- ( max_fee_per_gas as u128 , max_priority_fee_per_gas as u128 , max_fee_per_blob_gas )
552
- } else {
553
- warn ! ( "no blob excess gas and price in block env, using defaults" ) ;
554
- let ( max_fee_per_gas , max_priority_fee_per_gas , max_fee_per_blob_gas ) =
555
- bump_gas_from_retries ( retry_count , block_env . basefee , 500 ) ;
544
+ let fallback_blob_basefee = 500 ;
545
+
546
+ match block_env . blob_excess_gas_and_price {
547
+ Some ( excess ) => {
548
+ if excess . blob_gasprice == 0 {
549
+ warn ! ( "blob excess gas price is zero, using default blob base fee" ) ;
550
+ return bump_gas_from_retries (
551
+ retry_count ,
552
+ block_env . basefee ,
553
+ fallback_blob_basefee ,
554
+ ) ;
555
+ }
556
556
557
- ( max_fee_per_gas as u128 , max_priority_fee_per_gas as u128 , max_fee_per_blob_gas)
557
+ bump_gas_from_retries ( retry_count, block_env. basefee , excess. blob_gasprice )
558
+ }
559
+ None => {
560
+ warn ! ( "no blob excess gas and price in block env, using defaults" ) ;
561
+ bump_gas_from_retries ( retry_count, block_env. basefee , fallback_blob_basefee)
562
+ }
558
563
}
559
564
}
560
565
@@ -563,23 +568,23 @@ pub fn bump_gas_from_retries(
563
568
retry_count : usize ,
564
569
basefee : u64 ,
565
570
blob_basefee : u128 ,
566
- ) -> ( u64 , u64 , u128 ) {
571
+ ) -> ( u128 , u128 , u128 ) {
567
572
const PRIORITY_FEE_BASE : u64 = 2 * GWEI_TO_WEI ;
568
- const BASE_MULTIPLIER : u64 = 2 ;
573
+ const BASE_MULTIPLIER : u128 = 2 ;
569
574
const BLOB_MULTIPLIER : u128 = 2 ;
570
575
571
576
// Increase priority fee by 20% per retry
572
577
let priority_fee =
573
578
PRIORITY_FEE_BASE * ( 12u64 . pow ( retry_count as u32 ) / 10u64 . pow ( retry_count as u32 ) ) ;
574
579
575
580
// Max fee includes basefee + priority + headroom (double basefee, etc.)
576
- let max_fee_per_gas = basefee * BASE_MULTIPLIER + priority_fee;
581
+ let max_fee_per_gas = ( basefee as u128 ) * BASE_MULTIPLIER + ( priority_fee as u128 ) ;
577
582
let max_fee_per_blob_gas = blob_basefee * BLOB_MULTIPLIER * ( retry_count as u128 + 1 ) ;
578
583
579
584
debug ! (
580
585
retry_count,
581
586
max_fee_per_gas, priority_fee, max_fee_per_blob_gas, "calculated bumped gas parameters"
582
587
) ;
583
588
584
- ( max_fee_per_gas, priority_fee, max_fee_per_blob_gas)
589
+ ( max_fee_per_gas as u128 , priority_fee as u128 , max_fee_per_blob_gas)
585
590
}
0 commit comments