referrerpolicy=no-referrer-when-downgrade

HopRuntimeApi

Trait HopRuntimeApi 

Source
pub trait HopRuntimeApi<Block: BlockT, AccountId>: Core<Block>
where AccountId: Codec,
{ // Provided methods fn can_account_promote( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, who: AccountId, data_len: u32, ) -> Result<bool, ApiError> { ... } fn create_promotion_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, data: Vec<u8>, signer: MultiSigner, signature: MultiSignature, submit_timestamp: u64, ) -> Result<Block::Extrinsic, ApiError> { ... } fn max_promotion_size( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, ) -> Result<u32, ApiError> { ... } fn is_promoted_on_chain( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, hash: [u8; 32], ) -> Result<bool, ApiError> { ... } }
Expand description

Runtime API for HOP.

Runtimes that support HOP implement this API so the node can check authorization and promote near-expiry pool entries to on-chain storage.

Provided Methods§

Source

fn can_account_promote( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, who: AccountId, data_len: u32, ) -> Result<bool, ApiError>

Whether who may submit a HOP blob of data_len bytes for promotion.

Returns false for any “not allowed” reason — unknown account, exhausted quota, oversized payload, etc.

Source

fn create_promotion_extrinsic( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, data: Vec<u8>, signer: MultiSigner, signature: MultiSignature, submit_timestamp: u64, ) -> Result<Block::Extrinsic, ApiError>

Construct an unsigned promotion extrinsic carrying the user’s submit-time (in milliseconds from the Unix epoch), signer, signature, and timestamp so the runtime pallet can verify consent on-chain. submit_timestamp is bound into the signed payload and bounds the signature’s validity window, preventing replay long after the fact.

Source

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

Maximum data size per promotion extrinsic.

Source

fn is_promoted_on_chain( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, hash: [u8; 32], ) -> Result<bool, ApiError>

Whether the content with hash is already stored on-chain.

Used by HOP’s maintenance task to confirm that a previously submitted promotion extrinsic actually made it into a block.

Trait Implementations§

Source§

impl<Block: BlockT, AccountId> RuntimeApiInfo for dyn HopRuntimeApi<Block, AccountId>

Source§

const ID: [u8; 8]

The identifier of the runtime api.
Source§

const VERSION: u32 = 1u32

The version of the runtime api.

Implementors§