Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
81d2237
Draft of new sessions
gavofyork Jun 5, 2019
4fc86da
Reintroduce tuple impls
gavofyork Jun 5, 2019
d24568a
Merge remote-tracking branch 'origin/master' into gav-new-sessions
gavofyork Jun 5, 2019
84f1f1c
Move staking module to new session API
gavofyork Jun 5, 2019
5c67469
More work on staking and grandpa.
gavofyork Jun 5, 2019
5acfa04
Use iterator to avoid cloning and tuple macro
gavofyork Jun 5, 2019
fde708d
Make runtime build again
gavofyork Jun 6, 2019
b9b7d42
Polish the OpaqueKeys devex
gavofyork Jun 6, 2019
445df61
Move consensus logic into system & aura.
gavofyork Jun 6, 2019
4db0062
Fix up system module
gavofyork Jun 6, 2019
6696c55
Get build mostly going. Stuck at service.rs
gavofyork Jun 6, 2019
dc9e8c6
Building again
gavofyork Jun 6, 2019
7da4b04
Update srml/staking/src/lib.rs
gavofyork Jun 7, 2019
e2a0f2e
Refactoring out Consensus module, AuthorityIdOf, &c.
gavofyork Jun 7, 2019
6440ca8
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 7, 2019
cfea92a
Refactored out DigestItem::AuthoritiesChanged. Building.
gavofyork Jun 7, 2019
d3de475
Remove tentative code
gavofyork Jun 7, 2019
a061fd7
Remove invalid comment
gavofyork Jun 7, 2019
7f303f9
Make Seal opaque and introduce nice methods for handling opaque items.
gavofyork Jun 7, 2019
a38084d
Merge remote-tracking branch 'origin/master' into gav-new-sessions
gavofyork Jun 7, 2019
f8b24e0
Start to use proper digest for Aura authorities tracking.
gavofyork Jun 8, 2019
fa47974
Fix up grandpa, remove system::Raw/Log
gavofyork Jun 8, 2019
dd93267
Refactor Grandpa to use new logging infrastructure.
gavofyork Jun 8, 2019
7a2b935
Building again
gavofyork Jun 8, 2019
4f9a5a3
Tidy up some AuthorityIds
gavofyork Jun 9, 2019
4871529
Expunge most of the rest of the AuthorityKey confusion.
gavofyork Jun 9, 2019
afeed88
Remove cruft
gavofyork Jun 9, 2019
d1d25e7
Untangle last of the `AuthorityId`s.
gavofyork Jun 9, 2019
bf081a5
Sort out finality_tracker
gavofyork Jun 9, 2019
77ec1ff
Refactor median getting
gavofyork Jun 9, 2019
a02de97
Apply suggestions from code review
Demi-Marie Jun 10, 2019
1cca243
Session tests works
gavofyork Jun 10, 2019
3bbd5ab
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 10, 2019
6101aae
Update core/sr-primitives/src/generic/digest.rs
gavofyork Jun 10, 2019
5827ab5
Session tests works
gavofyork Jun 10, 2019
f8fa160
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 10, 2019
8a9a4a5
Fix for staking from @dvc94ch
gavofyork Jun 10, 2019
9b4f1a4
log an error
gavofyork Jun 10, 2019
f650fe8
fix test runtime build
gavofyork Jun 10, 2019
ca4dda3
Some test fixes
gavofyork Jun 11, 2019
7b339ef
Fix build.
dvc94ch Jun 11, 2019
730b805
Move OpaqueKeys to primitives.
dvc94ch Jun 11, 2019
8203a7e
Staking mock update to new session api.
dvc94ch Jun 7, 2019
807c284
Use on_initialize instead of check_rotate_session.
dvc94ch Jun 11, 2019
ba4721f
Update tests to new staking api.
dvc94ch Jun 11, 2019
979f3b5
fixup mock
dvc94ch Jun 11, 2019
6e0cf27
Fix bond_extra_and_withdraw_unbonded_works.
dvc94ch Jun 11, 2019
4cafd87
Fix bond_with_little_staked_value_bounded_by_slot_stake.
dvc94ch Jun 11, 2019
4b5bd6b
Fix bond_with_no_staked_value.
dvc94ch Jun 11, 2019
48b0238
Fix change_controller_works.
dvc94ch Jun 11, 2019
379ddc9
Fix less_than_needed_candidates_works.
dvc94ch Jun 11, 2019
7990ce5
Fix multi_era_reward_should_work.
dvc94ch Jun 11, 2019
f3e7f97
Fix nominating_and_rewards_should_work.
dvc94ch Jun 11, 2019
94e58de
Fix nominators_also_get_slashed.
dvc94ch Jun 11, 2019
5404cbf
Fix phragmen_large_scale_test.
dvc94ch Jun 11, 2019
ff246dd
Fix phragmen_poc_works.
dvc94ch Jun 11, 2019
93843f9
Fix phragmen_score_should_be_accurate_on_large_stakes.
dvc94ch Jun 11, 2019
5cc1c44
Fix phragmen_should_not_overflow.
dvc94ch Jun 11, 2019
cfa5237
Fix reward_destination_works.
dvc94ch Jun 11, 2019
d90ffdc
Fix rewards_should_work.
dvc94ch Jun 11, 2019
8692b16
Fix sessions_and_eras_should_work.
dvc94ch Jun 11, 2019
5f1ad03
Fix slot_stake_is_least_staked_validator.
dvc94ch Jun 11, 2019
82946f5
Fix too_many_unbond_calls_should_not_work.
dvc94ch Jun 11, 2019
6b6acd5
Fix wrong_vote_is_null.
dvc94ch Jun 11, 2019
1822167
Fix runtime.
dvc94ch Jun 11, 2019
e87be9d
Fix wasm runtime build.
dvc94ch Jun 11, 2019
5f110d8
Update Cargo.lock
dvc94ch Jun 11, 2019
a5866a6
Fix warnings.
dvc94ch Jun 11, 2019
0378cff
Fix grandpa tests.
dvc94ch Jun 11, 2019
3f4b234
Fix test-runtime build.
dvc94ch Jun 11, 2019
71014e3
Fix template node build.
dvc94ch Jun 11, 2019
a97f98d
Fix stuff.
dvc94ch Jun 11, 2019
a75d3ad
Update Cargo.lock to fix CI
Demi-Marie Jun 11, 2019
3fb729b
Merge branch 'master' into gav-new-sessions
Demi-Marie Jun 12, 2019
cbd8437
Re-add missing AuRa logs
Demi-Marie Jun 12, 2019
99e58a7
Merge remote-tracking branch 'origin/master' into gav-new-sessions
gavofyork Jun 12, 2019
b8f6500
Update core/consensus/babe/src/digest.rs
gavofyork Jun 12, 2019
8c15101
Kill log trait and all that jazz.
gavofyork Jun 12, 2019
24d175c
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 12, 2019
aa0956a
Refactor staking tests.
dvc94ch Jun 12, 2019
f788794
Fix ci runtime wasm check.
dvc94ch Jun 12, 2019
91a0495
Line length 120.
dvc94ch Jun 12, 2019
0399856
Make tests build again
gavofyork Jun 12, 2019
6ef0cb9
Merge remote-tracking branch 'origin/gav-new-sessions' into gav-new-s…
gavofyork Jun 12, 2019
b777ba9
Remove trailing commas in function declarations
Demi-Marie Jun 12, 2019
df313e0
Fix type error
Demi-Marie Jun 12, 2019
26f4a2d
Merge remote-tracking branch 'origin/master' into gav-new-sessions
Demi-Marie Jun 12, 2019
988e94d
Fix compilation errors
Demi-Marie Jun 12, 2019
ae7cc46
Fix a test
gavofyork Jun 13, 2019
f82c155
Another couple of fixes
gavofyork Jun 13, 2019
f8af78d
Fix another test
gavofyork Jun 13, 2019
ea77d7d
More test fixes
gavofyork Jun 13, 2019
b6a5548
Another test fix
gavofyork Jun 13, 2019
bb19f0b
Merge branch 'master' into gav-new-sessions
gavofyork Jun 13, 2019
3fcb3a7
Bump runtime.
gavofyork Jun 13, 2019
03249cd
Wrap long line
gavofyork Jun 13, 2019
56f5ac1
Fix build, remove redundant code.
gavofyork Jun 13, 2019
db47886
Issue to track TODO
gavofyork Jun 13, 2019
6b44e5f
Leave the benchmark code alone.
gavofyork Jun 13, 2019
2e8c85f
Merge remote-tracking branch 'origin/master' into gav-new-sessions
gavofyork Jun 13, 2019
5beee4b
Fix missing `std::time::{Instant, Duration}`
Demi-Marie Jun 13, 2019
3ee9625
Indentation
gavofyork Jun 14, 2019
0ad33b9
Aura ConsensusLog as enum
gavofyork Jun 14, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge remote-tracking branch 'origin/master' into gav-new-sessions
  • Loading branch information
