Trait sp_consensus_sassafras::SassafrasApi
source · pub trait SassafrasApi<Block: BlockT>: Core<Block> {
// Provided methods
fn ring_context(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<Option<RingContext>, ApiError> { ... }
fn submit_tickets_unsigned_extrinsic(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
tickets: Vec<TicketEnvelope>,
) -> Result<bool, ApiError> { ... }
fn slot_ticket_id(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
slot: Slot,
) -> Result<Option<TicketId>, ApiError> { ... }
fn slot_ticket(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
slot: Slot,
) -> Result<Option<(TicketId, TicketBody)>, 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,
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<bool, ApiError> { ... }
}
Expand description
API necessary for block authorship with Sassafras.
Provided Methods§
sourcefn ring_context(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<Option<RingContext>, ApiError>
fn ring_context( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Option<RingContext>, ApiError>
Get ring context to be used for ticket construction and verification.
sourcefn submit_tickets_unsigned_extrinsic(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
tickets: Vec<TicketEnvelope>,
) -> Result<bool, ApiError>
fn submit_tickets_unsigned_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, tickets: Vec<TicketEnvelope>, ) -> Result<bool, ApiError>
Submit next epoch validator tickets via an unsigned extrinsic.
This method returns false
when creation of the extrinsics fails.
sourcefn slot_ticket_id(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
slot: Slot,
) -> Result<Option<TicketId>, ApiError>
fn slot_ticket_id( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, slot: Slot, ) -> Result<Option<TicketId>, ApiError>
Get ticket id associated to the given slot.
sourcefn slot_ticket(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
slot: Slot,
) -> Result<Option<(TicketId, TicketBody)>, ApiError>
fn slot_ticket( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, slot: Slot, ) -> Result<Option<(TicketId, TicketBody)>, ApiError>
Get ticket id and data associated to the given slot.
sourcefn current_epoch(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
) -> Result<Epoch, ApiError>
fn current_epoch( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Epoch, ApiError>
Current epoch information.
sourcefn next_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>
Next epoch information.
sourcefn generate_key_ownership_proof(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
authority_id: AuthorityId,
) -> Result<Option<OpaqueKeyOwnershipProof>, ApiError>
fn generate_key_ownership_proof( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, 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.
sourcefn submit_report_equivocation_unsigned_extrinsic(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
equivocation_proof: EquivocationProof<Block::Header>,
key_owner_proof: OpaqueKeyOwnershipProof,
) -> Result<bool, 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<bool, 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 false
when creation of the extrinsic fails.
Only useful in an offchain context.