diff --git a/bolt-sidecar/src/api/builder.rs b/bolt-sidecar/src/api/builder.rs index 1864d0ee4..98cdf9520 100644 --- a/bolt-sidecar/src/api/builder.rs +++ b/bolt-sidecar/src/api/builder.rs @@ -168,7 +168,7 @@ where meta: Default::default(), }; - tracing::info!(elapsed = ?start.elapsed(), %hash, number, "Returning locally built header"); + tracing::info!(elapsed = ?start.elapsed(), %hash, number, ?versioned_bid, "Returning locally built header"); Ok(Json(versioned_bid)) } diff --git a/bolt-sidecar/src/builder/payload_builder.rs b/bolt-sidecar/src/builder/payload_builder.rs index c5f9e4279..56a506636 100644 --- a/bolt-sidecar/src/builder/payload_builder.rs +++ b/bolt-sidecar/src/builder/payload_builder.rs @@ -76,6 +76,7 @@ impl FallbackPayloadBuilder { pub struct Context { extra_data: Bytes, base_fee: u64, + blob_gas_used: u64, excess_blob_gas: u64, prev_randao: B256, fee_recipient: Address, @@ -91,7 +92,6 @@ pub struct Hints { pub gas_used: Option, pub receipts_root: Option, pub logs_bloom: Option, - pub blob_gas_used: Option, pub state_root: Option, pub block_hash: Option, } @@ -173,8 +173,13 @@ impl FallbackPayloadBuilder { latest_block.header.blob_gas_used.unwrap_or_default(), ) as u64; + let blob_gas_used = transactions + .iter() + .fold(0, |acc, tx| acc + tx.blob_gas_used().unwrap_or_default()); + let ctx = Context { base_fee, + blob_gas_used, excess_blob_gas, parent_beacon_block_root, prev_randao, @@ -359,7 +364,6 @@ pub(crate) fn build_header_with_hints_and_context( let gas_used = hints.gas_used.unwrap_or_default(); let receipts_root = hints.receipts_root.unwrap_or_default(); let logs_bloom = hints.logs_bloom.unwrap_or_default(); - let blob_gas_used = hints.blob_gas_used.unwrap_or_default(); let state_root = hints.state_root.unwrap_or_default(); Header { @@ -379,7 +383,7 @@ pub(crate) fn build_header_with_hints_and_context( mix_hash: context.prev_randao, nonce: BEACON_NONCE, base_fee_per_gas: Some(context.base_fee), - blob_gas_used: Some(blob_gas_used), + blob_gas_used: Some(context.blob_gas_used), excess_blob_gas: Some(context.excess_blob_gas), parent_beacon_block_root: Some(context.parent_beacon_block_root), extra_data: context.extra_data.clone(),