Skip to content
Snippets Groups Projects
Commit 74ed6978 authored by Marcio Diaz's avatar Marcio Diaz Committed by GitHub
Browse files

Fix identity benchmark (#5229)

* Set identity before calling set_subs.

* Remove -1.
parent abb67d1e
No related merge requests found
......@@ -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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment