mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-08 14:48:01 +00:00
Disable Calls to Identity Pallet (#1476)
This PR filters calls from the Identity pallet from all Relay Chain runtimes as preparation to move the identity state and logic to a system parachain within each network. After this change is deployed to a runtime, no more changes such as adding new sub-identities will be possible. The frozen state will be part of the genesis state of the system chain. After the system chain launches, the pallet and all state will be removed from each Relay Chain. Applications and UIs that render display information from this pallet will need to read from the system chain when it launches.
This commit is contained in:
@@ -63,9 +63,9 @@ use frame_election_provider_support::{
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{
|
||||
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, InstanceFilter,
|
||||
KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError,
|
||||
StorageMapShim, WithdrawReasons,
|
||||
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, EverythingBut,
|
||||
InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage,
|
||||
ProcessMessageError, StorageMapShim, WithdrawReasons,
|
||||
},
|
||||
weights::{ConstantMultiplier, WeightMeter},
|
||||
PalletId,
|
||||
@@ -158,11 +158,14 @@ pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
/// We currently allow all calls.
|
||||
pub struct BaseFilter;
|
||||
impl Contains<RuntimeCall> for BaseFilter {
|
||||
fn contains(_c: &RuntimeCall) -> bool {
|
||||
true
|
||||
/// A type to identify calls to the Identity pallet. These will be filtered to prevent invocation,
|
||||
/// locking the state of the pallet and preventing further updates to identities and sub-identities.
|
||||
/// The locked state will be the genesis state of a new system chain and then removed from the Relay
|
||||
/// Chain.
|
||||
pub struct IdentityCalls;
|
||||
impl Contains<RuntimeCall> for IdentityCalls {
|
||||
fn contains(c: &RuntimeCall) -> bool {
|
||||
matches!(c, RuntimeCall::Identity(_))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +175,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type BaseCallFilter = EverythingBut<IdentityCalls>;
|
||||
type BlockWeights = BlockWeights;
|
||||
type BlockLength = BlockLength;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
|
||||
@@ -47,9 +47,9 @@ use frame_election_provider_support::{
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{
|
||||
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, InstanceFilter,
|
||||
KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError,
|
||||
WithdrawReasons,
|
||||
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, EverythingBut,
|
||||
InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage,
|
||||
ProcessMessageError, WithdrawReasons,
|
||||
},
|
||||
weights::{ConstantMultiplier, WeightMeter},
|
||||
PalletId,
|
||||
@@ -149,13 +149,24 @@ pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
/// A type to identify calls to the Identity pallet. These will be filtered to prevent invocation,
|
||||
/// locking the state of the pallet and preventing further updates to identities and sub-identities.
|
||||
/// The locked state will be the genesis state of a new system chain and then removed from the Relay
|
||||
/// Chain.
|
||||
pub struct IdentityCalls;
|
||||
impl Contains<RuntimeCall> for IdentityCalls {
|
||||
fn contains(c: &RuntimeCall) -> bool {
|
||||
matches!(c, RuntimeCall::Identity(_))
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub const SS58Prefix: u8 = 0;
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type BaseCallFilter = EverythingBut<IdentityCalls>;
|
||||
type BlockWeights = BlockWeights;
|
||||
type BlockLength = BlockLength;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
|
||||
@@ -60,7 +60,7 @@ use beefy_primitives::{
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{
|
||||
fungible::HoldConsideration, Contains, EitherOfDiverse, InstanceFilter,
|
||||
fungible::HoldConsideration, Contains, EitherOfDiverse, EverythingBut, InstanceFilter,
|
||||
KeyOwnerProofSystem, LinearStoragePrice, LockIdentifier, PrivilegeCmp, ProcessMessage,
|
||||
ProcessMessageError, StorageMapShim, WithdrawReasons,
|
||||
},
|
||||
@@ -135,11 +135,14 @@ pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
/// We currently allow all calls.
|
||||
pub struct BaseFilter;
|
||||
impl Contains<RuntimeCall> for BaseFilter {
|
||||
fn contains(_call: &RuntimeCall) -> bool {
|
||||
true
|
||||
/// A type to identify calls to the Identity pallet. These will be filtered to prevent invocation,
|
||||
/// locking the state of the pallet and preventing further updates to identities and sub-identities.
|
||||
/// The locked state will be the genesis state of a new system chain and then removed from the Relay
|
||||
/// Chain.
|
||||
pub struct IdentityCalls;
|
||||
impl Contains<RuntimeCall> for IdentityCalls {
|
||||
fn contains(c: &RuntimeCall) -> bool {
|
||||
matches!(c, RuntimeCall::Identity(_))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,7 +152,7 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = BaseFilter;
|
||||
type BaseCallFilter = EverythingBut<IdentityCalls>;
|
||||
type BlockWeights = BlockWeights;
|
||||
type BlockLength = BlockLength;
|
||||
type DbWeight = RocksDbWeight;
|
||||
|
||||
@@ -29,8 +29,9 @@ use frame_election_provider_support::{bounds::ElectionBoundsBuilder, onchain, Se
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{
|
||||
fungible::HoldConsideration, ConstU32, InstanceFilter, KeyOwnerProofSystem,
|
||||
LinearStoragePrice, ProcessMessage, ProcessMessageError, WithdrawReasons,
|
||||
fungible::HoldConsideration, ConstU32, Contains, EverythingBut, InstanceFilter,
|
||||
KeyOwnerProofSystem, LinearStoragePrice, ProcessMessage, ProcessMessageError,
|
||||
WithdrawReasons,
|
||||
},
|
||||
weights::{ConstantMultiplier, WeightMeter},
|
||||
PalletId,
|
||||
@@ -141,13 +142,24 @@ pub fn native_version() -> NativeVersion {
|
||||
NativeVersion { runtime_version: VERSION, can_author_with: Default::default() }
|
||||
}
|
||||
|
||||
/// A type to identify calls to the Identity pallet. These will be filtered to prevent invocation,
|
||||
/// locking the state of the pallet and preventing further updates to identities and sub-identities.
|
||||
/// The locked state will be the genesis state of a new system chain and then removed from the Relay
|
||||
/// Chain.
|
||||
pub struct IdentityCalls;
|
||||
impl Contains<RuntimeCall> for IdentityCalls {
|
||||
fn contains(c: &RuntimeCall) -> bool {
|
||||
matches!(c, RuntimeCall::Identity(_))
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub const SS58Prefix: u8 = 42;
|
||||
}
|
||||
|
||||
impl frame_system::Config for Runtime {
|
||||
type BaseCallFilter = frame_support::traits::Everything;
|
||||
type BaseCallFilter = EverythingBut<IdentityCalls>;
|
||||
type BlockWeights = BlockWeights;
|
||||
type BlockLength = BlockLength;
|
||||
type RuntimeOrigin = RuntimeOrigin;
|
||||
|
||||
@@ -171,7 +171,9 @@ impl<Bridges: ExporterFor, Router: SendXcm, UniversalLocation: Get<InteriorMulti
|
||||
let xcm = msg.take().ok_or(MissingArgument)?;
|
||||
|
||||
// find exporter
|
||||
let Some((bridge, maybe_payment)) = Bridges::exporter_for(&remote_network, &remote_location, &xcm) else {
|
||||
let Some((bridge, maybe_payment)) =
|
||||
Bridges::exporter_for(&remote_network, &remote_location, &xcm)
|
||||
else {
|
||||
// We need to make sure that msg is not consumed in case of `NotApplicable`.
|
||||
*msg = Some(xcm);
|
||||
return Err(SendError::NotApplicable)
|
||||
@@ -236,7 +238,9 @@ impl<Bridges: ExporterFor, Router: SendXcm, UniversalLocation: Get<InteriorMulti
|
||||
let xcm = msg.take().ok_or(MissingArgument)?;
|
||||
|
||||
// find exporter
|
||||
let Some((bridge, maybe_payment)) = Bridges::exporter_for(&remote_network, &remote_location, &xcm) else {
|
||||
let Some((bridge, maybe_payment)) =
|
||||
Bridges::exporter_for(&remote_network, &remote_location, &xcm)
|
||||
else {
|
||||
// We need to make sure that msg is not consumed in case of `NotApplicable`.
|
||||
*msg = Some(xcm);
|
||||
return Err(SendError::NotApplicable)
|
||||
|
||||
Reference in New Issue
Block a user