Minimal collation work-flow and necessary traits (#25)

* collator crate skeleton and description

* parachain primitives: proof -> witness and egress format

* collation of ingress queues through trait

* add ingress collation test

* structure for collated ingress

* add collated ingress to proposal

* witness -> proof

* ingress collation and candidate creation + code cleanup

* update collator lib to new definitions

* address formatting grumble
This commit is contained in:
Robert Habermeier
2017-12-13 15:04:58 +01:00
committed by GitHub
parent 55e74cd426
commit 9612e1d7c1
6 changed files with 268 additions and 1 deletions
+24
View File
@@ -81,4 +81,28 @@ mod tests {
]
}"#);
}
#[test]
fn test_body_serialization() {
assert_eq!(ser::to_string_pretty(&Body {
candidates: vec![
parachain::Candidate {
parachain_index: 10.into(),
collator_signature: Default::default(),
unprocessed_ingress: Default::default(),
block: ::parachain::BlockData(vec![1, 3, 5, 8]),
}
],
}), r#"{
"candidates": [
{
"parachainIndex": 10,
"collatorSignature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"unprocessedIngress": [],
"block": "0x01030508"
}
]
}"#);
}
}
+8 -1
View File
@@ -44,7 +44,7 @@ pub struct Candidate {
/// Unprocessed ingress queue.
///
/// Ordered by parachain ID and block number.
pub unprocessed_ingress: Vec<(u64, Vec<Message>)>,
pub unprocessed_ingress: ConsolidatedIngress,
/// Block data
pub block: BlockData,
}
@@ -53,6 +53,13 @@ pub struct Candidate {
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct Message(#[serde(with="bytes")] pub Vec<u8>);
/// Consolidated ingress queue data.
///
/// This is just an ordered vector of other parachains' egress queues,
/// obtained according to the routing rules.
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub struct ConsolidatedIngress(pub Vec<(Id, Vec<Message>)>);
/// Parachain block data.
///
/// contains everything required to validate para-block, may contain block and witness data