Trait sp_consensus_subspace::SubspaceApi

source ·
pub trait SubspaceApi<Block: BlockT, RewardAddress: Encode + Decode>: Core<Block> {
Show 13 methods // 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_report_equivocation_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, equivocation_proof: EquivocationProof<Block::Header>, ) -> Result<Option<()>, 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 is_in_block_list( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, farmer_public_key: &FarmerPublicKey, ) -> Result<bool, 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<FarmerPublicKey>, 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_report_equivocation_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, equivocation_proof: EquivocationProof<Block::Header>, ) -> Result<Option<()>, ApiError>

Submits an unsigned extrinsic to report an equivocation. The caller must provide the equivocation 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.

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 is_in_block_list( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, farmer_public_key: &FarmerPublicKey, ) -> Result<bool, ApiError>

Check if farmer_public_key is in block list (due to equivocation)

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<FarmerPublicKey>, 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§