Skip to content

Commit

Permalink
Kusama People Chain (polkadot-fellows#217)
Browse files Browse the repository at this point in the history
See
https://forum.polkadot.network/t/people-chain-launch-and-identity-migration-plan/5930
for launch process.

A branch with runtimes for steps 2 and 3 of the launch process is here:
#1

---------

Co-authored-by: Adrian Catangiu <adrian@parity.io>
Co-authored-by: Dónal Murray <donalm@seadanda.dev>
  • Loading branch information
3 people authored Mar 18, 2024
1 parent 360581f commit 6d93705
Show file tree
Hide file tree
Showing 48 changed files with 6,694 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/integration-tests-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@
{
"name": "bridge-hub-polkadot",
"package": "bridge-hub-polkadot-integration-tests"
},
{
"name": "people-kusama",
"package": "people-kusama-integration-tests"
}
]
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Cancel Parachain Auctions ([polkadot-fellows/runtimes#215](https://github.com/polkadot-fellows/runtimes/pull/215))
- Upgrade encointer protocol to 6.1.0 ([polkadot-fellows/runtimes#236](https://github.com/polkadot-fellows/runtimes/pull/236))
- Update NFT deposits according to RFC-45 ([polkadot-fellows/runtimes#237](https://github.com/polkadot-fellows/runtimes/pull/237))
- Add Kusama People Chain ([polkadot-fellows/runtimes#217](https://github.com/polkadot-fellows/runtimes/pull/217))

### Changed

Expand Down
102 changes: 102 additions & 0 deletions Cargo.lock

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

3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ members = [
"system-parachains/constants",
"system-parachains/encointer",
"system-parachains/gluttons/glutton-kusama",
"system-parachains/people/people-kusama",
"integration-tests/emulated/chains/relays/kusama",
"integration-tests/emulated/chains/relays/polkadot",
"integration-tests/emulated/chains/parachains/assets/asset-hub-kusama",
"integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot",
"integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama",
"integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot",
"integration-tests/emulated/chains/parachains/collectives/collectives-polkadot",
"integration-tests/emulated/chains/parachains/people/people-kusama",
"integration-tests/emulated/chains/parachains/testing/penpal",
"integration-tests/emulated/helpers",
"integration-tests/emulated/networks/kusama-system",
Expand All @@ -43,6 +45,7 @@ members = [
"integration-tests/emulated/tests/assets/asset-hub-polkadot",
"integration-tests/emulated/tests/bridges/bridge-hub-kusama",
"integration-tests/emulated/tests/bridges/bridge-hub-polkadot",
"integration-tests/emulated/tests/people/people-kusama",
]

[profile.release]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "people-kusama-emulated-chain"
authors.workspace = true
edition.workspace = true
version.workspace = true
license = "Apache-2.0"
description = "People Kusama emulated chain used for integration tests"
publish = false

[dependencies]

# Substrate
sp-core = { version = "29.0.0" }
frame-support = { version = "29.0.0" }

# Cumulus
parachains-common = { version = "8.0.0" }
cumulus-primitives-core = { version = "0.8.0" }
emulated-integration-tests-common = { version = "4.0.0" }

# Local
people-kusama-runtime = { path = "../../../../../../system-parachains/people/people-kusama" }
kusama-emulated-chain = { path = "../../../relays/kusama" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Substrate
use sp_core::storage::Storage;

// Cumulus
use cumulus_primitives_core::ParaId;
use emulated_integration_tests_common::{build_genesis_storage, collators, SAFE_XCM_VERSION};
use parachains_common::Balance;

pub const PARA_ID: u32 = 1004;
pub const ED: Balance = people_kusama_runtime::ExistentialDeposit::get();

pub fn genesis() -> Storage {
let genesis_config = people_kusama_runtime::RuntimeGenesisConfig {
system: people_kusama_runtime::SystemConfig::default(),
parachain_info: people_kusama_runtime::ParachainInfoConfig {
parachain_id: ParaId::from(PARA_ID),
..Default::default()
},
collator_selection: people_kusama_runtime::CollatorSelectionConfig {
invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ED * 16,
..Default::default()
},
session: people_kusama_runtime::SessionConfig {
keys: collators::invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
people_kusama_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
},
polkadot_xcm: people_kusama_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
..Default::default()
};

build_genesis_storage(
&genesis_config,
people_kusama_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

pub mod genesis;

// Substrate
use frame_support::traits::OnInitialize;

// Cumulus
use emulated_integration_tests_common::{
impl_accounts_helpers_for_parachain, impl_assert_events_helpers_for_parachain,
impls::Parachain, xcm_emulator::decl_test_parachains,
};

// PeopleKusama Parachain declaration
decl_test_parachains! {
pub struct PeopleKusama {
genesis = genesis::genesis(),
on_init = {
people_kusama_runtime::AuraExt::on_initialize(1);
},
runtime = people_kusama_runtime,
core = {
XcmpMessageHandler: people_kusama_runtime::XcmpQueue,
LocationToAccountId: people_kusama_runtime::xcm_config::LocationToAccountId,
ParachainInfo: people_kusama_runtime::ParachainInfo,
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
},
pallets = {
PolkadotXcm: people_kusama_runtime::PolkadotXcm,
Balances: people_kusama_runtime::Balances,
Identity: people_kusama_runtime::Identity,
IdentityMigrator: people_kusama_runtime::IdentityMigrator,
}
},
}

// PeopleKusama implementation
impl_accounts_helpers_for_parachain!(PeopleKusama);
impl_assert_events_helpers_for_parachain!(PeopleKusama);
1 change: 1 addition & 0 deletions integration-tests/emulated/chains/relays/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ decl_test_relay_chains! {
Balances: kusama_runtime::Balances,
Hrmp: kusama_runtime::Hrmp,
Identity: kusama_runtime::Identity,
IdentityMigrator: kusama_runtime::IdentityMigrator,
}
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ asset-hub-kusama-emulated-chain = { path = "../../chains/parachains/assets/asset
bridge-hub-kusama-emulated-chain = { path = "../../chains/parachains/bridges/bridge-hub-kusama" }
kusama-emulated-chain = { path = "../../chains/relays/kusama" }
penpal-emulated-chain = { path = "../../chains/parachains/testing/penpal" }
people-kusama-emulated-chain = { path = "../../chains/parachains/people/people-kusama" }
6 changes: 5 additions & 1 deletion integration-tests/emulated/networks/kusama-system/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@ pub use asset_hub_kusama_emulated_chain;
pub use bridge_hub_kusama_emulated_chain;
pub use kusama_emulated_chain;
pub use penpal_emulated_chain;
pub use people_kusama_emulated_chain;

use asset_hub_kusama_emulated_chain::AssetHubKusama;
use bridge_hub_kusama_emulated_chain::BridgeHubKusama;
use kusama_emulated_chain::Kusama;
use penpal_emulated_chain::{PenpalA, PenpalB};
use people_kusama_emulated_chain::PeopleKusama;

// Cumulus
use emulated_integration_tests_common::{
Expand All @@ -37,6 +39,7 @@ decl_test_networks! {
BridgeHubKusama,
PenpalA,
PenpalB,
PeopleKusama,
],
bridge = ()
},
Expand All @@ -47,5 +50,6 @@ decl_test_sender_receiver_accounts_parameter_types! {
AssetHubKusamaPara { sender: ALICE, receiver: BOB },
BridgeHubKusamaPara { sender: ALICE, receiver: BOB },
PenpalAPara { sender: ALICE, receiver: BOB },
PenpalBPara { sender: ALICE, receiver: BOB }
PenpalBPara { sender: ALICE, receiver: BOB },
PeopleKusamaPara { sender: ALICE, receiver: BOB }
}
35 changes: 35 additions & 0 deletions integration-tests/emulated/tests/people/people-kusama/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[package]
name = "people-kusama-integration-tests"
version.workspace = true
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
description = "People Kusama runtime integration tests with xcm-emulator"
publish = false

[dependencies]
codec = { package = "parity-scale-codec", version = "3.6.9" }

# Substrate
sp-runtime = { version = "32.0.0" }
frame-support = { version = "29.0.0" }
pallet-balances = { version = "29.0.0" }
pallet-message-queue = { version = "32.0.0" }
pallet-identity = { version = "29.0.0" }

# Polkadot
polkadot-runtime-common = { version = "8.0.1" }
xcm = { package = "staging-xcm", version = "8.0.1" }
xcm-executor = { package = "staging-xcm-executor", default-features = false, version = "8.0.1" }

# Cumulus
parachains-common = { version = "8.0.0" }
emulated-integration-tests-common = { version = "4.0.0" }
asset-test-utils = { version = "8.0.1" }
cumulus-pallet-parachain-system = { features = ["parameterized-consensus-hook"], version = "0.8.1" }

# Local
kusama-runtime-constants = { path = "../../../../../relay/kusama/constants" }
kusama-runtime = { package = "staging-kusama-runtime", path = "../../../../../relay/kusama" }
people-kusama-runtime = { path = "../../../../../system-parachains/people/people-kusama" }
kusama-system-emulated-network = { path = "../../../networks/kusama-system" }
Loading

0 comments on commit 6d93705

Please sign in to comment.