mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
[xcm] Use Weight::MAX for reserve_asset_deposited, receive_teleported_asset benchmarks (#1726)
# Description ## Summary Previously, the `pallet_xcm::do_reserve_transfer_assets` and `pallet_xcm::do_teleport_assets` functions relied on weight estimation for remote chain execution, which was based on guesswork derived from the local chain. This approach led to complications for runtimes that did not provide or support specific [XCM configurations](https://github.com/paritytech/polkadot-sdk/blob/7cbe0c76ef8fd2aabf9f07de0156941ce3ed44b0/polkadot/xcm/xcm-executor/src/config.rs#L43-L47) for `IsReserve` or `IsTeleporter`. Consequently, such runtimes had to resort to implementing hard-coded weights for XCM instructions like `reserve_asset_deposited` or `receive_teleported_asset` to support extrinsics such as `pallet_xcm::reserve_transfer_assets` and `pallet_xcm::teleport_assets`, which depended on remote weight estimation. The issue of remote weight estimation was addressed and resolved by [Pull Request #1645](https://github.com/paritytech/polkadot-sdk/pull/1645), which removed the need for remote weight estimation. ## Solution As a continuation of this improvement, the current PR proposes further cleanup by removing unnecessary hard-coded values and rectifying benchmark results with `Weight::MAX` that previously used `T::BlockWeights::get().max_block` as an override for unsupported XCM instructions like `ReserveAssetDeposited` and `ReceiveTeleportedAsset`. ## Questions - [x] Can we remove now also `Hardcoded till the XCM pallet is fixed` for `deposit_asset`? E.g. for AssetHubKusama [here](https://github.com/paritytech/polkadot-sdk/blob/7cbe0c76ef8fd2aabf9f07de0156941ce3ed44b0/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/weights/xcm/mod.rs#L129-L134) - [x] Are comments like [this](https://github.com/paritytech/polkadot-sdk/blob/7cbe0c76ef8fd2aabf9f07de0156941ce3ed44b0/polkadot/runtime/kusama/src/weights/xcm/mod.rs#L94) `// Kusama doesn't support ReserveAssetDeposited, so this benchmark has a default weight` still relevant? Shouldnt be removed/changed? ## TODO - [x] `bench bot` regenerate xcm weights for all runtimes - [x] remove hard-coded stuff from system parachain weight files - [ ] when merged, open `polkadot-fellow/runtimes` PR ## References Fixes #1132 Closes #1132 Old polkadot repo [PR](https://github.com/paritytech/polkadot/pull/7546) --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -61,16 +61,8 @@ impl<Call> XcmWeightInfo<Call> for AssetHubKusamaXcmWeight<Call> {
|
||||
fn withdraw_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::withdraw_asset())
|
||||
}
|
||||
// Currently there is no trusted reserve (`IsReserve = ()`),
|
||||
// but we need this hack for `pallet_xcm::reserve_transfer_assets`
|
||||
// (TODO) fix https://github.com/paritytech/polkadot/pull/7424
|
||||
// (TODO) fix https://github.com/paritytech/polkadot/pull/7546
|
||||
fn reserve_asset_deposited(_assets: &MultiAssets) -> Weight {
|
||||
// TODO: if we change `IsReserve = ...` then use this line...
|
||||
// TODO: or if remote weight estimation is fixed, then remove
|
||||
// TODO: hardcoded - fix https://github.com/paritytech/cumulus/issues/1974
|
||||
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
|
||||
hardcoded_weight.min(XcmFungibleWeight::<Runtime>::reserve_asset_deposited())
|
||||
fn reserve_asset_deposited(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::reserve_asset_deposited())
|
||||
}
|
||||
fn receive_teleported_asset(assets: &MultiAssets) -> Weight {
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::receive_teleported_asset())
|
||||
@@ -127,10 +119,7 @@ impl<Call> XcmWeightInfo<Call> for AssetHubKusamaXcmWeight<Call> {
|
||||
}
|
||||
|
||||
fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> Weight {
|
||||
// Hardcoded till the XCM pallet is fixed
|
||||
let hardcoded_weight = Weight::from_parts(1_000_000_000_u64, 0);
|
||||
let weight = assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset());
|
||||
hardcoded_weight.min(weight)
|
||||
assets.weigh_multi_assets(XcmFungibleWeight::<Runtime>::deposit_asset())
|
||||
}
|
||||
fn deposit_reserve_asset(
|
||||
assets: &MultiAssetFilter,
|
||||
|
||||
+38
-40
@@ -17,28 +17,26 @@
|
||||
//! Autogenerated weights for `pallet_xcm_benchmarks::fungible`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-07-31, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-09-28, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `runner-ynta1nyy-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-kusama-dev"), DB CACHE: 1024
|
||||
//! HOSTNAME: `runner-nbnwcyh-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
|
||||
//! WASM-EXECUTION: Compiled, CHAIN: Some("asset-hub-kusama-dev"), DB CACHE: 1024
|
||||
|
||||
// Executed Command:
|
||||
// ./target/production/polkadot-parachain
|
||||
// target/production/polkadot-parachain
|
||||
// benchmark
|
||||
// pallet
|
||||
// --template=./templates/xcm-bench-template.hbs
|
||||
// --chain=asset-hub-kusama-dev
|
||||
// --wasm-execution=compiled
|
||||
// --pallet=pallet_xcm_benchmarks::fungible
|
||||
// --no-storage-info
|
||||
// --no-median-slopes
|
||||
// --no-min-squares
|
||||
// --extrinsic=*
|
||||
// --steps=50
|
||||
// --repeat=20
|
||||
// --json
|
||||
// --header=./file_header.txt
|
||||
// --output=./parachains/runtimes/assets/asset-hub-kusama/src/weights/xcm/pallet_xcm_benchmarks_fungible.rs
|
||||
// --extrinsic=*
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --json-file=/builds/parity/mirrors/polkadot-sdk/.git/.artifacts/bench.json
|
||||
// --pallet=pallet_xcm_benchmarks::fungible
|
||||
// --chain=asset-hub-kusama-dev
|
||||
// --header=./cumulus/file_header.txt
|
||||
// --template=./cumulus/templates/xcm-bench-template.hbs
|
||||
// --output=./cumulus/parachains/runtimes/assets/asset-hub-kusama/src/weights/xcm/
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
@@ -56,8 +54,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `101`
|
||||
// Estimated: `3593`
|
||||
// Minimum execution time: 26_104_000 picoseconds.
|
||||
Weight::from_parts(26_722_000, 3593)
|
||||
// Minimum execution time: 25_602_000 picoseconds.
|
||||
Weight::from_parts(26_312_000, 3593)
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
@@ -67,8 +65,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `101`
|
||||
// Estimated: `6196`
|
||||
// Minimum execution time: 52_259_000 picoseconds.
|
||||
Weight::from_parts(53_854_000, 6196)
|
||||
// Minimum execution time: 51_173_000 picoseconds.
|
||||
Weight::from_parts(52_221_000, 6196)
|
||||
.saturating_add(T::DbWeight::get().reads(2))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
@@ -88,10 +86,10 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
pub fn transfer_reserve_asset() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `210`
|
||||
// Measured: `246`
|
||||
// Estimated: `6196`
|
||||
// Minimum execution time: 77_248_000 picoseconds.
|
||||
Weight::from_parts(80_354_000, 6196)
|
||||
// Minimum execution time: 74_651_000 picoseconds.
|
||||
Weight::from_parts(76_500_000, 6196)
|
||||
.saturating_add(T::DbWeight::get().reads(8))
|
||||
.saturating_add(T::DbWeight::get().writes(4))
|
||||
}
|
||||
@@ -101,8 +99,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 500_000_000_000 picoseconds.
|
||||
Weight::from_parts(500_000_000_000, 0)
|
||||
// Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
|
||||
Weight::from_parts(18_446_744_073_709_551_000, 0)
|
||||
}
|
||||
// Storage: `ParachainInfo::ParachainId` (r:1 w:0)
|
||||
// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
|
||||
@@ -118,10 +116,10 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
pub fn initiate_reserve_withdraw() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `109`
|
||||
// Estimated: `3574`
|
||||
// Minimum execution time: 482_070_000 picoseconds.
|
||||
Weight::from_parts(490_269_000, 3574)
|
||||
// Measured: `145`
|
||||
// Estimated: `3610`
|
||||
// Minimum execution time: 458_666_000 picoseconds.
|
||||
Weight::from_parts(470_470_000, 3610)
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
@@ -129,8 +127,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `0`
|
||||
// Minimum execution time: 3_970_000 picoseconds.
|
||||
Weight::from_parts(4_056_000, 0)
|
||||
// Minimum execution time: 3_701_000 picoseconds.
|
||||
Weight::from_parts(3_887_000, 0)
|
||||
}
|
||||
// Storage: `System::Account` (r:1 w:1)
|
||||
// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`)
|
||||
@@ -138,8 +136,8 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `0`
|
||||
// Estimated: `3593`
|
||||
// Minimum execution time: 26_324_000 picoseconds.
|
||||
Weight::from_parts(26_985_000, 3593)
|
||||
// Minimum execution time: 25_709_000 picoseconds.
|
||||
Weight::from_parts(26_320_000, 3593)
|
||||
.saturating_add(T::DbWeight::get().reads(1))
|
||||
.saturating_add(T::DbWeight::get().writes(1))
|
||||
}
|
||||
@@ -159,10 +157,10 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
pub fn deposit_reserve_asset() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `109`
|
||||
// Estimated: `3593`
|
||||
// Minimum execution time: 52_814_000 picoseconds.
|
||||
Weight::from_parts(54_666_000, 3593)
|
||||
// Measured: `145`
|
||||
// Estimated: `3610`
|
||||
// Minimum execution time: 51_663_000 picoseconds.
|
||||
Weight::from_parts(52_538_000, 3610)
|
||||
.saturating_add(T::DbWeight::get().reads(7))
|
||||
.saturating_add(T::DbWeight::get().writes(3))
|
||||
}
|
||||
@@ -180,10 +178,10 @@ impl<T: frame_system::Config> WeightInfo<T> {
|
||||
// Proof: `ParachainSystem::PendingUpwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
|
||||
pub fn initiate_teleport() -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `109`
|
||||
// Estimated: `3574`
|
||||
// Minimum execution time: 33_044_000 picoseconds.
|
||||
Weight::from_parts(33_849_000, 3574)
|
||||
// Measured: `145`
|
||||
// Estimated: `3610`
|
||||
// Minimum execution time: 31_972_000 picoseconds.
|
||||
Weight::from_parts(32_834_000, 3610)
|
||||
.saturating_add(T::DbWeight::get().reads(6))
|
||||
.saturating_add(T::DbWeight::get().writes(2))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user