difftreelog
fix warnings
in: master
6 files changed
node/cli/src/command.rsdiffbeforeafterboth--- a/node/cli/src/command.rs
+++ b/node/cli/src/command.rs
@@ -425,7 +425,7 @@
.map(|cfg| &cfg.registry);
let task_manager =
sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)
- .map_err(|e| format!("Error: {:?}", e))?;
+ .map_err(|e| format!("Error: {e:?}"))?;
let info_provider = Some(timestamp_with_aura_info(12000));
runner.async_run(|config| -> Result<(Pin<Box<dyn Future<Output = _>>>, _)> {
pallets/common/src/eth.rsdiffbeforeafterboth--- a/pallets/common/src/eth.rs
+++ b/pallets/common/src/eth.rs
@@ -119,7 +119,7 @@
} else if self.sub == Default::default() {
Ok(Some(T::CrossAccountId::from_eth(self.eth)))
} else {
- Err(format!("All fields of cross account is non zeroed {:?}", self).into())
+ Err(format!("All fields of cross account is non zeroed {self:?}").into())
}
}
pallets/scheduler-v2/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// Original license:18// This file is part of Substrate.1920// Copyright (C) 2020-2022 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//! Scheduler pallet benchmarking.3637use super::*;38use frame_benchmarking::{account, benchmarks};39use frame_support::{40 ensure,41 traits::{schedule::Priority, PreimageRecipient},42};43use frame_system::RawOrigin;44use sp_std::{prelude::*, vec};45use sp_io::hashing::blake2_256;4647use crate::{Pallet as Scheduler, ScheduledCall, EncodedCall};48use frame_system::Call as SystemCall;4950const SEED: u32 = 0;5152const BLOCK_NUMBER: u32 = 2;5354/// Add `n` items to the schedule.55///56/// For `resolved`:57/// - `58/// - `None`: aborted (hash without preimage)59/// - `Some(true)`: hash resolves into call if possible, plain call otherwise60/// - `Some(false)`: plain call61fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {62 let t = DispatchTime::At(when);63 let origin: <T as Config>::PalletsOrigin = frame_system::RawOrigin::Root.into();64 for i in 0..n {65 let call = make_call::<T>(None);66 let period = Some(((i + 100).into(), 100));67 let name = u32_to_name(i);68 Scheduler::<T>::do_schedule_named(name, t, period, 0, origin.clone(), call)?;69 }70 ensure!(71 Agenda::<T>::get(when).agenda.len() == n as usize,72 "didn't fill schedule"73 );74 Ok(())75}7677/// Generate a name for a scheduled task from an unsigned integer.78fn u32_to_name(i: u32) -> TaskName {79 i.using_encoded(blake2_256)80}8182/// A utility for creating simple scheduled tasks.83///84/// # Arguments85/// * `periodic` - makes the task periodic.86/// Sets the task's period and repetition count to `100`.87/// * `named` - gives a name to the task: `u32_to_name(0)`.88/// * `signed` - determines the origin of the task.89/// If true, it will have the Signed origin. Otherwise it will have the Root origin.90/// See [`make_origin`] for details.91/// * maybe_lookup_len - sets optional lookup length. It is used to benchmark task fetching from the `Preimages` store.92/// * priority - the task's priority.93fn make_task<T: Config>(94 periodic: bool,95 named: bool,96 signed: bool,97 maybe_lookup_len: Option<u32>,98 priority: Priority,99) -> ScheduledOf<T> {100 let call = make_call::<T>(maybe_lookup_len);101 let maybe_periodic = match periodic {102 true => Some((100u32.into(), 100)),103 false => None,104 };105 let maybe_id = match named {106 true => Some(u32_to_name(0)),107 false => None,108 };109 let origin = make_origin::<T>(signed);110 Scheduled {111 maybe_id,112 priority,113 call,114 maybe_periodic,115 origin,116 _phantom: PhantomData,117 }118}119120/// Creates a `SystemCall::remark` scheduled call with a given `len` in bytes.121/// Returns `None` if the call is too large to encode.122fn bounded<T: Config>(len: u32) -> Option<ScheduledCall<T>> {123 let call = <<T as Config>::RuntimeCall>::from(SystemCall::remark {124 remark: vec![0; len as usize],125 });126 ScheduledCall::new(call).ok()127}128129/// Creates a scheduled call and maximizes its size.130///131/// If the `maybe_lookup_len` is not supplied, the task will create the maximal `Inline` scheduled call.132///133/// Otherwise, the function will take the length value from the `maybe_lookup_len`134/// and find a minimal length value that ensures that the scheduled call will require a Preimage lookup.135fn make_call<T: Config>(maybe_lookup_len: Option<u32>) -> ScheduledCall<T> {136 let bound = EncodedCall::bound() as u32;137 let mut len = match maybe_lookup_len {138 Some(len) => {139 len.min(<T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get() - 2)140 .max(bound) - 3141 }142 None => bound.saturating_sub(4),143 };144145 loop {146 let c = match bounded::<T>(len) {147 Some(x) => x,148 None => {149 len -= 1;150 continue;151 }152 };153 if c.lookup_needed() == maybe_lookup_len.is_some() {154 break c;155 }156 if maybe_lookup_len.is_some() {157 len += 1;158 } else if len > 0 {159 len -= 1;160 } else {161 break c;162 }163 }164}165166/// Creates an origin for a scheduled call.167///168/// If `signed` is true, it creates the Signed origin from a default account `account("origin", 0, SEED)`.169/// Otherwise, it creates the Root origin.170fn make_origin<T: Config>(signed: bool) -> <T as Config>::PalletsOrigin {171 match signed {172 true => frame_system::RawOrigin::Signed(account("origin", 0, SEED)).into(),173 false => frame_system::RawOrigin::Root.into(),174 }175}176177/// Creates a dummy `WeightCounter` with the maximum possible weight limit.178fn dummy_counter() -> WeightCounter {179 WeightCounter {180 used: Weight::zero(),181 limit: Weight::MAX,182 }183}184185benchmarks! {186 // `service_agendas` when no work is done.187 // (multiple agendas - scheduled tasks in several blocks)188 service_agendas_base {189 let now = T::BlockNumber::from(BLOCK_NUMBER);190 IncompleteSince::<T>::put(now - One::one());191 }: {192 Scheduler::<T>::service_agendas(&mut dummy_counter(), now, 0);193 } verify {194 assert_eq!(IncompleteSince::<T>::get(), Some(now - One::one()));195 }196197 // `service_agenda` when no work is done.198 // (only one agenda - scheduled tasks in a single block)199 service_agenda_base {200 let now = BLOCK_NUMBER.into();201 let s in 0 .. T::MaxScheduledPerBlock::get();202 fill_schedule::<T>(now, s)?;203 let mut executed = 0;204 }: {205 Scheduler::<T>::service_agenda(&mut dummy_counter(), &mut executed, now, now, 0);206 } verify {207 assert_eq!(executed, 0);208 }209210 // `service_task` when the task is a non-periodic, non-named, non-fetched call which is not211 // dispatched (e.g. due to being overweight).212 service_task_base {213 let now = BLOCK_NUMBER.into();214 let task = make_task::<T>(false, false, false, None, 0);215 // prevent any tasks from actually being executed as we only want the surrounding weight.216 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };217 }: {218 let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);219 } verify {220 //assert_eq!(result, Ok(()));221 }222223 // TODO uncomment if we will use the Preimages224 // // `service_task` when the task is a non-periodic, non-named, fetched call (with a known225 // // preimage length) and which is not dispatched (e.g. due to being overweight).226 // service_task_fetched {227 // let s in (EncodedCall::bound() as u32) .. (<T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get());228 // let now = BLOCK_NUMBER.into();229 // let task = make_task::<T>(false, false, false, Some(s), 0);230 // // prevent any tasks from actually being executed as we only want the surrounding weight.231 // let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };232 // }: {233 // let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);234 // } verify {235 // }236237 // `service_task` when the task is a non-periodic, named, non-fetched call which is not238 // dispatched (e.g. due to being overweight).239 service_task_named {240 let now = BLOCK_NUMBER.into();241 let task = make_task::<T>(false, true, false, None, 0);242 // prevent any tasks from actually being executed as we only want the surrounding weight.243 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };244 }: {245 let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);246 } verify {247 }248249 // `service_task` when the task is a periodic, non-named, non-fetched call which is not250 // dispatched (e.g. due to being overweight).251 service_task_periodic {252 let now = BLOCK_NUMBER.into();253 let task = make_task::<T>(true, false, false, None, 0);254 // prevent any tasks from actually being executed as we only want the surrounding weight.255 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };256 }: {257 let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);258 } verify {259 }260261 // `execute_dispatch` when the origin is `Signed`, not counting the dispatable's weight.262 execute_dispatch_signed {263 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::MAX };264 let origin = make_origin::<T>(true);265 let call = T::Preimages::realize(&make_call::<T>(None)).unwrap().0;266 }: {267 assert!(Scheduler::<T>::execute_dispatch(&mut counter, origin, call).is_ok());268 }269 verify {270 }271272 // `execute_dispatch` when the origin is not `Signed`, not counting the dispatable's weight.273 execute_dispatch_unsigned {274 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::MAX };275 let origin = make_origin::<T>(false);276 let call = T::Preimages::realize(&make_call::<T>(None)).unwrap().0;277 }: {278 assert!(Scheduler::<T>::execute_dispatch(&mut counter, origin, call).is_ok());279 }280 verify {281 }282283 schedule {284 let s in 0 .. (T::MaxScheduledPerBlock::get() - 1);285 let when = BLOCK_NUMBER.into();286 let periodic = Some((T::BlockNumber::one(), 100));287 let priority = Some(0);288 // Essentially a no-op call.289 let call = Box::new(SystemCall::set_storage { items: vec![] }.into());290291 fill_schedule::<T>(when, s)?;292 }: _(RawOrigin::Root, when, periodic, priority, call)293 verify {294 ensure!(295 Agenda::<T>::get(when).agenda.len() == (s + 1) as usize,296 "didn't add to schedule"297 );298 }299300 cancel {301 let s in 1 .. T::MaxScheduledPerBlock::get();302 let when = BLOCK_NUMBER.into();303304 fill_schedule::<T>(when, s)?;305 assert_eq!(Agenda::<T>::get(when).agenda.len(), s as usize);306 }: _(RawOrigin::Root, when, 0)307 verify {308 ensure!(309 Lookup::<T>::get(u32_to_name(0)).is_none(),310 "didn't remove from lookup"311 );312 // Removed schedule is NONE313 ensure!(314 Agenda::<T>::get(when).agenda[0].is_none(),315 "didn't remove from schedule"316 );317 }318319 schedule_named {320 let s in 0 .. (T::MaxScheduledPerBlock::get() - 1);321 let id = u32_to_name(s);322 let when = BLOCK_NUMBER.into();323 let periodic = Some((T::BlockNumber::one(), 100));324 let priority = Some(0);325 // Essentially a no-op call.326 let call = Box::new(SystemCall::set_storage { items: vec![] }.into());327328 fill_schedule::<T>(when, s)?;329 }: _(RawOrigin::Root, id, when, periodic, priority, call)330 verify {331 ensure!(332 Agenda::<T>::get(when).agenda.len() == (s + 1) as usize,333 "didn't add to schedule"334 );335 }336337 cancel_named {338 let s in 1 .. T::MaxScheduledPerBlock::get();339 let when = BLOCK_NUMBER.into();340341 fill_schedule::<T>(when, s)?;342 }: _(RawOrigin::Root, u32_to_name(0))343 verify {344 ensure!(345 Lookup::<T>::get(u32_to_name(0)).is_none(),346 "didn't remove from lookup"347 );348 // Removed schedule is NONE349 ensure!(350 Agenda::<T>::get(when).agenda[0].is_none(),351 "didn't remove from schedule"352 );353 }354355 change_named_priority {356 let origin: RawOrigin<T::AccountId> = frame_system::RawOrigin::Root;357 let s in 1 .. T::MaxScheduledPerBlock::get();358 let when = BLOCK_NUMBER.into();359 let idx = s - 1;360 let id = u32_to_name(idx);361 let priority = 42;362 fill_schedule::<T>(when, s)?;363 }: _(origin, id, priority)364 verify {365 ensure!(366 Agenda::<T>::get(when).agenda[idx as usize].clone().unwrap().priority == priority,367 "didn't change the priority"368 );369 }370371 impl_benchmark_test_suite!(Scheduler, crate::mock::new_test_ext(), crate::mock::Test);372}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) 2020-2022 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//! Scheduler pallet benchmarking.3637use super::*;38use frame_benchmarking::{account, benchmarks};39use frame_support::{40 ensure,41 traits::{schedule::Priority, PreimageRecipient},42};43use frame_system::RawOrigin;44use sp_std::{prelude::*, vec};45use sp_io::hashing::blake2_256;4647use crate::{Pallet as Scheduler, ScheduledCall, EncodedCall};48use frame_system::Call as SystemCall;4950const SEED: u32 = 0;5152const BLOCK_NUMBER: u32 = 2;5354/// Add `n` items to the schedule.55///56/// For `resolved`:57/// - `58/// - `None`: aborted (hash without preimage)59/// - `Some(true)`: hash resolves into call if possible, plain call otherwise60/// - `Some(false)`: plain call61fn fill_schedule<T: Config>(when: T::BlockNumber, n: u32) -> Result<(), &'static str> {62 let t = DispatchTime::At(when);63 let origin: <T as Config>::PalletsOrigin = frame_system::RawOrigin::Root.into();64 for i in 0..n {65 let call = make_call::<T>(None);66 let period = Some(((i + 100).into(), 100));67 let name = u32_to_name(i);68 Scheduler::<T>::do_schedule_named(name, t, period, 0, origin.clone(), call)?;69 }70 ensure!(71 Agenda::<T>::get(when).agenda.len() == n as usize,72 "didn't fill schedule"73 );74 Ok(())75}7677/// Generate a name for a scheduled task from an unsigned integer.78fn u32_to_name(i: u32) -> TaskName {79 i.using_encoded(blake2_256)80}8182/// A utility for creating simple scheduled tasks.83///84/// # Arguments85/// * `periodic` - makes the task periodic.86/// Sets the task's period and repetition count to `100`.87/// * `named` - gives a name to the task: `u32_to_name(0)`.88/// * `signed` - determines the origin of the task.89/// If true, it will have the Signed origin. Otherwise it will have the Root origin.90/// See [`make_origin`] for details.91/// * maybe_lookup_len - sets optional lookup length. It is used to benchmark task fetching from the `Preimages` store.92/// * priority - the task's priority.93fn make_task<T: Config>(94 periodic: bool,95 named: bool,96 signed: bool,97 maybe_lookup_len: Option<u32>,98 priority: Priority,99) -> ScheduledOf<T> {100 let call = make_call::<T>(maybe_lookup_len);101 let maybe_periodic = match periodic {102 true => Some((100u32.into(), 100)),103 false => None,104 };105 let maybe_id = match named {106 true => Some(u32_to_name(0)),107 false => None,108 };109 let origin = make_origin::<T>(signed);110 Scheduled {111 maybe_id,112 priority,113 call,114 maybe_periodic,115 origin,116 _phantom: PhantomData,117 }118}119120/// Creates a `SystemCall::remark` scheduled call with a given `len` in bytes.121/// Returns `None` if the call is too large to encode.122fn bounded<T: Config>(len: u32) -> Option<ScheduledCall<T>> {123 let call = <<T as Config>::RuntimeCall>::from(SystemCall::remark {124 remark: vec![0; len as usize],125 });126 ScheduledCall::new(call).ok()127}128129/// Creates a scheduled call and maximizes its size.130///131/// If the `maybe_lookup_len` is not supplied, the task will create the maximal `Inline` scheduled call.132///133/// Otherwise, the function will take the length value from the `maybe_lookup_len`134/// and find a minimal length value that ensures that the scheduled call will require a Preimage lookup.135fn make_call<T: Config>(maybe_lookup_len: Option<u32>) -> ScheduledCall<T> {136 let bound = EncodedCall::bound() as u32;137 let mut len = match maybe_lookup_len {138 Some(len) => {139 len.clamp(140 bound,141 <T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get() - 2,142 ) - 3143 }144 None => bound.saturating_sub(4),145 };146147 loop {148 let c = match bounded::<T>(len) {149 Some(x) => x,150 None => {151 len -= 1;152 continue;153 }154 };155 if c.lookup_needed() == maybe_lookup_len.is_some() {156 break c;157 }158 if maybe_lookup_len.is_some() {159 len += 1;160 } else if len > 0 {161 len -= 1;162 } else {163 break c;164 }165 }166}167168/// Creates an origin for a scheduled call.169///170/// If `signed` is true, it creates the Signed origin from a default account `account("origin", 0, SEED)`.171/// Otherwise, it creates the Root origin.172fn make_origin<T: Config>(signed: bool) -> <T as Config>::PalletsOrigin {173 match signed {174 true => frame_system::RawOrigin::Signed(account("origin", 0, SEED)).into(),175 false => frame_system::RawOrigin::Root.into(),176 }177}178179/// Creates a dummy `WeightCounter` with the maximum possible weight limit.180fn dummy_counter() -> WeightCounter {181 WeightCounter {182 used: Weight::zero(),183 limit: Weight::MAX,184 }185}186187benchmarks! {188 // `service_agendas` when no work is done.189 // (multiple agendas - scheduled tasks in several blocks)190 service_agendas_base {191 let now = T::BlockNumber::from(BLOCK_NUMBER);192 IncompleteSince::<T>::put(now - One::one());193 }: {194 Scheduler::<T>::service_agendas(&mut dummy_counter(), now, 0);195 } verify {196 assert_eq!(IncompleteSince::<T>::get(), Some(now - One::one()));197 }198199 // `service_agenda` when no work is done.200 // (only one agenda - scheduled tasks in a single block)201 service_agenda_base {202 let now = BLOCK_NUMBER.into();203 let s in 0 .. T::MaxScheduledPerBlock::get();204 fill_schedule::<T>(now, s)?;205 let mut executed = 0;206 }: {207 Scheduler::<T>::service_agenda(&mut dummy_counter(), &mut executed, now, now, 0);208 } verify {209 assert_eq!(executed, 0);210 }211212 // `service_task` when the task is a non-periodic, non-named, non-fetched call which is not213 // dispatched (e.g. due to being overweight).214 service_task_base {215 let now = BLOCK_NUMBER.into();216 let task = make_task::<T>(false, false, false, None, 0);217 // prevent any tasks from actually being executed as we only want the surrounding weight.218 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };219 }: {220 let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);221 } verify {222 //assert_eq!(result, Ok(()));223 }224225 // TODO uncomment if we will use the Preimages226 // // `service_task` when the task is a non-periodic, non-named, fetched call (with a known227 // // preimage length) and which is not dispatched (e.g. due to being overweight).228 // service_task_fetched {229 // let s in (EncodedCall::bound() as u32) .. (<T::Preimages as PreimageRecipient<T::Hash>>::MaxSize::get());230 // let now = BLOCK_NUMBER.into();231 // let task = make_task::<T>(false, false, false, Some(s), 0);232 // // prevent any tasks from actually being executed as we only want the surrounding weight.233 // let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };234 // }: {235 // let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);236 // } verify {237 // }238239 // `service_task` when the task is a non-periodic, named, non-fetched call which is not240 // dispatched (e.g. due to being overweight).241 service_task_named {242 let now = BLOCK_NUMBER.into();243 let task = make_task::<T>(false, true, false, None, 0);244 // prevent any tasks from actually being executed as we only want the surrounding weight.245 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };246 }: {247 let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);248 } verify {249 }250251 // `service_task` when the task is a periodic, non-named, non-fetched call which is not252 // dispatched (e.g. due to being overweight).253 service_task_periodic {254 let now = BLOCK_NUMBER.into();255 let task = make_task::<T>(true, false, false, None, 0);256 // prevent any tasks from actually being executed as we only want the surrounding weight.257 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::zero() };258 }: {259 let result = Scheduler::<T>::service_task(&mut counter, now, now, 0, true, task);260 } verify {261 }262263 // `execute_dispatch` when the origin is `Signed`, not counting the dispatable's weight.264 execute_dispatch_signed {265 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::MAX };266 let origin = make_origin::<T>(true);267 let call = T::Preimages::realize(&make_call::<T>(None)).unwrap().0;268 }: {269 assert!(Scheduler::<T>::execute_dispatch(&mut counter, origin, call).is_ok());270 }271 verify {272 }273274 // `execute_dispatch` when the origin is not `Signed`, not counting the dispatable's weight.275 execute_dispatch_unsigned {276 let mut counter = WeightCounter { used: Weight::zero(), limit: Weight::MAX };277 let origin = make_origin::<T>(false);278 let call = T::Preimages::realize(&make_call::<T>(None)).unwrap().0;279 }: {280 assert!(Scheduler::<T>::execute_dispatch(&mut counter, origin, call).is_ok());281 }282 verify {283 }284285 schedule {286 let s in 0 .. (T::MaxScheduledPerBlock::get() - 1);287 let when = BLOCK_NUMBER.into();288 let periodic = Some((T::BlockNumber::one(), 100));289 let priority = Some(0);290 // Essentially a no-op call.291 let call = Box::new(SystemCall::set_storage { items: vec![] }.into());292293 fill_schedule::<T>(when, s)?;294 }: _(RawOrigin::Root, when, periodic, priority, call)295 verify {296 ensure!(297 Agenda::<T>::get(when).agenda.len() == (s + 1) as usize,298 "didn't add to schedule"299 );300 }301302 cancel {303 let s in 1 .. T::MaxScheduledPerBlock::get();304 let when = BLOCK_NUMBER.into();305306 fill_schedule::<T>(when, s)?;307 assert_eq!(Agenda::<T>::get(when).agenda.len(), s as usize);308 }: _(RawOrigin::Root, when, 0)309 verify {310 ensure!(311 Lookup::<T>::get(u32_to_name(0)).is_none(),312 "didn't remove from lookup"313 );314 // Removed schedule is NONE315 ensure!(316 Agenda::<T>::get(when).agenda[0].is_none(),317 "didn't remove from schedule"318 );319 }320321 schedule_named {322 let s in 0 .. (T::MaxScheduledPerBlock::get() - 1);323 let id = u32_to_name(s);324 let when = BLOCK_NUMBER.into();325 let periodic = Some((T::BlockNumber::one(), 100));326 let priority = Some(0);327 // Essentially a no-op call.328 let call = Box::new(SystemCall::set_storage { items: vec![] }.into());329330 fill_schedule::<T>(when, s)?;331 }: _(RawOrigin::Root, id, when, periodic, priority, call)332 verify {333 ensure!(334 Agenda::<T>::get(when).agenda.len() == (s + 1) as usize,335 "didn't add to schedule"336 );337 }338339 cancel_named {340 let s in 1 .. T::MaxScheduledPerBlock::get();341 let when = BLOCK_NUMBER.into();342343 fill_schedule::<T>(when, s)?;344 }: _(RawOrigin::Root, u32_to_name(0))345 verify {346 ensure!(347 Lookup::<T>::get(u32_to_name(0)).is_none(),348 "didn't remove from lookup"349 );350 // Removed schedule is NONE351 ensure!(352 Agenda::<T>::get(when).agenda[0].is_none(),353 "didn't remove from schedule"354 );355 }356357 change_named_priority {358 let origin: RawOrigin<T::AccountId> = frame_system::RawOrigin::Root;359 let s in 1 .. T::MaxScheduledPerBlock::get();360 let when = BLOCK_NUMBER.into();361 let idx = s - 1;362 let id = u32_to_name(idx);363 let priority = 42;364 fill_schedule::<T>(when, s)?;365 }: _(origin, id, priority)366 verify {367 ensure!(368 Agenda::<T>::get(when).agenda[idx as usize].clone().unwrap().priority == priority,369 "didn't change the priority"370 );371 }372373 impl_benchmark_test_suite!(Scheduler, crate::mock::new_test_ext(), crate::mock::Test);374}runtime/common/tests/mod.rsdiffbeforeafterboth--- a/runtime/common/tests/mod.rs
+++ b/runtime/common/tests/mod.rs
@@ -33,7 +33,7 @@
const PARA_ID: u32 = 2037;
fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
- TPublic::Pair::from_string(&format!("//{}", seed), None)
+ TPublic::Pair::from_string(&format!("//{seed}"), None)
.expect("static values are valid; qed")
.public()
}
tests/src/eth/nonFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/nonFungible.test.ts
+++ b/tests/src/eth/nonFungible.test.ts
@@ -18,7 +18,7 @@
import {IKeyringPair} from '@polkadot/types/types';
import {Contract} from 'web3-eth-contract';
import {ITokenPropertyPermission} from '../util/playgrounds/types';
-import { CREATE_COLLECTION_DATA_DEFAULTS, CollectionMode, CreateCollectionData, TokenPermissionField } from './util/playgrounds/types';
+import {CREATE_COLLECTION_DATA_DEFAULTS, CollectionMode, CreateCollectionData, TokenPermissionField} from './util/playgrounds/types';
describe('Check ERC721 token URI for NFT', () => {
let donor: IKeyringPair;
tests/src/eth/reFungible.test.tsdiffbeforeafterboth--- a/tests/src/eth/reFungible.test.ts
+++ b/tests/src/eth/reFungible.test.ts
@@ -18,7 +18,7 @@
import {expect, itEth, usingEthPlaygrounds} from './util';
import {IKeyringPair} from '@polkadot/types/types';
import {ITokenPropertyPermission} from '../util/playgrounds/types';
-import { CREATE_COLLECTION_DATA_DEFAULTS, TokenPermissionField } from './util/playgrounds/types';
+import {CREATE_COLLECTION_DATA_DEFAULTS, TokenPermissionField} from './util/playgrounds/types';
describe('Refungible: Plain calls', () => {
let donor: IKeyringPair;