Skip to content

Do not run the view a node left when it restarts in the middle of a view change - #773

Open
HagarMeir wants to merge 1 commit into
hyperledger:mainfrom
HagarMeir:restart-in-left-view
Open

HagarMeir wants to merge 1 commit into
hyperledger:mainfrom
HagarMeir:restart-in-left-view

Conversation

@HagarMeir

Copy link
Copy Markdown
Contributor

Written by Claude (Anthropic's AI assistant) on behalf of Hagar Meir.

Part of #765.

  • When the write ahead log ends with a view change record, setViewAndSeq already restores the view change, and the node starts in the view it left. It now also calls Controller.LeaveView for that view before the controller starts, the same way the view changer does before it sends its view data.
  • Controller.startView doesn't run a view the node left. It still builds the view, because building the first view restores the node's state from the write ahead log, such as the in-flight proposal it reports in its view data. But it puts a view in its place that doesn't run: it is stopped, drops its messages, and takes the follower role. The restored view change then moves the node on as before: it sends its view data again, and the node enters the next view through a new view message or a sync.

Tests:

  • TestControllerDoesNotRunALeftStartView: a controller that starts in a view it left builds the view but doesn't start it, marks its sequence as inactive, and starts the next view when it gets to it.
  • TestSetViewAndSeqDoesNotStartALeftView: a view change record gives the start view and the restore.
  • TestRestartInTheMiddleOfAViewChange: node 4 restarts after it sent its view data, while its write ahead log still ends with the view change record. It doesn't run the view it left, and it gets to the next view. On main, it runs the view it left again.

🤖 Generated with Claude Code

…iew change

When the write ahead log ends with a view change record, setViewAndSeq
restores the view change and the node starts in the view it left. It
now also calls Controller.LeaveView for that view before the controller
starts. startView then doesn't run the view: it still builds it, which
restores the state from the write ahead log, but puts a stopped view in
its place. The restored view change moves the node on as before.

Part of hyperledger#765.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Hagar Meir <hagar.meir@ibm.com>
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.

1 participant