mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-29 10:17:57 +00:00
Move AuRa digest from client to primitives (#8245)
* Move AuRa digest from client to primitives This makes the digest stuff usable from inside the runtime ;) * Update primitives/runtime/src/generic/digest.rs Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com> * Review feedback * Make BABE use the new functionality Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
@@ -23,7 +23,7 @@ use super::{
|
||||
};
|
||||
use codec::{Codec, Decode, Encode};
|
||||
use sp_std::vec::Vec;
|
||||
use sp_runtime::{generic::OpaqueDigestItemId, DigestItem, RuntimeDebug};
|
||||
use sp_runtime::{DigestItem, RuntimeDebug};
|
||||
|
||||
use sp_consensus_vrf::schnorrkel::{Randomness, VRFOutput, VRFProof};
|
||||
|
||||
@@ -184,7 +184,7 @@ impl<Hash> CompatibleDigestItem for DigestItem<Hash> where
|
||||
}
|
||||
|
||||
fn as_babe_pre_digest(&self) -> Option<PreDigest> {
|
||||
self.try_to(OpaqueDigestItemId::PreRuntime(&BABE_ENGINE_ID))
|
||||
self.pre_runtime_try_to(&BABE_ENGINE_ID)
|
||||
}
|
||||
|
||||
fn babe_seal(signature: AuthoritySignature) -> Self {
|
||||
@@ -192,11 +192,11 @@ impl<Hash> CompatibleDigestItem for DigestItem<Hash> where
|
||||
}
|
||||
|
||||
fn as_babe_seal(&self) -> Option<AuthoritySignature> {
|
||||
self.try_to(OpaqueDigestItemId::Seal(&BABE_ENGINE_ID))
|
||||
self.seal_try_to(&BABE_ENGINE_ID)
|
||||
}
|
||||
|
||||
fn as_next_epoch_descriptor(&self) -> Option<NextEpochDescriptor> {
|
||||
self.try_to(OpaqueDigestItemId::Consensus(&BABE_ENGINE_ID))
|
||||
self.consensus_try_to(&BABE_ENGINE_ID)
|
||||
.and_then(|x: super::ConsensusLog| match x {
|
||||
super::ConsensusLog::NextEpochData(n) => Some(n),
|
||||
_ => None,
|
||||
@@ -204,7 +204,7 @@ impl<Hash> CompatibleDigestItem for DigestItem<Hash> where
|
||||
}
|
||||
|
||||
fn as_next_config_descriptor(&self) -> Option<NextConfigDescriptor> {
|
||||
self.try_to(OpaqueDigestItemId::Consensus(&BABE_ENGINE_ID))
|
||||
self.consensus_try_to(&BABE_ENGINE_ID)
|
||||
.and_then(|x: super::ConsensusLog| match x {
|
||||
super::ConsensusLog::NextConfigData(n) => Some(n),
|
||||
_ => None,
|
||||
|
||||
Reference in New Issue
Block a user