difftreelog
style(collator-selection) get rid of some todos
in: master
3 files changed
pallets/collator-selection/src/lib.rsdiffbeforeafterboth--- a/pallets/collator-selection/src/lib.rs
+++ b/pallets/collator-selection/src/lib.rs
@@ -285,7 +285,7 @@
impl<T: Config> Pallet<T> {
/// Add a collator to the list of invulnerable (fixed) collators.
#[pallet::call_index(0)]
- #[pallet::weight(T::WeightInfo::add_invulnerable(T::MaxCollators::get()))] // todo:collator weight
+ #[pallet::weight(T::WeightInfo::add_invulnerable(T::MaxCollators::get()))]
pub fn add_invulnerable(
origin: OriginFor<T>,
new: T::AccountId,
@@ -315,7 +315,7 @@
/// Remove a collator from the list of invulnerable (fixed) collators.
#[pallet::call_index(1)]
- #[pallet::weight(T::WeightInfo::remove_invulnerable(T::MaxCollators::get()))] // todo:collator weight
+ #[pallet::weight(T::WeightInfo::remove_invulnerable(T::MaxCollators::get()))]
pub fn remove_invulnerable(
origin: OriginFor<T>,
who: T::AccountId,
@@ -344,7 +344,7 @@
///
/// This call is not available to `Invulnerable` collators.
#[pallet::call_index(2)]
- #[pallet::weight(T::WeightInfo::get_license(T::MaxCollators::get()))] // todo:collator weight
+ #[pallet::weight(T::WeightInfo::get_license(T::MaxCollators::get()))]
pub fn get_license(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// register_as_candidate
let who = ensure_signed(origin)?;
@@ -377,7 +377,7 @@
///
/// This call is not available to `Invulnerable` collators.
#[pallet::call_index(3)]
- #[pallet::weight(T::WeightInfo::onboard(T::MaxCollators::get()))] // todo:collator weight
+ #[pallet::weight(T::WeightInfo::onboard(T::MaxCollators::get()))]
pub fn onboard(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// register_as_candidate
let who = ensure_signed(origin)?;
@@ -423,27 +423,27 @@
/// Deregister `origin` as a collator candidate. Note that the collator can only leave on
/// session change. The license to `onboard` later at any other time will remain.
#[pallet::call_index(4)]
- #[pallet::weight(T::WeightInfo::offboard(T::MaxCollators::get()))] // todo:collator weight
+ #[pallet::weight(T::WeightInfo::offboard(T::MaxCollators::get()))]
pub fn offboard(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// leave_intent
let who = ensure_signed(origin)?;
let current_count = Self::try_remove_candidate(&who)?;
- Ok(Some(T::WeightInfo::offboard(current_count as u32)).into()) // todo:collator weight
+ Ok(Some(T::WeightInfo::offboard(current_count as u32)).into())
}
/// Forfeit `origin`'s own license. The `LicenseBond` will be unreserved immediately.
///
/// This call is not available to `Invulnerable` collators.
#[pallet::call_index(5)]
- #[pallet::weight(T::WeightInfo::release_license(T::MaxCollators::get()))] // todo:collator weight
+ #[pallet::weight(T::WeightInfo::release_license(T::MaxCollators::get()))]
pub fn release_license(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
// leave_intent
let who = ensure_signed(origin)?;
let current_count = Self::try_remove_candidate_and_release_license(&who, false, true)?;
- Ok(Some(T::WeightInfo::release_license(current_count as u32)).into()) // todo:collator weight
+ Ok(Some(T::WeightInfo::release_license(current_count as u32)).into())
}
/// Force deregister `origin` as a collator candidate as a governing authority, and revoke its license.
@@ -452,7 +452,7 @@
///
/// This call is, of course, not applicable to `Invulnerable` collators.
#[pallet::call_index(6)]
- #[pallet::weight(T::WeightInfo::force_release_license(T::MaxCollators::get()))] // todo:collator weight
+ #[pallet::weight(T::WeightInfo::force_release_license(T::MaxCollators::get()))]
pub fn force_release_license(
origin: OriginFor<T>,
who: T::AccountId,
@@ -462,7 +462,7 @@
let current_count = Self::try_remove_candidate_and_release_license(&who, false, true)?;
- Ok(Some(T::WeightInfo::force_release_license(current_count as u32)).into()) // todo:collator weight
+ Ok(Some(T::WeightInfo::force_release_license(current_count as u32)).into())
}
}
pallets/collator-selection/src/weights.rsdiffbeforeafterboth1// 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 add_invulnerable(_b: u32) -> Weight;48 fn remove_invulnerable(_b: u32) -> Weight;49 fn get_license(_c: u32) -> Weight;50 fn onboard(_c: u32) -> Weight;51 fn offboard(_c: u32) -> Weight;52 fn release_license(_c: u32) -> Weight;53 fn force_release_license(_c: u32) -> Weight;54 fn note_author() -> Weight;55 fn new_session(_c: u32, _r: u32) -> Weight;56}5758/// Weights for pallet_collator_selection using the Substrate node and recommended hardware.59pub struct SubstrateWeight<T>(PhantomData<T>);60impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {61 fn add_invulnerable(b: u32) -> Weight {62 Weight::from_ref_time(18_563_000 as u64)63 // Standard Error: 064 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))65 .saturating_add(T::DbWeight::get().writes(1 as u64))66 }67 fn remove_invulnerable(b: u32) -> Weight {68 Weight::from_ref_time(18_563_000 as u64)69 // Standard Error: 070 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))71 .saturating_add(T::DbWeight::get().writes(1 as u64))72 }73 fn get_license(c: u32) -> Weight {74 Weight::from_ref_time(71_196_000 as u64)75 // Standard Error: 076 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))77 .saturating_add(T::DbWeight::get().reads(4 as u64))78 .saturating_add(T::DbWeight::get().writes(2 as u64))79 }80 fn onboard(c: u32) -> Weight {81 Weight::from_ref_time(71_196_000 as u64)82 // Standard Error: 083 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))84 .saturating_add(T::DbWeight::get().reads(4 as u64))85 .saturating_add(T::DbWeight::get().writes(2 as u64))86 }87 fn offboard(c: u32) -> Weight {88 Weight::from_ref_time(55_336_000 as u64)89 // Standard Error: 090 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))91 .saturating_add(T::DbWeight::get().reads(1 as u64))92 .saturating_add(T::DbWeight::get().writes(2 as u64))93 }94 fn release_license(c: u32) -> Weight {95 Weight::from_ref_time(55_336_000 as u64)96 // Standard Error: 097 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))98 .saturating_add(T::DbWeight::get().reads(1 as u64))99 .saturating_add(T::DbWeight::get().writes(2 as u64))100 }101 fn force_release_license(c: u32) -> Weight {102 Weight::from_ref_time(55_336_000 as u64)103 // Standard Error: 0104 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))105 .saturating_add(T::DbWeight::get().reads(1 as u64))106 .saturating_add(T::DbWeight::get().writes(2 as u64))107 }108 fn note_author() -> Weight {109 Weight::from_ref_time(71_461_000 as u64)110 .saturating_add(T::DbWeight::get().reads(3 as u64))111 .saturating_add(T::DbWeight::get().writes(4 as u64))112 }113 fn new_session(r: u32, c: u32) -> Weight {114 Weight::from_ref_time(0 as u64)115 // Standard Error: 1_010_000116 .saturating_add(Weight::from_ref_time(109_961_000 as u64).saturating_mul(r as u64))117 // Standard Error: 1_010_000118 .saturating_add(Weight::from_ref_time(151_952_000 as u64).saturating_mul(c as u64))119 .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64)))120 .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64)))121 .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(r as u64)))122 .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64)))123 }124}125126// For backwards compatibility and tests127impl WeightInfo for () {128 fn add_invulnerable(b: u32) -> Weight {129 Weight::from_ref_time(18_563_000 as u64)130 // Standard Error: 0131 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))132 .saturating_add(RocksDbWeight::get().writes(1 as u64))133 }134 fn remove_invulnerable(b: u32) -> Weight {135 Weight::from_ref_time(18_563_000 as u64)136 // Standard Error: 0137 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))138 .saturating_add(RocksDbWeight::get().writes(1 as u64))139 }140 fn get_license(c: u32) -> Weight {141 Weight::from_ref_time(71_196_000 as u64)142 // Standard Error: 0143 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))144 .saturating_add(RocksDbWeight::get().reads(4 as u64))145 .saturating_add(RocksDbWeight::get().writes(2 as u64))146 }147 fn onboard(c: u32) -> Weight {148 Weight::from_ref_time(71_196_000 as u64)149 // Standard Error: 0150 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))151 .saturating_add(RocksDbWeight::get().reads(4 as u64))152 .saturating_add(RocksDbWeight::get().writes(2 as u64))153 }154 fn offboard(c: u32) -> Weight {155 Weight::from_ref_time(55_336_000 as u64)156 // Standard Error: 0157 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))158 .saturating_add(RocksDbWeight::get().reads(1 as u64))159 .saturating_add(RocksDbWeight::get().writes(2 as u64))160 }161 fn release_license(c: u32) -> Weight {162 Weight::from_ref_time(55_336_000 as u64)163 // Standard Error: 0164 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))165 .saturating_add(RocksDbWeight::get().reads(1 as u64))166 .saturating_add(RocksDbWeight::get().writes(2 as u64))167 }168 fn force_release_license(c: u32) -> Weight {169 Weight::from_ref_time(55_336_000 as u64)170 // Standard Error: 0171 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))172 .saturating_add(RocksDbWeight::get().reads(1 as u64))173 .saturating_add(RocksDbWeight::get().writes(2 as u64))174 }175 fn note_author() -> Weight {176 Weight::from_ref_time(71_461_000 as u64)177 .saturating_add(RocksDbWeight::get().reads(3 as u64))178 .saturating_add(RocksDbWeight::get().writes(4 as u64))179 }180 fn new_session(r: u32, c: u32) -> Weight {181 Weight::from_ref_time(0 as u64)182 // Standard Error: 1_010_000183 .saturating_add(Weight::from_ref_time(109_961_000 as u64).saturating_mul(r as u64))184 // Standard Error: 1_010_000185 .saturating_add(Weight::from_ref_time(151_952_000 as u64).saturating_mul(c as u64))186 .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(r as u64)))187 .saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(c as u64)))188 .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(r as u64)))189 .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64)))190 }191}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// The weight info trait for `pallet_collator_selection`.45pub trait WeightInfo {46 fn add_invulnerable(_b: u32) -> Weight;47 fn remove_invulnerable(_b: u32) -> Weight;48 fn get_license(_c: u32) -> Weight;49 fn onboard(_c: u32) -> Weight;50 fn offboard(_c: u32) -> Weight;51 fn release_license(_c: u32) -> Weight;52 fn force_release_license(_c: u32) -> Weight;53 fn note_author() -> Weight;54 fn new_session(_c: u32, _r: u32) -> Weight;55}5657/// Weights for pallet_collator_selection using the Substrate node and recommended hardware.58pub struct SubstrateWeight<T>(PhantomData<T>);59impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {60 fn add_invulnerable(b: u32) -> Weight {61 Weight::from_ref_time(18_563_000 as u64)62 // Standard Error: 063 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))64 .saturating_add(T::DbWeight::get().writes(1 as u64))65 }66 fn remove_invulnerable(b: u32) -> Weight {67 Weight::from_ref_time(18_563_000 as u64)68 // Standard Error: 069 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))70 .saturating_add(T::DbWeight::get().writes(1 as u64))71 }72 fn get_license(c: u32) -> Weight {73 Weight::from_ref_time(71_196_000 as u64)74 // Standard Error: 075 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))76 .saturating_add(T::DbWeight::get().reads(4 as u64))77 .saturating_add(T::DbWeight::get().writes(2 as u64))78 }79 fn onboard(c: u32) -> Weight {80 Weight::from_ref_time(71_196_000 as u64)81 // Standard Error: 082 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))83 .saturating_add(T::DbWeight::get().reads(4 as u64))84 .saturating_add(T::DbWeight::get().writes(2 as u64))85 }86 fn offboard(c: u32) -> Weight {87 Weight::from_ref_time(55_336_000 as u64)88 // Standard Error: 089 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))90 .saturating_add(T::DbWeight::get().reads(1 as u64))91 .saturating_add(T::DbWeight::get().writes(2 as u64))92 }93 fn release_license(c: u32) -> Weight {94 Weight::from_ref_time(55_336_000 as u64)95 // Standard Error: 096 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))97 .saturating_add(T::DbWeight::get().reads(1 as u64))98 .saturating_add(T::DbWeight::get().writes(2 as u64))99 }100 fn force_release_license(c: u32) -> Weight {101 Weight::from_ref_time(55_336_000 as u64)102 // Standard Error: 0103 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))104 .saturating_add(T::DbWeight::get().reads(1 as u64))105 .saturating_add(T::DbWeight::get().writes(2 as u64))106 }107 fn note_author() -> Weight {108 Weight::from_ref_time(71_461_000 as u64)109 .saturating_add(T::DbWeight::get().reads(3 as u64))110 .saturating_add(T::DbWeight::get().writes(4 as u64))111 }112 fn new_session(r: u32, c: u32) -> Weight {113 Weight::from_ref_time(0 as u64)114 // Standard Error: 1_010_000115 .saturating_add(Weight::from_ref_time(109_961_000 as u64).saturating_mul(r as u64))116 // Standard Error: 1_010_000117 .saturating_add(Weight::from_ref_time(151_952_000 as u64).saturating_mul(c as u64))118 .saturating_add(T::DbWeight::get().reads((1 as u64).saturating_mul(r as u64)))119 .saturating_add(T::DbWeight::get().reads((2 as u64).saturating_mul(c as u64)))120 .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(r as u64)))121 .saturating_add(T::DbWeight::get().writes((2 as u64).saturating_mul(c as u64)))122 }123}124125// For backwards compatibility and tests126impl WeightInfo for () {127 fn add_invulnerable(b: u32) -> Weight {128 Weight::from_ref_time(18_563_000 as u64)129 // Standard Error: 0130 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))131 .saturating_add(RocksDbWeight::get().writes(1 as u64))132 }133 fn remove_invulnerable(b: u32) -> Weight {134 Weight::from_ref_time(18_563_000 as u64)135 // Standard Error: 0136 .saturating_add(Weight::from_ref_time(68_000 as u64).saturating_mul(b as u64))137 .saturating_add(RocksDbWeight::get().writes(1 as u64))138 }139 fn get_license(c: u32) -> Weight {140 Weight::from_ref_time(71_196_000 as u64)141 // Standard Error: 0142 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))143 .saturating_add(RocksDbWeight::get().reads(4 as u64))144 .saturating_add(RocksDbWeight::get().writes(2 as u64))145 }146 fn onboard(c: u32) -> Weight {147 Weight::from_ref_time(71_196_000 as u64)148 // Standard Error: 0149 .saturating_add(Weight::from_ref_time(198_000 as u64).saturating_mul(c as u64))150 .saturating_add(RocksDbWeight::get().reads(4 as u64))151 .saturating_add(RocksDbWeight::get().writes(2 as u64))152 }153 fn offboard(c: u32) -> Weight {154 Weight::from_ref_time(55_336_000 as u64)155 // Standard Error: 0156 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))157 .saturating_add(RocksDbWeight::get().reads(1 as u64))158 .saturating_add(RocksDbWeight::get().writes(2 as u64))159 }160 fn release_license(c: u32) -> Weight {161 Weight::from_ref_time(55_336_000 as u64)162 // Standard Error: 0163 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))164 .saturating_add(RocksDbWeight::get().reads(1 as u64))165 .saturating_add(RocksDbWeight::get().writes(2 as u64))166 }167 fn force_release_license(c: u32) -> Weight {168 Weight::from_ref_time(55_336_000 as u64)169 // Standard Error: 0170 .saturating_add(Weight::from_ref_time(151_000 as u64).saturating_mul(c as u64))171 .saturating_add(RocksDbWeight::get().reads(1 as u64))172 .saturating_add(RocksDbWeight::get().writes(2 as u64))173 }174 fn note_author() -> Weight {175 Weight::from_ref_time(71_461_000 as u64)176 .saturating_add(RocksDbWeight::get().reads(3 as u64))177 .saturating_add(RocksDbWeight::get().writes(4 as u64))178 }179 fn new_session(r: u32, c: u32) -> Weight {180 Weight::from_ref_time(0 as u64)181 // Standard Error: 1_010_000182 .saturating_add(Weight::from_ref_time(109_961_000 as u64).saturating_mul(r as u64))183 // Standard Error: 1_010_000184 .saturating_add(Weight::from_ref_time(151_952_000 as u64).saturating_mul(c as u64))185 .saturating_add(RocksDbWeight::get().reads((1 as u64).saturating_mul(r as u64)))186 .saturating_add(RocksDbWeight::get().reads((2 as u64).saturating_mul(c as u64)))187 .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(r as u64)))188 .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64)))189 }190}pallets/data-management/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/data-management/src/benchmarking.rs
+++ b/pallets/data-management/src/benchmarking.rs
@@ -22,7 +22,6 @@
use sp_core::{H160, H256};
use sp_std::{vec::Vec, vec};
-// todo:collator
benchmarks! {
where_clause { where <T as Config>::RuntimeEvent: codec::Encode }