diff --git a/pallets/salp/src/benchmarking.rs b/pallets/salp/src/benchmarking.rs index c0cb10dd57..251eef821c 100644 --- a/pallets/salp/src/benchmarking.rs +++ b/pallets/salp/src/benchmarking.rs @@ -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; @@ -112,6 +112,31 @@ benchmarks! { assert_eq!(status, ContributionStatus::Unlocked); } + batch_unlock { + let k in 1 .. T::RemoveKeysLimit::get(); + let fund_index = create_fund::(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::(&caller,fund_index); + Salp::::confirm_contribute( + RawOrigin::Root.into(), + caller.clone(), + fund_index, + true, + [0; 32] + ); + } + assert_ok!(Salp::::fund_success(RawOrigin::Root.into(), fund_index)); + }: _(RawOrigin::Signed(caller.clone()), fund_index) + verify { + let fund = Salp::::funds(fund_index).unwrap(); + let (_, status) = Salp::::contribution(fund.trie_index, &caller); + assert_eq!(status, ContributionStatus::Unlocked); + assert_last_event::(Event::::AllUnlocked(fund_index).into()); + } + redeem { let fund_index = create_fund::(1); let caller: T::AccountId = whitelisted_caller(); diff --git a/runtime/bifrost/src/weights/bifrost_salp.rs b/runtime/bifrost/src/weights/bifrost_salp.rs index 28548ae16b..9d0b98852a 100644 --- a/runtime/bifrost/src/weights/bifrost_salp.rs +++ b/runtime/bifrost/src/weights/bifrost_salp.rs @@ -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 @@ -58,24 +58,23 @@ impl bifrost_salp::WeightInfo for WeightInfo { // 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) @@ -85,7 +84,7 @@ impl bifrost_salp::WeightInfo for WeightInfo { // 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)) } @@ -98,10 +97,10 @@ impl bifrost_salp::WeightInfo for WeightInfo { // 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)) }