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

Clean up genesis config presets for all runtimes #450

Merged
Merged
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

- Allow signed origins to send arbitrary XCMs from some system chains ([polkadot-fellows/runtimes#407](https://github.com/polkadot-fellows/runtimes/pull/407))

### Fixed

- Chain-spec generator: propagate the `on_chain_release_build` feature to the chain-spec generator. Without this the live/genesis chain-specs contain a wrongly-configured WASM blob ([polkadot-fellows/runtimes#450](https://github.com/polkadot-fellows/runtimes/pull/450)).

## [1.3.2] 27.08.2024

### Fixed
Expand Down
16 changes: 16 additions & 0 deletions chain-spec-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,19 @@ runtime-benchmarks = [
"people-polkadot-runtime/runtime-benchmarks",
"polkadot-runtime/runtime-benchmarks",
]

on-chain-release-build = [
"asset-hub-kusama-runtime/on-chain-release-build",
"asset-hub-polkadot-runtime/on-chain-release-build",
"bridge-hub-kusama-runtime/on-chain-release-build",
"bridge-hub-polkadot-runtime/on-chain-release-build",
"collectives-polkadot-runtime/on-chain-release-build",
"coretime-kusama-runtime/on-chain-release-build",
"coretime-polkadot-runtime/on-chain-release-build",
"encointer-kusama-runtime/on-chain-release-build",
"glutton-kusama-runtime/on-chain-release-build",
"kusama-runtime/on-chain-release-build",
"people-kusama-runtime/on-chain-release-build",
"people-polkadot-runtime/on-chain-release-build",
"polkadot-runtime/on-chain-release-build",
]
36 changes: 10 additions & 26 deletions chain-spec-generator/src/system_parachains_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub fn asset_hub_polkadot_local_testnet_config() -> Result<Box<dyn ChainSpec>, S
.with_name("Polkadot Asset Hub Local")
.with_id("asset-hub-polkadot-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(asset_hub_polkadot_runtime::genesis_config_presets::asset_hub_polkadot_local_testnet_genesis(1000.into()))
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand All @@ -86,7 +86,7 @@ pub fn asset_hub_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, Str
.with_name("Kusama Asset Hub Local")
.with_id("asset-hub-kusama-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(asset_hub_kusama_runtime::genesis_config_presets::asset_hub_kusama_local_testnet_genesis(1000.into()))
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand All @@ -107,7 +107,7 @@ pub fn collectives_polkadot_local_testnet_config() -> Result<Box<dyn ChainSpec>,
.with_name("Polkadot Collectives Local")
.with_id("collectives-polkadot-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(collectives_polkadot_runtime::genesis_config_presets::collectives_polkadot_local_testnet_genesis(1001.into()))
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand All @@ -128,7 +128,7 @@ pub fn bridge_hub_polkadot_local_testnet_config() -> Result<Box<dyn ChainSpec>,
.with_name("Polkadot Bridge Hub Local")
.with_id("bridge-hub-polkadot-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(bridge_hub_polkadot_runtime::genesis_config_presets::bridge_hub_polkadot_local_testnet_genesis(1002.into()))
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand All @@ -148,7 +148,7 @@ pub fn bridge_hub_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, St
.with_name("Kusama Bridge Hub Local")
.with_id("bridge-hub-kusama-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(bridge_hub_kusama_runtime::genesis_config_presets::bridge_hub_kusama_local_testnet_genesis(1002.into()))
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand All @@ -166,11 +166,7 @@ pub fn glutton_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, Strin
.with_name("Kusama Glutton Local")
.with_id("glutton-kusama-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(
glutton_kusama_runtime::genesis_config_presets::glutton_kusama_local_testnet_genesis(
1300.into(),
),
)
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand All @@ -190,7 +186,7 @@ pub fn encointer_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, Str
.with_name("Kusama Encointer Local")
.with_id("encointer-kusama-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(encointer_kusama_runtime::genesis_config_presets::encointer_kusama_local_testnet_genesis(1001.into()))
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand All @@ -210,11 +206,7 @@ pub fn coretime_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, Stri
.with_name("Kusama Coretime Local")
.with_id("coretime-kusama-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(
coretime_kusama_runtime::genesis_config_presets::coretime_kusama_local_testnet_genesis(
1005.into(),
),
)
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand Down Expand Up @@ -327,11 +319,7 @@ pub fn people_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, String
.with_name("Kusama People Local")
.with_id("people-kusama-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(
people_kusama_runtime::genesis_config_presets::people_kusama_local_testnet_genesis(
1004.into(),
),
)
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand All @@ -351,11 +339,7 @@ pub fn people_polkadot_local_testnet_config() -> Result<Box<dyn ChainSpec>, Stri
.with_name("Polkadot People Local")
.with_id("people-polkadot-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(
people_polkadot_runtime::genesis_config_presets::people_polkadot_local_testnet_genesis(
1004.into(),
),
)
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.build(),
))
Expand Down
6 changes: 6 additions & 0 deletions relay/kusama/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use pallet_staking::{Forcing, StakerStatus};
use polkadot_primitives::{AccountPublic, AssignmentId, AsyncBackingParams};
use runtime_parachains::configuration::HostConfiguration;
use sp_core::{sr25519, Pair, Public};
use sp_genesis_builder::PresetId;
use sp_runtime::{traits::IdentifyAccount, Perbill};
#[cfg(not(feature = "std"))]
use sp_std::alloc::format;
Expand Down Expand Up @@ -224,6 +225,11 @@ pub fn kusama_development_config_genesis() -> serde_json::Value {
)
}

/// Provides the names of the predefined genesis configs for this runtime.
pub fn preset_names() -> Vec<PresetId> {
vec![PresetId::from("development"), PresetId::from("local_testnet")]
}

/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>> {
let patch = match id.try_into() {
Expand Down
5 changes: 1 addition & 4 deletions relay/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2523,10 +2523,7 @@ sp_api::impl_runtime_apis! {
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![
sp_genesis_builder::PresetId::from("local_testnet"),
sp_genesis_builder::PresetId::from("development"),
]
genesis_config_presets::preset_names()
}
}

Expand Down
6 changes: 6 additions & 0 deletions relay/polkadot/src/genesis_config_presets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use polkadot_primitives::{AccountPublic, AssignmentId, AsyncBackingParams};
use polkadot_runtime_constants::currency::UNITS as DOT;
use runtime_parachains::configuration::HostConfiguration;
use sp_core::{sr25519, Pair, Public};
use sp_genesis_builder::PresetId;
use sp_runtime::{traits::IdentifyAccount, Perbill};
#[cfg(not(feature = "std"))]
use sp_std::alloc::format;
Expand Down Expand Up @@ -224,6 +225,11 @@ pub fn polkadot_development_config_genesis() -> serde_json::Value {
)
}

/// Provides the names of the predefined genesis configs for this runtime.
pub fn preset_names() -> Vec<PresetId> {
vec![PresetId::from("development"), PresetId::from("local_testnet")]
}

/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>> {
let patch = match id.try_into() {
Expand Down
5 changes: 1 addition & 4 deletions relay/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2694,10 +2694,7 @@ sp_api::impl_runtime_apis! {
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![
sp_genesis_builder::PresetId::from("local_testnet"),
sp_genesis_builder::PresetId::from("development"),
]
genesis_config_presets::preset_names()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! Genesis configs presets for the AssetHubKusama runtime

use crate::*;
use sp_genesis_builder::PresetId;
use sp_std::vec::Vec;
use system_parachains_constants::genesis_presets::*;

Expand Down Expand Up @@ -72,6 +73,11 @@ fn asset_hub_kusama_development_genesis(para_id: ParaId) -> serde_json::Value {
asset_hub_kusama_local_testnet_genesis(para_id)
}

/// Provides the names of the predefined genesis configs for this runtime.
pub fn preset_names() -> Vec<PresetId> {
vec![PresetId::from("development"), PresetId::from("local_testnet")]
}

/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>> {
let patch = match id.try_into() {
Expand Down
5 changes: 1 addition & 4 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1372,10 +1372,7 @@ impl_runtime_apis! {
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![
sp_genesis_builder::PresetId::from("local_testnet"),
sp_genesis_builder::PresetId::from("development"),
]
genesis_config_presets::preset_names()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use crate::*;
use parachains_common::AssetHubPolkadotAuraId;
use sp_core::sr25519;
use sp_genesis_builder::PresetId;
use sp_std::vec::Vec;
use system_parachains_constants::genesis_presets::*;

Expand Down Expand Up @@ -88,6 +89,11 @@ fn asset_hub_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value
asset_hub_polkadot_local_testnet_genesis(para_id)
}

/// Provides the names of the predefined genesis configs for this runtime.
pub fn preset_names() -> Vec<PresetId> {
vec![PresetId::from("development"), PresetId::from("local_testnet")]
}

/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>> {
let patch = match id.try_into() {
Expand Down
5 changes: 1 addition & 4 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1340,10 +1340,7 @@ impl_runtime_apis! {
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![
sp_genesis_builder::PresetId::from("local_testnet"),
sp_genesis_builder::PresetId::from("development"),
]
genesis_config_presets::preset_names()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! Genesis configs presets for the BridgeHubKusama runtime

use crate::*;
use sp_genesis_builder::PresetId;
use sp_std::vec::Vec;
use system_parachains_constants::genesis_presets::*;

Expand Down Expand Up @@ -72,6 +73,11 @@ fn bridge_hub_kusama_development_genesis(para_id: ParaId) -> serde_json::Value {
bridge_hub_kusama_local_testnet_genesis(para_id)
}

/// Provides the names of the predefined genesis configs for this runtime.
pub fn preset_names() -> Vec<PresetId> {
vec![PresetId::from("development"), PresetId::from("local_testnet")]
}

/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>> {
let patch = match id.try_into() {
Expand Down
5 changes: 1 addition & 4 deletions system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -812,10 +812,7 @@ impl_runtime_apis! {
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![
sp_genesis_builder::PresetId::from("local_testnet"),
sp_genesis_builder::PresetId::from("development"),
]
genesis_config_presets::preset_names()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! Genesis configs presets for the BridgeHubPolkadot runtime

use crate::*;
use sp_genesis_builder::PresetId;
use sp_std::vec::Vec;
use system_parachains_constants::genesis_presets::*;

Expand Down Expand Up @@ -77,6 +78,11 @@ fn bridge_hub_polkadot_development_genesis(para_id: ParaId) -> serde_json::Value
bridge_hub_polkadot_local_testnet_genesis(para_id)
}

/// Provides the names of the predefined genesis configs for this runtime.
pub fn preset_names() -> Vec<PresetId> {
vec![PresetId::from("development"), PresetId::from("local_testnet")]
}

/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>> {
let patch = match id.try_into() {
Expand Down
5 changes: 1 addition & 4 deletions system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -814,10 +814,7 @@ impl_runtime_apis! {
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![
sp_genesis_builder::PresetId::from("local_testnet"),
sp_genesis_builder::PresetId::from("development"),
]
genesis_config_presets::preset_names()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//! Genesis configs presets for the CollectivesPolkadot runtime

use crate::*;
use sp_genesis_builder::PresetId;
use sp_std::vec::Vec;
use system_parachains_constants::genesis_presets::*;

Expand Down Expand Up @@ -72,6 +73,11 @@ fn collectives_polkadot_development_genesis(para_id: ParaId) -> serde_json::Valu
collectives_polkadot_local_testnet_genesis(para_id)
}

/// Provides the names of the predefined genesis configs for this runtime.
pub fn preset_names() -> Vec<PresetId> {
vec![PresetId::from("development"), PresetId::from("local_testnet")]
}

/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>> {
let patch = match id.try_into() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,10 +1039,7 @@ impl_runtime_apis! {
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![
sp_genesis_builder::PresetId::from("local_testnet"),
sp_genesis_builder::PresetId::from("development"),
]
genesis_config_presets::preset_names()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use crate::*;
use hex_literal::hex;
use sp_core::crypto::UncheckedInto;
use sp_genesis_builder::PresetId;
use sp_std::vec::Vec;
use system_parachains_constants::genesis_presets::*;

Expand Down Expand Up @@ -131,6 +132,11 @@ fn coretime_kusama_live_genesis(para_id: ParaId) -> serde_json::Value {
)
}

/// Provides the names of the predefined genesis configs for this runtime.
pub fn preset_names() -> Vec<PresetId> {
vec![PresetId::from("development"), PresetId::from("local_testnet")]
}

/// Provides the JSON representation of predefined genesis config for given `id`.
pub fn get_preset(id: &sp_genesis_builder::PresetId) -> Option<sp_std::vec::Vec<u8>> {
let patch = match id.try_into() {
Expand Down
5 changes: 1 addition & 4 deletions system-parachains/coretime/coretime-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1107,10 +1107,7 @@ impl_runtime_apis! {
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![
sp_genesis_builder::PresetId::from("local_testnet"),
sp_genesis_builder::PresetId::from("development"),
]
genesis_config_presets::preset_names()
}
}
}
Expand Down
Loading
Loading