mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 05:51:02 +00:00
Fix identity benchmark (#5229)
* Set identity before calling set_subs. * Remove -1.
This commit is contained in:
@@ -62,6 +62,12 @@ fn add_sub_accounts<T: Trait>(who: T::AccountId, s: u32) -> Result<Vec<(T::Accou
|
||||
let sub_account = account::<T>("sub", i);
|
||||
subs.push((sub_account, data.clone()));
|
||||
}
|
||||
|
||||
// Set identity so `set_subs` does not fail.
|
||||
let _ = T::Currency::make_free_balance_be(&who, BalanceOf::<T>::max_value());
|
||||
let info = create_identity_info::<T>(1);
|
||||
Identity::<T>::set_identity(who_origin.clone().into(), info)?;
|
||||
|
||||
Identity::<T>::set_subs(who_origin.into(), subs.clone())?;
|
||||
|
||||
return Ok(subs)
|
||||
@@ -147,19 +153,8 @@ benchmarks! {
|
||||
|
||||
let caller = account::<T>("caller", 0);
|
||||
let caller_origin: <T as frame_system::Trait>::Origin = RawOrigin::Signed(caller.clone()).into();
|
||||
let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::<T>::max_value());
|
||||
|
||||
// Create their main identity
|
||||
let info = create_identity_info::<T>(1);
|
||||
Identity::<T>::set_identity(caller_origin, info)?;
|
||||
}: _(RawOrigin::Signed(caller), {
|
||||
let mut subs = Module::<T>::subs(&caller);
|
||||
// Generic data to be used.
|
||||
let data = Data::Raw(vec![0; 32]);
|
||||
// Create an s+1 sub account to add
|
||||
subs.push((account::<T>("sub", s + 1), data));
|
||||
subs
|
||||
})
|
||||
let subs = Module::<T>::subs(&caller);
|
||||
}: _(RawOrigin::Signed(caller), subs)
|
||||
|
||||
clear_identity {
|
||||
let caller = account::<T>("caller", 0);
|
||||
|
||||
Reference in New Issue
Block a user