Struct pallet_grandpa::Module
source · [−]pub struct Module<T: Config>(_);
Implementations
sourceimpl<T: Config + 'static> Module<T>
impl<T: Config + 'static> Module<T>
sourcepub fn state() -> StoredState<T::BlockNumber>
pub fn state() -> StoredState<T::BlockNumber>
State of the current authority set.
sourcepub fn pending_change() -> Option<StoredPendingChange<T::BlockNumber>>
pub fn pending_change() -> Option<StoredPendingChange<T::BlockNumber>>
Pending change: (signaled at, scheduled change).
sourcepub fn next_forced() -> Option<T::BlockNumber>
pub fn next_forced() -> Option<T::BlockNumber>
next block number where we can force a change.
sourcepub fn stalled() -> Option<(T::BlockNumber, T::BlockNumber)>
pub fn stalled() -> Option<(T::BlockNumber, T::BlockNumber)>
true
if we are currently stalled.
sourcepub fn current_set_id() -> SetId
pub fn current_set_id() -> SetId
The number of changes (both in terms of keys and underlying economic responsibilities) in the “set” of Grandpa validators from genesis.
sourcepub fn session_for_set<K: EncodeLike<SetId>>(key: K) -> Option<SessionIndex>
pub fn session_for_set<K: EncodeLike<SetId>>(key: K) -> Option<SessionIndex>
A mapping from grandpa set ID to the index of the most recent session for which its members were responsible.
TWOX-NOTE: SetId
is not under user control.
sourceimpl<T: Config> Module<T>
impl<T: Config> Module<T>
Get the current set of authorities, along with their respective weights.
sourcepub fn schedule_pause(in_blocks: T::BlockNumber) -> DispatchResult
pub fn schedule_pause(in_blocks: T::BlockNumber) -> DispatchResult
Schedule GRANDPA to pause starting in the given number of blocks. Cannot be done when already paused.
sourcepub fn schedule_resume(in_blocks: T::BlockNumber) -> DispatchResult
pub fn schedule_resume(in_blocks: T::BlockNumber) -> DispatchResult
Schedule a resume of GRANDPA after pausing.
sourcepub fn schedule_change(
next_authorities: AuthorityList,
in_blocks: T::BlockNumber,
forced: Option<T::BlockNumber>
) -> DispatchResult
pub fn schedule_change(
next_authorities: AuthorityList,
in_blocks: T::BlockNumber,
forced: Option<T::BlockNumber>
) -> DispatchResult
Schedule a change in the authorities.
The change will be applied at the end of execution of the block
in_blocks
after the current block. This value may be 0, in which
case the change is applied at the end of the current block.
If the forced
parameter is defined, this indicates that the current
set has been synchronously determined to be offline and that after
in_blocks
the given change should be applied. The given block number
indicates the median last finalized block number and it should be used
as the canon block when starting the new grandpa voter.
No change should be signaled while any change is pending. Returns an error if a change is already pending.
sourcepub fn submit_unsigned_equivocation_report(
equivocation_proof: EquivocationProof<T::Hash, T::BlockNumber>,
key_owner_proof: T::KeyOwnerProof
) -> Option<()>
pub fn submit_unsigned_equivocation_report(
equivocation_proof: EquivocationProof<T::Hash, T::BlockNumber>,
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
sourceimpl<T: Config> BoundToRuntimeAppPublic for Module<T>
impl<T: Config> BoundToRuntimeAppPublic for Module<T>
type Public = AuthorityId
type Public = AuthorityId
The RuntimeAppPublic
this type is bound to.
sourceimpl<T: Config> GetPalletVersion for Module<T>
impl<T: Config> GetPalletVersion for Module<T>
sourcefn current_version() -> PalletVersion
fn current_version() -> PalletVersion
Returns the current version of the pallet.
sourcefn storage_version() -> Option<PalletVersion>
fn storage_version() -> Option<PalletVersion>
Returns the version of the pallet that is stored in storage. Read more
sourceimpl<T: Config> IntegrityTest for Module<T>
impl<T: Config> IntegrityTest for Module<T>
sourcefn integrity_test()
fn integrity_test()
Run integrity test. Read more
sourceimpl<T: Config> ModuleErrorMetadata for Module<T>
impl<T: Config> ModuleErrorMetadata for Module<T>
sourceimpl<T: Config + Config> OffchainWorker<<T as Config>::BlockNumber> for Module<T>
impl<T: Config + Config> OffchainWorker<<T as Config>::BlockNumber> for Module<T>
sourcefn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
This function is being called after every block import (when fully synced). Read more
sourceimpl<T: Config + Config> OnFinalize<<T as Config>::BlockNumber> for Module<T>
impl<T: Config + Config> OnFinalize<<T as Config>::BlockNumber> for Module<T>
sourcefn on_finalize(block_number: T::BlockNumber)
fn on_finalize(block_number: T::BlockNumber)
The block is being finalized. Implement to have something happen. Read more
sourceimpl<T: Config> OnGenesis for Module<T>
impl<T: Config> OnGenesis for Module<T>
sourcefn on_genesis()
fn on_genesis()
Something that should happen at genesis.
sourceimpl<T: Config + Config> OnInitialize<<T as Config>::BlockNumber> for Module<T>
impl<T: Config + Config> OnInitialize<<T as Config>::BlockNumber> for Module<T>
sourcefn on_initialize(_n: BlockNumber) -> u64
fn on_initialize(_n: BlockNumber) -> u64
The block is being initialized. Implement to have something happen. Read more
sourceimpl<T: Config> OnRuntimeUpgrade for Module<T>
impl<T: Config> OnRuntimeUpgrade for Module<T>
sourcefn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Perform a module upgrade. Read more
sourceimpl<T: Config> OneSessionHandler<<T as Config>::AccountId> for Module<T> where
T: Config,
impl<T: Config> OneSessionHandler<<T as Config>::AccountId> for Module<T> where
T: Config,
type Key = AuthorityId
type Key = AuthorityId
The key type expected.
sourcefn on_genesis_session<'a, I: 'a>(validators: I) where
I: Iterator<Item = (&'a T::AccountId, AuthorityId)>,
fn on_genesis_session<'a, I: 'a>(validators: I) where
I: Iterator<Item = (&'a T::AccountId, AuthorityId)>,
The given validator set will be used for the genesis session.
It is guaranteed that the given validator set will also be used
for the second session, therefore the first call to on_new_session
should provide the same validator set. Read more
sourcefn on_new_session<'a, I: 'a>(
changed: bool,
validators: I,
_queued_validators: I
) where
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)>,
Session set has changed; act appropriately. Note that this can be called before initialization of your module. Read more
sourcefn on_disabled(i: usize)
fn on_disabled(i: usize)
A validator got disabled. Act accordingly until a new session begins.
sourcefn on_before_session_ending()
fn on_before_session_ending()
A notification for end of the session. Read more
sourceimpl<T: Config> ValidateUnsigned for Module<T>
impl<T: Config> ValidateUnsigned for Module<T>
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.
sourcefn validate_unsigned(
source: TransactionSource,
call: &Self::Call
) -> TransactionValidity
fn validate_unsigned(
source: TransactionSource,
call: &Self::Call
) -> TransactionValidity
Return the validity of the call Read more
sourcefn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError>
fn pre_dispatch(call: &Self::Call) -> Result<(), TransactionValidityError>
Validate the call right before dispatch. Read more
impl<T: Copy + Config> Copy for Module<T>
impl<T: Eq + Config> Eq for Module<T>
impl<T: Config> StructuralEq for Module<T>
impl<T: Config> StructuralPartialEq for Module<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Module<T> where
T: RefUnwindSafe,
impl<T> Send for Module<T> where
T: Send,
impl<T> Sync for Module<T> where
T: Sync,
impl<T> Unpin for Module<T> where
T: Unpin,
impl<T> UnwindSafe for Module<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CheckedConversion for T
impl<T> CheckedConversion for T
sourcefn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self> where
Self: TryFrom<T>,
Convert from a value of T
into an equivalent instance of Option<Self>
. Read more
sourcefn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T> where
Self: TryInto<T>,
Consume self to return Some
equivalent value of Option<T>
. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
sourceimpl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
sourcefn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Self where
Self: UniqueSaturatedFrom<T>,
Convert from a value of T
into an equivalent instance of Self
. Read more
sourcefn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> T where
Self: UniqueSaturatedInto<T>,
Consume self to return an equivalent value of T
. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcepub fn unchecked_into(self) -> T
pub fn unchecked_into(self) -> T
The counterpart to unchecked_from
.
sourceimpl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for S where
T: Bounded,
S: TryInto<T>,
sourcepub fn unique_saturated_into(self) -> T
pub fn unique_saturated_into(self) -> T
Consume self to return an equivalent value of T
.