mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 02:48:03 +00:00
Fix vesting benchmark (#5269)
* Fix vesting bench starting block. * Set subs s+1 to hit worst path. * Remove unused origin. * Apply review suggestions.
This commit is contained in:
@@ -53,7 +53,7 @@ fn add_registrars<T: Trait>(r: u32) -> Result<(), &'static str> {
|
||||
|
||||
// Adds `s` sub-accounts to the identity of `who`. Each wil have 32 bytes of raw data added to it.
|
||||
// This additionally returns the vector of sub-accounts to it can be modified if needed.
|
||||
fn add_sub_accounts<T: Trait>(who: T::AccountId, s: u32) -> Result<Vec<(T::AccountId, Data)>, &'static str> {
|
||||
fn add_sub_accounts<T: Trait>(who: &T::AccountId, s: u32) -> Result<Vec<(T::AccountId, Data)>, &'static str> {
|
||||
let mut subs = Vec::new();
|
||||
let who_origin = RawOrigin::Signed(who.clone());
|
||||
let data = Data::Raw(vec![0; 32]);
|
||||
@@ -100,7 +100,7 @@ benchmarks! {
|
||||
let s in 1 .. T::MaxSubAccounts::get() => {
|
||||
// Give them s many sub accounts
|
||||
let caller = account::<T>("caller", 0);
|
||||
let _ = add_sub_accounts::<T>(caller, s)?;
|
||||
let _ = add_sub_accounts::<T>(&caller, s)?;
|
||||
};
|
||||
let x in 1 .. T::MaxAdditionalFields::get() => {
|
||||
// Create their main identity with x additional fields
|
||||
@@ -149,11 +149,19 @@ benchmarks! {
|
||||
)
|
||||
|
||||
set_subs {
|
||||
let s in ...;
|
||||
|
||||
let caller = account::<T>("caller", 0);
|
||||
let caller_origin: <T as frame_system::Trait>::Origin = RawOrigin::Signed(caller.clone()).into();
|
||||
let subs = Module::<T>::subs(&caller);
|
||||
|
||||
// Give them s many sub accounts.
|
||||
let s in 1 .. T::MaxSubAccounts::get() - 1 => {
|
||||
let _ = add_sub_accounts::<T>(&caller, s)?;
|
||||
};
|
||||
|
||||
let mut subs = Module::<T>::subs(&caller);
|
||||
|
||||
// Create an s + 1 sub account.
|
||||
let data = Data::Raw(vec![0; 32]);
|
||||
subs.push((account::<T>("sub", s + 1), data));
|
||||
|
||||
}: _(RawOrigin::Signed(caller), subs)
|
||||
|
||||
clear_identity {
|
||||
|
||||
Reference in New Issue
Block a user