Skip to content

Don't move to a left view on a sync - #808

Open
HagarMeir wants to merge 1 commit into
hyperledger:mainfrom
HagarMeir:sync-skips-left-view
Open

HagarMeir wants to merge 1 commit into
hyperledger:mainfrom
HagarMeir:sync-skips-left-view

Conversation

@HagarMeir

Copy link
Copy Markdown
Contributor

When a sync collects the state of a newer view, it stops the current view and writes a new view record for the collected view. It did that also for a view the node already left, after it sent its view data for a later one. changeView then refused to start that view, so no view ran until the next view change or sync. The record also hid the view change record from a restart, after which the node could run the view it left.

Now, under the view transition lock, a sync that collects a view below minStartView doesn't stop the current view, doesn't write the record, and doesn't move to that view, as changeView already refuses to.

Fixes #799.

Written by Claude for @HagarMeir.

🤖 Generated with Claude Code

A sync that collects the state of a view the node already left no
longer stops the current view, writes a new view record for it, or
moves to it, as changeView already refuses to start a left view.

Written by Claude for @HagarMeir.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
@pfi79

pfi79 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

One thing I'm not sure about, and it is outside the lines changed here, so please treat it as a question rather than a finding.

While reading the carry path, I wondered what happens when a node restarts with an uncommitted proposal in its WAL and the cluster has already carried a different proposal at the same sequence. As I read it:

  • State.Restore brings back the old proposal with Phase set to PROPOSED/PREPARED and the old view number.
  • NewProposer then sees viewNum > view.Number, clears restoredCarried, but leaves Phase and inFlightProposal as restored.
  • The switch later hits case carried != nil && view.Phase != COMMITTED and does not use the carried proposal; startsWith stays nil.

If that is right, the node would start the new view in the old phase, broadcast the old view's prepare/commit (which peers drop), and later refuse the carried proposal at the same sequence because carriedAt is nil. That could leave the node silent for the view, and I don't see a check that resets the restored phase when the view number advances.

I may be missing a guard or a later path that clears this state, so I am not claiming this is a defect. Could you confirm whether Phase and inFlightProposal are expected to be reset when viewNum > view.Number? If not, a test with a restored PROPOSED proposal from an older view and a carried proposal for the newer view would settle it.

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.

Sync can save a new view the node already left

2 participants