Kagome
Polkadot Runtime Engine in C++17
kagome::runtime::ParachainHostImpl Class Referencefinal

#include <parachain_host.hpp>

Inheritance diagram for kagome::runtime::ParachainHostImpl:
Collaboration diagram for kagome::runtime::ParachainHostImpl:

Public Member Functions

 ParachainHostImpl (std::shared_ptr< Executor > executor)
 
outcome::result< DutyRosterduty_roster (const primitives::BlockHash &block) override
 Calls the ParachainHost_duty_roster function from wasm code. More...
 
outcome::result< std::vector< ParachainId > > active_parachains (const primitives::BlockHash &block) override
 Calls the ParachainHost_active_parachains function from wasm code. More...
 
outcome::result< std::optional< Buffer > > parachain_head (const primitives::BlockHash &block, ParachainId id) override
 Calls the ParachainHost_parachain_head function from wasm code. More...
 
outcome::result< std::optional< kagome::common::Buffer > > parachain_code (const primitives::BlockHash &block, ParachainId id) override
 Calls the ParachainHost_parachain_code function from wasm code. More...
 
outcome::result< std::vector< ValidatorId > > validators (const primitives::BlockHash &block) override
 reports validators list for given block_id More...
 
outcome::result< std::vector< ValidatorGroup > > validator_groups (const primitives::BlockHash &block) override
 Returns the validator groups and rotation info localized based on the hypothetical child of a block whose state this is invoked on. Note that now in the GroupRotationInfoshould be the successor of the number of the block. More...
 
outcome::result< std::vector< CoreState > > availability_cores (const primitives::BlockHash &block) override
 Yields information on all availability cores as relevant to the child block. Cores are either free or occupied. Free cores can have paras assigned to them. More...
 
outcome::result< std::optional< PersistedValidationData > > persisted_validation_data (const primitives::BlockHash &block, ParachainId id, OccupiedCoreAssumption assumption) override
 Yields the persisted validation data for the given ParaId along with an assumption that should be used if the para currently occupies a core. More...
 
outcome::result< bool > check_validation_outputs (const primitives::BlockHash &block, ParachainId id, CandidateCommitments outputs) override
 Checks if the given validation outputs pass the acceptance criteria. More...
 
outcome::result< SessionIndexsession_index_for_child (const primitives::BlockHash &block) override
 Returns the session index expected at a child of the block. This can be used to instantiate a SigningContext. More...
 
outcome::result< std::optional< ValidationCode > > validation_code (const primitives::BlockHash &block, ParachainId id, OccupiedCoreAssumption assumption) override
 Fetch the validation code used by a para, making the given OccupiedCoreAssumption. More...
 
outcome::result< std::optional< ValidationCode > > validation_code_by_hash (const primitives::BlockHash &block, ValidationCodeHash hash) override
 Get the validation code (runtime) from its hash. More...
 
outcome::result< std::optional< CommittedCandidateReceipt > > candidate_pending_availability (const primitives::BlockHash &block, ParachainId id) override
 Get the receipt of a candidate pending availability. More...
 
outcome::result< std::vector< CandidateEvent > > candidate_events (const primitives::BlockHash &block) override
 Get a vector of events concerning candidates that occurred within a block. More...
 
outcome::result< std::optional< SessionInfo > > session_info (const primitives::BlockHash &block, SessionIndex index) override
 Get the session info for the given session, if stored. More...
 
outcome::result< std::vector< InboundDownwardMessage > > dmq_contents (const primitives::BlockHash &block, ParachainId id) override
 Get all the pending inbound messages in the downward message queue for a para. More...
 
outcome::result< std::map< ParachainId, std::vector< InboundHrmpMessage > > > inbound_hrmp_channels_contents (const primitives::BlockHash &block, ParachainId id) override
 Get the contents of all channels addressed to the given recipient. Channels that have no messages in them are also included. More...
 
- Public Member Functions inherited from kagome::runtime::ParachainHost
virtual ~ParachainHost ()=default
 

