Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use RuntimeGenesisConfig in genesis config presets #451

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog for the runtimes governed by the Polkadot Fellowship.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Changed
- Genesis config presets: Make use of RuntimeGenesisConfig to construct genesis config values for all runtimes ([polkadot-fellows/runtimes#451](https://github.com/polkadot-fellows/runtimes/pull/451)).

## [1.3.2] 27.08.2024

### Fixed
Expand Down Expand Up @@ -356,7 +361,6 @@ Note: This release only affects the following runtimes and is not a full system
- Add BEEFY to Polkadot ([polkadot-fellows/runtimes#65](https://github.com/polkadot-fellows/runtimes/pull/65))
- Fellowship Treasury pallet on Polkadot Collectives ([polkadot-fellows/runtimes#109](https://github.com/polkadot-fellows/runtimes/pull/109))
- Added Polkadot <> Kusama bridge to support asset transfers between Asset Hubs ([polkadot-fellows/runtimes#108](https://github.com/polkadot-fellows/runtimes/pull/108))

### Fixed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the empty line was accidentally removed 😆 you need to bring it back (but empty, no whitespaces)


- Add missing weight functions for `runtime_parachains_hrmp` and `preimage` pallets ([polkadot-fellows/runtimes#56](https://github.com/polkadot-fellows/runtimes/pull/56))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,50 @@ fn asset_hub_kusama_genesis(
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> serde_json::Value {
serde_json::json!({
"balances": BalancesConfig {
let config = RuntimeGenesisConfig {
system: Default::default(),
balances: BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, ASSET_HUB_KUSAMA_ED * 4096 * 4096))
.collect(),
},
"parachainInfo": ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
"collatorSelection": CollatorSelectionConfig {
transaction_payment: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() },
collator_selection: CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ASSET_HUB_KUSAMA_ED * 16,
..Default::default()
},
"session": SessionConfig {
session: SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
)
})
.collect(),
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
aura: Default::default(),
aura_ext: Default::default(),
polkadot_xcm: PolkadotXcmConfig {
_config: Default::default(),
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment needs to go to line 58, at this position it does not make so much sense.

// of this. `aura: Default::default()`
})
assets: Default::default(),
foreign_assets: Default::default(),
parachain_system: Default::default(),
vesting: Default::default(),
pool_assets: Default::default(),
};

serde_json::to_value(config).expect("Could not build genesis config.")
}

pub fn asset_hub_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,41 +43,50 @@ fn asset_hub_polkadot_genesis(
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> serde_json::Value {
serde_json::json!({
"balances": BalancesConfig {
let config = RuntimeGenesisConfig {
system: Default::default(),
balances: BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, ASSET_HUB_POLKADOT_ED * 4096 * 4096))
.collect(),
},
"parachainInfo": ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
"collatorSelection": CollatorSelectionConfig {
transaction_payment: Default::default(),
parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() },
collator_selection: CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ASSET_HUB_POLKADOT_ED * 16,
..Default::default()
},
"session": SessionConfig {
session: SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
)
})
.collect(),
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
aura: Default::default(),
aura_ext: Default::default(),
polkadot_xcm: PolkadotXcmConfig {
_config: Default::default(),
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

// of this. `aura: Default::default()`
})
assets: Default::default(),
foreign_assets: Default::default(),
parachain_system: Default::default(),
vesting: Default::default(),
pool_assets: Default::default(),
};

serde_json::to_value(config).expect("Could not build genesis config.")
}

pub fn asset_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,49 @@ fn bridge_hub_kusama_genesis(
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> serde_json::Value {
serde_json::json!({
"balances": BalancesConfig {
let config = RuntimeGenesisConfig {
system: Default::default(),
balances: BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, BRIDGE_HUB_KUSAMA_ED * 4096 * 4096))
.collect(),
},
"parachainInfo": ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
"collatorSelection": CollatorSelectionConfig {
parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() },
collator_selection: CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: BRIDGE_HUB_KUSAMA_ED * 16,
..Default::default()
},
"session": SessionConfig {
session: SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
)
})
.collect(),
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
aura: Default::default(),
aura_ext: Default::default(),
polkadot_xcm: PolkadotXcmConfig {
_config: Default::default(),
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this. `aura: Default::default()`
})
bridge_polkadot_grandpa: Default::default(),
bridge_polkadot_parachains: Default::default(),
parachain_system: Default::default(),
transaction_payment: Default::default(),
bridge_polkadot_messages: Default::default(),
};

serde_json::to_value(config).expect("Could not build genesis config.")
}

pub fn bridge_hub_kusama_local_testnet_genesis(para_id: ParaId) -> serde_json::Value {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,46 +27,54 @@ fn bridge_hub_polkadot_genesis(
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> serde_json::Value {
serde_json::json!({
"balances": BalancesConfig {
let config = RuntimeGenesisConfig {
system: Default::default(),
balances: BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, BRIDGE_HUB_POLKADOT_ED * 4096 * 4096))
.collect(),
},
"parachainInfo": ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
"collatorSelection": CollatorSelectionConfig {
parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() },
collator_selection: CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: BRIDGE_HUB_POLKADOT_ED * 16,
..Default::default()
},
"session": SessionConfig {
session: SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
)
})
.collect(),
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
aura: Default::default(),
aura_ext: Default::default(),
polkadot_xcm: PolkadotXcmConfig {
_config: Default::default(),
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
"ethereumSystem": EthereumSystemConfig {
bridge_kusama_grandpa: Default::default(),
bridge_kusama_parachains: Default::default(),
bridge_kusama_messages: Default::default(),
ethereum_system: EthereumSystemConfig {
para_id: id,
asset_hub_para_id: polkadot_runtime_constants::system_parachain::ASSET_HUB_ID.into(),
..Default::default()
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this. `aura: Default::default()`
})
parachain_system: Default::default(),
transaction_payment: Default::default(),
};

serde_json::to_value(config).expect("Could not build genesis config.")
}

pub fn bridge_hub_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,50 @@ fn collectives_polkadot_genesis(
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> serde_json::Value {
serde_json::json!({
"balances": BalancesConfig {
let config = RuntimeGenesisConfig {
system: Default::default(),
balances: BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, COLLECTIVES_POLKADOT_ED * 4096 * 4096))
.collect(),
},
"parachainInfo": ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
"collatorSelection": CollatorSelectionConfig {
parachain_info: ParachainInfoConfig { parachain_id: id, ..Default::default() },
collator_selection: CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: COLLECTIVES_POLKADOT_ED * 16,
..Default::default()
},
"session": SessionConfig {
session: SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
acc.clone(), // account id
acc, // validator id
SessionKeys { aura }, // session keys
)
})
.collect(),
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
aura: Default::default(),
aura_ext: Default::default(),
polkadot_xcm: PolkadotXcmConfig {
_config: Default::default(),
safe_xcm_version: Some(SAFE_XCM_VERSION),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this. `aura: Default::default()`
})
alliance: Default::default(),
alliance_motion: Default::default(),
fellowship_treasury: Default::default(),
parachain_system: Default::default(),
transaction_payment: Default::default(),
ambassador_treasury: Default::default(),
};

serde_json::to_value(config).expect("Could not build genesis config.")
}

pub fn collectives_polkadot_local_testnet_genesis(para_id: ParaId) -> serde_json::Value {
Expand Down
Loading
Loading