Skip to content

Commit

Permalink
rococo identity migration part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
joepetrowski committed Jan 16, 2024
1 parent a42a47f commit a2516cb
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 137 deletions.
29 changes: 4 additions & 25 deletions cumulus/parachains/runtimes/people/people-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ use frame_support::{
genesis_builder_helper::{build_config, create_default_config},
parameter_types,
traits::{
ConstBool, ConstU32, ConstU64, ConstU8, Contains, EitherOfDiverse, EverythingBut,
TransformOrigin,
ConstBool, ConstU32, ConstU64, ConstU8, EitherOfDiverse, Everything, TransformOrigin,
},
weights::{ConstantMultiplier, Weight},
PalletId,
Expand All @@ -48,7 +47,7 @@ use parachains_common::{
AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO,
HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use polkadot_runtime_common::{identity_migrator, BlockHashCount, SlowAdjustingFeeUpdate};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use sp_api::impl_runtime_apis;
pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
Expand Down Expand Up @@ -124,7 +123,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("people-rococo"),
impl_name: create_runtime_str!("people-rococo"),
authoring_version: 1,
spec_version: 1_000,
spec_version: 1_006_001,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 0,
Expand Down Expand Up @@ -162,16 +161,9 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}

pub struct IdentityCalls;
impl Contains<RuntimeCall> for IdentityCalls {
fn contains(c: &RuntimeCall) -> bool {
matches!(c, RuntimeCall::Identity(_))
}
}

#[derive_impl(frame_system::config_preludes::ParaChainDefaultConfig as frame_system::DefaultConfig)]
impl frame_system::Config for Runtime {
type BaseCallFilter = EverythingBut<IdentityCalls>;
type BaseCallFilter = Everything;
type BlockWeights = RuntimeBlockWeights;
type BlockLength = RuntimeBlockLength;
type AccountId = AccountId;
Expand Down Expand Up @@ -395,14 +387,6 @@ impl pallet_utility::Config for Runtime {
type WeightInfo = weights::pallet_utility::WeightInfo<Runtime>;
}

// To be removed after migration is complete.
impl identity_migrator::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Reaper = EnsureRoot<AccountId>;
type ReapIdentityHandler = ();
type WeightInfo = weights::polkadot_runtime_common_identity_migrator::WeightInfo<Runtime>;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime
Expand Down Expand Up @@ -438,9 +422,6 @@ construct_runtime!(

// The main stage.
Identity: pallet_identity::{Pallet, Call, Storage, Event<T>} = 50,

// To migrate deposits
IdentityMigrator: identity_migrator::{Pallet, Call, Event<T>} = 248,
}
);

Expand All @@ -459,8 +440,6 @@ mod benches {
[pallet_session, SessionBench::<Runtime>]
[pallet_utility, Utility]
[pallet_timestamp, Timestamp]
// Polkadot
[polkadot_runtime_common::identity_migrator, IdentityMigrator]
// Cumulus
[cumulus_pallet_xcmp_queue, XcmpQueue]
[pallet_collator_selection, CollatorSelection]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ pub mod pallet_timestamp;
pub mod pallet_utility;
pub mod pallet_xcm;
pub mod paritydb_weights;
pub mod polkadot_runtime_common_identity_migrator;
pub mod rocksdb_weights;
pub mod xcm;

Expand Down

This file was deleted.

19 changes: 10 additions & 9 deletions cumulus/parachains/runtimes/people/people-rococo/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,15 @@ impl Contains<RuntimeCall> for SafeCallFilter {

matches!(
call,
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
RuntimeCall::System(
frame_system::Call::set_heap_pages { .. } |
frame_system::Call::set_code { .. } |
frame_system::Call::set_code_without_checks { .. } |
frame_system::Call::kill_prefix { .. },
) | RuntimeCall::ParachainSystem(..) |
RuntimeCall::PolkadotXcm(
pallet_xcm::Call::force_xcm_version { .. } |
pallet_xcm::Call::force_default_xcm_version { .. }
) | RuntimeCall::System(
frame_system::Call::set_heap_pages { .. } |
frame_system::Call::set_code { .. } |
frame_system::Call::set_code_without_checks { .. } |
frame_system::Call::kill_prefix { .. },
) | RuntimeCall::ParachainSystem(..) |
RuntimeCall::Timestamp(..) |
RuntimeCall::Balances(..) |
RuntimeCall::CollatorSelection(
Expand All @@ -189,8 +191,7 @@ impl Contains<RuntimeCall> for SafeCallFilter {
) | RuntimeCall::Session(pallet_session::Call::purge_keys { .. }) |
RuntimeCall::XcmpQueue(..) |
RuntimeCall::MessageQueue(..) |
RuntimeCall::Identity(..) |
RuntimeCall::IdentityMigrator(..)
RuntimeCall::Identity(..)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ impl Contains<RuntimeCall> for SafeCallFilter {

matches!(
call,
RuntimeCall::PolkadotXcm(pallet_xcm::Call::force_xcm_version { .. }) |
RuntimeCall::PolkadotXcm(
pallet_xcm::Call::force_xcm_version { .. } |
pallet_xcm::Call::force_default_xcm_version { .. }
) |
RuntimeCall::System(
frame_system::Call::set_heap_pages { .. } |
frame_system::Call::set_code { .. } |
Expand Down
7 changes: 3 additions & 4 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ use frame_support::{
weights::{ConstantMultiplier, WeightMeter},
PalletId,
};
use frame_system::EnsureRoot;
use frame_system::{EnsureRoot, EnsureSigned};
use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId};
use pallet_identity::legacy::IdentityInfo;
use pallet_session::historical as session_historical;
Expand Down Expand Up @@ -153,7 +153,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("rococo"),
impl_name: create_runtime_str!("parity-rococo-v2.0"),
authoring_version: 0,
spec_version: 1_006_001,
spec_version: 1_006_002,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 24,
Expand Down Expand Up @@ -1145,8 +1145,7 @@ impl auctions::Config for Runtime {

impl identity_migrator::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// To be changed to `EnsureSigned` once there is a People Chain to migrate to.
type Reaper = EnsureRoot<AccountId>;
type Reaper = EnsureSigned<AccountId>;
type ReapIdentityHandler = ToParachainIdentityReaper<Runtime, Self::AccountId>;
type WeightInfo = weights::runtime_common_identity_migrator::WeightInfo<Runtime>;
}
Expand Down

0 comments on commit a2516cb

Please sign in to comment.