babe

package
v0.0.3-rc-1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiModuleName = "BabeApi"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Module

type Module struct {
	// contains filtered or unexported fields
}

Module implements the BabeApi Runtime API definition, necessary for block authorship.

func New

func New(babe babe.Module, logger log.RuntimeLogger) Module

func (Module) Configuration

func (m Module) Configuration() int64

Returns configuration data used by the Babe consensus engine.

func (Module) CurrentEpoch

func (m Module) CurrentEpoch() int64

Returns information regarding the current epoch.

func (Module) CurrentEpochStart

func (m Module) CurrentEpochStart() int64

Returns the start slot of the current epoch.

func (Module) GenerateKeyOwnershipProof

func (m Module) GenerateKeyOwnershipProof(dataPtr int32, dataLen int32) int64

Generates a proof of key ownership for the given authority in the current epoch. An example usage of this module is coupled with the session historical module to prove that a given authority key is tied to a given staking identity during a specific session. Proofs of key ownership are necessary for submitting equivocation reports. NOTE: even though the API takes a `slot` as parameter the current implementations ignores this parameter and instead relies on this method being called at the correct block height, i.e. any point at which the epoch for the given slot is live on-chain. Future implementations will instead use indexed data through an offchain worker, not requiring older states to be available.

func (Module) Item

func (m Module) Item() primitives.ApiItem

Item returns the first 8 bytes of the Blake2b hash of the name and version of the api module.

func (Module) Metadata

func (m Module) Metadata() primitives.RuntimeApiMetadata

Metadata returns the runtime api metadata of the module.

func (Module) Name

func (m Module) Name() string

Name returns the name of the api module.

func (Module) NextEpoch

func (m Module) NextEpoch() int64

Returns information regarding the next epoch (which was already previously announced).

func (Module) SubmitReportEquivocationUnsignedExtrinsic

func (m Module) SubmitReportEquivocationUnsignedExtrinsic(dataPtr int32, dataLen int32) int64

Submits an unsigned extrinsic to report an equivocation. The caller must provide the equivocation proof and a key ownership proof (should be obtained using `generate_key_ownership_proof`). The extrinsic will be unsigned and should only be accepted for local authorship (not to be broadcast to the network). This method returns `None` when creation of the extrinsic fails, e.g. if equivocation reporting is disabled for the given runtime (i.e. this method is hardcoded to return `None`). Only useful in an offchain context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL