From 5084967a2fc34a2cd6442367fec628ced68c7757 Mon Sep 17 00:00:00 2001 From: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Date: Tue, 11 Jun 2024 17:33:10 +0200 Subject: [PATCH] Remove Identity from Kusama Relay (#315) As a follow up to the migration to a People Chain, we can remove everything Identity-related from the Relay Chain. --------- Co-authored-by: Oliver Tale-Yazdi Co-authored-by: Adrian Catangiu Co-authored-by: Liam Aharon --- CHANGELOG.md | 6 + Cargo.lock | 1 - .../people/people-kusama/src/lib.rs | 1 - .../emulated/chains/relays/kusama/src/lib.rs | 2 - .../people/people-kusama/src/tests/mod.rs | 1 - .../people-kusama/src/tests/reap_identity.rs | 550 ------------------ relay/kusama/Cargo.toml | 4 - relay/kusama/src/impls.rs | 160 +---- relay/kusama/src/lib.rs | 319 +++++++--- relay/kusama/src/weights/mod.rs | 2 - relay/kusama/src/weights/pallet_identity.rs | 434 -------------- ...lkadot_runtime_common_identity_migrator.rs | 99 ---- .../people/people-kusama/src/lib.rs | 23 +- .../people/people-kusama/src/weights/mod.rs | 1 - ...lkadot_runtime_common_identity_migrator.rs | 90 --- 15 files changed, 256 insertions(+), 1437 deletions(-) delete mode 100644 integration-tests/emulated/tests/people/people-kusama/src/tests/reap_identity.rs delete mode 100644 relay/kusama/src/weights/pallet_identity.rs delete mode 100644 relay/kusama/src/weights/polkadot_runtime_common_identity_migrator.rs delete mode 100644 system-parachains/people/people-kusama/src/weights/polkadot_runtime_common_identity_migrator.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index e1889ecc51..f1cf9fe3ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Changelog for the runtimes governed by the Polkadot Fellowship. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [Unreleased] + +### Removed + +- Removed Identity-related code from Kusama Relay Chain ([polkadot-fellows/runtimes#315](https://github.com/polkadot-fellows/runtimes/pull/315)) + ## [1.2.5] 06.06.2024 ### Added diff --git a/Cargo.lock b/Cargo.lock index 3873911e94..dae3c3fcc6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15981,7 +15981,6 @@ dependencies = [ "pallet-election-provider-support-benchmarking", "pallet-fast-unstake", "pallet-grandpa", - "pallet-identity", "pallet-indices", "pallet-message-queue", "pallet-mmr", diff --git a/integration-tests/emulated/chains/parachains/people/people-kusama/src/lib.rs b/integration-tests/emulated/chains/parachains/people/people-kusama/src/lib.rs index 09e5168ee7..c070d43ce0 100644 --- a/integration-tests/emulated/chains/parachains/people/people-kusama/src/lib.rs +++ b/integration-tests/emulated/chains/parachains/people/people-kusama/src/lib.rs @@ -42,7 +42,6 @@ decl_test_parachains! { PolkadotXcm: people_kusama_runtime::PolkadotXcm, Balances: people_kusama_runtime::Balances, Identity: people_kusama_runtime::Identity, - IdentityMigrator: people_kusama_runtime::IdentityMigrator, } }, } diff --git a/integration-tests/emulated/chains/relays/kusama/src/lib.rs b/integration-tests/emulated/chains/relays/kusama/src/lib.rs index 2ac67cdc25..98ab2db269 100644 --- a/integration-tests/emulated/chains/relays/kusama/src/lib.rs +++ b/integration-tests/emulated/chains/relays/kusama/src/lib.rs @@ -36,8 +36,6 @@ decl_test_relay_chains! { XcmPallet: kusama_runtime::XcmPallet, Balances: kusama_runtime::Balances, Hrmp: kusama_runtime::Hrmp, - Identity: kusama_runtime::Identity, - IdentityMigrator: kusama_runtime::IdentityMigrator, Treasury: kusama_runtime::Treasury, AssetRate: kusama_runtime::AssetRate, } diff --git a/integration-tests/emulated/tests/people/people-kusama/src/tests/mod.rs b/integration-tests/emulated/tests/people/people-kusama/src/tests/mod.rs index 80c00021ca..516ec37cc1 100644 --- a/integration-tests/emulated/tests/people/people-kusama/src/tests/mod.rs +++ b/integration-tests/emulated/tests/people/people-kusama/src/tests/mod.rs @@ -13,5 +13,4 @@ // See the License for the specific language governing permissions and // limitations under the License. -mod reap_identity; mod teleport; diff --git a/integration-tests/emulated/tests/people/people-kusama/src/tests/reap_identity.rs b/integration-tests/emulated/tests/people/people-kusama/src/tests/reap_identity.rs deleted file mode 100644 index 3a55b3e354..0000000000 --- a/integration-tests/emulated/tests/people/people-kusama/src/tests/reap_identity.rs +++ /dev/null @@ -1,550 +0,0 @@ -// 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. - -//! # OnReapIdentity Tests -//! -//! This file contains the test cases for migrating Identity data away from the Kusama Relay -//! chain and to the Kusama People parachain. This migration is part of the broader Minimal Relay -//! effort: -//! https://github.com/polkadot-fellows/RFCs/blob/main/text/0032-minimal-relay.md -//! -//! ## Overview -//! -//! The tests validate the robustness and correctness of the `OnReapIdentityHandler` -//! ensuring that it behaves as expected in various scenarios. Key aspects tested include: -//! -//! - **Deposit Handling**: Confirming that deposits are correctly migrated from the Relay Chain to -//! the People parachain in various scenarios (different `IdentityInfo` fields and different -//! numbers of sub-accounts). -//! -//! ### Test Scenarios -//! -//! The tests are categorized into several scenarios, each resulting in different deposits required -//! on the destination parachain. The tests ensure: -//! -//! - Reserved deposits on the Relay Chain are fully released; -//! - The freed deposit from the Relay Chain is sufficient for the parachain deposit; and -//! - The account will exist on the parachain. - -use crate::*; -use frame_support::BoundedVec; -use kusama_runtime::{ - BasicDeposit, ByteDeposit, MaxAdditionalFields, MaxSubAccounts, RuntimeOrigin as KusamaOrigin, - SubAccountDeposit, -}; -use kusama_runtime_constants::currency::*; -use kusama_system_emulated_network::{ - kusama_emulated_chain::KusamaRelayPallet, KusamaRelay, KusamaRelaySender, -}; -use pallet_balances::Event as BalancesEvent; -use pallet_identity::{legacy::IdentityInfo, Data, Event as IdentityEvent}; -use people_kusama_runtime::people::{ - BasicDeposit as BasicDepositParachain, ByteDeposit as ByteDepositParachain, - IdentityInfo as IdentityInfoParachain, SubAccountDeposit as SubAccountDepositParachain, -}; - -type Balance = u128; -type KusamaIdentity = ::Identity; -type KusamaBalances = ::Balances; -type KusamaIdentityMigrator = ::IdentityMigrator; -type PeopleKusamaIdentity = ::Identity; -type PeopleKusamaBalances = ::Balances; - -#[derive(Clone, Debug)] -struct Identity { - relay: IdentityInfo, - para: IdentityInfoParachain, - subs: Subs, -} - -impl Identity { - fn new( - full: bool, - additional: Option>, - subs: Subs, - ) -> Self { - let pgp_fingerprint = [ - 0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE, 0xF0, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, - 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, - ]; - let make_data = |data: &[u8], full: bool| -> Data { - if full { - Data::Raw(data.to_vec().try_into().unwrap()) - } else { - Data::None - } - }; - let (github, discord) = additional - .as_ref() - .and_then(|vec| vec.first()) - .map(|(g, d)| (g.clone(), d.clone())) - .unwrap_or((Data::None, Data::None)); - Self { - relay: IdentityInfo { - display: make_data(b"xcm-test", full), - legal: make_data(b"The Xcm Test, Esq.", full), - web: make_data(b"https://visitme/", full), - riot: make_data(b"xcm-riot", full), - email: make_data(b"xcm-test@gmail.com", full), - pgp_fingerprint: Some(pgp_fingerprint), - image: make_data(b"xcm-test.png", full), - twitter: make_data(b"@xcm-test", full), - additional: additional.unwrap_or_default(), - }, - para: IdentityInfoParachain { - display: make_data(b"xcm-test", full), - legal: make_data(b"The Xcm Test, Esq.", full), - web: make_data(b"https://visitme/", full), - matrix: make_data(b"xcm-matrix@server", full), - email: make_data(b"xcm-test@gmail.com", full), - pgp_fingerprint: Some(pgp_fingerprint), - image: make_data(b"xcm-test.png", full), - twitter: make_data(b"@xcm-test", full), - github, - discord, - }, - subs, - } - } -} - -#[derive(Clone, Debug)] -enum Subs { - Zero, - Many(u32), -} - -enum IdentityOn<'a> { - Relay(&'a IdentityInfo), - Para(&'a IdentityInfoParachain), -} - -impl IdentityOn<'_> { - fn calculate_deposit(self) -> Balance { - match self { - IdentityOn::Relay(id) => { - let base_deposit = BasicDeposit::get(); - let byte_deposit = - ByteDeposit::get() * TryInto::::try_into(id.encoded_size()).unwrap(); - base_deposit + byte_deposit - }, - IdentityOn::Para(id) => { - let base_deposit = BasicDepositParachain::get(); - let byte_deposit = ByteDepositParachain::get() * - TryInto::::try_into(id.encoded_size()).unwrap(); - base_deposit + byte_deposit - }, - } - } -} - -/// Generate an `AccountId32` from a `u32`. -/// This creates a 32-byte array, initially filled with `255`, and then repeatedly fills it -/// with the 4-byte little-endian representation of the `u32` value, until the array is full. -/// -/// **Example**: -/// -/// `account_from_u32(5)` will return an `AccountId32` with the bytes -/// `[0, 5, 0, 0, 0, 0, 0, 0, 0, 5 ... ]` -fn account_from_u32(id: u32) -> AccountId32 { - let mut buffer = [255u8; 32]; - let id_bytes = id.to_le_bytes(); - let id_size = id_bytes.len(); - for chunk in buffer.chunks_mut(id_size) { - chunk.clone_from_slice(&id_bytes); - } - AccountId32::new(buffer) -} - -// Set up the Relay Chain with an identity. -fn set_id_relay(id: &Identity) -> Balance { - let mut total_deposit: Balance = 0; - - // Set identity and Subs on Relay Chain - KusamaRelay::execute_with(|| { - type RuntimeEvent = ::RuntimeEvent; - - assert_ok!(KusamaIdentity::set_identity( - KusamaOrigin::signed(KusamaRelaySender::get()), - Box::new(id.relay.clone()) - )); - - if let Subs::Many(n) = id.subs { - let subs: Vec<_> = (0..n) - .map(|i| (account_from_u32(i), Data::Raw(b"name".to_vec().try_into().unwrap()))) - .collect(); - - assert_ok!(KusamaIdentity::set_subs( - KusamaOrigin::signed(KusamaRelaySender::get()), - subs, - )); - } - - let reserved_balance = KusamaBalances::reserved_balance(KusamaRelaySender::get()); - let id_deposit = IdentityOn::Relay(&id.relay).calculate_deposit(); - - let total_deposit = match id.subs { - Subs::Zero => { - total_deposit = id_deposit; // No subs - assert_expected_events!( - KusamaRelay, - vec![ - RuntimeEvent::Identity(IdentityEvent::IdentitySet { .. }) => {}, - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == KusamaRelaySender::get(), - amount: *amount == id_deposit, - }, - ] - ); - total_deposit - }, - Subs::Many(n) => { - let sub_account_deposit = n as Balance * SubAccountDeposit::get(); - total_deposit = - sub_account_deposit + IdentityOn::Relay(&id.relay).calculate_deposit(); - assert_expected_events!( - KusamaRelay, - vec![ - RuntimeEvent::Identity(IdentityEvent::IdentitySet { .. }) => {}, - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == KusamaRelaySender::get(), - amount: *amount == id_deposit, - }, - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == KusamaRelaySender::get(), - amount: *amount == sub_account_deposit, - }, - ] - ); - total_deposit - }, - }; - - assert_eq!(reserved_balance, total_deposit); - }); - total_deposit -} - -// Set up the parachain with an identity and (maybe) sub accounts, but with zero deposits. -fn assert_set_id_parachain(id: &Identity) { - // Set identity and Subs on Parachain with zero deposit - PeopleKusama::execute_with(|| { - let free_bal = PeopleKusamaBalances::free_balance(PeopleKusamaSender::get()); - let reserved_balance = PeopleKusamaBalances::reserved_balance(PeopleKusamaSender::get()); - - // total balance at Genesis should be zero - assert_eq!(reserved_balance + free_bal, 0); - - assert_ok!(PeopleKusamaIdentity::set_identity_no_deposit( - &PeopleKusamaSender::get(), - id.para.clone(), - )); - - match id.subs { - Subs::Zero => {}, - Subs::Many(n) => { - let subs: Vec<_> = (0..n) - .map(|ii| { - (account_from_u32(ii), Data::Raw(b"name".to_vec().try_into().unwrap())) - }) - .collect(); - assert_ok!(PeopleKusamaIdentity::set_subs_no_deposit( - &PeopleKusamaSender::get(), - subs, - )); - }, - } - - // No amount should be reserved as deposit amounts are set to 0. - let reserved_balance = PeopleKusamaBalances::reserved_balance(PeopleKusamaSender::get()); - assert_eq!(reserved_balance, 0); - assert!(PeopleKusamaIdentity::identity(PeopleKusamaSender::get()).is_some()); - - let (_, sub_accounts) = PeopleKusamaIdentity::subs_of(PeopleKusamaSender::get()); - - match id.subs { - Subs::Zero => assert_eq!(sub_accounts.len(), 0), - Subs::Many(n) => assert_eq!(sub_accounts.len(), n as usize), - } - }); -} - -// Reap the identity on the Relay Chain and assert that the correct things happen there. -fn assert_reap_id_relay(total_deposit: Balance, id: &Identity) { - KusamaRelay::execute_with(|| { - type RuntimeEvent = ::RuntimeEvent; - let free_bal_before_reap = KusamaBalances::free_balance(KusamaRelaySender::get()); - let reserved_balance = KusamaBalances::reserved_balance(KusamaRelaySender::get()); - - assert_eq!(reserved_balance, total_deposit); - - assert_ok!(KusamaIdentityMigrator::reap_identity( - // Note: Root for launch testing, Signed once we open migrations. - KusamaOrigin::signed(KusamaRelaySender::get()), - KusamaRelaySender::get() - )); - - let remote_deposit = match id.subs { - Subs::Zero => calculate_remote_deposit(id.relay.encoded_size() as u32, 0), - Subs::Many(n) => calculate_remote_deposit(id.relay.encoded_size() as u32, n), - }; - - assert_expected_events!( - KusamaRelay, - vec![ - // `reap_identity` sums the identity and subs deposits and unreserves them in one - // call. Therefore, we only expect one `Unreserved` event. - RuntimeEvent::Balances(BalancesEvent::Unreserved { who, amount }) => { - who: *who == KusamaRelaySender::get(), - amount: *amount == total_deposit, - }, - RuntimeEvent::IdentityMigrator( - polkadot_runtime_common::identity_migrator::Event::IdentityReaped { - who, - }) => { - who: *who == PeopleKusamaSender::get(), - }, - ] - ); - // Identity should be gone. - assert!(PeopleKusamaIdentity::identity(KusamaRelaySender::get()).is_none()); - - // Subs should be gone. - let (_, sub_accounts) = KusamaIdentity::subs_of(KusamaRelaySender::get()); - assert_eq!(sub_accounts.len(), 0); - - let reserved_balance = KusamaBalances::reserved_balance(KusamaRelaySender::get()); - assert_eq!(reserved_balance, 0); - - // Free balance should be greater (i.e. the teleport should work even if 100% of an - // account's balance is reserved for Identity). - let free_bal_after_reap = KusamaBalances::free_balance(KusamaRelaySender::get()); - assert!(free_bal_after_reap > free_bal_before_reap); - - // Implicit: total_deposit > remote_deposit. As in, accounts should always have enough - // reserved for the parachain deposit. - assert_eq!(free_bal_after_reap, free_bal_before_reap + total_deposit - remote_deposit); - }); -} - -// Reaping the identity on the Relay Chain will have sent an XCM program to the parachain. Ensure -// that everything happens as expected. -fn assert_reap_parachain(id: &Identity) { - PeopleKusama::execute_with(|| { - let reserved_balance = PeopleKusamaBalances::reserved_balance(PeopleKusamaSender::get()); - let id_deposit = IdentityOn::Para(&id.para).calculate_deposit(); - let total_deposit = match id.subs { - Subs::Zero => id_deposit, - Subs::Many(n) => id_deposit + n as Balance * SubAccountDepositParachain::get(), - }; - assert_reap_events(id_deposit, id); - assert_eq!(reserved_balance, total_deposit); - - // Should have at least one ED after in free balance after the reap. - assert!(PeopleKusamaBalances::free_balance(PeopleKusamaSender::get()) >= PEOPLE_KUSAMA_ED); - }); -} - -// Assert the events that should happen on the parachain upon reaping an identity on the Relay -// Chain. -fn assert_reap_events(id_deposit: Balance, id: &Identity) { - type RuntimeEvent = ::RuntimeEvent; - match id.subs { - Subs::Zero => { - assert_expected_events!( - PeopleKusama, - vec![ - // Deposit and Endowed from teleport - RuntimeEvent::Balances(BalancesEvent::Minted { .. }) => {}, - RuntimeEvent::Balances(BalancesEvent::Endowed { .. }) => {}, - // Amount reserved for identity info - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == PeopleKusamaSender::get(), - amount: *amount == id_deposit, - }, - // Confirmation from Migrator with individual identity and subs deposits - RuntimeEvent::IdentityMigrator( - polkadot_runtime_common::identity_migrator::Event::DepositUpdated { - who, identity, subs - }) => { - who: *who == PeopleKusamaSender::get(), - identity: *identity == id_deposit, - subs: *subs == 0, - }, - RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { .. }) => {}, - ] - ); - }, - Subs::Many(n) => { - let subs_deposit = n as Balance * SubAccountDepositParachain::get(); - assert_expected_events!( - PeopleKusama, - vec![ - // Deposit and Endowed from teleport - RuntimeEvent::Balances(BalancesEvent::Minted { .. }) => {}, - RuntimeEvent::Balances(BalancesEvent::Endowed { .. }) => {}, - // Amount reserved for identity info - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == PeopleKusamaSender::get(), - amount: *amount == id_deposit, - }, - // Amount reserved for subs - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == PeopleKusamaSender::get(), - amount: *amount == subs_deposit, - }, - // Confirmation from Migrator with individual identity and subs deposits - RuntimeEvent::IdentityMigrator( - polkadot_runtime_common::identity_migrator::Event::DepositUpdated { - who, identity, subs - }) => { - who: *who == PeopleKusamaSender::get(), - identity: *identity == id_deposit, - subs: *subs == subs_deposit, - }, - RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { .. }) => {}, - ] - ); - }, - }; -} - -/// Duplicate of the impl of `ToParachainIdentityReaper` in the Kusama runtime. -fn calculate_remote_deposit(bytes: u32, subs: u32) -> Balance { - // Note: These `deposit` functions and `EXISTENTIAL_DEPOSIT` correspond to the Relay Chain's. - // Pulled in: use kusama_runtime_constants::currency::*; - let para_basic_deposit = deposit(1, 17) / 100; - let para_byte_deposit = deposit(0, 1) / 100; - let para_sub_account_deposit = deposit(1, 53) / 100; - let para_existential_deposit = EXISTENTIAL_DEPOSIT / 10; - - // pallet deposits - let id_deposit = - para_basic_deposit.saturating_add(para_byte_deposit.saturating_mul(bytes as Balance)); - let subs_deposit = para_sub_account_deposit.saturating_mul(subs as Balance); - - id_deposit - .saturating_add(subs_deposit) - .saturating_add(para_existential_deposit.saturating_mul(2)) -} - -// Represent some `additional` data that would not be migrated to the parachain. The encoded size, -// and thus the byte deposit, should decrease. -fn nonsensical_additional() -> BoundedVec<(Data, Data), MaxAdditionalFields> { - BoundedVec::try_from(vec![( - Data::Raw(b"fOo".to_vec().try_into().unwrap()), - Data::Raw(b"baR".to_vec().try_into().unwrap()), - )]) - .unwrap() -} - -// Represent some `additional` data that will be migrated to the parachain as first-class fields. -fn meaningful_additional() -> BoundedVec<(Data, Data), MaxAdditionalFields> { - BoundedVec::try_from(vec![ - ( - Data::Raw(b"github".to_vec().try_into().unwrap()), - Data::Raw(b"niels-username".to_vec().try_into().unwrap()), - ), - ( - Data::Raw(b"discord".to_vec().try_into().unwrap()), - Data::Raw(b"bohr-username".to_vec().try_into().unwrap()), - ), - ]) - .unwrap() -} - -// Execute a single test case. -fn assert_relay_para_flow(id: &Identity) { - let total_deposit = set_id_relay(id); - assert_set_id_parachain(id); - assert_reap_id_relay(total_deposit, id); - assert_reap_parachain(id); -} - -// Tests with empty `IdentityInfo`. - -#[test] -fn on_reap_identity_works_for_minimal_identity_with_zero_subs() { - assert_relay_para_flow(&Identity::new(false, None, Subs::Zero)); -} - -#[test] -fn on_reap_identity_works_for_minimal_identity() { - assert_relay_para_flow(&Identity::new(false, None, Subs::Many(1))); -} - -#[test] -fn on_reap_identity_works_for_minimal_identity_with_max_subs() { - assert_relay_para_flow(&Identity::new(false, None, Subs::Many(MaxSubAccounts::get()))); -} - -// Tests with full `IdentityInfo`. - -#[test] -fn on_reap_identity_works_for_full_identity_no_additional_zero_subs() { - assert_relay_para_flow(&Identity::new(true, None, Subs::Zero)); -} - -#[test] -fn on_reap_identity_works_for_full_identity_no_additional() { - assert_relay_para_flow(&Identity::new(true, None, Subs::Many(1))); -} - -#[test] -fn on_reap_identity_works_for_full_identity_no_additional_max_subs() { - assert_relay_para_flow(&Identity::new(true, None, Subs::Many(MaxSubAccounts::get()))); -} - -// Tests with full `IdentityInfo` and `additional` fields that will _not_ be migrated. - -#[test] -fn on_reap_identity_works_for_full_identity_nonsense_additional_zero_subs() { - assert_relay_para_flow(&Identity::new(true, Some(nonsensical_additional()), Subs::Zero)); -} - -#[test] -fn on_reap_identity_works_for_full_identity_nonsense_additional() { - assert_relay_para_flow(&Identity::new(true, Some(nonsensical_additional()), Subs::Many(1))); -} - -#[test] -fn on_reap_identity_works_for_full_identity_nonsense_additional_max_subs() { - assert_relay_para_flow(&Identity::new( - true, - Some(nonsensical_additional()), - Subs::Many(MaxSubAccounts::get()), - )); -} - -// Tests with full `IdentityInfo` and `additional` fields that will be migrated. - -#[test] -fn on_reap_identity_works_for_full_identity_meaningful_additional_zero_subs() { - assert_relay_para_flow(&Identity::new(true, Some(meaningful_additional()), Subs::Zero)); -} - -#[test] -fn on_reap_identity_works_for_full_identity_meaningful_additional() { - assert_relay_para_flow(&Identity::new(true, Some(meaningful_additional()), Subs::Many(1))); -} - -#[test] -fn on_reap_identity_works_for_full_identity_meaningful_additional_max_subs() { - assert_relay_para_flow(&Identity::new( - true, - Some(meaningful_additional()), - Subs::Many(MaxSubAccounts::get()), - )); -} diff --git a/relay/kusama/Cargo.toml b/relay/kusama/Cargo.toml index 9f4601f92e..b2df38038f 100644 --- a/relay/kusama/Cargo.toml +++ b/relay/kusama/Cargo.toml @@ -56,7 +56,6 @@ frame-executive = { workspace = true } frame-metadata-hash-extension = { workspace = true } pallet-grandpa = { workspace = true } pallet-nis = { workspace = true } -pallet-identity = { workspace = true } pallet-indices = { workspace = true } pallet-message-queue = { workspace = true } pallet-mmr = { workspace = true } @@ -152,7 +151,6 @@ std = [ "pallet-election-provider-support-benchmarking?/std", "pallet-fast-unstake/std", "pallet-grandpa/std", - "pallet-identity/std", "pallet-indices/std", "pallet-message-queue/std", "pallet-mmr/std", @@ -228,7 +226,6 @@ runtime-benchmarks = [ "pallet-election-provider-support-benchmarking/runtime-benchmarks", "pallet-fast-unstake/runtime-benchmarks", "pallet-grandpa/runtime-benchmarks", - "pallet-identity/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", "pallet-mmr/runtime-benchmarks", @@ -283,7 +280,6 @@ try-runtime = [ "pallet-election-provider-multi-phase/try-runtime", "pallet-fast-unstake/try-runtime", "pallet-grandpa/try-runtime", - "pallet-identity/try-runtime", "pallet-indices/try-runtime", "pallet-message-queue/try-runtime", "pallet-mmr/try-runtime", diff --git a/relay/kusama/src/impls.rs b/relay/kusama/src/impls.rs index 2dcdd7b63b..77e7ca941d 100644 --- a/relay/kusama/src/impls.rs +++ b/relay/kusama/src/impls.rs @@ -15,168 +15,10 @@ // along with Polkadot. If not, see . use super::*; -use codec::{Decode, Encode}; use core::marker::PhantomData; -use frame_support::{ - defensive, pallet_prelude::DispatchResult, traits::tokens::ConversionFromAssetBalance, -}; -use frame_system::RawOrigin; -use kusama_runtime_constants::system_parachain::PEOPLE_ID; +use frame_support::traits::tokens::ConversionFromAssetBalance; use polkadot_primitives::Id as ParaId; -use polkadot_runtime_common::identity_migrator::{OnReapIdentity, WeightInfo}; -use xcm::{latest::prelude::*, VersionedXcm}; use xcm_builder::IsChildSystemParachain; -use xcm_executor::traits::TransactAsset; - -/// A type containing the encoding of the People Chain pallets in its runtime. Used to construct any -/// remote calls. The codec index must correspond to the index of `IdentityMigrator` in the -/// `construct_runtime` of the remote chain. -#[derive(Encode, Decode)] -enum PeopleRuntimePallets { - #[codec(index = 248)] - IdentityMigrator(IdentityMigratorCalls), -} - -/// Call encoding for the calls needed from the Identity Migrator pallet. -#[derive(Encode, Decode)] -enum IdentityMigratorCalls { - #[codec(index = 1)] - PokeDeposit(AccountId), -} - -/// Type that implements `OnReapIdentity` that will send the deposit needed to store the same -/// information on a parachain, sends the deposit there, and then updates it. -pub struct ToParachainIdentityReaper(PhantomData<(Runtime, AccountId)>); -impl ToParachainIdentityReaper { - /// Calculate the balance needed on the remote chain based on the `IdentityInfo` and `Subs` on - /// this chain. The total includes: - /// - /// - Identity basic deposit - /// - `IdentityInfo` byte deposit - /// - Sub accounts deposit - /// - 2x existential deposit (1 for account existence, 1 such that the user can transact) - fn calculate_remote_deposit(bytes: u32, subs: u32) -> Balance { - // Remote deposit constants. Parachain uses `deposit / 100` - // Source: - // https://github.com/polkadot-fellows/runtimes/blob/55e97c5/system-parachains/constants/src/kusama.rs#L29 - // - // Parachain Deposit Configuration: - // - // pub const BasicDeposit: Balance = deposit(1, 17); - // pub const ByteDeposit: Balance = deposit(0, 1); - // pub const SubAccountDeposit: Balance = deposit(1, 53); - // pub const EXISTENTIAL_DEPOSIT: Balance = constants::currency::EXISTENTIAL_DEPOSIT / 10; - let para_basic_deposit = deposit(1, 17) / 100; - let para_byte_deposit = deposit(0, 1) / 100; - let para_sub_account_deposit = deposit(1, 53) / 100; - let para_existential_deposit = EXISTENTIAL_DEPOSIT / 10; - - // pallet deposits - let id_deposit = - para_basic_deposit.saturating_add(para_byte_deposit.saturating_mul(bytes as Balance)); - let subs_deposit = para_sub_account_deposit.saturating_mul(subs as Balance); - - id_deposit - .saturating_add(subs_deposit) - .saturating_add(para_existential_deposit.saturating_mul(2)) - } -} - -// Note / Warning: This implementation should only be used in a transactional context. If not, then -// an error could result in assets being burned. -impl OnReapIdentity for ToParachainIdentityReaper -where - Runtime: frame_system::Config + pallet_xcm::Config, - AccountId: Into<[u8; 32]> + Clone + Encode, -{ - fn on_reap_identity(who: &AccountId, fields: u32, subs: u32) -> DispatchResult { - use crate::{ - impls::IdentityMigratorCalls::PokeDeposit, - weights::polkadot_runtime_common_identity_migrator::WeightInfo as MigratorWeights, - }; - - let total_to_send = Self::calculate_remote_deposit(fields, subs); - - // define asset / destination from relay perspective - let ksm = Asset { id: AssetId(Here.into_location()), fun: Fungible(total_to_send) }; - // People Chain - let destination: Location = Location::new(0, Parachain(PEOPLE_ID)); - - // Do `check_out` accounting since the XCM Executor's `InitiateTeleport` doesn't support - // unpaid teleports. - - // withdraw the asset from `who` - let who_origin = - Junction::AccountId32 { network: None, id: who.clone().into() }.into_location(); - let _withdrawn = xcm_config::LocalAssetTransactor::withdraw_asset(&ksm, &who_origin, None) - .map_err(|err| { - defensive!( - "runtime::on_reap_identity: withdraw_asset(what: {:?}, who_origin: {:?}) error: {:?}", - (&ksm, &who_origin, err) - ); - pallet_xcm::Error::::LowBalance - })?; - - // check out - xcm_config::LocalAssetTransactor::can_check_out( - &destination, - &ksm, - // not used in AssetTransactor - &XcmContext { origin: None, message_id: [0; 32], topic: None }, - ) - .map_err(|err| { - log::error!( - target: "runtime::on_reap_identity", - "can_check_out(destination: {:?}, asset: {:?}, _) error: {:?}", - destination, ksm, err - ); - pallet_xcm::Error::::CannotCheckOutTeleport - })?; - xcm_config::LocalAssetTransactor::check_out( - &destination, - &ksm, - // not used in AssetTransactor - &XcmContext { origin: None, message_id: [0; 32], topic: None }, - ); - - // reanchor - let ksm_reanchored: Assets = - vec![Asset { id: AssetId(Location::new(1, Here)), fun: Fungible(total_to_send) }] - .into(); - - let poke = PeopleRuntimePallets::::IdentityMigrator(PokeDeposit(who.clone())); - let remote_weight_limit = MigratorWeights::::poke_deposit().saturating_mul(2); - - // Actual program to execute on People Chain. - let program: Xcm<()> = Xcm(vec![ - // Unpaid as this is constructed by the system, once per user. The user shouldn't have - // their balance reduced by teleport fees for the favor of migrating. - UnpaidExecution { weight_limit: Unlimited, check_origin: None }, - // Receive the asset into holding. - ReceiveTeleportedAsset(ksm_reanchored), - // Deposit into the user's account. - DepositAsset { - assets: Wild(AllCounted(1)), - beneficiary: Junction::AccountId32 { network: None, id: who.clone().into() } - .into_location(), - }, - // Poke the deposit to reserve the appropriate amount on the parachain. - Transact { - origin_kind: OriginKind::Superuser, - require_weight_at_most: remote_weight_limit, - call: poke.encode().into(), - }, - ]); - - // send - >::send( - RawOrigin::Root.into(), - Box::new(VersionedLocation::V4(destination)), - Box::new(VersionedXcm::V4(program)), - )?; - Ok(()) - } -} // TODO: replace by types from polkadot-sdk https://github.com/paritytech/polkadot-sdk/pull/3659 /// Determines if the given `asset_kind` is a native asset. If it is, returns the balance without diff --git a/relay/kusama/src/lib.rs b/relay/kusama/src/lib.rs index 05724aee55..2c81b5268c 100644 --- a/relay/kusama/src/lib.rs +++ b/relay/kusama/src/lib.rs @@ -33,7 +33,7 @@ use polkadot_primitives::{ PARACHAIN_KEY_TYPE_ID, }; use polkadot_runtime_common::{ - auctions, claims, crowdloan, identity_migrator, impl_runtime_weights, + auctions, claims, crowdloan, impl_runtime_weights, impls::{ DealWithFees, LocatableAssetConverter, VersionedLocatableAsset, VersionedLocationConverter, }, @@ -76,16 +76,15 @@ use frame_support::{ genesis_builder_helper::{build_config, create_default_config}, parameter_types, traits::{ - fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, EverythingBut, + fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, Everything, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError, StorageMapShim, WithdrawReasons, }, weights::{ConstantMultiplier, WeightMeter}, PalletId, }; -use frame_system::{EnsureRoot, EnsureSigned}; +use frame_system::EnsureRoot; use pallet_grandpa::{fg_primitives, AuthorityId as GrandpaId}; -use pallet_identity::legacy::IdentityInfo; use pallet_session::historical as session_historical; use pallet_transaction_payment::{FeeDetails, FungibleAdapter, RuntimeDispatchInfo}; use sp_core::{ConstU128, OpaqueMetadata, H256}; @@ -187,19 +186,8 @@ parameter_types! { pub const SS58Prefix: u8 = 2; } -/// 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 IsIdentityCall; -impl Contains for IsIdentityCall { - fn contains(c: &RuntimeCall) -> bool { - matches!(c, RuntimeCall::Identity(_)) - } -} - impl frame_system::Config for Runtime { - type BaseCallFilter = EverythingBut; + type BaseCallFilter = Everything; type BlockWeights = BlockWeights; type BlockLength = BlockLength; type RuntimeOrigin = RuntimeOrigin; @@ -970,44 +958,6 @@ impl claims::Config for Runtime { type WeightInfo = weights::polkadot_runtime_common_claims::WeightInfo; } -parameter_types! { - // Minimum 100 bytes/KSM deposited (1 CENT/byte) - pub const BasicDeposit: Balance = 1000 * CENTS; // 258 bytes on-chain - pub const ByteDeposit: Balance = deposit(0, 1); - pub const SubAccountDeposit: Balance = 200 * CENTS; // 53 bytes on-chain - pub const MaxSubAccounts: u32 = 100; - pub const MaxAdditionalFields: u32 = 100; - pub const MaxRegistrars: u32 = 20; -} - -impl pallet_identity::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Currency = Balances; - type BasicDeposit = BasicDeposit; - type ByteDeposit = ByteDeposit; - type SubAccountDeposit = SubAccountDeposit; - type MaxSubAccounts = MaxSubAccounts; - type IdentityInformation = IdentityInfo; - type MaxRegistrars = MaxRegistrars; - type Slashed = Treasury; - type ForceOrigin = EitherOf, GeneralAdmin>; - type RegistrarOrigin = EitherOf, GeneralAdmin>; - type OffchainSignature = Signature; - type SigningPublicKey = ::Signer; - type UsernameAuthorityOrigin = EnsureRoot; - type PendingUsernameExpiration = ConstU32<{ 7 * DAYS }>; - type MaxSuffixLength = ConstU32<7>; - type MaxUsernameLength = ConstU32<32>; - type WeightInfo = weights::pallet_identity::WeightInfo; -} - -impl identity_migrator::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Reaper = EnsureSigned; - type ReapIdentityHandler = impls::ToParachainIdentityReaper; - type WeightInfo = weights::polkadot_runtime_common_identity_migrator::WeightInfo; -} - impl pallet_utility::Config for Runtime { type RuntimeEvent = RuntimeEvent; type RuntimeCall = RuntimeCall; @@ -1115,14 +1065,22 @@ parameter_types! { TypeInfo, )] pub enum ProxyType { + #[codec(index = 0)] Any, + #[codec(index = 1)] NonTransfer, + #[codec(index = 2)] Governance, + #[codec(index = 3)] Staking, - IdentityJudgement, + // Index 4 skipped. Formerly `IdentityJudgement`. + #[codec(index = 5)] CancelProxy, + #[codec(index = 6)] Auction, + #[codec(index = 7)] Society, + #[codec(index = 8)] NominationPools, } @@ -1159,7 +1117,6 @@ impl InstanceFilter for ProxyType { RuntimeCall::Whitelist(..) | RuntimeCall::Claims(..) | RuntimeCall::Utility(..) | - RuntimeCall::Identity(..) | RuntimeCall::Society(..) | RuntimeCall::Recovery(pallet_recovery::Call::as_recovered {..}) | RuntimeCall::Recovery(pallet_recovery::Call::vouch_recovery {..}) | @@ -1212,11 +1169,6 @@ impl InstanceFilter for ProxyType { ProxyType::NominationPools => { matches!(c, RuntimeCall::NominationPools(..) | RuntimeCall::Utility(..)) }, - ProxyType::IdentityJudgement => matches!( - c, - RuntimeCall::Identity(pallet_identity::Call::provide_judgement { .. }) | - RuntimeCall::Utility(..) - ), ProxyType::CancelProxy => { matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::reject_announcement { .. })) }, @@ -1685,8 +1637,7 @@ construct_runtime! { // Utility module. Utility: pallet_utility = 24, - // Less simple identity module. - Identity: pallet_identity = 25, + // pallet_identity = 25 (removed post 1.2.4) // Society module. Society: pallet_society = 26, @@ -1768,9 +1719,6 @@ construct_runtime! { // refer to block. See issue #160 for details. Mmr: pallet_mmr = 201, BeefyMmrLeaf: pallet_beefy_mmr = 202, - - // Pallet for migrating Identity to a parachain. To be removed post-migration. - IdentityMigrator: identity_migrator = 248, } } @@ -1822,9 +1770,6 @@ pub mod migrations { #[cfg(feature = "try-runtime")] use sp_core::crypto::ByteArray; - // We don't have a limit in the Relay Chain. - const IDENTITY_MIGRATION_KEY_LIMIT: u64 = u64::MAX; - pub struct GetLegacyLeaseImpl; impl coretime::migration::GetLegacyLease for GetLegacyLeaseImpl { fn get_parachain_lease_in_blocks(para: ParaId) -> Option { @@ -1869,6 +1814,8 @@ pub mod migrations { parameter_types! { pub const StateTrieMigrationName: &'static str = "StateTrieMigration"; pub const ImOnlinePalletName: &'static str = "ImOnline"; + pub const IdentityPalletName: &'static str = "Identity"; + pub const IdentityMigratorPalletName: &'static str = "IdentityMigrator"; } /// Upgrade Session keys to exclude `ImOnline` key. @@ -1887,10 +1834,7 @@ pub mod migrations { log::info!(target: "runtime::session_keys", "Collecting pre-upgrade session keys state"); let key_ids = SessionKeys::key_ids(); frame_support::ensure!( - key_ids - .into_iter() - .find(|&k| *k == sp_core::crypto::key_types::IM_ONLINE) - .is_none(), + !key_ids.iter().any(|k| *k == sp_core::crypto::key_types::IM_ONLINE), "New session keys contain the ImOnline key that should have been removed", ); let storage_key = pallet_session::QueuedKeys::::hashed_key(); @@ -1906,7 +1850,7 @@ pub mod migrations { state.extend_from_slice(keys.get_raw(*key_id)); } }); - frame_support::ensure!(state.len() > 0, "Queued keys are not empty before upgrade"); + frame_support::ensure!(!state.is_empty(), "Queued keys are not empty before upgrade"); Ok(state) } @@ -1937,7 +1881,10 @@ pub mod migrations { new_state.extend_from_slice(keys.get_raw(*key_id)); } }); - frame_support::ensure!(new_state.len() > 0, "Queued keys are not empty after upgrade"); + frame_support::ensure!( + !new_state.is_empty(), + "Queued keys are not empty after upgrade" + ); frame_support::ensure!( old_state == new_state, "Pre-upgrade and post-upgrade keys do not match!" @@ -1982,6 +1929,214 @@ pub mod migrations { } } + /// Migration to remove deprecated judgement proxies. + mod clear_judgement_proxies { + use super::*; + + use frame_support::{ + pallet_prelude::ValueQuery, + storage_alias, + traits::{Currency, ReservableCurrency}, + Twox64Concat, + }; + use frame_system::pallet_prelude::BlockNumberFor; + use pallet_proxy::ProxyDefinition; + use sp_runtime::{BoundedVec, Saturating}; + + /// ProxyType including the deprecated `IdentityJudgement`. + #[derive( + Copy, + Clone, + Eq, + PartialEq, + Ord, + PartialOrd, + Encode, + Decode, + RuntimeDebug, + MaxEncodedLen, + TypeInfo, + )] + pub enum PrevProxyType { + Any, + NonTransfer, + Governance, + Staking, + IdentityJudgement, + CancelProxy, + Auction, + Society, + NominationPools, + } + + type BalanceOf = <::Currency as Currency< + ::AccountId, + >>::Balance; + + type PrevProxiesValue = ( + BoundedVec>, MaxProxies>, + BalanceOf, + ); + + /// Proxies including the deprecated `IdentityJudgement` type. + #[storage_alias] + pub type Proxies = StorageMap< + pallet_proxy::Pallet, + Twox64Concat, + AccountId, + PrevProxiesValue, + ValueQuery, + >; + + pub struct Migration; + impl OnRuntimeUpgrade for Migration { + /// Compute the expected post-upgrade state for Proxies stroage, and the reserved value + /// for all accounts with a proxy. + #[cfg(feature = "try-runtime")] + fn pre_upgrade() -> Result, sp_runtime::TryRuntimeError> { + let mut expected_proxies: BTreeMap> = + BTreeMap::new(); + let mut expected_reserved_amounts: BTreeMap = BTreeMap::new(); + + for (who, (mut proxies, old_deposit)) in + Proxies::::iter().collect::>() + { + let proxies_len_before = proxies.len() as u64; + proxies.retain(|proxy| proxy.proxy_type != PrevProxyType::IdentityJudgement); + let proxies_len_after = proxies.len() as u64; + + let new_deposit = + pallet_proxy::Pallet::::deposit(proxies.len() as u32); + + let current_reserved = + >::reserved_balance(&who); + + // Update the deposit only if proxies were removed and the deposit decreased. + if new_deposit < old_deposit && proxies_len_after < proxies_len_before { + // If there're no proxies left, they should be removed + if proxies.len() > 0 { + expected_proxies.insert(who.clone(), (proxies, new_deposit)); + } + expected_reserved_amounts.insert( + who, + current_reserved.saturating_sub(old_deposit - new_deposit), + ); + } else { + // Deposit should not change. If any proxies needed to be removed, this + // won't impact that. + expected_proxies.insert(who.clone(), (proxies, old_deposit)); + expected_reserved_amounts.insert(who, current_reserved); + } + } + + let pre_upgrade_state = (expected_proxies, expected_reserved_amounts); + Ok(pre_upgrade_state.encode()) + } + + fn on_runtime_upgrade() -> Weight { + let mut reads = 0u64; + let mut writes = 0u64; + let mut proxies_removed_total = 0u64; + + Proxies::::translate( + |who: AccountId, (mut proxies, old_deposit): PrevProxiesValue| { + // Remove filter out IdentityJudgement proxies. + let proxies_len_before = proxies.len() as u64; + proxies + .retain(|proxy| proxy.proxy_type != PrevProxyType::IdentityJudgement); + let proxies_len_after = proxies.len() as u64; + + let deposit = if proxies_len_before > proxies_len_after { + log::info!( + "Removing {} IdentityJudgement proxies for {:?}", + proxies_len_before - proxies_len_after, + &who + ); + proxies_removed_total + .saturating_accrue(proxies_len_before - proxies_len_after); + + let new_deposit = + pallet_proxy::Pallet::::deposit(proxies.len() as u32); + + // Be kind and don't increase the deposit in case it increased (can + // happen if param change). + let deposit = new_deposit.min(old_deposit); + if deposit < old_deposit { + writes.saturating_inc(); + >::unreserve( + &who, + old_deposit - deposit, + ); + } + + deposit + } else { + // Nothing to do, use the old deposit. + old_deposit + }; + + reads.saturating_accrue(proxies_len_before + 1); + writes.saturating_accrue(proxies_len_after + 1); + + // No need to keep the k/v around if there're no proxies left. + match proxies.is_empty() { + true => { + debug_assert_eq!(deposit, 0); + None + }, + false => Some((proxies, deposit)), + } + }, + ); + + log::info!("Removed {} IdentityJudgement proxies in total", proxies_removed_total); + ::DbWeight::get().reads_writes(reads, writes) + } + + #[cfg(feature = "try-runtime")] + fn post_upgrade(state: Vec) -> Result<(), sp_runtime::TryRuntimeError> { + use frame_support::ensure; + use sp_runtime::TryRuntimeError; + + let (expected_proxies, expected_total_reserved): ( + BTreeMap>, + BTreeMap, + ) = Decode::decode(&mut &state[..]).expect("Failed to decode pre-upgrade state"); + + // Check Proxies storage is as expected + for (who, (proxies, deposit)) in Proxies::::iter() { + match expected_proxies.get(&who) { + Some((expected_proxies, expected_deposit)) => { + ensure!(&proxies == expected_proxies, "Unexpected Proxy"); + ensure!(&deposit == expected_deposit, "Unexpected deposit"); + }, + None => { + return Err(TryRuntimeError::Other("Missing Proxy")); + }, + } + } + + // Check the total reserved amounts for every account is as expected + for (who, expected_reserved) in expected_total_reserved.iter() { + let current_reserved = + >::reserved_balance(who); + + ensure!(current_reserved == *expected_reserved, "Reserved balance mismatch"); + } + + // Check there are no extra entries in the expected state that are not in the + // current state + for (who, _) in expected_proxies.iter() { + if !Proxies::::contains_key(who) { + return Err(TryRuntimeError::Other("Extra entry in expected state")); + } + } + + Ok(()) + } + } + } + /// Unreleased migrations. Add new ones here: pub type Unreleased = ( frame_support::migrations::RemovePallet, @@ -1990,8 +2145,6 @@ pub mod migrations { parachains_configuration::migration::v10::MigrateToV10, parachains_configuration::migration::v11::MigrateToV11, pallet_grandpa::migrations::MigrateV4ToV5, - // Migrate Identity pallet for Usernames - pallet_identity::migration::versioned::V0ToV1, parachains_scheduler::migration::MigrateV1ToV2, // Migrate from legacy lease to coretime. Needs to run after configuration v11 coretime::migration::MigrateToCoretime< @@ -2008,6 +2161,16 @@ pub mod migrations { ::DbWeight, >, CancelAuctions, + // Remove `identity` and `identity-migrator`. + frame_support::migrations::RemovePallet< + IdentityPalletName, + ::DbWeight, + >, + frame_support::migrations::RemovePallet< + IdentityMigratorPalletName, + ::DbWeight, + >, + clear_judgement_proxies::Migration, ); /// Migrations/checks that do not need to be versioned and can run on every update. @@ -2036,7 +2199,6 @@ mod benches { [polkadot_runtime_common::auctions, Auctions] [polkadot_runtime_common::crowdloan, Crowdloan] [polkadot_runtime_common::claims, Claims] - [polkadot_runtime_common::identity_migrator, IdentityMigrator] [polkadot_runtime_common::slots, Slots] [polkadot_runtime_common::paras_registrar, Registrar] [runtime_parachains::configuration, Configuration] @@ -2061,7 +2223,6 @@ mod benches { [frame_election_provider_support, ElectionProviderBench::] [pallet_fast_unstake, FastUnstake] [pallet_nis, Nis] - [pallet_identity, Identity] [pallet_indices, Indices] [pallet_message_queue, MessageQueue] [pallet_multisig, Multisig] diff --git a/relay/kusama/src/weights/mod.rs b/relay/kusama/src/weights/mod.rs index 64d53581e4..21d376bcce 100644 --- a/relay/kusama/src/weights/mod.rs +++ b/relay/kusama/src/weights/mod.rs @@ -26,7 +26,6 @@ pub mod pallet_child_bounties; pub mod pallet_conviction_voting; pub mod pallet_election_provider_multi_phase; pub mod pallet_fast_unstake; -pub mod pallet_identity; pub mod pallet_indices; pub mod pallet_message_queue; pub mod pallet_multisig; @@ -50,7 +49,6 @@ pub mod pallet_xcm; pub mod polkadot_runtime_common_auctions; pub mod polkadot_runtime_common_claims; pub mod polkadot_runtime_common_crowdloan; -pub mod polkadot_runtime_common_identity_migrator; pub mod polkadot_runtime_common_paras_registrar; pub mod polkadot_runtime_common_slots; pub mod runtime_parachains_assigner_on_demand; diff --git a/relay/kusama/src/weights/pallet_identity.rs b/relay/kusama/src/weights/pallet_identity.rs deleted file mode 100644 index c49057bcea..0000000000 --- a/relay/kusama/src/weights/pallet_identity.rs +++ /dev/null @@ -1,434 +0,0 @@ -// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md -// for a list of specific contributors. -// 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. -//! Autogenerated weights for `pallet_identity` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-03-10, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `ggwpez-ref-hw`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./kusama-chain-spec.json")`, DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=./kusama-chain-spec.json -// --steps=50 -// --repeat=20 -// --pallet=pallet_identity -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./kusama-weights/ -// --header=./file_header.txt - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `pallet_identity`. -pub struct WeightInfo(PhantomData); -impl pallet_identity::WeightInfo for WeightInfo { - /// Storage: `Identity::Registrars` (r:1 w:1) - /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 19]`. - fn add_registrar(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `32 + r * (57 ±0)` - // Estimated: `2626` - // Minimum execution time: 7_423_000 picoseconds. - Weight::from_parts(8_143_580, 0) - .saturating_add(Weight::from_parts(0, 2626)) - // Standard Error: 1_398 - .saturating_add(Weight::from_parts(88_352, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 20]`. - fn set_identity(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `6978 + r * (5 ±0)` - // Estimated: `11037` - // Minimum execution time: 105_465_000 picoseconds. - Weight::from_parts(107_147_454, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 5_835 - .saturating_add(Weight::from_parts(226_100, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::IdentityOf` (r:1 w:0) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - /// Storage: `Identity::SuperOf` (r:100 w:100) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// The range of component `s` is `[0, 100]`. - fn set_subs_new(s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `101` - // Estimated: `11037 + s * (2589 ±0)` - // Minimum execution time: 8_211_000 picoseconds. - Weight::from_parts(18_905_719, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 4_828 - .saturating_add(Weight::from_parts(3_171_890, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(s.into()))) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) - .saturating_add(Weight::from_parts(0, 2589).saturating_mul(s.into())) - } - /// Storage: `Identity::IdentityOf` (r:1 w:0) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - /// Storage: `Identity::SuperOf` (r:0 w:100) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// The range of component `p` is `[0, 100]`. - fn set_subs_old(p: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `194 + p * (32 ±0)` - // Estimated: `11037` - // Minimum execution time: 8_234_000 picoseconds. - Weight::from_parts(20_223_382, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 5_672 - .saturating_add(Weight::from_parts(1_403_444, 0).saturating_mul(p.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(p.into()))) - } - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `Identity::SuperOf` (r:0 w:100) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 20]`. - /// The range of component `s` is `[0, 100]`. - fn clear_identity(r: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `7070 + r * (5 ±0) + s * (32 ±0)` - // Estimated: `11037` - // Minimum execution time: 52_414_000 picoseconds. - Weight::from_parts(54_584_569, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 15_763 - .saturating_add(Weight::from_parts(127_125, 0).saturating_mul(r.into())) - // Standard Error: 3_075 - .saturating_add(Weight::from_parts(1_408_841, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(2)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) - } - /// Storage: `Identity::Registrars` (r:1 w:0) - /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 20]`. - fn request_judgement(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `6968 + r * (57 ±0)` - // Estimated: `11037` - // Minimum execution time: 74_182_000 picoseconds. - Weight::from_parts(76_026_106, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 3_519 - .saturating_add(Weight::from_parts(111_153, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 20]`. - fn cancel_request(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `6999` - // Estimated: `11037` - // Minimum execution time: 71_727_000 picoseconds. - Weight::from_parts(74_452_036, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 4_923 - .saturating_add(Weight::from_parts(153_968, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::Registrars` (r:1 w:1) - /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 19]`. - fn set_fee(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `89 + r * (57 ±0)` - // Estimated: `2626` - // Minimum execution time: 5_452_000 picoseconds. - Weight::from_parts(5_821_047, 0) - .saturating_add(Weight::from_parts(0, 2626)) - // Standard Error: 903 - .saturating_add(Weight::from_parts(72_242, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::Registrars` (r:1 w:1) - /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 19]`. - fn set_account_id(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `89 + r * (57 ±0)` - // Estimated: `2626` - // Minimum execution time: 5_562_000 picoseconds. - Weight::from_parts(7_663_040, 0) - .saturating_add(Weight::from_parts(0, 2626)) - // Standard Error: 4_641 - .saturating_add(Weight::from_parts(106_113, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::Registrars` (r:1 w:1) - /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 19]`. - fn set_fields(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `89 + r * (57 ±0)` - // Estimated: `2626` - // Minimum execution time: 5_624_000 picoseconds. - Weight::from_parts(7_571_970, 0) - .saturating_add(Weight::from_parts(0, 2626)) - // Standard Error: 4_246 - .saturating_add(Weight::from_parts(109_102, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::Registrars` (r:1 w:0) - /// Proof: `Identity::Registrars` (`max_values`: Some(1), `max_size`: Some(1141), added: 1636, mode: `MaxEncodedLen`) - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 19]`. - fn provide_judgement(r: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `7046 + r * (57 ±0)` - // Estimated: `11037` - // Minimum execution time: 95_196_000 picoseconds. - Weight::from_parts(97_067_549, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 4_761 - .saturating_add(Weight::from_parts(106_543, 0).saturating_mul(r.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Identity::SuperOf` (r:0 w:100) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// The range of component `r` is `[1, 20]`. - /// The range of component `s` is `[0, 100]`. - fn kill_identity(r: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `7277 + r * (5 ±0) + s * (32 ±0)` - // Estimated: `11037` - // Minimum execution time: 67_997_000 picoseconds. - Weight::from_parts(69_029_074, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 17_074 - .saturating_add(Weight::from_parts(224_876, 0).saturating_mul(r.into())) - // Standard Error: 3_331 - .saturating_add(Weight::from_parts(1_380_625, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) - } - /// Storage: `Identity::IdentityOf` (r:1 w:0) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `Identity::SuperOf` (r:1 w:1) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - /// The range of component `s` is `[0, 99]`. - fn add_sub(s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `475 + s * (36 ±0)` - // Estimated: `11037` - // Minimum execution time: 23_603_000 picoseconds. - Weight::from_parts(29_512_485, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 1_432 - .saturating_add(Weight::from_parts(102_477, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Identity::IdentityOf` (r:1 w:0) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `Identity::SuperOf` (r:1 w:1) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// The range of component `s` is `[1, 100]`. - fn rename_sub(s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `591 + s * (3 ±0)` - // Estimated: `11037` - // Minimum execution time: 13_906_000 picoseconds. - Weight::from_parts(15_280_673, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 535 - .saturating_add(Weight::from_parts(44_553, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::IdentityOf` (r:1 w:0) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `Identity::SuperOf` (r:1 w:1) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - /// The range of component `s` is `[1, 100]`. - fn remove_sub(s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `638 + s * (35 ±0)` - // Estimated: `11037` - // Minimum execution time: 29_544_000 picoseconds. - Weight::from_parts(31_743_453, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 721 - .saturating_add(Weight::from_parts(86_362, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Identity::SuperOf` (r:1 w:1) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:0) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// The range of component `s` is `[0, 99]`. - fn quit_sub(s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `704 + s * (37 ±0)` - // Estimated: `6723` - // Minimum execution time: 22_595_000 picoseconds. - Weight::from_parts(24_344_163, 0) - .saturating_add(Weight::from_parts(0, 6723)) - // Standard Error: 615 - .saturating_add(Weight::from_parts(83_224, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(2)) - } - /// Storage: `Identity::UsernameAuthorities` (r:0 w:1) - /// Proof: `Identity::UsernameAuthorities` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - fn add_username_authority() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 6_166_000 picoseconds. - Weight::from_parts(6_519_000, 0) - .saturating_add(Weight::from_parts(0, 0)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::UsernameAuthorities` (r:1 w:1) - /// Proof: `Identity::UsernameAuthorities` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - fn remove_username_authority() -> Weight { - // Proof Size summary in bytes: - // Measured: `80` - // Estimated: `3517` - // Minimum execution time: 8_575_000 picoseconds. - Weight::from_parts(9_113_000, 0) - .saturating_add(Weight::from_parts(0, 3517)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::UsernameAuthorities` (r:1 w:1) - /// Proof: `Identity::UsernameAuthorities` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`) - /// Storage: `Identity::AccountOfUsername` (r:1 w:1) - /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) - /// Storage: `Identity::PendingUsernames` (r:1 w:0) - /// Proof: `Identity::PendingUsernames` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - fn set_username_for() -> Weight { - // Proof Size summary in bytes: - // Measured: `80` - // Estimated: `11037` - // Minimum execution time: 65_274_000 picoseconds. - Weight::from_parts(67_397_000, 0) - .saturating_add(Weight::from_parts(0, 11037)) - .saturating_add(T::DbWeight::get().reads(4)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Identity::PendingUsernames` (r:1 w:1) - /// Proof: `Identity::PendingUsernames` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `Identity::AccountOfUsername` (r:0 w:1) - /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) - fn accept_username() -> Weight { - // Proof Size summary in bytes: - // Measured: `115` - // Estimated: `11037` - // Minimum execution time: 19_299_000 picoseconds. - Weight::from_parts(20_138_000, 0) - .saturating_add(Weight::from_parts(0, 11037)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(3)) - } - /// Storage: `Identity::PendingUsernames` (r:1 w:1) - /// Proof: `Identity::PendingUsernames` (`max_values`: None, `max_size`: Some(85), added: 2560, mode: `MaxEncodedLen`) - fn remove_expired_approval() -> Weight { - // Proof Size summary in bytes: - // Measured: `115` - // Estimated: `3550` - // Minimum execution time: 16_264_000 picoseconds. - Weight::from_parts(20_214_000, 0) - .saturating_add(Weight::from_parts(0, 3550)) - .saturating_add(T::DbWeight::get().reads(1)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::AccountOfUsername` (r:1 w:0) - /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - fn set_primary_username() -> Weight { - // Proof Size summary in bytes: - // Measured: `257` - // Estimated: `11037` - // Minimum execution time: 15_009_000 picoseconds. - Weight::from_parts(15_555_000, 0) - .saturating_add(Weight::from_parts(0, 11037)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } - /// Storage: `Identity::AccountOfUsername` (r:1 w:1) - /// Proof: `Identity::AccountOfUsername` (`max_values`: None, `max_size`: Some(81), added: 2556, mode: `MaxEncodedLen`) - /// Storage: `Identity::IdentityOf` (r:1 w:0) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - fn remove_dangling_username() -> Weight { - // Proof Size summary in bytes: - // Measured: `98` - // Estimated: `11037` - // Minimum execution time: 10_682_000 picoseconds. - Weight::from_parts(11_008_000, 0) - .saturating_add(Weight::from_parts(0, 11037)) - .saturating_add(T::DbWeight::get().reads(2)) - .saturating_add(T::DbWeight::get().writes(1)) - } -} diff --git a/relay/kusama/src/weights/polkadot_runtime_common_identity_migrator.rs b/relay/kusama/src/weights/polkadot_runtime_common_identity_migrator.rs deleted file mode 100644 index 7b999b032f..0000000000 --- a/relay/kusama/src/weights/polkadot_runtime_common_identity_migrator.rs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md -// for a list of specific contributors. -// 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. - -//! Autogenerated weights for `polkadot_runtime_common::identity_migrator` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-06-06, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `ggwpez-ref-hw`, CPU: `AMD EPYC 7232P 8-Core Processor` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./kusama-chain-spec.json")`, DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=./kusama-chain-spec.json -// --steps=50 -// --repeat=20 -// --pallet=polkadot_runtime_common::identity_migrator -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./kusama-weights/ -// --header=./file_header.txt - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `polkadot_runtime_common::identity_migrator`. -pub struct WeightInfo(PhantomData); -impl polkadot_runtime_common::identity_migrator::WeightInfo for WeightInfo { - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:2 w:2) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Dmp::DeliveryFeeFactor` (r:1 w:0) - /// Proof: `Dmp::DeliveryFeeFactor` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `XcmPallet::SupportedVersion` (r:1 w:0) - /// Proof: `XcmPallet::SupportedVersion` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueues` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueues` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Dmp::DownwardMessageQueueHeads` (r:1 w:1) - /// Proof: `Dmp::DownwardMessageQueueHeads` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `Identity::SuperOf` (r:0 w:100) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// The range of component `r` is `[0, 20]`. - /// The range of component `s` is `[0, 100]`. - fn reap_identity(r: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `7391 + r * (5 ±0) + s * (32 ±0)` - // Estimated: `11037 + r * (7 ±0) + s * (32 ±0)` - // Minimum execution time: 181_550_000 picoseconds. - Weight::from_parts(190_125_430, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 2_225 - .saturating_add(Weight::from_parts(1_607_494, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(8)) - .saturating_add(T::DbWeight::get().writes(6)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) - .saturating_add(Weight::from_parts(0, 7).saturating_mul(r.into())) - .saturating_add(Weight::from_parts(0, 32).saturating_mul(s.into())) - } - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(7572), added: 10047, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - fn poke_deposit() -> Weight { - // Proof Size summary in bytes: - // Measured: `7242` - // Estimated: `11037` - // Minimum execution time: 145_051_000 picoseconds. - Weight::from_parts(146_251_000, 0) - .saturating_add(Weight::from_parts(0, 11037)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } -} diff --git a/system-parachains/people/people-kusama/src/lib.rs b/system-parachains/people/people-kusama/src/lib.rs index caf6e36a2c..1e5b582e2f 100644 --- a/system-parachains/people/people-kusama/src/lib.rs +++ b/system-parachains/people/people-kusama/src/lib.rs @@ -47,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}; @@ -101,9 +101,17 @@ pub type SignedExtra = ( pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; +parameter_types! { + pub const IdentityMigratorPalletName: &'static str = "IdentityMigrator"; +} /// Migrations to apply on runtime upgrade. pub type Migrations = ( pallet_collator_selection::migration::v2::MigrationToV2, + // remove `identity-migrator` + frame_support::migrations::RemovePallet< + IdentityMigratorPalletName, + ::DbWeight, + >, // permanent pallet_xcm::migration::MigrateToLatestXcmVersion, ); @@ -504,14 +512,6 @@ impl pallet_utility::Config for Runtime { type WeightInfo = weights::pallet_utility::WeightInfo; } -// To be removed after migration is complete. -impl identity_migrator::Config for Runtime { - type RuntimeEvent = RuntimeEvent; - type Reaper = EnsureRoot; - type ReapIdentityHandler = (); - type WeightInfo = weights::polkadot_runtime_common_identity_migrator::WeightInfo; -} - // Create the runtime by composing the FRAME pallets that were previously configured. construct_runtime!( pub enum Runtime @@ -546,9 +546,6 @@ construct_runtime!( // The main stage. Identity: pallet_identity = 50, - - // To migrate deposits - IdentityMigrator: identity_migrator = 248, } ); @@ -564,8 +561,6 @@ mod benches { [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] [pallet_utility, Utility] - // Polkadot - [polkadot_runtime_common::identity_migrator, IdentityMigrator] // Cumulus [cumulus_pallet_xcmp_queue, XcmpQueue] [pallet_collator_selection, CollatorSelection] diff --git a/system-parachains/people/people-kusama/src/weights/mod.rs b/system-parachains/people/people-kusama/src/weights/mod.rs index dce959e817..34658af9ee 100644 --- a/system-parachains/people/people-kusama/src/weights/mod.rs +++ b/system-parachains/people/people-kusama/src/weights/mod.rs @@ -31,7 +31,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; diff --git a/system-parachains/people/people-kusama/src/weights/polkadot_runtime_common_identity_migrator.rs b/system-parachains/people/people-kusama/src/weights/polkadot_runtime_common_identity_migrator.rs deleted file mode 100644 index eb0d37f2d3..0000000000 --- a/system-parachains/people/people-kusama/src/weights/polkadot_runtime_common_identity_migrator.rs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md -// for a list of specific contributors. -// 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. -//! Autogenerated weights for `polkadot_runtime_common::identity_migrator` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 -//! DATE: 2024-03-19, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `ggwpez-ref-hw`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` -//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("./people-kusama-chain-spec.json")`, DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=./people-kusama-chain-spec.json -// --steps=50 -// --repeat=20 -// --pallet=polkadot_runtime_common::identity_migrator -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./people-kusama-weights/ -// --header=./file_header.txt - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(missing_docs)] - -use frame_support::{traits::Get, weights::Weight}; -use core::marker::PhantomData; - -/// Weight functions for `polkadot_runtime_common::identity_migrator`. -pub struct WeightInfo(PhantomData); -impl polkadot_runtime_common::identity_migrator::WeightInfo for WeightInfo { - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(838), added: 3313, mode: `MaxEncodedLen`) - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Identity::SuperOf` (r:0 w:100) - /// Proof: `Identity::SuperOf` (`max_values`: None, `max_size`: Some(114), added: 2589, mode: `MaxEncodedLen`) - /// The range of component `r` is `[0, 20]`. - /// The range of component `s` is `[0, 100]`. - fn reap_identity(r: u32, s: u32, ) -> Weight { - // Proof Size summary in bytes: - // Measured: `741 + r * (5 ±0) + s * (32 ±0)` - // Estimated: `6723` - // Minimum execution time: 30_569_000 picoseconds. - Weight::from_parts(28_116_110, 0) - .saturating_add(Weight::from_parts(0, 6723)) - // Standard Error: 12_561 - .saturating_add(Weight::from_parts(311_879, 0).saturating_mul(r.into())) - // Standard Error: 2_573 - .saturating_add(Weight::from_parts(1_457_752, 0).saturating_mul(s.into())) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - .saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(s.into()))) - } - /// Storage: `Identity::IdentityOf` (r:1 w:1) - /// Proof: `Identity::IdentityOf` (`max_values`: None, `max_size`: Some(838), added: 3313, mode: `MaxEncodedLen`) - /// Storage: `System::Account` (r:1 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) - /// Storage: `Identity::SubsOf` (r:1 w:1) - /// Proof: `Identity::SubsOf` (`max_values`: None, `max_size`: Some(3258), added: 5733, mode: `MaxEncodedLen`) - fn poke_deposit() -> Weight { - // Proof Size summary in bytes: - // Measured: `706` - // Estimated: `6723` - // Minimum execution time: 41_584_000 picoseconds. - Weight::from_parts(43_230_000, 0) - .saturating_add(Weight::from_parts(0, 6723)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } -}