Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Implement AliasOrigin processing in XCVM (#7245)
Browse files Browse the repository at this point in the history
* Implement AliasOrigin processing in XCVM

* add builder types and first test

* switch to more general builder types

* clone target for RemovePrefixAccountId32

* change builder types

* change AliasForeignAccountId32 and add test for AliasCase

* add Aliasers type to xcm configs

* add benchmark

* benchmark fix

* add benchmark function for runtimes

* fix alias_origin result types

* fix benchmark test

* add runtime-benchmarks feature in pallet-xcm-benchmarks

* fmt

* remove AliasCase, add test and fmt

* address feedback

* ".git/.scripts/commands/bench/bench.sh" xcm kusama pallet_xcm_benchmarks::generic

* ".git/.scripts/commands/bench/bench.sh" xcm westend pallet_xcm_benchmarks::generic

* ".git/.scripts/commands/bench/bench.sh" xcm rococo pallet_xcm_benchmarks::generic

* address feedback

* lock

* ".git/.scripts/commands/bench/bench.sh" xcm kusama pallet_xcm_benchmarks::generic

* ".git/.scripts/commands/bench/bench.sh" xcm westend pallet_xcm_benchmarks::generic

* ".git/.scripts/commands/bench/bench.sh" xcm rococo pallet_xcm_benchmarks::generic

* change doc

* fmt

---------

Co-authored-by: Just van Stam <just.van.stam@gmail.com>
Co-authored-by: Just van Stam <vstam1@users.noreply.github.com>
Co-authored-by: command-bot <>
  • Loading branch information
3 people authored Jun 5, 2023
1 parent 99b093b commit bfb9e87
Show file tree
Hide file tree
Showing 29 changed files with 397 additions and 184 deletions.
5 changes: 5 additions & 0 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2202,6 +2202,11 @@ sp_api::impl_runtime_apis! {
// Kusama doesn't support exporting messages
Err(BenchmarkError::Skip)
}

fn alias_origin() -> Result<(MultiLocation, MultiLocation), BenchmarkError> {
// The XCM executor of Kusama doesn't have a configured `Aliasers`
Err(BenchmarkError::Skip)
}
}

