git.delta.rocks / unique-network / refs/commits / 3ce5f80a2a4f

difftreelog

source

pallets/collator-selection/src/weights.rs6.1 KiBsourcehistory
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license:18// This file is part of Substrate.1920// Copyright (C) 2021 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435#![allow(unused_parens)]36#![allow(unused_imports)]3738use frame_support::{39	traits::Get,40	weights::{constants::RocksDbWeight, Weight},41};42use sp_std::marker::PhantomData;4344// todo:collator re-generate weights45// The weight info trait for `pallet_collator_selection`.46pub trait WeightInfo {47	fn set_invulnerables(_b: u32) -> Weight;48	fn set_desired_collators() -> Weight;49	fn set_license_bond() -> Weight;50	fn register_as_candidate(_c: u32) -> Weight;51	fn leave_intent(_c: u32) -> Weight;52	fn note_author() -> Weight;53	fn new_session(_c: u32, _r: u32) -> Weight;54}5556/// Weights for pallet_collator_selection using the Substrate node and recommended hardware.57pub struct SubstrateWeight<T>(PhantomData<T>);58impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {59	fn set_invulnerables(b: u32) -> Weight {60		Weight::from_ref_time(18_563_000 as u64)61			// Standard Error: 062			.saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))63			.saturating_add(T::DbWeight::get().writes(1 as u64))64	}65	fn set_desired_collators() -> Weight {66		Weight::from_ref_time(16_363_000 as u64).saturating_add(T::DbWeight::get().writes(1 as u64))67	}68	fn set_license_bond() -> Weight {69		Weight::from_ref_time(16_840_000 as u64).saturating_add(T::DbWeight::get().writes(1 as u64))70	}71	fn register_as_candidate(c: u32) -> Weight {72		Weight::from_ref_time(71_196_000 as u64)73			// Standard Error: 074			.saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))75			.saturating_add(T::DbWeight::get().reads(4 as u64))76			.saturating_add(T::DbWeight::get().writes(2 as u64))77	}78	fn leave_intent(c: u32) -> Weight {79		Weight::from_ref_time(55_336_000 as u64)80			// Standard Error: 081			.saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))82			.saturating_add(T::DbWeight::get().reads(1 as u64))83			.saturating_add(T::DbWeight::get().writes(2 as u64))84	}85	fn note_author() -> Weight {86		Weight::from_ref_time(71_461_000 as u64)87			.saturating_add(T::DbWeight::get().reads(3 as u64))88			.saturating_add(T::DbWeight::get().writes(4 as u64))89	}90	fn new_session(r: u32, c: u32) -> Weight {91		Weight::from_ref_time(0 as u64)92			// Standard Error: 1_010_00093			.saturating_add(Weight::from_ref_time(109_961_000 as u64).saturating_mul(r as u64))94			// Standard Error: 1_010_00095			.saturating_add(Weight::from_ref_time(151_952_000 as u64).saturating_mul(c as u64))96			.saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64)))97			.saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64)))98			.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(r as u64)))99			.saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64)))100	}101}102103// For backwards compatibility and tests104impl WeightInfo for () {105	fn set_invulnerables(b: u32) -> Weight {106		Weight::from_ref_time(18_563_000 as u64)107			// Standard Error: 0108			.saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))109			.saturating_add(RocksDbWeight::get().writes(1 as u64))110	}111	fn set_desired_collators() -> Weight {112		Weight::from_ref_time(16_363_000 as u64)113			.saturating_add(RocksDbWeight::get().writes(1 as u64))114	}115	fn set_license_bond() -> Weight {116		Weight::from_ref_time(16_840_000 as u64)117			.saturating_add(RocksDbWeight::get().writes(1 as u64))118	}119	fn register_as_candidate(c: u32) -> Weight {120		Weight::from_ref_time(71_196_000 as u64)121			// Standard Error: 0122			.saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))123			.saturating_add(RocksDbWeight::get().reads(4 as u64))124			.saturating_add(RocksDbWeight::get().writes(2 as u64))125	}126	fn leave_intent(c: u32) -> Weight {127		Weight::from_ref_time(55_336_000 as u64)128			// Standard Error: 0129			.saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))130			.saturating_add(RocksDbWeight::get().reads(1 as u64))131			.saturating_add(RocksDbWeight::get().writes(2 as u64))132	}133	fn note_author() -> Weight {134		Weight::from_ref_time(71_461_000 as u64)135			.saturating_add(RocksDbWeight::get().reads(3 as u64))136			.saturating_add(RocksDbWeight::get().writes(4 as u64))137	}138	fn new_session(r: u32, c: u32) -> Weight {139		Weight::from_ref_time(0 as u64)140			// Standard Error: 1_010_000141			.saturating_add(Weight::from_ref_time(109_961_000 as u64).saturating_mul(r as u64))142			// Standard Error: 1_010_000143			.saturating_add(Weight::from_ref_time(151_952_000 as u64).saturating_mul(c as u64))144			.saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(r as u64)))145			.saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(c as u64)))146			.saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(r as u64)))147			.saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64)))148	}149}