referrerpolicy=no-referrer-when-downgrade

Trait sp_mixnet::runtime_api::MixnetApi

source ·
pub trait MixnetApi<Block: BlockT>: Core<Block> {
    // Provided methods
    fn session_status(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<SessionStatus, ApiError> { ... }
    fn prev_mixnodes(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<Result<Vec<Mixnode>, MixnodesErr>, ApiError> { ... }
    fn current_mixnodes(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
    ) -> Result<Result<Vec<Mixnode>, MixnodesErr>, ApiError> { ... }
    fn maybe_register(
        &self,
        __runtime_api_at_param__: <Block as BlockT>::Hash,
        session_index: SessionIndex,
        mixnode: Mixnode,
    ) -> Result<bool, ApiError> { ... }
}
Expand description

API to query the mixnet session status and mixnode sets, and to register mixnodes.

Provided Methods§

source

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

Get the index and phase of the current session.

source

fn prev_mixnodes( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Result<Vec<Mixnode>, MixnodesErr>, ApiError>

Get the mixnode set for the previous session.

source

fn current_mixnodes( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<Result<Vec<Mixnode>, MixnodesErr>, ApiError>

Get the mixnode set for the current session.

source

fn maybe_register( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, session_index: SessionIndex, mixnode: Mixnode, ) -> Result<bool, ApiError>

Try to register a mixnode for the next session.

If a registration extrinsic is submitted, true is returned. The caller should avoid calling maybe_register again for a few blocks, to give the submitted extrinsic a chance to get included.

With the above exception, maybe_register is designed to be called every block. Most of the time it will not do anything, for example:

  • If it is not an appropriate time to submit a registration extrinsic.
  • If the local node has already registered a mixnode for the next session.
  • If the local node is not permitted to register a mixnode for the next session.

session_index should match session_status().current_index; if it does not, false is returned immediately.

Trait Implementations§

source§

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

source§

const ID: [u8; 8] = _

The identifier of the runtime api.
source§

const VERSION: u32 = 1u32

The version of the runtime api.

Implementors§