Files
pezkuwi-subxt/polkadot/runtime/parachains/src/util.rs
T
Sergei Shulepov d4fdbf7db9 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`
2021-02-02 10:35:13 -06:00

42 lines
1.5 KiB
Rust

// Copyright 2017-2020 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! Utilities that don't belong to any particular module but may draw
//! on all modules.
use primitives::v1::{Id as ParaId, PersistedValidationData, Hash};
use crate::{configuration, paras, hrmp};
/// Make the persisted validation data for a particular parachain, a specified relay-parent and it's
/// storage root.
///
/// This ties together the storage of several modules.
pub fn make_persisted_validation_data<T: paras::Config + hrmp::Config>(
para_id: ParaId,
relay_parent_number: T::BlockNumber,
relay_parent_storage_root: Hash,
) -> Option<PersistedValidationData<T::BlockNumber>> {
let config = <configuration::Module<T>>::config();
Some(PersistedValidationData {
parent_head: <paras::Module<T>>::para_head(&para_id)?,
relay_parent_number,
relay_parent_storage_root,
max_pov_size: config.max_pov_size,
})
}