Closed 4meta5 closed 4 years ago
Before merging, I'd like to
[ ] get client to compile with an example that uses the bank
module
[ ] consider stuff in #58 to see if we can make the genesis config less configy...
This is the current testnet_genesis
function
pub fn testnet_genesis(
initial_authorities: Vec<(AuraId, GrandpaId)>,
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
org_membership: Option<Vec<(u32, AccountId, bool)>>,
flat_share_supervisors: Option<Vec<(u32, u32, AccountId)>>,
flat_share_membership: Option<Vec<(u32, u32, AccountId, bool)>>,
weighted_share_supervisors: Option<Vec<(u32, u32, AccountId)>>,
weighted_share_membership: Option<Vec<(u32, u32, AccountId, Shares)>>,
first_org_value_constitution: Vec<u8>,
first_org_flat_membership: Vec<AccountId>,
_enable_println: bool,
) -> GenesisConfig {
GenesisConfig {
frame_system: Some(SystemConfig {
code: WASM_BINARY.to_vec(),
changes_trie_config: Default::default(),
}),
pallet_balances: Some(BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, 1 << 60))
.collect(),
}),
pallet_indices: Some(IndicesConfig { indices: vec![] }),
membership: Some(MembershipConfig {
omnipotent_key: root_key.clone(),
membership: org_membership,
}),
shares_membership: Some(SharesMembershipConfig {
share_supervisors: flat_share_supervisors,
shareholder_membership: flat_share_membership,
}),
shares_atomic: Some(SharesAtomicConfig {
share_supervisors: weighted_share_supervisors,
shareholder_membership: weighted_share_membership,
}),
bank: Some(BankConfig {
first_organization_supervisor: root_key.clone(),
first_organization_value_constitution: first_org_value_constitution,
first_organization_flat_membership: first_org_flat_membership,
}),
pallet_aura: Some(AuraConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
}),
pallet_grandpa: Some(GrandpaConfig {
authorities: initial_authorities
.iter()
.map(|x| (x.1.clone(), 1))
.collect(),
}),
pallet_sudo: Some(SudoConfig { key: root_key }),
}
}
and I know it can be made cleaner with the builder pattern demonstrated in that other PR...
https://github.com/web3garden/sunshine-node/issues/59