* Introduce CollatorFn type alias

* Make test-runtime imports consistent with rococo-runtime

* Update node/primitives/src/lib.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* fix warnings

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Sergei Shulepov
2020-11-09 15:21:05 +01:00
committed by GitHub
parent 83661eb8dc
commit 2026228b77
5 changed files with 56 additions and 43 deletions
@@ -16,12 +16,11 @@
//! Collator for the adder test parachain.
use std::{pin::Pin, sync::{Arc, Mutex}, collections::HashMap, time::Duration};
use std::{sync::{Arc, Mutex}, collections::HashMap, time::Duration};
use test_parachain_adder::{hash_state, BlockData, HeadData, execute};
use futures::{Future, FutureExt};
use futures_timer::Delay;
use polkadot_primitives::v1::{ValidationData, PoV, Hash, CollatorId, CollatorPair};
use polkadot_node_primitives::Collation;
use polkadot_primitives::v1::{PoV, CollatorId, CollatorPair};
use polkadot_node_primitives::{Collation, CollatorFn};
use codec::{Encode, Decode};
use sp_core::Pair;
@@ -116,7 +115,9 @@ impl Collator {
/// This collation function can be plugged into the overseer to generate collations for the adder parachain.
pub fn create_collation_function(
&self,
) -> Box<dyn Fn(Hash, &ValidationData) -> Pin<Box<dyn Future<Output = Option<Collation>> + Send>> + Send + Sync> {
) -> CollatorFn {
use futures::FutureExt as _;
let state = self.state.clone();
Box::new(move |relay_parent, validation_data| {
@@ -166,7 +167,7 @@ mod tests {
use futures::executor::block_on;
use polkadot_parachain::{primitives::ValidationParams, wasm_executor::ExecutionMode};
use polkadot_primitives::v1::PersistedValidationData;
use polkadot_primitives::v1::{ValidationData, PersistedValidationData};
use codec::Decode;
#[test]