mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
"Common good" vs "System" parachain clean up (#1406)
## Summary The term "common good parachain" has been abandoned in favor of "system parachain" - e.g. [Joe's speech at Decoded2023](https://youtu.be/CSO-ERHK2gY?t=456). This pull request tries to fix and align code with this vision. ## Impact The important change is implementation of `trait IsSystem` for `Id` [here](https://github.com/paritytech/polkadot-sdk/pull/1406/files#diff-0b7b4f5b962a18ce980354592b55ab2a27b5a2e9f6f8089ec803ca73853e8583R225-R229) where we changed condition from `< 1000` to `<= 1999`, which means that all parachain IDs bellow 1999 (included) are considered as "system parachain" IDs. This change has a direct impact on the following components: #### [ChildSystemParachainAsSuperuser](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-builder/src/origin_conversion.rs#L72-L88) This origin converter is used for allowing to process XCM `Transact` from "system parachain" on the relay chain - e.g. see [configuration for Kusama](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/runtime/kusama/src/xcm_config.rs#L92-L101). Only configured for Kusama, Westend, Rococo runtimes. **No need for this feature anymore.** See [comment](https://github.com/paritytech/polkadot-sdk/pull/1406#issuecomment-1708218715). #### [IsChildSystemParachain](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-builder/src/barriers.rs#L310-L317) `IsChildSystemParachain` is used with `AllowExplicitUnpaidExecutionFrom` barrier for checking XCM programs (they have to start with `UnpaidExecution` instruction). Only configured for Kusama, Westend, Rococo runtimes. **Overall the impact is low or mostly ok because it only allows unpaid execution for "system parachains" (e.g. AssetHub, BridgeHub...) on the relay chain.** #### [SiblingSystemParachainAsSuperuser](https://github.com/paritytech/polkadot-sdk/blob/master/polkadot/xcm/xcm-builder/src/origin_conversion.rs#L94-L114) Not used anywhere in `polkadot-sdk` repo. ## Unresolved Questions - [ ] constants `LOWEST_USER_ID` and `LOWEST_PUBLIC_ID` seem to express the same thing now, do we want to keep them both or deprecated one of them? If so, which one? - [x] determine impact for `ChildSystemParachainAsSuperuser` ## TODO - [ ] when merged here, open PR to the `polkadot-fellows` ## Related Material https://youtu.be/CSO-ERHK2gY?t=456 https://forum.polkadot.network/t/polkadot-protocol-and-common-good-parachains/866 https://wiki.polkadot.network/docs/learn-system-chains
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
//!
|
//!
|
||||||
//! ### Governance
|
//! ### Governance
|
||||||
//!
|
//!
|
||||||
//! As a common good parachain, Collectives defers its governance (namely, its `Root` origin), to
|
//! As a system parachain, Collectives defers its governance (namely, its `Root` origin), to
|
||||||
//! its Relay Chain parent, Polkadot.
|
//! its Relay Chain parent, Polkadot.
|
||||||
//!
|
//!
|
||||||
//! ### Collator Selection
|
//! ### Collator Selection
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ pub type Barrier = TrailingSetTopicAsId<
|
|||||||
// If the message is one that immediately attemps to pay for execution, then
|
// If the message is one that immediately attemps to pay for execution, then
|
||||||
// allow it.
|
// allow it.
|
||||||
AllowTopLevelPaidExecutionFrom<Everything>,
|
AllowTopLevelPaidExecutionFrom<Everything>,
|
||||||
// Common Good Assets parachain, parent and its exec plurality get free
|
// System Assets parachain, parent and its exec plurality get free
|
||||||
// execution
|
// execution
|
||||||
AllowExplicitUnpaidExecutionFrom<(
|
AllowExplicitUnpaidExecutionFrom<(
|
||||||
CommonGoodAssetsParachain,
|
CommonGoodAssetsParachain,
|
||||||
|
|||||||
@@ -199,13 +199,11 @@ impl From<i32> for Id {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const USER_INDEX_START: u32 = 1000;
|
// System parachain ID is considered `< 2000`.
|
||||||
|
const SYSTEM_INDEX_END: u32 = 1999;
|
||||||
const PUBLIC_INDEX_START: u32 = 2000;
|
const PUBLIC_INDEX_START: u32 = 2000;
|
||||||
|
|
||||||
/// The ID of the first user (non-system) parachain.
|
/// The ID of the first publicly registrable parachain.
|
||||||
pub const LOWEST_USER_ID: Id = Id(USER_INDEX_START);
|
|
||||||
|
|
||||||
/// The ID of the first publicly registerable parachain.
|
|
||||||
pub const LOWEST_PUBLIC_ID: Id = Id(PUBLIC_INDEX_START);
|
pub const LOWEST_PUBLIC_ID: Id = Id(PUBLIC_INDEX_START);
|
||||||
|
|
||||||
impl Id {
|
impl Id {
|
||||||
@@ -223,7 +221,7 @@ pub trait IsSystem {
|
|||||||
|
|
||||||
impl IsSystem for Id {
|
impl IsSystem for Id {
|
||||||
fn is_system(&self) -> bool {
|
fn is_system(&self) -> bool {
|
||||||
self.0 < USER_INDEX_START
|
self.0 <= SYSTEM_INDEX_END
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ pub use polkadot_core_primitives::v2::{
|
|||||||
// Export some polkadot-parachain primitives
|
// Export some polkadot-parachain primitives
|
||||||
pub use polkadot_parachain_primitives::primitives::{
|
pub use polkadot_parachain_primitives::primitives::{
|
||||||
HeadData, HorizontalMessages, HrmpChannelId, Id, UpwardMessage, UpwardMessages, ValidationCode,
|
HeadData, HorizontalMessages, HrmpChannelId, Id, UpwardMessage, UpwardMessages, ValidationCode,
|
||||||
ValidationCodeHash, LOWEST_PUBLIC_ID, LOWEST_USER_ID,
|
ValidationCodeHash, LOWEST_PUBLIC_ID,
|
||||||
};
|
};
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|||||||
@@ -643,7 +643,7 @@ impl pallet_staking::EraPayout<Balance> for EraPayout {
|
|||||||
// all para-ids that are currently active.
|
// all para-ids that are currently active.
|
||||||
let auctioned_slots = Paras::parachains()
|
let auctioned_slots = Paras::parachains()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
// all active para-ids that do not belong to a system or common good chain is the number
|
// all active para-ids that do not belong to a system chain is the number
|
||||||
// of parachains that we should take into account for inflation.
|
// of parachains that we should take into account for inflation.
|
||||||
.filter(|i| *i >= LOWEST_PUBLIC_ID)
|
.filter(|i| *i >= LOWEST_PUBLIC_ID)
|
||||||
.count() as u64;
|
.count() as u64;
|
||||||
|
|||||||
@@ -37,11 +37,10 @@ use xcm::latest::prelude::*;
|
|||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
||||||
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
|
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
|
||||||
ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
|
ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain,
|
||||||
CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain, IsConcrete, MintLocation,
|
IsConcrete, MintLocation, OriginToPluralityVoice, SignedAccountId32AsNative,
|
||||||
OriginToPluralityVoice, SignedAccountId32AsNative, SignedToAccountId32,
|
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
|
||||||
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
|
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
|
||||||
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
@@ -95,8 +94,6 @@ type LocalOriginConverter = (
|
|||||||
ChildParachainAsNative<parachains_origin::Origin, RuntimeOrigin>,
|
ChildParachainAsNative<parachains_origin::Origin, RuntimeOrigin>,
|
||||||
// The AccountId32 location type can be expressed natively as a `Signed` origin.
|
// The AccountId32 location type can be expressed natively as a `Signed` origin.
|
||||||
SignedAccountId32AsNative<ThisNetwork, RuntimeOrigin>,
|
SignedAccountId32AsNative<ThisNetwork, RuntimeOrigin>,
|
||||||
// A system child parachain, expressed as a Superuser, converts to the `Root` origin.
|
|
||||||
ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -552,7 +552,7 @@ impl pallet_staking::EraPayout<Balance> for EraPayout {
|
|||||||
// all para-ids that are not active.
|
// all para-ids that are not active.
|
||||||
let auctioned_slots = Paras::parachains()
|
let auctioned_slots = Paras::parachains()
|
||||||
.into_iter()
|
.into_iter()
|
||||||
// all active para-ids that do not belong to a system or common good chain is the number
|
// all active para-ids that do not belong to a system chain is the number
|
||||||
// of parachains that we should take into account for inflation.
|
// of parachains that we should take into account for inflation.
|
||||||
.filter(|i| *i >= LOWEST_PUBLIC_ID)
|
.filter(|i| *i >= LOWEST_PUBLIC_ID)
|
||||||
.count() as u64;
|
.count() as u64;
|
||||||
|
|||||||
@@ -36,11 +36,10 @@ use xcm::latest::prelude::*;
|
|||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
||||||
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
|
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
|
||||||
ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
|
ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds,
|
||||||
CurrencyAdapter as XcmCurrencyAdapter, FixedWeightBounds, IsChildSystemParachain, IsConcrete,
|
IsChildSystemParachain, IsConcrete, MintLocation, SignedAccountId32AsNative,
|
||||||
MintLocation, SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation,
|
SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId,
|
||||||
TakeWeightCredit, TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin,
|
UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
|
||||||
WithUniqueTopic,
|
|
||||||
};
|
};
|
||||||
use xcm_executor::XcmExecutor;
|
use xcm_executor::XcmExecutor;
|
||||||
|
|
||||||
@@ -80,8 +79,6 @@ type LocalOriginConverter = (
|
|||||||
ChildParachainAsNative<parachains_origin::Origin, RuntimeOrigin>,
|
ChildParachainAsNative<parachains_origin::Origin, RuntimeOrigin>,
|
||||||
// The AccountId32 location type can be expressed natively as a `Signed` origin.
|
// The AccountId32 location type can be expressed natively as a `Signed` origin.
|
||||||
SignedAccountId32AsNative<ThisNetwork, RuntimeOrigin>,
|
SignedAccountId32AsNative<ThisNetwork, RuntimeOrigin>,
|
||||||
// A system child parachain, expressed as a Superuser, converts to the `Root` origin.
|
|
||||||
ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
parameter_types! {
|
parameter_types! {
|
||||||
|
|||||||
@@ -35,10 +35,10 @@ use xcm::latest::prelude::*;
|
|||||||
use xcm_builder::{
|
use xcm_builder::{
|
||||||
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
|
||||||
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
|
AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, ChildParachainAsNative,
|
||||||
ChildParachainConvertsVia, ChildSystemParachainAsSuperuser,
|
ChildParachainConvertsVia, CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain,
|
||||||
CurrencyAdapter as XcmCurrencyAdapter, IsChildSystemParachain, IsConcrete, MintLocation,
|
IsConcrete, MintLocation, SignedAccountId32AsNative, SignedToAccountId32,
|
||||||
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
|
SovereignSignedViaLocation, TakeWeightCredit, TrailingSetTopicAsId, UsingComponents,
|
||||||
TrailingSetTopicAsId, UsingComponents, WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
|
WeightInfoBounds, WithComputedOrigin, WithUniqueTopic,
|
||||||
};
|
};
|
||||||
use xcm_executor::XcmExecutor;
|
use xcm_executor::XcmExecutor;
|
||||||
|
|
||||||
@@ -74,7 +74,6 @@ type LocalOriginConverter = (
|
|||||||
SovereignSignedViaLocation<LocationConverter, RuntimeOrigin>,
|
SovereignSignedViaLocation<LocationConverter, RuntimeOrigin>,
|
||||||
ChildParachainAsNative<parachains_origin::Origin, RuntimeOrigin>,
|
ChildParachainAsNative<parachains_origin::Origin, RuntimeOrigin>,
|
||||||
SignedAccountId32AsNative<ThisNetwork, RuntimeOrigin>,
|
SignedAccountId32AsNative<ThisNetwork, RuntimeOrigin>,
|
||||||
ChildSystemParachainAsSuperuser<ParaId, RuntimeOrigin>,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our
|
/// The XCM router. When we want to send an XCM message, we use this type. It amalgamates all of our
|
||||||
|
|||||||
Reference in New Issue
Block a user