Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
grandpa: fix failing test
  • Loading branch information
andresilva committed Jun 13, 2022
commit 845f43a634a926455cba65dbacd5c470da56fd8c
7 changes: 5 additions & 2 deletions client/finality-grandpa/src/finality_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ mod tests {
let justification: GrandpaJustification<Block> =
Decode::decode(&mut &proof.justification[..])
.map_err(|_| ClientError::JustificationDecode)?;

justification.verify(current_set_id, &current_authorities)?;

Ok(proof)
Expand Down Expand Up @@ -370,15 +371,17 @@ 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 {
target_hash: blocks[7].hash(),
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(),
Expand Down
4 changes: 2 additions & 2 deletions client/finality-grandpa/src/justification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ use crate::{AuthorityList, Commit, Error};
/// nodes, and are used by syncing nodes to prove authority set handoffs.
#[derive(Clone, Encode, Decode, PartialEq, Eq, Debug)]
pub struct GrandpaJustification<Block: BlockT> {
round: u64,
pub(crate) round: u64,
pub(crate) commit: Commit<Block>,
votes_ancestries: Vec<Block::Header>,
pub(crate) votes_ancestries: Vec<Block::Header>,
}

impl<Block: BlockT> GrandpaJustification<Block> {
Expand Down