diff --git a/substrate/frame/identity/src/benchmarking.rs b/substrate/frame/identity/src/benchmarking.rs index b7a81956a5..87d577c4d8 100644 --- a/substrate/frame/identity/src/benchmarking.rs +++ b/substrate/frame/identity/src/benchmarking.rs @@ -62,6 +62,12 @@ fn add_sub_accounts(who: T::AccountId, s: u32) -> Result("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::::max_value()); + let info = create_identity_info::(1); + Identity::::set_identity(who_origin.clone().into(), info)?; + Identity::::set_subs(who_origin.into(), subs.clone())?; return Ok(subs) @@ -147,19 +153,8 @@ benchmarks! { let caller = account::("caller", 0); let caller_origin: ::Origin = RawOrigin::Signed(caller.clone()).into(); - let _ = T::Currency::make_free_balance_be(&caller, BalanceOf::::max_value()); - - // Create their main identity - let info = create_identity_info::(1); - Identity::::set_identity(caller_origin, info)?; - }: _(RawOrigin::Signed(caller), { - let mut subs = Module::::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::("sub", s + 1), data)); - subs - }) + let subs = Module::::subs(&caller); + }: _(RawOrigin::Signed(caller), subs) clear_identity { let caller = account::("caller", 0);