Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion pallets/salp/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

// Ensure we're `no_std` when compiling for Wasm.
#[cfg(feature = "runtime-benchmarks")]
use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller};
use frame_benchmarking::{account, benchmarks, impl_benchmark_test_suite, whitelisted_caller};
use frame_support::assert_ok;
use frame_system::RawOrigin;
use node_primitives::ParaId;
Expand Down Expand Up @@ -112,6 +112,31 @@ benchmarks! {
assert_eq!(status, ContributionStatus::Unlocked);
}

batch_unlock {
let k in 1 .. T::RemoveKeysLimit::get();
let fund_index = create_fund::<T>(1);
let contribution = T::MinContribution::get();
let mut caller: T::AccountId = whitelisted_caller();
for i in 0 .. k {
caller = account("contributor", i, 0);
contribute_fund::<T>(&caller,fund_index);
Salp::<T>::confirm_contribute(
RawOrigin::Root.into(),
caller.clone(),
fund_index,
true,
[0; 32]
);
}
assert_ok!(Salp::<T>::fund_success(RawOrigin::Root.into(), fund_index));
}: _(RawOrigin::Signed(caller.clone()), fund_index)
verify {
let fund = Salp::<T>::funds(fund_index).unwrap();
let (_, status) = Salp::<T>::contribution(fund.trie_index, &caller);
assert_eq!(status, ContributionStatus::Unlocked);
assert_last_event::<T>(Event::<T>::AllUnlocked(fund_index).into());
}

redeem {
let fund_index = create_fund::<T>(1);
let caller: T::AccountId = whitelisted_caller();
Expand Down
27 changes: 13 additions & 14 deletions runtime/bifrost/src/weights/bifrost_salp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
//! Autogenerated weights for `bifrost_salp`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-09-07, STEPS: `50`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2021-09-26, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-local"), DB CACHE: 128

// Executed Command:
// target/release/bifrost
// ./target/release/bifrost
// benchmark
// --chain=bifrost-local
// --steps=50
// --repeat=1
// --pallet=bifrost_salp
// --repeat=20
// --pallet=bifrost-salp
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
Expand Down Expand Up @@ -58,24 +58,23 @@ impl<T: frame_system::Config> bifrost_salp::WeightInfo for WeightInfo<T> {
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
// Storage: unknown [0xd861ea1ebf4800d4b89f4ff787ad79ee96d9a708c85b57da7eb8f9ddeda61291] (r:1 w:1)
fn contribute() -> Weight {
(156_695_000 as Weight)
(335_598_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
}
// Storage: Salp Funds (r:1 w:0)
// Storage: Salp RefundPool (r:1 w:1)
// Storage: Tokens Accounts (r:4 w:4)
// Storage: Tokens TotalIssuance (r:2 w:2)
// Storage: System Account (r:1 w:1)
// Storage: System Number (r:1 w:0)
// Storage: System ExecutionPhase (r:1 w:0)
// Storage: System EventCount (r:1 w:1)
// Storage: System Events (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: unknown [0xd861ea1ebf4800d4b89f4ff787ad79ee96d9a708c85b57da7eb8f9ddeda61291] (r:1 w:1)
fn refund() -> Weight {
(191_941_000 as Weight)
.saturating_add(T::DbWeight::get().reads(14 as Weight))
.saturating_add(T::DbWeight::get().writes(11 as Weight))
(328_431_000 as Weight)
.saturating_add(T::DbWeight::get().reads(13 as Weight))
.saturating_add(T::DbWeight::get().writes(10 as Weight))
}
// Storage: Salp Funds (r:1 w:0)
// Storage: Tokens Accounts (r:2 w:2)
Expand All @@ -85,7 +84,7 @@ impl<T: frame_system::Config> bifrost_salp::WeightInfo for WeightInfo<T> {
// Storage: System Events (r:1 w:1)
// Storage: unknown [0xd861ea1ebf4800d4b89f4ff787ad79ee96d9a708c85b57da7eb8f9ddeda61291] (r:1 w:1)
fn unlock() -> Weight {
(132_639_000 as Weight)
(252_844_000 as Weight)
.saturating_add(T::DbWeight::get().reads(8 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
Expand All @@ -98,10 +97,10 @@ impl<T: frame_system::Config> bifrost_salp::WeightInfo for WeightInfo<T> {
// Storage: System EventCount (r:1 w:1)
// Storage: System Events (r:1 w:1)
// Storage: System Account (r:1 w:1)
// Storage: unknown [0xd861ea1ebf4800d4b89f4ff787ad79ee96d9a708c85b57da7eb8f9ddeda61291] (r:0 w:1)
// Storage: unknown [0xd861ea1ebf4800d4b89f4ff787ad79ee96d9a708c85b57da7eb8f9ddeda61291] (r:1 w:1)
fn redeem() -> Weight {
(222_549_000 as Weight)
.saturating_add(T::DbWeight::get().reads(13 as Weight))
(395_212_000 as Weight)
.saturating_add(T::DbWeight::get().reads(14 as Weight))
.saturating_add(T::DbWeight::get().writes(11 as Weight))
}

Expand Down