gavofyork committed Jun 7, 2019
commit a38084d03a74e76f913b7843796b7e6299ed7707
34 changes: 17 additions & 17 deletions core/consensus/aura/src/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@
//!
//! This implements the digests for AuRa, to allow the private
//! `CompatibleDigestItem` trait to appear in public interfaces.

use primitives::Pair;
use aura_primitives::AURA_ENGINE_ID;
use runtime_primitives::generic::DigestItem;
use parity_codec::{Encode, Decode};
use runtime_primitives::{
traits::DigestItem as DigestItemT, generic::{DigestItem, OpaqueDigestItemId}
};
use parity_codec::{Encode, Codec};
use std::fmt::Debug;

type Signature<P> = <P as Pair>::Signature;

/// A digest item which is usable with aura consensus.
pub trait CompatibleDigestItem<T: Pair>: Sized {
pub trait CompatibleDigestItem<P: Pair>: Sized {
/// Construct a digest item which contains a signature on the hash.
fn aura_seal(signature: Signature<T>) -> Self;
fn aura_seal(signature: Signature<P>) -> Self;

/// If this item is an Aura seal, return the signature.
fn as_aura_seal(&self) -> Option<&Signature<T>>;
fn as_aura_seal(&self) -> Option<Signature<P>>;

/// Construct a digest item which contains the slot number
fn aura_pre_digest(slot_num: u64) -> Self;
Expand All @@ -40,28 +44,24 @@ pub trait CompatibleDigestItem<T: Pair>: Sized {
fn as_aura_pre_digest(&self) -> Option<u64>;
}

impl<P, Hash> CompatibleDigestItem<P> for DigestItem<Hash, P::Signature>
where P: Pair, P::Signature: Clone + Encode + Decode,
impl<P, Hash> CompatibleDigestItem<P> for DigestItem<Hash> where
P: Pair,
Signature<P>: Codec,
Hash: Debug + Send + Sync + Eq + Clone + Codec + 'static
{
fn aura_seal(signature: Signature<P>) -> Self {
DigestItem::Seal(AURA_ENGINE_ID, signature)
DigestItem::Seal(AURA_ENGINE_ID, signature.encode())
}

fn as_aura_seal(&self) -> Option<&Signature<P>> {
match self {
DigestItem::Seal(AURA_ENGINE_ID, ref sig) => Some(sig),
_ => None,
}
fn as_aura_seal(&self) -> Option<Signature<P>> {
self.try_into(OpaqueDigestItemId::Seal(&AURA_ENGINE_ID))
}

fn aura_pre_digest(slot_num: u64) -> Self {
DigestItem::PreRuntime(AURA_ENGINE_ID, slot_num.encode())
}

fn as_aura_pre_digest(&self) -> Option<u64> {
match self {
DigestItem::PreRuntime(AURA_ENGINE_ID, ref buffer) => Decode::decode(&mut &buffer[..]),
_ => None,
}
self.try_into(OpaqueDigestItemId::PreRuntime(&AURA_ENGINE_ID))
}
}
6 changes: 3 additions & 3 deletions core/consensus/aura/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ pub fn start_aura<B, C, SC, E, I, P, SO, Error, H>(
C: ProvideRuntimeApi + ProvideCache<B> + AuxStore + Send + Sync,
C::Api: AuraApi<B, AuthorityId<P>>,
SC: SelectChain<B>,
generic::DigestItem<B::Hash, P::Signature>: DigestItem<Hash=B::Hash>,
generic::DigestItem<B::Hash>: DigestItem<Hash=B::Hash>,
E::Proposer: Proposer<B, Error=Error>,
<<E::Proposer as Proposer<B>>::Create as IntoFuture>::Future: Send + 'static,
P: Pair + Send + Sync + 'static,
P::Public: Hash + Member + Encode + Decode,
P::Signature: Hash + Member + Encode + Decode,
DigestItemFor<B>: CompatibleDigestItem<P>,
H: Header<
Digest=generic::Digest<generic::DigestItem<B::Hash, P::Signature>>,
Digest=generic::Digest<generic::DigestItem<B::Hash>>,
Hash=B::Hash,
>,
E: Environment<B, Error=Error>,
Expand Down Expand Up @@ -196,7 +196,7 @@ impl<H, B, C, E, I, P, Error, SO> SlotWorker<B> for AuraWorker<C, E, I, P, SO> w
E::Proposer: Proposer<B, Error=Error>,
<<E::Proposer as Proposer<B>>::Create as IntoFuture>::Future: Send + 'static,
H: Header<
Digest=generic::Digest<generic::DigestItem<B::Hash, P::Signature>>,
Digest=generic::Digest<generic::DigestItem<B::Hash>>,
Hash=B::Hash,
>,
I: BlockImport<B> + Send + Sync + 'static,
Expand Down
55 changes: 9 additions & 46 deletions core/consensus/babe/src/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

//! Private mplementation details of BABE digests.

use primitives::sr25519::{Public, Signature};
use babe_primitives::BABE_ENGINE_ID;
use runtime_primitives::generic::DigestItem;
use runtime_primitives::{
traits::DigestItem as DigestItemT, generic::{DigestItem, OpaqueDigestItemId}
};
use std::fmt::Debug;
use parity_codec::{Decode, Encode, Input};
use log::info;
use parity_codec::{Decode, Encode, Codec, Input};
use schnorrkel::{
vrf::{VRFProof, VRFOutput, VRF_OUTPUT_LENGTH, VRF_PROOF_LENGTH},
PUBLIC_KEY_LENGTH,
Expand Down Expand Up @@ -89,61 +91,22 @@ pub trait CompatibleDigestItem: Sized {
fn as_babe_seal(&self) -> Option<Signature>;
}

impl<Hash: Debug> CompatibleDigestItem for DigestItem<Hash, Vec<u8>>
impl<Hash> CompatibleDigestItem for DigestItem<Hash> where
Hash: Debug + Send + Sync + Eq + Clone + Codec + 'static
{
fn babe_pre_digest(digest: BabePreDigest) -> Self {
DigestItem::PreRuntime(BABE_ENGINE_ID, digest.encode())
}

fn as_babe_pre_digest(&self) -> Option<BabePreDigest> {
match self {
DigestItem::PreRuntime(BABE_ENGINE_ID, seal) => {
let decoded = Decode::decode(&mut &seal[..]);
if decoded.is_none() {
info!(target: "babe", "Failed to decode {:?}", seal)
}
decoded
}
_ => {
info!(target: "babe", "Invalid consensus: {:?}!", self);
None
}
}
self.try_into(OpaqueDigestItemId::PreRuntime(&BABE_ENGINE_ID))
}

fn babe_seal(signature: Signature) -> Self {
DigestItem::Seal(BABE_ENGINE_ID, signature.encode())
}

fn as_babe_seal(&self) -> Option<Signature> {
match self {
DigestItem::Seal(BABE_ENGINE_ID, signature) => Decode::decode(&mut &signature[..]),
_ => None,
}
}
}

impl<Hash: Debug> CompatibleDigestItem for DigestItem<Hash, Signature>
{
fn babe_pre_digest(digest: BabePreDigest) -> Self {
DigestItem::PreRuntime(BABE_ENGINE_ID, digest.encode())
}

fn as_babe_pre_digest(&self) -> Option<BabePreDigest> {
match self {
DigestItem::PreRuntime(BABE_ENGINE_ID, seal) => Decode::decode(&mut &seal[..]),
_ => None,
}
}

fn babe_seal(signature: Signature) -> Self {
DigestItem::Seal(BABE_ENGINE_ID, signature)
}

fn as_babe_seal(&self) -> Option<Signature> {
match self {
DigestItem::Seal(BABE_ENGINE_ID, signature) => Some(signature.clone()),
_ => None,
}
self.try_into(OpaqueDigestItemId::Seal(&BABE_ENGINE_ID))
}
}
8 changes: 4 additions & 4 deletions core/consensus/babe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use runtime_support::serde::{Serialize, Deserialize};
use parity_codec::{Decode, Encode};
use primitives::{
crypto::Pair,
sr25519::{Public, Signature, self},
sr25519::{Public, self},
};
use merlin::Transcript;
use inherents::{InherentDataProviders, InherentData};
Expand Down Expand Up @@ -183,12 +183,12 @@ pub fn start_babe<B, C, SC, E, I, SO, Error, H>(BabeParams {
C: ProvideRuntimeApi + ProvideCache<B>,
C::Api: BabeApi<B, Public>,
SC: SelectChain<B>,
generic::DigestItem<B::Hash, Signature>: DigestItem<Hash=B::Hash>,
generic::DigestItem<B::Hash>: DigestItem<Hash=B::Hash>,
E::Proposer: Proposer<B, Error=Error>,
<<E::Proposer as Proposer<B>>::Create as IntoFuture>::Future: Send + 'static,
DigestItemFor<B>: CompatibleDigestItem,
H: Header<
Digest=generic::Digest<generic::DigestItem<B::Hash, Signature>>,
Digest=generic::Digest<generic::DigestItem<B::Hash>>,
Hash=B::Hash,
>,
E: Environment<B, Error=Error>,
Expand Down Expand Up @@ -236,7 +236,7 @@ impl<Hash, H, B, C, E, I, Error, SO> SlotWorker<B> for BabeWorker<C, E, I, SO> w
for<'de> Deserialize<'de> + Debug + Default + AsRef<[u8]> + AsMut<[u8]> +
std::hash::Hash + Display + Send + Sync + 'static,
H: Header<
Digest=generic::Digest<generic::DigestItem<B::Hash, Signature>>,
Digest=generic::Digest<generic::DigestItem<B::Hash>>,
Hash=B::Hash,
>,
I: BlockImport<B> + Send + Sync + 'static,
Expand Down
148 changes: 148 additions & 0 deletions core/sr-primitives/src/generic/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ impl<Item> traits::Digest for Digest<Item> where
}
}

/*
/// Digest item that is able to encode/decode 'system' digest items and
/// provide opaque access to other items.
#[derive(PartialEq, Eq, Clone)]
Expand Down Expand Up @@ -88,6 +89,153 @@ pub enum DigestItem<Hash> {
/// Any 'non-system' digest item, opaque to the native code.
Other(Vec<u8>),
}
*/

// Macro black magic.
macro_rules! gen_digest_type {
(
$( #[doc = $main_docs:tt] )*
pub enum $main:ident $(<$($main_params: tt),+>)? { }
$(
$( #[doc = $doc_attr:tt] )*
pub enum $n:ident $(<$($t: tt),+>)? {
$(
$( #[doc = $variant_doc:tt] )*
$variant:ident(($($interior: ty),*), $q: tt),
)*
}
)+
) => {
$( #[doc = $main_docs] )*
#[derive(PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Debug))]
pub enum $main $(<$($main_params),+>)? {
$(
$(
$( #[doc = $variant_doc] )*
$variant($($interior),*),
)*
)*
}

gen_digest_type! {
@internal
$main : $main $(<$($main_params),+>)? => $(
$( #[doc = $doc_attr] )*
pub enum $n $(<$($t),+>)? {
$(
$( #[doc = $variant_doc] )*
$variant(($($interior),*), $q),
)*
}
)+
}
};
(
@internal
$main_id:tt : $main:ty => $(
$( #[doc = $doc_attr:tt] )*
pub enum $n:ident $(<$($t: tt),+>)? {
$(
$( #[doc = $variant_doc:tt] )*
$variant:ident(($($interior: ty),*), $q: tt),
)*
}
)+
) => {
$(
$( #[doc = $doc_attr] )*
#[derive(PartialEq, Eq, Clone)]
#[cfg_attr(feature = "std", derive(Debug))]
pub enum $n $(<$($t),+>)? {
$(
$( #[doc = $variant_doc] )*
$variant($($interior),*),
)*
}

impl<Hash> From<$n $(<$($t),*>)?>
for $main {
fn from(digest: $n $(<$($t),+>)?) -> Self {
match digest {
$(
$n::$variant $q => $main_id::$variant $q,
)*
}
}
}
)*
};
}

gen_digest_type! {
/// Digest item that is able to encode/decode 'system' digest items and
/// provide opaque access to other items.
///
/// For all variants that include a `ConsensusEngineId`, consensus engine
/// implementations **MUST** ignore digests that have a `ConsensusEngineId`
/// that is not theirs. Node implementations **MUST** reject digests that
/// have a `ConsensusEngineId` that corresponds to a consensus engine not in
/// use. Node implementations **MUST** reject blocks as malformed if they
/// reject any of the block’s digest. If the runtime supports this, the
/// node that issued the block **SHOULD** be reported as having committed
/// severe misbehavior and punished accordingly. The invalid block, or its
/// hash, **SHOULD** constitute adequate proof of such misbehavior.
pub enum DigestItem<Hash> {}

/// A digest item that can be produced by consensus engines. Consensus
/// engine implementations **MUST NOT** push digests not in this variant.
/// This **SHOULD** be detected at compile time. If it is not, the behavior
/// of the blockchain is undefined.
pub enum ConsensusDigest {
/// An inherent digest.
///
/// These are messages from the consensus engine to the runtime,
/// although the consensus engine can (and should) read them itself to
/// avoid code and state duplication. It is erroneous for a runtime to
/// produce these, but this is checked at compile time. Runtimes can
/// (and should) trust these, as with any other inherent. Consensus
/// engines MUST verify them.
PreRuntime((ConsensusEngineId, Vec<u8>), (a, b)),

/// Put a Seal on it. This **MUST** come after all other `DigestItem`
/// variants. There **MUST** be exactly one `Seal` per consensus engine,
/// and its `ConsensusEngineId` **MUST** be that of the consensus engine
/// that produced it. Runtimes will not see this variant.
Seal((ConsensusEngineId, Vec<u8>), (a, b)),
}

/// A digest item that can be produced by runtimes. Runtime mplementations
/// **MUST NOT** push digests not in this variant. This **SHOULD** be
/// detected at compile time. If it is not, the behavior of the blockchain
/// is undefined.
pub enum RuntimeDigest {
/// A message from the runtime to the consensus engine. This MUST NOT be
/// generated by the native code of any consensus engine, but this is
/// caught at compile time. The `ConsensusEngineId` is that of the
/// consensus engine for which this digest is intended. Consensus
/// engines MUST ignore digests with `ConsensusEngineId`s other than
/// their own.
Consensus((ConsensusEngineId, Vec<u8>), (a, b)),

/// Any 'non-system' digest item, opaque to the native code. Runtimes
/// MUST verify these, and reject any they did not produce. These MUST
/// NOT be produced by native code.
Other((Vec<u8>), (a)),
}

/// A digest item that is reserved for the SRML. Only the SRML is allowed to
/// push these digests. Consensus engines and third-party runtime code
/// **MUST NOT** push digests in this variant. This **SHOULD** be detected
/// at compile time. If it is not, the behavior of the blockchain is
/// undefined.
pub enum SystemDigest<Hash> {
/// System digest item that contains the root of changes trie at given
/// block. It is created for every block iff runtime supports changes
/// trie creation.
ChangesTrieRoot((Hash), (a)),
}
}

#[cfg(feature = "std")]
impl<Hash: Encode> ::serde::Serialize for DigestItem<Hash> {
Expand Down
4 changes: 3 additions & 1 deletion core/sr-primitives/src/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ pub use self::era::{Era, Phase};
pub use self::checked_extrinsic::CheckedExtrinsic;
pub use self::header::Header;
pub use self::block::{Block, SignedBlock, BlockId};
pub use self::digest::{Digest, DigestItem, DigestItemRef, OpaqueDigestItemId};
pub use self::digest::{
Digest, DigestItem, DigestItemRef, ConsensusDigest, RuntimeDigest, SystemDigest, OpaqueDigestItemId
};

use crate::codec::Encode;
use rstd::prelude::*;
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.