Skip to content

XCMP weight metering: account for the MQ page position#8344

Merged
serban300 merged 17 commits intoparitytech:masterfrom
serban300:xcmp-weight-metering
May 21, 2025
Merged

XCMP weight metering: account for the MQ page position#8344
serban300 merged 17 commits intoparitytech:masterfrom
serban300:xcmp-weight-metering

Conversation

@serban300
Copy link
Copy Markdown
Contributor

Related to #8308
Follow-up for #8021

@serban300 serban300 added R0-no-crate-publish-required The change does not require any crates to be re-published. T6-XCM This PR/Issue is related to XCM. labels Apr 25, 2025
@serban300 serban300 self-assigned this Apr 25, 2025
@serban300 serban300 requested a review from a team as a code owner April 25, 2025 14:46
@serban300 serban300 force-pushed the xcmp-weight-metering branch 2 times, most recently from c3140d9 to 0b3886a Compare April 25, 2025 16:48
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@serban300 serban300 force-pushed the xcmp-weight-metering branch from 0b3886a to f2d7b2c Compare April 28, 2025 08:21
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 28, 2025
@serban300 serban300 force-pushed the xcmp-weight-metering branch from f2d7b2c to 9ea15c8 Compare April 29, 2025 07:21
@serban300
Copy link
Copy Markdown
Contributor Author

/cmd bench --pallet cumulus_pallet_xcmp_queue

@paritytech paritytech deleted a comment from github-actions bot Apr 29, 2025
@paritytech paritytech deleted a comment from github-actions bot Apr 29, 2025
@github-actions
Copy link
Copy Markdown
Contributor

Command "bench --pallet cumulus_pallet_xcmp_queue" has started 🚀 See logs here

@github-actions
Copy link
Copy Markdown
Contributor

Command "bench --pallet cumulus_pallet_xcmp_queue" has failed ❌! See logs here

@serban300
Copy link
Copy Markdown
Contributor Author

/cmd bench --pallet cumulus_pallet_xcmp_queue

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 2, 2025

Command "bench --pallet cumulus_pallet_xcmp_queue" has started 🚀 See logs here

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented May 2, 2025

Command "bench --pallet cumulus_pallet_xcmp_queue" has failed ❌! See logs here

@bkontur
Copy link
Copy Markdown
Contributor

bkontur commented May 21, 2025

Unrelated question:
Can we now determine the exact/approx number of XCMP queue throughput for a parachain based on the runtime’s queue configuration?

For example, if we consider some common/average XCM message and the actual AssetHubWestend runtime configuration for queues - can we approximately calculate the maximum number of such messages that can be processed per block (assuming no other extrinsics are included)? In other words, what's the maximum number of these XCM messages AHW can process/enqueue in a single block?

If this is feasible, maybe we could also introduce a basic sanity/integrity test to get a sense of the current throughput numbers.

cc: @sandreim had this question yesterday

@serban300
Copy link
Copy Markdown
Contributor Author

serban300 commented May 21, 2025

Unrelated question: Can we now determine the exact/approx number of XCMP queue throughput for a parachain based on the runtime’s queue configuration?

For example, if we consider some common/average XCM message and the actual AssetHubWestend runtime configuration for queues - can we approximately calculate the maximum number of such messages that can be processed per block (assuming no other extrinsics are included)? In other words, what's the maximum number of these XCM messages AHW can process/enqueue in a single block?

If this is feasible, maybe we could also introduce a basic sanity/integrity test to get a sense of the current throughput numbers.

cc: @sandreim had this question yesterday

@bkontur You mean the number of inbound messages that can be enqueued per block by the XCMP pallet ?

If so, yes. The block ref time assigned for this operation is 0.125s, no matter how many other extrinsics are included :

pub const ReservedXcmpWeight: Weight = MAXIMUM_BLOCK_WEIGHT.saturating_div(4);

And we can use the computed weights in order to see how many messages can be enqueued using 0.125s. We need some assumptions related to the average message size, the number of new pages, etc. Considering the current weights we can enqueue about 20k small messages in a block

@sandreim
Copy link
Copy Markdown
Contributor

Thanks @serban300. What does "small message" mean in bytes ?

@serban300
Copy link
Copy Markdown
Contributor Author

Thanks @serban300. What does "small message" mean in bytes ?

@sandreim "small messages" means 3 bytes in this case, but the weight doesn't increase by a lot with the number of bytes. If you have a certain message size in mind, I can redo the computations.

