Skip to content
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

Polkadot People Chain #319

Merged
Merged
Show file tree
Hide file tree
Changes from 37 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5c602c6
relay side
joepetrowski May 21, 2024
b742b05
add parachain runtime
joepetrowski May 21, 2024
19cdd2f
add integration tests
joepetrowski May 21, 2024
5ed4c8c
requires ED to teleport
joepetrowski May 21, 2024
2077279
fmt tests
joepetrowski May 21, 2024
56c6e20
fmt para runtime
joepetrowski May 21, 2024
056f42c
changelog
joepetrowski May 21, 2024
f88342a
add to CI
joepetrowski May 21, 2024
9781543
don't actually need ED, but check account needs to exist
joepetrowski May 21, 2024
f1d7909
merge main
joepetrowski May 21, 2024
c70411e
better solution that doesn't break teleport tests
joepetrowski May 21, 2024
f1fb5ab
fmt
joepetrowski May 21, 2024
88e8cc1
fmt (again)
joepetrowski May 21, 2024
c3370b0
merge main
joepetrowski May 22, 2024
e3c9e0a
Update system-parachains/people/people-polkadot/src/xcm_config.rs
joepetrowski May 29, 2024
afebcdc
Merge branch 'main' into polkadot-people
joepetrowski May 29, 2024
6940d9b
address review
joepetrowski May 29, 2024
3fea564
add type
joepetrowski May 30, 2024
f940d8d
Add people-polkadot to chain-spec-generator
bkontur May 30, 2024
83fc1dd
Added `[cumulus_pallet_parachain_system, ParachainSystem]`
bkontur May 30, 2024
cb67828
Added `[pallet_message_queue, MessageQueue]`
bkontur May 30, 2024
ae1debc
Fresh weights for people-polkadot
bkontur May 30, 2024
87be706
Fresh weights for people-kusama
bkontur May 30, 2024
0a64c66
Merge pull request #2 from bkontur/polkadot-people
joepetrowski May 30, 2024
5f81b5b
Weights for `polkadot_runtime_common::identity_migrator`
bkontur May 30, 2024
bfa4d77
Fix import
bkontur May 30, 2024
253ce14
Merge pull request #3 from bkontur/polkadot-people
joepetrowski Jun 6, 2024
7145189
Merge branch 'main' into polkadot-people
joepetrowski Jun 6, 2024
5ab9908
merge main
joepetrowski Jun 6, 2024
28bfe29
fix merge and build
joepetrowski Jun 6, 2024
61e3e5b
add metadata extension
joepetrowski Jun 7, 2024
27811dd
Fix `reap_identity` benchmark
bkontur Jun 7, 2024
f7018da
Merge pull request #5 from bkontur/polkadot-people
joepetrowski Jun 7, 2024
c370ff1
Change prefix
bkontur Jun 7, 2024
7896ee7
Fresh weights for `polkadot_runtime_common_identity_migrator` for `po…
bkontur Jun 7, 2024
ee84347
Just rename `runtime_common_*` files to correct `polkadot_runtime_com…
bkontur Jun 7, 2024
ba5480c
Merge pull request #6 from bkontur/polkadot-people
joepetrowski Jun 8, 2024
1899db3
remove unneeded migration
joepetrowski Jun 10, 2024
3290734
bump affected versions
joepetrowski Jun 10, 2024
6b0872b
merge main
joepetrowski Jun 11, 2024
7e3ac8c
fix changelog
joepetrowski Jun 11, 2024
91fd406
Merge branch 'main' into polkadot-people
joepetrowski Jun 13, 2024
c214dd8
Merge branch 'main' into polkadot-people
joepetrowski Jun 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/integration-tests-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
"name": "people-kusama",
"package": "people-kusama-integration-tests"
},
{
"name": "people-polkadot",
"package": "people-polkadot-integration-tests"
},
{
"name": "collectives-polkadot",
"package": "collectives-polkadot-integration-tests"
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/runtimes-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
"path": "system-parachains/people/people-kusama",
"is_relay": false
},
{
"name": "people-polkadot",
"package": "people-polkadot-runtime",
"path": "system-parachains/people/people-polkadot",
"is_relay": false
},
{
"name": "encointer-kusama",
"package": "encointer-kusama-runtime",
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Allow any parachain to have bidirectional channel with any system parachains ([polkadot-fellows/runtimes#329](https://github.com/polkadot-fellows/runtimes/pull/329))
- Update price controller of broker pallet to use higher leadin, without adjusting the minimum price too much ([polkadot-fellows/runtimes#334](https://github.com/polkadot-fellows/runtimes/pull/334)
- Enable support for new hardware signers like the generic ledger app ([polkadot-fellows/runtimes#337](https://github.com/polkadot-fellows/runtimes/pull/337))
- Add the Polkadot People Chain ([polkadot-fellows/runtimes#319](https://github.com/polkadot-fellows/runtimes/pull/319))

### Changed

Expand Down
104 changes: 104 additions & 0 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 @@ -170,6 +170,8 @@ penpal-emulated-chain = { path = "integration-tests/emulated/chains/parachains/t
penpal-runtime = { version = "0.15.1" }
people-kusama-emulated-chain = { path = "integration-tests/emulated/chains/parachains/people/people-kusama" }
people-kusama-runtime = { path = "system-parachains/people/people-kusama" }
people-polkadot-emulated-chain = { path = "integration-tests/emulated/chains/parachains/people/people-polkadot" }
people-polkadot-runtime = { path = "system-parachains/people/people-polkadot" }
polkadot-core-primitives = { version = "8.0.0", default-features = false }
polkadot-emulated-chain = { path = "integration-tests/emulated/chains/relays/polkadot" }
polkadot-parachain-primitives = { version = "7.0.0", default-features = false }
Expand Down Expand Up @@ -246,6 +248,7 @@ members = [
"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/people/people-polkadot",
"integration-tests/emulated/chains/parachains/testing/penpal",
"integration-tests/emulated/chains/relays/kusama",
"integration-tests/emulated/chains/relays/polkadot",
Expand All @@ -259,6 +262,7 @@ members = [
"integration-tests/emulated/tests/bridges/bridge-hub-polkadot",
"integration-tests/emulated/tests/collectives/collectives-polkadot",
"integration-tests/emulated/tests/people/people-kusama",
"integration-tests/emulated/tests/people/people-polkadot",
"relay/kusama",
"relay/kusama/constants",
"relay/polkadot",
Expand All @@ -278,6 +282,7 @@ members = [
"system-parachains/encointer",
"system-parachains/gluttons/glutton-kusama",
"system-parachains/people/people-kusama",
"system-parachains/people/people-polkadot",
"integration-tests/zombienet",
]

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 @@ -39,6 +39,7 @@ encointer-kusama-runtime = { workspace = true }
glutton-kusama-runtime = { workspace = true }
coretime-kusama-runtime = { workspace = true }
people-kusama-runtime = { workspace = true }
people-polkadot-runtime = { workspace = true }

[features]
fast-runtime = ["kusama-runtime/fast-runtime", "polkadot-runtime/fast-runtime"]
Expand All @@ -56,6 +57,7 @@ runtime-benchmarks = [
"pallet-staking/runtime-benchmarks",
"parachains-common/runtime-benchmarks",
"people-kusama-runtime/runtime-benchmarks",
"people-polkadot-runtime/runtime-benchmarks",
"polkadot-primitives/runtime-benchmarks",
"polkadot-runtime/runtime-benchmarks",
"runtime-parachains/runtime-benchmarks",
Expand Down
6 changes: 5 additions & 1 deletion chain-spec-generator/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
system_parachains_specs::{
AssetHubKusamaChainSpec, AssetHubPolkadotChainSpec, BridgeHubKusamaChainSpec,
BridgeHubPolkadotChainSpec, CollectivesPolkadotChainSpec, EncointerKusamaChainSpec,
GluttonKusamaChainSpec,
GluttonKusamaChainSpec, PeopleKusamaChainSpec, PeoplePolkadotChainSpec,
},
ChainSpec,
};
Expand Down Expand Up @@ -90,6 +90,10 @@ pub fn from_json_file(filepath: &str, supported: String) -> Result<Box<dyn Chain
Ok(Box::new(GluttonKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("encointer-kusama") =>
Ok(Box::new(EncointerKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("people-kusama") =>
Ok(Box::new(PeopleKusamaChainSpec::from_json_file(path)?)),
x if x.starts_with("people-polkadot") =>
Ok(Box::new(PeoplePolkadotChainSpec::from_json_file(path)?)),
_ => Err(format!("Unknown chain 'id' in json file. Only supported: {supported}'")),
}
}
4 changes: 4 additions & 0 deletions chain-spec-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ fn main() -> Result<(), String> {
"people-kusama-local",
Box::new(system_parachains_specs::people_kusama_local_testnet_config) as Box<_>,
),
(
"people-polkadot-local",
Box::new(system_parachains_specs::people_polkadot_local_testnet_config) as Box<_>,
),
]);

if let Some(function) = supported_chains.get(&*cli.chain) {
Expand Down
85 changes: 85 additions & 0 deletions chain-spec-generator/src/system_parachains_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ pub type CoretimeKusamaChainSpec = sc_chain_spec::GenericChainSpec<(), Extension

pub type PeopleKusamaChainSpec = sc_chain_spec::GenericChainSpec<(), Extensions>;

pub type PeoplePolkadotChainSpec = sc_chain_spec::GenericChainSpec<(), Extensions>;

const ASSET_HUB_POLKADOT_ED: Balance = asset_hub_polkadot_runtime::ExistentialDeposit::get();

const ASSET_HUB_KUSAMA_ED: Balance = asset_hub_kusama_runtime::ExistentialDeposit::get();
Expand All @@ -66,6 +68,8 @@ const CORETIME_KUSAMA_ED: Balance = coretime_kusama_runtime::ExistentialDeposit:

const PEOPLE_KUSAMA_ED: Balance = people_kusama_runtime::ExistentialDeposit::get();

const PEOPLE_POLKADOT_ED: Balance = people_polkadot_runtime::ExistentialDeposit::get();

/// The default XCM version to set in genesis config.
const SAFE_XCM_VERSION: u32 = xcm::prelude::XCM_VERSION;

Expand Down Expand Up @@ -144,6 +148,13 @@ pub fn people_kusama_session_keys(keys: AuraId) -> people_kusama_runtime::Sessio
people_kusama_runtime::SessionKeys { aura: keys }
}

/// Generate the session keys from individual elements.
///
/// The input must be a tuple of individual keys (a single arg for now since we have just one key).
pub fn people_polkadot_session_keys(keys: AuraId) -> people_polkadot_runtime::SessionKeys {
people_polkadot_runtime::SessionKeys { aura: keys }
}

// AssetHubPolkadot
fn asset_hub_polkadot_genesis(
invulnerables: Vec<(AccountId, AssetHubPolkadotAuraId)>,
Expand Down Expand Up @@ -758,3 +769,77 @@ pub fn people_kusama_local_testnet_config() -> Result<Box<dyn ChainSpec>, String
.build(),
))
}

// PeoplePolkadot
fn people_polkadot_genesis(
invulnerables: Vec<(AccountId, AuraId)>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> serde_json::Value {
serde_json::json!({
"balances": people_polkadot_runtime::BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, PEOPLE_POLKADOT_ED * 4096 * 4096))
ggwpez marked this conversation as resolved.
Show resolved Hide resolved
.collect(),
},
"parachainInfo": people_polkadot_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
"collatorSelection": people_polkadot_runtime::CollatorSelectionConfig {
invulnerables: invulnerables.iter().cloned().map(|(acc, _)| acc).collect(),
candidacy_bond: PEOPLE_POLKADOT_ED * 16,
..Default::default()
},
"session": people_polkadot_runtime::SessionConfig {
keys: invulnerables
.into_iter()
.map(|(acc, aura)| {
(
acc.clone(), // account id
acc, // validator id
people_polkadot_session_keys(aura), // session keys
)
})
.collect(),
},
"polkadotXcm": {
"safeXcmVersion": Some(SAFE_XCM_VERSION),
},
// no need to pass anything to aura, in fact it will panic if we do. Session will take care
// of this. `aura: Default::default()`
})
}

fn people_polkadot_local_genesis(para_id: ParaId) -> serde_json::Value {
crate::system_parachains_specs::people_polkadot_genesis(
// initial collators.
invulnerables(),
testnet_accounts(),
para_id,
)
}

pub fn people_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(
PeoplePolkadotChainSpec::builder(
people_polkadot_runtime::WASM_BINARY.expect("PeoplePolkadot wasm not available!"),
Extensions { relay_chain: "polkadot-local".into(), para_id: 1004 },
ggwpez marked this conversation as resolved.
Show resolved Hide resolved
)
.with_name("Polkadot People Local")
.with_id("people-polkadot-local")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(crate::system_parachains_specs::people_polkadot_local_genesis(
1004.into(),
))
.with_properties(properties)
.build(),
))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "people-polkadot-emulated-chain"
authors.workspace = true
edition.workspace = true
version.workspace = true
license = "Apache-2.0"
description = "People 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 }

# Local
people-polkadot-runtime = { workspace = true }
polkadot-emulated-chain = { workspace = true }
Loading
Loading