Generic authorship and uncle inclusion module (#2941)

* generalized uncle processing

* add some uncle tests

* set author and do event handling

* OnePerAuthorPerHeight no longer O(n^2) and test

* bump impl_version of node

* Documentation and style fixes

Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com>

* fix #2949: index-based FindAuthor wrapper for srml-session

* use for_each_tuple
This commit is contained in:
Robert Habermeier
2019-06-26 12:24:58 +02:00
committed by GitHub
parent 050377d1c0
commit 0ddf4a2a00
9 changed files with 705 additions and 3 deletions
+1
View File
@@ -64,6 +64,7 @@ pub use self::hashable::Hashable;
pub use self::dispatch::{Parameter, Dispatchable, Callable, IsSubType};
pub use self::double_map::StorageDoubleMapWithHasher;
pub use runtime_io::{print, storage_root};
pub use runtime_primitives::ConsensusEngineId;
/// Macro for easily creating a new implementation of the `Get` trait. Use similarly to
/// how you would declare a `const`:
+15
View File
@@ -23,6 +23,7 @@ use crate::codec::{Codec, Encode, Decode};
use crate::runtime_primitives::traits::{
MaybeSerializeDebug, SimpleArithmetic
};
use crate::runtime_primitives::ConsensusEngineId;
use super::for_each_tuple;
@@ -102,6 +103,20 @@ impl<T> MakePayment<T> for () {
fn make_payment(_: &T, _: usize) -> Result<(), &'static str> { Ok(()) }
}
/// A trait for finding the author of a block header based on the `PreRuntime` digests contained
/// within it.
pub trait FindAuthor<Author> {
/// Find the author of a block based on the pre-runtime digests.
fn find_author<'a, I>(digests: I) -> Option<Author>
where I: 'a + IntoIterator<Item=(ConsensusEngineId, &'a [u8])>;
}
/// A trait for verifying the seal of a header and returning the author.
pub trait VerifySeal<Header, Author> {
/// Verify a header and return the author, if any.
fn verify_seal(header: &Header) -> Result<Option<Author>, &'static str>;
}
/// Handler for when some currency "account" decreased in balance for
/// some reason.
///