mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 15:51:04 +00:00
identity: Don't let subs be re-registered (#6667)
* Fixes and tests * Don't set subs be re-registered. Also allow subs to de-register themselves and collect the deposit. Also allow individual registering and removal of subs. * Make it build * Update frame/identity/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Tests * Add benchmarks * Add some reasonable weights * Docs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
@@ -172,6 +172,48 @@ benchmarks! {
|
||||
|
||||
}: _(RawOrigin::Signed(caller), subs)
|
||||
|
||||
add_sub {
|
||||
let caller = account::<T>("caller", 0);
|
||||
|
||||
// Give them p many previous sub accounts.
|
||||
let p in 1 .. T::MaxSubAccounts::get() - 1 => {
|
||||
let _ = add_sub_accounts::<T>(&caller, p)?;
|
||||
};
|
||||
let sub = account::<T>("new_sub", 0);
|
||||
let data = Data::Raw(vec![0; 32]);
|
||||
}: _(RawOrigin::Signed(caller), T::Lookup::unlookup(sub), data)
|
||||
|
||||
rename_sub {
|
||||
let caller = account::<T>("caller", 0);
|
||||
|
||||
let p in 1 .. T::MaxSubAccounts::get();
|
||||
|
||||
// Give them p many previous sub accounts.
|
||||
let (sub, _) = add_sub_accounts::<T>(&caller, p)?.remove(0);
|
||||
let data = Data::Raw(vec![1; 32]);
|
||||
|
||||
}: _(RawOrigin::Signed(caller), T::Lookup::unlookup(sub), data)
|
||||
|
||||
remove_sub {
|
||||
let caller = account::<T>("caller", 0);
|
||||
|
||||
// Give them p many previous sub accounts.
|
||||
let p in 1 .. T::MaxSubAccounts::get();
|
||||
let (sub, _) = add_sub_accounts::<T>(&caller, p)?.remove(0);
|
||||
}: _(RawOrigin::Signed(caller), T::Lookup::unlookup(sub))
|
||||
|
||||
quit_sub {
|
||||
let caller = account::<T>("caller", 0);
|
||||
let sup = account::<T>("super", 0);
|
||||
|
||||
// Give them p many previous sub accounts.
|
||||
let p in 1 .. T::MaxSubAccounts::get() - 1 => {
|
||||
let _ = add_sub_accounts::<T>(&sup, p)?;
|
||||
};
|
||||
let sup_origin = RawOrigin::Signed(sup).into();
|
||||
Identity::<T>::add_sub(sup_origin, T::Lookup::unlookup(caller.clone()), Data::Raw(vec![0; 32]))?;
|
||||
}: _(RawOrigin::Signed(caller))
|
||||
|
||||
clear_identity {
|
||||
let caller = account::<T>("caller", 0);
|
||||
let caller_origin = <T as frame_system::Trait>::Origin::from(RawOrigin::Signed(caller.clone()));
|
||||
|
||||
Reference in New Issue
Block a user