diff --git a/Cargo.lock b/Cargo.lock
index 01bdaedad3..013c0838a9 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -521,6 +521,7 @@ dependencies = [
"ethereum-types",
"fp-evm",
"frame-support",
+ "frame-system",
"impl-trait-for-tuples",
"log",
"orml-traits",
@@ -649,6 +650,30 @@ dependencies = [
"sp-runtime",
]
+[[package]]
+name = "astar-xcm-benchmarks"
+version = "0.1.0"
+dependencies = [
+ "astar-primitives",
+ "frame-benchmarking",
+ "frame-support",
+ "frame-system",
+ "log",
+ "pallet-assets",
+ "pallet-balances",
+ "pallet-xcm-benchmarks",
+ "parity-scale-codec",
+ "scale-info",
+ "serde",
+ "sp-core",
+ "sp-io",
+ "sp-runtime",
+ "sp-std",
+ "xcm",
+ "xcm-builder",
+ "xcm-executor",
+]
+
[[package]]
name = "async-channel"
version = "1.9.0"
@@ -13163,6 +13188,7 @@ version = "5.28.0"
dependencies = [
"array-bytes 6.1.0",
"astar-primitives",
+ "astar-xcm-benchmarks",
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
@@ -13242,6 +13268,7 @@ dependencies = [
"pallet-vesting",
"pallet-xc-asset-config",
"pallet-xcm",
+ "pallet-xcm-benchmarks",
"pallet-xvm",
"parachain-info",
"parity-scale-codec",
diff --git a/Cargo.toml b/Cargo.toml
index b55af3035a..30f78873e0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -255,6 +255,7 @@ polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot",
cumulus-pallet-xcm = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.43", default-features = false }
xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
pallet-xcm = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
+pallet-xcm-benchmarks = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43", default-features = false }
@@ -282,6 +283,7 @@ pallet-ethereum-checked = { path = "./pallets/ethereum-checked", default-feature
pallet-inflation = { path = "./pallets/inflation", default-features = false }
pallet-dynamic-evm-base-fee = { path = "./pallets/dynamic-evm-base-fee", default-features = false }
pallet-unified-accounts = { path = "./pallets/unified-accounts", default-features = false }
+astar-xcm-benchmarks = { path = "./pallets/astar-xcm-benchmarks", default-features = false }
pallet-static-price-provider = { path = "./pallets/static-price-provider", default-features = false }
dapp-staking-v3-runtime-api = { path = "./pallets/dapp-staking-v3/rpc/runtime-api", default-features = false }
diff --git a/pallets/astar-xcm-benchmarks/Cargo.toml b/pallets/astar-xcm-benchmarks/Cargo.toml
new file mode 100644
index 0000000000..d115be0b6a
--- /dev/null
+++ b/pallets/astar-xcm-benchmarks/Cargo.toml
@@ -0,0 +1,65 @@
+[package]
+name = "astar-xcm-benchmarks"
+version = "0.1.0"
+description = "Pallet for providing benchmarks for xcm instructions"
+authors.workspace = true
+edition.workspace = true
+homepage.workspace = true
+repository.workspace = true
+
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+
+[dependencies]
+log = { workspace = true }
+serde = { workspace = true, optional = true }
+
+# Substrate
+frame-support = { workspace = true }
+frame-system = { workspace = true }
+parity-scale-codec = { workspace = true, optional = true, features = ["derive"] }
+scale-info = { workspace = true }
+sp-std = { workspace = true }
+
+# Polkadot / XCM
+pallet-xcm-benchmarks = { workspace = true }
+xcm = { workspace = true }
+xcm-executor = { workspace = true }
+
+# Benchmarks
+frame-benchmarking = { workspace = true, optional = true }
+
+# Astar
+astar-primitives = { workspace = true }
+
+[dev-dependencies]
+pallet-assets = { workspace = true, features = ["std"] }
+pallet-balances = { workspace = true, features = ["std"] }
+sp-core = { workspace = true, features = ["std"] }
+sp-io = { workspace = true, features = ["std"] }
+sp-runtime = { workspace = true, features = ["std"] }
+xcm-builder = { workspace = true, features = ["std"] }
+
+[features]
+default = ["std"]
+std = [
+ "astar-primitives/std",
+ "frame-benchmarking/std",
+ "frame-support/std",
+ "frame-system/std",
+ "pallet-xcm-benchmarks/std",
+ "parity-scale-codec/std",
+ "serde",
+ "sp-std/std",
+ "xcm/std",
+]
+
+try-runtime = ["frame-support/try-runtime"]
+
+runtime-benchmarks = [
+ "frame-benchmarking",
+ "frame-system/runtime-benchmarks",
+ "pallet-assets/runtime-benchmarks",
+ "pallet-xcm-benchmarks/runtime-benchmarks",
+ "parity-scale-codec",
+ "xcm-executor/runtime-benchmarks",
+]
diff --git a/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs
new file mode 100644
index 0000000000..4246c1076d
--- /dev/null
+++ b/pallets/astar-xcm-benchmarks/src/fungible/benchmarking.rs
@@ -0,0 +1,204 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+use super::{Pallet as AstarBenchmarks, *};
+use crate::WrappedBenchmark;
+use frame_benchmarking::v2::*;
+use frame_support::{
+ dispatch::Weight,
+ traits::{fungible::Inspect, Get},
+};
+use pallet_xcm_benchmarks::{
+ account_and_location, fungible::Pallet as PalletXcmBenchmarks, new_executor, AssetTransactorOf,
+};
+use sp_std::vec;
+use xcm::latest::prelude::*;
+use xcm_executor::traits::{Convert, TransactAsset};
+
+#[benchmarks(
+ where
+ <
+ <
+ T::TransactAsset
+ as
+ Inspect
+ >::Balance
+ as
+ TryInto
+ >::Error: sp_std::fmt::Debug,
+)]
+mod benchmarks {
+ use super::*;
+
+ /// Re-write for fungibles assets (like pallet_assets's assets) as
+ /// upstream benchmark does not take ED (assets's min_balance) into consideration
+ #[benchmark]
+ fn transfer_asset() -> Result<(), BenchmarkError> {
+ let (sender_account, sender_location) = account_and_location::(1);
+ let asset_to_deposit = T::get_multi_asset();
+ // take out ED from given asset
+ let (asset_to_send, min_balance) =
+ take_minimum_balance::(asset_to_deposit.clone()).unwrap();
+ let assets: MultiAssets = vec![asset_to_send.clone()].into();
+ // this xcm doesn't use holding
+
+ let dest_location = T::valid_destination()?;
+ let dest_account = T::AccountIdConverter::convert(dest_location.clone()).unwrap();
+
+ >::deposit_asset(
+ &asset_to_deposit,
+ &sender_location,
+ &XcmContext {
+ origin: Some(sender_location.clone()),
+ message_hash: [0; 32],
+ topic: None,
+ },
+ )
+ .unwrap();
+
+ let mut executor = new_executor::(sender_location);
+ let instruction = Instruction::TransferAsset {
+ assets,
+ beneficiary: dest_location,
+ };
+ let xcm = Xcm(vec![instruction]);
+
+ #[block]
+ {
+ executor.bench_process(xcm)?;
+ }
+
+ assert_eq!(T::TransactAsset::balance(&sender_account), min_balance);
+ assert!(!T::TransactAsset::balance(&dest_account).is_zero());
+ Ok(())
+ }
+
+ /// Re-write for fungibles assets (like pallet_assets's assets) as
+ /// upstream benchmark does not take ED (assets's min_balance) into consideration
+ #[benchmark]
+ fn transfer_reserve_asset() -> Result<(), BenchmarkError> {
+ let (sender_account, sender_location) = account_and_location::(1);
+ let dest_location = T::valid_destination()?;
+ let dest_account = T::AccountIdConverter::convert(dest_location.clone()).unwrap();
+
+ let asset_to_deposit = T::get_multi_asset();
+ // take out ED from given asset
+ let (asset_to_send, min_balance) =
+ take_minimum_balance::(asset_to_deposit.clone()).unwrap();
+ let assets: MultiAssets = vec![asset_to_send].into();
+
+ >::deposit_asset(
+ &asset_to_deposit,
+ &sender_location,
+ &XcmContext {
+ origin: Some(sender_location.clone()),
+ message_hash: [0; 32],
+ topic: None,
+ },
+ )
+ .unwrap();
+ assert!(T::TransactAsset::balance(&dest_account).is_zero());
+
+ let mut executor = new_executor::(sender_location);
+ let instruction = Instruction::TransferReserveAsset {
+ assets,
+ dest: dest_location,
+ xcm: Xcm::new(),
+ };
+ let xcm = Xcm(vec![instruction]);
+
+ #[block]
+ {
+ executor.bench_process(xcm)?;
+ }
+
+ assert_eq!(T::TransactAsset::balance(&sender_account), min_balance);
+ assert!(!T::TransactAsset::balance(&dest_account).is_zero());
+ Ok(())
+ }
+
+ /// The benchmarks for `reserve_asset_deposited` was added in later versions of
+ /// `pallet-xcm-benchmarks` (in v1.x.x versions).
+ /// TODO: remove this once we uplift to new polkadot release
+ #[benchmark]
+ fn reserve_asset_deposited() -> Result<(), BenchmarkError> {
+ let (trusted_reserve, transferable_reserve_asset) = T::TrustedReserve::get().ok_or(
+ BenchmarkError::Override(BenchmarkResult::from_weight(Weight::MAX)),
+ )?;
+
+ let assets: MultiAssets = vec![transferable_reserve_asset].into();
+
+ let mut executor = new_executor::(trusted_reserve);
+ let instruction = Instruction::ReserveAssetDeposited(assets.clone());
+ let xcm = Xcm(vec![instruction]);
+
+ #[block]
+ {
+ executor.bench_process(xcm)?;
+ }
+
+ assert!(executor.holding().ensure_contains(&assets).is_ok());
+ Ok(())
+ }
+
+ #[benchmark]
+ fn receive_teleported_asset() -> Result<(), BenchmarkError> {
+ #[block]
+ {}
+ Err(BenchmarkError::Override(BenchmarkResult::from_weight(
+ Weight::MAX,
+ )))
+ }
+
+ #[benchmark]
+ fn initiate_teleport() -> Result<(), BenchmarkError> {
+ #[block]
+ {}
+ Err(BenchmarkError::Override(BenchmarkResult::from_weight(
+ Weight::MAX,
+ )))
+ }
+
+ impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
+}
+
+// wrapper benchmarks
+pub type XcmFungibleBenchmarks = WrappedBenchmark, PalletXcmBenchmarks>;
+
+/// Take out the ED from given MultiAsset (if fungible)
+fn take_minimum_balance(
+ mut asset: MultiAsset,
+) -> Result<
+ (
+ MultiAsset,
+ >::Balance,
+ ),
+ (),
+>
+where
+ <>::Balance as TryInto>::Error:
+ sp_std::fmt::Debug,
+{
+ let minimum_balance = T::TransactAsset::minimum_balance();
+
+ if let Fungible(fun) = asset.fun {
+ asset.fun = Fungible(fun.saturating_sub(minimum_balance.try_into().map_err(|_| ())?));
+ }
+
+ Ok((asset, minimum_balance))
+}
diff --git a/pallets/astar-xcm-benchmarks/src/fungible/mod.rs b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs
new file mode 100644
index 0000000000..6e4fa21e6b
--- /dev/null
+++ b/pallets/astar-xcm-benchmarks/src/fungible/mod.rs
@@ -0,0 +1,39 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+pub use pallet::*;
+
+#[cfg(feature = "runtime-benchmarks")]
+pub mod benchmarking;
+
+#[frame_support::pallet]
+pub mod pallet {
+ #[pallet::config]
+ pub trait Config:
+ frame_system::Config + crate::Config + pallet_xcm_benchmarks::fungible::Config
+ {
+ /// A trusted location where reserve assets are stored, and the asset we allow to be
+ /// reserves.
+ type TrustedReserve: frame_support::traits::Get<
+ Option<(xcm::latest::MultiLocation, xcm::latest::MultiAsset)>,
+ >;
+ }
+
+ #[pallet::pallet]
+ pub struct Pallet(_);
+}
diff --git a/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs
new file mode 100644
index 0000000000..d244fd0da1
--- /dev/null
+++ b/pallets/astar-xcm-benchmarks/src/generic/benchmarking.rs
@@ -0,0 +1,151 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+use super::{Pallet as AstarBenchmarks, *};
+use crate::WrappedBenchmark;
+use frame_benchmarking::v2::*;
+use frame_support::dispatch::Weight;
+use pallet_xcm_benchmarks::{generic::Pallet as PalletXcmBenchmarks, new_executor, XcmCallOf};
+use sp_std::vec;
+use xcm::latest::prelude::*;
+
+#[benchmarks]
+mod benchmarks {
+ use super::*;
+
+ /// We need re-write buy_execution benchmark becuase our runtime
+ /// needs 1 additional DB read (XcAssetConfig) for fetching unit per sec
+ /// for a fungible asset. The upstream benchmark use native assets thus
+ /// won't accout for it.
+ #[benchmark]
+ fn buy_execution() -> Result<(), BenchmarkError> {
+ let holding = T::worst_case_holding(0).into();
+
+ let mut executor = new_executor::(Default::default());
+ executor.set_holding(holding);
+
+ // A fungible asset
+ let fee_asset = Concrete(MultiLocation::parent());
+
+ let instruction = Instruction::>::BuyExecution {
+ fees: (fee_asset, 100_000_000u128).into(), // should be something inside of holding
+ // this should not be Unlimited, as xcm-executor will skip buying the
+ // exceution altogether.
+ weight_limit: WeightLimit::Limited(Weight::from_parts(1u64, 1024)),
+ };
+
+ let xcm = Xcm(vec![instruction]);
+
+ #[block]
+ {
+ executor.bench_process(xcm)?;
+ }
+ // The completion of execution above is enough to validate this is completed.
+ Ok(())
+ }
+
+ /// Re-write as upstream one has hardcoded system pallet index as 1 whereas our runtimes
+ /// uses index 10.
+ #[benchmark]
+ fn expect_pallet() -> Result<(), BenchmarkError> {
+ let mut executor = new_executor::(Default::default());
+
+ let instruction = Instruction::ExpectPallet {
+ // used index 10 for our runtimes
+ index: 10,
+ name: b"System".to_vec(),
+ module_name: b"frame_system".to_vec(),
+ crate_major: 4,
+ min_crate_minor: 0,
+ };
+ let xcm = Xcm(vec![instruction]);
+
+ #[block]
+ {
+ executor.bench_process(xcm)?;
+ }
+ Ok(())
+ }
+
+ #[benchmark]
+ fn exchange_asset() -> Result<(), BenchmarkError> {
+ #[block]
+ {}
+ Err(BenchmarkError::Override(BenchmarkResult::from_weight(
+ Weight::MAX,
+ )))
+ }
+
+ #[benchmark]
+ fn export_message() -> Result<(), BenchmarkError> {
+ #[block]
+ {}
+ Err(BenchmarkError::Override(BenchmarkResult::from_weight(
+ Weight::MAX,
+ )))
+ }
+
+ #[benchmark]
+ fn lock_asset() -> Result<(), BenchmarkError> {
+ #[block]
+ {}
+ Err(BenchmarkError::Override(BenchmarkResult::from_weight(
+ Weight::MAX,
+ )))
+ }
+
+ #[benchmark]
+ fn unlock_asset() -> Result<(), BenchmarkError> {
+ #[block]
+ {}
+ Err(BenchmarkError::Override(BenchmarkResult::from_weight(
+ Weight::MAX,
+ )))
+ }
+
+ #[benchmark]
+ fn note_unlockable() -> Result<(), BenchmarkError> {
+ #[block]
+ {}
+ Err(BenchmarkError::Override(BenchmarkResult::from_weight(
+ Weight::MAX,
+ )))
+ }
+
+ #[benchmark]
+ fn request_unlock() -> Result<(), BenchmarkError> {
+ #[block]
+ {}
+ Err(BenchmarkError::Override(BenchmarkResult::from_weight(
+ Weight::MAX,
+ )))
+ }
+
+ #[benchmark]
+ fn universal_origin() -> Result<(), BenchmarkError> {
+ #[block]
+ {}
+ Err(BenchmarkError::Override(BenchmarkResult::from_weight(
+ Weight::MAX,
+ )))
+ }
+
+ impl_benchmark_test_suite!(Pallet, crate::mock::new_test_ext(), crate::mock::Test);
+}
+
+pub type XcmGenericBenchmarks = WrappedBenchmark, PalletXcmBenchmarks>;
diff --git a/pallets/astar-xcm-benchmarks/src/generic/mod.rs b/pallets/astar-xcm-benchmarks/src/generic/mod.rs
new file mode 100644
index 0000000000..715e12fbfa
--- /dev/null
+++ b/pallets/astar-xcm-benchmarks/src/generic/mod.rs
@@ -0,0 +1,34 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+pub use pallet::*;
+
+#[cfg(feature = "runtime-benchmarks")]
+pub mod benchmarking;
+
+#[frame_support::pallet]
+pub mod pallet {
+ #[pallet::config]
+ pub trait Config:
+ frame_system::Config + crate::Config + pallet_xcm_benchmarks::generic::Config
+ {
+ }
+
+ #[pallet::pallet]
+ pub struct Pallet(_);
+}
diff --git a/pallets/astar-xcm-benchmarks/src/lib.rs b/pallets/astar-xcm-benchmarks/src/lib.rs
new file mode 100644
index 0000000000..b0f232da72
--- /dev/null
+++ b/pallets/astar-xcm-benchmarks/src/lib.rs
@@ -0,0 +1,65 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+#![cfg_attr(not(feature = "std"), no_std)]
+
+pub mod fungible;
+pub mod generic;
+
+#[cfg(test)]
+mod mock;
+
+use sp_std::vec::Vec;
+
+/// A base trait for all individual pallets
+pub trait Config: frame_system::Config + pallet_xcm_benchmarks::Config {}
+
+/// This is a wrapper benchmark implementation over `Inner` by `Outer` by merging
+/// the benches from `Inner` if they don't exist in `Outer`.
+pub struct WrappedBenchmark(core::marker::PhantomData<(Outer, Inner)>);
+impl frame_benchmarking::Benchmarking for WrappedBenchmark
+where
+ Outer: frame_benchmarking::Benchmarking,
+ Inner: frame_benchmarking::Benchmarking,
+{
+ fn benchmarks(extra: bool) -> Vec {
+ let mut outer = Outer::benchmarks(extra);
+ let inner = Inner::benchmarks(extra);
+
+ for meta in inner {
+ if !outer.iter().any(|m| m.name == meta.name) {
+ outer.push(meta)
+ }
+ }
+ outer
+ }
+
+ fn run_benchmark(
+ name: &[u8],
+ c: &[(frame_benchmarking::BenchmarkParameter, u32)],
+ whitelist: &[frame_benchmarking::TrackedStorageKey],
+ verify: bool,
+ internal_repeats: u32,
+ ) -> Result, frame_benchmarking::BenchmarkError> {
+ if Outer::benchmarks(true).iter().any(|x| x.name == name) {
+ Outer::run_benchmark(name, c, whitelist, verify, internal_repeats)
+ } else {
+ Inner::run_benchmark(name, c, whitelist, verify, internal_repeats)
+ }
+ }
+}
diff --git a/pallets/astar-xcm-benchmarks/src/mock.rs b/pallets/astar-xcm-benchmarks/src/mock.rs
new file mode 100644
index 0000000000..bbfb01cbad
--- /dev/null
+++ b/pallets/astar-xcm-benchmarks/src/mock.rs
@@ -0,0 +1,380 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+//! A mock runtime for XCM benchmarking.
+
+use crate::{fungible, generic, *};
+use astar_primitives::xcm::ReserveAssetFilter;
+use frame_benchmarking::BenchmarkError;
+use frame_support::{
+ assert_ok, parameter_types,
+ traits::{fungible::ItemOf, AsEnsureOriginWithArg, Everything, Nothing},
+ weights::Weight,
+};
+use frame_system::{EnsureRoot, EnsureSigned};
+
+use core::marker::PhantomData;
+use sp_core::{ConstU32, ConstU64, Get, H256};
+use sp_runtime::{
+ testing::Header,
+ traits::{BlakeTwo256, IdentityLookup},
+};
+use xcm::latest::prelude::*;
+use xcm_builder::{AllowUnpaidExecutionFrom, FungiblesAdapter, MintLocation, NoChecking};
+
+type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic;
+type Block = frame_system::mocking::MockBlock;
+type Balance = u64;
+type AccountId = u64;
+type AssetId = u128;
+
+// For testing the pallet, we construct a mock runtime.
+frame_support::construct_runtime!(
+ pub enum Test where
+ Block = Block,
+ NodeBlock = Block,
+ UncheckedExtrinsic = UncheckedExtrinsic,
+ {
+ System: frame_system::{Pallet, Call, Config, Storage, Event} = 10,
+ Balances: pallet_balances::{Pallet, Call, Storage, Config, Event},
+ Assets: pallet_assets::{Pallet, Call, Storage, Event},
+ PolkadotXcmGenericBenchmarks: pallet_xcm_benchmarks::generic::{Pallet},
+ PolkadotXcmFungibleBenchmarks: pallet_xcm_benchmarks::fungible::{Pallet},
+ XcmAssetsBenchmark: fungible::{Pallet},
+ XcmGenericBenchmarks: generic::{Pallet},
+ }
+);
+
+pub struct AccountIdConverter;
+impl xcm_executor::traits::Convert for AccountIdConverter {
+ fn convert(ml: MultiLocation) -> Result {
+ match ml {
+ MultiLocation {
+ parents: 0,
+ interior: X1(Junction::AccountId32 { id, .. }),
+ } => Ok(::decode(&mut &*id.to_vec()).unwrap()),
+ _ => Err(ml),
+ }
+ }
+
+ fn reverse(acc: u64) -> Result {
+ Err(acc)
+ }
+}
+
+// An xcm sender/receiver akin to > /dev/null
+pub struct DevNull;
+impl SendXcm for DevNull {
+ type Ticket = ();
+
+ fn validate(
+ _destination: &mut Option,
+ _message: &mut Option,
+ ) -> SendResult {
+ Ok(((), MultiAssets::new()))
+ }
+
+ fn deliver(_: Self::Ticket) -> Result {
+ Ok(XcmHash::default())
+ }
+}
+
+impl xcm_executor::traits::OnResponse for DevNull {
+ fn expecting_response(_: &MultiLocation, _: u64, _: Option<&MultiLocation>) -> bool {
+ false
+ }
+ fn on_response(
+ _: &MultiLocation,
+ _: u64,
+ _: Option<&MultiLocation>,
+ _: Response,
+ _: Weight,
+ _: &XcmContext,
+ ) -> Weight {
+ Weight::zero()
+ }
+}
+
+parameter_types! {
+ pub const BlockHashCount: u64 = 250;
+ pub BlockWeights: frame_system::limits::BlockWeights =
+ frame_system::limits::BlockWeights::simple_max(Weight::from_parts(1024, u64::MAX));
+ pub UniversalLocation: InteriorMultiLocation = Here;
+}
+impl frame_system::Config for Test {
+ type BaseCallFilter = Everything;
+ type BlockWeights = ();
+ type BlockLength = ();
+ type DbWeight = ();
+ type RuntimeOrigin = RuntimeOrigin;
+ type Index = u64;
+ type BlockNumber = u64;
+ type Hash = H256;
+ type RuntimeCall = RuntimeCall;
+ type Hashing = BlakeTwo256;
+ type AccountId = AccountId;
+ type Lookup = IdentityLookup;
+ type Header = Header;
+ type RuntimeEvent = RuntimeEvent;
+ type BlockHashCount = BlockHashCount;
+ type Version = ();
+ type PalletInfo = PalletInfo;
+ type AccountData = pallet_balances::AccountData;
+ type OnNewAccount = ();
+ type OnKilledAccount = ();
+ type SystemWeightInfo = ();
+ type SS58Prefix = ();
+ type OnSetCode = ();
+ type MaxConsumers = ConstU32<16>;
+}
+
+parameter_types! {
+ pub const ExistentialDeposit: u64 = 10;
+}
+
+impl pallet_balances::Config for Test {
+ type MaxLocks = ();
+ type MaxReserves = ();
+ type ReserveIdentifier = [u8; 8];
+ type Balance = Balance;
+ type DustRemoval = ();
+ type RuntimeEvent = RuntimeEvent;
+ type ExistentialDeposit = ExistentialDeposit;
+ type AccountStore = System;
+ type WeightInfo = ();
+ type HoldIdentifier = ();
+ type FreezeIdentifier = ();
+ type MaxHolds = ConstU32<0>;
+ type MaxFreezes = ConstU32<0>;
+}
+
+impl pallet_assets::Config for Test {
+ type RuntimeEvent = RuntimeEvent;
+ type Balance = Balance;
+ type AssetId = AssetId;
+ type AssetIdParameter = AssetId;
+ type Currency = Balances;
+ type CreateOrigin = AsEnsureOriginWithArg>;
+ type ForceOrigin = EnsureRoot;
+ type AssetDeposit = ConstU64<10>;
+ type MetadataDepositBase = ConstU64<10>;
+ type MetadataDepositPerByte = ConstU64<1>;
+ type AssetAccountDeposit = ConstU64<10>;
+ type ApprovalDeposit = ConstU64<10>;
+ type StringLimit = ConstU32<50>;
+ type Freezer = ();
+ type Extra = ();
+ type RemoveItemsLimit = ConstU32<100>;
+ type CallbackHandle = ();
+ type WeightInfo = ();
+ #[cfg(feature = "runtime-benchmarks")]
+ type BenchmarkHelper = ();
+}
+
+pub struct MatchOnlyAsset(PhantomData);
+impl> xcm_executor::traits::MatchesFungibles
+ for MatchOnlyAsset
+{
+ fn matches_fungibles(
+ a: &MultiAsset,
+ ) -> core::result::Result<(AssetId, Balance), xcm_executor::traits::prelude::Error> {
+ use sp_runtime::traits::SaturatedConversion;
+ match a {
+ MultiAsset {
+ fun: Fungible(amount),
+ ..
+ } => Ok((Asset::get(), (*amount).saturated_into::())),
+ _ => Err(xcm_executor::traits::prelude::Error::AssetNotHandled),
+ }
+ }
+}
+
+parameter_types! {
+ pub const DummyCheckingAccount: AccountId = 0;
+
+ // AssetId used as a fungible for benchmarks
+ pub const TransactAssetId: u128 = 1;
+ pub const TransactAssetLocation: MultiLocation = MultiLocation { parents: 0, interior: X1(GeneralIndex(TransactAssetId::get())) };
+}
+
+// Use ONLY assets as the asset transactor.
+pub type AssetTransactor = FungiblesAdapter<
+ Assets,
+ MatchOnlyAsset,
+ AccountIdConverter,
+ AccountId,
+ NoChecking,
+ DummyCheckingAccount,
+>;
+
+parameter_types! {
+ /// Maximum number of instructions in a single XCM fragment. A sanity check against weight
+ /// calculations getting too crazy.
+ pub const MaxInstructions: u32 = 100;
+ pub const MaxAssetsIntoHolding: u32 = 64;
+
+ pub const WeightPrice: (xcm::latest::AssetId, u128, u128) = (Concrete(TransactAssetLocation::get()), 1_000_000, 1024);
+ pub const UnitWeightCost: u64 = 10;
+}
+
+pub struct XcmConfig;
+impl xcm_executor::Config for XcmConfig {
+ type RuntimeCall = RuntimeCall;
+ type XcmSender = DevNull;
+ type AssetTransactor = AssetTransactor;
+ type OriginConverter = ();
+ type IsReserve = ReserveAssetFilter;
+ type IsTeleporter = ();
+ type UniversalLocation = UniversalLocation;
+ type Barrier = AllowUnpaidExecutionFrom;
+ type Weigher = xcm_builder::FixedWeightBounds;
+ type Trader = xcm_builder::FixedRateOfFungible;
+ type ResponseHandler = DevNull;
+ type AssetTrap = ();
+ type AssetLocker = ();
+ type AssetExchanger = ();
+ type AssetClaims = ();
+ type SubscriptionService = ();
+ type PalletInstancesInfo = AllPalletsWithSystem;
+ type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
+ type FeeManager = ();
+ type MessageExporter = ();
+ type UniversalAliases = Nothing;
+ type CallDispatcher = RuntimeCall;
+ type SafeCallFilter = Everything;
+}
+
+impl pallet_xcm_benchmarks::Config for Test {
+ type XcmConfig = XcmConfig;
+ type AccountIdConverter = AccountIdConverter;
+ fn valid_destination() -> Result {
+ let valid_destination: MultiLocation = X1(AccountId32 {
+ network: None,
+ id: [0u8; 32],
+ })
+ .into();
+
+ Ok(valid_destination)
+ }
+ fn worst_case_holding(_depositable_count: u32) -> MultiAssets {
+ let assets: Vec = vec![MultiAsset {
+ id: Concrete(MultiLocation::parent()),
+ fun: Fungible(u128::MAX),
+ }];
+ assets.into()
+ }
+}
+
+impl pallet_xcm_benchmarks::generic::Config for Test {
+ type RuntimeCall = RuntimeCall;
+
+ fn worst_case_response() -> (u64, Response) {
+ let assets: MultiAssets = (Concrete(Here.into()), 100).into();
+ (0, Response::Assets(assets))
+ }
+
+ fn worst_case_asset_exchange() -> Result<(MultiAssets, MultiAssets), BenchmarkError> {
+ Err(BenchmarkError::Skip)
+ }
+
+ fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> {
+ Err(BenchmarkError::Skip)
+ }
+
+ fn export_message_origin_and_destination(
+ ) -> Result<(MultiLocation, NetworkId, Junctions), BenchmarkError> {
+ Err(BenchmarkError::Skip)
+ }
+
+ fn transact_origin_and_runtime_call() -> Result<(MultiLocation, RuntimeCall), BenchmarkError> {
+ Ok((
+ Default::default(),
+ frame_system::Call::remark_with_event { remark: vec![] }.into(),
+ ))
+ }
+
+ fn subscribe_origin() -> Result {
+ Ok(Default::default())
+ }
+
+ fn claimable_asset() -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
+ let assets: MultiAssets = (Concrete(Here.into()), 100).into();
+ let ticket = MultiLocation {
+ parents: 0,
+ interior: X1(GeneralIndex(0)),
+ };
+ Ok((Default::default(), ticket, assets))
+ }
+
+ fn unlockable_asset() -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
+ Err(BenchmarkError::Skip)
+ }
+}
+
+parameter_types! {
+ pub const CheckingAccount: Option<(u64, MintLocation)> = None;
+ pub const TrustedTeleporter: Option<(MultiLocation, MultiAsset)> = None;
+}
+
+impl pallet_xcm_benchmarks::fungible::Config for Test {
+ type TransactAsset = ItemOf;
+ type CheckedAccount = CheckingAccount;
+ type TrustedTeleporter = TrustedTeleporter;
+
+ fn get_multi_asset() -> MultiAsset {
+ let min_balance = 100u64;
+ let asset_location: MultiLocation = GeneralIndex(TransactAssetId::get()).into();
+
+ assert_ok!(Assets::force_create(
+ RuntimeOrigin::root(),
+ TransactAssetId::get(),
+ 0u64,
+ true,
+ min_balance,
+ ));
+
+ MultiAsset {
+ id: Concrete(asset_location),
+ fun: Fungible((min_balance * 100).into()),
+ }
+ }
+}
+
+parameter_types! {
+ pub TrustedReserveLocation: MultiLocation = Parent.into();
+ pub TrustedReserveAsset: MultiAsset = MultiAsset { id: Concrete(TrustedReserveLocation::get()), fun: Fungible(1_000_000) };
+ pub TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((TrustedReserveLocation::get(), TrustedReserveAsset::get()));
+}
+
+impl fungible::Config for Test {
+ type TrustedReserve = TrustedReserve;
+}
+
+impl generic::Config for Test {}
+impl Config for Test {}
+
+#[cfg(feature = "runtime-benchmarks")]
+pub fn new_test_ext() -> sp_io::TestExternalities {
+ use sp_runtime::BuildStorage;
+ let t = GenesisConfig {
+ ..Default::default()
+ }
+ .build_storage()
+ .unwrap();
+ t.into()
+}
diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml
index 0cbe00078a..8cac9bf8aa 100644
--- a/primitives/Cargo.toml
+++ b/primitives/Cargo.toml
@@ -20,6 +20,7 @@ fp-evm = { workspace = true }
# Substrate dependencies
frame-support = { workspace = true }
+frame-system = { workspace = true }
pallet-assets = { workspace = true }
sp-arithmetic = { workspace = true }
sp-core = { workspace = true }
@@ -53,6 +54,7 @@ std = [
"ethereum/std",
"fp-evm/std",
"frame-support/std",
+ "frame-system/std",
"sp-std/std",
"sp-runtime/std",
"sp-core/std",
diff --git a/primitives/src/benchmarks.rs b/primitives/src/benchmarks.rs
index f0cfa392df..c06d6da29d 100644
--- a/primitives/src/benchmarks.rs
+++ b/primitives/src/benchmarks.rs
@@ -16,11 +16,16 @@
// You should have received a copy of the GNU General Public License
// along with Astar. If not, see .
-use crate::AssetId;
-
-#[cfg(feature = "runtime-benchmarks")]
+use crate::{xcm::MAX_ASSETS, Address, AssetId};
+use core::marker::PhantomData;
+use frame_support::{assert_ok, dispatch::RawOrigin, traits::IsType};
+use sp_runtime::traits::StaticLookup;
+use sp_std::{boxed::Box, vec::Vec};
+use xcm::prelude::*;
/// Benchmark helper for `pallet-assets`.
pub struct AssetsBenchmarkHelper;
+
+#[cfg(feature = "runtime-benchmarks")]
impl> pallet_assets::BenchmarkHelper
for AssetsBenchmarkHelper
{
@@ -28,3 +33,69 @@ impl> pallet_assets::BenchmarkHelper(PhantomData);
+impl XcmBenchmarkHelper
+where
+ T: pallet_assets::Config + pallet_xc_asset_config::Config,
+ ::AssetIdParameter: From,
+ ::Balance: IsType,
+ ::AssetId: IsType,
+ <::Lookup as StaticLookup>::Source: IsType,
+{
+ /// Get the worst case holding for xcm benchmarks
+ /// Scenario: Max allowed fungible assets (pallet_assets)
+ pub fn worst_case_holding() -> MultiAssets {
+ let fungibles = MAX_ASSETS - 1;
+ let fungibles_amount: u128 = 100_000;
+ let assets = (0..fungibles)
+ .map(|i| MultiAsset {
+ id: Concrete(GeneralIndex(i as u128).into()),
+ fun: Fungible(fungibles_amount * i as u128),
+ })
+ // adding relay asset as it is used in buy execution benchmarks
+ .chain(core::iter::once(MultiAsset {
+ id: Concrete(MultiLocation::parent()),
+ fun: Fungible(u128::MAX),
+ }))
+ .collect::>();
+
+ // register the assets
+ for (i, asset) in assets.iter().enumerate() {
+ if let MultiAsset {
+ id: Concrete(location),
+ fun: Fungible(_),
+ } = asset
+ {
+ // create the asset
+ assert_ok!(pallet_assets::Pallet::::force_create(
+ RawOrigin::Root.into(),
+ (i as u128).into(),
+ // min balance, no significane in holding
+ Address::Id([0u8; 32].into()).into(),
+ true,
+ // min balance, no significane in holding
+ 1u128.into()
+ ));
+
+ // register asset in XcAssetConfig
+ assert_ok!(
+ pallet_xc_asset_config::Pallet::::register_asset_location(
+ RawOrigin::Root.into(),
+ Box::new(location.clone().into_versioned()),
+ (i as u128).into(),
+ )
+ );
+ assert_ok!(
+ pallet_xc_asset_config::Pallet::::set_asset_units_per_second(
+ RawOrigin::Root.into(),
+ Box::new(location.clone().into_versioned()),
+ 1_000_000_000_000u128,
+ )
+ );
+ }
+ }
+
+ assets.into()
+ }
+}
diff --git a/primitives/src/xcm/mod.rs b/primitives/src/xcm/mod.rs
index a0945c7532..85cdb740b9 100644
--- a/primitives/src/xcm/mod.rs
+++ b/primitives/src/xcm/mod.rs
@@ -53,6 +53,7 @@ use pallet_xc_asset_config::{ExecutionPaymentRate, XcAssetLocation};
mod tests;
pub const XCM_SIZE_LIMIT: u32 = 2u32.pow(16);
+pub const MAX_ASSETS: u32 = 64;
/// Used to convert between cross-chain asset multilocation and local asset Id.
///
diff --git a/runtime/shibuya/Cargo.toml b/runtime/shibuya/Cargo.toml
index dd7e2770ce..1996fab9fa 100644
--- a/runtime/shibuya/Cargo.toml
+++ b/runtime/shibuya/Cargo.toml
@@ -97,6 +97,7 @@ orml-xtokens = { workspace = true }
# Astar pallets
astar-primitives = { workspace = true }
+astar-xcm-benchmarks = { workspace = true, optional = true }
pallet-chain-extension-unified-accounts = { workspace = true }
pallet-chain-extension-xvm = { workspace = true }
pallet-collator-selection = { workspace = true }
@@ -117,6 +118,7 @@ pallet-static-price-provider = { workspace = true }
pallet-unified-accounts = { workspace = true }
pallet-xc-asset-config = { workspace = true }
pallet-xcm = { workspace = true }
+pallet-xcm-benchmarks = { workspace = true, optional = true }
pallet-xvm = { workspace = true }
dapp-staking-v3-runtime-api = { workspace = true }
@@ -247,6 +249,8 @@ std = [
"astar-primitives/std",
]
runtime-benchmarks = [
+ "astar-xcm-benchmarks/runtime-benchmarks",
+ "pallet-xcm-benchmarks/runtime-benchmarks",
"frame-benchmarking",
"frame-support/runtime-benchmarks",
"frame-system-benchmarking/runtime-benchmarks",
diff --git a/runtime/shibuya/src/lib.rs b/runtime/shibuya/src/lib.rs
index 0955c63642..ea2bdb3f55 100644
--- a/runtime/shibuya/src/lib.rs
+++ b/runtime/shibuya/src/lib.rs
@@ -1474,6 +1474,8 @@ mod benches {
[pallet_xvm, Xvm]
[pallet_dynamic_evm_base_fee, DynamicEvmBaseFee]
[pallet_unified_accounts, UnifiedAccounts]
+ [xcm_benchmarks_generic, XcmGeneric]
+ [xcm_benchmarks_fungible, XcmFungible]
);
}
@@ -1964,6 +1966,12 @@ impl_runtime_apis! {
use frame_system_benchmarking::Pallet as SystemBench;
use baseline::Pallet as BaselineBench;
+ // This is defined once again in dispatch_benchmark, because list_benchmarks!
+ // and add_benchmarks! are macros exported by define_benchmarks! macros and those types
+ // are referenced in that call.
+ type XcmFungible = astar_xcm_benchmarks::fungible::benchmarking::XcmFungibleBenchmarks::;
+ type XcmGeneric = astar_xcm_benchmarks::generic::benchmarking::XcmGenericBenchmarks::;
+
let mut list = Vec::::new();
list_benchmarks!(list, extra);
@@ -1975,14 +1983,122 @@ impl_runtime_apis! {
fn dispatch_benchmark(
config: frame_benchmarking::BenchmarkConfig
) -> Result, sp_runtime::RuntimeString> {
- use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey};
+ use frame_benchmarking::{baseline, Benchmarking, BenchmarkBatch, TrackedStorageKey, BenchmarkError};
use frame_system_benchmarking::Pallet as SystemBench;
+ use frame_support::{traits::{WhitelistedStorageKeys, tokens::fungible::{ItemOf}}, assert_ok};
use baseline::Pallet as BaselineBench;
-
+ use xcm::latest::prelude::*;
+ use xcm_builder::MintLocation;
+ use astar_primitives::benchmarks::XcmBenchmarkHelper;
impl frame_system_benchmarking::Config for Runtime {}
impl baseline::Config for Runtime {}
- use frame_support::traits::WhitelistedStorageKeys;
+ // XCM Benchmarks
+ impl astar_xcm_benchmarks::Config for Runtime {}
+ impl astar_xcm_benchmarks::generic::Config for Runtime {}
+ impl astar_xcm_benchmarks::fungible::Config for Runtime {
+ type TrustedReserve = TrustedReserve;
+ }
+
+ impl pallet_xcm_benchmarks::Config for Runtime {
+ type XcmConfig = xcm_config::XcmConfig;
+ type AccountIdConverter = xcm_config::LocationToAccountId;
+ // destination location to be used in benchmarks
+ fn valid_destination() -> Result {
+ Ok(MultiLocation::parent())
+ }
+ fn worst_case_holding(_depositable_count: u32) -> MultiAssets {
+ XcmBenchmarkHelper::::worst_case_holding()
+ }
+ }
+
+ impl pallet_xcm_benchmarks::generic::Config for Runtime {
+ type RuntimeCall = RuntimeCall;
+ fn worst_case_response() -> (u64, Response) {
+ (0u64, Response::Version(Default::default()))
+ }
+ fn worst_case_asset_exchange()
+ -> Result<(MultiAssets, MultiAssets), BenchmarkError> {
+ Err(BenchmarkError::Skip)
+ }
+
+ fn universal_alias() -> Result<(MultiLocation, Junction), BenchmarkError> {
+ Err(BenchmarkError::Skip)
+ }
+ fn transact_origin_and_runtime_call()
+ -> Result<(MultiLocation, RuntimeCall), BenchmarkError> {
+ Ok((MultiLocation::parent(), frame_system::Call::remark_with_event {
+ remark: vec![]
+ }.into()))
+ }
+ fn subscribe_origin() -> Result {
+ Ok(MultiLocation::parent())
+ }
+ fn claimable_asset()
+ -> Result<(MultiLocation, MultiLocation, MultiAssets), BenchmarkError> {
+ let origin = MultiLocation::parent();
+ let assets: MultiAssets = (Concrete(MultiLocation::parent()), 1_000u128)
+ .into();
+ let ticket = MultiLocation { parents: 0, interior: Here };
+ Ok((origin, ticket, assets))
+ }
+ fn unlockable_asset()
+ -> Result<(MultiLocation, MultiLocation, MultiAsset), BenchmarkError> {
+ Err(BenchmarkError::Skip)
+ }
+ fn export_message_origin_and_destination(
+ ) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
+ Err(BenchmarkError::Skip)
+ }
+ }
+
+ parameter_types! {
+ pub const NoCheckingAccount: Option<(AccountId, MintLocation)> = None;
+ pub const NoTeleporter: Option<(MultiLocation, MultiAsset)> = None;
+ pub const TransactAssetId: u128 = 1001;
+ pub const TransactAssetLocation: MultiLocation = MultiLocation { parents: 0, interior: X1(GeneralIndex(TransactAssetId::get())) };
+
+ pub TrustedReserveLocation: MultiLocation = Parent.into();
+ pub TrustedReserveAsset: MultiAsset = MultiAsset { id: Concrete(TrustedReserveLocation::get()), fun: Fungible(1_000_000) };
+ pub TrustedReserve: Option<(MultiLocation, MultiAsset)> = Some((TrustedReserveLocation::get(), TrustedReserveAsset::get()));
+ }
+
+ impl pallet_xcm_benchmarks::fungible::Config for Runtime {
+ type TransactAsset = ItemOf;
+ type CheckedAccount = NoCheckingAccount;
+ type TrustedTeleporter = NoTeleporter;
+
+ fn get_multi_asset() -> MultiAsset {
+ let min_balance = 100u128;
+ // create the transact asset and make it sufficient
+ assert_ok!(Assets::force_create(
+ RuntimeOrigin::root(),
+ TransactAssetId::get().into(),
+ Address::Id([0u8; 32].into()),
+ true,
+ // min balance
+ min_balance
+ ));
+
+ // convert mapping for asset id
+ assert_ok!(
+ XcAssetConfig::register_asset_location(
+ RuntimeOrigin::root(),
+ Box::new(TransactAssetLocation::get().into_versioned()),
+ TransactAssetId::get(),
+ )
+ );
+
+ MultiAsset {
+ id: Concrete(TransactAssetLocation::get()),
+ fun: Fungible(min_balance * 100),
+ }
+ }
+ }
+
+ type XcmFungible = astar_xcm_benchmarks::fungible::benchmarking::XcmFungibleBenchmarks::;
+ type XcmGeneric = astar_xcm_benchmarks::generic::benchmarking::XcmGenericBenchmarks::;
+
let whitelist: Vec = AllPalletsWithSystem::whitelisted_storage_keys();
let mut batches = Vec::::new();
diff --git a/runtime/shibuya/src/weights/mod.rs b/runtime/shibuya/src/weights/mod.rs
index b49f1c1a29..11722c07a3 100644
--- a/runtime/shibuya/src/weights/mod.rs
+++ b/runtime/shibuya/src/weights/mod.rs
@@ -22,3 +22,4 @@ pub mod pallet_dapp_staking_migration;
pub mod pallet_dapp_staking_v3;
pub mod pallet_inflation;
pub mod pallet_xcm;
+pub mod xcm;
diff --git a/runtime/shibuya/src/weights/xcm/fungible.rs b/runtime/shibuya/src/weights/xcm/fungible.rs
new file mode 100644
index 0000000000..68c7acc306
--- /dev/null
+++ b/runtime/shibuya/src/weights/xcm/fungible.rs
@@ -0,0 +1,200 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+//! Autogenerated weights for xcm_benchmarks_fungible
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2024-01-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024
+
+// Executed Command:
+// ./target/release/astar-collator
+// benchmark
+// pallet
+// --chain=shibuya-dev
+// --steps=50
+// --repeat=20
+// --pallet=xcm_benchmarks_fungible
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --output=./benchmark-results/shibuya-dev/benchmarks_fungible_weights.rs
+// --template=./scripts/templates/weight-template.hbs
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use core::marker::PhantomData;
+
+/// Weight functions needed for xcm_benchmarks_fungible.
+pub trait WeightInfo {
+ fn transfer_asset() -> Weight;
+ fn transfer_reserve_asset() -> Weight;
+ fn reserve_asset_deposited() -> Weight;
+ fn receive_teleported_asset() -> Weight;
+ fn initiate_teleport() -> Weight;
+ fn withdraw_asset() -> Weight;
+ fn deposit_asset() -> Weight;
+ fn deposit_reserve_asset() -> Weight;
+}
+
+/// Weights for xcm_benchmarks_fungible using the Substrate node and recommended hardware.
+pub struct SubstrateWeight(PhantomData);
+impl WeightInfo for SubstrateWeight {
+ /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0)
+ /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Assets Asset (r:1 w:1)
+ /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen)
+ /// Storage: Assets Account (r:2 w:2)
+ /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:1)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ fn transfer_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `545`
+ // Estimated: `6232`
+ // Minimum execution time: 49_562_000 picoseconds.
+ Weight::from_parts(50_040_000, 6232)
+ .saturating_add(T::DbWeight::get().reads(5_u64))
+ .saturating_add(T::DbWeight::get().writes(4_u64))
+ }
+ /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0)
+ /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Assets Asset (r:1 w:1)
+ /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen)
+ /// Storage: Assets Account (r:2 w:2)
+ /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:1)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem HostConfiguration (r:1 w:0)
+ /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
+ /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
+ fn transfer_reserve_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `721`
+ // Estimated: `6232`
+ // Minimum execution time: 72_571_000 picoseconds.
+ Weight::from_parts(73_202_000, 6232)
+ .saturating_add(T::DbWeight::get().reads(11_u64))
+ .saturating_add(T::DbWeight::get().writes(6_u64))
+ }
+ fn reserve_asset_deposited() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 3_430_000 picoseconds.
+ Weight::from_parts(3_566_000, 0)
+ }
+ /// Storage: Benchmark Override (r:0 w:0)
+ /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured)
+ fn receive_teleported_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
+ Weight::from_parts(18_446_744_073_709_551_000, 0)
+ }
+ /// Storage: Benchmark Override (r:0 w:0)
+ /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured)
+ fn initiate_teleport() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
+ Weight::from_parts(18_446_744_073_709_551_000, 0)
+ }
+ /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0)
+ /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Assets Asset (r:1 w:1)
+ /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen)
+ /// Storage: Assets Account (r:1 w:1)
+ /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:1)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ /// Storage: UnifiedAccounts NativeToEvm (r:1 w:0)
+ /// Proof: UnifiedAccounts NativeToEvm (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen)
+ fn withdraw_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `1960`
+ // Estimated: `5425`
+ // Minimum execution time: 57_091_000 picoseconds.
+ Weight::from_parts(57_836_000, 5425)
+ .saturating_add(T::DbWeight::get().reads(5_u64))
+ .saturating_add(T::DbWeight::get().writes(3_u64))
+ }
+ /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0)
+ /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Assets Asset (r:1 w:1)
+ /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen)
+ /// Storage: Assets Account (r:1 w:1)
+ /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:1)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ fn deposit_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `1696`
+ // Estimated: `5161`
+ // Minimum execution time: 45_650_000 picoseconds.
+ Weight::from_parts(46_029_000, 5161)
+ .saturating_add(T::DbWeight::get().reads(4_u64))
+ .saturating_add(T::DbWeight::get().writes(3_u64))
+ }
+ /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0)
+ /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Assets Asset (r:1 w:1)
+ /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen)
+ /// Storage: Assets Account (r:1 w:1)
+ /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:1)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem HostConfiguration (r:1 w:0)
+ /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
+ /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
+ fn deposit_reserve_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `1872`
+ // Estimated: `5337`
+ // Minimum execution time: 71_400_000 picoseconds.
+ Weight::from_parts(72_038_000, 5337)
+ .saturating_add(T::DbWeight::get().reads(10_u64))
+ .saturating_add(T::DbWeight::get().writes(5_u64))
+ }
+}
diff --git a/runtime/shibuya/src/weights/xcm/generic.rs b/runtime/shibuya/src/weights/xcm/generic.rs
new file mode 100644
index 0000000000..9903bcdec2
--- /dev/null
+++ b/runtime/shibuya/src/weights/xcm/generic.rs
@@ -0,0 +1,464 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+//! Autogenerated weights for xcm_benchmarks_generic
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2024-01-13, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! HOSTNAME: `gh-runner-01-ovh`, CPU: `Intel(R) Xeon(R) E-2236 CPU @ 3.40GHz`
+//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("shibuya-dev"), DB CACHE: 1024
+
+// Executed Command:
+// ./target/release/astar-collator
+// benchmark
+// pallet
+// --chain=shibuya-dev
+// --steps=50
+// --repeat=20
+// --pallet=xcm_benchmarks_generic
+// --extrinsic=*
+// --execution=wasm
+// --wasm-execution=compiled
+// --heap-pages=4096
+// --output=./benchmark-results/shibuya-dev/benchmarks_generic_weights.rs
+// --template=./scripts/templates/weight-template.hbs
+
+#![cfg_attr(rustfmt, rustfmt_skip)]
+#![allow(unused_parens)]
+#![allow(unused_imports)]
+
+use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
+use core::marker::PhantomData;
+
+/// Weight functions needed for xcm_benchmarks_generic.
+pub trait WeightInfo {
+ fn buy_execution() -> Weight;
+ fn expect_pallet() -> Weight;
+ fn exchange_asset() -> Weight;
+ fn export_message() -> Weight;
+ fn lock_asset() -> Weight;
+ fn unlock_asset() -> Weight;
+ fn note_unlockable() -> Weight;
+ fn request_unlock() -> Weight;
+ fn universal_origin() -> Weight;
+ fn report_holding() -> Weight;
+ fn query_response() -> Weight;
+ fn transact() -> Weight;
+ fn refund_surplus() -> Weight;
+ fn set_error_handler() -> Weight;
+ fn set_appendix() -> Weight;
+ fn clear_error() -> Weight;
+ fn descend_origin() -> Weight;
+ fn clear_origin() -> Weight;
+ fn report_error() -> Weight;
+ fn claim_asset() -> Weight;
+ fn trap() -> Weight;
+ fn subscribe_version() -> Weight;
+ fn unsubscribe_version() -> Weight;
+ fn initiate_reserve_withdraw() -> Weight;
+ fn burn_asset() -> Weight;
+ fn expect_asset() -> Weight;
+ fn expect_origin() -> Weight;
+ fn expect_error() -> Weight;
+ fn expect_transact_status() -> Weight;
+ fn query_pallet() -> Weight;
+ fn report_transact_status() -> Weight;
+ fn clear_transact_status() -> Weight;
+ fn set_topic() -> Weight;
+ fn clear_topic() -> Weight;
+ fn set_fees_mode() -> Weight;
+ fn unpaid_execution() -> Weight;
+}
+
+/// Weights for xcm_benchmarks_generic using the Substrate node and recommended hardware.
+pub struct SubstrateWeight(PhantomData);
+impl WeightInfo for SubstrateWeight {
+ /// Storage: XcAssetConfig AssetLocationUnitsPerSecond (r:1 w:0)
+ /// Proof Skipped: XcAssetConfig AssetLocationUnitsPerSecond (max_values: None, max_size: None, mode: Measured)
+ /// Storage: XcAssetConfig AssetLocationToId (r:1 w:0)
+ /// Proof Skipped: XcAssetConfig AssetLocationToId (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Assets Asset (r:1 w:1)
+ /// Proof: Assets Asset (max_values: None, max_size: Some(222), added: 2697, mode: MaxEncodedLen)
+ /// Storage: Assets Account (r:1 w:1)
+ /// Proof: Assets Account (max_values: None, max_size: Some(146), added: 2621, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:1)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ fn buy_execution() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `2468`
+ // Estimated: `5933`
+ // Minimum execution time: 110_783_000 picoseconds.
+ Weight::from_parts(115_074_000, 5933)
+ .saturating_add(T::DbWeight::get().reads(5_u64))
+ .saturating_add(T::DbWeight::get().writes(3_u64))
+ }
+ fn expect_pallet() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 7_111_000 picoseconds.
+ Weight::from_parts(7_262_000, 0)
+ }
+ /// Storage: Benchmark Override (r:0 w:0)
+ /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured)
+ fn exchange_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
+ Weight::from_parts(18_446_744_073_709_551_000, 0)
+ }
+ /// Storage: Benchmark Override (r:0 w:0)
+ /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured)
+ fn export_message() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
+ Weight::from_parts(18_446_744_073_709_551_000, 0)
+ }
+ /// Storage: Benchmark Override (r:0 w:0)
+ /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured)
+ fn lock_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
+ Weight::from_parts(18_446_744_073_709_551_000, 0)
+ }
+ /// Storage: Benchmark Override (r:0 w:0)
+ /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured)
+ fn unlock_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
+ Weight::from_parts(18_446_744_073_709_551_000, 0)
+ }
+ /// Storage: Benchmark Override (r:0 w:0)
+ /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured)
+ fn note_unlockable() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
+ Weight::from_parts(18_446_744_073_709_551_000, 0)
+ }
+ /// Storage: Benchmark Override (r:0 w:0)
+ /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured)
+ fn request_unlock() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 18_446_744_073_709_551_000 picoseconds.
+ Weight::from_parts(18_446_744_073_709_551_000, 0)
+ }
+ /// Storage: Benchmark Override (r:0 w:0)
+ /// Proof Skipped: Benchmark Override (max_values: None, max_size: None, mode: Measured)
+ fn universal_origin() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `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)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem HostConfiguration (r:1 w:0)
+ /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
+ /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
+ fn report_holding() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `176`
+ // Estimated: `3641`
+ // Minimum execution time: 356_141_000 picoseconds.
+ Weight::from_parts(360_928_000, 3641)
+ .saturating_add(T::DbWeight::get().reads(6_u64))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
+ }
+ /// Storage: PolkadotXcm Queries (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm Queries (max_values: None, max_size: None, mode: Measured)
+ fn query_response() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `31`
+ // Estimated: `3496`
+ // Minimum execution time: 10_476_000 picoseconds.
+ Weight::from_parts(10_697_000, 3496)
+ .saturating_add(T::DbWeight::get().reads(1_u64))
+ }
+ fn transact() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 12_040_000 picoseconds.
+ Weight::from_parts(12_275_000, 0)
+ }
+ fn refund_surplus() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 4_820_000 picoseconds.
+ Weight::from_parts(5_004_000, 0)
+ }
+ fn set_error_handler() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_559_000 picoseconds.
+ Weight::from_parts(2_752_000, 0)
+ }
+ fn set_appendix() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_501_000 picoseconds.
+ Weight::from_parts(2_661_000, 0)
+ }
+ fn clear_error() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_479_000 picoseconds.
+ Weight::from_parts(2_585_000, 0)
+ }
+ fn descend_origin() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 3_282_000 picoseconds.
+ Weight::from_parts(3_470_000, 0)
+ }
+ fn clear_origin() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_555_000 picoseconds.
+ Weight::from_parts(2_710_000, 0)
+ }
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem HostConfiguration (r:1 w:0)
+ /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
+ /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
+ fn report_error() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `176`
+ // Estimated: `3641`
+ // Minimum execution time: 25_651_000 picoseconds.
+ Weight::from_parts(26_142_000, 3641)
+ .saturating_add(T::DbWeight::get().reads(6_u64))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
+ }
+ /// Storage: PolkadotXcm AssetTraps (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm AssetTraps (max_values: None, max_size: None, mode: Measured)
+ fn claim_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `88`
+ // Estimated: `3553`
+ // Minimum execution time: 14_628_000 picoseconds.
+ Weight::from_parts(14_982_000, 3553)
+ .saturating_add(T::DbWeight::get().reads(1_u64))
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+ fn trap() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_594_000 picoseconds.
+ Weight::from_parts(2_702_000, 0)
+ }
+ /// Storage: PolkadotXcm VersionNotifyTargets (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem HostConfiguration (r:1 w:0)
+ /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
+ /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
+ fn subscribe_version() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `73`
+ // Estimated: `3538`
+ // Minimum execution time: 26_759_000 picoseconds.
+ Weight::from_parts(27_033_000, 3538)
+ .saturating_add(T::DbWeight::get().reads(6_u64))
+ .saturating_add(T::DbWeight::get().writes(3_u64))
+ }
+ /// Storage: PolkadotXcm VersionNotifyTargets (r:0 w:1)
+ /// Proof Skipped: PolkadotXcm VersionNotifyTargets (max_values: None, max_size: None, mode: Measured)
+ fn unsubscribe_version() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 4_755_000 picoseconds.
+ Weight::from_parts(4_895_000, 0)
+ .saturating_add(T::DbWeight::get().writes(1_u64))
+ }
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem HostConfiguration (r:1 w:0)
+ /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
+ /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
+ fn initiate_reserve_withdraw() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `176`
+ // Estimated: `3641`
+ // Minimum execution time: 416_383_000 picoseconds.
+ Weight::from_parts(421_855_000, 3641)
+ .saturating_add(T::DbWeight::get().reads(6_u64))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
+ }
+ fn burn_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 124_786_000 picoseconds.
+ Weight::from_parts(128_000_000, 0)
+ }
+ fn expect_asset() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 10_947_000 picoseconds.
+ Weight::from_parts(11_467_000, 0)
+ }
+ fn expect_origin() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_641_000 picoseconds.
+ Weight::from_parts(2_713_000, 0)
+ }
+ fn expect_error() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_569_000 picoseconds.
+ Weight::from_parts(2_665_000, 0)
+ }
+ fn expect_transact_status() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_785_000 picoseconds.
+ Weight::from_parts(2_864_000, 0)
+ }
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem HostConfiguration (r:1 w:0)
+ /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
+ /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
+ fn query_pallet() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `176`
+ // Estimated: `3641`
+ // Minimum execution time: 30_487_000 picoseconds.
+ Weight::from_parts(31_068_000, 3641)
+ .saturating_add(T::DbWeight::get().reads(6_u64))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
+ }
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem HostConfiguration (r:1 w:0)
+ /// Proof Skipped: ParachainSystem HostConfiguration (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem PendingUpwardMessages (r:1 w:1)
+ /// Proof Skipped: ParachainSystem PendingUpwardMessages (max_values: Some(1), max_size: None, mode: Measured)
+ fn report_transact_status() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `176`
+ // Estimated: `3641`
+ // Minimum execution time: 24_913_000 picoseconds.
+ Weight::from_parts(25_550_000, 3641)
+ .saturating_add(T::DbWeight::get().reads(6_u64))
+ .saturating_add(T::DbWeight::get().writes(2_u64))
+ }
+ fn clear_transact_status() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_530_000 picoseconds.
+ Weight::from_parts(2_617_000, 0)
+ }
+ fn set_topic() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_489_000 picoseconds.
+ Weight::from_parts(2_599_000, 0)
+ }
+ fn clear_topic() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_508_000 picoseconds.
+ Weight::from_parts(2_610_000, 0)
+ }
+ fn set_fees_mode() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_482_000 picoseconds.
+ Weight::from_parts(2_592_000, 0)
+ }
+ fn unpaid_execution() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `0`
+ // Estimated: `0`
+ // Minimum execution time: 2_663_000 picoseconds.
+ Weight::from_parts(2_765_000, 0)
+ }
+}
diff --git a/runtime/shibuya/src/weights/xcm/mod.rs b/runtime/shibuya/src/weights/xcm/mod.rs
new file mode 100644
index 0000000000..f4f5851ea3
--- /dev/null
+++ b/runtime/shibuya/src/weights/xcm/mod.rs
@@ -0,0 +1,263 @@
+// This file is part of Astar.
+
+// Copyright (C) 2019-2023 Stake Technologies Pte.Ltd.
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+// Astar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+
+// Astar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License
+// along with Astar. If not, see .
+
+mod fungible;
+mod generic;
+
+use astar_primitives::xcm::MAX_ASSETS;
+use core::cmp::min;
+use frame_support::weights::Weight;
+use fungible::{SubstrateWeight as XcmFungibleWeight, WeightInfo as FungibleWeightInfo};
+use generic::{SubstrateWeight as XcmGeneric, WeightInfo as GenericWeightInfo};
+use sp_std::prelude::*;
+use xcm::{
+ latest::{prelude::*, Weight as XCMWeight},
+ DoubleEncoded,
+};
+
+trait WeighMultiAssets {
+ fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight;
+}
+
+trait WeighMultiAssetsFilter {
+ fn weigh_multi_assets_filter(&self, weight: Weight) -> XCMWeight;
+}
+
+impl WeighMultiAssetsFilter for MultiAssetFilter {
+ fn weigh_multi_assets_filter(&self, weight: Weight) -> XCMWeight {
+ match self {
+ Self::Definite(assets) => {
+ weight.saturating_mul(assets.inner().into_iter().count() as u64)
+ }
+ Self::Wild(AllCounted(count) | AllOfCounted { count, .. }) => {
+ weight.saturating_mul(min(MAX_ASSETS, *count) as u64)
+ }
+ Self::Wild(All | AllOf { .. }) => weight.saturating_mul(MAX_ASSETS as u64),
+ }
+ }
+}
+
+impl WeighMultiAssets for MultiAssets {
+ fn weigh_multi_assets(&self, weight: Weight) -> XCMWeight {
+ weight.saturating_mul(self.inner().into_iter().count() as u64)
+ }
+}
+
+pub struct XcmWeight(core::marker::PhantomData<(Runtime, Call)>);
+impl XcmWeightInfo for XcmWeight
+where
+ Runtime: frame_system::Config,
+{
+ fn withdraw_asset(assets: &MultiAssets) -> XCMWeight {
+ assets.inner().iter().fold(Weight::zero(), |acc, _asset| {
+ acc.saturating_add(XcmFungibleWeight::::withdraw_asset())
+ })
+ }
+
+ fn reserve_asset_deposited(_assets: &MultiAssets) -> XCMWeight {
+ XcmFungibleWeight::::reserve_asset_deposited()
+ }
+ fn receive_teleported_asset(assets: &MultiAssets) -> XCMWeight {
+ assets.weigh_multi_assets(XcmFungibleWeight::::receive_teleported_asset())
+ }
+ fn query_response(
+ _query_id: &u64,
+ _response: &Response,
+ _max_weight: &Weight,
+ _querier: &Option,
+ ) -> XCMWeight {
+ XcmGeneric::::query_response()
+ }
+ fn transfer_asset(assets: &MultiAssets, _dest: &MultiLocation) -> XCMWeight {
+ assets.inner().iter().fold(Weight::zero(), |acc, _asset| {
+ acc.saturating_add(XcmFungibleWeight::::transfer_asset())
+ })
+ }
+ fn transfer_reserve_asset(
+ assets: &MultiAssets,
+ _dest: &MultiLocation,
+ _xcm: &Xcm<()>,
+ ) -> XCMWeight {
+ assets.inner().iter().fold(Weight::zero(), |acc, _asset| {
+ acc.saturating_add(XcmFungibleWeight::::transfer_reserve_asset())
+ })
+ }
+ fn transact(
+ _origin_type: &OriginKind,
+ _require_weight_at_most: &Weight,
+ _call: &DoubleEncoded,
+ ) -> XCMWeight {
+ XcmGeneric::::transact()
+ }
+ fn hrmp_new_channel_open_request(
+ _sender: &u32,
+ _max_message_size: &u32,
+ _max_capacity: &u32,
+ ) -> XCMWeight {
+ // XCM Executor does not currently support HRMP channel operations
+ Weight::MAX
+ }
+ fn hrmp_channel_accepted(_recipient: &u32) -> XCMWeight {
+ // XCM Executor does not currently support HRMP channel operations
+ Weight::MAX
+ }
+ fn hrmp_channel_closing(_initiator: &u32, _sender: &u32, _recipient: &u32) -> XCMWeight {
+ // XCM Executor does not currently support HRMP channel operations
+ Weight::MAX
+ }
+ fn clear_origin() -> XCMWeight {
+ XcmGeneric::::clear_origin()
+ }
+ fn descend_origin(_who: &InteriorMultiLocation) -> XCMWeight {
+ XcmGeneric::::descend_origin()
+ }
+ fn report_error(_query_response_info: &QueryResponseInfo) -> XCMWeight {
+ XcmGeneric::::report_error()
+ }
+ fn deposit_asset(assets: &MultiAssetFilter, _dest: &MultiLocation) -> XCMWeight {
+ assets.weigh_multi_assets_filter(XcmFungibleWeight::::deposit_asset())
+ }
+ fn deposit_reserve_asset(
+ assets: &MultiAssetFilter,
+ _dest: &MultiLocation,
+ _xcm: &Xcm<()>,
+ ) -> XCMWeight {
+ assets.weigh_multi_assets_filter(XcmFungibleWeight::::deposit_reserve_asset())
+ }
+ fn exchange_asset(
+ _give: &MultiAssetFilter,
+ _receive: &MultiAssets,
+ _maximal: &bool,
+ ) -> XCMWeight {
+ Weight::MAX
+ }
+ fn initiate_reserve_withdraw(
+ _assets: &MultiAssetFilter,
+ _reserve: &MultiLocation,
+ _xcm: &Xcm<()>,
+ ) -> XCMWeight {
+ // This is not correct. initiate reserve withdraw does not to that many db reads
+ // the only thing it does based on number of assets is a take from a local variable
+ //assets.weigh_multi_assets(XcmGeneric::::initiate_reserve_withdraw())
+ XcmGeneric::::initiate_reserve_withdraw()
+ }
+ fn initiate_teleport(
+ _assets: &MultiAssetFilter,
+ _dest: &MultiLocation,
+ _xcm: &Xcm<()>,
+ ) -> XCMWeight {
+ XcmFungibleWeight::::initiate_teleport()
+ }
+ fn report_holding(_response_info: &QueryResponseInfo, _assets: &MultiAssetFilter) -> Weight {
+ XcmGeneric::::report_holding()
+ }
+ fn buy_execution(_fees: &MultiAsset, _weight_limit: &WeightLimit) -> XCMWeight {
+ XcmGeneric::::buy_execution()
+ }
+ fn refund_surplus() -> XCMWeight {
+ XcmGeneric::::refund_surplus()
+ }
+ fn set_error_handler(_xcm: &Xcm) -> XCMWeight {
+ XcmGeneric::::set_error_handler()
+ }
+ fn set_appendix(_xcm: &Xcm) -> XCMWeight {
+ XcmGeneric::::set_appendix()
+ }
+ fn clear_error() -> XCMWeight {
+ XcmGeneric::::clear_error()
+ }
+ fn claim_asset(_assets: &MultiAssets, _ticket: &MultiLocation) -> XCMWeight {
+ XcmGeneric::::claim_asset()
+ }
+ fn trap(_code: &u64) -> XCMWeight {
+ XcmGeneric::::trap()
+ }
+ fn subscribe_version(_query_id: &QueryId, _max_response_weight: &Weight) -> XCMWeight {
+ XcmGeneric::::subscribe_version()
+ }
+ fn unsubscribe_version() -> XCMWeight {
+ XcmGeneric::::unsubscribe_version()
+ }
+ fn burn_asset(assets: &MultiAssets) -> Weight {
+ assets.weigh_multi_assets(XcmGeneric::::burn_asset())
+ }
+ fn expect_asset(assets: &MultiAssets) -> Weight {
+ assets.weigh_multi_assets(XcmGeneric::::expect_asset())
+ }
+ fn expect_origin(_origin: &Option) -> Weight {
+ XcmGeneric::::expect_origin()
+ }
+ fn expect_error(_error: &Option<(u32, XcmError)>) -> Weight {
+ XcmGeneric::::expect_error()
+ }
+ fn expect_transact_status(_transact_status: &MaybeErrorCode) -> Weight {
+ XcmGeneric::::expect_transact_status()
+ }
+ fn query_pallet(_module_name: &Vec, _response_info: &QueryResponseInfo) -> Weight {
+ XcmGeneric::::query_pallet()
+ }
+ fn expect_pallet(
+ _index: &u32,
+ _name: &Vec,
+ _module_name: &Vec,
+ _crate_major: &u32,
+ _min_crate_minor: &u32,
+ ) -> Weight {
+ XcmGeneric::::expect_pallet()
+ }
+ fn report_transact_status(_response_info: &QueryResponseInfo) -> Weight {
+ XcmGeneric::::report_transact_status()
+ }
+ fn clear_transact_status() -> Weight {
+ XcmGeneric::::clear_transact_status()
+ }
+ fn universal_origin(_: &Junction) -> Weight {
+ Weight::MAX
+ }
+ fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight {
+ Weight::MAX
+ }
+ fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
+ Weight::MAX
+ }
+ fn unlock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
+ Weight::MAX
+ }
+ fn note_unlockable(_: &MultiAsset, _: &MultiLocation) -> Weight {
+ Weight::MAX
+ }
+ fn request_unlock(_: &MultiAsset, _: &MultiLocation) -> Weight {
+ Weight::MAX
+ }
+ fn set_fees_mode(_: &bool) -> Weight {
+ XcmGeneric::::set_fees_mode()
+ }
+ fn set_topic(_topic: &[u8; 32]) -> Weight {
+ XcmGeneric::::set_topic()
+ }
+ fn clear_topic() -> Weight {
+ XcmGeneric::::clear_topic()
+ }
+ fn alias_origin(_: &MultiLocation) -> Weight {
+ // XCM Executor does not currently support alias origin operations
+ Weight::MAX
+ }
+ fn unpaid_execution(_: &WeightLimit, _: &Option) -> Weight {
+ XcmGeneric::::unpaid_execution()
+ }
+}
diff --git a/runtime/shibuya/src/xcm_config.rs b/runtime/shibuya/src/xcm_config.rs
index 8a5f5ba881..4b91a10878 100644
--- a/runtime/shibuya/src/xcm_config.rs
+++ b/runtime/shibuya/src/xcm_config.rs
@@ -35,10 +35,10 @@ use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, ConvertedConcreteId, CurrencyAdapter,
- EnsureXcmOrigin, FixedWeightBounds, FungiblesAdapter, IsConcrete, NoChecking,
- ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
- SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
- SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WithComputedOrigin,
+ EnsureXcmOrigin, FungiblesAdapter, IsConcrete, NoChecking, ParentAsSuperuser, ParentIsPreset,
+ RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
+ SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
+ UsingComponents, WeightInfoBounds, WithComputedOrigin,
};
use xcm_executor::{
traits::{Convert as XcmConvert, JustTry},
@@ -52,7 +52,7 @@ use orml_xcm_support::DisabledParachainFee;
use astar_primitives::xcm::{
AbsoluteAndRelativeReserveProvider, AccountIdToMultiLocation, DescribeAllTerminal,
DescribeFamily, FixedRateOfForeignAsset, HashedDescription, ReserveAssetFilter,
- XcmFungibleFeeHandler,
+ XcmFungibleFeeHandler, MAX_ASSETS,
};
parameter_types! {
@@ -141,6 +141,7 @@ parameter_types! {
// For the PoV size, we estimate 4 kB per instruction. This will be changed when we benchmark the instructions.
pub UnitWeightCost: Weight = Weight::from_parts(1_000_000_000, 4 * 1024);
pub const MaxInstructions: u32 = 100;
+ pub const MaxAssetsIntoHolding: u32 = MAX_ASSETS;
}
match_types! {
@@ -171,7 +172,8 @@ pub type ShibuyaXcmFungibleFeeHandler = XcmFungibleFeeHandler<
TreasuryAccountId,
>;
-pub type Weigher = FixedWeightBounds;
+pub type Weigher =
+ WeightInfoBounds, RuntimeCall, MaxInstructions>;
pub struct XcmConfig;
impl xcm_executor::Config for XcmConfig {
@@ -194,7 +196,7 @@ impl xcm_executor::Config for XcmConfig {
type SubscriptionService = PolkadotXcm;
type PalletInstancesInfo = AllPalletsWithSystem;
- type MaxAssetsIntoHolding = ConstU32<64>;
+ type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type AssetLocker = ();
type AssetExchanger = ();
type FeeManager = ();