Skip to content

Commit

Permalink
[checkpoint] Log error when fork (MystenLabs#5271)
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind authored Oct 17, 2022
1 parent ab99c73 commit 74180e5
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions crates/sui-core/src/checkpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -775,10 +775,22 @@ impl CheckpointStore {
committee: &Committee,
) -> SuiResult {
checkpoint.verify(committee, None)?;
debug_assert!(matches!(
self.latest_stored_checkpoint(),
Some(AuthenticatedCheckpoint::Signed(_))
));
match self.latest_stored_checkpoint() {
Some(AuthenticatedCheckpoint::Signed(s)) => {
if s.summary != checkpoint.summary {
error!(
cp_seq=checkpoint.summary.sequence_number,
"Local signed checkpoint is not the same as the checkpoint cert. Most likely local checkpoint has forked. cert: {}, local signed: {}",
checkpoint.summary,
s.summary,
);
panic!();
}
}
_ => {
unreachable!("Can never call promote_signed_checkpoint_to_cert when there is no signed checkpoint locally");
}
}
let seq = checkpoint.summary.sequence_number();
self.tables
.checkpoints
Expand Down

0 comments on commit 74180e5

Please sign in to comment.