Split BFT into substrate-bft and runtime-specific proposer logic (#72)

* reshuffle consensus libraries

* polkadot-useful type definitions for statement table

* begin BftService

* primary selection logic

* bft service implementation without I/O

* extract out `BlockImport` trait

* allow bft primitives to compile on wasm

* take polkadot-consensus down to the core.

* test for preemption

* fix test build
This commit is contained in:
Robert Habermeier
2018-02-15 14:20:18 +01:00
committed by GitHub
parent 8309fdd4b8
commit 03a51a0db8
31 changed files with 1395 additions and 1466 deletions
+9 -1
View File
@@ -53,6 +53,7 @@ pub trait Slicable: Sized {
}
/// Trait to mark that a type is not trivially (essentially "in place") serialisable.
// TODO: under specialization, remove this and simply specialize in place serializable types.
pub trait NonTrivialSlicable: Slicable {}
impl<T: EndianSensitive> Slicable for T {
@@ -213,6 +214,8 @@ macro_rules! tuple_impl {
self.0.using_encoded(f)
}
}
impl<$one: NonTrivialSlicable> NonTrivialSlicable for ($one,) { }
};
($first:ident, $($rest:ident,)+) => {
impl<$first: Slicable, $($rest: Slicable),+>
@@ -248,6 +251,11 @@ macro_rules! tuple_impl {
}
}
impl<$first: Slicable, $($rest: Slicable),+>
NonTrivialSlicable
for ($first, $($rest),+)
{ }
tuple_impl!($($rest,)+);
}
}
@@ -256,7 +264,7 @@ macro_rules! tuple_impl {
mod inner_tuple_impl {
use rstd::vec::Vec;
use super::{Input, Slicable};
use super::{Input, Slicable, NonTrivialSlicable};
tuple_impl!(A, B, C, D, E, F, G, H, I, J, K,);
}