From 18b7e25dcbb2ac85c198828ba0784be57c85f914 Mon Sep 17 00:00:00 2001 From: clearloop Date: Fri, 3 Sep 2021 17:05:50 +0800 Subject: [PATCH 1/6] feat(runtime): regenreate weights for pallet_asset_index --- .../common/src/weights/pallet_asset_index.rs | 105 ++++++++++++------ 1 file changed, 68 insertions(+), 37 deletions(-) diff --git a/runtime/common/src/weights/pallet_asset_index.rs b/runtime/common/src/weights/pallet_asset_index.rs index 17d99ec82a..e9948c32f4 100644 --- a/runtime/common/src/weights/pallet_asset_index.rs +++ b/runtime/common/src/weights/pallet_asset_index.rs @@ -1,12 +1,8 @@ -// 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: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("pint-local"), DB CACHE: 128 // Executed Command: // ./target/release/pint @@ -16,15 +12,17 @@ // -e // * // --execution -// Wasm +// wasm // --wasm-execution -// Compiled +// compiled // --raw // --output -// ./runtime/src/weights/pallet_asset_index.rs +// ./runtime/common/src/weights/pallet_asset_index.rs // --chain // pint-local + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -34,43 +32,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)) + (87_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() + (28_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 { + (121_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(12 as Weight)) + .saturating_add(T::DbWeight::get().writes(8 as Weight)) } - + // 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)) } - + fn remove_asset() -> Weight { + Default::default() + } + // 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() + (145_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 { + (30_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } } From 5a8ecf43b59c6ac2a2112466b56bed53ab7216e8 Mon Sep 17 00:00:00 2001 From: clearloop Date: Fri, 3 Sep 2021 17:59:06 +0800 Subject: [PATCH 2/6] feat(runtime): regenerate weights for palelt committee and pallet price_feed --- pallets/saft-registry/src/benchmarking.rs | 10 +- .../common/src/weights/pallet_asset_index.rs | 115 ++++++++++-------- .../common/src/weights/pallet_committee.rs | 71 ++++++++--- .../common/src/weights/pallet_price_feed.rs | 57 ++++++--- .../src/weights/pallet_saft_registry.rs | 71 +++++++---- 5 files changed, 216 insertions(+), 108 deletions(-) diff --git a/pallets/saft-registry/src/benchmarking.rs b/pallets/saft-registry/src/benchmarking.rs index 1e6ff0b079..9d789fa828 100644 --- a/pallets/saft-registry/src/benchmarking.rs +++ b/pallets/saft-registry/src/benchmarking.rs @@ -95,9 +95,11 @@ benchmarks! { } convert_to_liquid { + let i in 0 .. 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( @@ -108,7 +110,7 @@ benchmarks! { )); // Create saft records - for i in 0 .. MAX_SAFT_RECORDS { + for _ in 0 .. i { assert_ok!(SaftRegistry::::add_saft( origin.clone(), asset, @@ -120,9 +122,7 @@ benchmarks! { 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 e9948c32f4..8773090200 100644 --- a/runtime/common/src/weights/pallet_asset_index.rs +++ b/runtime/common/src/weights/pallet_asset_index.rs @@ -1,4 +1,7 @@ -//! Autogenerated weights for `pallet_asset_index` +// Copyright 2021 ChainSafe Systems +// SPDX-License-Identifier: LGPL-3.0-only + +//! Autogenerated weights for pallet_asset_index //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev //! DATE: 2021-09-03, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` @@ -20,88 +23,104 @@ // ./runtime/common/src/weights/pallet_asset_index.rs // --chain // pint-local +// --template +// ./templates/pallet-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(clippy::unnecessary_cast)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; 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) +/// Weight functions needed for pallet_asset_index. +pub trait WeightInfo { + fn add_asset() -> Weight; + fn complete_withdraw() -> Weight; + fn deposit() -> Weight; + fn register_asset() -> Weight; + fn set_metadata() -> Weight; + fn withdraw() -> Weight; + fn unlock() -> Weight; +} + +/// Weights for pallet_asset_index using the PINT node and recommended hardware. +pub struct PintWeight(PhantomData); +impl WeightInfo for PintWeight { fn add_asset() -> Weight { - (87_000_000 as Weight) + (88_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 { - (28_000_000 as Weight) + (30_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: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 { - (121_000_000 as Weight) + (124_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(12 as Weight)) .saturating_add(T::DbWeight::get().writes(8 as Weight)) } - // Storage: AssetIndex Assets (r:1 w:1) fn register_asset() -> Weight { - (17_000_000 as Weight) + (19_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 Metadata (r:1 w:1) fn set_metadata() -> Weight { - (16_000_000 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 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 { - (145_000_000 as Weight) + (141_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 { (30_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } } + +// For backwards compatibility and tests +impl WeightInfo for () { + fn add_asset() -> Weight { + (88_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) + } + fn complete_withdraw() -> Weight { + (30_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn deposit() -> Weight { + (124_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(12 as Weight)) + .saturating_add(RocksDbWeight::get().writes(8 as Weight)) + } + fn register_asset() -> Weight { + (19_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn set_metadata() -> Weight { + (17_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn withdraw() -> Weight { + (141_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(12 as Weight)) + .saturating_add(RocksDbWeight::get().writes(7 as Weight)) + } + fn unlock() -> Weight { + (30_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + } +} \ No newline at end of file diff --git a/runtime/common/src/weights/pallet_committee.rs b/runtime/common/src/weights/pallet_committee.rs index ae36249d01..f12f31485c 100644 --- a/runtime/common/src/weights/pallet_committee.rs +++ b/runtime/common/src/weights/pallet_committee.rs @@ -3,52 +3,91 @@ //! 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: `1`, REPEAT: 1, 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 // --output -// runtime/src/weights/pallet_committee.rs +// ./runtime/common/src/weights/pallet_committee.rs +// --chain +// pint-local +// --template +// ./templates/pallet-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(clippy::unnecessary_cast)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; -/// Weight functions for pallet_committee. -pub struct WeightInfo(PhantomData); -impl pallet_committee::WeightInfo for WeightInfo { +/// Weight functions needed for pallet_committee. +pub trait WeightInfo { + fn propose() -> Weight; + fn vote() -> Weight; + fn close() -> Weight; + fn add_constituent() -> Weight; +} + +/// Weights for pallet_committee using the PINT node and recommended hardware. +pub struct PintWeight(PhantomData); +impl WeightInfo for PintWeight { fn propose() -> Weight { - (30_000_000 as Weight) + (26_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } fn vote() -> Weight { - (28_000_000 as Weight) + (23_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn close() -> Weight { - (42_000_000 as Weight) + (35_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(4 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } fn add_constituent() -> Weight { - (16_000_000 as Weight) + (18_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } } + +// For backwards compatibility and tests +impl WeightInfo for () { + fn propose() -> Weight { + (26_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + } + fn vote() -> Weight { + (23_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn close() -> Weight { + (35_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn add_constituent() -> Weight { + (18_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } +} \ No newline at end of file diff --git a/runtime/common/src/weights/pallet_price_feed.rs b/runtime/common/src/weights/pallet_price_feed.rs index 3ce13be38e..56cc45a70d 100644 --- a/runtime/common/src/weights/pallet_price_feed.rs +++ b/runtime/common/src/weights/pallet_price_feed.rs @@ -3,40 +3,69 @@ //! 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: `1`, REPEAT: 1, 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 // --output -// runtime/src/weights/pallet_price_feed.rs +// ./runtime/common/src/weights/pallet_price_feed.rs +// --chain +// pint-local +// --template +// ./templates/pallet-weight-template.hbs + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(clippy::unnecessary_cast)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; -/// Weight functions for pallet_price_feed. -pub struct WeightInfo(PhantomData); -impl pallet_price_feed::WeightInfo for WeightInfo { +/// Weight functions needed for pallet_price_feed. +pub trait WeightInfo { + fn map_asset_price_feed() -> Weight; + fn unmap_asset_price_feed() -> Weight; +} + +/// Weights for pallet_price_feed using the PINT node and recommended hardware. +pub struct PintWeight(PhantomData); +impl WeightInfo for PintWeight { fn map_asset_price_feed() -> Weight { - (18_000_000 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)) } fn unmap_asset_price_feed() -> Weight { - (15_000_000 as Weight).saturating_add(T::DbWeight::get().reads(1 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)) } } + +// For backwards compatibility and tests +impl WeightInfo for () { + fn map_asset_price_feed() -> Weight { + (17_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn unmap_asset_price_feed() -> Weight { + (16_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } +} \ No newline at end of file diff --git a/runtime/common/src/weights/pallet_saft_registry.rs b/runtime/common/src/weights/pallet_saft_registry.rs index 856288dbbb..5467c2162c 100644 --- a/runtime/common/src/weights/pallet_saft_registry.rs +++ b/runtime/common/src/weights/pallet_saft_registry.rs @@ -1,27 +1,28 @@ -// 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: `1`, REPEAT: 1, 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 // --output -// runtime/src/weights/pallet_saft_registry.rs +// ./runtime/common/src/weights/pallet_saft_registry.rs +// --chain +// pint-local + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -31,26 +32,46 @@ 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)) + (109_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)) - } + // 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:100 w:100) 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)) + (571_000_000 as Weight) + .saturating_add(T::DbWeight::get().reads(103 as Weight)) + .saturating_add(T::DbWeight::get().writes(103 as Weight)) } } From 89b85f32e6962cc8ff85e1ca1a317539b0d6cabf Mon Sep 17 00:00:00 2001 From: clearloop Date: Fri, 3 Sep 2021 18:23:55 +0800 Subject: [PATCH 3/6] feat(runtime): use default weight template --- .../common/src/weights/pallet_asset_index.rs | 116 ++++++++---------- .../common/src/weights/pallet_committee.rs | 66 ++++------ .../common/src/weights/pallet_price_feed.rs | 43 ++----- 3 files changed, 82 insertions(+), 143 deletions(-) diff --git a/runtime/common/src/weights/pallet_asset_index.rs b/runtime/common/src/weights/pallet_asset_index.rs index 8773090200..930826aee8 100644 --- a/runtime/common/src/weights/pallet_asset_index.rs +++ b/runtime/common/src/weights/pallet_asset_index.rs @@ -1,7 +1,7 @@ // 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 4.0.0-dev //! DATE: 2021-09-03, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` @@ -14,113 +14,97 @@ // pallet_asset_index // -e // * +// --raw +// --output +// ./runtime/common/src/weights/pallet_asset_index.rs // --execution // wasm // --wasm-execution // compiled -// --raw -// --output -// ./runtime/common/src/weights/pallet_asset_index.rs // --chain // pint-local -// --template -// ./templates/pallet-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; -/// Weight functions needed for pallet_asset_index. -pub trait WeightInfo { - fn add_asset() -> Weight; - fn complete_withdraw() -> Weight; - fn deposit() -> Weight; - fn register_asset() -> Weight; - fn set_metadata() -> Weight; - fn withdraw() -> Weight; - fn unlock() -> Weight; -} - -/// Weights for pallet_asset_index using the PINT node and recommended hardware. -pub struct PintWeight(PhantomData); -impl WeightInfo for PintWeight { +/// 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 { - (88_000_000 as Weight) + (91_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 { - (30_000_000 as Weight) + (29_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: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 { - (124_000_000 as Weight) + (128_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(12 as Weight)) .saturating_add(T::DbWeight::get().writes(8 as Weight)) } + // Storage: AssetIndex Assets (r:1 w:1) fn register_asset() -> Weight { - (19_000_000 as 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 remove_asset() -> Weight { + Default::default() + } + // Storage: AssetIndex Metadata (r:1 w:1) fn set_metadata() -> Weight { - (17_000_000 as 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 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 { (141_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 { (30_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(3 as Weight)) .saturating_add(T::DbWeight::get().writes(4 as Weight)) } } - -// For backwards compatibility and tests -impl WeightInfo for () { - fn add_asset() -> Weight { - (88_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(5 as Weight)) - .saturating_add(RocksDbWeight::get().writes(5 as Weight)) - } - fn complete_withdraw() -> Weight { - (30_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn deposit() -> Weight { - (124_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(12 as Weight)) - .saturating_add(RocksDbWeight::get().writes(8 as Weight)) - } - fn register_asset() -> Weight { - (19_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn set_metadata() -> Weight { - (17_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn withdraw() -> Weight { - (141_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(12 as Weight)) - .saturating_add(RocksDbWeight::get().writes(7 as Weight)) - } - fn unlock() -> Weight { - (30_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(3 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) - } -} \ No newline at end of file diff --git a/runtime/common/src/weights/pallet_committee.rs b/runtime/common/src/weights/pallet_committee.rs index f12f31485c..6108c84f1d 100644 --- a/runtime/common/src/weights/pallet_committee.rs +++ b/runtime/common/src/weights/pallet_committee.rs @@ -1,7 +1,7 @@ // 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 4.0.0-dev //! DATE: 2021-09-03, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` @@ -14,80 +14,56 @@ // pallet_committee // -e // * +// --raw +// --output +// ./runtime/common/src/weights/pallet_committee.rs // --execution // wasm // --wasm-execution // compiled -// --raw -// --output -// ./runtime/common/src/weights/pallet_committee.rs // --chain // pint-local -// --template -// ./templates/pallet-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; -/// Weight functions needed for pallet_committee. -pub trait WeightInfo { - fn propose() -> Weight; - fn vote() -> Weight; - fn close() -> Weight; - fn add_constituent() -> Weight; -} - -/// Weights for pallet_committee using the PINT node and recommended hardware. -pub struct PintWeight(PhantomData); -impl WeightInfo for PintWeight { +/// 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 { - (26_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 { (23_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 { - (35_000_000 as Weight) + (34_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 { (18_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } } - -// For backwards compatibility and tests -impl WeightInfo for () { - fn propose() -> Weight { - (26_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(2 as Weight)) - .saturating_add(RocksDbWeight::get().writes(4 as Weight)) - } - fn vote() -> Weight { - (23_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(2 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn close() -> Weight { - (35_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(4 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn add_constituent() -> Weight { - (18_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } -} \ No newline at end of file diff --git a/runtime/common/src/weights/pallet_price_feed.rs b/runtime/common/src/weights/pallet_price_feed.rs index 56cc45a70d..9913214535 100644 --- a/runtime/common/src/weights/pallet_price_feed.rs +++ b/runtime/common/src/weights/pallet_price_feed.rs @@ -1,7 +1,7 @@ // 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 4.0.0-dev //! DATE: 2021-09-03, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` @@ -14,58 +14,37 @@ // pallet_price_feed // -e // * +// --raw +// --output +// ./runtime/common/src/weights/pallet_price_feed.rs // --execution // wasm // --wasm-execution // compiled -// --raw -// --output -// ./runtime/common/src/weights/pallet_price_feed.rs // --chain // pint-local -// --template -// ./templates/pallet-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; -/// Weight functions needed for pallet_price_feed. -pub trait WeightInfo { - fn map_asset_price_feed() -> Weight; - fn unmap_asset_price_feed() -> Weight; -} - -/// Weights for pallet_price_feed using the PINT node and recommended hardware. -pub struct PintWeight(PhantomData); -impl WeightInfo for PintWeight { +/// 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 { (17_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 { - (16_000_000 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)) } } - -// For backwards compatibility and tests -impl WeightInfo for () { - fn map_asset_price_feed() -> Weight { - (17_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } - fn unmap_asset_price_feed() -> Weight { - (16_000_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(1 as Weight)) - .saturating_add(RocksDbWeight::get().writes(1 as Weight)) - } -} \ No newline at end of file From 7e90178b995f91dfcbca7aaa8eee697dc974fba3 Mon Sep 17 00:00:00 2001 From: clearloop Date: Fri, 3 Sep 2021 18:33:21 +0800 Subject: [PATCH 4/6] feat(runtime): add weights of local-treasury --- pallets/local-treasury/src/benchmarking.rs | 2 +- .../src/weights/pallet_local_treasury.rs | 25 +++++++++++-------- 2 files changed, 16 insertions(+), 11 deletions(-) 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/runtime/common/src/weights/pallet_local_treasury.rs b/runtime/common/src/weights/pallet_local_treasury.rs index b2236cfee8..6ecc73a9b9 100644 --- a/runtime/common/src/weights/pallet_local_treasury.rs +++ b/runtime/common/src/weights/pallet_local_treasury.rs @@ -1,27 +1,31 @@ // 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: `1`, REPEAT: 1, 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 // --output -// runtime/src/weights/pallet_local_treasury.rs +// ./runtime/common/src/weights/pallet_local_treasury.rs +// --chain +// pint-local + +#![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] @@ -31,8 +35,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) + (50_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } From 7b8a7bc78145aff46f24decd244b6f7d4c8e5235 Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 4 Sep 2021 00:35:08 +0800 Subject: [PATCH 5/6] feat(saft-registry): fix the iterator of call convert_to_liquid --- pallets/saft-registry/src/benchmarking.rs | 25 +++++++++------- .../src/weights/pallet_saft_registry.rs | 30 +++++++++++++------ 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/pallets/saft-registry/src/benchmarking.rs b/pallets/saft-registry/src/benchmarking.rs index 9d789fa828..2b980199f4 100644 --- a/pallets/saft-registry/src/benchmarking.rs +++ b/pallets/saft-registry/src/benchmarking.rs @@ -95,7 +95,7 @@ benchmarks! { } convert_to_liquid { - let i in 0 .. MAX_SAFT_RECORDS; + let o in 1 .. MAX_SAFT_RECORDS; let nav = 1337u32; let units = 1234u32; @@ -109,17 +109,20 @@ benchmarks! { 1000u32.into() )); - // Create saft records - for _ in 0 .. i { - 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 { diff --git a/runtime/common/src/weights/pallet_saft_registry.rs b/runtime/common/src/weights/pallet_saft_registry.rs index 5467c2162c..a7ef3d803a 100644 --- a/runtime/common/src/weights/pallet_saft_registry.rs +++ b/runtime/common/src/weights/pallet_saft_registry.rs @@ -1,7 +1,10 @@ +// Copyright 2021 ChainSafe Systems +// SPDX-License-Identifier: LGPL-3.0-only + //! Autogenerated weights for `pallet_saft_registry` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2021-09-03, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! 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: @@ -16,10 +19,16 @@ // --wasm-execution // compiled // --raw -// --output -// ./runtime/common/src/weights/pallet_saft_registry.rs // --chain // pint-local +// --output +// ./runtime/common/src/weights/pallet_saft_registry.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 #![cfg_attr(rustfmt, rustfmt_skip)] @@ -43,7 +52,7 @@ impl pallet_saft_registry::WeightInfo for WeightInfo // Storage: SaftRegistry SAFTCounter (r:1 w:1) // Storage: SaftRegistry ActiveSAFTs (r:0 w:1) fn add_saft() -> Weight { - (109_000_000 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)) } @@ -68,10 +77,13 @@ impl pallet_saft_registry::WeightInfo for WeightInfo // 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:100 w:100) - fn convert_to_liquid(_: u32) -> Weight { - (571_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(103 as Weight)) - .saturating_add(T::DbWeight::get().writes(103 as Weight)) + // 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)) } } From 20bc7f8a1954b4219b57461bf83df004a8af56d0 Mon Sep 17 00:00:00 2001 From: clearloop Date: Sat, 4 Sep 2021 00:40:30 +0800 Subject: [PATCH 6/6] feat(runtime): regenerate weights for pallets with steps --- .../common/src/weights/pallet_asset_index.rs | 34 +++++++++++-------- .../common/src/weights/pallet_committee.rs | 20 +++++++---- .../src/weights/pallet_local_treasury.rs | 14 +++++--- .../common/src/weights/pallet_price_feed.rs | 16 ++++++--- 4 files changed, 54 insertions(+), 30 deletions(-) diff --git a/runtime/common/src/weights/pallet_asset_index.rs b/runtime/common/src/weights/pallet_asset_index.rs index 930826aee8..82ce50d82f 100644 --- a/runtime/common/src/weights/pallet_asset_index.rs +++ b/runtime/common/src/weights/pallet_asset_index.rs @@ -4,7 +4,7 @@ //! Autogenerated weights for `pallet_asset_index` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2021-09-03, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! 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: @@ -14,15 +14,21 @@ // pallet_asset_index // -e // * -// --raw -// --output -// ./runtime/common/src/weights/pallet_asset_index.rs // --execution // wasm // --wasm-execution // compiled +// --raw // --chain // pint-local +// --output +// ./runtime/common/src/weights/pallet_asset_index.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 #![cfg_attr(rustfmt, rustfmt_skip)] @@ -40,13 +46,13 @@ impl pallet_asset_index::WeightInfo for WeightInfo { // Storage: Tokens TotalIssuance (r:1 w:1) // Storage: System Account (r:2 w:2) fn add_asset() -> Weight { - (91_000_000 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 { - (29_000_000 as Weight) + (32_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } @@ -62,22 +68,22 @@ impl pallet_asset_index::WeightInfo for WeightInfo { // Storage: AssetIndex Deposits (r:1 w:1) // Storage: AssetIndex LockedIndexToken (r:0 w:1) fn deposit() -> Weight { - (128_000_000 as 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 { - (18_000_000 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)) } - fn remove_asset() -> Weight { - Default::default() - } // 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)) } @@ -94,7 +100,7 @@ impl pallet_asset_index::WeightInfo for WeightInfo { // Storage: AssetIndex PendingWithdrawals (r:1 w:1) // Storage: AssetIndex LockedIndexToken (r:0 w:1) fn withdraw() -> Weight { - (141_000_000 as Weight) + (155_000_000 as Weight) .saturating_add(T::DbWeight::get().reads(12 as Weight)) .saturating_add(T::DbWeight::get().writes(7 as Weight)) } @@ -103,7 +109,7 @@ impl pallet_asset_index::WeightInfo for WeightInfo { // Storage: System Account (r:1 w:1) // Storage: AssetIndex LockedIndexToken (r:0 w:1) fn unlock() -> Weight { - (30_000_000 as 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 6108c84f1d..eb5c8c3924 100644 --- a/runtime/common/src/weights/pallet_committee.rs +++ b/runtime/common/src/weights/pallet_committee.rs @@ -4,7 +4,7 @@ //! Autogenerated weights for `pallet_committee` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2021-09-03, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! 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: @@ -14,15 +14,21 @@ // pallet_committee // -e // * -// --raw -// --output -// ./runtime/common/src/weights/pallet_committee.rs // --execution // wasm // --wasm-execution // compiled +// --raw // --chain // pint-local +// --output +// ./runtime/common/src/weights/pallet_committee.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 #![cfg_attr(rustfmt, rustfmt_skip)] @@ -47,7 +53,7 @@ impl pallet_committee::WeightInfo for WeightInfo { // Storage: Committee Members (r:1 w:0) // Storage: Committee Votes (r:1 w:1) fn vote() -> Weight { - (23_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)) } @@ -56,13 +62,13 @@ impl pallet_committee::WeightInfo for WeightInfo { // Storage: Committee Votes (r:1 w:0) // Storage: Committee Proposals (r:1 w:0) fn close() -> Weight { - (34_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 { - (18_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 6ecc73a9b9..eb87b4f833 100644 --- a/runtime/common/src/weights/pallet_local_treasury.rs +++ b/runtime/common/src/weights/pallet_local_treasury.rs @@ -4,7 +4,7 @@ //! Autogenerated weights for `pallet_local_treasury` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2021-09-03, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! 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: @@ -19,10 +19,16 @@ // --wasm-execution // compiled // --raw -// --output -// ./runtime/common/src/weights/pallet_local_treasury.rs // --chain // pint-local +// --output +// ./runtime/common/src/weights/pallet_local_treasury.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 #![cfg_attr(rustfmt, rustfmt_skip)] @@ -37,7 +43,7 @@ pub struct WeightInfo(PhantomData); impl pallet_local_treasury::WeightInfo for WeightInfo { // Storage: System Account (r:2 w:2) fn withdraw() -> Weight { - (50_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 9913214535..58794d6f80 100644 --- a/runtime/common/src/weights/pallet_price_feed.rs +++ b/runtime/common/src/weights/pallet_price_feed.rs @@ -4,7 +4,7 @@ //! Autogenerated weights for `pallet_price_feed` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2021-09-03, STEPS: `1`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! 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: @@ -14,15 +14,21 @@ // pallet_price_feed // -e // * -// --raw -// --output -// ./runtime/common/src/weights/pallet_price_feed.rs // --execution // wasm // --wasm-execution // compiled +// --raw // --chain // pint-local +// --output +// ./runtime/common/src/weights/pallet_price_feed.rs +// --steps +// 50 +// --repeat +// 20 +// --heap-pages +// 4096 #![cfg_attr(rustfmt, rustfmt_skip)] @@ -37,7 +43,7 @@ pub struct WeightInfo(PhantomData); impl pallet_price_feed::WeightInfo for WeightInfo { // Storage: PriceFeed AssetFeeds (r:1 w:1) fn map_asset_price_feed() -> Weight { - (17_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)) }