fix(l1): use current header instead of parent to get excess blob gas#5706
fix(l1): use current header instead of parent to get excess blob gas#5706MegaRedHand merged 2 commits intolambdaclass:mainfrom
Conversation
There was a problem hiding this comment.
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
GetBlobBaseFeeRPC 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.
| if header.parent_hash.is_zero() { | ||
| return Ok(receipts); | ||
| } |
There was a problem hiding this comment.
I think this check might also be wrong. Doesn't the genesis block also include its own transactions which might create receipts?
There was a problem hiding this comment.
i think genesis blocks don't have receipts
There was a problem hiding this comment.
This. We don't have a way to accept a genesis block with transactions:
ethrex/crates/common/types/genesis.rs
Lines 697 to 703 in 1bebff3
It'd be good to add a comment here.
edg-l
left a comment
There was a problem hiding this comment.
Tested it locally, and it fixes the test. Thanks for your contribution!
| 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(), |
There was a problem hiding this comment.
For reference, the same code in geth is: https://github.com/ryanschneider/go-ethereum/blob/13bde9bb8572898abab200be7bd1616f5650257e/eth/gasprice/feehistory.go#L97-L103
…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>
Motivation
./hive --sim ethereum/eels/execute-blobs --client ethrexfails withexecution_testing.rpc.rpc_types.JSONRPCError: JSONRPCError(code=-32603, message=Internal Error: Parent block not found).excess_blob_gasis 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