Switch to relay_dispatch_queue_remaining_capacity (#2608)

* Switch to `relay_dispatch_queue_remaining_capacity`

This switches the parachain runtimes to use `relay_dispatch_queue_remaining_capacity` when possible.
If the data is not yet available on the relay chain it falls back to `relay_dispatch_queue_size`. It
will require that all parachains migrate to `relay_dispatch_queue_remaining_capacity` before we can
start removing the call to `relay_dipatch_queue_size`.

Besides that the pr adapts the xcm exumulator to make it work with the message queue.

* Fix test and use correct types

* ".git/.scripts/commands/fmt/fmt.sh"

---------

Co-authored-by: command-bot <>
This commit is contained in:
Bastian Köcher
2023-05-21 22:23:18 +02:00
committed by GitHub
parent 5ca30a3c4f
commit 3a20b3d702
9 changed files with 424 additions and 327 deletions
+5 -5
View File
@@ -233,13 +233,13 @@ pub mod pallet {
};
<PendingUpwardMessages<T>>::mutate(|up| {
let (count, size) = relevant_messaging_state.relay_dispatch_queue_size;
let queue_size = relevant_messaging_state.relay_dispatch_queue_size;
let available_capacity = cmp::min(
host_config.max_upward_queue_count.saturating_sub(count),
host_config.max_upward_message_num_per_candidate,
queue_size.remaining_count,
host_config.max_upward_message_num_per_candidate.into(),
);
let available_size = host_config.max_upward_queue_size.saturating_sub(size);
let available_size = queue_size.remaining_size;
// Count the number of messages we can possibly fit in the given constraints, i.e.
// available_capacity and available_size.
@@ -431,7 +431,7 @@ pub mod pallet {
.read_abridged_host_configuration()
.expect("Invalid host configuration in relay chain state proof");
let relevant_messaging_state = relay_state_proof
.read_messaging_state_snapshot()
.read_messaging_state_snapshot(&host_config)
.expect("Invalid messaging state in relay chain state proof");
<ValidationData<T>>::put(&vfp);