Private Attributes

std::shared_ptr< Executorexecutor_
 

Detailed Description

Definition at line 16 of file parachain_host.hpp.

Constructor & Destructor Documentation

kagome::runtime::ParachainHostImpl::ParachainHostImpl ( std::shared_ptr< Executor executor)
explicit

Definition at line 14 of file parachain_host.cpp.

Member Function Documentation

outcome::result< std::vector< ParachainId > > kagome::runtime::ParachainHostImpl::active_parachains ( const primitives::BlockHash block)
overridevirtual

Calls the ParachainHost_active_parachains function from wasm code.

Returns
vector of ParachainId items or error if fails

Implements kagome::runtime::ParachainHost.

Definition at line 25 of file parachain_host.cpp.

outcome::result< std::vector< CoreState > > kagome::runtime::ParachainHostImpl::availability_cores ( const primitives::BlockHash block)
overridevirtual

Yields information on all availability cores as relevant to the child block. Cores are either free or occupied. Free cores can have paras assigned to them.

Returns
vector of core states

Implements kagome::runtime::ParachainHost.

Definition at line 56 of file parachain_host.cpp.

outcome::result< std::vector< CandidateEvent > > kagome::runtime::ParachainHostImpl::candidate_events ( const primitives::BlockHash block)
overridevirtual

Get a vector of events concerning candidates that occurred within a block.

Returns
vector of events

Implements kagome::runtime::ParachainHost.

Definition at line 108 of file parachain_host.cpp.

outcome::result< std::optional< CommittedCandidateReceipt > > kagome::runtime::ParachainHostImpl::candidate_pending_availability ( const primitives::BlockHash block,
ParachainId  id 
)
overridevirtual

Get the receipt of a candidate pending availability.

Parameters
idparachain id
Returns
This returns CommittedCandidateReceipt for any paras assigned to occupied cores in availability_cores and nullopt otherwise.

Implements kagome::runtime::ParachainHost.

Definition at line 101 of file parachain_host.cpp.

outcome::result< bool > kagome::runtime::ParachainHostImpl::check_validation_outputs ( const primitives::BlockHash block,
ParachainId  id,
CandidateCommitments  outputs 
)
overridevirtual

Checks if the given validation outputs pass the acceptance criteria.

Parameters
idparachain id
outputscandidate commitments
Returns
validity (bool)

Implements kagome::runtime::ParachainHost.

Definition at line 71 of file parachain_host.cpp.

outcome::result< std::vector< InboundDownwardMessage > > kagome::runtime::ParachainHostImpl::dmq_contents ( const primitives::BlockHash block,
ParachainId  id 
)
overridevirtual

Get all the pending inbound messages in the downward message queue for a para.

Parameters
idparachain id
Returns
vector of messages

Implements kagome::runtime::ParachainHost.

Definition at line 120 of file parachain_host.cpp.

outcome::result< DutyRoster > kagome::runtime::ParachainHostImpl::duty_roster ( const primitives::BlockHash block)
overridevirtual

Calls the ParachainHost_duty_roster function from wasm code.

Returns
DutyRoster structure or error if fails

Implements kagome::runtime::ParachainHost.

Definition at line 19 of file parachain_host.cpp.

outcome::result< std::map< ParachainId, std::vector< InboundHrmpMessage > > > kagome::runtime::ParachainHostImpl::inbound_hrmp_channels_contents ( const primitives::BlockHash block,
ParachainId  id 
)
overridevirtual

Get the contents of all channels addressed to the given recipient. Channels that have no messages in them are also included.

Returns
Map of vectors of an inbound HRMP messages (Horizontal Relay-routed Message Passing) per parachain

Implements kagome::runtime::ParachainHost.

Definition at line 127 of file parachain_host.cpp.

outcome::result< std::optional< common::Buffer > > kagome::runtime::ParachainHostImpl::parachain_code ( const primitives::BlockHash block,
ParachainId  id 
)
overridevirtual

Calls the ParachainHost_parachain_code function from wasm code.

