Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jg/refactor pallet identity to fungibles #6370

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl pallet_identity::Config for Runtime {
type ForceOrigin = EnsureRoot<Self::AccountId>;
type RegistrarOrigin = EnsureRoot<Self::AccountId>;
type WeightInfo = weights::pallet_identity::WeightInfo<Runtime>;
type RuntimeHoldReason = RuntimeHoldReason;
}

/// The fields that we use to identify the owner of an account with. Each corresponds to a field
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl pallet_identity::Config for Runtime {
type ForceOrigin = EnsureRoot<Self::AccountId>;
type RegistrarOrigin = EnsureRoot<Self::AccountId>;
type WeightInfo = weights::pallet_identity::WeightInfo<Runtime>;
type RuntimeHoldReason = RuntimeHoldReason;
}

/// The fields that we use to identify the owner of an account with. Each corresponds to a field
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/common/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ impl pallet_identity::Config for Test {
type RegistrarOrigin = EnsureRoot<AccountId>;
type ForceOrigin = EnsureRoot<AccountId>;
type WeightInfo = ();
type RuntimeHoldReason = RuntimeHoldReason;
}

impl identity_migrator::Config for Test {
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ impl pallet_identity::Config for Runtime {
type ForceOrigin = EitherOf<EnsureRoot<Self::AccountId>, GeneralAdmin>;
type RegistrarOrigin = EitherOf<EnsureRoot<Self::AccountId>, GeneralAdmin>;
type WeightInfo = weights::pallet_identity::WeightInfo<Runtime>;
type RuntimeHoldReason = RuntimeHoldReason;
}

impl pallet_utility::Config for Runtime {
Expand Down
1 change: 1 addition & 0 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ impl pallet_identity::Config for Runtime {
type ForceOrigin = EitherOf<EnsureRoot<Self::AccountId>, GeneralAdmin>;
type RegistrarOrigin = EitherOf<EnsureRoot<Self::AccountId>, GeneralAdmin>;
type WeightInfo = weights::pallet_identity::WeightInfo<Runtime>;
type RuntimeHoldReason = RuntimeHoldReason;
}

impl pallet_utility::Config for Runtime {
Expand Down
1 change: 1 addition & 0 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,6 +1496,7 @@ impl pallet_identity::Config for Runtime {
type ForceOrigin = EnsureRootOrHalfCouncil;
type RegistrarOrigin = EnsureRootOrHalfCouncil;
type WeightInfo = pallet_identity::weights::SubstrateWeight<Runtime>;
type RuntimeHoldReason = RuntimeHoldReason;
}

parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions substrate/frame/alliance/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ impl pallet_identity::Config for Test {
type RegistrarOrigin = EnsureOneOrRoot;
type ForceOrigin = EnsureTwoOrRoot;
type WeightInfo = ();
type RuntimeHoldReason = RuntimeHoldReason;
}

pub struct AllianceIdentityVerifier;
Expand Down
28 changes: 14 additions & 14 deletions substrate/frame/identity/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn add_registrars<T: Config>(r: u32) -> Result<(), &'static str> {
for i in 0..r {
let registrar: T::AccountId = account("registrar", i, SEED);
let registrar_lookup = T::Lookup::unlookup(registrar.clone());
let _ = T::Currency::make_free_balance_be(&registrar, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&registrar, BalanceOf::<T>::max_value());
let registrar_origin = T::RegistrarOrigin::try_successful_origin()
.expect("RegistrarOrigin has no successful origin required for the benchmark");
Identity::<T>::add_registrar(registrar_origin, registrar_lookup)?;
Expand Down Expand Up @@ -73,7 +73,7 @@ fn create_sub_accounts<T: Config>(

// Set identity so `set_subs` does not fail.
if IdentityOf::<T>::get(who).is_none() {
let _ = T::Currency::make_free_balance_be(who, BalanceOf::<T>::max_value() / 2u32.into());
let _ = T::Currency::set_balance(who, BalanceOf::<T>::max_value() / 2u32.into());
let info = T::IdentityInformation::create_identity_info();
Identity::<T>::set_identity(who_origin.into(), Box::new(info))?;
}
Expand Down Expand Up @@ -122,7 +122,7 @@ mod benchmarks {
let caller_lookup = T::Lookup::unlookup(caller.clone());
let caller_origin: <T as frame_system::Config>::RuntimeOrigin =
RawOrigin::Signed(caller.clone()).into();
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&caller, BalanceOf::<T>::max_value() / 2u32.into());

// Add an initial identity
let initial_info = T::IdentityInformation::create_identity_info();
Expand All @@ -133,7 +133,7 @@ mod benchmarks {
let registrar: T::AccountId = account("registrar", i, SEED);
let _ = T::Lookup::unlookup(registrar.clone());
let balance_to_use = T::Currency::minimum_balance() * 10u32.into();
let _ = T::Currency::make_free_balance_be(&registrar, balance_to_use);
let _ = T::Currency::set_balance(&registrar, balance_to_use);

Identity::<T>::request_judgement(caller_origin.clone(), i, 10u32.into())?;
Identity::<T>::provide_judgement(
Expand Down Expand Up @@ -200,7 +200,7 @@ mod benchmarks {
let caller_origin =
<T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(caller.clone()));
let caller_lookup = <T::Lookup as StaticLookup>::unlookup(caller.clone());
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&caller, BalanceOf::<T>::max_value());

// Register the registrars
add_registrars::<T>(r)?;
Expand All @@ -216,7 +216,7 @@ mod benchmarks {
for i in 0..r {
let registrar: T::AccountId = account("registrar", i, SEED);
let balance_to_use = T::Currency::minimum_balance() * 10u32.into();
let _ = T::Currency::make_free_balance_be(&registrar, balance_to_use);
let _ = T::Currency::set_balance(&registrar, balance_to_use);

Identity::<T>::request_judgement(caller_origin.clone(), i, 10u32.into())?;
Identity::<T>::provide_judgement(
Expand All @@ -240,7 +240,7 @@ mod benchmarks {
#[benchmark]
fn request_judgement(r: Linear<1, { T::MaxRegistrars::get() }>) -> Result<(), BenchmarkError> {
let caller: T::AccountId = whitelisted_caller();
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&caller, BalanceOf::<T>::max_value() / 2u32.into());

// Register the registrars
add_registrars::<T>(r)?;
Expand All @@ -264,7 +264,7 @@ mod benchmarks {
#[benchmark]
fn cancel_request(r: Linear<1, { T::MaxRegistrars::get() }>) -> Result<(), BenchmarkError> {
let caller: T::AccountId = whitelisted_caller();
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&caller, BalanceOf::<T>::max_value() / 2u32.into());

// Register the registrars
add_registrars::<T>(r)?;
Expand Down Expand Up @@ -317,7 +317,7 @@ mod benchmarks {
fn set_account_id(r: Linear<1, { T::MaxRegistrars::get() - 1 }>) -> Result<(), BenchmarkError> {
let caller: T::AccountId = whitelisted_caller();
let caller_lookup = T::Lookup::unlookup(caller.clone());
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&caller, BalanceOf::<T>::max_value());

add_registrars::<T>(r)?;

Expand Down Expand Up @@ -346,7 +346,7 @@ mod benchmarks {
fn set_fields(r: Linear<1, { T::MaxRegistrars::get() - 1 }>) -> Result<(), BenchmarkError> {
let caller: T::AccountId = whitelisted_caller();
let caller_lookup = T::Lookup::unlookup(caller.clone());
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&caller, BalanceOf::<T>::max_value());

add_registrars::<T>(r)?;

Expand Down Expand Up @@ -382,11 +382,11 @@ mod benchmarks {
let user_origin =
<T as frame_system::Config>::RuntimeOrigin::from(RawOrigin::Signed(user.clone()));
let user_lookup = <T::Lookup as StaticLookup>::unlookup(user.clone());
let _ = T::Currency::make_free_balance_be(&user, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&user, BalanceOf::<T>::max_value() / 2u32.into());

let caller: T::AccountId = whitelisted_caller();
let caller_lookup = T::Lookup::unlookup(caller.clone());
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&caller, BalanceOf::<T>::max_value() / 2u32.into());

add_registrars::<T>(r)?;

Expand Down Expand Up @@ -420,7 +420,7 @@ mod benchmarks {
let target_origin: <T as frame_system::Config>::RuntimeOrigin =
RawOrigin::Signed(target.clone()).into();
let target_lookup = T::Lookup::unlookup(target.clone());
let _ = T::Currency::make_free_balance_be(&target, BalanceOf::<T>::max_value());
let _ = T::Currency::set_balance(&target, BalanceOf::<T>::max_value() / 2u32.into());

let info = T::IdentityInformation::create_identity_info();
Identity::<T>::set_identity(target_origin.clone(), Box::new(info.clone()))?;
Expand All @@ -430,7 +430,7 @@ mod benchmarks {
for i in 0..r {
let registrar: T::AccountId = account("registrar", i, SEED);
let balance_to_use = T::Currency::minimum_balance() * 10u32.into();
let _ = T::Currency::make_free_balance_be(&registrar, balance_to_use);
let _ = T::Currency::set_balance(&registrar, balance_to_use);

Identity::<T>::request_judgement(target_origin.clone(), i, 10u32.into())?;
Identity::<T>::provide_judgement(
Expand Down
Loading
Loading