pub type Babe = Pallet<Runtime>;
Aliased Type§
struct Babe(/* private fields */);
Implementations
Source§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
Methods for the ValidateUnsigned
implementation:
It 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.
pub fn validate_unsigned( source: TransactionSource, call: &Call<T>, ) -> Result<ValidTransaction, TransactionValidityError>
pub fn pre_dispatch(call: &Call<T>) -> Result<(), TransactionValidityError>
Source§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
Sourcepub fn report_equivocation(
origin: <T as Config>::RuntimeOrigin,
equivocation_proof: Box<EquivocationProof<<<T as Config>::Block as HeaderProvider>::HeaderT, Public>>,
key_owner_proof: <T as Config>::KeyOwnerProof,
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn report_equivocation( origin: <T as Config>::RuntimeOrigin, equivocation_proof: Box<EquivocationProof<<<T as Config>::Block as HeaderProvider>::HeaderT, Public>>, key_owner_proof: <T as Config>::KeyOwnerProof, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Report authority equivocation/misbehavior. This method will verify the equivocation proof and validate the given key ownership proof against the extracted offender. If both are valid, the offence will be reported.
Sourcepub fn report_equivocation_unsigned(
origin: <T as Config>::RuntimeOrigin,
equivocation_proof: Box<EquivocationProof<<<T as Config>::Block as HeaderProvider>::HeaderT, Public>>,
key_owner_proof: <T as Config>::KeyOwnerProof,
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn report_equivocation_unsigned( origin: <T as Config>::RuntimeOrigin, equivocation_proof: Box<EquivocationProof<<<T as Config>::Block as HeaderProvider>::HeaderT, Public>>, key_owner_proof: <T as Config>::KeyOwnerProof, ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Report authority equivocation/misbehavior. This method will verify
the equivocation proof and validate the given key ownership proof
against the extracted offender. If both are valid, the offence will
be reported.
This extrinsic must be called unsigned and it is expected that only
block authors will call it (validated in ValidateUnsigned
), as such
if the block author is defined it will be defined as the equivocation
reporter.
Sourcepub fn plan_config_change(
origin: <T as Config>::RuntimeOrigin,
config: NextConfigDescriptor,
) -> Result<(), DispatchError>
pub fn plan_config_change( origin: <T as Config>::RuntimeOrigin, config: NextConfigDescriptor, ) -> Result<(), DispatchError>
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.
Source§impl<T> Pallet<T>where
T: Config,
impl<T> Pallet<T>where
T: Config,
Sourcepub fn epoch_index() -> u64
pub fn epoch_index() -> u64
Public function to access epoch_index storage.
Public function to access authorities storage.
Sourcepub fn genesis_slot() -> Slot
pub fn genesis_slot() -> Slot
Public function to access genesis_slot storage.
Sourcepub fn current_slot() -> Slot
pub fn current_slot() -> Slot
Public function to access current_slot storage.
Sourcepub fn randomness() -> [u8; 32]
pub fn randomness() -> [u8; 32]
Public function to access randomness storage.
Sourcepub fn initialized() -> Option<Option<PreDigest>>
pub fn initialized() -> Option<Option<PreDigest>>
Public function to access initialized storage.
Public function to access author_vrf_randomness storage.
Sourcepub fn lateness() -> <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
pub fn lateness() -> <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
Public function to access lateness storage.
Sourcepub fn epoch_config() -> Option<BabeEpochConfiguration>
pub fn epoch_config() -> Option<BabeEpochConfiguration>
Public function to access epoch_config storage.
Sourcepub fn skipped_epochs() -> BoundedVec<(u64, u32), ConstU32<100>>
pub fn skipped_epochs() -> BoundedVec<(u64, u32), ConstU32<100>>
Public function to access skipped_epochs storage.
Sourcepub fn slot_duration() -> <T as Config>::Moment
pub fn slot_duration() -> <T as Config>::Moment
Determine the BABE slot duration based on the Timestamp module configuration.
Sourcepub fn should_epoch_change(
now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> bool
pub fn should_epoch_change( now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> bool
Determine whether an epoch change should take place at this block. Assumes that initialization has already taken place.
Sourcepub fn next_expected_epoch_change(
now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> Option<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>
pub fn next_expected_epoch_change( now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Option<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>
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.
Sourcepub fn enact_epoch_change(
authorities: WeakBoundedVec<(Public, u64), <T as Config>::MaxAuthorities>,
next_authorities: WeakBoundedVec<(Public, u64), <T as Config>::MaxAuthorities>,
session_index: Option<u32>,
)
pub fn enact_epoch_change( authorities: WeakBoundedVec<(Public, u64), <T as Config>::MaxAuthorities>, next_authorities: WeakBoundedVec<(Public, u64), <T as Config>::MaxAuthorities>, session_index: Option<u32>, )
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 pallet-session
.
This doesn’t do anything if authorities
is empty.
Sourcepub fn current_epoch_start() -> Slot
pub fn current_epoch_start() -> Slot
Finds the start slot of the current epoch.
Only guaranteed to give correct results after initialize
of the first
block in the chain (as its result is based off of GenesisSlot
).
Sourcepub fn current_epoch() -> Epoch
pub fn current_epoch() -> Epoch
Produces information about the current epoch.
Sourcepub fn next_epoch() -> Epoch
pub fn next_epoch() -> Epoch
Produces information about the next epoch (which was already previously announced).
Sourcepub fn submit_unsigned_equivocation_report(
equivocation_proof: EquivocationProof<<<T as Config>::Block as HeaderProvider>::HeaderT, Public>,
key_owner_proof: <T as Config>::KeyOwnerProof,
) -> Option<()>
pub fn submit_unsigned_equivocation_report( equivocation_proof: EquivocationProof<<<T as Config>::Block as HeaderProvider>::HeaderT, Public>, key_owner_proof: <T as Config>::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
Source§impl<T> BeforeAllRuntimeMigrations for Pallet<T>where
T: Config,
impl<T> BeforeAllRuntimeMigrations for Pallet<T>where
T: Config,
Source§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
Source§impl<T> Benchmarking for Pallet<T>
impl<T> Benchmarking for Pallet<T>
Source§fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>
fn benchmarks(extra: bool) -> Vec<BenchmarkMetadata>
Source§fn run_benchmark(
extrinsic: &[u8],
c: &[(BenchmarkParameter, u32)],
whitelist: &[TrackedStorageKey],
verify: bool,
internal_repeats: u32,
) -> Result<Vec<BenchmarkResult>, BenchmarkError>
fn run_benchmark( extrinsic: &[u8], c: &[(BenchmarkParameter, u32)], whitelist: &[TrackedStorageKey], verify: bool, internal_repeats: u32, ) -> Result<Vec<BenchmarkResult>, BenchmarkError>
Source§impl<T> BoundToRuntimeAppPublic for Pallet<T>where
T: Config,
impl<T> BoundToRuntimeAppPublic for Pallet<T>where
T: Config,
Source§type Public = Public
type Public = Public
RuntimeAppPublic
this type is bound to.Source§impl<T> DispatchViewFunction for Pallet<T>where
T: Config,
impl<T> DispatchViewFunction for Pallet<T>where
T: Config,
fn dispatch_view_function<O>(
id: &ViewFunctionId,
input: &mut &[u8],
output: &mut O,
) -> Result<(), ViewFunctionDispatchError>where
O: Output,
Source§impl<T> EstimateNextSessionRotation<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> EstimateNextSessionRotation<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§fn average_session_length() -> <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
fn average_session_length() -> <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
Source§fn estimate_current_session_progress(
_now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> (Option<Permill>, Weight)
fn estimate_current_session_progress( _now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> (Option<Permill>, Weight)
Source§fn estimate_next_session_rotation(
now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> (Option<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>, Weight)
fn estimate_next_session_rotation( now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> (Option<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number>, Weight)
Source§impl<T> FindAuthor<u32> for Pallet<T>where
T: Config,
impl<T> FindAuthor<u32> for Pallet<T>where
T: Config,
Source§impl<T> GetStorageVersion for Pallet<T>where
T: Config,
impl<T> GetStorageVersion for Pallet<T>where
T: Config,
Source§fn in_code_storage_version() -> <Pallet<T> as GetStorageVersion>::InCodeStorageVersion
fn in_code_storage_version() -> <Pallet<T> as GetStorageVersion>::InCodeStorageVersion
storage_version
attribute, or
NoStorageVersionSet
if the attribute is missing.Source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
Source§fn current_storage_version() -> Self::InCodeStorageVersion
fn current_storage_version() -> Self::InCodeStorageVersion
in_code_storage_version
and will be removed after March 2024.Self::current_storage_version
instead. Read moreSource§impl<T> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§fn on_initialize(
now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> Weight
fn on_initialize( now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Weight
Initialization
Source§fn on_finalize(
_now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
)
fn on_finalize( _now: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, )
Block finalization
Source§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize
). Read moreSource§fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
Source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Executive
pallet. Read moreSource§fn try_state(_n: BlockNumber) -> Result<(), DispatchError>
fn try_state(_n: BlockNumber) -> Result<(), DispatchError>
Source§fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
Source§fn post_upgrade(_state: Vec<u8>) -> Result<(), DispatchError>
fn post_upgrade(_state: Vec<u8>) -> Result<(), DispatchError>
Source§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
Source§fn integrity_test()
fn integrity_test()
Source§impl<T> IntegrityTest for Pallet<T>where
T: Config,
impl<T> IntegrityTest for Pallet<T>where
T: Config,
Source§impl<T> Lateness<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> Lateness<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§fn on_finalize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
)
fn on_finalize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, )
Hooks::on_finalize
.Source§impl<T> OnGenesis for Pallet<T>where
T: Config,
impl<T> OnGenesis for Pallet<T>where
T: Config,
Source§fn on_genesis()
fn on_genesis()
Source§impl<T> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§fn on_initialize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number,
) -> Weight
fn on_initialize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number, ) -> Weight
Hooks::on_initialize
.Source§impl<T> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> OnRuntimeUpgrade for Pallet<T>where
T: Config,
impl<T> OnRuntimeUpgrade for Pallet<T>where
T: Config,
Source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Source§fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
Hooks::pre_upgrade
.Source§fn post_upgrade(state: Vec<u8>) -> Result<(), DispatchError>
fn post_upgrade(state: Vec<u8>) -> Result<(), DispatchError>
Hooks::post_upgrade
.Source§fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
pre_upgrade
->
on_runtime_upgrade
-> post_upgrade
hooks for a migration. Read moreSource§impl<T> OnTimestampSet<<T as Config>::Moment> for Pallet<T>where
T: Config,
impl<T> OnTimestampSet<<T as Config>::Moment> for Pallet<T>where
T: Config,
Source§fn on_timestamp_set(moment: <T as Config>::Moment)
fn on_timestamp_set(moment: <T as Config>::Moment)
Source§impl<T> OneSessionHandler<<T as Config>::AccountId> for Pallet<T>
impl<T> OneSessionHandler<<T as Config>::AccountId> for Pallet<T>
Source§fn on_genesis_session<'a, I>(validators: I)
fn on_genesis_session<'a, I>(validators: I)
on_new_session
should provide the same validator set.Source§fn on_new_session<'a, I>(_changed: bool, validators: I, queued_validators: I)
fn on_new_session<'a, I>(_changed: bool, validators: I, queued_validators: I)
Source§fn on_disabled(i: u32)
fn on_disabled(i: u32)
Source§fn on_before_session_ending()
fn on_before_session_ending()
Source§impl<T> PalletInfoAccess for Pallet<T>where
T: Config,
impl<T> PalletInfoAccess for Pallet<T>where
T: Config,
Source§fn module_name() -> &'static str
fn module_name() -> &'static str
Source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
Source§impl<T> PalletsInfoAccess for Pallet<T>where
T: Config,
impl<T> PalletsInfoAccess for Pallet<T>where
T: Config,
Source§impl<T> ShouldEndSession<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> ShouldEndSession<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> StorageInfoTrait for Pallet<T>where
T: Config,
impl<T> StorageInfoTrait for Pallet<T>where
T: Config,
fn storage_info() -> Vec<StorageInfo>
Source§impl<T> TryDecodeEntireStorage for Pallet<T>where
T: Config,
impl<T> TryDecodeEntireStorage for Pallet<T>where
T: Config,
Source§fn try_decode_entire_state() -> Result<usize, Vec<TryDecodeEntireStorageError>>
fn try_decode_entire_state() -> Result<usize, Vec<TryDecodeEntireStorageError>>
Ok(bytes_decoded)
if success.Source§impl<T> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
impl<T> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>where
T: Config,
Source§impl<T> ValidateUnsigned for Pallet<T>where
T: Config,
impl<T> ValidateUnsigned for Pallet<T>where
T: Config,
Source§fn validate_unsigned(
source: TransactionSource,
call: &<Pallet<T> as ValidateUnsigned>::Call,
) -> Result<ValidTransaction, TransactionValidityError>
fn validate_unsigned( source: TransactionSource, call: &<Pallet<T> as ValidateUnsigned>::Call, ) -> Result<ValidTransaction, TransactionValidityError>
Source§fn pre_dispatch(
call: &<Pallet<T> as ValidateUnsigned>::Call,
) -> Result<(), TransactionValidityError>
fn pre_dispatch( call: &<Pallet<T> as ValidateUnsigned>::Call, ) -> Result<(), TransactionValidityError>
Source§impl<T> WhitelistedStorageKeys for Pallet<T>where
T: Config,
impl<T> WhitelistedStorageKeys for Pallet<T>where
T: Config,
Source§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
Vec<TrackedStorageKey>
indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation.