Skip to content

Commit

Permalink
Merge branch 'fix/sidecar/local-blob' of github.com:chainbound/bolt-v…
Browse files Browse the repository at this point in the history
…0 into fix/sidecar/local-blob
  • Loading branch information
merklefruit committed Jul 21, 2024
2 parents 165bf45 + 66d3b0b commit 14f98a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bolt-sidecar/src/api/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
10 changes: 7 additions & 3 deletions bolt-sidecar/src/builder/payload_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -91,7 +92,6 @@ pub struct Hints {
pub gas_used: Option<u64>,
pub receipts_root: Option<B256>,
pub logs_bloom: Option<Bloom>,
pub blob_gas_used: Option<u64>,
pub state_root: Option<B256>,
pub block_hash: Option<B256>,
}
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -374,7 +379,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 {
Expand All @@ -394,7 +398,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(),
Expand Down

0 comments on commit 14f98a6

Please sign in to comment.