Implement basic upward & downward messages (#118)

* Start by replacing branch names and set `DownwardMessage`

* Add the upward-message crate

* Add Kusama & Polkadot

* More work on getting the upward messages working

* Fix build

* Begin to integrate it into the test Parachain

* Update

* Make everything compile again

* Switch to westend and print parachain account on startup

* Use MultiSignature etc

* Fix validate block

* Some downward messages work

* Update git reference

* More downward messages integration

* Update test runtime for downward messages

* Enable downward message handler and withdraw send tokens

* Add some docs

* Begin to implement simple XCMP

* More work

* Fixes and make parachain id configurable

* Make parachain ID be part of the genesis

* Finishing the XCMP message demo

* Update and fixes tests

* Update branch
This commit is contained in:
Bastian Köcher
2020-06-18 12:10:20 +02:00
committed by GitHub
parent b082e7f815
commit 62c22b88b9
30 changed files with 1037 additions and 391 deletions
+42
View File
@@ -0,0 +1,42 @@
// Copyright 2020 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Substrate 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.
// Substrate 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 Cumulus. If not, see <http://www.gnu.org/licenses/>.
//! XMCP related primitives
use polkadot_primitives::parachain::Id as ParaId;
use sp_std::vec::Vec;
/// A raw XCMP message that is being send between two Parachain's.
#[derive(codec::Encode, codec::Decode)]
pub struct RawXCMPMessage {
/// Parachain sending the message.
pub from: ParaId,
/// SCALE encoded message.
pub data: Vec<u8>,
}
/// Something that can handle XCMP messages.
#[impl_trait_for_tuples::impl_for_tuples(30)]
pub trait XCMPMessageHandler<Message: codec::Decode> {
/// Handle a XCMP message.
fn handle_xcmp_message(src: ParaId, msg: &Message);
}
/// Something that can send XCMP messages.
pub trait XCMPMessageSender<Message: codec::Encode> {
/// Send a XCMP message to the given parachain.
fn send_xcmp_message(dest: ParaId, msg: &Message) -> Result<(), ()>;
}