diff --git a/polkadot/node/collation-generation/src/lib.rs b/polkadot/node/collation-generation/src/lib.rs index f96abc4ccf..9620b723af 100644 --- a/polkadot/node/collation-generation/src/lib.rs +++ b/polkadot/node/collation-generation/src/lib.rs @@ -233,7 +233,7 @@ async fn handle_new_activations( ctx.spawn("collation generation collation builder", Box::pin(async move { let persisted_validation_data_hash = validation_data.persisted.hash(); - let collation = match (task_config.collator)(&validation_data).await { + let collation = match (task_config.collator)(relay_parent, &validation_data).await { Some(collation) => collation, None => { log::debug!( @@ -406,7 +406,7 @@ mod tests { fn test_config>(para_id: Id) -> Arc { Arc::new(CollationGenerationConfig { key: CollatorPair::generate().0, - collator: Box::new(|_vd: &ValidationData| { + collator: Box::new(|_: Hash, _vd: &ValidationData| { Box::new(TestCollator) }), para_id: para_id.into(), diff --git a/polkadot/node/overseer/src/lib.rs b/polkadot/node/overseer/src/lib.rs index 9ad1601c89..1a5cae70cc 100644 --- a/polkadot/node/overseer/src/lib.rs +++ b/polkadot/node/overseer/src/lib.rs @@ -1876,7 +1876,7 @@ mod tests { fn test_collator_generation_msg() -> CollationGenerationMessage { CollationGenerationMessage::Initialize(CollationGenerationConfig { key: CollatorPair::generate().0, - collator: Box::new(|_| Box::new(TestCollator)), + collator: Box::new(|_, _| Box::new(TestCollator)), para_id: Default::default(), }) } diff --git a/polkadot/node/primitives/src/lib.rs b/polkadot/node/primitives/src/lib.rs index e80eb5556f..8079c3363f 100644 --- a/polkadot/node/primitives/src/lib.rs +++ b/polkadot/node/primitives/src/lib.rs @@ -285,7 +285,11 @@ pub struct CollationGenerationConfig { /// Collator's authentication key, so it can sign things. pub key: CollatorPair, /// Collation function. - pub collator: Box Box> + Unpin + Send> + Send + Sync>, + /// + /// Will be called with the hash of the relay chain block the parachain + /// block should be build on and the [`ValidationData`] that provides + /// information about the state of the parachain on the relay chain. + pub collator: Box Box> + Unpin + Send> + Send + Sync>, /// The parachain that this collator collates for pub para_id: ParaId, } diff --git a/polkadot/roadmap/implementers-guide/src/node/collators/collation-generation.md b/polkadot/roadmap/implementers-guide/src/node/collators/collation-generation.md index 94d205b528..4aeb42f9ea 100644 --- a/polkadot/roadmap/implementers-guide/src/node/collators/collation-generation.md +++ b/polkadot/roadmap/implementers-guide/src/node/collators/collation-generation.md @@ -36,7 +36,10 @@ pub struct Collation { struct CollationGenerationConfig { key: CollatorPair, - collator: Box Box>>> + /// Collate will be called with the relay chain hash the parachain should build + /// a block on and the `ValidationData` that provides information about the state + /// of the parachain on the relay chain. + collator: Box Box>>> para_id: ParaId, } ```