-
Notifications
You must be signed in to change notification settings - Fork 101
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
Kusama People Chain #217
Kusama People Chain #217
Changes from 11 commits
dfaf3f1
d376490
61b60cf
7c487be
ceb6471
4f5599c
8e4f435
e5dc570
e002c1f
a5a7836
bea2818
a2e869d
e46efdc
727bab0
97ee556
2b21625
68e06b6
629f6f9
30743c4
37b5ec0
ae204c2
698c749
67839a3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the genesis storage not be produced by the runtime? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, @NachoPal ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In general it should be possible to do: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's some refactoring and improvement from @michalkucharczyk in polkadot-sdk on genesis config, maybe he has an opinion on how this can be done best with minimal copy+pasta. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not very familiar with this part of code. But if I understand correctly this function is later used for some integration tests. So it is not strictly runtime function, just a testing helper? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When it comes to duplication: If the set of customized fields in genesis config is the same for every runtime/test then we could use single json patch and use GenesisBuilder runtime API to build the storage. But this approach would also require that serialization format is exactly the same for every runtime (e.g. SessionKeys). However json-patch approach may slow down execution of the tests (this concern was raised by @NachoPal if I recall correctly) - as we need to execute a runtime call to get the state. |
||
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); |
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" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this needs to be added to the
runtimes-matrix.json
- for running tests/check-migrations...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed here: #245