Skip to content

Commit

Permalink
Correct panic possible when jumping to a round with Precommit(None)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Oct 18, 2023
1 parent 9accddb commit 041ed46
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions coordinator/tributary/tendermint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -544,15 +544,17 @@ impl<N: Network + 'static> TendermintMachine<N> {
}
}

// Returns Ok(true) if this was a Precommit which had its signature validated
// Returns Ok(true) if this was a Precommit which had either no signature or its signature
// validated
// Returns Ok(false) if it wasn't a Precommit or the signature wasn't validated yet
// Returns Err if the signature was invalid
fn verify_precommit_signature(
&self,
signed: &SignedMessageFor<N>,
) -> Result<bool, TendermintError<N>> {
let msg = &signed.msg;
if let Data::Precommit(Some((id, sig))) = &msg.data {
if let Data::Precommit(precommit) = &msg.data {
let Some((id, sig)) = precommit else { return Ok(true) };
// Also verify the end_time of the commit
// Only perform this verification if we already have the end_time
// Else, there's a DoS where we receive a precommit for some round infinitely in the future
Expand Down

0 comments on commit 041ed46

Please sign in to comment.