diff --git a/node/network/availability-recovery/src/futures_undead.rs b/node/network/availability-recovery/src/futures_undead.rs index 550f41a9b3cf..aa91c39f8ed1 100644 --- a/node/network/availability-recovery/src/futures_undead.rs +++ b/node/network/availability-recovery/src/futures_undead.rs @@ -18,7 +18,7 @@ //! futures will still get polled, but will not count towards length. So length will only count //! futures, which are still considered live. //! -//! Usecase: If futures take longer than we would like them too, we may be able to request the data +//! Use case: If futures take longer than we would like them too, we may be able to request the data //! from somewhere else as well. We don't really want to cancel the old future, because maybe it //! was almost done, thus we would have wasted time with our impatience. By simply making them //! not count towards length, we can make sure to have enough "live" requests ongoing, while at the diff --git a/runtime/common/src/elections.rs b/runtime/common/src/elections.rs index 03989a64b439..ae0ec401f63a 100644 --- a/runtime/common/src/elections.rs +++ b/runtime/common/src/elections.rs @@ -70,7 +70,7 @@ pub type GenesisElectionOf = /// pallet-election-provider-multi-phase. pub const MINER_MAX_ITERATIONS: u32 = 10; -/// A source of random balance for the NPoS Solver, which is meant to be run by the offchain worker +/// A source of random balance for the NPoS Solver, which is meant to be run by the off-chain worker /// election miner. pub struct OffchainRandomBalancing; impl frame_support::pallet_prelude::Get> diff --git a/runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs b/runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs index 869c1bca408f..08b75be93653 100644 --- a/runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs +++ b/runtime/westend/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs @@ -17,7 +17,7 @@ //! Autogenerated weights for `pallet_xcm_benchmarks::fungible` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2021-09-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2021-10-25, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westend-dev"), DB CACHE: 128 // Executed Command: @@ -48,48 +48,59 @@ pub struct WeightInfo(PhantomData); impl WeightInfo { // Storage: System Account (r:1 w:1) pub(crate) fn withdraw_asset() -> Weight { - (39_691_000 as Weight) + (43_806_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: System Account (r:2 w:2) pub(crate) fn transfer_asset() -> Weight { - (62_616_000 as Weight) + (68_076_000 as Weight) .saturating_add(T::DbWeight::get().reads(2 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } // Storage: System Account (r:2 w:2) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn transfer_reserve_asset() -> Weight { - (86_642_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(4 as Weight)) + (99_639_000 as Weight) + .saturating_add(T::DbWeight::get().reads(7 as Weight)) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) } - // Storage: Benchmark Override (r:0 w:0) + // Storage: System Account (r:1 w:1) pub(crate) fn receive_teleported_asset() -> Weight { - (2_000_000_000_000 as Weight) + (38_670_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: System Account (r:1 w:1) pub(crate) fn deposit_asset() -> Weight { - (49_745_000 as Weight) + (51_793_000 as Weight) .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(1 as Weight)) } // Storage: System Account (r:1 w:1) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn deposit_reserve_asset() -> Weight { - (75_318_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + (85_782_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } // Storage: System Account (r:1 w:1) + // Storage: XcmPallet SupportedVersion (r:1 w:0) + // Storage: XcmPallet VersionDiscoveryQueue (r:1 w:1) + // Storage: XcmPallet SafeXcmVersion (r:1 w:0) // Storage: Dmp DownwardMessageQueueHeads (r:1 w:1) // Storage: Dmp DownwardMessageQueues (r:1 w:1) pub(crate) fn initiate_teleport() -> Weight { - (75_467_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) + (84_873_000 as Weight) + .saturating_add(T::DbWeight::get().reads(6 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) } } diff --git a/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs b/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs index 3a71d771c11d..9e2083704254 100644 --- a/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs +++ b/xcm/pallet-xcm-benchmarks/src/fungible/benchmarking.rs @@ -17,8 +17,11 @@ use super::*; use crate::{account_and_location, new_executor, worst_case_holding, AssetTransactorOf, XcmCallOf}; use frame_benchmarking::{benchmarks_instance_pallet, BenchmarkError, BenchmarkResult}; -use frame_support::{pallet_prelude::Get, traits::fungible::Inspect}; -use sp_runtime::traits::Zero; +use frame_support::{ + pallet_prelude::Get, + traits::fungible::{Inspect, Mutate}, +}; +use sp_runtime::traits::{Bounded, Zero}; use sp_std::{convert::TryInto, prelude::*, vec}; use xcm::latest::prelude::*; use xcm_executor::traits::{Convert, TransactAsset}; @@ -106,11 +109,19 @@ benchmarks_instance_pallet! { receive_teleported_asset { // If there is no trusted teleporter, then we skip this benchmark. - let (trusted_teleporter, teleportable_asset) = T::TrustedTeleporter::get().ok_or( - BenchmarkError::Override( - BenchmarkResult::from_weight(T::BlockWeights::get().max_block) - ) - )?; + let (trusted_teleporter, teleportable_asset) = T::TrustedTeleporter::get() + .ok_or(BenchmarkError::Skip)?; + + if let Some(checked_account) = T::CheckedAccount::get() { + T::TransactAsset::mint_into( + &checked_account, + < + T::TransactAsset + as + Inspect + >::Balance::max_value() / 2u32.into(), + )?; + } let assets: MultiAssets = vec![ teleportable_asset ].into(); diff --git a/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs b/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs index 8666dc6caa4d..fb5f3059561b 100644 --- a/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs +++ b/xcm/pallet-xcm-benchmarks/src/fungible/mock.rs @@ -131,7 +131,7 @@ impl xcm_executor::Config for XcmConfig { type AssetTransactor = AssetTransactor; type OriginConverter = (); type IsReserve = (); - type IsTeleporter = (); + type IsTeleporter = TrustedTeleporters; type LocationInverter = xcm_builder::LocationInverter; type Barrier = AllowUnpaidExecutionFrom; type Weigher = xcm_builder::FixedWeightBounds; @@ -153,12 +153,17 @@ impl crate::Config for Test { } } +pub type TrustedTeleporters = (xcm_builder::Case,); + parameter_types! { pub const CheckedAccount: Option = Some(100); + pub const ChildTeleporter: MultiLocation = Parachain(1000).into(); pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = Some(( - X1(OnlyChild).into(), + ChildTeleporter::get(), MultiAsset { id: Concrete(Here.into()), fun: Fungible(100) }, )); + pub const TeleConcreteFung: (MultiAssetFilter, MultiLocation) = + (Wild(AllOf { fun: WildFungible, id: Concrete(Here.into()) }), ChildTeleporter::get()); } impl xcm_balances_benchmark::Config for Test { diff --git a/xcm/pallet-xcm/src/lib.rs b/xcm/pallet-xcm/src/lib.rs index 0ae27321902a..393d015d6592 100644 --- a/xcm/pallet-xcm/src/lib.rs +++ b/xcm/pallet-xcm/src/lib.rs @@ -179,7 +179,7 @@ pub mod pallet { /// \[ origin location, id, expected location \] InvalidResponder(MultiLocation, QueryId, Option), /// Expected query response has been received but the expected origin location placed in - /// storate by this runtime previously cannot be decoded. The query remains registered. + /// storage by this runtime previously cannot be decoded. The query remains registered. /// /// This is unexpected (since a location placed in storage in a previously executing /// runtime should be readable prior to query timeout) and dangerous since the possibly diff --git a/xcm/pallet-xcm/src/tests.rs b/xcm/pallet-xcm/src/tests.rs index a9259e2155cf..660ac0ef14a8 100644 --- a/xcm/pallet-xcm/src/tests.rs +++ b/xcm/pallet-xcm/src/tests.rs @@ -861,7 +861,7 @@ fn subscriber_side_subscription_works() { }); } -/// We should autosubscribe when we don't know the remote's version. +/// We should auto-subscribe when we don't know the remote's version. #[test] fn auto_subscription_works() { new_test_ext_with_balances(vec![]).execute_with(|| {