Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
77b079a
Add barrier_check
raymondkfcheung Aug 30, 2025
e1769d3
Add dummy barrier_check impls
raymondkfcheung Aug 30, 2025
6e39f6b
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 19, 2025
c86a29a
Add TODO placeholder
raymondkfcheung Sep 22, 2025
7b6a77f
Update barrier_check signature
raymondkfcheung Sep 22, 2025
76fdb0b
Update barrier_check()
raymondkfcheung Sep 22, 2025
8e8842e
Fix fmt
raymondkfcheung Sep 22, 2025
d4e690c
Add XCM instructions
raymondkfcheung Sep 22, 2025
6fe0cd9
Update from github-actions[bot] running command 'prdoc --audience run…
github-actions[bot] Sep 22, 2025
7037781
Fix tests
raymondkfcheung Sep 22, 2025
4539162
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 22, 2025
8e5975f
Update polkadot/xcm/pallet-xcm-benchmarks/src/generic/benchmarking.rs
bkontur Sep 22, 2025
23cb0ce
Address the comments
raymondkfcheung Sep 22, 2025
34b4ac7
Merge remote-tracking branch 'origin/ray-benchmark-barriers' into ray…
raymondkfcheung Sep 22, 2025
01d514a
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 22, 2025
d708335
Change to RuntimeCall
raymondkfcheung Sep 22, 2025
bbd2789
Fix fmt
raymondkfcheung Sep 22, 2025
f8fcd39
Revert to Xcm<Instruction<Self>>
raymondkfcheung Sep 22, 2025
a976cdb
Fix bugs
raymondkfcheung Sep 23, 2025
a519ce1
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 23, 2025
0dca870
Fix tests
raymondkfcheung Sep 23, 2025
57fef77
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 23, 2025
6780bfa
Fix tests
raymondkfcheung Sep 23, 2025
635d6bb
Fix tests
raymondkfcheung Sep 24, 2025
a390792
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 24, 2025
98739eb
Fix tests
raymondkfcheung Sep 24, 2025
1311d54
Update PRDoc
raymondkfcheung Sep 24, 2025
7b9a69c
Fix tests
raymondkfcheung Sep 24, 2025
742531a
Fix tests
raymondkfcheung Sep 24, 2025
be36b88
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 24, 2025
c9dc655
Fix comments
raymondkfcheung Sep 24, 2025
b58152a
Fix imports
raymondkfcheung Sep 24, 2025
6ba21f9
Add tracing
raymondkfcheung Sep 24, 2025
62c3b03
Try to add DenyClearOrigin
raymondkfcheung Sep 24, 2025
6ca2124
Fix fmt
raymondkfcheung Sep 24, 2025
8b3990b
Add execute_xcm
raymondkfcheung Sep 24, 2025
2afdacb
Update execute_xcm
raymondkfcheung Sep 24, 2025
1bebab9
Update execute_xcm
raymondkfcheung Sep 24, 2025
008336f
Fix fmt
raymondkfcheung Sep 24, 2025
886f740
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 24, 2025
3a9ce41
Add ExecuteXcmOf
raymondkfcheung Sep 25, 2025
d76901c
Fix fmt
raymondkfcheung Sep 25, 2025
ae8c6d9
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 25, 2025
b88527c
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 25, 2025
956822c
Update PRDoc
raymondkfcheung Sep 25, 2025
fb11503
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 25, 2025
55fcaa7
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 25, 2025
1356f63
Fix fmt
raymondkfcheung Sep 25, 2025
aa73c5c
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Sep 25, 2025
462aafd
Merge remote-tracking branch 'origin/ray-benchmark-barriers' into ray…
raymondkfcheung Sep 25, 2025
560da77
Add WeightInfo
raymondkfcheung Sep 25, 2025
8d111a8
Add barrier_check
raymondkfcheung Sep 25, 2025
40ee282
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 25, 2025
014382b
Fix tests
raymondkfcheung Sep 25, 2025
74f7640
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 26, 2025
350798e
Make more complicated XCM
raymondkfcheung Sep 26, 2025
6f76a1b
Add barrier_check_weight
raymondkfcheung Sep 26, 2025
1993413
Remove weights::WeightInfo
raymondkfcheung Sep 26, 2025
32bfb35
Add AssetHubWestendXcmWeightInfoBounds
raymondkfcheung Sep 26, 2025
16a0fd7
Fix fmt
raymondkfcheung Sep 26, 2025
fce82c1
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Sep 26, 2025
90ca4ba
Merge remote-tracking branch 'origin/ray-benchmark-barriers' into ray…
raymondkfcheung Sep 26, 2025
7c2fd36
Fix fmt
raymondkfcheung Sep 26, 2025
f783b83
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 29, 2025
5f17996
Use more complicated instructions
raymondkfcheung Sep 29, 2025
bc636ed
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 29, 2025
82a6efb
Simplify the Deny
raymondkfcheung Sep 29, 2025
87486c3
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 29, 2025
001d9db
Update from github-actions[bot] running command 'bench --pallet palle…
github-actions[bot] Sep 29, 2025
ba06faf
Merge branch 'master' into ray-benchmark-barriers
raymondkfcheung Sep 29, 2025
459f361
Update PRDoc
raymondkfcheung Sep 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ use pallet_xcm::{EnsureXcm, IsVoiceOfBody};
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
#[cfg(feature = "runtime-benchmarks")]
use xcm::latest::prelude::{
Asset, Assets as XcmAssets, Fungible, Here, InteriorLocation, Junction, Junction::*, Location,
NetworkId, NonFungible, ParentThen, Response, WeightLimit, XCM_VERSION,
Asset, Assets as XcmAssets, Fungible, Here, Instruction, InteriorLocation, Junction,
Junction::*, Location, NetworkId, NonFungible, ParentThen, Response, WeightLimit, Xcm,
XCM_VERSION,
};
use xcm::{
latest::prelude::{AssetId, BodyId},
Expand Down Expand Up @@ -2016,6 +2017,10 @@ impl_runtime_apis! {
Location::new(1, [Parachain(1001), AccountId32 { id: [111u8; 32], network: None }]),
))
}

