Implement AliasOrigin processing in XCVM (#7245)

* 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 <>
This commit is contained in:
Keith Yeung
2023-06-05 22:39:01 +08:00
committed by GitHub
parent c8f9b1b7a0
commit f2fe05a757
29 changed files with 397 additions and 184 deletions
+5
View File
@@ -1989,6 +1989,11 @@ sp_api::impl_runtime_apis! {
// Westend doesn't support exporting messages
Err(BenchmarkError::Skip)
}
fn alias_origin() -> Result<(MultiLocation, MultiLocation), BenchmarkError> {
// The XCM executor of Westend doesn't have a configured `Aliasers`
Err(BenchmarkError::Skip)
}
}
type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
@@ -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("westend-dev"), DB CACHE: 1024
@@ -68,8 +68,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 31_799_000 picoseconds.
Weight::from_parts(32_268_000, 3634)
// Minimum execution time: 30_790_000 picoseconds.
Weight::from_parts(31_265_000, 3634)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -77,8 +77,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_114_000 picoseconds.
Weight::from_parts(3_209_000, 0)
// Minimum execution time: 2_741_000 picoseconds.
Weight::from_parts(2_823_000, 0)
}
/// Storage: XcmPallet Queries (r:1 w:0)
/// Proof Skipped: XcmPallet Queries (max_values: None, max_size: None, mode: Measured)
@@ -86,58 +86,58 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 11_350_000 picoseconds.
Weight::from_parts(11_664_000, 3634)
// Minimum execution time: 10_848_000 picoseconds.
Weight::from_parts(11_183_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_740_000 picoseconds.
Weight::from_parts(12_997_000, 0)
// Minimum execution time: 12_145_000 picoseconds.
Weight::from_parts(12_366_000, 0)
}
pub(crate) fn refund_surplus() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_182_000 picoseconds.
Weight::from_parts(3_258_000, 0)
// Minimum execution time: 2_837_000 picoseconds.
Weight::from_parts(2_939_000, 0)
}
pub(crate) fn set_error_handler() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_909_000 picoseconds.
Weight::from_parts(2_973_000, 0)
// Minimum execution time: 2_526_000 picoseconds.
Weight::from_parts(2_622_000, 0)
}
pub(crate) fn set_appendix() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_967_000 picoseconds.
Weight::from_parts(3_042_000, 0)
// Minimum execution time: 2_603_000 picoseconds.
Weight::from_parts(2_642_000, 0)
}
pub(crate) fn clear_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_980_000 picoseconds.
Weight::from_parts(3_041_000, 0)
// Minimum execution time: 2_500_000 picoseconds.
Weight::from_parts(2_573_000, 0)
}
pub(crate) fn descend_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_798_000 picoseconds.
Weight::from_parts(3_877_000, 0)
// Minimum execution time: 3_323_000 picoseconds.
Weight::from_parts(3_401_000, 0)
}
pub(crate) fn clear_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_884_000 picoseconds.
Weight::from_parts(2_951_000, 0)
// Minimum execution time: 2_557_000 picoseconds.
Weight::from_parts(2_620_000, 0)
}
/// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
/// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
@@ -157,8 +157,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 26_538_000 picoseconds.
Weight::from_parts(27_107_000, 3634)
// Minimum execution time: 25_828_000 picoseconds.
Weight::from_parts(26_318_000, 3634)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -168,8 +168,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `226`
// Estimated: `3691`
// Minimum execution time: 15_633_000 picoseconds.
Weight::from_parts(15_851_000, 3691)
// Minimum execution time: 14_794_000 picoseconds.
Weight::from_parts(15_306_000, 3691)
.saturating_add(T::DbWeight::get().reads(1))
.saturating_add(T::DbWeight::get().writes(1))
}
@@ -177,8 +177,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_873_000 picoseconds.
Weight::from_parts(2_998_000, 0)
// Minimum execution time: 2_534_000 picoseconds.
Weight::from_parts(2_574_000, 0)
}
/// Storage: XcmPallet VersionNotifyTargets (r:1 w:1)
/// Proof Skipped: XcmPallet VersionNotifyTargets (max_values: None, max_size: None, mode: Measured)
@@ -200,8 +200,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 33_283_000 picoseconds.
Weight::from_parts(33_682_000, 3634)
// Minimum execution time: 32_218_000 picoseconds.
Weight::from_parts(32_945_000, 3634)
.saturating_add(T::DbWeight::get().reads(8))
.saturating_add(T::DbWeight::get().writes(5))
}
@@ -211,8 +211,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 5_240_000 picoseconds.
Weight::from_parts(5_345_000, 0)
// Minimum execution time: 4_983_000 picoseconds.
Weight::from_parts(5_132_000, 0)
.saturating_add(T::DbWeight::get().writes(1))
}
/// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
@@ -233,8 +233,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 30_487_000 picoseconds.
Weight::from_parts(30_935_000, 3634)
// Minimum execution time: 29_375_000 picoseconds.
Weight::from_parts(30_320_000, 3634)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -242,36 +242,36 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 4_584_000 picoseconds.
Weight::from_parts(4_658_000, 0)
// Minimum execution time: 4_101_000 picoseconds.
Weight::from_parts(4_228_000, 0)
}
pub(crate) fn expect_asset() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_112_000 picoseconds.
Weight::from_parts(3_203_000, 0)
// Minimum execution time: 2_740_000 picoseconds.
Weight::from_parts(2_814_000, 0)
}
pub(crate) fn expect_origin() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_033_000 picoseconds.
Weight::from_parts(3_095_000, 0)
// Minimum execution time: 2_716_000 picoseconds.
Weight::from_parts(2_795_000, 0)
}
pub(crate) fn expect_error() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_945_000 picoseconds.
Weight::from_parts(3_014_000, 0)
// Minimum execution time: 2_550_000 picoseconds.
Weight::from_parts(2_601_000, 0)
}
pub(crate) fn expect_transact_status() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_117_000 picoseconds.
Weight::from_parts(3_204_000, 0)
// Minimum execution time: 2_762_000 picoseconds.
Weight::from_parts(2_849_000, 0)
}
/// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
/// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
@@ -291,8 +291,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 32_939_000 picoseconds.
Weight::from_parts(33_499_000, 3634)
// Minimum execution time: 31_709_000 picoseconds.
Weight::from_parts(32_288_000, 3634)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -300,8 +300,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 7_781_000 picoseconds.
Weight::from_parts(7_881_000, 0)
// Minimum execution time: 7_209_000 picoseconds.
Weight::from_parts(7_332_000, 0)
}
/// Storage: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
/// Proof Skipped: unknown `0x3a696e747261626c6f636b5f656e74726f7079` (r:1 w:1)
@@ -321,8 +321,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `169`
// Estimated: `3634`
// Minimum execution time: 26_864_000 picoseconds.
Weight::from_parts(27_419_000, 3634)
// Minimum execution time: 26_161_000 picoseconds.
Weight::from_parts(26_605_000, 3634)
.saturating_add(T::DbWeight::get().reads(7))
.saturating_add(T::DbWeight::get().writes(4))
}
@@ -330,35 +330,35 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_000_000 picoseconds.
Weight::from_parts(3_061_000, 0)
// Minimum execution time: 2_539_000 picoseconds.
Weight::from_parts(2_647_000, 0)
}
pub(crate) fn set_topic() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_881_000 picoseconds.
Weight::from_parts(2_968_000, 0)
// Minimum execution time: 2_494_000 picoseconds.
Weight::from_parts(2_588_000, 0)
}
pub(crate) fn clear_topic() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_902_000 picoseconds.
Weight::from_parts(2_976_000, 0)
// Minimum execution time: 2_510_000 picoseconds.
Weight::from_parts(2_590_000, 0)
}
pub(crate) fn set_fees_mode() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 2_907_000 picoseconds.
Weight::from_parts(2_981_000, 0)
// Minimum execution time: 2_491_000 picoseconds.
Weight::from_parts(2_546_000, 0)
}
pub(crate) fn unpaid_execution() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
// Estimated: `0`
// Minimum execution time: 3_136_000 picoseconds.
Weight::from_parts(3_184_000, 0)
// Minimum execution time: 2_696_000 picoseconds.
Weight::from_parts(2_816_000, 0)
}
}
@@ -268,6 +268,7 @@ impl xcm_executor::Config for XcmConfig {
type UniversalAliases = Nothing;
type CallDispatcher = WithOriginFilter<SafeCallFilter>;
type SafeCallFilter = SafeCallFilter;
type Aliasers = Nothing;
}
/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior location