sp_consensus_subspace

Trait SubspaceApi

source
pub trait SubspaceApi<Block: BlockT, RewardAddress: Encode + Decode>: Core<Block> {
    // Provided methods
    fn pot_parameters(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<PotParameters, ApiError> { ... }
    fn solution_ranges(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<SolutionRanges, ApiError> { ... }
    fn submit_vote_extrinsic(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        signed_vote: SignedVote<<<Block as BlockT>::Header as HeaderT>::Number, Block::Hash, RewardAddress>,
    ) -> Result<(), ApiError> { ... }
    fn history_size(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<HistorySize, ApiError> { ... }
    fn max_pieces_in_sector(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<u16, ApiError> { ... }
    fn segment_commitment(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        segment_index: SegmentIndex,
    ) -> Result<Option<SegmentCommitment>, ApiError> { ... }
    fn extract_segment_headers(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        ext: &Block::Extrinsic,
    ) -> Result<Option<Vec<SegmentHeader>>, ApiError> { ... }
    fn is_inherent(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        ext: &Block::Extrinsic,
    ) -> Result<bool, ApiError> { ... }
    fn root_plot_public_key(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<Option<PublicKey>, ApiError> { ... }
    fn should_adjust_solution_range(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<bool, ApiError> { ... }
    fn chain_constants(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<ChainConstants, ApiError> { ... }
}
Expand description

API necessary for block authorship with Subspace.

Provided Methods§

source

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

Proof of time parameters

source

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

Solution ranges.

source

fn submit_vote_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, signed_vote: SignedVote<<<Block as BlockT>::Header as HeaderT>::Number, Block::Hash, RewardAddress>, ) -> Result<(), ApiError>

Submit farmer vote vote that is essentially a header with bigger solution range than acceptable for block authoring. Only useful in an offchain context.

source

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

Size of the blockchain history

source

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

How many pieces one sector is supposed to contain (max)

source

fn segment_commitment( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, segment_index: SegmentIndex, ) -> Result<Option<SegmentCommitment>, ApiError>

Get the segment commitment of records for specified segment index

source

fn extract_segment_headers( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ext: &Block::Extrinsic, ) -> Result<Option<Vec<SegmentHeader>>, ApiError>

Returns Vec<SegmentHeader> if a given extrinsic has them.

source

fn is_inherent( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ext: &Block::Extrinsic, ) -> Result<bool, ApiError>

Checks if the extrinsic is an inherent.

source

fn root_plot_public_key( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Option<PublicKey>, ApiError>

Returns root plot public key in case block authoring is restricted.

source

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

Whether solution range adjustment is enabled.

source

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

Get Subspace blockchain constants

Trait Implementations§

source§

impl<Block: BlockT, RewardAddress: Encode + Decode> RuntimeApiInfo for dyn SubspaceApi<Block, RewardAddress>

source§

const ID: [u8; 8] = _

The identifier of the runtime api.
source§

const VERSION: u32 = 1u32

The version of the runtime api.

Implementors§