fn worst_case_for_not_passing_barrier() -> Result<Xcm<Instruction<Self>>, BenchmarkError> {
Err(BenchmarkError::Skip)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down
28 changes: 26 additions & 2 deletions cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ use frame_support::traits::PalletInfoAccess;

#[cfg(feature = "runtime-benchmarks")]
use xcm::latest::prelude::{
Asset, Assets as XcmAssets, Fungible, Here, InteriorLocation, Junction, Junction::*, Location,
NetworkId, NonFungible, ParentThen, Response, WeightLimit, XCM_VERSION,
Asset, Assets as XcmAssets, Fungible, Here, Instruction, InteriorLocation, Junction,
Junction::*, Location, NetworkId, NonFungible, ParentThen, Response, WeightLimit, Xcm,
XCM_VERSION,
};

use xcm_runtime_apis::{
Expand Down Expand Up @@ -2562,6 +2563,29 @@ pallet_revive::impl_runtime_apis_plus_revive!(
Location::new(1, [Parachain(1001), AccountId32 { id: [111u8; 32], network: None }]),
))
}

fn worst_case_for_not_passing_barrier() -> Result<Xcm<Instruction<Self>>, BenchmarkError> {
use xcm::latest::prelude::{ClearOrigin, SetAppendix, SetTopic};

let nested_limit = xcm_executor::RECURSION_LIMIT as usize - 2;

// Within the recursion limit, this is fine.
let mut set_topic = Xcm(vec![SetTopic([42; 32])]);
for _ in 0..nested_limit {
set_topic = Xcm(vec![SetAppendix(set_topic)]);
}
let set_topics = Xcm(vec![SetAppendix(set_topic); nested_limit]);

// Exceed the recursion limit, this will be rejected.
let mut clear_origin = Xcm(vec![SetAppendix(Xcm(vec![ClearOrigin]))]);
for _ in 0..=nested_limit {
clear_origin = Xcm(vec![SetAppendix(clear_origin)]);
}

let xcm = Xcm(vec![SetAppendix(set_topics), SetAppendix(clear_origin)]);

Ok(xcm)
}
}

type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::<Runtime>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ mod pallet_xcm_benchmarks_fungible;
mod pallet_xcm_benchmarks_generic;

use crate::{
xcm_config::{ERC20TransferGasLimit, MaxAssetsIntoHolding},
Runtime,
xcm_config::{ERC20TransferGasLimit, MaxAssetsIntoHolding, MaxInstructions},
Runtime, RuntimeCall,
};
use alloc::vec::Vec;
use assets_common::IsLocalAccountKey20;
Expand All @@ -30,6 +30,8 @@ use xcm::{
latest::{prelude::*, AssetTransferFilter},
DoubleEncoded,
};
use xcm_builder::WeightInfoBounds;
use xcm_executor::traits::WeightBounds;

trait WeighAssets {
fn weigh_assets(&self, weight: Weight) -> Weight;
Expand Down Expand Up @@ -303,3 +305,26 @@ impl<Call> XcmWeightInfo<Call> for AssetHubWestendXcmWeight<Call> {
XcmGeneric::<Runtime>::execute_with_origin()
}
}

pub struct AssetHubWestendXcmWeightInfoBounds;
impl WeightBounds<RuntimeCall> for AssetHubWestendXcmWeightInfoBounds {
fn weight(
message: &mut Xcm<RuntimeCall>,
weight_limit: Weight,
) -> Result<Weight, InstructionError> {
WeightInfoBounds::<AssetHubWestendXcmWeight<RuntimeCall>, RuntimeCall, MaxInstructions>::weight(
message,
weight_limit,
)
}

fn instr_weight(instruction: &mut Instruction<RuntimeCall>) -> Result<Weight, XcmError> {
WeightInfoBounds::<AssetHubWestendXcmWeight<RuntimeCall>, RuntimeCall, MaxInstructions>::instr_weight(
instruction,
)
}

fn barrier_check_weight() -> Option<Weight> {
Some(XcmGeneric::<Runtime>::barrier_check())
}
}
Loading
Loading