Unverified Commit e750a825 authored by Peter Goodspeed-Niklaus's avatar Peter Goodspeed-Niklaus Committed by GitHub
Browse files

implement collation generation subsystem (#1557)

* start sketching out a collation generation subsystem

* invent a basic strategy for double initialization

* clean up warnings

* impl util requests from runtime assuming a context instead of a FromJob sender

* implement collation generation algorithm from guide

* update AllMessages in tests

* fix trivial review comments

* remove another redundant declaration from merge

* filter availability cores by para_id

* handle new activations each in their own async task

* update guide according to the actual current implementation

* add initialization to guide

* add general-purpose subsystem_test_harness helper

* write first handle_new_activations test

* add test that handle_new_activations filters local_validation_data requests

* add (failing) test of collation distribution message sending

* rustfmt

* broken: work on fixing sender test

Unfortunately, for reasons that are not yet clear, despite the public key
and checked data being identical, the signer is not producing an identical
signature. This commit produces this output (among more):

signing with  Public(c4733ab0bbe3ba4c096685d1737a7f498cdbdd167a767d04a21dc7df12b8c858 (5GWHUNm5...))
checking with Public(c4733ab0bbe3ba4c096685d1737a7f498cdbdd167a767d04a21dc7df12b8c858 (5GWHUNm5...))
signed payload:  [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 10, 0, 0, 0, c7, e5, c0, 64, 7a, db, fe, 44, 81, e5, 51, 11, 79, 9f, a5, 63, 93, 94, 3c, c4, 36, c6, 30, 36, c2, c5, 44, a2, 1b, db, b7, 82, 3, 17, a, 2e, 75, 97, b7, b7, e3, d8, 4c, 5, 39, 1d, 13, 9a, 62, b1, 57, e7, 87, 86, d8, c0, 82, f2, 9d, cf, 4c, 11, 13, 14]
checked payload: [4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 10, 0, 0, 0, c7, e5, c0, 64, 7a, db, fe, 44, 81, e5, 51, 11, 79, 9f, a5, 63, 93, 94, 3c, c4, 36, c6, 30, 36, c2, c5, 44, a2, 1b, db, b7, 82, 3, 17, a, 2e, 75, 97, b7, b7, e3, d8, 4c, 5, 39, 1d, 13, 9a, 62, b1, 57, e7, 87, 86, d8, c0, 82, f2, 9d, cf, 4c, 11, 13, 14]

* fix broken test

* collation function returns commitments hash

It doesn't look like we use the actual commitments data anywhere, and
it's not obvious if there are any fields of `CandidateCommitments`
not available to the collator, so this commit just assigns them the
entire responsibility of generating the hash.

* add missing overseer impls

* calculating erasure coding is polkadot's responsibility, not cumulus

* concurrentize per-relay_parent requests
parent 474b72a5
Pipeline #104035 canceled with stages
in 5 minutes and 25 seconds
...@@ -4653,6 +4653,22 @@ dependencies = [ ...@@ -4653,6 +4653,22 @@ dependencies = [
"sp-runtime", "sp-runtime",
] ]
[[package]]
name = "polkadot-node-collation-generation"
version = "0.1.0"
dependencies = [
"derive_more 0.99.9",
"futures 0.3.5",
"log 0.4.11",
"polkadot-erasure-coding",
"polkadot-node-primitives",
"polkadot-node-subsystem",
"polkadot-node-subsystem-test-helpers",
"polkadot-node-subsystem-util",
"polkadot-primitives",
"sp-core",
]
[[package]] [[package]]
name = "polkadot-node-core-av-store" name = "polkadot-node-core-av-store"
version = "0.1.0" version = "0.1.0"
...@@ -4816,6 +4832,7 @@ dependencies = [ ...@@ -4816,6 +4832,7 @@ dependencies = [
name = "polkadot-node-primitives" name = "polkadot-node-primitives"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"futures 0.3.5",
"parity-scale-codec", "parity-scale-codec",
"polkadot-primitives", "polkadot-primitives",
"polkadot-statement-table", "polkadot-statement-table",
......
...@@ -44,6 +44,7 @@ members = [ ...@@ -44,6 +44,7 @@ members = [
"service", "service",
"validation", "validation",
"node/collation-generation",
"node/core/av-store", "node/core/av-store",
"node/core/backing", "node/core/backing",
"node/core/bitfield-signing", "node/core/bitfield-signing",
......
[package]
name = "polkadot-node-collation-generation"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
[dependencies]
derive_more = "0.99.9"
futures = "0.3.5"
log = "0.4.8"
polkadot-erasure-coding = { path = "../../erasure-coding" }
polkadot-node-primitives = { path = "../primitives" }
polkadot-node-subsystem = { path = "../subsystem" }
polkadot-node-subsystem-util = { path = "../subsystem-util" }
polkadot-primitives = { path = "../../primitives" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
[dev-dependencies]
polkadot-node-subsystem-test-helpers = { path = "../subsystem-test-helpers" }
This diff is collapsed.
...@@ -145,7 +145,6 @@ fn main() { ...@@ -145,7 +145,6 @@ fn main() {
candidate_validation: Subsystem2, candidate_validation: Subsystem2,
candidate_backing: Subsystem1, candidate_backing: Subsystem1,
candidate_selection: DummySubsystem, candidate_selection: DummySubsystem,
collator_protocol: DummySubsystem,
statement_distribution: DummySubsystem, statement_distribution: DummySubsystem,
availability_distribution: DummySubsystem, availability_distribution: DummySubsystem,
bitfield_signing: DummySubsystem, bitfield_signing: DummySubsystem,
...@@ -156,6 +155,8 @@ fn main() { ...@@ -156,6 +155,8 @@ fn main() {
availability_store: DummySubsystem, availability_store: DummySubsystem,
network_bridge: DummySubsystem, network_bridge: DummySubsystem,
chain_api: DummySubsystem, chain_api: DummySubsystem,
collation_generation: DummySubsystem,
collator_protocol: DummySubsystem,
}; };
let (overseer, _handler) = Overseer::new( let (overseer, _handler) = Overseer::new(
vec![], vec![],
......
...@@ -78,8 +78,8 @@ use polkadot_subsystem::messages::{ ...@@ -78,8 +78,8 @@ use polkadot_subsystem::messages::{
CandidateValidationMessage, CandidateBackingMessage, CandidateValidationMessage, CandidateBackingMessage,
CandidateSelectionMessage, ChainApiMessage, StatementDistributionMessage, CandidateSelectionMessage, ChainApiMessage, StatementDistributionMessage,
AvailabilityDistributionMessage, BitfieldSigningMessage, BitfieldDistributionMessage, AvailabilityDistributionMessage, BitfieldSigningMessage, BitfieldDistributionMessage,
ProvisionerMessage, PoVDistributionMessage, RuntimeApiMessage, CollatorProtocolMessage, ProvisionerMessage, PoVDistributionMessage, RuntimeApiMessage,
AvailabilityStoreMessage, NetworkBridgeMessage, AllMessages, AvailabilityStoreMessage, NetworkBridgeMessage, AllMessages, CollationGenerationMessage, CollatorProtocolMessage,
}; };
pub use polkadot_subsystem::{ pub use polkadot_subsystem::{
Subsystem, SubsystemContext, OverseerSignal, FromOverseer, SubsystemError, SubsystemResult, Subsystem, SubsystemContext, OverseerSignal, FromOverseer, SubsystemError, SubsystemResult,
...@@ -352,9 +352,6 @@ pub struct Overseer<S: SpawnNamed> { ...@@ -352,9 +352,6 @@ pub struct Overseer<S: SpawnNamed> {
/// A candidate selection subsystem. /// A candidate selection subsystem.
candidate_selection_subsystem: OverseenSubsystem<CandidateSelectionMessage>, candidate_selection_subsystem: OverseenSubsystem<CandidateSelectionMessage>,
/// A collator protocol subsystem
collator_protocol_subsystem: OverseenSubsystem<CollatorProtocolMessage>,
/// A statement distribution subsystem. /// A statement distribution subsystem.
statement_distribution_subsystem: OverseenSubsystem<StatementDistributionMessage>, statement_distribution_subsystem: OverseenSubsystem<StatementDistributionMessage>,
...@@ -382,9 +379,15 @@ pub struct Overseer<S: SpawnNamed> { ...@@ -382,9 +379,15 @@ pub struct Overseer<S: SpawnNamed> {
/// A network bridge subsystem. /// A network bridge subsystem.
network_bridge_subsystem: OverseenSubsystem<NetworkBridgeMessage>, network_bridge_subsystem: OverseenSubsystem<NetworkBridgeMessage>,
/// A Chain API subsystem /// A Chain API subsystem.
chain_api_subsystem: OverseenSubsystem<ChainApiMessage>, chain_api_subsystem: OverseenSubsystem<ChainApiMessage>,
/// A Collation Generation subsystem.
collation_generation_subsystem: OverseenSubsystem<CollationGenerationMessage>,
/// A Collator Protocol subsystem.
collator_protocol_subsystem: OverseenSubsystem<CollatorProtocolMessage>,
/// Spawner to spawn tasks to. /// Spawner to spawn tasks to.
s: S, s: S,
...@@ -417,15 +420,13 @@ pub struct Overseer<S: SpawnNamed> { ...@@ -417,15 +420,13 @@ pub struct Overseer<S: SpawnNamed> {
/// ///
/// [`Subsystem`]: trait.Subsystem.html /// [`Subsystem`]: trait.Subsystem.html
/// [`DummySubsystem`]: struct.DummySubsystem.html /// [`DummySubsystem`]: struct.DummySubsystem.html
pub struct AllSubsystems<CV, CB, CS, CP, SD, AD, BS, BD, P, PoVD, RA, AS, NB, CA> { pub struct AllSubsystems<CV, CB, CS, SD, AD, BS, BD, P, PoVD, RA, AS, NB, CA, CG, CP> {
/// A candidate validation subsystem. /// A candidate validation subsystem.
pub candidate_validation: CV, pub candidate_validation: CV,
/// A candidate backing subsystem. /// A candidate backing subsystem.
pub candidate_backing: CB, pub candidate_backing: CB,
/// A candidate selection subsystem. /// A candidate selection subsystem.
pub candidate_selection: CS, pub candidate_selection: CS,
/// A collator protocol subsystem.
pub collator_protocol: CP,
/// A statement distribution subsystem. /// A statement distribution subsystem.
pub statement_distribution: SD, pub statement_distribution: SD,
/// An availability distribution subsystem. /// An availability distribution subsystem.
...@@ -446,6 +447,10 @@ pub struct AllSubsystems<CV, CB, CS, CP, SD, AD, BS, BD, P, PoVD, RA, AS, NB, CA ...@@ -446,6 +447,10 @@ pub struct AllSubsystems<CV, CB, CS, CP, SD, AD, BS, BD, P, PoVD, RA, AS, NB, CA
pub network_bridge: NB, pub network_bridge: NB,
/// A Chain API subsystem. /// A Chain API subsystem.
pub chain_api: CA, pub chain_api: CA,
/// A Collation Generation subsystem.
pub collation_generation: CG,
/// A Collator Protocol subsystem.
pub collator_protocol: CP,
} }
impl<S> Overseer<S> impl<S> Overseer<S>
...@@ -518,7 +523,6 @@ where ...@@ -518,7 +523,6 @@ where
/// candidate_validation: ValidationSubsystem, /// candidate_validation: ValidationSubsystem,
/// candidate_backing: DummySubsystem, /// candidate_backing: DummySubsystem,
/// candidate_selection: DummySubsystem, /// candidate_selection: DummySubsystem,
/// collator_protocol: DummySubsystem,
/// statement_distribution: DummySubsystem, /// statement_distribution: DummySubsystem,
/// availability_distribution: DummySubsystem, /// availability_distribution: DummySubsystem,
/// bitfield_signing: DummySubsystem, /// bitfield_signing: DummySubsystem,
...@@ -529,6 +533,8 @@ where ...@@ -529,6 +533,8 @@ where
/// availability_store: DummySubsystem, /// availability_store: DummySubsystem,
/// network_bridge: DummySubsystem, /// network_bridge: DummySubsystem,
/// chain_api: DummySubsystem, /// chain_api: DummySubsystem,
/// collation_generation: DummySubsystem,
/// collator_protocol: DummySubsystem,
/// }; /// };
/// let (overseer, _handler) = Overseer::new( /// let (overseer, _handler) = Overseer::new(
/// vec![], /// vec![],
...@@ -549,16 +555,15 @@ where ...@@ -549,16 +555,15 @@ where
/// # /// #
/// # }); } /// # }); }
/// ``` /// ```
pub fn new<CV, CB, CS, CP, SD, AD, BS, BD, P, PoVD, RA, AS, NB, CA>( pub fn new<CV, CB, CS, SD, AD, BS, BD, P, PoVD, RA, AS, NB, CA, CG, CP>(
leaves: impl IntoIterator<Item = BlockInfo>, leaves: impl IntoIterator<Item = BlockInfo>,
all_subsystems: AllSubsystems<CV, CB, CS, CP, SD, AD, BS, BD, P, PoVD, RA, AS, NB, CA>, all_subsystems: AllSubsystems<CV, CB, CS, SD, AD, BS, BD, P, PoVD, RA, AS, NB, CA, CG, CP>,
mut s: S, mut s: S,
) -> SubsystemResult<(Self, OverseerHandler)> ) -> SubsystemResult<(Self, OverseerHandler)>
where where
CV: Subsystem<OverseerSubsystemContext<CandidateValidationMessage>> + Send, CV: Subsystem<OverseerSubsystemContext<CandidateValidationMessage>> + Send,
CB: Subsystem<OverseerSubsystemContext<CandidateBackingMessage>> + Send, CB: Subsystem<OverseerSubsystemContext<CandidateBackingMessage>> + Send,
CS: Subsystem<OverseerSubsystemContext<CandidateSelectionMessage>> + Send, CS: Subsystem<OverseerSubsystemContext<CandidateSelectionMessage>> + Send,
CP: Subsystem<OverseerSubsystemContext<CollatorProtocolMessage>> + Send,
SD: Subsystem<OverseerSubsystemContext<StatementDistributionMessage>> + Send, SD: Subsystem<OverseerSubsystemContext<StatementDistributionMessage>> + Send,
AD: Subsystem<OverseerSubsystemContext<AvailabilityDistributionMessage>> + Send, AD: Subsystem<OverseerSubsystemContext<AvailabilityDistributionMessage>> + Send,
BS: Subsystem<OverseerSubsystemContext<BitfieldSigningMessage>> + Send, BS: Subsystem<OverseerSubsystemContext<BitfieldSigningMessage>> + Send,
...@@ -569,6 +574,8 @@ where ...@@ -569,6 +574,8 @@ where
AS: Subsystem<OverseerSubsystemContext<AvailabilityStoreMessage>> + Send, AS: Subsystem<OverseerSubsystemContext<AvailabilityStoreMessage>> + Send,
NB: Subsystem<OverseerSubsystemContext<NetworkBridgeMessage>> + Send, NB: Subsystem<OverseerSubsystemContext<NetworkBridgeMessage>> + Send,
CA: Subsystem<OverseerSubsystemContext<ChainApiMessage>> + Send, CA: Subsystem<OverseerSubsystemContext<ChainApiMessage>> + Send,
CG: Subsystem<OverseerSubsystemContext<CollationGenerationMessage>> + Send,
CP: Subsystem<OverseerSubsystemContext<CollatorProtocolMessage>> + Send,
{ {
let (events_tx, events_rx) = mpsc::channel(CHANNEL_CAPACITY); let (events_tx, events_rx) = mpsc::channel(CHANNEL_CAPACITY);
...@@ -600,13 +607,6 @@ where ...@@ -600,13 +607,6 @@ where
all_subsystems.candidate_selection, all_subsystems.candidate_selection,
)?; )?;
let collator_protocol_subsystem = spawn(
&mut s,
&mut running_subsystems,
&mut running_subsystems_rx,
all_subsystems.collator_protocol,
)?;
let statement_distribution_subsystem = spawn( let statement_distribution_subsystem = spawn(
&mut s, &mut s,
&mut running_subsystems, &mut running_subsystems,
...@@ -677,6 +677,21 @@ where ...@@ -677,6 +677,21 @@ where
all_subsystems.chain_api, all_subsystems.chain_api,
)?; )?;
let collation_generation_subsystem = spawn(
&mut s,
&mut running_subsystems,
&mut running_subsystems_rx,
all_subsystems.collation_generation,
)?;
let collator_protocol_subsystem = spawn(
&mut s,
&mut running_subsystems,
&mut running_subsystems_rx,
all_subsystems.collator_protocol,
)?;
let active_leaves = HashSet::new(); let active_leaves = HashSet::new();
let leaves = leaves let leaves = leaves
...@@ -688,7 +703,6 @@ where ...@@ -688,7 +703,6 @@ where
candidate_validation_subsystem, candidate_validation_subsystem,
candidate_backing_subsystem, candidate_backing_subsystem,
candidate_selection_subsystem, candidate_selection_subsystem,
collator_protocol_subsystem,
statement_distribution_subsystem, statement_distribution_subsystem,
availability_distribution_subsystem, availability_distribution_subsystem,
bitfield_signing_subsystem, bitfield_signing_subsystem,
...@@ -699,6 +713,8 @@ where ...@@ -699,6 +713,8 @@ where
availability_store_subsystem, availability_store_subsystem,
network_bridge_subsystem, network_bridge_subsystem,
chain_api_subsystem, chain_api_subsystem,
collation_generation_subsystem,
collator_protocol_subsystem,
s, s,
running_subsystems, running_subsystems,
running_subsystems_rx, running_subsystems_rx,
...@@ -724,10 +740,6 @@ where ...@@ -724,10 +740,6 @@ where
let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
} }
if let Some(ref mut s) = self.collator_protocol_subsystem.instance {
let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
}
if let Some(ref mut s) = self.statement_distribution_subsystem.instance { if let Some(ref mut s) = self.statement_distribution_subsystem.instance {
let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
} }
...@@ -768,6 +780,14 @@ where ...@@ -768,6 +780,14 @@ where
let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await; let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
} }
if let Some(ref mut s) = self.collator_protocol_subsystem.instance {
let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
}
if let Some(ref mut s) = self.collation_generation_subsystem.instance {
let _ = s.tx.send(FromOverseer::Signal(OverseerSignal::Conclude)).await;
}
let mut stop_delay = Delay::new(Duration::from_secs(STOP_DELAY)).fuse(); let mut stop_delay = Delay::new(Duration::from_secs(STOP_DELAY)).fuse();
loop { loop {
...@@ -889,10 +909,6 @@ where ...@@ -889,10 +909,6 @@ where
s.tx.send(FromOverseer::Signal(signal.clone())).await?; s.tx.send(FromOverseer::Signal(signal.clone())).await?;
} }
if let Some(ref mut s) = self.collator_protocol_subsystem.instance {
s.tx.send(FromOverseer::Signal(signal.clone())).await?;
}
if let Some(ref mut s) = self.statement_distribution_subsystem.instance { if let Some(ref mut s) = self.statement_distribution_subsystem.instance {
s.tx.send(FromOverseer::Signal(signal.clone())).await?; s.tx.send(FromOverseer::Signal(signal.clone())).await?;
} }
...@@ -930,7 +946,15 @@ where ...@@ -930,7 +946,15 @@ where
} }
if let Some(ref mut s) = self.chain_api_subsystem.instance { if let Some(ref mut s) = self.chain_api_subsystem.instance {
s.tx.send(FromOverseer::Signal(signal)).await?; s.tx.send(FromOverseer::Signal(signal.clone())).await?;
}
if let Some(ref mut s) = self.collator_protocol_subsystem.instance {
s.tx.send(FromOverseer::Signal(signal.clone())).await?;
}
if let Some(ref mut s) = self.collation_generation_subsystem.instance {
s.tx.send(FromOverseer::Signal(signal.clone())).await?;
} }
Ok(()) Ok(())
...@@ -953,11 +977,6 @@ where ...@@ -953,11 +977,6 @@ where
let _ = s.tx.send(FromOverseer::Communication { msg }).await; let _ = s.tx.send(FromOverseer::Communication { msg }).await;
} }
} }
AllMessages::CollatorProtocol(msg) => {
if let Some(ref mut s) = self.collator_protocol_subsystem.instance {
let _ = s.tx.send(FromOverseer::Communication { msg }).await;
}
}
AllMessages::StatementDistribution(msg) => { AllMessages::StatementDistribution(msg) => {
if let Some(ref mut s) = self.statement_distribution_subsystem.instance { if let Some(ref mut s) = self.statement_distribution_subsystem.instance {
let _ = s.tx.send(FromOverseer::Communication { msg }).await; let _ = s.tx.send(FromOverseer::Communication { msg }).await;
...@@ -1008,6 +1027,16 @@ where ...@@ -1008,6 +1027,16 @@ where
let _ = s.tx.send(FromOverseer::Communication { msg }).await; let _ = s.tx.send(FromOverseer::Communication { msg }).await;
} }
} }
AllMessages::CollationGeneration(msg) => {
if let Some(ref mut s) = self.collation_generation_subsystem.instance {
let _ = s.tx.send(FromOverseer::Communication { msg }).await;
}
}
AllMessages::CollatorProtocol(msg) => {
if let Some(ref mut s) = self.collator_protocol_subsystem.instance {
let _ = s.tx.send(FromOverseer::Communication { msg }).await;
}
}
} }
} }
...@@ -1169,7 +1198,6 @@ mod tests { ...@@ -1169,7 +1198,6 @@ mod tests {
candidate_validation: TestSubsystem1(s1_tx), candidate_validation: TestSubsystem1(s1_tx),
candidate_backing: TestSubsystem2(s2_tx), candidate_backing: TestSubsystem2(s2_tx),
candidate_selection: DummySubsystem, candidate_selection: DummySubsystem,
collator_protocol: DummySubsystem,
statement_distribution: DummySubsystem, statement_distribution: DummySubsystem,
availability_distribution: DummySubsystem, availability_distribution: DummySubsystem,
bitfield_signing: DummySubsystem, bitfield_signing: DummySubsystem,
...@@ -1180,6 +1208,8 @@ mod tests { ...@@ -1180,6 +1208,8 @@ mod tests {
availability_store: DummySubsystem, availability_store: DummySubsystem,
network_bridge: DummySubsystem, network_bridge: DummySubsystem,
chain_api: DummySubsystem, chain_api: DummySubsystem,
collation_generation: DummySubsystem,
collator_protocol: DummySubsystem,
}; };
let (overseer, mut handler) = Overseer::new( let (overseer, mut handler) = Overseer::new(
vec![], vec![],
...@@ -1234,7 +1264,6 @@ mod tests { ...@@ -1234,7 +1264,6 @@ mod tests {
candidate_validation: TestSubsystem1(s1_tx), candidate_validation: TestSubsystem1(s1_tx),
candidate_backing: TestSubsystem4, candidate_backing: TestSubsystem4,
candidate_selection: DummySubsystem, candidate_selection: DummySubsystem,
collator_protocol: DummySubsystem,
statement_distribution: DummySubsystem, statement_distribution: DummySubsystem,
availability_distribution: DummySubsystem, availability_distribution: DummySubsystem,
bitfield_signing: DummySubsystem, bitfield_signing: DummySubsystem,
...@@ -1245,6 +1274,8 @@ mod tests { ...@@ -1245,6 +1274,8 @@ mod tests {
availability_store: DummySubsystem, availability_store: DummySubsystem,
network_bridge: DummySubsystem, network_bridge: DummySubsystem,
chain_api: DummySubsystem, chain_api: DummySubsystem,
collation_generation: DummySubsystem,
collator_protocol: DummySubsystem,
}; };
let (overseer, _handle) = Overseer::new( let (overseer, _handle) = Overseer::new(
vec![], vec![],
...@@ -1352,7 +1383,6 @@ mod tests { ...@@ -1352,7 +1383,6 @@ mod tests {
candidate_validation: TestSubsystem5(tx_5), candidate_validation: TestSubsystem5(tx_5),
candidate_backing: TestSubsystem6(tx_6), candidate_backing: TestSubsystem6(tx_6),
candidate_selection: DummySubsystem, candidate_selection: DummySubsystem,
collator_protocol: DummySubsystem,
statement_distribution: DummySubsystem, statement_distribution: DummySubsystem,
availability_distribution: DummySubsystem, availability_distribution: DummySubsystem,
bitfield_signing: DummySubsystem, bitfield_signing: DummySubsystem,
...@@ -1363,6 +1393,8 @@ mod tests { ...@@ -1363,6 +1393,8 @@ mod tests {
availability_store: DummySubsystem, availability_store: DummySubsystem,
network_bridge: DummySubsystem, network_bridge: DummySubsystem,
chain_api: DummySubsystem, chain_api: DummySubsystem,
collation_generation: DummySubsystem,
collator_protocol: DummySubsystem,
}; };
let (overseer, mut handler) = Overseer::new( let (overseer, mut handler) = Overseer::new(
vec![first_block], vec![first_block],
...@@ -1455,7 +1487,6 @@ mod tests { ...@@ -1455,7 +1487,6 @@ mod tests {
candidate_validation: TestSubsystem5(tx_5), candidate_validation: TestSubsystem5(tx_5),
candidate_backing: TestSubsystem6(tx_6), candidate_backing: TestSubsystem6(tx_6),
candidate_selection: DummySubsystem, candidate_selection: DummySubsystem,
collator_protocol: DummySubsystem,
statement_distribution: DummySubsystem, statement_distribution: DummySubsystem,
availability_distribution: DummySubsystem, availability_distribution: DummySubsystem,
bitfield_signing: DummySubsystem, bitfield_signing: DummySubsystem,
...@@ -1466,6 +1497,8 @@ mod tests { ...@@ -1466,6 +1497,8 @@ mod tests {
availability_store: DummySubsystem, availability_store: DummySubsystem,
network_bridge: DummySubsystem, network_bridge: DummySubsystem,
chain_api: DummySubsystem, chain_api: DummySubsystem,
collation_generation: DummySubsystem,
collator_protocol: DummySubsystem,
}; };
// start with two forks of different height. // start with two forks of different height.
let (overseer, mut handler) = Overseer::new( let (overseer, mut handler) = Overseer::new(
......
...@@ -6,6 +6,7 @@ edition = "2018" ...@@ -6,6 +6,7 @@ edition = "2018"
description = "Primitives types for the Node-side" description = "Primitives types for the Node-side"
[dependencies] [dependencies]
futures = "0.3.5"
polkadot-primitives = { path = "../../primitives" } polkadot-primitives = { path = "../../primitives" }
polkadot-statement-table = { path = "../../statement-table" } polkadot-statement-table = { path = "../../statement-table" }
parity-scale-codec = { version = "1.3.4", default-features = false, features = ["derive"] } parity-scale-codec = { version = "1.3.4", default-features = false, features = ["derive"] }
......
...@@ -20,12 +20,13 @@ ...@@ -20,12 +20,13 @@
//! not shared between the node and the runtime. This crate builds on top of the primitives defined //! not shared between the node and the runtime. This crate builds on top of the primitives defined
//! there. //! there.
use futures::Future;
use parity_scale_codec::{Decode, Encode}; use parity_scale_codec::{Decode, Encode};
use polkadot_primitives::v1::{ use polkadot_primitives::v1::{
Hash, CommittedCandidateReceipt, CandidateReceipt, CompactStatement, Hash, CommittedCandidateReceipt, CandidateReceipt, CompactStatement,
EncodeAs, Signed, SigningContext, ValidatorIndex, ValidatorId, EncodeAs, Signed, SigningContext, ValidatorIndex, ValidatorId,
UpwardMessage, Balance, ValidationCode, GlobalValidationData, LocalValidationData, UpwardMessage, Balance, ValidationCode, GlobalValidationData, LocalValidationData,
HeadData, HeadData, PoV, CollatorPair, Id as ParaId,
}; };
use polkadot_statement_table::{ use polkadot_statement_table::{
generic::{ generic::{
...@@ -258,3 +259,39 @@ impl std::convert::TryFrom<FromTableMisbehavior> for MisbehaviorReport { ...@@ -258,3 +259,39 @@ impl std::convert::TryFrom<FromTableMisbehavior> for MisbehaviorReport {
} }
} }
} }
/// The output of a collator.
///
/// This differs from `CandidateCommitments` in two ways:
///
/// - does not contain the erasure root; that's computed at the Polkadot level, not at Cumulus
/// - contains a proof of validity.
#[derive(Clone, Encode, Decode)]
pub struct Collation {
/// Fees paid from the chain to the relay chain validators.
pub fees: Balance,
/// Messages destined to be interpreted by the Relay chain itself.
pub upward_messages: Vec<UpwardMessage>,
/// New validation code.
pub new_validation_code: Option<ValidationCode>,
/// The head-data produced as a result of execution.
pub head_data: HeadData,
/// Proof that this block is valid.
pub proof_of_validity: PoV,
}