mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 04:11:07 +00:00
Make IdentityInfo generic in pallet-identity (#1661)
Fixes #179 # Description This PR makes the structure containing identity information used in `pallet-identity` generic through the pallet `Config`. Additionally, the old structure is now available in a separate module called `simple` (pending rename) and is compatible with the new interface. Another change in this PR is that while the `additional` field in `IdentityInfo` stays for backwards compatibility reasons, the associated costs are stil present in the pallet through the `additional` function in the `IdentityInformationProvider` interface. This function is marked as deprecated as it is only a temporary solution to the backwards compatibility problem we had. In short, we could have removed the additional fields in the struct and done a migration, but we chose to wait and do it off-chain through the genesis of the system parachain. After we move the identity pallet to the parachain, additional fields will be migrated into the existing fields and the `additional` key-value store will be removed. Until that happens, this interface will provide the necessary information to properly account for the associated costs. Additionally, this PR fixes an unrelated issue; the `IdentityField` enum used to represent the fields as bitflags couldn't store more than 8 fields, even though it was marked as `#[repr(u64)]`. This was because of the `derive` implementation of `TypeInfo`, which assumed `u8` semantics. The custom implementation of this trait in https://github.com/paritytech/polkadot-sdk/commit/0105cc0396b7a53d0b290f48b1225847f6d17321 fixes the issue. --------- Signed-off-by: georgepisaltu <george.pisaltu@parity.io> Co-authored-by: Sam Johnson <sam@durosoft.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
@@ -112,7 +112,7 @@ use frame_support::{
|
||||
},
|
||||
weights::Weight,
|
||||
};
|
||||
use pallet_identity::IdentityField;
|
||||
use pallet_identity::simple::IdentityField;
|
||||
use scale_info::TypeInfo;
|
||||
|
||||
pub use pallet::*;
|
||||
|
||||
@@ -31,7 +31,7 @@ pub use frame_support::{
|
||||
BoundedVec,
|
||||
};
|
||||
use frame_system::{EnsureRoot, EnsureSignedBy};
|
||||
use pallet_identity::{Data, IdentityInfo, Judgement};
|
||||
use pallet_identity::{simple::IdentityInfo, Data, Judgement};
|
||||
|
||||
pub use crate as pallet_alliance;
|
||||
|
||||
@@ -121,6 +121,7 @@ impl pallet_identity::Config for Test {
|
||||
type SubAccountDeposit = SubAccountDeposit;
|
||||
type MaxSubAccounts = MaxSubAccounts;
|
||||
type MaxAdditionalFields = MaxAdditionalFields;
|
||||
type IdentityInformation = IdentityInfo<MaxAdditionalFields>;
|
||||
type MaxRegistrars = MaxRegistrars;
|
||||
type Slashed = ();
|
||||
type RegistrarOrigin = EnsureOneOrRoot;
|
||||
|
||||
Reference in New Issue
Block a user