Rococo & Westend People Chain (#2281)

Rococo and Westend runtimes for the "People Chain". This chain contains
the Identity pallet with plans to migrate all related data from the
Relay Chain.

Changes `IdentityInfo` to:

- Remove `additional_fields`.
- Add `github` and `discord` as first class fields. From scraping chain
data, these were the only two additional fields used (for the Fellowship
and Ambassador Program, respectively).
- Rename `riot` to `matrix`.

Note: This will use the script in
https://github.com/paritytech/polkadot-sdk/pull/2025 to generate the
genesis state.

TODO:

- [x] https://github.com/paritytech/polkadot-sdk/pull/1814 and
integration of the Identity Migrator pallet for migration.
- [x] Tests: https://github.com/paritytech/polkadot-sdk/pull/2373

---------

Co-authored-by: Muharem <ismailov.m.h@gmail.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
Co-authored-by: Dónal Murray <donal.murray@parity.io>
Co-authored-by: Richard Melkonian <35300528+0xmovses@users.noreply.github.com>
Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
This commit is contained in:
joe petrowski
2023-12-22 21:28:09 +01:00
committed by GitHub
parent 4c0e0e0713
commit ecbbb5a736
111 changed files with 12730 additions and 258 deletions
@@ -0,0 +1,25 @@
[package]
name = "people-rococo-emulated-chain"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
description = "People Rococo emulated chain"
publish = false
[dependencies]
serde_json = "1.0.104"
# Substrate
sp-core = { path = "../../../../../../../../substrate/primitives/core", default-features = false }
sp-runtime = { path = "../../../../../../../../substrate/primitives/runtime", default-features = false }
frame-support = { path = "../../../../../../../../substrate/frame/support", default-features = false }
# Polakadot
parachains-common = { path = "../../../../../../../parachains/common" }
# Cumulus
cumulus-primitives-core = { path = "../../../../../../../primitives/core", default-features = false }
emulated-integration-tests-common = { path = "../../../../common", default-features = false }
people-rococo-runtime = { path = "../../../../../../runtimes/people/people-rococo" }
rococo-emulated-chain = { path = "../../../relays/rococo" }
@@ -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 = parachains_common::rococo::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage {
let genesis_config = people_rococo_runtime::RuntimeGenesisConfig {
system: people_rococo_runtime::SystemConfig::default(),
parachain_info: people_rococo_runtime::ParachainInfoConfig {
parachain_id: ParaId::from(PARA_ID),
..Default::default()
},
collator_selection: people_rococo_runtime::CollatorSelectionConfig {
invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ED * 16,
..Default::default()
},
session: people_rococo_runtime::SessionConfig {
keys: collators::invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
people_rococo_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
},
polkadot_xcm: people_rococo_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
..Default::default()
};
build_genesis_storage(
&genesis_config,
people_rococo_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
)
}
@@ -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,
};
// PeopleRococo Parachain declaration
decl_test_parachains! {
pub struct PeopleRococo {
genesis = genesis::genesis(),
on_init = {
people_rococo_runtime::AuraExt::on_initialize(1);
},
runtime = people_rococo_runtime,
core = {
XcmpMessageHandler: people_rococo_runtime::XcmpQueue,
LocationToAccountId: people_rococo_runtime::xcm_config::LocationToAccountId,
ParachainInfo: people_rococo_runtime::ParachainInfo,
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
},
pallets = {
PolkadotXcm: people_rococo_runtime::PolkadotXcm,
Balances: people_rococo_runtime::Balances,
Identity: people_rococo_runtime::Identity,
IdentityMigrator: people_rococo_runtime::IdentityMigrator,
}
},
}
// PeopleRococo implementation
impl_accounts_helpers_for_parachain!(PeopleRococo);
impl_assert_events_helpers_for_parachain!(PeopleRococo);
@@ -0,0 +1,25 @@
[package]
name = "people-westend-emulated-chain"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license = "Apache-2.0"
description = "People Westend emulated chain"
publish = false
[dependencies]
serde_json = "1.0.104"
# Substrate
sp-core = { path = "../../../../../../../../substrate/primitives/core", default-features = false }
sp-runtime = { path = "../../../../../../../../substrate/primitives/runtime", default-features = false }
frame-support = { path = "../../../../../../../../substrate/frame/support", default-features = false }
# Polakadot
parachains-common = { path = "../../../../../../../parachains/common" }
# Cumulus
cumulus-primitives-core = { path = "../../../../../../../primitives/core", default-features = false }
emulated-integration-tests-common = { path = "../../../../common", default-features = false }
people-westend-runtime = { path = "../../../../../../runtimes/people/people-westend" }
westend-emulated-chain = { path = "../../../relays/westend" }
@@ -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 = parachains_common::westend::currency::EXISTENTIAL_DEPOSIT;
pub fn genesis() -> Storage {
let genesis_config = people_westend_runtime::RuntimeGenesisConfig {
system: people_westend_runtime::SystemConfig::default(),
parachain_info: people_westend_runtime::ParachainInfoConfig {
parachain_id: ParaId::from(PARA_ID),
..Default::default()
},
collator_selection: people_westend_runtime::CollatorSelectionConfig {
invulnerables: collators::invulnerables().iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: ED * 16,
..Default::default()
},
session: people_westend_runtime::SessionConfig {
keys: collators::invulnerables()
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
people_westend_runtime::SessionKeys { aura }, // session keys
)
})
.collect(),
},
polkadot_xcm: people_westend_runtime::PolkadotXcmConfig {
safe_xcm_version: Some(SAFE_XCM_VERSION),
..Default::default()
},
..Default::default()
};
build_genesis_storage(
&genesis_config,
people_westend_runtime::WASM_BINARY.expect("WASM binary was not built, please build it!"),
)
}
@@ -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,
};
// PeopleWestend Parachain declaration
decl_test_parachains! {
pub struct PeopleWestend {
genesis = genesis::genesis(),
on_init = {
people_westend_runtime::AuraExt::on_initialize(1);
},
runtime = people_westend_runtime,
core = {
XcmpMessageHandler: people_westend_runtime::XcmpQueue,
LocationToAccountId: people_westend_runtime::xcm_config::LocationToAccountId,
ParachainInfo: people_westend_runtime::ParachainInfo,
MessageOrigin: cumulus_primitives_core::AggregateMessageOrigin,
},
pallets = {
PolkadotXcm: people_westend_runtime::PolkadotXcm,
Balances: people_westend_runtime::Balances,
Identity: people_westend_runtime::Identity,
IdentityMigrator: people_westend_runtime::IdentityMigrator,
}
},
}
// PeopleWestend implementation
impl_accounts_helpers_for_parachain!(PeopleWestend);
impl_assert_events_helpers_for_parachain!(PeopleWestend);