@serban300 serban300 added this pull request to the merge queue May 21, 2025
Merged via the queue into paritytech:master with commit 6a66aa3 May 21, 2025
243 of 245 checks passed
@serban300 serban300 deleted the xcmp-weight-metering branch May 21, 2025 18:08
ordian added a commit that referenced this pull request May 27, 2025
* master: (99 commits)
  Snowbridge: Remove asset location check for compatibility (#8473)
  add poke_deposit extrinsic to pallet-bounties (#8382)
  litep2p/peerset: Reject non-reserved peers in the reserved-only mode (#8650)
  Charge deposit based on key length (#8648)
  [pallet-revive] make subscription task panic on error (#8587)
  tx/metrics: Add metrics for the RPC v2 `transactionWatch_v1_submitAndWatch` (#8345)
  Bridges: Fix - Improve try-state for pallet-xcm-bridge-hub (#8615)
  Introduce CreateBare, deprecated CreateInherent (#7597)
  Use hashbrown hashmap/hashset in validation context (#8606)
  ci: rm gitlab config (#8622)
  🔪 flaky and Zombienet tests (#8600)
  cumulus: adjust unincluded segment size metric buckets (#8617)
  Benchmark storage access on block validation (#8069)
  Revert 7934 es/remove tj changes (#8611)
  collator-protocol: add more collation observability (#8230)
  `fatxpool`: add fallback for ready at light (#8533)
  txpool: fix tx removal from unlocks set (#8500)
  XCMP weight metering: account for the MQ page position (#8344)
  fix epmb solution duplicate issue + add remote mining apparatus to epm (#8585)
  Fix generated address returned by Substrate RPC runtime call (#8504)
  ...
@miss-stake miss-stake moved this from Backlog to Scheduled in Security Audit (PRs) - SRLabs Jun 3, 2025
fellowship-merge-bot bot pushed a commit to polkadot-fellows/runtimes that referenced this pull request Aug 7, 2025
This brings in `stable2506` Polkadot SDK, and integrates many new
features.

Integrated breaking changes to be verified by the original authors:

- [x] ~paritytech/polkadot-sdk#8127 @kianenigma
@Ank4n~
     This will come in with AHM, and not before.
- [x] paritytech/polkadot-sdk#7597 @gui1117 
- [x] paritytech/polkadot-sdk#8254 @bkchr 
- [x] paritytech/polkadot-sdk#7592 @bkontur 
- [x] paritytech/polkadot-sdk#8382
@UtkarshBhardwaj007
- [x] paritytech/polkadot-sdk#8021 @serban300 
- [x] paritytech/polkadot-sdk#8344 @serban300 
- [x] paritytech/polkadot-sdk#8262 @athei 
- [x] paritytech/polkadot-sdk#8584 @athei 
- [x] paritytech/polkadot-sdk#8299 @skunert
- [x] paritytech/polkadot-sdk#8652 @pgherveou 
- [x] paritytech/polkadot-sdk#8554 @pgherveou 
- [x] paritytech/polkadot-sdk#8281 @mrshiposha 
- [x] paritytech/polkadot-sdk#7730
@franciscoaguirre
- [x] paritytech/polkadot-sdk#8599 @yrong
@claravanstaden
- [x] paritytech/polkadot-sdk#8531 @bkontur 
- [x] paritytech/polkadot-sdk#8409 @kianenigma 
- [x] paritytech/polkadot-sdk#9137
@franciscoaguirre
- [x] paritytech/polkadot-sdk#7944 @bkontur 
- [x] paritytech/polkadot-sdk#8179 @bkontur 
- [x] paritytech/polkadot-sdk#8037 @yrong

---------

Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: claravanstaden <claravanstaden64@gmail.com>
Co-authored-by: Branislav Kontur <bkontur@gmail.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: Alain Brenzikofer <alain@integritee.network>
Co-authored-by: kianenigma <kian@parity.io>
Co-authored-by: Francisco Aguirre <franciscoaguirreperez@gmail.com>
Co-authored-by: ron <yrong1997@gmail.com>
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
Co-authored-by: Overkillus <maciej.zyszkiewicz@parity.io>
@redzsina redzsina moved this from Scheduled to In progress in Security Audit (PRs) - SRLabs Aug 25, 2025
@redzsina redzsina moved this from In progress to Audited in Security Audit (PRs) - SRLabs Sep 8, 2025
alvicsam pushed a commit that referenced this pull request Oct 17, 2025
Related to #8308
Follow-up for #8021

---------

Co-authored-by: command-bot <>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

Projects

Status: Audited
Status: Done

Development

Successfully merging this pull request may close these issues.

8 participants