Skip to content

Conversation

raymondkfcheung
Copy link
Contributor

@raymondkfcheung raymondkfcheung commented Sep 22, 2025

This PR improves the weight accounting for XCMs that are rejected early by Barrier.

Addresses #7965

@raymondkfcheung raymondkfcheung requested review from a team as code owners September 22, 2025 13:02
@raymondkfcheung raymondkfcheung self-assigned this Sep 22, 2025
@raymondkfcheung raymondkfcheung added T6-XCM This PR/Issue is related to XCM. T12-benchmarks This PR/Issue is related to benchmarking and weights. labels Sep 22, 2025
@raymondkfcheung raymondkfcheung removed the request for review from a team September 22, 2025 13:04
@raymondkfcheung raymondkfcheung changed the title Ray benchmark barriers Add Barrier Benchmark for Accurate XCM Weight Accounting in Early Rejections Sep 22, 2025
@raymondkfcheung
Copy link
Contributor Author

/cmd prdoc --audience runtime_dev --bump patch

@raymondkfcheung
Copy link
Contributor Author

/cmd bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend

Copy link
Contributor

Command "bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend" has started 🚀 See logs here

Copy link
Contributor

Command "bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend" has failed ❌! See logs here

}

#[benchmark]
fn barrier_check() -> Result<(), BenchmarkError> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raymondkfcheung This will generate fn barrier_check in the weight file pallet_xcm_benchmarks_generic.rs, where and how do we want to use it then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll replace xcm_weight at below code in XcmExecutor::execute():

return Outcome::Incomplete {
    used: xcm_weight, // Weight consumed before the error
    error: InstructionError { index: 0, error: XcmError::Barrier }, // The error that occurred
};

@raymondkfcheung
Copy link
Contributor Author

/cmd bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend

Copy link
Contributor

Command "bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend" has started 🚀 See logs here

@raymondkfcheung
Copy link
Contributor Author

/cmd bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend

Copy link
Contributor

Command "bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend" has started 🚀 See logs here

…t_xcm_benchmarks::generic --runtime asset-hub-westend'
Copy link
Contributor

Command "bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend" has finished ✅ See logs here

Subweight results:
File Extrinsic Old New Change [%]
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs expect_pallet 8.27us 9.86us +19.33
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs clear_transact_status 842.00ns 912.00ns +8.31
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs clear_topic 775.00ns 827.00ns +6.71
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs unpaid_execution 783.00ns 834.00ns +6.51
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs set_topic 768.00ns 815.00ns +6.12
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs set_fees_mode 779.00ns 823.00ns +5.65
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs asset_claimer 829.00ns 875.00ns +5.55
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs clear_origin 822.00ns 866.00ns +5.35
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs barrier_check 33.71us Added
Command output:

✅ Successful benchmarks of runtimes/pallets:
-- asset-hub-westend: ['pallet_xcm_benchmarks::generic']

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/18040153501
Failed job name: fmt

@raymondkfcheung
Copy link
Contributor Author

/cmd bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend

Copy link
Contributor

Command "bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend" has started 🚀 See logs here

…t_xcm_benchmarks::generic --runtime asset-hub-westend'
Copy link
Contributor

Command "bench --pallet pallet_xcm_benchmarks::generic --runtime asset-hub-westend" has finished ✅ See logs here

Subweight results:
File Extrinsic Old New Change [%]
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs set_topic 768.00ns 919.00ns +19.66
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs expect_pallet 8.27us 9.77us +18.15
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs unpaid_execution 783.00ns 923.00ns +17.88
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs asset_claimer 829.00ns 950.00ns +14.60
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs set_fees_mode 779.00ns 888.00ns +13.99
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs clear_topic 775.00ns 876.00ns +13.03
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs descend_origin 828.00ns 934.00ns +12.80
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs set_appendix 805.00ns 899.00ns +11.68
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs clear_origin 822.00ns 906.00ns +10.22
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs clear_error 810.00ns 880.00ns +8.64
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs alias_origin 859.00ns 930.00ns +8.27
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs refund_surplus 1.50us 1.62us +8.02
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs clear_transact_status 842.00ns 902.00ns +7.13
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs expect_transact_status 975.00ns 1.04us +6.87
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs expect_origin 3.81us 4.06us +6.78
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs expect_error 3.84us 4.10us +6.76
cumulus/parachains/runtimes/assets/asset-hub-westend/src/weights/xcm/pallet_xcm_benchmarks_generic.rs barrier_check 50.80us Added
Command output:

✅ Successful benchmarks of runtimes/pallets:
-- asset-hub-westend: ['pallet_xcm_benchmarks::generic']

@raymondkfcheung raymondkfcheung changed the title Add Barrier Benchmark for Accurate XCM Weight Accounting in Early Rejections Benchmark Barrier for Accurate Weighting on Early Rejection Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T6-XCM This PR/Issue is related to XCM. T12-benchmarks This PR/Issue is related to benchmarking and weights.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants