Line data Source code
1 : /* THIS FILE WAS GENERATED BY gen_events.py. DO NOT EDIT BY HAND! */
2 : #include "fd_event_gen.h"
3 : #include "../../../ballet/pb/fd_pb_encode.h"
4 :
5 : void
6 : fd_event_signed_vote_serialize( fd_circq_t * circq,
7 : fd_event_client_t * client,
8 : long timestamp_nanos,
9 : ulong link_seq,
10 0 : fd_event_signed_vote_t const * msg ) {
11 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_SIGNED_VOTE_BUF_MAX );
12 0 : FD_TEST( buffer );
13 :
14 0 : ulong event_id = fd_event_client_id_reserve( client );
15 :
16 0 : fd_pb_encoder_t encoder[1];
17 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_SIGNED_VOTE_BUF_MAX );
18 :
19 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
20 : a FD_EVENT_SIGNED_VOTE_BUF_MAX that under-models the encoder aborts loudly instead
21 : of silently truncating fields off published rows. */
22 0 : int ok = 1;
23 :
24 0 : FD_TEST( circq->cursor_push_seq );
25 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
26 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
27 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
28 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
29 :
30 0 : FD_TEST( msg->signed_txn_len<=1232UL );
31 0 : FD_TEST( msg->tower_cnt<=31UL );
32 :
33 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
34 0 : ok &= !!fd_pb_submsg_open( encoder, 3U ); /* SignedVote */
35 0 : if( msg->signed_txn_len ) ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->signed_txn, msg->signed_txn_len );
36 0 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->vote_account, 32UL );
37 0 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->vote_authority, 32UL );
38 0 : ok &= !!fd_pb_push_bytes ( encoder, 4U, msg->fee_payer, 32UL );
39 0 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->signature, 64UL );
40 0 : if( msg->vote_slot ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->vote_slot );
41 0 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->vote_bank_hash, 32UL );
42 0 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->vote_block_id, 32UL );
43 0 : ok &= !!fd_pb_push_bytes ( encoder, 9U, msg->txn_blockhash, 32UL );
44 0 : for( ulong k=0UL; k<msg->tower_cnt; k++ ) {
45 0 : ok &= !!fd_pb_submsg_open( encoder, 10U );
46 0 : if( msg->tower[ k ].slot ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->tower[ k ].slot );
47 0 : if( msg->tower[ k ].confirmation_count ) ok &= !!fd_pb_push_uint32( encoder, 2U, (uint)msg->tower[ k ].confirmation_count );
48 0 : ok &= !!fd_pb_submsg_close( encoder );
49 0 : }
50 0 : ok &= !!fd_pb_submsg_close( encoder );
51 0 : ok &= !!fd_pb_submsg_close( encoder );
52 0 : FD_TEST( ok );
53 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
54 0 : }
55 :
56 : void
57 : fd_event_slot_confirmed_serialize( fd_circq_t * circq,
58 : fd_event_client_t * client,
59 : long timestamp_nanos,
60 : ulong link_seq,
61 0 : fd_event_slot_confirmed_t const * msg ) {
62 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_SLOT_CONFIRMED_BUF_MAX );
63 0 : FD_TEST( buffer );
64 :
65 0 : ulong event_id = fd_event_client_id_reserve( client );
66 :
67 0 : fd_pb_encoder_t encoder[1];
68 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_SLOT_CONFIRMED_BUF_MAX );
69 :
70 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
71 : a FD_EVENT_SLOT_CONFIRMED_BUF_MAX that under-models the encoder aborts loudly instead
72 : of silently truncating fields off published rows. */
73 0 : int ok = 1;
74 :
75 0 : FD_TEST( circq->cursor_push_seq );
76 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
77 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
78 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
79 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
80 :
81 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
82 0 : ok &= !!fd_pb_submsg_open( encoder, 4U ); /* SlotConfirmed */
83 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
84 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
85 0 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->block_id, 32UL );
86 0 : if( msg->stake ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->stake );
87 0 : if( msg->total_stake ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->total_stake );
88 0 : if( msg->valid ) ok &= !!fd_pb_push_bool ( encoder, 6U, msg->valid );
89 0 : if( msg->level ) ok &= !!fd_pb_push_int32 ( encoder, 7U, msg->level );
90 0 : if( msg->forward ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->forward );
91 0 : ok &= !!fd_pb_submsg_close( encoder );
92 0 : ok &= !!fd_pb_submsg_close( encoder );
93 0 : FD_TEST( ok );
94 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
95 0 : }
96 :
97 : void
98 : fd_event_accdb_compaction_completed_serialize( fd_circq_t * circq,
99 : fd_event_client_t * client,
100 : long timestamp_nanos,
101 : ulong link_seq,
102 0 : fd_event_accdb_compaction_completed_t const * msg ) {
103 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_ACCDB_COMPACTION_COMPLETED_BUF_MAX );
104 0 : FD_TEST( buffer );
105 :
106 0 : ulong event_id = fd_event_client_id_reserve( client );
107 :
108 0 : fd_pb_encoder_t encoder[1];
109 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_ACCDB_COMPACTION_COMPLETED_BUF_MAX );
110 :
111 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
112 : a FD_EVENT_ACCDB_COMPACTION_COMPLETED_BUF_MAX that under-models the encoder aborts loudly instead
113 : of silently truncating fields off published rows. */
114 0 : int ok = 1;
115 :
116 0 : FD_TEST( circq->cursor_push_seq );
117 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
118 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
119 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
120 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
121 :
122 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
123 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* AccdbCompactionCompleted */
124 0 : if( msg->partition_idx ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->partition_idx );
125 0 : if( msg->src_layer ) ok &= !!fd_pb_push_uint32( encoder, 2U, (uint)msg->src_layer );
126 0 : if( msg->dest_layer ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)msg->dest_layer );
127 0 : if( msg->bytes_scanned ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->bytes_scanned );
128 0 : if( msg->bytes_freed ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->bytes_freed );
129 0 : if( msg->accounts_relocated ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->accounts_relocated );
130 0 : if( msg->bytes_relocated ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->bytes_relocated );
131 0 : if( msg->dead_records ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->dead_records );
132 0 : if( msg->start_time ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->start_time );
133 0 : if( msg->end_time ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->end_time );
134 0 : ok &= !!fd_pb_submsg_close( encoder );
135 0 : ok &= !!fd_pb_submsg_close( encoder );
136 0 : FD_TEST( ok );
137 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
138 0 : }
139 :
140 : void
141 : fd_event_accdb_partition_added_serialize( fd_circq_t * circq,
142 : fd_event_client_t * client,
143 : long timestamp_nanos,
144 : ulong link_seq,
145 0 : fd_event_accdb_partition_added_t const * msg ) {
146 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_ACCDB_PARTITION_ADDED_BUF_MAX );
147 0 : FD_TEST( buffer );
148 :
149 0 : ulong event_id = fd_event_client_id_reserve( client );
150 :
151 0 : fd_pb_encoder_t encoder[1];
152 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_ACCDB_PARTITION_ADDED_BUF_MAX );
153 :
154 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
155 : a FD_EVENT_ACCDB_PARTITION_ADDED_BUF_MAX that under-models the encoder aborts loudly instead
156 : of silently truncating fields off published rows. */
157 0 : int ok = 1;
158 :
159 0 : FD_TEST( circq->cursor_push_seq );
160 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
161 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
162 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
163 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
164 :
165 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
166 0 : ok &= !!fd_pb_submsg_open( encoder, 6U ); /* AccdbPartitionAdded */
167 0 : if( msg->partition_idx ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->partition_idx );
168 0 : if( msg->prior_partition_idx ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->prior_partition_idx );
169 0 : if( msg->layer ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)msg->layer );
170 0 : if( msg->old_partition_max ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->old_partition_max );
171 0 : if( msg->new_partition_max ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->new_partition_max );
172 0 : if( msg->partition_sz ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->partition_sz );
173 0 : if( msg->disk_allocated_bytes ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->disk_allocated_bytes );
174 0 : if( msg->duration_fallocate_nanos ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->duration_fallocate_nanos );
175 0 : if( msg->preallocated ) ok &= !!fd_pb_push_bool ( encoder, 9U, msg->preallocated );
176 0 : ok &= !!fd_pb_submsg_close( encoder );
177 0 : ok &= !!fd_pb_submsg_close( encoder );
178 0 : FD_TEST( ok );
179 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
180 0 : }
181 :
182 : void
183 : fd_event_block_equivocated_serialize( fd_circq_t * circq,
184 : fd_event_client_t * client,
185 : long timestamp_nanos,
186 : ulong link_seq,
187 0 : fd_event_block_equivocated_t const * msg ) {
188 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_BLOCK_EQUIVOCATED_BUF_MAX );
189 0 : FD_TEST( buffer );
190 :
191 0 : ulong event_id = fd_event_client_id_reserve( client );
192 :
193 0 : fd_pb_encoder_t encoder[1];
194 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_BLOCK_EQUIVOCATED_BUF_MAX );
195 :
196 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
197 : a FD_EVENT_BLOCK_EQUIVOCATED_BUF_MAX that under-models the encoder aborts loudly instead
198 : of silently truncating fields off published rows. */
199 0 : int ok = 1;
200 :
201 0 : FD_TEST( circq->cursor_push_seq );
202 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
203 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
204 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
205 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
206 :
207 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
208 0 : ok &= !!fd_pb_submsg_open( encoder, 7U ); /* BlockEquivocated */
209 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
210 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
211 0 : if( msg->parent_slot ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->parent_slot );
212 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->epoch );
213 0 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->block_id, 32UL );
214 0 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->sibling_block_id, 32UL );
215 0 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->bank_hash, 32UL );
216 0 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->block_hash, 32UL );
217 0 : if( msg->is_leader ) ok &= !!fd_pb_push_bool ( encoder, 9U, msg->is_leader );
218 0 : if( msg->our_block_voted ) ok &= !!fd_pb_push_bool ( encoder, 10U, msg->our_block_voted );
219 0 : if( msg->our_block_confirmed ) ok &= !!fd_pb_push_bool ( encoder, 11U, msg->our_block_confirmed );
220 0 : if( msg->block_stake ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->block_stake );
221 0 : if( msg->sibling_stake ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->sibling_stake );
222 0 : if( msg->total_stake ) ok &= !!fd_pb_push_uint64( encoder, 14U, (ulong)msg->total_stake );
223 0 : if( msg->detection ) ok &= !!fd_pb_push_int32 ( encoder, 15U, msg->detection );
224 0 : ok &= !!fd_pb_submsg_close( encoder );
225 0 : ok &= !!fd_pb_submsg_close( encoder );
226 0 : FD_TEST( ok );
227 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
228 0 : }
229 :
230 : void
231 : fd_event_runtime_txn_serialize( fd_circq_t * circq,
232 : fd_event_client_t * client,
233 : long timestamp_nanos,
234 : ulong link_seq,
235 0 : fd_event_runtime_txn_t const * msg ) {
236 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_TXN_BUF_MAX );
237 0 : FD_TEST( buffer );
238 :
239 0 : ulong event_id = fd_event_client_id_reserve( client );
240 :
241 0 : fd_pb_encoder_t encoder[1];
242 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_TXN_BUF_MAX );
243 :
244 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
245 : a FD_EVENT_RUNTIME_TXN_BUF_MAX that under-models the encoder aborts loudly instead
246 : of silently truncating fields off published rows. */
247 0 : int ok = 1;
248 :
249 0 : FD_TEST( circq->cursor_push_seq );
250 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
251 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
252 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
253 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
254 :
255 0 : FD_TEST( msg->account_diffs_cnt<=64UL );
256 0 : FD_TEST( msg->writable_accounts_cnt<=64UL );
257 0 : FD_TEST( msg->readonly_accounts_cnt<=64UL );
258 0 : FD_TEST( msg->program_ids_cnt<=64UL );
259 :
260 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
261 0 : ok &= !!fd_pb_submsg_open( encoder, 8U ); /* RuntimeTxn */
262 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
263 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
264 0 : if( msg->index_in_slot ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->index_in_slot );
265 0 : if( msg->commit_index_in_slot ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->commit_index_in_slot );
266 0 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->fec_merkle_root, 32UL );
267 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->epoch );
268 0 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->signature, 64UL );
269 0 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->blockhash, 32UL );
270 0 : ok &= !!fd_pb_push_bytes ( encoder, 9U, msg->fee_payer, 32UL );
271 0 : if( msg->is_simple_vote ) ok &= !!fd_pb_push_bool ( encoder, 10U, msg->is_simple_vote );
272 0 : if( msg->is_bundle ) ok &= !!fd_pb_push_bool ( encoder, 11U, msg->is_bundle );
273 0 : if( msg->is_committable ) ok &= !!fd_pb_push_bool ( encoder, 12U, msg->is_committable );
274 0 : if( msg->is_fees_only ) ok &= !!fd_pb_push_bool ( encoder, 13U, msg->is_fees_only );
275 0 : if( msg->txn_err ) ok &= !!fd_pb_push_int32 ( encoder, 14U, msg->txn_err );
276 0 : if( msg->exec_err ) ok &= !!fd_pb_push_int32 ( encoder, 15U, msg->exec_err );
277 0 : if( msg->exec_err_kind ) ok &= !!fd_pb_push_int32 ( encoder, 16U, msg->exec_err_kind );
278 0 : if( msg->exec_err_idx ) ok &= !!fd_pb_push_uint32( encoder, 17U, (uint)msg->exec_err_idx );
279 0 : if( msg->custom_err ) ok &= !!fd_pb_push_uint32( encoder, 18U, (uint)msg->custom_err );
280 0 : if( msg->compute_unit_limit ) ok &= !!fd_pb_push_uint64( encoder, 19U, (ulong)msg->compute_unit_limit );
281 0 : if( msg->compute_unit_price ) ok &= !!fd_pb_push_uint64( encoder, 20U, (ulong)msg->compute_unit_price );
282 0 : if( msg->compute_units_consumed ) ok &= !!fd_pb_push_uint64( encoder, 21U, (ulong)msg->compute_units_consumed );
283 0 : if( msg->heap_size ) ok &= !!fd_pb_push_uint64( encoder, 22U, (ulong)msg->heap_size );
284 0 : if( msg->num_builtin_instrs ) ok &= !!fd_pb_push_uint64( encoder, 23U, (ulong)msg->num_builtin_instrs );
285 0 : if( msg->num_non_builtin_instrs ) ok &= !!fd_pb_push_uint64( encoder, 24U, (ulong)msg->num_non_builtin_instrs );
286 0 : if( msg->loaded_accounts_data_size ) ok &= !!fd_pb_push_uint64( encoder, 25U, (ulong)msg->loaded_accounts_data_size );
287 0 : if( msg->loaded_accounts_data_size_limit ) ok &= !!fd_pb_push_uint64( encoder, 26U, (ulong)msg->loaded_accounts_data_size_limit );
288 0 : if( msg->accounts_resize_delta ) ok &= !!fd_pb_push_sint64( encoder, 27U, msg->accounts_resize_delta );
289 0 : if( msg->execution_fee ) ok &= !!fd_pb_push_uint64( encoder, 28U, (ulong)msg->execution_fee );
290 0 : if( msg->priority_fee ) ok &= !!fd_pb_push_uint64( encoder, 29U, (ulong)msg->priority_fee );
291 0 : if( msg->tips ) ok &= !!fd_pb_push_uint64( encoder, 30U, (ulong)msg->tips );
292 0 : if( msg->signature_count ) ok &= !!fd_pb_push_uint64( encoder, 31U, (ulong)msg->signature_count );
293 0 : if( msg->cost_signature ) ok &= !!fd_pb_push_uint32( encoder, 32U, (uint)msg->cost_signature );
294 0 : if( msg->cost_write_lock ) ok &= !!fd_pb_push_uint32( encoder, 33U, (uint)msg->cost_write_lock );
295 0 : if( msg->cost_data_bytes ) ok &= !!fd_pb_push_uint32( encoder, 34U, (uint)msg->cost_data_bytes );
296 0 : if( msg->cost_programs_execution ) ok &= !!fd_pb_push_uint32( encoder, 35U, (uint)msg->cost_programs_execution );
297 0 : if( msg->cost_loaded_accounts_data_size ) ok &= !!fd_pb_push_uint32( encoder, 36U, (uint)msg->cost_loaded_accounts_data_size );
298 0 : if( msg->cost_allocated_accounts_data_size ) ok &= !!fd_pb_push_uint64( encoder, 37U, (ulong)msg->cost_allocated_accounts_data_size );
299 0 : for( ulong k=0UL; k<msg->account_diffs_cnt; k++ ) {
300 0 : ok &= !!fd_pb_submsg_open( encoder, 38U );
301 0 : ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->account_diffs[ k ].pubkey, 32UL );
302 0 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->account_diffs[ k ].owner, 32UL );
303 0 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->account_diffs[ k ].prev_owner, 32UL );
304 0 : if( msg->account_diffs[ k ].lamports ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->account_diffs[ k ].lamports );
305 0 : if( msg->account_diffs[ k ].prev_lamports ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->account_diffs[ k ].prev_lamports );
306 0 : if( msg->account_diffs[ k ].data_sz ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->account_diffs[ k ].data_sz );
307 0 : if( msg->account_diffs[ k ].prev_data_sz ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->account_diffs[ k ].prev_data_sz );
308 0 : if( msg->account_diffs[ k ].is_executable ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->account_diffs[ k ].is_executable );
309 0 : if( msg->account_diffs[ k ].is_stake_update ) ok &= !!fd_pb_push_bool ( encoder, 9U, msg->account_diffs[ k ].is_stake_update );
310 0 : if( msg->account_diffs[ k ].is_vote_update ) ok &= !!fd_pb_push_bool ( encoder, 10U, msg->account_diffs[ k ].is_vote_update );
311 0 : if( msg->account_diffs[ k ].is_new_vote ) ok &= !!fd_pb_push_bool ( encoder, 11U, msg->account_diffs[ k ].is_new_vote );
312 0 : if( msg->account_diffs[ k ].is_rm_vote ) ok &= !!fd_pb_push_bool ( encoder, 12U, msg->account_diffs[ k ].is_rm_vote );
313 0 : ok &= !!fd_pb_submsg_close( encoder );
314 0 : }
315 0 : for( ulong k=0UL; k<msg->writable_accounts_cnt; k++ ) {
316 0 : ok &= !!fd_pb_push_bytes ( encoder, 39U, msg->writable_accounts[ k ], 32UL );
317 0 : }
318 0 : for( ulong k=0UL; k<msg->readonly_accounts_cnt; k++ ) {
319 0 : ok &= !!fd_pb_push_bytes ( encoder, 40U, msg->readonly_accounts[ k ], 32UL );
320 0 : }
321 0 : for( ulong k=0UL; k<msg->program_ids_cnt; k++ ) {
322 0 : ok &= !!fd_pb_push_bytes ( encoder, 41U, msg->program_ids[ k ], 32UL );
323 0 : }
324 0 : ok &= !!fd_pb_submsg_close( encoder );
325 0 : ok &= !!fd_pb_submsg_close( encoder );
326 0 : FD_TEST( ok );
327 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
328 0 : }
329 :
330 : void
331 : fd_event_block_completed_serialize( fd_circq_t * circq,
332 : fd_event_client_t * client,
333 : long timestamp_nanos,
334 : ulong link_seq,
335 0 : fd_event_block_completed_t const * msg ) {
336 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_BLOCK_COMPLETED_BUF_MAX );
337 0 : FD_TEST( buffer );
338 :
339 0 : ulong event_id = fd_event_client_id_reserve( client );
340 :
341 0 : fd_pb_encoder_t encoder[1];
342 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_BLOCK_COMPLETED_BUF_MAX );
343 :
344 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
345 : a FD_EVENT_BLOCK_COMPLETED_BUF_MAX that under-models the encoder aborts loudly instead
346 : of silently truncating fields off published rows. */
347 0 : int ok = 1;
348 :
349 0 : FD_TEST( circq->cursor_push_seq );
350 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
351 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
352 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
353 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
354 :
355 0 : FD_TEST( msg->txn_timing_cnt<=49019UL );
356 :
357 0 : uchar const * _dyn = (uchar const *)msg + FD_EVENT_BLOCK_COMPLETED_PREFIX_SZ;
358 0 : fd_event_block_completed_txn_timing_t const * txn_timing = (fd_event_block_completed_txn_timing_t const *)_dyn;
359 0 : _dyn += msg->txn_timing_cnt*sizeof(txn_timing[0]);
360 0 : ulong txn_timing_cnt = msg->txn_timing_cnt;
361 :
362 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
363 0 : ok &= !!fd_pb_submsg_open( encoder, 9U ); /* BlockCompleted */
364 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
365 0 : if( msg->bank_idx ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->bank_idx );
366 0 : if( msg->txncache_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)msg->txncache_fork_id );
367 0 : if( msg->progcache_fork_id ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->progcache_fork_id );
368 0 : if( msg->accdb_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 5U, (uint)msg->accdb_fork_id );
369 0 : if( msg->vote_stakes_fork_id ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->vote_stakes_fork_id );
370 0 : if( msg->collector_overrides_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 7U, (uint)msg->collector_overrides_fork_id );
371 0 : if( msg->stake_rewards_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 8U, (uint)msg->stake_rewards_fork_id );
372 0 : if( msg->epoch_credits_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 9U, (uint)msg->epoch_credits_fork_id );
373 0 : if( msg->stake_delegations_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 10U, (uint)msg->stake_delegations_fork_id );
374 0 : if( msg->cost_tracker_pool_idx ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->cost_tracker_pool_idx );
375 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->slot );
376 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->epoch );
377 0 : if( msg->parent_slot ) ok &= !!fd_pb_push_uint64( encoder, 14U, (ulong)msg->parent_slot );
378 0 : if( msg->root_slot ) ok &= !!fd_pb_push_uint64( encoder, 15U, (ulong)msg->root_slot );
379 0 : if( msg->storage_slot ) ok &= !!fd_pb_push_uint64( encoder, 16U, (ulong)msg->storage_slot );
380 0 : if( msg->turbine_slot ) ok &= !!fd_pb_push_uint64( encoder, 17U, (ulong)msg->turbine_slot );
381 0 : if( msg->caught_up ) ok &= !!fd_pb_push_bool ( encoder, 18U, msg->caught_up );
382 0 : if( msg->fork_width ) ok &= !!fd_pb_push_uint64( encoder, 19U, (ulong)msg->fork_width );
383 0 : if( msg->snapshot_in_progress ) ok &= !!fd_pb_push_bool ( encoder, 20U, msg->snapshot_in_progress );
384 0 : if( msg->live_bank_count ) ok &= !!fd_pb_push_uint64( encoder, 21U, (ulong)msg->live_bank_count );
385 0 : ok &= !!fd_pb_push_bytes ( encoder, 22U, msg->block_id, 32UL );
386 0 : ok &= !!fd_pb_push_bytes ( encoder, 23U, msg->parent_block_id, 32UL );
387 0 : ok &= !!fd_pb_push_bytes ( encoder, 24U, msg->bank_hash, 32UL );
388 0 : if( msg->dead ) ok &= !!fd_pb_push_bool ( encoder, 25U, msg->dead );
389 0 : if( msg->dead_reason ) ok &= !!fd_pb_push_int32 ( encoder, 26U, msg->dead_reason );
390 0 : if( msg->dead_time ) ok &= !!fd_pb_push_uint64( encoder, 27U, (ulong)msg->dead_time );
391 0 : if( msg->abandoned ) ok &= !!fd_pb_push_bool ( encoder, 28U, msg->abandoned );
392 0 : if( msg->abandoned_reason ) ok &= !!fd_pb_push_int32 ( encoder, 29U, msg->abandoned_reason );
393 0 : if( msg->abandoned_time ) ok &= !!fd_pb_push_uint64( encoder, 30U, (ulong)msg->abandoned_time );
394 0 : if( msg->is_leader ) ok &= !!fd_pb_push_bool ( encoder, 31U, msg->is_leader );
395 0 : if( msg->first_shred_received_time ) ok &= !!fd_pb_push_uint64( encoder, 32U, (ulong)msg->first_shred_received_time );
396 0 : if( msg->last_shred_received_time ) ok &= !!fd_pb_push_uint64( encoder, 33U, (ulong)msg->last_shred_received_time );
397 0 : if( msg->first_repair_request_time ) ok &= !!fd_pb_push_uint64( encoder, 34U, (ulong)msg->first_repair_request_time );
398 0 : if( msg->last_repair_received_time ) ok &= !!fd_pb_push_uint64( encoder, 35U, (ulong)msg->last_repair_received_time );
399 0 : if( msg->first_fec_set_received_time ) ok &= !!fd_pb_push_uint64( encoder, 36U, (ulong)msg->first_fec_set_received_time );
400 0 : if( msg->preparation_begin_time ) ok &= !!fd_pb_push_uint64( encoder, 37U, (ulong)msg->preparation_begin_time );
401 0 : if( msg->first_transaction_scheduled_time ) ok &= !!fd_pb_push_uint64( encoder, 38U, (ulong)msg->first_transaction_scheduled_time );
402 0 : if( msg->last_transaction_finished_time ) ok &= !!fd_pb_push_uint64( encoder, 39U, (ulong)msg->last_transaction_finished_time );
403 0 : if( msg->block_completed_time ) ok &= !!fd_pb_push_uint64( encoder, 40U, (ulong)msg->block_completed_time );
404 0 : if( msg->parent_block_completed_time ) ok &= !!fd_pb_push_uint64( encoder, 41U, (ulong)msg->parent_block_completed_time );
405 0 : if( msg->fec_set_count ) ok &= !!fd_pb_push_uint64( encoder, 42U, (ulong)msg->fec_set_count );
406 0 : if( msg->data_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 43U, (uint)msg->data_shred_count );
407 0 : if( msg->parity_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 44U, (uint)msg->parity_shred_count );
408 0 : if( msg->turbine_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 45U, (uint)msg->turbine_shred_count );
409 0 : if( msg->repair_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 46U, (uint)msg->repair_shred_count );
410 0 : if( msg->recovered_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 47U, (uint)msg->recovered_shred_count );
411 0 : if( msg->chain_confirmed ) ok &= !!fd_pb_push_bool ( encoder, 48U, msg->chain_confirmed );
412 0 : if( msg->lowest_verified_fec_index ) ok &= !!fd_pb_push_uint32( encoder, 49U, (uint)msg->lowest_verified_fec_index );
413 0 : if( msg->last_completed_fec_set_index ) ok &= !!fd_pb_push_uint32( encoder, 50U, (uint)msg->last_completed_fec_set_index );
414 0 : if( msg->slot_complete_flag ) ok &= !!fd_pb_push_bool ( encoder, 51U, msg->slot_complete_flag );
415 0 : if( msg->equivocation_detected_shred ) ok &= !!fd_pb_push_bool ( encoder, 52U, msg->equivocation_detected_shred );
416 0 : if( msg->repair_requests_retransmitted ) ok &= !!fd_pb_push_uint32( encoder, 53U, (uint)msg->repair_requests_retransmitted );
417 0 : if( msg->repair_responses_received ) ok &= !!fd_pb_push_uint32( encoder, 54U, (uint)msg->repair_responses_received );
418 0 : if( msg->repair_request_window_count ) ok &= !!fd_pb_push_uint32( encoder, 55U, (uint)msg->repair_request_window_count );
419 0 : if( msg->repair_request_highest_window_count ) ok &= !!fd_pb_push_uint32( encoder, 56U, (uint)msg->repair_request_highest_window_count );
420 0 : if( msg->repair_request_orphan_count ) ok &= !!fd_pb_push_uint32( encoder, 57U, (uint)msg->repair_request_orphan_count );
421 0 : if( msg->repair_failed_chain_verify ) ok &= !!fd_pb_push_bool ( encoder, 58U, msg->repair_failed_chain_verify );
422 0 : if( msg->cost_tracker_block_cost ) ok &= !!fd_pb_push_uint64( encoder, 59U, (ulong)msg->cost_tracker_block_cost );
423 0 : if( msg->cost_tracker_allocated_accounts_data_size ) ok &= !!fd_pb_push_uint64( encoder, 60U, (ulong)msg->cost_tracker_allocated_accounts_data_size );
424 0 : if( msg->cost_tracker_block_cost_limit ) ok &= !!fd_pb_push_uint64( encoder, 61U, (ulong)msg->cost_tracker_block_cost_limit );
425 0 : if( msg->cost_tracker_vote_cost_limit ) ok &= !!fd_pb_push_uint64( encoder, 62U, (ulong)msg->cost_tracker_vote_cost_limit );
426 0 : if( msg->cost_tracker_account_cost_limit ) ok &= !!fd_pb_push_uint64( encoder, 63U, (ulong)msg->cost_tracker_account_cost_limit );
427 0 : if( msg->became_leader_time ) ok &= !!fd_pb_push_uint64( encoder, 64U, (ulong)msg->became_leader_time );
428 0 : if( msg->leader_slot_start_time ) ok &= !!fd_pb_push_uint64( encoder, 65U, (ulong)msg->leader_slot_start_time );
429 0 : if( msg->pack_start_time ) ok &= !!fd_pb_push_uint64( encoder, 66U, (ulong)msg->pack_start_time );
430 0 : if( msg->pack_end_time ) ok &= !!fd_pb_push_uint64( encoder, 67U, (ulong)msg->pack_end_time );
431 0 : if( msg->microblock_count ) ok &= !!fd_pb_push_uint64( encoder, 68U, (ulong)msg->microblock_count );
432 0 : if( msg->pack_block_cost ) ok &= !!fd_pb_push_uint64( encoder, 69U, (ulong)msg->pack_block_cost );
433 0 : if( msg->pack_vote_cost ) ok &= !!fd_pb_push_uint64( encoder, 70U, (ulong)msg->pack_vote_cost );
434 0 : if( msg->pack_data_bytes ) ok &= !!fd_pb_push_uint64( encoder, 71U, (ulong)msg->pack_data_bytes );
435 0 : if( msg->pack_end_reason ) ok &= !!fd_pb_push_int32 ( encoder, 72U, msg->pack_end_reason );
436 0 : if( msg->bundle_txn_count ) ok &= !!fd_pb_push_uint64( encoder, 73U, (ulong)msg->bundle_txn_count );
437 0 : for( ulong k=0UL; k<txn_timing_cnt; k++ ) {
438 0 : ok &= !!fd_pb_submsg_open( encoder, 74U );
439 0 : if( txn_timing[ k ].received_time ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)txn_timing[ k ].received_time );
440 0 : if( txn_timing[ k ].parsed_time ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)txn_timing[ k ].parsed_time );
441 0 : if( txn_timing[ k ].dispatched_time ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)txn_timing[ k ].dispatched_time );
442 0 : if( txn_timing[ k ].replayed_time ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)txn_timing[ k ].replayed_time );
443 0 : if( txn_timing[ k ].sigverify_dispatched_time ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)txn_timing[ k ].sigverify_dispatched_time );
444 0 : if( txn_timing[ k ].sigverify_done_time ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)txn_timing[ k ].sigverify_done_time );
445 0 : if( txn_timing[ k ].poh_mixed_time ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)txn_timing[ k ].poh_mixed_time );
446 0 : ok &= !!fd_pb_submsg_close( encoder );
447 0 : }
448 0 : if( msg->votor_repaired ) ok &= !!fd_pb_push_bool ( encoder, 75U, msg->votor_repaired );
449 0 : if( msg->repair_request_shred_block_id_count ) ok &= !!fd_pb_push_uint32( encoder, 76U, (uint)msg->repair_request_shred_block_id_count );
450 0 : if( msg->repair_request_parent_count ) ok &= !!fd_pb_push_uint32( encoder, 77U, (uint)msg->repair_request_parent_count );
451 0 : if( msg->repair_request_fec_root_count ) ok &= !!fd_pb_push_uint32( encoder, 78U, (uint)msg->repair_request_fec_root_count );
452 0 : ok &= !!fd_pb_submsg_close( encoder );
453 0 : ok &= !!fd_pb_submsg_close( encoder );
454 0 : FD_TEST( ok );
455 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
456 0 : }
457 :
458 : void
459 : fd_event_snapshot_created_serialize( fd_circq_t * circq,
460 : fd_event_client_t * client,
461 : long timestamp_nanos,
462 : ulong link_seq,
463 0 : fd_event_snapshot_created_t const * msg ) {
464 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_SNAPSHOT_CREATED_BUF_MAX );
465 0 : FD_TEST( buffer );
466 :
467 0 : ulong event_id = fd_event_client_id_reserve( client );
468 :
469 0 : fd_pb_encoder_t encoder[1];
470 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_SNAPSHOT_CREATED_BUF_MAX );
471 :
472 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
473 : a FD_EVENT_SNAPSHOT_CREATED_BUF_MAX that under-models the encoder aborts loudly instead
474 : of silently truncating fields off published rows. */
475 0 : int ok = 1;
476 :
477 0 : FD_TEST( circq->cursor_push_seq );
478 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
479 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
480 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
481 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
482 :
483 0 : FD_TEST( msg->filename_len<=128UL );
484 0 : FD_TEST( msg->bank_accounts_lthash_len<=2048UL );
485 :
486 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
487 0 : ok &= !!fd_pb_submsg_open( encoder, 11U ); /* SnapshotCreated */
488 0 : if( msg->result ) ok &= !!fd_pb_push_int32 ( encoder, 1U, msg->result );
489 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
490 0 : if( msg->base_slot ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->base_slot );
491 0 : if( msg->filename_len ) ok &= !!fd_pb_push_bytes ( encoder, 4U, msg->filename, msg->filename_len );
492 0 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->hash, 32UL );
493 0 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->bank_hash, 32UL );
494 0 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->block_id, 32UL );
495 0 : if( msg->bank_accounts_lthash_len ) ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->bank_accounts_lthash, msg->bank_accounts_lthash_len );
496 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->epoch );
497 0 : if( msg->block_height ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->block_height );
498 0 : if( msg->capitalization ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->capitalization );
499 0 : if( msg->transaction_count ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->transaction_count );
500 0 : if( msg->account_count ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->account_count );
501 0 : if( msg->tombstone_count ) ok &= !!fd_pb_push_uint64( encoder, 14U, (ulong)msg->tombstone_count );
502 0 : if( msg->cached_accounts_count ) ok &= !!fd_pb_push_uint64( encoder, 15U, (ulong)msg->cached_accounts_count );
503 0 : if( msg->disk_accounts_count ) ok &= !!fd_pb_push_uint64( encoder, 16U, (ulong)msg->disk_accounts_count );
504 0 : if( msg->manifest_size ) ok &= !!fd_pb_push_uint64( encoder, 17U, (ulong)msg->manifest_size );
505 0 : if( msg->accounts_size ) ok &= !!fd_pb_push_uint64( encoder, 18U, (ulong)msg->accounts_size );
506 0 : if( msg->status_cache_size ) ok &= !!fd_pb_push_uint64( encoder, 19U, (ulong)msg->status_cache_size );
507 0 : if( msg->compressed_size ) ok &= !!fd_pb_push_uint64( encoder, 20U, (ulong)msg->compressed_size );
508 0 : if( msg->uncompressed_size ) ok &= !!fd_pb_push_uint64( encoder, 21U, (ulong)msg->uncompressed_size );
509 0 : if( msg->zstd_data_frame_count ) ok &= !!fd_pb_push_uint64( encoder, 22U, (ulong)msg->zstd_data_frame_count );
510 0 : if( msg->zstd_padding_size ) ok &= !!fd_pb_push_uint64( encoder, 23U, (ulong)msg->zstd_padding_size );
511 0 : if( msg->zstd_window_size ) ok &= !!fd_pb_push_uint64( encoder, 24U, (ulong)msg->zstd_window_size );
512 0 : if( msg->zstd_strategy ) ok &= !!fd_pb_push_int32 ( encoder, 25U, msg->zstd_strategy );
513 0 : if( msg->duration_compress_nanos ) ok &= !!fd_pb_push_uint64( encoder, 26U, (ulong)msg->duration_compress_nanos );
514 0 : if( msg->duration_io_blocked_nanos ) ok &= !!fd_pb_push_uint64( encoder, 27U, (ulong)msg->duration_io_blocked_nanos );
515 0 : if( msg->start_time ) ok &= !!fd_pb_push_uint64( encoder, 28U, (ulong)msg->start_time );
516 0 : if( msg->accounts_start_time ) ok &= !!fd_pb_push_uint64( encoder, 29U, (ulong)msg->accounts_start_time );
517 0 : if( msg->end_time ) ok &= !!fd_pb_push_uint64( encoder, 30U, (ulong)msg->end_time );
518 0 : ok &= !!fd_pb_submsg_close( encoder );
519 0 : ok &= !!fd_pb_submsg_close( encoder );
520 0 : FD_TEST( ok );
521 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
522 0 : }
523 :
524 : void
525 : fd_event_admin_command_serialize( fd_circq_t * circq,
526 : fd_event_client_t * client,
527 : long timestamp_nanos,
528 : ulong link_seq,
529 0 : fd_event_admin_command_t const * msg ) {
530 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_ADMIN_COMMAND_BUF_MAX );
531 0 : FD_TEST( buffer );
532 :
533 0 : ulong event_id = fd_event_client_id_reserve( client );
534 :
535 0 : fd_pb_encoder_t encoder[1];
536 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_ADMIN_COMMAND_BUF_MAX );
537 :
538 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
539 : a FD_EVENT_ADMIN_COMMAND_BUF_MAX that under-models the encoder aborts loudly instead
540 : of silently truncating fields off published rows. */
541 0 : int ok = 1;
542 :
543 0 : FD_TEST( circq->cursor_push_seq );
544 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
545 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
546 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
547 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
548 :
549 0 : FD_TEST( msg->custom_result_len<=64UL );
550 0 : FD_TEST( msg->args_json_len<=256UL );
551 :
552 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
553 0 : ok &= !!fd_pb_submsg_open( encoder, 12U ); /* AdminCommand */
554 0 : if( msg->type ) ok &= !!fd_pb_push_int32 ( encoder, 1U, msg->type );
555 0 : if( msg->result ) ok &= !!fd_pb_push_int32 ( encoder, 2U, msg->result );
556 0 : if( msg->custom_result_len ) ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->custom_result, msg->custom_result_len );
557 0 : if( msg->start_time ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->start_time );
558 0 : if( msg->end_time ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->end_time );
559 0 : if( msg->payload_version ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->payload_version );
560 0 : if( msg->has_payload_version ) ok &= !!fd_pb_push_bool ( encoder, 7U, msg->has_payload_version );
561 0 : if( msg->payload_size ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->payload_size );
562 0 : if( msg->args_json_len ) ok &= !!fd_pb_push_bytes ( encoder, 9U, msg->args_json, msg->args_json_len );
563 0 : ok &= !!fd_pb_submsg_close( encoder );
564 0 : ok &= !!fd_pb_submsg_close( encoder );
565 0 : FD_TEST( ok );
566 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
567 0 : }
568 :
569 : void
570 : fd_event_runtime_block_serialize( fd_circq_t * circq,
571 : fd_event_client_t * client,
572 : long timestamp_nanos,
573 : ulong link_seq,
574 0 : fd_event_runtime_block_t const * msg ) {
575 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_BLOCK_BUF_MAX );
576 0 : FD_TEST( buffer );
577 :
578 0 : ulong event_id = fd_event_client_id_reserve( client );
579 :
580 0 : fd_pb_encoder_t encoder[1];
581 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_BLOCK_BUF_MAX );
582 :
583 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
584 : a FD_EVENT_RUNTIME_BLOCK_BUF_MAX that under-models the encoder aborts loudly instead
585 : of silently truncating fields off published rows. */
586 0 : int ok = 1;
587 :
588 0 : FD_TEST( circq->cursor_push_seq );
589 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
590 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
591 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
592 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
593 :
594 0 : FD_TEST( msg->recent_blockhashes_cnt<=151UL );
595 0 : FD_TEST( msg->recent_blockhashes_sysvar_cnt<=150UL );
596 0 : FD_TEST( msg->sysvar_diffs_cnt<=16UL );
597 0 : FD_TEST( msg->other_diffs_cnt<=32UL );
598 0 : FD_TEST( msg->fec_merkle_roots_cnt<=512UL );
599 :
600 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
601 0 : ok &= !!fd_pb_submsg_open( encoder, 13U ); /* RuntimeBlock */
602 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
603 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
604 0 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->block_id, 32UL );
605 0 : if( msg->parent_slot ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->parent_slot );
606 0 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->parent_block_id, 32UL );
607 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->epoch );
608 0 : if( msg->block_height ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->block_height );
609 0 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->leader, 32UL );
610 0 : ok &= !!fd_pb_push_bytes ( encoder, 9U, msg->bank_hash, 32UL );
611 0 : ok &= !!fd_pb_push_bytes ( encoder, 10U, msg->prev_bank_hash, 32UL );
612 0 : ok &= !!fd_pb_push_bytes ( encoder, 11U, msg->accounts_lt_hash_checksum, 32UL );
613 0 : ok &= !!fd_pb_push_bytes ( encoder, 12U, msg->poh_hash, 32UL );
614 0 : ok &= !!fd_pb_submsg_open( encoder, 13U );
615 0 : if( msg->clock_sysvar.slot ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->clock_sysvar.slot );
616 0 : if( msg->clock_sysvar.epoch_start_timestamp ) ok &= !!fd_pb_push_sint64( encoder, 2U, msg->clock_sysvar.epoch_start_timestamp );
617 0 : if( msg->clock_sysvar.epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->clock_sysvar.epoch );
618 0 : if( msg->clock_sysvar.leader_schedule_epoch ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->clock_sysvar.leader_schedule_epoch );
619 0 : if( msg->clock_sysvar.unix_timestamp ) ok &= !!fd_pb_push_sint64( encoder, 5U, msg->clock_sysvar.unix_timestamp );
620 0 : ok &= !!fd_pb_submsg_close( encoder );
621 0 : for( ulong k=0UL; k<msg->recent_blockhashes_cnt; k++ ) {
622 0 : ok &= !!fd_pb_push_bytes ( encoder, 14U, msg->recent_blockhashes[ k ], 32UL );
623 0 : }
624 0 : for( ulong k=0UL; k<msg->recent_blockhashes_sysvar_cnt; k++ ) {
625 0 : ok &= !!fd_pb_submsg_open( encoder, 15U );
626 0 : ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->recent_blockhashes_sysvar[ k ].blockhash, 32UL );
627 0 : if( msg->recent_blockhashes_sysvar[ k ].lamports_per_signature ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->recent_blockhashes_sysvar[ k ].lamports_per_signature );
628 0 : ok &= !!fd_pb_submsg_close( encoder );
629 0 : }
630 0 : if( msg->last_restart_slot_sysvar ) ok &= !!fd_pb_push_uint64( encoder, 16U, (ulong)msg->last_restart_slot_sysvar );
631 0 : if( msg->num_transactions ) ok &= !!fd_pb_push_uint64( encoder, 17U, (ulong)msg->num_transactions );
632 0 : if( msg->num_failed_txns ) ok &= !!fd_pb_push_uint64( encoder, 18U, (ulong)msg->num_failed_txns );
633 0 : if( msg->num_nonvote_txns ) ok &= !!fd_pb_push_uint64( encoder, 19U, (ulong)msg->num_nonvote_txns );
634 0 : if( msg->num_nonvote_failed_txns ) ok &= !!fd_pb_push_uint64( encoder, 20U, (ulong)msg->num_nonvote_failed_txns );
635 0 : if( msg->num_signatures ) ok &= !!fd_pb_push_uint64( encoder, 21U, (ulong)msg->num_signatures );
636 0 : if( msg->num_shreds ) ok &= !!fd_pb_push_uint64( encoder, 22U, (ulong)msg->num_shreds );
637 0 : if( msg->tick_height ) ok &= !!fd_pb_push_uint64( encoder, 23U, (ulong)msg->tick_height );
638 0 : if( msg->execution_fees ) ok &= !!fd_pb_push_uint64( encoder, 24U, (ulong)msg->execution_fees );
639 0 : if( msg->priority_fees ) ok &= !!fd_pb_push_uint64( encoder, 25U, (ulong)msg->priority_fees );
640 0 : if( msg->tips ) ok &= !!fd_pb_push_uint64( encoder, 26U, (ulong)msg->tips );
641 0 : if( msg->fees_burned ) ok &= !!fd_pb_push_uint64( encoder, 27U, (ulong)msg->fees_burned );
642 0 : if( msg->leader_fee_reward ) ok &= !!fd_pb_push_uint64( encoder, 28U, (ulong)msg->leader_fee_reward );
643 0 : if( msg->capitalization ) ok &= !!fd_pb_push_uint64( encoder, 29U, (ulong)msg->capitalization );
644 0 : if( msg->total_effective_stake ) ok &= !!fd_pb_push_uint64( encoder, 30U, (ulong)msg->total_effective_stake );
645 0 : if( msg->total_activating_stake ) ok &= !!fd_pb_push_uint64( encoder, 31U, (ulong)msg->total_activating_stake );
646 0 : if( msg->total_deactivating_stake ) ok &= !!fd_pb_push_uint64( encoder, 32U, (ulong)msg->total_deactivating_stake );
647 0 : if( msg->total_epoch_stake ) ok &= !!fd_pb_push_uint64( encoder, 33U, (ulong)msg->total_epoch_stake );
648 0 : for( ulong k=0UL; k<msg->sysvar_diffs_cnt; k++ ) {
649 0 : ok &= !!fd_pb_submsg_open( encoder, 34U );
650 0 : ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->sysvar_diffs[ k ].pubkey, 32UL );
651 0 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->sysvar_diffs[ k ].owner, 32UL );
652 0 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->sysvar_diffs[ k ].prev_owner, 32UL );
653 0 : if( msg->sysvar_diffs[ k ].lamports ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->sysvar_diffs[ k ].lamports );
654 0 : if( msg->sysvar_diffs[ k ].prev_lamports ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->sysvar_diffs[ k ].prev_lamports );
655 0 : if( msg->sysvar_diffs[ k ].data_sz ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->sysvar_diffs[ k ].data_sz );
656 0 : if( msg->sysvar_diffs[ k ].prev_data_sz ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->sysvar_diffs[ k ].prev_data_sz );
657 0 : if( msg->sysvar_diffs[ k ].is_executable ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->sysvar_diffs[ k ].is_executable );
658 0 : ok &= !!fd_pb_submsg_close( encoder );
659 0 : }
660 0 : for( ulong k=0UL; k<msg->other_diffs_cnt; k++ ) {
661 0 : ok &= !!fd_pb_submsg_open( encoder, 35U );
662 0 : ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->other_diffs[ k ].pubkey, 32UL );
663 0 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->other_diffs[ k ].owner, 32UL );
664 0 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->other_diffs[ k ].prev_owner, 32UL );
665 0 : if( msg->other_diffs[ k ].lamports ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->other_diffs[ k ].lamports );
666 0 : if( msg->other_diffs[ k ].prev_lamports ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->other_diffs[ k ].prev_lamports );
667 0 : if( msg->other_diffs[ k ].data_sz ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->other_diffs[ k ].data_sz );
668 0 : if( msg->other_diffs[ k ].prev_data_sz ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->other_diffs[ k ].prev_data_sz );
669 0 : if( msg->other_diffs[ k ].is_executable ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->other_diffs[ k ].is_executable );
670 0 : ok &= !!fd_pb_submsg_close( encoder );
671 0 : }
672 0 : if( msg->fec_count ) ok &= !!fd_pb_push_uint64( encoder, 36U, (ulong)msg->fec_count );
673 0 : for( ulong k=0UL; k<msg->fec_merkle_roots_cnt; k++ ) {
674 0 : ok &= !!fd_pb_push_bytes ( encoder, 37U, msg->fec_merkle_roots[ k ], 32UL );
675 0 : }
676 0 : ok &= !!fd_pb_submsg_close( encoder );
677 0 : ok &= !!fd_pb_submsg_close( encoder );
678 0 : FD_TEST( ok );
679 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
680 0 : }
681 :
682 : void
683 : fd_event_runtime_reward_serialize( fd_circq_t * circq,
684 : fd_event_client_t * client,
685 : long timestamp_nanos,
686 : ulong link_seq,
687 0 : fd_event_runtime_reward_t const * msg ) {
688 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_REWARD_BUF_MAX );
689 0 : FD_TEST( buffer );
690 :
691 0 : ulong event_id = fd_event_client_id_reserve( client );
692 :
693 0 : fd_pb_encoder_t encoder[1];
694 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_REWARD_BUF_MAX );
695 :
696 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
697 : a FD_EVENT_RUNTIME_REWARD_BUF_MAX that under-models the encoder aborts loudly instead
698 : of silently truncating fields off published rows. */
699 0 : int ok = 1;
700 :
701 0 : FD_TEST( circq->cursor_push_seq );
702 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
703 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
704 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
705 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
706 :
707 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
708 0 : ok &= !!fd_pb_submsg_open( encoder, 14U ); /* RuntimeReward */
709 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
710 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
711 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->epoch );
712 0 : if( msg->kind ) ok &= !!fd_pb_push_int32 ( encoder, 4U, msg->kind );
713 0 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->pubkey, 32UL );
714 0 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->owner, 32UL );
715 0 : if( msg->prev_lamports ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->prev_lamports );
716 0 : if( msg->lamports ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->lamports );
717 0 : if( msg->partition_idx ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->partition_idx );
718 0 : if( msg->credits_observed ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->credits_observed );
719 0 : if( msg->stake ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->stake );
720 0 : ok &= !!fd_pb_submsg_close( encoder );
721 0 : ok &= !!fd_pb_submsg_close( encoder );
722 0 : FD_TEST( ok );
723 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
724 0 : }
725 :
726 : void
727 : fd_event_runtime_stake_delegation_serialize( fd_circq_t * circq,
728 : fd_event_client_t * client,
729 : long timestamp_nanos,
730 : ulong link_seq,
731 0 : fd_event_runtime_stake_delegation_t const * msg ) {
732 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_STAKE_DELEGATION_BUF_MAX );
733 0 : FD_TEST( buffer );
734 :
735 0 : ulong event_id = fd_event_client_id_reserve( client );
736 :
737 0 : fd_pb_encoder_t encoder[1];
738 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_STAKE_DELEGATION_BUF_MAX );
739 :
740 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
741 : a FD_EVENT_RUNTIME_STAKE_DELEGATION_BUF_MAX that under-models the encoder aborts loudly instead
742 : of silently truncating fields off published rows. */
743 0 : int ok = 1;
744 :
745 0 : FD_TEST( circq->cursor_push_seq );
746 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
747 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
748 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
749 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
750 :
751 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
752 0 : ok &= !!fd_pb_submsg_open( encoder, 15U ); /* RuntimeStakeDelegation */
753 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
754 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
755 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->epoch );
756 0 : if( msg->index_in_slot ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->index_in_slot );
757 0 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->signature, 64UL );
758 0 : if( msg->kind ) ok &= !!fd_pb_push_int32 ( encoder, 6U, msg->kind );
759 0 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->stake_account, 32UL );
760 0 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->vote_account, 32UL );
761 0 : if( msg->stake ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->stake );
762 0 : if( msg->activation_epoch ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->activation_epoch );
763 0 : if( msg->deactivation_epoch ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->deactivation_epoch );
764 0 : if( msg->credits_observed ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->credits_observed );
765 0 : ok &= !!fd_pb_submsg_close( encoder );
766 0 : ok &= !!fd_pb_submsg_close( encoder );
767 0 : FD_TEST( ok );
768 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
769 0 : }
770 :
771 : void
772 : fd_event_runtime_rooted_serialize( fd_circq_t * circq,
773 : fd_event_client_t * client,
774 : long timestamp_nanos,
775 : ulong link_seq,
776 0 : fd_event_runtime_rooted_t const * msg ) {
777 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_ROOTED_BUF_MAX );
778 0 : FD_TEST( buffer );
779 :
780 0 : ulong event_id = fd_event_client_id_reserve( client );
781 :
782 0 : fd_pb_encoder_t encoder[1];
783 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_ROOTED_BUF_MAX );
784 :
785 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
786 : a FD_EVENT_RUNTIME_ROOTED_BUF_MAX that under-models the encoder aborts loudly instead
787 : of silently truncating fields off published rows. */
788 0 : int ok = 1;
789 :
790 0 : FD_TEST( circq->cursor_push_seq );
791 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
792 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
793 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
794 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
795 :
796 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
797 0 : ok &= !!fd_pb_submsg_open( encoder, 16U ); /* RuntimeRooted */
798 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
799 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
800 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->epoch );
801 0 : if( msg->prev_root_slot ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->prev_root_slot );
802 0 : if( msg->stake_delegations_upserts ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->stake_delegations_upserts );
803 0 : if( msg->stake_delegations_removes ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->stake_delegations_removes );
804 0 : if( msg->stake_delegations_cnt ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->stake_delegations_cnt );
805 0 : if( msg->effective_stake ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->effective_stake );
806 0 : if( msg->activating_stake ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->activating_stake );
807 0 : if( msg->deactivating_stake ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->deactivating_stake );
808 0 : ok &= !!fd_pb_push_bytes ( encoder, 11U, msg->block_id, 32UL );
809 0 : ok &= !!fd_pb_submsg_close( encoder );
810 0 : ok &= !!fd_pb_submsg_close( encoder );
811 0 : FD_TEST( ok );
812 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
813 0 : }
814 :
815 : void
816 : fd_event_runtime_epoch_serialize( fd_circq_t * circq,
817 : fd_event_client_t * client,
818 : long timestamp_nanos,
819 : ulong link_seq,
820 0 : fd_event_runtime_epoch_t const * msg ) {
821 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_EPOCH_BUF_MAX );
822 0 : FD_TEST( buffer );
823 :
824 0 : ulong event_id = fd_event_client_id_reserve( client );
825 :
826 0 : fd_pb_encoder_t encoder[1];
827 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_EPOCH_BUF_MAX );
828 :
829 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
830 : a FD_EVENT_RUNTIME_EPOCH_BUF_MAX that under-models the encoder aborts loudly instead
831 : of silently truncating fields off published rows. */
832 0 : int ok = 1;
833 :
834 0 : FD_TEST( circq->cursor_push_seq );
835 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
836 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
837 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
838 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
839 :
840 0 : FD_TEST( msg->feature_activations_cnt<=16UL );
841 :
842 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
843 0 : ok &= !!fd_pb_submsg_open( encoder, 17U ); /* RuntimeEpoch */
844 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
845 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
846 0 : if( msg->parent_slot ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->parent_slot );
847 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->epoch );
848 0 : if( msg->total_effective_stake ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->total_effective_stake );
849 0 : if( msg->total_activating_stake ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->total_activating_stake );
850 0 : if( msg->total_deactivating_stake ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->total_deactivating_stake );
851 0 : if( msg->total_epoch_stake ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->total_epoch_stake );
852 0 : if( msg->num_staked_vote_accounts ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->num_staked_vote_accounts );
853 0 : if( msg->num_vote_accounts ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->num_vote_accounts );
854 0 : if( msg->num_top_votes_eligible ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->num_top_votes_eligible );
855 0 : if( msg->top_votes_min_stake ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->top_votes_min_stake );
856 0 : ok &= !!fd_pb_submsg_open( encoder, 13U );
857 0 : if( msg->stake_history_sysvar.epoch ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->stake_history_sysvar.epoch );
858 0 : if( msg->stake_history_sysvar.effective ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->stake_history_sysvar.effective );
859 0 : if( msg->stake_history_sysvar.activating ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->stake_history_sysvar.activating );
860 0 : if( msg->stake_history_sysvar.deactivating ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->stake_history_sysvar.deactivating );
861 0 : ok &= !!fd_pb_submsg_close( encoder );
862 0 : ok &= !!fd_pb_submsg_open( encoder, 14U );
863 0 : if( msg->epoch_schedule_sysvar.slots_per_epoch ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->epoch_schedule_sysvar.slots_per_epoch );
864 0 : if( msg->epoch_schedule_sysvar.leader_schedule_slot_offset ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->epoch_schedule_sysvar.leader_schedule_slot_offset );
865 0 : if( msg->epoch_schedule_sysvar.warmup ) ok &= !!fd_pb_push_bool ( encoder, 3U, msg->epoch_schedule_sysvar.warmup );
866 0 : if( msg->epoch_schedule_sysvar.first_normal_epoch ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->epoch_schedule_sysvar.first_normal_epoch );
867 0 : if( msg->epoch_schedule_sysvar.first_normal_slot ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->epoch_schedule_sysvar.first_normal_slot );
868 0 : ok &= !!fd_pb_submsg_close( encoder );
869 0 : for( ulong k=0UL; k<msg->feature_activations_cnt; k++ ) {
870 0 : ok &= !!fd_pb_push_bytes ( encoder, 15U, msg->feature_activations[ k ], 32UL );
871 0 : }
872 0 : ok &= !!fd_pb_submsg_open( encoder, 16U );
873 0 : if( msg->epoch_rewards_sysvar.total_rewards ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->epoch_rewards_sysvar.total_rewards );
874 0 : if( msg->epoch_rewards_sysvar.distributed ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->epoch_rewards_sysvar.distributed );
875 0 : if( msg->epoch_rewards_sysvar.distribution_starting_block_height ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->epoch_rewards_sysvar.distribution_starting_block_height );
876 0 : if( msg->epoch_rewards_sysvar.num_partitions ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->epoch_rewards_sysvar.num_partitions );
877 0 : if( msg->epoch_rewards_sysvar.total_points ) ok &= !!fd_pb_push_bytes ( encoder, 5U, (uchar const *)&msg->epoch_rewards_sysvar.total_points, 16UL );
878 0 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->epoch_rewards_sysvar.parent_blockhash, 32UL );
879 0 : ok &= !!fd_pb_submsg_close( encoder );
880 0 : if( msg->vat_burn_per_vote_account ) ok &= !!fd_pb_push_uint64( encoder, 17U, (ulong)msg->vat_burn_per_vote_account );
881 0 : ok &= !!fd_pb_submsg_close( encoder );
882 0 : ok &= !!fd_pb_submsg_close( encoder );
883 0 : FD_TEST( ok );
884 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
885 0 : }
886 :
887 : void
888 : fd_event_runtime_vote_account_serialize( fd_circq_t * circq,
889 : fd_event_client_t * client,
890 : long timestamp_nanos,
891 : ulong link_seq,
892 0 : fd_event_runtime_vote_account_t const * msg ) {
893 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_VOTE_ACCOUNT_BUF_MAX );
894 0 : FD_TEST( buffer );
895 :
896 0 : ulong event_id = fd_event_client_id_reserve( client );
897 :
898 0 : fd_pb_encoder_t encoder[1];
899 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_VOTE_ACCOUNT_BUF_MAX );
900 :
901 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
902 : a FD_EVENT_RUNTIME_VOTE_ACCOUNT_BUF_MAX that under-models the encoder aborts loudly instead
903 : of silently truncating fields off published rows. */
904 0 : int ok = 1;
905 :
906 0 : FD_TEST( circq->cursor_push_seq );
907 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
908 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
909 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
910 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
911 :
912 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
913 0 : ok &= !!fd_pb_submsg_open( encoder, 18U ); /* RuntimeVoteAccount */
914 0 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
915 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
916 0 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->epoch );
917 0 : ok &= !!fd_pb_push_bytes ( encoder, 4U, msg->pubkey, 32UL );
918 0 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->node_account, 32UL );
919 0 : if( msg->stake ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->stake );
920 0 : if( msg->commission_bps ) ok &= !!fd_pb_push_uint32( encoder, 7U, (uint)msg->commission_bps );
921 0 : if( msg->has_commission_t_2 ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->has_commission_t_2 );
922 0 : if( msg->commission_t_2_bps ) ok &= !!fd_pb_push_uint32( encoder, 9U, (uint)msg->commission_t_2_bps );
923 0 : if( msg->has_commission_t_3 ) ok &= !!fd_pb_push_bool ( encoder, 10U, msg->has_commission_t_3 );
924 0 : if( msg->commission_t_3_bps ) ok &= !!fd_pb_push_uint32( encoder, 11U, (uint)msg->commission_t_3_bps );
925 0 : if( msg->reward_commission_bps ) ok &= !!fd_pb_push_uint32( encoder, 12U, (uint)msg->reward_commission_bps );
926 0 : if( msg->credits ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->credits );
927 0 : if( msg->prev_credits ) ok &= !!fd_pb_push_uint64( encoder, 14U, (ulong)msg->prev_credits );
928 0 : if( msg->epoch_credits_cnt ) ok &= !!fd_pb_push_uint64( encoder, 15U, (ulong)msg->epoch_credits_cnt );
929 0 : ok &= !!fd_pb_submsg_close( encoder );
930 0 : ok &= !!fd_pb_submsg_close( encoder );
931 0 : FD_TEST( ok );
932 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
933 0 : }
934 :
935 : void
936 : fd_event_alpenglow_vote_serialize( fd_circq_t * circq,
937 : fd_event_client_t * client,
938 : long timestamp_nanos,
939 : ulong link_seq,
940 0 : fd_event_alpenglow_vote_t const * msg ) {
941 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_ALPENGLOW_VOTE_BUF_MAX );
942 0 : FD_TEST( buffer );
943 :
944 0 : ulong event_id = fd_event_client_id_reserve( client );
945 :
946 0 : fd_pb_encoder_t encoder[1];
947 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_ALPENGLOW_VOTE_BUF_MAX );
948 :
949 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
950 : a FD_EVENT_ALPENGLOW_VOTE_BUF_MAX that under-models the encoder aborts loudly instead
951 : of silently truncating fields off published rows. */
952 0 : int ok = 1;
953 :
954 0 : FD_TEST( circq->cursor_push_seq );
955 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
956 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
957 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
958 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
959 :
960 0 : FD_TEST( msg->broadcast_to_cnt<=2000UL );
961 :
962 0 : uchar const * _dyn = (uchar const *)msg + FD_EVENT_ALPENGLOW_VOTE_PREFIX_SZ;
963 0 : fd_event_alpenglow_vote_broadcast_to_t const * broadcast_to = (fd_event_alpenglow_vote_broadcast_to_t const *)_dyn;
964 0 : _dyn += msg->broadcast_to_cnt*sizeof(broadcast_to[0]);
965 0 : ulong broadcast_to_cnt = msg->broadcast_to_cnt;
966 :
967 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
968 0 : ok &= !!fd_pb_submsg_open( encoder, 19U ); /* AlpenglowVote */
969 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->slot );
970 0 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->block_id, 32UL );
971 0 : if( msg->voter_rank ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)msg->voter_rank );
972 0 : ok &= !!fd_pb_push_bytes ( encoder, 4U, msg->voter_identity, 32UL );
973 0 : if( msg->kind ) ok &= !!fd_pb_push_int32 ( encoder, 5U, msg->kind );
974 0 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->received_from_ip, 16UL );
975 0 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->received_from_identity, 32UL );
976 0 : if( msg->our_vote ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->our_vote );
977 0 : if( msg->reason ) ok &= !!fd_pb_push_int32 ( encoder, 9U, msg->reason );
978 0 : for( ulong k=0UL; k<broadcast_to_cnt; k++ ) {
979 0 : ok &= !!fd_pb_submsg_open( encoder, 10U );
980 0 : ok &= !!fd_pb_push_bytes ( encoder, 1U, broadcast_to[ k ].identity, 32UL );
981 0 : ok &= !!fd_pb_push_bytes ( encoder, 2U, broadcast_to[ k ].ip, 16UL );
982 0 : if( broadcast_to[ k ].port ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)broadcast_to[ k ].port );
983 0 : ok &= !!fd_pb_submsg_close( encoder );
984 0 : }
985 0 : if( msg->processing_result ) ok &= !!fd_pb_push_int32 ( encoder, 11U, msg->processing_result );
986 0 : if( msg->quorum_reached_final_cert ) ok &= !!fd_pb_push_bool ( encoder, 12U, msg->quorum_reached_final_cert );
987 0 : if( msg->quorum_reached_fast_final_cert ) ok &= !!fd_pb_push_bool ( encoder, 13U, msg->quorum_reached_fast_final_cert );
988 0 : if( msg->quorum_reached_notar_cert ) ok &= !!fd_pb_push_bool ( encoder, 14U, msg->quorum_reached_notar_cert );
989 0 : if( msg->quorum_reached_notar_fallback_cert ) ok &= !!fd_pb_push_bool ( encoder, 15U, msg->quorum_reached_notar_fallback_cert );
990 0 : if( msg->quorum_reached_skip_cert ) ok &= !!fd_pb_push_bool ( encoder, 16U, msg->quorum_reached_skip_cert );
991 0 : if( msg->quorum_reached_safe_to_notar ) ok &= !!fd_pb_push_bool ( encoder, 17U, msg->quorum_reached_safe_to_notar );
992 0 : if( msg->quorum_reached_safe_to_skip ) ok &= !!fd_pb_push_bool ( encoder, 18U, msg->quorum_reached_safe_to_skip );
993 0 : if( msg->aggregation_start_time ) ok &= !!fd_pb_push_uint64( encoder, 19U, (ulong)msg->aggregation_start_time );
994 0 : if( msg->verify_start_time ) ok &= !!fd_pb_push_uint64( encoder, 20U, (ulong)msg->verify_start_time );
995 0 : if( msg->broadcast_start_time ) ok &= !!fd_pb_push_uint64( encoder, 21U, (ulong)msg->broadcast_start_time );
996 0 : if( msg->done_time ) ok &= !!fd_pb_push_uint64( encoder, 22U, (ulong)msg->done_time );
997 0 : ok &= !!fd_pb_submsg_close( encoder );
998 0 : ok &= !!fd_pb_submsg_close( encoder );
999 0 : FD_TEST( ok );
1000 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
1001 0 : }
1002 :
1003 : void
1004 : fd_event_alpenglow_cert_serialize( fd_circq_t * circq,
1005 : fd_event_client_t * client,
1006 : long timestamp_nanos,
1007 : ulong link_seq,
1008 0 : fd_event_alpenglow_cert_t const * msg ) {
1009 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_ALPENGLOW_CERT_BUF_MAX );
1010 0 : FD_TEST( buffer );
1011 :
1012 0 : ulong event_id = fd_event_client_id_reserve( client );
1013 :
1014 0 : fd_pb_encoder_t encoder[1];
1015 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_ALPENGLOW_CERT_BUF_MAX );
1016 :
1017 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
1018 : a FD_EVENT_ALPENGLOW_CERT_BUF_MAX that under-models the encoder aborts loudly instead
1019 : of silently truncating fields off published rows. */
1020 0 : int ok = 1;
1021 :
1022 0 : FD_TEST( circq->cursor_push_seq );
1023 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
1024 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
1025 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
1026 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
1027 :
1028 0 : FD_TEST( msg->voters_len<=250UL );
1029 0 : FD_TEST( msg->fallback_voters_len<=250UL );
1030 0 : FD_TEST( msg->broadcast_to_cnt<=2000UL );
1031 :
1032 0 : uchar const * _dyn = (uchar const *)msg + FD_EVENT_ALPENGLOW_CERT_PREFIX_SZ;
1033 0 : fd_event_alpenglow_cert_broadcast_to_t const * broadcast_to = (fd_event_alpenglow_cert_broadcast_to_t const *)_dyn;
1034 0 : _dyn += msg->broadcast_to_cnt*sizeof(broadcast_to[0]);
1035 0 : ulong broadcast_to_cnt = msg->broadcast_to_cnt;
1036 :
1037 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
1038 0 : ok &= !!fd_pb_submsg_open( encoder, 20U ); /* AlpenglowCert */
1039 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->slot );
1040 0 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->block_id, 32UL );
1041 0 : if( msg->kind ) ok &= !!fd_pb_push_int32 ( encoder, 3U, msg->kind );
1042 0 : if( msg->voters_len ) ok &= !!fd_pb_push_bytes ( encoder, 4U, msg->voters, msg->voters_len );
1043 0 : if( msg->fallback_voters_len ) ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->fallback_voters, msg->fallback_voters_len );
1044 0 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->relayer_ip, 16UL );
1045 0 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->relayer_identity, 32UL );
1046 0 : if( msg->our_cert ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->our_cert );
1047 0 : for( ulong k=0UL; k<broadcast_to_cnt; k++ ) {
1048 0 : ok &= !!fd_pb_submsg_open( encoder, 9U );
1049 0 : ok &= !!fd_pb_push_bytes ( encoder, 1U, broadcast_to[ k ].identity, 32UL );
1050 0 : ok &= !!fd_pb_push_bytes ( encoder, 2U, broadcast_to[ k ].ip, 16UL );
1051 0 : if( broadcast_to[ k ].port ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)broadcast_to[ k ].port );
1052 0 : ok &= !!fd_pb_submsg_close( encoder );
1053 0 : }
1054 0 : if( msg->processing_result ) ok &= !!fd_pb_push_int32 ( encoder, 10U, msg->processing_result );
1055 0 : if( msg->verify_start_time ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->verify_start_time );
1056 0 : if( msg->broadcast_start_time ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->broadcast_start_time );
1057 0 : if( msg->done_time ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->done_time );
1058 0 : ok &= !!fd_pb_submsg_close( encoder );
1059 0 : ok &= !!fd_pb_submsg_close( encoder );
1060 0 : FD_TEST( ok );
1061 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
1062 0 : }
1063 :
1064 : void
1065 : fd_event_block_received_serialize( fd_circq_t * circq,
1066 : fd_event_client_t * client,
1067 : long timestamp_nanos,
1068 : ulong link_seq,
1069 0 : fd_event_block_received_t const * msg ) {
1070 0 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_BLOCK_RECEIVED_BUF_MAX );
1071 0 : FD_TEST( buffer );
1072 :
1073 0 : ulong event_id = fd_event_client_id_reserve( client );
1074 :
1075 0 : fd_pb_encoder_t encoder[1];
1076 0 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_BLOCK_RECEIVED_BUF_MAX );
1077 :
1078 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
1079 : a FD_EVENT_BLOCK_RECEIVED_BUF_MAX that under-models the encoder aborts loudly instead
1080 : of silently truncating fields off published rows. */
1081 0 : int ok = 1;
1082 :
1083 0 : FD_TEST( circq->cursor_push_seq );
1084 0 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
1085 0 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
1086 0 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
1087 0 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
1088 :
1089 0 : FD_TEST( msg->fec_sets_cnt<=512UL );
1090 :
1091 0 : uchar const * _dyn = (uchar const *)msg + FD_EVENT_BLOCK_RECEIVED_PREFIX_SZ;
1092 0 : fd_event_block_received_fec_sets_t const * fec_sets = (fd_event_block_received_fec_sets_t const *)_dyn;
1093 0 : _dyn += msg->fec_sets_cnt*sizeof(fec_sets[0]);
1094 0 : ulong fec_sets_cnt = msg->fec_sets_cnt;
1095 :
1096 0 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
1097 0 : ok &= !!fd_pb_submsg_open( encoder, 21U ); /* BlockReceived */
1098 0 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->slot );
1099 0 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->block_id, 32UL );
1100 0 : if( msg->parent_slot ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->parent_slot );
1101 0 : ok &= !!fd_pb_push_bytes ( encoder, 4U, msg->parent_block_id, 32UL );
1102 0 : if( msg->cancelled ) ok &= !!fd_pb_push_bool ( encoder, 5U, msg->cancelled );
1103 0 : if( msg->cancelled_reason ) ok &= !!fd_pb_push_int32 ( encoder, 6U, msg->cancelled_reason );
1104 0 : if( msg->cancelled_time ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->cancelled_time );
1105 0 : if( msg->notarized ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->notarized );
1106 0 : if( msg->is_leader ) ok &= !!fd_pb_push_bool ( encoder, 9U, msg->is_leader );
1107 0 : if( msg->caught_up ) ok &= !!fd_pb_push_bool ( encoder, 10U, msg->caught_up );
1108 0 : if( msg->fec_set_count ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->fec_set_count );
1109 0 : if( msg->first_shred_received_time ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->first_shred_received_time );
1110 0 : if( msg->last_shred_received_time ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->last_shred_received_time );
1111 0 : if( msg->first_repair_request_time ) ok &= !!fd_pb_push_uint64( encoder, 14U, (ulong)msg->first_repair_request_time );
1112 0 : if( msg->last_repair_received_time ) ok &= !!fd_pb_push_uint64( encoder, 15U, (ulong)msg->last_repair_received_time );
1113 0 : if( msg->first_meta_received_time ) ok &= !!fd_pb_push_uint64( encoder, 16U, (ulong)msg->first_meta_received_time );
1114 0 : if( msg->turbine_shred_received ) ok &= !!fd_pb_push_uint32( encoder, 17U, (uint)msg->turbine_shred_received );
1115 0 : if( msg->parity_shred_received ) ok &= !!fd_pb_push_uint32( encoder, 18U, (uint)msg->parity_shred_received );
1116 0 : if( msg->repair_shred_received ) ok &= !!fd_pb_push_uint32( encoder, 19U, (uint)msg->repair_shred_received );
1117 0 : if( msg->recovered_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 20U, (uint)msg->recovered_shred_count );
1118 0 : if( msg->last_completed_fec_set_index ) ok &= !!fd_pb_push_uint32( encoder, 21U, (uint)msg->last_completed_fec_set_index );
1119 0 : if( msg->slot_complete ) ok &= !!fd_pb_push_bool ( encoder, 22U, msg->slot_complete );
1120 0 : if( msg->equivocation_detected_shred ) ok &= !!fd_pb_push_bool ( encoder, 23U, msg->equivocation_detected_shred );
1121 0 : if( msg->repair_shred_responses_received ) ok &= !!fd_pb_push_uint32( encoder, 24U, (uint)msg->repair_shred_responses_received );
1122 0 : if( msg->parent_fec_count_responses_received ) ok &= !!fd_pb_push_uint32( encoder, 25U, (uint)msg->parent_fec_count_responses_received );
1123 0 : if( msg->fec_root_responses_received ) ok &= !!fd_pb_push_uint32( encoder, 26U, (uint)msg->fec_root_responses_received );
1124 0 : if( msg->repair_request_window_count ) ok &= !!fd_pb_push_uint32( encoder, 27U, (uint)msg->repair_request_window_count );
1125 0 : if( msg->repair_request_highest_window_count ) ok &= !!fd_pb_push_uint32( encoder, 28U, (uint)msg->repair_request_highest_window_count );
1126 0 : if( msg->repair_request_orphan_count ) ok &= !!fd_pb_push_uint32( encoder, 29U, (uint)msg->repair_request_orphan_count );
1127 0 : if( msg->repair_request_shred_for_block_id_count ) ok &= !!fd_pb_push_uint32( encoder, 30U, (uint)msg->repair_request_shred_for_block_id_count );
1128 0 : if( msg->repair_request_parent_fec_count ) ok &= !!fd_pb_push_uint32( encoder, 31U, (uint)msg->repair_request_parent_fec_count );
1129 0 : if( msg->repair_request_fec_root_count ) ok &= !!fd_pb_push_uint32( encoder, 32U, (uint)msg->repair_request_fec_root_count );
1130 0 : for( ulong k=0UL; k<fec_sets_cnt; k++ ) {
1131 0 : ok &= !!fd_pb_submsg_open( encoder, 33U );
1132 0 : ok &= !!fd_pb_push_bytes ( encoder, 1U, fec_sets[ k ].merkle_root, 32UL );
1133 0 : if( fec_sets[ k ].index ) ok &= !!fd_pb_push_uint32( encoder, 2U, (uint)fec_sets[ k ].index );
1134 0 : if( fec_sets[ k ].data_shreds_received_mask ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)fec_sets[ k ].data_shreds_received_mask );
1135 0 : if( fec_sets[ k ].parity_shreds_received_mask ) ok &= !!fd_pb_push_uint32( encoder, 4U, (uint)fec_sets[ k ].parity_shreds_received_mask );
1136 0 : if( fec_sets[ k ].repair_shreds_received_mask ) ok &= !!fd_pb_push_uint32( encoder, 5U, (uint)fec_sets[ k ].repair_shreds_received_mask );
1137 0 : if( fec_sets[ k ].duplicate_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 6U, (uint)fec_sets[ k ].duplicate_shred_count );
1138 0 : if( fec_sets[ k ].first_shred_received_time ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)fec_sets[ k ].first_shred_received_time );
1139 0 : if( fec_sets[ k ].completed_time ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)fec_sets[ k ].completed_time );
1140 0 : if( fec_sets[ k ].final_shred_source ) ok &= !!fd_pb_push_int32 ( encoder, 9U, fec_sets[ k ].final_shred_source );
1141 0 : ok &= !!fd_pb_submsg_close( encoder );
1142 0 : }
1143 0 : ok &= !!fd_pb_submsg_close( encoder );
1144 0 : ok &= !!fd_pb_submsg_close( encoder );
1145 0 : FD_TEST( ok );
1146 0 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
1147 0 : }
1148 :
1149 : void
1150 : fd_event_serialize_by_type( ulong type,
1151 : fd_circq_t * circq,
1152 : fd_event_client_t * client,
1153 : long timestamp_nanos,
1154 : ulong link_seq,
1155 : void const * ev,
1156 0 : ulong ev_sz ) {
1157 0 : switch( type ) {
1158 0 : case 3UL:
1159 0 : FD_TEST( ev_sz==sizeof(fd_event_signed_vote_t) );
1160 0 : fd_event_signed_vote_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_signed_vote_t const *)ev );
1161 0 : break;
1162 0 : case 4UL:
1163 0 : FD_TEST( ev_sz==sizeof(fd_event_slot_confirmed_t) );
1164 0 : fd_event_slot_confirmed_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_slot_confirmed_t const *)ev );
1165 0 : break;
1166 0 : case 5UL:
1167 0 : FD_TEST( ev_sz==sizeof(fd_event_accdb_compaction_completed_t) );
1168 0 : fd_event_accdb_compaction_completed_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_accdb_compaction_completed_t const *)ev );
1169 0 : break;
1170 0 : case 6UL:
1171 0 : FD_TEST( ev_sz==sizeof(fd_event_accdb_partition_added_t) );
1172 0 : fd_event_accdb_partition_added_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_accdb_partition_added_t const *)ev );
1173 0 : break;
1174 0 : case 7UL:
1175 0 : FD_TEST( ev_sz==sizeof(fd_event_block_equivocated_t) );
1176 0 : fd_event_block_equivocated_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_block_equivocated_t const *)ev );
1177 0 : break;
1178 0 : case 8UL:
1179 0 : FD_TEST( ev_sz==sizeof(fd_event_runtime_txn_t) );
1180 0 : fd_event_runtime_txn_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_txn_t const *)ev );
1181 0 : break;
1182 0 : case 9UL: {
1183 0 : FD_TEST( ev_sz>=FD_EVENT_BLOCK_COMPLETED_PREFIX_SZ );
1184 0 : fd_event_block_completed_t const * msg = (fd_event_block_completed_t const *)ev;
1185 0 : FD_TEST( msg->txn_timing_cnt<=49019UL );
1186 0 : FD_TEST( ev_sz==fd_event_block_completed_footprint( msg ) );
1187 0 : fd_event_block_completed_serialize( circq, client, timestamp_nanos, link_seq, msg );
1188 0 : break;
1189 0 : }
1190 0 : case 11UL:
1191 0 : FD_TEST( ev_sz==sizeof(fd_event_snapshot_created_t) );
1192 0 : fd_event_snapshot_created_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_snapshot_created_t const *)ev );
1193 0 : break;
1194 0 : case 12UL:
1195 0 : FD_TEST( ev_sz==sizeof(fd_event_admin_command_t) );
1196 0 : fd_event_admin_command_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_admin_command_t const *)ev );
1197 0 : break;
1198 0 : case 13UL:
1199 0 : FD_TEST( ev_sz==sizeof(fd_event_runtime_block_t) );
1200 0 : fd_event_runtime_block_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_block_t const *)ev );
1201 0 : break;
1202 0 : case 14UL:
1203 0 : FD_TEST( ev_sz==sizeof(fd_event_runtime_reward_t) );
1204 0 : fd_event_runtime_reward_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_reward_t const *)ev );
1205 0 : break;
1206 0 : case 15UL:
1207 0 : FD_TEST( ev_sz==sizeof(fd_event_runtime_stake_delegation_t) );
1208 0 : fd_event_runtime_stake_delegation_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_stake_delegation_t const *)ev );
1209 0 : break;
1210 0 : case 16UL:
1211 0 : FD_TEST( ev_sz==sizeof(fd_event_runtime_rooted_t) );
1212 0 : fd_event_runtime_rooted_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_rooted_t const *)ev );
1213 0 : break;
1214 0 : case 17UL:
1215 0 : FD_TEST( ev_sz==sizeof(fd_event_runtime_epoch_t) );
1216 0 : fd_event_runtime_epoch_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_epoch_t const *)ev );
1217 0 : break;
1218 0 : case 18UL:
1219 0 : FD_TEST( ev_sz==sizeof(fd_event_runtime_vote_account_t) );
1220 0 : fd_event_runtime_vote_account_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_vote_account_t const *)ev );
1221 0 : break;
1222 0 : case 19UL: {
1223 0 : FD_TEST( ev_sz>=FD_EVENT_ALPENGLOW_VOTE_PREFIX_SZ );
1224 0 : fd_event_alpenglow_vote_t const * msg = (fd_event_alpenglow_vote_t const *)ev;
1225 0 : FD_TEST( msg->broadcast_to_cnt<=2000UL );
1226 0 : FD_TEST( ev_sz==fd_event_alpenglow_vote_footprint( msg ) );
1227 0 : fd_event_alpenglow_vote_serialize( circq, client, timestamp_nanos, link_seq, msg );
1228 0 : break;
1229 0 : }
1230 0 : case 20UL: {
1231 0 : FD_TEST( ev_sz>=FD_EVENT_ALPENGLOW_CERT_PREFIX_SZ );
1232 0 : fd_event_alpenglow_cert_t const * msg = (fd_event_alpenglow_cert_t const *)ev;
1233 0 : FD_TEST( msg->broadcast_to_cnt<=2000UL );
1234 0 : FD_TEST( ev_sz==fd_event_alpenglow_cert_footprint( msg ) );
1235 0 : fd_event_alpenglow_cert_serialize( circq, client, timestamp_nanos, link_seq, msg );
1236 0 : break;
1237 0 : }
1238 0 : case 21UL: {
1239 0 : FD_TEST( ev_sz>=FD_EVENT_BLOCK_RECEIVED_PREFIX_SZ );
1240 0 : fd_event_block_received_t const * msg = (fd_event_block_received_t const *)ev;
1241 0 : FD_TEST( msg->fec_sets_cnt<=512UL );
1242 0 : FD_TEST( ev_sz==fd_event_block_received_footprint( msg ) );
1243 0 : fd_event_block_received_serialize( circq, client, timestamp_nanos, link_seq, msg );
1244 0 : break;
1245 0 : }
1246 0 : default: FD_LOG_ERR(( "unexpected event type %lu", type ));
1247 0 : }
1248 0 : }
|