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
+7 -4
View File
@@ -38,7 +38,7 @@ pub struct RelayStateSproofBuilder {
pub host_config: AbridgedHostConfiguration,
pub dmq_mqc_head: Option<relay_chain::Hash>,
pub upgrade_go_ahead: Option<UpgradeGoAhead>,
pub relay_dispatch_queue_size: Option<(u32, u32)>,
pub relay_dispatch_queue_remaining_capacity: Option<(u32, u32)>,
pub hrmp_ingress_channel_index: Option<Vec<ParaId>>,
pub hrmp_egress_channel_index: Option<Vec<ParaId>>,
pub hrmp_channels: BTreeMap<relay_chain::HrmpChannelId, AbridgedHrmpChannel>,
@@ -65,7 +65,7 @@ impl Default for RelayStateSproofBuilder {
},
dmq_mqc_head: None,
upgrade_go_ahead: None,
relay_dispatch_queue_size: None,
relay_dispatch_queue_remaining_capacity: None,
hrmp_ingress_channel_index: None,
hrmp_egress_channel_index: None,
hrmp_channels: BTreeMap::new(),
@@ -124,9 +124,12 @@ impl RelayStateSproofBuilder {
dmq_mqc_head.encode(),
);
}
if let Some(relay_dispatch_queue_size) = self.relay_dispatch_queue_size {
if let Some(relay_dispatch_queue_size) = self.relay_dispatch_queue_remaining_capacity {
insert(
relay_chain::well_known_keys::relay_dispatch_queue_size(self.para_id),
relay_chain::well_known_keys::relay_dispatch_queue_remaining_capacity(
self.para_id,
)
.key,
relay_dispatch_queue_size.encode(),
);
}