From 5ecaca1f555b145357ebae2f1f2e24fe1e3f905a Mon Sep 17 00:00:00 2001 From: Oliver Tale-Yazdi Date: Fri, 2 Aug 2024 17:36:13 +0200 Subject: [PATCH 1/3] Fast Fellowship Promote Tracks (#356) Add fast promotion tracks with 7 days (instead of 30 days) voting period. The tracks have a 50% turnout and 66% approval criteria. To be used in combination with https://github.com/paritytech/polkadot-sdk/pull/4778. It could be that the 50% turnout is too much for tracks I and II, but for III there are not so many fellows so we can expect them to all vote IMHO. --------- Signed-off-by: Oliver Tale-Yazdi Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> --- CHANGELOG.md | 5 ++ .../src/fellowship/mod.rs | 6 +- .../src/fellowship/origins.rs | 20 +++++ .../src/fellowship/tracks.rs | 78 ++++++++++++++++++- 4 files changed, 104 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f083d6a5bb..bab46d7737 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,8 +42,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Runtime apis to help with delegate-stake based Nomination Pools ([SDK v1.13 #4537](https://github.com/paritytech/polkadot-sdk/pull/4537)). - Kusama system chains: enable PoV-reclaim. +### Added + +- Fast promotion tracks for the Fellowship ranks I-III ([polkadot-fellows/runtimes#356](https://github.com/polkadot-fellows/runtimes/pull/356)). + ### Changed +- Polkadot chains: allow arbitrary XCM execution ([polkadot-fellows/runtimes#345](https://github.com/polkadot-fellows/runtimes/pull/345)). - Bounties: Remove payout delay ([polkadot-fellows/runtimes#386](https://github.com/polkadot-fellows/runtimes/pull/386)). - Polkadot System Chains: Reduce the base transaction fee by half ([polkadot-fellows/runtimes#398](https://github.com/polkadot-fellows/runtimes/pull/398)). diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs index 974e50dbf8..9f39e5ddfc 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/mod.rs @@ -19,6 +19,7 @@ mod origins; mod tracks; use crate::{ + fellowship::origins::EnsureCanFastPromoteTo, impls::ToParentTreasury, weights, xcm_config::{AssetHubUsdt, LocationToAccountId, TreasurerBodyId}, @@ -33,7 +34,7 @@ use frame_support::{ }, PalletId, }; -use frame_system::{EnsureNever, EnsureRoot, EnsureRootWithSuccess, EnsureWithSuccess}; +use frame_system::{EnsureRoot, EnsureRootWithSuccess}; pub use origins::{ pallet_origins as pallet_fellowship_origins, Architects, EnsureCanPromoteTo, EnsureCanRetainAt, EnsureFellowship, Fellows, Masters, Members, ToVoice, @@ -206,8 +207,7 @@ impl pallet_core_fellowship::Config for Runtime { >, EnsureCanPromoteTo, >; - // TODO until https://github.com/polkadot-fellows/runtimes/pull/356/files - type FastPromoteOrigin = EnsureWithSuccess, AccountId, ConstU16<0>>; + type FastPromoteOrigin = EnsureCanFastPromoteTo; type EvidenceSize = ConstU32<65536>; type MaxRank = ConstU32<9>; } diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs index 5ed2c19f79..ed998422a0 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/origins.rs @@ -99,6 +99,16 @@ pub mod pallet_origins { /// Origin aggregated through weighted votes of those with rank 8 or above when voting on /// a month-long track; `Success` is 6. PromoteTo6Dan, + + /// Origin aggregated through weighted votes of those with rank 3 or above when voting on + /// a 30 day long track; `Success` is 1. + FastPromoteTo1Dan, + /// Origin aggregated through weighted votes of those with rank 4 or above when voting on + /// a 30 day long track; `Success` is 2. + FastPromoteTo2Dan, + /// Origin aggregated through weighted votes of those with rank 5 or above when voting on + /// a 30 day long track; `Success` is 3. + FastPromoteTo3Dan, } impl Origin { @@ -244,4 +254,14 @@ pub mod pallet_origins { PromoteTo6Dan = ranks::DAN_6, } } + + // Fellowship origin indicating weighted voting from at least the rank of `Success + 2` on + // a 30 day long track; needed for fast Fellowship promotion voting. + decl_ensure! { + pub type EnsureCanFastPromoteTo: EnsureOrigin { + FastPromoteTo1Dan = ranks::DAN_1, + FastPromoteTo2Dan = ranks::DAN_2, + FastPromoteTo3Dan = ranks::DAN_3, + } + } } diff --git a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs index f6ef2166a4..320f97d647 100644 --- a/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs +++ b/system-parachains/collectives/collectives-polkadot/src/fellowship/tracks.rs @@ -56,6 +56,12 @@ pub mod constants { pub const PROMOTE_TO_4DAN: TrackId = 24; pub const PROMOTE_TO_5DAN: TrackId = 25; pub const PROMOTE_TO_6DAN: TrackId = 26; + + // Fast track promotions (30 days) used to fast-track promotions. This works out as the track ID + // minus 28. + pub const FAST_PROMOTE_TO_1DAN: TrackId = 31; + pub const FAST_PROMOTE_TO_2DAN: TrackId = 32; + pub const FAST_PROMOTE_TO_3DAN: TrackId = 33; } /// Convert the track ID (defined above) into the minimum rank (i.e. fellowship Dan grade) required @@ -71,6 +77,9 @@ impl Convert for MinRankOfClass { // A promotion vote; the track ID turns out to be 18 more than the minimum required // rank. promotion @ 21..=26 => promotion - 18, + // A fast promotion vote; the track ID turns out to be 28 more than the minimum required + // rank. + fast_promote @ 31..=33 => fast_promote - 28, _ => Rank::MAX, } } @@ -110,13 +119,32 @@ const PROMOTE_MIN_SUPPORT: pallet_referenda::Curve = pallet_referenda::Curve::Li ceil: Perbill::from_percent(100), }; +const FAST_PROMOTE_MAX_DECIDING: u32 = 10; +const FAST_PROMOTE_DECISION_DEPOSIT: Balance = 5 * DOLLARS; +const FAST_PROMOTE_PREPARE_PERIOD: BlockNumber = 0; +const FAST_PROMOTE_DECISION_PERIOD: BlockNumber = 30 * DAYS; +const FAST_PROMOTE_CONFIRM_PERIOD: BlockNumber = HOURS; +const FAST_PROMOTE_MIN_ENACTMENT_PERIOD: BlockNumber = 0; +const FAST_PROMOTE_MIN_APPROVAL: pallet_referenda::Curve = + pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(66), + ceil: Perbill::from_percent(100), + }; +const FAST_PROMOTE_MIN_SUPPORT: pallet_referenda::Curve = + pallet_referenda::Curve::LinearDecreasing { + length: Perbill::from_percent(100), + floor: Perbill::from_percent(50), + ceil: Perbill::from_percent(100), + }; + pub struct TracksInfo; impl pallet_referenda::TracksInfo for TracksInfo { type Id = TrackId; type RuntimeOrigin = ::PalletsOrigin; fn tracks() -> &'static [(Self::Id, pallet_referenda::TrackInfo)] { use constants as tracks; - static DATA: [(TrackId, pallet_referenda::TrackInfo); 21] = [ + static DATA: [(TrackId, pallet_referenda::TrackInfo); 24] = [ ( tracks::MEMBERS, pallet_referenda::TrackInfo { @@ -483,6 +511,48 @@ impl pallet_referenda::TracksInfo for TracksInfo { min_support: PROMOTE_MIN_SUPPORT, }, ), + ( + tracks::FAST_PROMOTE_TO_1DAN, + pallet_referenda::TrackInfo { + name: "fast promote to I Dan", + max_deciding: FAST_PROMOTE_MAX_DECIDING, + decision_deposit: FAST_PROMOTE_DECISION_DEPOSIT, + prepare_period: FAST_PROMOTE_PREPARE_PERIOD, + decision_period: FAST_PROMOTE_DECISION_PERIOD, + confirm_period: FAST_PROMOTE_CONFIRM_PERIOD, + min_enactment_period: FAST_PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: FAST_PROMOTE_MIN_APPROVAL, + min_support: FAST_PROMOTE_MIN_SUPPORT, + }, + ), + ( + tracks::FAST_PROMOTE_TO_2DAN, + pallet_referenda::TrackInfo { + name: "fast promote to II Dan", + max_deciding: FAST_PROMOTE_MAX_DECIDING, + decision_deposit: FAST_PROMOTE_DECISION_DEPOSIT, + prepare_period: FAST_PROMOTE_PREPARE_PERIOD, + decision_period: FAST_PROMOTE_DECISION_PERIOD, + confirm_period: FAST_PROMOTE_CONFIRM_PERIOD, + min_enactment_period: FAST_PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: FAST_PROMOTE_MIN_APPROVAL, + min_support: FAST_PROMOTE_MIN_SUPPORT, + }, + ), + ( + tracks::FAST_PROMOTE_TO_3DAN, + pallet_referenda::TrackInfo { + name: "fast promote to III Dan", + max_deciding: FAST_PROMOTE_MAX_DECIDING, + decision_deposit: FAST_PROMOTE_DECISION_DEPOSIT, + prepare_period: FAST_PROMOTE_PREPARE_PERIOD, + decision_period: FAST_PROMOTE_DECISION_PERIOD, + confirm_period: FAST_PROMOTE_CONFIRM_PERIOD, + min_enactment_period: FAST_PROMOTE_MIN_ENACTMENT_PERIOD, + min_approval: FAST_PROMOTE_MIN_APPROVAL, + min_support: FAST_PROMOTE_MIN_SUPPORT, + }, + ), ]; &DATA[..] } @@ -525,7 +595,11 @@ impl pallet_referenda::TracksInfo for TracksInfo { Ok(Origin::PromoteTo5Dan) => Ok(tracks::PROMOTE_TO_5DAN), Ok(Origin::PromoteTo6Dan) => Ok(tracks::PROMOTE_TO_6DAN), - _ => Err(()), + Ok(Origin::FastPromoteTo1Dan) => Ok(tracks::FAST_PROMOTE_TO_1DAN), + Ok(Origin::FastPromoteTo2Dan) => Ok(tracks::FAST_PROMOTE_TO_2DAN), + Ok(Origin::FastPromoteTo3Dan) => Ok(tracks::FAST_PROMOTE_TO_3DAN), + + Err(_) => Err(()), } } } From f4244f1851c5158a3b75af5dd49537e15e47ecf4 Mon Sep 17 00:00:00 2001 From: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:01:04 +0200 Subject: [PATCH 2/3] Remove Identity from Polkadot Relay (#415) Since the launch of the People Chain, we can remove Identity and Migration code. --- CHANGELOG.md | 1 + Cargo.lock | 1 - .../people/people-polkadot/src/lib.rs | 1 - .../chains/relays/polkadot/src/lib.rs | 2 - .../people/people-polkadot/src/tests/mod.rs | 1 - .../src/tests/reap_identity.rs | 563 ------------------ relay/polkadot/Cargo.toml | 4 - relay/polkadot/src/impls.rs | 161 +---- relay/polkadot/src/lib.rs | 302 +++++++--- relay/polkadot/src/weights/mod.rs | 2 - relay/polkadot/src/weights/pallet_identity.rs | 434 -------------- ...lkadot_runtime_common_identity_migrator.rs | 99 --- .../people/people-polkadot/src/lib.rs | 23 +- .../people/people-polkadot/src/weights/mod.rs | 1 - ...lkadot_runtime_common_identity_migrator.rs | 91 --- 15 files changed, 235 insertions(+), 1451 deletions(-) delete mode 100644 integration-tests/emulated/tests/people/people-polkadot/src/tests/reap_identity.rs delete mode 100644 relay/polkadot/src/weights/pallet_identity.rs delete mode 100644 relay/polkadot/src/weights/polkadot_runtime_common_identity_migrator.rs delete mode 100644 system-parachains/people/people-polkadot/src/weights/polkadot_runtime_common_identity_migrator.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index bab46d7737..3b4c08f5c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -109,6 +109,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Remove deprecated calls from treasury pallet ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #3820](https://github.com/paritytech/polkadot-sdk/pull/3820)). - Treasury pallet: - remove unused config parameters ([runtimes#381](https://github.com/polkadot-fellows/runtimes/pull/381), [SDK v1.14 #4831](https://github.com/paritytech/polkadot-sdk/pull/4831)). +- Remove Identity from Polkadot Relay Chain ([runtimes#415](https://github.com/polkadot-fellows/runtimes/pull/415)) #### From [#322](https://github.com/polkadot-fellows/runtimes/pull/322): diff --git a/Cargo.lock b/Cargo.lock index 8af9fb9d96..46e250e527 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9959,7 +9959,6 @@ dependencies = [ "pallet-election-provider-support-benchmarking", "pallet-fast-unstake", "pallet-grandpa", - "pallet-identity", "pallet-im-online", "pallet-indices", "pallet-message-queue", diff --git a/integration-tests/emulated/chains/parachains/people/people-polkadot/src/lib.rs b/integration-tests/emulated/chains/parachains/people/people-polkadot/src/lib.rs index fe1bab1b10..8026089f1d 100644 --- a/integration-tests/emulated/chains/parachains/people/people-polkadot/src/lib.rs +++ b/integration-tests/emulated/chains/parachains/people/people-polkadot/src/lib.rs @@ -42,7 +42,6 @@ decl_test_parachains! { PolkadotXcm: people_polkadot_runtime::PolkadotXcm, Balances: people_polkadot_runtime::Balances, Identity: people_polkadot_runtime::Identity, - IdentityMigrator: people_polkadot_runtime::IdentityMigrator, } }, } diff --git a/integration-tests/emulated/chains/relays/polkadot/src/lib.rs b/integration-tests/emulated/chains/relays/polkadot/src/lib.rs index 62ea7fa069..3093c3f3bb 100644 --- a/integration-tests/emulated/chains/relays/polkadot/src/lib.rs +++ b/integration-tests/emulated/chains/relays/polkadot/src/lib.rs @@ -38,8 +38,6 @@ decl_test_relay_chains! { Treasury: polkadot_runtime::Treasury, AssetRate: polkadot_runtime::AssetRate, Hrmp: polkadot_runtime::Hrmp, - Identity: polkadot_runtime::Identity, - IdentityMigrator: polkadot_runtime::IdentityMigrator, } }, } diff --git a/integration-tests/emulated/tests/people/people-polkadot/src/tests/mod.rs b/integration-tests/emulated/tests/people/people-polkadot/src/tests/mod.rs index 6d61e2fea9..40ee1de643 100644 --- a/integration-tests/emulated/tests/people/people-polkadot/src/tests/mod.rs +++ b/integration-tests/emulated/tests/people/people-polkadot/src/tests/mod.rs @@ -14,5 +14,4 @@ // limitations under the License. mod governance; -mod reap_identity; mod teleport; diff --git a/integration-tests/emulated/tests/people/people-polkadot/src/tests/reap_identity.rs b/integration-tests/emulated/tests/people/people-polkadot/src/tests/reap_identity.rs deleted file mode 100644 index fb67e9e0e1..0000000000 --- a/integration-tests/emulated/tests/people/people-polkadot/src/tests/reap_identity.rs +++ /dev/null @@ -1,563 +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 Polkadot Relay -//! chain and to the Polkadot 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 pallet_balances::Event as BalancesEvent; -use pallet_identity::{legacy::IdentityInfo, Data, Event as IdentityEvent}; -use people_polkadot_runtime::people::{ - BasicDeposit as BasicDepositParachain, ByteDeposit as ByteDepositParachain, - IdentityInfo as IdentityInfoParachain, SubAccountDeposit as SubAccountDepositParachain, -}; -use polkadot_runtime::{ - xcm_config::CheckAccount, BasicDeposit, ByteDeposit, MaxAdditionalFields, MaxSubAccounts, - RuntimeOrigin as PolkadotOrigin, SubAccountDeposit, -}; -use polkadot_runtime_constants::currency::*; -use polkadot_system_emulated_network::{ - polkadot_emulated_chain::PolkadotRelayPallet, PolkadotRelay, PolkadotRelaySender, -}; - -type Balance = u128; -type PolkadotIdentity = ::Identity; -type PolkadotBalances = ::Balances; -type PolkadotIdentityMigrator = ::IdentityMigrator; -type PeoplePolkadotIdentity = ::Identity; -type PeoplePolkadotBalances = ::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) -} - -// Initialize the XCM Check Account with the existential deposit. We assume that it exists in -// reality and is necessary in the test because the remote deposit is less than the ED, and we -// cannot teleport (check out) an amount less than ED into a nonexistent account. -fn init_check_account() { - PolkadotRelay::fund_accounts(vec![(CheckAccount::get(), EXISTENTIAL_DEPOSIT)]); -} - -// 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 - PolkadotRelay::execute_with(|| { - type RuntimeEvent = ::RuntimeEvent; - - assert_ok!(PolkadotIdentity::set_identity( - PolkadotOrigin::signed(PolkadotRelaySender::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!(PolkadotIdentity::set_subs( - PolkadotOrigin::signed(PolkadotRelaySender::get()), - subs, - )); - } - - let reserved_balance = PolkadotBalances::reserved_balance(PolkadotRelaySender::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!( - PolkadotRelay, - vec![ - RuntimeEvent::Identity(IdentityEvent::IdentitySet { .. }) => {}, - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == PolkadotRelaySender::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!( - PolkadotRelay, - vec![ - RuntimeEvent::Identity(IdentityEvent::IdentitySet { .. }) => {}, - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == PolkadotRelaySender::get(), - amount: *amount == id_deposit, - }, - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == PolkadotRelaySender::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 - PeoplePolkadot::execute_with(|| { - let free_bal = PeoplePolkadotBalances::free_balance(PeoplePolkadotSender::get()); - let reserved_balance = - PeoplePolkadotBalances::reserved_balance(PeoplePolkadotSender::get()); - - // total balance at Genesis should be zero - assert_eq!(reserved_balance + free_bal, 0); - - assert_ok!(PeoplePolkadotIdentity::set_identity_no_deposit( - &PeoplePolkadotSender::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!(PeoplePolkadotIdentity::set_subs_no_deposit( - &PeoplePolkadotSender::get(), - subs, - )); - }, - } - - // No amount should be reserved as deposit amounts are set to 0. - let reserved_balance = - PeoplePolkadotBalances::reserved_balance(PeoplePolkadotSender::get()); - assert_eq!(reserved_balance, 0); - assert!(PeoplePolkadotIdentity::identity(PeoplePolkadotSender::get()).is_some()); - - let (_, sub_accounts) = PeoplePolkadotIdentity::subs_of(PeoplePolkadotSender::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) { - PolkadotRelay::execute_with(|| { - type RuntimeEvent = ::RuntimeEvent; - let free_bal_before_reap = PolkadotBalances::free_balance(PolkadotRelaySender::get()); - let reserved_balance = PolkadotBalances::reserved_balance(PolkadotRelaySender::get()); - - assert_eq!(reserved_balance, total_deposit); - - assert_ok!(PolkadotIdentityMigrator::reap_identity( - // Note: Root for launch testing, Signed once we open migrations. - PolkadotOrigin::signed(PolkadotRelaySender::get()), - PolkadotRelaySender::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!( - PolkadotRelay, - 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 == PolkadotRelaySender::get(), - amount: *amount == total_deposit, - }, - RuntimeEvent::IdentityMigrator( - polkadot_runtime_common::identity_migrator::Event::IdentityReaped { - who, - }) => { - who: *who == PeoplePolkadotSender::get(), - }, - ] - ); - // Identity should be gone. - assert!(PeoplePolkadotIdentity::identity(PolkadotRelaySender::get()).is_none()); - - // Subs should be gone. - let (_, sub_accounts) = PolkadotIdentity::subs_of(PolkadotRelaySender::get()); - assert_eq!(sub_accounts.len(), 0); - - let reserved_balance = PolkadotBalances::reserved_balance(PolkadotRelaySender::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 = PolkadotBalances::free_balance(PolkadotRelaySender::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) { - PeoplePolkadot::execute_with(|| { - let reserved_balance = - PeoplePolkadotBalances::reserved_balance(PeoplePolkadotSender::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!( - PeoplePolkadotBalances::free_balance(PeoplePolkadotSender::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!( - PeoplePolkadot, - 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 == PeoplePolkadotSender::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 == PeoplePolkadotSender::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!( - PeoplePolkadot, - 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 == PeoplePolkadotSender::get(), - amount: *amount == id_deposit, - }, - // Amount reserved for subs - RuntimeEvent::Balances(BalancesEvent::Reserved { who, amount }) => { - who: *who == PeoplePolkadotSender::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 == PeoplePolkadotSender::get(), - identity: *identity == id_deposit, - subs: *subs == subs_deposit, - }, - RuntimeEvent::MessageQueue(pallet_message_queue::Event::Processed { .. }) => {}, - ] - ); - }, - }; -} - -/// Duplicate of the impl of `ToParachainIdentityReaper` in the Polkadot 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 polkadot_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) { - init_check_account(); - 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/polkadot/Cargo.toml b/relay/polkadot/Cargo.toml index e906be77b5..c8a5404fac 100644 --- a/relay/polkadot/Cargo.toml +++ b/relay/polkadot/Cargo.toml @@ -53,7 +53,6 @@ pallet-fast-unstake = { workspace = true } frame-executive = { workspace = true } frame-metadata-hash-extension = { workspace = true } pallet-grandpa = { workspace = true } -pallet-identity = { workspace = true } pallet-im-online = { workspace = true } pallet-indices = { workspace = true } pallet-message-queue = { workspace = true } @@ -150,7 +149,6 @@ std = [ "pallet-election-provider-support-benchmarking?/std", "pallet-fast-unstake/std", "pallet-grandpa/std", - "pallet-identity/std", "pallet-im-online/std", "pallet-indices/std", "pallet-message-queue/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-im-online/runtime-benchmarks", "pallet-indices/runtime-benchmarks", "pallet-message-queue/runtime-benchmarks", @@ -282,7 +279,6 @@ try-runtime = [ "pallet-election-provider-multi-phase/try-runtime", "pallet-fast-unstake/try-runtime", "pallet-grandpa/try-runtime", - "pallet-identity/try-runtime", "pallet-im-online/try-runtime", "pallet-indices/try-runtime", "pallet-message-queue/try-runtime", diff --git a/relay/polkadot/src/impls.rs b/relay/polkadot/src/impls.rs index 961a06c1d1..9d16785485 100644 --- a/relay/polkadot/src/impls.rs +++ b/relay/polkadot/src/impls.rs @@ -15,169 +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, Contains}, -}; -use frame_system::RawOrigin; +use frame_support::traits::{tokens::ConversionFromAssetBalance, Contains}; use polkadot_primitives::Id as ParaId; -use polkadot_runtime_common::identity_migrator::{OnReapIdentity, WeightInfo}; -use polkadot_runtime_constants::system_parachain::PEOPLE_ID; 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/b0a3eff/system-parachains/constants/src/polkadot.rs#L70 - // - // 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 dot = 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(&dot, &who_origin, None) - .map_err(|err| { - defensive!( - "runtime::on_reap_identity: withdraw_asset(what: {:?}, who_origin: {:?}) error: {:?}", - (&dot, &who_origin, err) - ); - pallet_xcm::Error::::LowBalance - })?; - - // check out - xcm_config::LocalAssetTransactor::can_check_out( - &destination, - &dot, - // 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, dot, err - ); - pallet_xcm::Error::::CannotCheckOutTeleport - })?; - xcm_config::LocalAssetTransactor::check_out( - &destination, - &dot, - // not used in AssetTransactor - &XcmContext { origin: None, message_id: [0; 32], topic: None }, - ); - - // reanchor - let dot_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(dot_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::from(destination)), - Box::new(VersionedXcm::from(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/polkadot/src/lib.rs b/relay/polkadot/src/lib.rs index 4fc780774e..9f593b75d2 100644 --- a/relay/polkadot/src/lib.rs +++ b/relay/polkadot/src/lib.rs @@ -22,7 +22,7 @@ use pallet_transaction_payment::FungibleAdapter; use polkadot_runtime_common::{ - auctions, claims, crowdloan, identity_migrator, impl_runtime_weights, + auctions, claims, crowdloan, impl_runtime_weights, impls::{ DealWithFees, LocatableAssetConverter, VersionedLocatableAsset, VersionedLocationConverter, }, @@ -61,8 +61,8 @@ use frame_support::{ genesis_builder_helper::{build_state, get_preset}, parameter_types, traits::{ - fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, EverythingBut, - Get, InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, + fungible::HoldConsideration, ConstU32, EitherOf, EitherOfDiverse, Everything, Get, + InstanceFilter, KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError, WithdrawReasons, }, weights::{ConstantMultiplier, WeightMeter, WeightToFee as _}, @@ -70,7 +70,6 @@ use frame_support::{ }; 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, RuntimeDispatchInfo}; use polkadot_primitives::{ @@ -135,11 +134,6 @@ use governance::{ pub mod impls; pub mod xcm_config; -use impls::ToParachainIdentityReaper; - -#[cfg(not(feature = "runtime-benchmarks"))] -use frame_system::EnsureSigned; - pub const LOG_TARGET: &str = "runtime::polkadot"; impl_runtime_weights!(polkadot_runtime_constants); @@ -180,19 +174,8 @@ parameter_types! { pub const SS58Prefix: u8 = 0; } -/// 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; @@ -785,48 +768,6 @@ impl pallet_fast_unstake::Config for Runtime { type WeightInfo = weights::pallet_fast_unstake::WeightInfo; } -parameter_types! { - // Minimum 4 CENTS/byte - pub const BasicDeposit: Balance = deposit(1, 258); - pub const ByteDeposit: Balance = deposit(0, 1); - pub const SubAccountDeposit: Balance = deposit(1, 53); - 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 = EitherOf, GeneralAdmin>; - 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; - #[cfg(not(feature = "runtime-benchmarks"))] - type Reaper = EnsureSigned; - #[cfg(feature = "runtime-benchmarks")] - type Reaper = - impls::benchmarks::InitializeReaperForBenchmarking>; - type ReapIdentityHandler = ToParachainIdentityReaper; - type WeightInfo = weights::polkadot_runtime_common_identity_migrator::WeightInfo; -} - parameter_types! { pub const ProposalBond: Permill = Permill::from_percent(5); pub const ProposalBondMinimum: Balance = 100 * DOLLARS; @@ -1109,7 +1050,7 @@ pub enum ProxyType { Governance = 2, Staking = 3, // Skip 4 as it is now removed (was SudoBalances) - IdentityJudgement = 5, + // Skip 5 as it was IdentityJudgement CancelProxy = 6, Auction = 7, NominationPools = 8, @@ -1136,13 +1077,13 @@ mod proxy_type_tests { (OldProxyType::NonTransfer, ProxyType::NonTransfer), (OldProxyType::Governance, ProxyType::Governance), (OldProxyType::Staking, ProxyType::Staking), - (OldProxyType::IdentityJudgement, ProxyType::IdentityJudgement), ] .into_iter() { assert_eq!(i.encode(), j.encode()); } assert!(ProxyType::decode(&mut &OldProxyType::SudoBalances.encode()[..]).is_err()); + assert!(ProxyType::decode(&mut &OldProxyType::IdentityJudgement.encode()[..]).is_err()); } } @@ -1180,7 +1121,6 @@ impl InstanceFilter for ProxyType { RuntimeCall::Vesting(pallet_vesting::Call::vest_other{..}) | // Specifically omitting Vesting `vested_transfer`, and `force_vested_transfer` RuntimeCall::Utility(..) | - RuntimeCall::Identity(..) | RuntimeCall::Proxy(..) | RuntimeCall::Multisig(..) | RuntimeCall::Registrar(paras_registrar::Call::register {..}) | @@ -1217,11 +1157,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 { .. })) }, @@ -1614,8 +1549,7 @@ construct_runtime! { // Cunning utilities. Usable initially. Utility: pallet_utility = 26, - // Identity. Late addition. - Identity: pallet_identity = 28, + // Identity: pallet_identity = 28, (removed post 1.2.8) // Proxy module. Late addition. Proxy: pallet_proxy = 29, @@ -1680,9 +1614,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, } } @@ -1717,6 +1648,214 @@ impl Get for NominationPoolsMigrationV4OldPallet { } } +/// Migration to remove deprecated judgement proxies. +mod clear_judgement_proxies { + use super::*; + + use frame_support::{ + pallet_prelude::{TypeInfo, ValueQuery}, + storage_alias, + traits::{Currency, OnRuntimeUpgrade, 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 = 0, + NonTransfer = 1, + Governance = 2, + Staking = 3, + // Skip 4 as it is now removed (was SudoBalances) + IdentityJudgement = 5, + CancelProxy = 6, + Auction = 7, + NominationPools = 8, + } + + 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 storage, 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(()) + } + } +} + +parameter_types! { + pub const IdentityPalletName: &'static str = "Identity"; + pub const IdentityMigratorPalletName: &'static str = "IdentityMigrator"; +} + /// All migrations that will run on the next runtime upgrade. /// /// This contains the combined migrations of the last 10 releases. It allows to skip runtime @@ -1733,6 +1872,15 @@ pub mod migrations { parachains_configuration::migration::v12::MigrateToV12, parachains_inclusion::migration::MigrateToV1, pallet_staking::migrations::v15::MigrateV14ToV15, + 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. @@ -1762,7 +1910,6 @@ mod benches { [polkadot_runtime_common::auctions, Auctions] [polkadot_runtime_common::claims, Claims] [polkadot_runtime_common::crowdloan, Crowdloan] - [polkadot_runtime_common::identity_migrator, IdentityMigrator] [polkadot_runtime_common::slots, Slots] [polkadot_runtime_common::paras_registrar, Registrar] [runtime_parachains::configuration, Configuration] @@ -1782,7 +1929,6 @@ mod benches { [pallet_election_provider_multi_phase, ElectionProviderMultiPhase] [frame_election_provider_support, ElectionProviderBench::] [pallet_fast_unstake, FastUnstake] - [pallet_identity, Identity] [pallet_indices, Indices] [pallet_message_queue, MessageQueue] [pallet_multisig, Multisig] diff --git a/relay/polkadot/src/weights/mod.rs b/relay/polkadot/src/weights/mod.rs index c4d8c00b0d..61ab39cef5 100644 --- a/relay/polkadot/src/weights/mod.rs +++ b/relay/polkadot/src/weights/mod.rs @@ -25,7 +25,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; @@ -45,7 +44,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_configuration; diff --git a/relay/polkadot/src/weights/pallet_identity.rs b/relay/polkadot/src/weights/pallet_identity.rs deleted file mode 100644 index e49c87b5d5..0000000000 --- a/relay/polkadot/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("./polkadot-chain-spec.json")`, DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=./polkadot-chain-spec.json -// --steps=50 -// --repeat=20 -// --pallet=pallet_identity -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./polkadot-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_476_000 picoseconds. - Weight::from_parts(8_068_602, 0) - .saturating_add(Weight::from_parts(0, 2626)) - // Standard Error: 1_238 - .saturating_add(Weight::from_parts(82_244, 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: 104_591_000 picoseconds. - Weight::from_parts(107_199_522, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 6_435 - .saturating_add(Weight::from_parts(148_902, 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_067_000 picoseconds. - Weight::from_parts(18_616_651, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 3_834 - .saturating_add(Weight::from_parts(3_075_321, 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: 7_931_000 picoseconds. - Weight::from_parts(19_401_564, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 2_980 - .saturating_add(Weight::from_parts(1_292_066, 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: 50_902_000 picoseconds. - Weight::from_parts(51_250_065, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 12_441 - .saturating_add(Weight::from_parts(174_014, 0).saturating_mul(r.into())) - // Standard Error: 2_427 - .saturating_add(Weight::from_parts(1_298_613, 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: 71_685_000 picoseconds. - Weight::from_parts(73_296_911, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 4_701 - .saturating_add(Weight::from_parts(152_413, 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: 69_785_000 picoseconds. - Weight::from_parts(71_089_142, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 3_819 - .saturating_add(Weight::from_parts(101_852, 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_213_000 picoseconds. - Weight::from_parts(5_581_162, 0) - .saturating_add(Weight::from_parts(0, 2626)) - // Standard Error: 981 - .saturating_add(Weight::from_parts(78_901, 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_337_000 picoseconds. - Weight::from_parts(5_799_042, 0) - .saturating_add(Weight::from_parts(0, 2626)) - // Standard Error: 939 - .saturating_add(Weight::from_parts(70_694, 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_357_000 picoseconds. - Weight::from_parts(5_658_168, 0) - .saturating_add(Weight::from_parts(0, 2626)) - // Standard Error: 948 - .saturating_add(Weight::from_parts(72_410, 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: 92_729_000 picoseconds. - Weight::from_parts(94_462_797, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 5_319 - .saturating_add(Weight::from_parts(107_982, 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: 64_407_000 picoseconds. - Weight::from_parts(67_522_869, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 15_370 - .saturating_add(Weight::from_parts(160_891, 0).saturating_mul(r.into())) - // Standard Error: 2_999 - .saturating_add(Weight::from_parts(1_313_042, 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_539_000 picoseconds. - Weight::from_parts(27_045_777, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 1_594 - .saturating_add(Weight::from_parts(128_065, 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: 11_418_000 picoseconds. - Weight::from_parts(14_873_630, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 914 - .saturating_add(Weight::from_parts(42_574, 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_362_000 picoseconds. - Weight::from_parts(31_448_090, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 811 - .saturating_add(Weight::from_parts(88_172, 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_979_000 picoseconds. - Weight::from_parts(24_439_448, 0) - .saturating_add(Weight::from_parts(0, 6723)) - // Standard Error: 571 - .saturating_add(Weight::from_parts(82_739, 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_105_000 picoseconds. - Weight::from_parts(6_441_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_719_000 picoseconds. - Weight::from_parts(9_041_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_333_000 picoseconds. - Weight::from_parts(67_018_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_237_000 picoseconds. - Weight::from_parts(19_746_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_277_000 picoseconds. - Weight::from_parts(20_932_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_000_000 picoseconds. - Weight::from_parts(15_349_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_637_000 picoseconds. - Weight::from_parts(10_971_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/polkadot/src/weights/polkadot_runtime_common_identity_migrator.rs b/relay/polkadot/src/weights/polkadot_runtime_common_identity_migrator.rs deleted file mode 100644 index 60d22ae11c..0000000000 --- a/relay/polkadot/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-07, 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("./polkadot-chain-spec.json")`, DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=./polkadot-chain-spec.json -// --steps=50 -// --repeat=20 -// --pallet=polkadot_runtime_common::identity_migrator -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./polkadot-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: `7522 + r * (5 ±0) + s * (32 ±0)` - // Estimated: `11037 + r * (7 ±0) + s * (32 ±0)` - // Minimum execution time: 176_411_000 picoseconds. - Weight::from_parts(182_882_369, 0) - .saturating_add(Weight::from_parts(0, 11037)) - // Standard Error: 1_902 - .saturating_add(Weight::from_parts(1_581_866, 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: 142_331_000 picoseconds. - Weight::from_parts(145_781_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-polkadot/src/lib.rs b/system-parachains/people/people-polkadot/src/lib.rs index eb900e6b88..7828bc1d02 100644 --- a/system-parachains/people/people-polkadot/src/lib.rs +++ b/system-parachains/people/people-polkadot/src/lib.rs @@ -49,7 +49,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}; @@ -110,9 +110,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 = ( cumulus_pallet_xcmp_queue::migration::v5::MigrateV4ToV5, + frame_support::migrations::RemovePallet< + IdentityMigratorPalletName, + ::DbWeight, + >, // permanent pallet_xcm::migration::MigrateToLatestXcmVersion, ); @@ -523,14 +531,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 @@ -565,9 +565,6 @@ construct_runtime!( // The main stage. Identity: pallet_identity = 50, - - // To migrate deposits - IdentityMigrator: identity_migrator = 248, } ); @@ -584,8 +581,6 @@ mod benches { [pallet_session, SessionBench::] [pallet_timestamp, Timestamp] [pallet_utility, Utility] - // Polkadot - [polkadot_runtime_common::identity_migrator, IdentityMigrator] // Cumulus [cumulus_pallet_parachain_system, ParachainSystem] [cumulus_pallet_xcmp_queue, XcmpQueue] diff --git a/system-parachains/people/people-polkadot/src/weights/mod.rs b/system-parachains/people/people-polkadot/src/weights/mod.rs index dce959e817..34658af9ee 100644 --- a/system-parachains/people/people-polkadot/src/weights/mod.rs +++ b/system-parachains/people/people-polkadot/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-polkadot/src/weights/polkadot_runtime_common_identity_migrator.rs b/system-parachains/people/people-polkadot/src/weights/polkadot_runtime_common_identity_migrator.rs deleted file mode 100644 index bcd87b2cc1..0000000000 --- a/system-parachains/people/people-polkadot/src/weights/polkadot_runtime_common_identity_migrator.rs +++ /dev/null @@ -1,91 +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-05-30, 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("./people-polkadot-chain-spec.json")`, DB CACHE: 1024 - -// Executed Command: -// ./target/production/polkadot -// benchmark -// pallet -// --chain=./people-polkadot-chain-spec.json -// --steps=50 -// --repeat=20 -// --pallet=polkadot_runtime_common::identity_migrator -// --extrinsic=* -// --wasm-execution=compiled -// --heap-pages=4096 -// --output=./people-polkadot-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: 36_130_000 picoseconds. - Weight::from_parts(38_663_715, 0) - .saturating_add(Weight::from_parts(0, 6723)) - // Standard Error: 4_799 - .saturating_add(Weight::from_parts(49_078, 0).saturating_mul(r.into())) - // Standard Error: 983 - .saturating_add(Weight::from_parts(1_498_325, 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: 51_511_000 picoseconds. - Weight::from_parts(52_060_000, 0) - .saturating_add(Weight::from_parts(0, 6723)) - .saturating_add(T::DbWeight::get().reads(3)) - .saturating_add(T::DbWeight::get().writes(3)) - } -} From b1b377694fe9c368a175d83cb6144b1edd529cff Mon Sep 17 00:00:00 2001 From: Alin Dima Date: Mon, 5 Aug 2024 20:29:13 +0300 Subject: [PATCH 3/3] bump polkadot-runtime-parachains to 15.0.1 (#412) Includes the following fix: https://github.com/paritytech/polkadot-sdk/pull/5113 - [x] Does not require a CHANGELOG entry Co-authored-by: fellowship-merge-bot[bot] <151052383+fellowship-merge-bot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 46e250e527..4b48e50fbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10111,9 +10111,9 @@ dependencies = [ [[package]] name = "polkadot-runtime-parachains" -version = "15.0.0" +version = "15.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9527e255412d9944a68a13161c0b2eb9cfa8011fab2cb4c5857f2ab80e80cc" +checksum = "3df740bff0b29ba4cd8c8874d7f8fb90e5722c24a7354d2e96d15e7121c1525e" dependencies = [ "bitflags 1.3.2", "bitvec", diff --git a/Cargo.toml b/Cargo.toml index 1de17b2a65..5cb12b007d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -186,7 +186,7 @@ polkadot-system-emulated-network = { path = "integration-tests/emulated/networks primitive-types = { version = "0.12.2", default-features = false } frame-metadata-hash-extension = { version = "0.4.0", default-features = false } remote-externalities = { version = "0.43.0", package = "frame-remote-externalities" } -runtime-parachains = { version = "15.0.0", default-features = false, package = "polkadot-runtime-parachains" } +runtime-parachains = { version = "15.0.1", default-features = false, package = "polkadot-runtime-parachains" } sc-chain-spec = { version = "35.0.0" } scale-info = { version = "2.10.0", default-features = false } separator = { version = "0.4.1" }