Trait sp_consensus_beefy::BeefyApi
source · pub trait BeefyApi<Block: BlockT, AuthorityId>: Core<Block>where
AuthorityId: Codec + RuntimeAppPublic,{
// Provided methods
fn beefy_genesis(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<Option<NumberFor<Block>>, ApiError> { ... }
fn validator_set(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<Option<ValidatorSet<AuthorityId>>, ApiError> { ... }
fn submit_report_double_voting_unsigned_extrinsic(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
equivocation_proof: DoubleVotingProof<NumberFor<Block>, AuthorityId, <AuthorityId as RuntimeAppPublic>::Signature>,
key_owner_proof: OpaqueKeyOwnershipProof,
) -> Result<Option<()>, ApiError> { ... }
fn submit_report_fork_voting_unsigned_extrinsic(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
equivocation_proof: ForkVotingProof<Block::Header, AuthorityId, OpaqueValue>,
key_owner_proof: OpaqueKeyOwnershipProof,
) -> Result<Option<()>, ApiError> { ... }
fn submit_report_future_block_voting_unsigned_extrinsic(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
equivocation_proof: FutureBlockVotingProof<NumberFor<Block>, AuthorityId>,
key_owner_proof: OpaqueKeyOwnershipProof,
) -> Result<Option<()>, ApiError> { ... }
fn generate_key_ownership_proof(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
set_id: ValidatorSetId,
authority_id: AuthorityId,
) -> Result<Option<OpaqueKeyOwnershipProof>, ApiError> { ... }
fn generate_ancestry_proof(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
prev_block_number: NumberFor<Block>,
best_known_block_number: Option<NumberFor<Block>>,
) -> Result<Option<OpaqueValue>, ApiError> { ... }
}
Expand description
API necessary for BEEFY voters.
Provided Methods§
sourcefn beefy_genesis(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<Option<NumberFor<Block>>, ApiError>
fn beefy_genesis( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Option<NumberFor<Block>>, ApiError>
Return the block number where BEEFY consensus is enabled/started
sourcefn validator_set(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<Option<ValidatorSet<AuthorityId>>, ApiError>
fn validator_set( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Option<ValidatorSet<AuthorityId>>, ApiError>
Return the current active BEEFY validator set
sourcefn submit_report_double_voting_unsigned_extrinsic(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
equivocation_proof: DoubleVotingProof<NumberFor<Block>, AuthorityId, <AuthorityId as RuntimeAppPublic>::Signature>,
key_owner_proof: OpaqueKeyOwnershipProof,
) -> Result<Option<()>, ApiError>
fn submit_report_double_voting_unsigned_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, equivocation_proof: DoubleVotingProof<NumberFor<Block>, AuthorityId, <AuthorityId as RuntimeAppPublic>::Signature>, key_owner_proof: OpaqueKeyOwnershipProof, ) -> Result<Option<()>, ApiError>
Submits an unsigned extrinsic to report a double voting equivocation. The caller
must provide the double voting 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.
sourcefn submit_report_fork_voting_unsigned_extrinsic(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
equivocation_proof: ForkVotingProof<Block::Header, AuthorityId, OpaqueValue>,
key_owner_proof: OpaqueKeyOwnershipProof,
) -> Result<Option<()>, ApiError>
fn submit_report_fork_voting_unsigned_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, equivocation_proof: ForkVotingProof<Block::Header, AuthorityId, OpaqueValue>, key_owner_proof: OpaqueKeyOwnershipProof, ) -> Result<Option<()>, ApiError>
Submits an unsigned extrinsic to report a fork voting equivocation. The caller
must provide the fork voting proof (the ancestry proof should be obtained using
generate_ancestry_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.
sourcefn submit_report_future_block_voting_unsigned_extrinsic(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
equivocation_proof: FutureBlockVotingProof<NumberFor<Block>, AuthorityId>,
key_owner_proof: OpaqueKeyOwnershipProof,
) -> Result<Option<()>, ApiError>
fn submit_report_future_block_voting_unsigned_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, equivocation_proof: FutureBlockVotingProof<NumberFor<Block>, AuthorityId>, key_owner_proof: OpaqueKeyOwnershipProof, ) -> Result<Option<()>, ApiError>
Submits an unsigned extrinsic to report a future block voting equivocation. The caller
must provide the future block voting 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.
sourcefn generate_key_ownership_proof(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
set_id: ValidatorSetId,
authority_id: AuthorityId,
) -> Result<Option<OpaqueKeyOwnershipProof>, ApiError>
fn generate_key_ownership_proof( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, set_id: ValidatorSetId, authority_id: AuthorityId, ) -> Result<Option<OpaqueKeyOwnershipProof>, ApiError>
Generates a proof of key ownership for the given authority in the
given set. 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 set_id
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 given set id is live on-chain. Future implementations will
instead use indexed data through an offchain worker, not requiring
older states to be available.
sourcefn generate_ancestry_proof(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
prev_block_number: NumberFor<Block>,
best_known_block_number: Option<NumberFor<Block>>,
) -> Result<Option<OpaqueValue>, ApiError>
fn generate_ancestry_proof( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, prev_block_number: NumberFor<Block>, best_known_block_number: Option<NumberFor<Block>>, ) -> Result<Option<OpaqueValue>, ApiError>
Generates a proof that the prev_block_number
is part of the canonical chain at
best_known_block_number
.