Skip to content

Commit

Permalink
Verify epoch before processing cert (MystenLabs#6134)
Browse files Browse the repository at this point in the history
  • Loading branch information
mystenmark authored Nov 15, 2022
1 parent 5d467bd commit 384dc62
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/sui-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,17 @@ impl AuthorityState {
certificate: &VerifiedCertificate,
mut bypass_validator_halt: bool,
) -> SuiResult<VerifiedTransactionInfoResponse> {
// Any caller that verifies the signatures on the certificate will have already checked the
// epoch. But paths that don't verify sigs (e.g. execution from checkpoint, reading from db)
// present the possibility of an epoch mismatch.
if certificate.epoch() != self.epoch() {
tx_guard.release();
return Err(SuiError::WrongEpoch {
expected_epoch: self.epoch(),
actual_epoch: certificate.epoch(),
});
}

let digest = *certificate.digest();
// The cert could have been processed by a concurrent attempt of the same cert, so check if
// the effects have already been written.
Expand Down

0 comments on commit 384dc62

Please sign in to comment.