let whitelist: Vec<TrackedStorageKey> = vec![
Expand Down
118 changes: 59 additions & 59 deletions runtime/kusama/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-06-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2023-06-02, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
Expand Down Expand Up @@ -68,76 +68,76 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `211`
// Estimated: `3676`
// Minimum execution time: 31_951_000 picoseconds.
Weight::from_parts(32_879_000, 3676)
// Minimum execution time: 32_102_000 picoseconds.
Weight::from_parts(33_749_000, 3676)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
pub(crate) fn buy_execution() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_691_000 picoseconds.
Weight::from_parts(2_783_000, 0)
// Minimum execution time: 2_624_000 picoseconds.
Weight::from_parts(2_714_000, 0)
}
/// Storage: XcmPallet Queries (r:1 w:0)
/// Proof Skipped: XcmPallet Queries (max_values: None, max_size: None, mode: Measured)
pub(crate) fn query_response() -> Weight {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 10_819_000 picoseconds.
Weight::from_parts(11_035_000, 3634)
// Minimum execution time: 10_599_000 picoseconds.
Weight::from_parts(10_882_000, 3634)
.saturating_add(T::DbWeight::get().reads(1))
}
pub(crate) fn transact() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 12_035_000 picoseconds.
Weight::from_parts(12_454_000, 0)
// Minimum execution time: 11_985_000 picoseconds.
Weight::from_parts(12_274_000, 0)
}
pub(crate) fn refund_surplus() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_874_000 picoseconds.
Weight::from_parts(2_981_000, 0)
// Minimum execution time: 2_739_000 picoseconds.
Weight::from_parts(2_862_000, 0)
}
pub(crate) fn set_error_handler() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_632_000 picoseconds.
Weight::from_parts(2_703_000, 0)
// Minimum execution time: 2_533_000 picoseconds.
Weight::from_parts(2_646_000, 0)
}
pub(crate) fn set_appendix() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_554_000 picoseconds.
Weight::from_parts(2_642_000, 0)
// Minimum execution time: 2_563_000 picoseconds.
Weight::from_parts(2_647_000, 0)
}
pub(crate) fn clear_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_642_000 picoseconds.
Weight::from_parts(2_761_000, 0)
// Minimum execution time: 2_512_000 picoseconds.
Weight::from_parts(2_574_000, 0)
}
pub(crate) fn descend_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_406_000 picoseconds.
Weight::from_parts(3_535_000, 0)
// Minimum execution time: 3_307_000 picoseconds.
Weight::from_parts(3_448_000, 0)
}
pub(crate) fn clear_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_568_000 picoseconds.
Weight::from_parts(2_647_000, 0)
// Minimum execution time: 2_524_000 picoseconds.
Weight::from_parts(2_614_000, 0)
}
/// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
/// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
Expand All @@ -157,8 +157,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `211`
// Estimated: `3676`
// Minimum execution time: 27_298_000 picoseconds.
Weight::from_parts(27_716_000, 3676)
// Minimum execution time: 27_275_000 picoseconds.
Weight::from_parts(27_861_000, 3676)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
Expand All @@ -168,17 +168,17 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `226`
// Estimated: `3691`
// Minimum execution time: 14_960_000 picoseconds.
Weight::from_parts(15_461_000, 3691)
// Minimum execution time: 14_731_000 picoseconds.
Weight::from_parts(15_006_000, 3691)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
pub(crate) fn trap() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_667_000 picoseconds.
Weight::from_parts(2_736_000, 0)
// Minimum execution time: 2_446_000 picoseconds.
Weight::from_parts(2_581_000, 0)
}
/// Storage: XcmPallet VersionNotifyTargets (r:1 w:1)
/// Proof Skipped: XcmPallet VersionNotifyTargets (max_values: None, max_size: None, mode: Measured)
Expand All @@ -200,8 +200,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `211`
// Estimated: `3676`
// Minimum execution time: 34_532_000 picoseconds.
Weight::from_parts(35_207_000, 3676)
// Minimum execution time: 34_319_000 picoseconds.
Weight::from_parts(34_708_000, 3676)
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
}
Expand All @@ -211,8 +211,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_196_000 picoseconds.
Weight::from_parts(5_283_000, 0)
// Minimum execution time: 4_974_000 picoseconds.
Weight::from_parts(5_155_000, 0)
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
Expand All @@ -233,45 +233,45 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `211`
// Estimated: `3676`
// Minimum execution time: 31_259_000 picoseconds.
Weight::from_parts(31_897_000, 3676)
// Minimum execution time: 30_858_000 picoseconds.
Weight::from_parts(31_858_000, 3676)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
pub(crate) fn burn_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_102_000 picoseconds.
Weight::from_parts(4_197_000, 0)
// Minimum execution time: 4_059_000 picoseconds.
Weight::from_parts(4_125_000, 0)
}
pub(crate) fn expect_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_758_000 picoseconds.
Weight::from_parts(2_870_000, 0)
// Minimum execution time: 2_657_000 picoseconds.
Weight::from_parts(2_741_000, 0)
}
pub(crate) fn expect_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_629_000 picoseconds.
Weight::from_parts(2_755_000, 0)
// Minimum execution time: 2_585_000 picoseconds.
Weight::from_parts(2_653_000, 0)
}
pub(crate) fn expect_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_639_000 picoseconds.
Weight::from_parts(2_713_000, 0)
// Minimum execution time: 2_552_000 picoseconds.
Weight::from_parts(2_632_000, 0)
}
pub(crate) fn expect_transact_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_842_000 picoseconds.
Weight::from_parts(2_928_000, 0)
// Minimum execution time: 2_682_000 picoseconds.
Weight::from_parts(2_763_000, 0)
}
/// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
/// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
Expand All @@ -291,17 +291,17 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `211`
// Estimated: `3676`
// Minimum execution time: 34_560_000 picoseconds.
Weight::from_parts(34_859_000, 3676)
// Minimum execution time: 34_316_000 picoseconds.
Weight::from_parts(34_682_000, 3676)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
pub(crate) fn expect_pallet() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 8_179_000 picoseconds.
Weight::from_parts(8_362_000, 0)
// Minimum execution time: 7_938_000 picoseconds.
Weight::from_parts(8_071_000, 0)
}
/// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
/// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
Expand All @@ -321,44 +321,44 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `211`
// Estimated: `3676`
// Minimum execution time: 27_036_000 picoseconds.
Weight::from_parts(27_743_000, 3676)
// Minimum execution time: 28_002_000 picoseconds.
Weight::from_parts(28_184_000, 3676)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
pub(crate) fn clear_transact_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_614_000 picoseconds.
Weight::from_parts(2_688_000, 0)
// Minimum execution time: 2_520_000 picoseconds.
Weight::from_parts(2_617_000, 0)
}
pub(crate) fn set_topic() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_551_000 picoseconds.
Weight::from_parts(2_656_000, 0)
// Minimum execution time: 2_506_000 picoseconds.
Weight::from_parts(2_560_000, 0)
}
pub(crate) fn clear_topic() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_597_000 picoseconds.
Weight::from_parts(2_708_000, 0)
// Minimum execution time: 2_503_000 picoseconds.
Weight::from_parts(2_605_000, 0)
}
pub(crate) fn set_fees_mode() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_610_000 picoseconds.
Weight::from_parts(2_758_000, 0)
// Minimum execution time: 2_511_000 picoseconds.
Weight::from_parts(2_597_000, 0)
}
pub(crate) fn unpaid_execution() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_766_000 picoseconds.
Weight::from_parts(3_372_000, 0)
// Minimum execution time: 2_617_000 picoseconds.
Weight::from_parts(2_715_000, 0)
}
}
1 change: 1 addition & 0 deletions runtime/kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ impl xcm_executor::Config for XcmConfig {
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
type Aliasers = Nothing;
}

parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions runtime/polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ impl xcm_executor::Config for XcmConfig {
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
type Aliasers = Nothing;
}

parameter_types! {
Expand Down
5 changes: 5 additions & 0 deletions runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2299,6 +2299,11 @@ sp_api::impl_runtime_apis! {
// Rococo doesn't support exporting messages
Err(BenchmarkError::Skip)
}

fn alias_origin() -> Result<(MultiLocation, MultiLocation), BenchmarkError> {
// The XCM executor of Rococo doesn't have a configured `Aliasers`
Err(BenchmarkError::Skip)
}
}

let whitelist: Vec<TrackedStorageKey> = vec![
Expand Down
Loading

0 comments on commit bfb9e87

Please sign in to comment.