Skip to content

fix(l1): use current header instead of parent to get excess blob gas#5706

Merged
MegaRedHand merged 2 commits intolambdaclass:mainfrom
lakshya-sky:fix/rpc-blobs-basefee
Dec 23, 2025
Merged

fix(l1): use current header instead of parent to get excess blob gas#5706
MegaRedHand merged 2 commits intolambdaclass:mainfrom
lakshya-sky:fix/rpc-blobs-basefee

Conversation

@lakshya-sky
Copy link
Contributor

Motivation

  • ./hive --sim ethereum/eels/execute-blobs --client ethrex fails with execution_testing.rpc.rpc_types.JSONRPCError: JSONRPCError(code=-32603, message=Internal Error: Parent block not found).
  • GetBlobBaseFee is using parents header which causes to get blob base fee for genesis blocks. According to the specs excess_blob_gas is Running total of blob gas consumed in excess of the target, prior to this block.. That means we need to use latest block header only.

Description

  • use latest block header and remove accessing parent header.

Copilot AI review requested due to automatic review settings December 22, 2025 20:22
@lakshya-sky lakshya-sky requested a review from a team as a code owner December 22, 2025 20:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the blob base fee calculation in RPC handlers to correctly use the current block's excess_blob_gas instead of the parent block's value. This addresses a bug that was causing failures when executing blob-related tests against genesis blocks.

Key changes:

  • Fixed GetBlobBaseFee RPC handler to use current header's excess blob gas
  • Removed unnecessary parent header lookup and import
  • Resolved TODO comment about blob base fee calculation in receipt generation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 335 to 337
if header.parent_hash.is_zero() {
return Ok(receipts);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this check might also be wrong. Doesn't the genesis block also include its own transactions which might create receipts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think genesis blocks don't have receipts

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This. We don't have a way to accept a genesis block with transactions:

fn get_block_body(&self) -> BlockBody {
BlockBody {
transactions: vec![],
ommers: vec![],
withdrawals: Some(vec![]),
}
}

It'd be good to add a comment here.

Copy link
Contributor

@edg-l edg-l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it locally, and it fixes the test. Thanks for your contribution!

Copy link
Collaborator

@MegaRedHand MegaRedHand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

let config = context.storage.get_chain_config();
let blob_base_fee = calculate_base_fee_per_blob_gas(
parent_header.excess_blob_gas.unwrap_or_default(),
header.excess_blob_gas.unwrap_or_default(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MegaRedHand MegaRedHand added this pull request to the merge queue Dec 23, 2025
Merged via the queue into lambdaclass:main with commit 1aa9fbc Dec 23, 2025
44 checks passed
lakshya-sky added a commit to lakshya-sky/ethrex that referenced this pull request Dec 23, 2025
…ambdaclass#5706)

**Motivation**

* `./hive --sim ethereum/eels/execute-blobs --client ethrex` fails with
`execution_testing.rpc.rpc_types.JSONRPCError: JSONRPCError(code=-32603,
message=Internal Error: Parent block not found)`.
* GetBlobBaseFee is using parents header which causes to get blob base
fee for genesis blocks. According to the specs `excess_blob_gas` is
**Running total of blob gas consumed in excess of the target, prior to
this block.**. That means we need to use latest block header only.

**Description**
- use latest block header and remove accessing parent header.

Co-authored-by: lakshya-sky <lakshya-sky@users.noreply.github.com>
Co-authored-by: Edgar <git@edgl.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants