Interchain message-passing (#117)

* compute ingress and routing in polkadot runtime

* extract parent candidates from block when beginning consensus

* fetch incoming messages when validating

* fix consensus tests

* parachain wasm execution uses messages

* update parachain tests to check if messages are executed

* abstract out network service to make room for network tests

* skeleton for incoming data fetch

* collate ingress from consensus-gossip

* keep track of validated candidates in the shared-table

* add some shared_table tests for new behavior

* broadcast egress messages on gossip

* test compute_ingress

* move network tests to module folder

* dummy network for consensus-network tests

* make consensus network generic over executor

* test egress broadcast and ingress fetch

* fix test compilation

* address some grumbles

* address grumbles and fix parachain shuffle

* remove broadcast parameter from consensus network trait
This commit is contained in:
Robert Habermeier
2019-02-19 13:59:29 -03:00
committed by GitHub
parent da409f6c9e
commit f8af277006
26 changed files with 1733 additions and 368 deletions
@@ -58,7 +58,7 @@ impl ParachainContext for AdderContext {
fn produce_candidate<I: IntoIterator<Item=(ParaId, Message)>>(
&self,
last_head: HeadData,
_ingress: I,
ingress: I,
) -> Result<(BlockData, HeadData), InvalidHead>
{
let adder_head = AdderHead::decode(&mut &last_head.0[..])
@@ -79,7 +79,11 @@ impl ParachainContext for AdderContext {
add: adder_head.number % 100,
};
let next_head = ::adder::execute(adder_head.hash(), adder_head, &next_body)
let from_messages = ::adder::process_messages(
ingress.into_iter().map(|(_, msg)| msg.0)
);
let next_head = ::adder::execute(adder_head.hash(), adder_head, &next_body, from_messages)
.expect("good execution params; qed");
let encoded_head = HeadData(next_head.encode());