Update bridges subtree (#2903)

* Squashed 'bridges/' changes from 0417308a48..3c4ada921b

3c4ada921b Update dependecies (#2277) (#2281)
3e195c9e76 GRANDPA: optimize votes_ancestries when needed (#2262) (#2264)
7065bbabc6 Implement RuntimeDebug for GrandpaJustification (#2254)
8c9e59bcbc Define generate_grandpa_key_ownership_proof() (#2247) (#2248)
0b46956df7 Deduplicate Grandpa consensus log reading logic (#2245) (#2246)
96c9701710 Fix deps from Cumulus (#2244)

git-subtree-dir: bridges
git-subtree-split: 3c4ada921bbdbdba945c3aa85d76ce316f7baab3

* removed extra files

* post-merge fixes

* also post-merge fixes
This commit is contained in:
Svyatoslav Nikolsky
2023-07-19 19:29:12 +03:00
committed by GitHub
parent 913b789416
commit 948f80733e
28 changed files with 391 additions and 240 deletions
@@ -38,8 +38,8 @@ type TestNumber = <TestHeader as HeaderT>::Number;
struct AncestryChain(bp_header_chain::justification::AncestryChain<TestHeader>);
impl AncestryChain {
fn new(ancestry: &[TestHeader]) -> Self {
Self(bp_header_chain::justification::AncestryChain::new(ancestry))
fn new(justification: &GrandpaJustification<TestHeader>) -> Self {
Self(bp_header_chain::justification::AncestryChain::new(justification))
}
}
@@ -55,9 +55,9 @@ impl finality_grandpa::Chain<TestHash, TestNumber> for AncestryChain {
if current_hash == base {
break
}
match self.0.parents.get(&current_hash).cloned() {
match self.0.parents.get(&current_hash) {
Some(parent_hash) => {
current_hash = parent_hash;
current_hash = *parent_hash;
route.push(current_hash);
},
_ => return Err(finality_grandpa::Error::NotDescendent),
@@ -124,7 +124,7 @@ fn same_result_when_precommit_target_has_lower_number_than_commit_target() {
&full_voter_set(),
&justification,
),
Err(Error::PrecommitIsNotCommitDescendant),
Err(Error::UnrelatedAncestryVote),
);
// original implementation returns `Ok(validation_result)`
@@ -132,7 +132,7 @@ fn same_result_when_precommit_target_has_lower_number_than_commit_target() {
let result = finality_grandpa::validate_commit(
&justification.commit,
&full_voter_set(),
&AncestryChain::new(&justification.votes_ancestries),
&AncestryChain::new(&justification),
)
.unwrap();
@@ -157,7 +157,7 @@ fn same_result_when_precommit_target_is_not_descendant_of_commit_target() {
&full_voter_set(),
&justification,
),
Err(Error::PrecommitIsNotCommitDescendant),
Err(Error::UnrelatedAncestryVote),
);
// original implementation returns `Ok(validation_result)`
@@ -165,7 +165,7 @@ fn same_result_when_precommit_target_is_not_descendant_of_commit_target() {
let result = finality_grandpa::validate_commit(
&justification.commit,
&full_voter_set(),
&AncestryChain::new(&justification.votes_ancestries),
&AncestryChain::new(&justification),
)
.unwrap();
@@ -198,7 +198,7 @@ fn same_result_when_there_are_not_enough_cumulative_weight_to_finalize_commit_ta
let result = finality_grandpa::validate_commit(
&justification.commit,
&full_voter_set(),
&AncestryChain::new(&justification.votes_ancestries),
&AncestryChain::new(&justification),
)
.unwrap();
@@ -236,7 +236,7 @@ fn different_result_when_justification_contains_duplicate_vote() {
let result = finality_grandpa::validate_commit(
&justification.commit,
&full_voter_set(),
&AncestryChain::new(&justification.votes_ancestries),
&AncestryChain::new(&justification),
)
.unwrap();
@@ -277,7 +277,7 @@ fn different_results_when_authority_equivocates_once_in_a_round() {
let result = finality_grandpa::validate_commit(
&justification.commit,
&full_voter_set(),
&AncestryChain::new(&justification.votes_ancestries),
&AncestryChain::new(&justification),
)
.unwrap();
@@ -330,7 +330,7 @@ fn different_results_when_authority_equivocates_twice_in_a_round() {
let result = finality_grandpa::validate_commit(
&justification.commit,
&full_voter_set(),
&AncestryChain::new(&justification.votes_ancestries),
&AncestryChain::new(&justification),
)
.unwrap();
@@ -369,7 +369,7 @@ fn different_results_when_there_are_more_than_enough_votes() {
let result = finality_grandpa::validate_commit(
&justification.commit,
&full_voter_set(),
&AncestryChain::new(&justification.votes_ancestries),
&AncestryChain::new(&justification),
)
.unwrap();
@@ -410,7 +410,7 @@ fn different_results_when_there_is_a_vote_of_unknown_authority() {
let result = finality_grandpa::validate_commit(
&justification.commit,
&full_voter_set(),
&AncestryChain::new(&justification.votes_ancestries),
&AncestryChain::new(&justification),
)
.unwrap();