Skip to content

Commit da944d4

Browse files
authored
Backport: Check the block height before the epoch in process_timeout (#4811) (#4813)
## Motivation When processing a timeout, we check whether the epoch of the certificate is correct before checking whether the height is correct - this may lead to spurious `InvalidEpoch` errors. ## Proposal Validate the height first. This is the backport of #4811 to the testnet branch. ## Test Plan CI ## Release Plan - Nothing to do ## Links - [reviewer checklist](https://github.com/linera-io/linera-protocol/blob/main/CONTRIBUTING.md#reviewer-checklist)
1 parent 9ca3e8b commit da944d4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

linera-core/src/chain_worker/state.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -562,14 +562,6 @@ where
562562
// Verify the certificate. Returns a catch-all error to make client code more robust.
563563
self.initialize_and_save_if_needed().await?;
564564
let (chain_epoch, committee) = self.chain.current_committee()?;
565-
ensure!(
566-
certificate.inner().epoch() == chain_epoch,
567-
WorkerError::InvalidEpoch {
568-
chain_id: certificate.inner().chain_id(),
569-
chain_epoch,
570-
epoch: certificate.inner().epoch()
571-
}
572-
);
573565
certificate.check(committee)?;
574566
if self
575567
.chain
@@ -579,6 +571,14 @@ where
579571
{
580572
return Ok((self.chain_info_response(), NetworkActions::default()));
581573
}
574+
ensure!(
575+
certificate.inner().epoch() == chain_epoch,
576+
WorkerError::InvalidEpoch {
577+
chain_id: certificate.inner().chain_id(),
578+
chain_epoch,
579+
epoch: certificate.inner().epoch()
580+
}
581+
);
582582
let old_round = self.chain.manager.current_round();
583583
self.chain
584584
.manager

0 commit comments

Comments
 (0)