Documentation ¶
Index ¶
- Constants
- Variables
- func AppendUint64(t *merlin.Transcript, label []byte, n uint64)
- func NewDispatchErrorDuplicateOffenceReport(moduleId sc.U8) primitives.DispatchError
- func NewDispatchErrorInvalidConfiguration(moduleId sc.U8) primitives.DispatchError
- func NewDispatchErrorInvalidEquivocationProof(moduleId sc.U8) primitives.DispatchError
- func NewDispatchErrorInvalidKeyOwnershipProof(moduleId sc.U8) primitives.DispatchError
- type Config
- type ConsensusLog
- type EpochChangeTrigger
- type ExternalTrigger
- type GenesisConfig
- type Module
- type NextConfigDescriptor
- type NextEpochDescriptor
- type SameAuthoritiesForever
Constants ¶
View Source
const ( // The epoch has changed. This provides information about the _next_ // epoch - information about the _current_ epoch (i.e. the one we've just // entered) should already be available earlier in the chain. ConsensusLogNextEpochData sc.U8 // Disable the authority with given index. ConsensusLogOnDisabled // The epoch has changed, and the epoch after the current one will // enact different epoch configurations. ConsensusLogNextConfigData )
An consensus log item for BABE.
View Source
const ( // An equivocation proof provided as part of an equivocation report is invalid. ErrorInvalidEquivocationProof sc.U8 = iota // A key ownership proof provided as part of an equivocation report is invalid. ErrorInvalidKeyOwnershipProof // A given equivocation report is valid but already previously reported. ErrorDuplicateOffenceReport // Submitted configuration is invalid. ErrorInvalidConfiguration )
View Source
const ( SkippedEpochsBound = 100 UnderConstructionSegmentLength sc.U32 = 256 )
View Source
const (
NextConfigDescriptorV1 sc.U8 = 1
)
Variables ¶
View Source
var ( EngineId = [4]byte{'B', 'A', 'B', 'E'} KeyTypeId = [4]byte{'b', 'a', 'b', 'e'} )
View Source
var RandomnessVrfContext = []byte("BabeVRFInOutContext")
VRF context used for per-slot randomness generation.
Functions ¶
func AppendUint64 ¶
func AppendUint64(t *merlin.Transcript, label []byte, n uint64)
AppendUint64 appends a uint64 to the given transcript using the given label
func NewDispatchErrorDuplicateOffenceReport ¶
func NewDispatchErrorDuplicateOffenceReport(moduleId sc.U8) primitives.DispatchError
func NewDispatchErrorInvalidConfiguration ¶
func NewDispatchErrorInvalidConfiguration(moduleId sc.U8) primitives.DispatchError
func NewDispatchErrorInvalidEquivocationProof ¶
func NewDispatchErrorInvalidEquivocationProof(moduleId sc.U8) primitives.DispatchError
func NewDispatchErrorInvalidKeyOwnershipProof ¶
func NewDispatchErrorInvalidKeyOwnershipProof(moduleId sc.U8) primitives.DispatchError
Types ¶
type Config ¶
type Config struct { Storage io.Storage DbWeight types.RuntimeDbWeight KeyType primitives.PublicKeyType EpochConfig babetypes.EpochConfiguration EpochDuration sc.U64 EpochChangeTrigger EpochChangeTrigger SessionModule session.Module MaxAuthorities sc.U32 MinimumPeriod sc.U64 SystemDigest func() (primitives.Digest, error) SystemModule system.Module }
func NewConfig ¶
func NewConfig( storage io.Storage, dbWeight types.RuntimeDbWeight, keyType primitives.PublicKeyType, epochConfig babetypes.EpochConfiguration, epochDuration sc.U64, epochChangeTrigger EpochChangeTrigger, sessionModule session.Module, maxAuthorities sc.U32, minimumPeriod sc.U64, systemDigest func() (primitives.Digest, error), systemModule system.Module, ) *Config
type ConsensusLog ¶
type ConsensusLog struct {
sc.VaryingData
}
func NewConsensusLogNextConfigData ¶
func NewConsensusLogNextConfigData(nextConfigData NextConfigDescriptor) ConsensusLog
func NewConsensusLogNextEpochData ¶
func NewConsensusLogNextEpochData(next NextEpochDescriptor) ConsensusLog
func NewConsensusLogOnDisabled ¶
func NewConsensusLogOnDisabled(index babetypes.AuthorityIndex) ConsensusLog
type EpochChangeTrigger ¶
type ExternalTrigger ¶
type ExternalTrigger struct{}
A type signifying to BABE that an external trigger for epoch changes (e.g. pallet-session) is used.
func (ExternalTrigger) Trigger ¶
func (t ExternalTrigger) Trigger(_ sc.U64)
Trigger an epoch change, if any should take place. This should be called during every block, after initialization is done.
type GenesisConfig ¶
type GenesisConfig struct { Authorities sc.Sequence[primitives.Authority] EpochConfig babetypes.EpochConfiguration }
func (*GenesisConfig) UnmarshalJSON ¶
func (gc *GenesisConfig) UnmarshalJSON(data []byte) error
type Module ¶
type Module interface { primitives.Module hooks.OnTimestampSet[sc.U64] sessiontypes.OneSessionHandler FindAuthor(digests sc.Sequence[primitives.DigestPreRuntime]) (sc.Option[sc.U32], error) StorageAuthorities() (sc.Sequence[primitives.Authority], error) StorageRandomness() (babetypes.Randomness, error) StorageSegmentIndexSet(sc.U32) StorageEpochConfig() (babetypes.EpochConfiguration, error) StorageEpochConfigSet(value babetypes.EpochConfiguration) EnactEpochChange(authorities sc.Sequence[primitives.Authority], nextAuthorities sc.Sequence[primitives.Authority], sessionIndex sc.Option[sc.U32]) error ShouldEpochChange(now sc.U64) bool SlotDuration() sc.U64 EpochDuration() sc.U64 EpochConfig() babetypes.EpochConfiguration EpochStartSlot(epochIndex sc.U64, genesisSlot babetypes.Slot, epochDuration sc.U64) (babetypes.Slot, error) CurrentEpochStart() (babetypes.Slot, error) CurrentEpoch() (babetypes.Epoch, error) NextEpoch() (babetypes.Epoch, error) }
func New ¶
func New(index sc.U8, config *Config, mdGenerator *primitives.MetadataTypeGenerator, logger log.RuntimeLogger) Module
type NextConfigDescriptor ¶
type NextConfigDescriptor struct {
V1 babetypes.EpochConfiguration
}
func DecodeNextConfigDescriptor ¶
func DecodeNextConfigDescriptor(buffer *bytes.Buffer) (NextConfigDescriptor, error)
func (NextConfigDescriptor) Bytes ¶
func (d NextConfigDescriptor) Bytes() []byte
type NextEpochDescriptor ¶
type NextEpochDescriptor struct { Authorities sc.Sequence[primitives.Authority] // The value of randomness to use for the slot-assignment. Randomness babetypes.Randomness }
Information about the next epoch. This is broadcast in the first block of the epoch.
func (NextEpochDescriptor) Bytes ¶
func (d NextEpochDescriptor) Bytes() []byte
type SameAuthoritiesForever ¶
type SameAuthoritiesForever struct {
Babe Module
}
A type signifying to BABE that it should perform epoch changes with an internal trigger, recycling the same authorities forever.
func (SameAuthoritiesForever) Trigger ¶
func (t SameAuthoritiesForever) Trigger(now sc.U64)
Click to show internal directories.
Click to hide internal directories.