diff --git a/pallets/local-treasury/src/benchmarking.rs b/pallets/local-treasury/src/benchmarking.rs index 5875cd4a07..7732e76c5a 100644 --- a/pallets/local-treasury/src/benchmarking.rs +++ b/pallets/local-treasury/src/benchmarking.rs @@ -7,7 +7,7 @@ use frame_system::Origin; benchmarks! { withdraw { - let local_treasury: ::AccountId = PalletId(*b"12345678").into_account(); + let local_treasury: ::AccountId = PalletId(*b"Treasury").into_account(); T::Currency::deposit_creating(&local_treasury, 10_000_000_u32.into()); let admin: ::AccountId = account("admin", 0, 0); }: _( diff --git a/pallets/saft-registry/src/benchmarking.rs b/pallets/saft-registry/src/benchmarking.rs index 1e6ff0b079..2b980199f4 100644 --- a/pallets/saft-registry/src/benchmarking.rs +++ b/pallets/saft-registry/src/benchmarking.rs @@ -95,9 +95,11 @@ benchmarks! { } convert_to_liquid { + let o in 1 .. MAX_SAFT_RECORDS; + let nav = 1337u32; let units = 1234u32; - let asset:T::AssetId = T::try_convert(2u8).unwrap(); + let asset:T::AssetId = T::try_convert(5u8).unwrap(); let origin = T::AdminOrigin::successful_origin(); assert_ok!(T::AssetRecorderBenchmarks::add_asset( @@ -107,22 +109,23 @@ benchmarks! { 1000u32.into() )); - // Create saft records - for i in 0 .. MAX_SAFT_RECORDS { - assert_ok!(SaftRegistry::::add_saft( - origin.clone(), - asset, - nav.into(), - units.into(), - )); - } + assert_ok!(SaftRegistry::::add_saft( + origin.clone(), + asset, + nav.into(), + units.into(), + )); + + assert_ok!(>::try_mutate(asset, |counter: &mut u32| -> Result<(), ()> { + *counter = o; + Ok(()) + })); + let call = Call::::convert_to_liquid( - asset, + asset, (Junction::Parent, Junction::Parachain(100)).into() ); - }: { - call.dispatch_bypass_filter(origin)? } - verify { + }: { call.dispatch_bypass_filter(origin)? } verify { assert_eq!( SaftRegistry::::saft_counter(asset), 0 diff --git a/runtime/common/src/weights/pallet_asset_index.rs b/runtime/common/src/weights/pallet_asset_index.rs index 17d99ec82a..82ce50d82f 100644 --- a/runtime/common/src/weights/pallet_asset_index.rs +++ b/runtime/common/src/weights/pallet_asset_index.rs @@ -1,12 +1,11 @@ // Copyright 2021 ChainSafe Systems // SPDX-License-Identifier: LGPL-3.0-only -//! Autogenerated weights for pallet_asset_index +//! Autogenerated weights for `pallet_asset_index` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-06-16, STEPS: `[]`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pint-local"), -//! DB CACHE: 128 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-09-03, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pint-local"), DB CACHE: 128 // Executed Command: // ./target/release/pint @@ -16,15 +15,23 @@ // -e // * // --execution -// Wasm +// wasm // --wasm-execution -// Compiled +// compiled // --raw -// --output -// ./runtime/src/weights/pallet_asset_index.rs // --chain // pint-local +// --output +// ./runtime/common/src/weights/pallet_asset_index.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -34,43 +41,76 @@ use sp_std::marker::PhantomData; /// Weight functions for pallet_asset_index. pub struct WeightInfo(PhantomData); impl pallet_asset_index::WeightInfo for WeightInfo { + // Storage: AssetIndex Assets (r:1 w:1) + // Storage: Tokens Accounts (r:1 w:1) + // Storage: Tokens TotalIssuance (r:1 w:1) + // Storage: System Account (r:2 w:2) fn add_asset() -> Weight { - (38_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (85_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) } - + // Storage: AssetIndex PendingWithdrawals (r:1 w:1) fn complete_withdraw() -> Weight { - Default::default() + (32_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - - fn remove_asset() -> Weight { - Default::default() + // Storage: AssetIndex Assets (r:2 w:0) + // Storage: Tokens Accounts (r:2 w:2) + // Storage: PriceFeed AssetFeeds (r:1 w:0) + // Storage: ChainlinkFeed Feeds (r:1 w:0) + // Storage: ChainlinkFeed Rounds (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: AssetIndex IndexTokenLocks (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: RemoteAssetManager AssetBalance (r:1 w:1) + // Storage: AssetIndex Deposits (r:1 w:1) + // Storage: AssetIndex LockedIndexToken (r:0 w:1) + fn deposit() -> Weight { + (131_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(12 as Weight)) + .saturating_add(T::DbWeight::get().writes(8 as Weight)) } - + fn remove_asset() -> Weight { + Default::default() + } + // Storage: AssetIndex Assets (r:1 w:1) fn register_asset() -> Weight { - (38_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - - fn deposit() -> Weight { - (38_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (17_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - + // Storage: AssetIndex Metadata (r:1 w:1) fn set_metadata() -> Weight { - (18_000_000 as Weight) + (16_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } - - fn unlock() -> Weight { - Default::default() - } - + // Storage: AssetIndex IndexTokenLocks (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: AssetIndex Deposits (r:1 w:1) + // Storage: AssetIndex Assets (r:2 w:0) + // Storage: Tokens Accounts (r:1 w:0) + // Storage: PriceFeed AssetFeeds (r:1 w:0) + // Storage: ChainlinkFeed Feeds (r:1 w:0) + // Storage: ChainlinkFeed Rounds (r:1 w:0) + // Storage: RemoteAssetManager AssetBalance (r:1 w:1) + // Storage: AssetIndex PendingWithdrawals (r:1 w:1) + // Storage: AssetIndex LockedIndexToken (r:0 w:1) fn withdraw() -> Weight { - Default::default() + (155_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(12 as Weight)) + .saturating_add(T::DbWeight::get().writes(7 as Weight)) + } + // Storage: AssetIndex IndexTokenLocks (r:1 w:1) + // Storage: Balances Locks (r:1 w:1) + // Storage: System Account (r:1 w:1) + // Storage: AssetIndex LockedIndexToken (r:0 w:1) + fn unlock() -> Weight { + (32_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } } diff --git a/runtime/common/src/weights/pallet_committee.rs b/runtime/common/src/weights/pallet_committee.rs index ae36249d01..eb5c8c3924 100644 --- a/runtime/common/src/weights/pallet_committee.rs +++ b/runtime/common/src/weights/pallet_committee.rs @@ -1,27 +1,37 @@ // Copyright 2021 ChainSafe Systems // SPDX-License-Identifier: LGPL-3.0-only -//! Autogenerated weights for pallet_committee +//! Autogenerated weights for `pallet_committee` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-06-04, STEPS: `[]`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-09-03, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pint-local"), DB CACHE: 128 // Executed Command: // ./target/release/pint // benchmark -// --execution -// wasm -// --wasm-execution -// compiled // -p // pallet_committee // -e // * +// --execution +// wasm +// --wasm-execution +// compiled // --raw +// --chain +// pint-local // --output -// runtime/src/weights/pallet_committee.rs +// ./runtime/common/src/weights/pallet_committee.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -31,23 +41,34 @@ use sp_std::marker::PhantomData; /// Weight functions for pallet_committee. pub struct WeightInfo(PhantomData); impl pallet_committee::WeightInfo for WeightInfo { + // Storage: Committee ProposalCount (r:1 w:1) + // Storage: Committee ActiveProposals (r:1 w:1) + // Storage: Committee Proposals (r:0 w:1) + // Storage: Committee Votes (r:0 w:1) fn propose() -> Weight { - (30_000_000 as Weight) + (25_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } + // Storage: Committee Members (r:1 w:0) + // Storage: Committee Votes (r:1 w:1) fn vote() -> Weight { - (28_000_000 as Weight) + (25_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Committee Members (r:1 w:0) + // Storage: Committee ExecutedProposals (r:1 w:1) + // Storage: Committee Votes (r:1 w:0) + // Storage: Committee Proposals (r:1 w:0) fn close() -> Weight { - (42_000_000 as Weight) + (92_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: Committee Members (r:1 w:1) fn add_constituent() -> Weight { - (16_000_000 as Weight) + (45_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } diff --git a/runtime/common/src/weights/pallet_local_treasury.rs b/runtime/common/src/weights/pallet_local_treasury.rs index b2236cfee8..eb87b4f833 100644 --- a/runtime/common/src/weights/pallet_local_treasury.rs +++ b/runtime/common/src/weights/pallet_local_treasury.rs @@ -1,27 +1,37 @@ // Copyright 2021 ChainSafe Systems // SPDX-License-Identifier: LGPL-3.0-only -//! Autogenerated weights for pallet_local_treasury +//! Autogenerated weights for `pallet_local_treasury` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-06-03, STEPS: `[]`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-09-03, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pint-local"), DB CACHE: 128 // Executed Command: // ./target/release/pint // benchmark -// --execution -// wasm -// --wasm-execution -// compiled // -p // pallet_local_treasury // -e // * +// --execution +// wasm +// --wasm-execution +// compiled // --raw +// --chain +// pint-local // --output -// runtime/src/weights/pallet_local_treasury.rs +// ./runtime/common/src/weights/pallet_local_treasury.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -31,8 +41,9 @@ use sp_std::marker::PhantomData; /// Weight functions for pallet_local_treasury. pub struct WeightInfo(PhantomData); impl pallet_local_treasury::WeightInfo for WeightInfo { + // Storage: System Account (r:2 w:2) fn withdraw() -> Weight { - (52_000_000 as Weight) + (51_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } diff --git a/runtime/common/src/weights/pallet_price_feed.rs b/runtime/common/src/weights/pallet_price_feed.rs index 3ce13be38e..58794d6f80 100644 --- a/runtime/common/src/weights/pallet_price_feed.rs +++ b/runtime/common/src/weights/pallet_price_feed.rs @@ -1,27 +1,37 @@ // Copyright 2021 ChainSafe Systems // SPDX-License-Identifier: LGPL-3.0-only -//! Autogenerated weights for pallet_price_feed +//! Autogenerated weights for `pallet_price_feed` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-06-03, STEPS: `[]`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-09-03, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pint-local"), DB CACHE: 128 // Executed Command: // ./target/release/pint // benchmark -// --execution -// wasm -// --wasm-execution -// compiled // -p // pallet_price_feed // -e // * +// --execution +// wasm +// --wasm-execution +// compiled // --raw +// --chain +// pint-local // --output -// runtime/src/weights/pallet_price_feed.rs +// ./runtime/common/src/weights/pallet_price_feed.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -31,12 +41,16 @@ use sp_std::marker::PhantomData; /// Weight functions for pallet_price_feed. pub struct WeightInfo(PhantomData); impl pallet_price_feed::WeightInfo for WeightInfo { + // Storage: PriceFeed AssetFeeds (r:1 w:1) fn map_asset_price_feed() -> Weight { - (18_000_000 as Weight) + (15_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } + // Storage: PriceFeed AssetFeeds (r:1 w:1) fn unmap_asset_price_feed() -> Weight { - (15_000_000 as Weight).saturating_add(T::DbWeight::get().reads(1 as Weight)) + (17_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) } } diff --git a/runtime/common/src/weights/pallet_saft_registry.rs b/runtime/common/src/weights/pallet_saft_registry.rs index 856288dbbb..a7ef3d803a 100644 --- a/runtime/common/src/weights/pallet_saft_registry.rs +++ b/runtime/common/src/weights/pallet_saft_registry.rs @@ -1,27 +1,37 @@ // Copyright 2021 ChainSafe Systems // SPDX-License-Identifier: LGPL-3.0-only -//! Autogenerated weights for pallet_saft_registry +//! Autogenerated weights for `pallet_saft_registry` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-06-03, STEPS: `[]`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: None, DB CACHE: 128 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-09-03, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pint-local"), DB CACHE: 128 // Executed Command: // ./target/release/pint // benchmark -// --execution -// wasm -// --wasm-execution -// compiled // -p // pallet_saft_registry // -e // * +// --execution +// wasm +// --wasm-execution +// compiled // --raw +// --chain +// pint-local // --output -// runtime/src/weights/pallet_saft_registry.rs +// ./runtime/common/src/weights/pallet_saft_registry.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -31,26 +41,49 @@ use sp_std::marker::PhantomData; /// Weight functions for pallet_saft_registry. pub struct WeightInfo(PhantomData); impl pallet_saft_registry::WeightInfo for WeightInfo { + // Storage: AssetIndex Assets (r:3 w:1) + // Storage: SaftRegistry SAFTNetAssetValue (r:1 w:1) + // Storage: Tokens Accounts (r:2 w:1) + // Storage: PriceFeed AssetFeeds (r:1 w:0) + // Storage: ChainlinkFeed Feeds (r:1 w:0) + // Storage: ChainlinkFeed Rounds (r:1 w:0) + // Storage: Tokens TotalIssuance (r:1 w:1) + // Storage: System Account (r:2 w:2) + // Storage: SaftRegistry SAFTCounter (r:1 w:1) + // Storage: SaftRegistry ActiveSAFTs (r:0 w:1) fn add_saft() -> Weight { - (23_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) + (105_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(13 as Weight)) + .saturating_add(T::DbWeight::get().writes(8 as Weight)) } - + // Storage: SaftRegistry ActiveSAFTs (r:1 w:1) + // Storage: AssetIndex Assets (r:1 w:0) + // Storage: System Account (r:1 w:1) + // Storage: Tokens Accounts (r:1 w:1) + // Storage: Tokens TotalIssuance (r:1 w:1) + // Storage: SaftRegistry SAFTNetAssetValue (r:1 w:1) fn remove_saft() -> Weight { + (64_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + } + // Storage: SaftRegistry ActiveSAFTs (r:1 w:1) + // Storage: SaftRegistry SAFTNetAssetValue (r:1 w:1) + fn report_nav() -> Weight { (23_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } - - fn report_nav() -> Weight { - (18_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn convert_to_liquid(_: u32) -> Weight { - (18_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) + // Storage: AssetIndex Assets (r:1 w:1) + // Storage: SaftRegistry SAFTNetAssetValue (r:1 w:1) + // Storage: SaftRegistry SAFTCounter (r:1 w:1) + // Storage: SaftRegistry ActiveSAFTs (r:1 w:1) + fn convert_to_liquid(o: u32, ) -> Weight { + (27_405_000 as Weight) + // Standard Error: 2_000 + .saturating_add((3_263_000 as Weight).saturating_mul(o as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(o as Weight))) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } }