Skip to content

Commit e80b05c

Browse files
committed
node cli
1 parent 202138e commit e80b05c

File tree

1 file changed

+32
-59
lines changed

1 file changed

+32
-59
lines changed

substrate/bin/node/cli/src/chain_spec.rs

+32-59
Original file line numberDiff line numberDiff line change
@@ -314,65 +314,38 @@ pub fn testnet_genesis(
314314
let (initial_authorities, endowed_accounts, stakers) =
315315
configure_accounts(initial_authorities, initial_nominators, endowed_accounts, STASH);
316316

317-
serde_json::json!({
318-
"balances": {
319-
"balances": endowed_accounts.iter().cloned().map(|x| (x, ENDOWMENT)).collect::<Vec<_>>(),
320-
},
321-
"session": {
322-
"keys": initial_authorities
323-
.iter()
324-
.map(|x| {
325-
(
326-
x.0.clone(),
327-
x.0.clone(),
328-
session_keys(
329-
x.2.clone(),
330-
x.3.clone(),
331-
x.4.clone(),
332-
x.5.clone(),
333-
x.6.clone(),
334-
x.7.clone(),
335-
),
336-
)
337-
})
338-
.collect::<Vec<_>>(),
339-
},
340-
"staking": {
341-
"validatorCount": initial_authorities.len() as u32,
342-
"minimumValidatorCount": initial_authorities.len() as u32,
343-
"invulnerables": initial_authorities.iter().map(|x| x.0.clone()).collect::<Vec<_>>(),
344-
"slashRewardFraction": Perbill::from_percent(10),
345-
"stakers": stakers.clone(),
346-
},
347-
"elections": {
348-
"members": endowed_accounts
349-
.iter()
350-
.take((num_endowed_accounts + 1) / 2)
351-
.cloned()
352-
.map(|member| (member, STASH))
353-
.collect::<Vec<_>>(),
354-
},
355-
"technicalCommittee": {
356-
"members": endowed_accounts
357-
.iter()
358-
.take((num_endowed_accounts + 1) / 2)
359-
.cloned()
360-
.collect::<Vec<_>>(),
361-
},
362-
"sudo": { "key": Some(root_key.clone()) },
363-
"babe": {
364-
"epochConfig": Some(kitchensink_runtime::BABE_GENESIS_EPOCH_CONFIG),
365-
},
366-
"society": { "pot": 0 },
367-
"assets": {
368-
// This asset is used by the NIS pallet as counterpart currency.
369-
"assets": vec![(9, Sr25519Keyring::Alice.to_account_id(), true, 1)],
370-
},
371-
"nominationPools": {
372-
"minCreateBond": 10 * DOLLARS,
373-
"minJoinBond": 1 * DOLLARS,
374-
},
375-
})
317+
let staking_playground_config = if cfg!(feature = "staking-playground") {
318+
Some(get_staking_playground_config())
319+
} else {
320+
None
321+
};
322+
323+
// Todo: After #7748 is done, we can refactor this to avoid
324+
// calling into the native runtime.
325+
kitchensink_runtime::genesis_config_presets::kitchensink_genesis(
326+
initial_authorities
327+
.iter()
328+
.map(|x| {
329+
(
330+
x.0.clone(),
331+
// stash account is controller
332+
x.0.clone(),
333+
session_keys(
334+
x.2.clone(),
335+
x.3.clone(),
336+
x.4.clone(),
337+
x.5.clone(),
338+
x.6.clone(),
339+
x.7.clone(),
340+
),
341+
)
342+
})
343+
.collect(),
344+
root_key,
345+
endowed_accounts,
346+
stakers,
347+
staking_playground_config,
348+
)
376349
}
377350

378351
fn get_staking_playground_config() -> StakingPlaygroundConfig {

0 commit comments

Comments
 (0)