mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 20:27:58 +00:00
Do not use Option to wrap GenesisConfig fields (#8275)
Currently we wrap every `GenesisConfig` field in an `Option`, while we require `Default` being implemented for all pallet genesisconfigs. Passing `None` also results in the genesis not being initialized, which is a bug as seen from the perspective of a pallet developer? This pr changes the fields of the `GenesisConfig` to non `Option` types.
This commit is contained in:
@@ -246,19 +246,19 @@ pub fn testnet_genesis(
|
||||
const STASH: Balance = ENDOWMENT / 1000;
|
||||
|
||||
GenesisConfig {
|
||||
frame_system: Some(SystemConfig {
|
||||
frame_system: SystemConfig {
|
||||
code: wasm_binary_unwrap().to_vec(),
|
||||
changes_trie_config: Default::default(),
|
||||
}),
|
||||
pallet_balances: Some(BalancesConfig {
|
||||
},
|
||||
pallet_balances: BalancesConfig {
|
||||
balances: endowed_accounts.iter().cloned()
|
||||
.map(|x| (x, ENDOWMENT))
|
||||
.collect()
|
||||
}),
|
||||
pallet_indices: Some(IndicesConfig {
|
||||
},
|
||||
pallet_indices: IndicesConfig {
|
||||
indices: vec![],
|
||||
}),
|
||||
pallet_session: Some(SessionConfig {
|
||||
},
|
||||
pallet_session: SessionConfig {
|
||||
keys: initial_authorities.iter().map(|x| {
|
||||
(x.0.clone(), x.0.clone(), session_keys(
|
||||
x.2.clone(),
|
||||
@@ -267,8 +267,8 @@ pub fn testnet_genesis(
|
||||
x.5.clone(),
|
||||
))
|
||||
}).collect::<Vec<_>>(),
|
||||
}),
|
||||
pallet_staking: Some(StakingConfig {
|
||||
},
|
||||
pallet_staking: StakingConfig {
|
||||
validator_count: initial_authorities.len() as u32 * 2,
|
||||
minimum_validator_count: initial_authorities.len() as u32,
|
||||
stakers: initial_authorities.iter().map(|x| {
|
||||
@@ -277,56 +277,56 @@ pub fn testnet_genesis(
|
||||
invulnerables: initial_authorities.iter().map(|x| x.0.clone()).collect(),
|
||||
slash_reward_fraction: Perbill::from_percent(10),
|
||||
.. Default::default()
|
||||
}),
|
||||
pallet_democracy: Some(DemocracyConfig::default()),
|
||||
pallet_elections_phragmen: Some(ElectionsConfig {
|
||||
},
|
||||
pallet_democracy: DemocracyConfig::default(),
|
||||
pallet_elections_phragmen: ElectionsConfig {
|
||||
members: endowed_accounts.iter()
|
||||
.take((num_endowed_accounts + 1) / 2)
|
||||
.cloned()
|
||||
.map(|member| (member, STASH))
|
||||
.collect(),
|
||||
}),
|
||||
pallet_collective_Instance1: Some(CouncilConfig::default()),
|
||||
pallet_collective_Instance2: Some(TechnicalCommitteeConfig {
|
||||
},
|
||||
pallet_collective_Instance1: CouncilConfig::default(),
|
||||
pallet_collective_Instance2: TechnicalCommitteeConfig {
|
||||
members: endowed_accounts.iter()
|
||||
.take((num_endowed_accounts + 1) / 2)
|
||||
.cloned()
|
||||
.collect(),
|
||||
phantom: Default::default(),
|
||||
}),
|
||||
pallet_contracts: Some(ContractsConfig {
|
||||
},
|
||||
pallet_contracts: ContractsConfig {
|
||||
current_schedule: pallet_contracts::Schedule {
|
||||
enable_println, // this should only be enabled on development chains
|
||||
..Default::default()
|
||||
},
|
||||
}),
|
||||
pallet_sudo: Some(SudoConfig {
|
||||
},
|
||||
pallet_sudo: SudoConfig {
|
||||
key: root_key,
|
||||
}),
|
||||
pallet_babe: Some(BabeConfig {
|
||||
},
|
||||
pallet_babe: BabeConfig {
|
||||
authorities: vec![],
|
||||
}),
|
||||
pallet_im_online: Some(ImOnlineConfig {
|
||||
},
|
||||
pallet_im_online: ImOnlineConfig {
|
||||
keys: vec![],
|
||||
}),
|
||||
pallet_authority_discovery: Some(AuthorityDiscoveryConfig {
|
||||
},
|
||||
pallet_authority_discovery: AuthorityDiscoveryConfig {
|
||||
keys: vec![],
|
||||
}),
|
||||
pallet_grandpa: Some(GrandpaConfig {
|
||||
},
|
||||
pallet_grandpa: GrandpaConfig {
|
||||
authorities: vec![],
|
||||
}),
|
||||
pallet_membership_Instance1: Some(Default::default()),
|
||||
pallet_treasury: Some(Default::default()),
|
||||
pallet_society: Some(SocietyConfig {
|
||||
},
|
||||
pallet_membership_Instance1: Default::default(),
|
||||
pallet_treasury: Default::default(),
|
||||
pallet_society: SocietyConfig {
|
||||
members: endowed_accounts.iter()
|
||||
.take((num_endowed_accounts + 1) / 2)
|
||||
.cloned()
|
||||
.collect(),
|
||||
pot: 0,
|
||||
max_members: 999,
|
||||
}),
|
||||
pallet_vesting: Some(Default::default()),
|
||||
pallet_gilt: Some(Default::default()),
|
||||
},
|
||||
pallet_vesting: Default::default(),
|
||||
pallet_gilt: Default::default(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user