Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the correct validated state on restart #1482

Merged
merged 1 commit into from
May 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion sequencer/src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,14 @@ pub trait SequencerPersistence: Sized + Send + Sync + 'static {
(Leaf::genesis(&state), QuorumCertificate::genesis(&state))
}
};
let validated_state = Some(Arc::new(ValidatedState::genesis(&state).0));
let validated_state = if leaf.get_block_header().height == 0 {
// If we are starting from genesis, we can provide the full state.
Some(Arc::new(ValidatedState::genesis(&state).0))
} else {
// Otherwise, we will have to construct a sparse state and fetch missing data during
// catchup.
None
};

// If we are not starting from genesis, we start from the view following the maximum view
// between `highest_voted_view` and `leaf.view_number`. This prevents double votes from
Expand All @@ -161,6 +168,7 @@ pub trait SequencerPersistence: Sized + Send + Sync + 'static {
?leaf,
?view,
?high_qc,
?validated_state,
?undecided_leaves,
?undecided_state,
"loaded consensus state"
Expand Down
Loading