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.rsdiffbeforeafterboth--- a/pallets/collator-selection/src/weights.rs
+++ b/pallets/collator-selection/src/weights.rs
@@ -41,7 +41,6 @@
};
use sp_std::marker::PhantomData;
-// todo:collator re-generate weights
// The weight info trait for `pallet_collator_selection`.
pub trait WeightInfo {
fn add_invulnerable(_b: u32) -> Weight;
pallets/data-management/src/benchmarking.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#![allow(missing_docs)]1819use super::{Call, Config, Pallet};20use frame_benchmarking::benchmarks;21use frame_system::RawOrigin;22use sp_core::{H160, H256};23use sp_std::{vec::Vec, vec};2425// todo:collator26benchmarks! {27 where_clause { where <T as Config>::RuntimeEvent: codec::Encode }2829 begin {30 }: _(RawOrigin::Root, H160::default())3132 set_data {33 let b in 0..80;34 let address = H160::from_low_u64_be(b as u64);35 let mut data = Vec::new();36 for i in 0..b {37 data.push((38 H256::from_low_u64_be(i as u64),39 H256::from_low_u64_be(i as u64),40 ));41 }42 <Pallet<T>>::begin(RawOrigin::Root.into(), address)?;43 }: _(RawOrigin::Root, address, data)4445 finish {46 let b in 0..80;47 let address = H160::from_low_u64_be(b as u64);48 let data: Vec<u8> = (0..b as u8).collect();49 <Pallet<T>>::begin(RawOrigin::Root.into(), address)?;50 }: _(RawOrigin::Root, address, data)5152 insert_eth_logs {53 let b in 0..200;54 let logs = (0..b).map(|_| ethereum::Log {55 address: H160([b as u8; 20]),56 data: vec![b as u8; 128],57 topics: vec![H256([b as u8; 32]); 6],58 }).collect::<Vec<_>>();59 }: _(RawOrigin::Root, logs)6061 insert_events {62 let b in 0..200;63 use codec::Encode;64 let logs = (0..b).map(|_| <T as Config>::RuntimeEvent::from(crate::Event::<T>::TestEvent).encode()).collect::<Vec<_>>();65 }: _(RawOrigin::Root, logs)6667 set_identities {68 let b in 0..600;69 use frame_benchmarking::account;70 use pallet_identity::{BalanceOf, Registration, IdentityInfo};71 let identities = (0..b).map(|i| (72 account("caller", i, 0),73 Some(Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {74 judgements: Default::default(),75 deposit: Default::default(),76 info: IdentityInfo {77 additional: Default::default(),78 display: Default::default(),79 legal: Default::default(),80 web: Default::default(),81 riot: Default::default(),82 email: Default::default(),83 pgp_fingerprint: None,84 image: Default::default(),85 twitter: Default::default(),86 },87 }),88 )).collect::<Vec<_>>();89 }: _(RawOrigin::Root, identities)90}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#![allow(missing_docs)]1819use super::{Call, Config, Pallet};20use frame_benchmarking::benchmarks;21use frame_system::RawOrigin;22use sp_core::{H160, H256};23use sp_std::{vec::Vec, vec};2425benchmarks! {26 where_clause { where <T as Config>::RuntimeEvent: codec::Encode }2728 begin {29 }: _(RawOrigin::Root, H160::default())3031 set_data {32 let b in 0..80;33 let address = H160::from_low_u64_be(b as u64);34 let mut data = Vec::new();35 for i in 0..b {36 data.push((37 H256::from_low_u64_be(i as u64),38 H256::from_low_u64_be(i as u64),39 ));40 }41 <Pallet<T>>::begin(RawOrigin::Root.into(), address)?;42 }: _(RawOrigin::Root, address, data)4344 finish {45 let b in 0..80;46 let address = H160::from_low_u64_be(b as u64);47 let data: Vec<u8> = (0..b as u8).collect();48 <Pallet<T>>::begin(RawOrigin::Root.into(), address)?;49 }: _(RawOrigin::Root, address, data)5051 insert_eth_logs {52 let b in 0..200;53 let logs = (0..b).map(|_| ethereum::Log {54 address: H160([b as u8; 20]),55 data: vec![b as u8; 128],56 topics: vec![H256([b as u8; 32]); 6],57 }).collect::<Vec<_>>();58 }: _(RawOrigin::Root, logs)5960 insert_events {61 let b in 0..200;62 use codec::Encode;63 let logs = (0..b).map(|_| <T as Config>::RuntimeEvent::from(crate::Event::<T>::TestEvent).encode()).collect::<Vec<_>>();64 }: _(RawOrigin::Root, logs)6566 set_identities {67 let b in 0..600;68 use frame_benchmarking::account;69 use pallet_identity::{BalanceOf, Registration, IdentityInfo};70 let identities = (0..b).map(|i| (71 account("caller", i, 0),72 Some(Registration::<BalanceOf<T>, T::MaxRegistrars, T::MaxAdditionalFields> {73 judgements: Default::default(),74 deposit: Default::default(),75 info: IdentityInfo {76 additional: Default::default(),77 display: Default::default(),78 legal: Default::default(),79 web: Default::default(),80 riot: Default::default(),81 email: Default::default(),82 pgp_fingerprint: None,83 image: Default::default(),84 twitter: Default::default(),85 },86 }),87 )).collect::<Vec<_>>();88 }: _(RawOrigin::Root, identities)89}