Kagome
Polkadot Runtime Engine in C++17
parachain_host.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_RUNTIME_PARACHAIN_HOST_HPP
7 #define KAGOME_CORE_RUNTIME_PARACHAIN_HOST_HPP
8 
9 #include "common/blob.hpp"
10 #include "common/unused.hpp"
11 #include "primitives/block_id.hpp"
12 #include "primitives/common.hpp"
15 
16 namespace kagome::runtime {
17 
18  class ParachainHost {
19  protected:
20  public:
21  virtual ~ParachainHost() = default;
22 
27  virtual outcome::result<DutyRoster> duty_roster(
28  const primitives::BlockHash &block) = 0;
29 
34  virtual outcome::result<std::vector<ParachainId>> active_parachains(
35  const primitives::BlockHash &block) = 0;
36 
42  virtual outcome::result<std::optional<Buffer>> parachain_head(
43  const primitives::BlockHash &block, ParachainId id) = 0;
44 
50  virtual outcome::result<std::optional<kagome::common::Buffer>>
51  parachain_code(const primitives::BlockHash &block, ParachainId id) = 0;
52 
57  virtual outcome::result<std::vector<ValidatorId>> validators(
58  const primitives::BlockHash &block) = 0;
59 
67  virtual outcome::result<std::vector<ValidatorGroup>> validator_groups(
68  const primitives::BlockHash &block) = 0;
69 
76  virtual outcome::result<std::vector<CoreState>> availability_cores(
77  const primitives::BlockHash &block) = 0;
78 
89  virtual outcome::result<std::optional<PersistedValidationData>>
91  ParachainId id,
92  OccupiedCoreAssumption assumption) = 0;
93 
101  virtual outcome::result<bool> check_validation_outputs(
102  const primitives::BlockHash &block,
103  ParachainId id,
104  CandidateCommitments outputs) = 0;
105 
111  virtual outcome::result<SessionIndex> session_index_for_child(
112  const primitives::BlockHash &block) = 0;
113 
122  virtual outcome::result<std::optional<ValidationCode>> validation_code(
123  const primitives::BlockHash &block,
124  ParachainId id,
125  OccupiedCoreAssumption assumption) = 0;
126 
132  virtual outcome::result<std::optional<ValidationCode>>
134  ValidationCodeHash hash) = 0;
135 
142  virtual outcome::result<std::optional<CommittedCandidateReceipt>>
144  ParachainId id) = 0;
145 
147 
152  virtual outcome::result<std::vector<CandidateEvent>> candidate_events(
153  const primitives::BlockHash &block) = 0;
154 
161  virtual outcome::result<std::optional<SessionInfo>> session_info(
162  const primitives::BlockHash &block, SessionIndex index) = 0;
163 
170  virtual outcome::result<std::vector<InboundDownwardMessage>> dmq_contents(
171  const primitives::BlockHash &block, ParachainId id) = 0;
172 
179  virtual outcome::result<
180  std::map<ParachainId, std::vector<InboundHrmpMessage>>>
182  ParachainId id) = 0;
183  };
184 
185 } // namespace kagome::runtime
186 #endif // KAGOME_CORE_RUNTIME_PARACHAIN_HOST_HPP
virtual outcome::result< std::map< ParachainId, std::vector< InboundHrmpMessage > > > inbound_hrmp_channels_contents(const primitives::BlockHash &block, ParachainId id)=0
Get the contents of all channels addressed to the given recipient. Channels that have no messages in ...
virtual outcome::result< std::optional< PersistedValidationData > > persisted_validation_data(const primitives::BlockHash &block, ParachainId id, OccupiedCoreAssumption assumption)=0
Yields the persisted validation data for the given ParaId along with an assumption that should be use...
virtual outcome::result< std::optional< Buffer > > parachain_head(const primitives::BlockHash &block, ParachainId id)=0
Calls the ParachainHost_parachain_head function from wasm code.
virtual outcome::result< DutyRoster > duty_roster(const primitives::BlockHash &block)=0
Calls the ParachainHost_duty_roster function from wasm code.
virtual outcome::result< std::vector< CandidateEvent > > candidate_events(const primitives::BlockHash &block)=0
Get a vector of events concerning candidates that occurred within a block.
virtual outcome::result< std::optional< CommittedCandidateReceipt > > candidate_pending_availability(const primitives::BlockHash &block, ParachainId id)=0
Get the receipt of a candidate pending availability.
virtual outcome::result< std::vector< ParachainId > > active_parachains(const primitives::BlockHash &block)=0
Calls the ParachainHost_active_parachains function from wasm code.
virtual outcome::result< std::optional< SessionInfo > > session_info(const primitives::BlockHash &block, SessionIndex index)=0
Get the session info for the given session, if stored.
virtual outcome::result< bool > check_validation_outputs(const primitives::BlockHash &block, ParachainId id, CandidateCommitments outputs)=0
Checks if the given validation outputs pass the acceptance criteria.
virtual ~ParachainHost()=default
virtual outcome::result< SessionIndex > session_index_for_child(const primitives::BlockHash &block)=0
Returns the session index expected at a child of the block. This can be used to instantiate a Signing...
virtual outcome::result< std::vector< ValidatorGroup > > validator_groups(const primitives::BlockHash &block)=0
Returns the validator groups and rotation info localized based on the hypothetical child of a block w...
virtual outcome::result< std::vector< InboundDownwardMessage > > dmq_contents(const primitives::BlockHash &block, ParachainId id)=0
Get all the pending inbound messages in the downward message queue for a para.
virtual outcome::result< std::optional< ValidationCode > > validation_code(const primitives::BlockHash &block, ParachainId id, OccupiedCoreAssumption assumption)=0
Fetch the validation code used by a para, making the given OccupiedCoreAssumption.
virtual outcome::result< std::optional< ValidationCode > > validation_code_by_hash(const primitives::BlockHash &block, ValidationCodeHash hash)=0
Get the validation code (runtime) from its hash.
virtual outcome::result< std::vector< ValidatorId > > validators(const primitives::BlockHash &block)=0
reports validators list for given block_id
virtual outcome::result< std::vector< CoreState > > availability_cores(const primitives::BlockHash &block)=0
Yields information on all availability cores as relevant to the child block. Cores are either free or...
virtual outcome::result< std::optional< kagome::common::Buffer > > parachain_code(const primitives::BlockHash &block, ParachainId id)=0
Calls the ParachainHost_parachain_code function from wasm code.
primitives::parachain::ParaId ParachainId