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:
Hernando Castano
2021-03-24 16:14:15 -04:00
committed by Bastian Köcher
parent a17c7eb80c
commit 78a9cdca66
7 changed files with 154 additions and 95 deletions
+4 -7
View File
@@ -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);