From e4cfb2556d5e4d3cdc95bb033afc33dab92f2921 Mon Sep 17 00:00:00 2001 From: Shawn Tabrizi Date: Tue, 27 Oct 2020 21:26:12 +0100 Subject: [PATCH] New Weight Template + Organization (#7391) * add_handlebar_template_to_benchmark - add benchmark-cli arg to take in a handlebar-template file * update to always use template * rewrite writer for handlebars * polish * pass cmd data * update docs * new weight layout * separate templates * support custom filename output * Update command.rs * Create frame-weight-template.hbs * use a vector to maintain benchmark order * bring back () * fix tests * fix build * Custom string serializer, remove feature flag * temp * rename * nit * update docs * docs on public objects * small fix * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs * remove long line * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_balances --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/balances/src/weights.rs --template=./.maintain/frame-weight-template.hbs * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=frame_system --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/system/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for system * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_staking --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/staking/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for staking * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_identity --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/identity/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for identity and staking * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_collective --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/collective/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for collective * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_democracy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/democracy/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for democracy * clean up zeros * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_elections_phragmen --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/elections-phragmen/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for elections phragmen * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_im_online --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/im-online/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for im online * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_indices --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/indices/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for indices * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_multisig --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/multisig/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for multisig * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_proxy --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/proxy/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for proxy * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_scheduler --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/scheduler/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for scheduler * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_session --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/session/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for session * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_timestamp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/timestamp/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for timestamp * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_treasury --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/treasury/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for treasury * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_utility --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/utility/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for utility * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_vesting --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/vesting/src/weights.rs --template=./.maintain/frame-weight-template.hbs * update for vesting * temp update * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_utility --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/utility/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Ezadkiel Marbella Co-authored-by: Parity Benchmarking Bot --- substrate/.maintain/frame-weight-template.hbs | 38 +- .../bin/node-template/runtime/src/lib.rs | 2 +- substrate/bin/node/runtime/src/lib.rs | 36 +- .../node/runtime/src/weights/frame_system.rs | 57 --- substrate/bin/node/runtime/src/weights/mod.rs | 17 - .../runtime/src/weights/pallet_balances.rs | 48 -- .../runtime/src/weights/pallet_collective.rs | 98 ----- .../runtime/src/weights/pallet_democracy.rs | 173 -------- .../src/weights/pallet_elections_phragmen.rs | 92 ---- .../runtime/src/weights/pallet_identity.rs | 137 ------ .../runtime/src/weights/pallet_im_online.rs | 35 -- .../runtime/src/weights/pallet_indices.rs | 53 --- .../runtime/src/weights/pallet_multisig.rs | 91 ---- .../node/runtime/src/weights/pallet_proxy.rs | 86 ---- .../runtime/src/weights/pallet_scheduler.rs | 52 --- .../runtime/src/weights/pallet_session.rs | 38 -- .../runtime/src/weights/pallet_staking.rs | 171 -------- .../runtime/src/weights/pallet_timestamp.rs | 33 -- .../runtime/src/weights/pallet_treasury.rs | 140 ------ .../runtime/src/weights/pallet_utility.rs | 41 -- .../runtime/src/weights/pallet_vesting.rs | 64 --- .../frame/balances/src/default_weight.rs | 46 -- substrate/frame/balances/src/lib.rs | 12 +- substrate/frame/balances/src/weights.rs | 123 ++++++ .../frame/collective/src/default_weight.rs | 97 ---- substrate/frame/collective/src/lib.rs | 16 +- substrate/frame/collective/src/weights.rs | 230 ++++++++++ .../frame/democracy/src/default_weight.rs | 171 -------- substrate/frame/democracy/src/lib.rs | 31 +- substrate/frame/democracy/src/weights.rs | 415 ++++++++++++++++++ .../elections-phragmen/src/default_weights.rs | 88 ---- substrate/frame/elections-phragmen/src/lib.rs | 21 +- .../frame/elections-phragmen/src/weights.rs | 215 +++++++++ .../frame/identity/src/default_weights.rs | 135 ------ substrate/frame/identity/src/lib.rs | 31 +- substrate/frame/identity/src/weights.rs | 312 +++++++++++++ .../frame/im-online/src/default_weight.rs | 33 -- substrate/frame/im-online/src/lib.rs | 8 +- substrate/frame/im-online/src/weights.rs | 75 ++++ .../frame/indices/src/default_weights.rs | 51 --- substrate/frame/indices/src/lib.rs | 22 +- substrate/frame/indices/src/weights.rs | 123 ++++++ .../frame/multisig/src/default_weights.rs | 89 ---- substrate/frame/multisig/src/lib.rs | 22 +- substrate/frame/multisig/src/weights.rs | 214 +++++++++ substrate/frame/proxy/src/default_weight.rs | 84 ---- substrate/frame/proxy/src/lib.rs | 22 +- substrate/frame/proxy/src/weights.rs | 214 +++++++++ .../frame/scheduler/src/default_weights.rs | 50 --- substrate/frame/scheduler/src/lib.rs | 10 +- substrate/frame/scheduler/src/weights.rs | 118 +++++ .../frame/session/src/default_weights.rs | 36 -- substrate/frame/session/src/lib.rs | 24 +- substrate/frame/session/src/weights.rs | 84 ++++ .../frame/staking/src/default_weights.rs | 169 ------- substrate/frame/staking/src/lib.rs | 30 +- substrate/frame/staking/src/weights.rs | 406 +++++++++++++++++ substrate/frame/system/src/default_weights.rs | 55 --- .../system/src/extensions/check_weight.rs | 2 +- substrate/frame/system/src/lib.rs | 17 +- substrate/frame/system/src/weight.rs | 76 ++++ substrate/frame/system/src/weights.rs | 167 ++++--- .../frame/timestamp/src/default_weights.rs | 33 -- substrate/frame/timestamp/src/lib.rs | 8 +- substrate/frame/timestamp/src/weights.rs | 80 ++++ .../frame/treasury/src/default_weights.rs | 138 ------ substrate/frame/treasury/src/lib.rs | 32 +- substrate/frame/treasury/src/weights.rs | 338 ++++++++++++++ .../frame/utility/src/default_weights.rs | 39 -- substrate/frame/utility/src/lib.rs | 15 +- substrate/frame/utility/src/weights.rs | 89 ++++ .../frame/vesting/src/default_weights.rs | 62 --- substrate/frame/vesting/src/lib.rs | 18 +- substrate/frame/vesting/src/weights.rs | 148 +++++++ .../frame/benchmarking-cli/src/template.hbs | 6 +- 75 files changed, 3501 insertions(+), 3151 deletions(-) delete mode 100644 substrate/bin/node/runtime/src/weights/frame_system.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_balances.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_collective.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_democracy.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_elections_phragmen.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_identity.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_im_online.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_indices.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_multisig.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_proxy.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_scheduler.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_session.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_staking.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_timestamp.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_treasury.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_utility.rs delete mode 100644 substrate/bin/node/runtime/src/weights/pallet_vesting.rs delete mode 100644 substrate/frame/balances/src/default_weight.rs create mode 100644 substrate/frame/balances/src/weights.rs delete mode 100644 substrate/frame/collective/src/default_weight.rs create mode 100644 substrate/frame/collective/src/weights.rs delete mode 100644 substrate/frame/democracy/src/default_weight.rs create mode 100644 substrate/frame/democracy/src/weights.rs delete mode 100644 substrate/frame/elections-phragmen/src/default_weights.rs create mode 100644 substrate/frame/elections-phragmen/src/weights.rs delete mode 100644 substrate/frame/identity/src/default_weights.rs create mode 100644 substrate/frame/identity/src/weights.rs delete mode 100644 substrate/frame/im-online/src/default_weight.rs create mode 100644 substrate/frame/im-online/src/weights.rs delete mode 100644 substrate/frame/indices/src/default_weights.rs create mode 100644 substrate/frame/indices/src/weights.rs delete mode 100644 substrate/frame/multisig/src/default_weights.rs create mode 100644 substrate/frame/multisig/src/weights.rs delete mode 100644 substrate/frame/proxy/src/default_weight.rs create mode 100644 substrate/frame/proxy/src/weights.rs delete mode 100644 substrate/frame/scheduler/src/default_weights.rs create mode 100644 substrate/frame/scheduler/src/weights.rs delete mode 100644 substrate/frame/session/src/default_weights.rs create mode 100644 substrate/frame/session/src/weights.rs delete mode 100644 substrate/frame/staking/src/default_weights.rs create mode 100644 substrate/frame/staking/src/weights.rs delete mode 100644 substrate/frame/system/src/default_weights.rs create mode 100644 substrate/frame/system/src/weight.rs delete mode 100644 substrate/frame/timestamp/src/default_weights.rs create mode 100644 substrate/frame/timestamp/src/weights.rs delete mode 100644 substrate/frame/treasury/src/default_weights.rs create mode 100644 substrate/frame/treasury/src/weights.rs delete mode 100644 substrate/frame/utility/src/default_weights.rs create mode 100644 substrate/frame/utility/src/weights.rs delete mode 100644 substrate/frame/vesting/src/default_weights.rs create mode 100644 substrate/frame/vesting/src/weights.rs diff --git a/substrate/.maintain/frame-weight-template.hbs b/substrate/.maintain/frame-weight-template.hbs index d0d7ef93d3..595c2a7d31 100644 --- a/substrate/.maintain/frame-weight-template.hbs +++ b/substrate/.maintain/frame-weight-template.hbs @@ -16,15 +16,19 @@ // limitations under the License. //! Weights for {{pallet}} -//! {{join args}} //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}} //! DATE: {{date}}, STEPS: {{cmd.steps}}, REPEAT: {{cmd.repeat}}, LOW RANGE: {{cmd.lowest_range_values}}, HIGH RANGE: {{cmd.highest_range_values}} //! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}} +// Executed Command: +{{#each args as |arg|~}} +// {{arg}} +{{/each}} + #![allow(unused_parens)] #![allow(unused_imports)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; /// Weight functions needed for {{pallet}}. @@ -33,7 +37,7 @@ pub trait WeightInfo { fn {{benchmark.name~}} ( {{~#each benchmark.components as |c| ~}} - _{{c.name}}: u32, {{/each~}} + {{c.name}}: u32, {{/each~}} ) -> Weight; {{/each}} } @@ -66,3 +70,31 @@ impl WeightInfo for SubstrateWeight { } {{/each}} } + +// For backwards compatibility and tests +impl WeightInfo for () { + {{#each benchmarks as |benchmark| ~}} + fn {{benchmark.name~}} + ( + {{~#each benchmark.components as |c| ~}} + {{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}} + ) -> Weight { + ({{underscore benchmark.base_weight}} as Weight) + {{#each benchmark.component_weight as |cw| ~}} + .saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)) + {{/each}} + {{~#if (ne benchmark.base_reads "0") ~}} + .saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight)) + {{/if}} + {{~#each benchmark.component_reads as |cr| ~}} + .saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight))) + {{/each}} + {{~#if (ne benchmark.base_writes "0") ~}} + .saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight)) + {{/if}} + {{~#each benchmark.component_writes as |cw| ~}} + .saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))) + {{~/each}} + } + {{/each}} +} diff --git a/substrate/bin/node-template/runtime/src/lib.rs b/substrate/bin/node-template/runtime/src/lib.rs index e96de63731..e414631d97 100644 --- a/substrate/bin/node-template/runtime/src/lib.rs +++ b/substrate/bin/node-template/runtime/src/lib.rs @@ -241,7 +241,7 @@ impl pallet_balances::Trait for Runtime { type DustRemoval = (); type ExistentialDeposit = ExistentialDeposit; type AccountStore = System; - type WeightInfo = (); + type WeightInfo = pallet_balances::weights::SubstrateWeight; } parameter_types! { diff --git a/substrate/bin/node/runtime/src/lib.rs b/substrate/bin/node/runtime/src/lib.rs index dfa7a4680a..0718a1557e 100644 --- a/substrate/bin/node/runtime/src/lib.rs +++ b/substrate/bin/node/runtime/src/lib.rs @@ -185,13 +185,13 @@ impl frame_system::Trait for Runtime { type AccountData = pallet_balances::AccountData; type OnNewAccount = (); type OnKilledAccount = (); - type SystemWeightInfo = weights::frame_system::WeightInfo; + type SystemWeightInfo = frame_system::weights::SubstrateWeight; } impl pallet_utility::Trait for Runtime { type Event = Event; type Call = Call; - type WeightInfo = weights::pallet_utility::WeightInfo; + type WeightInfo = pallet_utility::weights::SubstrateWeight; } parameter_types! { @@ -209,7 +209,7 @@ impl pallet_multisig::Trait for Runtime { type DepositBase = DepositBase; type DepositFactor = DepositFactor; type MaxSignatories = MaxSignatories; - type WeightInfo = weights::pallet_multisig::WeightInfo; + type WeightInfo = pallet_multisig::weights::SubstrateWeight; } parameter_types! { @@ -273,7 +273,7 @@ impl pallet_proxy::Trait for Runtime { type ProxyDepositBase = ProxyDepositBase; type ProxyDepositFactor = ProxyDepositFactor; type MaxProxies = MaxProxies; - type WeightInfo = weights::pallet_proxy::WeightInfo; + type WeightInfo = pallet_proxy::weights::SubstrateWeight; type MaxPending = MaxPending; type CallHasher = BlakeTwo256; type AnnouncementDepositBase = AnnouncementDepositBase; @@ -293,7 +293,7 @@ impl pallet_scheduler::Trait for Runtime { type MaximumWeight = MaximumSchedulerWeight; type ScheduleOrigin = EnsureRoot; type MaxScheduledPerBlock = MaxScheduledPerBlock; - type WeightInfo = weights::pallet_scheduler::WeightInfo; + type WeightInfo = pallet_scheduler::weights::SubstrateWeight; } parameter_types! { @@ -333,7 +333,7 @@ impl pallet_indices::Trait for Runtime { type Currency = Balances; type Deposit = IndexDeposit; type Event = Event; - type WeightInfo = weights::pallet_indices::WeightInfo; + type WeightInfo = pallet_indices::weights::SubstrateWeight; } parameter_types! { @@ -350,7 +350,7 @@ impl pallet_balances::Trait for Runtime { type Event = Event; type ExistentialDeposit = ExistentialDeposit; type AccountStore = frame_system::Module; - type WeightInfo = weights::pallet_balances::WeightInfo; + type WeightInfo = pallet_balances::weights::SubstrateWeight; } parameter_types! { @@ -377,7 +377,7 @@ impl pallet_timestamp::Trait for Runtime { type Moment = Moment; type OnTimestampSet = Babe; type MinimumPeriod = MinimumPeriod; - type WeightInfo = weights::pallet_timestamp::WeightInfo; + type WeightInfo = pallet_timestamp::weights::SubstrateWeight; } parameter_types! { @@ -414,7 +414,7 @@ impl pallet_session::Trait for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; - type WeightInfo = weights::pallet_session::WeightInfo; + type WeightInfo = pallet_session::weights::SubstrateWeight; } impl pallet_session::historical::Trait for Runtime { @@ -477,7 +477,7 @@ impl pallet_staking::Trait for Runtime { // The unsigned solution weight targeted by the OCW. We set it to the maximum possible value of // a single extrinsic. type OffchainSolutionWeightLimit = OffchainSolutionWeightLimit; - type WeightInfo = weights::pallet_staking::WeightInfo; + type WeightInfo = pallet_staking::weights::SubstrateWeight; } parameter_types! { @@ -535,7 +535,7 @@ impl pallet_democracy::Trait for Runtime { type Scheduler = Scheduler; type PalletsOrigin = OriginCaller; type MaxVotes = MaxVotes; - type WeightInfo = weights::pallet_democracy::WeightInfo; + type WeightInfo = pallet_democracy::weights::SubstrateWeight; type MaxProposals = MaxProposals; } @@ -554,7 +554,7 @@ impl pallet_collective::Trait for Runtime { type MaxProposals = CouncilMaxProposals; type MaxMembers = CouncilMaxMembers; type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::pallet_collective::WeightInfo; + type WeightInfo = pallet_collective::weights::SubstrateWeight; } parameter_types! { @@ -586,7 +586,7 @@ impl pallet_elections_phragmen::Trait for Runtime { type DesiredMembers = DesiredMembers; type DesiredRunnersUp = DesiredRunnersUp; type TermDuration = TermDuration; - type WeightInfo = weights::pallet_elections_phragmen::WeightInfo; + type WeightInfo = pallet_elections_phragmen::weights::SubstrateWeight; } parameter_types! { @@ -604,7 +604,7 @@ impl pallet_collective::Trait for Runtime { type MaxProposals = TechnicalMaxProposals; type MaxMembers = TechnicalMaxMembers; type DefaultVote = pallet_collective::PrimeDefaultVote; - type WeightInfo = weights::pallet_collective::WeightInfo; + type WeightInfo = pallet_collective::weights::SubstrateWeight; } type EnsureRootOrHalfCouncil = EnsureOneOf< @@ -672,7 +672,7 @@ impl pallet_treasury::Trait for Runtime { type BountyValueMinimum = BountyValueMinimum; type MaximumReasonLength = MaximumReasonLength; type BurnDestination = (); - type WeightInfo = weights::pallet_treasury::WeightInfo; + type WeightInfo = pallet_treasury::weights::SubstrateWeight; } parameter_types! { @@ -778,7 +778,7 @@ impl pallet_im_online::Trait for Runtime { type SessionDuration = SessionDuration; type ReportUnresponsiveness = Offences; type UnsignedPriority = ImOnlineUnsignedPriority; - type WeightInfo = weights::pallet_im_online::WeightInfo; + type WeightInfo = pallet_im_online::weights::SubstrateWeight; } parameter_types! { @@ -835,7 +835,7 @@ impl pallet_identity::Trait for Runtime { type Slashed = Treasury; type ForceOrigin = EnsureRootOrHalfCouncil; type RegistrarOrigin = EnsureRootOrHalfCouncil; - type WeightInfo = weights::pallet_identity::WeightInfo; + type WeightInfo = pallet_identity::weights::SubstrateWeight; } parameter_types! { @@ -892,7 +892,7 @@ impl pallet_vesting::Trait for Runtime { type Currency = Balances; type BlockNumberToBalance = ConvertInto; type MinVestedTransfer = MinVestedTransfer; - type WeightInfo = weights::pallet_vesting::WeightInfo; + type WeightInfo = pallet_vesting::weights::SubstrateWeight; } construct_runtime!( diff --git a/substrate/bin/node/runtime/src/weights/frame_system.rs b/substrate/bin/node/runtime/src/weights/frame_system.rs deleted file mode 100644 index 6831dad062..0000000000 --- a/substrate/bin/node/runtime/src/weights/frame_system.rs +++ /dev/null @@ -1,57 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5 - -#![allow(unused_parens)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl frame_system::WeightInfo for WeightInfo { - fn remark(_b: u32) -> Weight { - (1305000 as Weight) - } - fn set_heap_pages() -> Weight { - (2023000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_changes_trie_config() -> Weight { - (10026000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn set_storage(i: u32, ) -> Weight { - (0 as Weight) - .saturating_add((656000 as Weight).saturating_mul(i as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) - } - fn kill_storage(i: u32, ) -> Weight { - (4327000 as Weight) - .saturating_add((478000 as Weight).saturating_mul(i as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) - } - fn kill_prefix(p: u32, ) -> Weight { - (8349000 as Weight) - .saturating_add((838000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) - } - fn suicide() -> Weight { - (29247000 as Weight) - } -} diff --git a/substrate/bin/node/runtime/src/weights/mod.rs b/substrate/bin/node/runtime/src/weights/mod.rs index c75ff83085..5de6286da9 100644 --- a/substrate/bin/node/runtime/src/weights/mod.rs +++ b/substrate/bin/node/runtime/src/weights/mod.rs @@ -15,21 +15,4 @@ //! A list of the different weight modules for our runtime. -pub mod frame_system; -pub mod pallet_balances; -pub mod pallet_collective; pub mod pallet_contracts; -pub mod pallet_democracy; -pub mod pallet_elections_phragmen; -pub mod pallet_identity; -pub mod pallet_im_online; -pub mod pallet_indices; -pub mod pallet_multisig; -pub mod pallet_proxy; -pub mod pallet_scheduler; -pub mod pallet_session; -pub mod pallet_staking; -pub mod pallet_timestamp; -pub mod pallet_treasury; -pub mod pallet_utility; -pub mod pallet_vesting; diff --git a/substrate/bin/node/runtime/src/weights/pallet_balances.rs b/substrate/bin/node/runtime/src/weights/pallet_balances.rs deleted file mode 100644 index 18a971b20c..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_balances.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5 - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_balances::WeightInfo for WeightInfo { - fn transfer() -> Weight { - (65949000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn transfer_keep_alive() -> Weight { - (46665000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_balance_creating() -> Weight { - (27086000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_balance_killing() -> Weight { - (33424000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn force_transfer() -> Weight { - (65343000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_collective.rs b/substrate/bin/node/runtime/src/weights/pallet_collective.rs deleted file mode 100644 index 5e91dc19ab..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_collective.rs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_collective::WeightInfo for WeightInfo { - fn set_members(m: u32, n: u32, p: u32, ) -> Weight { - (0 as Weight) - .saturating_add((21040000 as Weight).saturating_mul(m as Weight)) - .saturating_add((173000 as Weight).saturating_mul(n as Weight)) - .saturating_add((31595000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) - } - fn execute(b: u32, m: u32, ) -> Weight { - (43359000 as Weight) - .saturating_add((4000 as Weight).saturating_mul(b as Weight)) - .saturating_add((123000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - } - fn propose_execute(b: u32, m: u32, ) -> Weight { - (54134000 as Weight) - .saturating_add((4000 as Weight).saturating_mul(b as Weight)) - .saturating_add((239000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - } - fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { - (90650000 as Weight) - .saturating_add((5000 as Weight).saturating_mul(b as Weight)) - .saturating_add((152000 as Weight).saturating_mul(m as Weight)) - .saturating_add((970000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn vote(m: u32, ) -> Weight { - (74460000 as Weight) - .saturating_add((290000 as Weight).saturating_mul(m as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn close_early_disapproved(m: u32, p: u32, ) -> Weight { - (86360000 as Weight) - .saturating_add((232000 as Weight).saturating_mul(m as Weight)) - .saturating_add((954000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { - (123653000 as Weight) - .saturating_add((1000 as Weight).saturating_mul(b as Weight)) - .saturating_add((287000 as Weight).saturating_mul(m as Weight)) - .saturating_add((920000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn close_disapproved(m: u32, p: u32, ) -> Weight { - (95395000 as Weight) - .saturating_add((236000 as Weight).saturating_mul(m as Weight)) - .saturating_add((965000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { - (135284000 as Weight) - .saturating_add((4000 as Weight).saturating_mul(b as Weight)) - .saturating_add((218000 as Weight).saturating_mul(m as Weight)) - .saturating_add((951000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn disapprove_proposal(p: u32, ) -> Weight { - (50500000 as Weight) - .saturating_add((966000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_democracy.rs b/substrate/bin/node/runtime/src/weights/pallet_democracy.rs deleted file mode 100644 index 51eca2855a..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_democracy.rs +++ /dev/null @@ -1,173 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Weights for pallet_democracy -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 -//! DATE: 2020-09-24, STEPS: [50], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_democracy::WeightInfo for WeightInfo { - fn propose() -> Weight { - (96_316_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn second(s: u32, ) -> Weight { - (58_386_000 as Weight) - .saturating_add((259_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn vote_new(r: u32, ) -> Weight { - (70_374_000 as Weight) - .saturating_add((291_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn vote_existing(r: u32, ) -> Weight { - (70_097_000 as Weight) - .saturating_add((296_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn emergency_cancel() -> Weight { - (41_731_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn blacklist(p: u32, ) -> Weight { - (117_847_000 as Weight) - .saturating_add((871_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(6 as Weight)) - } - fn external_propose(v: u32, ) -> Weight { - (20_972_000 as Weight) - .saturating_add((114_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn external_propose_majority() -> Weight { - (5_030_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn external_propose_default() -> Weight { - (4_981_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn fast_track() -> Weight { - (42_801_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn veto_external(v: u32, ) -> Weight { - (44_115_000 as Weight) - .saturating_add((194_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn cancel_proposal(p: u32, ) -> Weight { - (73_937_000 as Weight) - .saturating_add((962_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn cancel_referendum() -> Weight { - (25_233_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn cancel_queued(r: u32, ) -> Weight { - (48_251_000 as Weight) - .saturating_add((3_590_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn on_initialize_base(r: u32, ) -> Weight { - (17_597_000 as Weight) - .saturating_add((7_248_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - } - fn delegate(r: u32, ) -> Weight { - (93_916_000 as Weight) - .saturating_add((10_794_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) - } - fn undelegate(r: u32, ) -> Weight { - (47_855_000 as Weight) - .saturating_add((10_805_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) - } - fn clear_public_proposals() -> Weight { - (4_864_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn note_preimage(b: u32, ) -> Weight { - (66_754_000 as Weight) - .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn note_imminent_preimage(b: u32, ) -> Weight { - (44_664_000 as Weight) - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn reap_preimage(b: u32, ) -> Weight { - (59_968_000 as Weight) - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn unlock_remove(r: u32, ) -> Weight { - (58_573_000 as Weight) - .saturating_add((131_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn unlock_set(r: u32, ) -> Weight { - (53_831_000 as Weight) - .saturating_add((324_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn remove_vote(r: u32, ) -> Weight { - (31_846_000 as Weight) - .saturating_add((327_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn remove_other_vote(r: u32, ) -> Weight { - (31_880_000 as Weight) - .saturating_add((222_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_elections_phragmen.rs b/substrate/bin/node/runtime/src/weights/pallet_elections_phragmen.rs deleted file mode 100644 index a77817fa1f..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_elections_phragmen.rs +++ /dev/null @@ -1,92 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Weights for pallet_elections_phragmen -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 -//! DATE: 2020-10-26, STEPS: [50], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_elections_phragmen::WeightInfo for WeightInfo { - fn vote(v: u32, ) -> Weight { - (91_991_000 as Weight) - .saturating_add((184_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn vote_update(v: u32, ) -> Weight { - (56_633_000 as Weight) - .saturating_add((228_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn remove_voter() -> Weight { - (76_890_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn report_defunct_voter_correct(c: u32, v: u32, ) -> Weight { - (0 as Weight) - .saturating_add((1_769_000 as Weight).saturating_mul(c as Weight)) - .saturating_add((32_244_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn report_defunct_voter_incorrect(c: u32, v: u32, ) -> Weight { - (0 as Weight) - .saturating_add((1_777_000 as Weight).saturating_mul(c as Weight)) - .saturating_add((32_528_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn submit_candidacy(c: u32, ) -> Weight { - (75_137_000 as Weight) - .saturating_add((310_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn renounce_candidacy_candidate(c: u32, ) -> Weight { - (50_071_000 as Weight) - .saturating_add((184_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn renounce_candidacy_members() -> Weight { - (79_471_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn renounce_candidacy_runners_up() -> Weight { - (49_740_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn remove_member_with_replacement() -> Weight { - (76_973_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) - } - fn remove_member_wrong_refund() -> Weight { - (8_871_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_identity.rs b/substrate/bin/node/runtime/src/weights/pallet_identity.rs deleted file mode 100644 index a43b63c0fb..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_identity.rs +++ /dev/null @@ -1,137 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_identity::WeightInfo for WeightInfo { - fn add_registrar(r: u32, ) -> Weight { - (39_603_000 as Weight) - .saturating_add((418_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_identity(r: u32, x: u32, ) -> Weight { - (110_679_000 as Weight) - .saturating_add((389_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((2_985_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_subs_new(s: u32, ) -> Weight { - (78_697_000 as Weight) - .saturating_add((15_225_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn set_subs_old(p: u32, ) -> Weight { - (71_308_000 as Weight) - .saturating_add((5_772_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) - } - fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { - (91_553_000 as Weight) - .saturating_add((284_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((5_749_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((1_621_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn request_judgement(r: u32, x: u32, ) -> Weight { - (110_856_000 as Weight) - .saturating_add((496_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((3_221_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn cancel_request(r: u32, x: u32, ) -> Weight { - (96_857_000 as Weight) - .saturating_add((311_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((3_204_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_fee(r: u32, ) -> Weight { - (16_276_000 as Weight) - .saturating_add((381_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_account_id(r: u32, ) -> Weight { - (18_530_000 as Weight) - .saturating_add((391_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_fields(r: u32, ) -> Weight { - (16_359_000 as Weight) - .saturating_add((379_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn provide_judgement(r: u32, x: u32, ) -> Weight { - (72_869_000 as Weight) - .saturating_add((423_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((3_187_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight { - (123_199_000 as Weight) - .saturating_add((71_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((5_730_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((2_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn add_sub(s: u32, ) -> Weight { - (110_070_000 as Weight) - .saturating_add((262_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn rename_sub(s: u32, ) -> Weight { - (37_130_000 as Weight) - .saturating_add((79_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn remove_sub(s: u32, ) -> Weight { - (103_295_000 as Weight) - .saturating_add((235_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn quit_sub(s: u32, ) -> Weight { - (65_716_000 as Weight) - .saturating_add((227_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_im_online.rs b/substrate/bin/node/runtime/src/weights/pallet_im_online.rs deleted file mode 100644 index a85672da51..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_im_online.rs +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_im_online::WeightInfo for WeightInfo { - fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight { - (139830000 as Weight) - .saturating_add((211000 as Weight).saturating_mul(k as Weight)) - .saturating_add((654000 as Weight).saturating_mul(e as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_indices.rs b/substrate/bin/node/runtime/src/weights/pallet_indices.rs deleted file mode 100644 index e8845f3352..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_indices.rs +++ /dev/null @@ -1,53 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_indices::WeightInfo for WeightInfo { - fn claim() -> Weight { - (56_237_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn transfer() -> Weight { - (63_665_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn free() -> Weight { - (50_736_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn force_transfer() -> Weight { - (52_361_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn freeze() -> Weight { - (46_483_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_multisig.rs b/substrate/bin/node/runtime/src/weights/pallet_multisig.rs deleted file mode 100644 index 0af7c7c75e..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_multisig.rs +++ /dev/null @@ -1,91 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_multisig::WeightInfo for WeightInfo { - fn as_multi_threshold_1(z: u32, ) -> Weight { - (17_161_000 as Weight) - .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) - } - fn as_multi_create(s: u32, z: u32, ) -> Weight { - (79_857_000 as Weight) - .saturating_add((131_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn as_multi_create_store(s: u32, z: u32, ) -> Weight { - (90_218_000 as Weight) - .saturating_add((129_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((3_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn as_multi_approve(s: u32, z: u32, ) -> Weight { - (48_402_000 as Weight) - .saturating_add((132_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn as_multi_approve_store(s: u32, z: u32, ) -> Weight { - (88_390_000 as Weight) - .saturating_add((120_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((3_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn as_multi_complete(s: u32, z: u32, ) -> Weight { - (98_960_000 as Weight) - .saturating_add((276_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((6_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn approve_as_multi_create(s: u32, ) -> Weight { - (80_185_000 as Weight) - .saturating_add((121_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn approve_as_multi_approve(s: u32, ) -> Weight { - (48_386_000 as Weight) - .saturating_add((143_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn approve_as_multi_complete(s: u32, ) -> Weight { - (177_181_000 as Weight) - .saturating_add((273_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn cancel_as_multi(s: u32, ) -> Weight { - (126_334_000 as Weight) - .saturating_add((124_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_proxy.rs b/substrate/bin/node/runtime/src/weights/pallet_proxy.rs deleted file mode 100644 index c43b5db14e..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_proxy.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5 - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_proxy::WeightInfo for WeightInfo { - fn proxy(p: u32, ) -> Weight { - (26127000 as Weight) - .saturating_add((214000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - } - fn proxy_announced(a: u32, p: u32, ) -> Weight { - (55405000 as Weight) - .saturating_add((774000 as Weight).saturating_mul(a as Weight)) - .saturating_add((209000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn remove_announcement(a: u32, p: u32, ) -> Weight { - (35879000 as Weight) - .saturating_add((783000 as Weight).saturating_mul(a as Weight)) - .saturating_add((20000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn reject_announcement(a: u32, p: u32, ) -> Weight { - (36097000 as Weight) - .saturating_add((780000 as Weight).saturating_mul(a as Weight)) - .saturating_add((12000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn announce(a: u32, p: u32, ) -> Weight { - (53769000 as Weight) - .saturating_add((675000 as Weight).saturating_mul(a as Weight)) - .saturating_add((214000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn add_proxy(p: u32, ) -> Weight { - (36082000 as Weight) - .saturating_add((234000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn remove_proxy(p: u32, ) -> Weight { - (32885000 as Weight) - .saturating_add((267000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn remove_proxies(p: u32, ) -> Weight { - (31735000 as Weight) - .saturating_add((215000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn anonymous(p: u32, ) -> Weight { - (50907000 as Weight) - .saturating_add((61000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn kill_anonymous(p: u32, ) -> Weight { - (33926000 as Weight) - .saturating_add((208000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_scheduler.rs b/substrate/bin/node/runtime/src/weights/pallet_scheduler.rs deleted file mode 100644 index 895a282488..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_scheduler.rs +++ /dev/null @@ -1,52 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_scheduler::WeightInfo for WeightInfo { - fn schedule(s: u32, ) -> Weight { - (37_835_000 as Weight) - .saturating_add((81_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn cancel(s: u32, ) -> Weight { - (34_707_000 as Weight) - .saturating_add((3_125_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn schedule_named(s: u32, ) -> Weight { - (48_065_000 as Weight) - .saturating_add((110_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn cancel_named(s: u32, ) -> Weight { - (38_776_000 as Weight) - .saturating_add((3_138_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_session.rs b/substrate/bin/node/runtime/src/weights/pallet_session.rs deleted file mode 100644 index 1ca5c29237..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_session.rs +++ /dev/null @@ -1,38 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_session::WeightInfo for WeightInfo { - fn set_keys() -> Weight { - (88_411_000 as Weight) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) - } - fn purge_keys() -> Weight { - (51_843_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_staking.rs b/substrate/bin/node/runtime/src/weights/pallet_staking.rs deleted file mode 100644 index a4484a2685..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_staking.rs +++ /dev/null @@ -1,171 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Default weights of pallet-staking. -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_staking::WeightInfo for WeightInfo { - fn bond() -> Weight { - (144278000 as Weight) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn bond_extra() -> Weight { - (110715000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn unbond() -> Weight { - (99840000 as Weight) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn withdraw_unbonded_update(s: u32, ) -> Weight { - (100728000 as Weight) - .saturating_add((63000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(5 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn withdraw_unbonded_kill(s: u32, ) -> Weight { - (168879000 as Weight) - .saturating_add((6666000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(7 as Weight)) - .saturating_add(T::DbWeight::get().writes(8 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn validate() -> Weight { - (35539000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn nominate(n: u32, ) -> Weight { - (48596000 as Weight) - .saturating_add((308000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn chill() -> Weight { - (35144000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn set_payee() -> Weight { - (24255000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_controller() -> Weight { - (52294000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn set_validator_count() -> Weight { - (5185000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn force_no_eras() -> Weight { - (5907000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn force_new_era() -> Weight { - (5917000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn force_new_era_always() -> Weight { - (5952000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_invulnerables(v: u32, ) -> Weight { - (6324000 as Weight) - .saturating_add((9000 as Weight).saturating_mul(v as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn force_unstake(s: u32, ) -> Weight { - (119691000 as Weight) - .saturating_add((6681000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(8 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn cancel_deferred_slash(s: u32, ) -> Weight { - (5820201000 as Weight) - .saturating_add((34672000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn payout_stakers_dead_controller(n: u32, ) -> Weight { - (0 as Weight) - .saturating_add((92486000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) - } - fn payout_stakers_alive_staked(n: u32, ) -> Weight { - (0 as Weight) - .saturating_add((117324000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight))) - } - fn rebond(l: u32, ) -> Weight { - (71316000 as Weight) - .saturating_add((142000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn set_history_depth(e: u32, ) -> Weight { - (0 as Weight) - .saturating_add((51901000 as Weight).saturating_mul(e as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - .saturating_add(T::DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight))) - } - fn reap_stash(s: u32, ) -> Weight { - (147166000 as Weight) - .saturating_add((6661000 as Weight).saturating_mul(s as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(8 as Weight)) - .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn new_era(v: u32, n: u32, ) -> Weight { - (0 as Weight) - .saturating_add((1440459000 as Weight).saturating_mul(v as Weight)) - .saturating_add((182580000 as Weight).saturating_mul(n as Weight)) - .saturating_add(T::DbWeight::get().reads(10 as Weight)) - .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight))) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) - .saturating_add(T::DbWeight::get().writes(8 as Weight)) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight))) - } - fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight { - (0 as Weight) - .saturating_add((964000 as Weight).saturating_mul(v as Weight)) - .saturating_add((432000 as Weight).saturating_mul(n as Weight)) - .saturating_add((204294000 as Weight).saturating_mul(a as Weight)) - .saturating_add((9546000 as Weight).saturating_mul(w as Weight)) - .saturating_add(T::DbWeight::get().reads(6 as Weight)) - .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight))) - .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_timestamp.rs b/substrate/bin/node/runtime/src/weights/pallet_timestamp.rs deleted file mode 100644 index ee0dd77c63..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_timestamp.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5 - -#![allow(unused_parens)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_timestamp::WeightInfo for WeightInfo { - fn set() -> Weight { - (9133000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn on_finalize() -> Weight { - (5915000 as Weight) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_treasury.rs b/substrate/bin/node/runtime/src/weights/pallet_treasury.rs deleted file mode 100644 index d8fe9b578b..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_treasury.rs +++ /dev/null @@ -1,140 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_treasury::WeightInfo for WeightInfo { - fn propose_spend() -> Weight { - (79604000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn reject_proposal() -> Weight { - (61001000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn approve_proposal() -> Weight { - (17835000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn report_awesome(r: u32, ) -> Weight { - (101602000 as Weight) - .saturating_add((2000 as Weight).saturating_mul(r as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn retract_tip() -> Weight { - (82970000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn tip_new(r: u32, t: u32, ) -> Weight { - (63995000 as Weight) - .saturating_add((2000 as Weight).saturating_mul(r as Weight)) - .saturating_add((153000 as Weight).saturating_mul(t as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn tip(t: u32, ) -> Weight { - (46765000 as Weight) - .saturating_add((711000 as Weight).saturating_mul(t as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn close_tip(t: u32, ) -> Weight { - (160874000 as Weight) - .saturating_add((379000 as Weight).saturating_mul(t as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn propose_bounty(d: u32, ) -> Weight { - (86198000 as Weight) - .saturating_add((1000 as Weight).saturating_mul(d as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn approve_bounty() -> Weight { - (23063000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn propose_curator() -> Weight { - (18890000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn unassign_curator() -> Weight { - (66768000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn accept_curator() -> Weight { - (69131000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn award_bounty() -> Weight { - (48184000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn claim_bounty() -> Weight { - (243104000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) - } - fn close_bounty_proposed() -> Weight { - (65917000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn close_bounty_active() -> Weight { - (157232000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } - fn extend_bounty_expiry() -> Weight { - (46216000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn on_initialize_proposals(p: u32, ) -> Weight { - (119765000 as Weight) - .saturating_add((108368000 as Weight).saturating_mul(p as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) - } - fn on_initialize_bounties(b: u32, ) -> Weight { - (112536000 as Weight) - .saturating_add((107132000 as Weight).saturating_mul(b as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(b as Weight))) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight))) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_utility.rs b/substrate/bin/node/runtime/src/weights/pallet_utility.rs deleted file mode 100644 index 5b2aace87c..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_utility.rs +++ /dev/null @@ -1,41 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Weights for pallet_utility -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 -//! DATE: 2020-10-02, STEPS: [50], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_utility::WeightInfo for WeightInfo { - fn batch(c: u32, ) -> Weight { - (20_803_000 as Weight) - .saturating_add((1_984_000 as Weight).saturating_mul(c as Weight)) - } - fn as_derivative() -> Weight { - (5_853_000 as Weight) - } - fn batch_all(c: u32, ) -> Weight { - (21_104_000 as Weight) - .saturating_add((1_509_000 as Weight).saturating_mul(c as Weight)) - } -} diff --git a/substrate/bin/node/runtime/src/weights/pallet_vesting.rs b/substrate/bin/node/runtime/src/weights/pallet_vesting.rs deleted file mode 100644 index ac63b0177b..0000000000 --- a/substrate/bin/node/runtime/src/weights/pallet_vesting.rs +++ /dev/null @@ -1,64 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -pub struct WeightInfo(PhantomData); -impl pallet_vesting::WeightInfo for WeightInfo { - fn vest_locked(l: u32, ) -> Weight { - (82109000 as Weight) - .saturating_add((332000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn vest_unlocked(l: u32, ) -> Weight { - (88419000 as Weight) - .saturating_add((3000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn vest_other_locked(l: u32, ) -> Weight { - (81277000 as Weight) - .saturating_add((321000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn vest_other_unlocked(l: u32, ) -> Weight { - (87584000 as Weight) - .saturating_add((19000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn vested_transfer(l: u32, ) -> Weight { - (185916000 as Weight) - .saturating_add((625000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn force_vested_transfer(l: u32, ) -> Weight { - (185916000 as Weight) - .saturating_add((625000 as Weight).saturating_mul(l as Weight)) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) - } -} diff --git a/substrate/frame/balances/src/default_weight.rs b/substrate/frame/balances/src/default_weight.rs deleted file mode 100644 index 47a9199600..0000000000 --- a/substrate/frame/balances/src/default_weight.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Weights for the Balances Pallet - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn transfer() -> Weight { - (65949000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn transfer_keep_alive() -> Weight { - (46665000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_balance_creating() -> Weight { - (27086000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_balance_killing() -> Weight { - (33424000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn force_transfer() -> Weight { - (65343000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/frame/balances/src/lib.rs b/substrate/frame/balances/src/lib.rs index 422e112bdf..fcf41bcf26 100644 --- a/substrate/frame/balances/src/lib.rs +++ b/substrate/frame/balances/src/lib.rs @@ -154,14 +154,13 @@ mod tests; mod tests_local; mod tests_composite; mod benchmarking; -mod default_weight; +pub mod weights; use sp_std::prelude::*; use sp_std::{cmp, result, mem, fmt::Debug, ops::BitOr, convert::Infallible}; use codec::{Codec, Encode, Decode}; use frame_support::{ StorageValue, Parameter, decl_event, decl_storage, decl_module, decl_error, ensure, - weights::Weight, traits::{ Currency, OnKilledAccount, OnUnbalanced, TryDrop, StoredMap, WithdrawReason, WithdrawReasons, LockIdentifier, LockableCurrency, ExistenceRequirement, @@ -178,14 +177,7 @@ use sp_runtime::{ }; use frame_system::{self as system, ensure_signed, ensure_root}; pub use self::imbalances::{PositiveImbalance, NegativeImbalance}; - -pub trait WeightInfo { - fn transfer() -> Weight; - fn transfer_keep_alive() -> Weight; - fn set_balance_creating() -> Weight; - fn set_balance_killing() -> Weight; - fn force_transfer() -> Weight; -} +pub use weights::WeightInfo; pub trait Subtrait: frame_system::Trait { /// The balance of an account. diff --git a/substrate/frame/balances/src/weights.rs b/substrate/frame/balances/src/weights.rs new file mode 100644 index 0000000000..45e4195f96 --- /dev/null +++ b/substrate/frame/balances/src/weights.rs @@ -0,0 +1,123 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_balances +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_balances +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/balances/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_balances. +pub trait WeightInfo { + fn transfer() -> Weight; + fn transfer_keep_alive() -> Weight; + fn set_balance_creating() -> Weight; + fn set_balance_killing() -> Weight; + fn force_transfer() -> Weight; + +} + +/// Weights for pallet_balances using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn transfer() -> Weight { + (94_088_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn transfer_keep_alive() -> Weight { + (64_828_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_balance_creating() -> Weight { + (36_151_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_balance_killing() -> Weight { + (45_505_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn force_transfer() -> Weight { + (92_986_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn transfer() -> Weight { + (94_088_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn transfer_keep_alive() -> Weight { + (64_828_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_balance_creating() -> Weight { + (36_151_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_balance_killing() -> Weight { + (45_505_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn force_transfer() -> Weight { + (92_986_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + +} diff --git a/substrate/frame/collective/src/default_weight.rs b/substrate/frame/collective/src/default_weight.rs deleted file mode 100644 index bb6fe0ea25..0000000000 --- a/substrate/frame/collective/src/default_weight.rs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Default weights for the Collective Pallet -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn set_members(m: u32, n: u32, p: u32, ) -> Weight { - (0 as Weight) - .saturating_add((21040000 as Weight).saturating_mul(m as Weight)) - .saturating_add((173000 as Weight).saturating_mul(n as Weight)) - .saturating_add((31595000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) - } - fn execute(b: u32, m: u32, ) -> Weight { - (43359000 as Weight) - .saturating_add((4000 as Weight).saturating_mul(b as Weight)) - .saturating_add((123000 as Weight).saturating_mul(m as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - } - fn propose_execute(b: u32, m: u32, ) -> Weight { - (54134000 as Weight) - .saturating_add((4000 as Weight).saturating_mul(b as Weight)) - .saturating_add((239000 as Weight).saturating_mul(m as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - } - fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { - (90650000 as Weight) - .saturating_add((5000 as Weight).saturating_mul(b as Weight)) - .saturating_add((152000 as Weight).saturating_mul(m as Weight)) - .saturating_add((970000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - } - fn vote(m: u32, ) -> Weight { - (74460000 as Weight) - .saturating_add((290000 as Weight).saturating_mul(m as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn close_early_disapproved(m: u32, p: u32, ) -> Weight { - (86360000 as Weight) - .saturating_add((232000 as Weight).saturating_mul(m as Weight)) - .saturating_add((954000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { - (123653000 as Weight) - .saturating_add((1000 as Weight).saturating_mul(b as Weight)) - .saturating_add((287000 as Weight).saturating_mul(m as Weight)) - .saturating_add((920000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn close_disapproved(m: u32, p: u32, ) -> Weight { - (95395000 as Weight) - .saturating_add((236000 as Weight).saturating_mul(m as Weight)) - .saturating_add((965000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { - (135284000 as Weight) - .saturating_add((4000 as Weight).saturating_mul(b as Weight)) - .saturating_add((218000 as Weight).saturating_mul(m as Weight)) - .saturating_add((951000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn disapprove_proposal(p: u32, ) -> Weight { - (50500000 as Weight) - .saturating_add((966000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } -} diff --git a/substrate/frame/collective/src/lib.rs b/substrate/frame/collective/src/lib.rs index dd44f5e2ae..b7d561672b 100644 --- a/substrate/frame/collective/src/lib.rs +++ b/substrate/frame/collective/src/lib.rs @@ -63,7 +63,8 @@ use frame_system::{self as system, ensure_signed, ensure_root}; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; -mod default_weight; +pub mod weights; +pub use weights::WeightInfo; /// Simple index type for proposal counting. pub type ProposalIndex = u32; @@ -120,19 +121,6 @@ impl DefaultVote for MoreThanMajorityThenPrimeDefaultVote { } } -pub trait WeightInfo { - fn set_members(m: u32, n: u32, p: u32, ) -> Weight; - fn execute(b: u32, m: u32, ) -> Weight; - fn propose_execute(b: u32, m: u32, ) -> Weight; - fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight; - fn vote(m: u32, ) -> Weight; - fn close_early_disapproved(m: u32, p: u32, ) -> Weight; - fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight; - fn close_disapproved(m: u32, p: u32, ) -> Weight; - fn close_approved(b: u32, m: u32, p: u32, ) -> Weight; - fn disapprove_proposal(p: u32, ) -> Weight; -} - pub trait Trait: frame_system::Trait { /// The outer origin type. type Origin: From>; diff --git a/substrate/frame/collective/src/weights.rs b/substrate/frame/collective/src/weights.rs new file mode 100644 index 0000000000..4e4ec5196d --- /dev/null +++ b/substrate/frame/collective/src/weights.rs @@ -0,0 +1,230 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_collective +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_collective +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/collective/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_collective. +pub trait WeightInfo { + fn set_members(_m: u32, _n: u32, _p: u32, ) -> Weight; + fn execute(_b: u32, _m: u32, ) -> Weight; + fn propose_execute(_b: u32, _m: u32, ) -> Weight; + fn propose_proposed(_b: u32, _m: u32, _p: u32, ) -> Weight; + fn vote(_m: u32, ) -> Weight; + fn close_early_disapproved(_m: u32, _p: u32, ) -> Weight; + fn close_early_approved(_b: u32, _m: u32, _p: u32, ) -> Weight; + fn close_disapproved(_m: u32, _p: u32, ) -> Weight; + fn close_approved(_b: u32, _m: u32, _p: u32, ) -> Weight; + fn disapprove_proposal(_p: u32, ) -> Weight; + +} + +/// Weights for pallet_collective using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn set_members(m: u32, n: u32, p: u32, ) -> Weight { + (0 as Weight) + .saturating_add((20_933_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((254_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((28_233_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } + fn execute(b: u32, m: u32, ) -> Weight { + (31_147_000 as Weight) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((115_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + + } + fn propose_execute(b: u32, m: u32, ) -> Weight { + (38_774_000 as Weight) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((226_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + + } + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + (64_230_000 as Weight) + .saturating_add((5_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((138_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((637_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + + } + fn vote(m: u32, ) -> Weight { + (57_051_000 as Weight) + .saturating_add((220_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + (61_406_000 as Weight) + .saturating_add((225_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((630_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + (92_864_000 as Weight) + .saturating_add((1_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((233_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((597_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn close_disapproved(m: u32, p: u32, ) -> Weight { + (67_942_000 as Weight) + .saturating_add((232_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((636_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + (99_742_000 as Weight) + .saturating_add((1_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((233_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((598_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn disapprove_proposal(p: u32, ) -> Weight { + (36_628_000 as Weight) + .saturating_add((640_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn set_members(m: u32, n: u32, p: u32, ) -> Weight { + (0 as Weight) + .saturating_add((20_933_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((254_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((28_233_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(p as Weight))) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } + fn execute(b: u32, m: u32, ) -> Weight { + (31_147_000 as Weight) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((115_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + + } + fn propose_execute(b: u32, m: u32, ) -> Weight { + (38_774_000 as Weight) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((226_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + + } + fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight { + (64_230_000 as Weight) + .saturating_add((5_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((138_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((637_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + + } + fn vote(m: u32, ) -> Weight { + (57_051_000 as Weight) + .saturating_add((220_000 as Weight).saturating_mul(m as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn close_early_disapproved(m: u32, p: u32, ) -> Weight { + (61_406_000 as Weight) + .saturating_add((225_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((630_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight { + (92_864_000 as Weight) + .saturating_add((1_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((233_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((597_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn close_disapproved(m: u32, p: u32, ) -> Weight { + (67_942_000 as Weight) + .saturating_add((232_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((636_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn close_approved(b: u32, m: u32, p: u32, ) -> Weight { + (99_742_000 as Weight) + .saturating_add((1_000 as Weight).saturating_mul(b as Weight)) + .saturating_add((233_000 as Weight).saturating_mul(m as Weight)) + .saturating_add((598_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn disapprove_proposal(p: u32, ) -> Weight { + (36_628_000 as Weight) + .saturating_add((640_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + +} diff --git a/substrate/frame/democracy/src/default_weight.rs b/substrate/frame/democracy/src/default_weight.rs deleted file mode 100644 index 28aa45ae2d..0000000000 --- a/substrate/frame/democracy/src/default_weight.rs +++ /dev/null @@ -1,171 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Weights for pallet_democracy -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 -//! DATE: 2020-09-24, STEPS: [50], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn propose() -> Weight { - (96_316_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn second(s: u32, ) -> Weight { - (58_386_000 as Weight) - .saturating_add((259_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn vote_new(r: u32, ) -> Weight { - (70_374_000 as Weight) - .saturating_add((291_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn vote_existing(r: u32, ) -> Weight { - (70_097_000 as Weight) - .saturating_add((296_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn emergency_cancel() -> Weight { - (41_731_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn blacklist(p: u32, ) -> Weight { - (117_847_000 as Weight) - .saturating_add((871_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(6 as Weight)) - } - fn external_propose(v: u32, ) -> Weight { - (20_972_000 as Weight) - .saturating_add((114_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn external_propose_majority() -> Weight { - (5_030_000 as Weight) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn external_propose_default() -> Weight { - (4_981_000 as Weight) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn fast_track() -> Weight { - (42_801_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn veto_external(v: u32, ) -> Weight { - (44_115_000 as Weight) - .saturating_add((194_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn cancel_proposal(p: u32, ) -> Weight { - (73_937_000 as Weight) - .saturating_add((962_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn cancel_referendum() -> Weight { - (25_233_000 as Weight) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn cancel_queued(r: u32, ) -> Weight { - (48_251_000 as Weight) - .saturating_add((3_590_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn on_initialize_base(r: u32, ) -> Weight { - (17_597_000 as Weight) - .saturating_add((7_248_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - } - fn delegate(r: u32, ) -> Weight { - (93_916_000 as Weight) - .saturating_add((10_794_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - .saturating_add(DbWeight::get().writes(4 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) - } - fn undelegate(r: u32, ) -> Weight { - (47_855_000 as Weight) - .saturating_add((10_805_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) - } - fn clear_public_proposals() -> Weight { - (4_864_000 as Weight) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn note_preimage(b: u32, ) -> Weight { - (66_754_000 as Weight) - .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn note_imminent_preimage(b: u32, ) -> Weight { - (44_664_000 as Weight) - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn reap_preimage(b: u32, ) -> Weight { - (59_968_000 as Weight) - .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn unlock_remove(r: u32, ) -> Weight { - (58_573_000 as Weight) - .saturating_add((131_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn unlock_set(r: u32, ) -> Weight { - (53_831_000 as Weight) - .saturating_add((324_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn remove_vote(r: u32, ) -> Weight { - (31_846_000 as Weight) - .saturating_add((327_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn remove_other_vote(r: u32, ) -> Weight { - (31_880_000 as Weight) - .saturating_add((222_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/frame/democracy/src/lib.rs b/substrate/frame/democracy/src/lib.rs index 884106a63b..2eb0f89f3a 100644 --- a/substrate/frame/democracy/src/lib.rs +++ b/substrate/frame/democracy/src/lib.rs @@ -173,7 +173,8 @@ mod vote_threshold; mod vote; mod conviction; mod types; -mod default_weight; +pub mod weights; +pub use weights::WeightInfo; pub use vote_threshold::{Approved, VoteThreshold}; pub use vote::{Vote, AccountVote, Voting}; pub use conviction::Conviction; @@ -202,34 +203,6 @@ type BalanceOf = <::Currency as Currency< = <::Currency as Currency<::AccountId>>::NegativeImbalance; -pub trait WeightInfo { - fn propose() -> Weight; - fn second(s: u32, ) -> Weight; - fn vote_new(r: u32, ) -> Weight; - fn vote_existing(r: u32, ) -> Weight; - fn emergency_cancel() -> Weight; - fn blacklist(p: u32, ) -> Weight; - fn external_propose(v: u32, ) -> Weight; - fn external_propose_majority() -> Weight; - fn external_propose_default() -> Weight; - fn fast_track() -> Weight; - fn veto_external(v: u32, ) -> Weight; - fn cancel_referendum() -> Weight; - fn cancel_proposal(p: u32, ) -> Weight; - fn cancel_queued(r: u32, ) -> Weight; - fn on_initialize_base(r: u32, ) -> Weight; - fn delegate(r: u32, ) -> Weight; - fn undelegate(r: u32, ) -> Weight; - fn clear_public_proposals() -> Weight; - fn note_preimage(b: u32, ) -> Weight; - fn note_imminent_preimage(b: u32, ) -> Weight; - fn reap_preimage(b: u32, ) -> Weight; - fn unlock_remove(r: u32, ) -> Weight; - fn unlock_set(r: u32, ) -> Weight; - fn remove_vote(r: u32, ) -> Weight; - fn remove_other_vote(r: u32, ) -> Weight; -} - pub trait Trait: frame_system::Trait + Sized { type Proposal: Parameter + Dispatchable + From>; type Event: From> + Into<::Event>; diff --git a/substrate/frame/democracy/src/weights.rs b/substrate/frame/democracy/src/weights.rs new file mode 100644 index 0000000000..9d17d3a768 --- /dev/null +++ b/substrate/frame/democracy/src/weights.rs @@ -0,0 +1,415 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_democracy +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_democracy +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/democracy/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_democracy. +pub trait WeightInfo { + fn propose() -> Weight; + fn second(_s: u32, ) -> Weight; + fn vote_new(_r: u32, ) -> Weight; + fn vote_existing(_r: u32, ) -> Weight; + fn emergency_cancel() -> Weight; + fn blacklist(_p: u32, ) -> Weight; + fn external_propose(_v: u32, ) -> Weight; + fn external_propose_majority() -> Weight; + fn external_propose_default() -> Weight; + fn fast_track() -> Weight; + fn veto_external(_v: u32, ) -> Weight; + fn cancel_proposal(_p: u32, ) -> Weight; + fn cancel_referendum() -> Weight; + fn cancel_queued(_r: u32, ) -> Weight; + fn on_initialize_base(_r: u32, ) -> Weight; + fn delegate(_r: u32, ) -> Weight; + fn undelegate(_r: u32, ) -> Weight; + fn clear_public_proposals() -> Weight; + fn note_preimage(_b: u32, ) -> Weight; + fn note_imminent_preimage(_b: u32, ) -> Weight; + fn reap_preimage(_b: u32, ) -> Weight; + fn unlock_remove(_r: u32, ) -> Weight; + fn unlock_set(_r: u32, ) -> Weight; + fn remove_vote(_r: u32, ) -> Weight; + fn remove_other_vote(_r: u32, ) -> Weight; + +} + +/// Weights for pallet_democracy using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn propose() -> Weight { + (86_479_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn second(s: u32, ) -> Weight { + (52_126_000 as Weight) + .saturating_add((211_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn vote_new(r: u32, ) -> Weight { + (62_010_000 as Weight) + .saturating_add((288_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn vote_existing(r: u32, ) -> Weight { + (61_870_000 as Weight) + .saturating_add((294_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn emergency_cancel() -> Weight { + (37_329_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn blacklist(p: u32, ) -> Weight { + (105_595_000 as Weight) + .saturating_add((812_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(6 as Weight)) + + } + fn external_propose(v: u32, ) -> Weight { + (18_670_000 as Weight) + .saturating_add((110_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn external_propose_majority() -> Weight { + (4_413_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn external_propose_default() -> Weight { + (4_365_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn fast_track() -> Weight { + (37_914_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn veto_external(v: u32, ) -> Weight { + (38_965_000 as Weight) + .saturating_add((188_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn cancel_proposal(p: u32, ) -> Weight { + (66_560_000 as Weight) + .saturating_add((898_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn cancel_referendum() -> Weight { + (22_971_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn cancel_queued(r: u32, ) -> Weight { + (41_431_000 as Weight) + .saturating_add((4_598_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn on_initialize_base(r: u32, ) -> Weight { + (14_908_000 as Weight) + .saturating_add((6_638_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + + } + fn delegate(r: u32, ) -> Weight { + (82_620_000 as Weight) + .saturating_add((9_780_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) + } + fn undelegate(r: u32, ) -> Weight { + (40_817_000 as Weight) + .saturating_add((9_870_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) + } + fn clear_public_proposals() -> Weight { + (4_071_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn note_preimage(b: u32, ) -> Weight { + (58_361_000 as Weight) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn note_imminent_preimage(b: u32, ) -> Weight { + (39_294_000 as Weight) + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn reap_preimage(b: u32, ) -> Weight { + (52_829_000 as Weight) + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn unlock_remove(r: u32, ) -> Weight { + (52_058_000 as Weight) + .saturating_add((131_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn unlock_set(r: u32, ) -> Weight { + (47_488_000 as Weight) + .saturating_add((317_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn remove_vote(r: u32, ) -> Weight { + (28_231_000 as Weight) + .saturating_add((311_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn remove_other_vote(r: u32, ) -> Weight { + (27_743_000 as Weight) + .saturating_add((217_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn propose() -> Weight { + (86_479_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn second(s: u32, ) -> Weight { + (52_126_000 as Weight) + .saturating_add((211_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn vote_new(r: u32, ) -> Weight { + (62_010_000 as Weight) + .saturating_add((288_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn vote_existing(r: u32, ) -> Weight { + (61_870_000 as Weight) + .saturating_add((294_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn emergency_cancel() -> Weight { + (37_329_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn blacklist(p: u32, ) -> Weight { + (105_595_000 as Weight) + .saturating_add((812_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(6 as Weight)) + + } + fn external_propose(v: u32, ) -> Weight { + (18_670_000 as Weight) + .saturating_add((110_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn external_propose_majority() -> Weight { + (4_413_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn external_propose_default() -> Weight { + (4_365_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn fast_track() -> Weight { + (37_914_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn veto_external(v: u32, ) -> Weight { + (38_965_000 as Weight) + .saturating_add((188_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn cancel_proposal(p: u32, ) -> Weight { + (66_560_000 as Weight) + .saturating_add((898_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn cancel_referendum() -> Weight { + (22_971_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn cancel_queued(r: u32, ) -> Weight { + (41_431_000 as Weight) + .saturating_add((4_598_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn on_initialize_base(r: u32, ) -> Weight { + (14_908_000 as Weight) + .saturating_add((6_638_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + + } + fn delegate(r: u32, ) -> Weight { + (82_620_000 as Weight) + .saturating_add((9_780_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) + } + fn undelegate(r: u32, ) -> Weight { + (40_817_000 as Weight) + .saturating_add((9_870_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(r as Weight))) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(r as Weight))) + } + fn clear_public_proposals() -> Weight { + (4_071_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn note_preimage(b: u32, ) -> Weight { + (58_361_000 as Weight) + .saturating_add((4_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn note_imminent_preimage(b: u32, ) -> Weight { + (39_294_000 as Weight) + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn reap_preimage(b: u32, ) -> Weight { + (52_829_000 as Weight) + .saturating_add((3_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn unlock_remove(r: u32, ) -> Weight { + (52_058_000 as Weight) + .saturating_add((131_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn unlock_set(r: u32, ) -> Weight { + (47_488_000 as Weight) + .saturating_add((317_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn remove_vote(r: u32, ) -> Weight { + (28_231_000 as Weight) + .saturating_add((311_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn remove_other_vote(r: u32, ) -> Weight { + (27_743_000 as Weight) + .saturating_add((217_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + +} diff --git a/substrate/frame/elections-phragmen/src/default_weights.rs b/substrate/frame/elections-phragmen/src/default_weights.rs deleted file mode 100644 index 4025e61d15..0000000000 --- a/substrate/frame/elections-phragmen/src/default_weights.rs +++ /dev/null @@ -1,88 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn vote(v: u32, ) -> Weight { - (91_489_000 as Weight) - .saturating_add((199_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn vote_update(v: u32, ) -> Weight { - (56_511_000 as Weight) - .saturating_add((245_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn remove_voter() -> Weight { - (76_714_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn report_defunct_voter_correct(c: u32, v: u32, ) -> Weight { - (0 as Weight) - .saturating_add((1_743_000 as Weight).saturating_mul(c as Weight)) - .saturating_add((31_750_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn report_defunct_voter_incorrect(c: u32, v: u32, ) -> Weight { - (0 as Weight) - .saturating_add((1_733_000 as Weight).saturating_mul(c as Weight)) - .saturating_add((31_861_000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn submit_candidacy(c: u32, ) -> Weight { - (74_714_000 as Weight) - .saturating_add((315_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn renounce_candidacy_candidate(c: u32, ) -> Weight { - (50_408_000 as Weight) - .saturating_add((159_000 as Weight).saturating_mul(c as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn renounce_candidacy_members() -> Weight { - (79_626_000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - } - fn renounce_candidacy_runners_up() -> Weight { - (49_715_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn remove_member_with_replacement() -> Weight { - (76_572_000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) - } - fn remove_member_wrong_refund() -> Weight { - (8_777_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - } -} diff --git a/substrate/frame/elections-phragmen/src/lib.rs b/substrate/frame/elections-phragmen/src/lib.rs index f743c3cde8..ba4606b985 100644 --- a/substrate/frame/elections-phragmen/src/lib.rs +++ b/substrate/frame/elections-phragmen/src/lib.rs @@ -105,7 +105,8 @@ use sp_runtime::{ use sp_std::prelude::*; mod benchmarking; -mod default_weights; +pub mod weights; +pub use weights::WeightInfo; /// The maximum votes allowed per voter. pub const MAXIMUM_VOTE: usize = 16; @@ -139,20 +140,6 @@ pub struct DefunctVoter { pub candidate_count: u32 } -pub trait WeightInfo { - fn vote(v: u32, ) -> Weight; - fn vote_update(v: u32, ) -> Weight; - fn remove_voter() -> Weight; - fn report_defunct_voter_correct(c: u32, v: u32, ) -> Weight; - fn report_defunct_voter_incorrect(c: u32, v: u32, ) -> Weight; - fn submit_candidacy(c: u32, ) -> Weight; - fn renounce_candidacy_candidate(c: u32, ) -> Weight; - fn renounce_candidacy_members() -> Weight; - fn renounce_candidacy_runners_up() -> Weight; - fn remove_member_with_replacement() -> Weight; - fn remove_member_wrong_refund() -> Weight; -} - pub trait Trait: frame_system::Trait { /// The overarching event type.c type Event: From> + Into<::Event>; @@ -2443,7 +2430,7 @@ mod tests { assert_err_with_weight!( Elections::remove_member(Origin::root(), 4, true), Error::::InvalidReplacement, - Some(33777000), // only thing that matters for now is that it is NOT the full block. + Some(33489000), // only thing that matters for now is that it is NOT the full block. ); }); @@ -2465,7 +2452,7 @@ mod tests { assert_err_with_weight!( Elections::remove_member(Origin::root(), 4, false), Error::::InvalidReplacement, - Some(33777000) // only thing that matters for now is that it is NOT the full block. + Some(33489000) // only thing that matters for now is that it is NOT the full block. ); }); } diff --git a/substrate/frame/elections-phragmen/src/weights.rs b/substrate/frame/elections-phragmen/src/weights.rs new file mode 100644 index 0000000000..2702aec0a0 --- /dev/null +++ b/substrate/frame/elections-phragmen/src/weights.rs @@ -0,0 +1,215 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_elections_phragmen +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_elections_phragmen +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/elections-phragmen/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_elections_phragmen. +pub trait WeightInfo { + fn vote(_v: u32, ) -> Weight; + fn vote_update(_v: u32, ) -> Weight; + fn remove_voter() -> Weight; + fn report_defunct_voter_correct(_c: u32, _v: u32, ) -> Weight; + fn report_defunct_voter_incorrect(_c: u32, _v: u32, ) -> Weight; + fn submit_candidacy(_c: u32, ) -> Weight; + fn renounce_candidacy_candidate(_c: u32, ) -> Weight; + fn renounce_candidacy_members() -> Weight; + fn renounce_candidacy_runners_up() -> Weight; + fn remove_member_with_replacement() -> Weight; + fn remove_member_wrong_refund() -> Weight; + +} + +/// Weights for pallet_elections_phragmen using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn vote(v: u32, ) -> Weight { + (89_627_000 as Weight) + .saturating_add((197_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn vote_update(v: u32, ) -> Weight { + (54_724_000 as Weight) + .saturating_add((213_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn remove_voter() -> Weight { + (73_774_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn report_defunct_voter_correct(c: u32, v: u32, ) -> Weight { + (0 as Weight) + .saturating_add((1_746_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((31_383_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn report_defunct_voter_incorrect(c: u32, v: u32, ) -> Weight { + (0 as Weight) + .saturating_add((1_725_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((31_293_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn submit_candidacy(c: u32, ) -> Weight { + (73_403_000 as Weight) + .saturating_add((314_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn renounce_candidacy_candidate(c: u32, ) -> Weight { + (48_834_000 as Weight) + .saturating_add((187_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn renounce_candidacy_members() -> Weight { + (78_402_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + + } + fn renounce_candidacy_runners_up() -> Weight { + (49_054_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn remove_member_with_replacement() -> Weight { + (75_421_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + + } + fn remove_member_wrong_refund() -> Weight { + (8_489_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn vote(v: u32, ) -> Weight { + (89_627_000 as Weight) + .saturating_add((197_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn vote_update(v: u32, ) -> Weight { + (54_724_000 as Weight) + .saturating_add((213_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn remove_voter() -> Weight { + (73_774_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn report_defunct_voter_correct(c: u32, v: u32, ) -> Weight { + (0 as Weight) + .saturating_add((1_746_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((31_383_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(7 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn report_defunct_voter_incorrect(c: u32, v: u32, ) -> Weight { + (0 as Weight) + .saturating_add((1_725_000 as Weight).saturating_mul(c as Weight)) + .saturating_add((31_293_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().reads(6 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn submit_candidacy(c: u32, ) -> Weight { + (73_403_000 as Weight) + .saturating_add((314_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn renounce_candidacy_candidate(c: u32, ) -> Weight { + (48_834_000 as Weight) + .saturating_add((187_000 as Weight).saturating_mul(c as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn renounce_candidacy_members() -> Weight { + (78_402_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + + } + fn renounce_candidacy_runners_up() -> Weight { + (49_054_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn remove_member_with_replacement() -> Weight { + (75_421_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) + + } + fn remove_member_wrong_refund() -> Weight { + (8_489_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + + } + +} diff --git a/substrate/frame/identity/src/default_weights.rs b/substrate/frame/identity/src/default_weights.rs deleted file mode 100644 index 93b1c89ab9..0000000000 --- a/substrate/frame/identity/src/default_weights.rs +++ /dev/null @@ -1,135 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn add_registrar(r: u32, ) -> Weight { - (39_603_000 as Weight) - .saturating_add((418_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_identity(r: u32, x: u32, ) -> Weight { - (110_679_000 as Weight) - .saturating_add((389_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((2_985_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_subs_new(s: u32, ) -> Weight { - (78_697_000 as Weight) - .saturating_add((15_225_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn set_subs_old(p: u32, ) -> Weight { - (71_308_000 as Weight) - .saturating_add((5_772_000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) - } - fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { - (91_553_000 as Weight) - .saturating_add((284_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((5_749_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((1_621_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn request_judgement(r: u32, x: u32, ) -> Weight { - (110_856_000 as Weight) - .saturating_add((496_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((3_221_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn cancel_request(r: u32, x: u32, ) -> Weight { - (96_857_000 as Weight) - .saturating_add((311_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((3_204_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_fee(r: u32, ) -> Weight { - (16_276_000 as Weight) - .saturating_add((381_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_account_id(r: u32, ) -> Weight { - (18_530_000 as Weight) - .saturating_add((391_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_fields(r: u32, ) -> Weight { - (16_359_000 as Weight) - .saturating_add((379_000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn provide_judgement(r: u32, x: u32, ) -> Weight { - (72_869_000 as Weight) - .saturating_add((423_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((3_187_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight { - (123_199_000 as Weight) - .saturating_add((71_000 as Weight).saturating_mul(r as Weight)) - .saturating_add((5_730_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((2_000 as Weight).saturating_mul(x as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn add_sub(s: u32, ) -> Weight { - (110_070_000 as Weight) - .saturating_add((262_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn rename_sub(s: u32, ) -> Weight { - (37_130_000 as Weight) - .saturating_add((79_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn remove_sub(s: u32, ) -> Weight { - (103_295_000 as Weight) - .saturating_add((235_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn quit_sub(s: u32, ) -> Weight { - (65_716_000 as Weight) - .saturating_add((227_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/frame/identity/src/lib.rs b/substrate/frame/identity/src/lib.rs index 1ff69af9a9..0ee6563a56 100644 --- a/substrate/frame/identity/src/lib.rs +++ b/substrate/frame/identity/src/lib.rs @@ -72,6 +72,11 @@ #![cfg_attr(not(feature = "std"), no_std)] +#[cfg(test)] +mod tests; +mod benchmarking; +pub mod weights; + use sp_std::prelude::*; use sp_std::{fmt::Debug, ops::Add, iter::once}; use enumflags2::BitFlags; @@ -82,37 +87,13 @@ use frame_support::{ decl_module, decl_event, decl_storage, ensure, decl_error, dispatch::DispatchResultWithPostInfo, traits::{Currency, ReservableCurrency, OnUnbalanced, Get, BalanceStatus, EnsureOrigin}, - weights::Weight, }; use frame_system::ensure_signed; - -#[cfg(test)] -mod tests; -mod benchmarking; -mod default_weights; +pub use weights::WeightInfo; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; type NegativeImbalanceOf = <::Currency as Currency<::AccountId>>::NegativeImbalance; -pub trait WeightInfo { - fn add_registrar(r: u32, ) -> Weight; - fn set_identity(r: u32, x: u32, ) -> Weight; - fn set_subs_new(s: u32, ) -> Weight; - fn set_subs_old(p: u32, ) -> Weight; - fn add_sub(p: u32, ) -> Weight; - fn rename_sub(p: u32, ) -> Weight; - fn remove_sub(p: u32, ) -> Weight; - fn quit_sub(p: u32, ) -> Weight; - fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight; - fn request_judgement(r: u32, x: u32, ) -> Weight; - fn cancel_request(r: u32, x: u32, ) -> Weight; - fn set_fee(r: u32, ) -> Weight; - fn set_account_id(r: u32, ) -> Weight; - fn set_fields(r: u32, ) -> Weight; - fn provide_judgement(r: u32, x: u32, ) -> Weight; - fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight; -} - pub trait Trait: frame_system::Trait { /// The overarching event type. type Event: From> + Into<::Event>; diff --git a/substrate/frame/identity/src/weights.rs b/substrate/frame/identity/src/weights.rs new file mode 100644 index 0000000000..44efbb3103 --- /dev/null +++ b/substrate/frame/identity/src/weights.rs @@ -0,0 +1,312 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_identity +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_identity +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/identity/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_identity. +pub trait WeightInfo { + fn add_registrar(_r: u32, ) -> Weight; + fn set_identity(_r: u32, _x: u32, ) -> Weight; + fn set_subs_new(_s: u32, ) -> Weight; + fn set_subs_old(_p: u32, ) -> Weight; + fn clear_identity(_r: u32, _s: u32, _x: u32, ) -> Weight; + fn request_judgement(_r: u32, _x: u32, ) -> Weight; + fn cancel_request(_r: u32, _x: u32, ) -> Weight; + fn set_fee(_r: u32, ) -> Weight; + fn set_account_id(_r: u32, ) -> Weight; + fn set_fields(_r: u32, ) -> Weight; + fn provide_judgement(_r: u32, _x: u32, ) -> Weight; + fn kill_identity(_r: u32, _s: u32, _x: u32, ) -> Weight; + fn add_sub(_s: u32, ) -> Weight; + fn rename_sub(_s: u32, ) -> Weight; + fn remove_sub(_s: u32, ) -> Weight; + fn quit_sub(_s: u32, ) -> Weight; + +} + +/// Weights for pallet_identity using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn add_registrar(r: u32, ) -> Weight { + (28_965_000 as Weight) + .saturating_add((421_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_identity(r: u32, x: u32, ) -> Weight { + (71_923_000 as Weight) + .saturating_add((529_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_763_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_subs_new(s: u32, ) -> Weight { + (55_550_000 as Weight) + .saturating_add((9_760_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn set_subs_old(p: u32, ) -> Weight { + (51_789_000 as Weight) + .saturating_add((3_484_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } + fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { + (65_458_000 as Weight) + .saturating_add((230_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((3_437_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_023_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn request_judgement(r: u32, x: u32, ) -> Weight { + (75_299_000 as Weight) + .saturating_add((493_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_014_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn cancel_request(r: u32, x: u32, ) -> Weight { + (67_492_000 as Weight) + .saturating_add((225_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_003_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_fee(r: u32, ) -> Weight { + (11_375_000 as Weight) + .saturating_add((382_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_account_id(r: u32, ) -> Weight { + (12_898_000 as Weight) + .saturating_add((384_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_fields(r: u32, ) -> Weight { + (11_419_000 as Weight) + .saturating_add((381_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn provide_judgement(r: u32, x: u32, ) -> Weight { + (51_115_000 as Weight) + .saturating_add((427_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_001_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn kill_identity(_r: u32, s: u32, _x: u32, ) -> Weight { + (90_911_000 as Weight) + .saturating_add((3_450_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn add_sub(s: u32, ) -> Weight { + (76_957_000 as Weight) + .saturating_add((261_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn rename_sub(s: u32, ) -> Weight { + (26_219_000 as Weight) + .saturating_add((84_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn remove_sub(s: u32, ) -> Weight { + (73_130_000 as Weight) + .saturating_add((239_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn quit_sub(s: u32, ) -> Weight { + (48_088_000 as Weight) + .saturating_add((237_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn add_registrar(r: u32, ) -> Weight { + (28_965_000 as Weight) + .saturating_add((421_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_identity(r: u32, x: u32, ) -> Weight { + (71_923_000 as Weight) + .saturating_add((529_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((1_763_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_subs_new(s: u32, ) -> Weight { + (55_550_000 as Weight) + .saturating_add((9_760_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(s as Weight))) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn set_subs_old(p: u32, ) -> Weight { + (51_789_000 as Weight) + .saturating_add((3_484_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } + fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight { + (65_458_000 as Weight) + .saturating_add((230_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((3_437_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_023_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn request_judgement(r: u32, x: u32, ) -> Weight { + (75_299_000 as Weight) + .saturating_add((493_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_014_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn cancel_request(r: u32, x: u32, ) -> Weight { + (67_492_000 as Weight) + .saturating_add((225_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_003_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_fee(r: u32, ) -> Weight { + (11_375_000 as Weight) + .saturating_add((382_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_account_id(r: u32, ) -> Weight { + (12_898_000 as Weight) + .saturating_add((384_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_fields(r: u32, ) -> Weight { + (11_419_000 as Weight) + .saturating_add((381_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn provide_judgement(r: u32, x: u32, ) -> Weight { + (51_115_000 as Weight) + .saturating_add((427_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((2_001_000 as Weight).saturating_mul(x as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn kill_identity(_r: u32, s: u32, _x: u32, ) -> Weight { + (90_911_000 as Weight) + .saturating_add((3_450_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn add_sub(s: u32, ) -> Weight { + (76_957_000 as Weight) + .saturating_add((261_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn rename_sub(s: u32, ) -> Weight { + (26_219_000 as Weight) + .saturating_add((84_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn remove_sub(s: u32, ) -> Weight { + (73_130_000 as Weight) + .saturating_add((239_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn quit_sub(s: u32, ) -> Weight { + (48_088_000 as Weight) + .saturating_add((237_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + +} diff --git a/substrate/frame/im-online/src/default_weight.rs b/substrate/frame/im-online/src/default_weight.rs deleted file mode 100644 index e6efb42f2e..0000000000 --- a/substrate/frame/im-online/src/default_weight.rs +++ /dev/null @@ -1,33 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight { - (139830000 as Weight) - .saturating_add((211000 as Weight).saturating_mul(k as Weight)) - .saturating_add((654000 as Weight).saturating_mul(e as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } -} diff --git a/substrate/frame/im-online/src/lib.rs b/substrate/frame/im-online/src/lib.rs index 716a2cbcb7..2d3693d127 100644 --- a/substrate/frame/im-online/src/lib.rs +++ b/substrate/frame/im-online/src/lib.rs @@ -72,7 +72,7 @@ mod mock; mod tests; mod benchmarking; -mod default_weight; +pub mod weights; use sp_application_crypto::RuntimeAppPublic; use codec::{Encode, Decode}; @@ -96,13 +96,13 @@ use sp_staking::{ use frame_support::{ decl_module, decl_event, decl_storage, Parameter, debug, decl_error, traits::Get, - weights::Weight, }; use frame_system::ensure_none; use frame_system::offchain::{ SendTransactionTypes, SubmitTransaction, }; +pub use weights::WeightInfo; pub mod sr25519 { mod app_sr25519 { @@ -227,10 +227,6 @@ pub struct Heartbeat pub validators_len: u32, } -pub trait WeightInfo { - fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight; -} - pub trait Trait: SendTransactionTypes> + pallet_session::historical::Trait { /// The identifier type for an authority. type AuthorityId: Member + Parameter + RuntimeAppPublic + Default + Ord; diff --git a/substrate/frame/im-online/src/weights.rs b/substrate/frame/im-online/src/weights.rs new file mode 100644 index 0000000000..f9df679bd2 --- /dev/null +++ b/substrate/frame/im-online/src/weights.rs @@ -0,0 +1,75 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_im_online +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_im_online +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/im-online/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_im_online. +pub trait WeightInfo { + fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight; + +} + +/// Weights for pallet_im_online using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight { + (114_379_000 as Weight) + .saturating_add((219_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((481_000 as Weight).saturating_mul(e as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight { + (114_379_000 as Weight) + .saturating_add((219_000 as Weight).saturating_mul(k as Weight)) + .saturating_add((481_000 as Weight).saturating_mul(e as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + +} diff --git a/substrate/frame/indices/src/default_weights.rs b/substrate/frame/indices/src/default_weights.rs deleted file mode 100644 index 6b3b9c13e4..0000000000 --- a/substrate/frame/indices/src/default_weights.rs +++ /dev/null @@ -1,51 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn claim() -> Weight { - (56_237_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn transfer() -> Weight { - (63_665_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn free() -> Weight { - (50_736_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn force_transfer() -> Weight { - (52_361_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn freeze() -> Weight { - (46_483_000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } -} diff --git a/substrate/frame/indices/src/lib.rs b/substrate/frame/indices/src/lib.rs index edbaed17e5..aa645d0cb9 100644 --- a/substrate/frame/indices/src/lib.rs +++ b/substrate/frame/indices/src/lib.rs @@ -20,6 +20,12 @@ #![cfg_attr(not(feature = "std"), no_std)] +mod mock; +pub mod address; +mod tests; +mod benchmarking; +pub mod weights; + use sp_std::prelude::*; use codec::Codec; use sp_runtime::traits::{ @@ -28,27 +34,13 @@ use sp_runtime::traits::{ use frame_support::{Parameter, decl_module, decl_error, decl_event, decl_storage, ensure}; use frame_support::dispatch::DispatchResult; use frame_support::traits::{Currency, ReservableCurrency, Get, BalanceStatus::Reserved}; -use frame_support::weights::Weight; use frame_system::{ensure_signed, ensure_root}; use self::address::Address as RawAddress; - -mod mock; -pub mod address; -mod tests; -mod benchmarking; -mod default_weights; +pub use weights::WeightInfo; pub type Address = RawAddress<::AccountId, ::AccountIndex>; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; -pub trait WeightInfo { - fn claim() -> Weight; - fn transfer() -> Weight; - fn free() -> Weight; - fn force_transfer() -> Weight; - fn freeze() -> Weight; -} - /// The module's config trait. pub trait Trait: frame_system::Trait { /// Type used for storing an account's index; implies the maximum number of accounts the system diff --git a/substrate/frame/indices/src/weights.rs b/substrate/frame/indices/src/weights.rs new file mode 100644 index 0000000000..36d990cec5 --- /dev/null +++ b/substrate/frame/indices/src/weights.rs @@ -0,0 +1,123 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_indices +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_indices +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/indices/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_indices. +pub trait WeightInfo { + fn claim() -> Weight; + fn transfer() -> Weight; + fn free() -> Weight; + fn force_transfer() -> Weight; + fn freeze() -> Weight; + +} + +/// Weights for pallet_indices using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn claim() -> Weight { + (53_799_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn transfer() -> Weight { + (60_294_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn free() -> Weight { + (48_625_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn force_transfer() -> Weight { + (49_762_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn freeze() -> Weight { + (44_869_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 claim() -> Weight { + (53_799_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn transfer() -> Weight { + (60_294_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn free() -> Weight { + (48_625_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn force_transfer() -> Weight { + (49_762_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn freeze() -> Weight { + (44_869_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + +} diff --git a/substrate/frame/multisig/src/default_weights.rs b/substrate/frame/multisig/src/default_weights.rs deleted file mode 100644 index 19d1528d9a..0000000000 --- a/substrate/frame/multisig/src/default_weights.rs +++ /dev/null @@ -1,89 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn as_multi_threshold_1(z: u32, ) -> Weight { - (17_161_000 as Weight) - .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) - } - fn as_multi_create(s: u32, z: u32, ) -> Weight { - (79_857_000 as Weight) - .saturating_add((131_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn as_multi_create_store(s: u32, z: u32, ) -> Weight { - (90_218_000 as Weight) - .saturating_add((129_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((3_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn as_multi_approve(s: u32, z: u32, ) -> Weight { - (48_402_000 as Weight) - .saturating_add((132_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn as_multi_approve_store(s: u32, z: u32, ) -> Weight { - (88_390_000 as Weight) - .saturating_add((120_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((3_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn as_multi_complete(s: u32, z: u32, ) -> Weight { - (98_960_000 as Weight) - .saturating_add((276_000 as Weight).saturating_mul(s as Weight)) - .saturating_add((6_000 as Weight).saturating_mul(z as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn approve_as_multi_create(s: u32, ) -> Weight { - (80_185_000 as Weight) - .saturating_add((121_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn approve_as_multi_approve(s: u32, ) -> Weight { - (48_386_000 as Weight) - .saturating_add((143_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn approve_as_multi_complete(s: u32, ) -> Weight { - (177_181_000 as Weight) - .saturating_add((273_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn cancel_as_multi(s: u32, ) -> Weight { - (126_334_000 as Weight) - .saturating_add((124_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/frame/multisig/src/lib.rs b/substrate/frame/multisig/src/lib.rs index b011998403..873508259a 100644 --- a/substrate/frame/multisig/src/lib.rs +++ b/substrate/frame/multisig/src/lib.rs @@ -46,6 +46,10 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +mod tests; +mod benchmarking; +pub mod weights; + use sp_std::prelude::*; use codec::{Encode, Decode}; use sp_io::hashing::blake2_256; @@ -56,28 +60,12 @@ use frame_support::{traits::{Get, ReservableCurrency, Currency}, }; use frame_system::{self as system, ensure_signed, RawOrigin}; use sp_runtime::{DispatchError, DispatchResult, traits::{Dispatchable, Zero}}; - -mod tests; -mod benchmarking; -mod default_weights; +pub use weights::WeightInfo; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; /// Just a bunch of bytes, but they should decode to a valid `Call`. pub type OpaqueCall = Vec; -pub trait WeightInfo { - fn as_multi_threshold_1(z: u32, ) -> Weight; - fn as_multi_create(s: u32, z: u32, ) -> Weight; - fn as_multi_create_store(s: u32, z: u32, ) -> Weight; - fn as_multi_approve(s: u32, z: u32, ) -> Weight; - fn as_multi_approve_store(s: u32, z: u32, ) -> Weight; - fn as_multi_complete(s: u32, z: u32, ) -> Weight; - fn approve_as_multi_create(s: u32, ) -> Weight; - fn approve_as_multi_approve(s: u32, ) -> Weight; - fn approve_as_multi_complete(s: u32, ) -> Weight; - fn cancel_as_multi(s: u32, ) -> Weight; -} - /// Configuration trait. pub trait Trait: frame_system::Trait { /// The overarching event type. diff --git a/substrate/frame/multisig/src/weights.rs b/substrate/frame/multisig/src/weights.rs new file mode 100644 index 0000000000..ab55b181f5 --- /dev/null +++ b/substrate/frame/multisig/src/weights.rs @@ -0,0 +1,214 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_multisig +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_multisig +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/multisig/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_multisig. +pub trait WeightInfo { + fn as_multi_threshold_1(z: u32, ) -> Weight; + fn as_multi_create(s: u32, z: u32, ) -> Weight; + fn as_multi_create_store(s: u32, z: u32, ) -> Weight; + fn as_multi_approve(s: u32, z: u32, ) -> Weight; + fn as_multi_approve_store(s: u32, z: u32, ) -> Weight; + fn as_multi_complete(s: u32, z: u32, ) -> Weight; + fn approve_as_multi_create(s: u32, ) -> Weight; + fn approve_as_multi_approve(s: u32, ) -> Weight; + fn approve_as_multi_complete(s: u32, ) -> Weight; + fn cancel_as_multi(s: u32, ) -> Weight; + +} + +/// Weights for pallet_multisig using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn as_multi_threshold_1(z: u32, ) -> Weight { + (14_183_000 as Weight) + .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) + + } + fn as_multi_create(s: u32, z: u32, ) -> Weight { + (72_350_000 as Weight) + .saturating_add((64_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn as_multi_create_store(s: u32, z: u32, ) -> Weight { + (83_175_000 as Weight) + .saturating_add((72_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((3_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn as_multi_approve(s: u32, z: u32, ) -> Weight { + (43_035_000 as Weight) + .saturating_add((140_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn as_multi_approve_store(s: u32, z: u32, ) -> Weight { + (75_190_000 as Weight) + .saturating_add((127_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((3_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn as_multi_complete(s: u32, z: u32, ) -> Weight { + (92_751_000 as Weight) + .saturating_add((282_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((5_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn approve_as_multi_create(s: u32, ) -> Weight { + (71_937_000 as Weight) + .saturating_add((87_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn approve_as_multi_approve(s: u32, ) -> Weight { + (44_294_000 as Weight) + .saturating_add((89_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn approve_as_multi_complete(s: u32, ) -> Weight { + (163_098_000 as Weight) + .saturating_add((276_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn cancel_as_multi(s: u32, ) -> Weight { + (115_731_000 as Weight) + .saturating_add((104_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn as_multi_threshold_1(z: u32, ) -> Weight { + (14_183_000 as Weight) + .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) + + } + fn as_multi_create(s: u32, z: u32, ) -> Weight { + (72_350_000 as Weight) + .saturating_add((64_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn as_multi_create_store(s: u32, z: u32, ) -> Weight { + (83_175_000 as Weight) + .saturating_add((72_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((3_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn as_multi_approve(s: u32, z: u32, ) -> Weight { + (43_035_000 as Weight) + .saturating_add((140_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((1_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn as_multi_approve_store(s: u32, z: u32, ) -> Weight { + (75_190_000 as Weight) + .saturating_add((127_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((3_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn as_multi_complete(s: u32, z: u32, ) -> Weight { + (92_751_000 as Weight) + .saturating_add((282_000 as Weight).saturating_mul(s as Weight)) + .saturating_add((5_000 as Weight).saturating_mul(z as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn approve_as_multi_create(s: u32, ) -> Weight { + (71_937_000 as Weight) + .saturating_add((87_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn approve_as_multi_approve(s: u32, ) -> Weight { + (44_294_000 as Weight) + .saturating_add((89_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn approve_as_multi_complete(s: u32, ) -> Weight { + (163_098_000 as Weight) + .saturating_add((276_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn cancel_as_multi(s: u32, ) -> Weight { + (115_731_000 as Weight) + .saturating_add((104_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + +} diff --git a/substrate/frame/proxy/src/default_weight.rs b/substrate/frame/proxy/src/default_weight.rs deleted file mode 100644 index 183c0b81c8..0000000000 --- a/substrate/frame/proxy/src/default_weight.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5 - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn proxy(p: u32, ) -> Weight { - (26127000 as Weight) - .saturating_add((214000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - } - fn proxy_announced(a: u32, p: u32, ) -> Weight { - (55405000 as Weight) - .saturating_add((774000 as Weight).saturating_mul(a as Weight)) - .saturating_add((209000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn remove_announcement(a: u32, p: u32, ) -> Weight { - (35879000 as Weight) - .saturating_add((783000 as Weight).saturating_mul(a as Weight)) - .saturating_add((20000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn reject_announcement(a: u32, p: u32, ) -> Weight { - (36097000 as Weight) - .saturating_add((780000 as Weight).saturating_mul(a as Weight)) - .saturating_add((12000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn announce(a: u32, p: u32, ) -> Weight { - (53769000 as Weight) - .saturating_add((675000 as Weight).saturating_mul(a as Weight)) - .saturating_add((214000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn add_proxy(p: u32, ) -> Weight { - (36082000 as Weight) - .saturating_add((234000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn remove_proxy(p: u32, ) -> Weight { - (32885000 as Weight) - .saturating_add((267000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn remove_proxies(p: u32, ) -> Weight { - (31735000 as Weight) - .saturating_add((215000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn anonymous(p: u32, ) -> Weight { - (50907000 as Weight) - .saturating_add((61000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn kill_anonymous(p: u32, ) -> Weight { - (33926000 as Weight) - .saturating_add((208000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } -} diff --git a/substrate/frame/proxy/src/lib.rs b/substrate/frame/proxy/src/lib.rs index 7649fe0ad4..75ab3902dc 100644 --- a/substrate/frame/proxy/src/lib.rs +++ b/substrate/frame/proxy/src/lib.rs @@ -38,6 +38,10 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +mod tests; +mod benchmarking; +pub mod weights; + use sp_std::prelude::*; use codec::{Encode, Decode}; use sp_io::hashing::blake2_256; @@ -49,26 +53,10 @@ use frame_support::{ }; use frame_system::{self as system, ensure_signed}; use frame_support::dispatch::DispatchError; - -mod tests; -mod benchmarking; -mod default_weight; +pub use weights::WeightInfo; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; -pub trait WeightInfo { - fn proxy_announced(a: u32, p: u32, ) -> Weight; - fn remove_announcement(a: u32, p: u32, ) -> Weight; - fn reject_announcement(a: u32, p: u32, ) -> Weight; - fn announce(a: u32, p: u32, ) -> Weight; - fn proxy(p: u32, ) -> Weight; - fn add_proxy(p: u32, ) -> Weight; - fn remove_proxy(p: u32, ) -> Weight; - fn remove_proxies(p: u32, ) -> Weight; - fn anonymous(p: u32, ) -> Weight; - fn kill_anonymous(p: u32, ) -> Weight; -} - /// Configuration trait. pub trait Trait: frame_system::Trait { /// The overarching event type. diff --git a/substrate/frame/proxy/src/weights.rs b/substrate/frame/proxy/src/weights.rs new file mode 100644 index 0000000000..944fe53a14 --- /dev/null +++ b/substrate/frame/proxy/src/weights.rs @@ -0,0 +1,214 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_proxy +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_proxy +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/proxy/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_proxy. +pub trait WeightInfo { + fn proxy(p: u32, ) -> Weight; + fn proxy_announced(a: u32, p: u32, ) -> Weight; + fn remove_announcement(a: u32, p: u32, ) -> Weight; + fn reject_announcement(a: u32, p: u32, ) -> Weight; + fn announce(a: u32, p: u32, ) -> Weight; + fn add_proxy(p: u32, ) -> Weight; + fn remove_proxy(p: u32, ) -> Weight; + fn remove_proxies(p: u32, ) -> Weight; + fn anonymous(p: u32, ) -> Weight; + fn kill_anonymous(p: u32, ) -> Weight; + +} + +/// Weights for pallet_proxy using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn proxy(p: u32, ) -> Weight { + (32_194_000 as Weight) + .saturating_add((215_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + + } + fn proxy_announced(a: u32, p: u32, ) -> Weight { + (67_490_000 as Weight) + .saturating_add((859_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((215_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn remove_announcement(a: u32, p: u32, ) -> Weight { + (40_768_000 as Weight) + .saturating_add((882_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((122_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn reject_announcement(a: u32, p: u32, ) -> Weight { + (42_742_000 as Weight) + .saturating_add((852_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((22_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn announce(a: u32, p: u32, ) -> Weight { + (67_967_000 as Weight) + .saturating_add((737_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((213_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn add_proxy(p: u32, ) -> Weight { + (45_245_000 as Weight) + .saturating_add((240_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn remove_proxy(p: u32, ) -> Weight { + (40_742_000 as Weight) + .saturating_add((272_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn remove_proxies(p: u32, ) -> Weight { + (39_070_000 as Weight) + .saturating_add((214_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn anonymous(p: u32, ) -> Weight { + (64_851_000 as Weight) + .saturating_add((37_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn kill_anonymous(p: u32, ) -> Weight { + (41_831_000 as Weight) + .saturating_add((207_000 as Weight).saturating_mul(p 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 proxy(p: u32, ) -> Weight { + (32_194_000 as Weight) + .saturating_add((215_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + + } + fn proxy_announced(a: u32, p: u32, ) -> Weight { + (67_490_000 as Weight) + .saturating_add((859_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((215_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn remove_announcement(a: u32, p: u32, ) -> Weight { + (40_768_000 as Weight) + .saturating_add((882_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((122_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn reject_announcement(a: u32, p: u32, ) -> Weight { + (42_742_000 as Weight) + .saturating_add((852_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((22_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn announce(a: u32, p: u32, ) -> Weight { + (67_967_000 as Weight) + .saturating_add((737_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((213_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn add_proxy(p: u32, ) -> Weight { + (45_245_000 as Weight) + .saturating_add((240_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn remove_proxy(p: u32, ) -> Weight { + (40_742_000 as Weight) + .saturating_add((272_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn remove_proxies(p: u32, ) -> Weight { + (39_070_000 as Weight) + .saturating_add((214_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn anonymous(p: u32, ) -> Weight { + (64_851_000 as Weight) + .saturating_add((37_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn kill_anonymous(p: u32, ) -> Weight { + (41_831_000 as Weight) + .saturating_add((207_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + +} diff --git a/substrate/frame/scheduler/src/default_weights.rs b/substrate/frame/scheduler/src/default_weights.rs deleted file mode 100644 index 920de1d37a..0000000000 --- a/substrate/frame/scheduler/src/default_weights.rs +++ /dev/null @@ -1,50 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn schedule(s: u32, ) -> Weight { - (37_835_000 as Weight) - .saturating_add((81_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn cancel(s: u32, ) -> Weight { - (34_707_000 as Weight) - .saturating_add((3_125_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn schedule_named(s: u32, ) -> Weight { - (48_065_000 as Weight) - .saturating_add((110_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn cancel_named(s: u32, ) -> Weight { - (38_776_000 as Weight) - .saturating_add((3_138_000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/frame/scheduler/src/lib.rs b/substrate/frame/scheduler/src/lib.rs index 6bc2d72929..c467678a46 100644 --- a/substrate/frame/scheduler/src/lib.rs +++ b/substrate/frame/scheduler/src/lib.rs @@ -52,7 +52,7 @@ #![cfg_attr(not(feature = "std"), no_std)] mod benchmarking; -mod default_weights; +pub mod weights; use sp_std::{prelude::*, marker::PhantomData, borrow::Borrow}; use codec::{Encode, Decode, Codec}; @@ -64,13 +64,7 @@ use frame_support::{ weights::{GetDispatchInfo, Weight}, }; use frame_system::{self as system, ensure_signed}; - -pub trait WeightInfo { - fn schedule(s: u32, ) -> Weight; - fn cancel(s: u32, ) -> Weight; - fn schedule_named(s: u32, ) -> Weight; - fn cancel_named(s: u32, ) -> Weight; -} +pub use weights::WeightInfo; /// Our pallet's configuration trait. All our types and constants go in here. If the /// pallet is dependent on specific other pallets, then their configuration traits diff --git a/substrate/frame/scheduler/src/weights.rs b/substrate/frame/scheduler/src/weights.rs new file mode 100644 index 0000000000..3699e6f85b --- /dev/null +++ b/substrate/frame/scheduler/src/weights.rs @@ -0,0 +1,118 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_scheduler +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_scheduler +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/scheduler/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_scheduler. +pub trait WeightInfo { + fn schedule(s: u32, ) -> Weight; + fn cancel(s: u32, ) -> Weight; + fn schedule_named(s: u32, ) -> Weight; + fn cancel_named(s: u32, ) -> Weight; + +} + +/// Weights for pallet_scheduler using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn schedule(s: u32, ) -> Weight { + (35_029_000 as Weight) + .saturating_add((77_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn cancel(s: u32, ) -> Weight { + (31_419_000 as Weight) + .saturating_add((4_015_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn schedule_named(s: u32, ) -> Weight { + (44_752_000 as Weight) + .saturating_add((123_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn cancel_named(s: u32, ) -> Weight { + (35_712_000 as Weight) + .saturating_add((4_008_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn schedule(s: u32, ) -> Weight { + (35_029_000 as Weight) + .saturating_add((77_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn cancel(s: u32, ) -> Weight { + (31_419_000 as Weight) + .saturating_add((4_015_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn schedule_named(s: u32, ) -> Weight { + (44_752_000 as Weight) + .saturating_add((123_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn cancel_named(s: u32, ) -> Weight { + (35_712_000 as Weight) + .saturating_add((4_008_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + +} diff --git a/substrate/frame/session/src/default_weights.rs b/substrate/frame/session/src/default_weights.rs deleted file mode 100644 index f3082981c7..0000000000 --- a/substrate/frame/session/src/default_weights.rs +++ /dev/null @@ -1,36 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn set_keys() -> Weight { - (88_411_000 as Weight) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) - } - fn purge_keys() -> Weight { - (51_843_000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) - } -} diff --git a/substrate/frame/session/src/lib.rs b/substrate/frame/session/src/lib.rs index 1d81f38bdf..c0a8fc2916 100644 --- a/substrate/frame/session/src/lib.rs +++ b/substrate/frame/session/src/lib.rs @@ -100,6 +100,14 @@ #![cfg_attr(not(feature = "std"), no_std)] +#[cfg(test)] +mod mock; +#[cfg(test)] +mod tests; +#[cfg(feature = "historical")] +pub mod historical; +pub mod weights; + use sp_std::{prelude::*, marker::PhantomData, ops::{Sub, Rem}}; use codec::Decode; use sp_runtime::{KeyTypeId, Perbill, RuntimeAppPublic, BoundToRuntimeAppPublic}; @@ -114,16 +122,7 @@ use frame_support::{ weights::Weight, }; use frame_system::ensure_signed; - -#[cfg(test)] -mod mock; -#[cfg(test)] -mod tests; - -#[cfg(feature = "historical")] -pub mod historical; - -mod default_weights; +pub use weights::WeightInfo; /// Decides whether the session should be ended. pub trait ShouldEndSession { @@ -353,11 +352,6 @@ impl ValidatorRegistration for Module { } } -pub trait WeightInfo { - fn set_keys() -> Weight; - fn purge_keys() -> Weight; -} - pub trait Trait: frame_system::Trait { /// The overarching event type. type Event: From + Into<::Event>; diff --git a/substrate/frame/session/src/weights.rs b/substrate/frame/session/src/weights.rs new file mode 100644 index 0000000000..f1fc18b0ef --- /dev/null +++ b/substrate/frame/session/src/weights.rs @@ -0,0 +1,84 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_session +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_session +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/session/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_session. +pub trait WeightInfo { + fn set_keys() -> Weight; + fn purge_keys() -> Weight; + +} + +/// Weights for pallet_session using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn set_keys() -> Weight { + (86_033_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + + } + fn purge_keys() -> Weight { + (54_334_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn set_keys() -> Weight { + (86_033_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(6 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) + + } + fn purge_keys() -> Weight { + (54_334_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) + + } + +} diff --git a/substrate/frame/staking/src/default_weights.rs b/substrate/frame/staking/src/default_weights.rs deleted file mode 100644 index fa5a05f638..0000000000 --- a/substrate/frame/staking/src/default_weights.rs +++ /dev/null @@ -1,169 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Default weights of pallet-staking. -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn bond() -> Weight { - (144278000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - } - fn bond_extra() -> Weight { - (110715000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn unbond() -> Weight { - (99840000 as Weight) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn withdraw_unbonded_update(s: u32, ) -> Weight { - (100728000 as Weight) - .saturating_add((63000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(5 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn withdraw_unbonded_kill(s: u32, ) -> Weight { - (168879000 as Weight) - .saturating_add((6666000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(7 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn validate() -> Weight { - (35539000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn nominate(n: u32, ) -> Weight { - (48596000 as Weight) - .saturating_add((308000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn chill() -> Weight { - (35144000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn set_payee() -> Weight { - (24255000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_controller() -> Weight { - (52294000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn set_validator_count() -> Weight { - (5185000 as Weight) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn force_no_eras() -> Weight { - (5907000 as Weight) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn force_new_era() -> Weight { - (5917000 as Weight) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn force_new_era_always() -> Weight { - (5952000 as Weight) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_invulnerables(v: u32, ) -> Weight { - (6324000 as Weight) - .saturating_add((9000 as Weight).saturating_mul(v as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn force_unstake(s: u32, ) -> Weight { - (119691000 as Weight) - .saturating_add((6681000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn cancel_deferred_slash(s: u32, ) -> Weight { - (5820201000 as Weight) - .saturating_add((34672000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn payout_stakers_dead_controller(n: u32, ) -> Weight { - (0 as Weight) - .saturating_add((92486000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) - } - fn payout_stakers_alive_staked(n: u32, ) -> Weight { - (0 as Weight) - .saturating_add((117324000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight))) - } - fn rebond(l: u32, ) -> Weight { - (71316000 as Weight) - .saturating_add((142000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn set_history_depth(e: u32, ) -> Weight { - (0 as Weight) - .saturating_add((51901000 as Weight).saturating_mul(e as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - .saturating_add(DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight))) - } - fn reap_stash(s: u32, ) -> Weight { - (147166000 as Weight) - .saturating_add((6661000 as Weight).saturating_mul(s as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(8 as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) - } - fn new_era(v: u32, n: u32, ) -> Weight { - (0 as Weight) - .saturating_add((1440459000 as Weight).saturating_mul(v as Weight)) - .saturating_add((182580000 as Weight).saturating_mul(n as Weight)) - .saturating_add(DbWeight::get().reads(10 as Weight)) - .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight))) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) - .saturating_add(DbWeight::get().writes(8 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight))) - } - fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight { - (0 as Weight) - .saturating_add((964000 as Weight).saturating_mul(v as Weight)) - .saturating_add((432000 as Weight).saturating_mul(n as Weight)) - .saturating_add((204294000 as Weight).saturating_mul(a as Weight)) - .saturating_add((9546000 as Weight).saturating_mul(w as Weight)) - .saturating_add(DbWeight::get().reads(6 as Weight)) - .saturating_add(DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight))) - .saturating_add(DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } -} diff --git a/substrate/frame/staking/src/lib.rs b/substrate/frame/staking/src/lib.rs index cd3a71ffab..fdea1c18e7 100644 --- a/substrate/frame/staking/src/lib.rs +++ b/substrate/frame/staking/src/lib.rs @@ -279,7 +279,7 @@ pub mod benchmarking; pub mod slashing; pub mod offchain_election; pub mod inflation; -pub mod default_weights; +pub mod weights; use sp_std::{ result, @@ -330,6 +330,7 @@ use sp_npos_elections::{ build_support_map, evaluate_support, seq_phragmen, generate_solution_type, is_score_better, VotingLimit, SupportMap, VoteWeight, }; +pub use weights::WeightInfo; const STAKING_ID: LockIdentifier = *b"staking "; pub const MAX_UNLOCKING_CHUNKS: usize = 32; @@ -769,33 +770,6 @@ impl SessionInterface<::AccountId> for T whe } } -pub trait WeightInfo { - fn bond() -> Weight; - fn bond_extra() -> Weight; - fn unbond() -> Weight; - fn withdraw_unbonded_update(s: u32, ) -> Weight; - fn withdraw_unbonded_kill(s: u32, ) -> Weight; - fn validate() -> Weight; - fn nominate(n: u32, ) -> Weight; - fn chill() -> Weight; - fn set_payee() -> Weight; - fn set_controller() -> Weight; - fn set_validator_count() -> Weight; - fn force_no_eras() -> Weight; - fn force_new_era() -> Weight; - fn force_new_era_always() -> Weight; - fn set_invulnerables(v: u32, ) -> Weight; - fn force_unstake(s: u32, ) -> Weight; - fn cancel_deferred_slash(s: u32, ) -> Weight; - fn payout_stakers_alive_staked(n: u32, ) -> Weight; - fn payout_stakers_dead_controller(n: u32, ) -> Weight; - fn rebond(l: u32, ) -> Weight; - fn set_history_depth(e: u32, ) -> Weight; - fn reap_stash(s: u32, ) -> Weight; - fn new_era(v: u32, n: u32, ) -> Weight; - fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight; -} - pub trait Trait: frame_system::Trait + SendTransactionTypes> { /// The staking balance. type Currency: LockableCurrency; diff --git a/substrate/frame/staking/src/weights.rs b/substrate/frame/staking/src/weights.rs new file mode 100644 index 0000000000..cb301276e0 --- /dev/null +++ b/substrate/frame/staking/src/weights.rs @@ -0,0 +1,406 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_staking +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_staking +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/staking/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_staking. +pub trait WeightInfo { + fn bond() -> Weight; + fn bond_extra() -> Weight; + fn unbond() -> Weight; + fn withdraw_unbonded_update(_s: u32, ) -> Weight; + fn withdraw_unbonded_kill(_s: u32, ) -> Weight; + fn validate() -> Weight; + fn nominate(_n: u32, ) -> Weight; + fn chill() -> Weight; + fn set_payee() -> Weight; + fn set_controller() -> Weight; + fn set_validator_count() -> Weight; + fn force_no_eras() -> Weight; + fn force_new_era() -> Weight; + fn force_new_era_always() -> Weight; + fn set_invulnerables(_v: u32, ) -> Weight; + fn force_unstake(_s: u32, ) -> Weight; + fn cancel_deferred_slash(_s: u32, ) -> Weight; + fn payout_stakers_dead_controller(_n: u32, ) -> Weight; + fn payout_stakers_alive_staked(_n: u32, ) -> Weight; + fn rebond(_l: u32, ) -> Weight; + fn set_history_depth(_e: u32, ) -> Weight; + fn reap_stash(_s: u32, ) -> Weight; + fn new_era(_v: u32, _n: u32, ) -> Weight; + fn submit_solution_better(_v: u32, _n: u32, _a: u32, _w: u32, ) -> Weight; + +} + +/// Weights for pallet_staking using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn bond() -> Weight { + (99_659_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + + } + fn bond_extra() -> Weight { + (79_045_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn unbond() -> Weight { + (71_716_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn withdraw_unbonded_update(s: u32, ) -> Weight { + (72_835_000 as Weight) + .saturating_add((63_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn withdraw_unbonded_kill(s: u32, ) -> Weight { + (118_239_000 as Weight) + .saturating_add((3_910_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(8 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn validate() -> Weight { + (25_691_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn nominate(n: u32, ) -> Weight { + (35_374_000 as Weight) + .saturating_add((203_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn chill() -> Weight { + (25_227_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn set_payee() -> Weight { + (17_601_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_controller() -> Weight { + (37_514_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn set_validator_count() -> Weight { + (3_338_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn force_no_eras() -> Weight { + (3_869_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn force_new_era() -> Weight { + (3_795_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn force_new_era_always() -> Weight { + (3_829_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_invulnerables(v: u32, ) -> Weight { + (4_087_000 as Weight) + .saturating_add((9_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn force_unstake(s: u32, ) -> Weight { + (81_063_000 as Weight) + .saturating_add((3_872_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(8 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn cancel_deferred_slash(s: u32, ) -> Weight { + (5_840_640_000 as Weight) + .saturating_add((34_806_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn payout_stakers_dead_controller(n: u32, ) -> Weight { + (153_024_000 as Weight) + .saturating_add((59_909_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(11 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + } + fn payout_stakers_alive_staked(n: u32, ) -> Weight { + (196_058_000 as Weight) + .saturating_add((78_955_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(12 as Weight)) + .saturating_add(T::DbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight))) + } + fn rebond(l: u32, ) -> Weight { + (49_966_000 as Weight) + .saturating_add((92_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn set_history_depth(e: u32, ) -> Weight { + (0 as Weight) + .saturating_add((38_529_000 as Weight).saturating_mul(e as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + .saturating_add(T::DbWeight::get().writes((7 as Weight).saturating_mul(e as Weight))) + } + fn reap_stash(s: u32, ) -> Weight { + (101_457_000 as Weight) + .saturating_add((3_914_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(8 as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn new_era(v: u32, n: u32, ) -> Weight { + (0 as Weight) + .saturating_add((948_467_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((117_579_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(10 as Weight)) + .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(v as Weight))) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes(8 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight))) + } + fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight { + (0 as Weight) + .saturating_add((1_728_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((907_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((99_762_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((9_017_000 as Weight).saturating_mul(w as Weight)) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().reads((4 as Weight).saturating_mul(a as Weight))) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(w as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn bond() -> Weight { + (99_659_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + + } + fn bond_extra() -> Weight { + (79_045_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn unbond() -> Weight { + (71_716_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn withdraw_unbonded_update(s: u32, ) -> Weight { + (72_835_000 as Weight) + .saturating_add((63_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(5 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn withdraw_unbonded_kill(s: u32, ) -> Weight { + (118_239_000 as Weight) + .saturating_add((3_910_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(7 as Weight)) + .saturating_add(RocksDbWeight::get().writes(8 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn validate() -> Weight { + (25_691_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn nominate(n: u32, ) -> Weight { + (35_374_000 as Weight) + .saturating_add((203_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn chill() -> Weight { + (25_227_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn set_payee() -> Weight { + (17_601_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_controller() -> Weight { + (37_514_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn set_validator_count() -> Weight { + (3_338_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn force_no_eras() -> Weight { + (3_869_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn force_new_era() -> Weight { + (3_795_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn force_new_era_always() -> Weight { + (3_829_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_invulnerables(v: u32, ) -> Weight { + (4_087_000 as Weight) + .saturating_add((9_000 as Weight).saturating_mul(v as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn force_unstake(s: u32, ) -> Weight { + (81_063_000 as Weight) + .saturating_add((3_872_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(8 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn cancel_deferred_slash(s: u32, ) -> Weight { + (5_840_640_000 as Weight) + .saturating_add((34_806_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn payout_stakers_dead_controller(n: u32, ) -> Weight { + (153_024_000 as Weight) + .saturating_add((59_909_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(11 as Weight)) + .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + } + fn payout_stakers_alive_staked(n: u32, ) -> Weight { + (196_058_000 as Weight) + .saturating_add((78_955_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(12 as Weight)) + .saturating_add(RocksDbWeight::get().reads((5 as Weight).saturating_mul(n as Weight))) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(n as Weight))) + } + fn rebond(l: u32, ) -> Weight { + (49_966_000 as Weight) + .saturating_add((92_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn set_history_depth(e: u32, ) -> Weight { + (0 as Weight) + .saturating_add((38_529_000 as Weight).saturating_mul(e as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes((7 as Weight).saturating_mul(e as Weight))) + } + fn reap_stash(s: u32, ) -> Weight { + (101_457_000 as Weight) + .saturating_add((3_914_000 as Weight).saturating_mul(s as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(8 as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(s as Weight))) + } + fn new_era(v: u32, n: u32, ) -> Weight { + (0 as Weight) + .saturating_add((948_467_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((117_579_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(RocksDbWeight::get().reads(10 as Weight)) + .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(v as Weight))) + .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) + .saturating_add(RocksDbWeight::get().writes(8 as Weight)) + .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(v as Weight))) + } + fn submit_solution_better(v: u32, n: u32, a: u32, w: u32, ) -> Weight { + (0 as Weight) + .saturating_add((1_728_000 as Weight).saturating_mul(v as Weight)) + .saturating_add((907_000 as Weight).saturating_mul(n as Weight)) + .saturating_add((99_762_000 as Weight).saturating_mul(a as Weight)) + .saturating_add((9_017_000 as Weight).saturating_mul(w as Weight)) + .saturating_add(RocksDbWeight::get().reads(6 as Weight)) + .saturating_add(RocksDbWeight::get().reads((4 as Weight).saturating_mul(a as Weight))) + .saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(w as Weight))) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + +} diff --git a/substrate/frame/system/src/default_weights.rs b/substrate/frame/system/src/default_weights.rs deleted file mode 100644 index 8b0c17a285..0000000000 --- a/substrate/frame/system/src/default_weights.rs +++ /dev/null @@ -1,55 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5 - -#![allow(unused_parens)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn remark(_b: u32) -> Weight { - (1305000 as Weight) - } - fn set_heap_pages() -> Weight { - (2023000 as Weight) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn set_changes_trie_config() -> Weight { - (10026000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn set_storage(i: u32, ) -> Weight { - (0 as Weight) - .saturating_add((656000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) - } - fn kill_storage(i: u32, ) -> Weight { - (4327000 as Weight) - .saturating_add((478000 as Weight).saturating_mul(i as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) - } - fn kill_prefix(p: u32, ) -> Weight { - (8349000 as Weight) - .saturating_add((838000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) - } - fn suicide() -> Weight { - (29247000 as Weight) - } -} diff --git a/substrate/frame/system/src/extensions/check_weight.rs b/substrate/frame/system/src/extensions/check_weight.rs index 30052468fe..39439a3e2d 100644 --- a/substrate/frame/system/src/extensions/check_weight.rs +++ b/substrate/frame/system/src/extensions/check_weight.rs @@ -90,7 +90,7 @@ impl CheckWeight where /// Upon successes, it returns the new block weight as a `Result`. fn check_block_weight( info: &DispatchInfoOf, - ) -> Result { + ) -> Result { let maximum_weight = T::MaximumBlockWeight::get(); let mut all_weight = Module::::block_weight(); match info.class { diff --git a/substrate/frame/system/src/lib.rs b/substrate/frame/system/src/lib.rs index e9b7a6d9f7..595b001ea6 100644 --- a/substrate/frame/system/src/lib.rs +++ b/substrate/frame/system/src/lib.rs @@ -136,10 +136,10 @@ pub mod offchain; pub(crate) mod mock; mod extensions; -mod weights; +mod weight; +pub mod weights; #[cfg(test)] mod tests; -mod default_weights; pub use extensions::{ check_mortality::CheckMortality, check_genesis::CheckGenesis, check_nonce::CheckNonce, @@ -148,6 +148,7 @@ pub use extensions::{ }; // Backward compatible re-export. pub use extensions::check_mortality::CheckMortality as CheckEra; +pub use weights::WeightInfo; /// Compute the trie root of a list of extrinsics. pub fn extrinsics_root(extrinsics: &[E]) -> H::Output { @@ -159,16 +160,6 @@ pub fn extrinsics_data_root(xts: Vec>) -> H::Output { H::ordered_trie_root(xts) } -pub trait WeightInfo { - fn remark(b: u32) -> Weight; - fn set_heap_pages() -> Weight; - fn set_changes_trie_config() -> Weight; - fn set_storage(i: u32, ) -> Weight; - fn kill_storage(i: u32, ) -> Weight; - fn kill_prefix(p: u32, ) -> Weight; - fn suicide() -> Weight; -} - pub trait Trait: 'static + Eq + Clone { /// The basic call filter to use in Origin. All origins are built with this filter as base, /// except Root. @@ -408,7 +399,7 @@ decl_storage! { ExtrinsicCount: Option; /// The current weight for the block. - BlockWeight get(fn block_weight): weights::ExtrinsicsWeight; + BlockWeight get(fn block_weight): weight::ExtrinsicsWeight; /// Total length (in bytes) for all extrinsics put together, for the current block. AllExtrinsicsLen: Option; diff --git a/substrate/frame/system/src/weight.rs b/substrate/frame/system/src/weight.rs new file mode 100644 index 0000000000..93295093c4 --- /dev/null +++ b/substrate/frame/system/src/weight.rs @@ -0,0 +1,76 @@ +// This file is part of Substrate. + +// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use codec::{Encode, Decode}; +use frame_support::weights::{Weight, DispatchClass}; +use sp_runtime::RuntimeDebug; + +/// An object to track the currently used extrinsic weight in a block. +#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode)] +pub struct ExtrinsicsWeight { + normal: Weight, + operational: Weight, +} + +impl ExtrinsicsWeight { + /// Returns the total weight consumed by all extrinsics in the block. + pub fn total(&self) -> Weight { + self.normal.saturating_add(self.operational) + } + + /// Add some weight of a specific dispatch class, saturating at the numeric bounds of `Weight`. + pub fn add(&mut self, weight: Weight, class: DispatchClass) { + let value = self.get_mut(class); + *value = value.saturating_add(weight); + } + + /// Try to add some weight of a specific dispatch class, returning Err(()) if overflow would + /// occur. + pub fn checked_add(&mut self, weight: Weight, class: DispatchClass) -> Result<(), ()> { + let value = self.get_mut(class); + *value = value.checked_add(weight).ok_or(())?; + Ok(()) + } + + /// Subtract some weight of a specific dispatch class, saturating at the numeric bounds of + /// `Weight`. + pub fn sub(&mut self, weight: Weight, class: DispatchClass) { + let value = self.get_mut(class); + *value = value.saturating_sub(weight); + } + + /// Get the current weight of a specific dispatch class. + pub fn get(&self, class: DispatchClass) -> Weight { + match class { + DispatchClass::Operational => self.operational, + DispatchClass::Normal | DispatchClass::Mandatory => self.normal, + } + } + + /// Get a mutable reference to the current weight of a specific dispatch class. + fn get_mut(&mut self, class: DispatchClass) -> &mut Weight { + match class { + DispatchClass::Operational => &mut self.operational, + DispatchClass::Normal | DispatchClass::Mandatory => &mut self.normal, + } + } + + /// Set the weight of a specific dispatch class. + pub fn put(&mut self, new: Weight, class: DispatchClass) { + *self.get_mut(class) = new; + } +} diff --git a/substrate/frame/system/src/weights.rs b/substrate/frame/system/src/weights.rs index 93295093c4..fb07e12507 100644 --- a/substrate/frame/system/src/weights.rs +++ b/substrate/frame/system/src/weights.rs @@ -1,13 +1,13 @@ // This file is part of Substrate. -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. +// Copyright (C) 2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -15,62 +15,119 @@ // See the License for the specific language governing permissions and // limitations under the License. -use codec::{Encode, Decode}; -use frame_support::weights::{Weight, DispatchClass}; -use sp_runtime::RuntimeDebug; +//! Weights for frame_system +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=frame_system +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/system/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for frame_system. +pub trait WeightInfo { + fn remark(_b: u32, ) -> Weight; + fn set_heap_pages() -> Weight; + fn set_changes_trie_config() -> Weight; + fn set_storage(_i: u32, ) -> Weight; + fn kill_storage(_i: u32, ) -> Weight; + fn kill_prefix(_p: u32, ) -> Weight; + fn suicide() -> Weight; -/// An object to track the currently used extrinsic weight in a block. -#[derive(Clone, Eq, PartialEq, Default, RuntimeDebug, Encode, Decode)] -pub struct ExtrinsicsWeight { - normal: Weight, - operational: Weight, } -impl ExtrinsicsWeight { - /// Returns the total weight consumed by all extrinsics in the block. - pub fn total(&self) -> Weight { - self.normal.saturating_add(self.operational) +/// Weights for frame_system using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn remark(_b: u32, ) -> Weight { + (1_906_000 as Weight) + + } + fn set_heap_pages() -> Weight { + (2_792_000 as Weight) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn set_changes_trie_config() -> Weight { + (12_029_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn set_storage(i: u32, ) -> Weight { + (0 as Weight) + .saturating_add((842_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + fn kill_storage(i: u32, ) -> Weight { + (1_120_000 as Weight) + .saturating_add((599_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + fn kill_prefix(p: u32, ) -> Weight { + (9_470_000 as Weight) + .saturating_add((861_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } + fn suicide() -> Weight { + (38_469_000 as Weight) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn remark(_b: u32, ) -> Weight { + (1_906_000 as Weight) + + } + fn set_heap_pages() -> Weight { + (2_792_000 as Weight) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn set_changes_trie_config() -> Weight { + (12_029_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn set_storage(i: u32, ) -> Weight { + (0 as Weight) + .saturating_add((842_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + fn kill_storage(i: u32, ) -> Weight { + (1_120_000 as Weight) + .saturating_add((599_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + fn kill_prefix(p: u32, ) -> Weight { + (9_470_000 as Weight) + .saturating_add((861_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } + fn suicide() -> Weight { + (38_469_000 as Weight) + } - /// Add some weight of a specific dispatch class, saturating at the numeric bounds of `Weight`. - pub fn add(&mut self, weight: Weight, class: DispatchClass) { - let value = self.get_mut(class); - *value = value.saturating_add(weight); - } - - /// Try to add some weight of a specific dispatch class, returning Err(()) if overflow would - /// occur. - pub fn checked_add(&mut self, weight: Weight, class: DispatchClass) -> Result<(), ()> { - let value = self.get_mut(class); - *value = value.checked_add(weight).ok_or(())?; - Ok(()) - } - - /// Subtract some weight of a specific dispatch class, saturating at the numeric bounds of - /// `Weight`. - pub fn sub(&mut self, weight: Weight, class: DispatchClass) { - let value = self.get_mut(class); - *value = value.saturating_sub(weight); - } - - /// Get the current weight of a specific dispatch class. - pub fn get(&self, class: DispatchClass) -> Weight { - match class { - DispatchClass::Operational => self.operational, - DispatchClass::Normal | DispatchClass::Mandatory => self.normal, - } - } - - /// Get a mutable reference to the current weight of a specific dispatch class. - fn get_mut(&mut self, class: DispatchClass) -> &mut Weight { - match class { - DispatchClass::Operational => &mut self.operational, - DispatchClass::Normal | DispatchClass::Mandatory => &mut self.normal, - } - } - - /// Set the weight of a specific dispatch class. - pub fn put(&mut self, new: Weight, class: DispatchClass) { - *self.get_mut(class) = new; - } } diff --git a/substrate/frame/timestamp/src/default_weights.rs b/substrate/frame/timestamp/src/default_weights.rs deleted file mode 100644 index d8db018228..0000000000 --- a/substrate/frame/timestamp/src/default_weights.rs +++ /dev/null @@ -1,33 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc5 - -#![allow(unused_parens)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn set() -> Weight { - (9133000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn on_finalize() -> Weight { - (5915000 as Weight) - } -} diff --git a/substrate/frame/timestamp/src/lib.rs b/substrate/frame/timestamp/src/lib.rs index e03037f2e8..d546a34017 100644 --- a/substrate/frame/timestamp/src/lib.rs +++ b/substrate/frame/timestamp/src/lib.rs @@ -93,7 +93,7 @@ #![cfg_attr(not(feature = "std"), no_std)] mod benchmarking; -mod default_weights; +pub mod weights; use sp_std::{result, cmp}; use sp_inherents::{ProvideInherent, InherentData, InherentIdentifier}; @@ -115,11 +115,7 @@ use sp_timestamp::{ InherentError, INHERENT_IDENTIFIER, InherentType, OnTimestampSet, }; - -pub trait WeightInfo { - fn set() -> Weight; - fn on_finalize() -> Weight; -} +pub use weights::WeightInfo; /// The module configuration trait pub trait Trait: frame_system::Trait { diff --git a/substrate/frame/timestamp/src/weights.rs b/substrate/frame/timestamp/src/weights.rs new file mode 100644 index 0000000000..67ce28ba91 --- /dev/null +++ b/substrate/frame/timestamp/src/weights.rs @@ -0,0 +1,80 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_timestamp +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_timestamp +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/timestamp/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_timestamp. +pub trait WeightInfo { + fn set() -> Weight; + fn on_finalize() -> Weight; + +} + +/// Weights for pallet_timestamp using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn set() -> Weight { + (11_650_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn on_finalize() -> Weight { + (6_681_000 as Weight) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn set() -> Weight { + (11_650_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn on_finalize() -> Weight { + (6_681_000 as Weight) + + } + +} diff --git a/substrate/frame/treasury/src/default_weights.rs b/substrate/frame/treasury/src/default_weights.rs deleted file mode 100644 index bf4f5fb789..0000000000 --- a/substrate/frame/treasury/src/default_weights.rs +++ /dev/null @@ -1,138 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn propose_spend() -> Weight { - (79604000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn reject_proposal() -> Weight { - (61001000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn approve_proposal() -> Weight { - (17835000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn report_awesome(r: u32, ) -> Weight { - (101602000 as Weight) - .saturating_add((2000 as Weight).saturating_mul(r as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn retract_tip() -> Weight { - (82970000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn tip_new(r: u32, t: u32, ) -> Weight { - (63995000 as Weight) - .saturating_add((2000 as Weight).saturating_mul(r as Weight)) - .saturating_add((153000 as Weight).saturating_mul(t as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn tip(t: u32, ) -> Weight { - (46765000 as Weight) - .saturating_add((711000 as Weight).saturating_mul(t as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn close_tip(t: u32, ) -> Weight { - (160874000 as Weight) - .saturating_add((379000 as Weight).saturating_mul(t as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn propose_bounty(d: u32, ) -> Weight { - (86198000 as Weight) - .saturating_add((1000 as Weight).saturating_mul(d as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - } - fn approve_bounty() -> Weight { - (23063000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn propose_curator() -> Weight { - (18890000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn unassign_curator() -> Weight { - (66768000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn accept_curator() -> Weight { - (69131000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn award_bounty() -> Weight { - (48184000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn claim_bounty() -> Weight { - (243104000 as Weight) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(5 as Weight)) - } - fn close_bounty_proposed() -> Weight { - (65917000 as Weight) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn close_bounty_active() -> Weight { - (157232000 as Weight) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - } - fn extend_bounty_expiry() -> Weight { - (46216000 as Weight) - .saturating_add(DbWeight::get().reads(1 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn on_initialize_proposals(p: u32, ) -> Weight { - (119765000 as Weight) - .saturating_add((108368000 as Weight).saturating_mul(p as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) - } - fn on_initialize_bounties(b: u32, ) -> Weight { - (112536000 as Weight) - .saturating_add((107132000 as Weight).saturating_mul(b as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().reads((3 as Weight).saturating_mul(b as Weight))) - .saturating_add(DbWeight::get().writes(2 as Weight)) - .saturating_add(DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight))) - } -} diff --git a/substrate/frame/treasury/src/lib.rs b/substrate/frame/treasury/src/lib.rs index a61f64e907..43f9515f0a 100644 --- a/substrate/frame/treasury/src/lib.rs +++ b/substrate/frame/treasury/src/lib.rs @@ -134,6 +134,10 @@ #![cfg_attr(not(feature = "std"), no_std)] +mod tests; +mod benchmarking; +pub mod weights; + #[cfg(feature = "std")] use serde::{Serialize, Deserialize}; use sp_std::prelude::*; @@ -150,10 +154,7 @@ use frame_support::weights::{Weight, DispatchClass}; use frame_support::traits::{Contains, ContainsLengthBound, EnsureOrigin}; use codec::{Encode, Decode}; use frame_system::{self as system, ensure_signed}; - -mod tests; -mod benchmarking; -mod default_weights; +pub use weights::WeightInfo; type BalanceOf = <>::Currency as Currency<::AccountId>>::Balance; @@ -162,29 +163,6 @@ type PositiveImbalanceOf = type NegativeImbalanceOf = <>::Currency as Currency<::AccountId>>::NegativeImbalance; -pub trait WeightInfo { - fn propose_spend() -> Weight; - fn reject_proposal() -> Weight; - fn approve_proposal() -> Weight; - fn report_awesome(r: u32, ) -> Weight; - fn retract_tip() -> Weight; - fn tip_new(r: u32, t: u32, ) -> Weight; - fn tip(t: u32, ) -> Weight; - fn close_tip(t: u32, ) -> Weight; - fn propose_bounty(r: u32, ) -> Weight; - fn approve_bounty() -> Weight; - fn propose_curator() -> Weight; - fn unassign_curator() -> Weight; - fn accept_curator() -> Weight; - fn award_bounty() -> Weight; - fn claim_bounty() -> Weight; - fn close_bounty_proposed() -> Weight; - fn close_bounty_active() -> Weight; - fn extend_bounty_expiry() -> Weight; - fn on_initialize_proposals(p: u32, ) -> Weight; - fn on_initialize_bounties(b: u32, ) -> Weight; -} - pub trait Trait: frame_system::Trait { /// The treasury's module id, used for deriving its sovereign account ID. type ModuleId: Get; diff --git a/substrate/frame/treasury/src/weights.rs b/substrate/frame/treasury/src/weights.rs new file mode 100644 index 0000000000..646b9869f4 --- /dev/null +++ b/substrate/frame/treasury/src/weights.rs @@ -0,0 +1,338 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_treasury +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_treasury +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/treasury/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_treasury. +pub trait WeightInfo { + fn propose_spend() -> Weight; + fn reject_proposal() -> Weight; + fn approve_proposal() -> Weight; + fn report_awesome(r: u32, ) -> Weight; + fn retract_tip() -> Weight; + fn tip_new(r: u32, t: u32, ) -> Weight; + fn tip(t: u32, ) -> Weight; + fn close_tip(t: u32, ) -> Weight; + fn propose_bounty(d: u32, ) -> Weight; + fn approve_bounty() -> Weight; + fn propose_curator() -> Weight; + fn unassign_curator() -> Weight; + fn accept_curator() -> Weight; + fn award_bounty() -> Weight; + fn claim_bounty() -> Weight; + fn close_bounty_proposed() -> Weight; + fn close_bounty_active() -> Weight; + fn extend_bounty_expiry() -> Weight; + fn on_initialize_proposals(p: u32, ) -> Weight; + fn on_initialize_bounties(b: u32, ) -> Weight; + +} + +/// Weights for pallet_treasury using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn propose_spend() -> Weight { + (56_844_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn reject_proposal() -> Weight { + (46_098_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn approve_proposal() -> Weight { + (13_622_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn report_awesome(r: u32, ) -> Weight { + (71_823_000 as Weight) + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn retract_tip() -> Weight { + (60_150_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn tip_new(r: u32, t: u32, ) -> Weight { + (46_522_000 as Weight) + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((145_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn tip(t: u32, ) -> Weight { + (33_790_000 as Weight) + .saturating_add((713_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn close_tip(t: u32, ) -> Weight { + (113_040_000 as Weight) + .saturating_add((375_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn propose_bounty(d: u32, ) -> Weight { + (60_887_000 as Weight) + .saturating_add((1_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + + } + fn approve_bounty() -> Weight { + (17_337_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn propose_curator() -> Weight { + (14_068_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn unassign_curator() -> Weight { + (49_717_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn accept_curator() -> Weight { + (50_596_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn award_bounty() -> Weight { + (36_030_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn claim_bounty() -> Weight { + (167_088_000 as Weight) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + + } + fn close_bounty_proposed() -> Weight { + (48_977_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn close_bounty_active() -> Weight { + (110_959_000 as Weight) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + + } + fn extend_bounty_expiry() -> Weight { + (34_987_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn on_initialize_proposals(p: u32, ) -> Weight { + (76_596_000 as Weight) + .saturating_add((73_988_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) + } + fn on_initialize_bounties(b: u32, ) -> Weight { + (75_165_000 as Weight) + .saturating_add((73_634_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(b as Weight))) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight))) + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn propose_spend() -> Weight { + (56_844_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn reject_proposal() -> Weight { + (46_098_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn approve_proposal() -> Weight { + (13_622_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn report_awesome(r: u32, ) -> Weight { + (71_823_000 as Weight) + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn retract_tip() -> Weight { + (60_150_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn tip_new(r: u32, t: u32, ) -> Weight { + (46_522_000 as Weight) + .saturating_add((2_000 as Weight).saturating_mul(r as Weight)) + .saturating_add((145_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn tip(t: u32, ) -> Weight { + (33_790_000 as Weight) + .saturating_add((713_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn close_tip(t: u32, ) -> Weight { + (113_040_000 as Weight) + .saturating_add((375_000 as Weight).saturating_mul(t as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn propose_bounty(d: u32, ) -> Weight { + (60_887_000 as Weight) + .saturating_add((1_000 as Weight).saturating_mul(d as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + + } + fn approve_bounty() -> Weight { + (17_337_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn propose_curator() -> Weight { + (14_068_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn unassign_curator() -> Weight { + (49_717_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn accept_curator() -> Weight { + (50_596_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn award_bounty() -> Weight { + (36_030_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn claim_bounty() -> Weight { + (167_088_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(5 as Weight)) + + } + fn close_bounty_proposed() -> Weight { + (48_977_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn close_bounty_active() -> Weight { + (110_959_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + + } + fn extend_bounty_expiry() -> Weight { + (34_987_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn on_initialize_proposals(p: u32, ) -> Weight { + (76_596_000 as Weight) + .saturating_add((73_988_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(p as Weight))) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(p as Weight))) + } + fn on_initialize_bounties(b: u32, ) -> Weight { + (75_165_000 as Weight) + .saturating_add((73_634_000 as Weight).saturating_mul(b as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(b as Weight))) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight))) + } + +} diff --git a/substrate/frame/utility/src/default_weights.rs b/substrate/frame/utility/src/default_weights.rs deleted file mode 100644 index 8dc9b6fb8c..0000000000 --- a/substrate/frame/utility/src/default_weights.rs +++ /dev/null @@ -1,39 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! Weights for pallet_utility -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 -//! DATE: 2020-10-02, STEPS: [50], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn batch(c: u32, ) -> Weight { - (20_803_000 as Weight) - .saturating_add((1_984_000 as Weight).saturating_mul(c as Weight)) - } - fn as_derivative() -> Weight { - (5_853_000 as Weight) - } - fn batch_all(c: u32, ) -> Weight { - (21_104_000 as Weight) - .saturating_add((1_509_000 as Weight).saturating_mul(c as Weight)) - } -} diff --git a/substrate/frame/utility/src/lib.rs b/substrate/frame/utility/src/lib.rs index 3aa310c8ac..e7ff09c8f0 100644 --- a/substrate/frame/utility/src/lib.rs +++ b/substrate/frame/utility/src/lib.rs @@ -55,6 +55,10 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] +mod tests; +mod benchmarking; +pub mod weights; + use sp_std::prelude::*; use codec::{Encode, Decode}; use sp_core::TypeId; @@ -67,16 +71,7 @@ use frame_support::{ }; use frame_system::{ensure_signed, ensure_root}; use sp_runtime::{DispatchError, traits::Dispatchable}; - -mod tests; -mod benchmarking; -mod default_weights; - -pub trait WeightInfo { - fn batch(c: u32, ) -> Weight; - fn as_derivative() -> Weight; - fn batch_all(c: u32, ) -> Weight; -} +pub use weights::WeightInfo; /// Configuration trait. pub trait Trait: frame_system::Trait { diff --git a/substrate/frame/utility/src/weights.rs b/substrate/frame/utility/src/weights.rs new file mode 100644 index 0000000000..73e4e3b1d9 --- /dev/null +++ b/substrate/frame/utility/src/weights.rs @@ -0,0 +1,89 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_utility +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_utility +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/utility/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_utility. +pub trait WeightInfo { + fn batch(c: u32, ) -> Weight; + fn as_derivative() -> Weight; + fn batch_all(c: u32, ) -> Weight; + +} + +/// Weights for pallet_utility using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn batch(c: u32, ) -> Weight { + (20_071_000 as Weight) + .saturating_add((2_739_000 as Weight).saturating_mul(c as Weight)) + + } + fn as_derivative() -> Weight { + (5_721_000 as Weight) + + } + fn batch_all(c: u32, ) -> Weight { + (21_440_000 as Weight) + .saturating_add((2_738_000 as Weight).saturating_mul(c as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn batch(c: u32, ) -> Weight { + (20_071_000 as Weight) + .saturating_add((2_739_000 as Weight).saturating_mul(c as Weight)) + + } + fn as_derivative() -> Weight { + (5_721_000 as Weight) + + } + fn batch_all(c: u32, ) -> Weight { + (21_440_000 as Weight) + .saturating_add((2_738_000 as Weight).saturating_mul(c as Weight)) + + } + +} diff --git a/substrate/frame/vesting/src/default_weights.rs b/substrate/frame/vesting/src/default_weights.rs deleted file mode 100644 index dac9224d69..0000000000 --- a/substrate/frame/vesting/src/default_weights.rs +++ /dev/null @@ -1,62 +0,0 @@ -// This file is part of Substrate. - -// Copyright (C) 2020 Parity Technologies (UK) Ltd. -// SPDX-License-Identifier: Apache-2.0 - -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0-rc6 - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::weights::{Weight, constants::RocksDbWeight as DbWeight}; - -impl crate::WeightInfo for () { - fn vest_locked(l: u32, ) -> Weight { - (82109000 as Weight) - .saturating_add((332000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(1 as Weight)) - } - fn vest_unlocked(l: u32, ) -> Weight { - (88419000 as Weight) - .saturating_add((3000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(2 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn vest_other_locked(l: u32, ) -> Weight { - (81277000 as Weight) - .saturating_add((321000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(2 as Weight)) - } - fn vest_other_unlocked(l: u32, ) -> Weight { - (87584000 as Weight) - .saturating_add((19000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn vested_transfer(l: u32, ) -> Weight { - (185916000 as Weight) - .saturating_add((625000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(3 as Weight)) - .saturating_add(DbWeight::get().writes(3 as Weight)) - } - fn force_vested_transfer(l: u32, ) -> Weight { - (185916000 as Weight) - .saturating_add((625000 as Weight).saturating_mul(l as Weight)) - .saturating_add(DbWeight::get().reads(4 as Weight)) - .saturating_add(DbWeight::get().writes(4 as Weight)) - } -} diff --git a/substrate/frame/vesting/src/lib.rs b/substrate/frame/vesting/src/lib.rs index 1583b06d69..959df1fb1b 100644 --- a/substrate/frame/vesting/src/lib.rs +++ b/substrate/frame/vesting/src/lib.rs @@ -47,34 +47,26 @@ #![cfg_attr(not(feature = "std"), no_std)] +mod benchmarking; +pub mod weights; + use sp_std::prelude::*; use sp_std::fmt::Debug; use codec::{Encode, Decode}; use sp_runtime::{DispatchResult, RuntimeDebug, traits::{ StaticLookup, Zero, AtLeast32BitUnsigned, MaybeSerializeDeserialize, Convert }}; -use frame_support::{decl_module, decl_event, decl_storage, decl_error, ensure, weights::Weight}; +use frame_support::{decl_module, decl_event, decl_storage, decl_error, ensure}; use frame_support::traits::{ Currency, LockableCurrency, VestingSchedule, WithdrawReason, LockIdentifier, ExistenceRequirement, Get, }; use frame_system::{ensure_signed, ensure_root}; - -mod benchmarking; -mod default_weights; +pub use weights::WeightInfo; type BalanceOf = <::Currency as Currency<::AccountId>>::Balance; type MaxLocksOf = <::Currency as LockableCurrency<::AccountId>>::MaxLocks; -pub trait WeightInfo { - fn vest_locked(l: u32, ) -> Weight; - fn vest_unlocked(l: u32, ) -> Weight; - fn vest_other_locked(l: u32, ) -> Weight; - fn vest_other_unlocked(l: u32, ) -> Weight; - fn vested_transfer(l: u32, ) -> Weight; - fn force_vested_transfer(l: u32, ) -> Weight; -} - pub trait Trait: frame_system::Trait { /// The overarching event type. type Event: From> + Into<::Event>; diff --git a/substrate/frame/vesting/src/weights.rs b/substrate/frame/vesting/src/weights.rs new file mode 100644 index 0000000000..23a46ec763 --- /dev/null +++ b/substrate/frame/vesting/src/weights.rs @@ -0,0 +1,148 @@ +// This file is part of Substrate. + +// Copyright (C) 2020 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Weights for pallet_vesting +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 2.0.0 +//! DATE: 2020-10-27, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/substrate +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=pallet_vesting +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./frame/vesting/src/weights.rs +// --template=./.maintain/frame-weight-template.hbs + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +/// Weight functions needed for pallet_vesting. +pub trait WeightInfo { + fn vest_locked(l: u32, ) -> Weight; + fn vest_unlocked(l: u32, ) -> Weight; + fn vest_other_locked(l: u32, ) -> Weight; + fn vest_other_unlocked(l: u32, ) -> Weight; + fn vested_transfer(l: u32, ) -> Weight; + fn force_vested_transfer(l: u32, ) -> Weight; + +} + +/// Weights for pallet_vesting using the Substrate node and recommended hardware. +pub struct SubstrateWeight(PhantomData); +impl WeightInfo for SubstrateWeight { + fn vest_locked(l: u32, ) -> Weight { + (57_472_000 as Weight) + .saturating_add((155_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + + } + fn vest_unlocked(l: u32, ) -> Weight { + (61_681_000 as Weight) + .saturating_add((138_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn vest_other_locked(l: u32, ) -> Weight { + (56_910_000 as Weight) + .saturating_add((160_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + + } + fn vest_other_unlocked(l: u32, ) -> Weight { + (61_319_000 as Weight) + .saturating_add((144_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn vested_transfer(l: u32, ) -> Weight { + (124_996_000 as Weight) + .saturating_add((209_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(3 as Weight)) + .saturating_add(T::DbWeight::get().writes(3 as Weight)) + + } + fn force_vested_transfer(l: u32, ) -> Weight { + (123_911_000 as Weight) + .saturating_add((213_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(T::DbWeight::get().reads(4 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + + } + +} + +// For backwards compatibility and tests +impl WeightInfo for () { + fn vest_locked(l: u32, ) -> Weight { + (57_472_000 as Weight) + .saturating_add((155_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(1 as Weight)) + + } + fn vest_unlocked(l: u32, ) -> Weight { + (61_681_000 as Weight) + .saturating_add((138_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(RocksDbWeight::get().reads(2 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn vest_other_locked(l: u32, ) -> Weight { + (56_910_000 as Weight) + .saturating_add((160_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + + } + fn vest_other_unlocked(l: u32, ) -> Weight { + (61_319_000 as Weight) + .saturating_add((144_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn vested_transfer(l: u32, ) -> Weight { + (124_996_000 as Weight) + .saturating_add((209_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(RocksDbWeight::get().reads(3 as Weight)) + .saturating_add(RocksDbWeight::get().writes(3 as Weight)) + + } + fn force_vested_transfer(l: u32, ) -> Weight { + (123_911_000 as Weight) + .saturating_add((213_000 as Weight).saturating_mul(l as Weight)) + .saturating_add(RocksDbWeight::get().reads(4 as Weight)) + .saturating_add(RocksDbWeight::get().writes(4 as Weight)) + + } + +} diff --git a/substrate/utils/frame/benchmarking-cli/src/template.hbs b/substrate/utils/frame/benchmarking-cli/src/template.hbs index 3a7e57c954..7280b7b9cd 100644 --- a/substrate/utils/frame/benchmarking-cli/src/template.hbs +++ b/substrate/utils/frame/benchmarking-cli/src/template.hbs @@ -1,10 +1,14 @@ {{header}} //! Weights for {{pallet}} -//! {{join args}} //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION {{version}} //! DATE: {{date}}, STEPS: {{cmd.steps}}, REPEAT: {{cmd.repeat}}, LOW RANGE: {{cmd.lowest_range_values}}, HIGH RANGE: {{cmd.highest_range_values}} //! EXECUTION: {{cmd.execution}}, WASM-EXECUTION: {{cmd.wasm_execution}}, CHAIN: {{cmd.chain}}, DB CACHE: {{cmd.db_cache}} +// Executed Command: +{{#each args as |arg|~}} +// {{arg}} +{{/each}} + #![allow(unused_parens)] #![allow(unused_imports)]