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

XCMv3 fixes #1710

Merged
merged 5 commits into from
Oct 3, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion parachain-template/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetTrap = PolkadotXcm;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
type PalletInstancesInfo = ();
type PalletInstancesInfo = super::AllPalletsWithSystem;
bkontur marked this conversation as resolved.
Show resolved Hide resolved
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
Expand Down
16 changes: 13 additions & 3 deletions parachains/runtimes/assets/statemine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,7 @@ impl_runtime_apis! {
fn valid_destination() -> Result<MultiLocation, BenchmarkError> {
Ok(KsmLocation::get())
}
fn worst_case_holding() -> MultiAssets {
fn worst_case_holding(_depositable_count: u32) -> MultiAssets {
// A mix of fungible, non-fungible, and concrete assets.
const HOLDING_FUNGIBLES: u32 = 100;
const HOLDING_NON_FUNGIBLES: u32 = 100;
Expand Down Expand Up @@ -882,7 +882,6 @@ impl_runtime_apis! {
KsmLocation::get(),
MultiAsset { fun: Fungible(1 * UNITS), id: Concrete(KsmLocation::get()) },
));
pub const TrustedReserve: Option<(MultiLocation, MultiAsset)> = None;
pub const CheckedAccount: Option<AccountId> = None;

}
Expand All @@ -892,7 +891,6 @@ impl_runtime_apis! {

type CheckedAccount = CheckedAccount;
type TrustedTeleporter = TrustedTeleporter;
type TrustedReserve = TrustedReserve;

fn get_multi_asset() -> MultiAsset {
MultiAsset {
Expand All @@ -909,6 +907,14 @@ impl_runtime_apis! {
(0u64, Response::Version(Default::default()))
}

fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> {
Err(BenchmarkError::Skip)
}

fn universal_alias() -> Result<Junction, BenchmarkError> {
Err(BenchmarkError::Skip)
}

fn transact_origin() -> Result<MultiLocation, BenchmarkError> {
Ok(KsmLocation::get())
}
Expand All @@ -923,6 +929,10 @@ impl_runtime_apis! {
let ticket = MultiLocation { parents: 0, interior: Here };
Ok((origin, ticket, assets))
}

fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
Err(BenchmarkError::Skip)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down
96 changes: 76 additions & 20 deletions parachains/runtimes/assets/statemine/src/weights/xcm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
}
fn query_response(_query_id: &u64, _response: &Response, _max_weight: &u64) -> XCMWeight {
fn query_response(
_query_id: &u64,
_response: &Response,
_max_weight: &u64,
_querier: &Option<MultiLocation>,
) -> XCMWeight {
XcmGeneric::<Runtime>::query_response().ref_time()
}
fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight {
Expand Down Expand Up @@ -104,33 +109,28 @@ impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight {
XcmGeneric::<Runtime>::descend_origin().ref_time()
}
fn report_error(
_query_id: &QueryId,
_dest: &MultiLocation,
_max_response_weight: &u64,
) -> XCMWeight {
fn report_error(_query_response_info: &QueryResponseInfo) -> XCMWeight {
XcmGeneric::<Runtime>::report_error().ref_time()
}

fn deposit_asset(
assets: &MultiAssetFilter,
_max_assets: &u32,
_dest: &MultiLocation,
) -> XCMWeight {
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> XCMWeight {
// Hardcoded till the XCM pallet is fixed
let hardcoded_weight = Weight::from_ref_time(1_000_000_000 as u64).ref_time();
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
cmp::min(hardcoded_weight, weight)
}
fn deposit_reserve_asset(
assets: &MultiAssetFilter,
_max_assets: &u32,
_dest: &MultiLocation,
_xcm: &Xcm<()>,
) -> XCMWeight {
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_reserve_asset())
}
fn exchange_asset(_give: &MultiAssetFilter, _receive: &MultiAssets) -> XCMWeight {
fn exchange_asset(
_give: &MultiAssetFilter,
_receive: &MultiAssets,
_maximal: &bool,
) -> XCMWeight {
Weight::MAX.ref_time()
}
fn initiate_reserve_withdraw(
Expand All @@ -150,13 +150,8 @@ impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::initiate_teleport());
cmp::min(hardcoded_weight, weight)
}
fn query_holding(
_query_id: &u64,
_dest: &MultiLocation,
_assets: &MultiAssetFilter,
_max_response_weight: &u64,
) -> XCMWeight {
XcmGeneric::<Runtime>::query_holding().ref_time()
fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> XCMWeight {
XcmGeneric::<Runtime>::report_holding().ref_time()
}
fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight {
XcmGeneric::<Runtime>::buy_execution().ref_time()
Expand Down Expand Up @@ -185,4 +180,65 @@ impl<Call> XcmWeightInfo<Call> for StatemineXcmWeight<Call> {
fn unsubscribe_version() -> XCMWeight {
XcmGeneric::<Runtime>::unsubscribe_version().ref_time()
}
fn burn_asset(assets: &MultiAssets) -> XCMWeight {
assets.weigh_multi_assets(XcmGeneric::<Runtime>::burn_asset())
}
fn expect_asset(assets: &MultiAssets) -> XCMWeight {
assets.weigh_multi_assets(XcmGeneric::<Runtime>::expect_asset())
}
fn expect_origin(_origin: &Option<MultiLocation>) -> XCMWeight {
XcmGeneric::<Runtime>::expect_origin().ref_time()
}
fn expect_error(_error: &Option<(u32, XcmError)>) -> XCMWeight {
XcmGeneric::<Runtime>::expect_error().ref_time()
}
fn query_pallet(_module_name: &Vec<u8>, _response_info: &QueryResponseInfo) -> XCMWeight {
XcmGeneric::<Runtime>::query_pallet().ref_time()
}
fn expect_pallet(
_index: &u32,
_name: &Vec<u8>,
_module_name: &Vec<u8>,
_crate_major: &u32,
_min_crate_minor: &u32,
) -> XCMWeight {
XcmGeneric::<Runtime>::expect_pallet().ref_time()
}
fn report_transact_status(_response_info: &QueryResponseInfo) -> XCMWeight {
XcmGeneric::<Runtime>::report_transact_status().ref_time()
}
fn clear_transact_status() -> XCMWeight {
XcmGeneric::<Runtime>::clear_transact_status().ref_time()
}
fn universal_origin(_: &Junction) -> XCMWeight {
Weight::MAX.ref_time()
}
fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> XCMWeight {
Weight::MAX.ref_time()
}
fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> XCMWeight {
Weight::MAX.ref_time()
}
fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> XCMWeight {
Weight::MAX.ref_time()
}
fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> XCMWeight {
Weight::MAX.ref_time()
}
fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> XCMWeight {
Weight::MAX.ref_time()
}
fn set_fees_mode(_: &bool) -> XCMWeight {
XcmGeneric::<Runtime>::set_fees_mode().ref_time()
}
fn set_topic(_topic: &[u8; 32]) -> XCMWeight {
XcmGeneric::<Runtime>::set_topic().ref_time()
}
fn clear_topic() -> XCMWeight {
XcmGeneric::<Runtime>::clear_topic().ref_time()
}
fn alias_origin(_: &MultiLocation) -> XCMWeight {
// XCM Executor does not currently support alias origin operations
Weight::MAX.ref_time()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
//! Autogenerated weights for `pallet_xcm_benchmarks::generic`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2022-08-17, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2022-09-30, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 1024

// Executed Command:
Expand All @@ -36,7 +37,7 @@
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
// --header=./file_header.txt
// --template=./templates/xcm-bench-template.hbs
// --output=./parachains/runtimes/assets/statemine/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
// --output=./parachains/runtimes/assets/statemine/src/weights/xcm/

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand All @@ -54,58 +55,59 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
pub(crate) fn query_holding() -> Weight {
Weight::from_ref_time(694_466_000 as u64)
pub(crate) fn report_holding() -> Weight {
Weight::from_ref_time(1_303_495_000 as u64)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
pub(crate) fn buy_execution() -> Weight {
Weight::from_ref_time(7_095_000 as u64)
Weight::from_ref_time(8_667_000 as u64)
}
// Storage: PolkadotXcm Queries (r:1 w:0)
pub(crate) fn query_response() -> Weight {
Weight::from_ref_time(13_270_000 as u64)
Weight::from_ref_time(19_292_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
}
pub(crate) fn transact() -> Weight {
Weight::from_ref_time(16_375_000 as u64)
Weight::from_ref_time(37_996_000 as u64)
}
pub(crate) fn refund_surplus() -> Weight {
Weight::from_ref_time(7_319_000 as u64)
Weight::from_ref_time(9_076_000 as u64)
}
pub(crate) fn set_error_handler() -> Weight {
Weight::from_ref_time(3_515_000 as u64)
Weight::from_ref_time(6_410_000 as u64)
}
pub(crate) fn set_appendix() -> Weight {
Weight::from_ref_time(3_501_000 as u64)
Weight::from_ref_time(6_412_000 as u64)
}
pub(crate) fn clear_error() -> Weight {
Weight::from_ref_time(3_459_000 as u64)
Weight::from_ref_time(6_311_000 as u64)
}
pub(crate) fn descend_origin() -> Weight {
Weight::from_ref_time(4_319_000 as u64)
Weight::from_ref_time(7_355_000 as u64)
}
pub(crate) fn clear_origin() -> Weight {
Weight::from_ref_time(3_511_000 as u64)
Weight::from_ref_time(6_389_000 as u64)
}
// Storage: ParachainInfo ParachainId (r:1 w:0)
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
pub(crate) fn report_error() -> Weight {
Weight::from_ref_time(13_284_000 as u64)
.saturating_add(T::DbWeight::get().reads(5 as u64))
Weight::from_ref_time(23_020_000 as u64)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
// Storage: PolkadotXcm AssetTraps (r:1 w:1)
pub(crate) fn claim_asset() -> Weight {
Weight::from_ref_time(7_985_000 as u64)
Weight::from_ref_time(13_613_000 as u64)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
pub(crate) fn trap() -> Weight {
Weight::from_ref_time(3_515_000 as u64)
Weight::from_ref_time(6_457_000 as u64)
}
// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1)
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
Expand All @@ -114,13 +116,13 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
pub(crate) fn subscribe_version() -> Weight {
Weight::from_ref_time(16_657_000 as u64)
Weight::from_ref_time(31_677_000 as u64)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1)
pub(crate) fn unsubscribe_version() -> Weight {
Weight::from_ref_time(5_622_000 as u64)
Weight::from_ref_time(9_613_000 as u64)
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: ParachainInfo ParachainId (r:1 w:0)
Expand All @@ -130,8 +132,57 @@ impl<T: frame_system::Config> WeightInfo<T> {
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
pub(crate) fn initiate_reserve_withdraw() -> Weight {
Weight::from_ref_time(878_786_000 as u64)
Weight::from_ref_time(1_588_580_000 as u64)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
pub(crate) fn burn_asset() -> Weight {
Weight::from_ref_time(497_452_000 as u64)
}
pub(crate) fn expect_asset() -> Weight {
Weight::from_ref_time(38_502_000 as u64)
}
pub(crate) fn expect_origin() -> Weight {
Weight::from_ref_time(6_427_000 as u64)
}
pub(crate) fn expect_error() -> Weight {
Weight::from_ref_time(6_303_000 as u64)
}
// Storage: ParachainInfo ParachainId (r:1 w:0)
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
pub(crate) fn query_pallet() -> Weight {
Weight::from_ref_time(25_510_000 as u64)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
pub(crate) fn expect_pallet() -> Weight {
Weight::from_ref_time(7_909_000 as u64)
}
// Storage: ParachainInfo ParachainId (r:1 w:0)
// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
// Storage: ParachainSystem HostConfiguration (r:1 w:0)
// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
pub(crate) fn report_transact_status() -> Weight {
Weight::from_ref_time(22_949_000 as u64)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
pub(crate) fn clear_transact_status() -> Weight {
Weight::from_ref_time(6_491_000 as u64)
}
pub(crate) fn set_topic() -> Weight {
Weight::from_ref_time(6_527_000 as u64)
}
pub(crate) fn clear_topic() -> Weight {
Weight::from_ref_time(6_440_000 as u64)
}
pub(crate) fn set_fees_mode() -> Weight {
Weight::from_ref_time(6_426_000 as u64)
}
}
2 changes: 1 addition & 1 deletion parachains/runtimes/assets/statemine/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetTrap = PolkadotXcm;
type AssetClaims = PolkadotXcm;
type SubscriptionService = PolkadotXcm;
type PalletInstancesInfo = ();
type PalletInstancesInfo = super::AllPalletsWithSystem;
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
Expand Down
Loading