Clean up PersistedValidationData (#2353)

* PVD: `block_number`->`relay_parent_number`

* ValidationParams: `relay_chain_height`->`relay_parent_number`

* Expose DMQ MQC hash as a well-known-key

This way the relay storage merkle proofs will be able to obtain the DMQ
MQC hash and we will be able to remove the it from the
PersistedValidationData struct.

* PersistedValidationData: Remove HRMP MQC heads

* PersistedValidationData: Remove `dmq_mqc_head`

* Expose the HRMP ingress channel index as a well-known-key

This way a parachain (PVF and collator) can find all the parachains that
have an outbound channel to the given one. That allows in turn to find
all the inbound channels for the given para.

Having access to that allows the parachain to get the same information
as the hrmp_mqc_heads now provide.

* Rename `relay_storage_root` to `relay_parent_storage_root`
This commit is contained in:
Sergei Shulepov
2021-02-02 17:35:13 +01:00
committed by GitHub
parent 16b250d7ea
commit d4fdbf7db9
17 changed files with 112 additions and 100 deletions
+14 -1
View File
@@ -1084,7 +1084,8 @@ impl<T: Config> Module<T> {
/// Returns the list of MQC heads for the inbound channels of the given recipient para paired
/// with the sender para ids. This vector is sorted ascending by the para id and doesn't contain
/// multiple entries with the same sender.
pub(crate) fn hrmp_mqc_heads(recipient: ParaId) -> Vec<(ParaId, Hash)> {
#[cfg(test)]
fn hrmp_mqc_heads(recipient: ParaId) -> Vec<(ParaId, Hash)> {
let sender_set = <Self as Store>::HrmpIngressChannelsIndex::get(&recipient);
// The ingress channels vector is sorted, thus `mqc_heads` is sorted as well.
@@ -1706,6 +1707,18 @@ mod tests {
},
);
let raw_ingress_index =
sp_io::storage::get(
&well_known_keys::hrmp_ingress_channel_index(para_b),
)
.expect("the ingress index must be present for para_b");
let ingress_index = <Vec<ParaId>>::decode(&mut &raw_ingress_index[..])
.expect("ingress indexx should be decodable as a list of para ids");
assert_eq!(
ingress_index,
vec![para_a],
);
// Now, verify that we can access and decode the egress index.
let raw_egress_index =
sp_io::storage::get(