From 7337e5ec1fe859861d22acc55fcb4a3efafb09f0 Mon Sep 17 00:00:00 2001 From: Gemma Date: Mon, 11 Nov 2024 16:16:18 +0800 Subject: [PATCH 1/3] Migrated benchmarking from v1 to v2 in bb-bnc. --- pallets/bb-bnc/src/benchmarking.rs | 457 +++++++++++++++++----- pallets/bb-bnc/src/mock.rs | 5 + pallets/bb-bnc/src/weights.rs | 601 ++++++++++++++++------------- pallets/farming/rpc/src/lib.rs | 3 +- 4 files changed, 692 insertions(+), 374 deletions(-) diff --git a/pallets/bb-bnc/src/benchmarking.rs b/pallets/bb-bnc/src/benchmarking.rs index 26dcebcfe..6be37f84b 100644 --- a/pallets/bb-bnc/src/benchmarking.rs +++ b/pallets/bb-bnc/src/benchmarking.rs @@ -16,58 +16,109 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -// Ensure we're `no_std` when compiling for Wasm. #![cfg(feature = "runtime-benchmarks")] -use frame_benchmarking::{account, benchmarks, v1::BenchmarkError}; -use frame_support::{assert_ok, traits::EnsureOrigin}; - +use crate::{BalanceOf, Call, Config, Pallet as BbBNC, Pallet}; use bifrost_primitives::{CurrencyId, TokenSymbol}; +use frame_benchmarking::v2::*; +use frame_support::{assert_ok, traits::EnsureOrigin}; use frame_system::RawOrigin; +use orml_traits::MultiCurrency; use sp_runtime::traits::UniqueSaturatedFrom; use sp_std::vec; -use crate::{BalanceOf, Call, Config, Pallet as BbBNC, Pallet}; -use orml_traits::MultiCurrency; +#[benchmarks] +mod benchmarks { + use super::*; -benchmarks! { - set_config { - }: _(RawOrigin::Root, - Some((4 * 365 * 86400 / 12u32).into()), - Some((7 * 86400 / 12u32).into())) + #[benchmark] + fn set_config() -> Result<(), BenchmarkError> { + #[extrinsic_call] + _( + RawOrigin::Root, + Some((4 * 365 * 86400 / 12u32).into()), + Some((7 * 86400 / 12u32).into()), + ); + + Ok(()) + } + + #[benchmark] + fn create_lock() -> Result<(), BenchmarkError> { + let test_account: T::AccountId = account("seed", 1, 1); - create_lock { - let test_account: T::AccountId = account("seed",1,1); assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + T::MultiCurrency::deposit( + CurrencyId::VToken(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - account("seed",1,1), - Some((7 * 86400 / 12u32).into()),rewards + account("seed", 1, 1), + Some((7 * 86400 / 12u32).into()), + rewards )); - }: _(RawOrigin::Signed(test_account),BalanceOf::::unique_saturated_from(50000000000u128),(365 * 86400 / 12u32).into()) + #[extrinsic_call] + _( + RawOrigin::Signed(test_account), + BalanceOf::::unique_saturated_from(50000000000u128), + (365 * 86400 / 12u32).into(), + ); + + Ok(()) + } + + #[benchmark] + fn increase_amount() -> Result<(), BenchmarkError> { + let test_account: T::AccountId = account("seed", 1, 1); - increase_amount { - let test_account: T::AccountId = account("seed",1,1); assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + T::MultiCurrency::deposit( + CurrencyId::VToken(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - account("seed",1,1), - Some((7 * 86400 / 12u32).into()),rewards + account("seed", 1, 1), + Some((7 * 86400 / 12u32).into()), + rewards )); assert_ok!(BbBNC::::create_lock( @@ -76,22 +127,48 @@ benchmarks! { (365 * 86400 / 12u32).into() )); - }: _(RawOrigin::Signed(test_account),0,BalanceOf::::unique_saturated_from(50000000000u128)) + #[extrinsic_call] + _( + RawOrigin::Signed(test_account), + 0, + BalanceOf::::unique_saturated_from(50000000000u128), + ); + + Ok(()) + } + + #[benchmark] + fn increase_unlock_time() -> Result<(), BenchmarkError> { + let test_account: T::AccountId = account("seed", 1, 1); - increase_unlock_time { - let test_account: T::AccountId = account("seed",1,1); assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + T::MultiCurrency::deposit( + CurrencyId::VToken(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - account("seed",1,1), - Some((7 * 86400 / 12u32).into()),rewards + account("seed", 1, 1), + Some((7 * 86400 / 12u32).into()), + rewards )); assert_ok!(BbBNC::::create_lock( @@ -100,22 +177,44 @@ benchmarks! { (365 * 86400 / 12u32).into() )); - }: _(RawOrigin::Signed(test_account),0,(7 * 86400 / 12u32 + 365 * 86400 / 12u32).into()) + #[extrinsic_call] + _(RawOrigin::Signed(test_account), 0, (7 * 86400 / 12u32 + 365 * 86400 / 12u32).into()); + + Ok(()) + } + + #[benchmark] + fn withdraw() -> Result<(), BenchmarkError> { + let test_account: T::AccountId = account("seed", 1, 1); - withdraw { - let test_account: T::AccountId = account("seed",1,1); assert_ok!(BbBNC::::set_config( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + T::MultiCurrency::deposit( + CurrencyId::VToken(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - account("seed",1,1), - Some((7 * 86400 / 12u32).into()),rewards + account("seed", 1, 1), + Some((7 * 86400 / 12u32).into()), + rewards )); assert_ok!(BbBNC::::create_lock( @@ -126,22 +225,44 @@ benchmarks! { >::set_block_number((2 * 365 * 86400 / 12u32).into()); - }: _(RawOrigin::Signed(test_account),0) + #[extrinsic_call] + _(RawOrigin::Signed(test_account), 0); + + Ok(()) + } + + #[benchmark] + fn get_rewards() -> Result<(), BenchmarkError> { + let test_account: T::AccountId = account("seed", 1, 1); - get_rewards { - let test_account: T::AccountId = account("seed",1,1); assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + T::MultiCurrency::deposit( + CurrencyId::VToken(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - account("seed",1,1), - Some((7 * 86400 / 12u32).into()),rewards + account("seed", 1, 1), + Some((7 * 86400 / 12u32).into()), + rewards )); assert_ok!(BbBNC::::create_lock( @@ -152,41 +273,93 @@ benchmarks! { >::set_block_number((2 * 365 * 86400 / 12u32).into()); - }: _(RawOrigin::Signed(test_account)) + #[extrinsic_call] + _(RawOrigin::Signed(test_account)); - notify_rewards { + Ok(()) + } + #[benchmark] + fn notify_rewards() -> Result<(), BenchmarkError> { assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &account("seed",1,1), BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - }: _(RawOrigin::Root,account("seed",1,1),Some((7 * 86400 / 12u32).into()),rewards) - set_markup_coefficient { + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &account("seed", 1, 1), + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + #[extrinsic_call] + _(RawOrigin::Root, account("seed", 1, 1), Some((7 * 86400 / 12u32).into()), rewards); + + Ok(()) + } + + #[benchmark] + fn set_markup_coefficient() -> Result<(), BenchmarkError> { assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &account("seed",1,1), BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - }: _(RawOrigin::Root, CurrencyId::VToken(TokenSymbol::BNC), 10_000.into(), 10_000_000_000_000.into()) - deposit_markup { - let test_account: T::AccountId = account("seed",1,1); + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &account("seed", 1, 1), + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + #[extrinsic_call] + _( + RawOrigin::Root, + CurrencyId::VToken(TokenSymbol::BNC), + 10_000.into(), + 10_000_000_000_000.into(), + ); + + Ok(()) + } + + #[benchmark] + fn deposit_markup() -> Result<(), BenchmarkError> { + let test_account: T::AccountId = account("seed", 1, 1); + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + T::MultiCurrency::deposit( + CurrencyId::VToken(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - account("seed",1,1), - Some((7 * 86400 / 12u32).into()),rewards + account("seed", 1, 1), + Some((7 * 86400 / 12u32).into()), + rewards )); assert_ok!(BbBNC::::create_lock( @@ -194,30 +367,57 @@ benchmarks! { BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() )); + assert_ok!(BbBNC::::set_markup_coefficient( RawOrigin::Root.into(), CurrencyId::VToken(TokenSymbol::BNC), 1_000.into(), 10_000_000_000_000.into() )); + >::set_block_number((2 * 365 * 86400 / 12u32).into()); - }: _(RawOrigin::Signed(test_account), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128)) + #[extrinsic_call] + _( + RawOrigin::Signed(test_account), + CurrencyId::VToken(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + ); + + Ok(()) + } + #[benchmark] + fn withdraw_markup() -> Result<(), BenchmarkError> { + let test_account: T::AccountId = account("seed", 1, 1); - withdraw_markup { - let test_account: T::AccountId = account("seed",1,1); assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + T::MultiCurrency::deposit( + CurrencyId::VToken(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - account("seed",1,1), - Some((7 * 86400 / 12u32).into()),rewards + account("seed", 1, 1), + Some((7 * 86400 / 12u32).into()), + rewards )); assert_ok!(BbBNC::::create_lock( @@ -225,31 +425,60 @@ benchmarks! { BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() )); + assert_ok!(BbBNC::::set_markup_coefficient( RawOrigin::Root.into(), CurrencyId::VToken(TokenSymbol::BNC), 1_000.into(), 10_000_000_000_000.into() )); - assert_ok!(BbBNC::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))); + + assert_ok!(BbBNC::::deposit_markup( + RawOrigin::Signed(test_account.clone()).into(), + CurrencyId::VToken(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128) + )); + >::set_block_number((2 * 365 * 86400 / 12u32).into()); - }: _(RawOrigin::Signed(test_account), CurrencyId::VToken(TokenSymbol::BNC)) + #[extrinsic_call] + _(RawOrigin::Signed(test_account), CurrencyId::VToken(TokenSymbol::BNC)); + + Ok(()) + } + + #[benchmark] + fn redeem_unlock() -> Result<(), BenchmarkError> { + let test_account: T::AccountId = account("seed", 1, 1); - redeem_unlock { - let test_account: T::AccountId = account("seed",1,1); assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + T::MultiCurrency::deposit( + CurrencyId::VToken(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - account("seed",1,1), - Some((7 * 86400 / 12u32).into()),rewards + account("seed", 1, 1), + Some((7 * 86400 / 12u32).into()), + rewards )); assert_ok!(BbBNC::::create_lock( @@ -257,31 +486,60 @@ benchmarks! { BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() )); + assert_ok!(BbBNC::::set_markup_coefficient( RawOrigin::Root.into(), CurrencyId::VToken(TokenSymbol::BNC), 1_000.into(), 10_000_000_000_000.into() )); - assert_ok!(BbBNC::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))); + + assert_ok!(BbBNC::::deposit_markup( + RawOrigin::Signed(test_account.clone()).into(), + CurrencyId::VToken(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128) + )); + >::set_block_number((2 * 86400 / 12u32).into()); - }: _(RawOrigin::Signed(test_account), 0) + #[extrinsic_call] + _(RawOrigin::Signed(test_account), 0); + + Ok(()) + } + + #[benchmark] + fn refresh() -> Result<(), BenchmarkError> { + let test_account: T::AccountId = account("seed", 1, 1); - refresh { - let test_account: T::AccountId = account("seed",1,1); assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) )); - T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; - let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; + + T::MultiCurrency::deposit( + CurrencyId::Native(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + T::MultiCurrency::deposit( + CurrencyId::VToken(TokenSymbol::BNC), + &test_account, + BalanceOf::::unique_saturated_from(100_000_000_000_000u128), + )?; + + let rewards = vec![( + CurrencyId::Native(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128), + )]; + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - account("seed",1,1), - Some((7 * 86400 / 12u32).into()),rewards + account("seed", 1, 1), + Some((7 * 86400 / 12u32).into()), + rewards )); assert_ok!(BbBNC::::create_lock( @@ -289,16 +547,27 @@ benchmarks! { BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() )); + assert_ok!(BbBNC::::set_markup_coefficient( RawOrigin::Root.into(), CurrencyId::VToken(TokenSymbol::BNC), 1_000.into(), 10_000_000_000_000.into() )); - assert_ok!(BbBNC::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))); + + assert_ok!(BbBNC::::deposit_markup( + RawOrigin::Signed(test_account.clone()).into(), + CurrencyId::VToken(TokenSymbol::BNC), + BalanceOf::::unique_saturated_from(10_000_000_000_000u128) + )); + >::set_block_number((2 * 86400 / 12u32).into()); - }: _(RawOrigin::Signed(test_account), CurrencyId::VToken(TokenSymbol::BNC)) + #[extrinsic_call] + _(RawOrigin::Signed(test_account), CurrencyId::VToken(TokenSymbol::BNC)); + + Ok(()) + } - impl_benchmark_test_suite!(BbBNC,crate::mock::ExtBuilder::default().build(),crate::mock::Runtime); + impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext_benchmark(), crate::mock::Runtime); } diff --git a/pallets/bb-bnc/src/mock.rs b/pallets/bb-bnc/src/mock.rs index 36d34a318..20f5eb77a 100644 --- a/pallets/bb-bnc/src/mock.rs +++ b/pallets/bb-bnc/src/mock.rs @@ -450,3 +450,8 @@ impl ExtBuilder { t.into() } } + +#[cfg(feature = "runtime-benchmarks")] +pub fn new_test_ext_benchmark() -> sp_io::TestExternalities { + ExtBuilder::default().build() +} diff --git a/pallets/bb-bnc/src/weights.rs b/pallets/bb-bnc/src/weights.rs index aca971f2c..b54a417dd 100644 --- a/pallets/bb-bnc/src/weights.rs +++ b/pallets/bb-bnc/src/weights.rs @@ -24,9 +24,9 @@ //! Autogenerated weights for bb_bnc //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bifrost-jenkins`, CPU: `Intel(R) Xeon(R) CPU E5-26xx v4` +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-11-06, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `mjl-legion`, CPU: `12th Gen Intel(R) Core(TM) i9-12900H` //! WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-polkadot-local"), DB CACHE: 1024 // Executed Command: @@ -69,263 +69,289 @@ pub trait WeightInfo { // For backwards compatibility and tests impl WeightInfo for () { - /// Storage: BbBNC VeConfigs (r:1 w:1) - /// Proof Skipped: BbBNC VeConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: System Number (r:1 w:0) - /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: System ExecutionPhase (r:1 w:0) - /// Proof: System ExecutionPhase (max_values: Some(1), max_size: Some(5), added: 500, mode: MaxEncodedLen) - /// Storage: System EventCount (r:1 w:1) - /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: System Events (r:1 w:1) - /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: `BbBNC::BbConfigs` (r:1 w:1) + /// Proof: `BbBNC::BbConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn set_config() -> Weight { // Proof Size summary in bytes: - // Measured: `200` - // Estimated: `1685` - // Minimum execution time: 32_840_000 picoseconds. - Weight::from_parts(34_249_000, 1685) + // Measured: `134` + // Estimated: `1619` + // Minimum execution time: 6_981_000 picoseconds. + Weight::from_parts(7_592_000, 1619) .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } - /// Storage: BbBNC VeConfigs (r:1 w:0) - /// Proof Skipped: BbBNC VeConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC Locked (r:1 w:1) - /// Proof Skipped: BbBNC Locked (max_values: None, max_size: None, mode: Measured) - /// Storage: System Number (r:1 w:0) - /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: BbBNC Supply (r:1 w:1) - /// Proof Skipped: BbBNC Supply (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Tokens Accounts (r:2 w:2) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - /// Storage: AssetRegistry CurrencyMetadatas (r:1 w:0) - /// Proof Skipped: AssetRegistry CurrencyMetadatas (max_values: None, max_size: None, mode: Measured) - /// Storage: System Account (r:2 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: System ExecutionPhase (r:1 w:0) - /// Proof: System ExecutionPhase (max_values: Some(1), max_size: Some(5), added: 500, mode: MaxEncodedLen) - /// Storage: System EventCount (r:1 w:1) - /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: System Events (r:1 w:1) - /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC IncentiveConfigs (r:1 w:1) - /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC Epoch (r:1 w:1) - /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC PointHistory (r:1 w:1) - /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointEpoch (r:1 w:1) - /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC Rewards (r:1 w:0) - /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC SlopeChanges (r:2 w:1) - /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointHistory (r:0 w:1) - /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserRewardPerTokenPaid (r:0 w:1) - /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) + /// Storage: `BbBNC::Position` (r:1 w:1) + /// Proof: `BbBNC::Position` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPositions` (r:1 w:1) + /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::BbConfigs` (r:1 w:0) + /// Proof: `BbBNC::BbConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `BbBNC::Locked` (r:1 w:1) + /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Supply` (r:1 w:1) + /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Tokens::Accounts` (r:1 w:1) + /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(118), added: 2593, mode: `MaxEncodedLen`) + /// Storage: `BbBNC::UserLocked` (r:1 w:1) + /// Proof: `BbBNC::UserLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Tokens::Locks` (r:1 w:1) + /// Proof: `Tokens::Locks` (`max_values`: None, `max_size`: Some(1271), added: 3746, mode: `MaxEncodedLen`) + /// Storage: `AssetRegistry::CurrencyMetadatas` (r:1 w:0) + /// Proof: `AssetRegistry::CurrencyMetadatas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserMarkupInfos` (r:1 w:0) + /// Proof: `BbBNC::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserFarmingPool` (r:1 w:0) + /// Proof: `BbBNC::UserFarmingPool` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Epoch` (r:1 w:1) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:1) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointEpoch` (r:1 w:1) + /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Rewards` (r:1 w:0) + /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:2 w:1) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointHistory` (r:0 w:1) + /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:0 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) fn create_lock() -> Weight { // Proof Size summary in bytes: - // Measured: `1439` - // Estimated: `7379` - // Minimum execution time: 254_132_000 picoseconds. - Weight::from_parts(257_959_000, 7379) - .saturating_add(RocksDbWeight::get().reads(19_u64)) - .saturating_add(RocksDbWeight::get().writes(14_u64)) + // Measured: `1389` + // Estimated: `7329` + // Minimum execution time: 77_626_000 picoseconds. + Weight::from_parts(83_128_000, 7329) + .saturating_add(RocksDbWeight::get().reads(23_u64)) + .saturating_add(RocksDbWeight::get().writes(17_u64)) } - /// Storage: BbBNC VeConfigs (r:1 w:0) - /// Proof Skipped: BbBNC VeConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC Locked (r:1 w:1) - /// Proof Skipped: BbBNC Locked (max_values: None, max_size: None, mode: Measured) - /// Storage: System Number (r:1 w:0) - /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: BbBNC Supply (r:1 w:1) - /// Proof Skipped: BbBNC Supply (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Tokens Accounts (r:2 w:2) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - /// Storage: AssetRegistry CurrencyMetadatas (r:1 w:0) - /// Proof Skipped: AssetRegistry CurrencyMetadatas (max_values: None, max_size: None, mode: Measured) - /// Storage: System Account (r:1 w:0) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: System ExecutionPhase (r:1 w:0) - /// Proof: System ExecutionPhase (max_values: Some(1), max_size: Some(5), added: 500, mode: MaxEncodedLen) - /// Storage: System EventCount (r:1 w:1) - /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: System Events (r:1 w:1) - /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC IncentiveConfigs (r:1 w:1) - /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC Epoch (r:1 w:1) - /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC PointHistory (r:1 w:1) - /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointEpoch (r:1 w:1) - /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointHistory (r:1 w:1) - /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC Rewards (r:1 w:1) - /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserRewardPerTokenPaid (r:1 w:1) - /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC SlopeChanges (r:1 w:1) - /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) + /// Storage: `BbBNC::UserPositions` (r:1 w:0) + /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::BbConfigs` (r:1 w:0) + /// Proof: `BbBNC::BbConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Locked` (r:1 w:1) + /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `BbBNC::Supply` (r:1 w:1) + /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Tokens::Accounts` (r:1 w:1) + /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(118), added: 2593, mode: `MaxEncodedLen`) + /// Storage: `BbBNC::UserLocked` (r:1 w:1) + /// Proof: `BbBNC::UserLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Tokens::Locks` (r:1 w:1) + /// Proof: `Tokens::Locks` (`max_values`: None, `max_size`: Some(1271), added: 3746, mode: `MaxEncodedLen`) + /// Storage: `AssetRegistry::CurrencyMetadatas` (r:1 w:0) + /// Proof: `AssetRegistry::CurrencyMetadatas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserMarkupInfos` (r:1 w:0) + /// Proof: `BbBNC::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserFarmingPool` (r:1 w:0) + /// Proof: `BbBNC::UserFarmingPool` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Epoch` (r:1 w:1) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:1) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointEpoch` (r:1 w:1) + /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointHistory` (r:1 w:1) + /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Rewards` (r:1 w:1) + /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:1 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:1 w:1) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) fn increase_amount() -> Weight { // Proof Size summary in bytes: - // Measured: `2083` - // Estimated: `6176` - // Minimum execution time: 282_837_000 picoseconds. - Weight::from_parts(287_187_000, 6176) - .saturating_add(RocksDbWeight::get().reads(19_u64)) - .saturating_add(RocksDbWeight::get().writes(14_u64)) + // Measured: `2248` + // Estimated: `5713` + // Minimum execution time: 100_357_000 picoseconds. + Weight::from_parts(104_849_000, 5713) + .saturating_add(RocksDbWeight::get().reads(22_u64)) + .saturating_add(RocksDbWeight::get().writes(15_u64)) } - /// Storage: BbBNC VeConfigs (r:1 w:0) - /// Proof Skipped: BbBNC VeConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC Locked (r:1 w:1) - /// Proof Skipped: BbBNC Locked (max_values: None, max_size: None, mode: Measured) - /// Storage: System Number (r:1 w:0) - /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: BbBNC Supply (r:1 w:1) - /// Proof Skipped: BbBNC Supply (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC IncentiveConfigs (r:1 w:1) - /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC Epoch (r:1 w:1) - /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC PointHistory (r:1 w:1) - /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointEpoch (r:1 w:1) - /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointHistory (r:1 w:1) - /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC Rewards (r:1 w:1) - /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserRewardPerTokenPaid (r:1 w:1) - /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC SlopeChanges (r:2 w:2) - /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) - /// Storage: Tokens Accounts (r:1 w:0) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - /// Storage: System ExecutionPhase (r:1 w:0) - /// Proof: System ExecutionPhase (max_values: Some(1), max_size: Some(5), added: 500, mode: MaxEncodedLen) - /// Storage: System EventCount (r:1 w:1) - /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: System Events (r:1 w:1) - /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: `BbBNC::UserPositions` (r:1 w:0) + /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::BbConfigs` (r:1 w:0) + /// Proof: `BbBNC::BbConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Locked` (r:1 w:1) + /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `BbBNC::Supply` (r:1 w:1) + /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `Tokens::Accounts` (r:1 w:0) + /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(118), added: 2593, mode: `MaxEncodedLen`) + /// Storage: `BbBNC::UserMarkupInfos` (r:1 w:0) + /// Proof: `BbBNC::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserFarmingPool` (r:1 w:0) + /// Proof: `BbBNC::UserFarmingPool` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Epoch` (r:1 w:1) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:1) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointEpoch` (r:1 w:1) + /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointHistory` (r:1 w:1) + /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Rewards` (r:1 w:1) + /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:1 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:2 w:2) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn increase_unlock_time() -> Weight { // Proof Size summary in bytes: - // Measured: `1589` - // Estimated: `7529` - // Minimum execution time: 225_251_000 picoseconds. - Weight::from_parts(229_018_000, 7529) - .saturating_add(RocksDbWeight::get().reads(17_u64)) + // Measured: `1519` + // Estimated: `7459` + // Minimum execution time: 80_873_000 picoseconds. + Weight::from_parts(82_372_000, 7459) + .saturating_add(RocksDbWeight::get().reads(20_u64)) .saturating_add(RocksDbWeight::get().writes(13_u64)) } - /// Storage: BbBNC Locked (r:1 w:1) - /// Proof Skipped: BbBNC Locked (max_values: None, max_size: None, mode: Measured) - /// Storage: System Number (r:1 w:0) - /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: BbBNC Supply (r:1 w:1) - /// Proof Skipped: BbBNC Supply (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: Tokens Accounts (r:2 w:2) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - /// Storage: AssetRegistry CurrencyMetadatas (r:1 w:0) - /// Proof Skipped: AssetRegistry CurrencyMetadatas (max_values: None, max_size: None, mode: Measured) - /// Storage: System Account (r:1 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: System ExecutionPhase (r:1 w:0) - /// Proof: System ExecutionPhase (max_values: Some(1), max_size: Some(5), added: 500, mode: MaxEncodedLen) - /// Storage: System EventCount (r:1 w:1) - /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: System Events (r:1 w:1) - /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC IncentiveConfigs (r:1 w:1) - /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC Epoch (r:1 w:1) - /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC PointHistory (r:1 w:105) - /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC SlopeChanges (r:104 w:0) - /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointEpoch (r:1 w:1) - /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointHistory (r:1 w:1) - /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC Rewards (r:1 w:1) - /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserRewardPerTokenPaid (r:1 w:1) - /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) + /// Storage: `BbBNC::UserPositions` (r:1 w:1) + /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Locked` (r:1 w:1) + /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `BbBNC::Supply` (r:1 w:1) + /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserLocked` (r:1 w:1) + /// Proof: `BbBNC::UserLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Tokens::Locks` (r:1 w:1) + /// Proof: `Tokens::Locks` (`max_values`: None, `max_size`: Some(1271), added: 3746, mode: `MaxEncodedLen`) + /// Storage: `Tokens::Accounts` (r:1 w:1) + /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(118), added: 2593, mode: `MaxEncodedLen`) + /// Storage: `AssetRegistry::CurrencyMetadatas` (r:1 w:0) + /// Proof: `AssetRegistry::CurrencyMetadatas` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:1 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserFarmingPool` (r:1 w:0) + /// Proof: `BbBNC::UserFarmingPool` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Epoch` (r:1 w:1) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:105) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:104 w:0) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Rewards` (r:1 w:0) + /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointHistory` (r:0 w:1) + /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:0 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointEpoch` (r:0 w:1) + /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) fn withdraw() -> Weight { // Proof Size summary in bytes: - // Measured: `2059` - // Estimated: `260449` - // Minimum execution time: 1_285_654_000 picoseconds. - Weight::from_parts(1_315_018_000, 260449) + // Measured: `2095` + // Estimated: `260485` + // Minimum execution time: 462_398_000 picoseconds. + Weight::from_parts(474_144_000, 260485) .saturating_add(RocksDbWeight::get().reads(121_u64)) - .saturating_add(RocksDbWeight::get().writes(118_u64)) + .saturating_add(RocksDbWeight::get().writes(119_u64)) } - /// Storage: BbBNC IncentiveConfigs (r:1 w:1) - /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: System Number (r:1 w:0) - /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: BbBNC Epoch (r:1 w:0) - /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC PointHistory (r:1 w:0) - /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC SlopeChanges (r:104 w:0) - /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointEpoch (r:1 w:0) - /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserPointHistory (r:1 w:0) - /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC Rewards (r:1 w:1) - /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: BbBNC UserRewardPerTokenPaid (r:1 w:1) - /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) - /// Storage: Balances TotalIssuance (r:1 w:1) - /// Proof: Balances TotalIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) - /// Storage: System Account (r:3 w:3) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: System ExecutionPhase (r:1 w:0) - /// Proof: System ExecutionPhase (max_values: Some(1), max_size: Some(5), added: 500, mode: MaxEncodedLen) - /// Storage: System EventCount (r:1 w:1) - /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: System Events (r:1 w:1) - /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `BbBNC::Epoch` (r:1 w:0) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:0) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:104 w:0) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPositions` (r:1 w:0) + /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointEpoch` (r:1 w:0) + /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointHistory` (r:1 w:0) + /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Rewards` (r:1 w:0) + /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:0 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) fn get_rewards() -> Weight { // Proof Size summary in bytes: - // Measured: `1384` - // Estimated: `259774` - // Minimum execution time: 752_030_000 picoseconds. - Weight::from_parts(778_014_000, 259774) - .saturating_add(RocksDbWeight::get().reads(119_u64)) - .saturating_add(RocksDbWeight::get().writes(9_u64)) + // Measured: `906` + // Estimated: `259296` + // Minimum execution time: 217_613_000 picoseconds. + Weight::from_parts(219_885_000, 259296) + .saturating_add(RocksDbWeight::get().reads(112_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } - /// Storage: BbBNC IncentiveConfigs (r:1 w:1) - /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: System Number (r:1 w:0) - /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: System ExecutionPhase (r:1 w:0) - /// Proof: System ExecutionPhase (max_values: Some(1), max_size: Some(5), added: 500, mode: MaxEncodedLen) - /// Storage: System EventCount (r:1 w:1) - /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: System Events (r:1 w:1) - /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC Epoch (r:1 w:0) - /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: BbBNC PointHistory (r:1 w:0) - /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: System Account (r:2 w:2) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - /// Storage: Balances TotalIssuance (r:1 w:0) - /// Proof: Balances TotalIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Epoch` (r:1 w:0) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:0) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:2 w:2) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `Balances::TotalIssuance` (r:1 w:0) + /// Proof: `Balances::TotalIssuance` (`max_values`: Some(1), `max_size`: Some(16), added: 511, mode: `MaxEncodedLen`) fn notify_rewards() -> Weight { // Proof Size summary in bytes: - // Measured: `508` + // Measured: `564` // Estimated: `6196` - // Minimum execution time: 175_754_000 picoseconds. - Weight::from_parts(179_695_000, 6196) + // Minimum execution time: 52_388_000 picoseconds. + Weight::from_parts(54_170_000, 6196) .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) - } + } /// Storage: `BbBNC::TotalLock` (r:1 w:1) /// Proof: `BbBNC::TotalLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Number` (r:1 w:0) @@ -334,13 +360,12 @@ impl WeightInfo for () { /// Proof: `BbBNC::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_markup_coefficient() -> Weight { // Proof Size summary in bytes: - // Measured: `213` - // Estimated: `3678` - // Minimum execution time: 12_353_000 picoseconds. - Weight::from_parts(12_533_000, 0) - .saturating_add(Weight::from_parts(0, 3678)) - .saturating_add(RocksDbWeight::get().reads(2)) - .saturating_add(RocksDbWeight::get().writes(2)) + // Measured: `147` + // Estimated: `3612` + // Minimum execution time: 6_232_000 picoseconds. + Weight::from_parts(6_576_000, 3612) + .saturating_add(RocksDbWeight::get().reads(2_u64)) + .saturating_add(RocksDbWeight::get().writes(2_u64)) } /// Storage: `BbBNC::MarkupCoefficient` (r:1 w:0) /// Proof: `BbBNC::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -352,6 +377,8 @@ impl WeightInfo for () { /// Proof: `BbBNC::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::LockedTokens` (r:1 w:1) /// Proof: `BbBNC::LockedTokens` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Tokens::TotalIssuance` (r:1 w:0) + /// Proof: `Tokens::TotalIssuance` (`max_values`: None, `max_size`: Some(38), added: 2513, mode: `MaxEncodedLen`) /// Storage: `Tokens::Locks` (r:1 w:1) /// Proof: `Tokens::Locks` (`max_values`: None, `max_size`: Some(1271), added: 3746, mode: `MaxEncodedLen`) /// Storage: `Tokens::Accounts` (r:1 w:1) @@ -368,8 +395,10 @@ impl WeightInfo for () { /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Locked` (r:1 w:0) /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserFarmingPool` (r:1 w:0) + /// Proof: `BbBNC::UserFarmingPool` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) - /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Epoch` (r:1 w:1) /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::PointHistory` (r:1 w:105) @@ -380,21 +409,20 @@ impl WeightInfo for () { /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::UserPointHistory` (r:1 w:1) /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `BbBNC::Rewards` (r:1 w:1) + /// Storage: `BbBNC::Rewards` (r:1 w:0) /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:1 w:1) - /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Supply` (r:1 w:0) /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:0 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) fn deposit_markup() -> Weight { // Proof Size summary in bytes: - // Measured: `2260` - // Estimated: `260650` - // Minimum execution time: 820_796_000 picoseconds. - Weight::from_parts(831_306_000, 0) - .saturating_add(Weight::from_parts(0, 260650)) - .saturating_add(RocksDbWeight::get().reads(125)) - .saturating_add(RocksDbWeight::get().writes(118)) + // Measured: `2304` + // Estimated: `260694` + // Minimum execution time: 473_759_000 picoseconds. + Weight::from_parts(481_199_000, 260694) + .saturating_add(RocksDbWeight::get().reads(126_u64)) + .saturating_add(RocksDbWeight::get().writes(117_u64)) } /// Storage: `BbBNC::MarkupCoefficient` (r:1 w:0) /// Proof: `BbBNC::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -422,8 +450,10 @@ impl WeightInfo for () { /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Locked` (r:1 w:0) /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserFarmingPool` (r:1 w:0) + /// Proof: `BbBNC::UserFarmingPool` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) - /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Epoch` (r:1 w:1) /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::PointHistory` (r:1 w:105) @@ -442,13 +472,12 @@ impl WeightInfo for () { /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn withdraw_markup() -> Weight { // Proof Size summary in bytes: - // Measured: `2725` - // Estimated: `261115` - // Minimum execution time: 813_232_000 picoseconds. - Weight::from_parts(823_401_000, 0) - .saturating_add(Weight::from_parts(0, 261115)) - .saturating_add(RocksDbWeight::get().reads(125)) - .saturating_add(RocksDbWeight::get().writes(118)) + // Measured: `2731` + // Estimated: `261121` + // Minimum execution time: 479_009_000 picoseconds. + Weight::from_parts(487_635_000, 261121) + .saturating_add(RocksDbWeight::get().reads(126_u64)) + .saturating_add(RocksDbWeight::get().writes(118_u64)) } /// Storage: `BbBNC::Locked` (r:1 w:1) /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -460,43 +489,46 @@ impl WeightInfo for () { /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::UserLocked` (r:1 w:1) /// Proof: `BbBNC::UserLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Tokens::Locks` (r:1 w:1) + /// Proof: `Tokens::Locks` (`max_values`: None, `max_size`: Some(1271), added: 3746, mode: `MaxEncodedLen`) /// Storage: `Tokens::Accounts` (r:2 w:2) /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(118), added: 2593, mode: `MaxEncodedLen`) /// Storage: `AssetRegistry::CurrencyMetadatas` (r:1 w:0) /// Proof: `AssetRegistry::CurrencyMetadatas` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `System::Account` (r:2 w:1) - /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) /// Storage: `System::ExecutionPhase` (r:1 w:0) /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) /// Storage: `System::EventCount` (r:1 w:1) /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `System::Events` (r:1 w:1) /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `BbBNC::UserFarmingPool` (r:1 w:0) + /// Proof: `BbBNC::UserFarmingPool` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) - /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Epoch` (r:1 w:1) /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `BbBNC::PointHistory` (r:1 w:105) + /// Storage: `BbBNC::PointHistory` (r:1 w:1) /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `BbBNC::SlopeChanges` (r:104 w:0) - /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Rewards` (r:1 w:1) /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:1 w:1) /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:1 w:1) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::UserPointHistory` (r:0 w:1) /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::UserPointEpoch` (r:0 w:1) /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) fn redeem_unlock() -> Weight { // Proof Size summary in bytes: - // Measured: `2525` - // Estimated: `260915` - // Minimum execution time: 818_341_000 picoseconds. - Weight::from_parts(827_248_000, 0) - .saturating_add(Weight::from_parts(0, 260915)) - .saturating_add(RocksDbWeight::get().reads(122)) - .saturating_add(RocksDbWeight::get().writes(120)) + // Measured: `2656` + // Estimated: `6196` + // Minimum execution time: 116_696_000 picoseconds. + Weight::from_parts(118_734_000, 6196) + .saturating_add(RocksDbWeight::get().reads(21_u64)) + .saturating_add(RocksDbWeight::get().writes(18_u64)) } /// Storage: `BbBNC::MarkupCoefficient` (r:1 w:0) /// Proof: `BbBNC::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) @@ -504,12 +536,18 @@ impl WeightInfo for () { /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) /// Storage: `BbBNC::LockedTokens` (r:2 w:1) /// Proof: `BbBNC::LockedTokens` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::TotalLock` (r:1 w:0) + /// Proof: `BbBNC::TotalLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `Tokens::TotalIssuance` (r:1 w:0) + /// Proof: `Tokens::TotalIssuance` (`max_values`: None, `max_size`: Some(38), added: 2513, mode: `MaxEncodedLen`) /// Storage: `BbBNC::UserMarkupInfos` (r:1 w:1) /// Proof: `BbBNC::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::UserPositions` (r:1 w:0) /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Locked` (r:1 w:0) /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserFarmingPool` (r:1 w:0) + /// Proof: `BbBNC::UserFarmingPool` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Epoch` (r:1 w:1) @@ -528,14 +566,19 @@ impl WeightInfo for () { /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `BbBNC::Supply` (r:1 w:0) /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn refresh() -> Weight { // Proof Size summary in bytes: - // Measured: `1687` - // Estimated: `7627` - // Minimum execution time: 129_204_000 picoseconds. - Weight::from_parts(130_316_000, 0) - .saturating_add(Weight::from_parts(0, 7627)) - .saturating_add(RocksDbWeight::get().reads(16)) - .saturating_add(RocksDbWeight::get().writes(10)) + // Measured: `1804` + // Estimated: `7744` + // Minimum execution time: 95_664_000 picoseconds. + Weight::from_parts(98_039_000, 7744) + .saturating_add(RocksDbWeight::get().reads(22_u64)) + .saturating_add(RocksDbWeight::get().writes(12_u64)) } } diff --git a/pallets/farming/rpc/src/lib.rs b/pallets/farming/rpc/src/lib.rs index 9a926babd..7bd515478 100644 --- a/pallets/farming/rpc/src/lib.rs +++ b/pallets/farming/rpc/src/lib.rs @@ -66,7 +66,8 @@ impl FarmingRpc { #[async_trait] impl - FarmingRpcApiServer<::Hash, AccountId, PoolId, CurrencyId> for FarmingRpc + FarmingRpcApiServer<::Hash, AccountId, PoolId, CurrencyId> + for FarmingRpc where Block: BlockT, C: Send + Sync + 'static + ProvideRuntimeApi + HeaderBackend, From 626bbdc5eace1b95a70483897ef9b43826b19242 Mon Sep 17 00:00:00 2001 From: Gemma Date: Mon, 11 Nov 2024 16:20:35 +0800 Subject: [PATCH 2/3] format changed --- pallets/farming/rpc/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pallets/farming/rpc/src/lib.rs b/pallets/farming/rpc/src/lib.rs index 7bd515478..9a926babd 100644 --- a/pallets/farming/rpc/src/lib.rs +++ b/pallets/farming/rpc/src/lib.rs @@ -66,8 +66,7 @@ impl FarmingRpc { #[async_trait] impl - FarmingRpcApiServer<::Hash, AccountId, PoolId, CurrencyId> - for FarmingRpc + FarmingRpcApiServer<::Hash, AccountId, PoolId, CurrencyId> for FarmingRpc where Block: BlockT, C: Send + Sync + 'static + ProvideRuntimeApi + HeaderBackend, From b6f0a9f00ab2a238383bb658cfda9a5c2f91646c Mon Sep 17 00:00:00 2001 From: Gemma Date: Mon, 11 Nov 2024 16:21:57 +0800 Subject: [PATCH 3/3] format changed --- pallets/bb-bnc/src/benchmarking.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/pallets/bb-bnc/src/benchmarking.rs b/pallets/bb-bnc/src/benchmarking.rs index 6be37f84b..f37bb9efd 100644 --- a/pallets/bb-bnc/src/benchmarking.rs +++ b/pallets/bb-bnc/src/benchmarking.rs @@ -16,6 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +// Ensure we're `no_std` when compiling for Wasm. #![cfg(feature = "runtime-benchmarks")] use crate::{BalanceOf, Call, Config, Pallet as BbBNC, Pallet};