Parameters
idparachain id
Returns
parachain code or error if fails

Implements kagome::runtime::ParachainHost.

Definition at line 38 of file parachain_host.cpp.

outcome::result< std::optional< common::Buffer > > kagome::runtime::ParachainHostImpl::parachain_head ( const primitives::BlockHash block,
ParachainId  id 
)
overridevirtual

Calls the ParachainHost_parachain_head function from wasm code.

Parameters
idparachain id
Returns
parachain head or error if fails

Implements kagome::runtime::ParachainHost.

Definition at line 31 of file parachain_host.cpp.

outcome::result< std::optional< PersistedValidationData > > kagome::runtime::ParachainHostImpl::persisted_validation_data ( const primitives::BlockHash block,
ParachainId  id,
OccupiedCoreAssumption  assumption 
)
overridevirtual

Yields the persisted validation data for the given ParaId along with an assumption that should be used if the para currently occupies a core.

Parameters
idparachain id
assumptionoccupied core assumption
Returns
Returns nullopt if either the para is not registered or the assumption is Freed (not Included) and the para already occupies a core.

Implements kagome::runtime::ParachainHost.

Definition at line 63 of file parachain_host.cpp.

outcome::result< SessionIndex > kagome::runtime::ParachainHostImpl::session_index_for_child ( const primitives::BlockHash block)
overridevirtual

Returns the session index expected at a child of the block. This can be used to instantiate a SigningContext.

Returns
session index

Implements kagome::runtime::ParachainHost.

Definition at line 79 of file parachain_host.cpp.

outcome::result< std::optional< SessionInfo > > kagome::runtime::ParachainHostImpl::session_info ( const primitives::BlockHash block,
SessionIndex  index 
)
overridevirtual

Get the session info for the given session, if stored.

Note
This function is only available since parachain host version 2.
Parameters
indexsession index
Returns
SessionInfo, optional

Implements kagome::runtime::ParachainHost.

Definition at line 113 of file parachain_host.cpp.

outcome::result< std::optional< ValidationCode > > kagome::runtime::ParachainHostImpl::validation_code ( const primitives::BlockHash block,
ParachainId  id,
OccupiedCoreAssumption  assumption 
)
overridevirtual

Fetch the validation code used by a para, making the given OccupiedCoreAssumption.

Parameters
idparachain id
assumptionoccupied core assumption
Returns
nullopt if either the para is not registered or the assumption is Freed (TimedOut or Unused) and the para already occupies a core.

Implements kagome::runtime::ParachainHost.

Definition at line 86 of file parachain_host.cpp.

outcome::result< std::optional< ValidationCode > > kagome::runtime::ParachainHostImpl::validation_code_by_hash ( const primitives::BlockHash block,
ValidationCodeHash  hash 
)
overridevirtual

Get the validation code (runtime) from its hash.

Parameters
hashvalidation code hash
Returns
validation code, if found

Implements kagome::runtime::ParachainHost.

Definition at line 94 of file parachain_host.cpp.

outcome::result< std::vector< ValidatorGroup > > kagome::runtime::ParachainHostImpl::validator_groups ( const primitives::BlockHash block)
overridevirtual

Returns the validator groups and rotation info localized based on the hypothetical child of a block whose state this is invoked on. Note that now in the GroupRotationInfoshould be the successor of the number of the block.

Returns
vector of validator groups

Implements kagome::runtime::ParachainHost.

Definition at line 51 of file parachain_host.cpp.

outcome::result< std::vector< ValidatorId > > kagome::runtime::ParachainHostImpl::validators ( const primitives::BlockHash block)
overridevirtual

reports validators list for given block_id

Returns
validators list

Implements kagome::runtime::ParachainHost.

Definition at line 44 of file parachain_host.cpp.

Member Data Documentation

std::shared_ptr<Executor> kagome::runtime::ParachainHostImpl::executor_
private

Definition at line 80 of file parachain_host.hpp.


The documentation for this class was generated from the following files: