Skip to content

Fix replay over empty-tx-set ledgers - #5355

Merged
marta-lokhova merged 1 commit into
stellar:masterfrom
bboston7:pd-catchup
Jul 17, 2026
Merged

marta-lokhova merged 1 commit into
stellar:masterfrom
bboston7:pd-catchup

Conversation

@bboston7

Copy link
Copy Markdown
Contributor

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.

`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.
Copilot AI review requested due to automatic review settings July 16, 2026 22:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread src/history/test/HistoryTests.cpp Resolved
@bboston7
bboston7 requested a review from marta-lokhova July 17, 2026 16:44
@marta-lokhova
marta-lokhova added this pull request to the merge queue Jul 17, 2026
Merged via the queue into stellar:master with commit 8612ca3 Jul 17, 2026
114 of 122 checks passed
@bboston7
bboston7 deleted the pd-catchup branch July 20, 2026 16:39
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.

3 participants