mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 20:31:13 +00:00
Fix Benchmarks to enable batch run (#5523)
* some fixes * Update tips benchmark to be resiliant to genesis * Update Cargo.lock
This commit is contained in:
@@ -58,12 +58,15 @@ fn setup_awesome<T: Trait>(length: u32) -> (T::AccountId, Vec<u8>, T::AccountId)
|
||||
fn setup_tip<T: Trait>(r: u32, t: u32) ->
|
||||
Result<(T::AccountId, Vec<u8>, T::AccountId, BalanceOf<T>), &'static str>
|
||||
{
|
||||
let tippers_count = T::Tippers::count();
|
||||
|
||||
for i in 0 .. t {
|
||||
let member = account("member", i, SEED);
|
||||
T::Tippers::add(&member);
|
||||
ensure!(T::Tippers::contains(&member), "failed to add tipper");
|
||||
}
|
||||
|
||||
ensure!(T::Tippers::count() == t as usize, "problem creating tippers");
|
||||
ensure!(T::Tippers::count() == tippers_count + t as usize, "problem creating tippers");
|
||||
let caller = account("member", t - 1, SEED);
|
||||
let reason = vec![0; r as usize];
|
||||
let beneficiary = account("beneficiary", t, SEED);
|
||||
@@ -71,16 +74,19 @@ fn setup_tip<T: Trait>(r: u32, t: u32) ->
|
||||
Ok((caller, reason, beneficiary, value))
|
||||
}
|
||||
|
||||
// Create `t` new types for the tip proposal with `hash`.
|
||||
// This function automatically moves forward the block number to a time which
|
||||
// would resolve the tipping process.
|
||||
// Create `t` new tips for the tip proposal with `hash`.
|
||||
// This function automatically makes the tip able to close.
|
||||
fn create_tips<T: Trait>(t: u32, hash: T::Hash, value: BalanceOf<T>) -> Result<(), &'static str> {
|
||||
for i in 0 .. t {
|
||||
let caller = account("member", i, SEED);
|
||||
ensure!(T::Tippers::contains(&caller), "caller is not a tipper");
|
||||
Treasury::<T>::tip(RawOrigin::Signed(caller).into(), hash, value)?;
|
||||
}
|
||||
frame_system::Module::<T>::set_block_number(T::TipCountdown::get() * 10.into());
|
||||
Tips::<T>::mutate(hash, |maybe_tip| {
|
||||
if let Some(open_tip) = maybe_tip {
|
||||
open_tip.closes = Some(T::BlockNumber::zero());
|
||||
}
|
||||
});
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user