westend_emulated_chain/
genesis.rs1use sc_consensus_grandpa::AuthorityId as GrandpaId;
18use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
19use sp_consensus_babe::AuthorityId as BabeId;
20use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId;
21use sp_core::storage::Storage;
22
23use polkadot_primitives::{AssignmentId, ValidatorId};
25
26use emulated_integration_tests_common::{
28 accounts, build_genesis_storage, get_host_config, validators,
29};
30use parachains_common::Balance;
31use westend_runtime_constants::currency::UNITS as WND;
32
33pub const ED: Balance = westend_runtime_constants::currency::EXISTENTIAL_DEPOSIT;
34const ENDOWMENT: u128 = 1_000_000 * WND;
35
36fn session_keys(
37 babe: BabeId,
38 grandpa: GrandpaId,
39 para_validator: ValidatorId,
40 para_assignment: AssignmentId,
41 authority_discovery: AuthorityDiscoveryId,
42 beefy: BeefyId,
43) -> westend_runtime::SessionKeys {
44 westend_runtime::SessionKeys {
45 babe,
46 grandpa,
47 para_validator,
48 para_assignment,
49 authority_discovery,
50 beefy,
51 }
52}
53
54pub fn genesis() -> Storage {
55 let genesis_config = westend_runtime::RuntimeGenesisConfig {
56 system: westend_runtime::SystemConfig::default(),
57 balances: westend_runtime::BalancesConfig {
58 balances: accounts::init_balances().iter().cloned().map(|k| (k, ENDOWMENT)).collect(),
59 ..Default::default()
60 },
61 session: westend_runtime::SessionConfig {
62 keys: validators::initial_authorities()
63 .iter()
64 .map(|x| {
65 (
66 x.0.clone(),
67 x.0.clone(),
68 session_keys(
69 x.2.clone(),
70 x.3.clone(),
71 x.4.clone(),
72 x.5.clone(),
73 x.6.clone(),
74 x.7.clone(),
75 ),
76 )
77 })
78 .collect::<Vec<_>>(),
79 ..Default::default()
80 },
81 babe: westend_runtime::BabeConfig {
82 authorities: Default::default(),
83 epoch_config: westend_runtime::BABE_GENESIS_EPOCH_CONFIG,
84 ..Default::default()
85 },
86 configuration: westend_runtime::ConfigurationConfig { config: get_host_config() },
87 ..Default::default()
88 };
89
90 build_genesis_storage(&genesis_config, westend_runtime::WASM_BINARY.unwrap())
91}