enforce block-snapshots cap inside aggregator collation#20852
Open
sudeepdino008 wants to merge 3 commits intorelease/3.4from
Open
enforce block-snapshots cap inside aggregator collation#20852sudeepdino008 wants to merge 3 commits intorelease/3.4from
sudeepdino008 wants to merge 3 commits intorelease/3.4from
Conversation
61d15bd to
f080791
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR moves the “max collatable txNum” cap enforcement from call sites into the state Aggregator, so state collation can’t advance past block snapshot progress (addressing the BuildFilesInBackground loophole noted in #20701). It introduces a SetFrozenBlocksProvider hook to let the aggregator query snapshot progress and applies the cap during collation readiness checks.
Changes:
- Add
FrozenBlocksProvider+SetFrozenBlocksProvidertodb/state.Aggregatorand enforce the snapshot boundary cap insidereadyForCollation. - Wire the provider in main entry points (node backend setup, integration snapshots, retire command).
- Remove external capping logic in
ExecV3andsnapshots_cmd, and add regression tests coveringBuildFiles/BuildFiles2cap behavior.
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 |
|---|---|
| node/eth/backend.go | Wires SetFrozenBlocksProvider(blockReader) during block reader/aggregator setup. |
| execution/stagedsync/exec3.go | Removes call-site max-collatable capping; relies on aggregator internal enforcement. |
| db/test/aggregator_ext_test.go | Adds regression tests ensuring BuildFiles/BuildFiles2 respect the cap and that nil/low-cap behavior is safe. |
| db/state/aggregator.go | Introduces FrozenBlocksProvider, stores it on the aggregator, and enforces the cap in readyForCollation. |
| db/services/snapshot_progress.go | Updates doc comment to reflect that the aggregator enforces the cap internally. |
| cmd/utils/app/snapshots_cmd.go | Wires provider for retire flow and removes explicit MaxCollatableTxNum capping of lastTxNum. |
| cmd/integration/commands/stages.go | Wires provider in allSnapshots() integration setup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
lastTxNumInDbetc.)SetFrozenBlocksProviderwhich is called to find block snapshots progress, and use it to cap the state collation.