Inform the PVF with the latest relevant relay chain state (#279)

* Update polkadot

* Extend cumulus primitives with some relay chain exports

Follow https://github.com/paritytech/polkadot/pull/2194 to see the
polkadot PR

* collator: collect the state proof

This commit changes cumulus-collator so that it takes the relay chain
state at the relay parent and creates a storage proof that contains all
the required data for PVF.

* parachain-upgrade: use the proofs instead

This change is needed to make cumulus logic to not longer depend on the
transient validation data. As part of this change, in order to preserve
the current behavior `code_upgrade_allowed` now is computed on the
parachain side, rather than provided by polkadot.

Turned out that this requires to know the self parachain id so it was
added where needed.

* message-broker: use relay state to track limits

this should make sending messages safe from accidentally running over
the relay chain limits that were previously unknown.

* Update polkadot

So that `relay_storage_root` is available through `ValidationParams`

* Check `relay_storage_root` matches expected

Check that `relay_storage_root` submitted by the collator matches the
one that we receive in `validate_block` through `ValidationParams`

* Add a missing check for `dmq_mqc_head` while we are at it

* Update polkadot

* Fix tests that use the relay storage root

* Apply suggestions from code review

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update message-broker/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove unneeded (&_)

* Fix unwraps

* Polish basti's suggestion

* Fix merge

* Bring back the System::can_set_code check

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Sergei Shulepov
2021-01-13 14:40:26 +01:00
committed by GitHub
parent 322eda8f69
commit 464e54affd
19 changed files with 793 additions and 136 deletions
+15 -3
View File
@@ -18,16 +18,23 @@
#![cfg_attr(not(feature = "std"), no_std)]
pub use polkadot_core_primitives as relay_chain;
pub use polkadot_core_primitives::InboundDownwardMessage;
pub use polkadot_parachain::primitives::{Id as ParaId, UpwardMessage, ValidationParams};
pub use polkadot_primitives::v1::{
PersistedValidationData, TransientValidationData, ValidationData,
PersistedValidationData, TransientValidationData, ValidationData, AbridgedHostConfiguration,
AbridgedHrmpChannel,
};
#[cfg(feature = "std")]
pub mod genesis;
/// A module that re-exports relevant relay chain definitions.
pub mod relay_chain {
pub use polkadot_core_primitives::*;
pub use polkadot_primitives::v1;
pub use polkadot_primitives::v1::well_known_keys;
}
/// An inbound HRMP message.
pub type InboundHrmpMessage = polkadot_primitives::v1::InboundHrmpMessage<relay_chain::BlockNumber>;
@@ -62,7 +69,12 @@ pub mod inherents {
pub validation_data: crate::ValidationData,
/// A storage proof of a predefined set of keys from the relay-chain.
///
/// The set of keys is TBD
/// Specifically this witness contains the data for:
///
/// - active host configuration as per the relay parent,
/// - the relay dispatch queue sizes
/// - the list of egress HRMP channels (in the list of recipients form)
/// - the metadata for the egress HRMP channels
pub relay_chain_state: sp_trie::StorageProof,
}
}