From 3f67c93dd1c4987b7d0bfad32e77f1578d73112c Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Tue, 4 Apr 2023 09:34:56 +0200 Subject: [PATCH] Added `origin` to config for `universal_origin` benchmark (#6986) --- polkadot/runtime/kusama/src/lib.rs | 2 +- polkadot/runtime/rococo/src/lib.rs | 2 +- polkadot/runtime/westend/src/lib.rs | 2 +- .../xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs | 4 ++-- polkadot/xcm/pallet-xcm-benchmarks/src/generic/mock.rs | 4 ++-- polkadot/xcm/pallet-xcm-benchmarks/src/generic/mod.rs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/polkadot/runtime/kusama/src/lib.rs b/polkadot/runtime/kusama/src/lib.rs index e1e9c5dcfb..b4e22e094c 100644 --- a/polkadot/runtime/kusama/src/lib.rs +++ b/polkadot/runtime/kusama/src/lib.rs @@ -2093,7 +2093,7 @@ sp_api::impl_runtime_apis! { Err(BenchmarkError::Skip) } - fn universal_alias() -> Result { + fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> { // The XCM executor of Kusama doesn't have a configured `UniversalAliases` Err(BenchmarkError::Skip) } diff --git a/polkadot/runtime/rococo/src/lib.rs b/polkadot/runtime/rococo/src/lib.rs index ba507d1149..139a65c734 100644 --- a/polkadot/runtime/rococo/src/lib.rs +++ b/polkadot/runtime/rococo/src/lib.rs @@ -2095,7 +2095,7 @@ sp_api::impl_runtime_apis! { Err(BenchmarkError::Skip) } - fn universal_alias() -> Result { + fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> { // The XCM executor of Rococo doesn't have a configured `UniversalAliases` Err(BenchmarkError::Skip) } diff --git a/polkadot/runtime/westend/src/lib.rs b/polkadot/runtime/westend/src/lib.rs index eef79f74c1..722d12c8f1 100644 --- a/polkadot/runtime/westend/src/lib.rs +++ b/polkadot/runtime/westend/src/lib.rs @@ -1819,7 +1819,7 @@ sp_api::impl_runtime_apis! { Err(BenchmarkError::Skip) } - fn universal_alias() -> Result { + fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> { // The XCM executor of Westend doesn't have a configured `UniversalAliases` Err(BenchmarkError::Skip) } diff --git a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs index 19aecdd47c..46301a974c 100644 --- a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs +++ b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs @@ -482,9 +482,9 @@ benchmarks! { } universal_origin { - let alias = T::universal_alias().map_err(|_| BenchmarkError::Skip)?; + let (origin, alias) = T::universal_alias().map_err(|_| BenchmarkError::Skip)?; - let mut executor = new_executor::(Here.into_location()); + let mut executor = new_executor::(origin); let instruction = Instruction::UniversalOrigin(alias.clone()); let xcm = Xcm(vec![instruction]); diff --git a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/mock.rs b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/mock.rs index c76a9f2759..3cb5c5d0c8 100644 --- a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/mock.rs +++ b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/mock.rs @@ -163,8 +163,8 @@ impl generic::Config for Test { Ok(Default::default()) } - fn universal_alias() -> Result { - Ok(GlobalConsensus(ByGenesis([0; 32]))) + fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> { + Ok((Here.into(), GlobalConsensus(ByGenesis([0; 32])))) } fn transact_origin_and_runtime_call( diff --git a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/mod.rs b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/mod.rs index b12ac0ba23..bdf3b2821f 100644 --- a/polkadot/xcm/pallet-xcm-benchmarks/src/generic/mod.rs +++ b/polkadot/xcm/pallet-xcm-benchmarks/src/generic/mod.rs @@ -52,10 +52,10 @@ pub mod pallet { /// If set to `Err`, benchmarks which rely on an `exchange_asset` will be skipped. fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError>; - /// A `Junction` that is one of the `UniversalAliases` configured by the XCM executor. + /// A `(MultiLocation, Junction)` that is one of the `UniversalAliases` configured by the XCM executor. /// /// If set to `Err`, benchmarks which rely on a universal alias will be skipped. - fn universal_alias() -> Result; + fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError>; /// The `MultiLocation` and `RuntimeCall` used for successful transaction XCMs. ///