types, rawdb, p2p, stagedsync: distinguish empty BALs - #22914
Merged
Conversation
taratorio
marked this pull request as ready for review
July 31, 2026 12:04
taratorio
requested review from
AskAlexSharov,
mh0lt,
sudeepdino008 and
yperbasis
as code owners
July 31, 2026 12:04
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refines Erigon’s EIP-7928 Block Access List (BAL) handling by separating “commitment field is present” from “commitment is non-empty”, allowing empty BAL commitments (canonical 0xc0) to be treated as present while still avoiding unnecessary DB/network work for consumers that only benefit from non-empty BALs.
Changes:
- Redefines
Header.HasBAL()to mean “BAL commitment field present” and introducesHeader.HasNonEmptyBAL()to mean “commitment is not the canonical empty-list hash”. - Updates staged sync execution (
exec3) and backward downloader BAL request selection to useHasNonEmptyBAL()to skip work for empty commitments. - Preserves faithful block reconstruction in
rawdb.ReadBlock(including stored empty BAL sidecars) and adds regression tests covering missing/empty/non-empty commitment states and call sites.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| execution/types/block.go | Redefines HasBAL() semantics (presence) and adds HasNonEmptyBAL() (non-empty commitment). |
| execution/types/block_access_list_test.go | Adds tests validating HasBAL() vs HasNonEmptyBAL() behavior for missing/empty/non-empty commitments. |
| execution/stagedsync/exec3.go | Adds blockAccessListBytes helper and switches exec path to avoid DB reads for empty commitments. |
| execution/stagedsync/exec3_bal_test.go | Adds tests ensuring stagedsync skips DB reads when BAL field is missing or commitment is empty. |
| execution/p2p/bbd.go | Skips backward BAL requests for empty commitments by switching to HasNonEmptyBAL(). |
| db/rawdb/accessors_chain.go | Uses header.HasBAL() to ensure empty BAL sidecars are preserved on block reconstruction. |
| db/rawdb/accessors_chain_test.go | Adds regression test ensuring ReadBlock loads stored empty BAL bytes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
AskAlexSharov
approved these changes
Jul 31, 2026
taratorio
enabled auto-merge
July 31, 2026 15:02
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #22894 addressing the staged-sync review comment and the rawdb review comment.
The original
Header.HasBAL()predicate conflated two states: whether the BAL commitment field is present and whether it commits to a non-empty BAL. Those meanings need different behavior for a canonical empty BAL encoded as0xc0.This change:
Header.HasBAL()as presence of the BAL commitment field;Header.HasNonEmptyBAL()for a commitment other than the canonical empty-list hash;HasNonEmptyBAL()in staged sync and backward BAL fetching to avoid unnecessary database and network work;rawdb.ReadBlockonHasBAL()so a stored empty0xc0sidecar is preserved;TestAssembleBlockWithFreshlyAddedTxnswait for observed txpool polls instead of a fixed delay.This keeps block reconstruction faithful while retaining the intended optimization for BAL consumers that do not need an empty sidecar. The builder-test change removes timing dependence and does not change production block-building behavior.
TDD note: the CI stabilization is a test-only synchronization refactor, so no production behavior was changed. The failed race-test job is the original red signal.
Validation:
go test ./execution/types ./db/rawdb ./execution/stagedsync ./execution/p2p -count=1go test ./execution/stagedsync ./execution/execmodule -run '^(TestBlockAccessListBytes|TestAssembleBlockWithFreshlyAddedTxns)$' -count=20ERIGON_EXEC3_PARALLEL=true GOMAXPROCS=4 go test -race -timeout=10m ./execution/stagedsync ./execution/execmodule -run '^(TestBlockAccessListBytes|TestAssembleBlockWithFreshlyAddedTxns)$' -count=50ERIGON_EXEC3_PARALLEL=true GOMAXPROCS=4 go test -race -timeout=60m ./execution/execmodule -count=3go test ./execution/stagedsync ./execution/execmodule -count=1make lint(four consecutive clean runs)make erigon integration