Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Only allow primary slots. PrimarySlots sc.U8 = iota // Allow primary and secondary plain slots. PrimaryAndSecondaryPlainSlots // Allow primary and secondary VRF slots. PrimaryAndSecondaryVRFSlots )
Types of allowed slots.
View Source
const RandomnessLength = 32
VRF output length for per-slot randomness.
Variables ¶
View Source
var (
ErrInvalidAllowedSlots = errors.New("invalid 'AllowedSlots' type")
)
Functions ¶
This section is empty.
Types ¶
type AllowedSlots ¶
type AllowedSlots struct {
sc.VaryingData
}
func DecodeAllowedSlots ¶
func DecodeAllowedSlots(buffer *bytes.Buffer) (AllowedSlots, error)
func NewPrimaryAndSecondaryPlainSlots ¶
func NewPrimaryAndSecondaryPlainSlots() AllowedSlots
func NewPrimaryAndSecondaryVRFSlots ¶
func NewPrimaryAndSecondaryVRFSlots() AllowedSlots
func NewPrimarySlots ¶
func NewPrimarySlots() AllowedSlots
func (AllowedSlots) String ¶
func (a AllowedSlots) String() string
type Authority ¶
type Authority struct {
Key AuthorityId
Weight BabeAuthorityWeight
}
type AuthorityId ¶
type AuthorityId = primitives.Sr25519PublicKey
A Babe authority identifier. Necessarily equivalent to the schnorrkel public key used in the main Babe module. If that ever changes, then this must, too.
type AuthorityIndex ¶
type BabeAuthorityWeight ¶
The weight of an authority. We use a unique name for the weight to avoid conflicts with other `Weight` types, since the metadata isn't able to disambiguate.
type Configuration ¶
type Configuration struct {
// The slot duration in milliseconds for BABE. Currently, only
// the value provided by this type at genesis will be used.
//
// Dynamic slot duration may be supported in the future.
SlotDuration sc.U64
// The duration of epochs in slots.
EpochLength sc.U64
// A constant value that is used in the threshold calculation formula.
// In the threshold formula calculation, `1 - c` represents the probability
// of a slot being empty.
C primitives.RationalValue
// The authorities
Authorities sc.Sequence[Authority]
// The randomness
Randomness Randomness
// Type of allowed slots.
AllowedSlots AllowedSlots
}
Configuration data used by the BABE consensus engine.
func DecodeConfiguration ¶
func DecodeConfiguration(buffer *bytes.Buffer) (Configuration, error)
func (Configuration) Bytes ¶
func (c Configuration) Bytes() []byte
type Epoch ¶
type Epoch struct {
// The epoch index.
EpochIndex sc.U64
// The starting slot of the epoch.
StartSlot Slot
// The duration of this epoch.
Duration sc.U64
// The authorities and their weights.
Authorities sc.Sequence[Authority]
// Randomness for this epoch.
Randomness Randomness
// Configuration of the epoch.
Config EpochConfiguration
}
BABE epoch information
type EpochConfiguration ¶
type EpochConfiguration struct {
// A constant value that is used in the threshold calculation formula.
// In the threshold formula calculation, `1 - c` represents the probability
// of a slot being empty.
C primitives.RationalValue
// Whether this chain should run with secondary slots, which are assigned
// in round-robin manner.
AllowedSlots AllowedSlots
}
Configuration data used by the BABE consensus engine that may change with epochs.
func DecodeEpochConfiguration ¶
func DecodeEpochConfiguration(buffer *bytes.Buffer) (EpochConfiguration, error)
func (EpochConfiguration) Bytes ¶
func (c EpochConfiguration) Bytes() []byte
type EpochStartBlocks ¶
func DecodeEpochStartBlocks ¶
func DecodeEpochStartBlocks(buffer *bytes.Buffer) (EpochStartBlocks, error)
func (EpochStartBlocks) Bytes ¶
func (e EpochStartBlocks) Bytes() []byte
type Randomness ¶
type Randomness = sc.FixedSequence[sc.U8]
Randomness type required by BABE operations.
func NewRandomness ¶
func NewRandomness() Randomness
type SessionIndex ¶
type SkippedEpoch ¶
type SkippedEpoch struct {
sc.U64
SessionIndex
}
func (SkippedEpoch) Bytes ¶
func (se SkippedEpoch) Bytes() []byte
Click to show internal directories.
Click to hide internal directories.