Skip to content

Instantly share code, notes, and snippets.

@bkontur
Last active April 4, 2024 13:00
Show Gist options
  • Save bkontur/f74fc00fd726d09bc7f0f3a9f51ec113 to your computer and use it in GitHub Desktop.
Save bkontur/f74fc00fd726d09bc7f0f3a9f51ec113 to your computer and use it in GitHub Desktop.
diff --git a/cumulus/polkadot-parachain/src/command.rs b/cumulus/polkadot-parachain/src/command.rs
index a7319b6dfbb..bb4256240f0 100644
--- a/cumulus/polkadot-parachain/src/command.rs
+++ b/cumulus/polkadot-parachain/src/command.rs
@@ -55,6 +55,7 @@ enum Runtime {
Glutton,
GluttonWestend,
BridgeHub(chain_spec::bridge_hubs::BridgeHubRuntimeType),
+ CoretimeKusama,
Coretime(chain_spec::coretime::CoretimeRuntimeType),
People(chain_spec::people::PeopleRuntimeType),
}
@@ -115,6 +116,8 @@ fn runtime(id: &str) -> Runtime {
id.parse::<chain_spec::bridge_hubs::BridgeHubRuntimeType>()
.expect("Invalid value"),
)
+ } else if id.starts_with("coretime-kusama") {
+ Runtime::CoretimeKusama
} else if id.starts_with(chain_spec::coretime::CoretimeRuntimeType::ID_PREFIX) {
Runtime::Coretime(
id.parse::<chain_spec::coretime::CoretimeRuntimeType>().expect("Invalid value"),
@@ -408,6 +411,7 @@ macro_rules! construct_partials {
Runtime::BridgeHub(_) |
Runtime::CollectivesPolkadot |
Runtime::CollectivesWestend |
+ Runtime::CoretimeKusama |
Runtime::Coretime(_) |
Runtime::People(_) => {
let $partials = new_partial::<RuntimeApi, _>(
@@ -461,6 +465,7 @@ macro_rules! construct_async_run {
Runtime::BridgeHub(_) |
Runtime::CollectivesPolkadot |
Runtime::CollectivesWestend |
+ Runtime::CoretimeKusama |
Runtime::Coretime(_) |
Runtime::People(_) => {
runner.async_run(|$config| {
@@ -781,6 +786,14 @@ pub fn run() -> Result<()> {
}
.map_err(Into::into),
+ CoretimeKusama => crate::service::start_generic_aura_node::<
+ RuntimeApi,
+ AuraId,
+ >(config, polkadot_config, collator_options, id, hwbench)
+ .await
+ .map(|r| r.0)
+ .map_err(Into::into),
+
Coretime(coretime_runtime_type) => match coretime_runtime_type {
chain_spec::coretime::CoretimeRuntimeType::Rococo |
chain_spec::coretime::CoretimeRuntimeType::RococoLocal |
# polkadot-fellows repo
cd <fellows-repo-dir>
git checkout tags/v1.2.0 -b v1.2.0 --force
cargo run --bin chain-spec-generator coretime-kusama-local > coretime-kusama-chain-spec.json
# download coretime-kusama wasm
cd <some-dir>
wget https://github.com/polkadot-fellows/runtimes/releases/download/v1.2.0/coretime-kusama_runtime-v1002000.compact.compressed.wasm
cat coretime-kusama_runtime-v1002000.compact.compressed.wasm | od -A n -v -t x1 | tr -d ' \n' > rt-hex.txt
# replace the runtime in the spec with the given runtime and set some values to production
# Related issue for bootNodes, invulnerables, and session keys: https://github.com/paritytech/devops/issues/2725
cat coretime-kusama-chain-spec.json | jq --rawfile code rt-hex.txt '.genesis.runtimeGenesis.code = ("0x" + $code)' \
| jq '.name = "Kusama Coretime"' \
| jq '.id = "coretime-kusama"' \
| jq '.chainType = "Live"' \
| jq '.bootNodes = [
"/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-b-0.polkadot.io/tcp/30334/p2p/12D3KooWEbJsTw3TnLjDr3M7LtuBzhSBeMThpgRRNF5zPP2PUnjM",
"/dns/kusama-coretime-connect-b-1.polkadot.io/tcp/30334/p2p/12D3KooWMkSaSjV6pZ58d5zaBykQitYQaKtuD3TTWYbuES5WLdny",
"/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",
"/dns/kusama-coretime-connect-b-0.polkadot.io/tcp/443/wss/p2p/12D3KooWEbJsTw3TnLjDr3M7LtuBzhSBeMThpgRRNF5zPP2PUnjM",
"/dns/kusama-coretime-connect-b-1.polkadot.io/tcp/443/wss/p2p/12D3KooWMkSaSjV6pZ58d5zaBykQitYQaKtuD3TTWYbuES5WLdny"
]' \
| jq '.relay_chain = "kusama"' \
| jq --argjson para_id 1005 '.para_id = $para_id' \
| jq --argjson para_id 1005 '.genesis.runtimeGenesis.patch.parachainInfo.parachainId = $para_id' \
| jq '.genesis.runtimeGenesis.patch.balances.balances = []' \
| jq '.genesis.runtimeGenesis.patch.polkadotXcm.safeXcmVersion = 3' \
| jq '.genesis.runtimeGenesis.patch.collatorSelection.invulnerables = [
"HRn3a4qLmv1ejBHvEbnjaiEWjt154iFi2Wde7bXKGUwGvtL",
"Cx9Uu2sxp3Xt1QBUbGQo7j3imTvjWJrqPF1PApDoy6UVkWP",
"CdW8izFcLeicL3zZUQaC3a39AGeNSTgc9Jb5E5sjREPryA2",
"H1tAQMm3eizGcmpAhL9aA9gR844kZpQfkU7pkmMiLx9jSzE",
"J11Rp4mjz3vRb2DL51HqRGRjhuEQRyXgtuFskebXb8zMZ9s",
"DtuntvQBh9vajFTnd42aTTCiuCyY3ep6EVwhhPji2ejyyhW",
"HmatizNhXrZtXwQK2LfntvjCy3x1EuKs1WnRQ6CP3KkNfmA",
"HPUEzi4v3YJmhBfSbcGEFFiNKPAGVnGkfDiUzBNTR7j1CxT"
]' \
| jq '.genesis.runtimeGenesis.patch.session.keys = [
[
"HRn3a4qLmv1ejBHvEbnjaiEWjt154iFi2Wde7bXKGUwGvtL",
"HRn3a4qLmv1ejBHvEbnjaiEWjt154iFi2Wde7bXKGUwGvtL",
{
"aura": "E8E67m6hzdSKnmdHpkzuEd8JtWR9bSBUq9vwiRufHzZ95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DiUzBNTR7j1CxT",
{
"aura": "HAKDDNB1tENBDWZwLkV8VoDJufPQu63KWBF7UFmM6JYGAgi"
}
]
]' \
> edited-coretime-kusama-chain-spec-3.json
# polkadot-sdk repo
cd <polkadot-repo-dir>
git checkout tags/v1.2.0 -b v1.2.0 --force
# apply patch
git apply coretime-kusama.patch
cargo run -p polkadot-parachain-bin export-genesis-state --chain ../../edited-coretime-kusama-chain-spec-4.json > ../../coretime-kusama-genesis-head-data-4
@bkontur
Copy link
Author

bkontur commented Apr 2, 2024

coretime-kusama

with safeXcmVersion 4

Running `target/debug/polkadot-parachain export-genesis-state --chain ../../edited-coretime-kusama-chain-spec-4.json`
2024-04-02 21:46:06 🔨 Initializing Genesis block/state (state: 0xd33f…0e8f, header-hash: 0xd8a0…a1d4)
0x000000000000000000000000000000000000000000000000000000000000000000d33f0a8ad50d3df2cca8267290da749d3aa7537ec5a96459d57195fa488c0e8f03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400

with safeXcmVersion 3

Running `target/debug/polkadot-parachain export-genesis-state --chain ../../edited-coretime-kusama-chain-spec-3.json`
2024-04-02 21:47:19 🔨 Initializing Genesis block/state (state: 0xc418…889c, header-hash: 0x638c…d050)
0x000000000000000000000000000000000000000000000000000000000000000000c41865a2a094ef4563f74d248996fe70ed60ec52f78b36e38f55108b7c96889c03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400

@seadanda
Copy link

seadanda commented Apr 3, 2024

We have decided not to use two of the parity collators (b-0 and b-1) as we have so many community ones, they are already removed from the invulnerables and session keys, but not from the bootnodes. These should become:

...
    | jq '.bootNodes = [
          "/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"
        ]' \
...

@bkontur
Copy link
Author

bkontur commented Apr 3, 2024

We have decided not to use two of the parity collators (b-0 and b-1) as we have so many community ones, they are already removed from the invulnerables and session keys, but not from the bootnodes. These should become:

...
    | jq '.bootNodes = [
          "/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"
        ]' \
...

can you please update those in the paritytech/polkadot-sdk#3961?

@bkontur
Copy link
Author

bkontur commented Apr 4, 2024

people-kusama

with safeXcmVersion 3

./target/debug/polkadot-parachain export-genesis-state --chain people-kusama > genesis
2024-04-04 10:30:42 🔨 Initializing Genesis block/state (state: 0x023a…2733, header-hash: 0x07b8…2645)

genesis:

0x000000000000000000000000000000000000000000000000000000000000000000023a97898d4669e095d08f8a4d21677f447e7af23fca3c153f4b7739e049273303170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400

@seadanda
Copy link

seadanda commented Apr 4, 2024

My genesis state is the same for people-kusama with safeXcmVersion 3. Looking good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment