Struct noble_babe::Module [−][src]
The BABE Noble
Implementations
impl<T: Config + 'static> Module<T>
[src]
pub fn epoch_index() -> u64
[src]
Current epoch index.
pub fn authorities() -> Vec<(AuthorityId, BabeAuthorityWeight)>
[src]
Current epoch authorities.
pub fn genesis_slot() -> Slot
[src]
The slot at which the first epoch actually started. This is 0 until the first block of the chain.
pub fn current_slot() -> Slot
[src]
Current slot number.
pub fn randomness() -> Randomness
[src]
The epoch randomness for the current epoch.
Security
This MUST NOT be used for gambling, as it can be influenced by a malicious validator in the short term. It MAY be used in many cryptographic protocols, however, so long as one remembers that this (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.
pub fn initialized() -> Option<Option<Randomness>>
[src]
Temporary value (cleared at block finalization) which is Some
if per-block initialization has already been called for current block.
pub fn author_vrf_randomness() -> Option<Randomness>
[src]
Temporary value (cleared at block finalization) that includes the VRF output generated at this block. This field should always be populated during block processing unless secondary plain slots are enabled (which don’t contain a VRF output).
pub fn lateness() -> T::BlockNumber
[src]
How late the current block is compared to its parent.
This entry is populated as part of block execution and is cleaned up on block finalization. Querying this storage entry outside of block execution context should always yield zero.
impl<T: Config> Module<T>
[src]
pub fn slot_duration() -> T::Moment
[src]
Determine the BABE slot duration based on the Timestamp module configuration.
pub fn should_epoch_change(now: T::BlockNumber) -> bool
[src]
Determine whether an epoch change should take place at this block. Assumes that initialization has already taken place.
pub fn next_expected_epoch_change(now: T::BlockNumber) -> Option<T::BlockNumber>
[src]
Return the best guess block number, at which the next epoch change is predicted to happen.
Returns None if the prediction is in the past; This implies an error internally in the Babe and should not happen under normal circumstances.
In other word, this is only accurate if no slots are missed. Given missed slots, the slot number will grow while the block number will not. Hence, the result can be interpreted as an upper bound.
pub fn plan_config_change(config: NextConfigDescriptor)
[src]
Plan an epoch config change. The epoch config change is recorded and will be enacted on the
next call to enact_epoch_change
. The config will be activated one epoch after. Multiple calls to this
method will replace any existing planned config change that had not been enacted yet.
pub fn enact_epoch_change(
authorities: Vec<(AuthorityId, BabeAuthorityWeight)>,
next_authorities: Vec<(AuthorityId, BabeAuthorityWeight)>
)
[src]
authorities: Vec<(AuthorityId, BabeAuthorityWeight)>,
next_authorities: Vec<(AuthorityId, BabeAuthorityWeight)>
)
DANGEROUS: Enact an epoch change. Should be done on every block where should_epoch_change
has returned true
,
and the caller is the only caller of this function.
Typically, this is not handled directly by the user, but by higher-level validator-set manager logic like
noble-session
.
pub fn current_epoch_start() -> Slot
[src]
Finds the start slot of the current epoch. only guaranteed to
give correct results after do_initialize
of the first block
in the chain (as its result is based off of GenesisSlot
).
pub fn current_epoch() -> Epoch
[src]
Produces information about the current epoch.
pub fn next_epoch() -> Epoch
[src]
Produces information about the next epoch (which was already previously announced).
pub fn submit_unsigned_equivocation_report(
equivocation_proof: EquivocationProof<T::Header>,
key_owner_proof: T::KeyOwnerProof
) -> Option<()>
[src]
equivocation_proof: EquivocationProof<T::Header>,
key_owner_proof: T::KeyOwnerProof
) -> Option<()>
Submits an extrinsic to report an equivocation. This method will create
an unsigned extrinsic with a call to report_equivocation_unsigned
and
will push the transaction to the pool. Only useful in an offchain
context.
Trait Implementations
impl<T: Config> BoundToRuntimeAppPublic for Module<T>
[src]
type Public = AuthorityId
The RuntimeAppPublic
this type is bound to.
impl<T: Config> Callable<T> for Module<T>
[src]
impl<T: Clone + Config> Clone for Module<T>
[src]
impl<T: Copy + Config> Copy for Module<T>
[src]
impl<T: Config> Debug for Module<T> where
T: Debug,
[src]
T: Debug,
impl<T: Eq + Config> Eq for Module<T>
[src]
impl<T: Config> EstimateNextSessionRotation<<T as Config>::BlockNumber> for Module<T>
[src]
fn estimate_next_session_rotation(now: T::BlockNumber) -> Option<T::BlockNumber>
[src]
fn weight(_now: T::BlockNumber) -> Weight
[src]
impl<T: Config> FindAuthor<u32> for Module<T>
[src]
fn find_author<'a, I>(digests: I) -> Option<u32> where
I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,
[src]
I: 'a + IntoIterator<Item = (ConsensusEngineId, &'a [u8])>,
impl<T: Config> GetNobleVersion for Module<T>
[src]
fn current_version() -> NobleVersion
[src]
fn storage_version() -> Option<NobleVersion>
[src]
impl<T: Config> IntegrityTest for Module<T>
[src]
pub fn integrity_test()
[src]
impl<T: Config> IsMember<Public> for Module<T>
[src]
fn is_member(authority_id: &AuthorityId) -> bool
[src]
impl<T: Config> Lateness<<T as Config>::BlockNumber> for Module<T>
[src]
fn lateness(&self) -> T::BlockNumber
[src]
impl<T: Config> ModuleErrorMetadata for Module<T>
[src]
fn metadata() -> &'static [ErrorMetadata]
[src]
impl<T: Config + Config> OffchainWorker<<T as Config>::BlockNumber> for Module<T>
[src]
pub fn offchain_worker(_n: BlockNumber)
[src]
impl<T: Config + Config> OnFinalize<<T as Config>::BlockNumber> for Module<T>
[src]
fn on_finalize(_block_number_not_used: <T as Config>::BlockNumber)
[src]
impl<T: Config> OnGenesis for Module<T>
[src]
fn on_genesis()
[src]
impl<T: Config + Config> OnInitialize<<T as Config>::BlockNumber> for Module<T>
[src]
fn on_initialize(now: T::BlockNumber) -> Weight
[src]
impl<T: Config> OnRuntimeUpgrade for Module<T>
[src]
fn on_runtime_upgrade() -> Weight
[src]
impl<T: Config> OnTimestampSet<<T as Config>::Moment> for Module<T>
[src]
fn on_timestamp_set(_moment: T::Moment)
[src]
impl<T: Config> OneSessionHandler<<T as Config>::AccountId> for Module<T>
[src]
type Key = AuthorityId
The key type expected.
fn on_genesis_session<'a, I: 'a>(validators: I) where
I: Iterator<Item = (&'a T::AccountId, AuthorityId)>,
[src]
I: Iterator<Item = (&'a T::AccountId, AuthorityId)>,
fn on_new_session<'a, I: 'a>(
_changed: bool,
validators: I,
queued_validators: I
) where
I: Iterator<Item = (&'a T::AccountId, AuthorityId)>,
[src]
_changed: bool,
validators: I,
queued_validators: I
) where
I: Iterator<Item = (&'a T::AccountId, AuthorityId)>,
fn on_disabled(i: usize)
[src]
pub fn on_before_session_ending()
[src]
impl<T: PartialEq + Config> PartialEq<Module<T>> for Module<T>
[src]
impl<T: Config> ProvideInherent for Module<T>
[src]
type Call = Call<T>
The call type of the pallet.
type Error = MakeFatalError<Error>
The error returned by check_inherent
.
const INHERENT_IDENTIFIER: InherentIdentifier
[src]
fn create_inherent(_: &InherentData) -> Option<Self::Call>
[src]
fn check_inherent(
call: &Self::Call,
data: &InherentData
) -> Result<(), Self::Error>
[src]
call: &Self::Call,
data: &InherentData
) -> Result<(), Self::Error>
pub fn is_inherent_required(
&InherentData
) -> Result<Option<Self::Error>, Self::Error>
[src]
&InherentData
) -> Result<Option<Self::Error>, Self::Error>
impl<T: Config> Randomness<<T as Config>::Hash> for Module<T>
[src]
fn random(subject: &[u8]) -> T::Hash
[src]
Some BABE blocks have VRF outputs where the block producer has exactly one bit of influence, either they make the block or they do not make the block and thus someone else makes the next block. Yet, this randomness is not fresh in all BABE blocks.
If that is an insufficient security guarantee then two things can be used to improve this randomness:
- Name, in advance, the block number whose random value will be used; ensure your module retains a buffer of previous random values for its subject and then index into these in order to obviate the ability of your user to look up the parent hash and choose when to transact based upon it.
- Require your user to first commit to an additional value by first posting its hash. Require them to reveal the value to determine the final result, hashing it with the output of this random function. This reduces the ability of a cabal of block producers from conspiring against individuals.
pub fn random_seed() -> Output
[src]
impl<T: Config> ShouldEndSession<<T as Config>::BlockNumber> for Module<T>
[src]
fn should_end_session(now: T::BlockNumber) -> bool
[src]
impl<T: Config> StructuralEq for Module<T>
[src]
impl<T: Config> StructuralPartialEq for Module<T>
[src]
impl<T: Config> ValidateUnsigned for Module<T>
[src]
A ValidateUnsigned
implementation that restricts calls to report_equivocation_unsigned
to local calls (i.e. extrinsics generated on this node) or that already in a block. This
guarantees that only block authors can include unsigned equivocation reports.
type Call = Call<T>
The call to validate
fn validate_unsigned(
source: TransactionSource,
call: &Self::Call
) -> TransactionValidity
[src]
source: TransactionSource,
call: &Self::Call
) -> TransactionValidity
fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Module<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Module<T> where
T: Send,
T: Send,
impl<T> Sync for Module<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Module<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Module<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> CheckedConversion for T
[src]
pub fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
[src]
Self: TryFrom<T>,
pub fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
[src]
Self: TryInto<T>,
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Any + Send + Sync,
T: Any + Send + Sync,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IsType<T> for T
[src]
pub fn from_ref(t: &T) -> &T
[src]
pub fn into_ref(&self) -> &T
[src]
pub fn from_mut(t: &mut T) -> &mut T
[src]
pub fn into_mut(&mut self) -> &mut T
[src]
impl<T, Outer> IsWrappedBy<Outer> for T where
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
Outer: AsRef<T> + AsMut<T> + From<T>,
pub fn from_ref(outer: &Outer) -> &T
Get a reference to the inner from the outer.
pub fn from_mut(outer: &mut Outer) -> &mut T
Get a mutable reference to the inner from the outer.
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeDebug for T where
T: Debug,
T: Debug,
impl<T> MaybeRefUnwindSafe for T where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Member for T where
T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone,
[src]
T: 'static + Send + Sync + Debug + Eq + PartialEq<T> + Clone,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> SaturatedConversion for T
pub fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Self: UniqueSaturatedFrom<T>,
pub fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Self: UniqueSaturatedInto<T>,
impl<T> Scalar for T where
T: Copy + PartialEq<T> + Debug + Any,
[src]
T: Copy + PartialEq<T> + Debug + Any,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn is_in_subset(&self) -> bool
pub fn to_subset_unchecked(&self) -> SS
pub fn from_subset(element: &SS) -> SP
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
T: UncheckedFrom<S>,
pub fn unchecked_into(self) -> T
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
T: Bounded,
S: TryInto<T>,
pub fn unique_saturated_into(self) -> T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,