From 440ece2d44866c7dec5782b5a053be44866d7e06 Mon Sep 17 00:00:00 2001 From: Vladislav Markushin Date: Wed, 15 May 2024 12:25:13 -0300 Subject: [PATCH] Weaken GRANDPA proof validation `verify_with_voter_set` function is performing additional validation that go beyond the [standard implementation](https://raw.githubusercontent.com/w3f/consensus/master/pdf/grandpa.pdf) (section 2.3), possibly leading to proofs not being accepted while valid. Instead, we need to accept all finality justifications where is_valid is true. The equivocations or other misbehaviors detected in the justifications must be handled too but not should not reject the proof. --- algorithms/grandpa/primitives/src/justification.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/algorithms/grandpa/primitives/src/justification.rs b/algorithms/grandpa/primitives/src/justification.rs index c3e0a1b16..8cb369675 100644 --- a/algorithms/grandpa/primitives/src/justification.rs +++ b/algorithms/grandpa/primitives/src/justification.rs @@ -77,14 +77,7 @@ where let ancestry_chain = AncestryChain::::new(&self.votes_ancestries); match finality_grandpa::validate_commit(&self.commit, voters, &ancestry_chain) { - Ok(ref result) if result.is_valid() => { - if result.num_duplicated_precommits() > 0 || - result.num_invalid_voters() > 0 || - result.num_equivocations() > 0 - { - Err(anyhow!("Invalid commit, found one of `duplicate precommits`, `invalid voters`, or `equivocations` {result:?}"))? - } - }, + Ok(ref result) if result.is_valid() => (), // no additional checks required err => { let result = err.map_err(|_| { anyhow!("[verify_with_voter_set] Invalid ancestry while validating commit!")