From 2b798f857153eb9b4c3ce76295c5a5cfcad18abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Wed, 7 Oct 2020 13:29:00 +0200 Subject: [PATCH] Use `Pin>` for collation future (#1792) --- polkadot/node/collation-generation/src/lib.rs | 2 +- polkadot/node/overseer/src/lib.rs | 2 +- polkadot/node/primitives/src/lib.rs | 3 ++- .../src/node/collators/collation-generation.md | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/polkadot/node/collation-generation/src/lib.rs b/polkadot/node/collation-generation/src/lib.rs index 9620b723af..d51e5bb78b 100644 --- a/polkadot/node/collation-generation/src/lib.rs +++ b/polkadot/node/collation-generation/src/lib.rs @@ -407,7 +407,7 @@ mod tests { Arc::new(CollationGenerationConfig { key: CollatorPair::generate().0, collator: Box::new(|_: Hash, _vd: &ValidationData| { - Box::new(TestCollator) + TestCollator.boxed() }), para_id: para_id.into(), }) diff --git a/polkadot/node/overseer/src/lib.rs b/polkadot/node/overseer/src/lib.rs index 1a5cae70cc..0318cad34b 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(|_, _| TestCollator.boxed()), para_id: Default::default(), }) } diff --git a/polkadot/node/primitives/src/lib.rs b/polkadot/node/primitives/src/lib.rs index 8079c3363f..e961112be1 100644 --- a/polkadot/node/primitives/src/lib.rs +++ b/polkadot/node/primitives/src/lib.rs @@ -35,6 +35,7 @@ use polkadot_statement_table::{ }, v1::Misbehavior as TableMisbehavior, }; +use std::pin::Pin; pub use sp_core::traits::SpawnNamed; @@ -289,7 +290,7 @@ pub struct CollationGenerationConfig { /// 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>, + pub collator: Box Pin> + 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 4aeb42f9ea..5863a4989e 100644 --- a/polkadot/roadmap/implementers-guide/src/node/collators/collation-generation.md +++ b/polkadot/roadmap/implementers-guide/src/node/collators/collation-generation.md @@ -39,7 +39,7 @@ struct CollationGenerationConfig { /// 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>>> + collator: Box Pin>>>> para_id: ParaId, } ```