Skip to content

Conversation

@letypequividelespoubelles
Copy link
Collaborator

@letypequividelespoubelles letypequividelespoubelles commented Sep 29, 2025

Note

Plumbs historical block-hash collection into tracing and replay: gather prior hashes, add last-block hash, and wire through BlockCapturer, ZkTracer/Hub, RPC, and tests with EIP-2935/4788 touches.

  • Blockhash tracing & replay:
    • Replace BlockHashReaper with map-based storage in Reaper; add consistency checks; include EIP-2935/4788 system-tx touches.
    • Overhaul module/blockhash to track first/last blocks, inject historical hashes, add parent-hash op, auto-emit missing historical calls, and include last-block placeholder; BlockhashOperation now uses Hash.
    • ConflationSnapshot: new from(...), historicalBlockHashes(), refined toBlockHashLookup.
  • Tracer/Hub plumbing:
    • ZkTracer and all *Hub constructors accept historical hashes and pass to Blockhash.
    • Fork.getForkFromBesuBlockchainService overload for BlockchainService.
    • ZkCounter: count blockhash lines at conflation start; fix counting loops and report unchecked modules as 0.
  • Capture/RPC:
    • CaptureToFile/GenerateConflatedTracesV2: fetch fork and historical block hashes from BlockchainService and pass to BlockCapturer/ZkTracer.
    • BlockCapturer: accept historical hashes, record end-block hash, and simplify per-opcode handling.
  • Snapshots:
    • BlockHeaderSnapshot: store parentBeaconBlockRoot as optional hex string with null-guard.
  • Tests & utilities:
    • Replay and toy environments parse conflations first, derive and pass historical hashes; add Prague Sepolia tests; adjust defaults to Prague; minor disables.

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

@letypequividelespoubelles letypequividelespoubelles linked an issue Sep 29, 2025 that may be closed by this pull request
@letypequividelespoubelles letypequividelespoubelles marked this pull request as draft September 29, 2025 13:13
cursor[bot]

This comment was marked as outdated.

@letypequividelespoubelles letypequividelespoubelles marked this pull request as ready for review October 1, 2025 04:03
cursor[bot]

This comment was marked as outdated.

Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
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.
This restores this component, whilst retaining flexibility around the
use of Map<Long,Hash>.  The goal is simply to ensure all block hashes
are stored in the JSON file as hex strings.
cursor[bot]

This comment was marked as outdated.

DavePearce and others added 8 commits October 17, 2025 16:59
Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
This puts in fixes for the methods Reaper.touchBlockHash() and also
ConflationSnapshot.from(), and applies spotless.
Signed-off-by: F Bojarski <[email protected]>
Signed-off-by: F Bojarski <[email protected]>
cursor[bot]

This comment was marked as outdated.

Signed-off-by: F Bojarski <[email protected]>
@letypequividelespoubelles letypequividelespoubelles merged commit d6d5e90 into arith-dev Oct 24, 2025
14 of 15 checks passed
@letypequividelespoubelles letypequividelespoubelles deleted the 2348-add-previous-blockhashes-to-the-conflation branch October 24, 2025 17:20
Copy link
Collaborator

@OlivierBBB OlivierBBB left a comment

Choose a reason for hiding this comment

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

Not much of a review. One potential issue in the logic wrt the keys at which the EIP4788_BEACONROOT_ADDRESS contract's storage gets probed.

final UInt256 timestamp = UInt256.valueOf(header.getTimestamp());
final UInt256 keyTimestamp = timestamp.mod(HISTORY_BUFFER_LENGTH);
conflationStorage.touch(EIP4788_BEACONROOT_ADDRESS, timestamp);
conflationStorage.touch(EIP4788_BEACONROOT_ADDRESS, keyTimestamp);
Copy link
Collaborator

Choose a reason for hiding this comment

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

The keys that are touched by 4788 system transactions are

brKey := timestamp mod 8191
tsKey := brKey + 8191

Am I misunderstanding here ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

nope, you're right

replay(OLD_MAINNET_TESTCONFIG, "4323985.mainnet.json.gz", testInfo);
}

@Disabled("Fails to create the ConflationSnapshot from the gson file")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this read json ? (Several cases in this file, but I also see gson in other places)

checkBlockHashConsistancies(e);
}

private void checkBlockHashConsistancies(BlockhashOperation op) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Typo checkBlockHashConsistencies

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.

Add previous blockhashes to the conflation

5 participants