Kagome
Polkadot Runtime Engine in C++17
parachain_host_types.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CORE_RUNTIME_PARACHAIN_HOST_TYPES_HPP
7 #define KAGOME_CORE_RUNTIME_PARACHAIN_HOST_TYPES_HPP
8 
9 #include <scale/bitvec.hpp>
10 
11 #include "common/blob.hpp"
12 #include "common/unused.hpp"
14 #include "primitives/block_id.hpp"
15 #include "primitives/common.hpp"
17 
18 namespace kagome::runtime {
19 
24  using GroupIndex = uint32_t;
31  using HeadData = Buffer;
32  using GroupRotatePeriod = uint32_t;
35  using SessionIndex = uint32_t;
36  using CoreIndex = uint32_t;
37 
39  struct ScheduledCore {
43  std::optional<CollatorId> collator;
44  };
45 
70  };
71 
73  struct OccupiedCore {
74  // NOTE: this has no ParaId as it can be deduced from the candidate
75  // descriptor.
79  std::optional<ScheduledCore> next_up_on_available;
87  std::optional<ScheduledCore> next_up_on_time_out;
91  scale::BitVec availability;
98  };
99 
100  using GroupDescriptor =
101  std::tuple<BlockNumber, GroupRotatePeriod, BlockNumber>;
102  using ValidatorGroup = std::tuple<std::vector<ValidatorId>, GroupDescriptor>;
103  using CoreState = boost::variant<OccupiedCore, // 0
104  ScheduledCore, // 1
105  Unused<2>>; // 2
107  Included, // 0
108  TimedOut, // 1
109  Unused // 2
110  };
119  uint32_t max_pov_size;
120  };
121 
127  };
128 
131  std::vector<UpwardMessage> upward_messages;
133  std::vector<OutboundHrmpMessage> horizontal_messages;
135  std::optional<ValidationCode> new_validation_code;
143  };
144 
150  };
151 
157  Hash commitments_hash{};
158  };
159 
160  struct Candidate {
164  };
165 
166  struct CandidateBacked : public Candidate {
167  GroupIndex group_index{};
168  };
169 
170  struct CandidateIncluded : public Candidate {
171  GroupIndex group_index{};
172  };
173 
174  struct CandidateTimedOut : public Candidate {};
175 
176  using CandidateEvent = boost::variant<
179  CandidateBacked, // 0
184  CandidateIncluded, // 1
187  CandidateTimedOut // 2
188  >;
189 
190  using ValidatorIndex = uint32_t;
192  struct SessionInfo {
193  /****** New in v2 *******/
196  std::vector<ValidatorIndex> active_validator_indices;
201 
202  /****** Old fields ******/
211  std::vector<ValidatorId> validators;
220  std::vector<primitives::AuthorityDiscoveryId> discovery_keys;
232  std::vector<AssignmentId> assignment_keys;
236  std::vector<std::vector<ValidatorIndex>> validator_groups;
239  uint32_t n_cores;
248  uint32_t no_show_slots;
251  };
252 
260  };
261 
269  };
270 
271 } // namespace kagome::runtime
272 #endif // KAGOME_CORE_RUNTIME_PARACHAIN_HOST_TYPES_HPP
CandidateDescriptor candidate_descriptor
The descriptor of the candidate occupying the core.
Class represents arbitrary (including empty) byte buffer.
Definition: buffer.hpp:29
boost::variant< OccupiedCore, ScheduledCore, Unused< 2 >> CoreState
std::tuple< std::vector< ValidatorId >, GroupDescriptor > ValidatorGroup
CandidateCommitments commitments
The commitments of the candidate receipt.
ValidationCodeHash validation_code_hash
The blake2-256 hash of the validation code bytes.
Hash erasure_root
The root of a block&#39;s erasure encoding Merkle tree.
Hash relay_parent_storage_root
The relay-chain block storage root this is in the context of.
Hash para_head
Hash of the para header that is being generated by this candidate.
Blob< 32 > Hash256
Definition: blob.hpp:230
std::vector< ValidatorId > validators
Hash relay_parent
The hash of the relay-chain block this is executed in the context of.
CandidateHash candidate_hash
The hash of the candidate occupying the core.
std::optional< ValidationCode > new_validation_code
New validation code.
std::optional< ScheduledCore > next_up_on_time_out
common::Blob< 32 > random_seed
A secure random seed for the session, gathered from BABE.
uint32_t max_pov_size
The maximum legal size of a POV block, in bytes.
HeadData parent_head
The parent head-data.
HeadData head_data
The head-data produced as a result of execution.
common::Blob< 32 > ValidatorId
ValidatorId primitive is an ed25519 or sr25519 public key.
CandidateDescriptor descriptor
The descriptor of the candidate.
SessionIndex dispute_period
The amount of sessions to keep for disputes.
boost::variant< CandidateBacked, CandidateIncluded, CandidateTimedOut > CandidateEvent
BlockNumber time_out_at
The relay-chain block this will time-out at, if any.
uint32_t BlockNumber
Definition: common.hpp:18
SLBuffer< std::numeric_limits< size_t >::max()> Buffer
Definition: buffer.hpp:244
uint32_t n_delay_tranches
The number of delay tranches in total.
ParachainId para_id
The ID of a para scheduled.
std::vector< primitives::AuthorityDiscoveryId > discovery_keys
ParachainId para_id
The ID of the para this is a candidate for.
Hash pov_hash
The blake2-256 hash of the PoV.
BlockNumber relay_parent_number
The relay-chain block number this is in the context of.
std::vector< ValidatorIndex > active_validator_indices
Information about a core which is currently occupied.
std::vector< std::vector< ValidatorIndex > > validator_groups
std::optional< ScheduledCore > next_up_on_available
uint32_t zeroth_delay_tranche_width
The zeroth delay tranche width.
std::vector< AssignmentId > assignment_keys
ParachainId recipient
The para that will get this message in its downward message queue.
Information about a core which is currently occupied.
uint32_t relay_vrf_modulo_samples
The number of samples we do of relay_vrf_modulo.
primitives::parachain::DutyRoster DutyRoster
primitives::BlockNumber BlockNumber
CandidateDescriptor descriptor
The descriptor of the candidate.
uint32_t processed_downward_messages
The number of messages processed from the DMQ.
std::vector< UpwardMessage > upward_messages
Messages destined to be interpreted by the Relay chain itself.
GroupIndex group_responsible
The group assigned to distribute availability pieces of this candidate.
std::vector< OutboundHrmpMessage > horizontal_messages
Horizontal messages sent by the parachain.
BlockNumber occupied_since
The relay-chain block number this began occupying the core at.
std::optional< CollatorId > collator
The collator required to author the block, if any.
uint32_t needed_approvals
The number of validators needed to approve a block.
CollatorId collator
The collator&#39;s sr25519 public key.
primitives::parachain::ParaId ParachainId
std::tuple< BlockNumber, GroupRotatePeriod, BlockNumber > GroupDescriptor
std::vector< Chain > DutyRoster
DutyRoster primitive.
uint32_t ParaId
ParachainId primitive is an uint32_t.
DownwardMessage msg
The actual downward message to processes.