mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 02:01:06 +00:00
grandpa: fix creation of justification with equivocating precommits in commit (#11302)
* grandpa: fix creation of justification ancestry we would reject commits that have precommits targeting blocks lower than the commit target. when there is an equivocation (or if it the commit is not minimal) it is possible to have such precommits and we should assume that they are the round base. * grandpa: bump to 0.16.0 * grandpa: add test for justification with equivocation * grandpa: fix failing test
This commit is contained in:
@@ -237,7 +237,7 @@ where
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod tests {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::{authorities::AuthoritySetChanges, BlockNumberOps, ClientError, SetId};
|
||||
use futures::executor::block_on;
|
||||
@@ -271,6 +271,7 @@ pub(crate) mod tests {
|
||||
let justification: GrandpaJustification<Block> =
|
||||
Decode::decode(&mut &proof.justification[..])
|
||||
.map_err(|_| ClientError::JustificationDecode)?;
|
||||
|
||||
justification.verify(current_set_id, ¤t_authorities)?;
|
||||
|
||||
Ok(proof)
|
||||
@@ -370,7 +371,7 @@ pub(crate) mod tests {
|
||||
|
||||
#[test]
|
||||
fn finality_proof_check_fails_with_incomplete_justification() {
|
||||
let (client, _, blocks) = test_blockchain(8, &[4, 5, 8]);
|
||||
let (_, _, blocks) = test_blockchain(8, &[4, 5, 8]);
|
||||
|
||||
// Create a commit without precommits
|
||||
let commit = finality_grandpa::Commit {
|
||||
@@ -378,7 +379,9 @@ pub(crate) mod tests {
|
||||
target_number: *blocks[7].header().number(),
|
||||
precommits: Vec::new(),
|
||||
};
|
||||
let grandpa_just = GrandpaJustification::from_commit(&client, 8, commit).unwrap();
|
||||
|
||||
let grandpa_just =
|
||||
GrandpaJustification::<Block> { round: 8, votes_ancestries: Vec::new(), commit };
|
||||
|
||||
let finality_proof = FinalityProof {
|
||||
block: header(2).hash(),
|
||||
|
||||
Reference in New Issue
Block a user