Skip to content

Commit

Permalink
adjust genesisconfig addition
Browse files Browse the repository at this point in the history
  • Loading branch information
runcomet committed Dec 1, 2024
1 parent dddac55 commit d53d795
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ fn asset_hub_rococo_genesis(
) -> serde_json::Value {
build_struct_json_patch!(RuntimeGenesisConfig {
balances: BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, endowment)).collect(),
..Default::default()
balances: endowed_accounts.iter().cloned().map(|k| (k, endowment)).collect()
},
parachain_info: ParachainInfoConfig { parachain_id: id },
collator_selection: CollatorSelectionConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ fn asset_hub_westend_genesis(
) -> serde_json::Value {
build_struct_json_patch!(RuntimeGenesisConfig {
balances: BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, endowment)).collect(),
..Default::default()
balances: endowed_accounts.iter().cloned().map(|k| (k, endowment)).collect()
},
parachain_info: ParachainInfoConfig { parachain_id: id },
collator_selection: CollatorSelectionConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ fn bridge_hub_rococo_genesis(
.iter()
.cloned()
.map(|k| (k, 1u128 << 60))
.collect::<Vec<_>>(),
..Default::default()
.collect::<Vec<_>>()
},
parachain_info: ParachainInfoConfig { parachain_id: id },
collator_selection: CollatorSelectionConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ fn bridge_hub_westend_genesis(
.iter()
.cloned()
.map(|k| (k, 1u128 << 60))
.collect::<Vec<_>>(),
..Default::default()
.collect::<Vec<_>>()
},
parachain_info: ParachainInfoConfig { parachain_id: id },
collator_selection: CollatorSelectionConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ fn collectives_westend_genesis(
.iter()
.cloned()
.map(|k| (k, COLLECTIVES_WESTEND_ED * 4096))
.collect::<Vec<_>>(),
..Default::default()
.collect::<Vec<_>>()
},
parachain_info: ParachainInfoConfig { parachain_id: id },
collator_selection: CollatorSelectionConfig {
Expand Down
2 changes: 1 addition & 1 deletion cumulus/parachains/runtimes/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ impl<Runtime: BasicParachainRuntime> ExtBuilder<Runtime> {
.unwrap();
}

pallet_balances::GenesisConfig::<Runtime> { balances: self.balances, ..Default::default() }
pallet_balances::GenesisConfig::<Runtime> { balances: self.balances }
.assimilate_storage(&mut t)
.unwrap();

Expand Down
6 changes: 2 additions & 4 deletions polkadot/runtime/rococo/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ fn rococo_testnet_genesis(

build_struct_json_patch!(RuntimeGenesisConfig {
balances: BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect::<Vec<_>>(),
..Default::default()
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect::<Vec<_>>()
},
session: SessionConfig {
keys: initial_authorities
Expand Down Expand Up @@ -428,8 +427,7 @@ fn rococo_staging_testnet_config_genesis() -> serde_json::Value {
.iter()
.map(|k: &AccountId| (k.clone(), ENDOWMENT))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH)))
.collect::<Vec<_>>(),
..Default::default()
.collect::<Vec<_>>()
},
session: SessionConfig {
keys: initial_authorities
Expand Down
6 changes: 2 additions & 4 deletions polkadot/runtime/westend/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,7 @@ fn westend_testnet_genesis(

build_struct_json_patch!(RuntimeGenesisConfig {
balances: BalancesConfig {
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect::<Vec<_>>(),
..Default::default()
balances: endowed_accounts.iter().map(|k| (k.clone(), ENDOWMENT)).collect::<Vec<_>>()
},
session: SessionConfig {
keys: initial_authorities
Expand Down Expand Up @@ -345,8 +344,7 @@ fn westend_staging_testnet_config_genesis() -> serde_json::Value {
.iter()
.map(|k: &AccountId| (k.clone(), ENDOWMENT))
.chain(initial_authorities.iter().map(|x| (x.0.clone(), STASH)))
.collect::<Vec<_>>(),
..Default::default()
.collect::<Vec<_>>()
},
session: SessionConfig {
keys: initial_authorities
Expand Down
18 changes: 2 additions & 16 deletions prdoc/pr_6267.prdoc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ crates:
bump: minor
- name: pallet-asset-conversion
bump: minor
- name: pallet-asset-conversion-ops
bump: minor
- name: pallet-alliance
bump: minor
- name: node-testing
Expand All @@ -111,24 +113,8 @@ crates:
bump: minor
- name: pallet-xcm
bump: minor
- name: westend-runtime
bump: minor
- name: rococo-runtime
bump: minor
- name: polkadot-runtime-common
bump: minor
- name: parachains-runtimes-test-utils
bump: minor
- name: collectives-westend-runtime
bump: minor
- name: bridge-hub-westend-runtime
bump: minor
- name: bridge-hub-rococo-runtime
bump: minor
- name: asset-hub-westend-runtime
bump: minor
- name: asset-hub-rococo-runtime
bump: minor
- name: pallet-collator-selection
bump: minor
- name: pallet-bridge-messages
Expand Down
2 changes: 1 addition & 1 deletion substrate/bin/node/testing/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub fn config_endowed(extra_endowed: Vec<AccountId>) -> RuntimeGenesisConfig {

RuntimeGenesisConfig {
indices: IndicesConfig { indices: vec![] },
balances: BalancesConfig { balances: endowed, ..Default::default() },
balances: BalancesConfig { balances: endowed },
session: SessionConfig {
keys: vec![
(alice(), dave(), session_keys_from_seed(Ed25519Keyring::Alice.into())),
Expand Down
3 changes: 2 additions & 1 deletion substrate/frame/balances/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ use sp_runtime::{

#[cfg(feature = "runtime-benchmarks")]
use sp_core::{sr25519::Pair as SrPair, Pair};
#[cfg(feature = "runtime-benchmarks")]
use alloc::{format, string::{String, ToString}};

pub use types::{
Expand Down Expand Up @@ -521,7 +522,7 @@ pub mod pallet {
balances: Default::default(),

#[cfg(feature = "runtime-benchmarks")]
dev_accounts: (One::one(), <T as Config<I>>::ExistentialDeposit::get(), None),
dev_accounts: (One::one(), <T as Config<I>>::ExistentialDeposit::get(), Some("//Sender/{}".to_string())),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion substrate/test-utils/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ sp-session = { workspace = true }
sp-api = { workspace = true }
sp-runtime = { features = ["serde"], workspace = true }
pallet-babe = { workspace = true }
pallet-balances = { workspace = true }
pallet-balances = { workspace = true, features = ["runtime-benchmarks"] }
frame-executive = { workspace = true }
frame-metadata-hash-extension = { workspace = true }
frame-system = { workspace = true }
Expand Down

0 comments on commit d53d795

Please sign in to comment.