Skip to content

Conversation

DavePearce
Copy link
Collaborator

@DavePearce DavePearce commented Oct 16, 2025

Note

Make parentBeaconBlockRoot optional hex in BlockHeaderSnapshot, add Sepolia Prague test config, and select mining beneficiary by fork (post-Shanghai uses coinbase).

  • Block capture / snapshots:
    • Convert BlockHeaderSnapshot.parentBeaconBlockRoot from Bytes32 to Optional<String> and serialize as hex via map(Bytes::toHexString).
    • In toBlockHeader(), set parentBeaconBlockRoot only when present (Bytes32.fromHexString(...)); keep CliqueBlockHeaderFunctions setup.
  • Testing / replay:
    • Determine mining beneficiary by fork: post-Shanghai uses header.getCoinbase(), otherwise CliqueHelpers.getProposerOfBlock(...).
  • Chain config:
    • Add SEPOLIA_TESTCONFIG(fork) and SEPOLIA_PRAGUE_TESTCONFIG for Prague on Sepolia.

Written by Cursor Bugbot for commit add5f6a. This will update automatically on new commits. Configure here.

This changes the type of the field parentBeaconBlockRoot in
BlockHeaderSnapshot to be an (optional) String instead of a Bytes32
instance.  This is to avoid decoding issues because the GSONDecoder is
not aware of the Bytes32 type.
The clique consensus protocol was only used prior to shanghai, hence we
cannot extract key information from block headers generated from
Shanghai nodes and onwards.
@DavePearce DavePearce linked an issue Oct 16, 2025 that may be closed by this pull request
this.baseFee.ifPresent(baseFee -> builder.baseFee(Wei.fromHexString(baseFee)));

this.parentBeaconBlockRoot.ifPresent(
root -> builder.parentBeaconBlockRoot(Bytes32.fromHexString(root)));
Copy link

Choose a reason for hiding this comment

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

Bug: Block Header Inconsistency Due to Null Handling

The toBlockHeader method now conditionally sets parentBeaconBlockRoot. If the root is empty, the builder method isn't called, which differs from the original code that explicitly passed null. This can cause the BlockHeaderBuilder to treat the field as "not set" instead of "set to null," leading to inconsistent header reconstruction and potentially breaking round-trip conversion.

Fix in Cursor Fix in Web

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.

fix: BlockHeaderSnapshot

2 participants