Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit 5fb41d2

Browse files
committed
another attempt to fix the test
1 parent 35e8ab1 commit 5fb41d2

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

node/test-service/src/chain_spec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub fn polkadot_local_testnet_config() -> PolkadotChainSpec {
3636
"Local Testnet",
3737
"local_testnet",
3838
ChainType::Local,
39-
|| polkadot_local_testnet_genesis(None, None),
39+
|| polkadot_local_testnet_genesis(None, None, None),
4040
vec![],
4141
None,
4242
Some(DEFAULT_PROTOCOL_ID),
@@ -48,16 +48,16 @@ pub fn polkadot_local_testnet_config() -> PolkadotChainSpec {
4848
/// Polkadot local testnet genesis config (multivalidator Alice + Bob)
4949
pub fn polkadot_local_testnet_genesis(
5050
changes_trie_config: Option<ChangesTrieConfiguration>,
51+
endowed_accounts: Option<Vec<AccountId>>,
5152
endowment: Option<u128>,
5253
) -> polkadot_test_runtime::GenesisConfig {
5354
polkadot_testnet_genesis(
5455
vec![
5556
get_authority_keys_from_seed("Alice"),
5657
get_authority_keys_from_seed("Bob"),
57-
get_authority_keys_from_seed("Charlie"),
5858
],
5959
get_account_id_from_seed::<sr25519::Public>("Alice"),
60-
None,
60+
endowed_accounts,
6161
changes_trie_config,
6262
endowment,
6363
)

runtime/test-runtime/client/src/lib.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use std::convert::TryFrom;
2424
pub use substrate_test_client::*;
2525
pub use polkadot_test_runtime as runtime;
2626

27-
use sp_core::{ChangesTrieConfiguration, map, twox_128};
27+
use sp_core::{sr25519, ChangesTrieConfiguration, map, twox_128};
2828
use sp_core::storage::{ChildInfo, Storage, StorageChild};
2929
use polkadot_test_runtime::GenesisConfig;
3030
use polkadot_test_service::polkadot_local_testnet_genesis;
@@ -94,13 +94,27 @@ pub struct GenesisParameters {
9494

9595
impl GenesisParameters {
9696
fn genesis_config(&self) -> GenesisConfig {
97-
let config = polkadot_local_testnet_genesis(
97+
polkadot_local_testnet_genesis(
9898
self.changes_trie_config.clone(),
99-
Some(1000),
100-
);
101-
config.assimilate_storage(&mut self.extra_storage.clone()).expect("Adding `system::GensisConfig` to the genesis");
99+
Some(vec![
100+
sr25519::Public::from(Sr25519Keyring::Alice).into(),
101+
sr25519::Public::from(Sr25519Keyring::Bob).into(),
102+
sr25519::Public::from(Sr25519Keyring::Charlie).into(),
103+
]),
104+
Some(1000 * polkadot_test_runtime::constants::currency::DOLLARS),
105+
)
106+
}
102107

103-
config
108+
fn genesis_map(&self) -> Storage {
109+
// Assimilate the system genesis config.
110+
let mut storage = Storage {
111+
top: BTreeMap::new(),
112+
children_default: self.extra_storage.children_default.clone(),
113+
};
114+
let config = self.genesis_config();
115+
config.assimilate_storage(&mut storage).expect("Adding `system::GenesisConfig` to the genesis");
116+
117+
storage
104118
}
105119
}
106120

@@ -114,7 +128,7 @@ impl substrate_test_client::GenesisInit for GenesisParameters {
114128
fn genesis_storage(&self) -> Storage {
115129
use codec::Encode;
116130

117-
let mut storage = self.genesis_config().build_storage().unwrap();
131+
let mut storage = self.genesis_map();
118132

119133
let child_roots = storage.children_default.iter().map(|(sk, child_content)| {
120134
let state_root = <<<runtime::Block as BlockT>::Header as HeaderT>::Hashing as HashT>::trie_root(

0 commit comments

Comments
 (0)