pub trait AuraUnincludedSegmentApi<Block: BlockT>: Core<Block> {
// Provided method
fn can_build_upon(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
included_hash: Block::Hash,
slot: Slot,
) -> Result<bool, ApiError> { ... }
}
Expand description
This runtime API is used to inform potential block authors whether they will have the right to author at a slot, assuming they have claimed the slot.
In particular, this API allows Aura-based parachains to regulate their “unincluded segment”, which is the section of the head of the chain which has not yet been made available in the relay chain.
When the unincluded segment is short, Aura chains will allow authors to create multiple blocks per slot in order to build a backlog. When it is saturated, this API will limit the amount of blocks that can be created.
Provided Methods§
sourcefn can_build_upon(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
included_hash: Block::Hash,
slot: Slot,
) -> Result<bool, ApiError>
fn can_build_upon( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, included_hash: Block::Hash, slot: Slot, ) -> Result<bool, ApiError>
Whether it is legal to extend the chain, assuming the given block is the most recently included one as-of the relay parent that will be built against, and the given slot.
This should be consistent with the logic the runtime uses when validating blocks to avoid issues.
When the unincluded segment is empty, i.e. included_hash == at
, where at is the block
whose state we are querying against, this must always return true
as long as the slot
is more recent than the included block itself.