From 2e25b8056bb08a0d365f5303eae5e051ce055527 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Mon, 3 May 2021 23:23:51 +1200 Subject: [PATCH 1/6] update weights for auction & authority --- auction/src/default_weight.rs | 23 ----------- auction/src/lib.rs | 8 +--- auction/src/weights.rs | 53 ++++++++++++++++++++++++ authority/src/default_weight.rs | 44 -------------------- authority/src/lib.rs | 13 ++---- authority/src/weights.rs | 71 +++++++++++++++++++++++++++++++++ 6 files changed, 129 insertions(+), 83 deletions(-) delete mode 100644 auction/src/default_weight.rs create mode 100644 auction/src/weights.rs delete mode 100644 authority/src/default_weight.rs create mode 100644 authority/src/weights.rs diff --git a/auction/src/default_weight.rs b/auction/src/default_weight.rs deleted file mode 100644 index 26e552fef..000000000 --- a/auction/src/default_weight.rs +++ /dev/null @@ -1,23 +0,0 @@ -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 - -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; - -impl crate::WeightInfo for () { - fn bid_collateral_auction() -> Weight { - (493_957_000 as Weight) - .saturating_add(DbWeight::get().reads(12 as Weight)) - .saturating_add(DbWeight::get().writes(12 as Weight)) - } - fn on_finalize(c: u32) -> Weight { - (50_992_000 as Weight) - .saturating_add((171_653_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(c as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(c as Weight))) - } -} diff --git a/auction/src/lib.rs b/auction/src/lib.rs index 184fc4259..69aefa886 100644 --- a/auction/src/lib.rs +++ b/auction/src/lib.rs @@ -21,21 +21,17 @@ use sp_runtime::{ DispatchError, DispatchResult, }; -mod default_weight; mod mock; mod tests; +mod weights; pub use module::*; +pub use weights::WeightInfo; #[frame_support::pallet] pub mod module { use super::*; - pub trait WeightInfo { - fn bid_collateral_auction() -> Weight; - fn on_finalize(c: u32) -> Weight; - } - #[pallet::config] pub trait Config: frame_system::Config { type Event: From> + IsType<::Event>; diff --git a/auction/src/weights.rs b/auction/src/weights.rs new file mode 100644 index 000000000..751e5df7b --- /dev/null +++ b/auction/src/weights.rs @@ -0,0 +1,53 @@ +//! Autogenerated weights for orml_auction +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// /Users/xiliangchen/projects/acala/target/release/acala +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=orml_auction +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./auction/src/weights.rs +// --template +// ../templates/orml-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 sp_std::marker::PhantomData; + +/// Weight functions needed for orml_auction. +pub trait WeightInfo { + fn bid_collateral_auction(d: u32, ) -> Weight; + fn on_finalize(c: u32, d: u32, ) -> Weight; +} + +/// Default weights. +impl WeightInfo for () { + fn bid_collateral_auction(_d: u32, ) -> Weight { + (127_663_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(10 as Weight)) + .saturating_add(RocksDbWeight::get().writes(12 as Weight)) + } + fn on_finalize(c: u32, _d: u32, ) -> Weight { + (17_808_000 as Weight) + // Standard Error: 11_000 + .saturating_add((57_660_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(RocksDbWeight::get().reads(10 as Weight)) + .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(c as Weight))) + .saturating_add(RocksDbWeight::get().writes(7 as Weight)) + .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(c as Weight))) + } +} diff --git a/authority/src/default_weight.rs b/authority/src/default_weight.rs deleted file mode 100644 index 802a567bb..000000000 --- a/authority/src/default_weight.rs +++ /dev/null @@ -1,44 +0,0 @@ -//! Weights for orml_authority -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 -//! DATE: 2020-11-18, STEPS: [1, ], REPEAT: 1, LOW RANGE: [], HIGH RANGE: [] -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB -//! CACHE: 128 - -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for orml_authority. -impl crate::WeightInfo for () { - fn dispatch_as() -> Weight { - (48_680_000 as Weight) - } - fn schedule_dispatch_without_delay() -> Weight { - (121_510_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn schedule_dispatch_with_delay() -> Weight { - (130_696_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn fast_track_scheduled_dispatch() -> Weight { - (145_530_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn delay_scheduled_dispatch() -> Weight { - (145_169_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn cancel_scheduled_dispatch() -> Weight { - (104_990_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } -} diff --git a/authority/src/lib.rs b/authority/src/lib.rs index 9ee84333b..ef4aec224 100644 --- a/authority/src/lib.rs +++ b/authority/src/lib.rs @@ -35,9 +35,11 @@ use sp_runtime::{ }; use sp_std::prelude::*; -mod default_weight; mod mock; mod tests; +mod weights; + +pub use weights::WeightInfo; /// A delayed origin. Can only be dispatched via `dispatch_as` with a delay. #[derive(PartialEq, Eq, Clone, RuntimeDebug, Encode, Decode)] @@ -120,15 +122,6 @@ pub use module::*; pub mod module { use super::*; - pub trait WeightInfo { - fn dispatch_as() -> Weight; - fn schedule_dispatch_without_delay() -> Weight; - fn schedule_dispatch_with_delay() -> Weight; - fn fast_track_scheduled_dispatch() -> Weight; - fn delay_scheduled_dispatch() -> Weight; - fn cancel_scheduled_dispatch() -> Weight; - } - /// Origin for the authority module. pub type Origin = DelayedOrigin<::BlockNumber, ::PalletsOrigin>; pub(crate) type CallOf = ::Call; diff --git a/authority/src/weights.rs b/authority/src/weights.rs new file mode 100644 index 000000000..d7cc5082a --- /dev/null +++ b/authority/src/weights.rs @@ -0,0 +1,71 @@ +//! Autogenerated weights for orml_authority +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// /Users/xiliangchen/projects/acala/target/release/acala +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=orml_authority +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./authority/src/weights.rs +// --template +// ../templates/orml-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 sp_std::marker::PhantomData; + +/// Weight functions needed for orml_authority. +pub trait WeightInfo { + fn dispatch_as() -> Weight; + fn schedule_dispatch_without_delay() -> Weight; + fn schedule_dispatch_with_delay() -> Weight; + fn fast_track_scheduled_dispatch() -> Weight; + fn delay_scheduled_dispatch() -> Weight; + fn cancel_scheduled_dispatch() -> Weight; +} + +/// Default weights. +impl WeightInfo for () { + fn dispatch_as() -> Weight { + (10_000_000 as Weight) + } + fn schedule_dispatch_without_delay() -> Weight { + (28_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + } + fn schedule_dispatch_with_delay() -> Weight { + (29_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + } + fn fast_track_scheduled_dispatch() -> Weight { + (36_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + } + fn delay_scheduled_dispatch() -> Weight { + (36_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + } + fn cancel_scheduled_dispatch() -> Weight { + (24_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } +} From c086023c59260d24f644a17601767bdab7463be2 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Tue, 4 May 2021 10:02:21 +1200 Subject: [PATCH 2/6] update --- auction/src/weights.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/auction/src/weights.rs b/auction/src/weights.rs index 751e5df7b..75b15353c 100644 --- a/auction/src/weights.rs +++ b/auction/src/weights.rs @@ -30,21 +30,21 @@ use sp_std::marker::PhantomData; /// Weight functions needed for orml_auction. pub trait WeightInfo { - fn bid_collateral_auction(d: u32, ) -> Weight; - fn on_finalize(c: u32, d: u32, ) -> Weight; + fn bid_collateral_auction() -> Weight; + fn on_finalize(c: u32, ) -> Weight; } /// Default weights. impl WeightInfo for () { - fn bid_collateral_auction(_d: u32, ) -> Weight { - (127_663_000 as Weight) - .saturating_add(RocksDbWeight::get().reads(10 as Weight)) - .saturating_add(RocksDbWeight::get().writes(12 as Weight)) + fn bid_collateral_auction() -> Weight { + (107_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(8 as Weight)) + .saturating_add(RocksDbWeight::get().writes(9 as Weight)) } - fn on_finalize(c: u32, _d: u32, ) -> Weight { - (17_808_000 as Weight) - // Standard Error: 11_000 - .saturating_add((57_660_000 as Weight).saturating_mul(c as Weight)) + fn on_finalize(c: u32, ) -> Weight { + (7_540_000 as Weight) + // Standard Error: 13_000 + .saturating_add((57_808_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(10 as Weight)) .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(c as Weight))) .saturating_add(RocksDbWeight::get().writes(7 as Weight)) From 5fdad94cceb33f992c21d70f1041b2f6f52c04ae Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Tue, 4 May 2021 11:21:55 +1200 Subject: [PATCH 3/6] update weight info for orml-currencies --- currencies/src/lib.rs | 11 ++----- currencies/src/weights.rs | 67 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 currencies/src/weights.rs diff --git a/currencies/src/lib.rs b/currencies/src/lib.rs index db2fd9d44..cec25c405 100644 --- a/currencies/src/lib.rs +++ b/currencies/src/lib.rs @@ -65,24 +65,17 @@ use sp_std::{ marker, result, }; -mod default_weight; mod mock; mod tests; +mod weights; pub use module::*; +pub use weights::WeightInfo; #[frame_support::pallet] pub mod module { use super::*; - pub trait WeightInfo { - fn transfer_non_native_currency() -> Weight; - fn transfer_native_currency() -> Weight; - fn update_balance_non_native_currency() -> Weight; - fn update_balance_native_currency_creating() -> Weight; - fn update_balance_native_currency_killing() -> Weight; - } - pub(crate) type BalanceOf = <::MultiCurrency as MultiCurrency<::AccountId>>::Balance; pub(crate) type CurrencyIdOf = diff --git a/currencies/src/weights.rs b/currencies/src/weights.rs new file mode 100644 index 000000000..5d3bb7910 --- /dev/null +++ b/currencies/src/weights.rs @@ -0,0 +1,67 @@ +//! Autogenerated weights for module_currencies +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// /Users/xiliangchen/projects/acala/target/release/acala +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=module_currencies +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./currencies/src/weights.rs +// --template +// ../templates/orml-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 sp_std::marker::PhantomData; + +/// Weight functions needed for module_currencies. +pub trait WeightInfo { + fn transfer_non_native_currency() -> Weight; + fn transfer_native_currency() -> Weight; + fn update_balance_non_native_currency() -> Weight; + fn update_balance_native_currency_creating() -> Weight; + fn update_balance_native_currency_killing() -> Weight; +} + +/// Default weights. +impl WeightInfo for () { + fn transfer_non_native_currency() -> Weight { + (59_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + } + fn transfer_native_currency() -> Weight { + (59_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } + fn update_balance_non_native_currency() -> Weight { + (28_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + } + fn update_balance_native_currency_creating() -> Weight { + (30_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } + fn update_balance_native_currency_killing() -> Weight { + (37_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } +} From bcbbff715b89f211ea3ac1026242ce6e67c182a9 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Tue, 4 May 2021 11:50:59 +1200 Subject: [PATCH 4/6] oracle & tokens --- oracle/src/lib.rs | 8 ++---- oracle/src/weights.rs | 51 ++++++++++++++++++++++++++++++++++++ tokens/src/default_weight.rs | 20 -------------- tokens/src/lib.rs | 9 +++---- tokens/src/weights.rs | 49 ++++++++++++++++++++++++++++++++++ 5 files changed, 105 insertions(+), 32 deletions(-) create mode 100644 oracle/src/weights.rs delete mode 100644 tokens/src/default_weight.rs create mode 100644 tokens/src/weights.rs diff --git a/oracle/src/lib.rs b/oracle/src/lib.rs index 0716ff3b9..e17708f2c 100644 --- a/oracle/src/lib.rs +++ b/oracle/src/lib.rs @@ -42,21 +42,17 @@ use sp_std::{prelude::*, vec}; pub use crate::default_combine_data::DefaultCombineData; mod default_combine_data; -mod default_weight; mod mock; mod tests; +mod weights; pub use module::*; +pub use weights::WeightInfo; #[frame_support::pallet] pub mod module { use super::*; - pub trait WeightInfo { - fn feed_values(c: u32) -> Weight; - fn on_finalize() -> Weight; - } - pub(crate) type MomentOf = <>::Time as Time>::Moment; pub(crate) type TimestampedValueOf = TimestampedValue<>::OracleValue, MomentOf>; diff --git a/oracle/src/weights.rs b/oracle/src/weights.rs new file mode 100644 index 000000000..b8445419e --- /dev/null +++ b/oracle/src/weights.rs @@ -0,0 +1,51 @@ +//! Autogenerated weights for orml_oracle +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// /Users/xiliangchen/projects/acala/target/release/acala +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=orml_oracle +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./oracle/src/weights.rs +// --template +// ../templates/orml-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 sp_std::marker::PhantomData; + +/// Weight functions needed for orml_oracle. +pub trait WeightInfo { + fn feed_values(c: u32, ) -> Weight; + fn on_finalize() -> Weight; +} + +/// Default weights. +impl WeightInfo for () { + fn feed_values(c: u32, ) -> Weight { + (16_083_000 as Weight) + // Standard Error: 40_000 + .saturating_add((3_950_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(c as Weight))) + } + fn on_finalize() -> Weight { + (3_000_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + } +} diff --git a/tokens/src/default_weight.rs b/tokens/src/default_weight.rs deleted file mode 100644 index e46bf5656..000000000 --- a/tokens/src/default_weight.rs +++ /dev/null @@ -1,20 +0,0 @@ -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 - -#![allow(unused_parens)] -#![allow(unused_imports)] -#![allow(clippy::unnecessary_cast)] - -use frame_support::weights::{constants::RocksDbWeight as DbWeight, Weight}; - -impl crate::WeightInfo for () { - fn transfer() -> Weight { - (158_835_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn transfer_all() -> Weight { - (162_545_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } -} diff --git a/tokens/src/lib.rs b/tokens/src/lib.rs index f29e336b5..955b56856 100644 --- a/tokens/src/lib.rs +++ b/tokens/src/lib.rs @@ -70,10 +70,12 @@ use sp_std::{ vec::Vec, }; -mod default_weight; mod imbalances; mod mock; mod tests; +mod weights; + +pub use weights::WeightInfo; pub struct TransferDust(marker::PhantomData<(T, GetAccountId)>); impl OnDust for TransferDust @@ -150,11 +152,6 @@ pub use module::*; pub mod module { use super::*; - pub trait WeightInfo { - fn transfer() -> Weight; - fn transfer_all() -> Weight; - } - #[pallet::config] pub trait Config: frame_system::Config { type Event: From> + IsType<::Event>; diff --git a/tokens/src/weights.rs b/tokens/src/weights.rs new file mode 100644 index 000000000..65ddbe4eb --- /dev/null +++ b/tokens/src/weights.rs @@ -0,0 +1,49 @@ +//! Autogenerated weights for orml_tokens +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// /Users/xiliangchen/projects/acala/target/release/acala +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=orml_tokens +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./tokens/src/weights.rs +// --template +// ../templates/orml-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 sp_std::marker::PhantomData; + +/// Weight functions needed for orml_tokens. +pub trait WeightInfo { + fn transfer() -> Weight; + fn transfer_all() -> Weight; +} + +/// Default weights. +impl WeightInfo for () { + fn transfer() -> Weight { + (59_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + } + fn transfer_all() -> Weight { + (61_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + } +} From fe86d880016117b80fdd47c7f612424d5357bb7b Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Tue, 4 May 2021 14:40:22 +1200 Subject: [PATCH 5/6] update orml-vesting --- vesting/src/lib.rs | 9 ++----- vesting/src/weights.rs | 59 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 vesting/src/weights.rs diff --git a/vesting/src/lib.rs b/vesting/src/lib.rs index bfce0556b..2d3db167d 100644 --- a/vesting/src/lib.rs +++ b/vesting/src/lib.rs @@ -44,11 +44,12 @@ use sp_std::{ vec::Vec, }; -mod default_weight; mod mock; mod tests; +mod weights; pub use module::*; +pub use weights::WeightInfo; /// The maximum number of vesting schedules an account can have. pub const MAX_VESTINGS: usize = 20; @@ -109,12 +110,6 @@ impl VestingSche pub mod module { use super::*; - pub trait WeightInfo { - fn vested_transfer() -> Weight; - fn claim(i: u32) -> Weight; - fn update_vesting_schedules(i: u32) -> Weight; - } - pub(crate) type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; pub(crate) type VestingScheduleOf = VestingSchedule<::BlockNumber, BalanceOf>; diff --git a/vesting/src/weights.rs b/vesting/src/weights.rs new file mode 100644 index 000000000..0efb3bb8b --- /dev/null +++ b/vesting/src/weights.rs @@ -0,0 +1,59 @@ +//! Autogenerated weights for orml_vesting +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-05-04, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// /Users/xiliangchen/projects/acala/target/release/acala +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=orml_vesting +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./vesting/src/weights.rs +// --template +// ../templates/orml-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 sp_std::marker::PhantomData; + +/// Weight functions needed for orml_vesting. +pub trait WeightInfo { + fn vested_transfer() -> Weight; + fn claim(i: u32, ) -> Weight; + fn update_vesting_schedules(i: u32, ) -> Weight; +} + +/// Default weights. +impl WeightInfo for () { + fn vested_transfer() -> Weight { + (69_000_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + } + fn claim(i: u32, ) -> Weight { + (31_747_000 as Weight) + // Standard Error: 4_000 + .saturating_add((63_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } + fn update_vesting_schedules(i: u32, ) -> Weight { + (29_457_000 as Weight) + // Standard Error: 4_000 + .saturating_add((117_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + } +} From 9bbe1b2d219f0645f07c11b011297f4bc49d3f63 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Tue, 4 May 2021 14:40:36 +1200 Subject: [PATCH 6/6] rebenchmark everything --- Makefile | 14 ++++++++++++++ auction/src/weights.rs | 8 ++++---- authority/src/weights.rs | 2 +- currencies/src/weights.rs | 10 +++++----- oracle/src/weights.rs | 8 ++++---- tokens/src/weights.rs | 6 +++--- 6 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 0583cd27d..51dfe8fe8 100644 --- a/Makefile +++ b/Makefile @@ -47,3 +47,17 @@ dev-check-tests: Cargo.toml dev-test: Cargo.toml cargo test --all --features runtime-benchmarks + +# run benchmarks via Acala node +benchmark-all: + cargo run --release --bin=acala --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=orml_auction --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./auction/src/weights.rs --template ../templates/orml-weight-template.hbs + + cargo run --release --bin=acala --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=orml_authority --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./authority/src/weights.rs --template ../templates/orml-weight-template.hbs + + cargo run --release --bin=acala --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=module_currencies --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./currencies/src/weights.rs --template ../templates/orml-weight-template.hbs + + cargo run --release --bin=acala --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=orml_oracle --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./oracle/src/weights.rs --template ../templates/orml-weight-template.hbs + + cargo run --release --bin=acala --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=orml_tokens --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./tokens/src/weights.rs --template ../templates/orml-weight-template.hbs + + cargo run --release --bin=acala --features=runtime-benchmarks -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=orml_vesting --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./vesting/src/weights.rs --template ../templates/orml-weight-template.hbs diff --git a/auction/src/weights.rs b/auction/src/weights.rs index 75b15353c..9dcb4f32d 100644 --- a/auction/src/weights.rs +++ b/auction/src/weights.rs @@ -1,7 +1,7 @@ //! Autogenerated weights for orml_auction //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! DATE: 2021-05-04, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: @@ -37,14 +37,14 @@ pub trait WeightInfo { /// Default weights. impl WeightInfo for () { fn bid_collateral_auction() -> Weight { - (107_000_000 as Weight) + (108_000_000 as Weight) .saturating_add(RocksDbWeight::get().reads(8 as Weight)) .saturating_add(RocksDbWeight::get().writes(9 as Weight)) } fn on_finalize(c: u32, ) -> Weight { - (7_540_000 as Weight) + (9_779_000 as Weight) // Standard Error: 13_000 - .saturating_add((57_808_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((57_962_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(10 as Weight)) .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(c as Weight))) .saturating_add(RocksDbWeight::get().writes(7 as Weight)) diff --git a/authority/src/weights.rs b/authority/src/weights.rs index d7cc5082a..59c1354f1 100644 --- a/authority/src/weights.rs +++ b/authority/src/weights.rs @@ -1,7 +1,7 @@ //! Autogenerated weights for orml_authority //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! DATE: 2021-05-04, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: diff --git a/currencies/src/weights.rs b/currencies/src/weights.rs index 5d3bb7910..a75ebb239 100644 --- a/currencies/src/weights.rs +++ b/currencies/src/weights.rs @@ -1,7 +1,7 @@ //! Autogenerated weights for module_currencies //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! DATE: 2021-05-04, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: @@ -40,22 +40,22 @@ pub trait WeightInfo { /// Default weights. impl WeightInfo for () { fn transfer_non_native_currency() -> Weight { - (59_000_000 as Weight) + (60_000_000 as Weight) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } fn transfer_native_currency() -> Weight { - (59_000_000 as Weight) + (60_000_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } fn update_balance_non_native_currency() -> Weight { - (28_000_000 as Weight) + (29_000_000 as Weight) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(3 as Weight)) } fn update_balance_native_currency_creating() -> Weight { - (30_000_000 as Weight) + (31_000_000 as Weight) .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) } diff --git a/oracle/src/weights.rs b/oracle/src/weights.rs index b8445419e..36447bdd5 100644 --- a/oracle/src/weights.rs +++ b/oracle/src/weights.rs @@ -1,7 +1,7 @@ //! Autogenerated weights for orml_oracle //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! DATE: 2021-05-04, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: @@ -37,9 +37,9 @@ pub trait WeightInfo { /// Default weights. impl WeightInfo for () { fn feed_values(c: u32, ) -> Weight { - (16_083_000 as Weight) - // Standard Error: 40_000 - .saturating_add((3_950_000 as Weight).saturating_mul(c as Weight)) + (16_800_000 as Weight) + // Standard Error: 84_000 + .saturating_add((3_600_000 as Weight).saturating_mul(c as Weight)) .saturating_add(RocksDbWeight::get().reads(3 as Weight)) .saturating_add(RocksDbWeight::get().writes(1 as Weight)) .saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(c as Weight))) diff --git a/tokens/src/weights.rs b/tokens/src/weights.rs index 65ddbe4eb..5b6ed9474 100644 --- a/tokens/src/weights.rs +++ b/tokens/src/weights.rs @@ -1,7 +1,7 @@ //! Autogenerated weights for orml_tokens //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-05-03, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! DATE: 2021-05-04, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: @@ -37,12 +37,12 @@ pub trait WeightInfo { /// Default weights. impl WeightInfo for () { fn transfer() -> Weight { - (59_000_000 as Weight) + (60_000_000 as Weight) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) } fn transfer_all() -> Weight { - (61_000_000 as Weight) + (62_000_000 as Weight) .saturating_add(RocksDbWeight::get().reads(5 as Weight)) .saturating_add(RocksDbWeight::get().writes(4 as Weight)) }