Kagome
Polkadot Runtime Engine in C++17
parachain_host_types_serde.cpp
Go to the documentation of this file.
1 
7 
8 namespace kagome::runtime {
9 
10  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
11  const ScheduledCore &val) {
12  s << val.para_id << val.collator;
13  return s;
14  }
15 
16  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
17  ScheduledCore &val) {
18  return s >> val.para_id >> val.collator;
19  }
20 
21  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
22  const CandidateDescriptor &val) {
23  s << val.para_id << val.relay_parent << val.collator
25  << val.signature << val.para_head << val.validation_code_hash;
26  return s;
27  }
28 
29  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
30  CandidateDescriptor &val) {
31  return s >> val.para_id >> val.relay_parent >> val.collator
33  >> val.erasure_root >> val.signature >> val.para_head
34  >> val.validation_code_hash;
35  }
36 
37  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
38  const OccupiedCore &val) {
39  s << val.next_up_on_available << val.occupied_since << val.time_out_at
42  return s;
43  }
44 
45  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
46  OccupiedCore &val) {
47  return s >> val.next_up_on_available >> val.occupied_since
48  >> val.time_out_at >> val.next_up_on_time_out >> val.availability
49  >> val.group_responsible >> val.candidate_hash
50  >> val.candidate_descriptor;
51  }
52 
53  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
54  const PersistedValidationData &val) {
55  s << val.parent_head << val.relay_parent_number
57  return s;
58  }
59 
60  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
62  return s >> val.parent_head >> val.relay_parent_number
64  }
65 
66  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
67  const OutboundHrmpMessage &val) {
68  s << val.recipient << val.data;
69  return s;
70  }
71 
72  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
73  OutboundHrmpMessage &val) {
74  return s >> val.recipient >> val.data;
75  }
76 
77  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
78  const CandidateCommitments &val) {
79  s << val.upward_messages << val.horizontal_messages
80  << val.new_validation_code << val.head_data
82  return s;
83  }
84 
85  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
86  CandidateCommitments &val) {
87  return s >> val.upward_messages >> val.horizontal_messages
88  >> val.new_validation_code >> val.head_data
90  }
91 
92  ::scale::ScaleEncoderStream &operator<<(
93  ::scale::ScaleEncoderStream &s, const CommittedCandidateReceipt &val) {
94  s << val.descriptor << val.commitments;
95  return s;
96  }
97 
98  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
100  return s >> val.descriptor >> val.commitments;
101  }
102 
103  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
104  const CandidateReceipt &val) {
105  s << val.descriptor << val.commitments_hash;
106  return s;
107  }
108 
109  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
110  CandidateReceipt &val) {
111  return s >> val.descriptor >> val.commitments_hash;
112  }
113 
114  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
115  const Candidate &val) {
116  s << val.candidate_receipt << val.head_data << val.core_index;
117  return s;
118  }
119 
120  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
121  Candidate &val) {
122  return s >> val.candidate_receipt >> val.head_data >> val.core_index;
123  }
124 
125  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
126  const CandidateBacked &val) {
127  s << static_cast<Candidate>(val) << val.group_index;
128  return s;
129  }
130 
131  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
132  CandidateBacked &val) {
133  return s >> static_cast<Candidate &>(val) >> val.group_index;
134  }
135 
136  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
137  const CandidateIncluded &val) {
138  s << static_cast<Candidate>(val);
139  s << val.group_index;
140  return s;
141  }
142 
143  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
144  CandidateIncluded &val) {
145  return s >> static_cast<Candidate &>(val) >> val.group_index;
146  }
147 
148  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
149  const SessionInfo &val) {
151  << val.validators << val.discovery_keys << val.assignment_keys
154  << val.no_show_slots << val.needed_approvals;
155  return s;
156  }
157 
158  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
159  SessionInfo &val) {
160  return s >> val.active_validator_indices >> val.random_seed
161  >> val.dispute_period >> val.validators >> val.discovery_keys
162  >> val.assignment_keys >> val.validator_groups >> val.n_cores
164  >> val.n_delay_tranches >> val.no_show_slots >> val.needed_approvals;
165  }
166 
167  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
168  const InboundDownwardMessage &val) {
169  s << val.sent_at << val.msg;
170  return s;
171  }
172 
173  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
174  InboundDownwardMessage &val) {
175  return s >> val.sent_at >> val.msg;
176  }
177 
178  ::scale::ScaleEncoderStream &operator<<(::scale::ScaleEncoderStream &s,
179  const InboundHrmpMessage &val) {
180  s << val.sent_at << val.data;
181  return s;
182  }
183 
184  ::scale::ScaleDecoderStream &operator>>(::scale::ScaleDecoderStream &s,
185  InboundHrmpMessage &val) {
186  return s >> val.sent_at >> val.data;
187  }
188 } // namespace kagome::runtime
CandidateDescriptor candidate_descriptor
The descriptor of the candidate occupying the core.
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.
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.
::scale::ScaleDecoderStream & operator>>(::scale::ScaleDecoderStream &s, ScheduledCore &val)
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.
CandidateDescriptor descriptor
The descriptor of the candidate.
SessionIndex dispute_period
The amount of sessions to keep for disputes.
BlockNumber time_out_at
The relay-chain block this will time-out at, if any.
::scale::ScaleEncoderStream & operator<<(::scale::ScaleEncoderStream &s, const ScheduledCore &val)
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.
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.
DownwardMessage msg
The actual downward message to processes.