Skip to content

Fix kStructurallyValidValue validation downgrade after reboot#5348

Merged
sisuresh merged 1 commit into
stellar:masterfrom
bboston7:pd-persistence
Jul 24, 2026
Merged

Fix kStructurallyValidValue validation downgrade after reboot#5348
sisuresh merged 1 commit into
stellar:masterfrom
bboston7:pd-persistence

Conversation

@bboston7

Copy link
Copy Markdown
Contributor

Closes #5339.

Fixes a bug by which values that were considered "structurally valid" could be downgraded to "invalid" on a reboot due to the loss of the in-memory state tracking of whether transaction sets were requested or not.

The solution is simple: value validation should not depend on tx set request status. That is, whether a value is "structurally valid" or "invalid" should not change based on whether the node has requested a referenced transaction set or not.

Copilot AI review requested due to automatic review settings July 14, 2026 22:59

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

This PR fixes a restart-related SCP validation bug where a value that is structurally valid (but references a missing/invalid tx set) could be reclassified as invalid after reboot due to loss of in-memory tx set fetch state. The fix makes structural validity depend on protocol capability (empty-tx-set support) rather than tx set request/waiting-time state, and adds a regression test covering SCP state restore with a missing tx set.

Changes:

  • Update HerderSCPDriver::validateValueAgainstLocalState so missing tx sets are treated as kStructurallyValidValue whenever the protocol supports empty-tx-set values (instead of depending on tx set fetch waiting-time state).
  • Clarify the comment in BallotProtocol::maybeReplaceValueWithEmptyTxSet about why values without an active download wait can be converted to empty-tx-set values.
  • Add a new herder test that persists SCP state referencing a fake/missing tx set, restarts, and verifies the node treats the value as structurally valid and can advance by switching to the empty-tx-set value.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/scp/BallotProtocol.cpp Clarifies rationale when replacing a structurally-valid-but-unavailable value with an empty-tx-set value.
src/herder/HerderSCPDriver.cpp Removes dependence on tx set fetch waiting-time state when determining structural validity for missing tx sets.
src/herder/test/HerderTests.cpp Adds regression coverage for SCP state restore when a referenced tx set is missing after restart.

Comment thread src/herder/test/HerderTests.cpp
@bboston7
bboston7 requested a review from marta-lokhova July 16, 2026 22:09
Comment thread src/herder/HerderSCPDriver.cpp
marta-lokhova
marta-lokhova previously approved these changes Jul 23, 2026
Closes stellar#5339.

Fixes a bug by which values that were considered "structurally valid"
could be downgraded to "invalid" on a reboot due to the loss of the
in-memory state tracking of whether transaction sets were requested or
not.

The solution is simple: value validation should not depend on tx set
request status. That is, whether a value is "structurally valid" or
"invalid" should not change based on whether the node has requested a
referenced transaction set or not.
@marta-lokhova
marta-lokhova added this pull request to the merge queue Jul 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 23, 2026
@sisuresh
sisuresh added this pull request to the merge queue Jul 23, 2026
Merged via the queue into stellar:master with commit c1706b6 Jul 24, 2026
54 checks passed
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.

Value validation can downgrade a structurally valid value to an invalid one on reboot

4 participants