Weight v1.5: Opaque Struct (#12138)

* initial idea

* update frame_support

* update a bunch more

* add ord

* adjust RuntimeDbWeight

* frame_system builds

* re-export

* frame_support tests pass

* frame_executive compile

* frame_executive builds

* frame_system tests passing

* pallet-utility tests pass

* fix a bunch of pallets

* more

* phragmen

* state-trie-migration

* scheduler and referenda

* pallet-election-provider-multi-phase

* aura

* staking

* more

* babe

* balances

* bunch more

* sudo

* transaction-payment

* asset-tx-payment

* last pallets

* fix alliance merge

* fix node template runtime

* fix pallet-contracts cc @athei

* fix node runtime

* fix compile on runtime-benchmarks feature

* comment

* fix frame-support-test

* fix more tests

* weight regex

* frame system works

* fix a bunch

* more

* more

* more

* more

* more

* more fixes

* update templates

* fix contracts benchmarks

* Update lib.rs

* Update lib.rs

* fix ui

* make scalar saturating mul const

* more const functions

* scalar div

* refactor using constant functions

* move impl

* fix overhead template

* use compactas

* Update lib.rs
This commit is contained in:
Shawn Tabrizi
2022-08-31 12:26:13 +01:00
committed by GitHub
parent 299f4ba541
commit 30951822ba
187 changed files with 5932 additions and 4930 deletions
+13 -13
View File
@@ -31,7 +31,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for {{pallet}}.
@@ -64,22 +64,22 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
({{underscore benchmark.base_weight}} as Weight)
Weight::from_ref_time({{underscore benchmark.base_weight}} as RefTimeWeight)
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
.saturating_add(Weight::from_ref_time({{underscore cw.slope}} as RefTimeWeight).scalar_saturating_mul({{cw.name}} as RefTimeWeight))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as Weight))
.saturating_add(T::DbWeight::get().reads({{benchmark.base_reads}} as RefTimeWeight))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
.saturating_add(T::DbWeight::get().reads(({{cr.slope}} as RefTimeWeight).saturating_mul({{cr.name}} as RefTimeWeight)))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as Weight))
.saturating_add(T::DbWeight::get().writes({{benchmark.base_writes}} as RefTimeWeight))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
.saturating_add(T::DbWeight::get().writes(({{cw.slope}} as RefTimeWeight).saturating_mul({{cw.name}} as RefTimeWeight)))
{{/each}}
}
{{/each}}
@@ -99,22 +99,22 @@ impl WeightInfo for () {
{{~#each benchmark.components as |c| ~}}
{{~#if (not c.is_used)}}_{{/if}}{{c.name}}: u32, {{/each~}}
) -> Weight {
({{underscore benchmark.base_weight}} as Weight)
Weight::from_ref_time({{underscore benchmark.base_weight}} as RefTimeWeight)
{{#each benchmark.component_weight as |cw|}}
// Standard Error: {{underscore cw.error}}
.saturating_add(({{underscore cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight))
.saturating_add(Weight::from_ref_time({{underscore cw.slope}} as RefTimeWeight).scalar_saturating_mul({{cw.name}} as RefTimeWeight))
{{/each}}
{{#if (ne benchmark.base_reads "0")}}
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as Weight))
.saturating_add(RocksDbWeight::get().reads({{benchmark.base_reads}} as RefTimeWeight))
{{/if}}
{{#each benchmark.component_reads as |cr|}}
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as Weight).saturating_mul({{cr.name}} as Weight)))
.saturating_add(RocksDbWeight::get().reads(({{cr.slope}} as RefTimeWeight).saturating_mul({{cr.name}} as RefTimeWeight)))
{{/each}}
{{#if (ne benchmark.base_writes "0")}}
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as Weight))
.saturating_add(RocksDbWeight::get().writes({{benchmark.base_writes}} as RefTimeWeight))
{{/if}}
{{#each benchmark.component_writes as |cw|}}
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as Weight).saturating_mul({{cw.name}} as Weight)))
.saturating_add(RocksDbWeight::get().writes(({{cw.slope}} as RefTimeWeight).saturating_mul({{cw.name}} as RefTimeWeight)))
{{/each}}
}
{{/each}}
@@ -64,7 +64,7 @@ pub mod pallet {
impl<T: Config> Pallet<T> {
/// An example dispatchable that takes a singles value as a parameter, writes the value to
/// storage and emits an event. This function must be dispatched by a signed extrinsic.
#[pallet::weight(10_000 + T::DbWeight::get().writes(1))]
#[pallet::weight(10_000 + T::DbWeight::get().writes(1).ref_time())]
pub fn do_something(origin: OriginFor<T>, something: u32) -> DispatchResult {
// Check that the extrinsic was signed and get the signer.
// This function will return an error if the extrinsic is not signed.
@@ -81,7 +81,7 @@ pub mod pallet {
}
/// An example dispatchable that may throw a custom error.
#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1))]
#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(1,1).ref_time())]
pub fn cause_error(origin: OriginFor<T>) -> DispatchResult {
let _who = ensure_signed(origin)?;
+3 -3
View File
@@ -18,7 +18,7 @@
use codec::{Decode, Encode, Joiner};
use frame_support::{
traits::Currency,
weights::{DispatchClass, DispatchInfo, GetDispatchInfo},
weights::{DispatchClass, DispatchInfo, GetDispatchInfo, Weight},
};
use frame_system::{self, AccountInfo, EventRecord, Phase};
use sp_core::{storage::well_known_keys, traits::Externalities, NeverNativeValue};
@@ -733,7 +733,7 @@ fn deploying_wasm_contract_should_work() {
function: Call::Contracts(
pallet_contracts::Call::instantiate_with_code::<Runtime> {
value: 0,
gas_limit: 500_000_000,
gas_limit: Weight::from_ref_time(500_000_000),
storage_deposit_limit: None,
code: transfer_code,
data: Vec::new(),
@@ -746,7 +746,7 @@ fn deploying_wasm_contract_should_work() {
function: Call::Contracts(pallet_contracts::Call::call::<Runtime> {
dest: sp_runtime::MultiAddress::Id(addr.clone()),
value: 10,
gas_limit: 500_000_000,
gas_limit: Weight::from_ref_time(500_000_000),
storage_deposit_limit: None,
data: vec![0x00, 0x01, 0x02, 0x03],
}),
+1 -1
View File
@@ -208,7 +208,7 @@ fn transaction_fee_is_correct() {
// we know that weight to fee multiplier is effect-less in block 1.
// current weight of transfer = 200_000_000
// Linear weight to fee is 1:1 right now (1 weight = 1 unit of balance)
assert_eq!(weight_fee, weight as Balance);
assert_eq!(weight_fee, weight.ref_time() as Balance);
balance_alice -= base_fee;
balance_alice -= weight_fee;
balance_alice -= tip;
+20 -19
View File
@@ -163,13 +163,13 @@ mod multiplier_tests {
let previous_float = previous_float.max(min_multiplier().into_inner() as f64 / accuracy);
// maximum tx weight
let m = max_normal() as f64;
let m = max_normal().ref_time() as f64;
// block weight always truncated to max weight
let block_weight = (block_weight as f64).min(m);
let block_weight = (block_weight.ref_time() as f64).min(m);
let v: f64 = AdjustmentVariable::get().to_float();
// Ideal saturation in terms of weight
let ss = target() as f64;
let ss = target().ref_time() as f64;
// Current saturation in terms of weight
let s = block_weight;
@@ -197,9 +197,9 @@ mod multiplier_tests {
fn truth_value_update_poc_works() {
let fm = Multiplier::saturating_from_rational(1, 2);
let test_set = vec![
(0, fm),
(100, fm),
(1000, fm),
(Weight::zero(), fm),
(Weight::from_ref_time(100), fm),
(Weight::from_ref_time(1000), fm),
(target(), fm),
(max_normal() / 2, fm),
(max_normal(), fm),
@@ -229,7 +229,7 @@ mod multiplier_tests {
#[test]
fn multiplier_cannot_go_below_limit() {
// will not go any further below even if block is empty.
run_with_system_weight(0, || {
run_with_system_weight(Weight::new(), || {
let next = runtime_multiplier_update(min_multiplier());
assert_eq!(next, min_multiplier());
})
@@ -247,7 +247,7 @@ mod multiplier_tests {
// 1 < 0.00001 * k * 0.1875
// 10^9 / 1875 < k
// k > 533_333 ~ 18,5 days.
run_with_system_weight(0, || {
run_with_system_weight(Weight::new(), || {
// start from 1, the default.
let mut fm = Multiplier::one();
let mut iterations: u64 = 0;
@@ -283,7 +283,8 @@ mod multiplier_tests {
// `cargo test congested_chain_simulation -- --nocapture` to get some insight.
// almost full. The entire quota of normal transactions is taken.
let block_weight = BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap() - 100;
let block_weight = BlockWeights::get().get(DispatchClass::Normal).max_total.unwrap() -
Weight::from_ref_time(100);
// Default substrate weight.
let tx_weight = frame_support::weights::constants::ExtrinsicBaseWeight::get();
@@ -407,27 +408,27 @@ mod multiplier_tests {
#[test]
fn weight_to_fee_should_not_overflow_on_large_weights() {
let kb = 1024 as Weight;
let kb = Weight::from_ref_time(1024);
let mb = kb * kb;
let max_fm = Multiplier::saturating_from_integer(i128::MAX);
// check that for all values it can compute, correctly.
vec![
0,
1,
10,
1000,
Weight::zero(),
Weight::one(),
Weight::from_ref_time(10),
Weight::from_ref_time(1000),
kb,
10 * kb,
100 * kb,
mb,
10 * mb,
2147483647,
4294967295,
Weight::from_ref_time(2147483647),
Weight::from_ref_time(4294967295),
BlockWeights::get().max_block / 2,
BlockWeights::get().max_block,
Weight::max_value() / 2,
Weight::max_value(),
Weight::MAX / 2,
Weight::MAX,
]
.into_iter()
.for_each(|i| {
@@ -440,7 +441,7 @@ mod multiplier_tests {
// Some values that are all above the target and will cause an increase.
let t = target();
vec![t + 100, t * 2, t * 4].into_iter().for_each(|i| {
vec![t + Weight::from_ref_time(100), t * 2, t * 4].into_iter().for_each(|i| {
run_with_system_weight(i, || {
let fm = runtime_multiplier_update(max_fm);
// won't grow. The convert saturates everything.
+3 -3
View File
@@ -170,7 +170,7 @@ const AVERAGE_ON_INITIALIZE_RATIO: Perbill = Perbill::from_percent(10);
/// by Operational extrinsics.
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
/// We allow for 2 seconds of compute with a 6 second average block time.
const MAXIMUM_BLOCK_WEIGHT: Weight = 2 * WEIGHT_PER_SECOND;
const MAXIMUM_BLOCK_WEIGHT: Weight = WEIGHT_PER_SECOND.scalar_saturating_mul(2);
parameter_types! {
pub const BlockHashCount: BlockNumber = 2400;
@@ -1936,7 +1936,7 @@ impl_runtime_apis! {
storage_deposit_limit: Option<Balance>,
input_data: Vec<u8>,
) -> pallet_contracts_primitives::ContractExecResult<Balance> {
Contracts::bare_call(origin, dest, value, gas_limit, storage_deposit_limit, input_data, true)
Contracts::bare_call(origin, dest, value, Weight::from_ref_time(gas_limit), storage_deposit_limit, input_data, true)
}
fn instantiate(
@@ -1949,7 +1949,7 @@ impl_runtime_apis! {
salt: Vec<u8>,
) -> pallet_contracts_primitives::ContractInstantiateResult<AccountId, Balance>
{
Contracts::bare_instantiate(origin, value, gas_limit, storage_deposit_limit, code, data, salt, true)
Contracts::bare_instantiate(origin, value, Weight::from_ref_time(gas_limit), storage_deposit_limit, code, data, salt, true)
}
fn upload_code(
+4 -4
View File
@@ -332,7 +332,7 @@ benchmarks_instance_pallet! {
// Whitelist voter account from further DB operations.
let voter_key = frame_system::Account::<T>::hashed_key_for(&voter);
frame_benchmarking::benchmarking::add_to_whitelist(voter_key.into());
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
@@ -417,7 +417,7 @@ benchmarks_instance_pallet! {
index,
true,
)?;
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
@@ -489,7 +489,7 @@ benchmarks_instance_pallet! {
System::<T>::set_block_number(T::BlockNumber::max_value());
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
@@ -562,7 +562,7 @@ benchmarks_instance_pallet! {
// caller is prime, prime already votes aye by creating the proposal
System::<T>::set_block_number(T::BlockNumber::max_value());
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash.clone(), index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(T::ProposalProvider::proposal_of(last_hash), None);
+1 -1
View File
@@ -25,7 +25,7 @@ pub const STORAGE_VERSION: StorageVersion = StorageVersion::new(1);
/// Wrapper for all migrations of this pallet.
pub fn migrate<T: Config<I>, I: 'static>() -> Weight {
let onchain_version = Pallet::<T, I>::on_chain_storage_version();
let mut weight: Weight = 0;
let mut weight: Weight = Weight::new();
if onchain_version < 1 {
weight = weight.saturating_add(v0_to_v1::migrate::<T, I>());
+159 -159
View File
@@ -41,7 +41,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_alliance.
@@ -80,30 +80,30 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `y` is `[0, 90]`.
/// The range of component `p` is `[1, 100]`.
fn propose_proposed(b: u32, x: u32, y: u32, p: u32, ) -> Weight {
(22_575_000 as Weight)
Weight::from_ref_time(22_575_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((11_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(11_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 23_000
.saturating_add((158_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(158_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
// Standard Error: 2_000
.saturating_add((90_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(90_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 2_000
.saturating_add((216_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))
.saturating_add(Weight::from_ref_time(216_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Alliance Members (r:2 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
/// The range of component `x` is `[3, 10]`.
/// The range of component `y` is `[2, 90]`.
fn vote(x: u32, y: u32, ) -> Weight {
(45_486_000 as Weight)
Weight::from_ref_time(45_486_000 as RefTimeWeight)
// Standard Error: 29_000
.saturating_add((78_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(78_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
// Standard Error: 2_000
.saturating_add((128_000 as Weight).saturating_mul(y as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(128_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion ProposalOf (r:1 w:1)
@@ -111,11 +111,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: AllianceMotion Voting (r:0 w:1)
/// The range of component `p` is `[1, 100]`.
fn veto(p: u32, ) -> Weight {
(35_296_000 as Weight)
Weight::from_ref_time(35_296_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((171_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))
.saturating_add(Weight::from_ref_time(171_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
@@ -126,15 +126,15 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `y` is `[2, 90]`.
/// The range of component `p` is `[1, 100]`.
fn close_early_disapproved(x: u32, y: u32, p: u32, ) -> Weight {
(39_252_000 as Weight)
Weight::from_ref_time(39_252_000 as RefTimeWeight)
// Standard Error: 18_000
.saturating_add((75_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(75_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((107_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(107_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((170_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))
.saturating_add(Weight::from_ref_time(170_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
@@ -146,13 +146,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `y` is `[2, 90]`.
/// The range of component `p` is `[1, 100]`.
fn close_early_approved(_b: u32, _x: u32, y: u32, p: u32, ) -> Weight {
(50_357_000 as Weight)
Weight::from_ref_time(50_357_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((103_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(103_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((204_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))
.saturating_add(Weight::from_ref_time(204_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
@@ -164,13 +164,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `y` is `[2, 90]`.
/// The range of component `p` is `[1, 100]`.
fn close_disapproved(_x: u32, y: u32, p: u32, ) -> Weight {
(41_258_000 as Weight)
Weight::from_ref_time(41_258_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((111_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(111_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((186_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))
.saturating_add(Weight::from_ref_time(186_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
@@ -183,15 +183,15 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `y` is `[2, 90]`.
/// The range of component `p` is `[1, 100]`.
fn close_approved(_b: u32, x: u32, y: u32, p: u32, ) -> Weight {
(40_490_000 as Weight)
Weight::from_ref_time(40_490_000 as RefTimeWeight)
// Standard Error: 16_000
.saturating_add((119_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(119_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((93_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(93_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((195_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))
.saturating_add(Weight::from_ref_time(195_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:2 w:3)
// Storage: AllianceMotion Members (r:1 w:1)
@@ -199,55 +199,55 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `y` is `[0, 90]`.
/// The range of component `z` is `[0, 100]`.
fn init_members(_x: u32, y: u32, z: u32, ) -> Weight {
(35_186_000 as Weight)
Weight::from_ref_time(35_186_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((161_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(161_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((127_000 as Weight).saturating_mul(z as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(Weight::from_ref_time(127_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Alliance Rule (r:0 w:1)
fn set_rule() -> Weight {
(18_189_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_189_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Announcements (r:1 w:1)
fn announce() -> Weight {
(21_106_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_106_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Announcements (r:1 w:1)
fn remove_announcement() -> Weight {
(22_208_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(22_208_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Members (r:4 w:1)
// Storage: Alliance UnscrupulousAccounts (r:1 w:0)
// Storage: System Account (r:1 w:1)
// Storage: Alliance DepositOf (r:0 w:1)
fn join_alliance() -> Weight {
(53_771_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Weight::from_ref_time(53_771_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:4 w:1)
// Storage: Alliance UnscrupulousAccounts (r:1 w:0)
fn nominate_ally() -> Weight {
(41_912_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(41_912_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Members (r:3 w:2)
// Storage: AllianceMotion Proposals (r:1 w:0)
// Storage: AllianceMotion Members (r:0 w:1)
// Storage: AllianceMotion Prime (r:0 w:1)
fn elevate_ally() -> Weight {
(36_811_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(36_811_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Alliance Members (r:4 w:2)
// Storage: AllianceMotion Proposals (r:1 w:0)
@@ -255,18 +255,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: AllianceMotion Prime (r:0 w:1)
// Storage: Alliance RetiringMembers (r:0 w:1)
fn give_retirement_notice() -> Weight {
(41_079_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(41_079_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Alliance RetiringMembers (r:1 w:1)
// Storage: Alliance Members (r:1 w:1)
// Storage: Alliance DepositOf (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn retire() -> Weight {
(42_703_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(42_703_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Alliance Members (r:3 w:1)
// Storage: AllianceMotion Proposals (r:1 w:0)
@@ -275,35 +275,35 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: AllianceMotion Members (r:0 w:1)
// Storage: AllianceMotion Prime (r:0 w:1)
fn kick_member() -> Weight {
(61_370_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(61_370_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Alliance UnscrupulousAccounts (r:1 w:1)
// Storage: Alliance UnscrupulousWebsites (r:1 w:1)
/// The range of component `n` is `[1, 100]`.
/// The range of component `l` is `[1, 255]`.
fn add_unscrupulous_items(n: u32, l: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((1_385_000 as Weight).saturating_mul(n as Weight))
.saturating_add(Weight::from_ref_time(1_385_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((119_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))
.saturating_add(Weight::from_ref_time(119_000 as RefTimeWeight).scalar_saturating_mul(l as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Alliance UnscrupulousAccounts (r:1 w:1)
// Storage: Alliance UnscrupulousWebsites (r:1 w:1)
/// The range of component `n` is `[1, 100]`.
/// The range of component `l` is `[1, 255]`.
fn remove_unscrupulous_items(n: u32, l: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 153_000
.saturating_add((21_484_000 as Weight).saturating_mul(n as Weight))
.saturating_add(Weight::from_ref_time(21_484_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
// Standard Error: 59_000
.saturating_add((3_772_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))
.saturating_add(Weight::from_ref_time(3_772_000 as RefTimeWeight).scalar_saturating_mul(l as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
}
@@ -319,30 +319,30 @@ impl WeightInfo for () {
/// The range of component `y` is `[0, 90]`.
/// The range of component `p` is `[1, 100]`.
fn propose_proposed(b: u32, x: u32, y: u32, p: u32, ) -> Weight {
(22_575_000 as Weight)
Weight::from_ref_time(22_575_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((11_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(11_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 23_000
.saturating_add((158_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(158_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
// Standard Error: 2_000
.saturating_add((90_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(90_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 2_000
.saturating_add((216_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(Weight::from_ref_time(216_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Alliance Members (r:2 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
/// The range of component `x` is `[3, 10]`.
/// The range of component `y` is `[2, 90]`.
fn vote(x: u32, y: u32, ) -> Weight {
(45_486_000 as Weight)
Weight::from_ref_time(45_486_000 as RefTimeWeight)
// Standard Error: 29_000
.saturating_add((78_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(78_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
// Standard Error: 2_000
.saturating_add((128_000 as Weight).saturating_mul(y as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(128_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion ProposalOf (r:1 w:1)
@@ -350,11 +350,11 @@ impl WeightInfo for () {
// Storage: AllianceMotion Voting (r:0 w:1)
/// The range of component `p` is `[1, 100]`.
fn veto(p: u32, ) -> Weight {
(35_296_000 as Weight)
Weight::from_ref_time(35_296_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((171_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(171_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
@@ -365,15 +365,15 @@ impl WeightInfo for () {
/// The range of component `y` is `[2, 90]`.
/// The range of component `p` is `[1, 100]`.
fn close_early_disapproved(x: u32, y: u32, p: u32, ) -> Weight {
(39_252_000 as Weight)
Weight::from_ref_time(39_252_000 as RefTimeWeight)
// Standard Error: 18_000
.saturating_add((75_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(75_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((107_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(107_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((170_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(170_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
@@ -385,13 +385,13 @@ impl WeightInfo for () {
/// The range of component `y` is `[2, 90]`.
/// The range of component `p` is `[1, 100]`.
fn close_early_approved(_b: u32, _x: u32, y: u32, p: u32, ) -> Weight {
(50_357_000 as Weight)
Weight::from_ref_time(50_357_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((103_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(103_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((204_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(204_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
@@ -403,13 +403,13 @@ impl WeightInfo for () {
/// The range of component `y` is `[2, 90]`.
/// The range of component `p` is `[1, 100]`.
fn close_disapproved(_x: u32, y: u32, p: u32, ) -> Weight {
(41_258_000 as Weight)
Weight::from_ref_time(41_258_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((111_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(111_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((186_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(186_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:1 w:0)
// Storage: AllianceMotion Voting (r:1 w:1)
@@ -422,15 +422,15 @@ impl WeightInfo for () {
/// The range of component `y` is `[2, 90]`.
/// The range of component `p` is `[1, 100]`.
fn close_approved(_b: u32, x: u32, y: u32, p: u32, ) -> Weight {
(40_490_000 as Weight)
Weight::from_ref_time(40_490_000 as RefTimeWeight)
// Standard Error: 16_000
.saturating_add((119_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(119_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((93_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(93_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((195_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(195_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:2 w:3)
// Storage: AllianceMotion Members (r:1 w:1)
@@ -438,55 +438,55 @@ impl WeightInfo for () {
/// The range of component `y` is `[0, 90]`.
/// The range of component `z` is `[0, 100]`.
fn init_members(_x: u32, y: u32, z: u32, ) -> Weight {
(35_186_000 as Weight)
Weight::from_ref_time(35_186_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((161_000 as Weight).saturating_mul(y as Weight))
.saturating_add(Weight::from_ref_time(161_000 as RefTimeWeight).scalar_saturating_mul(y as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((127_000 as Weight).saturating_mul(z as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(Weight::from_ref_time(127_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Alliance Rule (r:0 w:1)
fn set_rule() -> Weight {
(18_189_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_189_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Announcements (r:1 w:1)
fn announce() -> Weight {
(21_106_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_106_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Announcements (r:1 w:1)
fn remove_announcement() -> Weight {
(22_208_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(22_208_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Members (r:4 w:1)
// Storage: Alliance UnscrupulousAccounts (r:1 w:0)
// Storage: System Account (r:1 w:1)
// Storage: Alliance DepositOf (r:0 w:1)
fn join_alliance() -> Weight {
(53_771_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(53_771_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Alliance Members (r:4 w:1)
// Storage: Alliance UnscrupulousAccounts (r:1 w:0)
fn nominate_ally() -> Weight {
(41_912_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(41_912_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Alliance Members (r:3 w:2)
// Storage: AllianceMotion Proposals (r:1 w:0)
// Storage: AllianceMotion Members (r:0 w:1)
// Storage: AllianceMotion Prime (r:0 w:1)
fn elevate_ally() -> Weight {
(36_811_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(36_811_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Alliance Members (r:4 w:2)
// Storage: AllianceMotion Proposals (r:1 w:0)
@@ -494,18 +494,18 @@ impl WeightInfo for () {
// Storage: AllianceMotion Prime (r:0 w:1)
// Storage: Alliance RetiringMembers (r:0 w:1)
fn give_retirement_notice() -> Weight {
(41_079_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(41_079_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Alliance RetiringMembers (r:1 w:1)
// Storage: Alliance Members (r:1 w:1)
// Storage: Alliance DepositOf (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn retire() -> Weight {
(42_703_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(42_703_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Alliance Members (r:3 w:1)
// Storage: AllianceMotion Proposals (r:1 w:0)
@@ -514,34 +514,34 @@ impl WeightInfo for () {
// Storage: AllianceMotion Members (r:0 w:1)
// Storage: AllianceMotion Prime (r:0 w:1)
fn kick_member() -> Weight {
(61_370_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(61_370_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Alliance UnscrupulousAccounts (r:1 w:1)
// Storage: Alliance UnscrupulousWebsites (r:1 w:1)
/// The range of component `n` is `[1, 100]`.
/// The range of component `l` is `[1, 255]`.
fn add_unscrupulous_items(n: u32, l: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((1_385_000 as Weight).saturating_mul(n as Weight))
.saturating_add(Weight::from_ref_time(1_385_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((119_000 as Weight).saturating_mul(l as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(119_000 as RefTimeWeight).scalar_saturating_mul(l as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Alliance UnscrupulousAccounts (r:1 w:1)
// Storage: Alliance UnscrupulousWebsites (r:1 w:1)
/// The range of component `n` is `[1, 100]`.
/// The range of component `l` is `[1, 255]`.
fn remove_unscrupulous_items(n: u32, l: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 153_000
.saturating_add((21_484_000 as Weight).saturating_mul(n as Weight))
.saturating_add(Weight::from_ref_time(21_484_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
// Standard Error: 59_000
.saturating_add((3_772_000 as Weight).saturating_mul(l as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(3_772_000 as RefTimeWeight).scalar_saturating_mul(l as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
}
+163 -163
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_assets.
@@ -74,15 +74,15 @@ pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Assets Asset (r:1 w:1)
fn create() -> Weight {
(27_167_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(27_167_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn force_create() -> Weight {
(15_473_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(15_473_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:5002 w:5001)
@@ -90,168 +90,168 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Assets Metadata (r:1 w:0)
// Storage: Assets Approvals (r:501 w:500)
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 37_000
.saturating_add((17_145_000 as Weight).saturating_mul(c as Weight))
.saturating_add(Weight::from_ref_time(17_145_000 as RefTimeWeight).scalar_saturating_mul(c as RefTimeWeight))
// Standard Error: 37_000
.saturating_add((19_333_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(19_333_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 375_000
.saturating_add((17_046_000 as Weight).saturating_mul(a as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(a as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
.saturating_add(Weight::from_ref_time(17_046_000 as RefTimeWeight).scalar_saturating_mul(a as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((2 as RefTimeWeight).saturating_mul(c as RefTimeWeight)))
.saturating_add(T::DbWeight::get().reads((2 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(a as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((2 as RefTimeWeight).saturating_mul(c as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes((2 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(a as RefTimeWeight)))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
fn mint() -> Weight {
(30_819_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(30_819_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
fn burn() -> Weight {
(35_212_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(35_212_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:2 w:2)
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
(47_401_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(47_401_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:2 w:2)
// Storage: System Account (r:1 w:1)
fn transfer_keep_alive() -> Weight {
(42_300_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(42_300_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:2 w:2)
// Storage: System Account (r:1 w:1)
fn force_transfer() -> Weight {
(47_946_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(47_946_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Account (r:1 w:1)
fn freeze() -> Weight {
(21_670_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_670_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Account (r:1 w:1)
fn thaw() -> Weight {
(21_503_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_503_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn freeze_asset() -> Weight {
(18_158_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_158_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn thaw_asset() -> Weight {
(18_525_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_525_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Metadata (r:1 w:0)
fn transfer_ownership() -> Weight {
(19_858_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(19_858_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn set_team() -> Weight {
(18_045_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_045_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Metadata (r:1 w:1)
fn set_metadata(n: u32, s: u32, ) -> Weight {
(32_395_000 as Weight)
Weight::from_ref_time(32_395_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(n as Weight))
.saturating_add(Weight::from_ref_time(5_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
// Standard Error: 0
.saturating_add((2_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))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Metadata (r:1 w:1)
fn clear_metadata() -> Weight {
(32_893_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(32_893_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Metadata (r:1 w:1)
fn force_set_metadata(_n: u32, s: u32, ) -> Weight {
(19_586_000 as Weight)
Weight::from_ref_time(19_586_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((1_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))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Metadata (r:1 w:1)
fn force_clear_metadata() -> Weight {
(32_478_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(32_478_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn force_asset_status() -> Weight {
(17_143_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(17_143_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Approvals (r:1 w:1)
fn approve_transfer() -> Weight {
(36_389_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(36_389_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Assets Approvals (r:1 w:1)
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:2 w:2)
// Storage: System Account (r:1 w:1)
fn transfer_approved() -> Weight {
(61_854_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(61_854_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Approvals (r:1 w:1)
fn cancel_approval() -> Weight {
(36_759_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(36_759_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Approvals (r:1 w:1)
fn force_cancel_approval() -> Weight {
(37_753_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(37_753_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
}
@@ -259,15 +259,15 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
impl WeightInfo for () {
// Storage: Assets Asset (r:1 w:1)
fn create() -> Weight {
(27_167_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(27_167_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn force_create() -> Weight {
(15_473_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(15_473_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:5002 w:5001)
@@ -275,167 +275,167 @@ impl WeightInfo for () {
// Storage: Assets Metadata (r:1 w:0)
// Storage: Assets Approvals (r:501 w:500)
fn destroy(c: u32, s: u32, a: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 37_000
.saturating_add((17_145_000 as Weight).saturating_mul(c as Weight))
.saturating_add(Weight::from_ref_time(17_145_000 as RefTimeWeight).scalar_saturating_mul(c as RefTimeWeight))
// Standard Error: 37_000
.saturating_add((19_333_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(19_333_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 375_000
.saturating_add((17_046_000 as Weight).saturating_mul(a as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(c as Weight)))
.saturating_add(RocksDbWeight::get().reads((2 as Weight).saturating_mul(s as Weight)))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(a as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(c as Weight)))
.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(s as Weight)))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(a as Weight)))
.saturating_add(Weight::from_ref_time(17_046_000 as RefTimeWeight).scalar_saturating_mul(a as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((2 as RefTimeWeight).saturating_mul(c as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().reads((2 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(a as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((2 as RefTimeWeight).saturating_mul(c as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes((2 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(a as RefTimeWeight)))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
fn mint() -> Weight {
(30_819_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(30_819_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:1 w:1)
fn burn() -> Weight {
(35_212_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(35_212_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:2 w:2)
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
(47_401_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(47_401_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:2 w:2)
// Storage: System Account (r:1 w:1)
fn transfer_keep_alive() -> Weight {
(42_300_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(42_300_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:2 w:2)
// Storage: System Account (r:1 w:1)
fn force_transfer() -> Weight {
(47_946_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(47_946_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Account (r:1 w:1)
fn freeze() -> Weight {
(21_670_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_670_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Account (r:1 w:1)
fn thaw() -> Weight {
(21_503_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_503_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn freeze_asset() -> Weight {
(18_158_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_158_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn thaw_asset() -> Weight {
(18_525_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_525_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Metadata (r:1 w:0)
fn transfer_ownership() -> Weight {
(19_858_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(19_858_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn set_team() -> Weight {
(18_045_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_045_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Metadata (r:1 w:1)
fn set_metadata(n: u32, s: u32, ) -> Weight {
(32_395_000 as Weight)
Weight::from_ref_time(32_395_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(n as Weight))
.saturating_add(Weight::from_ref_time(5_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Metadata (r:1 w:1)
fn clear_metadata() -> Weight {
(32_893_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(32_893_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Metadata (r:1 w:1)
fn force_set_metadata(_n: u32, s: u32, ) -> Weight {
(19_586_000 as Weight)
Weight::from_ref_time(19_586_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:0)
// Storage: Assets Metadata (r:1 w:1)
fn force_clear_metadata() -> Weight {
(32_478_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(32_478_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
fn force_asset_status() -> Weight {
(17_143_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(17_143_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Approvals (r:1 w:1)
fn approve_transfer() -> Weight {
(36_389_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(36_389_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Assets Approvals (r:1 w:1)
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Account (r:2 w:2)
// Storage: System Account (r:1 w:1)
fn transfer_approved() -> Weight {
(61_854_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(61_854_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Approvals (r:1 w:1)
fn cancel_approval() -> Weight {
(36_759_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(36_759_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Assets Asset (r:1 w:1)
// Storage: Assets Approvals (r:1 w:1)
fn force_cancel_approval() -> Weight {
(37_753_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(37_753_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
}
+5 -4
View File
@@ -243,7 +243,7 @@ pub mod pallet {
/// - `duration`: Locked duration of the atomic swap. For safety reasons, it is recommended
/// that the revealer uses a shorter duration than the counterparty, to prevent the
/// situation where the revealer reveals the proof too late around the end block.
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000))]
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1).ref_time().saturating_add(40_000_000))]
pub fn create_swap(
origin: OriginFor<T>,
target: T::AccountId,
@@ -280,9 +280,10 @@ pub mod pallet {
/// the operation fails. This is used for weight calculation.
#[pallet::weight(
T::DbWeight::get().reads_writes(1, 1)
.saturating_add(40_000_000)
.saturating_add((proof.len() as Weight).saturating_mul(100))
.saturating_add(action.weight())
.ref_time()
.saturating_add(40_000_000)
.saturating_add((proof.len() as u64).saturating_mul(100))
)]
pub fn claim_swap(
origin: OriginFor<T>,
@@ -317,7 +318,7 @@ pub mod pallet {
///
/// - `target`: Target of the original atomic swap.
/// - `hashed_proof`: Hashed proof of the original atomic swap.
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1).saturating_add(40_000_000))]
#[pallet::weight(T::DbWeight::get().reads_writes(1, 1).ref_time().saturating_add(40_000_000))]
pub fn cancel_swap(
origin: OriginFor<T>,
target: T::AccountId,
+1 -1
View File
@@ -30,7 +30,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
+1 -1
View File
@@ -49,7 +49,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
@@ -227,7 +227,7 @@ mod tests {
pub const Period: BlockNumber = 1;
pub const Offset: BlockNumber = 0;
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
+2 -2
View File
@@ -190,7 +190,7 @@ pub mod pallet {
T::EventHandler::note_author(author);
}
0
Weight::zero()
}
fn on_finalize(_: T::BlockNumber) {
@@ -460,7 +460,7 @@ mod tests {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
+5 -3
View File
@@ -38,8 +38,8 @@ impl crate::WeightInfo for () {
const MAX_NOMINATORS: u64 = 200;
// checking membership proof
(35 * WEIGHT_PER_MICROS)
.saturating_add((175 * WEIGHT_PER_NANOS).saturating_mul(validator_count))
let ref_time_weight = (35 * WEIGHT_PER_MICROS)
.saturating_add((175 * WEIGHT_PER_NANOS).scalar_saturating_mul(validator_count))
.saturating_add(DbWeight::get().reads(5))
// check equivocation proof
.saturating_add(110 * WEIGHT_PER_MICROS)
@@ -47,6 +47,8 @@ impl crate::WeightInfo for () {
.saturating_add(110 * WEIGHT_PER_MICROS)
.saturating_add(25 * WEIGHT_PER_MICROS * MAX_NOMINATORS)
.saturating_add(DbWeight::get().reads(14 + 3 * MAX_NOMINATORS))
.saturating_add(DbWeight::get().writes(10 + 3 * MAX_NOMINATORS))
.saturating_add(DbWeight::get().writes(10 + 3 * MAX_NOMINATORS));
ref_time_weight
}
}
+2 -2
View File
@@ -336,7 +336,7 @@ pub mod pallet {
/// Initialization
fn on_initialize(now: BlockNumberFor<T>) -> Weight {
Self::initialize(now);
0
Weight::zero()
}
/// Block finalization
@@ -1008,6 +1008,6 @@ pub mod migrations {
writes += 3;
T::DbWeight::get().writes(writes) + T::DbWeight::get().reads(reads)
T::DbWeight::get().reads_writes(reads, writes)
}
}
+1 -1
View File
@@ -66,7 +66,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
+1 -1
View File
@@ -852,7 +852,7 @@ fn valid_equivocation_reports_dont_pay_fees() {
.get_dispatch_info();
// it should have non-zero weight and the fee has to be paid.
assert!(info.weight > 0);
assert!(info.weight > Weight::zero());
assert_eq!(info.pays_fee, Pays::Yes);
// report the equivocation.
@@ -21,7 +21,6 @@ use codec::{Decode, Encode};
use core::marker::PhantomData;
use frame_election_provider_support::ScoreProvider;
use frame_support::traits::OnRuntimeUpgrade;
use sp_runtime::traits::Zero;
#[cfg(feature = "try-runtime")]
use frame_support::ensure;
+19 -19
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_bags_list.
@@ -57,18 +57,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList ListNodes (r:4 w:4)
// Storage: BagsList ListBags (r:1 w:1)
fn rebag_non_terminal() -> Weight {
(55_040_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(55_040_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn rebag_terminal() -> Weight {
(53_671_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(53_671_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: BagsList ListNodes (r:4 w:4)
// Storage: Staking Bonded (r:2 w:0)
@@ -76,9 +76,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList CounterForListNodes (r:1 w:1)
// Storage: BagsList ListBags (r:1 w:1)
fn put_in_front_of() -> Weight {
(56_410_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
Weight::from_ref_time(56_410_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(10 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(6 as RefTimeWeight))
}
}
@@ -89,18 +89,18 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:4 w:4)
// Storage: BagsList ListBags (r:1 w:1)
fn rebag_non_terminal() -> Weight {
(55_040_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(55_040_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Staking Bonded (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn rebag_terminal() -> Weight {
(53_671_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(53_671_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: BagsList ListNodes (r:4 w:4)
// Storage: Staking Bonded (r:2 w:0)
@@ -108,8 +108,8 @@ impl WeightInfo for () {
// Storage: BagsList CounterForListNodes (r:1 w:1)
// Storage: BagsList ListBags (r:1 w:1)
fn put_in_front_of() -> Weight {
(56_410_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(10 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
Weight::from_ref_time(56_410_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(10 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(6 as RefTimeWeight))
}
}
+4 -4
View File
@@ -188,14 +188,14 @@ macro_rules! decl_tests {
ChargeTransactionPayment::from(1),
&1,
CALL,
&info_from_weight(1),
&info_from_weight(Weight::one()),
1,
).is_err());
assert_ok!(<ChargeTransactionPayment<$test> as SignedExtension>::pre_dispatch(
ChargeTransactionPayment::from(0),
&1,
CALL,
&info_from_weight(1),
&info_from_weight(Weight::one()),
1,
));
@@ -206,14 +206,14 @@ macro_rules! decl_tests {
ChargeTransactionPayment::from(1),
&1,
CALL,
&info_from_weight(1),
&info_from_weight(Weight::one()),
1,
).is_err());
assert!(<ChargeTransactionPayment<$test> as SignedExtension>::pre_dispatch(
ChargeTransactionPayment::from(0),
&1,
CALL,
&info_from_weight(1),
&info_from_weight(Weight::one()),
1,
).is_err());
});
@@ -46,7 +46,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
pub static ExistentialDeposit: u64 = 0;
}
impl frame_system::Config for Test {
+1 -1
View File
@@ -47,7 +47,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
pub static ExistentialDeposit: u64 = 0;
}
impl frame_system::Config for Test {
@@ -51,7 +51,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
pub static ExistentialDeposit: u64 = 0;
}
impl frame_system::Config for Test {
+43 -43
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_balances.
@@ -58,45 +58,45 @@ pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
(41_860_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(41_860_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn transfer_keep_alive() -> Weight {
(32_760_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(32_760_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn set_balance_creating() -> Weight {
(22_279_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(22_279_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn set_balance_killing() -> Weight {
(25_488_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(25_488_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:2 w:2)
fn force_transfer() -> Weight {
(42_190_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(42_190_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn transfer_all() -> Weight {
(37_789_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(37_789_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn force_unreserve() -> Weight {
(20_056_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(20_056_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
}
@@ -104,44 +104,44 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
impl WeightInfo for () {
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
(41_860_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(41_860_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn transfer_keep_alive() -> Weight {
(32_760_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(32_760_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn set_balance_creating() -> Weight {
(22_279_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(22_279_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn set_balance_killing() -> Weight {
(25_488_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(25_488_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:2 w:2)
fn force_transfer() -> Weight {
(42_190_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(42_190_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn transfer_all() -> Weight {
(37_789_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(37_789_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn force_unreserve() -> Weight {
(20_056_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(20_056_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
}
+1 -1
View File
@@ -127,7 +127,7 @@ pub struct BenchmarkResult {
impl BenchmarkResult {
pub fn from_weight(w: Weight) -> Self {
Self { extrinsic_time: (w as u128) / 1_000, ..Default::default() }
Self { extrinsic_time: (w.ref_time() / 1_000) as u128, ..Default::default() }
}
}
+27 -27
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for frame_benchmarking.
@@ -58,75 +58,75 @@ pub trait WeightInfo {
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn addition(_i: u32, ) -> Weight {
(103_000 as Weight)
Weight::from_ref_time(103_000 as RefTimeWeight)
}
fn subtraction(_i: u32, ) -> Weight {
(105_000 as Weight)
Weight::from_ref_time(105_000 as RefTimeWeight)
}
fn multiplication(_i: u32, ) -> Weight {
(113_000 as Weight)
Weight::from_ref_time(113_000 as RefTimeWeight)
}
fn division(_i: u32, ) -> Weight {
(102_000 as Weight)
Weight::from_ref_time(102_000 as RefTimeWeight)
}
fn hashing(_i: u32, ) -> Weight {
(20_865_902_000 as Weight)
Weight::from_ref_time(20_865_902_000 as RefTimeWeight)
}
fn sr25519_verification(i: u32, ) -> Weight {
(319_000 as Weight)
Weight::from_ref_time(319_000 as RefTimeWeight)
// Standard Error: 8_000
.saturating_add((47_171_000 as Weight).saturating_mul(i as Weight))
.saturating_add(Weight::from_ref_time(47_171_000 as RefTimeWeight).scalar_saturating_mul(i as RefTimeWeight))
}
// Storage: Skipped Metadata (r:0 w:0)
fn storage_read(i: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((2_110_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
.saturating_add(Weight::from_ref_time(2_110_000 as RefTimeWeight).scalar_saturating_mul(i as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(i as RefTimeWeight)))
}
// Storage: Skipped Metadata (r:0 w:0)
fn storage_write(i: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 0
.saturating_add((372_000 as Weight).saturating_mul(i as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
.saturating_add(Weight::from_ref_time(372_000 as RefTimeWeight).scalar_saturating_mul(i as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(i as RefTimeWeight)))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
fn addition(_i: u32, ) -> Weight {
(103_000 as Weight)
Weight::from_ref_time(103_000 as RefTimeWeight)
}
fn subtraction(_i: u32, ) -> Weight {
(105_000 as Weight)
Weight::from_ref_time(105_000 as RefTimeWeight)
}
fn multiplication(_i: u32, ) -> Weight {
(113_000 as Weight)
Weight::from_ref_time(113_000 as RefTimeWeight)
}
fn division(_i: u32, ) -> Weight {
(102_000 as Weight)
Weight::from_ref_time(102_000 as RefTimeWeight)
}
fn hashing(_i: u32, ) -> Weight {
(20_865_902_000 as Weight)
Weight::from_ref_time(20_865_902_000 as RefTimeWeight)
}
fn sr25519_verification(i: u32, ) -> Weight {
(319_000 as Weight)
Weight::from_ref_time(319_000 as RefTimeWeight)
// Standard Error: 8_000
.saturating_add((47_171_000 as Weight).saturating_mul(i as Weight))
.saturating_add(Weight::from_ref_time(47_171_000 as RefTimeWeight).scalar_saturating_mul(i as RefTimeWeight))
}
// Storage: Skipped Metadata (r:0 w:0)
fn storage_read(i: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((2_110_000 as Weight).saturating_mul(i as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(i as Weight)))
.saturating_add(Weight::from_ref_time(2_110_000 as RefTimeWeight).scalar_saturating_mul(i as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(i as RefTimeWeight)))
}
// Storage: Skipped Metadata (r:0 w:0)
fn storage_write(i: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 0
.saturating_add((372_000 as Weight).saturating_mul(i as Weight))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(i as Weight)))
.saturating_add(Weight::from_ref_time(372_000 as RefTimeWeight).scalar_saturating_mul(i as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(i as RefTimeWeight)))
}
}
@@ -54,7 +54,7 @@ pub fn migrate<
target: "runtime::bounties",
"New pallet name is equal to the old prefix. No migration needs to be done.",
);
return 0
return Weight::zero()
}
let on_chain_storage_version = <P as GetStorageVersion>::on_chain_storage_version();
@@ -105,7 +105,7 @@ pub fn migrate<
"Attempted to apply migration to v4 but failed because storage version is {:?}",
on_chain_storage_version,
);
0
Weight::zero()
}
}
+73 -73
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_bounties.
@@ -65,88 +65,88 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Bounties BountyDescriptions (r:0 w:1)
// Storage: Bounties Bounties (r:0 w:1)
fn propose_bounty(_d: u32, ) -> Weight {
(28_903_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(28_903_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: Bounties BountyApprovals (r:1 w:1)
fn approve_bounty() -> Weight {
(10_997_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(10_997_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
fn propose_curator() -> Weight {
(8_967_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(8_967_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn unassign_curator() -> Weight {
(28_665_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(28_665_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn accept_curator() -> Weight {
(25_141_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(25_141_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
fn award_bounty() -> Weight {
(21_295_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_295_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: System Account (r:3 w:3)
// Storage: ChildBounties ChildrenCuratorFees (r:1 w:1)
// Storage: Bounties BountyDescriptions (r:0 w:1)
fn claim_bounty() -> Weight {
(67_951_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
Weight::from_ref_time(67_951_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
// Storage: System Account (r:1 w:1)
// Storage: Bounties BountyDescriptions (r:0 w:1)
fn close_bounty_proposed() -> Weight {
(33_654_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Weight::from_ref_time(33_654_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
// Storage: System Account (r:2 w:2)
// Storage: Bounties BountyDescriptions (r:0 w:1)
fn close_bounty_active() -> Weight {
(50_582_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(50_582_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
fn extend_bounty_expiry() -> Weight {
(18_322_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_322_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Bounties BountyApprovals (r:1 w:1)
// Storage: Bounties Bounties (r:1 w:1)
// Storage: System Account (r:2 w:2)
fn spend_funds(b: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 17_000
.saturating_add((29_233_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(b as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))
.saturating_add(Weight::from_ref_time(29_233_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((3 as RefTimeWeight).saturating_mul(b as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((3 as RefTimeWeight).saturating_mul(b as RefTimeWeight)))
}
}
@@ -157,87 +157,87 @@ impl WeightInfo for () {
// Storage: Bounties BountyDescriptions (r:0 w:1)
// Storage: Bounties Bounties (r:0 w:1)
fn propose_bounty(_d: u32, ) -> Weight {
(28_903_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(28_903_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: Bounties BountyApprovals (r:1 w:1)
fn approve_bounty() -> Weight {
(10_997_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(10_997_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
fn propose_curator() -> Weight {
(8_967_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(8_967_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn unassign_curator() -> Weight {
(28_665_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(28_665_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn accept_curator() -> Weight {
(25_141_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(25_141_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
fn award_bounty() -> Weight {
(21_295_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_295_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: System Account (r:3 w:3)
// Storage: ChildBounties ChildrenCuratorFees (r:1 w:1)
// Storage: Bounties BountyDescriptions (r:0 w:1)
fn claim_bounty() -> Weight {
(67_951_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
Weight::from_ref_time(67_951_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
// Storage: System Account (r:1 w:1)
// Storage: Bounties BountyDescriptions (r:0 w:1)
fn close_bounty_proposed() -> Weight {
(33_654_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(33_654_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
// Storage: ChildBounties ParentChildBounties (r:1 w:0)
// Storage: System Account (r:2 w:2)
// Storage: Bounties BountyDescriptions (r:0 w:1)
fn close_bounty_active() -> Weight {
(50_582_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(50_582_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:1)
fn extend_bounty_expiry() -> Weight {
(18_322_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(18_322_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Bounties BountyApprovals (r:1 w:1)
// Storage: Bounties Bounties (r:1 w:1)
// Storage: System Account (r:2 w:2)
fn spend_funds(b: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 17_000
.saturating_add((29_233_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(b as Weight)))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(b as Weight)))
.saturating_add(Weight::from_ref_time(29_233_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((3 as RefTimeWeight).saturating_mul(b as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((3 as RefTimeWeight).saturating_mul(b as RefTimeWeight)))
}
}
+1 -1
View File
@@ -60,7 +60,7 @@ frame_support::construct_runtime!(
);
parameter_types! {
pub const MaximumBlockWeight: Weight = 1024;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
+51 -51
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_child_bounties.
@@ -64,51 +64,51 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: ChildBounties ChildBountyDescriptions (r:0 w:1)
// Storage: ChildBounties ChildBounties (r:0 w:1)
fn add_child_bounty(d: u32, ) -> Weight {
(51_064_000 as Weight)
Weight::from_ref_time(51_064_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(d as Weight))
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
// Storage: ChildBounties ChildrenCuratorFees (r:1 w:1)
fn propose_curator() -> Weight {
(15_286_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(15_286_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn accept_curator() -> Weight {
(29_929_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(29_929_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: ChildBounties ChildBounties (r:1 w:1)
// Storage: Bounties Bounties (r:1 w:0)
// Storage: System Account (r:1 w:1)
fn unassign_curator() -> Weight {
(32_449_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(32_449_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
fn award_child_bounty() -> Weight {
(23_793_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(23_793_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ChildBounties ChildBounties (r:1 w:1)
// Storage: System Account (r:3 w:3)
// Storage: ChildBounties ParentChildBounties (r:1 w:1)
// Storage: ChildBounties ChildBountyDescriptions (r:0 w:1)
fn claim_child_bounty() -> Weight {
(67_529_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
Weight::from_ref_time(67_529_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
@@ -117,9 +117,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Account (r:2 w:2)
// Storage: ChildBounties ChildBountyDescriptions (r:0 w:1)
fn close_child_bounty_added() -> Weight {
(48_436_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
Weight::from_ref_time(48_436_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
@@ -128,9 +128,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: ChildBounties ParentChildBounties (r:1 w:1)
// Storage: ChildBounties ChildBountyDescriptions (r:0 w:1)
fn close_child_bounty_active() -> Weight {
(58_044_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(7 as Weight))
Weight::from_ref_time(58_044_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(7 as RefTimeWeight))
}
}
@@ -143,51 +143,51 @@ impl WeightInfo for () {
// Storage: ChildBounties ChildBountyDescriptions (r:0 w:1)
// Storage: ChildBounties ChildBounties (r:0 w:1)
fn add_child_bounty(d: u32, ) -> Weight {
(51_064_000 as Weight)
Weight::from_ref_time(51_064_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(d as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
// Storage: ChildBounties ChildrenCuratorFees (r:1 w:1)
fn propose_curator() -> Weight {
(15_286_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(15_286_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn accept_curator() -> Weight {
(29_929_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(29_929_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: ChildBounties ChildBounties (r:1 w:1)
// Storage: Bounties Bounties (r:1 w:0)
// Storage: System Account (r:1 w:1)
fn unassign_curator() -> Weight {
(32_449_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(32_449_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
fn award_child_bounty() -> Weight {
(23_793_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(23_793_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ChildBounties ChildBounties (r:1 w:1)
// Storage: System Account (r:3 w:3)
// Storage: ChildBounties ParentChildBounties (r:1 w:1)
// Storage: ChildBounties ChildBountyDescriptions (r:0 w:1)
fn claim_child_bounty() -> Weight {
(67_529_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
Weight::from_ref_time(67_529_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
@@ -196,9 +196,9 @@ impl WeightInfo for () {
// Storage: System Account (r:2 w:2)
// Storage: ChildBounties ChildBountyDescriptions (r:0 w:1)
fn close_child_bounty_added() -> Weight {
(48_436_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
Weight::from_ref_time(48_436_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Bounties Bounties (r:1 w:0)
// Storage: ChildBounties ChildBounties (r:1 w:1)
@@ -207,8 +207,8 @@ impl WeightInfo for () {
// Storage: ChildBounties ParentChildBounties (r:1 w:1)
// Storage: ChildBounties ChildBountyDescriptions (r:0 w:1)
fn close_child_bounty_active() -> Weight {
(58_044_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(7 as Weight))
Weight::from_ref_time(58_044_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(7 as RefTimeWeight))
}
}
@@ -355,7 +355,7 @@ benchmarks_instance_pallet! {
// Whitelist voter account from further DB operations.
let voter_key = frame_system::Account::<T>::hashed_key_for(&voter);
frame_benchmarking::benchmarking::add_to_whitelist(voter_key.into());
}: close(SystemOrigin::Signed(voter), last_hash, index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(voter), last_hash, index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
@@ -436,7 +436,7 @@ benchmarks_instance_pallet! {
index, approve,
)?;
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::MAX, bytes_in_storage)
verify {
// The last proposal is removed.
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
@@ -511,7 +511,7 @@ benchmarks_instance_pallet! {
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
// Prime nay will close it as disapproved
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::MAX, bytes_in_storage)
verify {
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Disapproved { proposal_hash: last_hash }.into());
@@ -583,7 +583,7 @@ benchmarks_instance_pallet! {
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
// Prime aye will close it as approved
}: close(SystemOrigin::Signed(caller), last_hash, p - 1, Weight::max_value(), bytes_in_storage)
}: close(SystemOrigin::Signed(caller), last_hash, p - 1, Weight::MAX, bytes_in_storage)
verify {
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
assert_last_event::<T, I>(Event::Executed { proposal_hash: last_hash, result: Err(DispatchError::BadOrigin) }.into());
@@ -45,7 +45,7 @@ pub fn migrate<T: frame_system::Config, P: GetStorageVersion + PalletInfoAccess,
target: "runtime::collective",
"New pallet name is equal to the old pallet name. No migration needs to be done.",
);
return 0
return Weight::zero()
}
let on_chain_storage_version = <P as GetStorageVersion>::on_chain_storage_version();
@@ -70,7 +70,7 @@ pub fn migrate<T: frame_system::Config, P: GetStorageVersion + PalletInfoAccess,
"Attempted to apply migration to v4 but failed because storage version is {:?}",
on_chain_storage_version,
);
0
Weight::zero()
}
}
+17 -7
View File
@@ -89,7 +89,7 @@ parameter_types! {
pub const MotionDuration: u64 = 3;
pub const MaxProposals: u32 = 100;
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
@@ -270,7 +270,13 @@ fn proposal_weight_limit_works_on_approve() {
// With 1's prime vote, this should pass
System::set_block_number(4);
assert_noop!(
Collective::close(Origin::signed(4), hash, 0, proposal_weight - 100, proposal_len),
Collective::close(
Origin::signed(4),
hash,
0,
proposal_weight - Weight::from_ref_time(100),
proposal_len
),
Error::<Test, Instance1>::WrongProposalWeight
);
assert_ok!(Collective::close(Origin::signed(4), hash, 0, proposal_weight, proposal_len));
@@ -301,7 +307,7 @@ fn proposal_weight_limit_ignored_on_disapprove() {
Origin::signed(4),
hash,
0,
proposal_weight - 100,
proposal_weight - Weight::from_ref_time(100),
proposal_len
));
})
@@ -687,7 +693,11 @@ fn correct_validate_and_get_proposal() {
Error::<Test, Instance1>::WrongProposalLength
);
assert_noop!(
Collective::validate_and_get_proposal(&hash, length, weight - 10),
Collective::validate_and_get_proposal(
&hash,
length,
weight - Weight::from_ref_time(10)
),
Error::<Test, Instance1>::WrongProposalWeight
);
let res = Collective::validate_and_get_proposal(&hash, length, weight);
@@ -1196,18 +1206,18 @@ fn close_disapprove_does_not_care_about_weight_or_len() {
assert_ok!(Collective::vote(Origin::signed(2), hash, 0, true));
// It will not close with bad weight/len information
assert_noop!(
Collective::close(Origin::signed(2), hash, 0, 0, 0),
Collective::close(Origin::signed(2), hash, 0, Weight::zero(), 0),
Error::<Test, Instance1>::WrongProposalLength,
);
assert_noop!(
Collective::close(Origin::signed(2), hash, 0, 0, proposal_len),
Collective::close(Origin::signed(2), hash, 0, Weight::zero(), proposal_len),
Error::<Test, Instance1>::WrongProposalWeight,
);
// Now we make the proposal fail
assert_ok!(Collective::vote(Origin::signed(1), hash, 0, false));
assert_ok!(Collective::vote(Origin::signed(2), hash, 0, false));
// It can close even if the weight/len information is bad
assert_ok!(Collective::close(Origin::signed(2), hash, 0, 0, 0));
assert_ok!(Collective::close(Origin::signed(2), hash, 0, Weight::zero(), 0));
})
}
+105 -105
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_collective.
@@ -64,36 +64,36 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council Voting (r:100 w:100)
// Storage: Council Prime (r:0 w:1)
fn set_members(m: u32, n: u32, p: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 12_000
.saturating_add((10_280_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(10_280_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 12_000
.saturating_add((126_000 as Weight).saturating_mul(n as Weight))
.saturating_add(Weight::from_ref_time(126_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
// Standard Error: 12_000
.saturating_add((13_310_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)))
.saturating_add(Weight::from_ref_time(13_310_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(p as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(p as RefTimeWeight)))
}
// Storage: Council Members (r:1 w:0)
fn execute(b: u32, m: u32, ) -> Weight {
(16_819_000 as Weight)
Weight::from_ref_time(16_819_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 0
.saturating_add((33_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(Weight::from_ref_time(33_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council ProposalOf (r:1 w:0)
fn propose_execute(b: u32, m: u32, ) -> Weight {
(18_849_000 as Weight)
Weight::from_ref_time(18_849_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 0
.saturating_add((56_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(Weight::from_ref_time(56_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council ProposalOf (r:1 w:1)
@@ -101,52 +101,52 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council ProposalCount (r:1 w:1)
// Storage: Council Voting (r:0 w:1)
fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight {
(22_204_000 as Weight)
Weight::from_ref_time(22_204_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((8_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(8_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((49_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(49_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((180_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))
.saturating_add(Weight::from_ref_time(180_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council Voting (r:1 w:1)
fn vote(m: u32, ) -> Weight {
(30_941_000 as Weight)
Weight::from_ref_time(30_941_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((77_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))
.saturating_add(Weight::from_ref_time(77_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Council Voting (r:1 w:1)
// Storage: Council Members (r:1 w:0)
// Storage: Council Proposals (r:1 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn close_early_disapproved(m: u32, p: u32, ) -> Weight {
(32_485_000 as Weight)
Weight::from_ref_time(32_485_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((39_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(39_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((124_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))
.saturating_add(Weight::from_ref_time(124_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Council Voting (r:1 w:1)
// Storage: Council Members (r:1 w:0)
// Storage: Council ProposalOf (r:1 w:1)
// Storage: Council Proposals (r:1 w:1)
fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight {
(33_487_000 as Weight)
Weight::from_ref_time(33_487_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(5_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((66_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(66_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((157_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))
.saturating_add(Weight::from_ref_time(157_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Council Voting (r:1 w:1)
// Storage: Council Members (r:1 w:0)
@@ -154,13 +154,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council Proposals (r:1 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn close_disapproved(m: u32, p: u32, ) -> Weight {
(33_494_000 as Weight)
Weight::from_ref_time(33_494_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((58_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(58_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((124_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))
.saturating_add(Weight::from_ref_time(124_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Council Voting (r:1 w:1)
// Storage: Council Members (r:1 w:0)
@@ -168,25 +168,25 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council ProposalOf (r:1 w:1)
// Storage: Council Proposals (r:1 w:1)
fn close_approved(b: u32, m: u32, p: u32, ) -> Weight {
(36_566_000 as Weight)
Weight::from_ref_time(36_566_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(5_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((63_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(63_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((158_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))
.saturating_add(Weight::from_ref_time(158_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Council Proposals (r:1 w:1)
// Storage: Council Voting (r:0 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn disapprove_proposal(p: u32, ) -> Weight {
(20_159_000 as Weight)
Weight::from_ref_time(20_159_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((173_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))
.saturating_add(Weight::from_ref_time(173_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
}
@@ -197,36 +197,36 @@ impl WeightInfo for () {
// Storage: Council Voting (r:100 w:100)
// Storage: Council Prime (r:0 w:1)
fn set_members(m: u32, n: u32, p: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 12_000
.saturating_add((10_280_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(10_280_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 12_000
.saturating_add((126_000 as Weight).saturating_mul(n as Weight))
.saturating_add(Weight::from_ref_time(126_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
// Standard Error: 12_000
.saturating_add((13_310_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)))
.saturating_add(Weight::from_ref_time(13_310_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(p as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(p as RefTimeWeight)))
}
// Storage: Council Members (r:1 w:0)
fn execute(b: u32, m: u32, ) -> Weight {
(16_819_000 as Weight)
Weight::from_ref_time(16_819_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 0
.saturating_add((33_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(Weight::from_ref_time(33_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council ProposalOf (r:1 w:0)
fn propose_execute(b: u32, m: u32, ) -> Weight {
(18_849_000 as Weight)
Weight::from_ref_time(18_849_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 0
.saturating_add((56_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(Weight::from_ref_time(56_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council ProposalOf (r:1 w:1)
@@ -234,52 +234,52 @@ impl WeightInfo for () {
// Storage: Council ProposalCount (r:1 w:1)
// Storage: Council Voting (r:0 w:1)
fn propose_proposed(b: u32, m: u32, p: u32, ) -> Weight {
(22_204_000 as Weight)
Weight::from_ref_time(22_204_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((8_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(8_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((49_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(49_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((180_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(Weight::from_ref_time(180_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Council Members (r:1 w:0)
// Storage: Council Voting (r:1 w:1)
fn vote(m: u32, ) -> Weight {
(30_941_000 as Weight)
Weight::from_ref_time(30_941_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((77_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(77_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Council Voting (r:1 w:1)
// Storage: Council Members (r:1 w:0)
// Storage: Council Proposals (r:1 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn close_early_disapproved(m: u32, p: u32, ) -> Weight {
(32_485_000 as Weight)
Weight::from_ref_time(32_485_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((39_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(39_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((124_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(124_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Council Voting (r:1 w:1)
// Storage: Council Members (r:1 w:0)
// Storage: Council ProposalOf (r:1 w:1)
// Storage: Council Proposals (r:1 w:1)
fn close_early_approved(b: u32, m: u32, p: u32, ) -> Weight {
(33_487_000 as Weight)
Weight::from_ref_time(33_487_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(5_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((66_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(66_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((157_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(157_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Council Voting (r:1 w:1)
// Storage: Council Members (r:1 w:0)
@@ -287,13 +287,13 @@ impl WeightInfo for () {
// Storage: Council Proposals (r:1 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn close_disapproved(m: u32, p: u32, ) -> Weight {
(33_494_000 as Weight)
Weight::from_ref_time(33_494_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((58_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(58_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((124_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(124_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Council Voting (r:1 w:1)
// Storage: Council Members (r:1 w:0)
@@ -301,24 +301,24 @@ impl WeightInfo for () {
// Storage: Council ProposalOf (r:1 w:1)
// Storage: Council Proposals (r:1 w:1)
fn close_approved(b: u32, m: u32, p: u32, ) -> Weight {
(36_566_000 as Weight)
Weight::from_ref_time(36_566_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((5_000 as Weight).saturating_mul(b as Weight))
.saturating_add(Weight::from_ref_time(5_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((63_000 as Weight).saturating_mul(m as Weight))
.saturating_add(Weight::from_ref_time(63_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((158_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(158_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Council Proposals (r:1 w:1)
// Storage: Council Voting (r:0 w:1)
// Storage: Council ProposalOf (r:0 w:1)
fn disapprove_proposal(p: u32, ) -> Weight {
(20_159_000 as Weight)
Weight::from_ref_time(20_159_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((173_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(173_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
}
+2 -2
View File
@@ -229,7 +229,7 @@ where
call_request;
let value: Balance = decode_hex(value, "balance")?;
let gas_limit: Weight = decode_hex(gas_limit, "weight")?;
let gas_limit: u64 = decode_hex(gas_limit, "weight")?;
let storage_deposit_limit: Option<Balance> =
storage_deposit_limit.map(|l| decode_hex(l, "balance")).transpose()?;
limit_gas(gas_limit)?;
@@ -259,7 +259,7 @@ where
} = instantiate_request;
let value: Balance = decode_hex(value, "balance")?;
let gas_limit: Weight = decode_hex(gas_limit, "weight")?;
let gas_limit: u64 = decode_hex(gas_limit, "weight")?;
let storage_deposit_limit: Option<Balance> =
storage_deposit_limit.map(|l| decode_hex(l, "balance")).transpose()?;
limit_gas(gas_limit)?;
@@ -2853,8 +2853,8 @@ benchmarks! {
println!("{:#?}", Schedule::<T>::default());
println!("###############################################");
println!("Lazy deletion throughput per block (empty queue, full queue): {}, {}",
weight_limit / weight_per_key,
(weight_limit - weight_per_queue_item * queue_depth) / weight_per_key,
weight_limit / weight_per_key.ref_time(),
(weight_limit - weight_per_queue_item * queue_depth) / weight_per_key.ref_time(),
);
}
#[cfg(not(feature = "std"))]
@@ -238,7 +238,7 @@ where
///
/// Weight is synonymous with gas in substrate.
pub fn charge_weight(&mut self, amount: Weight) -> Result<ChargedAmount> {
self.inner.runtime.charge_gas(RuntimeCosts::ChainExtension(amount))
self.inner.runtime.charge_gas(RuntimeCosts::ChainExtension(amount.ref_time()))
}
/// Adjust a previously charged amount down to its actual amount.
@@ -248,7 +248,7 @@ where
pub fn adjust_weight(&mut self, charged: ChargedAmount, actual_weight: Weight) {
self.inner
.runtime
.adjust_gas(charged, RuntimeCosts::ChainExtension(actual_weight))
.adjust_gas(charged, RuntimeCosts::ChainExtension(actual_weight.ref_time()))
}
/// Grants access to the execution environment of the current contract call.
@@ -411,7 +411,8 @@ where
buffer,
allow_skip,
|len| {
weight_per_byte.map(|w| RuntimeCosts::ChainExtension(w.saturating_mul(len.into())))
weight_per_byte
.map(|w| RuntimeCosts::ChainExtension(w.ref_time().saturating_mul(len.into())))
},
)
}
+29 -17
View File
@@ -664,7 +664,7 @@ where
debug_message: Option<&'a mut Vec<u8>>,
) -> Result<(Self, E), ExecError> {
let (first_frame, executable, nonce) =
Self::new_frame(args, value, gas_meter, storage_meter, 0, schedule)?;
Self::new_frame(args, value, gas_meter, storage_meter, Weight::zero(), schedule)?;
let stack = Self {
origin,
schedule,
@@ -1089,7 +1089,7 @@ where
delegated_call: Some(DelegatedCall { executable, caller: self.caller().clone() }),
},
value,
0,
Weight::zero(),
)?;
self.run(executable, input_data)
}
@@ -1825,7 +1825,7 @@ mod tests {
let value = Default::default();
let recurse_ch = MockLoader::insert(Call, |ctx, _| {
// Try to call into yourself.
let r = ctx.ext.call(0, BOB, 0, vec![], true);
let r = ctx.ext.call(Weight::zero(), BOB, 0, vec![], true);
REACHED_BOTTOM.with(|reached_bottom| {
let mut reached_bottom = reached_bottom.borrow_mut();
@@ -1880,7 +1880,7 @@ mod tests {
.with(|caller| *caller.borrow_mut() = Some(ctx.ext.caller().clone()));
// Call into CHARLIE contract.
assert_matches!(ctx.ext.call(0, CHARLIE, 0, vec![], true), Ok(_));
assert_matches!(ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], true), Ok(_));
exec_success()
});
let charlie_ch = MockLoader::insert(Call, |ctx, _| {
@@ -2011,7 +2011,7 @@ mod tests {
// ALICE is the origin of the call stack
assert!(ctx.ext.caller_is_origin());
// BOB calls CHARLIE
ctx.ext.call(0, CHARLIE, 0, vec![], true)
ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], true)
});
ExtBuilder::default().build().execute_with(|| {
@@ -2041,7 +2041,7 @@ mod tests {
assert_eq!(*ctx.ext.address(), BOB);
// Call into charlie contract.
assert_matches!(ctx.ext.call(0, CHARLIE, 0, vec![], true), Ok(_));
assert_matches!(ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], true), Ok(_));
exec_success()
});
let charlie_ch = MockLoader::insert(Call, |ctx, _| {
@@ -2190,7 +2190,7 @@ mod tests {
let (address, output) = ctx
.ext
.instantiate(
0,
Weight::zero(),
dummy_ch,
<Test as Config>::Currency::minimum_balance(),
vec![],
@@ -2250,7 +2250,7 @@ mod tests {
// Instantiate a contract and save it's address in `instantiated_contract_address`.
assert_matches!(
ctx.ext.instantiate(
0,
Weight::zero(),
dummy_ch,
<Test as Config>::Currency::minimum_balance(),
vec![],
@@ -2342,13 +2342,13 @@ mod tests {
let info = ctx.ext.contract_info();
assert_eq!(info.storage_deposit, 0);
info.storage_deposit = 42;
assert_eq!(ctx.ext.call(0, CHARLIE, 0, vec![], true), exec_trapped());
assert_eq!(ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], true), exec_trapped());
assert_eq!(ctx.ext.contract_info().storage_deposit, 42);
}
exec_success()
});
let code_charlie = MockLoader::insert(Call, |ctx, _| {
assert!(ctx.ext.call(0, BOB, 0, vec![99], true).is_ok());
assert!(ctx.ext.call(Weight::zero(), BOB, 0, vec![99], true).is_ok());
exec_trapped()
});
@@ -2377,7 +2377,7 @@ mod tests {
fn recursive_call_during_constructor_fails() {
let code = MockLoader::insert(Constructor, |ctx, _| {
assert_matches!(
ctx.ext.call(0, ctx.ext.address().clone(), 0, vec![], true),
ctx.ext.call(Weight::zero(), ctx.ext.address().clone(), 0, vec![], true),
Err(ExecError{error, ..}) if error == <Error<Test>>::ContractNotFound.into()
);
exec_success()
@@ -2479,7 +2479,7 @@ mod tests {
// call the contract passed as input with disabled reentry
let code_bob = MockLoader::insert(Call, |ctx, _| {
let dest = Decode::decode(&mut ctx.input_data.as_ref()).unwrap();
ctx.ext.call(0, dest, 0, vec![], false)
ctx.ext.call(Weight::zero(), dest, 0, vec![], false)
});
let code_charlie = MockLoader::insert(Call, |_, _| exec_success());
@@ -2524,7 +2524,7 @@ mod tests {
fn call_deny_reentry() {
let code_bob = MockLoader::insert(Call, |ctx, _| {
if ctx.input_data[0] == 0 {
ctx.ext.call(0, CHARLIE, 0, vec![], false)
ctx.ext.call(Weight::zero(), CHARLIE, 0, vec![], false)
} else {
exec_success()
}
@@ -2532,7 +2532,7 @@ mod tests {
// call BOB with input set to '1'
let code_charlie =
MockLoader::insert(Call, |ctx, _| ctx.ext.call(0, BOB, 0, vec![1], true));
MockLoader::insert(Call, |ctx, _| ctx.ext.call(Weight::zero(), BOB, 0, vec![1], true));
ExtBuilder::default().build().execute_with(|| {
let schedule = <Test as Config>::Schedule::get();
@@ -2695,18 +2695,30 @@ mod tests {
let success_code = MockLoader::insert(Constructor, |_, _| exec_success());
let succ_fail_code = MockLoader::insert(Constructor, move |ctx, _| {
ctx.ext
.instantiate(0, fail_code, ctx.ext.minimum_balance() * 100, vec![], &[])
.instantiate(
Weight::zero(),
fail_code,
ctx.ext.minimum_balance() * 100,
vec![],
&[],
)
.ok();
exec_success()
});
let succ_succ_code = MockLoader::insert(Constructor, move |ctx, _| {
let (account_id, _) = ctx
.ext
.instantiate(0, success_code, ctx.ext.minimum_balance() * 100, vec![], &[])
.instantiate(
Weight::zero(),
success_code,
ctx.ext.minimum_balance() * 100,
vec![],
&[],
)
.unwrap();
// a plain call should not influence the account counter
ctx.ext.call(0, account_id, 0, vec![], false).unwrap();
ctx.ext.call(Weight::zero(), account_id, 0, vec![], false).unwrap();
exec_success()
});
+12 -12
View File
@@ -107,7 +107,7 @@ where
///
/// Passing `0` as amount is interpreted as "all remaining gas".
pub fn nested(&mut self, amount: Weight) -> Result<Self, DispatchError> {
let amount = if amount == 0 { self.gas_left } else { amount };
let amount = if amount == Weight::zero() { self.gas_left } else { amount };
// NOTE that it is ok to allocate all available gas since it still ensured
// by `charge` that it doesn't reach zero.
@@ -121,7 +121,7 @@ where
/// Absorb the remaining gas of a nested meter after we are done using it.
pub fn absorb_nested(&mut self, nested: Self) {
if self.gas_left == 0 {
if self.gas_left == Weight::zero() {
// All of the remaining gas was inherited by the nested gas meter. When absorbing
// we can therefore safely inherit the lowest gas that the nested gas meter experienced
// as long as it is lower than the lowest gas that was experienced by the parent.
@@ -157,7 +157,7 @@ where
}
let amount = token.weight();
let new_value = self.gas_left.checked_sub(amount);
let new_value = self.gas_left.checked_sub(&amount);
// We always consume the gas even if there is not enough gas.
self.gas_left = new_value.unwrap_or_else(Zero::zero);
@@ -227,7 +227,7 @@ where
#[cfg(test)]
mod tests {
use super::{GasMeter, Token};
use super::{GasMeter, Token, Weight};
use crate::tests::Test;
/// A simple utility macro that helps to match against a
@@ -271,20 +271,20 @@ mod tests {
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
struct SimpleToken(u64);
impl Token<Test> for SimpleToken {
fn weight(&self) -> u64 {
self.0
fn weight(&self) -> Weight {
Weight::from_ref_time(self.0)
}
}
#[test]
fn it_works() {
let gas_meter = GasMeter::<Test>::new(50000);
assert_eq!(gas_meter.gas_left(), 50000);
let gas_meter = GasMeter::<Test>::new(Weight::from_ref_time(50000));
assert_eq!(gas_meter.gas_left(), Weight::from_ref_time(50000));
}
#[test]
fn tracing() {
let mut gas_meter = GasMeter::<Test>::new(50000);
let mut gas_meter = GasMeter::<Test>::new(Weight::from_ref_time(50000));
assert!(!gas_meter.charge(SimpleToken(1)).is_err());
let mut tokens = gas_meter.tokens().iter();
@@ -294,7 +294,7 @@ mod tests {
// This test makes sure that nothing can be executed if there is no gas.
#[test]
fn refuse_to_execute_anything_if_zero() {
let mut gas_meter = GasMeter::<Test>::new(0);
let mut gas_meter = GasMeter::<Test>::new(Weight::zero());
assert!(gas_meter.charge(SimpleToken(1)).is_err());
}
@@ -305,7 +305,7 @@ mod tests {
// if the gas meter runs out of gas. However, this is just a nice property to have.
#[test]
fn overcharge_is_unrecoverable() {
let mut gas_meter = GasMeter::<Test>::new(200);
let mut gas_meter = GasMeter::<Test>::new(Weight::from_ref_time(200));
// The first charge is should lead to OOG.
assert!(gas_meter.charge(SimpleToken(300)).is_err());
@@ -318,7 +318,7 @@ mod tests {
// possible.
#[test]
fn charge_exact_amount() {
let mut gas_meter = GasMeter::<Test>::new(25);
let mut gas_meter = GasMeter::<Test>::new(Weight::from_ref_time(25));
assert!(!gas_meter.charge(SimpleToken(25)).is_err());
}
}
+6 -6
View File
@@ -110,7 +110,7 @@ use frame_support::{
dispatch::Dispatchable,
ensure,
traits::{ConstU32, Contains, Currency, Get, Randomness, ReservableCurrency, Time},
weights::{DispatchClass, GetDispatchInfo, Pays, PostDispatchInfo, Weight},
weights::{DispatchClass, GetDispatchInfo, Pays, PostDispatchInfo, RefTimeWeight, Weight},
BoundedVec,
};
use frame_system::{limits::BlockWeights, Pallet as System};
@@ -214,7 +214,7 @@ impl<B: Get<BlockWeights>, const P: u32> Get<Weight> for DefaultContractAccessWe
.get(DispatchClass::Normal)
.max_total
.unwrap_or(block_weights.max_block) /
Weight::from(P)
RefTimeWeight::from(P)
}
}
@@ -873,8 +873,8 @@ where
);
ContractExecResult {
result: output.result.map_err(|r| r.error),
gas_consumed: output.gas_meter.gas_consumed(),
gas_required: output.gas_meter.gas_required(),
gas_consumed: output.gas_meter.gas_consumed().ref_time(),
gas_required: output.gas_meter.gas_required().ref_time(),
storage_deposit: output.storage_deposit,
debug_message: debug_message.unwrap_or_default(),
}
@@ -918,8 +918,8 @@ where
.result
.map(|(account_id, result)| InstantiateReturnValue { result, account_id })
.map_err(|e| e.error),
gas_consumed: output.gas_meter.gas_consumed(),
gas_required: output.gas_meter.gas_required(),
gas_consumed: output.gas_meter.gas_consumed().ref_time(),
gas_required: output.gas_meter.gas_required().ref_time(),
storage_deposit: output.storage_deposit,
debug_message: debug_message.unwrap_or_default(),
}
+3 -3
View File
@@ -26,7 +26,7 @@ use sp_std::{marker::PhantomData, prelude::*};
/// Wrapper for all migrations of this pallet, based on `StorageVersion`.
pub fn migrate<T: Config>() -> Weight {
let version = StorageVersion::get::<Pallet<T>>();
let mut weight: Weight = 0;
let mut weight = Weight::new();
if version < 4 {
weight = weight.saturating_add(v4::migrate::<T>());
@@ -127,7 +127,7 @@ mod v5 {
type DeletionQueue<T: Config> = StorageValue<Pallet<T>, Vec<DeletedContract>>;
pub fn migrate<T: Config>() -> Weight {
let mut weight: Weight = 0;
let mut weight = Weight::new();
<ContractInfoOf<T>>::translate(|_key, old: OldContractInfo<T>| {
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
@@ -216,7 +216,7 @@ mod v6 {
type OwnerInfoOf<T: Config> = StorageMap<Pallet<T>, Identity, CodeHash<T>, OwnerInfo<T>>;
pub fn migrate<T: Config>() -> Weight {
let mut weight: Weight = 0;
let mut weight = Weight::new();
<ContractInfoOf<T>>::translate(|_key, old: OldContractInfo<T>| {
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 1));
+58 -58
View File
@@ -21,7 +21,7 @@
use crate::{weights::WeightInfo, Config};
use codec::{Decode, Encode};
use frame_support::{weights::Weight, DefaultNoBound};
use frame_support::{weights::RefTimeWeight, DefaultNoBound};
use pallet_contracts_proc_macro::{ScheduleDebug, WeightDebug};
use scale_info::TypeInfo;
#[cfg(feature = "std")]
@@ -255,166 +255,166 @@ pub struct InstructionWeights<T: Config> {
#[scale_info(skip_type_params(T))]
pub struct HostFnWeights<T: Config> {
/// Weight of calling `seal_caller`.
pub caller: Weight,
pub caller: RefTimeWeight,
/// Weight of calling `seal_is_contract`.
pub is_contract: Weight,
pub is_contract: RefTimeWeight,
/// Weight of calling `seal_code_hash`.
pub code_hash: Weight,
pub code_hash: RefTimeWeight,
/// Weight of calling `seal_own_code_hash`.
pub own_code_hash: Weight,
pub own_code_hash: RefTimeWeight,
/// Weight of calling `seal_caller_is_origin`.
pub caller_is_origin: Weight,
pub caller_is_origin: RefTimeWeight,
/// Weight of calling `seal_address`.
pub address: Weight,
pub address: RefTimeWeight,
/// Weight of calling `seal_gas_left`.
pub gas_left: Weight,
pub gas_left: RefTimeWeight,
/// Weight of calling `seal_balance`.
pub balance: Weight,
pub balance: RefTimeWeight,
/// Weight of calling `seal_value_transferred`.
pub value_transferred: Weight,
pub value_transferred: RefTimeWeight,
/// Weight of calling `seal_minimum_balance`.
pub minimum_balance: Weight,
pub minimum_balance: RefTimeWeight,
/// Weight of calling `seal_block_number`.
pub block_number: Weight,
pub block_number: RefTimeWeight,
/// Weight of calling `seal_now`.
pub now: Weight,
pub now: RefTimeWeight,
/// Weight of calling `seal_weight_to_fee`.
pub weight_to_fee: Weight,
pub weight_to_fee: RefTimeWeight,
/// Weight of calling `gas`.
pub gas: Weight,
pub gas: RefTimeWeight,
/// Weight of calling `seal_input`.
pub input: Weight,
pub input: RefTimeWeight,
/// Weight per input byte copied to contract memory by `seal_input`.
pub input_per_byte: Weight,
pub input_per_byte: RefTimeWeight,
/// Weight of calling `seal_return`.
pub r#return: Weight,
pub r#return: RefTimeWeight,
/// Weight per byte returned through `seal_return`.
pub return_per_byte: Weight,
pub return_per_byte: RefTimeWeight,
/// Weight of calling `seal_terminate`.
pub terminate: Weight,
pub terminate: RefTimeWeight,
/// Weight of calling `seal_random`.
pub random: Weight,
pub random: RefTimeWeight,
/// Weight of calling `seal_reposit_event`.
pub deposit_event: Weight,
pub deposit_event: RefTimeWeight,
/// Weight per topic supplied to `seal_deposit_event`.
pub deposit_event_per_topic: Weight,
pub deposit_event_per_topic: RefTimeWeight,
/// Weight per byte of an event deposited through `seal_deposit_event`.
pub deposit_event_per_byte: Weight,
pub deposit_event_per_byte: RefTimeWeight,
/// Weight of calling `seal_debug_message`.
pub debug_message: Weight,
pub debug_message: RefTimeWeight,
/// Weight of calling `seal_set_storage`.
pub set_storage: Weight,
pub set_storage: RefTimeWeight,
/// Weight per written byten of an item stored with `seal_set_storage`.
pub set_storage_per_new_byte: Weight,
pub set_storage_per_new_byte: RefTimeWeight,
/// Weight per overwritten byte of an item stored with `seal_set_storage`.
pub set_storage_per_old_byte: Weight,
pub set_storage_per_old_byte: RefTimeWeight,
/// Weight of calling `seal_set_code_hash`.
pub set_code_hash: Weight,
pub set_code_hash: RefTimeWeight,
/// Weight of calling `seal_clear_storage`.
pub clear_storage: Weight,
pub clear_storage: RefTimeWeight,
/// Weight of calling `seal_clear_storage` per byte of the stored item.
pub clear_storage_per_byte: Weight,
pub clear_storage_per_byte: RefTimeWeight,
/// Weight of calling `seal_contains_storage`.
pub contains_storage: Weight,
pub contains_storage: RefTimeWeight,
/// Weight of calling `seal_contains_storage` per byte of the stored item.
pub contains_storage_per_byte: Weight,
pub contains_storage_per_byte: RefTimeWeight,
/// Weight of calling `seal_get_storage`.
pub get_storage: Weight,
pub get_storage: RefTimeWeight,
/// Weight per byte of an item received via `seal_get_storage`.
pub get_storage_per_byte: Weight,
pub get_storage_per_byte: RefTimeWeight,
/// Weight of calling `seal_take_storage`.
pub take_storage: Weight,
pub take_storage: RefTimeWeight,
/// Weight per byte of an item received via `seal_take_storage`.
pub take_storage_per_byte: Weight,
pub take_storage_per_byte: RefTimeWeight,
/// Weight of calling `seal_transfer`.
pub transfer: Weight,
pub transfer: RefTimeWeight,
/// Weight of calling `seal_call`.
pub call: Weight,
pub call: RefTimeWeight,
/// Weight of calling `seal_delegate_call`.
pub delegate_call: Weight,
pub delegate_call: RefTimeWeight,
/// Weight surcharge that is claimed if `seal_call` does a balance transfer.
pub call_transfer_surcharge: Weight,
pub call_transfer_surcharge: RefTimeWeight,
/// Weight per byte that is cloned by supplying the `CLONE_INPUT` flag.
pub call_per_cloned_byte: Weight,
pub call_per_cloned_byte: RefTimeWeight,
/// Weight of calling `seal_instantiate`.
pub instantiate: Weight,
pub instantiate: RefTimeWeight,
/// Weight surcharge that is claimed if `seal_instantiate` does a balance transfer.
pub instantiate_transfer_surcharge: Weight,
pub instantiate_transfer_surcharge: RefTimeWeight,
/// Weight per salt byte supplied to `seal_instantiate`.
pub instantiate_per_salt_byte: Weight,
pub instantiate_per_salt_byte: RefTimeWeight,
/// Weight of calling `seal_hash_sha_256`.
pub hash_sha2_256: Weight,
pub hash_sha2_256: RefTimeWeight,
/// Weight per byte hashed by `seal_hash_sha_256`.
pub hash_sha2_256_per_byte: Weight,
pub hash_sha2_256_per_byte: RefTimeWeight,
/// Weight of calling `seal_hash_keccak_256`.
pub hash_keccak_256: Weight,
pub hash_keccak_256: RefTimeWeight,
/// Weight per byte hashed by `seal_hash_keccak_256`.
pub hash_keccak_256_per_byte: Weight,
pub hash_keccak_256_per_byte: RefTimeWeight,
/// Weight of calling `seal_hash_blake2_256`.
pub hash_blake2_256: Weight,
pub hash_blake2_256: RefTimeWeight,
/// Weight per byte hashed by `seal_hash_blake2_256`.
pub hash_blake2_256_per_byte: Weight,
pub hash_blake2_256_per_byte: RefTimeWeight,
/// Weight of calling `seal_hash_blake2_128`.
pub hash_blake2_128: Weight,
pub hash_blake2_128: RefTimeWeight,
/// Weight per byte hashed by `seal_hash_blake2_128`.
pub hash_blake2_128_per_byte: Weight,
pub hash_blake2_128_per_byte: RefTimeWeight,
/// Weight of calling `seal_ecdsa_recover`.
pub ecdsa_recover: Weight,
pub ecdsa_recover: RefTimeWeight,
/// Weight of calling `seal_ecdsa_to_eth_address`.
pub ecdsa_to_eth_address: Weight,
pub ecdsa_to_eth_address: RefTimeWeight,
/// The type parameter is used in the default implementation.
#[codec(skip)]
@@ -435,19 +435,19 @@ macro_rules! call_zero {
macro_rules! cost_args {
($name:ident, $( $arg: expr ),+) => {
(T::WeightInfo::$name($( $arg ),+).saturating_sub(call_zero!($name, $( $arg ),+)))
(T::WeightInfo::$name($( $arg ),+).saturating_sub(call_zero!($name, $( $arg ),+))).ref_time()
}
}
macro_rules! cost_batched_args {
($name:ident, $( $arg: expr ),+) => {
cost_args!($name, $( $arg ),+) / Weight::from(API_BENCHMARK_BATCH_SIZE)
cost_args!($name, $( $arg ),+) / RefTimeWeight::from(API_BENCHMARK_BATCH_SIZE)
}
}
macro_rules! cost_instr_no_params_with_batch_size {
($name:ident, $batch_size:expr) => {
(cost_args!($name, 1) / Weight::from($batch_size)) as u32
(cost_args!($name, 1) / RefTimeWeight::from($batch_size)) as u32
};
}
+13 -7
View File
@@ -28,7 +28,7 @@ use codec::{Decode, Encode, MaxEncodedLen};
use frame_support::{
dispatch::{DispatchError, DispatchResult},
storage::child::{self, ChildInfo},
weights::Weight,
weights::{RefTimeWeight, Weight},
};
use scale_info::TypeInfo;
use sp_core::crypto::UncheckedFrom;
@@ -227,9 +227,11 @@ where
let base_weight = T::WeightInfo::on_process_deletion_queue_batch();
let weight_per_queue_item = T::WeightInfo::on_initialize_per_queue_item(1) -
T::WeightInfo::on_initialize_per_queue_item(0);
let weight_per_key = T::WeightInfo::on_initialize_per_trie_key(1) -
T::WeightInfo::on_initialize_per_trie_key(0);
let decoding_weight = weight_per_queue_item.saturating_mul(queue_len as Weight);
let weight_per_key = (T::WeightInfo::on_initialize_per_trie_key(1) -
T::WeightInfo::on_initialize_per_trie_key(0))
.ref_time();
let decoding_weight =
weight_per_queue_item.scalar_saturating_mul(queue_len as RefTimeWeight);
// `weight_per_key` being zero makes no sense and would constitute a failure to
// benchmark properly. We opt for not removing any keys at all in this case.
@@ -237,7 +239,8 @@ where
.saturating_sub(base_weight)
.saturating_sub(decoding_weight)
.checked_div(weight_per_key)
.unwrap_or(0) as u32;
.unwrap_or(Weight::zero())
.ref_time() as u32;
(weight_per_key, key_budget)
}
@@ -248,7 +251,7 @@ where
pub fn process_deletion_queue_batch(weight_limit: Weight) -> Weight {
let queue_len = <DeletionQueue<T>>::decode_len().unwrap_or(0);
if queue_len == 0 {
return 0
return Weight::zero()
}
let (weight_per_key, mut remaining_key_budget) =
@@ -282,7 +285,10 @@ where
}
<DeletionQueue<T>>::put(queue);
weight_limit.saturating_sub(weight_per_key.saturating_mul(remaining_key_budget as Weight))
let ref_time_weight = weight_limit
.ref_time()
.saturating_sub(weight_per_key.saturating_mul(remaining_key_budget as RefTimeWeight));
Weight::from_ref_time(ref_time_weight)
}
/// Generates a unique trie id by returning `hash(account_id ++ nonce)`.
+19 -15
View File
@@ -175,7 +175,7 @@ impl ChainExtension<Test> for TestExtension {
},
0x8002 => {
let mut env = env.buf_in_buf_out();
let weight = env.read(5)?[4].into();
let weight = Weight::from_ref_time(env.read(5)?[4].into());
env.charge_weight(weight)?;
Ok(RetVal::Converging(id))
},
@@ -332,7 +332,7 @@ parameter_types! {
impl Convert<Weight, BalanceOf<Self>> for Test {
fn convert(w: Weight) -> BalanceOf<Self> {
w
w.ref_time()
}
}
@@ -355,6 +355,10 @@ impl Contains<Call> for TestFilter {
}
}
parameter_types! {
pub const DeletionWeightLimit: Weight = Weight::from_ref_time(500_000_000_000);
}
impl Config for Test {
type Time = Timestamp;
type Randomness = Randomness;
@@ -368,7 +372,7 @@ impl Config for Test {
type ChainExtension =
(TestExtension, DisabledExtension, RevertingExtension, TempStorageExtension);
type DeletionQueueDepth = ConstU32<1024>;
type DeletionWeightLimit = ConstU64<500_000_000_000>;
type DeletionWeightLimit = DeletionWeightLimit;
type Schedule = MySchedule;
type DepositPerByte = DepositPerByte;
type DepositPerItem = DepositPerItem;
@@ -384,7 +388,7 @@ pub const BOB: AccountId32 = AccountId32::new([2u8; 32]);
pub const CHARLIE: AccountId32 = AccountId32::new([3u8; 32]);
pub const DJANGO: AccountId32 = AccountId32::new([4u8; 32]);
pub const GAS_LIMIT: Weight = 100_000_000_000;
pub const GAS_LIMIT: Weight = Weight::from_ref_time(100_000_000_000);
pub struct ExtBuilder {
existential_deposit: u64,
@@ -642,7 +646,7 @@ fn run_out_of_gas() {
Origin::signed(ALICE),
addr, // newly created account
0,
1_000_000_000_000,
Weight::from_ref_time(1_000_000_000_000),
None,
vec![],
),
@@ -1826,7 +1830,7 @@ fn lazy_removal_works() {
assert_matches!(child::get(trie, &[99]), Some(42));
// Run the lazy removal
Contracts::on_idle(System::block_number(), Weight::max_value());
Contracts::on_idle(System::block_number(), Weight::MAX);
// Value should be gone now
assert_matches!(child::get::<i32>(trie, &[99]), None);
@@ -1896,7 +1900,7 @@ fn lazy_batch_removal_works() {
}
// Run single lazy removal
Contracts::on_idle(System::block_number(), Weight::max_value());
Contracts::on_idle(System::block_number(), Weight::MAX);
// The single lazy removal should have removed all queued tries
for trie in tries.iter() {
@@ -1911,7 +1915,7 @@ fn lazy_removal_partial_remove_works() {
// We create a contract with some extra keys above the weight limit
let extra_keys = 7u32;
let weight_limit = 5_000_000_000;
let weight_limit = Weight::from_ref_time(5_000_000_000);
let (_, max_keys) = Storage::<Test>::deletion_budget(1, weight_limit);
let vals: Vec<_> = (0..max_keys + extra_keys)
.map(|i| (blake2_256(&i.encode()), (i as u32), (i as u32).encode()))
@@ -2085,7 +2089,7 @@ fn lazy_removal_does_no_run_on_low_remaining_weight() {
assert_matches!(child::get::<i32>(trie, &[99]), Some(42));
// Run on_idle with max remaining weight, this should remove the value
Contracts::on_idle(System::block_number(), Weight::max_value());
Contracts::on_idle(System::block_number(), Weight::MAX);
// Value should be gone
assert_matches!(child::get::<i32>(trie, &[99]), None);
@@ -2096,7 +2100,7 @@ fn lazy_removal_does_no_run_on_low_remaining_weight() {
fn lazy_removal_does_not_use_all_weight() {
let (code, hash) = compile_module::<Test>("self_destruct").unwrap();
let weight_limit = 5_000_000_000;
let weight_limit = Weight::from_ref_time(5_000_000_000);
let mut ext = ExtBuilder::default().existential_deposit(50).build();
let (trie, vals, weight_per_key) = ext.execute_with(|| {
@@ -2167,7 +2171,7 @@ fn lazy_removal_does_not_use_all_weight() {
let weight_used = Storage::<Test>::process_deletion_queue_batch(weight_limit);
// We have one less key in our trie than our weight limit suffices for
assert_eq!(weight_used, weight_limit - weight_per_key);
assert_eq!(weight_used, weight_limit - Weight::from_ref_time(weight_per_key));
// All the keys are removed
for val in vals {
@@ -2322,7 +2326,7 @@ fn reinstrument_does_charge() {
assert!(result2.gas_consumed > result1.gas_consumed);
assert_eq!(
result2.gas_consumed,
result1.gas_consumed + <Test as Config>::WeightInfo::reinstrument(code_len),
result1.gas_consumed + <Test as Config>::WeightInfo::reinstrument(code_len).ref_time(),
);
});
}
@@ -2430,7 +2434,7 @@ fn gas_estimation_nested_call_fixed_limit() {
let input: Vec<u8> = AsRef::<[u8]>::as_ref(&addr_callee)
.iter()
.cloned()
.chain((GAS_LIMIT / 5).to_le_bytes())
.chain((GAS_LIMIT / 5).ref_time().to_le_bytes())
.collect();
// Call in order to determine the gas that is required for this call
@@ -2454,7 +2458,7 @@ fn gas_estimation_nested_call_fixed_limit() {
ALICE,
addr_caller,
0,
result.gas_required,
Weight::from_ref_time(result.gas_required),
Some(result.storage_deposit.charge_or_zero()),
input,
false,
@@ -2524,7 +2528,7 @@ fn gas_estimation_call_runtime() {
ALICE,
addr_caller,
0,
result.gas_required,
Weight::from_ref_time(result.gas_required),
None,
call.encode(),
false,
@@ -218,14 +218,16 @@ impl<T: Config> Token<T> for CodeToken {
// contract code. This is why we subtract `T::*::(0)`. We need to do this at this
// point because when charging the general weight for calling the contract we not know the
// size of the contract.
match *self {
let ref_time_weight = match *self {
Reinstrument(len) => T::WeightInfo::reinstrument(len),
Load(len) => {
let computation = T::WeightInfo::call_with_code_per_byte(len)
.saturating_sub(T::WeightInfo::call_with_code_per_byte(0));
let bandwidth = T::ContractAccessWeight::get().saturating_mul(len.into());
let bandwidth = T::ContractAccessWeight::get().scalar_saturating_mul(len as u64);
computation.max(bandwidth)
},
}
};
ref_time_weight
}
}
+4 -4
View File
@@ -365,7 +365,7 @@ mod tests {
events: Default::default(),
runtime_calls: Default::default(),
schedule: Default::default(),
gas_meter: GasMeter::new(10_000_000_000),
gas_meter: GasMeter::new(Weight::from_ref_time(10_000_000_000)),
debug_buffer: Default::default(),
ecdsa_recover: Default::default(),
}
@@ -406,7 +406,7 @@ mod tests {
code_hash,
value,
data: data.to_vec(),
gas_left: gas_limit,
gas_left: gas_limit.ref_time(),
salt: salt.to_vec(),
});
Ok((
@@ -520,7 +520,7 @@ mod tests {
16_384
}
fn get_weight_price(&self, weight: Weight) -> BalanceOf<Self::T> {
BalanceOf::<Self::T>::from(1312_u32).saturating_mul(weight.into())
BalanceOf::<Self::T>::from(1312_u32).saturating_mul(weight.ref_time().into())
}
fn schedule(&self) -> &Schedule<Self::T> {
&self.schedule
@@ -1911,7 +1911,7 @@ mod tests {
)]
);
assert!(mock_ext.gas_meter.gas_left() > 0);
assert!(mock_ext.gas_meter.gas_left() > Weight::zero());
}
const CODE_DEPOSIT_EVENT_MAX_TOPICS: &str = r#"
@@ -327,14 +327,14 @@ impl RuntimeCosts {
EcdsaRecovery => s.ecdsa_recover,
ChainExtension(amount) => amount,
#[cfg(feature = "unstable-interface")]
CallRuntime(weight) => weight,
CallRuntime(weight) => weight.ref_time(),
SetCodeHash => s.set_code_hash,
EcdsaToEthAddress => s.ecdsa_to_eth_address,
};
RuntimeToken {
#[cfg(test)]
_created_from: *self,
weight,
weight: Weight::from_ref_time(weight),
}
}
}
@@ -857,7 +857,7 @@ where
self.charge_gas(RuntimeCosts::CallSurchargeTransfer)?;
}
self.ext.call(
gas,
Weight::from_ref_time(gas),
callee,
value,
input_data,
@@ -906,6 +906,7 @@ where
salt_ptr: u32,
salt_len: u32,
) -> Result<ReturnCode, TrapReason> {
let gas = Weight::from_ref_time(gas);
self.charge_gas(RuntimeCosts::InstantiateBase { input_data_len, salt_len })?;
let value: BalanceOf<<E as Ext>::T> = self.read_sandbox_memory_as(value_ptr)?;
if value > 0u32.into() {
@@ -1704,6 +1705,7 @@ pub mod env {
out_ptr: u32,
out_len_ptr: u32,
) -> Result<(), TrapReason> {
let gas = Weight::from_ref_time(gas);
ctx.charge_gas(RuntimeCosts::WeightToFee)?;
Ok(ctx.write_sandbox_output(
out_ptr,
File diff suppressed because it is too large Load Diff
@@ -22,6 +22,7 @@ use std::collections::BTreeMap;
use frame_support::{
assert_noop, assert_ok, parameter_types,
traits::{ConstU32, ConstU64, Contains, Polling, VoteTally},
weights::Weight,
};
use sp_core::H256;
use sp_runtime::{
@@ -57,7 +58,7 @@ impl Contains<Call> for BaseFilter {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1_000_000);
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1_000_000));
}
impl frame_system::Config for Test {
type BaseCallFilter = BaseFilter;
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_conviction_voting.
@@ -62,9 +62,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn vote_new() -> Weight {
(148_804_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
Weight::from_ref_time(148_804_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Referenda ReferendumInfoFor (r:1 w:1)
// Storage: ConvictionVoting VotingFor (r:1 w:1)
@@ -72,24 +72,24 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn vote_existing() -> Weight {
(313_333_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(6 as Weight))
Weight::from_ref_time(313_333_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: ConvictionVoting VotingFor (r:1 w:1)
// Storage: Referenda ReferendumInfoFor (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn remove_vote() -> Weight {
(300_591_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(300_591_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: ConvictionVoting VotingFor (r:1 w:1)
// Storage: Referenda ReferendumInfoFor (r:1 w:0)
fn remove_other_vote() -> Weight {
(53_887_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(53_887_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ConvictionVoting VotingFor (r:2 w:2)
// Storage: ConvictionVoting ClassLocksFor (r:1 w:1)
@@ -97,33 +97,33 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Referenda ReferendumInfoFor (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn delegate(r: u32, ) -> Weight {
(51_518_000 as Weight)
Weight::from_ref_time(51_518_000 as RefTimeWeight)
// Standard Error: 83_000
.saturating_add((27_235_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(r as Weight)))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(r as Weight)))
.saturating_add(Weight::from_ref_time(27_235_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
}
// Storage: ConvictionVoting VotingFor (r:2 w:2)
// Storage: Referenda ReferendumInfoFor (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn undelegate(r: u32, ) -> Weight {
(37_885_000 as Weight)
Weight::from_ref_time(37_885_000 as RefTimeWeight)
// Standard Error: 75_000
.saturating_add((24_395_000 as Weight).saturating_mul(r as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(r as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(r as Weight)))
.saturating_add(Weight::from_ref_time(24_395_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
}
// Storage: ConvictionVoting VotingFor (r:1 w:1)
// Storage: ConvictionVoting ClassLocksFor (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn unlock() -> Weight {
(67_703_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Weight::from_ref_time(67_703_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
}
@@ -135,9 +135,9 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn vote_new() -> Weight {
(148_804_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
Weight::from_ref_time(148_804_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Referenda ReferendumInfoFor (r:1 w:1)
// Storage: ConvictionVoting VotingFor (r:1 w:1)
@@ -145,24 +145,24 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn vote_existing() -> Weight {
(313_333_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
Weight::from_ref_time(313_333_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: ConvictionVoting VotingFor (r:1 w:1)
// Storage: Referenda ReferendumInfoFor (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn remove_vote() -> Weight {
(300_591_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(300_591_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: ConvictionVoting VotingFor (r:1 w:1)
// Storage: Referenda ReferendumInfoFor (r:1 w:0)
fn remove_other_vote() -> Weight {
(53_887_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(53_887_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ConvictionVoting VotingFor (r:2 w:2)
// Storage: ConvictionVoting ClassLocksFor (r:1 w:1)
@@ -170,32 +170,32 @@ impl WeightInfo for () {
// Storage: Referenda ReferendumInfoFor (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn delegate(r: u32, ) -> Weight {
(51_518_000 as Weight)
Weight::from_ref_time(51_518_000 as RefTimeWeight)
// Standard Error: 83_000
.saturating_add((27_235_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(r as Weight)))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(r as Weight)))
.saturating_add(Weight::from_ref_time(27_235_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
}
// Storage: ConvictionVoting VotingFor (r:2 w:2)
// Storage: Referenda ReferendumInfoFor (r:1 w:1)
// Storage: Scheduler Agenda (r:2 w:2)
fn undelegate(r: u32, ) -> Weight {
(37_885_000 as Weight)
Weight::from_ref_time(37_885_000 as RefTimeWeight)
// Standard Error: 75_000
.saturating_add((24_395_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(r as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(r as Weight)))
.saturating_add(Weight::from_ref_time(24_395_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((3 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
}
// Storage: ConvictionVoting VotingFor (r:1 w:1)
// Storage: ConvictionVoting ClassLocksFor (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn unlock() -> Weight {
(67_703_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(67_703_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
}
+1 -1
View File
@@ -1765,7 +1765,7 @@ impl<T: Config> Pallet<T> {
/// # </weight>
fn begin_block(now: T::BlockNumber) -> Weight {
let max_block_weight = T::BlockWeights::get().max_block;
let mut weight = 0;
let mut weight = Weight::new();
let next = Self::lowest_unbaked();
let last = Self::referendum_count();
+1 -1
View File
@@ -78,7 +78,7 @@ impl Contains<Call> for BaseFilter {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1_000_000);
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(1_000_000));
}
impl frame_system::Config for Test {
type BaseCallFilter = BaseFilter;
+199 -199
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_democracy.
@@ -80,44 +80,44 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Democracy Blacklist (r:1 w:0)
// Storage: Democracy DepositOf (r:0 w:1)
fn propose() -> Weight {
(48_328_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Weight::from_ref_time(48_328_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy DepositOf (r:1 w:1)
fn second(s: u32, ) -> Weight {
(30_923_000 as Weight)
Weight::from_ref_time(30_923_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((142_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))
.saturating_add(Weight::from_ref_time(142_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy VotingOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn vote_new(r: u32, ) -> Weight {
(40_345_000 as Weight)
Weight::from_ref_time(40_345_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((140_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))
.saturating_add(Weight::from_ref_time(140_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy VotingOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn vote_existing(r: u32, ) -> Weight {
(39_853_000 as Weight)
Weight::from_ref_time(39_853_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((150_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))
.saturating_add(Weight::from_ref_time(150_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy Cancellations (r:1 w:1)
fn emergency_cancel() -> Weight {
(19_364_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(19_364_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Democracy PublicProps (r:1 w:1)
// Storage: Democracy NextExternal (r:1 w:1)
@@ -126,82 +126,82 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Democracy DepositOf (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn blacklist(p: u32, ) -> Weight {
(57_708_000 as Weight)
Weight::from_ref_time(57_708_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((192_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))
.saturating_add(Weight::from_ref_time(192_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:1 w:1)
// Storage: Democracy Blacklist (r:1 w:0)
fn external_propose(v: u32, ) -> Weight {
(10_714_000 as Weight)
Weight::from_ref_time(10_714_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((33_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))
.saturating_add(Weight::from_ref_time(33_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:0 w:1)
fn external_propose_majority() -> Weight {
(3_697_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(3_697_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:0 w:1)
fn external_propose_default() -> Weight {
(3_831_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(3_831_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:1 w:1)
// Storage: Democracy ReferendumCount (r:1 w:1)
// Storage: Democracy ReferendumInfoOf (r:0 w:1)
fn fast_track() -> Weight {
(20_271_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Weight::from_ref_time(20_271_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:1 w:1)
// Storage: Democracy Blacklist (r:1 w:1)
fn veto_external(v: u32, ) -> Weight {
(21_319_000 as Weight)
Weight::from_ref_time(21_319_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((52_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))
.saturating_add(Weight::from_ref_time(52_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Democracy PublicProps (r:1 w:1)
// Storage: Democracy DepositOf (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn cancel_proposal(p: u32, ) -> Weight {
(43_960_000 as Weight)
Weight::from_ref_time(43_960_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((184_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))
.saturating_add(Weight::from_ref_time(184_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:0 w:1)
fn cancel_referendum() -> Weight {
(13_475_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(13_475_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Scheduler Lookup (r:1 w:1)
// Storage: Scheduler Agenda (r:1 w:1)
fn cancel_queued(r: u32, ) -> Weight {
(24_320_000 as Weight)
Weight::from_ref_time(24_320_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((560_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))
.saturating_add(Weight::from_ref_time(560_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Democracy LowestUnbaked (r:1 w:1)
// Storage: Democracy ReferendumCount (r:1 w:0)
// Storage: Democracy ReferendumInfoOf (r:1 w:0)
fn on_initialize_base(r: u32, ) -> Weight {
(3_428_000 as Weight)
Weight::from_ref_time(3_428_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((3_171_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(1 as Weight))
.saturating_add(Weight::from_ref_time(3_171_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy LowestUnbaked (r:1 w:1)
// Storage: Democracy ReferendumCount (r:1 w:0)
@@ -210,103 +210,103 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Democracy PublicProps (r:1 w:0)
// Storage: Democracy ReferendumInfoOf (r:1 w:0)
fn on_initialize_base_with_launch_period(r: u32, ) -> Weight {
(7_867_000 as Weight)
Weight::from_ref_time(7_867_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((3_177_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)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(3_177_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy VotingOf (r:3 w:3)
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn delegate(r: u32, ) -> Weight {
(37_902_000 as Weight)
Weight::from_ref_time(37_902_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((4_335_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)))
.saturating_add(Weight::from_ref_time(4_335_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
}
// Storage: Democracy VotingOf (r:2 w:2)
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
fn undelegate(r: u32, ) -> Weight {
(21_272_000 as Weight)
Weight::from_ref_time(21_272_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((4_351_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)))
.saturating_add(Weight::from_ref_time(4_351_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
}
// Storage: Democracy PublicProps (r:0 w:1)
fn clear_public_proposals() -> Weight {
(4_913_000 as Weight)
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(4_913_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy Preimages (r:1 w:1)
fn note_preimage(b: u32, ) -> Weight {
(27_986_000 as Weight)
Weight::from_ref_time(27_986_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_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))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy Preimages (r:1 w:1)
fn note_imminent_preimage(b: u32, ) -> Weight {
(20_058_000 as Weight)
Weight::from_ref_time(20_058_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_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))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy Preimages (r:1 w:1)
// Storage: System Account (r:1 w:0)
fn reap_preimage(b: u32, ) -> Weight {
(28_619_000 as Weight)
Weight::from_ref_time(28_619_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((1_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))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy VotingOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn unlock_remove(r: u32, ) -> Weight {
(26_619_000 as Weight)
Weight::from_ref_time(26_619_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((56_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))
.saturating_add(Weight::from_ref_time(56_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy VotingOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn unlock_set(r: u32, ) -> Weight {
(25_373_000 as Weight)
Weight::from_ref_time(25_373_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((142_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))
.saturating_add(Weight::from_ref_time(142_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy VotingOf (r:1 w:1)
fn remove_vote(r: u32, ) -> Weight {
(15_961_000 as Weight)
Weight::from_ref_time(15_961_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((115_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))
.saturating_add(Weight::from_ref_time(115_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy VotingOf (r:1 w:1)
fn remove_other_vote(r: u32, ) -> Weight {
(15_992_000 as Weight)
Weight::from_ref_time(15_992_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((113_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))
.saturating_add(Weight::from_ref_time(113_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
}
@@ -317,44 +317,44 @@ impl WeightInfo for () {
// Storage: Democracy Blacklist (r:1 w:0)
// Storage: Democracy DepositOf (r:0 w:1)
fn propose() -> Weight {
(48_328_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(48_328_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy DepositOf (r:1 w:1)
fn second(s: u32, ) -> Weight {
(30_923_000 as Weight)
Weight::from_ref_time(30_923_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((142_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(142_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy VotingOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn vote_new(r: u32, ) -> Weight {
(40_345_000 as Weight)
Weight::from_ref_time(40_345_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((140_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(140_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy VotingOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn vote_existing(r: u32, ) -> Weight {
(39_853_000 as Weight)
Weight::from_ref_time(39_853_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((150_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(150_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy Cancellations (r:1 w:1)
fn emergency_cancel() -> Weight {
(19_364_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(19_364_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Democracy PublicProps (r:1 w:1)
// Storage: Democracy NextExternal (r:1 w:1)
@@ -363,82 +363,82 @@ impl WeightInfo for () {
// Storage: Democracy DepositOf (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn blacklist(p: u32, ) -> Weight {
(57_708_000 as Weight)
Weight::from_ref_time(57_708_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((192_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(6 as Weight))
.saturating_add(Weight::from_ref_time(192_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(6 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:1 w:1)
// Storage: Democracy Blacklist (r:1 w:0)
fn external_propose(v: u32, ) -> Weight {
(10_714_000 as Weight)
Weight::from_ref_time(10_714_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((33_000 as Weight).saturating_mul(v as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(33_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:0 w:1)
fn external_propose_majority() -> Weight {
(3_697_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(3_697_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:0 w:1)
fn external_propose_default() -> Weight {
(3_831_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(3_831_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:1 w:1)
// Storage: Democracy ReferendumCount (r:1 w:1)
// Storage: Democracy ReferendumInfoOf (r:0 w:1)
fn fast_track() -> Weight {
(20_271_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(20_271_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy NextExternal (r:1 w:1)
// Storage: Democracy Blacklist (r:1 w:1)
fn veto_external(v: u32, ) -> Weight {
(21_319_000 as Weight)
Weight::from_ref_time(21_319_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((52_000 as Weight).saturating_mul(v as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(52_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Democracy PublicProps (r:1 w:1)
// Storage: Democracy DepositOf (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn cancel_proposal(p: u32, ) -> Weight {
(43_960_000 as Weight)
Weight::from_ref_time(43_960_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((184_000 as Weight).saturating_mul(p as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(184_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:0 w:1)
fn cancel_referendum() -> Weight {
(13_475_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(13_475_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Scheduler Lookup (r:1 w:1)
// Storage: Scheduler Agenda (r:1 w:1)
fn cancel_queued(r: u32, ) -> Weight {
(24_320_000 as Weight)
Weight::from_ref_time(24_320_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((560_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(560_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Democracy LowestUnbaked (r:1 w:1)
// Storage: Democracy ReferendumCount (r:1 w:0)
// Storage: Democracy ReferendumInfoOf (r:1 w:0)
fn on_initialize_base(r: u32, ) -> Weight {
(3_428_000 as Weight)
Weight::from_ref_time(3_428_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((3_171_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(1 as Weight))
.saturating_add(Weight::from_ref_time(3_171_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy LowestUnbaked (r:1 w:1)
// Storage: Democracy ReferendumCount (r:1 w:0)
@@ -447,102 +447,102 @@ impl WeightInfo for () {
// Storage: Democracy PublicProps (r:1 w:0)
// Storage: Democracy ReferendumInfoOf (r:1 w:0)
fn on_initialize_base_with_launch_period(r: u32, ) -> Weight {
(7_867_000 as Weight)
Weight::from_ref_time(7_867_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((3_177_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)))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(3_177_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy VotingOf (r:3 w:3)
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn delegate(r: u32, ) -> Weight {
(37_902_000 as Weight)
Weight::from_ref_time(37_902_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((4_335_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)))
.saturating_add(Weight::from_ref_time(4_335_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
}
// Storage: Democracy VotingOf (r:2 w:2)
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
fn undelegate(r: u32, ) -> Weight {
(21_272_000 as Weight)
Weight::from_ref_time(21_272_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((4_351_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)))
.saturating_add(Weight::from_ref_time(4_351_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(r as RefTimeWeight)))
}
// Storage: Democracy PublicProps (r:0 w:1)
fn clear_public_proposals() -> Weight {
(4_913_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(4_913_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy Preimages (r:1 w:1)
fn note_preimage(b: u32, ) -> Weight {
(27_986_000 as Weight)
Weight::from_ref_time(27_986_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy Preimages (r:1 w:1)
fn note_imminent_preimage(b: u32, ) -> Weight {
(20_058_000 as Weight)
Weight::from_ref_time(20_058_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy Preimages (r:1 w:1)
// Storage: System Account (r:1 w:0)
fn reap_preimage(b: u32, ) -> Weight {
(28_619_000 as Weight)
Weight::from_ref_time(28_619_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Democracy VotingOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn unlock_remove(r: u32, ) -> Weight {
(26_619_000 as Weight)
Weight::from_ref_time(26_619_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((56_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(56_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy VotingOf (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn unlock_set(r: u32, ) -> Weight {
(25_373_000 as Weight)
Weight::from_ref_time(25_373_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((142_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(142_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy VotingOf (r:1 w:1)
fn remove_vote(r: u32, ) -> Weight {
(15_961_000 as Weight)
Weight::from_ref_time(15_961_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((115_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(115_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Democracy ReferendumInfoOf (r:1 w:1)
// Storage: Democracy VotingOf (r:1 w:1)
fn remove_other_vote(r: u32, ) -> Weight {
(15_992_000 as Weight)
Weight::from_ref_time(15_992_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((113_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(113_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
}
@@ -234,7 +234,6 @@ use frame_election_provider_support::{
ElectionDataProvider, ElectionProvider, InstantElectionProvider, NposSolution,
};
use frame_support::{
dispatch::DispatchResultWithPostInfo,
ensure,
traits::{Currency, Get, OnUnbalanced, ReservableCurrency},
weights::{DispatchClass, Weight},
@@ -877,7 +876,7 @@ pub mod pallet {
origin: OriginFor<T>,
raw_solution: Box<RawSolution<SolutionOf<T::MinerConfig>>>,
witness: SolutionOrSnapshotSize,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
ensure_none(origin)?;
let error_message = "Invalid unsigned submission must produce invalid block and \
deprive validator from their authoring reward.";
@@ -905,7 +904,7 @@ pub mod pallet {
prev_ejected: ejected_a_solution,
});
Ok(None.into())
Ok(())
}
/// Set a new value for `MinimumUntrustedScore`.
@@ -992,7 +991,7 @@ pub mod pallet {
let deposit = Self::deposit_for(&raw_solution, size);
let call_fee = {
let call = Call::submit { raw_solution: raw_solution.clone() };
T::EstimateCallFee::estimate_call_fee(&call, None.into())
T::EstimateCallFee::estimate_call_fee(&call, None::<Weight>.into())
};
let submission = SignedSubmission {
@@ -349,9 +349,11 @@ impl MinerConfig for Runtime {
fn solution_weight(v: u32, t: u32, a: u32, d: u32) -> Weight {
match MockWeightInfo::get() {
MockedWeightInfo::Basic =>
(10 as Weight).saturating_add((5 as Weight).saturating_mul(a as Weight)),
MockedWeightInfo::Complex => (0 * v + 0 * t + 1000 * a + 0 * d) as Weight,
MockedWeightInfo::Basic => Weight::from_ref_time(
(10 as u64).saturating_add((5 as u64).saturating_mul(a as u64)),
),
MockedWeightInfo::Complex =>
Weight::from_ref_time((0 * v + 0 * t + 1000 * a + 0 * d) as u64),
MockedWeightInfo::Real =>
<() as multi_phase::weights::WeightInfo>::feasibility_check(v, t, a, d),
}
@@ -514,8 +514,8 @@ impl<T: Config> Pallet<T> {
let feasibility_weight = Self::solution_weight_of(raw_solution, size);
let len_deposit = T::SignedDepositByte::get().saturating_mul(encoded_len);
let weight_deposit =
T::SignedDepositWeight::get().saturating_mul(feasibility_weight.saturated_into());
let weight_deposit = T::SignedDepositWeight::get()
.saturating_mul(feasibility_weight.ref_time().saturated_into());
T::SignedDepositBase::get()
.saturating_add(len_deposit)
@@ -957,7 +957,7 @@ mod tests {
#[test]
fn cannot_consume_too_much_future_weight() {
ExtBuilder::default()
.signed_weight(40)
.signed_weight(Weight::from_ref_time(40))
.mock_weight_info(MockedWeightInfo::Basic)
.build_and_execute(|| {
roll_to(15);
@@ -971,13 +971,13 @@ mod tests {
raw.solution.unique_targets().len() as u32,
);
// default solution will have 5 edges (5 * 5 + 10)
assert_eq!(solution_weight, 35);
assert_eq!(solution_weight, Weight::from_ref_time(35));
assert_eq!(raw.solution.voter_count(), 5);
assert_eq!(<Runtime as Config>::SignedMaxWeight::get(), 40);
assert_eq!(<Runtime as Config>::SignedMaxWeight::get(), Weight::from_ref_time(40));
assert_ok!(MultiPhase::submit(Origin::signed(99), Box::new(raw.clone())));
<SignedMaxWeight>::set(30);
<SignedMaxWeight>::set(Weight::from_ref_time(30));
// note: resubmitting the same solution is technically okay as long as the queue has
// space.
@@ -699,54 +699,153 @@ mod max_weight {
fn find_max_voter_binary_search_works() {
let w = SolutionOrSnapshotSize { voters: 10, targets: 0 };
MockWeightInfo::set(crate::mock::MockedWeightInfo::Complex);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 0), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 999), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1000), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1001), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1990), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1999), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2000), 2);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2001), 2);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2010), 2);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2990), 2);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2999), 2);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 3000), 3);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 3333), 3);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 5500), 5);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 7777), 7);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 9999), 9);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 10_000), 10);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 10_999), 10);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 11_000), 10);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 22_000), 10);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::zero()), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1)), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(999)), 0);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1000)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1001)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1990)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1999)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2000)),
2
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2001)),
2
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2010)),
2
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2990)),
2
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2999)),
2
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(3000)),
3
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(3333)),
3
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(5500)),
5
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(7777)),
7
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(9999)),
9
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(10_000)),
10
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(10_999)),
10
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(11_000)),
10
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(22_000)),
10
);
let w = SolutionOrSnapshotSize { voters: 1, targets: 0 };
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 0), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 999), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1000), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1001), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1990), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1999), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2000), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2001), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2010), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 3333), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(0)), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1)), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(999)), 0);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1000)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1001)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1990)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1999)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2000)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2001)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2010)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(3333)),
1
);
let w = SolutionOrSnapshotSize { voters: 2, targets: 0 };
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 0), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 999), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1000), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1001), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 1999), 1);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2000), 2);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2001), 2);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 2010), 2);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, 3333), 2);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(0)), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1)), 0);
assert_eq!(Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(999)), 0);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1000)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1001)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(1999)),
1
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2000)),
2
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2001)),
2
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(2010)),
2
);
assert_eq!(
Miner::<Runtime>::maximum_voter_for_weight(0, w, Weight::from_ref_time(3333)),
2
);
}
}
@@ -1024,7 +1123,7 @@ mod tests {
#[test]
fn miner_trims_weight() {
ExtBuilder::default()
.miner_weight(100)
.miner_weight(Weight::from_ref_time(100))
.mock_weight_info(crate::mock::MockedWeightInfo::Basic)
.build_and_execute(|| {
roll_to(25);
@@ -1038,11 +1137,11 @@ mod tests {
raw.solution.unique_targets().len() as u32,
);
// default solution will have 5 edges (5 * 5 + 10)
assert_eq!(solution_weight, 35);
assert_eq!(solution_weight, Weight::from_ref_time(35));
assert_eq!(raw.solution.voter_count(), 5);
// now reduce the max weight
<MinerMaxWeight>::set(25);
<MinerMaxWeight>::set(Weight::from_ref_time(25));
let (raw, witness) = MultiPhase::mine_solution().unwrap();
let solution_weight = <Runtime as MinerConfig>::solution_weight(
@@ -1052,7 +1151,7 @@ mod tests {
raw.solution.unique_targets().len() as u32,
);
// default solution will have 5 edges (5 * 5 + 10)
assert_eq!(solution_weight, 25);
assert_eq!(solution_weight, Weight::from_ref_time(25));
assert_eq!(raw.solution.voter_count(), 3);
})
}
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_election_provider_multi_phase.
@@ -68,46 +68,46 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking ForceEra (r:1 w:0)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:1 w:0)
fn on_initialize_nothing() -> Weight {
(13_495_000 as Weight)
.saturating_add(T::DbWeight::get().reads(8 as Weight))
Weight::from_ref_time(13_495_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(8 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:0 w:1)
fn on_initialize_open_signed() -> Weight {
(14_114_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(14_114_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:0 w:1)
fn on_initialize_open_unsigned() -> Weight {
(13_756_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(13_756_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
// Storage: ElectionProviderMultiPhase QueuedSolution (r:0 w:1)
fn finalize_signed_phase_accept_solution() -> Weight {
(28_467_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(28_467_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn finalize_signed_phase_reject_solution() -> Weight {
(21_991_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_991_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase SnapshotMetadata (r:0 w:1)
// Storage: ElectionProviderMultiPhase DesiredTargets (r:0 w:1)
// Storage: ElectionProviderMultiPhase Snapshot (r:0 w:1)
fn create_snapshot_internal(v: u32, t: u32, ) -> Weight {
(3_186_000 as Weight)
Weight::from_ref_time(3_186_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((202_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(202_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 3_000
.saturating_add((60_000 as Weight).saturating_mul(t as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(60_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase SignedSubmissionIndices (r:1 w:1)
// Storage: ElectionProviderMultiPhase SignedSubmissionNextIndex (r:1 w:1)
@@ -119,13 +119,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: ElectionProviderMultiPhase Snapshot (r:0 w:1)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:0 w:1)
fn elect_queued(a: u32, d: u32, ) -> Weight {
(137_653_000 as Weight)
Weight::from_ref_time(137_653_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((640_000 as Weight).saturating_mul(a as Weight))
.saturating_add(Weight::from_ref_time(640_000 as RefTimeWeight).scalar_saturating_mul(a as RefTimeWeight))
// Standard Error: 6_000
.saturating_add((48_000 as Weight).saturating_mul(d as Weight))
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(8 as Weight))
.saturating_add(Weight::from_ref_time(48_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(8 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase CurrentPhase (r:1 w:0)
// Storage: ElectionProviderMultiPhase SnapshotMetadata (r:1 w:0)
@@ -134,9 +134,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: ElectionProviderMultiPhase SignedSubmissionNextIndex (r:1 w:1)
// Storage: ElectionProviderMultiPhase SignedSubmissionsMap (r:0 w:1)
fn submit() -> Weight {
(49_313_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Weight::from_ref_time(49_313_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase CurrentPhase (r:1 w:0)
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
@@ -146,33 +146,33 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: ElectionProviderMultiPhase MinimumUntrustedScore (r:1 w:0)
// Storage: ElectionProviderMultiPhase Snapshot (r:1 w:0)
fn submit_unsigned(v: u32, t: u32, a: u32, d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((867_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(867_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 7_000
.saturating_add((107_000 as Weight).saturating_mul(t as Weight))
.saturating_add(Weight::from_ref_time(107_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
// Standard Error: 12_000
.saturating_add((6_907_000 as Weight).saturating_mul(a as Weight))
.saturating_add(Weight::from_ref_time(6_907_000 as RefTimeWeight).scalar_saturating_mul(a as RefTimeWeight))
// Standard Error: 18_000
.saturating_add((1_427_000 as Weight).saturating_mul(d as Weight))
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(1_427_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
// Storage: ElectionProviderMultiPhase DesiredTargets (r:1 w:0)
// Storage: ElectionProviderMultiPhase MinimumUntrustedScore (r:1 w:0)
// Storage: ElectionProviderMultiPhase Snapshot (r:1 w:0)
fn feasibility_check(v: u32, t: u32, a: u32, d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((844_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(844_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 5_000
.saturating_add((150_000 as Weight).saturating_mul(t as Weight))
.saturating_add(Weight::from_ref_time(150_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
// Standard Error: 8_000
.saturating_add((5_421_000 as Weight).saturating_mul(a as Weight))
.saturating_add(Weight::from_ref_time(5_421_000 as RefTimeWeight).scalar_saturating_mul(a as RefTimeWeight))
// Standard Error: 13_000
.saturating_add((1_167_000 as Weight).saturating_mul(d as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(Weight::from_ref_time(1_167_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
}
}
@@ -187,46 +187,46 @@ impl WeightInfo for () {
// Storage: Staking ForceEra (r:1 w:0)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:1 w:0)
fn on_initialize_nothing() -> Weight {
(13_495_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(8 as Weight))
Weight::from_ref_time(13_495_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(8 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:0 w:1)
fn on_initialize_open_signed() -> Weight {
(14_114_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(14_114_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:0 w:1)
fn on_initialize_open_unsigned() -> Weight {
(13_756_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(13_756_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
// Storage: ElectionProviderMultiPhase QueuedSolution (r:0 w:1)
fn finalize_signed_phase_accept_solution() -> Weight {
(28_467_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(28_467_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: System Account (r:1 w:1)
fn finalize_signed_phase_reject_solution() -> Weight {
(21_991_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(21_991_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase SnapshotMetadata (r:0 w:1)
// Storage: ElectionProviderMultiPhase DesiredTargets (r:0 w:1)
// Storage: ElectionProviderMultiPhase Snapshot (r:0 w:1)
fn create_snapshot_internal(v: u32, t: u32, ) -> Weight {
(3_186_000 as Weight)
Weight::from_ref_time(3_186_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((202_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(202_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 3_000
.saturating_add((60_000 as Weight).saturating_mul(t as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(60_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase SignedSubmissionIndices (r:1 w:1)
// Storage: ElectionProviderMultiPhase SignedSubmissionNextIndex (r:1 w:1)
@@ -238,13 +238,13 @@ impl WeightInfo for () {
// Storage: ElectionProviderMultiPhase Snapshot (r:0 w:1)
// Storage: ElectionProviderMultiPhase CurrentPhase (r:0 w:1)
fn elect_queued(a: u32, d: u32, ) -> Weight {
(137_653_000 as Weight)
Weight::from_ref_time(137_653_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((640_000 as Weight).saturating_mul(a as Weight))
.saturating_add(Weight::from_ref_time(640_000 as RefTimeWeight).scalar_saturating_mul(a as RefTimeWeight))
// Standard Error: 6_000
.saturating_add((48_000 as Weight).saturating_mul(d as Weight))
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(8 as Weight))
.saturating_add(Weight::from_ref_time(48_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(8 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase CurrentPhase (r:1 w:0)
// Storage: ElectionProviderMultiPhase SnapshotMetadata (r:1 w:0)
@@ -253,9 +253,9 @@ impl WeightInfo for () {
// Storage: ElectionProviderMultiPhase SignedSubmissionNextIndex (r:1 w:1)
// Storage: ElectionProviderMultiPhase SignedSubmissionsMap (r:0 w:1)
fn submit() -> Weight {
(49_313_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(49_313_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase CurrentPhase (r:1 w:0)
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
@@ -265,32 +265,32 @@ impl WeightInfo for () {
// Storage: ElectionProviderMultiPhase MinimumUntrustedScore (r:1 w:0)
// Storage: ElectionProviderMultiPhase Snapshot (r:1 w:0)
fn submit_unsigned(v: u32, t: u32, a: u32, d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((867_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(867_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 7_000
.saturating_add((107_000 as Weight).saturating_mul(t as Weight))
.saturating_add(Weight::from_ref_time(107_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
// Standard Error: 12_000
.saturating_add((6_907_000 as Weight).saturating_mul(a as Weight))
.saturating_add(Weight::from_ref_time(6_907_000 as RefTimeWeight).scalar_saturating_mul(a as RefTimeWeight))
// Standard Error: 18_000
.saturating_add((1_427_000 as Weight).saturating_mul(d as Weight))
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(1_427_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: ElectionProviderMultiPhase Round (r:1 w:0)
// Storage: ElectionProviderMultiPhase DesiredTargets (r:1 w:0)
// Storage: ElectionProviderMultiPhase MinimumUntrustedScore (r:1 w:0)
// Storage: ElectionProviderMultiPhase Snapshot (r:1 w:0)
fn feasibility_check(v: u32, t: u32, a: u32, d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((844_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(844_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 5_000
.saturating_add((150_000 as Weight).saturating_mul(t as Weight))
.saturating_add(Weight::from_ref_time(150_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
// Standard Error: 8_000
.saturating_add((5_421_000 as Weight).saturating_mul(a as Weight))
.saturating_add(Weight::from_ref_time(5_421_000 as RefTimeWeight).scalar_saturating_mul(a as RefTimeWeight))
// Standard Error: 13_000
.saturating_add((1_167_000 as Weight).saturating_mul(d as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(Weight::from_ref_time(1_167_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
}
}
@@ -40,7 +40,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_election_provider_support_benchmarking.
@@ -53,43 +53,43 @@ pub trait WeightInfo {
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn phragmen(v: u32, t: u32, d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 667_000
.saturating_add((32_973_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(32_973_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 1_334_000
.saturating_add((1_334_000 as Weight).saturating_mul(t as Weight))
.saturating_add(Weight::from_ref_time(1_334_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
// Standard Error: 60_644_000
.saturating_add((2_636_364_000 as Weight).saturating_mul(d as Weight))
.saturating_add(Weight::from_ref_time(2_636_364_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
}
fn phragmms(v: u32, t: u32, d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 73_000
.saturating_add((21_073_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(21_073_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 146_000
.saturating_add((65_000 as Weight).saturating_mul(t as Weight))
.saturating_add(Weight::from_ref_time(65_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
// Standard Error: 6_649_000
.saturating_add((1_711_424_000 as Weight).saturating_mul(d as Weight))
.saturating_add(Weight::from_ref_time(1_711_424_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
fn phragmen(v: u32, t: u32, d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 667_000
.saturating_add((32_973_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(32_973_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 1_334_000
.saturating_add((1_334_000 as Weight).saturating_mul(t as Weight))
.saturating_add(Weight::from_ref_time(1_334_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
// Standard Error: 60_644_000
.saturating_add((2_636_364_000 as Weight).saturating_mul(d as Weight))
.saturating_add(Weight::from_ref_time(2_636_364_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
}
fn phragmms(v: u32, t: u32, d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 73_000
.saturating_add((21_073_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(21_073_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 146_000
.saturating_add((65_000 as Weight).saturating_mul(t as Weight))
.saturating_add(Weight::from_ref_time(65_000 as RefTimeWeight).scalar_saturating_mul(t as RefTimeWeight))
// Standard Error: 6_649_000
.saturating_add((1_711_424_000 as Weight).saturating_mul(d as Weight))
.saturating_add(Weight::from_ref_time(1_711_424_000 as RefTimeWeight).scalar_saturating_mul(d as RefTimeWeight))
}
}
+14 -17
View File
@@ -279,7 +279,7 @@ pub mod pallet {
if !term_duration.is_zero() && (n % term_duration).is_zero() {
Self::do_phragmen()
} else {
0
Weight::zero()
}
}
}
@@ -363,7 +363,7 @@ pub mod pallet {
T::Currency::set_lock(T::PalletId::get(), &who, locked_stake, WithdrawReasons::all());
Voting::<T>::insert(&who, Voter { votes, deposit: new_deposit, stake: locked_stake });
Ok(None.into())
Ok(None::<Weight>.into())
}
/// Remove `origin` as a voter.
@@ -372,11 +372,11 @@ pub mod pallet {
///
/// The dispatch origin of this call must be signed and be a voter.
#[pallet::weight(T::WeightInfo::remove_voter())]
pub fn remove_voter(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
pub fn remove_voter(origin: OriginFor<T>) -> DispatchResult {
let who = ensure_signed(origin)?;
ensure!(Self::is_voter(&who), Error::<T>::MustBeVoter);
Self::do_remove_voter(&who);
Ok(None.into())
Ok(())
}
/// Submit oneself for candidacy. A fixed amount of deposit is recorded.
@@ -398,7 +398,7 @@ pub mod pallet {
pub fn submit_candidacy(
origin: OriginFor<T>,
#[pallet::compact] candidate_count: u32,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
let who = ensure_signed(origin)?;
let actual_count = <Candidates<T>>::decode_len().unwrap_or(0) as u32;
@@ -417,7 +417,7 @@ pub mod pallet {
.map_err(|_| Error::<T>::InsufficientCandidateFunds)?;
<Candidates<T>>::mutate(|c| c.insert(index, (who, T::CandidacyBond::get())));
Ok(None.into())
Ok(())
}
/// Renounce one's intention to be a candidate for the next election round. 3 potential
@@ -443,10 +443,7 @@ pub mod pallet {
Renouncing::Member => T::WeightInfo::renounce_candidacy_members(),
Renouncing::RunnerUp => T::WeightInfo::renounce_candidacy_runners_up(),
})]
pub fn renounce_candidacy(
origin: OriginFor<T>,
renouncing: Renouncing,
) -> DispatchResultWithPostInfo {
pub fn renounce_candidacy(origin: OriginFor<T>, renouncing: Renouncing) -> DispatchResult {
let who = ensure_signed(origin)?;
match renouncing {
Renouncing::Member => {
@@ -482,7 +479,7 @@ pub mod pallet {
})?;
},
};
Ok(None.into())
Ok(())
}
/// Remove a particular member from the set. This is effective immediately and the bond of
@@ -513,7 +510,7 @@ pub mod pallet {
who: AccountIdLookupOf<T>,
slash_bond: bool,
rerun_election: bool,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
ensure_root(origin)?;
let who = T::Lookup::lookup(who)?;
@@ -525,7 +522,7 @@ pub mod pallet {
}
// no refund needed.
Ok(None.into())
Ok(())
}
/// Clean all voters who are defunct (i.e. they do not serve any purpose at all). The
@@ -543,13 +540,13 @@ pub mod pallet {
origin: OriginFor<T>,
_num_voters: u32,
_num_defunct: u32,
) -> DispatchResultWithPostInfo {
) -> DispatchResult {
let _ = ensure_root(origin)?;
<Voting<T>>::iter()
.filter(|(_, x)| Self::is_defunct_voter(&x.votes))
.for_each(|(dv, _)| Self::do_remove_voter(&dv));
Ok(None.into())
Ok(())
}
}
@@ -1177,7 +1174,7 @@ mod tests {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
@@ -1488,7 +1485,7 @@ mod tests {
ensure_members_has_approval_stake();
}
fn submit_candidacy(origin: Origin) -> DispatchResultWithPostInfo {
fn submit_candidacy(origin: Origin) -> sp_runtime::DispatchResult {
Elections::submit_candidacy(origin, Elections::candidates().len() as u32)
}
@@ -101,14 +101,14 @@ pub fn apply<V: V2ToV3, T: Config>(
StorageVersion::new(3).put::<Pallet<T>>();
Weight::max_value()
Weight::MAX
} else {
log::warn!(
target: "runtime::elections-phragmen",
"Attempted to apply migration to V3 but failed because storage version is {:?}",
storage_version,
);
0
Weight::zero()
}
}
@@ -38,7 +38,7 @@ pub fn migrate<T: crate::Config, N: AsRef<str>>(new_pallet_name: N) -> Weight {
target: "runtime::elections-phragmen",
"New pallet name is equal to the old prefix. No migration needs to be done.",
);
return 0
return Weight::zero()
}
let storage_version = StorageVersion::get::<crate::Pallet<T>>();
log::info!(
@@ -63,7 +63,7 @@ pub fn migrate<T: crate::Config, N: AsRef<str>>(new_pallet_name: N) -> Weight {
"Attempted to apply migration to v4 but failed because storage version is {:?}",
storage_version,
);
0
Weight::zero()
}
}
@@ -8,7 +8,7 @@ use super::super::*;
/// situation where they could increase their free balance but still not be able to use their funds
/// because they were less than the lock.
pub fn migrate<T: Config>(to_migrate: Vec<T::AccountId>) -> Weight {
let mut weight = 0;
let mut weight = Weight::new();
for who in to_migrate.iter() {
if let Ok(mut voter) = Voting::<T>::try_get(who) {
@@ -41,7 +41,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_elections_phragmen.
@@ -70,11 +70,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
/// The range of component `v` is `[1, 16]`.
fn vote_equal(v: u32, ) -> Weight {
(27_011_000 as Weight)
Weight::from_ref_time(27_011_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((214_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))
.saturating_add(Weight::from_ref_time(214_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Elections Candidates (r:1 w:0)
// Storage: Elections Members (r:1 w:0)
@@ -83,11 +83,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
/// The range of component `v` is `[2, 16]`.
fn vote_more(v: u32, ) -> Weight {
(40_240_000 as Weight)
Weight::from_ref_time(40_240_000 as RefTimeWeight)
// Standard Error: 5_000
.saturating_add((244_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))
.saturating_add(Weight::from_ref_time(244_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Elections Candidates (r:1 w:0)
// Storage: Elections Members (r:1 w:0)
@@ -96,38 +96,38 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
/// The range of component `v` is `[2, 16]`.
fn vote_less(v: u32, ) -> Weight {
(40_394_000 as Weight)
Weight::from_ref_time(40_394_000 as RefTimeWeight)
// Standard Error: 5_000
.saturating_add((217_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))
.saturating_add(Weight::from_ref_time(217_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Elections Voting (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn remove_voter() -> Weight {
(37_651_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(37_651_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Elections Candidates (r:1 w:1)
// Storage: Elections Members (r:1 w:0)
// Storage: Elections RunnersUp (r:1 w:0)
/// The range of component `c` is `[1, 1000]`.
fn submit_candidacy(c: u32, ) -> Weight {
(42_217_000 as Weight)
Weight::from_ref_time(42_217_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((50_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))
.saturating_add(Weight::from_ref_time(50_000 as RefTimeWeight).scalar_saturating_mul(c as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Elections Candidates (r:1 w:1)
/// The range of component `c` is `[1, 1000]`.
fn renounce_candidacy_candidate(c: u32, ) -> Weight {
(46_459_000 as Weight)
Weight::from_ref_time(46_459_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((26_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))
.saturating_add(Weight::from_ref_time(26_000 as RefTimeWeight).scalar_saturating_mul(c as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Elections Members (r:1 w:1)
// Storage: Elections RunnersUp (r:1 w:1)
@@ -135,19 +135,19 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council Proposals (r:1 w:0)
// Storage: Council Members (r:0 w:1)
fn renounce_candidacy_members() -> Weight {
(45_189_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(45_189_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Elections RunnersUp (r:1 w:1)
fn renounce_candidacy_runners_up() -> Weight {
(34_516_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(34_516_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Benchmark Override (r:0 w:0)
fn remove_member_without_replacement() -> Weight {
(2_000_000_000_000 as Weight)
Weight::from_ref_time(2_000_000_000_000 as RefTimeWeight)
}
// Storage: Elections Members (r:1 w:1)
// Storage: System Account (r:1 w:1)
@@ -156,9 +156,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Council Proposals (r:1 w:0)
// Storage: Council Members (r:0 w:1)
fn remove_member_with_replacement() -> Weight {
(51_838_000 as Weight)
.saturating_add(T::DbWeight::get().reads(5 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(51_838_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Elections Voting (r:5001 w:5000)
// Storage: Elections Members (r:1 w:0)
@@ -169,12 +169,12 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `v` is `[5000, 10000]`.
/// The range of component `d` is `[1, 5000]`.
fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 76_000
.saturating_add((63_721_000 as Weight).saturating_mul(v as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(Weight::from_ref_time(63_721_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((3 as RefTimeWeight).saturating_mul(v as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes((3 as RefTimeWeight).saturating_mul(v as RefTimeWeight)))
}
// Storage: Elections Candidates (r:1 w:1)
// Storage: Elections Members (r:1 w:1)
@@ -189,15 +189,15 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `v` is `[1, 10000]`.
/// The range of component `e` is `[10000, 160000]`.
fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 773_000
.saturating_add((81_534_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(81_534_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 51_000
.saturating_add((4_453_000 as Weight).saturating_mul(e as Weight))
.saturating_add(T::DbWeight::get().reads(280 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
.saturating_add(Weight::from_ref_time(4_453_000 as RefTimeWeight).scalar_saturating_mul(e as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(280 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(c as RefTimeWeight)))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(v as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(c as RefTimeWeight)))
}
}
@@ -210,11 +210,11 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
/// The range of component `v` is `[1, 16]`.
fn vote_equal(v: u32, ) -> Weight {
(27_011_000 as Weight)
Weight::from_ref_time(27_011_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((214_000 as Weight).saturating_mul(v as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(214_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Elections Candidates (r:1 w:0)
// Storage: Elections Members (r:1 w:0)
@@ -223,11 +223,11 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
/// The range of component `v` is `[2, 16]`.
fn vote_more(v: u32, ) -> Weight {
(40_240_000 as Weight)
Weight::from_ref_time(40_240_000 as RefTimeWeight)
// Standard Error: 5_000
.saturating_add((244_000 as Weight).saturating_mul(v as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(244_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Elections Candidates (r:1 w:0)
// Storage: Elections Members (r:1 w:0)
@@ -236,38 +236,38 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
/// The range of component `v` is `[2, 16]`.
fn vote_less(v: u32, ) -> Weight {
(40_394_000 as Weight)
Weight::from_ref_time(40_394_000 as RefTimeWeight)
// Standard Error: 5_000
.saturating_add((217_000 as Weight).saturating_mul(v as Weight))
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(217_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Elections Voting (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn remove_voter() -> Weight {
(37_651_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(37_651_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Elections Candidates (r:1 w:1)
// Storage: Elections Members (r:1 w:0)
// Storage: Elections RunnersUp (r:1 w:0)
/// The range of component `c` is `[1, 1000]`.
fn submit_candidacy(c: u32, ) -> Weight {
(42_217_000 as Weight)
Weight::from_ref_time(42_217_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((50_000 as Weight).saturating_mul(c as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(50_000 as RefTimeWeight).scalar_saturating_mul(c as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Elections Candidates (r:1 w:1)
/// The range of component `c` is `[1, 1000]`.
fn renounce_candidacy_candidate(c: u32, ) -> Weight {
(46_459_000 as Weight)
Weight::from_ref_time(46_459_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((26_000 as Weight).saturating_mul(c as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(26_000 as RefTimeWeight).scalar_saturating_mul(c as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Elections Members (r:1 w:1)
// Storage: Elections RunnersUp (r:1 w:1)
@@ -275,19 +275,19 @@ impl WeightInfo for () {
// Storage: Council Proposals (r:1 w:0)
// Storage: Council Members (r:0 w:1)
fn renounce_candidacy_members() -> Weight {
(45_189_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(45_189_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Elections RunnersUp (r:1 w:1)
fn renounce_candidacy_runners_up() -> Weight {
(34_516_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(34_516_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Benchmark Override (r:0 w:0)
fn remove_member_without_replacement() -> Weight {
(2_000_000_000_000 as Weight)
Weight::from_ref_time(2_000_000_000_000 as RefTimeWeight)
}
// Storage: Elections Members (r:1 w:1)
// Storage: System Account (r:1 w:1)
@@ -296,9 +296,9 @@ impl WeightInfo for () {
// Storage: Council Proposals (r:1 w:0)
// Storage: Council Members (r:0 w:1)
fn remove_member_with_replacement() -> Weight {
(51_838_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(51_838_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(5 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: Elections Voting (r:5001 w:5000)
// Storage: Elections Members (r:1 w:0)
@@ -309,12 +309,12 @@ impl WeightInfo for () {
/// The range of component `v` is `[5000, 10000]`.
/// The range of component `d` is `[1, 5000]`.
fn clean_defunct_voters(v: u32, _d: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 76_000
.saturating_add((63_721_000 as Weight).saturating_mul(v as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().reads((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(RocksDbWeight::get().writes((3 as Weight).saturating_mul(v as Weight)))
.saturating_add(Weight::from_ref_time(63_721_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((3 as RefTimeWeight).saturating_mul(v as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes((3 as RefTimeWeight).saturating_mul(v as RefTimeWeight)))
}
// Storage: Elections Candidates (r:1 w:1)
// Storage: Elections Members (r:1 w:1)
@@ -329,14 +329,14 @@ impl WeightInfo for () {
/// The range of component `v` is `[1, 10000]`.
/// The range of component `e` is `[10000, 160000]`.
fn election_phragmen(c: u32, v: u32, e: u32, ) -> Weight {
(0 as Weight)
Weight::from_ref_time(0 as RefTimeWeight)
// Standard Error: 773_000
.saturating_add((81_534_000 as Weight).saturating_mul(v as Weight))
.saturating_add(Weight::from_ref_time(81_534_000 as RefTimeWeight).scalar_saturating_mul(v as RefTimeWeight))
// Standard Error: 51_000
.saturating_add((4_453_000 as Weight).saturating_mul(e as Weight))
.saturating_add(RocksDbWeight::get().reads(280 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(c as Weight)))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(v as Weight)))
.saturating_add(RocksDbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
.saturating_add(Weight::from_ref_time(4_453_000 as RefTimeWeight).scalar_saturating_mul(e as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(280 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(c as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(v as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(c as RefTimeWeight)))
}
}
+2 -2
View File
@@ -329,7 +329,7 @@ impl<T: pallet_balances::Config> WeighData<(&BalanceOf<T>,)> for WeightForSetDum
let multiplier = self.0;
// *target.0 is the amount passed into the extrinsic
let cents = *target.0 / <BalanceOf<T>>::from(MILLICENTS);
(cents * multiplier).saturated_into::<Weight>()
Weight::from_ref_time((cents * multiplier).saturated_into::<u64>())
}
}
@@ -392,7 +392,7 @@ pub mod pallet {
fn on_initialize(_n: T::BlockNumber) -> Weight {
// Anything that needs to be done at the start of the block.
// We don't do anything here.
0
Weight::zero()
}
// `on_finalize` is executed at the end of block after all extrinsic are dispatched.
+2 -2
View File
@@ -52,7 +52,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
@@ -190,7 +190,7 @@ fn weights_work() {
let default_call = pallet_example_basic::Call::<Test>::accumulate_dummy { increase_by: 10 };
let info1 = default_call.get_dispatch_info();
// aka. `let info = <Call<Test> as GetDispatchInfo>::get_dispatch_info(&default_call);`
assert!(info1.weight > 0);
assert!(info1.weight > Weight::zero());
// `set_dummy` is simpler than `accumulate_dummy`, and the weight
// should be less.
+19 -19
View File
@@ -49,7 +49,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_example_basic.
@@ -63,39 +63,39 @@ pub trait WeightInfo {
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn set_dummy_benchmark(b: u32, ) -> Weight {
(5_834_000 as Weight)
.saturating_add((24_000 as Weight).saturating_mul(b as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(5_834_000 as RefTimeWeight)
.saturating_add(Weight::from_ref_time(24_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
fn accumulate_dummy(b: u32, ) -> Weight {
(51_353_000 as Weight)
.saturating_add((14_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))
Weight::from_ref_time(51_353_000 as RefTimeWeight)
.saturating_add(Weight::from_ref_time(14_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
fn sort_vector(x: u32, ) -> Weight {
(2_569_000 as Weight)
Weight::from_ref_time(2_569_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((4_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(4_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
fn set_dummy_benchmark(b: u32, ) -> Weight {
(5_834_000 as Weight)
.saturating_add((24_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(5_834_000 as RefTimeWeight)
.saturating_add(Weight::from_ref_time(24_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
fn accumulate_dummy(b: u32, ) -> Weight {
(51_353_000 as Weight)
.saturating_add((14_000 as Weight).saturating_mul(b as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(51_353_000 as RefTimeWeight)
.saturating_add(Weight::from_ref_time(14_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
fn sort_vector(x: u32, ) -> Weight {
(2_569_000 as Weight)
Weight::from_ref_time(2_569_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((4_000 as Weight).saturating_mul(x as Weight))
.saturating_add(Weight::from_ref_time(4_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
}
}
@@ -53,7 +53,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
+1 -1
View File
@@ -56,7 +56,7 @@ struct CustomOnRuntimeUpgrade;
impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
// Do whatever you want.
0
frame_support::weights::Weight::zero()
}
}
+23 -20
View File
@@ -107,7 +107,7 @@
//! impl frame_support::traits::OnRuntimeUpgrade for CustomOnRuntimeUpgrade {
//! fn on_runtime_upgrade() -> frame_support::weights::Weight {
//! // Do whatever you want.
//! 0
//! frame_support::weights::Weight::zero()
//! }
//! }
//!
@@ -123,12 +123,12 @@ use frame_support::{
EnsureInherentsAreFirst, ExecuteBlock, OffchainWorker, OnFinalize, OnIdle, OnInitialize,
OnRuntimeUpgrade,
},
weights::{DispatchClass, DispatchInfo, GetDispatchInfo},
weights::{DispatchClass, DispatchInfo, GetDispatchInfo, Weight},
};
use sp_runtime::{
generic::Digest,
traits::{
self, Applyable, CheckEqual, Checkable, Dispatchable, Header, NumberFor, One, Saturating,
self, Applyable, CheckEqual, Checkable, Dispatchable, Header, NumberFor, One,
ValidateUnsigned, Zero,
},
transaction_validity::{TransactionSource, TransactionValidity},
@@ -299,7 +299,7 @@ where
// This means the format of all the event related storages must always be compatible.
<frame_system::Pallet<System>>::reset_events();
let mut weight = 0;
let mut weight = Weight::new();
if Self::runtime_upgraded() {
weight = weight.saturating_add(Self::execute_on_runtime_upgrade());
}
@@ -413,7 +413,7 @@ where
let max_weight = <System::BlockWeights as frame_support::traits::Get<_>>::get().max_block;
let remaining_weight = max_weight.saturating_sub(weight.total());
if remaining_weight > 0 {
if remaining_weight > Weight::zero() {
let used_weight = <AllPalletsWithSystem as OnIdle<System::BlockNumber>>::on_idle(
block_number,
remaining_weight,
@@ -593,12 +593,12 @@ mod tests {
// one with block number arg and one without
fn on_initialize(n: T::BlockNumber) -> Weight {
println!("on_initialize({})", n);
175
Weight::from_ref_time(175)
}
fn on_idle(n: T::BlockNumber, remaining_weight: Weight) -> Weight {
println!("on_idle{}, {})", n, remaining_weight);
175
Weight::from_ref_time(175)
}
fn on_finalize(n: T::BlockNumber) {
@@ -607,7 +607,7 @@ mod tests {
fn on_runtime_upgrade() -> Weight {
sp_io::storage::set(super::TEST_KEY, "module".as_bytes());
200
Weight::from_ref_time(200)
}
fn offchain_worker(n: T::BlockNumber) {
@@ -721,9 +721,9 @@ mod tests {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::builder()
.base_block(10)
.for_class(DispatchClass::all(), |weights| weights.base_extrinsic = 5)
.for_class(DispatchClass::non_mandatory(), |weights| weights.max_total = 1024.into())
.base_block(Weight::from_ref_time(10))
.for_class(DispatchClass::all(), |weights| weights.base_extrinsic = Weight::from_ref_time(5))
.for_class(DispatchClass::non_mandatory(), |weights| weights.max_total = Weight::from_ref_time(1024).into())
.build_or_panic();
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
read: 10,
@@ -814,7 +814,7 @@ mod tests {
sp_io::storage::set(TEST_KEY, "custom_upgrade".as_bytes());
sp_io::storage::set(CUSTOM_ON_RUNTIME_KEY, &true.encode());
System::deposit_event(frame_system::Event::CodeUpdated);
100
Weight::from_ref_time(100)
}
}
@@ -988,12 +988,12 @@ mod tests {
sign_extra(1, 0, 0),
);
let encoded = xt.encode();
let encoded_len = encoded.len() as Weight;
let encoded_len = encoded.len() as u64;
// on_initialize weight + base block execution weight
let block_weights = <Runtime as frame_system::Config>::BlockWeights::get();
let base_block_weight = 175 + block_weights.base_block;
let base_block_weight = Weight::from_ref_time(175) + block_weights.base_block;
let limit = block_weights.get(DispatchClass::Normal).max_total.unwrap() - base_block_weight;
let num_to_exhaust_block = limit / (encoded_len + 5);
let num_to_exhaust_block = limit.ref_time() / (encoded_len + 5);
t.execute_with(|| {
Executive::initialize_block(&Header::new(
1,
@@ -1016,7 +1016,7 @@ mod tests {
assert_eq!(
<frame_system::Pallet<Runtime>>::block_weight().total(),
//--------------------- on_initialize + block_execution + extrinsic_base weight
(encoded_len + 5) * (nonce + 1) + base_block_weight,
Weight::from_ref_time((encoded_len + 5) * (nonce + 1)) + base_block_weight,
);
assert_eq!(
<frame_system::Pallet<Runtime>>::extrinsic_index(),
@@ -1047,8 +1047,8 @@ mod tests {
let mut t = new_test_ext(1);
t.execute_with(|| {
// Block execution weight + on_initialize weight from custom module
let base_block_weight =
175 + <Runtime as frame_system::Config>::BlockWeights::get().base_block;
let base_block_weight = Weight::from_ref_time(175) +
<Runtime as frame_system::Config>::BlockWeights::get().base_block;
Executive::initialize_block(&Header::new(
1,
@@ -1066,7 +1066,7 @@ mod tests {
assert!(Executive::apply_extrinsic(x2.clone()).unwrap().is_ok());
// default weight for `TestXt` == encoded length.
let extrinsic_weight = len as Weight +
let extrinsic_weight = Weight::from_ref_time(len as u64) +
<Runtime as frame_system::Config>::BlockWeights::get()
.get(DispatchClass::Normal)
.base_extrinsic;
@@ -1180,7 +1180,10 @@ mod tests {
// NOTE: might need updates over time if new weights are introduced.
// For now it only accounts for the base block execution weight and
// the `on_initialize` weight defined in the custom test module.
assert_eq!(<frame_system::Pallet<Runtime>>::block_weight().total(), 175 + 175 + 10);
assert_eq!(
<frame_system::Pallet<Runtime>>::block_weight().total(),
Weight::from_ref_time(175 + 175 + 10)
);
})
}
+1 -1
View File
@@ -335,7 +335,7 @@ pub mod pallet {
if (n % T::IntakePeriod::get()).is_zero() {
Self::pursue_target(T::MaxIntakeBids::get())
} else {
0
Weight::zero()
}
}
}
+61 -61
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_gilt.
@@ -60,70 +60,70 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
fn place_bid(l: u32, ) -> Weight {
(41_605_000 as Weight)
Weight::from_ref_time(41_605_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((62_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))
.saturating_add(Weight::from_ref_time(62_000 as RefTimeWeight).scalar_saturating_mul(l as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
fn place_bid_max() -> Weight {
(97_715_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(97_715_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
fn retract_bid(l: u32, ) -> Weight {
(42_061_000 as Weight)
Weight::from_ref_time(42_061_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((52_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))
.saturating_add(Weight::from_ref_time(52_000 as RefTimeWeight).scalar_saturating_mul(l as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Gilt ActiveTotal (r:1 w:1)
fn set_target() -> Weight {
(5_026_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(5_026_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Gilt Active (r:1 w:1)
// Storage: Gilt ActiveTotal (r:1 w:1)
fn thaw() -> Weight {
(47_753_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(47_753_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Gilt ActiveTotal (r:1 w:0)
fn pursue_target_noop() -> Weight {
(1_663_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
Weight::from_ref_time(1_663_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
}
// Storage: Gilt ActiveTotal (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt Active (r:0 w:1)
fn pursue_target_per_item(b: u32, ) -> Weight {
(40_797_000 as Weight)
Weight::from_ref_time(40_797_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((4_122_000 as Weight).saturating_mul(b 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(b as Weight)))
.saturating_add(Weight::from_ref_time(4_122_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(b as RefTimeWeight)))
}
// Storage: Gilt ActiveTotal (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt Active (r:0 w:1)
fn pursue_target_per_queue(q: u32, ) -> Weight {
(14_944_000 as Weight)
Weight::from_ref_time(14_944_000 as RefTimeWeight)
// Standard Error: 6_000
.saturating_add((8_135_000 as Weight).saturating_mul(q as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(q as Weight)))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(T::DbWeight::get().writes((2 as Weight).saturating_mul(q as Weight)))
.saturating_add(Weight::from_ref_time(8_135_000 as RefTimeWeight).scalar_saturating_mul(q as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(q as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((2 as RefTimeWeight).saturating_mul(q as RefTimeWeight)))
}
}
@@ -132,69 +132,69 @@ impl WeightInfo for () {
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
fn place_bid(l: u32, ) -> Weight {
(41_605_000 as Weight)
Weight::from_ref_time(41_605_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((62_000 as Weight).saturating_mul(l as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(62_000 as RefTimeWeight).scalar_saturating_mul(l as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
fn place_bid_max() -> Weight {
(97_715_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(97_715_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
fn retract_bid(l: u32, ) -> Weight {
(42_061_000 as Weight)
Weight::from_ref_time(42_061_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((52_000 as Weight).saturating_mul(l as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(52_000 as RefTimeWeight).scalar_saturating_mul(l as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Gilt ActiveTotal (r:1 w:1)
fn set_target() -> Weight {
(5_026_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(5_026_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Gilt Active (r:1 w:1)
// Storage: Gilt ActiveTotal (r:1 w:1)
fn thaw() -> Weight {
(47_753_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(47_753_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Gilt ActiveTotal (r:1 w:0)
fn pursue_target_noop() -> Weight {
(1_663_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
Weight::from_ref_time(1_663_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
}
// Storage: Gilt ActiveTotal (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt Active (r:0 w:1)
fn pursue_target_per_item(b: u32, ) -> Weight {
(40_797_000 as Weight)
Weight::from_ref_time(40_797_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((4_122_000 as Weight).saturating_mul(b 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(b as Weight)))
.saturating_add(Weight::from_ref_time(4_122_000 as RefTimeWeight).scalar_saturating_mul(b as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(b as RefTimeWeight)))
}
// Storage: Gilt ActiveTotal (r:1 w:1)
// Storage: Gilt QueueTotals (r:1 w:1)
// Storage: Gilt Queues (r:1 w:1)
// Storage: Gilt Active (r:0 w:1)
fn pursue_target_per_queue(q: u32, ) -> Weight {
(14_944_000 as Weight)
Weight::from_ref_time(14_944_000 as RefTimeWeight)
// Standard Error: 6_000
.saturating_add((8_135_000 as Weight).saturating_mul(q as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(q as Weight)))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(RocksDbWeight::get().writes((2 as Weight).saturating_mul(q as Weight)))
.saturating_add(Weight::from_ref_time(8_135_000 as RefTimeWeight).scalar_saturating_mul(q as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(q as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((2 as RefTimeWeight).saturating_mul(q as RefTimeWeight)))
}
}
@@ -35,7 +35,7 @@ impl crate::WeightInfo for () {
// checking membership proof
(35 * WEIGHT_PER_MICROS)
.saturating_add((175 * WEIGHT_PER_NANOS).saturating_mul(validator_count))
.saturating_add((175 * WEIGHT_PER_NANOS).scalar_saturating_mul(validator_count))
.saturating_add(DbWeight::get().reads(5))
// check equivocation proof
.saturating_add(95 * WEIGHT_PER_MICROS)
+2 -2
View File
@@ -37,7 +37,7 @@ pub fn migrate<T: crate::Config, N: AsRef<str>>(new_pallet_name: N) -> Weight {
target: "runtime::afg",
"New pallet name is equal to the old prefix. No migration needs to be done.",
);
return 0
return Weight::zero()
}
let storage_version = StorageVersion::get::<crate::Pallet<T>>();
log::info!(
@@ -57,7 +57,7 @@ pub fn migrate<T: crate::Config, N: AsRef<str>>(new_pallet_name: N) -> Weight {
<T as frame_system::Config>::BlockWeights::get().max_block
} else {
0
Weight::zero()
}
}
+1 -1
View File
@@ -71,7 +71,7 @@ impl_opaque_keys! {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
+1 -1
View File
@@ -856,7 +856,7 @@ fn valid_equivocation_reports_dont_pay_fees() {
.get_dispatch_info();
// it should have non-zero weight and the fee has to be paid.
assert!(info.weight > 0);
assert!(info.weight > Weight::zero());
assert_eq!(info.pays_fee, Pays::Yes);
// report the equivocation.
+1 -1
View File
@@ -50,7 +50,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
+155 -155
View File
@@ -40,7 +40,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_identity.
@@ -69,48 +69,48 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Identity Registrars (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
fn add_registrar(r: u32, ) -> Weight {
(16_649_000 as Weight)
Weight::from_ref_time(16_649_000 as RefTimeWeight)
// Standard Error: 5_000
.saturating_add((241_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))
.saturating_add(Weight::from_ref_time(241_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:1)
/// The range of component `r` is `[1, 20]`.
/// The range of component `x` is `[1, 100]`.
fn set_identity(r: u32, x: u32, ) -> Weight {
(31_322_000 as Weight)
Weight::from_ref_time(31_322_000 as RefTimeWeight)
// Standard Error: 10_000
.saturating_add((252_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(252_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((312_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))
.saturating_add(Weight::from_ref_time(312_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SubsOf (r:1 w:1)
// Storage: Identity SuperOf (r:1 w:1)
/// The range of component `s` is `[1, 100]`.
fn set_subs_new(s: u32, ) -> Weight {
(30_012_000 as Weight)
Weight::from_ref_time(30_012_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((3_005_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)))
.saturating_add(Weight::from_ref_time(3_005_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SubsOf (r:1 w:1)
// Storage: Identity SuperOf (r:0 w:1)
/// The range of component `p` is `[1, 100]`.
fn set_subs_old(p: u32, ) -> Weight {
(29_623_000 as Weight)
Weight::from_ref_time(29_623_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((1_100_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)))
.saturating_add(Weight::from_ref_time(1_100_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(p as RefTimeWeight)))
}
// Storage: Identity SubsOf (r:1 w:1)
// Storage: Identity IdentityOf (r:1 w:1)
@@ -119,81 +119,81 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `s` is `[1, 100]`.
/// The range of component `x` is `[1, 100]`.
fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight {
(34_370_000 as Weight)
Weight::from_ref_time(34_370_000 as RefTimeWeight)
// Standard Error: 10_000
.saturating_add((186_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(186_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((1_114_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(1_114_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((189_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)))
.saturating_add(Weight::from_ref_time(189_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
}
// Storage: Identity Registrars (r:1 w:0)
// Storage: Identity IdentityOf (r:1 w:1)
/// The range of component `r` is `[1, 20]`.
/// The range of component `x` is `[1, 100]`.
fn request_judgement(r: u32, x: u32, ) -> Weight {
(34_759_000 as Weight)
Weight::from_ref_time(34_759_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((251_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(251_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 0
.saturating_add((340_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))
.saturating_add(Weight::from_ref_time(340_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:1)
/// The range of component `r` is `[1, 20]`.
/// The range of component `x` is `[1, 100]`.
fn cancel_request(r: u32, x: u32, ) -> Weight {
(32_254_000 as Weight)
Weight::from_ref_time(32_254_000 as RefTimeWeight)
// Standard Error: 7_000
.saturating_add((159_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(159_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 0
.saturating_add((347_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))
.saturating_add(Weight::from_ref_time(347_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity Registrars (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
fn set_fee(r: u32, ) -> Weight {
(7_858_000 as Weight)
Weight::from_ref_time(7_858_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((190_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))
.saturating_add(Weight::from_ref_time(190_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity Registrars (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
fn set_account_id(r: u32, ) -> Weight {
(8_011_000 as Weight)
Weight::from_ref_time(8_011_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((187_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))
.saturating_add(Weight::from_ref_time(187_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity Registrars (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
fn set_fields(r: u32, ) -> Weight {
(7_970_000 as Weight)
Weight::from_ref_time(7_970_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((175_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))
.saturating_add(Weight::from_ref_time(175_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity Registrars (r:1 w:0)
// Storage: Identity IdentityOf (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
/// The range of component `x` is `[1, 100]`.
fn provide_judgement(r: u32, x: u32, ) -> Weight {
(24_730_000 as Weight)
Weight::from_ref_time(24_730_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((196_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(196_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 0
.saturating_add((341_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))
.saturating_add(Weight::from_ref_time(341_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity SubsOf (r:1 w:1)
// Storage: Identity IdentityOf (r:1 w:1)
@@ -203,58 +203,58 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
/// The range of component `s` is `[1, 100]`.
/// The range of component `x` is `[1, 100]`.
fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight {
(44_988_000 as Weight)
Weight::from_ref_time(44_988_000 as RefTimeWeight)
// Standard Error: 10_000
.saturating_add((201_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(201_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((1_126_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(1_126_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 1_000
.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)))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes((1 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SuperOf (r:1 w:1)
// Storage: Identity SubsOf (r:1 w:1)
/// The range of component `s` is `[1, 99]`.
fn add_sub(s: u32, ) -> Weight {
(36_768_000 as Weight)
Weight::from_ref_time(36_768_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((115_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))
.saturating_add(Weight::from_ref_time(115_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SuperOf (r:1 w:1)
/// The range of component `s` is `[1, 100]`.
fn rename_sub(s: u32, ) -> Weight {
(13_474_000 as Weight)
Weight::from_ref_time(13_474_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((56_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))
.saturating_add(Weight::from_ref_time(56_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SuperOf (r:1 w:1)
// Storage: Identity SubsOf (r:1 w:1)
/// The range of component `s` is `[1, 100]`.
fn remove_sub(s: u32, ) -> Weight {
(37_720_000 as Weight)
Weight::from_ref_time(37_720_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((114_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))
.saturating_add(Weight::from_ref_time(114_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Identity SuperOf (r:1 w:1)
// Storage: Identity SubsOf (r:1 w:1)
/// The range of component `s` is `[1, 99]`.
fn quit_sub(s: u32, ) -> Weight {
(26_848_000 as Weight)
Weight::from_ref_time(26_848_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((115_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))
.saturating_add(Weight::from_ref_time(115_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
}
@@ -263,48 +263,48 @@ impl WeightInfo for () {
// Storage: Identity Registrars (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
fn add_registrar(r: u32, ) -> Weight {
(16_649_000 as Weight)
Weight::from_ref_time(16_649_000 as RefTimeWeight)
// Standard Error: 5_000
.saturating_add((241_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(241_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:1)
/// The range of component `r` is `[1, 20]`.
/// The range of component `x` is `[1, 100]`.
fn set_identity(r: u32, x: u32, ) -> Weight {
(31_322_000 as Weight)
Weight::from_ref_time(31_322_000 as RefTimeWeight)
// Standard Error: 10_000
.saturating_add((252_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(252_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((312_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(312_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SubsOf (r:1 w:1)
// Storage: Identity SuperOf (r:1 w:1)
/// The range of component `s` is `[1, 100]`.
fn set_subs_new(s: u32, ) -> Weight {
(30_012_000 as Weight)
Weight::from_ref_time(30_012_000 as RefTimeWeight)
// Standard Error: 2_000
.saturating_add((3_005_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)))
.saturating_add(Weight::from_ref_time(3_005_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SubsOf (r:1 w:1)
// Storage: Identity SuperOf (r:0 w:1)
/// The range of component `p` is `[1, 100]`.
fn set_subs_old(p: u32, ) -> Weight {
(29_623_000 as Weight)
Weight::from_ref_time(29_623_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((1_100_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)))
.saturating_add(Weight::from_ref_time(1_100_000 as RefTimeWeight).scalar_saturating_mul(p as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(p as RefTimeWeight)))
}
// Storage: Identity SubsOf (r:1 w:1)
// Storage: Identity IdentityOf (r:1 w:1)
@@ -313,81 +313,81 @@ impl WeightInfo for () {
/// The range of component `s` is `[1, 100]`.
/// The range of component `x` is `[1, 100]`.
fn clear_identity(r: u32, s: u32, x: u32, ) -> Weight {
(34_370_000 as Weight)
Weight::from_ref_time(34_370_000 as RefTimeWeight)
// Standard Error: 10_000
.saturating_add((186_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(186_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((1_114_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(1_114_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((189_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)))
.saturating_add(Weight::from_ref_time(189_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
}
// Storage: Identity Registrars (r:1 w:0)
// Storage: Identity IdentityOf (r:1 w:1)
/// The range of component `r` is `[1, 20]`.
/// The range of component `x` is `[1, 100]`.
fn request_judgement(r: u32, x: u32, ) -> Weight {
(34_759_000 as Weight)
Weight::from_ref_time(34_759_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((251_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(251_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 0
.saturating_add((340_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(340_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:1)
/// The range of component `r` is `[1, 20]`.
/// The range of component `x` is `[1, 100]`.
fn cancel_request(r: u32, x: u32, ) -> Weight {
(32_254_000 as Weight)
Weight::from_ref_time(32_254_000 as RefTimeWeight)
// Standard Error: 7_000
.saturating_add((159_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(159_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 0
.saturating_add((347_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(347_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity Registrars (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
fn set_fee(r: u32, ) -> Weight {
(7_858_000 as Weight)
Weight::from_ref_time(7_858_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((190_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(190_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity Registrars (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
fn set_account_id(r: u32, ) -> Weight {
(8_011_000 as Weight)
Weight::from_ref_time(8_011_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((187_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(187_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity Registrars (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
fn set_fields(r: u32, ) -> Weight {
(7_970_000 as Weight)
Weight::from_ref_time(7_970_000 as RefTimeWeight)
// Standard Error: 3_000
.saturating_add((175_000 as Weight).saturating_mul(r as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(175_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity Registrars (r:1 w:0)
// Storage: Identity IdentityOf (r:1 w:1)
/// The range of component `r` is `[1, 19]`.
/// The range of component `x` is `[1, 100]`.
fn provide_judgement(r: u32, x: u32, ) -> Weight {
(24_730_000 as Weight)
Weight::from_ref_time(24_730_000 as RefTimeWeight)
// Standard Error: 4_000
.saturating_add((196_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(196_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 0
.saturating_add((341_000 as Weight).saturating_mul(x as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(341_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity SubsOf (r:1 w:1)
// Storage: Identity IdentityOf (r:1 w:1)
@@ -397,57 +397,57 @@ impl WeightInfo for () {
/// The range of component `s` is `[1, 100]`.
/// The range of component `x` is `[1, 100]`.
fn kill_identity(r: u32, s: u32, x: u32, ) -> Weight {
(44_988_000 as Weight)
Weight::from_ref_time(44_988_000 as RefTimeWeight)
// Standard Error: 10_000
.saturating_add((201_000 as Weight).saturating_mul(r as Weight))
.saturating_add(Weight::from_ref_time(201_000 as RefTimeWeight).scalar_saturating_mul(r as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((1_126_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(1_126_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 1_000
.saturating_add((2_000 as Weight).saturating_mul(x 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)))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(x as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes((1 as RefTimeWeight).saturating_mul(s as RefTimeWeight)))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SuperOf (r:1 w:1)
// Storage: Identity SubsOf (r:1 w:1)
/// The range of component `s` is `[1, 99]`.
fn add_sub(s: u32, ) -> Weight {
(36_768_000 as Weight)
Weight::from_ref_time(36_768_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((115_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(115_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SuperOf (r:1 w:1)
/// The range of component `s` is `[1, 100]`.
fn rename_sub(s: u32, ) -> Weight {
(13_474_000 as Weight)
Weight::from_ref_time(13_474_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((56_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(56_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Identity IdentityOf (r:1 w:0)
// Storage: Identity SuperOf (r:1 w:1)
// Storage: Identity SubsOf (r:1 w:1)
/// The range of component `s` is `[1, 100]`.
fn remove_sub(s: u32, ) -> Weight {
(37_720_000 as Weight)
Weight::from_ref_time(37_720_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((114_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(114_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Identity SuperOf (r:1 w:1)
// Storage: Identity SubsOf (r:1 w:1)
/// The range of component `s` is `[1, 99]`.
fn quit_sub(s: u32, ) -> Weight {
(26_848_000 as Weight)
Weight::from_ref_time(26_848_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((115_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(115_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
}
+1 -1
View File
@@ -123,7 +123,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Runtime {
+11 -11
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_im_online.
@@ -56,13 +56,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: ImOnline AuthoredBlocks (r:1 w:0)
// Storage: ImOnline Keys (r:1 w:0)
fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight {
(79_225_000 as Weight)
Weight::from_ref_time(79_225_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((41_000 as Weight).saturating_mul(k as Weight))
.saturating_add(Weight::from_ref_time(41_000 as RefTimeWeight).scalar_saturating_mul(k as RefTimeWeight))
// Standard Error: 0
.saturating_add((293_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))
.saturating_add(Weight::from_ref_time(293_000 as RefTimeWeight).scalar_saturating_mul(e as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
}
@@ -74,12 +74,12 @@ impl WeightInfo for () {
// Storage: ImOnline AuthoredBlocks (r:1 w:0)
// Storage: ImOnline Keys (r:1 w:0)
fn validate_unsigned_and_then_heartbeat(k: u32, e: u32, ) -> Weight {
(79_225_000 as Weight)
Weight::from_ref_time(79_225_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((41_000 as Weight).saturating_mul(k as Weight))
.saturating_add(Weight::from_ref_time(41_000 as RefTimeWeight).scalar_saturating_mul(k as RefTimeWeight))
// Standard Error: 0
.saturating_add((293_000 as Weight).saturating_mul(e as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(293_000 as RefTimeWeight).scalar_saturating_mul(e as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
}
+1 -1
View File
@@ -44,7 +44,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
+31 -31
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_indices.
@@ -56,35 +56,35 @@ pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Indices Accounts (r:1 w:1)
fn claim() -> Weight {
(25_929_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(25_929_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Indices Accounts (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
(32_627_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(32_627_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Indices Accounts (r:1 w:1)
fn free() -> Weight {
(26_804_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(26_804_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Indices Accounts (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn force_transfer() -> Weight {
(27_390_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
Weight::from_ref_time(27_390_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Indices Accounts (r:1 w:1)
fn freeze() -> Weight {
(30_973_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(30_973_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
}
@@ -92,34 +92,34 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
impl WeightInfo for () {
// Storage: Indices Accounts (r:1 w:1)
fn claim() -> Weight {
(25_929_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(25_929_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Indices Accounts (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn transfer() -> Weight {
(32_627_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(32_627_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Indices Accounts (r:1 w:1)
fn free() -> Weight {
(26_804_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(26_804_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Indices Accounts (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn force_transfer() -> Weight {
(27_390_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
Weight::from_ref_time(27_390_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Indices Accounts (r:1 w:1)
fn freeze() -> Weight {
(30_973_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(30_973_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
}
+37 -37
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_lottery.
@@ -63,30 +63,30 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Account (r:1 w:1)
// Storage: Lottery Tickets (r:0 w:1)
fn buy_ticket() -> Weight {
(44_706_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(44_706_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Lottery CallIndices (r:0 w:1)
fn set_calls(n: u32, ) -> Weight {
(12_556_000 as Weight)
Weight::from_ref_time(12_556_000 as RefTimeWeight)
// Standard Error: 7_000
.saturating_add((295_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(295_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Lottery Lottery (r:1 w:1)
// Storage: Lottery LotteryIndex (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn start_lottery() -> Weight {
(38_051_000 as Weight)
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
Weight::from_ref_time(38_051_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Lottery Lottery (r:1 w:1)
fn stop_repeat() -> Weight {
(6_910_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(6_910_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0)
// Storage: Lottery Lottery (r:1 w:1)
@@ -94,9 +94,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Lottery TicketsCount (r:1 w:1)
// Storage: Lottery Tickets (r:1 w:0)
fn on_initialize_end() -> Weight {
(53_732_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(53_732_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0)
// Storage: Lottery Lottery (r:1 w:1)
@@ -105,9 +105,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Lottery Tickets (r:1 w:0)
// Storage: Lottery LotteryIndex (r:1 w:1)
fn on_initialize_repeat() -> Weight {
(55_868_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(55_868_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
}
@@ -121,30 +121,30 @@ impl WeightInfo for () {
// Storage: System Account (r:1 w:1)
// Storage: Lottery Tickets (r:0 w:1)
fn buy_ticket() -> Weight {
(44_706_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(44_706_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: Lottery CallIndices (r:0 w:1)
fn set_calls(n: u32, ) -> Weight {
(12_556_000 as Weight)
Weight::from_ref_time(12_556_000 as RefTimeWeight)
// Standard Error: 7_000
.saturating_add((295_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(295_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Lottery Lottery (r:1 w:1)
// Storage: Lottery LotteryIndex (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn start_lottery() -> Weight {
(38_051_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
Weight::from_ref_time(38_051_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Lottery Lottery (r:1 w:1)
fn stop_repeat() -> Weight {
(6_910_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(6_910_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0)
// Storage: Lottery Lottery (r:1 w:1)
@@ -152,9 +152,9 @@ impl WeightInfo for () {
// Storage: Lottery TicketsCount (r:1 w:1)
// Storage: Lottery Tickets (r:1 w:0)
fn on_initialize_end() -> Weight {
(53_732_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(6 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(53_732_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(6 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: RandomnessCollectiveFlip RandomMaterial (r:1 w:0)
// Storage: Lottery Lottery (r:1 w:1)
@@ -163,8 +163,8 @@ impl WeightInfo for () {
// Storage: Lottery Tickets (r:1 w:0)
// Storage: Lottery LotteryIndex (r:1 w:1)
fn on_initialize_repeat() -> Weight {
(55_868_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(7 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(55_868_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(7 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
}
+1 -1
View File
@@ -532,7 +532,7 @@ mod tests {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
pub static Members: Vec<u64> = vec![];
pub static Prime: Option<u64> = None;
}
@@ -46,7 +46,7 @@ pub fn migrate<T: frame_system::Config, P: GetStorageVersion + PalletInfoAccess,
target: "runtime::membership",
"New pallet name is equal to the old prefix. No migration needs to be done.",
);
return 0
return Weight::zero()
}
let on_chain_storage_version = <P as GetStorageVersion>::on_chain_storage_version();
@@ -71,7 +71,7 @@ pub fn migrate<T: frame_system::Config, P: GetStorageVersion + PalletInfoAccess,
"Attempted to apply migration to v4 but failed because storage version is {:?}",
on_chain_storage_version,
);
0
Weight::zero()
}
}
+55 -55
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_membership.
@@ -61,11 +61,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn add_member(m: u32, ) -> Weight {
(15_318_000 as Weight)
Weight::from_ref_time(15_318_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((51_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(51_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -73,11 +73,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn remove_member(m: u32, ) -> Weight {
(18_005_000 as Weight)
Weight::from_ref_time(18_005_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((45_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(45_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -85,11 +85,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn swap_member(m: u32, ) -> Weight {
(18_029_000 as Weight)
Weight::from_ref_time(18_029_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(55_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -97,11 +97,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn reset_member(m: u32, ) -> Weight {
(18_105_000 as Weight)
Weight::from_ref_time(18_105_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((158_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(158_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -109,29 +109,29 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn change_key(m: u32, ) -> Weight {
(18_852_000 as Weight)
Weight::from_ref_time(18_852_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(Weight::from_ref_time(55_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:0)
// Storage: TechnicalMembership Prime (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn set_prime(m: u32, ) -> Weight {
(4_869_000 as Weight)
Weight::from_ref_time(4_869_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((28_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(28_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: TechnicalMembership Prime (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn clear_prime(m: u32, ) -> Weight {
(1_593_000 as Weight)
Weight::from_ref_time(1_593_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(m as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
}
@@ -142,11 +142,11 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn add_member(m: u32, ) -> Weight {
(15_318_000 as Weight)
Weight::from_ref_time(15_318_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((51_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(51_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -154,11 +154,11 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn remove_member(m: u32, ) -> Weight {
(18_005_000 as Weight)
Weight::from_ref_time(18_005_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((45_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(45_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -166,11 +166,11 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn swap_member(m: u32, ) -> Weight {
(18_029_000 as Weight)
Weight::from_ref_time(18_029_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(55_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -178,11 +178,11 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn reset_member(m: u32, ) -> Weight {
(18_105_000 as Weight)
Weight::from_ref_time(18_105_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((158_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(158_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:1)
// Storage: TechnicalCommittee Proposals (r:1 w:0)
@@ -190,28 +190,28 @@ impl WeightInfo for () {
// Storage: TechnicalCommittee Members (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn change_key(m: u32, ) -> Weight {
(18_852_000 as Weight)
Weight::from_ref_time(18_852_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((55_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
.saturating_add(Weight::from_ref_time(55_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: TechnicalMembership Members (r:1 w:0)
// Storage: TechnicalMembership Prime (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn set_prime(m: u32, ) -> Weight {
(4_869_000 as Weight)
Weight::from_ref_time(4_869_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((28_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(28_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: TechnicalMembership Prime (r:0 w:1)
// Storage: TechnicalCommittee Prime (r:0 w:1)
fn clear_prime(m: u32, ) -> Weight {
(1_593_000 as Weight)
Weight::from_ref_time(1_593_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(m as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(m as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
}
@@ -30,7 +30,7 @@ impl crate::WeightInfo for () {
// Blake2 hash cost.
let hash_weight = 2 * WEIGHT_PER_NANOS;
// No-op hook.
let hook_weight = 0;
let hook_weight = Weight::zero();
leaf_weight
.saturating_add(hash_weight)
@@ -39,7 +39,7 @@ fn register_offchain_ext(ext: &mut sp_io::TestExternalities) {
ext.register_extension(OffchainWorkerExt::new(offchain));
}
fn new_block() -> u64 {
fn new_block() -> Weight {
let number = frame_system::Pallet::<Test>::block_number() + 1;
let hash = H256::repeat_byte(number as u8);
LEAF_DATA.with(|r| r.borrow_mut().a = number);
@@ -110,7 +110,7 @@ fn should_start_empty() {
crate::RootHash::<Test>::get(),
hex("4320435e8c3318562dba60116bdbcc0b82ffcecb9bb39aae3300cfda3ad0b8b0")
);
assert!(weight != 0);
assert!(weight != Weight::zero());
});
}
+16 -16
View File
@@ -80,7 +80,7 @@ benchmarks! {
// Whitelist caller account from further DB operations.
let caller_key = frame_system::Account::<T>::hashed_key_for(&caller);
frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into());
}: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call, false, 0)
}: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call, false, Weight::zero())
verify {
assert!(Multisigs::<T>::contains_key(multi_account_id, call_hash));
assert!(!Calls::<T>::contains_key(call_hash));
@@ -99,7 +99,7 @@ benchmarks! {
// Whitelist caller account from further DB operations.
let caller_key = frame_system::Account::<T>::hashed_key_for(&caller);
frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into());
}: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call, true, 0)
}: as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call, true, Weight::zero())
verify {
assert!(Multisigs::<T>::contains_key(multi_account_id, call_hash));
assert!(Calls::<T>::contains_key(call_hash));
@@ -118,13 +118,13 @@ benchmarks! {
// before the call, get the timepoint
let timepoint = Multisig::<T>::timepoint();
// Create the multi, storing for worst case
Multisig::<T>::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), true, 0)?;
Multisig::<T>::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), true, Weight::zero())?;
assert!(Calls::<T>::contains_key(call_hash));
let caller2 = signatories2.remove(0);
// Whitelist caller account from further DB operations.
let caller_key = frame_system::Account::<T>::hashed_key_for(&caller2);
frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into());
}: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, false, 0)
}: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, false, Weight::zero())
verify {
let multisig = Multisigs::<T>::get(multi_account_id, call_hash).ok_or("multisig not created")?;
assert_eq!(multisig.approvals.len(), 2);
@@ -143,13 +143,13 @@ benchmarks! {
// before the call, get the timepoint
let timepoint = Multisig::<T>::timepoint();
// Create the multi, not storing
Multisig::<T>::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), false, 0)?;
Multisig::<T>::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), false, Weight::zero())?;
assert!(!Calls::<T>::contains_key(call_hash));
let caller2 = signatories2.remove(0);
// Whitelist caller account from further DB operations.
let caller_key = frame_system::Account::<T>::hashed_key_for(&caller2);
frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into());
}: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, true, 0)
}: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, true, Weight::zero())
verify {
let multisig = Multisigs::<T>::get(multi_account_id, call_hash).ok_or("multisig not created")?;
assert_eq!(multisig.approvals.len(), 2);
@@ -169,20 +169,20 @@ benchmarks! {
// before the call, get the timepoint
let timepoint = Multisig::<T>::timepoint();
// Create the multi, storing it for worst case
Multisig::<T>::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), true, 0)?;
Multisig::<T>::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), true, Weight::zero())?;
// Everyone except the first person approves
for i in 1 .. s - 1 {
let mut signatories_loop = signatories2.clone();
let caller_loop = signatories_loop.remove(i as usize);
let o = RawOrigin::Signed(caller_loop).into();
Multisig::<T>::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone(), false, 0)?;
Multisig::<T>::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone(), false, Weight::zero())?;
}
let caller2 = signatories2.remove(0);
assert!(Multisigs::<T>::contains_key(&multi_account_id, call_hash));
// Whitelist caller account from further DB operations.
let caller_key = frame_system::Account::<T>::hashed_key_for(&caller2);
frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into());
}: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, false, Weight::max_value())
}: as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call, false, Weight::MAX)
verify {
assert!(!Multisigs::<T>::contains_key(&multi_account_id, call_hash));
}
@@ -200,7 +200,7 @@ benchmarks! {
let caller_key = frame_system::Account::<T>::hashed_key_for(&caller);
frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into());
// Create the multi
}: approve_as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call_hash, 0)
}: approve_as_multi(RawOrigin::Signed(caller), s as u16, signatories, None, call_hash, Weight::zero())
verify {
assert!(Multisigs::<T>::contains_key(multi_account_id, call_hash));
}
@@ -225,13 +225,13 @@ benchmarks! {
None,
call,
false,
0
Weight::zero()
)?;
let caller2 = signatories2.remove(0);
// Whitelist caller account from further DB operations.
let caller_key = frame_system::Account::<T>::hashed_key_for(&caller2);
frame_benchmarking::benchmarking::add_to_whitelist(caller_key.into());
}: approve_as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call_hash, 0)
}: approve_as_multi(RawOrigin::Signed(caller2), s as u16, signatories2, Some(timepoint), call_hash, Weight::zero())
verify {
let multisig = Multisigs::<T>::get(multi_account_id, call_hash).ok_or("multisig not created")?;
assert_eq!(multisig.approvals.len(), 2);
@@ -251,13 +251,13 @@ benchmarks! {
// before the call, get the timepoint
let timepoint = Multisig::<T>::timepoint();
// Create the multi
Multisig::<T>::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), true, 0)?;
Multisig::<T>::as_multi(RawOrigin::Signed(caller).into(), s as u16, signatories, None, call.clone(), true, Weight::zero())?;
// Everyone except the first person approves
for i in 1 .. s - 1 {
let mut signatories_loop = signatories2.clone();
let caller_loop = signatories_loop.remove(i as usize);
let o = RawOrigin::Signed(caller_loop).into();
Multisig::<T>::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone(), false, 0)?;
Multisig::<T>::as_multi(o, s as u16, signatories_loop, Some(timepoint), call.clone(), false, Weight::zero())?;
}
let caller2 = signatories2.remove(0);
assert!(Multisigs::<T>::contains_key(&multi_account_id, call_hash));
@@ -270,7 +270,7 @@ benchmarks! {
signatories2,
Some(timepoint),
call_hash,
Weight::max_value()
Weight::MAX
)
verify {
assert!(!Multisigs::<T>::contains_key(multi_account_id, call_hash));
@@ -288,7 +288,7 @@ benchmarks! {
let timepoint = Multisig::<T>::timepoint();
// Create the multi
let o = RawOrigin::Signed(caller.clone()).into();
Multisig::<T>::as_multi(o, s as u16, signatories.clone(), None, call, true, 0)?;
Multisig::<T>::as_multi(o, s as u16, signatories.clone(), None, call, true, Weight::zero())?;
assert!(Multisigs::<T>::contains_key(&multi_account_id, call_hash));
assert!(Calls::<T>::contains_key(call_hash));
// Whitelist caller account from further DB operations.
+2 -2
View File
@@ -257,9 +257,9 @@ pub mod pallet {
let dispatch_info = call.get_dispatch_info();
(
T::WeightInfo::as_multi_threshold_1(call.using_encoded(|c| c.len() as u32))
.saturating_add(dispatch_info.weight)
// AccountData for inner call origin accountdata.
.saturating_add(T::DbWeight::get().reads_writes(1, 1)),
.saturating_add(T::DbWeight::get().reads_writes(1, 1))
.saturating_add(dispatch_info.weight),
dispatch_info.class,
)
})]
+132 -41
View File
@@ -50,7 +50,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
type BaseCallFilter = TestBaseCallFilter;
@@ -152,7 +152,7 @@ fn multisig_deposit_is_taken_and_returned() {
None,
OpaqueCall::from_encoded(data.clone()),
false,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(1), 2);
assert_eq!(Balances::reserved_balance(1), 3);
@@ -190,7 +190,7 @@ fn multisig_deposit_is_taken_and_returned_with_call_storage() {
None,
OpaqueCall::from_encoded(data),
true,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(1), 0);
assert_eq!(Balances::reserved_balance(1), 5);
@@ -221,7 +221,14 @@ fn multisig_deposit_is_taken_and_returned_with_alt_call_storage() {
let data = call.encode();
let hash = blake2_256(&data);
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(1),
3,
vec![2, 3],
None,
hash,
Weight::zero()
));
assert_eq!(Balances::free_balance(1), 1);
assert_eq!(Balances::reserved_balance(1), 4);
@@ -232,7 +239,7 @@ fn multisig_deposit_is_taken_and_returned_with_alt_call_storage() {
Some(now()),
OpaqueCall::from_encoded(data),
true,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(2), 3);
assert_eq!(Balances::reserved_balance(2), 2);
@@ -259,18 +266,25 @@ fn cancel_multisig_returns_deposit() {
new_test_ext().execute_with(|| {
let call = call_transfer(6, 15).encode();
let hash = blake2_256(&call);
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(1),
3,
vec![2, 3],
None,
hash,
Weight::zero()
));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(2),
3,
vec![1, 3],
Some(now()),
hash,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(1), 6);
assert_eq!(Balances::reserved_balance(1), 4);
assert_ok!(Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash),);
assert_ok!(Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash));
assert_eq!(Balances::free_balance(1), 10);
assert_eq!(Balances::reserved_balance(1), 0);
});
@@ -288,11 +302,25 @@ fn timepoint_checking_works() {
let hash = blake2_256(&call);
assert_noop!(
Multisig::approve_as_multi(Origin::signed(2), 2, vec![1, 3], Some(now()), hash, 0),
Multisig::approve_as_multi(
Origin::signed(2),
2,
vec![1, 3],
Some(now()),
hash,
Weight::zero()
),
Error::<Test>::UnexpectedTimepoint,
);
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash, 0));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(1),
2,
vec![2, 3],
None,
hash,
Weight::zero()
));
assert_noop!(
Multisig::as_multi(
@@ -302,7 +330,7 @@ fn timepoint_checking_works() {
None,
OpaqueCall::from_encoded(call.clone()),
false,
0
Weight::zero()
),
Error::<Test>::NoTimepoint,
);
@@ -315,7 +343,7 @@ fn timepoint_checking_works() {
Some(later),
OpaqueCall::from_encoded(call),
false,
0
Weight::zero()
),
Error::<Test>::WrongTimepoint,
);
@@ -341,7 +369,7 @@ fn multisig_2_of_3_works_with_call_storing() {
None,
OpaqueCall::from_encoded(data),
true,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(6), 0);
@@ -369,7 +397,14 @@ fn multisig_2_of_3_works() {
let call_weight = call.get_dispatch_info().weight;
let data = call.encode();
let hash = blake2_256(&data);
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash, 0));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(1),
2,
vec![2, 3],
None,
hash,
Weight::zero()
));
assert_eq!(Balances::free_balance(6), 0);
assert_ok!(Multisig::as_multi(
@@ -397,14 +432,21 @@ fn multisig_3_of_3_works() {
let call_weight = call.get_dispatch_info().weight;
let data = call.encode();
let hash = blake2_256(&data);
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(1),
3,
vec![2, 3],
None,
hash,
Weight::zero()
));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(2),
3,
vec![1, 3],
Some(now()),
hash,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(6), 0);
@@ -426,14 +468,21 @@ fn cancel_multisig_works() {
new_test_ext().execute_with(|| {
let call = call_transfer(6, 15).encode();
let hash = blake2_256(&call);
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(1),
3,
vec![2, 3],
None,
hash,
Weight::zero()
));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(2),
3,
vec![1, 3],
Some(now()),
hash,
0
Weight::zero()
));
assert_noop!(
Multisig::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash),
@@ -455,7 +504,7 @@ fn cancel_multisig_with_call_storage_works() {
None,
OpaqueCall::from_encoded(call),
true,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(1), 4);
assert_ok!(Multisig::approve_as_multi(
@@ -464,7 +513,7 @@ fn cancel_multisig_with_call_storage_works() {
vec![1, 3],
Some(now()),
hash,
0
Weight::zero()
));
assert_noop!(
Multisig::cancel_as_multi(Origin::signed(2), 3, vec![1, 3], now(), hash),
@@ -480,7 +529,14 @@ fn cancel_multisig_with_alt_call_storage_works() {
new_test_ext().execute_with(|| {
let call = call_transfer(6, 15).encode();
let hash = blake2_256(&call);
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(1),
3,
vec![2, 3],
None,
hash,
Weight::zero()
));
assert_eq!(Balances::free_balance(1), 6);
assert_ok!(Multisig::as_multi(
Origin::signed(2),
@@ -489,7 +545,7 @@ fn cancel_multisig_with_alt_call_storage_works() {
Some(now()),
OpaqueCall::from_encoded(call),
true,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(2), 8);
assert_ok!(Multisig::cancel_as_multi(Origin::signed(1), 3, vec![2, 3], now(), hash));
@@ -516,7 +572,7 @@ fn multisig_2_of_3_as_multi_works() {
None,
OpaqueCall::from_encoded(data.clone()),
false,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(6), 0);
@@ -555,7 +611,7 @@ fn multisig_2_of_3_as_multi_with_many_calls_works() {
None,
OpaqueCall::from_encoded(data1.clone()),
false,
0
Weight::zero()
));
assert_ok!(Multisig::as_multi(
Origin::signed(2),
@@ -564,7 +620,7 @@ fn multisig_2_of_3_as_multi_with_many_calls_works() {
None,
OpaqueCall::from_encoded(data2.clone()),
false,
0
Weight::zero()
));
assert_ok!(Multisig::as_multi(
Origin::signed(3),
@@ -609,7 +665,7 @@ fn multisig_2_of_3_cannot_reissue_same_call() {
None,
OpaqueCall::from_encoded(data.clone()),
false,
0
Weight::zero()
));
assert_ok!(Multisig::as_multi(
Origin::signed(2),
@@ -629,7 +685,7 @@ fn multisig_2_of_3_cannot_reissue_same_call() {
None,
OpaqueCall::from_encoded(data.clone()),
false,
0
Weight::zero()
));
assert_ok!(Multisig::as_multi(
Origin::signed(3),
@@ -667,7 +723,7 @@ fn minimum_threshold_check_works() {
None,
OpaqueCall::from_encoded(call.clone()),
false,
0
Weight::zero()
),
Error::<Test>::MinimumThreshold,
);
@@ -679,7 +735,7 @@ fn minimum_threshold_check_works() {
None,
OpaqueCall::from_encoded(call.clone()),
false,
0
Weight::zero()
),
Error::<Test>::MinimumThreshold,
);
@@ -698,7 +754,7 @@ fn too_many_signatories_fails() {
None,
OpaqueCall::from_encoded(call),
false,
0
Weight::zero()
),
Error::<Test>::TooManySignatories,
);
@@ -710,9 +766,23 @@ fn duplicate_approvals_are_ignored() {
new_test_ext().execute_with(|| {
let call = call_transfer(6, 15).encode();
let hash = blake2_256(&call);
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], None, hash, 0));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(1),
2,
vec![2, 3],
None,
hash,
Weight::zero()
));
assert_noop!(
Multisig::approve_as_multi(Origin::signed(1), 2, vec![2, 3], Some(now()), hash, 0),
Multisig::approve_as_multi(
Origin::signed(1),
2,
vec![2, 3],
Some(now()),
hash,
Weight::zero()
),
Error::<Test>::AlreadyApproved,
);
assert_ok!(Multisig::approve_as_multi(
@@ -721,10 +791,17 @@ fn duplicate_approvals_are_ignored() {
vec![1, 3],
Some(now()),
hash,
0
Weight::zero()
));
assert_noop!(
Multisig::approve_as_multi(Origin::signed(3), 2, vec![1, 2], Some(now()), hash, 0),
Multisig::approve_as_multi(
Origin::signed(3),
2,
vec![1, 2],
Some(now()),
hash,
Weight::zero()
),
Error::<Test>::AlreadyApproved,
);
});
@@ -741,7 +818,14 @@ fn multisig_1_of_3_works() {
let call = call_transfer(6, 15).encode();
let hash = blake2_256(&call);
assert_noop!(
Multisig::approve_as_multi(Origin::signed(1), 1, vec![2, 3], None, hash, 0),
Multisig::approve_as_multi(
Origin::signed(1),
1,
vec![2, 3],
None,
hash,
Weight::zero()
),
Error::<Test>::MinimumThreshold,
);
assert_noop!(
@@ -752,7 +836,7 @@ fn multisig_1_of_3_works() {
None,
OpaqueCall::from_encoded(call),
false,
0
Weight::zero()
),
Error::<Test>::MinimumThreshold,
);
@@ -791,7 +875,7 @@ fn weight_check_works() {
None,
OpaqueCall::from_encoded(data.clone()),
false,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(6), 0);
@@ -803,7 +887,7 @@ fn weight_check_works() {
Some(now()),
OpaqueCall::from_encoded(data),
false,
0
Weight::zero()
),
Error::<Test>::MaxWeightTooLow,
);
@@ -825,14 +909,21 @@ fn multisig_handles_no_preimage_after_all_approve() {
let call_weight = call.get_dispatch_info().weight;
let data = call.encode();
let hash = blake2_256(&data);
assert_ok!(Multisig::approve_as_multi(Origin::signed(1), 3, vec![2, 3], None, hash, 0));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(1),
3,
vec![2, 3],
None,
hash,
Weight::zero()
));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(2),
3,
vec![1, 3],
Some(now()),
hash,
0
Weight::zero()
));
assert_ok!(Multisig::approve_as_multi(
Origin::signed(3),
@@ -840,7 +931,7 @@ fn multisig_handles_no_preimage_after_all_approve() {
vec![1, 2],
Some(now()),
hash,
0
Weight::zero()
));
assert_eq!(Balances::free_balance(6), 0);
+85 -85
View File
@@ -39,7 +39,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_multisig.
@@ -60,199 +60,199 @@ pub trait WeightInfo {
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn as_multi_threshold_1(_z: u32, ) -> Weight {
(17_537_000 as Weight)
Weight::from_ref_time(17_537_000 as RefTimeWeight)
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
fn as_multi_create(s: u32, z: u32, ) -> Weight {
(36_535_000 as Weight)
Weight::from_ref_time(36_535_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((99_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(99_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.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))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
fn as_multi_create_store(s: u32, z: u32, ) -> Weight {
(39_918_000 as Weight)
Weight::from_ref_time(39_918_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((95_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(95_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.saturating_add((2_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))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
fn as_multi_approve(s: u32, z: u32, ) -> Weight {
(25_524_000 as Weight)
Weight::from_ref_time(25_524_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((94_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(94_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.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))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
fn as_multi_approve_store(s: u32, z: u32, ) -> Weight {
(39_923_000 as Weight)
Weight::from_ref_time(39_923_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((91_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(91_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.saturating_add((2_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))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn as_multi_complete(s: u32, z: u32, ) -> Weight {
(45_877_000 as Weight)
Weight::from_ref_time(45_877_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((146_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(146_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.saturating_add((2_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))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
fn approve_as_multi_create(s: u32, ) -> Weight {
(34_309_000 as Weight)
Weight::from_ref_time(34_309_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((114_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))
.saturating_add(Weight::from_ref_time(114_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:0)
fn approve_as_multi_approve(s: u32, ) -> Weight {
(22_848_000 as Weight)
Weight::from_ref_time(22_848_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((114_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))
.saturating_add(Weight::from_ref_time(114_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn approve_as_multi_complete(s: u32, ) -> Weight {
(63_239_000 as Weight)
Weight::from_ref_time(63_239_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((161_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(Weight::from_ref_time(161_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
fn cancel_as_multi(s: u32, ) -> Weight {
(51_254_000 as Weight)
Weight::from_ref_time(51_254_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((118_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))
.saturating_add(Weight::from_ref_time(118_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
}
// For backwards compatibility and tests
impl WeightInfo for () {
fn as_multi_threshold_1(_z: u32, ) -> Weight {
(17_537_000 as Weight)
Weight::from_ref_time(17_537_000 as RefTimeWeight)
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
fn as_multi_create(s: u32, z: u32, ) -> Weight {
(36_535_000 as Weight)
Weight::from_ref_time(36_535_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((99_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(99_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.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))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
fn as_multi_create_store(s: u32, z: u32, ) -> Weight {
(39_918_000 as Weight)
Weight::from_ref_time(39_918_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((95_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(95_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
fn as_multi_approve(s: u32, z: u32, ) -> Weight {
(25_524_000 as Weight)
Weight::from_ref_time(25_524_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((94_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(94_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.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))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
fn as_multi_approve_store(s: u32, z: u32, ) -> Weight {
(39_923_000 as Weight)
Weight::from_ref_time(39_923_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((91_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(91_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn as_multi_complete(s: u32, z: u32, ) -> Weight {
(45_877_000 as Weight)
Weight::from_ref_time(45_877_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((146_000 as Weight).saturating_mul(s as Weight))
.saturating_add(Weight::from_ref_time(146_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
// Standard Error: 0
.saturating_add((2_000 as Weight).saturating_mul(z as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
.saturating_add(Weight::from_ref_time(2_000 as RefTimeWeight).scalar_saturating_mul(z as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: unknown [0x3a65787472696e7369635f696e646578] (r:1 w:0)
fn approve_as_multi_create(s: u32, ) -> Weight {
(34_309_000 as Weight)
Weight::from_ref_time(34_309_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((114_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(114_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:0)
fn approve_as_multi_approve(s: u32, ) -> Weight {
(22_848_000 as Weight)
Weight::from_ref_time(22_848_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((114_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
.saturating_add(Weight::from_ref_time(114_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn approve_as_multi_complete(s: u32, ) -> Weight {
(63_239_000 as Weight)
Weight::from_ref_time(63_239_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((161_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(Weight::from_ref_time(161_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(3 as RefTimeWeight))
}
// Storage: Multisig Multisigs (r:1 w:1)
// Storage: Multisig Calls (r:1 w:1)
fn cancel_as_multi(s: u32, ) -> Weight {
(51_254_000 as Weight)
Weight::from_ref_time(51_254_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((118_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(118_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
}
+1 -1
View File
@@ -273,7 +273,7 @@ mod tests {
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
frame_system::limits::BlockWeights::simple_max(frame_support::weights::Weight::from_ref_time(1024));
}
impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
@@ -21,7 +21,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
pub trait WeightInfo {
@@ -37,13 +37,13 @@ pub trait WeightInfo {
}
impl WeightInfo for () {
fn add_well_known_node() -> Weight { 50_000_000 }
fn remove_well_known_node() -> Weight { 50_000_000 }
fn swap_well_known_node() -> Weight { 50_000_000 }
fn reset_well_known_nodes() -> Weight { 50_000_000 }
fn claim_node() -> Weight { 50_000_000 }
fn remove_claim() -> Weight { 50_000_000 }
fn transfer_node() -> Weight { 50_000_000 }
fn add_connections() -> Weight { 50_000_000 }
fn remove_connections() -> Weight { 50_000_000 }
fn add_well_known_node() -> Weight { Weight::from_ref_time(50_000_000) }
fn remove_well_known_node() -> Weight { Weight::from_ref_time(50_000_000) }
fn swap_well_known_node() -> Weight { Weight::from_ref_time(50_000_000) }
fn reset_well_known_nodes() -> Weight { Weight::from_ref_time(50_000_000) }
fn claim_node() -> Weight { Weight::from_ref_time(50_000_000) }
fn remove_claim() -> Weight { Weight::from_ref_time(50_000_000) }
fn transfer_node() -> Weight { Weight::from_ref_time(50_000_000) }
fn add_connections() -> Weight { Weight::from_ref_time(50_000_000) }
fn remove_connections() -> Weight { Weight::from_ref_time(50_000_000) }
}
@@ -320,6 +320,7 @@ pub mod v2 {
current
);
current.put::<Pallet<T>>();
T::DbWeight::get().reads_writes(members_translated + 1, reward_pools_translated + 1)
}
}
+99 -99
View File
@@ -41,7 +41,7 @@
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use frame_support::{traits::Get, weights::{RefTimeWeight, Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_nomination_pools.
@@ -80,9 +80,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn join() -> Weight {
(123_947_000 as Weight)
.saturating_add(T::DbWeight::get().reads(17 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
Weight::from_ref_time(123_947_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(17 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(12 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -94,9 +94,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_transfer() -> Weight {
(118_236_000 as Weight)
.saturating_add(T::DbWeight::get().reads(14 as Weight))
.saturating_add(T::DbWeight::get().writes(12 as Weight))
Weight::from_ref_time(118_236_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(14 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(12 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -108,18 +108,18 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_reward() -> Weight {
(132_475_000 as Weight)
.saturating_add(T::DbWeight::get().reads(14 as Weight))
.saturating_add(T::DbWeight::get().writes(13 as Weight))
Weight::from_ref_time(132_475_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(14 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(13 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn claim_payout() -> Weight {
(50_299_000 as Weight)
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
Weight::from_ref_time(50_299_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -136,9 +136,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools SubPoolsStorage (r:1 w:1)
// Storage: NominationPools CounterForSubPoolsStorage (r:1 w:1)
fn unbond() -> Weight {
(121_254_000 as Weight)
.saturating_add(T::DbWeight::get().reads(18 as Weight))
.saturating_add(T::DbWeight::get().writes(13 as Weight))
Weight::from_ref_time(121_254_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(18 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(13 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
@@ -146,11 +146,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Balances Locks (r:1 w:1)
/// The range of component `s` is `[0, 100]`.
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
(41_928_000 as Weight)
Weight::from_ref_time(41_928_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((52_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(4 as Weight))
.saturating_add(T::DbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(52_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
@@ -162,11 +162,11 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools CounterForPoolMembers (r:1 w:1)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_update(s: u32, ) -> Weight {
(81_611_000 as Weight)
Weight::from_ref_time(81_611_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((56_000 as Weight).saturating_mul(s as Weight))
.saturating_add(T::DbWeight::get().reads(8 as Weight))
.saturating_add(T::DbWeight::get().writes(7 as Weight))
.saturating_add(Weight::from_ref_time(56_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(8 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(7 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
@@ -189,9 +189,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking Payee (r:0 w:1)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
(139_849_000 as Weight)
.saturating_add(T::DbWeight::get().reads(19 as Weight))
.saturating_add(T::DbWeight::get().writes(16 as Weight))
Weight::from_ref_time(139_849_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(19 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(16 as RefTimeWeight))
}
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: NominationPools MinCreateBond (r:1 w:0)
@@ -216,9 +216,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn create() -> Weight {
(126_246_000 as Weight)
.saturating_add(T::DbWeight::get().reads(22 as Weight))
.saturating_add(T::DbWeight::get().writes(15 as Weight))
Weight::from_ref_time(126_246_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(22 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(15 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
@@ -234,30 +234,30 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Staking CounterForNominators (r:1 w:1)
/// The range of component `n` is `[1, 16]`.
fn nominate(n: u32, ) -> Weight {
(48_829_000 as Weight)
Weight::from_ref_time(48_829_000 as RefTimeWeight)
// Standard Error: 10_000
.saturating_add((2_204_000 as Weight).saturating_mul(n as Weight))
.saturating_add(T::DbWeight::get().reads(12 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
.saturating_add(Weight::from_ref_time(2_204_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(12 as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads((1 as RefTimeWeight).saturating_mul(n as RefTimeWeight)))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Ledger (r:1 w:0)
fn set_state() -> Weight {
(26_761_000 as Weight)
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(26_761_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: NominationPools Metadata (r:1 w:1)
// Storage: NominationPools CounterForMetadata (r:1 w:1)
/// The range of component `n` is `[1, 256]`.
fn set_metadata(n: u32, ) -> Weight {
(14_519_000 as Weight)
Weight::from_ref_time(14_519_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((1_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))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
.saturating_add(T::DbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: NominationPools MinJoinBond (r:0 w:1)
// Storage: NominationPools MaxPoolMembers (r:0 w:1)
@@ -265,14 +265,14 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: NominationPools MinCreateBond (r:0 w:1)
// Storage: NominationPools MaxPools (r:0 w:1)
fn set_configs() -> Weight {
(6_173_000 as Weight)
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(6_173_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:1)
fn update_roles() -> Weight {
(22_261_000 as Weight)
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
Weight::from_ref_time(22_261_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
@@ -283,9 +283,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: BagsList ListBags (r:1 w:1)
// Storage: BagsList CounterForListNodes (r:1 w:1)
fn chill() -> Weight {
(47_959_000 as Weight)
.saturating_add(T::DbWeight::get().reads(8 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
Weight::from_ref_time(47_959_000 as RefTimeWeight)
.saturating_add(T::DbWeight::get().reads(8 as RefTimeWeight))
.saturating_add(T::DbWeight::get().writes(5 as RefTimeWeight))
}
}
@@ -305,9 +305,9 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn join() -> Weight {
(123_947_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(17 as Weight))
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
Weight::from_ref_time(123_947_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(17 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(12 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -319,9 +319,9 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_transfer() -> Weight {
(118_236_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(14 as Weight))
.saturating_add(RocksDbWeight::get().writes(12 as Weight))
Weight::from_ref_time(118_236_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(14 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(12 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -333,18 +333,18 @@ impl WeightInfo for () {
// Storage: BagsList ListNodes (r:3 w:3)
// Storage: BagsList ListBags (r:2 w:2)
fn bond_extra_reward() -> Weight {
(132_475_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(14 as Weight))
.saturating_add(RocksDbWeight::get().writes(13 as Weight))
Weight::from_ref_time(132_475_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(14 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(13 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: NominationPools RewardPools (r:1 w:1)
// Storage: System Account (r:1 w:1)
fn claim_payout() -> Weight {
(50_299_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(4 as Weight))
Weight::from_ref_time(50_299_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(4 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: NominationPools BondedPools (r:1 w:1)
@@ -361,9 +361,9 @@ impl WeightInfo for () {
// Storage: NominationPools SubPoolsStorage (r:1 w:1)
// Storage: NominationPools CounterForSubPoolsStorage (r:1 w:1)
fn unbond() -> Weight {
(121_254_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(18 as Weight))
.saturating_add(RocksDbWeight::get().writes(13 as Weight))
Weight::from_ref_time(121_254_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(18 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(13 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:1)
@@ -371,11 +371,11 @@ impl WeightInfo for () {
// Storage: Balances Locks (r:1 w:1)
/// The range of component `s` is `[0, 100]`.
fn pool_withdraw_unbonded(s: u32, ) -> Weight {
(41_928_000 as Weight)
Weight::from_ref_time(41_928_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((52_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(4 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(52_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(4 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
@@ -387,11 +387,11 @@ impl WeightInfo for () {
// Storage: NominationPools CounterForPoolMembers (r:1 w:1)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_update(s: u32, ) -> Weight {
(81_611_000 as Weight)
Weight::from_ref_time(81_611_000 as RefTimeWeight)
// Standard Error: 1_000
.saturating_add((56_000 as Weight).saturating_mul(s as Weight))
.saturating_add(RocksDbWeight::get().reads(8 as Weight))
.saturating_add(RocksDbWeight::get().writes(7 as Weight))
.saturating_add(Weight::from_ref_time(56_000 as RefTimeWeight).scalar_saturating_mul(s as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(8 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(7 as RefTimeWeight))
}
// Storage: NominationPools PoolMembers (r:1 w:1)
// Storage: Staking CurrentEra (r:1 w:0)
@@ -414,9 +414,9 @@ impl WeightInfo for () {
// Storage: Staking Payee (r:0 w:1)
/// The range of component `s` is `[0, 100]`.
fn withdraw_unbonded_kill(_s: u32, ) -> Weight {
(139_849_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(19 as Weight))
.saturating_add(RocksDbWeight::get().writes(16 as Weight))
Weight::from_ref_time(139_849_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(19 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(16 as RefTimeWeight))
}
// Storage: Staking MinNominatorBond (r:1 w:0)
// Storage: NominationPools MinCreateBond (r:1 w:0)
@@ -441,9 +441,9 @@ impl WeightInfo for () {
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Payee (r:0 w:1)
fn create() -> Weight {
(126_246_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(22 as Weight))
.saturating_add(RocksDbWeight::get().writes(15 as Weight))
Weight::from_ref_time(126_246_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(22 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(15 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
@@ -459,30 +459,30 @@ impl WeightInfo for () {
// Storage: Staking CounterForNominators (r:1 w:1)
/// The range of component `n` is `[1, 16]`.
fn nominate(n: u32, ) -> Weight {
(48_829_000 as Weight)
Weight::from_ref_time(48_829_000 as RefTimeWeight)
// Standard Error: 10_000
.saturating_add((2_204_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().reads(12 as Weight))
.saturating_add(RocksDbWeight::get().reads((1 as Weight).saturating_mul(n as Weight)))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
.saturating_add(Weight::from_ref_time(2_204_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(12 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads((1 as RefTimeWeight).saturating_mul(n as RefTimeWeight)))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:1)
// Storage: Staking Ledger (r:1 w:0)
fn set_state() -> Weight {
(26_761_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(2 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(26_761_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(2 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: NominationPools Metadata (r:1 w:1)
// Storage: NominationPools CounterForMetadata (r:1 w:1)
/// The range of component `n` is `[1, 256]`.
fn set_metadata(n: u32, ) -> Weight {
(14_519_000 as Weight)
Weight::from_ref_time(14_519_000 as RefTimeWeight)
// Standard Error: 0
.saturating_add((1_000 as Weight).saturating_mul(n as Weight))
.saturating_add(RocksDbWeight::get().reads(3 as Weight))
.saturating_add(RocksDbWeight::get().writes(2 as Weight))
.saturating_add(Weight::from_ref_time(1_000 as RefTimeWeight).scalar_saturating_mul(n as RefTimeWeight))
.saturating_add(RocksDbWeight::get().reads(3 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(2 as RefTimeWeight))
}
// Storage: NominationPools MinJoinBond (r:0 w:1)
// Storage: NominationPools MaxPoolMembers (r:0 w:1)
@@ -490,14 +490,14 @@ impl WeightInfo for () {
// Storage: NominationPools MinCreateBond (r:0 w:1)
// Storage: NominationPools MaxPools (r:0 w:1)
fn set_configs() -> Weight {
(6_173_000 as Weight)
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(6_173_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:1)
fn update_roles() -> Weight {
(22_261_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
Weight::from_ref_time(22_261_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(1 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(1 as RefTimeWeight))
}
// Storage: NominationPools BondedPools (r:1 w:0)
// Storage: Staking Ledger (r:1 w:0)
@@ -508,8 +508,8 @@ impl WeightInfo for () {
// Storage: BagsList ListBags (r:1 w:1)
// Storage: BagsList CounterForListNodes (r:1 w:1)
fn chill() -> Weight {
(47_959_000 as Weight)
.saturating_add(RocksDbWeight::get().reads(8 as Weight))
.saturating_add(RocksDbWeight::get().writes(5 as Weight))
Weight::from_ref_time(47_959_000 as RefTimeWeight)
.saturating_add(RocksDbWeight::get().reads(8 as RefTimeWeight))
.saturating_add(RocksDbWeight::get().writes(5 as RefTimeWeight))
}
}
@@ -40,7 +40,9 @@ type Balance = u64;
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(2 * WEIGHT_PER_SECOND);
frame_system::limits::BlockWeights::simple_max(
2 * WEIGHT_PER_SECOND
);
}
impl frame_system::Config for Test {
+1 -1
View File
@@ -50,7 +50,7 @@ frame_support::construct_runtime!(
parameter_types! {
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(2_000_000_000_000);
frame_system::limits::BlockWeights::simple_max(Weight::from_ref_time(2_000_000_000_000));
}
impl frame_system::Config for Test {
type BaseCallFilter = Everything;

Some files were not shown because too many files have changed in this diff Show More