Skip to content

Commit

Permalink
fix bench
Browse files Browse the repository at this point in the history
  • Loading branch information
asiniscalchi committed Dec 12, 2024
1 parent ae8b293 commit 0a97917
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
14 changes: 13 additions & 1 deletion pallets/treasury-funding/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ mod benchmarks {
#[benchmark]
fn fund_treasury() {
let caller: T::AccountId = whitelisted_caller();
assert_ok!(pallet_balances::Pallet::<T>::force_set_balance(
RawOrigin::Root.into(),
T::Lookup::unlookup(caller.clone()),
20000000000000000000000000_u128.saturated_into()
));

let vault_account = Pallet::<T>::account_id();

Expand All @@ -28,8 +33,10 @@ mod benchmarks {
let treasury_amount = pallet_balances::Pallet::<T>::free_balance(&treasury_account);
assert_eq!(treasury_amount, 10000000000000000000000000_u128.saturated_into());

assert_eq!(pallet_balances::Pallet::<T>::free_balance(&vault_account), 0_u32.into());

assert_ok!(pallet_vesting::Pallet::<T>::vested_transfer(
RawOrigin::Signed(vault_account.clone()).into(),
RawOrigin::Signed(caller.clone()).into(),
T::Lookup::unlookup(vault_account.clone()),
pallet_vesting::VestingInfo::new(
amount.saturated_into(),
Expand All @@ -38,6 +45,11 @@ mod benchmarks {
),
));

assert_eq!(
pallet_balances::Pallet::<T>::free_balance(&vault_account),
amount.saturated_into()
);

frame_system::Pallet::<T>::set_block_number(1001_u32.into());
assert_eq!(frame_system::Pallet::<T>::block_number(), 1001_u32.into());

Expand Down
8 changes: 4 additions & 4 deletions runtime/laos/src/weights/pallet_treasury_funding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ impl<T: frame_system::Config> pallet_treasury_funding::WeightInfo for WeightInfo
/// Proof: `Balances::Locks` (`max_values`: None, `max_size`: Some(1287), added: 3762, mode: `MaxEncodedLen`)
/// Storage: `Balances::Freezes` (r:1 w:0)
/// Proof: `Balances::Freezes` (`max_values`: None, `max_size`: Some(887), added: 3362, mode: `MaxEncodedLen`)
/// Storage: `System::Account` (r:2 w:1)
/// Storage: `System::Account` (r:2 w:2)
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(116), added: 2591, mode: `MaxEncodedLen`)
fn fund_treasury() -> Weight {
// Proof Size summary in bytes:
// Measured: `499`
// Estimated: `6172`
// Minimum execution time: 62_639_000 picoseconds.
Weight::from_parts(64_462_000, 0)
// Minimum execution time: 82_036_000 picoseconds.
Weight::from_parts(83_699_000, 0)
.saturating_add(Weight::from_parts(0, 6172))
.saturating_add(T::DbWeight::get().reads(5))
.saturating_add(T::DbWeight::get().writes(3))
.saturating_add(T::DbWeight::get().writes(4))
}
}

0 comments on commit 0a97917

Please sign in to comment.