difftreelog
refactor(identity) displace set-identities to identity pallet
in: master
19 files changed
Makefilediffbeforeafterboth--- a/Makefile
+++ b/Makefile
@@ -133,6 +133,10 @@
bench-collator-selection:
make _bench PALLET=collator-selection
+.PHONY: bench-identity
+bench-identity:
+ make _bench PALLET=identity
+
.PHONY: bench-app-promotion
bench-app-promotion:
make _bench PALLET=app-promotion PALLET_DIR=app-promotion
pallets/data-management/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/data-management/src/benchmarking.rs
+++ b/pallets/data-management/src/benchmarking.rs
@@ -62,28 +62,4 @@
use codec::Encode;
let logs = (0..b).map(|_| <T as Config>::RuntimeEvent::from(crate::Event::<T>::TestEvent).encode()).collect::<Vec<_>>();
}: _(RawOrigin::Root, logs)
-
- set_identities {
- let b in 0..600;
- use frame_benchmarking::account;
- use pallet_identity::{BalanceOf, Registration, IdentityInfo};
- let identities = (0..b).map(|i| (
- account("caller", i, 0),
- Some(Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {
- judgements: Default::default(),
- deposit: Default::default(),
- info: IdentityInfo {
- additional: Default::default(),
- display: Default::default(),
- legal: Default::default(),
- web: Default::default(),
- riot: Default::default(),
- email: Default::default(),
- pgp_fingerprint: None,
- image: Default::default(),
- twitter: Default::default(),
- },
- }),
- )).collect::<Vec<_>>();
- }: _(RawOrigin::Root, identities)
}
pallets/data-management/src/lib.rsdiffbeforeafterboth--- a/pallets/data-management/src/lib.rs
+++ b/pallets/data-management/src/lib.rs
@@ -34,10 +34,9 @@
use sp_std::vec::Vec;
use super::weights::WeightInfo;
use pallet_evm::{PrecompileHandle, Pallet as PalletEvm};
- use pallet_identity::Registration;
#[pallet::config]
- pub trait Config: frame_system::Config + pallet_evm::Config + pallet_identity::Config {
+ pub trait Config: frame_system::Config + pallet_evm::Config {
/// Weights
type WeightInfo: WeightInfo;
/// The overarching event type.
@@ -147,29 +146,6 @@
<T as frame_system::Config>::RuntimeEvent::decode(&mut event.as_slice())
.map_err(|_| <Error<T>>::BadEvent)?,
);
- }
- Ok(())
- }
-
- /// Insert or remove identities.
- #[pallet::call_index(5)]
- #[pallet::weight(<SelfWeightOf<T>>::set_identities(identities.len() as u32))] // todo:collator weight
- pub fn set_identities(
- origin: OriginFor<T>,
- identities: Vec<(
- T::AccountId,
- Option<
- Registration<
- pallet_identity::BalanceOf<T>,
- T::MaxRegistrars,
- T::MaxAdditionalFields,
- >,
- >,
- )>,
- ) -> DispatchResult {
- ensure_root(origin)?;
- for identity in identities {
- <pallet_identity::IdentityOf<T>>::set(identity.0, identity.1);
}
Ok(())
}
pallets/data-management/src/weights.rsdiffbeforeafterboth--- a/pallets/data-management/src/weights.rs
+++ b/pallets/data-management/src/weights.rs
@@ -39,7 +39,6 @@
fn finish(b: u32, ) -> Weight;
fn insert_eth_logs(b: u32, ) -> Weight;
fn insert_events(b: u32, ) -> Weight;
- fn set_identities(b: u32, ) -> Weight;
}
/// Weights for pallet_data_management using the Substrate node and recommended hardware.
@@ -77,11 +76,6 @@
.saturating_add(Weight::from_ref_time(722_345 as u64).saturating_mul(b as u64))
}
fn insert_events(b: u32, ) -> Weight {
- Weight::from_ref_time(10_936_376 as u64)
- // Standard Error: 1_227
- .saturating_add(Weight::from_ref_time(1_311_481 as u64).saturating_mul(b as u64))
- }
- fn set_identities(b: u32, ) -> Weight {
Weight::from_ref_time(10_936_376 as u64)
// Standard Error: 1_227
.saturating_add(Weight::from_ref_time(1_311_481 as u64).saturating_mul(b as u64))
@@ -122,11 +116,6 @@
.saturating_add(Weight::from_ref_time(722_345 as u64).saturating_mul(b as u64))
}
fn insert_events(b: u32, ) -> Weight {
- Weight::from_ref_time(10_936_376 as u64)
- // Standard Error: 1_227
- .saturating_add(Weight::from_ref_time(1_311_481 as u64).saturating_mul(b as u64))
- }
- fn set_identities(b: u32, ) -> Weight {
Weight::from_ref_time(10_936_376 as u64)
// Standard Error: 1_227
.saturating_add(Weight::from_ref_time(1_311_481 as u64).saturating_mul(b as u64))
pallets/identity/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/identity/src/benchmarking.rs
+++ b/pallets/identity/src/benchmarking.rs
@@ -412,6 +412,21 @@
ensure!(!IdentityOf::<T>::contains_key(&target), "Identity not removed");
}
+ set_identities {
+ let x in 0 .. T::MaxAdditionalFields::get();
+ let n in 0..600;
+ use frame_benchmarking::account;
+ let identities = (0..n).map(|i| (
+ account("caller", i, 0),
+ Some(Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {
+ judgements: Default::default(),
+ deposit: Default::default(),
+ info: create_identity_info::<T>(x),
+ }),
+ )).collect::<Vec<_>>();
+ let origin = T::ForceOrigin::successful_origin();
+ }: _<T::RuntimeOrigin>(origin, identities)
+
add_sub {
let s in 0 .. T::MaxSubAccounts::get() - 1;
pallets/identity/src/lib.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license:18// This file is part of Substrate.1920// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435//! # Identity Pallet36//!37//! - [`Config`]38//! - [`Call`]39//!40//! ## Overview41//!42//! A federated naming system, allowing for multiple registrars to be added from a specified origin.43//! Registrars can set a fee to provide identity-verification service. Anyone can put forth a44//! proposed identity for a fixed deposit and ask for review by any number of registrars (paying45//! each of their fees). Registrar judgements are given as an `enum`, allowing for sophisticated,46//! multi-tier opinions.47//!48//! Some judgements are identified as *sticky*, which means they cannot be removed except by49//! complete removal of the identity, or by the registrar. Judgements are allowed to represent a50//! portion of funds that have been reserved for the registrar.51//!52//! A super-user can remove accounts and in doing so, slash the deposit.53//!54//! All accounts may also have a limited number of sub-accounts which may be specified by the owner;55//! by definition, these have equivalent ownership and each has an individual name.56//!57//! The number of registrars should be limited, and the deposit made sufficiently large, to ensure58//! no state-bloat attack is viable.59//!60//! ## Interface61//!62//! ### Dispatchable Functions63//!64//! #### For general users65//! * `set_identity` - Set the associated identity of an account; a small deposit is reserved if not66//! already taken.67//! * `clear_identity` - Remove an account's associated identity; the deposit is returned.68//! * `request_judgement` - Request a judgement from a registrar, paying a fee.69//! * `cancel_request` - Cancel the previous request for a judgement.70//!71//! #### For general users with sub-identities72//! * `set_subs` - Set the sub-accounts of an identity.73//! * `add_sub` - Add a sub-identity to an identity.74//! * `remove_sub` - Remove a sub-identity of an identity.75//! * `rename_sub` - Rename a sub-identity of an identity.76//! * `quit_sub` - Remove a sub-identity of an identity (called by the sub-identity).77//!78//! #### For registrars79//! * `set_fee` - Set the fee required to be paid for a judgement to be given by the registrar.80//! * `set_fields` - Set the fields that a registrar cares about in their judgements.81//! * `provide_judgement` - Provide a judgement to an identity.82//!83//! #### For super-users84//! * `add_registrar` - Add a new registrar to the system.85//! * `kill_identity` - Forcibly remove the associated identity; the deposit is lost.86//!87//! [`Call`]: ./enum.Call.html88//! [`Config`]: ./trait.Config.html8990#![cfg_attr(not(feature = "std"), no_std)]9192mod benchmarking;93#[cfg(test)]94mod tests;95mod types;96pub mod weights;9798use frame_support::traits::{BalanceStatus, Currency, OnUnbalanced, ReservableCurrency};99use sp_runtime::traits::{AppendZerosInput, Hash, Saturating, StaticLookup, Zero};100use sp_std::prelude::*;101pub use weights::WeightInfo;102103pub use pallet::*;104pub use types::{105 Data, IdentityField, IdentityFields, IdentityInfo, Judgement, RegistrarIndex, RegistrarInfo,106 Registration,107};108109pub type BalanceOf<T> =110 <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;111type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<112 <T as frame_system::Config>::AccountId,113>>::NegativeImbalance;114type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;115116#[frame_support::pallet]117pub mod pallet {118 use super::*;119 use frame_support::pallet_prelude::*;120 use frame_system::pallet_prelude::*;121122 #[pallet::config]123 pub trait Config: frame_system::Config {124 /// The overarching event type.125 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;126127 /// The currency trait.128 type Currency: ReservableCurrency<Self::AccountId>;129130 /// The amount held on deposit for a registered identity131 #[pallet::constant]132 type BasicDeposit: Get<BalanceOf<Self>>;133134 /// The amount held on deposit per additional field for a registered identity.135 #[pallet::constant]136 type FieldDeposit: Get<BalanceOf<Self>>;137138 /// The amount held on deposit for a registered subaccount. This should account for the fact139 /// that one storage item's value will increase by the size of an account ID, and there will140 /// be another trie item whose value is the size of an account ID plus 32 bytes.141 #[pallet::constant]142 type SubAccountDeposit: Get<BalanceOf<Self>>;143144 /// The maximum number of sub-accounts allowed per identified account.145 #[pallet::constant]146 type MaxSubAccounts: Get<u32>;147148 /// Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O149 /// required to access an identity, but can be pretty high.150 #[pallet::constant]151 type MaxAdditionalFields: Get<u32>;152153 /// Maxmimum number of registrars allowed in the system. Needed to bound the complexity154 /// of, e.g., updating judgements.155 #[pallet::constant]156 type MaxRegistrars: Get<u32>;157158 /// What to do with slashed funds.159 type Slashed: OnUnbalanced<NegativeImbalanceOf<Self>>;160161 /// The origin which may forcibly set or remove a name. Root can always do this.162 type ForceOrigin: EnsureOrigin<Self::RuntimeOrigin>;163164 /// The origin which may add or remove registrars. Root can always do this.165 type RegistrarOrigin: EnsureOrigin<Self::RuntimeOrigin>;166167 /// Weight information for extrinsics in this pallet.168 type WeightInfo: WeightInfo;169 }170171 #[pallet::pallet]172 #[pallet::generate_store(pub(super) trait Store)]173 pub struct Pallet<T>(_);174175 /// Information that is pertinent to identify the entity behind an account.176 ///177 /// TWOX-NOTE: OK ― `AccountId` is a secure hash.178 #[pallet::storage]179 #[pallet::getter(fn identity)]180 pub type IdentityOf<T: Config> = StorageMap<181 _,182 Twox64Concat,183 T::AccountId,184 Registration<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields>,185 OptionQuery,186 >;187188 /// The super-identity of an alternative "sub" identity together with its name, within that189 /// context. If the account is not some other account's sub-identity, then just `None`.190 #[pallet::storage]191 #[pallet::getter(fn super_of)]192 pub(super) type SuperOf<T: Config> =193 StorageMap<_, Blake2_128Concat, T::AccountId, (T::AccountId, Data), OptionQuery>;194195 /// Alternative "sub" identities of this account.196 ///197 /// The first item is the deposit, the second is a vector of the accounts.198 ///199 /// TWOX-NOTE: OK ― `AccountId` is a secure hash.200 #[pallet::storage]201 #[pallet::getter(fn subs_of)]202 pub(super) type SubsOf<T: Config> = StorageMap<203 _,204 Twox64Concat,205 T::AccountId,206 (BalanceOf<T>, BoundedVec<T::AccountId, T::MaxSubAccounts>),207 ValueQuery,208 >;209210 /// The set of registrars. Not expected to get very big as can only be added through a211 /// special origin (likely a council motion).212 ///213 /// The index into this can be cast to `RegistrarIndex` to get a valid value.214 #[pallet::storage]215 #[pallet::getter(fn registrars)]216 pub(super) type Registrars<T: Config> = StorageValue<217 _,218 BoundedVec<Option<RegistrarInfo<BalanceOf<T>, T::AccountId>>, T::MaxRegistrars>,219 ValueQuery,220 >;221222 #[pallet::error]223 pub enum Error<T> {224 /// Too many subs-accounts.225 TooManySubAccounts,226 /// Account isn't found.227 NotFound,228 /// Account isn't named.229 NotNamed,230 /// Empty index.231 EmptyIndex,232 /// Fee is changed.233 FeeChanged,234 /// No identity found.235 NoIdentity,236 /// Sticky judgement.237 StickyJudgement,238 /// Judgement given.239 JudgementGiven,240 /// Invalid judgement.241 InvalidJudgement,242 /// The index is invalid.243 InvalidIndex,244 /// The target is invalid.245 InvalidTarget,246 /// Too many additional fields.247 TooManyFields,248 /// Maximum amount of registrars reached. Cannot add any more.249 TooManyRegistrars,250 /// Account ID is already named.251 AlreadyClaimed,252 /// Sender is not a sub-account.253 NotSub,254 /// Sub-account isn't owned by sender.255 NotOwned,256 /// The provided judgement was for a different identity.257 JudgementForDifferentIdentity,258 /// Error that occurs when there is an issue paying for judgement.259 JudgementPaymentFailed,260 }261262 #[pallet::event]263 #[pallet::generate_deposit(pub(super) fn deposit_event)]264 pub enum Event<T: Config> {265 /// A name was set or reset (which will remove all judgements).266 IdentitySet { who: T::AccountId },267 /// A name was cleared, and the given balance returned.268 IdentityCleared {269 who: T::AccountId,270 deposit: BalanceOf<T>,271 },272 /// A name was removed and the given balance slashed.273 IdentityKilled {274 who: T::AccountId,275 deposit: BalanceOf<T>,276 },277 /// A judgement was asked from a registrar.278 JudgementRequested {279 who: T::AccountId,280 registrar_index: RegistrarIndex,281 },282 /// A judgement request was retracted.283 JudgementUnrequested {284 who: T::AccountId,285 registrar_index: RegistrarIndex,286 },287 /// A judgement was given by a registrar.288 JudgementGiven {289 target: T::AccountId,290 registrar_index: RegistrarIndex,291 },292 /// A registrar was added.293 RegistrarAdded { registrar_index: RegistrarIndex },294 /// A sub-identity was added to an identity and the deposit paid.295 SubIdentityAdded {296 sub: T::AccountId,297 main: T::AccountId,298 deposit: BalanceOf<T>,299 },300 /// A sub-identity was removed from an identity and the deposit freed.301 SubIdentityRemoved {302 sub: T::AccountId,303 main: T::AccountId,304 deposit: BalanceOf<T>,305 },306 /// A sub-identity was cleared, and the given deposit repatriated from the307 /// main identity account to the sub-identity account.308 SubIdentityRevoked {309 sub: T::AccountId,310 main: T::AccountId,311 deposit: BalanceOf<T>,312 },313 }314315 #[pallet::call]316 /// Identity pallet declaration.317 impl<T: Config> Pallet<T> {318 /// Add a registrar to the system.319 ///320 /// The dispatch origin for this call must be `T::RegistrarOrigin`.321 ///322 /// - `account`: the account of the registrar.323 ///324 /// Emits `RegistrarAdded` if successful.325 ///326 /// # <weight>327 /// - `O(R)` where `R` registrar-count (governance-bounded and code-bounded).328 /// - One storage mutation (codec `O(R)`).329 /// - One event.330 /// # </weight>331 #[pallet::call_index(0)]332 #[pallet::weight(T::WeightInfo::add_registrar(T::MaxRegistrars::get()))]333 pub fn add_registrar(334 origin: OriginFor<T>,335 account: AccountIdLookupOf<T>,336 ) -> DispatchResultWithPostInfo {337 T::RegistrarOrigin::ensure_origin(origin)?;338 let account = T::Lookup::lookup(account)?;339340 let (i, registrar_count) = <Registrars<T>>::try_mutate(341 |registrars| -> Result<(RegistrarIndex, usize), DispatchError> {342 registrars343 .try_push(Some(RegistrarInfo {344 account,345 fee: Zero::zero(),346 fields: Default::default(),347 }))348 .map_err(|_| Error::<T>::TooManyRegistrars)?;349 Ok(((registrars.len() - 1) as RegistrarIndex, registrars.len()))350 },351 )?;352353 Self::deposit_event(Event::RegistrarAdded { registrar_index: i });354355 Ok(Some(T::WeightInfo::add_registrar(registrar_count as u32)).into())356 }357358 /// Set an account's identity information and reserve the appropriate deposit.359 ///360 /// If the account already has identity information, the deposit is taken as part payment361 /// for the new deposit.362 ///363 /// The dispatch origin for this call must be _Signed_.364 ///365 /// - `info`: The identity information.366 ///367 /// Emits `IdentitySet` if successful.368 ///369 /// # <weight>370 /// - `O(X + X' + R)`371 /// - where `X` additional-field-count (deposit-bounded and code-bounded)372 /// - where `R` judgements-count (registrar-count-bounded)373 /// - One balance reserve operation.374 /// - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).375 /// - One event.376 /// # </weight>377 #[pallet::call_index(1)]378 #[pallet::weight( T::WeightInfo::set_identity(379 T::MaxRegistrars::get(), // R380 T::MaxAdditionalFields::get(), // X381 ))]382 pub fn set_identity(383 origin: OriginFor<T>,384 info: Box<IdentityInfo<T::MaxAdditionalFields>>,385 ) -> DispatchResultWithPostInfo {386 let sender = ensure_signed(origin)?;387 let extra_fields = info.additional.len() as u32;388 ensure!(389 extra_fields <= T::MaxAdditionalFields::get(),390 Error::<T>::TooManyFields391 );392 let fd = <BalanceOf<T>>::from(extra_fields) * T::FieldDeposit::get();393394 let mut id = match <IdentityOf<T>>::get(&sender) {395 Some(mut id) => {396 // Only keep non-positive judgements.397 id.judgements.retain(|j| j.1.is_sticky());398 id.info = *info;399 id400 }401 None => Registration {402 info: *info,403 judgements: BoundedVec::default(),404 deposit: Zero::zero(),405 },406 };407408 let old_deposit = id.deposit;409 id.deposit = T::BasicDeposit::get() + fd;410 if id.deposit > old_deposit {411 T::Currency::reserve(&sender, id.deposit - old_deposit)?;412 }413 if old_deposit > id.deposit {414 let err_amount = T::Currency::unreserve(&sender, old_deposit - id.deposit);415 debug_assert!(err_amount.is_zero());416 }417418 let judgements = id.judgements.len();419 <IdentityOf<T>>::insert(&sender, id);420 Self::deposit_event(Event::IdentitySet { who: sender });421422 Ok(Some(T::WeightInfo::set_identity(423 judgements as u32, // R424 extra_fields, // X425 ))426 .into())427 }428429 /// Set the sub-accounts of the sender.430 ///431 /// Payment: Any aggregate balance reserved by previous `set_subs` calls will be returned432 /// and an amount `SubAccountDeposit` will be reserved for each item in `subs`.433 ///434 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered435 /// identity.436 ///437 /// - `subs`: The identity's (new) sub-accounts.438 ///439 /// # <weight>440 /// - `O(P + S)`441 /// - where `P` old-subs-count (hard- and deposit-bounded).442 /// - where `S` subs-count (hard- and deposit-bounded).443 /// - At most one balance operations.444 /// - DB:445 /// - `P + S` storage mutations (codec complexity `O(1)`)446 /// - One storage read (codec complexity `O(P)`).447 /// - One storage write (codec complexity `O(S)`).448 /// - One storage-exists (`IdentityOf::contains_key`).449 /// # </weight>450 // TODO: This whole extrinsic screams "not optimized". For example we could451 // filter any overlap between new and old subs, and avoid reading/writing452 // to those values... We could also ideally avoid needing to write to453 // N storage items for N sub accounts. Right now the weight on this function454 // is a large overestimate due to the fact that it could potentially write455 // to 2 x T::MaxSubAccounts::get().456 #[pallet::call_index(2)]457 #[pallet::weight(T::WeightInfo::set_subs_old(T::MaxSubAccounts::get()) // P: Assume max sub accounts removed.458 .saturating_add(T::WeightInfo::set_subs_new(subs.len() as u32)) // S: Assume all subs are new.459 )]460 pub fn set_subs(461 origin: OriginFor<T>,462 subs: Vec<(T::AccountId, Data)>,463 ) -> DispatchResultWithPostInfo {464 let sender = ensure_signed(origin)?;465 ensure!(<IdentityOf<T>>::contains_key(&sender), Error::<T>::NotFound);466 ensure!(467 subs.len() <= T::MaxSubAccounts::get() as usize,468 Error::<T>::TooManySubAccounts469 );470471 let (old_deposit, old_ids) = <SubsOf<T>>::get(&sender);472 let new_deposit = T::SubAccountDeposit::get() * <BalanceOf<T>>::from(subs.len() as u32);473474 let not_other_sub = subs475 .iter()476 .filter_map(|i| SuperOf::<T>::get(&i.0))477 .all(|i| i.0 == sender);478 ensure!(not_other_sub, Error::<T>::AlreadyClaimed);479480 if old_deposit < new_deposit {481 T::Currency::reserve(&sender, new_deposit - old_deposit)?;482 } else if old_deposit > new_deposit {483 let err_amount = T::Currency::unreserve(&sender, old_deposit - new_deposit);484 debug_assert!(err_amount.is_zero());485 }486 // do nothing if they're equal.487488 for s in old_ids.iter() {489 <SuperOf<T>>::remove(s);490 }491 let mut ids = BoundedVec::<T::AccountId, T::MaxSubAccounts>::default();492 for (id, name) in subs {493 <SuperOf<T>>::insert(&id, (sender.clone(), name));494 ids.try_push(id)495 .expect("subs length is less than T::MaxSubAccounts; qed");496 }497 let new_subs = ids.len();498499 if ids.is_empty() {500 <SubsOf<T>>::remove(&sender);501 } else {502 <SubsOf<T>>::insert(&sender, (new_deposit, ids));503 }504505 Ok(Some(506 T::WeightInfo::set_subs_old(old_ids.len() as u32) // P: Real number of old accounts removed.507 // S: New subs added508 .saturating_add(T::WeightInfo::set_subs_new(new_subs as u32)),509 )510 .into())511 }512513 /// Clear an account's identity info and all sub-accounts and return all deposits.514 ///515 /// Payment: All reserved balances on the account are returned.516 ///517 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered518 /// identity.519 ///520 /// Emits `IdentityCleared` if successful.521 ///522 /// # <weight>523 /// - `O(R + S + X)`524 /// - where `R` registrar-count (governance-bounded).525 /// - where `S` subs-count (hard- and deposit-bounded).526 /// - where `X` additional-field-count (deposit-bounded and code-bounded).527 /// - One balance-unreserve operation.528 /// - `2` storage reads and `S + 2` storage deletions.529 /// - One event.530 /// # </weight>531 #[pallet::call_index(3)]532 #[pallet::weight(T::WeightInfo::clear_identity(533 T::MaxRegistrars::get(), // R534 T::MaxSubAccounts::get(), // S535 T::MaxAdditionalFields::get(), // X536 ))]537 pub fn clear_identity(origin: OriginFor<T>) -> DispatchResultWithPostInfo {538 let sender = ensure_signed(origin)?;539540 let (subs_deposit, sub_ids) = <SubsOf<T>>::take(&sender);541 let id = <IdentityOf<T>>::take(&sender).ok_or(Error::<T>::NotNamed)?;542 let deposit = id.total_deposit() + subs_deposit;543 for sub in sub_ids.iter() {544 <SuperOf<T>>::remove(sub);545 }546547 let err_amount = T::Currency::unreserve(&sender, deposit);548 debug_assert!(err_amount.is_zero());549550 Self::deposit_event(Event::IdentityCleared {551 who: sender,552 deposit,553 });554555 Ok(Some(T::WeightInfo::clear_identity(556 id.judgements.len() as u32, // R557 sub_ids.len() as u32, // S558 id.info.additional.len() as u32, // X559 ))560 .into())561 }562563 /// Request a judgement from a registrar.564 ///565 /// Payment: At most `max_fee` will be reserved for payment to the registrar if judgement566 /// given.567 ///568 /// The dispatch origin for this call must be _Signed_ and the sender must have a569 /// registered identity.570 ///571 /// - `reg_index`: The index of the registrar whose judgement is requested.572 /// - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as:573 ///574 /// ```nocompile575 /// Self::registrars().get(reg_index).unwrap().fee576 /// ```577 ///578 /// Emits `JudgementRequested` if successful.579 ///580 /// # <weight>581 /// - `O(R + X)`.582 /// - One balance-reserve operation.583 /// - Storage: 1 read `O(R)`, 1 mutate `O(X + R)`.584 /// - One event.585 /// # </weight>586 #[pallet::call_index(4)]587 #[pallet::weight(T::WeightInfo::request_judgement(588 T::MaxRegistrars::get(), // R589 T::MaxAdditionalFields::get(), // X590 ))]591 pub fn request_judgement(592 origin: OriginFor<T>,593 #[pallet::compact] reg_index: RegistrarIndex,594 #[pallet::compact] max_fee: BalanceOf<T>,595 ) -> DispatchResultWithPostInfo {596 let sender = ensure_signed(origin)?;597 let registrars = <Registrars<T>>::get();598 let registrar = registrars599 .get(reg_index as usize)600 .and_then(Option::as_ref)601 .ok_or(Error::<T>::EmptyIndex)?;602 ensure!(max_fee >= registrar.fee, Error::<T>::FeeChanged);603 let mut id = <IdentityOf<T>>::get(&sender).ok_or(Error::<T>::NoIdentity)?;604605 let item = (reg_index, Judgement::FeePaid(registrar.fee));606 match id.judgements.binary_search_by_key(®_index, |x| x.0) {607 Ok(i) => {608 if id.judgements[i].1.is_sticky() {609 return Err(Error::<T>::StickyJudgement.into());610 } else {611 id.judgements[i] = item612 }613 }614 Err(i) => id615 .judgements616 .try_insert(i, item)617 .map_err(|_| Error::<T>::TooManyRegistrars)?,618 }619620 T::Currency::reserve(&sender, registrar.fee)?;621622 let judgements = id.judgements.len();623 let extra_fields = id.info.additional.len();624 <IdentityOf<T>>::insert(&sender, id);625626 Self::deposit_event(Event::JudgementRequested {627 who: sender,628 registrar_index: reg_index,629 });630631 Ok(Some(T::WeightInfo::request_judgement(632 judgements as u32,633 extra_fields as u32,634 ))635 .into())636 }637638 /// Cancel a previous request.639 ///640 /// Payment: A previously reserved deposit is returned on success.641 ///642 /// The dispatch origin for this call must be _Signed_ and the sender must have a643 /// registered identity.644 ///645 /// - `reg_index`: The index of the registrar whose judgement is no longer requested.646 ///647 /// Emits `JudgementUnrequested` if successful.648 ///649 /// # <weight>650 /// - `O(R + X)`.651 /// - One balance-reserve operation.652 /// - One storage mutation `O(R + X)`.653 /// - One event654 /// # </weight>655 #[pallet::call_index(5)]656 #[pallet::weight(T::WeightInfo::cancel_request(657 T::MaxRegistrars::get(), // R658 T::MaxAdditionalFields::get(), // X659 ))]660 pub fn cancel_request(661 origin: OriginFor<T>,662 reg_index: RegistrarIndex,663 ) -> DispatchResultWithPostInfo {664 let sender = ensure_signed(origin)?;665 let mut id = <IdentityOf<T>>::get(&sender).ok_or(Error::<T>::NoIdentity)?;666667 let pos = id668 .judgements669 .binary_search_by_key(®_index, |x| x.0)670 .map_err(|_| Error::<T>::NotFound)?;671 let fee = if let Judgement::FeePaid(fee) = id.judgements.remove(pos).1 {672 fee673 } else {674 return Err(Error::<T>::JudgementGiven.into());675 };676677 let err_amount = T::Currency::unreserve(&sender, fee);678 debug_assert!(err_amount.is_zero());679 let judgements = id.judgements.len();680 let extra_fields = id.info.additional.len();681 <IdentityOf<T>>::insert(&sender, id);682683 Self::deposit_event(Event::JudgementUnrequested {684 who: sender,685 registrar_index: reg_index,686 });687688 Ok(Some(T::WeightInfo::cancel_request(689 judgements as u32,690 extra_fields as u32,691 ))692 .into())693 }694695 /// Set the fee required for a judgement to be requested from a registrar.696 ///697 /// The dispatch origin for this call must be _Signed_ and the sender must be the account698 /// of the registrar whose index is `index`.699 ///700 /// - `index`: the index of the registrar whose fee is to be set.701 /// - `fee`: the new fee.702 ///703 /// # <weight>704 /// - `O(R)`.705 /// - One storage mutation `O(R)`.706 /// - Benchmark: 7.315 + R * 0.329 µs (min squares analysis)707 /// # </weight>708 #[pallet::call_index(6)]709 #[pallet::weight(T::WeightInfo::set_fee(T::MaxRegistrars::get()))] // R710 pub fn set_fee(711 origin: OriginFor<T>,712 #[pallet::compact] index: RegistrarIndex,713 #[pallet::compact] fee: BalanceOf<T>,714 ) -> DispatchResultWithPostInfo {715 let who = ensure_signed(origin)?;716717 let registrars = <Registrars<T>>::mutate(|rs| -> Result<usize, DispatchError> {718 rs.get_mut(index as usize)719 .and_then(|x| x.as_mut())720 .and_then(|r| {721 if r.account == who {722 r.fee = fee;723 Some(())724 } else {725 None726 }727 })728 .ok_or_else(|| DispatchError::from(Error::<T>::InvalidIndex))?;729 Ok(rs.len())730 })?;731 Ok(Some(T::WeightInfo::set_fee(registrars as u32)).into()) // R732 }733734 /// Change the account associated with a registrar.735 ///736 /// The dispatch origin for this call must be _Signed_ and the sender must be the account737 /// of the registrar whose index is `index`.738 ///739 /// - `index`: the index of the registrar whose fee is to be set.740 /// - `new`: the new account ID.741 ///742 /// # <weight>743 /// - `O(R)`.744 /// - One storage mutation `O(R)`.745 /// - Benchmark: 8.823 + R * 0.32 µs (min squares analysis)746 /// # </weight>747 #[pallet::call_index(7)]748 #[pallet::weight(T::WeightInfo::set_account_id(T::MaxRegistrars::get()))] // R749 pub fn set_account_id(750 origin: OriginFor<T>,751 #[pallet::compact] index: RegistrarIndex,752 new: AccountIdLookupOf<T>,753 ) -> DispatchResultWithPostInfo {754 let who = ensure_signed(origin)?;755 let new = T::Lookup::lookup(new)?;756757 let registrars = <Registrars<T>>::mutate(|rs| -> Result<usize, DispatchError> {758 rs.get_mut(index as usize)759 .and_then(|x| x.as_mut())760 .and_then(|r| {761 if r.account == who {762 r.account = new;763 Some(())764 } else {765 None766 }767 })768 .ok_or_else(|| DispatchError::from(Error::<T>::InvalidIndex))?;769 Ok(rs.len())770 })?;771 Ok(Some(T::WeightInfo::set_account_id(registrars as u32)).into()) // R772 }773774 /// Set the field information for a registrar.775 ///776 /// The dispatch origin for this call must be _Signed_ and the sender must be the account777 /// of the registrar whose index is `index`.778 ///779 /// - `index`: the index of the registrar whose fee is to be set.780 /// - `fields`: the fields that the registrar concerns themselves with.781 ///782 /// # <weight>783 /// - `O(R)`.784 /// - One storage mutation `O(R)`.785 /// - Benchmark: 7.464 + R * 0.325 µs (min squares analysis)786 /// # </weight>787 #[pallet::call_index(8)]788 #[pallet::weight(T::WeightInfo::set_fields(T::MaxRegistrars::get()))] // R789 pub fn set_fields(790 origin: OriginFor<T>,791 #[pallet::compact] index: RegistrarIndex,792 fields: IdentityFields,793 ) -> DispatchResultWithPostInfo {794 let who = ensure_signed(origin)?;795796 let registrars = <Registrars<T>>::mutate(|rs| -> Result<usize, DispatchError> {797 rs.get_mut(index as usize)798 .and_then(|x| x.as_mut())799 .and_then(|r| {800 if r.account == who {801 r.fields = fields;802 Some(())803 } else {804 None805 }806 })807 .ok_or_else(|| DispatchError::from(Error::<T>::InvalidIndex))?;808 Ok(rs.len())809 })?;810 Ok(Some(T::WeightInfo::set_fields(811 registrars as u32, // R812 ))813 .into())814 }815816 /// Provide a judgement for an account's identity.817 ///818 /// The dispatch origin for this call must be _Signed_ and the sender must be the account819 /// of the registrar whose index is `reg_index`.820 ///821 /// - `reg_index`: the index of the registrar whose judgement is being made.822 /// - `target`: the account whose identity the judgement is upon. This must be an account823 /// with a registered identity.824 /// - `judgement`: the judgement of the registrar of index `reg_index` about `target`.825 /// - `identity`: The hash of the [`IdentityInfo`] for that the judgement is provided.826 ///827 /// Emits `JudgementGiven` if successful.828 ///829 /// # <weight>830 /// - `O(R + X)`.831 /// - One balance-transfer operation.832 /// - Up to one account-lookup operation.833 /// - Storage: 1 read `O(R)`, 1 mutate `O(R + X)`.834 /// - One event.835 /// # </weight>836 #[pallet::call_index(9)]837 #[pallet::weight(T::WeightInfo::provide_judgement(838 T::MaxRegistrars::get(), // R839 T::MaxAdditionalFields::get(), // X840 ))]841 pub fn provide_judgement(842 origin: OriginFor<T>,843 #[pallet::compact] reg_index: RegistrarIndex,844 target: AccountIdLookupOf<T>,845 judgement: Judgement<BalanceOf<T>>,846 identity: T::Hash,847 ) -> DispatchResultWithPostInfo {848 let sender = ensure_signed(origin)?;849 let target = T::Lookup::lookup(target)?;850 ensure!(!judgement.has_deposit(), Error::<T>::InvalidJudgement);851 <Registrars<T>>::get()852 .get(reg_index as usize)853 .and_then(Option::as_ref)854 .filter(|r| r.account == sender)855 .ok_or(Error::<T>::InvalidIndex)?;856 let mut id = <IdentityOf<T>>::get(&target).ok_or(Error::<T>::InvalidTarget)?;857858 if T::Hashing::hash_of(&id.info) != identity {859 return Err(Error::<T>::JudgementForDifferentIdentity.into());860 }861862 let item = (reg_index, judgement);863 match id.judgements.binary_search_by_key(®_index, |x| x.0) {864 Ok(position) => {865 if let Judgement::FeePaid(fee) = id.judgements[position].1 {866 T::Currency::repatriate_reserved(867 &target,868 &sender,869 fee,870 BalanceStatus::Free,871 )872 .map_err(|_| Error::<T>::JudgementPaymentFailed)?;873 }874 id.judgements[position] = item875 }876 Err(position) => id877 .judgements878 .try_insert(position, item)879 .map_err(|_| Error::<T>::TooManyRegistrars)?,880 }881882 let judgements = id.judgements.len();883 let extra_fields = id.info.additional.len();884 <IdentityOf<T>>::insert(&target, id);885 Self::deposit_event(Event::JudgementGiven {886 target,887 registrar_index: reg_index,888 });889890 Ok(Some(T::WeightInfo::provide_judgement(891 judgements as u32,892 extra_fields as u32,893 ))894 .into())895 }896897 /// Remove an account's identity and sub-account information and slash the deposits.898 ///899 /// Payment: Reserved balances from `set_subs` and `set_identity` are slashed and handled by900 /// `Slash`. Verification request deposits are not returned; they should be cancelled901 /// manually using `cancel_request`.902 ///903 /// The dispatch origin for this call must match `T::ForceOrigin`.904 ///905 /// - `target`: the account whose identity the judgement is upon. This must be an account906 /// with a registered identity.907 ///908 /// Emits `IdentityKilled` if successful.909 ///910 /// # <weight>911 /// - `O(R + S + X)`.912 /// - One balance-reserve operation.913 /// - `S + 2` storage mutations.914 /// - One event.915 /// # </weight>916 #[pallet::call_index(10)]917 #[pallet::weight(T::WeightInfo::kill_identity(918 T::MaxRegistrars::get(), // R919 T::MaxSubAccounts::get(), // S920 T::MaxAdditionalFields::get(), // X921 ))]922 pub fn kill_identity(923 origin: OriginFor<T>,924 target: AccountIdLookupOf<T>,925 ) -> DispatchResultWithPostInfo {926 T::ForceOrigin::ensure_origin(origin)?;927928 // Figure out who we're meant to be clearing.929 let target = T::Lookup::lookup(target)?;930 // Grab their deposit (and check that they have one).931 let (subs_deposit, sub_ids) = <SubsOf<T>>::take(&target);932 let id = <IdentityOf<T>>::take(&target).ok_or(Error::<T>::NotNamed)?;933 let deposit = id.total_deposit() + subs_deposit;934 for sub in sub_ids.iter() {935 <SuperOf<T>>::remove(sub);936 }937 // Slash their deposit from them.938 T::Slashed::on_unbalanced(T::Currency::slash_reserved(&target, deposit).0);939940 Self::deposit_event(Event::IdentityKilled {941 who: target,942 deposit,943 });944945 Ok(Some(T::WeightInfo::kill_identity(946 id.judgements.len() as u32, // R947 sub_ids.len() as u32, // S948 id.info.additional.len() as u32, // X949 ))950 .into())951 }952953 /// Add the given account to the sender's subs.954 ///955 /// Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated956 /// to the sender.957 ///958 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered959 /// sub identity of `sub`.960 #[pallet::call_index(11)]961 #[pallet::weight(T::WeightInfo::add_sub(T::MaxSubAccounts::get()))]962 pub fn add_sub(963 origin: OriginFor<T>,964 sub: AccountIdLookupOf<T>,965 data: Data,966 ) -> DispatchResult {967 let sender = ensure_signed(origin)?;968 let sub = T::Lookup::lookup(sub)?;969 ensure!(970 IdentityOf::<T>::contains_key(&sender),971 Error::<T>::NoIdentity972 );973974 // Check if it's already claimed as sub-identity.975 ensure!(976 !SuperOf::<T>::contains_key(&sub),977 Error::<T>::AlreadyClaimed978 );979980 SubsOf::<T>::try_mutate(&sender, |(ref mut subs_deposit, ref mut sub_ids)| {981 // Ensure there is space and that the deposit is paid.982 ensure!(983 sub_ids.len() < T::MaxSubAccounts::get() as usize,984 Error::<T>::TooManySubAccounts985 );986 let deposit = T::SubAccountDeposit::get();987 T::Currency::reserve(&sender, deposit)?;988989 SuperOf::<T>::insert(&sub, (sender.clone(), data));990 sub_ids991 .try_push(sub.clone())992 .expect("sub ids length checked above; qed");993 *subs_deposit = subs_deposit.saturating_add(deposit);994995 Self::deposit_event(Event::SubIdentityAdded {996 sub,997 main: sender.clone(),998 deposit,999 });1000 Ok(())1001 })1002 }10031004 /// Alter the associated name of the given sub-account.1005 ///1006 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered1007 /// sub identity of `sub`.1008 #[pallet::call_index(12)]1009 #[pallet::weight(T::WeightInfo::rename_sub(T::MaxSubAccounts::get()))]1010 pub fn rename_sub(1011 origin: OriginFor<T>,1012 sub: AccountIdLookupOf<T>,1013 data: Data,1014 ) -> DispatchResult {1015 let sender = ensure_signed(origin)?;1016 let sub = T::Lookup::lookup(sub)?;1017 ensure!(1018 IdentityOf::<T>::contains_key(&sender),1019 Error::<T>::NoIdentity1020 );1021 ensure!(1022 SuperOf::<T>::get(&sub).map_or(false, |x| x.0 == sender),1023 Error::<T>::NotOwned1024 );1025 SuperOf::<T>::insert(&sub, (sender, data));1026 Ok(())1027 }10281029 /// Remove the given account from the sender's subs.1030 ///1031 /// Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated1032 /// to the sender.1033 ///1034 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered1035 /// sub identity of `sub`.1036 #[pallet::call_index(13)]1037 #[pallet::weight(T::WeightInfo::remove_sub(T::MaxSubAccounts::get()))]1038 pub fn remove_sub(origin: OriginFor<T>, sub: AccountIdLookupOf<T>) -> DispatchResult {1039 let sender = ensure_signed(origin)?;1040 ensure!(1041 IdentityOf::<T>::contains_key(&sender),1042 Error::<T>::NoIdentity1043 );1044 let sub = T::Lookup::lookup(sub)?;1045 let (sup, _) = SuperOf::<T>::get(&sub).ok_or(Error::<T>::NotSub)?;1046 ensure!(sup == sender, Error::<T>::NotOwned);1047 SuperOf::<T>::remove(&sub);1048 SubsOf::<T>::mutate(&sup, |(ref mut subs_deposit, ref mut sub_ids)| {1049 sub_ids.retain(|x| x != &sub);1050 let deposit = T::SubAccountDeposit::get().min(*subs_deposit);1051 *subs_deposit -= deposit;1052 let err_amount = T::Currency::unreserve(&sender, deposit);1053 debug_assert!(err_amount.is_zero());1054 Self::deposit_event(Event::SubIdentityRemoved {1055 sub,1056 main: sender,1057 deposit,1058 });1059 });1060 Ok(())1061 }10621063 /// Remove the sender as a sub-account.1064 ///1065 /// Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated1066 /// to the sender (*not* the original depositor).1067 ///1068 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered1069 /// super-identity.1070 ///1071 /// NOTE: This should not normally be used, but is provided in the case that the non-1072 /// controller of an account is maliciously registered as a sub-account.1073 #[pallet::call_index(14)]1074 #[pallet::weight(T::WeightInfo::quit_sub(T::MaxSubAccounts::get()))]1075 pub fn quit_sub(origin: OriginFor<T>) -> DispatchResult {1076 let sender = ensure_signed(origin)?;1077 let (sup, _) = SuperOf::<T>::take(&sender).ok_or(Error::<T>::NotSub)?;1078 SubsOf::<T>::mutate(&sup, |(ref mut subs_deposit, ref mut sub_ids)| {1079 sub_ids.retain(|x| x != &sender);1080 let deposit = T::SubAccountDeposit::get().min(*subs_deposit);1081 *subs_deposit -= deposit;1082 let _ =1083 T::Currency::repatriate_reserved(&sup, &sender, deposit, BalanceStatus::Free);1084 Self::deposit_event(Event::SubIdentityRevoked {1085 sub: sender,1086 main: sup.clone(),1087 deposit,1088 });1089 });1090 Ok(())1091 }1092 }1093}10941095impl<T: Config> Pallet<T> {1096 /// Get the subs of an account.1097 pub fn subs(who: &T::AccountId) -> Vec<(T::AccountId, Data)> {1098 SubsOf::<T>::get(who)1099 .11100 .into_iter()1101 .filter_map(|a| SuperOf::<T>::get(&a).map(|x| (a, x.1)))1102 .collect()1103 }11041105 /// Check if the account has corresponding identity information by the identity field.1106 pub fn has_identity(who: &T::AccountId, fields: u64) -> bool {1107 IdentityOf::<T>::get(who).map_or(false, |registration| {1108 (registration.info.fields().0.bits() & fields) == fields1109 })1110 }1111}1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license:18// This file is part of Substrate.1920// Copyright (C) 2019-2022 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435//! # Identity Pallet36//!37//! - [`Config`]38//! - [`Call`]39//!40//! ## Overview41//!42//! A federated naming system, allowing for multiple registrars to be added from a specified origin.43//! Registrars can set a fee to provide identity-verification service. Anyone can put forth a44//! proposed identity for a fixed deposit and ask for review by any number of registrars (paying45//! each of their fees). Registrar judgements are given as an `enum`, allowing for sophisticated,46//! multi-tier opinions.47//!48//! Some judgements are identified as *sticky*, which means they cannot be removed except by49//! complete removal of the identity, or by the registrar. Judgements are allowed to represent a50//! portion of funds that have been reserved for the registrar.51//!52//! A super-user can remove accounts and in doing so, slash the deposit.53//!54//! All accounts may also have a limited number of sub-accounts which may be specified by the owner;55//! by definition, these have equivalent ownership and each has an individual name.56//!57//! The number of registrars should be limited, and the deposit made sufficiently large, to ensure58//! no state-bloat attack is viable.59//!60//! ## Interface61//!62//! ### Dispatchable Functions63//!64//! #### For general users65//! * `set_identity` - Set the associated identity of an account; a small deposit is reserved if not66//! already taken.67//! * `clear_identity` - Remove an account's associated identity; the deposit is returned.68//! * `request_judgement` - Request a judgement from a registrar, paying a fee.69//! * `cancel_request` - Cancel the previous request for a judgement.70//!71//! #### For general users with sub-identities72//! * `set_subs` - Set the sub-accounts of an identity.73//! * `add_sub` - Add a sub-identity to an identity.74//! * `remove_sub` - Remove a sub-identity of an identity.75//! * `rename_sub` - Rename a sub-identity of an identity.76//! * `quit_sub` - Remove a sub-identity of an identity (called by the sub-identity).77//!78//! #### For registrars79//! * `set_fee` - Set the fee required to be paid for a judgement to be given by the registrar.80//! * `set_fields` - Set the fields that a registrar cares about in their judgements.81//! * `provide_judgement` - Provide a judgement to an identity.82//!83//! #### For super-users84//! * `add_registrar` - Add a new registrar to the system.85//! * `kill_identity` - Forcibly remove the associated identity; the deposit is lost.86//!87//! [`Call`]: ./enum.Call.html88//! [`Config`]: ./trait.Config.html8990#![cfg_attr(not(feature = "std"), no_std)]9192mod benchmarking;93#[cfg(test)]94mod tests;95mod types;96pub mod weights;9798use frame_support::traits::{BalanceStatus, Currency, OnUnbalanced, ReservableCurrency};99use sp_runtime::traits::{AppendZerosInput, Hash, Saturating, StaticLookup, Zero};100use sp_std::prelude::*;101pub use weights::WeightInfo;102103pub use pallet::*;104pub use types::{105 Data, IdentityField, IdentityFields, IdentityInfo, Judgement, RegistrarIndex, RegistrarInfo,106 Registration,107};108109pub type BalanceOf<T> =110 <<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;111type NegativeImbalanceOf<T> = <<T as Config>::Currency as Currency<112 <T as frame_system::Config>::AccountId,113>>::NegativeImbalance;114type AccountIdLookupOf<T> = <<T as frame_system::Config>::Lookup as StaticLookup>::Source;115116#[frame_support::pallet]117pub mod pallet {118 use super::*;119 use frame_support::pallet_prelude::*;120 use frame_system::pallet_prelude::*;121122 #[pallet::config]123 pub trait Config: frame_system::Config {124 /// The overarching event type.125 type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;126127 /// The currency trait.128 type Currency: ReservableCurrency<Self::AccountId>;129130 /// The amount held on deposit for a registered identity131 #[pallet::constant]132 type BasicDeposit: Get<BalanceOf<Self>>;133134 /// The amount held on deposit per additional field for a registered identity.135 #[pallet::constant]136 type FieldDeposit: Get<BalanceOf<Self>>;137138 /// The amount held on deposit for a registered subaccount. This should account for the fact139 /// that one storage item's value will increase by the size of an account ID, and there will140 /// be another trie item whose value is the size of an account ID plus 32 bytes.141 #[pallet::constant]142 type SubAccountDeposit: Get<BalanceOf<Self>>;143144 /// The maximum number of sub-accounts allowed per identified account.145 #[pallet::constant]146 type MaxSubAccounts: Get<u32>;147148 /// Maximum number of additional fields that may be stored in an ID. Needed to bound the I/O149 /// required to access an identity, but can be pretty high.150 #[pallet::constant]151 type MaxAdditionalFields: Get<u32>;152153 /// Maxmimum number of registrars allowed in the system. Needed to bound the complexity154 /// of, e.g., updating judgements.155 #[pallet::constant]156 type MaxRegistrars: Get<u32>;157158 /// What to do with slashed funds.159 type Slashed: OnUnbalanced<NegativeImbalanceOf<Self>>;160161 /// The origin which may forcibly set or remove a name. Root can always do this.162 type ForceOrigin: EnsureOrigin<Self::RuntimeOrigin>;163164 /// The origin which may add or remove registrars. Root can always do this.165 type RegistrarOrigin: EnsureOrigin<Self::RuntimeOrigin>;166167 /// Weight information for extrinsics in this pallet.168 type WeightInfo: WeightInfo;169 }170171 #[pallet::pallet]172 #[pallet::generate_store(pub(super) trait Store)]173 pub struct Pallet<T>(_);174175 /// Information that is pertinent to identify the entity behind an account.176 ///177 /// TWOX-NOTE: OK ― `AccountId` is a secure hash.178 #[pallet::storage]179 #[pallet::getter(fn identity)]180 pub type IdentityOf<T: Config> = StorageMap<181 _,182 Twox64Concat,183 T::AccountId,184 Registration<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields>,185 OptionQuery,186 >;187188 /// The super-identity of an alternative "sub" identity together with its name, within that189 /// context. If the account is not some other account's sub-identity, then just `None`.190 #[pallet::storage]191 #[pallet::getter(fn super_of)]192 pub(super) type SuperOf<T: Config> =193 StorageMap<_, Blake2_128Concat, T::AccountId, (T::AccountId, Data), OptionQuery>;194195 /// Alternative "sub" identities of this account.196 ///197 /// The first item is the deposit, the second is a vector of the accounts.198 ///199 /// TWOX-NOTE: OK ― `AccountId` is a secure hash.200 #[pallet::storage]201 #[pallet::getter(fn subs_of)]202 pub(super) type SubsOf<T: Config> = StorageMap<203 _,204 Twox64Concat,205 T::AccountId,206 (BalanceOf<T>, BoundedVec<T::AccountId, T::MaxSubAccounts>),207 ValueQuery,208 >;209210 /// The set of registrars. Not expected to get very big as can only be added through a211 /// special origin (likely a council motion).212 ///213 /// The index into this can be cast to `RegistrarIndex` to get a valid value.214 #[pallet::storage]215 #[pallet::getter(fn registrars)]216 pub(super) type Registrars<T: Config> = StorageValue<217 _,218 BoundedVec<Option<RegistrarInfo<BalanceOf<T>, T::AccountId>>, T::MaxRegistrars>,219 ValueQuery,220 >;221222 #[pallet::error]223 pub enum Error<T> {224 /// Too many subs-accounts.225 TooManySubAccounts,226 /// Account isn't found.227 NotFound,228 /// Account isn't named.229 NotNamed,230 /// Empty index.231 EmptyIndex,232 /// Fee is changed.233 FeeChanged,234 /// No identity found.235 NoIdentity,236 /// Sticky judgement.237 StickyJudgement,238 /// Judgement given.239 JudgementGiven,240 /// Invalid judgement.241 InvalidJudgement,242 /// The index is invalid.243 InvalidIndex,244 /// The target is invalid.245 InvalidTarget,246 /// Too many additional fields.247 TooManyFields,248 /// Maximum amount of registrars reached. Cannot add any more.249 TooManyRegistrars,250 /// Account ID is already named.251 AlreadyClaimed,252 /// Sender is not a sub-account.253 NotSub,254 /// Sub-account isn't owned by sender.255 NotOwned,256 /// The provided judgement was for a different identity.257 JudgementForDifferentIdentity,258 /// Error that occurs when there is an issue paying for judgement.259 JudgementPaymentFailed,260 }261262 #[pallet::event]263 #[pallet::generate_deposit(pub(super) fn deposit_event)]264 pub enum Event<T: Config> {265 /// A name was set or reset (which will remove all judgements).266 IdentitySet { who: T::AccountId },267 /// A name was cleared, and the given balance returned.268 IdentityCleared {269 who: T::AccountId,270 deposit: BalanceOf<T>,271 },272 /// A name was removed and the given balance slashed.273 IdentityKilled {274 who: T::AccountId,275 deposit: BalanceOf<T>,276 },277 /// A judgement was asked from a registrar.278 JudgementRequested {279 who: T::AccountId,280 registrar_index: RegistrarIndex,281 },282 /// A judgement request was retracted.283 JudgementUnrequested {284 who: T::AccountId,285 registrar_index: RegistrarIndex,286 },287 /// A judgement was given by a registrar.288 JudgementGiven {289 target: T::AccountId,290 registrar_index: RegistrarIndex,291 },292 /// A registrar was added.293 RegistrarAdded { registrar_index: RegistrarIndex },294 /// A sub-identity was added to an identity and the deposit paid.295 SubIdentityAdded {296 sub: T::AccountId,297 main: T::AccountId,298 deposit: BalanceOf<T>,299 },300 /// A sub-identity was removed from an identity and the deposit freed.301 SubIdentityRemoved {302 sub: T::AccountId,303 main: T::AccountId,304 deposit: BalanceOf<T>,305 },306 /// A sub-identity was cleared, and the given deposit repatriated from the307 /// main identity account to the sub-identity account.308 SubIdentityRevoked {309 sub: T::AccountId,310 main: T::AccountId,311 deposit: BalanceOf<T>,312 },313 }314315 #[pallet::call]316 /// Identity pallet declaration.317 impl<T: Config> Pallet<T> {318 /// Add a registrar to the system.319 ///320 /// The dispatch origin for this call must be `T::RegistrarOrigin`.321 ///322 /// - `account`: the account of the registrar.323 ///324 /// Emits `RegistrarAdded` if successful.325 ///326 /// # <weight>327 /// - `O(R)` where `R` registrar-count (governance-bounded and code-bounded).328 /// - One storage mutation (codec `O(R)`).329 /// - One event.330 /// # </weight>331 #[pallet::call_index(0)]332 #[pallet::weight(T::WeightInfo::add_registrar(T::MaxRegistrars::get()))]333 pub fn add_registrar(334 origin: OriginFor<T>,335 account: AccountIdLookupOf<T>,336 ) -> DispatchResultWithPostInfo {337 T::RegistrarOrigin::ensure_origin(origin)?;338 let account = T::Lookup::lookup(account)?;339340 let (i, registrar_count) = <Registrars<T>>::try_mutate(341 |registrars| -> Result<(RegistrarIndex, usize), DispatchError> {342 registrars343 .try_push(Some(RegistrarInfo {344 account,345 fee: Zero::zero(),346 fields: Default::default(),347 }))348 .map_err(|_| Error::<T>::TooManyRegistrars)?;349 Ok(((registrars.len() - 1) as RegistrarIndex, registrars.len()))350 },351 )?;352353 Self::deposit_event(Event::RegistrarAdded { registrar_index: i });354355 Ok(Some(T::WeightInfo::add_registrar(registrar_count as u32)).into())356 }357358 /// Set an account's identity information and reserve the appropriate deposit.359 ///360 /// If the account already has identity information, the deposit is taken as part payment361 /// for the new deposit.362 ///363 /// The dispatch origin for this call must be _Signed_.364 ///365 /// - `info`: The identity information.366 ///367 /// Emits `IdentitySet` if successful.368 ///369 /// # <weight>370 /// - `O(X + X' + R)`371 /// - where `X` additional-field-count (deposit-bounded and code-bounded)372 /// - where `R` judgements-count (registrar-count-bounded)373 /// - One balance reserve operation.374 /// - One storage mutation (codec-read `O(X' + R)`, codec-write `O(X + R)`).375 /// - One event.376 /// # </weight>377 #[pallet::call_index(1)]378 #[pallet::weight( T::WeightInfo::set_identity(379 T::MaxRegistrars::get(), // R380 T::MaxAdditionalFields::get(), // X381 ))]382 pub fn set_identity(383 origin: OriginFor<T>,384 info: Box<IdentityInfo<T::MaxAdditionalFields>>,385 ) -> DispatchResultWithPostInfo {386 let sender = ensure_signed(origin)?;387 let extra_fields = info.additional.len() as u32;388 ensure!(389 extra_fields <= T::MaxAdditionalFields::get(),390 Error::<T>::TooManyFields391 );392 let fd = <BalanceOf<T>>::from(extra_fields) * T::FieldDeposit::get();393394 let mut id = match <IdentityOf<T>>::get(&sender) {395 Some(mut id) => {396 // Only keep non-positive judgements.397 id.judgements.retain(|j| j.1.is_sticky());398 id.info = *info;399 id400 }401 None => Registration {402 info: *info,403 judgements: BoundedVec::default(),404 deposit: Zero::zero(),405 },406 };407408 let old_deposit = id.deposit;409 id.deposit = T::BasicDeposit::get() + fd;410 if id.deposit > old_deposit {411 T::Currency::reserve(&sender, id.deposit - old_deposit)?;412 }413 if old_deposit > id.deposit {414 let err_amount = T::Currency::unreserve(&sender, old_deposit - id.deposit);415 debug_assert!(err_amount.is_zero());416 }417418 let judgements = id.judgements.len();419 <IdentityOf<T>>::insert(&sender, id);420 Self::deposit_event(Event::IdentitySet { who: sender });421422 Ok(Some(T::WeightInfo::set_identity(423 judgements as u32, // R424 extra_fields, // X425 ))426 .into())427 }428429 /// Set the sub-accounts of the sender.430 ///431 /// Payment: Any aggregate balance reserved by previous `set_subs` calls will be returned432 /// and an amount `SubAccountDeposit` will be reserved for each item in `subs`.433 ///434 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered435 /// identity.436 ///437 /// - `subs`: The identity's (new) sub-accounts.438 ///439 /// # <weight>440 /// - `O(P + S)`441 /// - where `P` old-subs-count (hard- and deposit-bounded).442 /// - where `S` subs-count (hard- and deposit-bounded).443 /// - At most one balance operations.444 /// - DB:445 /// - `P + S` storage mutations (codec complexity `O(1)`)446 /// - One storage read (codec complexity `O(P)`).447 /// - One storage write (codec complexity `O(S)`).448 /// - One storage-exists (`IdentityOf::contains_key`).449 /// # </weight>450 // TODO: This whole extrinsic screams "not optimized". For example we could451 // filter any overlap between new and old subs, and avoid reading/writing452 // to those values... We could also ideally avoid needing to write to453 // N storage items for N sub accounts. Right now the weight on this function454 // is a large overestimate due to the fact that it could potentially write455 // to 2 x T::MaxSubAccounts::get().456 #[pallet::call_index(2)]457 #[pallet::weight(T::WeightInfo::set_subs_old(T::MaxSubAccounts::get()) // P: Assume max sub accounts removed.458 .saturating_add(T::WeightInfo::set_subs_new(subs.len() as u32)) // S: Assume all subs are new.459 )]460 pub fn set_subs(461 origin: OriginFor<T>,462 subs: Vec<(T::AccountId, Data)>,463 ) -> DispatchResultWithPostInfo {464 let sender = ensure_signed(origin)?;465 ensure!(<IdentityOf<T>>::contains_key(&sender), Error::<T>::NotFound);466 ensure!(467 subs.len() <= T::MaxSubAccounts::get() as usize,468 Error::<T>::TooManySubAccounts469 );470471 let (old_deposit, old_ids) = <SubsOf<T>>::get(&sender);472 let new_deposit = T::SubAccountDeposit::get() * <BalanceOf<T>>::from(subs.len() as u32);473474 let not_other_sub = subs475 .iter()476 .filter_map(|i| SuperOf::<T>::get(&i.0))477 .all(|i| i.0 == sender);478 ensure!(not_other_sub, Error::<T>::AlreadyClaimed);479480 if old_deposit < new_deposit {481 T::Currency::reserve(&sender, new_deposit - old_deposit)?;482 } else if old_deposit > new_deposit {483 let err_amount = T::Currency::unreserve(&sender, old_deposit - new_deposit);484 debug_assert!(err_amount.is_zero());485 }486 // do nothing if they're equal.487488 for s in old_ids.iter() {489 <SuperOf<T>>::remove(s);490 }491 let mut ids = BoundedVec::<T::AccountId, T::MaxSubAccounts>::default();492 for (id, name) in subs {493 <SuperOf<T>>::insert(&id, (sender.clone(), name));494 ids.try_push(id)495 .expect("subs length is less than T::MaxSubAccounts; qed");496 }497 let new_subs = ids.len();498499 if ids.is_empty() {500 <SubsOf<T>>::remove(&sender);501 } else {502 <SubsOf<T>>::insert(&sender, (new_deposit, ids));503 }504505 Ok(Some(506 T::WeightInfo::set_subs_old(old_ids.len() as u32) // P: Real number of old accounts removed.507 // S: New subs added508 .saturating_add(T::WeightInfo::set_subs_new(new_subs as u32)),509 )510 .into())511 }512513 /// Clear an account's identity info and all sub-accounts and return all deposits.514 ///515 /// Payment: All reserved balances on the account are returned.516 ///517 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered518 /// identity.519 ///520 /// Emits `IdentityCleared` if successful.521 ///522 /// # <weight>523 /// - `O(R + S + X)`524 /// - where `R` registrar-count (governance-bounded).525 /// - where `S` subs-count (hard- and deposit-bounded).526 /// - where `X` additional-field-count (deposit-bounded and code-bounded).527 /// - One balance-unreserve operation.528 /// - `2` storage reads and `S + 2` storage deletions.529 /// - One event.530 /// # </weight>531 #[pallet::call_index(3)]532 #[pallet::weight(T::WeightInfo::clear_identity(533 T::MaxRegistrars::get(), // R534 T::MaxSubAccounts::get(), // S535 T::MaxAdditionalFields::get(), // X536 ))]537 pub fn clear_identity(origin: OriginFor<T>) -> DispatchResultWithPostInfo {538 let sender = ensure_signed(origin)?;539540 let (subs_deposit, sub_ids) = <SubsOf<T>>::take(&sender);541 let id = <IdentityOf<T>>::take(&sender).ok_or(Error::<T>::NotNamed)?;542 let deposit = id.total_deposit() + subs_deposit;543 for sub in sub_ids.iter() {544 <SuperOf<T>>::remove(sub);545 }546547 let err_amount = T::Currency::unreserve(&sender, deposit);548 debug_assert!(err_amount.is_zero());549550 Self::deposit_event(Event::IdentityCleared {551 who: sender,552 deposit,553 });554555 Ok(Some(T::WeightInfo::clear_identity(556 id.judgements.len() as u32, // R557 sub_ids.len() as u32, // S558 id.info.additional.len() as u32, // X559 ))560 .into())561 }562563 /// Request a judgement from a registrar.564 ///565 /// Payment: At most `max_fee` will be reserved for payment to the registrar if judgement566 /// given.567 ///568 /// The dispatch origin for this call must be _Signed_ and the sender must have a569 /// registered identity.570 ///571 /// - `reg_index`: The index of the registrar whose judgement is requested.572 /// - `max_fee`: The maximum fee that may be paid. This should just be auto-populated as:573 ///574 /// ```nocompile575 /// Self::registrars().get(reg_index).unwrap().fee576 /// ```577 ///578 /// Emits `JudgementRequested` if successful.579 ///580 /// # <weight>581 /// - `O(R + X)`.582 /// - One balance-reserve operation.583 /// - Storage: 1 read `O(R)`, 1 mutate `O(X + R)`.584 /// - One event.585 /// # </weight>586 #[pallet::call_index(4)]587 #[pallet::weight(T::WeightInfo::request_judgement(588 T::MaxRegistrars::get(), // R589 T::MaxAdditionalFields::get(), // X590 ))]591 pub fn request_judgement(592 origin: OriginFor<T>,593 #[pallet::compact] reg_index: RegistrarIndex,594 #[pallet::compact] max_fee: BalanceOf<T>,595 ) -> DispatchResultWithPostInfo {596 let sender = ensure_signed(origin)?;597 let registrars = <Registrars<T>>::get();598 let registrar = registrars599 .get(reg_index as usize)600 .and_then(Option::as_ref)601 .ok_or(Error::<T>::EmptyIndex)?;602 ensure!(max_fee >= registrar.fee, Error::<T>::FeeChanged);603 let mut id = <IdentityOf<T>>::get(&sender).ok_or(Error::<T>::NoIdentity)?;604605 let item = (reg_index, Judgement::FeePaid(registrar.fee));606 match id.judgements.binary_search_by_key(®_index, |x| x.0) {607 Ok(i) => {608 if id.judgements[i].1.is_sticky() {609 return Err(Error::<T>::StickyJudgement.into());610 } else {611 id.judgements[i] = item612 }613 }614 Err(i) => id615 .judgements616 .try_insert(i, item)617 .map_err(|_| Error::<T>::TooManyRegistrars)?,618 }619620 T::Currency::reserve(&sender, registrar.fee)?;621622 let judgements = id.judgements.len();623 let extra_fields = id.info.additional.len();624 <IdentityOf<T>>::insert(&sender, id);625626 Self::deposit_event(Event::JudgementRequested {627 who: sender,628 registrar_index: reg_index,629 });630631 Ok(Some(T::WeightInfo::request_judgement(632 judgements as u32,633 extra_fields as u32,634 ))635 .into())636 }637638 /// Cancel a previous request.639 ///640 /// Payment: A previously reserved deposit is returned on success.641 ///642 /// The dispatch origin for this call must be _Signed_ and the sender must have a643 /// registered identity.644 ///645 /// - `reg_index`: The index of the registrar whose judgement is no longer requested.646 ///647 /// Emits `JudgementUnrequested` if successful.648 ///649 /// # <weight>650 /// - `O(R + X)`.651 /// - One balance-reserve operation.652 /// - One storage mutation `O(R + X)`.653 /// - One event654 /// # </weight>655 #[pallet::call_index(5)]656 #[pallet::weight(T::WeightInfo::cancel_request(657 T::MaxRegistrars::get(), // R658 T::MaxAdditionalFields::get(), // X659 ))]660 pub fn cancel_request(661 origin: OriginFor<T>,662 reg_index: RegistrarIndex,663 ) -> DispatchResultWithPostInfo {664 let sender = ensure_signed(origin)?;665 let mut id = <IdentityOf<T>>::get(&sender).ok_or(Error::<T>::NoIdentity)?;666667 let pos = id668 .judgements669 .binary_search_by_key(®_index, |x| x.0)670 .map_err(|_| Error::<T>::NotFound)?;671 let fee = if let Judgement::FeePaid(fee) = id.judgements.remove(pos).1 {672 fee673 } else {674 return Err(Error::<T>::JudgementGiven.into());675 };676677 let err_amount = T::Currency::unreserve(&sender, fee);678 debug_assert!(err_amount.is_zero());679 let judgements = id.judgements.len();680 let extra_fields = id.info.additional.len();681 <IdentityOf<T>>::insert(&sender, id);682683 Self::deposit_event(Event::JudgementUnrequested {684 who: sender,685 registrar_index: reg_index,686 });687688 Ok(Some(T::WeightInfo::cancel_request(689 judgements as u32,690 extra_fields as u32,691 ))692 .into())693 }694695 /// Set the fee required for a judgement to be requested from a registrar.696 ///697 /// The dispatch origin for this call must be _Signed_ and the sender must be the account698 /// of the registrar whose index is `index`.699 ///700 /// - `index`: the index of the registrar whose fee is to be set.701 /// - `fee`: the new fee.702 ///703 /// # <weight>704 /// - `O(R)`.705 /// - One storage mutation `O(R)`.706 /// - Benchmark: 7.315 + R * 0.329 µs (min squares analysis)707 /// # </weight>708 #[pallet::call_index(6)]709 #[pallet::weight(T::WeightInfo::set_fee(T::MaxRegistrars::get()))] // R710 pub fn set_fee(711 origin: OriginFor<T>,712 #[pallet::compact] index: RegistrarIndex,713 #[pallet::compact] fee: BalanceOf<T>,714 ) -> DispatchResultWithPostInfo {715 let who = ensure_signed(origin)?;716717 let registrars = <Registrars<T>>::mutate(|rs| -> Result<usize, DispatchError> {718 rs.get_mut(index as usize)719 .and_then(|x| x.as_mut())720 .and_then(|r| {721 if r.account == who {722 r.fee = fee;723 Some(())724 } else {725 None726 }727 })728 .ok_or_else(|| DispatchError::from(Error::<T>::InvalidIndex))?;729 Ok(rs.len())730 })?;731 Ok(Some(T::WeightInfo::set_fee(registrars as u32)).into()) // R732 }733734 /// Change the account associated with a registrar.735 ///736 /// The dispatch origin for this call must be _Signed_ and the sender must be the account737 /// of the registrar whose index is `index`.738 ///739 /// - `index`: the index of the registrar whose fee is to be set.740 /// - `new`: the new account ID.741 ///742 /// # <weight>743 /// - `O(R)`.744 /// - One storage mutation `O(R)`.745 /// - Benchmark: 8.823 + R * 0.32 µs (min squares analysis)746 /// # </weight>747 #[pallet::call_index(7)]748 #[pallet::weight(T::WeightInfo::set_account_id(T::MaxRegistrars::get()))] // R749 pub fn set_account_id(750 origin: OriginFor<T>,751 #[pallet::compact] index: RegistrarIndex,752 new: AccountIdLookupOf<T>,753 ) -> DispatchResultWithPostInfo {754 let who = ensure_signed(origin)?;755 let new = T::Lookup::lookup(new)?;756757 let registrars = <Registrars<T>>::mutate(|rs| -> Result<usize, DispatchError> {758 rs.get_mut(index as usize)759 .and_then(|x| x.as_mut())760 .and_then(|r| {761 if r.account == who {762 r.account = new;763 Some(())764 } else {765 None766 }767 })768 .ok_or_else(|| DispatchError::from(Error::<T>::InvalidIndex))?;769 Ok(rs.len())770 })?;771 Ok(Some(T::WeightInfo::set_account_id(registrars as u32)).into()) // R772 }773774 /// Set the field information for a registrar.775 ///776 /// The dispatch origin for this call must be _Signed_ and the sender must be the account777 /// of the registrar whose index is `index`.778 ///779 /// - `index`: the index of the registrar whose fee is to be set.780 /// - `fields`: the fields that the registrar concerns themselves with.781 ///782 /// # <weight>783 /// - `O(R)`.784 /// - One storage mutation `O(R)`.785 /// - Benchmark: 7.464 + R * 0.325 µs (min squares analysis)786 /// # </weight>787 #[pallet::call_index(8)]788 #[pallet::weight(T::WeightInfo::set_fields(T::MaxRegistrars::get()))] // R789 pub fn set_fields(790 origin: OriginFor<T>,791 #[pallet::compact] index: RegistrarIndex,792 fields: IdentityFields,793 ) -> DispatchResultWithPostInfo {794 let who = ensure_signed(origin)?;795796 let registrars = <Registrars<T>>::mutate(|rs| -> Result<usize, DispatchError> {797 rs.get_mut(index as usize)798 .and_then(|x| x.as_mut())799 .and_then(|r| {800 if r.account == who {801 r.fields = fields;802 Some(())803 } else {804 None805 }806 })807 .ok_or_else(|| DispatchError::from(Error::<T>::InvalidIndex))?;808 Ok(rs.len())809 })?;810 Ok(Some(T::WeightInfo::set_fields(811 registrars as u32, // R812 ))813 .into())814 }815816 /// Provide a judgement for an account's identity.817 ///818 /// The dispatch origin for this call must be _Signed_ and the sender must be the account819 /// of the registrar whose index is `reg_index`.820 ///821 /// - `reg_index`: the index of the registrar whose judgement is being made.822 /// - `target`: the account whose identity the judgement is upon. This must be an account823 /// with a registered identity.824 /// - `judgement`: the judgement of the registrar of index `reg_index` about `target`.825 /// - `identity`: The hash of the [`IdentityInfo`] for that the judgement is provided.826 ///827 /// Emits `JudgementGiven` if successful.828 ///829 /// # <weight>830 /// - `O(R + X)`.831 /// - One balance-transfer operation.832 /// - Up to one account-lookup operation.833 /// - Storage: 1 read `O(R)`, 1 mutate `O(R + X)`.834 /// - One event.835 /// # </weight>836 #[pallet::call_index(9)]837 #[pallet::weight(T::WeightInfo::provide_judgement(838 T::MaxRegistrars::get(), // R839 T::MaxAdditionalFields::get(), // X840 ))]841 pub fn provide_judgement(842 origin: OriginFor<T>,843 #[pallet::compact] reg_index: RegistrarIndex,844 target: AccountIdLookupOf<T>,845 judgement: Judgement<BalanceOf<T>>,846 identity: T::Hash,847 ) -> DispatchResultWithPostInfo {848 let sender = ensure_signed(origin)?;849 let target = T::Lookup::lookup(target)?;850 ensure!(!judgement.has_deposit(), Error::<T>::InvalidJudgement);851 <Registrars<T>>::get()852 .get(reg_index as usize)853 .and_then(Option::as_ref)854 .filter(|r| r.account == sender)855 .ok_or(Error::<T>::InvalidIndex)?;856 let mut id = <IdentityOf<T>>::get(&target).ok_or(Error::<T>::InvalidTarget)?;857858 if T::Hashing::hash_of(&id.info) != identity {859 return Err(Error::<T>::JudgementForDifferentIdentity.into());860 }861862 let item = (reg_index, judgement);863 match id.judgements.binary_search_by_key(®_index, |x| x.0) {864 Ok(position) => {865 if let Judgement::FeePaid(fee) = id.judgements[position].1 {866 T::Currency::repatriate_reserved(867 &target,868 &sender,869 fee,870 BalanceStatus::Free,871 )872 .map_err(|_| Error::<T>::JudgementPaymentFailed)?;873 }874 id.judgements[position] = item875 }876 Err(position) => id877 .judgements878 .try_insert(position, item)879 .map_err(|_| Error::<T>::TooManyRegistrars)?,880 }881882 let judgements = id.judgements.len();883 let extra_fields = id.info.additional.len();884 <IdentityOf<T>>::insert(&target, id);885 Self::deposit_event(Event::JudgementGiven {886 target,887 registrar_index: reg_index,888 });889890 Ok(Some(T::WeightInfo::provide_judgement(891 judgements as u32,892 extra_fields as u32,893 ))894 .into())895 }896897 /// Remove an account's identity and sub-account information and slash the deposits.898 ///899 /// Payment: Reserved balances from `set_subs` and `set_identity` are slashed and handled by900 /// `Slash`. Verification request deposits are not returned; they should be cancelled901 /// manually using `cancel_request`.902 ///903 /// The dispatch origin for this call must match `T::ForceOrigin`.904 ///905 /// - `target`: the account whose identity the judgement is upon. This must be an account906 /// with a registered identity.907 ///908 /// Emits `IdentityKilled` if successful.909 ///910 /// # <weight>911 /// - `O(R + S + X)`.912 /// - One balance-reserve operation.913 /// - `S + 2` storage mutations.914 /// - One event.915 /// # </weight>916 #[pallet::call_index(10)]917 #[pallet::weight(T::WeightInfo::kill_identity(918 T::MaxRegistrars::get(), // R919 T::MaxSubAccounts::get(), // S920 T::MaxAdditionalFields::get(), // X921 ))]922 pub fn kill_identity(923 origin: OriginFor<T>,924 target: AccountIdLookupOf<T>,925 ) -> DispatchResultWithPostInfo {926 T::ForceOrigin::ensure_origin(origin)?;927928 // Figure out who we're meant to be clearing.929 let target = T::Lookup::lookup(target)?;930 // Grab their deposit (and check that they have one).931 let (subs_deposit, sub_ids) = <SubsOf<T>>::take(&target);932 let id = <IdentityOf<T>>::take(&target).ok_or(Error::<T>::NotNamed)?;933 let deposit = id.total_deposit() + subs_deposit;934 for sub in sub_ids.iter() {935 <SuperOf<T>>::remove(sub);936 }937 // Slash their deposit from them.938 T::Slashed::on_unbalanced(T::Currency::slash_reserved(&target, deposit).0);939940 Self::deposit_event(Event::IdentityKilled {941 who: target,942 deposit,943 });944945 Ok(Some(T::WeightInfo::kill_identity(946 id.judgements.len() as u32, // R947 sub_ids.len() as u32, // S948 id.info.additional.len() as u32, // X949 ))950 .into())951 }952953 /// Add the given account to the sender's subs.954 ///955 /// Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated956 /// to the sender.957 ///958 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered959 /// sub identity of `sub`.960 #[pallet::call_index(11)]961 #[pallet::weight(T::WeightInfo::add_sub(T::MaxSubAccounts::get()))]962 pub fn add_sub(963 origin: OriginFor<T>,964 sub: AccountIdLookupOf<T>,965 data: Data,966 ) -> DispatchResult {967 let sender = ensure_signed(origin)?;968 let sub = T::Lookup::lookup(sub)?;969 ensure!(970 IdentityOf::<T>::contains_key(&sender),971 Error::<T>::NoIdentity972 );973974 // Check if it's already claimed as sub-identity.975 ensure!(976 !SuperOf::<T>::contains_key(&sub),977 Error::<T>::AlreadyClaimed978 );979980 SubsOf::<T>::try_mutate(&sender, |(ref mut subs_deposit, ref mut sub_ids)| {981 // Ensure there is space and that the deposit is paid.982 ensure!(983 sub_ids.len() < T::MaxSubAccounts::get() as usize,984 Error::<T>::TooManySubAccounts985 );986 let deposit = T::SubAccountDeposit::get();987 T::Currency::reserve(&sender, deposit)?;988989 SuperOf::<T>::insert(&sub, (sender.clone(), data));990 sub_ids991 .try_push(sub.clone())992 .expect("sub ids length checked above; qed");993 *subs_deposit = subs_deposit.saturating_add(deposit);994995 Self::deposit_event(Event::SubIdentityAdded {996 sub,997 main: sender.clone(),998 deposit,999 });1000 Ok(())1001 })1002 }10031004 /// Alter the associated name of the given sub-account.1005 ///1006 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered1007 /// sub identity of `sub`.1008 #[pallet::call_index(12)]1009 #[pallet::weight(T::WeightInfo::rename_sub(T::MaxSubAccounts::get()))]1010 pub fn rename_sub(1011 origin: OriginFor<T>,1012 sub: AccountIdLookupOf<T>,1013 data: Data,1014 ) -> DispatchResult {1015 let sender = ensure_signed(origin)?;1016 let sub = T::Lookup::lookup(sub)?;1017 ensure!(1018 IdentityOf::<T>::contains_key(&sender),1019 Error::<T>::NoIdentity1020 );1021 ensure!(1022 SuperOf::<T>::get(&sub).map_or(false, |x| x.0 == sender),1023 Error::<T>::NotOwned1024 );1025 SuperOf::<T>::insert(&sub, (sender, data));1026 Ok(())1027 }10281029 /// Remove the given account from the sender's subs.1030 ///1031 /// Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated1032 /// to the sender.1033 ///1034 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered1035 /// sub identity of `sub`.1036 #[pallet::call_index(13)]1037 #[pallet::weight(T::WeightInfo::remove_sub(T::MaxSubAccounts::get()))]1038 pub fn remove_sub(origin: OriginFor<T>, sub: AccountIdLookupOf<T>) -> DispatchResult {1039 let sender = ensure_signed(origin)?;1040 ensure!(1041 IdentityOf::<T>::contains_key(&sender),1042 Error::<T>::NoIdentity1043 );1044 let sub = T::Lookup::lookup(sub)?;1045 let (sup, _) = SuperOf::<T>::get(&sub).ok_or(Error::<T>::NotSub)?;1046 ensure!(sup == sender, Error::<T>::NotOwned);1047 SuperOf::<T>::remove(&sub);1048 SubsOf::<T>::mutate(&sup, |(ref mut subs_deposit, ref mut sub_ids)| {1049 sub_ids.retain(|x| x != &sub);1050 let deposit = T::SubAccountDeposit::get().min(*subs_deposit);1051 *subs_deposit -= deposit;1052 let err_amount = T::Currency::unreserve(&sender, deposit);1053 debug_assert!(err_amount.is_zero());1054 Self::deposit_event(Event::SubIdentityRemoved {1055 sub,1056 main: sender,1057 deposit,1058 });1059 });1060 Ok(())1061 }10621063 /// Remove the sender as a sub-account.1064 ///1065 /// Payment: Balance reserved by a previous `set_subs` call for one sub will be repatriated1066 /// to the sender (*not* the original depositor).1067 ///1068 /// The dispatch origin for this call must be _Signed_ and the sender must have a registered1069 /// super-identity.1070 ///1071 /// NOTE: This should not normally be used, but is provided in the case that the non-1072 /// controller of an account is maliciously registered as a sub-account.1073 #[pallet::call_index(14)]1074 #[pallet::weight(T::WeightInfo::quit_sub(T::MaxSubAccounts::get()))]1075 pub fn quit_sub(origin: OriginFor<T>) -> DispatchResult {1076 let sender = ensure_signed(origin)?;1077 let (sup, _) = SuperOf::<T>::take(&sender).ok_or(Error::<T>::NotSub)?;1078 SubsOf::<T>::mutate(&sup, |(ref mut subs_deposit, ref mut sub_ids)| {1079 sub_ids.retain(|x| x != &sender);1080 let deposit = T::SubAccountDeposit::get().min(*subs_deposit);1081 *subs_deposit -= deposit;1082 let _ =1083 T::Currency::repatriate_reserved(&sup, &sender, deposit, BalanceStatus::Free);1084 Self::deposit_event(Event::SubIdentityRevoked {1085 sub: sender,1086 main: sup.clone(),1087 deposit,1088 });1089 });1090 Ok(())1091 }10921093 /// Insert or remove identities.1094 #[pallet::call_index(15)]1095 #[pallet::weight(T::WeightInfo::set_identities(1096 T::MaxAdditionalFields::get(), // X1097 identities.len() as u32, // N1098 ))] // todo:collator weight1099 pub fn set_identities(1100 origin: OriginFor<T>,1101 identities: Vec<(1102 T::AccountId,1103 Option<Registration<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields>>,1104 )>,1105 ) -> DispatchResult {1106 T::ForceOrigin::ensure_origin(origin)?;1107 for identity in identities {1108 IdentityOf::<T>::set(identity.0, identity.1);1109 }1110 Ok(())1111 }1112 }1113}11141115impl<T: Config> Pallet<T> {1116 /// Get the subs of an account.1117 pub fn subs(who: &T::AccountId) -> Vec<(T::AccountId, Data)> {1118 SubsOf::<T>::get(who)1119 .11120 .into_iter()1121 .filter_map(|a| SuperOf::<T>::get(&a).map(|x| (a, x.1)))1122 .collect()1123 }11241125 /// Check if the account has corresponding identity information by the identity field.1126 pub fn has_identity(who: &T::AccountId, fields: u64) -> bool {1127 IdentityOf::<T>::get(who).map_or(false, |registration| {1128 (registration.info.fields().0.bits() & fields) == fields1129 })1130 }1131}pallets/identity/src/weights.rsdiffbeforeafterboth--- a/pallets/identity/src/weights.rs
+++ b/pallets/identity/src/weights.rs
@@ -76,6 +76,7 @@
fn set_fields(r: u32, ) -> Weight;
fn provide_judgement(r: u32, x: u32, ) -> Weight;
fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight;
+ fn set_identities(x: u32, n: u32, ) -> Weight;
fn add_sub(s: u32, ) -> Weight;
fn rename_sub(s: u32, ) -> Weight;
fn remove_sub(s: u32, ) -> Weight;
@@ -245,6 +246,19 @@
.saturating_add(T::DbWeight::get().writes(3 as u64))
.saturating_add(T::DbWeight::get().writes((1 as u64).saturating_mul(s as u64)))
}
+ // Storage: Identity IdentityOf (r:1 w:1)
+ /// The range of component `x` is `[0, 100]`.
+ /// The range of component `n` is `[0, 600]`.
+ fn set_identities(x: u32, n: u32) -> Weight {
+ // Minimum execution time: 41_872 nanoseconds.
+ Weight::from_ref_time(40_230_216 as u64)
+ // Standard Error: 2_342
+ .saturating_add(Weight::from_ref_time(145_168 as u64))
+ // Standard Error: 457
+ .saturating_add(Weight::from_ref_time(291_732 as u64).saturating_mul(x as u64))
+ .saturating_add(T::DbWeight::get().reads(1 as u64))
+ .saturating_add(T::DbWeight::get().writes(1 as u64).saturating_mul(n as u64))
+ }
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SuperOf (r:1 w:1)
// Storage: Identity SubsOf (r:1 w:1)
@@ -455,6 +469,19 @@
.saturating_add(RocksDbWeight::get().writes(3 as u64))
.saturating_add(RocksDbWeight::get().writes((1 as u64).saturating_mul(s as u64)))
}
+ // Storage: Identity IdentityOf (r:1 w:1)
+ /// The range of component `x` is `[0, 100]`.
+ /// The range of component `n` is `[0, 600]`.
+ fn set_identities(x: u32, n: u32) -> Weight {
+ // Minimum execution time: 41_872 nanoseconds.
+ Weight::from_ref_time(40_230_216 as u64)
+ // Standard Error: 2_342
+ .saturating_add(Weight::from_ref_time(145_168 as u64))
+ // Standard Error: 457
+ .saturating_add(Weight::from_ref_time(291_732 as u64).saturating_mul(x as u64))
+ .saturating_add(RocksDbWeight::get().reads(1 as u64))
+ .saturating_add(RocksDbWeight::get().writes(1 as u64).saturating_mul(n as u64))
+ }
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SuperOf (r:1 w:1)
// Storage: Identity SubsOf (r:1 w:1)
runtime/common/runtime_apis.rsdiffbeforeafterboth--- a/runtime/common/runtime_apis.rs
+++ b/runtime/common/runtime_apis.rs
@@ -708,6 +708,9 @@
#[cfg(feature = "collator-selection")]
list_benchmark!(list, extra, pallet_collator_selection, CollatorSelection);
+ #[cfg(feature = "collator-selection")]
+ list_benchmark!(list, extra, pallet_identity, Identity);
+
#[cfg(feature = "foreign-assets")]
list_benchmark!(list, extra, pallet_foreign_assets, ForeignAssets);
@@ -774,6 +777,9 @@
#[cfg(feature = "collator-selection")]
add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection);
+ #[cfg(feature = "collator-selection")]
+ add_benchmark!(params, batches, pallet_identity, Identity);
+
#[cfg(feature = "foreign-assets")]
add_benchmark!(params, batches, pallet_foreign_assets, ForeignAssets);
runtime/opal/Cargo.tomldiffbeforeafterboth--- a/runtime/opal/Cargo.toml
+++ b/runtime/opal/Cargo.toml
@@ -40,6 +40,7 @@
'pallet-inflation/runtime-benchmarks',
'pallet-app-promotion/runtime-benchmarks',
'pallet-collator-selection/runtime-benchmarks',
+ 'pallet-identity/runtime-benchmarks',
'pallet-unique-scheduler-v2/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -39,6 +39,7 @@
'pallet-foreign-assets/runtime-benchmarks',
'pallet-inflation/runtime-benchmarks',
'pallet-collator-selection/runtime-benchmarks',
+ 'pallet-identity/runtime-benchmarks',
'pallet-app-promotion/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -39,6 +39,7 @@
'pallet-foreign-assets/runtime-benchmarks',
'pallet-inflation/runtime-benchmarks',
'pallet-collator-selection/runtime-benchmarks',
+ 'pallet-identity/runtime-benchmarks',
'pallet-app-promotion/runtime-benchmarks',
'pallet-xcm/runtime-benchmarks',
'sp-runtime/runtime-benchmarks',
tests/src/collatorSelection.seqtest.tsdiffbeforeafterboth--- a/tests/src/collatorSelection.seqtest.ts
+++ b/tests/src/collatorSelection.seqtest.ts
@@ -287,7 +287,7 @@
expect(await helper.collatorSelection.getCandidates()).to.be.deep.equal([]);
});
- itSub('Dithmarschen', async ({helper}) => {
+ itSub('Penalizes and forfeits license from faulty collators', async ({helper}) => {
// This one shouldn't even be able to produce blocks.
const account = crowd.pop()!;
await helper.collatorSelection.obtainLicense(account);
tests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-tx.ts
+++ b/tests/src/interfaces/augment-api-tx.ts
@@ -318,10 +318,6 @@
**/
setData: AugmentedSubmittable<(address: H160 | string | Uint8Array, data: Vec<ITuple<[H256, H256]>> | ([H256 | string | Uint8Array, H256 | string | Uint8Array])[]) => SubmittableExtrinsic<ApiType>, [H160, Vec<ITuple<[H256, H256]>>]>;
/**
- * Insert or remove identities.
- **/
- setIdentities: AugmentedSubmittable<(identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>> | ([AccountId32 | string | Uint8Array, Option<PalletIdentityRegistration> | null | Uint8Array | PalletIdentityRegistration | { judgements?: any; deposit?: any; info?: any } | string])[]) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>]>;
- /**
* Generic tx
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
@@ -606,6 +602,10 @@
**/
setFields: AugmentedSubmittable<(index: Compact<u32> | AnyNumber | Uint8Array, fields: PalletIdentityBitFlags) => SubmittableExtrinsic<ApiType>, [Compact<u32>, PalletIdentityBitFlags]>;
/**
+ * Insert or remove identities.
+ **/
+ setIdentities: AugmentedSubmittable<(identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>> | ([AccountId32 | string | Uint8Array, Option<PalletIdentityRegistration> | null | Uint8Array | PalletIdentityRegistration | { judgements?: any; deposit?: any; info?: any } | string])[]) => SubmittableExtrinsic<ApiType>, [Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>]>;
+ /**
* Set an account's identity information and reserve the appropriate deposit.
*
* If the account already has identity information, the deposit is taken as part payment
tests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -1477,11 +1477,7 @@
readonly asInsertEvents: {
readonly events: Vec<Bytes>;
} & Struct;
- readonly isSetIdentities: boolean;
- readonly asSetIdentities: {
- readonly identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>;
- } & Struct;
- readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents' | 'SetIdentities';
+ readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents';
}
/** @name PalletDataManagementError */
@@ -1825,7 +1821,11 @@
readonly sub: MultiAddress;
} & Struct;
readonly isQuitSub: boolean;
- readonly type: 'AddRegistrar' | 'SetIdentity' | 'SetSubs' | 'ClearIdentity' | 'RequestJudgement' | 'CancelRequest' | 'SetFee' | 'SetAccountId' | 'SetFields' | 'ProvideJudgement' | 'KillIdentity' | 'AddSub' | 'RenameSub' | 'RemoveSub' | 'QuitSub';
+ readonly isSetIdentities: boolean;
+ readonly asSetIdentities: {
+ readonly identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>;
+ } & Struct;
+ readonly type: 'AddRegistrar' | 'SetIdentity' | 'SetSubs' | 'ClearIdentity' | 'RequestJudgement' | 'CancelRequest' | 'SetFee' | 'SetAccountId' | 'SetFields' | 'ProvideJudgement' | 'KillIdentity' | 'AddSub' | 'RenameSub' | 'RemoveSub' | 'QuitSub' | 'SetIdentities';
}
/** @name PalletIdentityError */
tests/src/interfaces/lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -1863,17 +1863,20 @@
remove_sub: {
sub: 'MultiAddress',
},
- quit_sub: 'Null'
+ quit_sub: 'Null',
+ set_identities: {
+ identities: 'Vec<(AccountId32,Option<PalletIdentityRegistration>)>'
+ }
}
},
/**
- * Lookup248: pallet_identity::pallet::Error<T>
+ * Lookup251: pallet_identity::pallet::Error<T>
**/
PalletIdentityError: {
_enum: ['TooManySubAccounts', 'NotFound', 'NotNamed', 'EmptyIndex', 'FeeChanged', 'NoIdentity', 'StickyJudgement', 'JudgementGiven', 'InvalidJudgement', 'InvalidIndex', 'InvalidTarget', 'TooManyFields', 'TooManyRegistrars', 'AlreadyClaimed', 'NotSub', 'NotOwned', 'JudgementForDifferentIdentity', 'JudgementPaymentFailed']
},
/**
- * Lookup250: pallet_balances::BalanceLock<Balance>
+ * Lookup253: pallet_balances::BalanceLock<Balance>
**/
PalletBalancesBalanceLock: {
id: '[u8;8]',
@@ -1881,20 +1884,20 @@
reasons: 'PalletBalancesReasons'
},
/**
- * Lookup251: pallet_balances::Reasons
+ * Lookup254: pallet_balances::Reasons
**/
PalletBalancesReasons: {
_enum: ['Fee', 'Misc', 'All']
},
/**
- * Lookup254: pallet_balances::ReserveData<ReserveIdentifier, Balance>
+ * Lookup257: pallet_balances::ReserveData<ReserveIdentifier, Balance>
**/
PalletBalancesReserveData: {
id: '[u8;16]',
amount: 'u128'
},
/**
- * Lookup256: pallet_balances::pallet::Call<T, I>
+ * Lookup259: pallet_balances::pallet::Call<T, I>
**/
PalletBalancesCall: {
_enum: {
@@ -1927,13 +1930,13 @@
}
},
/**
- * Lookup257: pallet_balances::pallet::Error<T, I>
+ * Lookup260: pallet_balances::pallet::Error<T, I>
**/
PalletBalancesError: {
_enum: ['VestingBalance', 'LiquidityRestrictions', 'InsufficientBalance', 'ExistentialDeposit', 'KeepAlive', 'ExistingVestingSchedule', 'DeadAccount', 'TooManyReserves']
},
/**
- * Lookup259: pallet_timestamp::pallet::Call<T>
+ * Lookup262: pallet_timestamp::pallet::Call<T>
**/
PalletTimestampCall: {
_enum: {
@@ -1943,13 +1946,13 @@
}
},
/**
- * Lookup261: pallet_transaction_payment::Releases
+ * Lookup264: pallet_transaction_payment::Releases
**/
PalletTransactionPaymentReleases: {
_enum: ['V1Ancient', 'V2']
},
/**
- * Lookup262: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
+ * Lookup265: pallet_treasury::Proposal<sp_core::crypto::AccountId32, Balance>
**/
PalletTreasuryProposal: {
proposer: 'AccountId32',
@@ -1958,7 +1961,7 @@
bond: 'u128'
},
/**
- * Lookup264: pallet_treasury::pallet::Call<T, I>
+ * Lookup267: pallet_treasury::pallet::Call<T, I>
**/
PalletTreasuryCall: {
_enum: {
@@ -1982,17 +1985,17 @@
}
},
/**
- * Lookup266: frame_support::PalletId
+ * Lookup269: frame_support::PalletId
**/
FrameSupportPalletId: '[u8;8]',
/**
- * Lookup267: pallet_treasury::pallet::Error<T, I>
+ * Lookup270: pallet_treasury::pallet::Error<T, I>
**/
PalletTreasuryError: {
_enum: ['InsufficientProposersBalance', 'InvalidIndex', 'TooManyApprovals', 'InsufficientPermission', 'ProposalNotApproved']
},
/**
- * Lookup268: pallet_sudo::pallet::Call<T>
+ * Lookup271: pallet_sudo::pallet::Call<T>
**/
PalletSudoCall: {
_enum: {
@@ -2016,7 +2019,7 @@
}
},
/**
- * Lookup270: orml_vesting::module::Call<T>
+ * Lookup273: orml_vesting::module::Call<T>
**/
OrmlVestingModuleCall: {
_enum: {
@@ -2035,7 +2038,7 @@
}
},
/**
- * Lookup272: orml_xtokens::module::Call<T>
+ * Lookup275: orml_xtokens::module::Call<T>
**/
OrmlXtokensModuleCall: {
_enum: {
@@ -2078,7 +2081,7 @@
}
},
/**
- * Lookup273: xcm::VersionedMultiAsset
+ * Lookup276: xcm::VersionedMultiAsset
**/
XcmVersionedMultiAsset: {
_enum: {
@@ -2087,7 +2090,7 @@
}
},
/**
- * Lookup276: orml_tokens::module::Call<T>
+ * Lookup279: orml_tokens::module::Call<T>
**/
OrmlTokensModuleCall: {
_enum: {
@@ -2121,7 +2124,7 @@
}
},
/**
- * Lookup277: cumulus_pallet_xcmp_queue::pallet::Call<T>
+ * Lookup280: cumulus_pallet_xcmp_queue::pallet::Call<T>
**/
CumulusPalletXcmpQueueCall: {
_enum: {
@@ -2170,7 +2173,7 @@
}
},
/**
- * Lookup278: pallet_xcm::pallet::Call<T>
+ * Lookup281: pallet_xcm::pallet::Call<T>
**/
PalletXcmCall: {
_enum: {
@@ -2224,7 +2227,7 @@
}
},
/**
- * Lookup279: xcm::VersionedXcm<RuntimeCall>
+ * Lookup282: xcm::VersionedXcm<RuntimeCall>
**/
XcmVersionedXcm: {
_enum: {
@@ -2234,7 +2237,7 @@
}
},
/**
- * Lookup280: xcm::v0::Xcm<RuntimeCall>
+ * Lookup283: xcm::v0::Xcm<RuntimeCall>
**/
XcmV0Xcm: {
_enum: {
@@ -2288,7 +2291,7 @@
}
},
/**
- * Lookup282: xcm::v0::order::Order<RuntimeCall>
+ * Lookup285: xcm::v0::order::Order<RuntimeCall>
**/
XcmV0Order: {
_enum: {
@@ -2331,7 +2334,7 @@
}
},
/**
- * Lookup284: xcm::v0::Response
+ * Lookup287: xcm::v0::Response
**/
XcmV0Response: {
_enum: {
@@ -2339,7 +2342,7 @@
}
},
/**
- * Lookup285: xcm::v1::Xcm<RuntimeCall>
+ * Lookup288: xcm::v1::Xcm<RuntimeCall>
**/
XcmV1Xcm: {
_enum: {
@@ -2398,7 +2401,7 @@
}
},
/**
- * Lookup287: xcm::v1::order::Order<RuntimeCall>
+ * Lookup290: xcm::v1::order::Order<RuntimeCall>
**/
XcmV1Order: {
_enum: {
@@ -2443,7 +2446,7 @@
}
},
/**
- * Lookup289: xcm::v1::Response
+ * Lookup292: xcm::v1::Response
**/
XcmV1Response: {
_enum: {
@@ -2452,11 +2455,11 @@
}
},
/**
- * Lookup303: cumulus_pallet_xcm::pallet::Call<T>
+ * Lookup306: cumulus_pallet_xcm::pallet::Call<T>
**/
CumulusPalletXcmCall: 'Null',
/**
- * Lookup304: cumulus_pallet_dmp_queue::pallet::Call<T>
+ * Lookup307: cumulus_pallet_dmp_queue::pallet::Call<T>
**/
CumulusPalletDmpQueueCall: {
_enum: {
@@ -2467,7 +2470,7 @@
}
},
/**
- * Lookup305: pallet_inflation::pallet::Call<T>
+ * Lookup308: pallet_inflation::pallet::Call<T>
**/
PalletInflationCall: {
_enum: {
@@ -2477,7 +2480,7 @@
}
},
/**
- * Lookup306: pallet_unique::Call<T>
+ * Lookup309: pallet_unique::Call<T>
**/
PalletUniqueCall: {
_enum: {
@@ -2621,7 +2624,7 @@
}
},
/**
- * Lookup311: up_data_structs::CollectionMode
+ * Lookup314: up_data_structs::CollectionMode
**/
UpDataStructsCollectionMode: {
_enum: {
@@ -2631,7 +2634,7 @@
}
},
/**
- * Lookup312: up_data_structs::CreateCollectionData<sp_core::crypto::AccountId32>
+ * Lookup315: up_data_structs::CreateCollectionData<sp_core::crypto::AccountId32>
**/
UpDataStructsCreateCollectionData: {
mode: 'UpDataStructsCollectionMode',
@@ -2646,13 +2649,13 @@
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup314: up_data_structs::AccessMode
+ * Lookup317: up_data_structs::AccessMode
**/
UpDataStructsAccessMode: {
_enum: ['Normal', 'AllowList']
},
/**
- * Lookup316: up_data_structs::CollectionLimits
+ * Lookup319: up_data_structs::CollectionLimits
**/
UpDataStructsCollectionLimits: {
accountTokenOwnershipLimit: 'Option<u32>',
@@ -2666,7 +2669,7 @@
transfersEnabled: 'Option<bool>'
},
/**
- * Lookup318: up_data_structs::SponsoringRateLimit
+ * Lookup321: up_data_structs::SponsoringRateLimit
**/
UpDataStructsSponsoringRateLimit: {
_enum: {
@@ -2675,7 +2678,7 @@
}
},
/**
- * Lookup321: up_data_structs::CollectionPermissions
+ * Lookup324: up_data_structs::CollectionPermissions
**/
UpDataStructsCollectionPermissions: {
access: 'Option<UpDataStructsAccessMode>',
@@ -2683,7 +2686,7 @@
nesting: 'Option<UpDataStructsNestingPermissions>'
},
/**
- * Lookup323: up_data_structs::NestingPermissions
+ * Lookup326: up_data_structs::NestingPermissions
**/
UpDataStructsNestingPermissions: {
tokenOwner: 'bool',
@@ -2691,18 +2694,18 @@
restricted: 'Option<UpDataStructsOwnerRestrictedSet>'
},
/**
- * Lookup325: up_data_structs::OwnerRestrictedSet
+ * Lookup328: up_data_structs::OwnerRestrictedSet
**/
UpDataStructsOwnerRestrictedSet: 'BTreeSet<u32>',
/**
- * Lookup330: up_data_structs::PropertyKeyPermission
+ * Lookup333: up_data_structs::PropertyKeyPermission
**/
UpDataStructsPropertyKeyPermission: {
key: 'Bytes',
permission: 'UpDataStructsPropertyPermission'
},
/**
- * Lookup331: up_data_structs::PropertyPermission
+ * Lookup334: up_data_structs::PropertyPermission
**/
UpDataStructsPropertyPermission: {
mutable: 'bool',
@@ -2710,14 +2713,14 @@
tokenOwner: 'bool'
},
/**
- * Lookup334: up_data_structs::Property
+ * Lookup337: up_data_structs::Property
**/
UpDataStructsProperty: {
key: 'Bytes',
value: 'Bytes'
},
/**
- * Lookup337: up_data_structs::CreateItemData
+ * Lookup340: up_data_structs::CreateItemData
**/
UpDataStructsCreateItemData: {
_enum: {
@@ -2727,26 +2730,26 @@
}
},
/**
- * Lookup338: up_data_structs::CreateNftData
+ * Lookup341: up_data_structs::CreateNftData
**/
UpDataStructsCreateNftData: {
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup339: up_data_structs::CreateFungibleData
+ * Lookup342: up_data_structs::CreateFungibleData
**/
UpDataStructsCreateFungibleData: {
value: 'u128'
},
/**
- * Lookup340: up_data_structs::CreateReFungibleData
+ * Lookup343: up_data_structs::CreateReFungibleData
**/
UpDataStructsCreateReFungibleData: {
pieces: 'u128',
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup343: up_data_structs::CreateItemExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup346: up_data_structs::CreateItemExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsCreateItemExData: {
_enum: {
@@ -2757,14 +2760,14 @@
}
},
/**
- * Lookup345: up_data_structs::CreateNftExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup348: up_data_structs::CreateNftExData<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsCreateNftExData: {
properties: 'Vec<UpDataStructsProperty>',
owner: 'PalletEvmAccountBasicCrossAccountIdRepr'
},
/**
- * Lookup352: up_data_structs::CreateRefungibleExSingleOwner<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup355: up_data_structs::CreateRefungibleExSingleOwner<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsCreateRefungibleExSingleOwner: {
user: 'PalletEvmAccountBasicCrossAccountIdRepr',
@@ -2772,14 +2775,14 @@
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup354: up_data_structs::CreateRefungibleExMultipleOwners<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
+ * Lookup357: up_data_structs::CreateRefungibleExMultipleOwners<pallet_evm::account::BasicCrossAccountIdRepr<sp_core::crypto::AccountId32>>
**/
UpDataStructsCreateRefungibleExMultipleOwners: {
users: 'BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>',
properties: 'Vec<UpDataStructsProperty>'
},
/**
- * Lookup355: pallet_configuration::pallet::Call<T>
+ * Lookup358: pallet_configuration::pallet::Call<T>
**/
PalletConfigurationCall: {
_enum: {
@@ -2807,7 +2810,7 @@
}
},
/**
- * Lookup360: pallet_configuration::AppPromotionConfiguration<BlockNumber>
+ * Lookup363: pallet_configuration::AppPromotionConfiguration<BlockNumber>
**/
PalletConfigurationAppPromotionConfiguration: {
recalculationInterval: 'Option<u32>',
@@ -2816,15 +2819,15 @@
maxStakersPerCalculation: 'Option<u8>'
},
/**
- * Lookup364: pallet_template_transaction_payment::Call<T>
+ * Lookup367: pallet_template_transaction_payment::Call<T>
**/
PalletTemplateTransactionPaymentCall: 'Null',
/**
- * Lookup365: pallet_structure::pallet::Call<T>
+ * Lookup368: pallet_structure::pallet::Call<T>
**/
PalletStructureCall: 'Null',
/**
- * Lookup366: pallet_rmrk_core::pallet::Call<T>
+ * Lookup369: pallet_rmrk_core::pallet::Call<T>
**/
PalletRmrkCoreCall: {
_enum: {
@@ -2915,7 +2918,7 @@
}
},
/**
- * Lookup372: rmrk_traits::resource::ResourceTypes<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup375: rmrk_traits::resource::ResourceTypes<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsResourceResourceTypes: {
_enum: {
@@ -2925,7 +2928,7 @@
}
},
/**
- * Lookup374: rmrk_traits::resource::BasicResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup377: rmrk_traits::resource::BasicResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsResourceBasicResource: {
src: 'Option<Bytes>',
@@ -2934,7 +2937,7 @@
thumb: 'Option<Bytes>'
},
/**
- * Lookup376: rmrk_traits::resource::ComposableResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup379: rmrk_traits::resource::ComposableResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsResourceComposableResource: {
parts: 'Vec<u32>',
@@ -2945,7 +2948,7 @@
thumb: 'Option<Bytes>'
},
/**
- * Lookup377: rmrk_traits::resource::SlotResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup380: rmrk_traits::resource::SlotResource<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsResourceSlotResource: {
base: 'u32',
@@ -2956,7 +2959,7 @@
thumb: 'Option<Bytes>'
},
/**
- * Lookup380: pallet_rmrk_equip::pallet::Call<T>
+ * Lookup383: pallet_rmrk_equip::pallet::Call<T>
**/
PalletRmrkEquipCall: {
_enum: {
@@ -2977,7 +2980,7 @@
}
},
/**
- * Lookup383: rmrk_traits::part::PartType<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup386: rmrk_traits::part::PartType<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsPartPartType: {
_enum: {
@@ -2986,7 +2989,7 @@
}
},
/**
- * Lookup385: rmrk_traits::part::FixedPart<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup388: rmrk_traits::part::FixedPart<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsPartFixedPart: {
id: 'u32',
@@ -2994,7 +2997,7 @@
src: 'Bytes'
},
/**
- * Lookup386: rmrk_traits::part::SlotPart<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup389: rmrk_traits::part::SlotPart<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsPartSlotPart: {
id: 'u32',
@@ -3003,7 +3006,7 @@
z: 'u32'
},
/**
- * Lookup387: rmrk_traits::part::EquippableList<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup390: rmrk_traits::part::EquippableList<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsPartEquippableList: {
_enum: {
@@ -3013,7 +3016,7 @@
}
},
/**
- * Lookup389: rmrk_traits::theme::Theme<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<rmrk_traits::theme::ThemeProperty<sp_core::bounded::bounded_vec::BoundedVec<T, S>>, S>>
+ * Lookup392: rmrk_traits::theme::Theme<sp_core::bounded::bounded_vec::BoundedVec<T, S>, sp_core::bounded::bounded_vec::BoundedVec<rmrk_traits::theme::ThemeProperty<sp_core::bounded::bounded_vec::BoundedVec<T, S>>, S>>
**/
RmrkTraitsTheme: {
name: 'Bytes',
@@ -3021,14 +3024,14 @@
inherit: 'bool'
},
/**
- * Lookup391: rmrk_traits::theme::ThemeProperty<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
+ * Lookup394: rmrk_traits::theme::ThemeProperty<sp_core::bounded::bounded_vec::BoundedVec<T, S>>
**/
RmrkTraitsThemeThemeProperty: {
key: 'Bytes',
value: 'Bytes'
},
/**
- * Lookup393: pallet_app_promotion::pallet::Call<T>
+ * Lookup396: pallet_app_promotion::pallet::Call<T>
**/
PalletAppPromotionCall: {
_enum: {
@@ -3057,7 +3060,7 @@
}
},
/**
- * Lookup394: pallet_foreign_assets::module::Call<T>
+ * Lookup397: pallet_foreign_assets::module::Call<T>
**/
PalletForeignAssetsModuleCall: {
_enum: {
@@ -3074,7 +3077,7 @@
}
},
/**
- * Lookup395: pallet_evm::pallet::Call<T>
+ * Lookup398: pallet_evm::pallet::Call<T>
**/
PalletEvmCall: {
_enum: {
@@ -3117,7 +3120,7 @@
}
},
/**
- * Lookup401: pallet_ethereum::pallet::Call<T>
+ * Lookup404: pallet_ethereum::pallet::Call<T>
**/
PalletEthereumCall: {
_enum: {
@@ -3127,7 +3130,7 @@
}
},
/**
- * Lookup402: ethereum::transaction::TransactionV2
+ * Lookup405: ethereum::transaction::TransactionV2
**/
EthereumTransactionTransactionV2: {
_enum: {
@@ -3137,7 +3140,7 @@
}
},
/**
- * Lookup403: ethereum::transaction::LegacyTransaction
+ * Lookup406: ethereum::transaction::LegacyTransaction
**/
EthereumTransactionLegacyTransaction: {
nonce: 'U256',
@@ -3149,7 +3152,7 @@
signature: 'EthereumTransactionTransactionSignature'
},
/**
- * Lookup404: ethereum::transaction::TransactionAction
+ * Lookup407: ethereum::transaction::TransactionAction
**/
EthereumTransactionTransactionAction: {
_enum: {
@@ -3158,7 +3161,7 @@
}
},
/**
- * Lookup405: ethereum::transaction::TransactionSignature
+ * Lookup408: ethereum::transaction::TransactionSignature
**/
EthereumTransactionTransactionSignature: {
v: 'u64',
@@ -3166,7 +3169,7 @@
s: 'H256'
},
/**
- * Lookup407: ethereum::transaction::EIP2930Transaction
+ * Lookup410: ethereum::transaction::EIP2930Transaction
**/
EthereumTransactionEip2930Transaction: {
chainId: 'u64',
@@ -3182,14 +3185,14 @@
s: 'H256'
},
/**
- * Lookup409: ethereum::transaction::AccessListItem
+ * Lookup412: ethereum::transaction::AccessListItem
**/
EthereumTransactionAccessListItem: {
address: 'H160',
storageKeys: 'Vec<H256>'
},
/**
- * Lookup410: ethereum::transaction::EIP1559Transaction
+ * Lookup413: ethereum::transaction::EIP1559Transaction
**/
EthereumTransactionEip1559Transaction: {
chainId: 'u64',
@@ -3206,7 +3209,7 @@
s: 'H256'
},
/**
- * Lookup411: pallet_data_management::pallet::Call<T>
+ * Lookup414: pallet_data_management::pallet::Call<T>
**/
PalletDataManagementCall: {
_enum: {
@@ -3225,10 +3228,7 @@
logs: 'Vec<EthereumLog>',
},
insert_events: {
- events: 'Vec<Bytes>',
- },
- set_identities: {
- identities: 'Vec<(AccountId32,Option<PalletIdentityRegistration>)>'
+ events: 'Vec<Bytes>'
}
}
},
tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -2057,10 +2057,14 @@
readonly sub: MultiAddress;
} & Struct;
readonly isQuitSub: boolean;
- readonly type: 'AddRegistrar' | 'SetIdentity' | 'SetSubs' | 'ClearIdentity' | 'RequestJudgement' | 'CancelRequest' | 'SetFee' | 'SetAccountId' | 'SetFields' | 'ProvideJudgement' | 'KillIdentity' | 'AddSub' | 'RenameSub' | 'RemoveSub' | 'QuitSub';
+ readonly isSetIdentities: boolean;
+ readonly asSetIdentities: {
+ readonly identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>;
+ } & Struct;
+ readonly type: 'AddRegistrar' | 'SetIdentity' | 'SetSubs' | 'ClearIdentity' | 'RequestJudgement' | 'CancelRequest' | 'SetFee' | 'SetAccountId' | 'SetFields' | 'ProvideJudgement' | 'KillIdentity' | 'AddSub' | 'RenameSub' | 'RemoveSub' | 'QuitSub' | 'SetIdentities';
}
- /** @name PalletIdentityError (248) */
+ /** @name PalletIdentityError (251) */
interface PalletIdentityError extends Enum {
readonly isTooManySubAccounts: boolean;
readonly isNotFound: boolean;
@@ -2083,14 +2087,14 @@
readonly type: 'TooManySubAccounts' | 'NotFound' | 'NotNamed' | 'EmptyIndex' | 'FeeChanged' | 'NoIdentity' | 'StickyJudgement' | 'JudgementGiven' | 'InvalidJudgement' | 'InvalidIndex' | 'InvalidTarget' | 'TooManyFields' | 'TooManyRegistrars' | 'AlreadyClaimed' | 'NotSub' | 'NotOwned' | 'JudgementForDifferentIdentity' | 'JudgementPaymentFailed';
}
- /** @name PalletBalancesBalanceLock (250) */
+ /** @name PalletBalancesBalanceLock (253) */
interface PalletBalancesBalanceLock extends Struct {
readonly id: U8aFixed;
readonly amount: u128;
readonly reasons: PalletBalancesReasons;
}
- /** @name PalletBalancesReasons (251) */
+ /** @name PalletBalancesReasons (254) */
interface PalletBalancesReasons extends Enum {
readonly isFee: boolean;
readonly isMisc: boolean;
@@ -2098,13 +2102,13 @@
readonly type: 'Fee' | 'Misc' | 'All';
}
- /** @name PalletBalancesReserveData (254) */
+ /** @name PalletBalancesReserveData (257) */
interface PalletBalancesReserveData extends Struct {
readonly id: U8aFixed;
readonly amount: u128;
}
- /** @name PalletBalancesCall (256) */
+ /** @name PalletBalancesCall (259) */
interface PalletBalancesCall extends Enum {
readonly isTransfer: boolean;
readonly asTransfer: {
@@ -2141,7 +2145,7 @@
readonly type: 'Transfer' | 'SetBalance' | 'ForceTransfer' | 'TransferKeepAlive' | 'TransferAll' | 'ForceUnreserve';
}
- /** @name PalletBalancesError (257) */
+ /** @name PalletBalancesError (260) */
interface PalletBalancesError extends Enum {
readonly isVestingBalance: boolean;
readonly isLiquidityRestrictions: boolean;
@@ -2154,7 +2158,7 @@
readonly type: 'VestingBalance' | 'LiquidityRestrictions' | 'InsufficientBalance' | 'ExistentialDeposit' | 'KeepAlive' | 'ExistingVestingSchedule' | 'DeadAccount' | 'TooManyReserves';
}
- /** @name PalletTimestampCall (259) */
+ /** @name PalletTimestampCall (262) */
interface PalletTimestampCall extends Enum {
readonly isSet: boolean;
readonly asSet: {
@@ -2163,14 +2167,14 @@
readonly type: 'Set';
}
- /** @name PalletTransactionPaymentReleases (261) */
+ /** @name PalletTransactionPaymentReleases (264) */
interface PalletTransactionPaymentReleases extends Enum {
readonly isV1Ancient: boolean;
readonly isV2: boolean;
readonly type: 'V1Ancient' | 'V2';
}
- /** @name PalletTreasuryProposal (262) */
+ /** @name PalletTreasuryProposal (265) */
interface PalletTreasuryProposal extends Struct {
readonly proposer: AccountId32;
readonly value: u128;
@@ -2178,7 +2182,7 @@
readonly bond: u128;
}
- /** @name PalletTreasuryCall (264) */
+ /** @name PalletTreasuryCall (267) */
interface PalletTreasuryCall extends Enum {
readonly isProposeSpend: boolean;
readonly asProposeSpend: {
@@ -2205,10 +2209,10 @@
readonly type: 'ProposeSpend' | 'RejectProposal' | 'ApproveProposal' | 'Spend' | 'RemoveApproval';
}
- /** @name FrameSupportPalletId (266) */
+ /** @name FrameSupportPalletId (269) */
interface FrameSupportPalletId extends U8aFixed {}
- /** @name PalletTreasuryError (267) */
+ /** @name PalletTreasuryError (270) */
interface PalletTreasuryError extends Enum {
readonly isInsufficientProposersBalance: boolean;
readonly isInvalidIndex: boolean;
@@ -2218,7 +2222,7 @@
readonly type: 'InsufficientProposersBalance' | 'InvalidIndex' | 'TooManyApprovals' | 'InsufficientPermission' | 'ProposalNotApproved';
}
- /** @name PalletSudoCall (268) */
+ /** @name PalletSudoCall (271) */
interface PalletSudoCall extends Enum {
readonly isSudo: boolean;
readonly asSudo: {
@@ -2241,7 +2245,7 @@
readonly type: 'Sudo' | 'SudoUncheckedWeight' | 'SetKey' | 'SudoAs';
}
- /** @name OrmlVestingModuleCall (270) */
+ /** @name OrmlVestingModuleCall (273) */
interface OrmlVestingModuleCall extends Enum {
readonly isClaim: boolean;
readonly isVestedTransfer: boolean;
@@ -2261,7 +2265,7 @@
readonly type: 'Claim' | 'VestedTransfer' | 'UpdateVestingSchedules' | 'ClaimFor';
}
- /** @name OrmlXtokensModuleCall (272) */
+ /** @name OrmlXtokensModuleCall (275) */
interface OrmlXtokensModuleCall extends Enum {
readonly isTransfer: boolean;
readonly asTransfer: {
@@ -2308,7 +2312,7 @@
readonly type: 'Transfer' | 'TransferMultiasset' | 'TransferWithFee' | 'TransferMultiassetWithFee' | 'TransferMulticurrencies' | 'TransferMultiassets';
}
- /** @name XcmVersionedMultiAsset (273) */
+ /** @name XcmVersionedMultiAsset (276) */
interface XcmVersionedMultiAsset extends Enum {
readonly isV0: boolean;
readonly asV0: XcmV0MultiAsset;
@@ -2317,7 +2321,7 @@
readonly type: 'V0' | 'V1';
}
- /** @name OrmlTokensModuleCall (276) */
+ /** @name OrmlTokensModuleCall (279) */
interface OrmlTokensModuleCall extends Enum {
readonly isTransfer: boolean;
readonly asTransfer: {
@@ -2354,7 +2358,7 @@
readonly type: 'Transfer' | 'TransferAll' | 'TransferKeepAlive' | 'ForceTransfer' | 'SetBalance';
}
- /** @name CumulusPalletXcmpQueueCall (277) */
+ /** @name CumulusPalletXcmpQueueCall (280) */
interface CumulusPalletXcmpQueueCall extends Enum {
readonly isServiceOverweight: boolean;
readonly asServiceOverweight: {
@@ -2390,7 +2394,7 @@
readonly type: 'ServiceOverweight' | 'SuspendXcmExecution' | 'ResumeXcmExecution' | 'UpdateSuspendThreshold' | 'UpdateDropThreshold' | 'UpdateResumeThreshold' | 'UpdateThresholdWeight' | 'UpdateWeightRestrictDecay' | 'UpdateXcmpMaxIndividualWeight';
}
- /** @name PalletXcmCall (278) */
+ /** @name PalletXcmCall (281) */
interface PalletXcmCall extends Enum {
readonly isSend: boolean;
readonly asSend: {
@@ -2452,7 +2456,7 @@
readonly type: 'Send' | 'TeleportAssets' | 'ReserveTransferAssets' | 'Execute' | 'ForceXcmVersion' | 'ForceDefaultXcmVersion' | 'ForceSubscribeVersionNotify' | 'ForceUnsubscribeVersionNotify' | 'LimitedReserveTransferAssets' | 'LimitedTeleportAssets';
}
- /** @name XcmVersionedXcm (279) */
+ /** @name XcmVersionedXcm (282) */
interface XcmVersionedXcm extends Enum {
readonly isV0: boolean;
readonly asV0: XcmV0Xcm;
@@ -2463,7 +2467,7 @@
readonly type: 'V0' | 'V1' | 'V2';
}
- /** @name XcmV0Xcm (280) */
+ /** @name XcmV0Xcm (283) */
interface XcmV0Xcm extends Enum {
readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: {
@@ -2526,7 +2530,7 @@
readonly type: 'WithdrawAsset' | 'ReserveAssetDeposit' | 'TeleportAsset' | 'QueryResponse' | 'TransferAsset' | 'TransferReserveAsset' | 'Transact' | 'HrmpNewChannelOpenRequest' | 'HrmpChannelAccepted' | 'HrmpChannelClosing' | 'RelayedFrom';
}
- /** @name XcmV0Order (282) */
+ /** @name XcmV0Order (285) */
interface XcmV0Order extends Enum {
readonly isNull: boolean;
readonly isDepositAsset: boolean;
@@ -2574,14 +2578,14 @@
readonly type: 'Null' | 'DepositAsset' | 'DepositReserveAsset' | 'ExchangeAsset' | 'InitiateReserveWithdraw' | 'InitiateTeleport' | 'QueryHolding' | 'BuyExecution';
}
- /** @name XcmV0Response (284) */
+ /** @name XcmV0Response (287) */
interface XcmV0Response extends Enum {
readonly isAssets: boolean;
readonly asAssets: Vec<XcmV0MultiAsset>;
readonly type: 'Assets';
}
- /** @name XcmV1Xcm (285) */
+ /** @name XcmV1Xcm (288) */
interface XcmV1Xcm extends Enum {
readonly isWithdrawAsset: boolean;
readonly asWithdrawAsset: {
@@ -2650,7 +2654,7 @@
readonly type: 'WithdrawAsset' | 'ReserveAssetDeposited' | 'ReceiveTeleportedAsset' | 'QueryResponse' | 'TransferAsset' | 'TransferReserveAsset' | 'Transact' | 'HrmpNewChannelOpenRequest' | 'HrmpChannelAccepted' | 'HrmpChannelClosing' | 'RelayedFrom' | 'SubscribeVersion' | 'UnsubscribeVersion';
}
- /** @name XcmV1Order (287) */
+ /** @name XcmV1Order (290) */
interface XcmV1Order extends Enum {
readonly isNoop: boolean;
readonly isDepositAsset: boolean;
@@ -2700,7 +2704,7 @@
readonly type: 'Noop' | 'DepositAsset' | 'DepositReserveAsset' | 'ExchangeAsset' | 'InitiateReserveWithdraw' | 'InitiateTeleport' | 'QueryHolding' | 'BuyExecution';
}
- /** @name XcmV1Response (289) */
+ /** @name XcmV1Response (292) */
interface XcmV1Response extends Enum {
readonly isAssets: boolean;
readonly asAssets: XcmV1MultiassetMultiAssets;
@@ -2709,10 +2713,10 @@
readonly type: 'Assets' | 'Version';
}
- /** @name CumulusPalletXcmCall (303) */
+ /** @name CumulusPalletXcmCall (306) */
type CumulusPalletXcmCall = Null;
- /** @name CumulusPalletDmpQueueCall (304) */
+ /** @name CumulusPalletDmpQueueCall (307) */
interface CumulusPalletDmpQueueCall extends Enum {
readonly isServiceOverweight: boolean;
readonly asServiceOverweight: {
@@ -2722,7 +2726,7 @@
readonly type: 'ServiceOverweight';
}
- /** @name PalletInflationCall (305) */
+ /** @name PalletInflationCall (308) */
interface PalletInflationCall extends Enum {
readonly isStartInflation: boolean;
readonly asStartInflation: {
@@ -2731,7 +2735,7 @@
readonly type: 'StartInflation';
}
- /** @name PalletUniqueCall (306) */
+ /** @name PalletUniqueCall (309) */
interface PalletUniqueCall extends Enum {
readonly isCreateCollection: boolean;
readonly asCreateCollection: {
@@ -2904,7 +2908,7 @@
readonly type: 'CreateCollection' | 'CreateCollectionEx' | 'DestroyCollection' | 'AddToAllowList' | 'RemoveFromAllowList' | 'ChangeCollectionOwner' | 'AddCollectionAdmin' | 'RemoveCollectionAdmin' | 'SetCollectionSponsor' | 'ConfirmSponsorship' | 'RemoveCollectionSponsor' | 'CreateItem' | 'CreateMultipleItems' | 'SetCollectionProperties' | 'DeleteCollectionProperties' | 'SetTokenProperties' | 'DeleteTokenProperties' | 'SetTokenPropertyPermissions' | 'CreateMultipleItemsEx' | 'SetTransfersEnabledFlag' | 'BurnItem' | 'BurnFrom' | 'Transfer' | 'Approve' | 'TransferFrom' | 'SetCollectionLimits' | 'SetCollectionPermissions' | 'Repartition' | 'SetAllowanceForAll' | 'ForceRepairCollection' | 'ForceRepairItem';
}
- /** @name UpDataStructsCollectionMode (311) */
+ /** @name UpDataStructsCollectionMode (314) */
interface UpDataStructsCollectionMode extends Enum {
readonly isNft: boolean;
readonly isFungible: boolean;
@@ -2913,7 +2917,7 @@
readonly type: 'Nft' | 'Fungible' | 'ReFungible';
}
- /** @name UpDataStructsCreateCollectionData (312) */
+ /** @name UpDataStructsCreateCollectionData (315) */
interface UpDataStructsCreateCollectionData extends Struct {
readonly mode: UpDataStructsCollectionMode;
readonly access: Option<UpDataStructsAccessMode>;
@@ -2927,14 +2931,14 @@
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsAccessMode (314) */
+ /** @name UpDataStructsAccessMode (317) */
interface UpDataStructsAccessMode extends Enum {
readonly isNormal: boolean;
readonly isAllowList: boolean;
readonly type: 'Normal' | 'AllowList';
}
- /** @name UpDataStructsCollectionLimits (316) */
+ /** @name UpDataStructsCollectionLimits (319) */
interface UpDataStructsCollectionLimits extends Struct {
readonly accountTokenOwnershipLimit: Option<u32>;
readonly sponsoredDataSize: Option<u32>;
@@ -2947,7 +2951,7 @@
readonly transfersEnabled: Option<bool>;
}
- /** @name UpDataStructsSponsoringRateLimit (318) */
+ /** @name UpDataStructsSponsoringRateLimit (321) */
interface UpDataStructsSponsoringRateLimit extends Enum {
readonly isSponsoringDisabled: boolean;
readonly isBlocks: boolean;
@@ -2955,43 +2959,43 @@
readonly type: 'SponsoringDisabled' | 'Blocks';
}
- /** @name UpDataStructsCollectionPermissions (321) */
+ /** @name UpDataStructsCollectionPermissions (324) */
interface UpDataStructsCollectionPermissions extends Struct {
readonly access: Option<UpDataStructsAccessMode>;
readonly mintMode: Option<bool>;
readonly nesting: Option<UpDataStructsNestingPermissions>;
}
- /** @name UpDataStructsNestingPermissions (323) */
+ /** @name UpDataStructsNestingPermissions (326) */
interface UpDataStructsNestingPermissions extends Struct {
readonly tokenOwner: bool;
readonly collectionAdmin: bool;
readonly restricted: Option<UpDataStructsOwnerRestrictedSet>;
}
- /** @name UpDataStructsOwnerRestrictedSet (325) */
+ /** @name UpDataStructsOwnerRestrictedSet (328) */
interface UpDataStructsOwnerRestrictedSet extends BTreeSet<u32> {}
- /** @name UpDataStructsPropertyKeyPermission (330) */
+ /** @name UpDataStructsPropertyKeyPermission (333) */
interface UpDataStructsPropertyKeyPermission extends Struct {
readonly key: Bytes;
readonly permission: UpDataStructsPropertyPermission;
}
- /** @name UpDataStructsPropertyPermission (331) */
+ /** @name UpDataStructsPropertyPermission (334) */
interface UpDataStructsPropertyPermission extends Struct {
readonly mutable: bool;
readonly collectionAdmin: bool;
readonly tokenOwner: bool;
}
- /** @name UpDataStructsProperty (334) */
+ /** @name UpDataStructsProperty (337) */
interface UpDataStructsProperty extends Struct {
readonly key: Bytes;
readonly value: Bytes;
}
- /** @name UpDataStructsCreateItemData (337) */
+ /** @name UpDataStructsCreateItemData (340) */
interface UpDataStructsCreateItemData extends Enum {
readonly isNft: boolean;
readonly asNft: UpDataStructsCreateNftData;
@@ -3002,23 +3006,23 @@
readonly type: 'Nft' | 'Fungible' | 'ReFungible';
}
- /** @name UpDataStructsCreateNftData (338) */
+ /** @name UpDataStructsCreateNftData (341) */
interface UpDataStructsCreateNftData extends Struct {
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsCreateFungibleData (339) */
+ /** @name UpDataStructsCreateFungibleData (342) */
interface UpDataStructsCreateFungibleData extends Struct {
readonly value: u128;
}
- /** @name UpDataStructsCreateReFungibleData (340) */
+ /** @name UpDataStructsCreateReFungibleData (343) */
interface UpDataStructsCreateReFungibleData extends Struct {
readonly pieces: u128;
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsCreateItemExData (343) */
+ /** @name UpDataStructsCreateItemExData (346) */
interface UpDataStructsCreateItemExData extends Enum {
readonly isNft: boolean;
readonly asNft: Vec<UpDataStructsCreateNftExData>;
@@ -3031,26 +3035,26 @@
readonly type: 'Nft' | 'Fungible' | 'RefungibleMultipleItems' | 'RefungibleMultipleOwners';
}
- /** @name UpDataStructsCreateNftExData (345) */
+ /** @name UpDataStructsCreateNftExData (348) */
interface UpDataStructsCreateNftExData extends Struct {
readonly properties: Vec<UpDataStructsProperty>;
readonly owner: PalletEvmAccountBasicCrossAccountIdRepr;
}
- /** @name UpDataStructsCreateRefungibleExSingleOwner (352) */
+ /** @name UpDataStructsCreateRefungibleExSingleOwner (355) */
interface UpDataStructsCreateRefungibleExSingleOwner extends Struct {
readonly user: PalletEvmAccountBasicCrossAccountIdRepr;
readonly pieces: u128;
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name UpDataStructsCreateRefungibleExMultipleOwners (354) */
+ /** @name UpDataStructsCreateRefungibleExMultipleOwners (357) */
interface UpDataStructsCreateRefungibleExMultipleOwners extends Struct {
readonly users: BTreeMap<PalletEvmAccountBasicCrossAccountIdRepr, u128>;
readonly properties: Vec<UpDataStructsProperty>;
}
- /** @name PalletConfigurationCall (355) */
+ /** @name PalletConfigurationCall (358) */
interface PalletConfigurationCall extends Enum {
readonly isSetWeightToFeeCoefficientOverride: boolean;
readonly asSetWeightToFeeCoefficientOverride: {
@@ -3083,7 +3087,7 @@
readonly type: 'SetWeightToFeeCoefficientOverride' | 'SetMinGasPriceOverride' | 'SetXcmAllowedLocations' | 'SetAppPromotionConfigurationOverride' | 'SetCollatorSelectionDesiredCollators' | 'SetCollatorSelectionLicenseBond' | 'SetCollatorSelectionKickThreshold';
}
- /** @name PalletConfigurationAppPromotionConfiguration (360) */
+ /** @name PalletConfigurationAppPromotionConfiguration (363) */
interface PalletConfigurationAppPromotionConfiguration extends Struct {
readonly recalculationInterval: Option<u32>;
readonly pendingInterval: Option<u32>;
@@ -3091,13 +3095,13 @@
readonly maxStakersPerCalculation: Option<u8>;
}
- /** @name PalletTemplateTransactionPaymentCall (364) */
+ /** @name PalletTemplateTransactionPaymentCall (367) */
type PalletTemplateTransactionPaymentCall = Null;
- /** @name PalletStructureCall (365) */
+ /** @name PalletStructureCall (368) */
type PalletStructureCall = Null;
- /** @name PalletRmrkCoreCall (366) */
+ /** @name PalletRmrkCoreCall (369) */
interface PalletRmrkCoreCall extends Enum {
readonly isCreateCollection: boolean;
readonly asCreateCollection: {
@@ -3203,7 +3207,7 @@
readonly type: 'CreateCollection' | 'DestroyCollection' | 'ChangeCollectionIssuer' | 'LockCollection' | 'MintNft' | 'BurnNft' | 'Send' | 'AcceptNft' | 'RejectNft' | 'AcceptResource' | 'AcceptResourceRemoval' | 'SetProperty' | 'SetPriority' | 'AddBasicResource' | 'AddComposableResource' | 'AddSlotResource' | 'RemoveResource';
}
- /** @name RmrkTraitsResourceResourceTypes (372) */
+ /** @name RmrkTraitsResourceResourceTypes (375) */
interface RmrkTraitsResourceResourceTypes extends Enum {
readonly isBasic: boolean;
readonly asBasic: RmrkTraitsResourceBasicResource;
@@ -3214,7 +3218,7 @@
readonly type: 'Basic' | 'Composable' | 'Slot';
}
- /** @name RmrkTraitsResourceBasicResource (374) */
+ /** @name RmrkTraitsResourceBasicResource (377) */
interface RmrkTraitsResourceBasicResource extends Struct {
readonly src: Option<Bytes>;
readonly metadata: Option<Bytes>;
@@ -3222,7 +3226,7 @@
readonly thumb: Option<Bytes>;
}
- /** @name RmrkTraitsResourceComposableResource (376) */
+ /** @name RmrkTraitsResourceComposableResource (379) */
interface RmrkTraitsResourceComposableResource extends Struct {
readonly parts: Vec<u32>;
readonly base: u32;
@@ -3232,7 +3236,7 @@
readonly thumb: Option<Bytes>;
}
- /** @name RmrkTraitsResourceSlotResource (377) */
+ /** @name RmrkTraitsResourceSlotResource (380) */
interface RmrkTraitsResourceSlotResource extends Struct {
readonly base: u32;
readonly src: Option<Bytes>;
@@ -3242,7 +3246,7 @@
readonly thumb: Option<Bytes>;
}
- /** @name PalletRmrkEquipCall (380) */
+ /** @name PalletRmrkEquipCall (383) */
interface PalletRmrkEquipCall extends Enum {
readonly isCreateBase: boolean;
readonly asCreateBase: {
@@ -3264,7 +3268,7 @@
readonly type: 'CreateBase' | 'ThemeAdd' | 'Equippable';
}
- /** @name RmrkTraitsPartPartType (383) */
+ /** @name RmrkTraitsPartPartType (386) */
interface RmrkTraitsPartPartType extends Enum {
readonly isFixedPart: boolean;
readonly asFixedPart: RmrkTraitsPartFixedPart;
@@ -3273,14 +3277,14 @@
readonly type: 'FixedPart' | 'SlotPart';
}
- /** @name RmrkTraitsPartFixedPart (385) */
+ /** @name RmrkTraitsPartFixedPart (388) */
interface RmrkTraitsPartFixedPart extends Struct {
readonly id: u32;
readonly z: u32;
readonly src: Bytes;
}
- /** @name RmrkTraitsPartSlotPart (386) */
+ /** @name RmrkTraitsPartSlotPart (389) */
interface RmrkTraitsPartSlotPart extends Struct {
readonly id: u32;
readonly equippable: RmrkTraitsPartEquippableList;
@@ -3288,7 +3292,7 @@
readonly z: u32;
}
- /** @name RmrkTraitsPartEquippableList (387) */
+ /** @name RmrkTraitsPartEquippableList (390) */
interface RmrkTraitsPartEquippableList extends Enum {
readonly isAll: boolean;
readonly isEmpty: boolean;
@@ -3297,20 +3301,20 @@
readonly type: 'All' | 'Empty' | 'Custom';
}
- /** @name RmrkTraitsTheme (389) */
+ /** @name RmrkTraitsTheme (392) */
interface RmrkTraitsTheme extends Struct {
readonly name: Bytes;
readonly properties: Vec<RmrkTraitsThemeThemeProperty>;
readonly inherit: bool;
}
- /** @name RmrkTraitsThemeThemeProperty (391) */
+ /** @name RmrkTraitsThemeThemeProperty (394) */
interface RmrkTraitsThemeThemeProperty extends Struct {
readonly key: Bytes;
readonly value: Bytes;
}
- /** @name PalletAppPromotionCall (393) */
+ /** @name PalletAppPromotionCall (396) */
interface PalletAppPromotionCall extends Enum {
readonly isSetAdminAddress: boolean;
readonly asSetAdminAddress: {
@@ -3344,7 +3348,7 @@
readonly type: 'SetAdminAddress' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsoringCollection' | 'SponsorContract' | 'StopSponsoringContract' | 'PayoutStakers';
}
- /** @name PalletForeignAssetsModuleCall (394) */
+ /** @name PalletForeignAssetsModuleCall (397) */
interface PalletForeignAssetsModuleCall extends Enum {
readonly isRegisterForeignAsset: boolean;
readonly asRegisterForeignAsset: {
@@ -3361,7 +3365,7 @@
readonly type: 'RegisterForeignAsset' | 'UpdateForeignAsset';
}
- /** @name PalletEvmCall (395) */
+ /** @name PalletEvmCall (398) */
interface PalletEvmCall extends Enum {
readonly isWithdraw: boolean;
readonly asWithdraw: {
@@ -3406,7 +3410,7 @@
readonly type: 'Withdraw' | 'Call' | 'Create' | 'Create2';
}
- /** @name PalletEthereumCall (401) */
+ /** @name PalletEthereumCall (404) */
interface PalletEthereumCall extends Enum {
readonly isTransact: boolean;
readonly asTransact: {
@@ -3415,7 +3419,7 @@
readonly type: 'Transact';
}
- /** @name EthereumTransactionTransactionV2 (402) */
+ /** @name EthereumTransactionTransactionV2 (405) */
interface EthereumTransactionTransactionV2 extends Enum {
readonly isLegacy: boolean;
readonly asLegacy: EthereumTransactionLegacyTransaction;
@@ -3426,7 +3430,7 @@
readonly type: 'Legacy' | 'Eip2930' | 'Eip1559';
}
- /** @name EthereumTransactionLegacyTransaction (403) */
+ /** @name EthereumTransactionLegacyTransaction (406) */
interface EthereumTransactionLegacyTransaction extends Struct {
readonly nonce: U256;
readonly gasPrice: U256;
@@ -3437,7 +3441,7 @@
readonly signature: EthereumTransactionTransactionSignature;
}
- /** @name EthereumTransactionTransactionAction (404) */
+ /** @name EthereumTransactionTransactionAction (407) */
interface EthereumTransactionTransactionAction extends Enum {
readonly isCall: boolean;
readonly asCall: H160;
@@ -3445,14 +3449,14 @@
readonly type: 'Call' | 'Create';
}
- /** @name EthereumTransactionTransactionSignature (405) */
+ /** @name EthereumTransactionTransactionSignature (408) */
interface EthereumTransactionTransactionSignature extends Struct {
readonly v: u64;
readonly r: H256;
readonly s: H256;
}
- /** @name EthereumTransactionEip2930Transaction (407) */
+ /** @name EthereumTransactionEip2930Transaction (410) */
interface EthereumTransactionEip2930Transaction extends Struct {
readonly chainId: u64;
readonly nonce: U256;
@@ -3467,13 +3471,13 @@
readonly s: H256;
}
- /** @name EthereumTransactionAccessListItem (409) */
+ /** @name EthereumTransactionAccessListItem (412) */
interface EthereumTransactionAccessListItem extends Struct {
readonly address: H160;
readonly storageKeys: Vec<H256>;
}
- /** @name EthereumTransactionEip1559Transaction (410) */
+ /** @name EthereumTransactionEip1559Transaction (413) */
interface EthereumTransactionEip1559Transaction extends Struct {
readonly chainId: u64;
readonly nonce: U256;
@@ -3489,7 +3493,7 @@
readonly s: H256;
}
- /** @name PalletDataManagementCall (411) */
+ /** @name PalletDataManagementCall (414) */
interface PalletDataManagementCall extends Enum {
readonly isBegin: boolean;
readonly asBegin: {
@@ -3513,11 +3517,7 @@
readonly asInsertEvents: {
readonly events: Vec<Bytes>;
} & Struct;
- readonly isSetIdentities: boolean;
- readonly asSetIdentities: {
- readonly identities: Vec<ITuple<[AccountId32, Option<PalletIdentityRegistration>]>>;
- } & Struct;
- readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents' | 'SetIdentities';
+ readonly type: 'Begin' | 'SetData' | 'Finish' | 'InsertEthLogs' | 'InsertEvents';
}
/** @name PalletMaintenanceCall (418) */
tests/src/pallet-presence.test.tsdiffbeforeafterboth--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -69,7 +69,7 @@
const collatorSelection = ['authorship', 'session', 'collatorselection', 'identity'];
const testUtils = 'testutils';
- if (chain.eq('OPAL by UNIQUE')) {
+ if (chain.eq('OPAL by UNIQUE') || chain.eq('SAPPHIRE by UNIQUE')) {
requiredPallets.push(
refungible,
foreignAssets,
tests/src/util/identitySetter.tsdiffbeforeafterboth--- a/tests/src/util/identitySetter.ts
+++ b/tests/src/util/identitySetter.ts
@@ -33,7 +33,7 @@
try {
const superuser = await privateKey(key);
// todo:collator
- await helper.getSudo().executeExtrinsic(superuser, 'api.tx.dataManagement.setIdentities', [identities]);
+ await helper.getSudo().executeExtrinsic(superuser, 'api.tx.identity.setIdentities', [identities]);
console.log(`Tried to upload ${identities.length} identities. `
+ `Now there are ${(await helper.getApi().query.identity.identityOf.keys()).length}.`);
} catch (error) {
tests/src/util/playgrounds/unique.dev.tsdiffbeforeafterboth--- a/tests/src/util/playgrounds/unique.dev.ts
+++ b/tests/src/util/playgrounds/unique.dev.ts
@@ -257,16 +257,17 @@
const accounts: IKeyringPair[] = [];
let nonce = await this.helper.chain.getNonce(donor.address);
const tokenNominal = this.helper.balance.getOneTokenNominal();
+ const ss58Format = this.helper.chain.getChainProperties().ss58Format;
for (let i = 0; i < accountsToCreate; i++) {
if (i === 500) { // if there are too many accounts to create
await Promise.allSettled(transactions); // wait while first 500 (should be 100 for devnode) tx will be settled
transactions = []; //
nonce = await this.helper.chain.getNonce(donor.address); // update nonce
}
- const recepient = this.helper.util.fromSeed(mnemonicGenerate());
- accounts.push(recepient);
+ const recipient = this.helper.util.fromSeed(mnemonicGenerate(), ss58Format);
+ accounts.push(recipient);
if (withBalance !== 0n) {
- const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recepient.address}, withBalance * tokenNominal]);
+ const tx = this.helper.constructApiCall('api.tx.balances.transfer', [{Id: recipient.address}, withBalance * tokenNominal]);
transactions.push(this.helper.signTransaction(donor, tx, {nonce}, 'account generation'));
nonce++;
}