Update Cumulus for Parachains V1 (#224)

* Start with something

* Whatever

* Update

* MOARE

* Make cumulus-network compile and tests work

* Update more and fixes

* More stuff

* More fixes

* Make collator build

* Make test almost work

* Remove contracts runtime

* More test work

* Make service compile

* Fix test-service

* Fix test client

* More fixes

* Fix collator test

* Fix network tests (again)

* Make everything compile, finally

* Fix tests

* Update to latest masters

* Remove ignore

* Switch to different branch in polkadot for now

* Update reference

* Make it compile with latest changes

* Update collator/src/lib.rs

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>

* Update to latest upstream

* Update to latest master

* Fix test

Co-authored-by: Robert Habermeier <rphmeier@gmail.com>
This commit is contained in:
Bastian Köcher
2020-11-08 22:18:09 +01:00
committed by GitHub
parent 9512520b95
commit 76f9ecae47
87 changed files with 3815 additions and 17343 deletions
+13 -25
View File
@@ -25,18 +25,15 @@ pub use polkadot_core_primitives::DownwardMessage;
/// It is "generic" in such a way, that the actual message is encoded in the `data` field.
/// Besides the `data` it also holds the `origin` of the message.
pub use polkadot_parachain::primitives::UpwardMessage as GenericUpwardMessage;
pub use polkadot_parachain::primitives::{
Id as ParaId, ParachainDispatchOrigin as UpwardMessageOrigin,
pub use polkadot_parachain::primitives::{Id as ParaId, ValidationParams};
pub use polkadot_primitives::v1::{
PersistedValidationData, TransientValidationData, ValidationData,
};
#[cfg(feature = "std")]
pub mod genesis;
pub mod validation_function_params;
pub mod xcmp;
use codec::{Decode, Encode};
use sp_runtime::traits::Block as BlockT;
/// Identifiers and types related to Cumulus Inherents
pub mod inherents {
use sp_inherents::InherentIdentifier;
@@ -47,11 +44,10 @@ pub mod inherents {
/// The type of the inherent downward messages.
pub type DownwardMessagesType = sp_std::vec::Vec<crate::DownwardMessage>;
/// The identifier for the `validation_function_params` inherent.
pub const VALIDATION_FUNCTION_PARAMS_IDENTIFIER: InherentIdentifier = *b"valfunp0";
/// The identifier for the `set_validation_data` inherent.
pub const VALIDATION_DATA_IDENTIFIER: InherentIdentifier = *b"valfunp0";
/// The type of the inherent.
pub type ValidationFunctionParamsType =
crate::validation_function_params::ValidationFunctionParams;
pub type ValidationDataType = crate::ValidationData;
}
/// Well known keys for values in the storage.
@@ -61,11 +57,11 @@ pub mod well_known_keys {
/// The upward messages are stored as SCALE encoded `Vec<GenericUpwardMessage>`.
pub const UPWARD_MESSAGES: &'static [u8] = b":cumulus_upward_messages:";
/// Current validation function parameters.
pub const VALIDATION_FUNCTION_PARAMS: &'static [u8] = b":cumulus_validation_function_params";
/// Current validation data.
pub const VALIDATION_DATA: &'static [u8] = b":cumulus_validation_data:";
/// Code upgarde (set as appropriate by a pallet).
pub const NEW_VALIDATION_CODE: &'static [u8] = b":cumulus_new_validation_code";
pub const NEW_VALIDATION_CODE: &'static [u8] = b":cumulus_new_validation_code:";
/// The storage key for the processed downward messages.
///
@@ -80,16 +76,8 @@ pub trait DownwardMessageHandler {
fn handle_downward_message(msg: &DownwardMessage);
}
/// Something that can send upward messages.
pub trait UpwardMessageSender<UpwardMessage> {
/// Send an upward message to the relay chain.
///
/// Returns an error if sending failed.
fn send_upward_message(msg: &UpwardMessage, origin: UpwardMessageOrigin) -> Result<(), ()>;
}
/// The head data of the parachain, stored in the relay chain.
#[derive(Decode, Encode, Debug)]
pub struct HeadData<Block: BlockT> {
pub header: Block::Header,
/// A trait which is called when the validation data is set.
#[impl_trait_for_tuples::impl_for_tuples(30)]
pub trait OnValidationData {
fn on_validation_data(data: ValidationData);
}