Repository navigation
Fix replay over empty-tx-set ledgers - #5355
Merged
Merged
Conversation
`ApplyCheckpointWork` contained a check that the transaction set hash of the transaction set to apply exactly matches the one specified in a ledger header. With CAP-83 however, there is one case where this is not true. An empty-tx-set ledger will have an all zeros hash in the ledger header, but the actual constructed empty transaction set will have a different hash. This PR fixes the check to properly handle empty-tx-set ledgers. It also adds a few additional checks that an empty-tx-set ledger is well-formed. I audited the code for other places where I may have missed these checks in the original CAP-83 PR, and this is the only one I found.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates history replay to support CAP-83 empty-transaction-set ledgers while rejecting malformed variants.
Changes:
- Accepts valid empty-tx-set hash/content-hash differences during replay.
- Validates empty-tx-set metadata, protocol support, and transaction count.
- Adds offline, online, and malformed-history catchup tests.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/catchup/ApplyCheckpointWork.cpp |
Adds CAP-83 replay validation. |
src/history/test/HistoryTests.cpp |
Adds catchup and malformed-history tests. |
src/history/test/HistoryTestsUtils.cpp |
Generates synthetic empty-tx-set ledgers. |
src/history/test/HistoryTestsUtils.h |
Declares the new test helper. |
marta-lokhova
approved these changes
Jul 17, 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.
ApplyCheckpointWorkcontained a check that the transaction set hash of the transaction set to apply exactly matches the one specified in a ledger header. With CAP-83 however, there is one case where this is not true. An empty-tx-set ledger will have an all zeros hash in the ledger header, but the actual constructed empty transaction set will have a different hash. This PR fixes the check to properly handle empty-tx-set ledgers. It also adds a few additional checks that an empty-tx-set ledger is well-formed.I audited the code for other places where I may have missed these checks in the original CAP-83 PR, and this is the only one I found.