Skip to content

Commit

Permalink
Add coretime chainspecs for kusama and polkadot and presets for live …
Browse files Browse the repository at this point in the history
…chains (#4)

* Add kusama live preset and chain spec to builder

* Add coretime-polkadot chainspec

* Make clippy happy

* Remove unnecessary dep

* Use presets for new chainspecs

* Add live to preset names

* Add stake plus bootnodes to coretime polkadot at release. (#5)

* Add the Polkadot Coretime runtime (polkadot-fellows#410)

Add the Polkadot Coretime chain in advance of the 1.3.0 release.

This uses the new Price adapter which has been running on Kusama now for
two sales cycles, and includes the mechanism to burn revenue.

TODO:
- [x] Add Transact tests for hardcoded weights after
polkadot-fellows#401 is merged
- [ ] Rerun benchmarks and check hardcoded weights after merge

The genesis chain-spec is developing on
#4. This can be used as a merge
target for any community boot nodes who would like to be included at
genesis and will be separately merged to `main`.

---------

Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Branislav Kontur <[email protected]>
Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>

* Update changelog

* all runtimes: remove already applied migrations (polkadot-fellows#420)

Remove migrations already **applied on-chain**.

- [x] Does not require a CHANGELOG entry

---------

Signed-off-by: Adrian Catangiu <[email protected]>
Co-authored-by: joe petrowski <[email protected]>

---------

Signed-off-by: Adrian Catangiu <[email protected]>
Co-authored-by: Tom <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Branislav Kontur <[email protected]>
Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
Co-authored-by: Adrian Catangiu <[email protected]>
Co-authored-by: joe petrowski <[email protected]>
  • Loading branch information
7 people authored Aug 14, 2024
1 parent f5efa3d commit 128d0a5
Show file tree
Hide file tree
Showing 20 changed files with 223 additions and 265 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- All runtimes: add `LocationToAccountApi` ([polkadot-fellows/runtimes#413](https:/polkadot-fellows/runtimes/pull/413))
- Enable Agile Coretime on Polkadot ([polkadot-fellows/runtimes#401](https:/polkadot-fellows/runtimes/pull/401))
- Add the Polkadot Coretime Chain runtime ([polkadot-fellows/runtimes#410](https:/polkadot-fellows/runtimes/pull/410))
- Add the Polkadot and Kusama Coretime Chain specs ([polkadot-fellows/runtimes#432](https:/polkadot-fellows/runtimes/pull/432))

#### From [#322](https:/polkadot-fellows/runtimes/pull/322):

Expand Down
22 changes: 1 addition & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ coretime-kusama-runtime = { path = "system-parachains/coretime/coretime-kusama"
coretime-polkadot-emulated-chain = { path = "integration-tests/emulated/chains/parachains/coretime/coretime-polkadot" }
coretime-polkadot-runtime = { path = "system-parachains/coretime/coretime-polkadot" }
cumulus-pallet-aura-ext = { version = "0.15.0", default-features = false }
cumulus-pallet-dmp-queue = { version = "0.15.0", default-features = false }
cumulus-pallet-parachain-system = { version = "0.15.0", default-features = false }
cumulus-pallet-session-benchmarking = { version = "17.0.0", default-features = false }
cumulus-pallet-xcm = { version = "0.15.0", default-features = false }
Expand Down Expand Up @@ -189,6 +188,7 @@ frame-metadata-hash-extension = { version = "0.4.0", default-features = false }
remote-externalities = { version = "0.43.0", package = "frame-remote-externalities" }
runtime-parachains = { version = "15.0.1", default-features = false, package = "polkadot-runtime-parachains" }
sc-chain-spec = { version = "35.0.0" }
sc-network = { version = "0.42.0" }
scale-info = { version = "2.10.0", default-features = false }
separator = { version = "0.4.1" }
serde = { version = "1.0.196" }
Expand Down
1 change: 1 addition & 0 deletions chain-spec-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ polkadot-runtime = { workspace = true }
kusama-runtime = { workspace = true }

sc-chain-spec = { workspace = true }
sc-network = { workspace = true }

asset-hub-polkadot-runtime = { workspace = true }
asset-hub-kusama-runtime = { workspace = true }
Expand Down
8 changes: 8 additions & 0 deletions chain-spec-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,18 @@ fn main() -> Result<(), String> {
"encointer-kusama-local",
Box::new(system_parachains_specs::encointer_kusama_local_testnet_config) as Box<_>,
),
(
"coretime-kusama",
Box::new(system_parachains_specs::coretime_kusama_config) as Box<_>,
),
(
"coretime-kusama-local",
Box::new(system_parachains_specs::coretime_kusama_local_testnet_config) as Box<_>,
),
(
"coretime-polkadot",
Box::new(system_parachains_specs::coretime_polkadot_config) as Box<_>,
),
(
"coretime-polkadot-local",
Box::new(system_parachains_specs::coretime_polkadot_local_testnet_config) as Box<_>,
Expand Down
75 changes: 75 additions & 0 deletions chain-spec-generator/src/system_parachains_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.

use sc_chain_spec::{ChainSpec, ChainSpecExtension, ChainSpecGroup, ChainType};
use sc_network::config::MultiaddrWithPeerId;
use serde::{Deserialize, Serialize};
use std::str::FromStr;

/// Generic extensions for Parachain ChainSpecs.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
Expand Down Expand Up @@ -218,6 +220,41 @@ pub fn coretime_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, Stri
))
}

pub fn coretime_kusama_config() -> Result<Box<dyn ChainSpec>, String> {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 2.into());
properties.insert("tokenSymbol".into(), "KSM".into());
properties.insert("tokenDecimals".into(), 12.into());

let boot_nodes = [
"/dns/kusama-coretime-connect-a-0.polkadot.io/tcp/30334/p2p/12D3KooWR7Biy6nPgQFhk2eYP62pAkcFA6he9RUFURTDh7ewTjpo",
"/dns/kusama-coretime-connect-a-1.polkadot.io/tcp/30334/p2p/12D3KooWAGFiMZDF9RxdacrkenzGdo8nhfSe9EXofHc5mHeJ9vGX",
"/dns/kusama-coretime-connect-a-0.polkadot.io/tcp/443/wss/p2p/12D3KooWR7Biy6nPgQFhk2eYP62pAkcFA6he9RUFURTDh7ewTjpo",
"/dns/kusama-coretime-connect-a-1.polkadot.io/tcp/443/wss/p2p/12D3KooWAGFiMZDF9RxdacrkenzGdo8nhfSe9EXofHc5mHeJ9vGX",
];

Ok(Box::new(
CoretimeKusamaChainSpec::builder(
coretime_kusama_runtime::WASM_BINARY.expect("Kusama Coretime wasm not available!"),
Extensions { relay_chain: "kusama".into(), para_id: 1005 },
)
.with_name("Kusama Coretime")
.with_id("coretime-kusama")
.with_chain_type(ChainType::Live)
.with_genesis_config_preset_name("live")
.with_properties(properties)
.with_boot_nodes(
boot_nodes
.iter()
.map(|addr| {
MultiaddrWithPeerId::from_str(addr).expect("Boot node address is incorrect.")
})
.collect(),
)
.build(),
))
}

pub fn coretime_polkadot_local_testnet_config() -> Result<Box<dyn ChainSpec>, String> {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 0.into());
Expand All @@ -238,6 +275,44 @@ pub fn coretime_polkadot_local_testnet_config() -> Result<Box<dyn ChainSpec>, St
))
}

pub fn coretime_polkadot_config() -> Result<Box<dyn ChainSpec>, String> {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 0.into());
properties.insert("tokenSymbol".into(), "DOT".into());
properties.insert("tokenDecimals".into(), 10.into());

let boot_nodes = [
"/dns/polkadot-coretime-connect-a-0.polkadot.io/tcp/30334/p2p/12D3KooWKjnixAHbKMsPTJwGx8SrBeGEJLHA8KmKcEDYMp3YmWgR",
"/dns/polkadot-coretime-connect-a-1.polkadot.io/tcp/30334/p2p/12D3KooWQ7B7p4DFv1jWqaKfhrZBcMmi5g8bWFnmskguLaGEmT6n",
"/dns/polkadot-coretime-connect-a-0.polkadot.io/tcp/443/wss/p2p/12D3KooWKjnixAHbKMsPTJwGx8SrBeGEJLHA8KmKcEDYMp3YmWgR",
"/dns/polkadot-coretime-connect-a-1.polkadot.io/tcp/443/wss/p2p/12D3KooWQ7B7p4DFv1jWqaKfhrZBcMmi5g8bWFnmskguLaGEmT6n",
"/dns4/coretime-polkadot.boot.stake.plus/tcp/30332/wss/p2p/12D3KooWFJ2yBTKFKYwgKUjfY3F7XfaxHV8hY6fbJu5oMkpP7wZ9",
"/dns4/coretime-polkadot.boot.stake.plus/tcp/31332/wss/p2p/12D3KooWCy5pToLafcQzPHn5kadxAftmF6Eh8ZJGPXhSeXSUDfjv",

];

Ok(Box::new(
CoretimePolkadotChainSpec::builder(
coretime_polkadot_runtime::WASM_BINARY.expect("Polkadot Coretime wasm not available!"),
Extensions { relay_chain: "polkadot".into(), para_id: 1005 },
)
.with_name("Polkadot Coretime")
.with_id("coretime-polkadot")
.with_chain_type(ChainType::Live)
.with_genesis_config_preset_name("live")
.with_properties(properties)
.with_boot_nodes(
boot_nodes
.iter()
.map(|addr| {
MultiaddrWithPeerId::from_str(addr).expect("Boot node address is incorrect.")
})
.collect(),
)
.build(),
))
}

pub fn people_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, String> {
let mut properties = sc_chain_spec::Properties::new();
properties.insert("ss58Format".into(), 2.into());
Expand Down
4 changes: 0 additions & 4 deletions system-parachains/asset-hubs/asset-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ xcm-runtime-apis = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
cumulus-pallet-dmp-queue = { workspace = true }
cumulus-pallet-parachain-system = { workspace = true }
cumulus-pallet-session-benchmarking = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
Expand Down Expand Up @@ -124,7 +123,6 @@ default = ["std"]
state-trie-version-1 = ["pallet-state-trie-migration"]
runtime-benchmarks = [
"assets-common/runtime-benchmarks",
"cumulus-pallet-dmp-queue/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
Expand Down Expand Up @@ -162,7 +160,6 @@ runtime-benchmarks = [
]
try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-xcm/try-runtime",
"cumulus-pallet-xcmp-queue/try-runtime",
Expand Down Expand Up @@ -203,7 +200,6 @@ std = [
"bp-bridge-hub-polkadot/std",
"codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-session-benchmarking/std",
"cumulus-pallet-xcm/std",
Expand Down
7 changes: 1 addition & 6 deletions system-parachains/asset-hubs/asset-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1049,14 +1049,9 @@ pub type SignedExtra = (
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;

parameter_types! {
pub DmpQueueName: &'static str = "DmpQueue";
}

/// Migrations to apply on runtime upgrade.
pub type Migrations = (
frame_support::migrations::RemovePallet<DmpQueueName, RocksDbWeight>,
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
// unreleased and/or un-applied
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
pallet_assets::migration::next_asset_id::SetNextAssetId<
ConstU32<50_000_000>,
Expand Down
9 changes: 1 addition & 8 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1029,16 +1029,9 @@ pub type SignedExtra = (
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;

parameter_types! {
pub DmpQueueName: &'static str = "DmpQueue";
}

/// Migrations to apply on runtime upgrade.
pub type Migrations = (
// unreleased
frame_support::migrations::RemovePallet<DmpQueueName, RocksDbWeight>,
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
// unreleased and/or un-applied
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
pallet_assets::migration::next_asset_id::SetNextAssetId<
ConstU32<50_000_000>,
Expand Down
4 changes: 0 additions & 4 deletions system-parachains/bridge-hubs/bridge-hub-kusama/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ xcm-runtime-apis = { workspace = true }

# Cumulus
cumulus-pallet-aura-ext = { workspace = true }
cumulus-pallet-dmp-queue = { workspace = true }
cumulus-pallet-parachain-system = { workspace = true }
cumulus-pallet-session-benchmarking = { workspace = true }
cumulus-pallet-xcm = { workspace = true }
Expand Down Expand Up @@ -146,7 +145,6 @@ std = [
"bridge-runtime-common/std",
"codec/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-dmp-queue/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-session-benchmarking/std",
"cumulus-pallet-xcm/std",
Expand Down Expand Up @@ -227,7 +225,6 @@ std = [
runtime-benchmarks = [
"bridge-hub-common/runtime-benchmarks",
"bridge-runtime-common/runtime-benchmarks",
"cumulus-pallet-dmp-queue/runtime-benchmarks",
"cumulus-pallet-parachain-system/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
Expand Down Expand Up @@ -269,7 +266,6 @@ runtime-benchmarks = [

try-runtime = [
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
"cumulus-pallet-xcm/try-runtime",
"cumulus-pallet-xcmp-queue/try-runtime",
Expand Down
7 changes: 1 addition & 6 deletions system-parachains/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,9 @@ bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! {
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;

parameter_types! {
pub DmpQueueName: &'static str = "DmpQueue";
}

/// Migrations to apply on runtime upgrade.
pub type Migrations = (
frame_support::migrations::RemovePallet<DmpQueueName, RocksDbWeight>,
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
// unreleased and/or un-applied
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
// permanent
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
Expand Down
15 changes: 1 addition & 14 deletions system-parachains/bridge-hubs/bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ pub use sp_runtime::BuildStorage;

// Polkadot imports
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use polkadot_runtime_constants::system_parachain::{ASSET_HUB_ID, BRIDGE_HUB_ID};

use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};

Expand Down Expand Up @@ -141,21 +140,9 @@ bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! {
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;

parameter_types! {
pub DmpQueueName: &'static str = "DmpQueue";
}

/// Migrations to apply on runtime upgrade.
pub type Migrations = (
// unreleased
frame_support::migrations::RemovePallet<DmpQueueName, RocksDbWeight>,
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
snowbridge_pallet_system::migration::v0::InitializeOnUpgrade<
Runtime,
ConstU32<BRIDGE_HUB_ID>,
ConstU32<ASSET_HUB_ID>,
>,
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
// unreleased and/or un-applied
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
// permanent
pallet_xcm::migration::MigrateToLatestXcmVersion<Runtime>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,17 +749,10 @@ pub type SignedExtra = (
pub type UncheckedExtrinsic =
generic::UncheckedExtrinsic<Address, RuntimeCall, Signature, SignedExtra>;

parameter_types! {
pub DmpQueueName: &'static str = "DmpQueue";
}

/// All migrations executed on runtime upgrade as a nested tuple of types implementing
/// `OnRuntimeUpgrade`. Included migrations must be idempotent.
type Migrations = (
// unreleased
frame_support::migrations::RemovePallet<DmpQueueName, RocksDbWeight>,
cumulus_pallet_xcmp_queue::migration::v4::MigrationToV4<Runtime>,
pallet_collator_selection::migration::v2::MigrationToV2<Runtime>,
// unreleased and/or un-applied
cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5<Runtime>,
pallet_core_fellowship::migration::MigrateV0ToV1<Runtime, fellowship::FellowshipCoreInstance>,
pallet_core_fellowship::migration::MigrateV0ToV1<Runtime, ambassador::AmbassadorCoreInstance>,
Expand Down
Loading

0 comments on commit 128d0a5

Please sign in to comment.