#messages #threshold #channel #queue #pallet #factor #fee

no-std cumulus-pallet-xcmp-queue

Pallet to queue outbound and inbound XCMP messages. (polkadot v1.10.0)

13 releases (breaking)

new 0.11.0 Apr 9, 2024
0.10.0 Mar 18, 2024
0.9.0 Feb 27, 2024
0.6.0 Dec 13, 2023
0.0.0 Nov 21, 2022

#248 in Magic Beans

Download history 332/week @ 2023-12-18 110/week @ 2023-12-25 708/week @ 2024-01-01 889/week @ 2024-01-08 418/week @ 2024-01-15 531/week @ 2024-01-22 425/week @ 2024-01-29 502/week @ 2024-02-05 1025/week @ 2024-02-12 1719/week @ 2024-02-19 1679/week @ 2024-02-26 555/week @ 2024-03-04 518/week @ 2024-03-11 984/week @ 2024-03-18 917/week @ 2024-03-25 1110/week @ 2024-04-01

3,575 downloads per month
Used in 28 crates (25 directly)

Apache-2.0 and maybe GPL-3.0-or-later…

115KB
2K SLoC

A pallet which uses the XCMP transport layer to handle both incoming and outgoing XCM message sending and dispatch, queuing, signalling and backpressure. To do so, it implements:

  • XcmpMessageHandler
  • XcmpMessageSource

Also provides an implementation of SendXcm which can be placed in a router tuple for relaying XCM over XCMP if the destination is Parent/Parachain. It requires an implementation of XcmExecutor for dispatching incoming XCM messages.

To prevent out of memory errors on the OutboundXcmpMessages queue, an exponential fee factor (DeliveryFeeFactor) is set, much like the one used in DMP. The fee factor increases whenever the total size of messages in a particular channel passes a threshold. This threshold is defined as a percentage of the maximum total size the channel can have. More concretely, the threshold is max_total_size / THRESHOLD_FACTOR, where:

  • max_total_size is the maximum size, in bytes, of the channel, not number of messages. It is defined in the channel configuration.
  • THRESHOLD_FACTOR just declares which percentage of the max size is the actual threshold. If it's 2, then the threshold is half of the max size, if it's 4, it's a quarter, and so on.

Dependencies

~27–41MB
~700K SLoC