mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 16:31:07 +00:00
Larger Test Keyring Support (#842)
* Allow creation of authority lists with any number of authorities * Move keyring helpers into their own module * Add helper for generating list of test accounts * Fix import names in tests * Rename Keyring trait to Signer * Get list of accounts in a more functional way * Clarify meaning of `test_keyring` return type * Use concrete test account type instead of generics * Make sure voter set contains all authorities which signed off on pre-commits
This commit is contained in:
committed by
Bastian Köcher
parent
a17c7eb80c
commit
78a9cdca66
@@ -59,10 +59,7 @@ use crate::storage::ImportedHeader;
|
||||
use crate::verifier::*;
|
||||
use crate::{BestFinalized, BestHeight, BridgeStorage, NextScheduledChange, PalletStorage};
|
||||
use bp_header_chain::AuthoritySet;
|
||||
use bp_test_utils::{
|
||||
authority_list, make_default_justification,
|
||||
Keyring::{Alice, Bob},
|
||||
};
|
||||
use bp_test_utils::{authority_list, make_default_justification, ALICE, BOB};
|
||||
use codec::Encode;
|
||||
use frame_support::{IterableStorageMap, StorageValue};
|
||||
use sp_finality_grandpa::{ConsensusLog, GRANDPA_ENGINE_ID};
|
||||
@@ -505,7 +502,7 @@ where
|
||||
|
||||
pub(crate) fn change_log(delay: u64) -> Digest<TestHash> {
|
||||
let consensus_log = ConsensusLog::<TestNumber>::ScheduledChange(sp_finality_grandpa::ScheduledChange {
|
||||
next_authorities: vec![(Alice.into(), 1), (Bob.into(), 1)],
|
||||
next_authorities: vec![(ALICE.into(), 1), (BOB.into(), 1)],
|
||||
delay,
|
||||
});
|
||||
|
||||
|
||||
@@ -721,10 +721,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::mock::{run_test, test_header, unfinalized_header, Origin, TestHeader, TestRuntime};
|
||||
use bp_header_chain::HeaderChain;
|
||||
use bp_test_utils::{
|
||||
authority_list,
|
||||
Keyring::{Alice, Bob},
|
||||
};
|
||||
use bp_test_utils::{authority_list, ALICE, BOB};
|
||||
use frame_support::{assert_err, assert_noop, assert_ok};
|
||||
use sp_runtime::DispatchError;
|
||||
|
||||
@@ -952,7 +949,7 @@ mod tests {
|
||||
let storage = PalletStorage::<TestRuntime>::new();
|
||||
|
||||
let next_set_id = 2;
|
||||
let next_authorities = vec![(Alice.into(), 1), (Bob.into(), 1)];
|
||||
let next_authorities = vec![(ALICE.into(), 1), (BOB.into(), 1)];
|
||||
|
||||
// Need to update the header digest to indicate that our header signals an authority set
|
||||
// change. The change will be enacted when we import our header.
|
||||
@@ -981,7 +978,7 @@ mod tests {
|
||||
let storage = PalletStorage::<TestRuntime>::new();
|
||||
|
||||
let next_set_id = 2;
|
||||
let next_authorities = vec![(Alice.into(), 1), (Bob.into(), 1)];
|
||||
let next_authorities = vec![(ALICE.into(), 1), (BOB.into(), 1)];
|
||||
|
||||
// Need to update the header digest to indicate that our header signals an authority set
|
||||
// change. However, the change doesn't happen until the next block.
|
||||
@@ -1010,7 +1007,7 @@ mod tests {
|
||||
run_test(|| {
|
||||
let storage = PalletStorage::<TestRuntime>::new();
|
||||
|
||||
let next_authorities = vec![(Alice.into(), 1)];
|
||||
let next_authorities = vec![(ALICE.into(), 1)];
|
||||
let next_set_id = 2;
|
||||
let next_authority_set = AuthoritySet::new(next_authorities.clone(), next_set_id);
|
||||
|
||||
|
||||
@@ -342,10 +342,7 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::mock::*;
|
||||
use crate::{BestFinalized, BestHeight, HeaderId, ImportedHeaders, PalletStorage};
|
||||
use bp_test_utils::{
|
||||
authority_list, make_default_justification,
|
||||
Keyring::{Alice, Bob},
|
||||
};
|
||||
use bp_test_utils::{authority_list, make_default_justification, ALICE, BOB};
|
||||
use codec::Encode;
|
||||
use frame_support::{assert_err, assert_ok};
|
||||
use frame_support::{StorageMap, StorageValue};
|
||||
@@ -695,7 +692,7 @@ mod tests {
|
||||
// This is an *invalid* authority set because the combined weight of the
|
||||
// authorities is greater than `u64::MAX`
|
||||
let consensus_log = ConsensusLog::<TestNumber>::ScheduledChange(sp_finality_grandpa::ScheduledChange {
|
||||
next_authorities: vec![(Alice.into(), u64::MAX), (Bob.into(), u64::MAX)],
|
||||
next_authorities: vec![(ALICE.into(), u64::MAX), (BOB.into(), u64::MAX)],
|
||||
delay: 0,
|
||||
});
|
||||
|
||||
@@ -800,7 +797,7 @@ mod tests {
|
||||
// Schedule a change at the height of our header
|
||||
let set_id = 2;
|
||||
let height = *header.number();
|
||||
let authorities = vec![Alice.into()];
|
||||
let authorities = vec![ALICE.into()];
|
||||
let change = schedule_next_change(authorities, set_id, height);
|
||||
storage.schedule_next_set_change(genesis_hash, change.clone());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user