Babe
Calls
planConfigChange
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.
Namespace
Type
reportEquivocation
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.
Namespace
Type
reportEquivocationUnsigned
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.
Namespace
Type
Storage
authorities
Current epoch authorities.
Namespace
Type
authorVrfRandomness
This field should always be populated during block processing unless secondary plain slots are enabled (which don't contain a VRF output).
It is set in on_finalize
, before it will contain the value from the last block.
Namespace
Type
currentSlot
Current slot number.
Namespace
Type
epochConfig
The configuration for the current epoch. Should never be None
as it is initialized in genesis.
Namespace
Type
epochIndex
Current epoch index.
Namespace
Type
epochStart
The block numbers when the last and current epoch have started, respectively N-1
and N
. NOTE: We track this is in order to annotate the block number when a given pool of entropy was fixed (i.e. it was known to chain observers). Since epochs are defined in slots, which may be skipped, the block numbers may not line up with the slot numbers.
Namespace
Type
genesisSlot
The slot at which the first epoch actually started. This is 0 until the first block of the chain.
Namespace
Type
initialized
Temporary value (cleared at block finalization) which is Some
if per-block initialization has already been called for current block.
Namespace
Type
lateness
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.
Namespace
Type
nextAuthorities
Next epoch authorities.
Namespace
Type
nextEpochConfig
The configuration for the next epoch, None
if the config will not change (you can fallback to EpochConfig
instead in that case).
Namespace
Type
nextRandomness
Next epoch randomness.
Namespace
Type
pendingEpochConfigChange
Pending epoch configuration change that will be applied when the next epoch is enacted.
Namespace
Type
randomness
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.
Namespace
Type
segmentIndex
Randomness under construction.
We make a trade-off between storage accesses and list length. We store the under-construction randomness in segments of up to UNDER_CONSTRUCTION_SEGMENT_LENGTH
.
Once a segment reaches this length, we begin the next one. We reset all segments and return to 0
at the beginning of every epoch.
Namespace
Type
underConstruction
TWOX-NOTE: SegmentIndex
is an increasing integer, so this is okay.
Namespace
Type
undefined## Errors
DuplicateOffenceReport
A given equivocation report is valid but already previously reported.
Namespace
InvalidConfiguration
Submitted configuration is invalid.
Namespace
InvalidEquivocationProof
An equivocation proof provided as part of an equivocation report is invalid.
Namespace
InvalidKeyOwnershipProof
A key ownership proof provided as part of an equivocation report is invalid.
Namespace
Constants
epochDuration
The amount of time, in slots, that each epoch should last. NOTE: Currently it is not possible to change the epoch duration after the chain has started. Attempting to do so will brick block production.
Namespace
Type
expectedBlockTime
The expected average block time at which BABE should be creating blocks. Since BABE is probabilistic it is not trivial to figure out what the expected average block time should be based on the slot duration and the security parameter c
(where 1 - c
represents the probability of a slot being empty).
Namespace
Type
maxAuthorities
Max number of authorities allowed
Namespace
Type
JSON-RPC Methods
epochAuthorship
epochAuthorship
Returns data about which slots (primary or secondary) can be claimed in the current epoch with the keys in the keystore.
Info: This method is only active with appropriate flags.
Interface
JSON
Last updated