Kagome
Polkadot Runtime Engine in C++17
parachain_host.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_RUNTIME_IMPL_PARACHAIN_HOST_HPP
7 #define KAGOME_CORE_RUNTIME_IMPL_PARACHAIN_HOST_HPP
8 
11 
12 namespace kagome::runtime {
13 
14  class Executor;
15 
16  class ParachainHostImpl final : public ParachainHost {
17  public:
18  explicit ParachainHostImpl(std::shared_ptr<Executor> executor);
19 
20  outcome::result<DutyRoster> duty_roster(
21  const primitives::BlockHash &block) override;
22 
23  outcome::result<std::vector<ParachainId>> active_parachains(
24  const primitives::BlockHash &block) override;
25 
26  outcome::result<std::optional<Buffer>> parachain_head(
27  const primitives::BlockHash &block, ParachainId id) override;
28 
29  outcome::result<std::optional<kagome::common::Buffer>> parachain_code(
30  const primitives::BlockHash &block, ParachainId id) override;
31 
32  outcome::result<std::vector<ValidatorId>> validators(
33  const primitives::BlockHash &block) override;
34 
35  outcome::result<std::vector<ValidatorGroup>> validator_groups(
36  const primitives::BlockHash &block) override;
37 
38  outcome::result<std::vector<CoreState>> availability_cores(
39  const primitives::BlockHash &block) override;
40 
41  outcome::result<std::optional<PersistedValidationData>>
43  ParachainId id,
44  OccupiedCoreAssumption assumption) override;
45 
46  outcome::result<bool> check_validation_outputs(
47  const primitives::BlockHash &block,
48  ParachainId id,
49  CandidateCommitments outputs) override;
50 
51  outcome::result<SessionIndex> session_index_for_child(
52  const primitives::BlockHash &block) override;
53 
54  outcome::result<std::optional<ValidationCode>> validation_code(
55  const primitives::BlockHash &block,
56  ParachainId id,
57  OccupiedCoreAssumption assumption) override;
58 
59  outcome::result<std::optional<ValidationCode>> validation_code_by_hash(
60  const primitives::BlockHash &block, ValidationCodeHash hash) override;
61 
62  outcome::result<std::optional<CommittedCandidateReceipt>>
64  ParachainId id) override;
65 
66  outcome::result<std::vector<CandidateEvent>> candidate_events(
67  const primitives::BlockHash &block) override;
68 
69  outcome::result<std::optional<SessionInfo>> session_info(
70  const primitives::BlockHash &block, SessionIndex index) override;
71 
72  outcome::result<std::vector<InboundDownwardMessage>> dmq_contents(
73  const primitives::BlockHash &block, ParachainId id) override;
74 
75  outcome::result<std::map<ParachainId, std::vector<InboundHrmpMessage>>>
77  ParachainId id) override;
78 
79  private:
80  std::shared_ptr<Executor> executor_;
81  };
82 
83 } // namespace kagome::runtime
84 
85 #endif // KAGOME_CORE_RUNTIME_PARACHAIN_HOST_HPP
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 w...
outcome::result< std::optional< SessionInfo > > session_info(const primitives::BlockHash &block, SessionIndex index) override
Get the session info for the given session, if stored.
outcome::result< std::optional< ValidationCode > > validation_code_by_hash(const primitives::BlockHash &block, ValidationCodeHash hash) override
Get the validation code (runtime) from its hash.
outcome::result< std::vector< CandidateEvent > > candidate_events(const primitives::BlockHash &block) override
Get a vector of events concerning candidates that occurred within a block.
std::shared_ptr< Executor > executor_
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.
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 use...
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...
outcome::result< std::vector< ParachainId > > active_parachains(const primitives::BlockHash &block) override
Calls the ParachainHost_active_parachains function from wasm code.
outcome::result< DutyRoster > duty_roster(const primitives::BlockHash &block) override
Calls the ParachainHost_duty_roster function from wasm code.
ParachainHostImpl(std::shared_ptr< Executor > executor)
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.
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.
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.
outcome::result< std::vector< ValidatorId > > validators(const primitives::BlockHash &block) override
reports validators list for given block_id
outcome::result< std::optional< Buffer > > parachain_head(const primitives::BlockHash &block, ParachainId id) override
Calls the ParachainHost_parachain_head function from wasm code.
outcome::result< SessionIndex > session_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 Signing...
outcome::result< std::optional< CommittedCandidateReceipt > > candidate_pending_availability(const primitives::BlockHash &block, ParachainId id) override
Get the receipt of a candidate pending availability.
primitives::parachain::ParaId ParachainId
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 ...