mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-30 00:17:56 +00:00
Fix init-bridge (#1900)
This commit is contained in:
committed by
Bastian Köcher
parent
26330d9a25
commit
e7debc4b09
@@ -181,7 +181,7 @@ pub mod pallet {
|
||||
let is_authorities_change_enacted =
|
||||
try_enact_authority_change::<T, I>(&finality_target, set_id)?;
|
||||
let may_refund_call_fee = is_authorities_change_enacted &&
|
||||
submit_finality_proof_info_from_args::<T, I>(&*finality_target, &justification)
|
||||
submit_finality_proof_info_from_args::<T, I>(&finality_target, &justification)
|
||||
.fits_limits();
|
||||
<RequestCount<T, I>>::mutate(|count| *count += 1);
|
||||
insert_header::<T, I>(*finality_target, hash);
|
||||
|
||||
@@ -135,7 +135,7 @@ pub fn decode_justification_target<Header: HeaderT>(
|
||||
}
|
||||
|
||||
/// Verify and optimize given justification by removing unknown and duplicate votes.
|
||||
pub fn optimize_justification<Header: HeaderT>(
|
||||
pub fn verify_and_optimize_justification<Header: HeaderT>(
|
||||
finalized_target: (Header::Hash, Header::Number),
|
||||
authorities_set_id: SetId,
|
||||
authorities_set: &VoterSet<AuthorityId>,
|
||||
|
||||
@@ -17,7 +17,8 @@
|
||||
//! Tests for Grandpa Justification code.
|
||||
|
||||
use bp_header_chain::justification::{
|
||||
optimize_justification, required_justification_precommits, verify_justification, Error,
|
||||
required_justification_precommits, verify_and_optimize_justification, verify_justification,
|
||||
Error,
|
||||
};
|
||||
use bp_test_utils::*;
|
||||
|
||||
@@ -199,7 +200,7 @@ fn optimizer_does_noting_with_minimal_justification() {
|
||||
let justification = make_default_justification::<TestHeader>(&test_header(1));
|
||||
|
||||
let num_precommits_before = justification.commit.precommits.len();
|
||||
let justification = optimize_justification::<TestHeader>(
|
||||
let justification = verify_and_optimize_justification::<TestHeader>(
|
||||
header_id::<TestHeader>(1),
|
||||
TEST_GRANDPA_SET_ID,
|
||||
&voter_set(),
|
||||
@@ -222,7 +223,7 @@ fn unknown_authority_votes_are_removed_by_optimizer() {
|
||||
));
|
||||
|
||||
let num_precommits_before = justification.commit.precommits.len();
|
||||
let justification = optimize_justification::<TestHeader>(
|
||||
let justification = verify_and_optimize_justification::<TestHeader>(
|
||||
header_id::<TestHeader>(1),
|
||||
TEST_GRANDPA_SET_ID,
|
||||
&voter_set(),
|
||||
@@ -243,7 +244,7 @@ fn duplicate_authority_votes_are_removed_by_optimizer() {
|
||||
.push(justification.commit.precommits.first().cloned().unwrap());
|
||||
|
||||
let num_precommits_before = justification.commit.precommits.len();
|
||||
let justification = optimize_justification::<TestHeader>(
|
||||
let justification = verify_and_optimize_justification::<TestHeader>(
|
||||
header_id::<TestHeader>(1),
|
||||
TEST_GRANDPA_SET_ID,
|
||||
&voter_set(),
|
||||
@@ -266,7 +267,7 @@ fn redundant_authority_votes_are_removed_by_optimizer() {
|
||||
));
|
||||
|
||||
let num_precommits_before = justification.commit.precommits.len();
|
||||
let justification = optimize_justification::<TestHeader>(
|
||||
let justification = verify_and_optimize_justification::<TestHeader>(
|
||||
header_id::<TestHeader>(1),
|
||||
TEST_GRANDPA_SET_ID,
|
||||
&voter_set(),
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
use crate::error::Error;
|
||||
use async_trait::async_trait;
|
||||
use bp_header_chain::{
|
||||
justification::{verify_justification, GrandpaJustification},
|
||||
justification::{verify_and_optimize_justification, GrandpaJustification},
|
||||
ConsensusLogReader, FinalityProof, GrandpaConsensusLogReader,
|
||||
};
|
||||
use bp_runtime::{BasicOperatingMode, HeaderIdProvider, OperatingMode};
|
||||
@@ -172,7 +172,7 @@ impl<C: ChainWithGrandpa> Engine<C> for Grandpa<C> {
|
||||
// actual authorities set (which we have read now) may have changed, so this
|
||||
// `optimize_justification` may fail. But if target chain is configured properly, it'll fail
|
||||
// anyway, after we submit transaction and failing earlier is better. So - it is fine
|
||||
bp_header_chain::justification::optimize_justification(
|
||||
verify_and_optimize_justification(
|
||||
(header.hash(), *header.number()),
|
||||
authority_set_id,
|
||||
&authority_set,
|
||||
@@ -272,11 +272,11 @@ impl<C: ChainWithGrandpa> Engine<C> for Grandpa<C> {
|
||||
initial_authorities_set_id,
|
||||
);
|
||||
|
||||
let is_valid_set_id = verify_justification::<C::Header>(
|
||||
let is_valid_set_id = verify_and_optimize_justification(
|
||||
(initial_header_hash, initial_header_number),
|
||||
initial_authorities_set_id,
|
||||
&authorities_for_verification,
|
||||
&justification,
|
||||
justification.clone(),
|
||||
)
|
||||
.is_ok();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user