mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 07:01:05 +00:00
Dispatch on-disabled digests from consensus modules (#3055)
* on-disable primitives for engines * dispatch on-disabled digests from SRML consensus * bump runtime versions * use find_map
This commit is contained in:
committed by
Gavin Wood
parent
3d72844710
commit
13b9e49688
@@ -31,7 +31,7 @@ use parity_codec::{Encode, Decode};
|
||||
use inherents::{RuntimeString, InherentIdentifier, InherentData, ProvideInherent, MakeFatalError};
|
||||
#[cfg(feature = "std")]
|
||||
use inherents::{InherentDataProviders, ProvideInherentData};
|
||||
use babe_primitives::BABE_ENGINE_ID;
|
||||
use babe_primitives::{BABE_ENGINE_ID, ConsensusLog};
|
||||
pub use babe_primitives::{AuthorityId, VRF_OUTPUT_LENGTH, VRF_PROOF_LENGTH, PUBLIC_KEY_LENGTH};
|
||||
|
||||
/// The BABE inherent identifier.
|
||||
@@ -128,13 +128,13 @@ decl_storage! {
|
||||
/// (like everything else on-chain) it is public. For example, it can be
|
||||
/// used where a number is needed that cannot have been chosen by an
|
||||
/// adversary, for purposes such as public-coin zero-knowledge proofs.
|
||||
EpochRandomness get(epoch_randomness): [u8; 32];
|
||||
EpochRandomness get(epoch_randomness): [u8; VRF_OUTPUT_LENGTH];
|
||||
|
||||
/// The randomness under construction
|
||||
UnderConstruction: [u8; 32];
|
||||
UnderConstruction: [u8; VRF_OUTPUT_LENGTH];
|
||||
|
||||
/// The randomness for the next epoch
|
||||
NextEpochRandomness: [u8; 32];
|
||||
NextEpochRandomness: [u8; VRF_OUTPUT_LENGTH];
|
||||
|
||||
/// The current epoch
|
||||
EpochIndex get(epoch_index): u64;
|
||||
@@ -162,7 +162,7 @@ decl_module! {
|
||||
}
|
||||
|
||||
impl<T: Trait> RandomnessBeacon for Module<T> {
|
||||
fn random() -> [u8; 32] {
|
||||
fn random() -> [u8; VRF_OUTPUT_LENGTH] {
|
||||
Self::epoch_randomness()
|
||||
}
|
||||
}
|
||||
@@ -245,8 +245,13 @@ impl<T: Trait> session::OneSessionHandler<T::AccountId> for Module<T> {
|
||||
s[40..].copy_from_slice(&rho);
|
||||
NextEpochRandomness::put(runtime_io::blake2_256(&s))
|
||||
}
|
||||
fn on_disabled(_i: usize) {
|
||||
// ignore?
|
||||
|
||||
fn on_disabled(i: usize) {
|
||||
let log: DigestItem<T::Hash> = DigestItem::Consensus(
|
||||
BABE_ENGINE_ID,
|
||||
ConsensusLog::OnDisabled(i as u64).encode(),
|
||||
);
|
||||
<system::Module<T>>::deposit_log(log.into());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user