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