Collator node workflow (#280)

* arbitrary application logic in CLI

* collation work

* split up exit and work futures in application

* collation node workflow

* typo

* indentation fix

* doc grumbles

* rename Application to Worker

* refactor Worker::exit to exit_only
This commit is contained in:
Robert Habermeier
2018-07-06 15:13:31 +01:00
committed by Sergey Pepyakin
parent 6bfcbd6d59
commit 24f7b548dc
13 changed files with 285 additions and 94 deletions
+16 -20
View File
@@ -134,26 +134,6 @@ impl Slicable for DutyRoster {
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub struct Extrinsic;
/// Candidate parachain block.
///
/// https://github.com/w3f/polkadot-spec/blob/master/spec.md#candidate-para-chain-block
#[derive(PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub struct Candidate {
/// The ID of the parachain this is a proposal for.
pub parachain_index: Id,
/// Collator's signature
pub collator_signature: CandidateSignature,
/// Unprocessed ingress queue.
///
/// Ordered by parachain ID and block number.
pub unprocessed_ingress: ConsolidatedIngress,
/// Block data
pub block: BlockData,
}
/// Candidate receipt type.
#[derive(PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
@@ -164,6 +144,8 @@ pub struct CandidateReceipt {
pub parachain_index: Id,
/// The collator's relay-chain account ID
pub collator: super::AccountId,
/// Signature on block data by collator.
pub signature: CandidateSignature,
/// The head-data
pub head_data: HeadData,
/// Balance uploads to the relay chain.
@@ -182,6 +164,7 @@ impl Slicable for CandidateReceipt {
self.parachain_index.using_encoded(|s| v.extend(s));
self.collator.using_encoded(|s| v.extend(s));
self.signature.using_encoded(|s| v.extend(s));
self.head_data.0.using_encoded(|s| v.extend(s));
self.balance_uploads.using_encoded(|s| v.extend(s));
self.egress_queue_roots.using_encoded(|s| v.extend(s));
@@ -195,6 +178,7 @@ impl Slicable for CandidateReceipt {
Some(CandidateReceipt {
parachain_index: Slicable::decode(input)?,
collator: Slicable::decode(input)?,
signature: Slicable::decode(input)?,
head_data: Slicable::decode(input).map(HeadData)?,
balance_uploads: Slicable::decode(input)?,
egress_queue_roots: Slicable::decode(input)?,
@@ -227,6 +211,18 @@ impl Ord for CandidateReceipt {
}
}
/// A full collation.
#[derive(PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]
#[cfg_attr(feature = "std", serde(rename_all = "camelCase"))]
#[cfg_attr(feature = "std", serde(deny_unknown_fields))]
pub struct Collation {
/// Block data.
pub block_data: BlockData,
/// Candidate receipt itself.
pub receipt: CandidateReceipt,
}
/// Parachain ingress queue message.
#[derive(PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Serialize, Deserialize, Debug))]