pub trait BabeApi<Block: BlockT>: Core<Block> {
    // Provided methods
    fn configuration(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash
    ) -> Result<BabeConfiguration, ApiError> { ... }
    fn configuration_before_version_2(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash
    ) -> Result<BabeConfigurationV1, ApiError> { ... }
    fn current_epoch_start(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash
    ) -> Result<Slot, ApiError> { ... }
    fn current_epoch(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash
    ) -> Result<Epoch, ApiError> { ... }
    fn next_epoch(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash
    ) -> Result<Epoch, ApiError> { ... }
    fn generate_key_ownership_proof(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        slot: Slot,
        authority_id: AuthorityId
    ) -> Result<Option<OpaqueKeyOwnershipProof>, ApiError> { ... }
    fn submit_report_equivocation_unsigned_extrinsic(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        equivocation_proof: EquivocationProof<Block::Header>,
        key_owner_proof: OpaqueKeyOwnershipProof
    ) -> Result<Option<()>, ApiError> { ... }
}
Expand description

API necessary for block authorship with BABE.

Provided Methods§

source

fn configuration( &self, __runtime_api_at_param__: <Block as BlockT>::Hash ) -> Result<BabeConfiguration, ApiError>

Return the configuration for BABE.

source

fn configuration_before_version_2( &self, __runtime_api_at_param__: <Block as BlockT>::Hash ) -> Result<BabeConfigurationV1, ApiError>

👎Deprecated

Return the configuration for BABE. Version 1.

source

fn current_epoch_start( &self, __runtime_api_at_param__: <Block as BlockT>::Hash ) -> Result<Slot, ApiError>

Returns the slot that started the current epoch.

source

fn current_epoch( &self, __runtime_api_at_param__: <Block as BlockT>::Hash ) -> Result<Epoch, ApiError>

Returns information regarding the current epoch.

source

fn next_epoch( &self, __runtime_api_at_param__: <Block as BlockT>::Hash ) -> Result<Epoch, ApiError>

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

source

fn generate_key_ownership_proof( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, slot: Slot, authority_id: AuthorityId ) -> Result<Option<OpaqueKeyOwnershipProof>, ApiError>

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.

source

fn submit_report_equivocation_unsigned_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, equivocation_proof: EquivocationProof<Block::Header>, key_owner_proof: OpaqueKeyOwnershipProof ) -> Result<Option<()>, ApiError>

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.

Trait Implementations§

source§

impl<Block: BlockT> RuntimeApiInfo for dyn BabeApi<Block>

source§

const ID: [u8; 8] = _

The identifier of the runtime api.
source§

const VERSION: u32 = 2u32

The version of the runtime api.

Implementors§