Skip to content

Commit

Permalink
Add the Polkadot Coretime runtime (#410)
Browse files Browse the repository at this point in the history
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
#401 is merged
- [ ] Rerun benchmarks and check hardcoded weights after merge

The genesis chain-spec is developing on
seadanda#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 <git@kchr.de>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Aug 13, 2024
1 parent c125f5c commit 9d3d5f6
Show file tree
Hide file tree
Showing 53 changed files with 6,543 additions and 46 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/runtimes-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
"uri": "wss://kusama-coretime-rpc.polkadot.io:443",
"is_relay": false
},
{
"name": "coretime-polkadot",
"package": "coretime-polkadot-runtime",
"path": "system-parachains/coretime/coretime-polkadot",
"is_relay": false
},
{
"name": "people-kusama",
"package": "people-kusama-runtime",
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- All runtimes: XcmPaymentApi and DryRunApi ([polkadot-fellows/runtimes#380](https://github.com/polkadot-fellows/runtimes/pull/380))
- All runtimes: add `LocationToAccountApi` ([polkadot-fellows/runtimes#413](https://github.com/polkadot-fellows/runtimes/pull/413))
- Enable Agile Coretime on Polkadot ([polkadot-fellows/runtimes#401](https://github.com/polkadot-fellows/runtimes/pull/401))
- Add the Polkadot Coretime Chain runtime ([polkadot-fellows/runtimes#410](https://github.com/polkadot-fellows/runtimes/pull/410))

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

Expand Down
145 changes: 122 additions & 23 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ collectives-polkadot-runtime = { path = "system-parachains/collectives/collectiv
collectives-polkadot-runtime-constants = { path = "system-parachains/collectives/collectives-polkadot/constants" }
coretime-kusama-emulated-chain = { path = "integration-tests/emulated/chains/parachains/coretime/coretime-kusama" }
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 }
Expand Down Expand Up @@ -253,6 +255,7 @@ members = [
"integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot",
"integration-tests/emulated/chains/parachains/collectives/collectives-polkadot",
"integration-tests/emulated/chains/parachains/coretime/coretime-kusama",
"integration-tests/emulated/chains/parachains/coretime/coretime-polkadot",
"integration-tests/emulated/chains/parachains/people/people-kusama",
"integration-tests/emulated/chains/parachains/people/people-polkadot",
"integration-tests/emulated/chains/parachains/testing/penpal",
Expand All @@ -268,6 +271,7 @@ members = [
"integration-tests/emulated/tests/bridges/bridge-hub-polkadot",
"integration-tests/emulated/tests/collectives/collectives-polkadot",
"integration-tests/emulated/tests/coretime/coretime-kusama",
"integration-tests/emulated/tests/coretime/coretime-polkadot",
"integration-tests/emulated/tests/people/people-kusama",
"integration-tests/emulated/tests/people/people-polkadot",
"integration-tests/zombienet",
Expand All @@ -287,6 +291,7 @@ members = [
"system-parachains/collectives/collectives-polkadot/constants",
"system-parachains/constants",
"system-parachains/coretime/coretime-kusama",
"system-parachains/coretime/coretime-polkadot",
"system-parachains/encointer",
"system-parachains/gluttons/glutton-kusama",
"system-parachains/people/people-kusama",
Expand Down
2 changes: 2 additions & 0 deletions chain-spec-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ bridge-hub-kusama-runtime = { workspace = true }
encointer-kusama-runtime = { workspace = true }
glutton-kusama-runtime = { workspace = true }
coretime-kusama-runtime = { workspace = true }
coretime-polkadot-runtime = { workspace = true }
people-kusama-runtime = { workspace = true }
people-polkadot-runtime = { workspace = true }

Expand All @@ -36,6 +37,7 @@ runtime-benchmarks = [
"bridge-hub-polkadot-runtime/runtime-benchmarks",
"collectives-polkadot-runtime/runtime-benchmarks",
"coretime-kusama-runtime/runtime-benchmarks",
"coretime-polkadot-runtime/runtime-benchmarks",
"encointer-kusama-runtime/runtime-benchmarks",
"glutton-kusama-runtime/runtime-benchmarks",
"kusama-runtime/runtime-benchmarks",
Expand Down
2 changes: 2 additions & 0 deletions chain-spec-generator/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ pub fn from_json_file(filepath: &str, supported: String) -> Result<Box<dyn Chain
Ok(Box::new(BridgeHubKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("coretime-kusama") =>
Ok(Box::new(CoretimeKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("coretime-polkadot") =>
Ok(Box::new(CoretimeKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("glutton-kusama") =>
Ok(Box::new(GluttonKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("encointer-kusama") =>
Expand Down
4 changes: 4 additions & 0 deletions chain-spec-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ fn main() -> Result<(), String> {
"coretime-kusama-local",
Box::new(system_parachains_specs::coretime_kusama_local_testnet_config) as Box<_>,
),
(
"coretime-polkadot-local",
Box::new(system_parachains_specs::coretime_polkadot_local_testnet_config) as Box<_>,
),
(
"people-kusama-local",
Box::new(system_parachains_specs::people_kusama_local_testnet_config) as Box<_>,
Expand Down
22 changes: 22 additions & 0 deletions chain-spec-generator/src/system_parachains_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ pub type EncointerKusamaChainSpec = sc_chain_spec::GenericChainSpec<Extensions>;

pub type CoretimeKusamaChainSpec = sc_chain_spec::GenericChainSpec<Extensions>;

pub type CoretimePolkadotChainSpec = sc_chain_spec::GenericChainSpec<Extensions>;

pub type PeopleKusamaChainSpec = sc_chain_spec::GenericChainSpec<Extensions>;

pub type PeoplePolkadotChainSpec = sc_chain_spec::GenericChainSpec<Extensions>;
Expand Down Expand Up @@ -216,6 +218,26 @@ pub fn coretime_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, Stri
))
}

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());
properties.insert("tokenSymbol".into(), "DOT".into());
properties.insert("tokenDecimals".into(), 10.into());

Ok(Box::new(
CoretimePolkadotChainSpec::builder(
coretime_polkadot_runtime::WASM_BINARY.expect("CoretimePolkadot wasm not available!"),
Extensions { relay_chain: "polkadot-local".into(), para_id: 1005 },
)
.with_name("Polkadot Coretime Local")
.with_id("coretime-polkadot-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_preset_name("local_testnet")
.with_properties(properties)
.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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "coretime-kusama-emulated-chain"
version = "0.0.0"
version.workspace = true
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use emulated_integration_tests_common::{
};
use parachains_common::Balance;

pub const PARA_ID: u32 = 1001;
pub const PARA_ID: u32 = 1005;
pub const ED: Balance = coretime_kusama_runtime::ExistentialDeposit::get();

pub fn genesis() -> Storage {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "coretime-polkadot-emulated-chain"
version.workspace = true
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
description = "Coretime Polkadot emulated chain used for integration tests"
publish = false

[dependencies]

# Substrate
sp-core = { workspace = true, default-features = true }
frame-support = { workspace = true, default-features = true }

# Cumulus
parachains-common = { workspace = true, default-features = true }
cumulus-primitives-core = { workspace = true, default-features = true }
emulated-integration-tests-common = { workspace = true }

# Runtimes
coretime-polkadot-runtime = { workspace = true }
Loading

0 comments on commit 9d3d5f6

Please sign in to comment.