Collators get incoming parachain messages (#149)

* refactor out a consensus data fetcher from table router

* move statement checking logic into router

* refuse to start authority if collator

* support building the table router asynchronously

* instantiate_consensus does not overwrite old

* update key in new consensus if there was none before

* collator collects ingress from network

* test produced egress roots

* fix adder-collator compilation

* address first grumbles

* integrate new gossip with collator network launch

* address review
This commit is contained in:
Robert Habermeier
2019-03-22 00:48:36 +01:00
committed by GitHub
parent 67275abe30
commit 454ddf8921
16 changed files with 960 additions and 657 deletions
@@ -33,7 +33,7 @@ use std::sync::Arc;
use adder::{HeadData as AdderHead, BlockData as AdderBody};
use substrate_primitives::{Pair as PairT, ed25519::Pair};
use parachain::codec::{Encode, Decode};
use primitives::parachain::{HeadData, BlockData, Id as ParaId, Message};
use primitives::parachain::{HeadData, BlockData, Id as ParaId, Message, Extrinsic};
use collator::{InvalidHead, ParachainContext, VersionInfo};
use parking_lot::Mutex;
@@ -59,7 +59,7 @@ impl ParachainContext for AdderContext {
&self,
last_head: HeadData,
ingress: I,
) -> Result<(BlockData, HeadData), InvalidHead>
) -> Result<(BlockData, HeadData, Extrinsic), InvalidHead>
{
let adder_head = AdderHead::decode(&mut &last_head.0[..])
.ok_or(InvalidHead)?;
@@ -93,7 +93,7 @@ impl ParachainContext for AdderContext {
next_head.number, next_body.state.overflowing_add(next_body.add).0);
db.insert(next_head.clone(), next_body);
Ok((encoded_body, encoded_head))
Ok((encoded_body, encoded_head, Extrinsic { outgoing_messages: Vec::new() }))
}
}