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 3 : fd_event_signed_vote_t const * msg ) {
11 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_SIGNED_VOTE_BUF_MAX );
12 3 : FD_TEST( buffer );
13 :
14 3 : ulong event_id = fd_event_client_id_reserve( client );
15 :
16 3 : fd_pb_encoder_t encoder[1];
17 3 : 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 3 : int ok = 1;
23 :
24 3 : FD_TEST( circq->cursor_push_seq );
25 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
26 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
27 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
28 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
29 :
30 3 : FD_TEST( msg->signed_txn_len<=1232UL );
31 3 : FD_TEST( msg->tower_cnt<=31UL );
32 :
33 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
34 3 : ok &= !!fd_pb_submsg_open( encoder, 3U ); /* SignedVote */
35 3 : if( msg->signed_txn_len ) ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->signed_txn, msg->signed_txn_len );
36 3 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->vote_account, 32UL );
37 3 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->vote_authority, 32UL );
38 3 : ok &= !!fd_pb_push_bytes ( encoder, 4U, msg->fee_payer, 32UL );
39 3 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->signature, 64UL );
40 3 : if( msg->vote_slot ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->vote_slot );
41 3 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->vote_bank_hash, 32UL );
42 3 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->vote_block_id, 32UL );
43 3 : ok &= !!fd_pb_push_bytes ( encoder, 9U, msg->txn_blockhash, 32UL );
44 96 : for( ulong k=0UL; k<msg->tower_cnt; k++ ) {
45 93 : ok &= !!fd_pb_submsg_open( encoder, 10U );
46 93 : if( msg->tower[ k ].slot ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->tower[ k ].slot );
47 93 : if( msg->tower[ k ].confirmation_count ) ok &= !!fd_pb_push_uint32( encoder, 2U, (uint)msg->tower[ k ].confirmation_count );
48 93 : ok &= !!fd_pb_submsg_close( encoder );
49 93 : }
50 3 : ok &= !!fd_pb_submsg_close( encoder );
51 3 : ok &= !!fd_pb_submsg_close( encoder );
52 3 : FD_TEST( ok );
53 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
54 3 : }
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 3 : fd_event_slot_confirmed_t const * msg ) {
62 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_SLOT_CONFIRMED_BUF_MAX );
63 3 : FD_TEST( buffer );
64 :
65 3 : ulong event_id = fd_event_client_id_reserve( client );
66 :
67 3 : fd_pb_encoder_t encoder[1];
68 3 : 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 3 : int ok = 1;
74 :
75 3 : FD_TEST( circq->cursor_push_seq );
76 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
77 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
78 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
79 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
80 :
81 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
82 3 : ok &= !!fd_pb_submsg_open( encoder, 4U ); /* SlotConfirmed */
83 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
84 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
85 3 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->block_id, 32UL );
86 3 : if( msg->stake ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->stake );
87 3 : if( msg->total_stake ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->total_stake );
88 3 : if( msg->valid ) ok &= !!fd_pb_push_bool ( encoder, 6U, msg->valid );
89 3 : if( msg->level ) ok &= !!fd_pb_push_int32 ( encoder, 7U, msg->level );
90 3 : if( msg->forward ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->forward );
91 3 : ok &= !!fd_pb_submsg_close( encoder );
92 3 : ok &= !!fd_pb_submsg_close( encoder );
93 3 : FD_TEST( ok );
94 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
95 3 : }
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 3 : fd_event_accdb_compaction_completed_t const * msg ) {
103 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_ACCDB_COMPACTION_COMPLETED_BUF_MAX );
104 3 : FD_TEST( buffer );
105 :
106 3 : ulong event_id = fd_event_client_id_reserve( client );
107 :
108 3 : fd_pb_encoder_t encoder[1];
109 3 : 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 3 : int ok = 1;
115 :
116 3 : FD_TEST( circq->cursor_push_seq );
117 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
118 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
119 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
120 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
121 :
122 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
123 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* AccdbCompactionCompleted */
124 3 : if( msg->partition_idx ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->partition_idx );
125 3 : if( msg->src_layer ) ok &= !!fd_pb_push_uint32( encoder, 2U, (uint)msg->src_layer );
126 3 : if( msg->dest_layer ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)msg->dest_layer );
127 3 : if( msg->bytes_scanned ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->bytes_scanned );
128 3 : if( msg->bytes_freed ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->bytes_freed );
129 3 : if( msg->accounts_relocated ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->accounts_relocated );
130 3 : if( msg->bytes_relocated ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->bytes_relocated );
131 3 : if( msg->dead_records ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->dead_records );
132 3 : if( msg->start_time ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->start_time );
133 3 : if( msg->end_time ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->end_time );
134 3 : ok &= !!fd_pb_submsg_close( encoder );
135 3 : ok &= !!fd_pb_submsg_close( encoder );
136 3 : FD_TEST( ok );
137 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
138 3 : }
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 3 : fd_event_accdb_partition_added_t const * msg ) {
146 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_ACCDB_PARTITION_ADDED_BUF_MAX );
147 3 : FD_TEST( buffer );
148 :
149 3 : ulong event_id = fd_event_client_id_reserve( client );
150 :
151 3 : fd_pb_encoder_t encoder[1];
152 3 : 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 3 : int ok = 1;
158 :
159 3 : FD_TEST( circq->cursor_push_seq );
160 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
161 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
162 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
163 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
164 :
165 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
166 3 : ok &= !!fd_pb_submsg_open( encoder, 6U ); /* AccdbPartitionAdded */
167 3 : if( msg->partition_idx ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->partition_idx );
168 3 : if( msg->prior_partition_idx ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->prior_partition_idx );
169 3 : if( msg->layer ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)msg->layer );
170 3 : if( msg->old_partition_max ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->old_partition_max );
171 3 : if( msg->new_partition_max ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->new_partition_max );
172 3 : if( msg->partition_sz ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->partition_sz );
173 3 : if( msg->disk_allocated_bytes ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->disk_allocated_bytes );
174 3 : ok &= !!fd_pb_submsg_close( encoder );
175 3 : ok &= !!fd_pb_submsg_close( encoder );
176 3 : FD_TEST( ok );
177 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
178 3 : }
179 :
180 : void
181 : fd_event_block_equivocated_serialize( fd_circq_t * circq,
182 : fd_event_client_t * client,
183 : long timestamp_nanos,
184 : ulong link_seq,
185 3 : fd_event_block_equivocated_t const * msg ) {
186 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_BLOCK_EQUIVOCATED_BUF_MAX );
187 3 : FD_TEST( buffer );
188 :
189 3 : ulong event_id = fd_event_client_id_reserve( client );
190 :
191 3 : fd_pb_encoder_t encoder[1];
192 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_BLOCK_EQUIVOCATED_BUF_MAX );
193 :
194 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
195 : a FD_EVENT_BLOCK_EQUIVOCATED_BUF_MAX that under-models the encoder aborts loudly instead
196 : of silently truncating fields off published rows. */
197 3 : int ok = 1;
198 :
199 3 : FD_TEST( circq->cursor_push_seq );
200 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
201 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
202 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
203 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
204 :
205 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
206 3 : ok &= !!fd_pb_submsg_open( encoder, 7U ); /* BlockEquivocated */
207 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
208 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
209 3 : if( msg->parent_slot ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->parent_slot );
210 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->epoch );
211 3 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->block_id, 32UL );
212 3 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->sibling_block_id, 32UL );
213 3 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->bank_hash, 32UL );
214 3 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->block_hash, 32UL );
215 3 : if( msg->is_leader ) ok &= !!fd_pb_push_bool ( encoder, 9U, msg->is_leader );
216 3 : if( msg->our_block_voted ) ok &= !!fd_pb_push_bool ( encoder, 10U, msg->our_block_voted );
217 3 : if( msg->our_block_confirmed ) ok &= !!fd_pb_push_bool ( encoder, 11U, msg->our_block_confirmed );
218 3 : if( msg->block_stake ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->block_stake );
219 3 : if( msg->sibling_stake ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->sibling_stake );
220 3 : if( msg->total_stake ) ok &= !!fd_pb_push_uint64( encoder, 14U, (ulong)msg->total_stake );
221 3 : if( msg->detection ) ok &= !!fd_pb_push_int32 ( encoder, 15U, msg->detection );
222 3 : ok &= !!fd_pb_submsg_close( encoder );
223 3 : ok &= !!fd_pb_submsg_close( encoder );
224 3 : FD_TEST( ok );
225 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
226 3 : }
227 :
228 : void
229 : fd_event_runtime_txn_serialize( fd_circq_t * circq,
230 : fd_event_client_t * client,
231 : long timestamp_nanos,
232 : ulong link_seq,
233 3 : fd_event_runtime_txn_t const * msg ) {
234 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_TXN_BUF_MAX );
235 3 : FD_TEST( buffer );
236 :
237 3 : ulong event_id = fd_event_client_id_reserve( client );
238 :
239 3 : fd_pb_encoder_t encoder[1];
240 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_TXN_BUF_MAX );
241 :
242 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
243 : a FD_EVENT_RUNTIME_TXN_BUF_MAX that under-models the encoder aborts loudly instead
244 : of silently truncating fields off published rows. */
245 3 : int ok = 1;
246 :
247 3 : FD_TEST( circq->cursor_push_seq );
248 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
249 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
250 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
251 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
252 :
253 3 : FD_TEST( msg->account_diffs_cnt<=64UL );
254 3 : FD_TEST( msg->writable_accounts_cnt<=64UL );
255 3 : FD_TEST( msg->readonly_accounts_cnt<=64UL );
256 3 : FD_TEST( msg->program_ids_cnt<=64UL );
257 :
258 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
259 3 : ok &= !!fd_pb_submsg_open( encoder, 8U ); /* RuntimeTxn */
260 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
261 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
262 3 : if( msg->index_in_slot ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->index_in_slot );
263 3 : if( msg->commit_index_in_slot ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->commit_index_in_slot );
264 3 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->fec_merkle_root, 32UL );
265 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->epoch );
266 3 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->signature, 64UL );
267 3 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->blockhash, 32UL );
268 3 : ok &= !!fd_pb_push_bytes ( encoder, 9U, msg->fee_payer, 32UL );
269 3 : if( msg->is_simple_vote ) ok &= !!fd_pb_push_bool ( encoder, 10U, msg->is_simple_vote );
270 3 : if( msg->is_bundle ) ok &= !!fd_pb_push_bool ( encoder, 11U, msg->is_bundle );
271 3 : if( msg->is_committable ) ok &= !!fd_pb_push_bool ( encoder, 12U, msg->is_committable );
272 3 : if( msg->is_fees_only ) ok &= !!fd_pb_push_bool ( encoder, 13U, msg->is_fees_only );
273 3 : if( msg->txn_err ) ok &= !!fd_pb_push_int32 ( encoder, 14U, msg->txn_err );
274 3 : if( msg->exec_err ) ok &= !!fd_pb_push_int32 ( encoder, 15U, msg->exec_err );
275 3 : if( msg->exec_err_kind ) ok &= !!fd_pb_push_int32 ( encoder, 16U, msg->exec_err_kind );
276 3 : if( msg->exec_err_idx ) ok &= !!fd_pb_push_uint32( encoder, 17U, (uint)msg->exec_err_idx );
277 3 : if( msg->custom_err ) ok &= !!fd_pb_push_uint32( encoder, 18U, (uint)msg->custom_err );
278 3 : if( msg->compute_unit_limit ) ok &= !!fd_pb_push_uint64( encoder, 19U, (ulong)msg->compute_unit_limit );
279 3 : if( msg->compute_unit_price ) ok &= !!fd_pb_push_uint64( encoder, 20U, (ulong)msg->compute_unit_price );
280 3 : if( msg->compute_units_consumed ) ok &= !!fd_pb_push_uint64( encoder, 21U, (ulong)msg->compute_units_consumed );
281 3 : if( msg->heap_size ) ok &= !!fd_pb_push_uint64( encoder, 22U, (ulong)msg->heap_size );
282 3 : if( msg->num_builtin_instrs ) ok &= !!fd_pb_push_uint64( encoder, 23U, (ulong)msg->num_builtin_instrs );
283 3 : if( msg->num_non_builtin_instrs ) ok &= !!fd_pb_push_uint64( encoder, 24U, (ulong)msg->num_non_builtin_instrs );
284 3 : if( msg->loaded_accounts_data_size ) ok &= !!fd_pb_push_uint64( encoder, 25U, (ulong)msg->loaded_accounts_data_size );
285 3 : if( msg->loaded_accounts_data_size_limit ) ok &= !!fd_pb_push_uint64( encoder, 26U, (ulong)msg->loaded_accounts_data_size_limit );
286 3 : if( msg->accounts_resize_delta ) ok &= !!fd_pb_push_sint64( encoder, 27U, msg->accounts_resize_delta );
287 3 : if( msg->execution_fee ) ok &= !!fd_pb_push_uint64( encoder, 28U, (ulong)msg->execution_fee );
288 3 : if( msg->priority_fee ) ok &= !!fd_pb_push_uint64( encoder, 29U, (ulong)msg->priority_fee );
289 3 : if( msg->tips ) ok &= !!fd_pb_push_uint64( encoder, 30U, (ulong)msg->tips );
290 3 : if( msg->signature_count ) ok &= !!fd_pb_push_uint64( encoder, 31U, (ulong)msg->signature_count );
291 3 : if( msg->cost_signature ) ok &= !!fd_pb_push_uint32( encoder, 32U, (uint)msg->cost_signature );
292 3 : if( msg->cost_write_lock ) ok &= !!fd_pb_push_uint32( encoder, 33U, (uint)msg->cost_write_lock );
293 3 : if( msg->cost_data_bytes ) ok &= !!fd_pb_push_uint32( encoder, 34U, (uint)msg->cost_data_bytes );
294 3 : if( msg->cost_programs_execution ) ok &= !!fd_pb_push_uint32( encoder, 35U, (uint)msg->cost_programs_execution );
295 3 : if( msg->cost_loaded_accounts_data_size ) ok &= !!fd_pb_push_uint32( encoder, 36U, (uint)msg->cost_loaded_accounts_data_size );
296 3 : if( msg->cost_allocated_accounts_data_size ) ok &= !!fd_pb_push_uint64( encoder, 37U, (ulong)msg->cost_allocated_accounts_data_size );
297 195 : for( ulong k=0UL; k<msg->account_diffs_cnt; k++ ) {
298 192 : ok &= !!fd_pb_submsg_open( encoder, 38U );
299 192 : ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->account_diffs[ k ].pubkey, 32UL );
300 192 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->account_diffs[ k ].owner, 32UL );
301 192 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->account_diffs[ k ].prev_owner, 32UL );
302 192 : if( msg->account_diffs[ k ].lamports ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->account_diffs[ k ].lamports );
303 192 : if( msg->account_diffs[ k ].prev_lamports ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->account_diffs[ k ].prev_lamports );
304 192 : if( msg->account_diffs[ k ].data_sz ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->account_diffs[ k ].data_sz );
305 192 : if( msg->account_diffs[ k ].prev_data_sz ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->account_diffs[ k ].prev_data_sz );
306 192 : if( msg->account_diffs[ k ].is_executable ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->account_diffs[ k ].is_executable );
307 192 : if( msg->account_diffs[ k ].is_stake_update ) ok &= !!fd_pb_push_bool ( encoder, 9U, msg->account_diffs[ k ].is_stake_update );
308 192 : if( msg->account_diffs[ k ].is_vote_update ) ok &= !!fd_pb_push_bool ( encoder, 10U, msg->account_diffs[ k ].is_vote_update );
309 192 : if( msg->account_diffs[ k ].is_new_vote ) ok &= !!fd_pb_push_bool ( encoder, 11U, msg->account_diffs[ k ].is_new_vote );
310 192 : if( msg->account_diffs[ k ].is_rm_vote ) ok &= !!fd_pb_push_bool ( encoder, 12U, msg->account_diffs[ k ].is_rm_vote );
311 192 : ok &= !!fd_pb_submsg_close( encoder );
312 192 : }
313 195 : for( ulong k=0UL; k<msg->writable_accounts_cnt; k++ ) {
314 192 : ok &= !!fd_pb_push_bytes ( encoder, 39U, msg->writable_accounts[ k ], 32UL );
315 192 : }
316 195 : for( ulong k=0UL; k<msg->readonly_accounts_cnt; k++ ) {
317 192 : ok &= !!fd_pb_push_bytes ( encoder, 40U, msg->readonly_accounts[ k ], 32UL );
318 192 : }
319 195 : for( ulong k=0UL; k<msg->program_ids_cnt; k++ ) {
320 192 : ok &= !!fd_pb_push_bytes ( encoder, 41U, msg->program_ids[ k ], 32UL );
321 192 : }
322 3 : ok &= !!fd_pb_submsg_close( encoder );
323 3 : ok &= !!fd_pb_submsg_close( encoder );
324 3 : FD_TEST( ok );
325 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
326 3 : }
327 :
328 : void
329 : fd_event_block_completed_serialize( fd_circq_t * circq,
330 : fd_event_client_t * client,
331 : long timestamp_nanos,
332 : ulong link_seq,
333 3 : fd_event_block_completed_t const * msg ) {
334 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_BLOCK_COMPLETED_BUF_MAX );
335 3 : FD_TEST( buffer );
336 :
337 3 : ulong event_id = fd_event_client_id_reserve( client );
338 :
339 3 : fd_pb_encoder_t encoder[1];
340 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_BLOCK_COMPLETED_BUF_MAX );
341 :
342 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
343 : a FD_EVENT_BLOCK_COMPLETED_BUF_MAX that under-models the encoder aborts loudly instead
344 : of silently truncating fields off published rows. */
345 3 : int ok = 1;
346 :
347 3 : FD_TEST( circq->cursor_push_seq );
348 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
349 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
350 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
351 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
352 :
353 3 : FD_TEST( msg->txn_timing_cnt<=98039UL );
354 :
355 3 : uchar const * _dyn = (uchar const *)msg + FD_EVENT_BLOCK_COMPLETED_PREFIX_SZ;
356 3 : fd_event_block_completed_txn_timing_t const * txn_timing = (fd_event_block_completed_txn_timing_t const *)_dyn;
357 3 : _dyn += msg->txn_timing_cnt*sizeof(txn_timing[0]);
358 3 : ulong txn_timing_cnt = msg->txn_timing_cnt;
359 :
360 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
361 3 : ok &= !!fd_pb_submsg_open( encoder, 9U ); /* BlockCompleted */
362 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
363 3 : if( msg->bank_idx ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->bank_idx );
364 3 : if( msg->txncache_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 3U, (uint)msg->txncache_fork_id );
365 3 : if( msg->progcache_fork_id ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->progcache_fork_id );
366 3 : if( msg->accdb_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 5U, (uint)msg->accdb_fork_id );
367 3 : if( msg->vote_stakes_fork_id ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->vote_stakes_fork_id );
368 3 : if( msg->collector_overrides_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 7U, (uint)msg->collector_overrides_fork_id );
369 3 : if( msg->stake_rewards_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 8U, (uint)msg->stake_rewards_fork_id );
370 3 : if( msg->epoch_credits_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 9U, (uint)msg->epoch_credits_fork_id );
371 3 : if( msg->stake_delegations_fork_id ) ok &= !!fd_pb_push_uint32( encoder, 10U, (uint)msg->stake_delegations_fork_id );
372 3 : if( msg->cost_tracker_pool_idx ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->cost_tracker_pool_idx );
373 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->slot );
374 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->epoch );
375 3 : if( msg->parent_slot ) ok &= !!fd_pb_push_uint64( encoder, 14U, (ulong)msg->parent_slot );
376 3 : if( msg->root_slot ) ok &= !!fd_pb_push_uint64( encoder, 15U, (ulong)msg->root_slot );
377 3 : if( msg->storage_slot ) ok &= !!fd_pb_push_uint64( encoder, 16U, (ulong)msg->storage_slot );
378 3 : if( msg->turbine_slot ) ok &= !!fd_pb_push_uint64( encoder, 17U, (ulong)msg->turbine_slot );
379 3 : if( msg->caught_up ) ok &= !!fd_pb_push_bool ( encoder, 18U, msg->caught_up );
380 3 : if( msg->fork_width ) ok &= !!fd_pb_push_uint64( encoder, 19U, (ulong)msg->fork_width );
381 3 : if( msg->snapshot_in_progress ) ok &= !!fd_pb_push_bool ( encoder, 20U, msg->snapshot_in_progress );
382 3 : if( msg->live_bank_count ) ok &= !!fd_pb_push_uint64( encoder, 21U, (ulong)msg->live_bank_count );
383 3 : ok &= !!fd_pb_push_bytes ( encoder, 22U, msg->block_id, 32UL );
384 3 : ok &= !!fd_pb_push_bytes ( encoder, 23U, msg->parent_block_id, 32UL );
385 3 : ok &= !!fd_pb_push_bytes ( encoder, 24U, msg->bank_hash, 32UL );
386 3 : if( msg->dead ) ok &= !!fd_pb_push_bool ( encoder, 25U, msg->dead );
387 3 : if( msg->dead_reason ) ok &= !!fd_pb_push_int32 ( encoder, 26U, msg->dead_reason );
388 3 : if( msg->dead_time ) ok &= !!fd_pb_push_uint64( encoder, 27U, (ulong)msg->dead_time );
389 3 : if( msg->abandoned ) ok &= !!fd_pb_push_bool ( encoder, 28U, msg->abandoned );
390 3 : if( msg->abandoned_reason ) ok &= !!fd_pb_push_int32 ( encoder, 29U, msg->abandoned_reason );
391 3 : if( msg->abandoned_time ) ok &= !!fd_pb_push_uint64( encoder, 30U, (ulong)msg->abandoned_time );
392 3 : if( msg->is_leader ) ok &= !!fd_pb_push_bool ( encoder, 31U, msg->is_leader );
393 3 : if( msg->first_shred_received_time ) ok &= !!fd_pb_push_uint64( encoder, 32U, (ulong)msg->first_shred_received_time );
394 3 : if( msg->last_shred_received_time ) ok &= !!fd_pb_push_uint64( encoder, 33U, (ulong)msg->last_shred_received_time );
395 3 : if( msg->first_repair_request_time ) ok &= !!fd_pb_push_uint64( encoder, 34U, (ulong)msg->first_repair_request_time );
396 3 : if( msg->last_repair_received_time ) ok &= !!fd_pb_push_uint64( encoder, 35U, (ulong)msg->last_repair_received_time );
397 3 : if( msg->first_fec_set_received_time ) ok &= !!fd_pb_push_uint64( encoder, 36U, (ulong)msg->first_fec_set_received_time );
398 3 : if( msg->preparation_begin_time ) ok &= !!fd_pb_push_uint64( encoder, 37U, (ulong)msg->preparation_begin_time );
399 3 : if( msg->first_transaction_scheduled_time ) ok &= !!fd_pb_push_uint64( encoder, 38U, (ulong)msg->first_transaction_scheduled_time );
400 3 : if( msg->last_transaction_finished_time ) ok &= !!fd_pb_push_uint64( encoder, 39U, (ulong)msg->last_transaction_finished_time );
401 3 : if( msg->block_completed_time ) ok &= !!fd_pb_push_uint64( encoder, 40U, (ulong)msg->block_completed_time );
402 3 : if( msg->parent_block_completed_time ) ok &= !!fd_pb_push_uint64( encoder, 41U, (ulong)msg->parent_block_completed_time );
403 3 : if( msg->fec_set_count ) ok &= !!fd_pb_push_uint64( encoder, 42U, (ulong)msg->fec_set_count );
404 3 : if( msg->data_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 43U, (uint)msg->data_shred_count );
405 3 : if( msg->parity_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 44U, (uint)msg->parity_shred_count );
406 3 : if( msg->turbine_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 45U, (uint)msg->turbine_shred_count );
407 3 : if( msg->repair_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 46U, (uint)msg->repair_shred_count );
408 3 : if( msg->recovered_shred_count ) ok &= !!fd_pb_push_uint32( encoder, 47U, (uint)msg->recovered_shred_count );
409 3 : if( msg->chain_confirmed ) ok &= !!fd_pb_push_bool ( encoder, 48U, msg->chain_confirmed );
410 3 : if( msg->lowest_verified_fec_index ) ok &= !!fd_pb_push_uint32( encoder, 49U, (uint)msg->lowest_verified_fec_index );
411 3 : if( msg->last_completed_fec_set_index ) ok &= !!fd_pb_push_uint32( encoder, 50U, (uint)msg->last_completed_fec_set_index );
412 3 : if( msg->slot_complete_flag ) ok &= !!fd_pb_push_bool ( encoder, 51U, msg->slot_complete_flag );
413 3 : if( msg->equivocation_detected_shred ) ok &= !!fd_pb_push_bool ( encoder, 52U, msg->equivocation_detected_shred );
414 3 : if( msg->repair_requests_retransmitted ) ok &= !!fd_pb_push_uint32( encoder, 53U, (uint)msg->repair_requests_retransmitted );
415 3 : if( msg->repair_responses_received ) ok &= !!fd_pb_push_uint32( encoder, 54U, (uint)msg->repair_responses_received );
416 3 : if( msg->repair_request_window_count ) ok &= !!fd_pb_push_uint32( encoder, 55U, (uint)msg->repair_request_window_count );
417 3 : if( msg->repair_request_highest_window_count ) ok &= !!fd_pb_push_uint32( encoder, 56U, (uint)msg->repair_request_highest_window_count );
418 3 : if( msg->repair_request_orphan_count ) ok &= !!fd_pb_push_uint32( encoder, 57U, (uint)msg->repair_request_orphan_count );
419 3 : if( msg->repair_failed_chain_verify ) ok &= !!fd_pb_push_bool ( encoder, 58U, msg->repair_failed_chain_verify );
420 3 : if( msg->cost_tracker_block_cost ) ok &= !!fd_pb_push_uint64( encoder, 59U, (ulong)msg->cost_tracker_block_cost );
421 3 : if( msg->cost_tracker_allocated_accounts_data_size ) ok &= !!fd_pb_push_uint64( encoder, 60U, (ulong)msg->cost_tracker_allocated_accounts_data_size );
422 3 : if( msg->cost_tracker_block_cost_limit ) ok &= !!fd_pb_push_uint64( encoder, 61U, (ulong)msg->cost_tracker_block_cost_limit );
423 3 : if( msg->cost_tracker_vote_cost_limit ) ok &= !!fd_pb_push_uint64( encoder, 62U, (ulong)msg->cost_tracker_vote_cost_limit );
424 3 : if( msg->cost_tracker_account_cost_limit ) ok &= !!fd_pb_push_uint64( encoder, 63U, (ulong)msg->cost_tracker_account_cost_limit );
425 3 : if( msg->became_leader_time ) ok &= !!fd_pb_push_uint64( encoder, 64U, (ulong)msg->became_leader_time );
426 3 : if( msg->leader_slot_start_time ) ok &= !!fd_pb_push_uint64( encoder, 65U, (ulong)msg->leader_slot_start_time );
427 3 : if( msg->pack_start_time ) ok &= !!fd_pb_push_uint64( encoder, 66U, (ulong)msg->pack_start_time );
428 3 : if( msg->pack_end_time ) ok &= !!fd_pb_push_uint64( encoder, 67U, (ulong)msg->pack_end_time );
429 3 : if( msg->microblock_count ) ok &= !!fd_pb_push_uint64( encoder, 68U, (ulong)msg->microblock_count );
430 3 : if( msg->pack_block_cost ) ok &= !!fd_pb_push_uint64( encoder, 69U, (ulong)msg->pack_block_cost );
431 3 : if( msg->pack_vote_cost ) ok &= !!fd_pb_push_uint64( encoder, 70U, (ulong)msg->pack_vote_cost );
432 3 : if( msg->pack_data_bytes ) ok &= !!fd_pb_push_uint64( encoder, 71U, (ulong)msg->pack_data_bytes );
433 3 : if( msg->pack_end_reason ) ok &= !!fd_pb_push_int32 ( encoder, 72U, msg->pack_end_reason );
434 3 : if( msg->bundle_txn_count ) ok &= !!fd_pb_push_uint64( encoder, 73U, (ulong)msg->bundle_txn_count );
435 294120 : for( ulong k=0UL; k<txn_timing_cnt; k++ ) {
436 294117 : ok &= !!fd_pb_submsg_open( encoder, 74U );
437 294117 : if( txn_timing[ k ].received_time ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)txn_timing[ k ].received_time );
438 294117 : if( txn_timing[ k ].parsed_time ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)txn_timing[ k ].parsed_time );
439 294117 : if( txn_timing[ k ].dispatched_time ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)txn_timing[ k ].dispatched_time );
440 294117 : if( txn_timing[ k ].replayed_time ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)txn_timing[ k ].replayed_time );
441 294117 : if( txn_timing[ k ].sigverify_dispatched_time ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)txn_timing[ k ].sigverify_dispatched_time );
442 294117 : if( txn_timing[ k ].sigverify_done_time ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)txn_timing[ k ].sigverify_done_time );
443 294117 : if( txn_timing[ k ].poh_mixed_time ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)txn_timing[ k ].poh_mixed_time );
444 294117 : ok &= !!fd_pb_submsg_close( encoder );
445 294117 : }
446 3 : ok &= !!fd_pb_submsg_close( encoder );
447 3 : ok &= !!fd_pb_submsg_close( encoder );
448 3 : FD_TEST( ok );
449 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
450 3 : }
451 :
452 : void
453 : fd_event_snapshot_created_serialize( fd_circq_t * circq,
454 : fd_event_client_t * client,
455 : long timestamp_nanos,
456 : ulong link_seq,
457 3 : fd_event_snapshot_created_t const * msg ) {
458 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_SNAPSHOT_CREATED_BUF_MAX );
459 3 : FD_TEST( buffer );
460 :
461 3 : ulong event_id = fd_event_client_id_reserve( client );
462 :
463 3 : fd_pb_encoder_t encoder[1];
464 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_SNAPSHOT_CREATED_BUF_MAX );
465 :
466 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
467 : a FD_EVENT_SNAPSHOT_CREATED_BUF_MAX that under-models the encoder aborts loudly instead
468 : of silently truncating fields off published rows. */
469 3 : int ok = 1;
470 :
471 3 : FD_TEST( circq->cursor_push_seq );
472 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
473 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
474 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
475 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
476 :
477 3 : FD_TEST( msg->filename_len<=128UL );
478 3 : FD_TEST( msg->bank_accounts_lthash_len<=2048UL );
479 :
480 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
481 3 : ok &= !!fd_pb_submsg_open( encoder, 11U ); /* SnapshotCreated */
482 3 : if( msg->result ) ok &= !!fd_pb_push_int32 ( encoder, 1U, msg->result );
483 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
484 3 : if( msg->base_slot ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->base_slot );
485 3 : if( msg->filename_len ) ok &= !!fd_pb_push_bytes ( encoder, 4U, msg->filename, msg->filename_len );
486 3 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->hash, 32UL );
487 3 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->bank_hash, 32UL );
488 3 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->block_id, 32UL );
489 3 : if( msg->bank_accounts_lthash_len ) ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->bank_accounts_lthash, msg->bank_accounts_lthash_len );
490 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->epoch );
491 3 : if( msg->block_height ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->block_height );
492 3 : if( msg->capitalization ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->capitalization );
493 3 : if( msg->transaction_count ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->transaction_count );
494 3 : if( msg->account_count ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->account_count );
495 3 : if( msg->tombstone_count ) ok &= !!fd_pb_push_uint64( encoder, 14U, (ulong)msg->tombstone_count );
496 3 : if( msg->cached_accounts_count ) ok &= !!fd_pb_push_uint64( encoder, 15U, (ulong)msg->cached_accounts_count );
497 3 : if( msg->disk_accounts_count ) ok &= !!fd_pb_push_uint64( encoder, 16U, (ulong)msg->disk_accounts_count );
498 3 : if( msg->manifest_size ) ok &= !!fd_pb_push_uint64( encoder, 17U, (ulong)msg->manifest_size );
499 3 : if( msg->accounts_size ) ok &= !!fd_pb_push_uint64( encoder, 18U, (ulong)msg->accounts_size );
500 3 : if( msg->status_cache_size ) ok &= !!fd_pb_push_uint64( encoder, 19U, (ulong)msg->status_cache_size );
501 3 : if( msg->compressed_size ) ok &= !!fd_pb_push_uint64( encoder, 20U, (ulong)msg->compressed_size );
502 3 : if( msg->uncompressed_size ) ok &= !!fd_pb_push_uint64( encoder, 21U, (ulong)msg->uncompressed_size );
503 3 : if( msg->zstd_data_frame_count ) ok &= !!fd_pb_push_uint64( encoder, 22U, (ulong)msg->zstd_data_frame_count );
504 3 : if( msg->zstd_padding_size ) ok &= !!fd_pb_push_uint64( encoder, 23U, (ulong)msg->zstd_padding_size );
505 3 : if( msg->zstd_window_size ) ok &= !!fd_pb_push_uint64( encoder, 24U, (ulong)msg->zstd_window_size );
506 3 : if( msg->zstd_strategy ) ok &= !!fd_pb_push_int32 ( encoder, 25U, msg->zstd_strategy );
507 3 : if( msg->duration_compress_nanos ) ok &= !!fd_pb_push_uint64( encoder, 26U, (ulong)msg->duration_compress_nanos );
508 3 : if( msg->duration_io_blocked_nanos ) ok &= !!fd_pb_push_uint64( encoder, 27U, (ulong)msg->duration_io_blocked_nanos );
509 3 : if( msg->start_time ) ok &= !!fd_pb_push_uint64( encoder, 28U, (ulong)msg->start_time );
510 3 : if( msg->accounts_start_time ) ok &= !!fd_pb_push_uint64( encoder, 29U, (ulong)msg->accounts_start_time );
511 3 : if( msg->end_time ) ok &= !!fd_pb_push_uint64( encoder, 30U, (ulong)msg->end_time );
512 3 : ok &= !!fd_pb_submsg_close( encoder );
513 3 : ok &= !!fd_pb_submsg_close( encoder );
514 3 : FD_TEST( ok );
515 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
516 3 : }
517 :
518 : void
519 : fd_event_admin_command_serialize( fd_circq_t * circq,
520 : fd_event_client_t * client,
521 : long timestamp_nanos,
522 : ulong link_seq,
523 6 : fd_event_admin_command_t const * msg ) {
524 6 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_ADMIN_COMMAND_BUF_MAX );
525 6 : FD_TEST( buffer );
526 :
527 6 : ulong event_id = fd_event_client_id_reserve( client );
528 :
529 6 : fd_pb_encoder_t encoder[1];
530 6 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_ADMIN_COMMAND_BUF_MAX );
531 :
532 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
533 : a FD_EVENT_ADMIN_COMMAND_BUF_MAX that under-models the encoder aborts loudly instead
534 : of silently truncating fields off published rows. */
535 6 : int ok = 1;
536 :
537 6 : FD_TEST( circq->cursor_push_seq );
538 6 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
539 6 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
540 6 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
541 6 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
542 :
543 6 : FD_TEST( msg->custom_result_len<=64UL );
544 6 : FD_TEST( msg->args_json_len<=256UL );
545 :
546 6 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
547 6 : ok &= !!fd_pb_submsg_open( encoder, 12U ); /* AdminCommand */
548 6 : if( msg->type ) ok &= !!fd_pb_push_int32 ( encoder, 1U, msg->type );
549 6 : if( msg->result ) ok &= !!fd_pb_push_int32 ( encoder, 2U, msg->result );
550 6 : if( msg->custom_result_len ) ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->custom_result, msg->custom_result_len );
551 6 : if( msg->start_time ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->start_time );
552 6 : if( msg->end_time ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->end_time );
553 6 : if( msg->payload_version ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->payload_version );
554 6 : if( msg->has_payload_version ) ok &= !!fd_pb_push_bool ( encoder, 7U, msg->has_payload_version );
555 6 : if( msg->payload_size ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->payload_size );
556 6 : if( msg->args_json_len ) ok &= !!fd_pb_push_bytes ( encoder, 9U, msg->args_json, msg->args_json_len );
557 6 : ok &= !!fd_pb_submsg_close( encoder );
558 6 : ok &= !!fd_pb_submsg_close( encoder );
559 6 : FD_TEST( ok );
560 6 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
561 6 : }
562 :
563 : void
564 : fd_event_runtime_block_serialize( fd_circq_t * circq,
565 : fd_event_client_t * client,
566 : long timestamp_nanos,
567 : ulong link_seq,
568 3 : fd_event_runtime_block_t const * msg ) {
569 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_BLOCK_BUF_MAX );
570 3 : FD_TEST( buffer );
571 :
572 3 : ulong event_id = fd_event_client_id_reserve( client );
573 :
574 3 : fd_pb_encoder_t encoder[1];
575 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_BLOCK_BUF_MAX );
576 :
577 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
578 : a FD_EVENT_RUNTIME_BLOCK_BUF_MAX that under-models the encoder aborts loudly instead
579 : of silently truncating fields off published rows. */
580 3 : int ok = 1;
581 :
582 3 : FD_TEST( circq->cursor_push_seq );
583 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
584 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
585 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
586 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
587 :
588 3 : FD_TEST( msg->recent_blockhashes_cnt<=151UL );
589 3 : FD_TEST( msg->recent_blockhashes_sysvar_cnt<=150UL );
590 3 : FD_TEST( msg->sysvar_diffs_cnt<=16UL );
591 3 : FD_TEST( msg->other_diffs_cnt<=32UL );
592 3 : FD_TEST( msg->fec_merkle_roots_cnt<=1024UL );
593 :
594 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
595 3 : ok &= !!fd_pb_submsg_open( encoder, 13U ); /* RuntimeBlock */
596 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
597 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
598 3 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->block_id, 32UL );
599 3 : if( msg->parent_slot ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->parent_slot );
600 3 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->parent_block_id, 32UL );
601 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->epoch );
602 3 : if( msg->block_height ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->block_height );
603 3 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->leader, 32UL );
604 3 : ok &= !!fd_pb_push_bytes ( encoder, 9U, msg->bank_hash, 32UL );
605 3 : ok &= !!fd_pb_push_bytes ( encoder, 10U, msg->prev_bank_hash, 32UL );
606 3 : ok &= !!fd_pb_push_bytes ( encoder, 11U, msg->accounts_lt_hash_checksum, 32UL );
607 3 : ok &= !!fd_pb_push_bytes ( encoder, 12U, msg->poh_hash, 32UL );
608 3 : ok &= !!fd_pb_submsg_open( encoder, 13U );
609 3 : if( msg->clock_sysvar.slot ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->clock_sysvar.slot );
610 3 : if( msg->clock_sysvar.epoch_start_timestamp ) ok &= !!fd_pb_push_sint64( encoder, 2U, msg->clock_sysvar.epoch_start_timestamp );
611 3 : if( msg->clock_sysvar.epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->clock_sysvar.epoch );
612 3 : if( msg->clock_sysvar.leader_schedule_epoch ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->clock_sysvar.leader_schedule_epoch );
613 3 : if( msg->clock_sysvar.unix_timestamp ) ok &= !!fd_pb_push_sint64( encoder, 5U, msg->clock_sysvar.unix_timestamp );
614 3 : ok &= !!fd_pb_submsg_close( encoder );
615 456 : for( ulong k=0UL; k<msg->recent_blockhashes_cnt; k++ ) {
616 453 : ok &= !!fd_pb_push_bytes ( encoder, 14U, msg->recent_blockhashes[ k ], 32UL );
617 453 : }
618 453 : for( ulong k=0UL; k<msg->recent_blockhashes_sysvar_cnt; k++ ) {
619 450 : ok &= !!fd_pb_submsg_open( encoder, 15U );
620 450 : ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->recent_blockhashes_sysvar[ k ].blockhash, 32UL );
621 450 : 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 );
622 450 : ok &= !!fd_pb_submsg_close( encoder );
623 450 : }
624 3 : if( msg->last_restart_slot_sysvar ) ok &= !!fd_pb_push_uint64( encoder, 16U, (ulong)msg->last_restart_slot_sysvar );
625 3 : if( msg->num_transactions ) ok &= !!fd_pb_push_uint64( encoder, 17U, (ulong)msg->num_transactions );
626 3 : if( msg->num_failed_txns ) ok &= !!fd_pb_push_uint64( encoder, 18U, (ulong)msg->num_failed_txns );
627 3 : if( msg->num_nonvote_txns ) ok &= !!fd_pb_push_uint64( encoder, 19U, (ulong)msg->num_nonvote_txns );
628 3 : if( msg->num_nonvote_failed_txns ) ok &= !!fd_pb_push_uint64( encoder, 20U, (ulong)msg->num_nonvote_failed_txns );
629 3 : if( msg->num_signatures ) ok &= !!fd_pb_push_uint64( encoder, 21U, (ulong)msg->num_signatures );
630 3 : if( msg->num_shreds ) ok &= !!fd_pb_push_uint64( encoder, 22U, (ulong)msg->num_shreds );
631 3 : if( msg->tick_height ) ok &= !!fd_pb_push_uint64( encoder, 23U, (ulong)msg->tick_height );
632 3 : if( msg->execution_fees ) ok &= !!fd_pb_push_uint64( encoder, 24U, (ulong)msg->execution_fees );
633 3 : if( msg->priority_fees ) ok &= !!fd_pb_push_uint64( encoder, 25U, (ulong)msg->priority_fees );
634 3 : if( msg->tips ) ok &= !!fd_pb_push_uint64( encoder, 26U, (ulong)msg->tips );
635 3 : if( msg->fees_burned ) ok &= !!fd_pb_push_uint64( encoder, 27U, (ulong)msg->fees_burned );
636 3 : if( msg->leader_fee_reward ) ok &= !!fd_pb_push_uint64( encoder, 28U, (ulong)msg->leader_fee_reward );
637 3 : if( msg->capitalization ) ok &= !!fd_pb_push_uint64( encoder, 29U, (ulong)msg->capitalization );
638 3 : if( msg->total_effective_stake ) ok &= !!fd_pb_push_uint64( encoder, 30U, (ulong)msg->total_effective_stake );
639 3 : if( msg->total_activating_stake ) ok &= !!fd_pb_push_uint64( encoder, 31U, (ulong)msg->total_activating_stake );
640 3 : if( msg->total_deactivating_stake ) ok &= !!fd_pb_push_uint64( encoder, 32U, (ulong)msg->total_deactivating_stake );
641 3 : if( msg->total_epoch_stake ) ok &= !!fd_pb_push_uint64( encoder, 33U, (ulong)msg->total_epoch_stake );
642 51 : for( ulong k=0UL; k<msg->sysvar_diffs_cnt; k++ ) {
643 48 : ok &= !!fd_pb_submsg_open( encoder, 34U );
644 48 : ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->sysvar_diffs[ k ].pubkey, 32UL );
645 48 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->sysvar_diffs[ k ].owner, 32UL );
646 48 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->sysvar_diffs[ k ].prev_owner, 32UL );
647 48 : if( msg->sysvar_diffs[ k ].lamports ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->sysvar_diffs[ k ].lamports );
648 48 : if( msg->sysvar_diffs[ k ].prev_lamports ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->sysvar_diffs[ k ].prev_lamports );
649 48 : if( msg->sysvar_diffs[ k ].data_sz ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->sysvar_diffs[ k ].data_sz );
650 48 : if( msg->sysvar_diffs[ k ].prev_data_sz ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->sysvar_diffs[ k ].prev_data_sz );
651 48 : if( msg->sysvar_diffs[ k ].is_executable ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->sysvar_diffs[ k ].is_executable );
652 48 : ok &= !!fd_pb_submsg_close( encoder );
653 48 : }
654 99 : for( ulong k=0UL; k<msg->other_diffs_cnt; k++ ) {
655 96 : ok &= !!fd_pb_submsg_open( encoder, 35U );
656 96 : ok &= !!fd_pb_push_bytes ( encoder, 1U, msg->other_diffs[ k ].pubkey, 32UL );
657 96 : ok &= !!fd_pb_push_bytes ( encoder, 2U, msg->other_diffs[ k ].owner, 32UL );
658 96 : ok &= !!fd_pb_push_bytes ( encoder, 3U, msg->other_diffs[ k ].prev_owner, 32UL );
659 96 : if( msg->other_diffs[ k ].lamports ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->other_diffs[ k ].lamports );
660 96 : if( msg->other_diffs[ k ].prev_lamports ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->other_diffs[ k ].prev_lamports );
661 96 : if( msg->other_diffs[ k ].data_sz ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->other_diffs[ k ].data_sz );
662 96 : if( msg->other_diffs[ k ].prev_data_sz ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->other_diffs[ k ].prev_data_sz );
663 96 : if( msg->other_diffs[ k ].is_executable ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->other_diffs[ k ].is_executable );
664 96 : ok &= !!fd_pb_submsg_close( encoder );
665 96 : }
666 3 : if( msg->fec_count ) ok &= !!fd_pb_push_uint64( encoder, 36U, (ulong)msg->fec_count );
667 3075 : for( ulong k=0UL; k<msg->fec_merkle_roots_cnt; k++ ) {
668 3072 : ok &= !!fd_pb_push_bytes ( encoder, 37U, msg->fec_merkle_roots[ k ], 32UL );
669 3072 : }
670 3 : ok &= !!fd_pb_submsg_close( encoder );
671 3 : ok &= !!fd_pb_submsg_close( encoder );
672 3 : FD_TEST( ok );
673 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
674 3 : }
675 :
676 : void
677 : fd_event_runtime_reward_serialize( fd_circq_t * circq,
678 : fd_event_client_t * client,
679 : long timestamp_nanos,
680 : ulong link_seq,
681 3 : fd_event_runtime_reward_t const * msg ) {
682 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_REWARD_BUF_MAX );
683 3 : FD_TEST( buffer );
684 :
685 3 : ulong event_id = fd_event_client_id_reserve( client );
686 :
687 3 : fd_pb_encoder_t encoder[1];
688 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_REWARD_BUF_MAX );
689 :
690 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
691 : a FD_EVENT_RUNTIME_REWARD_BUF_MAX that under-models the encoder aborts loudly instead
692 : of silently truncating fields off published rows. */
693 3 : int ok = 1;
694 :
695 3 : FD_TEST( circq->cursor_push_seq );
696 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
697 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
698 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
699 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
700 :
701 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
702 3 : ok &= !!fd_pb_submsg_open( encoder, 14U ); /* RuntimeReward */
703 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
704 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
705 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->epoch );
706 3 : if( msg->kind ) ok &= !!fd_pb_push_int32 ( encoder, 4U, msg->kind );
707 3 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->pubkey, 32UL );
708 3 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->owner, 32UL );
709 3 : if( msg->prev_lamports ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->prev_lamports );
710 3 : if( msg->lamports ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->lamports );
711 3 : if( msg->partition_idx ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->partition_idx );
712 3 : if( msg->credits_observed ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->credits_observed );
713 3 : if( msg->stake ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->stake );
714 3 : ok &= !!fd_pb_submsg_close( encoder );
715 3 : ok &= !!fd_pb_submsg_close( encoder );
716 3 : FD_TEST( ok );
717 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
718 3 : }
719 :
720 : void
721 : fd_event_runtime_stake_delegation_serialize( fd_circq_t * circq,
722 : fd_event_client_t * client,
723 : long timestamp_nanos,
724 : ulong link_seq,
725 3 : fd_event_runtime_stake_delegation_t const * msg ) {
726 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_STAKE_DELEGATION_BUF_MAX );
727 3 : FD_TEST( buffer );
728 :
729 3 : ulong event_id = fd_event_client_id_reserve( client );
730 :
731 3 : fd_pb_encoder_t encoder[1];
732 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_STAKE_DELEGATION_BUF_MAX );
733 :
734 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
735 : a FD_EVENT_RUNTIME_STAKE_DELEGATION_BUF_MAX that under-models the encoder aborts loudly instead
736 : of silently truncating fields off published rows. */
737 3 : int ok = 1;
738 :
739 3 : FD_TEST( circq->cursor_push_seq );
740 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
741 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
742 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
743 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
744 :
745 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
746 3 : ok &= !!fd_pb_submsg_open( encoder, 15U ); /* RuntimeStakeDelegation */
747 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
748 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
749 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->epoch );
750 3 : if( msg->index_in_slot ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->index_in_slot );
751 3 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->signature, 64UL );
752 3 : if( msg->kind ) ok &= !!fd_pb_push_int32 ( encoder, 6U, msg->kind );
753 3 : ok &= !!fd_pb_push_bytes ( encoder, 7U, msg->stake_account, 32UL );
754 3 : ok &= !!fd_pb_push_bytes ( encoder, 8U, msg->vote_account, 32UL );
755 3 : if( msg->stake ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->stake );
756 3 : if( msg->activation_epoch ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->activation_epoch );
757 3 : if( msg->deactivation_epoch ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->deactivation_epoch );
758 3 : if( msg->credits_observed ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->credits_observed );
759 3 : ok &= !!fd_pb_submsg_close( encoder );
760 3 : ok &= !!fd_pb_submsg_close( encoder );
761 3 : FD_TEST( ok );
762 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
763 3 : }
764 :
765 : void
766 : fd_event_runtime_rooted_serialize( fd_circq_t * circq,
767 : fd_event_client_t * client,
768 : long timestamp_nanos,
769 : ulong link_seq,
770 3 : fd_event_runtime_rooted_t const * msg ) {
771 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_ROOTED_BUF_MAX );
772 3 : FD_TEST( buffer );
773 :
774 3 : ulong event_id = fd_event_client_id_reserve( client );
775 :
776 3 : fd_pb_encoder_t encoder[1];
777 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_ROOTED_BUF_MAX );
778 :
779 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
780 : a FD_EVENT_RUNTIME_ROOTED_BUF_MAX that under-models the encoder aborts loudly instead
781 : of silently truncating fields off published rows. */
782 3 : int ok = 1;
783 :
784 3 : FD_TEST( circq->cursor_push_seq );
785 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
786 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
787 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
788 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
789 :
790 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
791 3 : ok &= !!fd_pb_submsg_open( encoder, 16U ); /* RuntimeRooted */
792 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
793 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
794 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->epoch );
795 3 : if( msg->prev_root_slot ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->prev_root_slot );
796 3 : if( msg->stake_delegations_upserts ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->stake_delegations_upserts );
797 3 : if( msg->stake_delegations_removes ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->stake_delegations_removes );
798 3 : if( msg->stake_delegations_cnt ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->stake_delegations_cnt );
799 3 : if( msg->effective_stake ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->effective_stake );
800 3 : if( msg->activating_stake ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->activating_stake );
801 3 : if( msg->deactivating_stake ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->deactivating_stake );
802 3 : ok &= !!fd_pb_push_bytes ( encoder, 11U, msg->block_id, 32UL );
803 3 : ok &= !!fd_pb_submsg_close( encoder );
804 3 : ok &= !!fd_pb_submsg_close( encoder );
805 3 : FD_TEST( ok );
806 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
807 3 : }
808 :
809 : void
810 : fd_event_runtime_epoch_serialize( fd_circq_t * circq,
811 : fd_event_client_t * client,
812 : long timestamp_nanos,
813 : ulong link_seq,
814 3 : fd_event_runtime_epoch_t const * msg ) {
815 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_EPOCH_BUF_MAX );
816 3 : FD_TEST( buffer );
817 :
818 3 : ulong event_id = fd_event_client_id_reserve( client );
819 :
820 3 : fd_pb_encoder_t encoder[1];
821 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_EPOCH_BUF_MAX );
822 :
823 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
824 : a FD_EVENT_RUNTIME_EPOCH_BUF_MAX that under-models the encoder aborts loudly instead
825 : of silently truncating fields off published rows. */
826 3 : int ok = 1;
827 :
828 3 : FD_TEST( circq->cursor_push_seq );
829 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
830 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
831 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
832 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
833 :
834 3 : FD_TEST( msg->feature_activations_cnt<=16UL );
835 :
836 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
837 3 : ok &= !!fd_pb_submsg_open( encoder, 17U ); /* RuntimeEpoch */
838 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
839 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
840 3 : if( msg->parent_slot ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->parent_slot );
841 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->epoch );
842 3 : if( msg->total_effective_stake ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->total_effective_stake );
843 3 : if( msg->total_activating_stake ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->total_activating_stake );
844 3 : if( msg->total_deactivating_stake ) ok &= !!fd_pb_push_uint64( encoder, 7U, (ulong)msg->total_deactivating_stake );
845 3 : if( msg->total_epoch_stake ) ok &= !!fd_pb_push_uint64( encoder, 8U, (ulong)msg->total_epoch_stake );
846 3 : if( msg->num_staked_vote_accounts ) ok &= !!fd_pb_push_uint64( encoder, 9U, (ulong)msg->num_staked_vote_accounts );
847 3 : if( msg->num_vote_accounts ) ok &= !!fd_pb_push_uint64( encoder, 10U, (ulong)msg->num_vote_accounts );
848 3 : if( msg->num_top_votes_eligible ) ok &= !!fd_pb_push_uint64( encoder, 11U, (ulong)msg->num_top_votes_eligible );
849 3 : if( msg->top_votes_min_stake ) ok &= !!fd_pb_push_uint64( encoder, 12U, (ulong)msg->top_votes_min_stake );
850 3 : ok &= !!fd_pb_submsg_open( encoder, 13U );
851 3 : if( msg->stake_history_sysvar.epoch ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->stake_history_sysvar.epoch );
852 3 : if( msg->stake_history_sysvar.effective ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->stake_history_sysvar.effective );
853 3 : if( msg->stake_history_sysvar.activating ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->stake_history_sysvar.activating );
854 3 : if( msg->stake_history_sysvar.deactivating ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->stake_history_sysvar.deactivating );
855 3 : ok &= !!fd_pb_submsg_close( encoder );
856 3 : ok &= !!fd_pb_submsg_open( encoder, 14U );
857 3 : if( msg->epoch_schedule_sysvar.slots_per_epoch ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->epoch_schedule_sysvar.slots_per_epoch );
858 3 : 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 );
859 3 : if( msg->epoch_schedule_sysvar.warmup ) ok &= !!fd_pb_push_bool ( encoder, 3U, msg->epoch_schedule_sysvar.warmup );
860 3 : if( msg->epoch_schedule_sysvar.first_normal_epoch ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->epoch_schedule_sysvar.first_normal_epoch );
861 3 : if( msg->epoch_schedule_sysvar.first_normal_slot ) ok &= !!fd_pb_push_uint64( encoder, 5U, (ulong)msg->epoch_schedule_sysvar.first_normal_slot );
862 3 : ok &= !!fd_pb_submsg_close( encoder );
863 51 : for( ulong k=0UL; k<msg->feature_activations_cnt; k++ ) {
864 48 : ok &= !!fd_pb_push_bytes ( encoder, 15U, msg->feature_activations[ k ], 32UL );
865 48 : }
866 3 : ok &= !!fd_pb_submsg_open( encoder, 16U );
867 3 : if( msg->epoch_rewards_sysvar.total_rewards ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->epoch_rewards_sysvar.total_rewards );
868 3 : if( msg->epoch_rewards_sysvar.distributed ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->epoch_rewards_sysvar.distributed );
869 3 : 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 );
870 3 : if( msg->epoch_rewards_sysvar.num_partitions ) ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)msg->epoch_rewards_sysvar.num_partitions );
871 3 : if( msg->epoch_rewards_sysvar.total_points ) ok &= !!fd_pb_push_bytes ( encoder, 5U, (uchar const *)&msg->epoch_rewards_sysvar.total_points, 16UL );
872 3 : ok &= !!fd_pb_push_bytes ( encoder, 6U, msg->epoch_rewards_sysvar.parent_blockhash, 32UL );
873 3 : ok &= !!fd_pb_submsg_close( encoder );
874 3 : if( msg->vat_burn_per_vote_account ) ok &= !!fd_pb_push_uint64( encoder, 17U, (ulong)msg->vat_burn_per_vote_account );
875 3 : ok &= !!fd_pb_submsg_close( encoder );
876 3 : ok &= !!fd_pb_submsg_close( encoder );
877 3 : FD_TEST( ok );
878 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
879 3 : }
880 :
881 : void
882 : fd_event_runtime_vote_account_serialize( fd_circq_t * circq,
883 : fd_event_client_t * client,
884 : long timestamp_nanos,
885 : ulong link_seq,
886 3 : fd_event_runtime_vote_account_t const * msg ) {
887 3 : uchar * buffer = fd_circq_push_back( circq, 1UL, FD_EVENT_RUNTIME_VOTE_ACCOUNT_BUF_MAX );
888 3 : FD_TEST( buffer );
889 :
890 3 : ulong event_id = fd_event_client_id_reserve( client );
891 :
892 3 : fd_pb_encoder_t encoder[1];
893 3 : fd_pb_encoder_init( encoder, buffer, FD_EVENT_RUNTIME_VOTE_ACCOUNT_BUF_MAX );
894 :
895 : /* Pushes fail (returning NULL) rather than overflow; accumulate so
896 : a FD_EVENT_RUNTIME_VOTE_ACCOUNT_BUF_MAX that under-models the encoder aborts loudly instead
897 : of silently truncating fields off published rows. */
898 3 : int ok = 1;
899 :
900 3 : FD_TEST( circq->cursor_push_seq );
901 3 : ok &= !!fd_pb_push_uint64( encoder, 1U, circq->cursor_push_seq-1UL );
902 3 : ok &= !!fd_pb_push_uint64( encoder, 2U, event_id );
903 3 : ok &= !!fd_pb_push_uint64( encoder, 3U, link_seq );
904 3 : ok &= !!fd_pb_push_uint64( encoder, 4U, (ulong)timestamp_nanos );
905 :
906 3 : ok &= !!fd_pb_submsg_open( encoder, 5U ); /* Event */
907 3 : ok &= !!fd_pb_submsg_open( encoder, 18U ); /* RuntimeVoteAccount */
908 3 : if( msg->bank_seq ) ok &= !!fd_pb_push_uint64( encoder, 1U, (ulong)msg->bank_seq );
909 3 : if( msg->slot ) ok &= !!fd_pb_push_uint64( encoder, 2U, (ulong)msg->slot );
910 3 : if( msg->epoch ) ok &= !!fd_pb_push_uint64( encoder, 3U, (ulong)msg->epoch );
911 3 : ok &= !!fd_pb_push_bytes ( encoder, 4U, msg->pubkey, 32UL );
912 3 : ok &= !!fd_pb_push_bytes ( encoder, 5U, msg->node_account, 32UL );
913 3 : if( msg->stake ) ok &= !!fd_pb_push_uint64( encoder, 6U, (ulong)msg->stake );
914 3 : if( msg->commission_bps ) ok &= !!fd_pb_push_uint32( encoder, 7U, (uint)msg->commission_bps );
915 3 : if( msg->has_commission_t_2 ) ok &= !!fd_pb_push_bool ( encoder, 8U, msg->has_commission_t_2 );
916 3 : if( msg->commission_t_2_bps ) ok &= !!fd_pb_push_uint32( encoder, 9U, (uint)msg->commission_t_2_bps );
917 3 : if( msg->has_commission_t_3 ) ok &= !!fd_pb_push_bool ( encoder, 10U, msg->has_commission_t_3 );
918 3 : if( msg->commission_t_3_bps ) ok &= !!fd_pb_push_uint32( encoder, 11U, (uint)msg->commission_t_3_bps );
919 3 : if( msg->reward_commission_bps ) ok &= !!fd_pb_push_uint32( encoder, 12U, (uint)msg->reward_commission_bps );
920 3 : if( msg->credits ) ok &= !!fd_pb_push_uint64( encoder, 13U, (ulong)msg->credits );
921 3 : if( msg->prev_credits ) ok &= !!fd_pb_push_uint64( encoder, 14U, (ulong)msg->prev_credits );
922 3 : if( msg->epoch_credits_cnt ) ok &= !!fd_pb_push_uint64( encoder, 15U, (ulong)msg->epoch_credits_cnt );
923 3 : ok &= !!fd_pb_submsg_close( encoder );
924 3 : ok &= !!fd_pb_submsg_close( encoder );
925 3 : FD_TEST( ok );
926 3 : fd_circq_resize_back( circq, fd_pb_encoder_out_sz( encoder ) );
927 3 : }
928 :
929 : void
930 : fd_event_serialize_by_type( ulong type,
931 : fd_circq_t * circq,
932 : fd_event_client_t * client,
933 : long timestamp_nanos,
934 : ulong link_seq,
935 : void const * ev,
936 45 : ulong ev_sz ) {
937 45 : switch( type ) {
938 3 : case 3UL:
939 3 : FD_TEST( ev_sz==sizeof(fd_event_signed_vote_t) );
940 3 : fd_event_signed_vote_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_signed_vote_t const *)ev );
941 3 : break;
942 3 : case 4UL:
943 3 : FD_TEST( ev_sz==sizeof(fd_event_slot_confirmed_t) );
944 3 : fd_event_slot_confirmed_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_slot_confirmed_t const *)ev );
945 3 : break;
946 3 : case 5UL:
947 3 : FD_TEST( ev_sz==sizeof(fd_event_accdb_compaction_completed_t) );
948 3 : fd_event_accdb_compaction_completed_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_accdb_compaction_completed_t const *)ev );
949 3 : break;
950 3 : case 6UL:
951 3 : FD_TEST( ev_sz==sizeof(fd_event_accdb_partition_added_t) );
952 3 : fd_event_accdb_partition_added_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_accdb_partition_added_t const *)ev );
953 3 : break;
954 3 : case 7UL:
955 3 : FD_TEST( ev_sz==sizeof(fd_event_block_equivocated_t) );
956 3 : fd_event_block_equivocated_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_block_equivocated_t const *)ev );
957 3 : break;
958 3 : case 8UL:
959 3 : FD_TEST( ev_sz==sizeof(fd_event_runtime_txn_t) );
960 3 : fd_event_runtime_txn_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_txn_t const *)ev );
961 3 : break;
962 3 : case 9UL: {
963 3 : FD_TEST( ev_sz>=FD_EVENT_BLOCK_COMPLETED_PREFIX_SZ );
964 3 : fd_event_block_completed_t const * msg = (fd_event_block_completed_t const *)ev;
965 3 : FD_TEST( msg->txn_timing_cnt<=98039UL );
966 3 : FD_TEST( ev_sz==fd_event_block_completed_footprint( msg ) );
967 3 : fd_event_block_completed_serialize( circq, client, timestamp_nanos, link_seq, msg );
968 3 : break;
969 3 : }
970 3 : case 11UL:
971 3 : FD_TEST( ev_sz==sizeof(fd_event_snapshot_created_t) );
972 3 : fd_event_snapshot_created_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_snapshot_created_t const *)ev );
973 3 : break;
974 3 : case 12UL:
975 3 : FD_TEST( ev_sz==sizeof(fd_event_admin_command_t) );
976 3 : fd_event_admin_command_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_admin_command_t const *)ev );
977 3 : break;
978 3 : case 13UL:
979 3 : FD_TEST( ev_sz==sizeof(fd_event_runtime_block_t) );
980 3 : fd_event_runtime_block_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_block_t const *)ev );
981 3 : break;
982 3 : case 14UL:
983 3 : FD_TEST( ev_sz==sizeof(fd_event_runtime_reward_t) );
984 3 : fd_event_runtime_reward_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_reward_t const *)ev );
985 3 : break;
986 3 : case 15UL:
987 3 : FD_TEST( ev_sz==sizeof(fd_event_runtime_stake_delegation_t) );
988 3 : fd_event_runtime_stake_delegation_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_stake_delegation_t const *)ev );
989 3 : break;
990 3 : case 16UL:
991 3 : FD_TEST( ev_sz==sizeof(fd_event_runtime_rooted_t) );
992 3 : fd_event_runtime_rooted_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_rooted_t const *)ev );
993 3 : break;
994 3 : case 17UL:
995 3 : FD_TEST( ev_sz==sizeof(fd_event_runtime_epoch_t) );
996 3 : fd_event_runtime_epoch_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_epoch_t const *)ev );
997 3 : break;
998 3 : case 18UL:
999 3 : FD_TEST( ev_sz==sizeof(fd_event_runtime_vote_account_t) );
1000 3 : fd_event_runtime_vote_account_serialize( circq, client, timestamp_nanos, link_seq, (fd_event_runtime_vote_account_t const *)ev );
1001 3 : break;
1002 0 : default: FD_LOG_ERR(( "unexpected event type %lu", type ));
1003 45 : }
1004 45 : }
|