Line data Source code
1 : // This is an auto-generated file. To add entries, edit fd_types.json
2 : #include "fd_types.h"
3 : #pragma GCC diagnostic ignored "-Wunused-parameter"
4 : #pragma GCC diagnostic ignored "-Wunused-variable"
5 : #define SOURCE_fd_src_flamenco_types_fd_types_c
6 : #include "fd_types_custom.c"
7 0 : int fd_hash_decode( fd_hash_t * self, fd_bincode_decode_ctx_t * ctx ) {
8 0 : void const * data = ctx->data;
9 0 : int err = fd_hash_decode_preflight( ctx );
10 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11 0 : ctx->data = data;
12 0 : fd_hash_new( self );
13 0 : fd_hash_decode_unsafe( self, ctx );
14 0 : return FD_BINCODE_SUCCESS;
15 0 : }
16 70965 : int fd_hash_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
17 70965 : return fd_bincode_bytes_decode_preflight( sizeof(fd_hash_t), ctx );
18 70965 : }
19 3727317 : void fd_hash_decode_unsafe( fd_hash_t * self, fd_bincode_decode_ctx_t * ctx ) {
20 3727317 : fd_bincode_bytes_decode_unsafe( (uchar*)self, sizeof(fd_hash_t), ctx );
21 3727317 : }
22 7923447 : void fd_hash_new( fd_hash_t * self ) { }
23 9722832 : void fd_hash_destroy( fd_hash_t * self, fd_bincode_destroy_ctx_t * ctx ) { }
24 0 : ulong fd_hash_footprint( void ) { return sizeof(fd_hash_t); }
25 0 : ulong fd_hash_align( void ) { return alignof(fd_hash_t); }
26 74718453 : ulong fd_hash_size( fd_hash_t const * self ) { (void)self; return sizeof(fd_hash_t); }
27 74718225 : int fd_hash_encode( fd_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28 74718225 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_hash_t), ctx );
29 74718225 : }
30 156 : void fd_hash_walk( void * w, fd_hash_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31 156 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_HASH256, name, level );
32 156 : }
33 :
34 0 : int fd_signature_decode( fd_signature_t * self, fd_bincode_decode_ctx_t * ctx ) {
35 0 : void const * data = ctx->data;
36 0 : int err = fd_signature_decode_preflight( ctx );
37 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
38 0 : ctx->data = data;
39 0 : fd_signature_new( self );
40 0 : fd_signature_decode_unsafe( self, ctx );
41 0 : return FD_BINCODE_SUCCESS;
42 0 : }
43 30 : int fd_signature_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
44 30 : return fd_bincode_bytes_decode_preflight( sizeof(fd_signature_t), ctx );
45 30 : }
46 30 : void fd_signature_decode_unsafe( fd_signature_t * self, fd_bincode_decode_ctx_t * ctx ) {
47 30 : fd_bincode_bytes_decode_unsafe( (uchar*)self, sizeof(fd_signature_t), ctx );
48 30 : }
49 27 : void fd_signature_new( fd_signature_t * self ) { }
50 0 : void fd_signature_destroy( fd_signature_t * self, fd_bincode_destroy_ctx_t * ctx ) { }
51 0 : ulong fd_signature_footprint( void ) { return sizeof(fd_signature_t); }
52 0 : ulong fd_signature_align( void ) { return alignof(fd_signature_t); }
53 0 : ulong fd_signature_size( fd_signature_t const * self ) { (void)self; return sizeof(fd_signature_t); }
54 0 : int fd_signature_encode( fd_signature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
55 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_signature_t), ctx );
56 0 : }
57 30 : void fd_signature_walk( void * w, fd_signature_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
58 30 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_SIG512, name, level );
59 30 : }
60 :
61 0 : int fd_gossip_ip4_addr_decode( fd_gossip_ip4_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
62 0 : void const * data = ctx->data;
63 0 : int err = fd_gossip_ip4_addr_decode_preflight( ctx );
64 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
65 0 : ctx->data = data;
66 0 : fd_gossip_ip4_addr_new( self );
67 0 : fd_gossip_ip4_addr_decode_unsafe( self, ctx );
68 0 : return FD_BINCODE_SUCCESS;
69 0 : }
70 93 : int fd_gossip_ip4_addr_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
71 93 : return fd_bincode_bytes_decode_preflight( sizeof(fd_gossip_ip4_addr_t), ctx );
72 93 : }
73 93 : void fd_gossip_ip4_addr_decode_unsafe( fd_gossip_ip4_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
74 93 : fd_bincode_bytes_decode_unsafe( (uchar*)self, sizeof(fd_gossip_ip4_addr_t), ctx );
75 93 : }
76 0 : void fd_gossip_ip4_addr_new( fd_gossip_ip4_addr_t * self ) { }
77 0 : void fd_gossip_ip4_addr_destroy( fd_gossip_ip4_addr_t * self, fd_bincode_destroy_ctx_t * ctx ) { }
78 0 : ulong fd_gossip_ip4_addr_footprint( void ) { return sizeof(fd_gossip_ip4_addr_t); }
79 0 : ulong fd_gossip_ip4_addr_align( void ) { return alignof(fd_gossip_ip4_addr_t); }
80 0 : ulong fd_gossip_ip4_addr_size( fd_gossip_ip4_addr_t const * self ) { (void)self; return sizeof(fd_gossip_ip4_addr_t); }
81 0 : int fd_gossip_ip4_addr_encode( fd_gossip_ip4_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
82 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_gossip_ip4_addr_t), ctx );
83 0 : }
84 :
85 0 : int fd_gossip_ip6_addr_decode( fd_gossip_ip6_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
86 0 : void const * data = ctx->data;
87 0 : int err = fd_gossip_ip6_addr_decode_preflight( ctx );
88 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
89 0 : ctx->data = data;
90 0 : fd_gossip_ip6_addr_new( self );
91 0 : fd_gossip_ip6_addr_decode_unsafe( self, ctx );
92 0 : return FD_BINCODE_SUCCESS;
93 0 : }
94 0 : int fd_gossip_ip6_addr_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
95 0 : return fd_bincode_bytes_decode_preflight( sizeof(fd_gossip_ip6_addr_t), ctx );
96 0 : }
97 0 : void fd_gossip_ip6_addr_decode_unsafe( fd_gossip_ip6_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
98 0 : fd_bincode_bytes_decode_unsafe( (uchar*)self, sizeof(fd_gossip_ip6_addr_t), ctx );
99 0 : }
100 0 : void fd_gossip_ip6_addr_new( fd_gossip_ip6_addr_t * self ) { }
101 0 : void fd_gossip_ip6_addr_destroy( fd_gossip_ip6_addr_t * self, fd_bincode_destroy_ctx_t * ctx ) { }
102 0 : ulong fd_gossip_ip6_addr_footprint( void ) { return sizeof(fd_gossip_ip6_addr_t); }
103 0 : ulong fd_gossip_ip6_addr_align( void ) { return alignof(fd_gossip_ip6_addr_t); }
104 0 : ulong fd_gossip_ip6_addr_size( fd_gossip_ip6_addr_t const * self ) { (void)self; return sizeof(fd_gossip_ip6_addr_t); }
105 0 : int fd_gossip_ip6_addr_encode( fd_gossip_ip6_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
106 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_gossip_ip6_addr_t), ctx );
107 0 : }
108 :
109 0 : int fd_feature_decode( fd_feature_t * self, fd_bincode_decode_ctx_t * ctx ) {
110 0 : void const * data = ctx->data;
111 0 : int err = fd_feature_decode_preflight( ctx );
112 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
113 0 : ctx->data = data;
114 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
115 0 : fd_feature_new( self );
116 0 : }
117 0 : fd_feature_decode_unsafe( self, ctx );
118 0 : return FD_BINCODE_SUCCESS;
119 0 : }
120 0 : int fd_feature_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
121 0 : int err;
122 0 : {
123 0 : uchar o;
124 0 : err = fd_bincode_bool_decode( &o, ctx );
125 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
126 0 : if( o ) {
127 0 : err = fd_bincode_uint64_decode_preflight( ctx );
128 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
129 0 : }
130 0 : }
131 0 : return FD_BINCODE_SUCCESS;
132 0 : }
133 0 : void fd_feature_decode_unsafe( fd_feature_t * self, fd_bincode_decode_ctx_t * ctx ) {
134 0 : {
135 0 : uchar o;
136 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
137 0 : self->has_activated_at = !!o;
138 0 : if( o ) {
139 0 : fd_bincode_uint64_decode_unsafe( &self->activated_at, ctx );
140 0 : }
141 0 : }
142 0 : }
143 0 : int fd_feature_encode( fd_feature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
144 0 : int err;
145 0 : err = fd_bincode_bool_encode( self->has_activated_at, ctx );
146 0 : if( FD_UNLIKELY( err ) ) return err;
147 0 : if( self->has_activated_at ) {
148 0 : err = fd_bincode_uint64_encode( self->activated_at, ctx );
149 0 : if( FD_UNLIKELY( err ) ) return err;
150 0 : }
151 0 : return FD_BINCODE_SUCCESS;
152 0 : }
153 0 : int fd_feature_decode_offsets( fd_feature_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
154 0 : uchar const * data = ctx->data;
155 0 : int err;
156 0 : self->activated_at_off = (uint)( (ulong)ctx->data - (ulong)data );
157 0 : {
158 0 : uchar o;
159 0 : err = fd_bincode_bool_decode( &o, ctx );
160 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
161 0 : if( o ) {
162 0 : err = fd_bincode_uint64_decode_preflight( ctx );
163 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
164 0 : }
165 0 : }
166 0 : return FD_BINCODE_SUCCESS;
167 0 : }
168 0 : void fd_feature_new(fd_feature_t * self) {
169 0 : fd_memset( self, 0, sizeof(fd_feature_t) );
170 0 : }
171 0 : void fd_feature_destroy( fd_feature_t * self, fd_bincode_destroy_ctx_t * ctx ) {
172 0 : if( self->has_activated_at ) {
173 0 : self->has_activated_at = 0;
174 0 : }
175 0 : }
176 :
177 0 : ulong fd_feature_footprint( void ){ return FD_FEATURE_FOOTPRINT; }
178 0 : ulong fd_feature_align( void ){ return FD_FEATURE_ALIGN; }
179 :
180 0 : void fd_feature_walk( void * w, fd_feature_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
181 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature", level++ );
182 0 : if( !self->has_activated_at ) {
183 0 : fun( w, NULL, "activated_at", FD_FLAMENCO_TYPE_NULL, "ulong", level );
184 0 : } else {
185 0 : fun( w, &self->activated_at, "activated_at", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
186 0 : }
187 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature", level-- );
188 0 : }
189 0 : ulong fd_feature_size( fd_feature_t const * self ) {
190 0 : ulong size = 0;
191 0 : size += sizeof(char);
192 0 : if( self->has_activated_at ) {
193 0 : size += sizeof(ulong);
194 0 : }
195 0 : return size;
196 0 : }
197 :
198 0 : int fd_fee_calculator_decode( fd_fee_calculator_t * self, fd_bincode_decode_ctx_t * ctx ) {
199 0 : void const * data = ctx->data;
200 0 : int err = fd_fee_calculator_decode_preflight( ctx );
201 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
202 0 : ctx->data = data;
203 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
204 0 : fd_fee_calculator_new( self );
205 0 : }
206 0 : fd_fee_calculator_decode_unsafe( self, ctx );
207 0 : return FD_BINCODE_SUCCESS;
208 0 : }
209 6 : int fd_fee_calculator_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
210 6 : return fd_bincode_bytes_decode_preflight( 8, ctx );
211 6 : }
212 1191210 : void fd_fee_calculator_decode_unsafe( fd_fee_calculator_t * self, fd_bincode_decode_ctx_t * ctx ) {
213 1191210 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
214 1191210 : }
215 74657928 : int fd_fee_calculator_encode( fd_fee_calculator_t const * self, fd_bincode_encode_ctx_t * ctx ) {
216 74657928 : int err;
217 74657928 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
218 74657928 : if( FD_UNLIKELY( err ) ) return err;
219 74657928 : return FD_BINCODE_SUCCESS;
220 74657928 : }
221 : enum {
222 : fd_fee_calculator_lamports_per_signature_TAG = (0 << 6) | FD_ARCHIVE_META_ULONG,
223 : };
224 0 : int fd_fee_calculator_decode_archival( fd_fee_calculator_t * self, fd_bincode_decode_ctx_t * ctx ) {
225 0 : void const * data = ctx->data;
226 0 : int err = fd_fee_calculator_decode_archival_preflight( ctx );
227 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
228 0 : ctx->data = data;
229 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
230 0 : fd_fee_calculator_new( self );
231 0 : }
232 0 : fd_fee_calculator_decode_archival_unsafe( self, ctx );
233 0 : return FD_BINCODE_SUCCESS;
234 0 : }
235 0 : int fd_fee_calculator_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
236 0 : int err;
237 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
238 0 : void * offset = NULL;
239 0 : for(;;) {
240 0 : err = fd_bincode_uint16_decode( &tag, ctx );
241 0 : if( FD_UNLIKELY( err ) ) return err;
242 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
243 0 : switch( tag ) {
244 0 : case (ushort)fd_fee_calculator_lamports_per_signature_TAG: {
245 0 : err = fd_bincode_uint64_decode_preflight( ctx );
246 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
247 0 : break;
248 0 : }
249 0 : default:
250 0 : err = fd_archive_decode_skip_field( ctx, tag );
251 0 : if( FD_UNLIKELY( err ) ) return err;
252 0 : break;
253 0 : }
254 0 : }
255 0 : return FD_BINCODE_SUCCESS;
256 0 : }
257 0 : void fd_fee_calculator_decode_archival_unsafe( fd_fee_calculator_t * self, fd_bincode_decode_ctx_t * ctx ) {
258 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
259 0 : void * offset = NULL;
260 0 : for(;;) {
261 0 : fd_bincode_uint16_decode( &tag, ctx );
262 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
263 0 : switch( tag ) {
264 0 : case (ushort)fd_fee_calculator_lamports_per_signature_TAG: {
265 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
266 0 : break;
267 0 : }
268 0 : default:
269 0 : fd_archive_decode_skip_field( ctx, tag );
270 0 : break;
271 0 : }
272 0 : }
273 0 : }
274 0 : int fd_fee_calculator_encode_archival( fd_fee_calculator_t const * self, fd_bincode_encode_ctx_t * ctx ) {
275 0 : int err;
276 0 : void * offset = NULL;
277 0 : err = fd_bincode_uint16_encode( (ushort)fd_fee_calculator_lamports_per_signature_TAG, ctx );
278 0 : if( FD_UNLIKELY( err ) ) return err;
279 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
280 0 : if( FD_UNLIKELY( err ) ) return err;
281 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
282 0 : if( FD_UNLIKELY( err ) ) return err;
283 0 : return FD_BINCODE_SUCCESS;
284 0 : }
285 0 : int fd_fee_calculator_decode_offsets( fd_fee_calculator_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
286 0 : uchar const * data = ctx->data;
287 0 : int err;
288 0 : self->lamports_per_signature_off = (uint)( (ulong)ctx->data - (ulong)data );
289 0 : err = fd_bincode_uint64_decode_preflight( ctx );
290 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
291 0 : return FD_BINCODE_SUCCESS;
292 0 : }
293 2060100 : void fd_fee_calculator_new(fd_fee_calculator_t * self) {
294 2060100 : fd_memset( self, 0, sizeof(fd_fee_calculator_t) );
295 2060100 : }
296 4220766 : void fd_fee_calculator_destroy( fd_fee_calculator_t * self, fd_bincode_destroy_ctx_t * ctx ) {
297 4220766 : }
298 :
299 0 : ulong fd_fee_calculator_footprint( void ){ return FD_FEE_CALCULATOR_FOOTPRINT; }
300 0 : ulong fd_fee_calculator_align( void ){ return FD_FEE_CALCULATOR_ALIGN; }
301 :
302 0 : void fd_fee_calculator_walk( void * w, fd_fee_calculator_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
303 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_calculator", level++ );
304 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
305 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_calculator", level-- );
306 0 : }
307 74657937 : ulong fd_fee_calculator_size( fd_fee_calculator_t const * self ) {
308 74657937 : ulong size = 0;
309 74657937 : size += sizeof(ulong);
310 74657937 : return size;
311 74657937 : }
312 :
313 0 : int fd_hash_age_decode( fd_hash_age_t * self, fd_bincode_decode_ctx_t * ctx ) {
314 0 : void const * data = ctx->data;
315 0 : int err = fd_hash_age_decode_preflight( ctx );
316 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
317 0 : ctx->data = data;
318 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
319 0 : fd_hash_age_new( self );
320 0 : }
321 0 : fd_hash_age_decode_unsafe( self, ctx );
322 0 : return FD_BINCODE_SUCCESS;
323 0 : }
324 0 : int fd_hash_age_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
325 0 : return fd_bincode_bytes_decode_preflight( 24, ctx );
326 0 : }
327 0 : void fd_hash_age_decode_unsafe( fd_hash_age_t * self, fd_bincode_decode_ctx_t * ctx ) {
328 0 : fd_fee_calculator_decode_unsafe( &self->fee_calculator, ctx );
329 0 : fd_bincode_uint64_decode_unsafe( &self->hash_index, ctx );
330 0 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
331 0 : }
332 0 : int fd_hash_age_encode( fd_hash_age_t const * self, fd_bincode_encode_ctx_t * ctx ) {
333 0 : int err;
334 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
335 0 : if( FD_UNLIKELY( err ) ) return err;
336 0 : err = fd_bincode_uint64_encode( self->hash_index, ctx );
337 0 : if( FD_UNLIKELY( err ) ) return err;
338 0 : err = fd_bincode_uint64_encode( self->timestamp, ctx );
339 0 : if( FD_UNLIKELY( err ) ) return err;
340 0 : return FD_BINCODE_SUCCESS;
341 0 : }
342 : enum {
343 : fd_hash_age_fee_calculator_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
344 : fd_hash_age_hash_index_TAG = (1 << 6) | FD_ARCHIVE_META_ULONG,
345 : fd_hash_age_timestamp_TAG = (2 << 6) | FD_ARCHIVE_META_ULONG,
346 : };
347 0 : int fd_hash_age_decode_archival( fd_hash_age_t * self, fd_bincode_decode_ctx_t * ctx ) {
348 0 : void const * data = ctx->data;
349 0 : int err = fd_hash_age_decode_archival_preflight( ctx );
350 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
351 0 : ctx->data = data;
352 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
353 0 : fd_hash_age_new( self );
354 0 : }
355 0 : fd_hash_age_decode_archival_unsafe( self, ctx );
356 0 : return FD_BINCODE_SUCCESS;
357 0 : }
358 0 : int fd_hash_age_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
359 0 : int err;
360 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
361 0 : void * offset = NULL;
362 0 : for(;;) {
363 0 : err = fd_bincode_uint16_decode( &tag, ctx );
364 0 : if( FD_UNLIKELY( err ) ) return err;
365 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
366 0 : switch( tag ) {
367 0 : case (ushort)fd_hash_age_fee_calculator_TAG: {
368 0 : err = fd_archive_decode_setup_length( ctx, &offset );
369 0 : if( FD_UNLIKELY( err ) ) return err;
370 0 : err = fd_fee_calculator_decode_archival_preflight( ctx );
371 0 : if( FD_UNLIKELY( err ) ) return err;
372 0 : err = fd_archive_decode_check_length( ctx, offset );
373 0 : if( FD_UNLIKELY( err ) ) return err;
374 0 : break;
375 0 : }
376 0 : case (ushort)fd_hash_age_hash_index_TAG: {
377 0 : err = fd_bincode_uint64_decode_preflight( ctx );
378 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
379 0 : break;
380 0 : }
381 0 : case (ushort)fd_hash_age_timestamp_TAG: {
382 0 : err = fd_bincode_uint64_decode_preflight( ctx );
383 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
384 0 : break;
385 0 : }
386 0 : default:
387 0 : err = fd_archive_decode_skip_field( ctx, tag );
388 0 : if( FD_UNLIKELY( err ) ) return err;
389 0 : break;
390 0 : }
391 0 : }
392 0 : return FD_BINCODE_SUCCESS;
393 0 : }
394 0 : void fd_hash_age_decode_archival_unsafe( fd_hash_age_t * self, fd_bincode_decode_ctx_t * ctx ) {
395 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
396 0 : void * offset = NULL;
397 0 : for(;;) {
398 0 : fd_bincode_uint16_decode( &tag, ctx );
399 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
400 0 : switch( tag ) {
401 0 : case (ushort)fd_hash_age_fee_calculator_TAG: {
402 0 : fd_archive_decode_setup_length( ctx, &offset );
403 0 : fd_fee_calculator_decode_archival_unsafe( &self->fee_calculator, ctx );
404 0 : break;
405 0 : }
406 0 : case (ushort)fd_hash_age_hash_index_TAG: {
407 0 : fd_bincode_uint64_decode_unsafe( &self->hash_index, ctx );
408 0 : break;
409 0 : }
410 0 : case (ushort)fd_hash_age_timestamp_TAG: {
411 0 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
412 0 : break;
413 0 : }
414 0 : default:
415 0 : fd_archive_decode_skip_field( ctx, tag );
416 0 : break;
417 0 : }
418 0 : }
419 0 : }
420 0 : int fd_hash_age_encode_archival( fd_hash_age_t const * self, fd_bincode_encode_ctx_t * ctx ) {
421 0 : int err;
422 0 : void * offset = NULL;
423 0 : err = fd_bincode_uint16_encode( (ushort)fd_hash_age_fee_calculator_TAG, ctx );
424 0 : if( FD_UNLIKELY( err ) ) return err;
425 0 : err = fd_archive_encode_setup_length( ctx, &offset );
426 0 : if( FD_UNLIKELY( err ) ) return err;
427 0 : err = fd_fee_calculator_encode_archival( &self->fee_calculator, ctx );
428 0 : if( FD_UNLIKELY( err ) ) return err;
429 0 : err = fd_archive_encode_set_length( ctx, offset );
430 0 : if( FD_UNLIKELY( err ) ) return err;
431 0 : err = fd_bincode_uint16_encode( (ushort)fd_hash_age_hash_index_TAG, ctx );
432 0 : if( FD_UNLIKELY( err ) ) return err;
433 0 : err = fd_bincode_uint64_encode( self->hash_index, ctx );
434 0 : if( FD_UNLIKELY( err ) ) return err;
435 0 : err = fd_bincode_uint16_encode( (ushort)fd_hash_age_timestamp_TAG, ctx );
436 0 : if( FD_UNLIKELY( err ) ) return err;
437 0 : err = fd_bincode_uint64_encode( self->timestamp, ctx );
438 0 : if( FD_UNLIKELY( err ) ) return err;
439 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
440 0 : if( FD_UNLIKELY( err ) ) return err;
441 0 : return FD_BINCODE_SUCCESS;
442 0 : }
443 0 : int fd_hash_age_decode_offsets( fd_hash_age_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
444 0 : uchar const * data = ctx->data;
445 0 : int err;
446 0 : self->fee_calculator_off = (uint)( (ulong)ctx->data - (ulong)data );
447 0 : err = fd_fee_calculator_decode_preflight( ctx );
448 0 : if( FD_UNLIKELY( err ) ) return err;
449 0 : self->hash_index_off = (uint)( (ulong)ctx->data - (ulong)data );
450 0 : err = fd_bincode_uint64_decode_preflight( ctx );
451 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
452 0 : self->timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
453 0 : err = fd_bincode_uint64_decode_preflight( ctx );
454 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
455 0 : return FD_BINCODE_SUCCESS;
456 0 : }
457 0 : void fd_hash_age_new(fd_hash_age_t * self) {
458 0 : fd_memset( self, 0, sizeof(fd_hash_age_t) );
459 0 : fd_fee_calculator_new( &self->fee_calculator );
460 0 : }
461 872661 : void fd_hash_age_destroy( fd_hash_age_t * self, fd_bincode_destroy_ctx_t * ctx ) {
462 872661 : fd_fee_calculator_destroy( &self->fee_calculator, ctx );
463 872661 : }
464 :
465 0 : ulong fd_hash_age_footprint( void ){ return FD_HASH_AGE_FOOTPRINT; }
466 0 : ulong fd_hash_age_align( void ){ return FD_HASH_AGE_ALIGN; }
467 :
468 0 : void fd_hash_age_walk( void * w, fd_hash_age_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
469 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hash_age", level++ );
470 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
471 0 : fun( w, &self->hash_index, "hash_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
472 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
473 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hash_age", level-- );
474 0 : }
475 0 : ulong fd_hash_age_size( fd_hash_age_t const * self ) {
476 0 : ulong size = 0;
477 0 : size += fd_fee_calculator_size( &self->fee_calculator );
478 0 : size += sizeof(ulong);
479 0 : size += sizeof(ulong);
480 0 : return size;
481 0 : }
482 :
483 0 : int fd_hash_hash_age_pair_decode( fd_hash_hash_age_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
484 0 : void const * data = ctx->data;
485 0 : int err = fd_hash_hash_age_pair_decode_preflight( ctx );
486 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
487 0 : ctx->data = data;
488 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
489 0 : fd_hash_hash_age_pair_new( self );
490 0 : }
491 0 : fd_hash_hash_age_pair_decode_unsafe( self, ctx );
492 0 : return FD_BINCODE_SUCCESS;
493 0 : }
494 0 : int fd_hash_hash_age_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
495 0 : return fd_bincode_bytes_decode_preflight( 56, ctx );
496 0 : }
497 0 : void fd_hash_hash_age_pair_decode_unsafe( fd_hash_hash_age_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
498 0 : fd_hash_decode_unsafe( &self->key, ctx );
499 0 : fd_hash_age_decode_unsafe( &self->val, ctx );
500 0 : }
501 0 : int fd_hash_hash_age_pair_encode( fd_hash_hash_age_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
502 0 : int err;
503 0 : err = fd_hash_encode( &self->key, ctx );
504 0 : if( FD_UNLIKELY( err ) ) return err;
505 0 : err = fd_hash_age_encode( &self->val, ctx );
506 0 : if( FD_UNLIKELY( err ) ) return err;
507 0 : return FD_BINCODE_SUCCESS;
508 0 : }
509 : enum {
510 : fd_hash_hash_age_pair_key_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
511 : fd_hash_hash_age_pair_val_TAG = (1 << 6) | FD_ARCHIVE_META_STRUCT,
512 : };
513 0 : int fd_hash_hash_age_pair_decode_archival( fd_hash_hash_age_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
514 0 : void const * data = ctx->data;
515 0 : int err = fd_hash_hash_age_pair_decode_archival_preflight( ctx );
516 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
517 0 : ctx->data = data;
518 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
519 0 : fd_hash_hash_age_pair_new( self );
520 0 : }
521 0 : fd_hash_hash_age_pair_decode_archival_unsafe( self, ctx );
522 0 : return FD_BINCODE_SUCCESS;
523 0 : }
524 0 : int fd_hash_hash_age_pair_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
525 0 : int err;
526 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
527 0 : void * offset = NULL;
528 0 : for(;;) {
529 0 : err = fd_bincode_uint16_decode( &tag, ctx );
530 0 : if( FD_UNLIKELY( err ) ) return err;
531 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
532 0 : switch( tag ) {
533 0 : case (ushort)fd_hash_hash_age_pair_key_TAG: {
534 0 : err = fd_archive_decode_setup_length( ctx, &offset );
535 0 : if( FD_UNLIKELY( err ) ) return err;
536 0 : err = fd_hash_decode_archival_preflight( ctx );
537 0 : if( FD_UNLIKELY( err ) ) return err;
538 0 : err = fd_archive_decode_check_length( ctx, offset );
539 0 : if( FD_UNLIKELY( err ) ) return err;
540 0 : break;
541 0 : }
542 0 : case (ushort)fd_hash_hash_age_pair_val_TAG: {
543 0 : err = fd_archive_decode_setup_length( ctx, &offset );
544 0 : if( FD_UNLIKELY( err ) ) return err;
545 0 : err = fd_hash_age_decode_archival_preflight( ctx );
546 0 : if( FD_UNLIKELY( err ) ) return err;
547 0 : err = fd_archive_decode_check_length( ctx, offset );
548 0 : if( FD_UNLIKELY( err ) ) return err;
549 0 : break;
550 0 : }
551 0 : default:
552 0 : err = fd_archive_decode_skip_field( ctx, tag );
553 0 : if( FD_UNLIKELY( err ) ) return err;
554 0 : break;
555 0 : }
556 0 : }
557 0 : return FD_BINCODE_SUCCESS;
558 0 : }
559 0 : void fd_hash_hash_age_pair_decode_archival_unsafe( fd_hash_hash_age_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
560 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
561 0 : void * offset = NULL;
562 0 : for(;;) {
563 0 : fd_bincode_uint16_decode( &tag, ctx );
564 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
565 0 : switch( tag ) {
566 0 : case (ushort)fd_hash_hash_age_pair_key_TAG: {
567 0 : fd_archive_decode_setup_length( ctx, &offset );
568 0 : fd_hash_decode_archival_unsafe( &self->key, ctx );
569 0 : break;
570 0 : }
571 0 : case (ushort)fd_hash_hash_age_pair_val_TAG: {
572 0 : fd_archive_decode_setup_length( ctx, &offset );
573 0 : fd_hash_age_decode_archival_unsafe( &self->val, ctx );
574 0 : break;
575 0 : }
576 0 : default:
577 0 : fd_archive_decode_skip_field( ctx, tag );
578 0 : break;
579 0 : }
580 0 : }
581 0 : }
582 0 : int fd_hash_hash_age_pair_encode_archival( fd_hash_hash_age_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
583 0 : int err;
584 0 : void * offset = NULL;
585 0 : err = fd_bincode_uint16_encode( (ushort)fd_hash_hash_age_pair_key_TAG, ctx );
586 0 : if( FD_UNLIKELY( err ) ) return err;
587 0 : err = fd_archive_encode_setup_length( ctx, &offset );
588 0 : if( FD_UNLIKELY( err ) ) return err;
589 0 : err = fd_hash_encode_archival( &self->key, ctx );
590 0 : if( FD_UNLIKELY( err ) ) return err;
591 0 : err = fd_archive_encode_set_length( ctx, offset );
592 0 : if( FD_UNLIKELY( err ) ) return err;
593 0 : err = fd_bincode_uint16_encode( (ushort)fd_hash_hash_age_pair_val_TAG, ctx );
594 0 : if( FD_UNLIKELY( err ) ) return err;
595 0 : err = fd_archive_encode_setup_length( ctx, &offset );
596 0 : if( FD_UNLIKELY( err ) ) return err;
597 0 : err = fd_hash_age_encode_archival( &self->val, ctx );
598 0 : if( FD_UNLIKELY( err ) ) return err;
599 0 : err = fd_archive_encode_set_length( ctx, offset );
600 0 : if( FD_UNLIKELY( err ) ) return err;
601 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
602 0 : if( FD_UNLIKELY( err ) ) return err;
603 0 : return FD_BINCODE_SUCCESS;
604 0 : }
605 0 : int fd_hash_hash_age_pair_decode_offsets( fd_hash_hash_age_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
606 0 : uchar const * data = ctx->data;
607 0 : int err;
608 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
609 0 : err = fd_hash_decode_preflight( ctx );
610 0 : if( FD_UNLIKELY( err ) ) return err;
611 0 : self->val_off = (uint)( (ulong)ctx->data - (ulong)data );
612 0 : err = fd_hash_age_decode_preflight( ctx );
613 0 : if( FD_UNLIKELY( err ) ) return err;
614 0 : return FD_BINCODE_SUCCESS;
615 0 : }
616 0 : void fd_hash_hash_age_pair_new(fd_hash_hash_age_pair_t * self) {
617 0 : fd_memset( self, 0, sizeof(fd_hash_hash_age_pair_t) );
618 0 : fd_hash_new( &self->key );
619 0 : fd_hash_age_new( &self->val );
620 0 : }
621 872661 : void fd_hash_hash_age_pair_destroy( fd_hash_hash_age_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
622 872661 : fd_hash_destroy( &self->key, ctx );
623 872661 : fd_hash_age_destroy( &self->val, ctx );
624 872661 : }
625 :
626 0 : ulong fd_hash_hash_age_pair_footprint( void ){ return FD_HASH_HASH_AGE_PAIR_FOOTPRINT; }
627 0 : ulong fd_hash_hash_age_pair_align( void ){ return FD_HASH_HASH_AGE_PAIR_ALIGN; }
628 :
629 0 : void fd_hash_hash_age_pair_walk( void * w, fd_hash_hash_age_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
630 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hash_hash_age_pair", level++ );
631 0 : fd_hash_walk( w, &self->key, fun, "key", level );
632 0 : fd_hash_age_walk( w, &self->val, fun, "val", level );
633 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hash_hash_age_pair", level-- );
634 0 : }
635 0 : ulong fd_hash_hash_age_pair_size( fd_hash_hash_age_pair_t const * self ) {
636 0 : ulong size = 0;
637 0 : size += fd_hash_size( &self->key );
638 0 : size += fd_hash_age_size( &self->val );
639 0 : return size;
640 0 : }
641 :
642 0 : int fd_block_hash_vec_decode( fd_block_hash_vec_t * self, fd_bincode_decode_ctx_t * ctx ) {
643 0 : void const * data = ctx->data;
644 0 : int err = fd_block_hash_vec_decode_preflight( ctx );
645 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
646 0 : ctx->data = data;
647 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
648 0 : fd_block_hash_vec_new( self );
649 0 : }
650 0 : fd_block_hash_vec_decode_unsafe( self, ctx );
651 0 : return FD_BINCODE_SUCCESS;
652 0 : }
653 9 : int fd_block_hash_vec_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
654 9 : int err;
655 9 : err = fd_bincode_uint64_decode_preflight( ctx );
656 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
657 9 : {
658 9 : uchar o;
659 9 : err = fd_bincode_bool_decode( &o, ctx );
660 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
661 6 : if( o ) {
662 0 : err = fd_hash_decode_preflight( ctx );
663 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
664 0 : }
665 6 : }
666 6 : ulong ages_len;
667 6 : err = fd_bincode_uint64_decode( &ages_len, ctx );
668 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
669 6 : if( ages_len ) {
670 0 : for( ulong i=0; i < ages_len; i++ ) {
671 0 : err = fd_hash_hash_age_pair_decode_preflight( ctx );
672 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
673 0 : }
674 0 : }
675 6 : err = fd_bincode_uint64_decode_preflight( ctx );
676 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
677 6 : return FD_BINCODE_SUCCESS;
678 6 : }
679 6 : void fd_block_hash_vec_decode_unsafe( fd_block_hash_vec_t * self, fd_bincode_decode_ctx_t * ctx ) {
680 6 : fd_bincode_uint64_decode_unsafe( &self->last_hash_index, ctx );
681 6 : {
682 6 : uchar o;
683 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
684 6 : if( o ) {
685 0 : self->last_hash = (fd_hash_t *)fd_valloc_malloc( ctx->valloc, FD_HASH_ALIGN, FD_HASH_FOOTPRINT );
686 0 : fd_hash_new( self->last_hash );
687 0 : fd_hash_decode_unsafe( self->last_hash, ctx );
688 0 : } else
689 6 : self->last_hash = NULL;
690 6 : }
691 6 : fd_bincode_uint64_decode_unsafe( &self->ages_len, ctx );
692 6 : if( self->ages_len ) {
693 0 : self->ages = (fd_hash_hash_age_pair_t *)fd_valloc_malloc( ctx->valloc, FD_HASH_HASH_AGE_PAIR_ALIGN, FD_HASH_HASH_AGE_PAIR_FOOTPRINT*self->ages_len );
694 0 : for( ulong i=0; i < self->ages_len; i++ ) {
695 0 : fd_hash_hash_age_pair_new( self->ages + i );
696 0 : fd_hash_hash_age_pair_decode_unsafe( self->ages + i, ctx );
697 0 : }
698 0 : } else
699 6 : self->ages = NULL;
700 6 : fd_bincode_uint64_decode_unsafe( &self->max_age, ctx );
701 6 : }
702 6 : int fd_block_hash_vec_encode( fd_block_hash_vec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
703 6 : int err;
704 6 : err = fd_bincode_uint64_encode( self->last_hash_index, ctx );
705 6 : if( FD_UNLIKELY( err ) ) return err;
706 6 : if( self->last_hash != NULL ) {
707 0 : err = fd_bincode_bool_encode( 1, ctx );
708 0 : if( FD_UNLIKELY( err ) ) return err;
709 0 : err = fd_hash_encode( self->last_hash, ctx );
710 0 : if( FD_UNLIKELY( err ) ) return err;
711 6 : } else {
712 6 : err = fd_bincode_bool_encode( 0, ctx );
713 6 : if( FD_UNLIKELY( err ) ) return err;
714 6 : }
715 6 : err = fd_bincode_uint64_encode( self->ages_len, ctx );
716 6 : if( FD_UNLIKELY(err) ) return err;
717 6 : if( self->ages_len ) {
718 0 : for( ulong i=0; i < self->ages_len; i++ ) {
719 0 : err = fd_hash_hash_age_pair_encode( self->ages + i, ctx );
720 0 : if( FD_UNLIKELY( err ) ) return err;
721 0 : }
722 0 : }
723 6 : err = fd_bincode_uint64_encode( self->max_age, ctx );
724 6 : if( FD_UNLIKELY( err ) ) return err;
725 6 : return FD_BINCODE_SUCCESS;
726 6 : }
727 0 : int fd_block_hash_vec_decode_offsets( fd_block_hash_vec_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
728 0 : uchar const * data = ctx->data;
729 0 : int err;
730 0 : self->last_hash_index_off = (uint)( (ulong)ctx->data - (ulong)data );
731 0 : err = fd_bincode_uint64_decode_preflight( ctx );
732 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
733 0 : self->last_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
734 0 : {
735 0 : uchar o;
736 0 : err = fd_bincode_bool_decode( &o, ctx );
737 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
738 0 : if( o ) {
739 0 : err = fd_hash_decode_preflight( ctx );
740 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
741 0 : }
742 0 : }
743 0 : self->ages_off = (uint)( (ulong)ctx->data - (ulong)data );
744 0 : ulong ages_len;
745 0 : err = fd_bincode_uint64_decode( &ages_len, ctx );
746 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
747 0 : if( ages_len ) {
748 0 : for( ulong i=0; i < ages_len; i++ ) {
749 0 : err = fd_hash_hash_age_pair_decode_preflight( ctx );
750 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
751 0 : }
752 0 : }
753 0 : self->max_age_off = (uint)( (ulong)ctx->data - (ulong)data );
754 0 : err = fd_bincode_uint64_decode_preflight( ctx );
755 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
756 0 : return FD_BINCODE_SUCCESS;
757 0 : }
758 6 : void fd_block_hash_vec_new(fd_block_hash_vec_t * self) {
759 6 : fd_memset( self, 0, sizeof(fd_block_hash_vec_t) );
760 6 : }
761 0 : void fd_block_hash_vec_destroy( fd_block_hash_vec_t * self, fd_bincode_destroy_ctx_t * ctx ) {
762 0 : if( self->last_hash ) {
763 0 : fd_hash_destroy( self->last_hash, ctx );
764 0 : fd_valloc_free( ctx->valloc, self->last_hash );
765 0 : self->last_hash = NULL;
766 0 : }
767 0 : if( self->ages ) {
768 0 : for( ulong i=0; i < self->ages_len; i++ )
769 0 : fd_hash_hash_age_pair_destroy( self->ages + i, ctx );
770 0 : fd_valloc_free( ctx->valloc, self->ages );
771 0 : self->ages = NULL;
772 0 : }
773 0 : }
774 :
775 0 : ulong fd_block_hash_vec_footprint( void ){ return FD_BLOCK_HASH_VEC_FOOTPRINT; }
776 0 : ulong fd_block_hash_vec_align( void ){ return FD_BLOCK_HASH_VEC_ALIGN; }
777 :
778 0 : void fd_block_hash_vec_walk( void * w, fd_block_hash_vec_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
779 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_hash_vec", level++ );
780 0 : fun( w, &self->last_hash_index, "last_hash_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
781 0 : if( !self->last_hash ) {
782 0 : fun( w, NULL, "last_hash", FD_FLAMENCO_TYPE_NULL, "hash", level );
783 0 : } else {
784 0 : fd_hash_walk( w, self->last_hash, fun, "last_hash", level );
785 0 : }
786 0 : if( self->ages_len ) {
787 0 : fun( w, NULL, "ages", FD_FLAMENCO_TYPE_ARR, "array", level++ );
788 0 : for( ulong i=0; i < self->ages_len; i++ )
789 0 : fd_hash_hash_age_pair_walk(w, self->ages + i, fun, "hash_hash_age_pair", level );
790 0 : fun( w, NULL, "ages", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
791 0 : }
792 0 : fun( w, &self->max_age, "max_age", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
793 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_hash_vec", level-- );
794 0 : }
795 6 : ulong fd_block_hash_vec_size( fd_block_hash_vec_t const * self ) {
796 6 : ulong size = 0;
797 6 : size += sizeof(ulong);
798 6 : size += sizeof(char);
799 6 : if( NULL != self->last_hash ) {
800 0 : size += fd_hash_size( self->last_hash );
801 0 : }
802 6 : do {
803 6 : size += sizeof(ulong);
804 6 : for( ulong i=0; i < self->ages_len; i++ )
805 0 : size += fd_hash_hash_age_pair_size( self->ages + i );
806 6 : } while(0);
807 6 : size += sizeof(ulong);
808 6 : return size;
809 6 : }
810 :
811 0 : int fd_block_hash_queue_decode( fd_block_hash_queue_t * self, fd_bincode_decode_ctx_t * ctx ) {
812 0 : void const * data = ctx->data;
813 0 : int err = fd_block_hash_queue_decode_preflight( ctx );
814 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
815 0 : ctx->data = data;
816 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
817 0 : fd_block_hash_queue_new( self );
818 0 : }
819 0 : fd_block_hash_queue_decode_unsafe( self, ctx );
820 0 : return FD_BINCODE_SUCCESS;
821 0 : }
822 0 : int fd_block_hash_queue_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
823 0 : int err;
824 0 : err = fd_bincode_uint64_decode_preflight( ctx );
825 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
826 0 : {
827 0 : uchar o;
828 0 : err = fd_bincode_bool_decode( &o, ctx );
829 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
830 0 : if( o ) {
831 0 : err = fd_hash_decode_preflight( ctx );
832 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
833 0 : }
834 0 : }
835 0 : ulong ages_len;
836 0 : err = fd_bincode_uint64_decode( &ages_len, ctx );
837 0 : if( FD_UNLIKELY( err ) ) return err;
838 0 : for( ulong i=0; i < ages_len; i++ ) {
839 0 : err = fd_hash_hash_age_pair_decode_preflight( ctx );
840 0 : if( FD_UNLIKELY( err ) ) return err;
841 0 : }
842 0 : err = fd_bincode_uint64_decode_preflight( ctx );
843 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
844 0 : return FD_BINCODE_SUCCESS;
845 0 : }
846 0 : void fd_block_hash_queue_decode_unsafe( fd_block_hash_queue_t * self, fd_bincode_decode_ctx_t * ctx ) {
847 0 : fd_bincode_uint64_decode_unsafe( &self->last_hash_index, ctx );
848 0 : {
849 0 : uchar o;
850 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
851 0 : if( o ) {
852 0 : self->last_hash = (fd_hash_t *)fd_valloc_malloc( ctx->valloc, FD_HASH_ALIGN, FD_HASH_FOOTPRINT );
853 0 : fd_hash_new( self->last_hash );
854 0 : fd_hash_decode_unsafe( self->last_hash, ctx );
855 0 : } else
856 0 : self->last_hash = NULL;
857 0 : }
858 0 : ulong ages_len;
859 0 : fd_bincode_uint64_decode_unsafe( &ages_len, ctx );
860 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
861 0 : self->ages_pool = fd_hash_hash_age_pair_t_map_alloc( ctx->valloc, fd_ulong_max(ages_len, 400 ) );
862 0 : self->ages_root = NULL;
863 0 : }
864 0 : for( ulong i=0; i < ages_len; i++ ) {
865 0 : fd_hash_hash_age_pair_t_mapnode_t * node = fd_hash_hash_age_pair_t_map_acquire( self->ages_pool );
866 0 : fd_hash_hash_age_pair_new( &node->elem );
867 0 : fd_hash_hash_age_pair_decode_unsafe( &node->elem, ctx );
868 0 : fd_hash_hash_age_pair_t_map_insert( self->ages_pool, &self->ages_root, node );
869 0 : }
870 0 : fd_bincode_uint64_decode_unsafe( &self->max_age, ctx );
871 0 : }
872 0 : int fd_block_hash_queue_encode( fd_block_hash_queue_t const * self, fd_bincode_encode_ctx_t * ctx ) {
873 0 : int err;
874 0 : err = fd_bincode_uint64_encode( self->last_hash_index, ctx );
875 0 : if( FD_UNLIKELY( err ) ) return err;
876 0 : if( self->last_hash != NULL ) {
877 0 : err = fd_bincode_bool_encode( 1, ctx );
878 0 : if( FD_UNLIKELY( err ) ) return err;
879 0 : err = fd_hash_encode( self->last_hash, ctx );
880 0 : if( FD_UNLIKELY( err ) ) return err;
881 0 : } else {
882 0 : err = fd_bincode_bool_encode( 0, ctx );
883 0 : if( FD_UNLIKELY( err ) ) return err;
884 0 : }
885 0 : if( self->ages_root ) {
886 0 : ulong ages_len = fd_hash_hash_age_pair_t_map_size( self->ages_pool, self->ages_root );
887 0 : err = fd_bincode_uint64_encode( ages_len, ctx );
888 0 : if( FD_UNLIKELY( err ) ) return err;
889 0 : for( fd_hash_hash_age_pair_t_mapnode_t * n = fd_hash_hash_age_pair_t_map_minimum( self->ages_pool, self->ages_root ); n; n = fd_hash_hash_age_pair_t_map_successor( self->ages_pool, n ) ) {
890 0 : err = fd_hash_hash_age_pair_encode( &n->elem, ctx );
891 0 : if( FD_UNLIKELY( err ) ) return err;
892 0 : }
893 0 : } else {
894 0 : ulong ages_len = 0;
895 0 : err = fd_bincode_uint64_encode( ages_len, ctx );
896 0 : if( FD_UNLIKELY( err ) ) return err;
897 0 : }
898 0 : err = fd_bincode_uint64_encode( self->max_age, ctx );
899 0 : if( FD_UNLIKELY( err ) ) return err;
900 0 : return FD_BINCODE_SUCCESS;
901 0 : }
902 : enum {
903 : fd_block_hash_queue_last_hash_index_TAG = (0 << 6) | FD_ARCHIVE_META_ULONG,
904 : fd_block_hash_queue_last_hash_TAG = (1 << 6) | FD_ARCHIVE_META_OPTION,
905 : fd_block_hash_queue_ages_TAG = (2 << 6) | FD_ARCHIVE_META_MAP,
906 : fd_block_hash_queue_max_age_TAG = (3 << 6) | FD_ARCHIVE_META_ULONG,
907 : };
908 0 : int fd_block_hash_queue_decode_archival( fd_block_hash_queue_t * self, fd_bincode_decode_ctx_t * ctx ) {
909 0 : void const * data = ctx->data;
910 0 : int err = fd_block_hash_queue_decode_archival_preflight( ctx );
911 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
912 0 : ctx->data = data;
913 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
914 0 : fd_block_hash_queue_new( self );
915 0 : }
916 0 : fd_block_hash_queue_decode_archival_unsafe( self, ctx );
917 0 : return FD_BINCODE_SUCCESS;
918 0 : }
919 0 : int fd_block_hash_queue_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
920 0 : int err;
921 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
922 0 : void * offset = NULL;
923 0 : for(;;) {
924 0 : err = fd_bincode_uint16_decode( &tag, ctx );
925 0 : if( FD_UNLIKELY( err ) ) return err;
926 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
927 0 : switch( tag ) {
928 0 : case (ushort)fd_block_hash_queue_last_hash_index_TAG: {
929 0 : err = fd_bincode_uint64_decode_preflight( ctx );
930 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
931 0 : break;
932 0 : }
933 0 : case (ushort)fd_block_hash_queue_last_hash_TAG: {
934 0 : err = fd_archive_decode_setup_length( ctx, &offset );
935 0 : if( FD_UNLIKELY( err ) ) return err;
936 0 : {
937 0 : uchar o;
938 0 : err = fd_bincode_bool_decode( &o, ctx );
939 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
940 0 : if( o ) {
941 0 : err = fd_hash_decode_archival_preflight( ctx );
942 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
943 0 : }
944 0 : }
945 0 : err = fd_archive_decode_check_length( ctx, offset );
946 0 : if( FD_UNLIKELY( err ) ) return err;
947 0 : break;
948 0 : }
949 0 : case (ushort)fd_block_hash_queue_ages_TAG: {
950 0 : err = fd_archive_decode_setup_length( ctx, &offset );
951 0 : if( FD_UNLIKELY( err ) ) return err;
952 0 : ulong ages_len;
953 0 : err = fd_bincode_uint64_decode( &ages_len, ctx );
954 0 : if( FD_UNLIKELY( err ) ) return err;
955 0 : for( ulong i=0; i < ages_len; i++ ) {
956 0 : err = fd_hash_hash_age_pair_decode_archival_preflight( ctx );
957 0 : if( FD_UNLIKELY( err ) ) return err;
958 0 : }
959 0 : err = fd_archive_decode_check_length( ctx, offset );
960 0 : if( FD_UNLIKELY( err ) ) return err;
961 0 : break;
962 0 : }
963 0 : case (ushort)fd_block_hash_queue_max_age_TAG: {
964 0 : err = fd_bincode_uint64_decode_preflight( ctx );
965 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
966 0 : break;
967 0 : }
968 0 : default:
969 0 : err = fd_archive_decode_skip_field( ctx, tag );
970 0 : if( FD_UNLIKELY( err ) ) return err;
971 0 : break;
972 0 : }
973 0 : }
974 0 : return FD_BINCODE_SUCCESS;
975 0 : }
976 0 : void fd_block_hash_queue_decode_archival_unsafe( fd_block_hash_queue_t * self, fd_bincode_decode_ctx_t * ctx ) {
977 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
978 0 : void * offset = NULL;
979 0 : for(;;) {
980 0 : fd_bincode_uint16_decode( &tag, ctx );
981 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
982 0 : switch( tag ) {
983 0 : case (ushort)fd_block_hash_queue_last_hash_index_TAG: {
984 0 : fd_bincode_uint64_decode_unsafe( &self->last_hash_index, ctx );
985 0 : break;
986 0 : }
987 0 : case (ushort)fd_block_hash_queue_last_hash_TAG: {
988 0 : fd_archive_decode_setup_length( ctx, &offset );
989 0 : {
990 0 : uchar o;
991 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
992 0 : if( o ) {
993 0 : self->last_hash = (fd_hash_t *)fd_valloc_malloc( ctx->valloc, FD_HASH_ALIGN, FD_HASH_FOOTPRINT );
994 0 : fd_hash_new( self->last_hash );
995 0 : fd_hash_decode_archival_unsafe( self->last_hash, ctx );
996 0 : } else
997 0 : self->last_hash = NULL;
998 0 : }
999 0 : break;
1000 0 : }
1001 0 : case (ushort)fd_block_hash_queue_ages_TAG: {
1002 0 : fd_archive_decode_setup_length( ctx, &offset );
1003 0 : ulong ages_len;
1004 0 : fd_bincode_uint64_decode_unsafe( &ages_len, ctx );
1005 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1006 0 : self->ages_pool = fd_hash_hash_age_pair_t_map_alloc( ctx->valloc, fd_ulong_max(ages_len, 400 ) );
1007 0 : self->ages_root = NULL;
1008 0 : }
1009 0 : for( ulong i=0; i < ages_len; i++ ) {
1010 0 : fd_hash_hash_age_pair_t_mapnode_t * node = fd_hash_hash_age_pair_t_map_acquire( self->ages_pool );
1011 0 : fd_hash_hash_age_pair_new( &node->elem );
1012 0 : fd_hash_hash_age_pair_decode_archival_unsafe( &node->elem, ctx );
1013 0 : fd_hash_hash_age_pair_t_map_insert( self->ages_pool, &self->ages_root, node );
1014 0 : }
1015 0 : break;
1016 0 : }
1017 0 : case (ushort)fd_block_hash_queue_max_age_TAG: {
1018 0 : fd_bincode_uint64_decode_unsafe( &self->max_age, ctx );
1019 0 : break;
1020 0 : }
1021 0 : default:
1022 0 : fd_archive_decode_skip_field( ctx, tag );
1023 0 : break;
1024 0 : }
1025 0 : }
1026 0 : }
1027 0 : int fd_block_hash_queue_encode_archival( fd_block_hash_queue_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1028 0 : int err;
1029 0 : void * offset = NULL;
1030 0 : err = fd_bincode_uint16_encode( (ushort)fd_block_hash_queue_last_hash_index_TAG, ctx );
1031 0 : if( FD_UNLIKELY( err ) ) return err;
1032 0 : err = fd_bincode_uint64_encode( self->last_hash_index, ctx );
1033 0 : if( FD_UNLIKELY( err ) ) return err;
1034 0 : err = fd_bincode_uint16_encode( (ushort)fd_block_hash_queue_last_hash_TAG, ctx );
1035 0 : if( FD_UNLIKELY( err ) ) return err;
1036 0 : err = fd_archive_encode_setup_length( ctx, &offset );
1037 0 : if( FD_UNLIKELY( err ) ) return err;
1038 0 : if( self->last_hash != NULL ) {
1039 0 : err = fd_bincode_bool_encode( 1, ctx );
1040 0 : if( FD_UNLIKELY( err ) ) return err;
1041 0 : err = fd_hash_encode_archival( self->last_hash, ctx );
1042 0 : if( FD_UNLIKELY( err ) ) return err;
1043 0 : } else {
1044 0 : err = fd_bincode_bool_encode( 0, ctx );
1045 0 : if( FD_UNLIKELY( err ) ) return err;
1046 0 : }
1047 0 : err = fd_archive_encode_set_length( ctx, offset );
1048 0 : if( FD_UNLIKELY( err ) ) return err;
1049 0 : err = fd_bincode_uint16_encode( (ushort)fd_block_hash_queue_ages_TAG, ctx );
1050 0 : if( FD_UNLIKELY( err ) ) return err;
1051 0 : err = fd_archive_encode_setup_length( ctx, &offset );
1052 0 : if( FD_UNLIKELY( err ) ) return err;
1053 0 : if( self->ages_root ) {
1054 0 : ulong ages_len = fd_hash_hash_age_pair_t_map_size( self->ages_pool, self->ages_root );
1055 0 : err = fd_bincode_uint64_encode( ages_len, ctx );
1056 0 : if( FD_UNLIKELY( err ) ) return err;
1057 0 : for( fd_hash_hash_age_pair_t_mapnode_t * n = fd_hash_hash_age_pair_t_map_minimum( self->ages_pool, self->ages_root ); n; n = fd_hash_hash_age_pair_t_map_successor( self->ages_pool, n ) ) {
1058 0 : err = fd_hash_hash_age_pair_encode_archival( &n->elem, ctx );
1059 0 : if( FD_UNLIKELY( err ) ) return err;
1060 0 : }
1061 0 : } else {
1062 0 : ulong ages_len = 0;
1063 0 : err = fd_bincode_uint64_encode( ages_len, ctx );
1064 0 : if( FD_UNLIKELY( err ) ) return err;
1065 0 : }
1066 0 : err = fd_archive_encode_set_length( ctx, offset );
1067 0 : if( FD_UNLIKELY( err ) ) return err;
1068 0 : err = fd_bincode_uint16_encode( (ushort)fd_block_hash_queue_max_age_TAG, ctx );
1069 0 : if( FD_UNLIKELY( err ) ) return err;
1070 0 : err = fd_bincode_uint64_encode( self->max_age, ctx );
1071 0 : if( FD_UNLIKELY( err ) ) return err;
1072 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
1073 0 : if( FD_UNLIKELY( err ) ) return err;
1074 0 : return FD_BINCODE_SUCCESS;
1075 0 : }
1076 0 : int fd_block_hash_queue_decode_offsets( fd_block_hash_queue_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
1077 0 : uchar const * data = ctx->data;
1078 0 : int err;
1079 0 : self->last_hash_index_off = (uint)( (ulong)ctx->data - (ulong)data );
1080 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1081 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1082 0 : self->last_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
1083 0 : {
1084 0 : uchar o;
1085 0 : err = fd_bincode_bool_decode( &o, ctx );
1086 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1087 0 : if( o ) {
1088 0 : err = fd_hash_decode_preflight( ctx );
1089 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1090 0 : }
1091 0 : }
1092 0 : self->ages_off = (uint)( (ulong)ctx->data - (ulong)data );
1093 0 : ulong ages_len;
1094 0 : err = fd_bincode_uint64_decode( &ages_len, ctx );
1095 0 : if( FD_UNLIKELY( err ) ) return err;
1096 0 : for( ulong i=0; i < ages_len; i++ ) {
1097 0 : err = fd_hash_hash_age_pair_decode_preflight( ctx );
1098 0 : if( FD_UNLIKELY( err ) ) return err;
1099 0 : }
1100 0 : self->max_age_off = (uint)( (ulong)ctx->data - (ulong)data );
1101 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1102 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1103 0 : return FD_BINCODE_SUCCESS;
1104 0 : }
1105 815718 : void fd_block_hash_queue_new(fd_block_hash_queue_t * self) {
1106 815718 : fd_memset( self, 0, sizeof(fd_block_hash_queue_t) );
1107 815718 : }
1108 815718 : void fd_block_hash_queue_destroy( fd_block_hash_queue_t * self, fd_bincode_destroy_ctx_t * ctx ) {
1109 815718 : if( self->last_hash ) {
1110 12741 : fd_hash_destroy( self->last_hash, ctx );
1111 12741 : fd_valloc_free( ctx->valloc, self->last_hash );
1112 12741 : self->last_hash = NULL;
1113 12741 : }
1114 1688379 : for( fd_hash_hash_age_pair_t_mapnode_t * n = fd_hash_hash_age_pair_t_map_minimum(self->ages_pool, self->ages_root ); n; n = fd_hash_hash_age_pair_t_map_successor(self->ages_pool, n) ) {
1115 872661 : fd_hash_hash_age_pair_destroy( &n->elem, ctx );
1116 872661 : }
1117 815718 : fd_valloc_free( ctx->valloc, fd_hash_hash_age_pair_t_map_delete( fd_hash_hash_age_pair_t_map_leave( self->ages_pool ) ) );
1118 815718 : self->ages_pool = NULL;
1119 815718 : self->ages_root = NULL;
1120 815718 : }
1121 :
1122 0 : ulong fd_block_hash_queue_footprint( void ){ return FD_BLOCK_HASH_QUEUE_FOOTPRINT; }
1123 0 : ulong fd_block_hash_queue_align( void ){ return FD_BLOCK_HASH_QUEUE_ALIGN; }
1124 :
1125 0 : void fd_block_hash_queue_walk( void * w, fd_block_hash_queue_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1126 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_hash_queue", level++ );
1127 0 : fun( w, &self->last_hash_index, "last_hash_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1128 0 : if( !self->last_hash ) {
1129 0 : fun( w, NULL, "last_hash", FD_FLAMENCO_TYPE_NULL, "hash", level );
1130 0 : } else {
1131 0 : fd_hash_walk( w, self->last_hash, fun, "last_hash", level );
1132 0 : }
1133 0 : if( self->ages_root ) {
1134 0 : for( fd_hash_hash_age_pair_t_mapnode_t * n = fd_hash_hash_age_pair_t_map_minimum(self->ages_pool, self->ages_root ); n; n = fd_hash_hash_age_pair_t_map_successor( self->ages_pool, n ) ) {
1135 0 : fd_hash_hash_age_pair_walk(w, &n->elem, fun, "ages", level );
1136 0 : }
1137 0 : }
1138 0 : fun( w, &self->max_age, "max_age", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1139 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_hash_queue", level-- );
1140 0 : }
1141 0 : ulong fd_block_hash_queue_size( fd_block_hash_queue_t const * self ) {
1142 0 : ulong size = 0;
1143 0 : size += sizeof(ulong);
1144 0 : size += sizeof(char);
1145 0 : if( NULL != self->last_hash ) {
1146 0 : size += fd_hash_size( self->last_hash );
1147 0 : }
1148 0 : if( self->ages_root ) {
1149 0 : size += sizeof(ulong);
1150 0 : for( fd_hash_hash_age_pair_t_mapnode_t * n = fd_hash_hash_age_pair_t_map_minimum( self->ages_pool, self->ages_root ); n; n = fd_hash_hash_age_pair_t_map_successor( self->ages_pool, n ) ) {
1151 0 : size += fd_hash_hash_age_pair_size( &n->elem );
1152 0 : }
1153 0 : } else {
1154 0 : size += sizeof(ulong);
1155 0 : }
1156 0 : size += sizeof(ulong);
1157 0 : return size;
1158 0 : }
1159 :
1160 0 : int fd_fee_rate_governor_decode( fd_fee_rate_governor_t * self, fd_bincode_decode_ctx_t * ctx ) {
1161 0 : void const * data = ctx->data;
1162 0 : int err = fd_fee_rate_governor_decode_preflight( ctx );
1163 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1164 0 : ctx->data = data;
1165 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1166 0 : fd_fee_rate_governor_new( self );
1167 0 : }
1168 0 : fd_fee_rate_governor_decode_unsafe( self, ctx );
1169 0 : return FD_BINCODE_SUCCESS;
1170 0 : }
1171 6 : int fd_fee_rate_governor_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
1172 6 : return fd_bincode_bytes_decode_preflight( 33, ctx );
1173 6 : }
1174 6 : void fd_fee_rate_governor_decode_unsafe( fd_fee_rate_governor_t * self, fd_bincode_decode_ctx_t * ctx ) {
1175 6 : fd_bincode_uint64_decode_unsafe( &self->target_lamports_per_signature, ctx );
1176 6 : fd_bincode_uint64_decode_unsafe( &self->target_signatures_per_slot, ctx );
1177 6 : fd_bincode_uint64_decode_unsafe( &self->min_lamports_per_signature, ctx );
1178 6 : fd_bincode_uint64_decode_unsafe( &self->max_lamports_per_signature, ctx );
1179 6 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
1180 6 : }
1181 15 : int fd_fee_rate_governor_encode( fd_fee_rate_governor_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1182 15 : int err;
1183 15 : err = fd_bincode_uint64_encode( self->target_lamports_per_signature, ctx );
1184 15 : if( FD_UNLIKELY( err ) ) return err;
1185 15 : err = fd_bincode_uint64_encode( self->target_signatures_per_slot, ctx );
1186 15 : if( FD_UNLIKELY( err ) ) return err;
1187 15 : err = fd_bincode_uint64_encode( self->min_lamports_per_signature, ctx );
1188 15 : if( FD_UNLIKELY( err ) ) return err;
1189 15 : err = fd_bincode_uint64_encode( self->max_lamports_per_signature, ctx );
1190 15 : if( FD_UNLIKELY( err ) ) return err;
1191 15 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
1192 15 : if( FD_UNLIKELY( err ) ) return err;
1193 15 : return FD_BINCODE_SUCCESS;
1194 15 : }
1195 : enum {
1196 : fd_fee_rate_governor_target_lamports_per_signature_TAG = (0 << 6) | FD_ARCHIVE_META_ULONG,
1197 : fd_fee_rate_governor_target_signatures_per_slot_TAG = (1 << 6) | FD_ARCHIVE_META_ULONG,
1198 : fd_fee_rate_governor_min_lamports_per_signature_TAG = (2 << 6) | FD_ARCHIVE_META_ULONG,
1199 : fd_fee_rate_governor_max_lamports_per_signature_TAG = (3 << 6) | FD_ARCHIVE_META_ULONG,
1200 : fd_fee_rate_governor_burn_percent_TAG = (4 << 6) | FD_ARCHIVE_META_UCHAR,
1201 : };
1202 0 : int fd_fee_rate_governor_decode_archival( fd_fee_rate_governor_t * self, fd_bincode_decode_ctx_t * ctx ) {
1203 0 : void const * data = ctx->data;
1204 0 : int err = fd_fee_rate_governor_decode_archival_preflight( ctx );
1205 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1206 0 : ctx->data = data;
1207 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1208 0 : fd_fee_rate_governor_new( self );
1209 0 : }
1210 0 : fd_fee_rate_governor_decode_archival_unsafe( self, ctx );
1211 0 : return FD_BINCODE_SUCCESS;
1212 0 : }
1213 0 : int fd_fee_rate_governor_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
1214 0 : int err;
1215 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1216 0 : void * offset = NULL;
1217 0 : for(;;) {
1218 0 : err = fd_bincode_uint16_decode( &tag, ctx );
1219 0 : if( FD_UNLIKELY( err ) ) return err;
1220 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1221 0 : switch( tag ) {
1222 0 : case (ushort)fd_fee_rate_governor_target_lamports_per_signature_TAG: {
1223 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1224 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1225 0 : break;
1226 0 : }
1227 0 : case (ushort)fd_fee_rate_governor_target_signatures_per_slot_TAG: {
1228 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1229 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1230 0 : break;
1231 0 : }
1232 0 : case (ushort)fd_fee_rate_governor_min_lamports_per_signature_TAG: {
1233 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1234 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1235 0 : break;
1236 0 : }
1237 0 : case (ushort)fd_fee_rate_governor_max_lamports_per_signature_TAG: {
1238 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1239 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1240 0 : break;
1241 0 : }
1242 0 : case (ushort)fd_fee_rate_governor_burn_percent_TAG: {
1243 0 : err = fd_bincode_uint8_decode_preflight( ctx );
1244 0 : if( FD_UNLIKELY( err ) ) return err;
1245 0 : break;
1246 0 : }
1247 0 : default:
1248 0 : err = fd_archive_decode_skip_field( ctx, tag );
1249 0 : if( FD_UNLIKELY( err ) ) return err;
1250 0 : break;
1251 0 : }
1252 0 : }
1253 0 : return FD_BINCODE_SUCCESS;
1254 0 : }
1255 0 : void fd_fee_rate_governor_decode_archival_unsafe( fd_fee_rate_governor_t * self, fd_bincode_decode_ctx_t * ctx ) {
1256 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1257 0 : void * offset = NULL;
1258 0 : for(;;) {
1259 0 : fd_bincode_uint16_decode( &tag, ctx );
1260 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1261 0 : switch( tag ) {
1262 0 : case (ushort)fd_fee_rate_governor_target_lamports_per_signature_TAG: {
1263 0 : fd_bincode_uint64_decode_unsafe( &self->target_lamports_per_signature, ctx );
1264 0 : break;
1265 0 : }
1266 0 : case (ushort)fd_fee_rate_governor_target_signatures_per_slot_TAG: {
1267 0 : fd_bincode_uint64_decode_unsafe( &self->target_signatures_per_slot, ctx );
1268 0 : break;
1269 0 : }
1270 0 : case (ushort)fd_fee_rate_governor_min_lamports_per_signature_TAG: {
1271 0 : fd_bincode_uint64_decode_unsafe( &self->min_lamports_per_signature, ctx );
1272 0 : break;
1273 0 : }
1274 0 : case (ushort)fd_fee_rate_governor_max_lamports_per_signature_TAG: {
1275 0 : fd_bincode_uint64_decode_unsafe( &self->max_lamports_per_signature, ctx );
1276 0 : break;
1277 0 : }
1278 0 : case (ushort)fd_fee_rate_governor_burn_percent_TAG: {
1279 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
1280 0 : break;
1281 0 : }
1282 0 : default:
1283 0 : fd_archive_decode_skip_field( ctx, tag );
1284 0 : break;
1285 0 : }
1286 0 : }
1287 0 : }
1288 0 : int fd_fee_rate_governor_encode_archival( fd_fee_rate_governor_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1289 0 : int err;
1290 0 : void * offset = NULL;
1291 0 : err = fd_bincode_uint16_encode( (ushort)fd_fee_rate_governor_target_lamports_per_signature_TAG, ctx );
1292 0 : if( FD_UNLIKELY( err ) ) return err;
1293 0 : err = fd_bincode_uint64_encode( self->target_lamports_per_signature, ctx );
1294 0 : if( FD_UNLIKELY( err ) ) return err;
1295 0 : err = fd_bincode_uint16_encode( (ushort)fd_fee_rate_governor_target_signatures_per_slot_TAG, ctx );
1296 0 : if( FD_UNLIKELY( err ) ) return err;
1297 0 : err = fd_bincode_uint64_encode( self->target_signatures_per_slot, ctx );
1298 0 : if( FD_UNLIKELY( err ) ) return err;
1299 0 : err = fd_bincode_uint16_encode( (ushort)fd_fee_rate_governor_min_lamports_per_signature_TAG, ctx );
1300 0 : if( FD_UNLIKELY( err ) ) return err;
1301 0 : err = fd_bincode_uint64_encode( self->min_lamports_per_signature, ctx );
1302 0 : if( FD_UNLIKELY( err ) ) return err;
1303 0 : err = fd_bincode_uint16_encode( (ushort)fd_fee_rate_governor_max_lamports_per_signature_TAG, ctx );
1304 0 : if( FD_UNLIKELY( err ) ) return err;
1305 0 : err = fd_bincode_uint64_encode( self->max_lamports_per_signature, ctx );
1306 0 : if( FD_UNLIKELY( err ) ) return err;
1307 0 : err = fd_bincode_uint16_encode( (ushort)fd_fee_rate_governor_burn_percent_TAG, ctx );
1308 0 : if( FD_UNLIKELY( err ) ) return err;
1309 0 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
1310 0 : if( FD_UNLIKELY( err ) ) return err;
1311 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
1312 0 : if( FD_UNLIKELY( err ) ) return err;
1313 0 : return FD_BINCODE_SUCCESS;
1314 0 : }
1315 0 : int fd_fee_rate_governor_decode_offsets( fd_fee_rate_governor_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
1316 0 : uchar const * data = ctx->data;
1317 0 : int err;
1318 0 : self->target_lamports_per_signature_off = (uint)( (ulong)ctx->data - (ulong)data );
1319 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1320 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1321 0 : self->target_signatures_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
1322 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1323 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1324 0 : self->min_lamports_per_signature_off = (uint)( (ulong)ctx->data - (ulong)data );
1325 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1326 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1327 0 : self->max_lamports_per_signature_off = (uint)( (ulong)ctx->data - (ulong)data );
1328 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1329 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1330 0 : self->burn_percent_off = (uint)( (ulong)ctx->data - (ulong)data );
1331 0 : err = fd_bincode_uint8_decode_preflight( ctx );
1332 0 : if( FD_UNLIKELY( err ) ) return err;
1333 0 : return FD_BINCODE_SUCCESS;
1334 0 : }
1335 815736 : void fd_fee_rate_governor_new(fd_fee_rate_governor_t * self) {
1336 815736 : fd_memset( self, 0, sizeof(fd_fee_rate_governor_t) );
1337 815736 : }
1338 815718 : void fd_fee_rate_governor_destroy( fd_fee_rate_governor_t * self, fd_bincode_destroy_ctx_t * ctx ) {
1339 815718 : }
1340 :
1341 0 : ulong fd_fee_rate_governor_footprint( void ){ return FD_FEE_RATE_GOVERNOR_FOOTPRINT; }
1342 0 : ulong fd_fee_rate_governor_align( void ){ return FD_FEE_RATE_GOVERNOR_ALIGN; }
1343 :
1344 0 : void fd_fee_rate_governor_walk( void * w, fd_fee_rate_governor_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1345 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_rate_governor", level++ );
1346 0 : fun( w, &self->target_lamports_per_signature, "target_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1347 0 : fun( w, &self->target_signatures_per_slot, "target_signatures_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1348 0 : fun( w, &self->min_lamports_per_signature, "min_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1349 0 : fun( w, &self->max_lamports_per_signature, "max_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1350 0 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
1351 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_rate_governor", level-- );
1352 0 : }
1353 6 : ulong fd_fee_rate_governor_size( fd_fee_rate_governor_t const * self ) {
1354 6 : ulong size = 0;
1355 6 : size += sizeof(ulong);
1356 6 : size += sizeof(ulong);
1357 6 : size += sizeof(ulong);
1358 6 : size += sizeof(ulong);
1359 6 : size += sizeof(char);
1360 6 : return size;
1361 6 : }
1362 :
1363 0 : int fd_slot_pair_decode( fd_slot_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
1364 0 : void const * data = ctx->data;
1365 0 : int err = fd_slot_pair_decode_preflight( ctx );
1366 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1367 0 : ctx->data = data;
1368 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1369 0 : fd_slot_pair_new( self );
1370 0 : }
1371 0 : fd_slot_pair_decode_unsafe( self, ctx );
1372 0 : return FD_BINCODE_SUCCESS;
1373 0 : }
1374 0 : int fd_slot_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
1375 0 : return fd_bincode_bytes_decode_preflight( 16, ctx );
1376 0 : }
1377 0 : void fd_slot_pair_decode_unsafe( fd_slot_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
1378 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1379 0 : fd_bincode_uint64_decode_unsafe( &self->val, ctx );
1380 0 : }
1381 0 : int fd_slot_pair_encode( fd_slot_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1382 0 : int err;
1383 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1384 0 : if( FD_UNLIKELY( err ) ) return err;
1385 0 : err = fd_bincode_uint64_encode( self->val, ctx );
1386 0 : if( FD_UNLIKELY( err ) ) return err;
1387 0 : return FD_BINCODE_SUCCESS;
1388 0 : }
1389 : enum {
1390 : fd_slot_pair_slot_TAG = (0 << 6) | FD_ARCHIVE_META_ULONG,
1391 : fd_slot_pair_val_TAG = (1 << 6) | FD_ARCHIVE_META_ULONG,
1392 : };
1393 0 : int fd_slot_pair_decode_archival( fd_slot_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
1394 0 : void const * data = ctx->data;
1395 0 : int err = fd_slot_pair_decode_archival_preflight( ctx );
1396 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1397 0 : ctx->data = data;
1398 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1399 0 : fd_slot_pair_new( self );
1400 0 : }
1401 0 : fd_slot_pair_decode_archival_unsafe( self, ctx );
1402 0 : return FD_BINCODE_SUCCESS;
1403 0 : }
1404 0 : int fd_slot_pair_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
1405 0 : int err;
1406 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1407 0 : void * offset = NULL;
1408 0 : for(;;) {
1409 0 : err = fd_bincode_uint16_decode( &tag, ctx );
1410 0 : if( FD_UNLIKELY( err ) ) return err;
1411 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1412 0 : switch( tag ) {
1413 0 : case (ushort)fd_slot_pair_slot_TAG: {
1414 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1415 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1416 0 : break;
1417 0 : }
1418 0 : case (ushort)fd_slot_pair_val_TAG: {
1419 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1420 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1421 0 : break;
1422 0 : }
1423 0 : default:
1424 0 : err = fd_archive_decode_skip_field( ctx, tag );
1425 0 : if( FD_UNLIKELY( err ) ) return err;
1426 0 : break;
1427 0 : }
1428 0 : }
1429 0 : return FD_BINCODE_SUCCESS;
1430 0 : }
1431 0 : void fd_slot_pair_decode_archival_unsafe( fd_slot_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
1432 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1433 0 : void * offset = NULL;
1434 0 : for(;;) {
1435 0 : fd_bincode_uint16_decode( &tag, ctx );
1436 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1437 0 : switch( tag ) {
1438 0 : case (ushort)fd_slot_pair_slot_TAG: {
1439 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1440 0 : break;
1441 0 : }
1442 0 : case (ushort)fd_slot_pair_val_TAG: {
1443 0 : fd_bincode_uint64_decode_unsafe( &self->val, ctx );
1444 0 : break;
1445 0 : }
1446 0 : default:
1447 0 : fd_archive_decode_skip_field( ctx, tag );
1448 0 : break;
1449 0 : }
1450 0 : }
1451 0 : }
1452 0 : int fd_slot_pair_encode_archival( fd_slot_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1453 0 : int err;
1454 0 : void * offset = NULL;
1455 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_pair_slot_TAG, ctx );
1456 0 : if( FD_UNLIKELY( err ) ) return err;
1457 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1458 0 : if( FD_UNLIKELY( err ) ) return err;
1459 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_pair_val_TAG, ctx );
1460 0 : if( FD_UNLIKELY( err ) ) return err;
1461 0 : err = fd_bincode_uint64_encode( self->val, ctx );
1462 0 : if( FD_UNLIKELY( err ) ) return err;
1463 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
1464 0 : if( FD_UNLIKELY( err ) ) return err;
1465 0 : return FD_BINCODE_SUCCESS;
1466 0 : }
1467 0 : int fd_slot_pair_decode_offsets( fd_slot_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
1468 0 : uchar const * data = ctx->data;
1469 0 : int err;
1470 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
1471 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1472 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1473 0 : self->val_off = (uint)( (ulong)ctx->data - (ulong)data );
1474 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1475 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1476 0 : return FD_BINCODE_SUCCESS;
1477 0 : }
1478 0 : void fd_slot_pair_new(fd_slot_pair_t * self) {
1479 0 : fd_memset( self, 0, sizeof(fd_slot_pair_t) );
1480 0 : }
1481 0 : void fd_slot_pair_destroy( fd_slot_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
1482 0 : }
1483 :
1484 0 : ulong fd_slot_pair_footprint( void ){ return FD_SLOT_PAIR_FOOTPRINT; }
1485 0 : ulong fd_slot_pair_align( void ){ return FD_SLOT_PAIR_ALIGN; }
1486 :
1487 0 : void fd_slot_pair_walk( void * w, fd_slot_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1488 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_pair", level++ );
1489 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1490 0 : fun( w, &self->val, "val", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
1491 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_pair", level-- );
1492 0 : }
1493 0 : ulong fd_slot_pair_size( fd_slot_pair_t const * self ) {
1494 0 : ulong size = 0;
1495 0 : size += sizeof(ulong);
1496 0 : size += sizeof(ulong);
1497 0 : return size;
1498 0 : }
1499 :
1500 0 : int fd_hard_forks_decode( fd_hard_forks_t * self, fd_bincode_decode_ctx_t * ctx ) {
1501 0 : void const * data = ctx->data;
1502 0 : int err = fd_hard_forks_decode_preflight( ctx );
1503 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1504 0 : ctx->data = data;
1505 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1506 0 : fd_hard_forks_new( self );
1507 0 : }
1508 0 : fd_hard_forks_decode_unsafe( self, ctx );
1509 0 : return FD_BINCODE_SUCCESS;
1510 0 : }
1511 6 : int fd_hard_forks_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
1512 6 : int err;
1513 6 : ulong hard_forks_len;
1514 6 : err = fd_bincode_uint64_decode( &hard_forks_len, ctx );
1515 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1516 6 : if( hard_forks_len ) {
1517 0 : for( ulong i=0; i < hard_forks_len; i++ ) {
1518 0 : err = fd_slot_pair_decode_preflight( ctx );
1519 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1520 0 : }
1521 0 : }
1522 6 : return FD_BINCODE_SUCCESS;
1523 6 : }
1524 6 : void fd_hard_forks_decode_unsafe( fd_hard_forks_t * self, fd_bincode_decode_ctx_t * ctx ) {
1525 6 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
1526 6 : if( self->hard_forks_len ) {
1527 0 : self->hard_forks = (fd_slot_pair_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_PAIR_ALIGN, FD_SLOT_PAIR_FOOTPRINT*self->hard_forks_len );
1528 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
1529 0 : fd_slot_pair_new( self->hard_forks + i );
1530 0 : fd_slot_pair_decode_unsafe( self->hard_forks + i, ctx );
1531 0 : }
1532 0 : } else
1533 6 : self->hard_forks = NULL;
1534 6 : }
1535 6 : int fd_hard_forks_encode( fd_hard_forks_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1536 6 : int err;
1537 6 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
1538 6 : if( FD_UNLIKELY(err) ) return err;
1539 6 : if( self->hard_forks_len ) {
1540 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
1541 0 : err = fd_slot_pair_encode( self->hard_forks + i, ctx );
1542 0 : if( FD_UNLIKELY( err ) ) return err;
1543 0 : }
1544 0 : }
1545 6 : return FD_BINCODE_SUCCESS;
1546 6 : }
1547 : enum {
1548 : fd_hard_forks_hard_forks_TAG = (0 << 6) | FD_ARCHIVE_META_VECTOR,
1549 : };
1550 0 : int fd_hard_forks_decode_archival( fd_hard_forks_t * self, fd_bincode_decode_ctx_t * ctx ) {
1551 0 : void const * data = ctx->data;
1552 0 : int err = fd_hard_forks_decode_archival_preflight( ctx );
1553 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1554 0 : ctx->data = data;
1555 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1556 0 : fd_hard_forks_new( self );
1557 0 : }
1558 0 : fd_hard_forks_decode_archival_unsafe( self, ctx );
1559 0 : return FD_BINCODE_SUCCESS;
1560 0 : }
1561 0 : int fd_hard_forks_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
1562 0 : int err;
1563 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1564 0 : void * offset = NULL;
1565 0 : for(;;) {
1566 0 : err = fd_bincode_uint16_decode( &tag, ctx );
1567 0 : if( FD_UNLIKELY( err ) ) return err;
1568 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1569 0 : switch( tag ) {
1570 0 : case (ushort)fd_hard_forks_hard_forks_TAG: {
1571 0 : err = fd_archive_decode_setup_length( ctx, &offset );
1572 0 : if( FD_UNLIKELY( err ) ) return err;
1573 0 : ulong hard_forks_len;
1574 0 : err = fd_bincode_uint64_decode( &hard_forks_len, ctx );
1575 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1576 0 : if( hard_forks_len ) {
1577 0 : for( ulong i=0; i < hard_forks_len; i++ ) {
1578 0 : err = fd_slot_pair_decode_archival_preflight( ctx );
1579 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1580 0 : }
1581 0 : }
1582 0 : err = fd_archive_decode_check_length( ctx, offset );
1583 0 : if( FD_UNLIKELY( err ) ) return err;
1584 0 : break;
1585 0 : }
1586 0 : default:
1587 0 : err = fd_archive_decode_skip_field( ctx, tag );
1588 0 : if( FD_UNLIKELY( err ) ) return err;
1589 0 : break;
1590 0 : }
1591 0 : }
1592 0 : return FD_BINCODE_SUCCESS;
1593 0 : }
1594 0 : void fd_hard_forks_decode_archival_unsafe( fd_hard_forks_t * self, fd_bincode_decode_ctx_t * ctx ) {
1595 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1596 0 : void * offset = NULL;
1597 0 : for(;;) {
1598 0 : fd_bincode_uint16_decode( &tag, ctx );
1599 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1600 0 : switch( tag ) {
1601 0 : case (ushort)fd_hard_forks_hard_forks_TAG: {
1602 0 : fd_archive_decode_setup_length( ctx, &offset );
1603 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
1604 0 : if( self->hard_forks_len ) {
1605 0 : self->hard_forks = (fd_slot_pair_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_PAIR_ALIGN, FD_SLOT_PAIR_FOOTPRINT*self->hard_forks_len );
1606 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
1607 0 : fd_slot_pair_new( self->hard_forks + i );
1608 0 : fd_slot_pair_decode_archival_unsafe( self->hard_forks + i, ctx );
1609 0 : }
1610 0 : } else
1611 0 : self->hard_forks = NULL;
1612 0 : break;
1613 0 : }
1614 0 : default:
1615 0 : fd_archive_decode_skip_field( ctx, tag );
1616 0 : break;
1617 0 : }
1618 0 : }
1619 0 : }
1620 0 : int fd_hard_forks_encode_archival( fd_hard_forks_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1621 0 : int err;
1622 0 : void * offset = NULL;
1623 0 : err = fd_bincode_uint16_encode( (ushort)fd_hard_forks_hard_forks_TAG, ctx );
1624 0 : if( FD_UNLIKELY( err ) ) return err;
1625 0 : err = fd_archive_encode_setup_length( ctx, &offset );
1626 0 : if( FD_UNLIKELY( err ) ) return err;
1627 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
1628 0 : if( FD_UNLIKELY(err) ) return err;
1629 0 : if( self->hard_forks_len ) {
1630 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
1631 0 : err = fd_slot_pair_encode_archival( self->hard_forks + i, ctx );
1632 0 : if( FD_UNLIKELY( err ) ) return err;
1633 0 : }
1634 0 : }
1635 0 : err = fd_archive_encode_set_length( ctx, offset );
1636 0 : if( FD_UNLIKELY( err ) ) return err;
1637 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
1638 0 : if( FD_UNLIKELY( err ) ) return err;
1639 0 : return FD_BINCODE_SUCCESS;
1640 0 : }
1641 0 : int fd_hard_forks_decode_offsets( fd_hard_forks_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
1642 0 : uchar const * data = ctx->data;
1643 0 : int err;
1644 0 : self->hard_forks_off = (uint)( (ulong)ctx->data - (ulong)data );
1645 0 : ulong hard_forks_len;
1646 0 : err = fd_bincode_uint64_decode( &hard_forks_len, ctx );
1647 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1648 0 : if( hard_forks_len ) {
1649 0 : for( ulong i=0; i < hard_forks_len; i++ ) {
1650 0 : err = fd_slot_pair_decode_preflight( ctx );
1651 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1652 0 : }
1653 0 : }
1654 0 : return FD_BINCODE_SUCCESS;
1655 0 : }
1656 815724 : void fd_hard_forks_new(fd_hard_forks_t * self) {
1657 815724 : fd_memset( self, 0, sizeof(fd_hard_forks_t) );
1658 815724 : }
1659 815718 : void fd_hard_forks_destroy( fd_hard_forks_t * self, fd_bincode_destroy_ctx_t * ctx ) {
1660 815718 : if( self->hard_forks ) {
1661 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
1662 0 : fd_slot_pair_destroy( self->hard_forks + i, ctx );
1663 0 : fd_valloc_free( ctx->valloc, self->hard_forks );
1664 0 : self->hard_forks = NULL;
1665 0 : }
1666 815718 : }
1667 :
1668 0 : ulong fd_hard_forks_footprint( void ){ return FD_HARD_FORKS_FOOTPRINT; }
1669 0 : ulong fd_hard_forks_align( void ){ return FD_HARD_FORKS_ALIGN; }
1670 :
1671 0 : void fd_hard_forks_walk( void * w, fd_hard_forks_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1672 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hard_forks", level++ );
1673 0 : if( self->hard_forks_len ) {
1674 0 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR, "array", level++ );
1675 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
1676 0 : fd_slot_pair_walk(w, self->hard_forks + i, fun, "slot_pair", level );
1677 0 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
1678 0 : }
1679 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hard_forks", level-- );
1680 0 : }
1681 6 : ulong fd_hard_forks_size( fd_hard_forks_t const * self ) {
1682 6 : ulong size = 0;
1683 6 : do {
1684 6 : size += sizeof(ulong);
1685 6 : for( ulong i=0; i < self->hard_forks_len; i++ )
1686 0 : size += fd_slot_pair_size( self->hard_forks + i );
1687 6 : } while(0);
1688 6 : return size;
1689 6 : }
1690 :
1691 0 : int fd_inflation_decode( fd_inflation_t * self, fd_bincode_decode_ctx_t * ctx ) {
1692 0 : void const * data = ctx->data;
1693 0 : int err = fd_inflation_decode_preflight( ctx );
1694 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1695 0 : ctx->data = data;
1696 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1697 0 : fd_inflation_new( self );
1698 0 : }
1699 0 : fd_inflation_decode_unsafe( self, ctx );
1700 0 : return FD_BINCODE_SUCCESS;
1701 0 : }
1702 6 : int fd_inflation_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
1703 6 : return fd_bincode_bytes_decode_preflight( 48, ctx );
1704 6 : }
1705 6 : void fd_inflation_decode_unsafe( fd_inflation_t * self, fd_bincode_decode_ctx_t * ctx ) {
1706 6 : fd_bincode_double_decode_unsafe( &self->initial, ctx );
1707 6 : fd_bincode_double_decode_unsafe( &self->terminal, ctx );
1708 6 : fd_bincode_double_decode_unsafe( &self->taper, ctx );
1709 6 : fd_bincode_double_decode_unsafe( &self->foundation, ctx );
1710 6 : fd_bincode_double_decode_unsafe( &self->foundation_term, ctx );
1711 6 : fd_bincode_double_decode_unsafe( &self->unused, ctx );
1712 6 : }
1713 15 : int fd_inflation_encode( fd_inflation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1714 15 : int err;
1715 15 : err = fd_bincode_double_encode( self->initial, ctx );
1716 15 : if( FD_UNLIKELY( err ) ) return err;
1717 15 : err = fd_bincode_double_encode( self->terminal, ctx );
1718 15 : if( FD_UNLIKELY( err ) ) return err;
1719 15 : err = fd_bincode_double_encode( self->taper, ctx );
1720 15 : if( FD_UNLIKELY( err ) ) return err;
1721 15 : err = fd_bincode_double_encode( self->foundation, ctx );
1722 15 : if( FD_UNLIKELY( err ) ) return err;
1723 15 : err = fd_bincode_double_encode( self->foundation_term, ctx );
1724 15 : if( FD_UNLIKELY( err ) ) return err;
1725 15 : err = fd_bincode_double_encode( self->unused, ctx );
1726 15 : if( FD_UNLIKELY( err ) ) return err;
1727 15 : return FD_BINCODE_SUCCESS;
1728 15 : }
1729 : enum {
1730 : fd_inflation_initial_TAG = (0 << 6) | FD_ARCHIVE_META_DOUBLE,
1731 : fd_inflation_terminal_TAG = (1 << 6) | FD_ARCHIVE_META_DOUBLE,
1732 : fd_inflation_taper_TAG = (2 << 6) | FD_ARCHIVE_META_DOUBLE,
1733 : fd_inflation_foundation_TAG = (3 << 6) | FD_ARCHIVE_META_DOUBLE,
1734 : fd_inflation_foundation_term_TAG = (4 << 6) | FD_ARCHIVE_META_DOUBLE,
1735 : fd_inflation_unused_TAG = (5 << 6) | FD_ARCHIVE_META_DOUBLE,
1736 : };
1737 0 : int fd_inflation_decode_archival( fd_inflation_t * self, fd_bincode_decode_ctx_t * ctx ) {
1738 0 : void const * data = ctx->data;
1739 0 : int err = fd_inflation_decode_archival_preflight( ctx );
1740 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1741 0 : ctx->data = data;
1742 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1743 0 : fd_inflation_new( self );
1744 0 : }
1745 0 : fd_inflation_decode_archival_unsafe( self, ctx );
1746 0 : return FD_BINCODE_SUCCESS;
1747 0 : }
1748 0 : int fd_inflation_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
1749 0 : int err;
1750 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1751 0 : void * offset = NULL;
1752 0 : for(;;) {
1753 0 : err = fd_bincode_uint16_decode( &tag, ctx );
1754 0 : if( FD_UNLIKELY( err ) ) return err;
1755 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1756 0 : switch( tag ) {
1757 0 : case (ushort)fd_inflation_initial_TAG: {
1758 0 : err = fd_bincode_double_decode_preflight( ctx );
1759 0 : if( FD_UNLIKELY( err ) ) return err;
1760 0 : break;
1761 0 : }
1762 0 : case (ushort)fd_inflation_terminal_TAG: {
1763 0 : err = fd_bincode_double_decode_preflight( ctx );
1764 0 : if( FD_UNLIKELY( err ) ) return err;
1765 0 : break;
1766 0 : }
1767 0 : case (ushort)fd_inflation_taper_TAG: {
1768 0 : err = fd_bincode_double_decode_preflight( ctx );
1769 0 : if( FD_UNLIKELY( err ) ) return err;
1770 0 : break;
1771 0 : }
1772 0 : case (ushort)fd_inflation_foundation_TAG: {
1773 0 : err = fd_bincode_double_decode_preflight( ctx );
1774 0 : if( FD_UNLIKELY( err ) ) return err;
1775 0 : break;
1776 0 : }
1777 0 : case (ushort)fd_inflation_foundation_term_TAG: {
1778 0 : err = fd_bincode_double_decode_preflight( ctx );
1779 0 : if( FD_UNLIKELY( err ) ) return err;
1780 0 : break;
1781 0 : }
1782 0 : case (ushort)fd_inflation_unused_TAG: {
1783 0 : err = fd_bincode_double_decode_preflight( ctx );
1784 0 : if( FD_UNLIKELY( err ) ) return err;
1785 0 : break;
1786 0 : }
1787 0 : default:
1788 0 : err = fd_archive_decode_skip_field( ctx, tag );
1789 0 : if( FD_UNLIKELY( err ) ) return err;
1790 0 : break;
1791 0 : }
1792 0 : }
1793 0 : return FD_BINCODE_SUCCESS;
1794 0 : }
1795 0 : void fd_inflation_decode_archival_unsafe( fd_inflation_t * self, fd_bincode_decode_ctx_t * ctx ) {
1796 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1797 0 : void * offset = NULL;
1798 0 : for(;;) {
1799 0 : fd_bincode_uint16_decode( &tag, ctx );
1800 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1801 0 : switch( tag ) {
1802 0 : case (ushort)fd_inflation_initial_TAG: {
1803 0 : fd_bincode_double_decode_unsafe( &self->initial, ctx );
1804 0 : break;
1805 0 : }
1806 0 : case (ushort)fd_inflation_terminal_TAG: {
1807 0 : fd_bincode_double_decode_unsafe( &self->terminal, ctx );
1808 0 : break;
1809 0 : }
1810 0 : case (ushort)fd_inflation_taper_TAG: {
1811 0 : fd_bincode_double_decode_unsafe( &self->taper, ctx );
1812 0 : break;
1813 0 : }
1814 0 : case (ushort)fd_inflation_foundation_TAG: {
1815 0 : fd_bincode_double_decode_unsafe( &self->foundation, ctx );
1816 0 : break;
1817 0 : }
1818 0 : case (ushort)fd_inflation_foundation_term_TAG: {
1819 0 : fd_bincode_double_decode_unsafe( &self->foundation_term, ctx );
1820 0 : break;
1821 0 : }
1822 0 : case (ushort)fd_inflation_unused_TAG: {
1823 0 : fd_bincode_double_decode_unsafe( &self->unused, ctx );
1824 0 : break;
1825 0 : }
1826 0 : default:
1827 0 : fd_archive_decode_skip_field( ctx, tag );
1828 0 : break;
1829 0 : }
1830 0 : }
1831 0 : }
1832 0 : int fd_inflation_encode_archival( fd_inflation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1833 0 : int err;
1834 0 : void * offset = NULL;
1835 0 : err = fd_bincode_uint16_encode( (ushort)fd_inflation_initial_TAG, ctx );
1836 0 : if( FD_UNLIKELY( err ) ) return err;
1837 0 : err = fd_bincode_double_encode( self->initial, ctx );
1838 0 : if( FD_UNLIKELY( err ) ) return err;
1839 0 : err = fd_bincode_uint16_encode( (ushort)fd_inflation_terminal_TAG, ctx );
1840 0 : if( FD_UNLIKELY( err ) ) return err;
1841 0 : err = fd_bincode_double_encode( self->terminal, ctx );
1842 0 : if( FD_UNLIKELY( err ) ) return err;
1843 0 : err = fd_bincode_uint16_encode( (ushort)fd_inflation_taper_TAG, ctx );
1844 0 : if( FD_UNLIKELY( err ) ) return err;
1845 0 : err = fd_bincode_double_encode( self->taper, ctx );
1846 0 : if( FD_UNLIKELY( err ) ) return err;
1847 0 : err = fd_bincode_uint16_encode( (ushort)fd_inflation_foundation_TAG, ctx );
1848 0 : if( FD_UNLIKELY( err ) ) return err;
1849 0 : err = fd_bincode_double_encode( self->foundation, ctx );
1850 0 : if( FD_UNLIKELY( err ) ) return err;
1851 0 : err = fd_bincode_uint16_encode( (ushort)fd_inflation_foundation_term_TAG, ctx );
1852 0 : if( FD_UNLIKELY( err ) ) return err;
1853 0 : err = fd_bincode_double_encode( self->foundation_term, ctx );
1854 0 : if( FD_UNLIKELY( err ) ) return err;
1855 0 : err = fd_bincode_uint16_encode( (ushort)fd_inflation_unused_TAG, ctx );
1856 0 : if( FD_UNLIKELY( err ) ) return err;
1857 0 : err = fd_bincode_double_encode( self->unused, ctx );
1858 0 : if( FD_UNLIKELY( err ) ) return err;
1859 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
1860 0 : if( FD_UNLIKELY( err ) ) return err;
1861 0 : return FD_BINCODE_SUCCESS;
1862 0 : }
1863 0 : int fd_inflation_decode_offsets( fd_inflation_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
1864 0 : uchar const * data = ctx->data;
1865 0 : int err;
1866 0 : self->initial_off = (uint)( (ulong)ctx->data - (ulong)data );
1867 0 : err = fd_bincode_double_decode_preflight( ctx );
1868 0 : if( FD_UNLIKELY( err ) ) return err;
1869 0 : self->terminal_off = (uint)( (ulong)ctx->data - (ulong)data );
1870 0 : err = fd_bincode_double_decode_preflight( ctx );
1871 0 : if( FD_UNLIKELY( err ) ) return err;
1872 0 : self->taper_off = (uint)( (ulong)ctx->data - (ulong)data );
1873 0 : err = fd_bincode_double_decode_preflight( ctx );
1874 0 : if( FD_UNLIKELY( err ) ) return err;
1875 0 : self->foundation_off = (uint)( (ulong)ctx->data - (ulong)data );
1876 0 : err = fd_bincode_double_decode_preflight( ctx );
1877 0 : if( FD_UNLIKELY( err ) ) return err;
1878 0 : self->foundation_term_off = (uint)( (ulong)ctx->data - (ulong)data );
1879 0 : err = fd_bincode_double_decode_preflight( ctx );
1880 0 : if( FD_UNLIKELY( err ) ) return err;
1881 0 : self->unused_off = (uint)( (ulong)ctx->data - (ulong)data );
1882 0 : err = fd_bincode_double_decode_preflight( ctx );
1883 0 : if( FD_UNLIKELY( err ) ) return err;
1884 0 : return FD_BINCODE_SUCCESS;
1885 0 : }
1886 407877 : void fd_inflation_new(fd_inflation_t * self) {
1887 407877 : fd_memset( self, 0, sizeof(fd_inflation_t) );
1888 407877 : }
1889 0 : void fd_inflation_destroy( fd_inflation_t * self, fd_bincode_destroy_ctx_t * ctx ) {
1890 0 : }
1891 :
1892 0 : ulong fd_inflation_footprint( void ){ return FD_INFLATION_FOOTPRINT; }
1893 0 : ulong fd_inflation_align( void ){ return FD_INFLATION_ALIGN; }
1894 :
1895 0 : void fd_inflation_walk( void * w, fd_inflation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
1896 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_inflation", level++ );
1897 0 : fun( w, &self->initial, "initial", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1898 0 : fun( w, &self->terminal, "terminal", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1899 0 : fun( w, &self->taper, "taper", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1900 0 : fun( w, &self->foundation, "foundation", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1901 0 : fun( w, &self->foundation_term, "foundation_term", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1902 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
1903 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_inflation", level-- );
1904 0 : }
1905 6 : ulong fd_inflation_size( fd_inflation_t const * self ) {
1906 6 : ulong size = 0;
1907 6 : size += sizeof(double);
1908 6 : size += sizeof(double);
1909 6 : size += sizeof(double);
1910 6 : size += sizeof(double);
1911 6 : size += sizeof(double);
1912 6 : size += sizeof(double);
1913 6 : return size;
1914 6 : }
1915 :
1916 30027 : int fd_rent_decode( fd_rent_t * self, fd_bincode_decode_ctx_t * ctx ) {
1917 30027 : void const * data = ctx->data;
1918 30027 : int err = fd_rent_decode_preflight( ctx );
1919 30027 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1920 29985 : ctx->data = data;
1921 29985 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1922 29985 : fd_rent_new( self );
1923 29985 : }
1924 29985 : fd_rent_decode_unsafe( self, ctx );
1925 29985 : return FD_BINCODE_SUCCESS;
1926 30027 : }
1927 30033 : int fd_rent_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
1928 30033 : return fd_bincode_bytes_decode_preflight( 17, ctx );
1929 30033 : }
1930 29991 : void fd_rent_decode_unsafe( fd_rent_t * self, fd_bincode_decode_ctx_t * ctx ) {
1931 29991 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
1932 29991 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
1933 29991 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
1934 29991 : }
1935 12756 : int fd_rent_encode( fd_rent_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1936 12756 : int err;
1937 12756 : err = fd_bincode_uint64_encode( self->lamports_per_uint8_year, ctx );
1938 12756 : if( FD_UNLIKELY( err ) ) return err;
1939 12756 : err = fd_bincode_double_encode( self->exemption_threshold, ctx );
1940 12756 : if( FD_UNLIKELY( err ) ) return err;
1941 12756 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
1942 12756 : if( FD_UNLIKELY( err ) ) return err;
1943 12756 : return FD_BINCODE_SUCCESS;
1944 12756 : }
1945 : enum {
1946 : fd_rent_lamports_per_uint8_year_TAG = (0 << 6) | FD_ARCHIVE_META_ULONG,
1947 : fd_rent_exemption_threshold_TAG = (1 << 6) | FD_ARCHIVE_META_DOUBLE,
1948 : fd_rent_burn_percent_TAG = (2 << 6) | FD_ARCHIVE_META_UCHAR,
1949 : };
1950 0 : int fd_rent_decode_archival( fd_rent_t * self, fd_bincode_decode_ctx_t * ctx ) {
1951 0 : void const * data = ctx->data;
1952 0 : int err = fd_rent_decode_archival_preflight( ctx );
1953 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1954 0 : ctx->data = data;
1955 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
1956 0 : fd_rent_new( self );
1957 0 : }
1958 0 : fd_rent_decode_archival_unsafe( self, ctx );
1959 0 : return FD_BINCODE_SUCCESS;
1960 0 : }
1961 0 : int fd_rent_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
1962 0 : int err;
1963 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1964 0 : void * offset = NULL;
1965 0 : for(;;) {
1966 0 : err = fd_bincode_uint16_decode( &tag, ctx );
1967 0 : if( FD_UNLIKELY( err ) ) return err;
1968 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1969 0 : switch( tag ) {
1970 0 : case (ushort)fd_rent_lamports_per_uint8_year_TAG: {
1971 0 : err = fd_bincode_uint64_decode_preflight( ctx );
1972 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1973 0 : break;
1974 0 : }
1975 0 : case (ushort)fd_rent_exemption_threshold_TAG: {
1976 0 : err = fd_bincode_double_decode_preflight( ctx );
1977 0 : if( FD_UNLIKELY( err ) ) return err;
1978 0 : break;
1979 0 : }
1980 0 : case (ushort)fd_rent_burn_percent_TAG: {
1981 0 : err = fd_bincode_uint8_decode_preflight( ctx );
1982 0 : if( FD_UNLIKELY( err ) ) return err;
1983 0 : break;
1984 0 : }
1985 0 : default:
1986 0 : err = fd_archive_decode_skip_field( ctx, tag );
1987 0 : if( FD_UNLIKELY( err ) ) return err;
1988 0 : break;
1989 0 : }
1990 0 : }
1991 0 : return FD_BINCODE_SUCCESS;
1992 0 : }
1993 0 : void fd_rent_decode_archival_unsafe( fd_rent_t * self, fd_bincode_decode_ctx_t * ctx ) {
1994 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
1995 0 : void * offset = NULL;
1996 0 : for(;;) {
1997 0 : fd_bincode_uint16_decode( &tag, ctx );
1998 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
1999 0 : switch( tag ) {
2000 0 : case (ushort)fd_rent_lamports_per_uint8_year_TAG: {
2001 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
2002 0 : break;
2003 0 : }
2004 0 : case (ushort)fd_rent_exemption_threshold_TAG: {
2005 0 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
2006 0 : break;
2007 0 : }
2008 0 : case (ushort)fd_rent_burn_percent_TAG: {
2009 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
2010 0 : break;
2011 0 : }
2012 0 : default:
2013 0 : fd_archive_decode_skip_field( ctx, tag );
2014 0 : break;
2015 0 : }
2016 0 : }
2017 0 : }
2018 0 : int fd_rent_encode_archival( fd_rent_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2019 0 : int err;
2020 0 : void * offset = NULL;
2021 0 : err = fd_bincode_uint16_encode( (ushort)fd_rent_lamports_per_uint8_year_TAG, ctx );
2022 0 : if( FD_UNLIKELY( err ) ) return err;
2023 0 : err = fd_bincode_uint64_encode( self->lamports_per_uint8_year, ctx );
2024 0 : if( FD_UNLIKELY( err ) ) return err;
2025 0 : err = fd_bincode_uint16_encode( (ushort)fd_rent_exemption_threshold_TAG, ctx );
2026 0 : if( FD_UNLIKELY( err ) ) return err;
2027 0 : err = fd_bincode_double_encode( self->exemption_threshold, ctx );
2028 0 : if( FD_UNLIKELY( err ) ) return err;
2029 0 : err = fd_bincode_uint16_encode( (ushort)fd_rent_burn_percent_TAG, ctx );
2030 0 : if( FD_UNLIKELY( err ) ) return err;
2031 0 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
2032 0 : if( FD_UNLIKELY( err ) ) return err;
2033 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
2034 0 : if( FD_UNLIKELY( err ) ) return err;
2035 0 : return FD_BINCODE_SUCCESS;
2036 0 : }
2037 0 : int fd_rent_decode_offsets( fd_rent_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
2038 0 : uchar const * data = ctx->data;
2039 0 : int err;
2040 0 : self->lamports_per_uint8_year_off = (uint)( (ulong)ctx->data - (ulong)data );
2041 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2042 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2043 0 : self->exemption_threshold_off = (uint)( (ulong)ctx->data - (ulong)data );
2044 0 : err = fd_bincode_double_decode_preflight( ctx );
2045 0 : if( FD_UNLIKELY( err ) ) return err;
2046 0 : self->burn_percent_off = (uint)( (ulong)ctx->data - (ulong)data );
2047 0 : err = fd_bincode_uint8_decode_preflight( ctx );
2048 0 : if( FD_UNLIKELY( err ) ) return err;
2049 0 : return FD_BINCODE_SUCCESS;
2050 0 : }
2051 437862 : void fd_rent_new(fd_rent_t * self) {
2052 437862 : fd_memset( self, 0, sizeof(fd_rent_t) );
2053 437862 : }
2054 437886 : void fd_rent_destroy( fd_rent_t * self, fd_bincode_destroy_ctx_t * ctx ) {
2055 437886 : }
2056 :
2057 0 : ulong fd_rent_footprint( void ){ return FD_RENT_FOOTPRINT; }
2058 0 : ulong fd_rent_align( void ){ return FD_RENT_ALIGN; }
2059 :
2060 0 : void fd_rent_walk( void * w, fd_rent_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2061 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent", level++ );
2062 0 : fun( w, &self->lamports_per_uint8_year, "lamports_per_uint8_year", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2063 0 : fun( w, &self->exemption_threshold, "exemption_threshold", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
2064 0 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
2065 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent", level-- );
2066 0 : }
2067 12747 : ulong fd_rent_size( fd_rent_t const * self ) {
2068 12747 : ulong size = 0;
2069 12747 : size += sizeof(ulong);
2070 12747 : size += sizeof(double);
2071 12747 : size += sizeof(char);
2072 12747 : return size;
2073 12747 : }
2074 :
2075 25266 : int fd_epoch_schedule_decode( fd_epoch_schedule_t * self, fd_bincode_decode_ctx_t * ctx ) {
2076 25266 : void const * data = ctx->data;
2077 25266 : int err = fd_epoch_schedule_decode_preflight( ctx );
2078 25266 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2079 24543 : ctx->data = data;
2080 24543 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2081 24543 : fd_epoch_schedule_new( self );
2082 24543 : }
2083 24543 : fd_epoch_schedule_decode_unsafe( self, ctx );
2084 24543 : return FD_BINCODE_SUCCESS;
2085 25266 : }
2086 25278 : int fd_epoch_schedule_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
2087 25278 : int err;
2088 25278 : err = fd_bincode_uint64_decode_preflight( ctx );
2089 25278 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2090 25230 : err = fd_bincode_uint64_decode_preflight( ctx );
2091 25230 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2092 25218 : err = fd_bincode_bool_decode_preflight( ctx );
2093 25218 : if( FD_UNLIKELY( err ) ) return err;
2094 24567 : err = fd_bincode_uint64_decode_preflight( ctx );
2095 24567 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2096 24561 : err = fd_bincode_uint64_decode_preflight( ctx );
2097 24561 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2098 24555 : return FD_BINCODE_SUCCESS;
2099 24561 : }
2100 24555 : void fd_epoch_schedule_decode_unsafe( fd_epoch_schedule_t * self, fd_bincode_decode_ctx_t * ctx ) {
2101 24555 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
2102 24555 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
2103 24555 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
2104 24555 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
2105 24555 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
2106 24555 : }
2107 12762 : int fd_epoch_schedule_encode( fd_epoch_schedule_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2108 12762 : int err;
2109 12762 : err = fd_bincode_uint64_encode( self->slots_per_epoch, ctx );
2110 12762 : if( FD_UNLIKELY( err ) ) return err;
2111 12762 : err = fd_bincode_uint64_encode( self->leader_schedule_slot_offset, ctx );
2112 12762 : if( FD_UNLIKELY( err ) ) return err;
2113 12762 : err = fd_bincode_bool_encode( (uchar)(self->warmup), ctx );
2114 12762 : if( FD_UNLIKELY( err ) ) return err;
2115 12762 : err = fd_bincode_uint64_encode( self->first_normal_epoch, ctx );
2116 12762 : if( FD_UNLIKELY( err ) ) return err;
2117 12762 : err = fd_bincode_uint64_encode( self->first_normal_slot, ctx );
2118 12762 : if( FD_UNLIKELY( err ) ) return err;
2119 12762 : return FD_BINCODE_SUCCESS;
2120 12762 : }
2121 : enum {
2122 : fd_epoch_schedule_slots_per_epoch_TAG = (0 << 6) | FD_ARCHIVE_META_ULONG,
2123 : fd_epoch_schedule_leader_schedule_slot_offset_TAG = (1 << 6) | FD_ARCHIVE_META_ULONG,
2124 : fd_epoch_schedule_warmup_TAG = (2 << 6) | FD_ARCHIVE_META_BOOL,
2125 : fd_epoch_schedule_first_normal_epoch_TAG = (3 << 6) | FD_ARCHIVE_META_ULONG,
2126 : fd_epoch_schedule_first_normal_slot_TAG = (4 << 6) | FD_ARCHIVE_META_ULONG,
2127 : };
2128 0 : int fd_epoch_schedule_decode_archival( fd_epoch_schedule_t * self, fd_bincode_decode_ctx_t * ctx ) {
2129 0 : void const * data = ctx->data;
2130 0 : int err = fd_epoch_schedule_decode_archival_preflight( ctx );
2131 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2132 0 : ctx->data = data;
2133 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2134 0 : fd_epoch_schedule_new( self );
2135 0 : }
2136 0 : fd_epoch_schedule_decode_archival_unsafe( self, ctx );
2137 0 : return FD_BINCODE_SUCCESS;
2138 0 : }
2139 0 : int fd_epoch_schedule_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
2140 0 : int err;
2141 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
2142 0 : void * offset = NULL;
2143 0 : for(;;) {
2144 0 : err = fd_bincode_uint16_decode( &tag, ctx );
2145 0 : if( FD_UNLIKELY( err ) ) return err;
2146 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
2147 0 : switch( tag ) {
2148 0 : case (ushort)fd_epoch_schedule_slots_per_epoch_TAG: {
2149 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2150 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2151 0 : break;
2152 0 : }
2153 0 : case (ushort)fd_epoch_schedule_leader_schedule_slot_offset_TAG: {
2154 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2155 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2156 0 : break;
2157 0 : }
2158 0 : case (ushort)fd_epoch_schedule_warmup_TAG: {
2159 0 : err = fd_bincode_bool_decode_preflight( ctx );
2160 0 : if( FD_UNLIKELY( err ) ) return err;
2161 0 : break;
2162 0 : }
2163 0 : case (ushort)fd_epoch_schedule_first_normal_epoch_TAG: {
2164 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2165 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2166 0 : break;
2167 0 : }
2168 0 : case (ushort)fd_epoch_schedule_first_normal_slot_TAG: {
2169 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2170 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2171 0 : break;
2172 0 : }
2173 0 : default:
2174 0 : err = fd_archive_decode_skip_field( ctx, tag );
2175 0 : if( FD_UNLIKELY( err ) ) return err;
2176 0 : break;
2177 0 : }
2178 0 : }
2179 0 : return FD_BINCODE_SUCCESS;
2180 0 : }
2181 0 : void fd_epoch_schedule_decode_archival_unsafe( fd_epoch_schedule_t * self, fd_bincode_decode_ctx_t * ctx ) {
2182 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
2183 0 : void * offset = NULL;
2184 0 : for(;;) {
2185 0 : fd_bincode_uint16_decode( &tag, ctx );
2186 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
2187 0 : switch( tag ) {
2188 0 : case (ushort)fd_epoch_schedule_slots_per_epoch_TAG: {
2189 0 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
2190 0 : break;
2191 0 : }
2192 0 : case (ushort)fd_epoch_schedule_leader_schedule_slot_offset_TAG: {
2193 0 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
2194 0 : break;
2195 0 : }
2196 0 : case (ushort)fd_epoch_schedule_warmup_TAG: {
2197 0 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
2198 0 : break;
2199 0 : }
2200 0 : case (ushort)fd_epoch_schedule_first_normal_epoch_TAG: {
2201 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
2202 0 : break;
2203 0 : }
2204 0 : case (ushort)fd_epoch_schedule_first_normal_slot_TAG: {
2205 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
2206 0 : break;
2207 0 : }
2208 0 : default:
2209 0 : fd_archive_decode_skip_field( ctx, tag );
2210 0 : break;
2211 0 : }
2212 0 : }
2213 0 : }
2214 0 : int fd_epoch_schedule_encode_archival( fd_epoch_schedule_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2215 0 : int err;
2216 0 : void * offset = NULL;
2217 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_schedule_slots_per_epoch_TAG, ctx );
2218 0 : if( FD_UNLIKELY( err ) ) return err;
2219 0 : err = fd_bincode_uint64_encode( self->slots_per_epoch, ctx );
2220 0 : if( FD_UNLIKELY( err ) ) return err;
2221 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_schedule_leader_schedule_slot_offset_TAG, ctx );
2222 0 : if( FD_UNLIKELY( err ) ) return err;
2223 0 : err = fd_bincode_uint64_encode( self->leader_schedule_slot_offset, ctx );
2224 0 : if( FD_UNLIKELY( err ) ) return err;
2225 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_schedule_warmup_TAG, ctx );
2226 0 : if( FD_UNLIKELY( err ) ) return err;
2227 0 : err = fd_bincode_bool_encode( (uchar)(self->warmup), ctx );
2228 0 : if( FD_UNLIKELY( err ) ) return err;
2229 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_schedule_first_normal_epoch_TAG, ctx );
2230 0 : if( FD_UNLIKELY( err ) ) return err;
2231 0 : err = fd_bincode_uint64_encode( self->first_normal_epoch, ctx );
2232 0 : if( FD_UNLIKELY( err ) ) return err;
2233 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_schedule_first_normal_slot_TAG, ctx );
2234 0 : if( FD_UNLIKELY( err ) ) return err;
2235 0 : err = fd_bincode_uint64_encode( self->first_normal_slot, ctx );
2236 0 : if( FD_UNLIKELY( err ) ) return err;
2237 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
2238 0 : if( FD_UNLIKELY( err ) ) return err;
2239 0 : return FD_BINCODE_SUCCESS;
2240 0 : }
2241 0 : int fd_epoch_schedule_decode_offsets( fd_epoch_schedule_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
2242 0 : uchar const * data = ctx->data;
2243 0 : int err;
2244 0 : self->slots_per_epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
2245 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2246 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2247 0 : self->leader_schedule_slot_offset_off = (uint)( (ulong)ctx->data - (ulong)data );
2248 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2249 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2250 0 : self->warmup_off = (uint)( (ulong)ctx->data - (ulong)data );
2251 0 : err = fd_bincode_bool_decode_preflight( ctx );
2252 0 : if( FD_UNLIKELY( err ) ) return err;
2253 0 : self->first_normal_epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
2254 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2255 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2256 0 : self->first_normal_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
2257 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2258 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2259 0 : return FD_BINCODE_SUCCESS;
2260 0 : }
2261 840291 : void fd_epoch_schedule_new(fd_epoch_schedule_t * self) {
2262 840291 : fd_memset( self, 0, sizeof(fd_epoch_schedule_t) );
2263 840291 : }
2264 433125 : void fd_epoch_schedule_destroy( fd_epoch_schedule_t * self, fd_bincode_destroy_ctx_t * ctx ) {
2265 433125 : }
2266 :
2267 0 : ulong fd_epoch_schedule_footprint( void ){ return FD_EPOCH_SCHEDULE_FOOTPRINT; }
2268 0 : ulong fd_epoch_schedule_align( void ){ return FD_EPOCH_SCHEDULE_ALIGN; }
2269 :
2270 0 : void fd_epoch_schedule_walk( void * w, fd_epoch_schedule_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2271 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_schedule", level++ );
2272 0 : fun( w, &self->slots_per_epoch, "slots_per_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2273 0 : fun( w, &self->leader_schedule_slot_offset, "leader_schedule_slot_offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2274 0 : fun( w, &self->warmup, "warmup", FD_FLAMENCO_TYPE_BOOL, "bool", level );
2275 0 : fun( w, &self->first_normal_epoch, "first_normal_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2276 0 : fun( w, &self->first_normal_slot, "first_normal_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2277 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_schedule", level-- );
2278 0 : }
2279 12753 : ulong fd_epoch_schedule_size( fd_epoch_schedule_t const * self ) {
2280 12753 : ulong size = 0;
2281 12753 : size += sizeof(ulong);
2282 12753 : size += sizeof(ulong);
2283 12753 : size += sizeof(char);
2284 12753 : size += sizeof(ulong);
2285 12753 : size += sizeof(ulong);
2286 12753 : return size;
2287 12753 : }
2288 :
2289 0 : int fd_rent_collector_decode( fd_rent_collector_t * self, fd_bincode_decode_ctx_t * ctx ) {
2290 0 : void const * data = ctx->data;
2291 0 : int err = fd_rent_collector_decode_preflight( ctx );
2292 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2293 0 : ctx->data = data;
2294 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2295 0 : fd_rent_collector_new( self );
2296 0 : }
2297 0 : fd_rent_collector_decode_unsafe( self, ctx );
2298 0 : return FD_BINCODE_SUCCESS;
2299 0 : }
2300 6 : int fd_rent_collector_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
2301 6 : int err;
2302 6 : err = fd_bincode_uint64_decode_preflight( ctx );
2303 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2304 6 : err = fd_epoch_schedule_decode_preflight( ctx );
2305 6 : if( FD_UNLIKELY( err ) ) return err;
2306 6 : err = fd_bincode_double_decode_preflight( ctx );
2307 6 : if( FD_UNLIKELY( err ) ) return err;
2308 6 : err = fd_rent_decode_preflight( ctx );
2309 6 : if( FD_UNLIKELY( err ) ) return err;
2310 6 : return FD_BINCODE_SUCCESS;
2311 6 : }
2312 6 : void fd_rent_collector_decode_unsafe( fd_rent_collector_t * self, fd_bincode_decode_ctx_t * ctx ) {
2313 6 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2314 6 : fd_epoch_schedule_decode_unsafe( &self->epoch_schedule, ctx );
2315 6 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
2316 6 : fd_rent_decode_unsafe( &self->rent, ctx );
2317 6 : }
2318 6 : int fd_rent_collector_encode( fd_rent_collector_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2319 6 : int err;
2320 6 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2321 6 : if( FD_UNLIKELY( err ) ) return err;
2322 6 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
2323 6 : if( FD_UNLIKELY( err ) ) return err;
2324 6 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
2325 6 : if( FD_UNLIKELY( err ) ) return err;
2326 6 : err = fd_rent_encode( &self->rent, ctx );
2327 6 : if( FD_UNLIKELY( err ) ) return err;
2328 6 : return FD_BINCODE_SUCCESS;
2329 6 : }
2330 0 : int fd_rent_collector_decode_offsets( fd_rent_collector_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
2331 0 : uchar const * data = ctx->data;
2332 0 : int err;
2333 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
2334 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2335 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2336 0 : self->epoch_schedule_off = (uint)( (ulong)ctx->data - (ulong)data );
2337 0 : err = fd_epoch_schedule_decode_preflight( ctx );
2338 0 : if( FD_UNLIKELY( err ) ) return err;
2339 0 : self->slots_per_year_off = (uint)( (ulong)ctx->data - (ulong)data );
2340 0 : err = fd_bincode_double_decode_preflight( ctx );
2341 0 : if( FD_UNLIKELY( err ) ) return err;
2342 0 : self->rent_off = (uint)( (ulong)ctx->data - (ulong)data );
2343 0 : err = fd_rent_decode_preflight( ctx );
2344 0 : if( FD_UNLIKELY( err ) ) return err;
2345 0 : return FD_BINCODE_SUCCESS;
2346 0 : }
2347 6 : void fd_rent_collector_new(fd_rent_collector_t * self) {
2348 6 : fd_memset( self, 0, sizeof(fd_rent_collector_t) );
2349 6 : fd_epoch_schedule_new( &self->epoch_schedule );
2350 6 : fd_rent_new( &self->rent );
2351 6 : }
2352 0 : void fd_rent_collector_destroy( fd_rent_collector_t * self, fd_bincode_destroy_ctx_t * ctx ) {
2353 0 : fd_epoch_schedule_destroy( &self->epoch_schedule, ctx );
2354 0 : fd_rent_destroy( &self->rent, ctx );
2355 0 : }
2356 :
2357 0 : ulong fd_rent_collector_footprint( void ){ return FD_RENT_COLLECTOR_FOOTPRINT; }
2358 0 : ulong fd_rent_collector_align( void ){ return FD_RENT_COLLECTOR_ALIGN; }
2359 :
2360 0 : void fd_rent_collector_walk( void * w, fd_rent_collector_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2361 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_collector", level++ );
2362 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2363 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
2364 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
2365 0 : fd_rent_walk( w, &self->rent, fun, "rent", level );
2366 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_collector", level-- );
2367 0 : }
2368 6 : ulong fd_rent_collector_size( fd_rent_collector_t const * self ) {
2369 6 : ulong size = 0;
2370 6 : size += sizeof(ulong);
2371 6 : size += fd_epoch_schedule_size( &self->epoch_schedule );
2372 6 : size += sizeof(double);
2373 6 : size += fd_rent_size( &self->rent );
2374 6 : return size;
2375 6 : }
2376 :
2377 0 : int fd_stake_history_entry_decode( fd_stake_history_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
2378 0 : void const * data = ctx->data;
2379 0 : int err = fd_stake_history_entry_decode_preflight( ctx );
2380 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2381 0 : ctx->data = data;
2382 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2383 0 : fd_stake_history_entry_new( self );
2384 0 : }
2385 0 : fd_stake_history_entry_decode_unsafe( self, ctx );
2386 0 : return FD_BINCODE_SUCCESS;
2387 0 : }
2388 2202606 : int fd_stake_history_entry_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
2389 2202606 : return fd_bincode_bytes_decode_preflight( 32, ctx );
2390 2202606 : }
2391 2196006 : void fd_stake_history_entry_decode_unsafe( fd_stake_history_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
2392 2196006 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2393 2196006 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
2394 2196006 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
2395 2196006 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
2396 2196006 : }
2397 12276 : int fd_stake_history_entry_encode( fd_stake_history_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2398 12276 : int err;
2399 12276 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2400 12276 : if( FD_UNLIKELY( err ) ) return err;
2401 12276 : err = fd_bincode_uint64_encode( self->effective, ctx );
2402 12276 : if( FD_UNLIKELY( err ) ) return err;
2403 12276 : err = fd_bincode_uint64_encode( self->activating, ctx );
2404 12276 : if( FD_UNLIKELY( err ) ) return err;
2405 12276 : err = fd_bincode_uint64_encode( self->deactivating, ctx );
2406 12276 : if( FD_UNLIKELY( err ) ) return err;
2407 12276 : return FD_BINCODE_SUCCESS;
2408 12276 : }
2409 : enum {
2410 : fd_stake_history_entry_epoch_TAG = (0 << 6) | FD_ARCHIVE_META_ULONG,
2411 : fd_stake_history_entry_effective_TAG = (1 << 6) | FD_ARCHIVE_META_ULONG,
2412 : fd_stake_history_entry_activating_TAG = (2 << 6) | FD_ARCHIVE_META_ULONG,
2413 : fd_stake_history_entry_deactivating_TAG = (3 << 6) | FD_ARCHIVE_META_ULONG,
2414 : };
2415 0 : int fd_stake_history_entry_decode_archival( fd_stake_history_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
2416 0 : void const * data = ctx->data;
2417 0 : int err = fd_stake_history_entry_decode_archival_preflight( ctx );
2418 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2419 0 : ctx->data = data;
2420 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2421 0 : fd_stake_history_entry_new( self );
2422 0 : }
2423 0 : fd_stake_history_entry_decode_archival_unsafe( self, ctx );
2424 0 : return FD_BINCODE_SUCCESS;
2425 0 : }
2426 0 : int fd_stake_history_entry_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
2427 0 : int err;
2428 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
2429 0 : void * offset = NULL;
2430 0 : for(;;) {
2431 0 : err = fd_bincode_uint16_decode( &tag, ctx );
2432 0 : if( FD_UNLIKELY( err ) ) return err;
2433 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
2434 0 : switch( tag ) {
2435 0 : case (ushort)fd_stake_history_entry_epoch_TAG: {
2436 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2437 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2438 0 : break;
2439 0 : }
2440 0 : case (ushort)fd_stake_history_entry_effective_TAG: {
2441 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2442 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2443 0 : break;
2444 0 : }
2445 0 : case (ushort)fd_stake_history_entry_activating_TAG: {
2446 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2447 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2448 0 : break;
2449 0 : }
2450 0 : case (ushort)fd_stake_history_entry_deactivating_TAG: {
2451 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2452 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2453 0 : break;
2454 0 : }
2455 0 : default:
2456 0 : err = fd_archive_decode_skip_field( ctx, tag );
2457 0 : if( FD_UNLIKELY( err ) ) return err;
2458 0 : break;
2459 0 : }
2460 0 : }
2461 0 : return FD_BINCODE_SUCCESS;
2462 0 : }
2463 0 : void fd_stake_history_entry_decode_archival_unsafe( fd_stake_history_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
2464 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
2465 0 : void * offset = NULL;
2466 0 : for(;;) {
2467 0 : fd_bincode_uint16_decode( &tag, ctx );
2468 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
2469 0 : switch( tag ) {
2470 0 : case (ushort)fd_stake_history_entry_epoch_TAG: {
2471 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2472 0 : break;
2473 0 : }
2474 0 : case (ushort)fd_stake_history_entry_effective_TAG: {
2475 0 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
2476 0 : break;
2477 0 : }
2478 0 : case (ushort)fd_stake_history_entry_activating_TAG: {
2479 0 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
2480 0 : break;
2481 0 : }
2482 0 : case (ushort)fd_stake_history_entry_deactivating_TAG: {
2483 0 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
2484 0 : break;
2485 0 : }
2486 0 : default:
2487 0 : fd_archive_decode_skip_field( ctx, tag );
2488 0 : break;
2489 0 : }
2490 0 : }
2491 0 : }
2492 0 : int fd_stake_history_entry_encode_archival( fd_stake_history_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2493 0 : int err;
2494 0 : void * offset = NULL;
2495 0 : err = fd_bincode_uint16_encode( (ushort)fd_stake_history_entry_epoch_TAG, ctx );
2496 0 : if( FD_UNLIKELY( err ) ) return err;
2497 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2498 0 : if( FD_UNLIKELY( err ) ) return err;
2499 0 : err = fd_bincode_uint16_encode( (ushort)fd_stake_history_entry_effective_TAG, ctx );
2500 0 : if( FD_UNLIKELY( err ) ) return err;
2501 0 : err = fd_bincode_uint64_encode( self->effective, ctx );
2502 0 : if( FD_UNLIKELY( err ) ) return err;
2503 0 : err = fd_bincode_uint16_encode( (ushort)fd_stake_history_entry_activating_TAG, ctx );
2504 0 : if( FD_UNLIKELY( err ) ) return err;
2505 0 : err = fd_bincode_uint64_encode( self->activating, ctx );
2506 0 : if( FD_UNLIKELY( err ) ) return err;
2507 0 : err = fd_bincode_uint16_encode( (ushort)fd_stake_history_entry_deactivating_TAG, ctx );
2508 0 : if( FD_UNLIKELY( err ) ) return err;
2509 0 : err = fd_bincode_uint64_encode( self->deactivating, ctx );
2510 0 : if( FD_UNLIKELY( err ) ) return err;
2511 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
2512 0 : if( FD_UNLIKELY( err ) ) return err;
2513 0 : return FD_BINCODE_SUCCESS;
2514 0 : }
2515 0 : int fd_stake_history_entry_decode_offsets( fd_stake_history_entry_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
2516 0 : uchar const * data = ctx->data;
2517 0 : int err;
2518 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
2519 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2520 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2521 0 : self->effective_off = (uint)( (ulong)ctx->data - (ulong)data );
2522 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2523 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2524 0 : self->activating_off = (uint)( (ulong)ctx->data - (ulong)data );
2525 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2526 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2527 0 : self->deactivating_off = (uint)( (ulong)ctx->data - (ulong)data );
2528 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2529 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2530 0 : return FD_BINCODE_SUCCESS;
2531 0 : }
2532 235176960 : void fd_stake_history_entry_new(fd_stake_history_entry_t * self) {
2533 235176960 : fd_memset( self, 0, sizeof(fd_stake_history_entry_t) );
2534 235176960 : }
2535 228969984 : void fd_stake_history_entry_destroy( fd_stake_history_entry_t * self, fd_bincode_destroy_ctx_t * ctx ) {
2536 228969984 : }
2537 :
2538 0 : ulong fd_stake_history_entry_footprint( void ){ return FD_STAKE_HISTORY_ENTRY_FOOTPRINT; }
2539 0 : ulong fd_stake_history_entry_align( void ){ return FD_STAKE_HISTORY_ENTRY_ALIGN; }
2540 :
2541 0 : void fd_stake_history_entry_walk( void * w, fd_stake_history_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2542 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history_entry", level++ );
2543 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2544 0 : fun( w, &self->effective, "effective", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2545 0 : fun( w, &self->activating, "activating", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2546 0 : fun( w, &self->deactivating, "deactivating", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2547 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history_entry", level-- );
2548 0 : }
2549 0 : ulong fd_stake_history_entry_size( fd_stake_history_entry_t const * self ) {
2550 0 : ulong size = 0;
2551 0 : size += sizeof(ulong);
2552 0 : size += sizeof(ulong);
2553 0 : size += sizeof(ulong);
2554 0 : size += sizeof(ulong);
2555 0 : return size;
2556 0 : }
2557 :
2558 39348 : int fd_stake_history_decode( fd_stake_history_t * self, fd_bincode_decode_ctx_t * ctx ) {
2559 39348 : void const * data = ctx->data;
2560 39348 : int err = fd_stake_history_decode_preflight( ctx );
2561 39348 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2562 39189 : ctx->data = data;
2563 39189 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2564 39189 : fd_stake_history_new( self );
2565 39189 : }
2566 39189 : fd_stake_history_decode_unsafe( self, ctx );
2567 39189 : return FD_BINCODE_SUCCESS;
2568 39348 : }
2569 39354 : int fd_stake_history_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
2570 39354 : int err;
2571 39354 : ulong fd_stake_history_len;
2572 39354 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
2573 39354 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2574 39288 : if( fd_stake_history_len ) {
2575 2224392 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
2576 2202606 : err = fd_stake_history_entry_decode_preflight( ctx );
2577 2202606 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2578 2202606 : }
2579 21879 : }
2580 39195 : return FD_BINCODE_SUCCESS;
2581 39288 : }
2582 39195 : void fd_stake_history_decode_unsafe( fd_stake_history_t * self, fd_bincode_decode_ctx_t * ctx ) {
2583 39195 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
2584 39195 : self->fd_stake_history_size = 512;
2585 39195 : self->fd_stake_history_offset = 0;
2586 2235201 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
2587 2196006 : fd_stake_history_entry_decode_unsafe( self->fd_stake_history + i, ctx );
2588 2196006 : }
2589 39195 : }
2590 24558 : int fd_stake_history_encode( fd_stake_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2591 24558 : int err;
2592 24558 : err = fd_bincode_uint64_encode( self->fd_stake_history_len, ctx );
2593 24558 : if( FD_UNLIKELY(err) ) return err;
2594 24558 : if( FD_UNLIKELY( 0 == self->fd_stake_history_len ) ) return FD_BINCODE_SUCCESS;
2595 24552 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
2596 12276 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
2597 12276 : err = fd_stake_history_entry_encode( self->fd_stake_history + idx, ctx );
2598 12276 : if( FD_UNLIKELY( err ) ) return err;
2599 12276 : }
2600 12276 : return FD_BINCODE_SUCCESS;
2601 12276 : }
2602 : enum {
2603 : fd_stake_history_fd_stake_history_TAG = (0 << 6) | FD_ARCHIVE_META_STATIC_VECTOR,
2604 : };
2605 0 : int fd_stake_history_decode_archival( fd_stake_history_t * self, fd_bincode_decode_ctx_t * ctx ) {
2606 0 : void const * data = ctx->data;
2607 0 : int err = fd_stake_history_decode_archival_preflight( ctx );
2608 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2609 0 : ctx->data = data;
2610 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2611 0 : fd_stake_history_new( self );
2612 0 : }
2613 0 : fd_stake_history_decode_archival_unsafe( self, ctx );
2614 0 : return FD_BINCODE_SUCCESS;
2615 0 : }
2616 0 : int fd_stake_history_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
2617 0 : int err;
2618 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
2619 0 : void * offset = NULL;
2620 0 : for(;;) {
2621 0 : err = fd_bincode_uint16_decode( &tag, ctx );
2622 0 : if( FD_UNLIKELY( err ) ) return err;
2623 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
2624 0 : switch( tag ) {
2625 0 : case (ushort)fd_stake_history_fd_stake_history_TAG: {
2626 0 : err = fd_archive_decode_setup_length( ctx, &offset );
2627 0 : if( FD_UNLIKELY( err ) ) return err;
2628 0 : ulong fd_stake_history_len;
2629 0 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
2630 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2631 0 : if( fd_stake_history_len ) {
2632 0 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
2633 0 : err = fd_stake_history_entry_decode_archival_preflight( ctx );
2634 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2635 0 : }
2636 0 : }
2637 0 : err = fd_archive_decode_check_length( ctx, offset );
2638 0 : if( FD_UNLIKELY( err ) ) return err;
2639 0 : break;
2640 0 : }
2641 0 : default:
2642 0 : err = fd_archive_decode_skip_field( ctx, tag );
2643 0 : if( FD_UNLIKELY( err ) ) return err;
2644 0 : break;
2645 0 : }
2646 0 : }
2647 0 : return FD_BINCODE_SUCCESS;
2648 0 : }
2649 0 : void fd_stake_history_decode_archival_unsafe( fd_stake_history_t * self, fd_bincode_decode_ctx_t * ctx ) {
2650 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
2651 0 : void * offset = NULL;
2652 0 : for(;;) {
2653 0 : fd_bincode_uint16_decode( &tag, ctx );
2654 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
2655 0 : switch( tag ) {
2656 0 : case (ushort)fd_stake_history_fd_stake_history_TAG: {
2657 0 : fd_archive_decode_setup_length( ctx, &offset );
2658 0 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
2659 0 : self->fd_stake_history_size = 512;
2660 0 : self->fd_stake_history_offset = 0;
2661 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
2662 0 : fd_stake_history_entry_decode_archival_unsafe( self->fd_stake_history + i, ctx );
2663 0 : }
2664 0 : break;
2665 0 : }
2666 0 : default:
2667 0 : fd_archive_decode_skip_field( ctx, tag );
2668 0 : break;
2669 0 : }
2670 0 : }
2671 0 : }
2672 0 : int fd_stake_history_encode_archival( fd_stake_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2673 0 : int err;
2674 0 : void * offset = NULL;
2675 0 : err = fd_bincode_uint16_encode( (ushort)fd_stake_history_fd_stake_history_TAG, ctx );
2676 0 : if( FD_UNLIKELY( err ) ) return err;
2677 0 : err = fd_archive_encode_setup_length( ctx, &offset );
2678 0 : if( FD_UNLIKELY( err ) ) return err;
2679 0 : err = fd_bincode_uint64_encode( self->fd_stake_history_len, ctx );
2680 0 : if( FD_UNLIKELY(err) ) return err;
2681 0 : if( FD_UNLIKELY( 0 == self->fd_stake_history_len ) ) return FD_BINCODE_SUCCESS;
2682 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
2683 0 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
2684 0 : err = fd_stake_history_entry_encode_archival( self->fd_stake_history + idx, ctx );
2685 0 : if( FD_UNLIKELY( err ) ) return err;
2686 0 : }
2687 0 : err = fd_archive_encode_set_length( ctx, offset );
2688 0 : if( FD_UNLIKELY( err ) ) return err;
2689 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
2690 0 : if( FD_UNLIKELY( err ) ) return err;
2691 0 : return FD_BINCODE_SUCCESS;
2692 0 : }
2693 0 : int fd_stake_history_decode_offsets( fd_stake_history_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
2694 0 : uchar const * data = ctx->data;
2695 0 : int err;
2696 0 : self->fd_stake_history_off = (uint)( (ulong)ctx->data - (ulong)data );
2697 0 : ulong fd_stake_history_len;
2698 0 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
2699 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2700 0 : if( fd_stake_history_len ) {
2701 0 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
2702 0 : err = fd_stake_history_entry_decode_preflight( ctx );
2703 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2704 0 : }
2705 0 : }
2706 0 : return FD_BINCODE_SUCCESS;
2707 0 : }
2708 459330 : void fd_stake_history_new(fd_stake_history_t * self) {
2709 459330 : fd_memset( self, 0, sizeof(fd_stake_history_t) );
2710 459330 : self->fd_stake_history_size = 512;
2711 235636290 : for( ulong i=0; i<512; i++ )
2712 235176960 : fd_stake_history_entry_new( self->fd_stake_history + i );
2713 459330 : }
2714 447207 : void fd_stake_history_destroy( fd_stake_history_t * self, fd_bincode_destroy_ctx_t * ctx ) {
2715 229417191 : for( ulong i=0; i<512; i++ )
2716 228969984 : fd_stake_history_entry_destroy( self->fd_stake_history + i, ctx );
2717 447207 : }
2718 :
2719 0 : ulong fd_stake_history_footprint( void ){ return FD_STAKE_HISTORY_FOOTPRINT; }
2720 0 : ulong fd_stake_history_align( void ){ return FD_STAKE_HISTORY_ALIGN; }
2721 :
2722 0 : void fd_stake_history_walk( void * w, fd_stake_history_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2723 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history", level++ );
2724 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR, "stake_history_entry[]", level++ );
2725 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
2726 0 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
2727 0 : fd_stake_history_entry_walk( w, self->fd_stake_history + idx, fun, "stake_history_entry", level );
2728 0 : }
2729 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR_END, "stake_history_entry[]", level-- );
2730 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history", level-- );
2731 0 : }
2732 6 : ulong fd_stake_history_size( fd_stake_history_t const * self ) {
2733 6 : ulong size = 0;
2734 6 : size += sizeof(ulong);
2735 6 : for( ulong i=0; i<self->fd_stake_history_len; i++ )
2736 0 : size += fd_stake_history_entry_size( self->fd_stake_history + i );
2737 6 : return size;
2738 6 : }
2739 :
2740 0 : int fd_solana_account_decode( fd_solana_account_t * self, fd_bincode_decode_ctx_t * ctx ) {
2741 0 : void const * data = ctx->data;
2742 0 : int err = fd_solana_account_decode_preflight( ctx );
2743 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2744 0 : ctx->data = data;
2745 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2746 0 : fd_solana_account_new( self );
2747 0 : }
2748 0 : fd_solana_account_decode_unsafe( self, ctx );
2749 0 : return FD_BINCODE_SUCCESS;
2750 0 : }
2751 0 : int fd_solana_account_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
2752 0 : int err;
2753 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2754 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2755 0 : ulong data_len;
2756 0 : err = fd_bincode_uint64_decode( &data_len, ctx );
2757 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2758 0 : if( data_len ) {
2759 0 : err = fd_bincode_bytes_decode_preflight( data_len, ctx );
2760 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2761 0 : }
2762 0 : err = fd_pubkey_decode_preflight( ctx );
2763 0 : if( FD_UNLIKELY( err ) ) return err;
2764 0 : err = fd_bincode_bool_decode_preflight( ctx );
2765 0 : if( FD_UNLIKELY( err ) ) return err;
2766 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2767 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2768 0 : return FD_BINCODE_SUCCESS;
2769 0 : }
2770 0 : void fd_solana_account_decode_unsafe( fd_solana_account_t * self, fd_bincode_decode_ctx_t * ctx ) {
2771 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
2772 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
2773 0 : if( self->data_len ) {
2774 0 : self->data = fd_valloc_malloc( ctx->valloc, 8UL, self->data_len );
2775 0 : fd_bincode_bytes_decode_unsafe( self->data, self->data_len, ctx );
2776 0 : } else
2777 0 : self->data = NULL;
2778 0 : fd_pubkey_decode_unsafe( &self->owner, ctx );
2779 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
2780 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
2781 0 : }
2782 144 : int fd_solana_account_encode( fd_solana_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2783 144 : int err;
2784 144 : err = fd_bincode_uint64_encode( self->lamports, ctx );
2785 144 : if( FD_UNLIKELY( err ) ) return err;
2786 144 : err = fd_bincode_uint64_encode( self->data_len, ctx );
2787 144 : if( FD_UNLIKELY(err) ) return err;
2788 144 : if( self->data_len ) {
2789 30 : err = fd_bincode_bytes_encode( self->data, self->data_len, ctx );
2790 30 : if( FD_UNLIKELY( err ) ) return err;
2791 30 : }
2792 144 : err = fd_pubkey_encode( &self->owner, ctx );
2793 144 : if( FD_UNLIKELY( err ) ) return err;
2794 144 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
2795 144 : if( FD_UNLIKELY( err ) ) return err;
2796 144 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
2797 144 : if( FD_UNLIKELY( err ) ) return err;
2798 144 : return FD_BINCODE_SUCCESS;
2799 144 : }
2800 0 : int fd_solana_account_decode_offsets( fd_solana_account_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
2801 0 : uchar const * data = ctx->data;
2802 0 : int err;
2803 0 : self->lamports_off = (uint)( (ulong)ctx->data - (ulong)data );
2804 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2805 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2806 0 : self->data_off = (uint)( (ulong)ctx->data - (ulong)data );
2807 0 : ulong data_len;
2808 0 : err = fd_bincode_uint64_decode( &data_len, ctx );
2809 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2810 0 : if( data_len ) {
2811 0 : err = fd_bincode_bytes_decode_preflight( data_len, ctx );
2812 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2813 0 : }
2814 0 : self->owner_off = (uint)( (ulong)ctx->data - (ulong)data );
2815 0 : err = fd_pubkey_decode_preflight( ctx );
2816 0 : if( FD_UNLIKELY( err ) ) return err;
2817 0 : self->executable_off = (uint)( (ulong)ctx->data - (ulong)data );
2818 0 : err = fd_bincode_bool_decode_preflight( ctx );
2819 0 : if( FD_UNLIKELY( err ) ) return err;
2820 0 : self->rent_epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
2821 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2822 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2823 0 : return FD_BINCODE_SUCCESS;
2824 0 : }
2825 0 : void fd_solana_account_new(fd_solana_account_t * self) {
2826 0 : fd_memset( self, 0, sizeof(fd_solana_account_t) );
2827 0 : fd_pubkey_new( &self->owner );
2828 0 : }
2829 0 : void fd_solana_account_destroy( fd_solana_account_t * self, fd_bincode_destroy_ctx_t * ctx ) {
2830 0 : if( self->data ) {
2831 0 : fd_valloc_free( ctx->valloc, self->data );
2832 0 : self->data = NULL;
2833 0 : }
2834 0 : fd_pubkey_destroy( &self->owner, ctx );
2835 0 : }
2836 :
2837 0 : ulong fd_solana_account_footprint( void ){ return FD_SOLANA_ACCOUNT_FOOTPRINT; }
2838 0 : ulong fd_solana_account_align( void ){ return FD_SOLANA_ACCOUNT_ALIGN; }
2839 :
2840 0 : void fd_solana_account_walk( void * w, fd_solana_account_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
2841 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account", level++ );
2842 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2843 0 : fun(w, self->data, "data", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
2844 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
2845 0 : fun( w, &self->executable, "executable", FD_FLAMENCO_TYPE_BOOL, "bool", level );
2846 0 : fun( w, &self->rent_epoch, "rent_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
2847 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account", level-- );
2848 0 : }
2849 0 : ulong fd_solana_account_size( fd_solana_account_t const * self ) {
2850 0 : ulong size = 0;
2851 0 : size += sizeof(ulong);
2852 0 : do {
2853 0 : size += sizeof(ulong);
2854 0 : size += self->data_len;
2855 0 : } while(0);
2856 0 : size += fd_pubkey_size( &self->owner );
2857 0 : size += sizeof(char);
2858 0 : size += sizeof(ulong);
2859 0 : return size;
2860 0 : }
2861 :
2862 0 : int fd_vote_accounts_pair_decode( fd_vote_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
2863 0 : void const * data = ctx->data;
2864 0 : int err = fd_vote_accounts_pair_decode_preflight( ctx );
2865 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2866 0 : ctx->data = data;
2867 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2868 0 : fd_vote_accounts_pair_new( self );
2869 0 : }
2870 0 : fd_vote_accounts_pair_decode_unsafe( self, ctx );
2871 0 : return FD_BINCODE_SUCCESS;
2872 0 : }
2873 0 : int fd_vote_accounts_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
2874 0 : int err;
2875 0 : err = fd_pubkey_decode_preflight( ctx );
2876 0 : if( FD_UNLIKELY( err ) ) return err;
2877 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2878 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2879 0 : err = fd_solana_vote_account_decode_preflight( ctx );
2880 0 : if( FD_UNLIKELY( err ) ) return err;
2881 0 : return FD_BINCODE_SUCCESS;
2882 0 : }
2883 0 : void fd_vote_accounts_pair_decode_unsafe( fd_vote_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
2884 0 : fd_pubkey_decode_unsafe( &self->key, ctx );
2885 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
2886 0 : fd_solana_vote_account_decode_unsafe( &self->value, ctx );
2887 0 : }
2888 0 : int fd_vote_accounts_pair_encode( fd_vote_accounts_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2889 0 : int err;
2890 0 : err = fd_pubkey_encode( &self->key, ctx );
2891 0 : if( FD_UNLIKELY( err ) ) return err;
2892 0 : err = fd_bincode_uint64_encode( self->stake, ctx );
2893 0 : if( FD_UNLIKELY( err ) ) return err;
2894 0 : err = fd_solana_vote_account_encode( &self->value, ctx );
2895 0 : if( FD_UNLIKELY( err ) ) return err;
2896 0 : return FD_BINCODE_SUCCESS;
2897 0 : }
2898 : enum {
2899 : fd_vote_accounts_pair_key_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
2900 : fd_vote_accounts_pair_stake_TAG = (1 << 6) | FD_ARCHIVE_META_ULONG,
2901 : fd_vote_accounts_pair_value_TAG = (2 << 6) | FD_ARCHIVE_META_STRUCT,
2902 : };
2903 0 : int fd_vote_accounts_pair_decode_archival( fd_vote_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
2904 0 : void const * data = ctx->data;
2905 0 : int err = fd_vote_accounts_pair_decode_archival_preflight( ctx );
2906 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2907 0 : ctx->data = data;
2908 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
2909 0 : fd_vote_accounts_pair_new( self );
2910 0 : }
2911 0 : fd_vote_accounts_pair_decode_archival_unsafe( self, ctx );
2912 0 : return FD_BINCODE_SUCCESS;
2913 0 : }
2914 0 : int fd_vote_accounts_pair_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
2915 0 : int err;
2916 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
2917 0 : void * offset = NULL;
2918 0 : for(;;) {
2919 0 : err = fd_bincode_uint16_decode( &tag, ctx );
2920 0 : if( FD_UNLIKELY( err ) ) return err;
2921 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
2922 0 : switch( tag ) {
2923 0 : case (ushort)fd_vote_accounts_pair_key_TAG: {
2924 0 : err = fd_archive_decode_setup_length( ctx, &offset );
2925 0 : if( FD_UNLIKELY( err ) ) return err;
2926 0 : err = fd_pubkey_decode_archival_preflight( ctx );
2927 0 : if( FD_UNLIKELY( err ) ) return err;
2928 0 : err = fd_archive_decode_check_length( ctx, offset );
2929 0 : if( FD_UNLIKELY( err ) ) return err;
2930 0 : break;
2931 0 : }
2932 0 : case (ushort)fd_vote_accounts_pair_stake_TAG: {
2933 0 : err = fd_bincode_uint64_decode_preflight( ctx );
2934 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2935 0 : break;
2936 0 : }
2937 0 : case (ushort)fd_vote_accounts_pair_value_TAG: {
2938 0 : err = fd_archive_decode_setup_length( ctx, &offset );
2939 0 : if( FD_UNLIKELY( err ) ) return err;
2940 0 : err = fd_solana_vote_account_decode_archival_preflight( ctx );
2941 0 : if( FD_UNLIKELY( err ) ) return err;
2942 0 : err = fd_archive_decode_check_length( ctx, offset );
2943 0 : if( FD_UNLIKELY( err ) ) return err;
2944 0 : break;
2945 0 : }
2946 0 : default:
2947 0 : err = fd_archive_decode_skip_field( ctx, tag );
2948 0 : if( FD_UNLIKELY( err ) ) return err;
2949 0 : break;
2950 0 : }
2951 0 : }
2952 0 : return FD_BINCODE_SUCCESS;
2953 0 : }
2954 0 : void fd_vote_accounts_pair_decode_archival_unsafe( fd_vote_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
2955 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
2956 0 : void * offset = NULL;
2957 0 : for(;;) {
2958 0 : fd_bincode_uint16_decode( &tag, ctx );
2959 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
2960 0 : switch( tag ) {
2961 0 : case (ushort)fd_vote_accounts_pair_key_TAG: {
2962 0 : fd_archive_decode_setup_length( ctx, &offset );
2963 0 : fd_pubkey_decode_archival_unsafe( &self->key, ctx );
2964 0 : break;
2965 0 : }
2966 0 : case (ushort)fd_vote_accounts_pair_stake_TAG: {
2967 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
2968 0 : break;
2969 0 : }
2970 0 : case (ushort)fd_vote_accounts_pair_value_TAG: {
2971 0 : fd_archive_decode_setup_length( ctx, &offset );
2972 0 : fd_solana_vote_account_decode_archival_unsafe( &self->value, ctx );
2973 0 : break;
2974 0 : }
2975 0 : default:
2976 0 : fd_archive_decode_skip_field( ctx, tag );
2977 0 : break;
2978 0 : }
2979 0 : }
2980 0 : }
2981 0 : int fd_vote_accounts_pair_encode_archival( fd_vote_accounts_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2982 0 : int err;
2983 0 : void * offset = NULL;
2984 0 : err = fd_bincode_uint16_encode( (ushort)fd_vote_accounts_pair_key_TAG, ctx );
2985 0 : if( FD_UNLIKELY( err ) ) return err;
2986 0 : err = fd_archive_encode_setup_length( ctx, &offset );
2987 0 : if( FD_UNLIKELY( err ) ) return err;
2988 0 : err = fd_pubkey_encode_archival( &self->key, ctx );
2989 0 : if( FD_UNLIKELY( err ) ) return err;
2990 0 : err = fd_archive_encode_set_length( ctx, offset );
2991 0 : if( FD_UNLIKELY( err ) ) return err;
2992 0 : err = fd_bincode_uint16_encode( (ushort)fd_vote_accounts_pair_stake_TAG, ctx );
2993 0 : if( FD_UNLIKELY( err ) ) return err;
2994 0 : err = fd_bincode_uint64_encode( self->stake, ctx );
2995 0 : if( FD_UNLIKELY( err ) ) return err;
2996 0 : err = fd_bincode_uint16_encode( (ushort)fd_vote_accounts_pair_value_TAG, ctx );
2997 0 : if( FD_UNLIKELY( err ) ) return err;
2998 0 : err = fd_archive_encode_setup_length( ctx, &offset );
2999 0 : if( FD_UNLIKELY( err ) ) return err;
3000 0 : err = fd_solana_vote_account_encode_archival( &self->value, ctx );
3001 0 : if( FD_UNLIKELY( err ) ) return err;
3002 0 : err = fd_archive_encode_set_length( ctx, offset );
3003 0 : if( FD_UNLIKELY( err ) ) return err;
3004 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
3005 0 : if( FD_UNLIKELY( err ) ) return err;
3006 0 : return FD_BINCODE_SUCCESS;
3007 0 : }
3008 0 : int fd_vote_accounts_pair_decode_offsets( fd_vote_accounts_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
3009 0 : uchar const * data = ctx->data;
3010 0 : int err;
3011 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
3012 0 : err = fd_pubkey_decode_preflight( ctx );
3013 0 : if( FD_UNLIKELY( err ) ) return err;
3014 0 : self->stake_off = (uint)( (ulong)ctx->data - (ulong)data );
3015 0 : err = fd_bincode_uint64_decode_preflight( ctx );
3016 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3017 0 : self->value_off = (uint)( (ulong)ctx->data - (ulong)data );
3018 0 : err = fd_solana_vote_account_decode_preflight( ctx );
3019 0 : if( FD_UNLIKELY( err ) ) return err;
3020 0 : return FD_BINCODE_SUCCESS;
3021 0 : }
3022 0 : void fd_vote_accounts_pair_new(fd_vote_accounts_pair_t * self) {
3023 0 : fd_memset( self, 0, sizeof(fd_vote_accounts_pair_t) );
3024 0 : fd_pubkey_new( &self->key );
3025 0 : fd_solana_vote_account_new( &self->value );
3026 0 : }
3027 0 : void fd_vote_accounts_pair_destroy( fd_vote_accounts_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
3028 0 : fd_pubkey_destroy( &self->key, ctx );
3029 0 : fd_solana_vote_account_destroy( &self->value, ctx );
3030 0 : }
3031 :
3032 0 : ulong fd_vote_accounts_pair_footprint( void ){ return FD_VOTE_ACCOUNTS_PAIR_FOOTPRINT; }
3033 0 : ulong fd_vote_accounts_pair_align( void ){ return FD_VOTE_ACCOUNTS_PAIR_ALIGN; }
3034 :
3035 0 : void fd_vote_accounts_pair_walk( void * w, fd_vote_accounts_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3036 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_accounts_pair", level++ );
3037 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
3038 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3039 0 : fd_solana_vote_account_walk( w, &self->value, fun, "value", level );
3040 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_accounts_pair", level-- );
3041 0 : }
3042 0 : ulong fd_vote_accounts_pair_size( fd_vote_accounts_pair_t const * self ) {
3043 0 : ulong size = 0;
3044 0 : size += fd_pubkey_size( &self->key );
3045 0 : size += sizeof(ulong);
3046 0 : size += fd_solana_vote_account_size( &self->value );
3047 0 : return size;
3048 0 : }
3049 :
3050 0 : int fd_vote_accounts_pair_serializable_decode( fd_vote_accounts_pair_serializable_t * self, fd_bincode_decode_ctx_t * ctx ) {
3051 0 : void const * data = ctx->data;
3052 0 : int err = fd_vote_accounts_pair_serializable_decode_preflight( ctx );
3053 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3054 0 : ctx->data = data;
3055 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3056 0 : fd_vote_accounts_pair_serializable_new( self );
3057 0 : }
3058 0 : fd_vote_accounts_pair_serializable_decode_unsafe( self, ctx );
3059 0 : return FD_BINCODE_SUCCESS;
3060 0 : }
3061 0 : int fd_vote_accounts_pair_serializable_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
3062 0 : int err;
3063 0 : err = fd_pubkey_decode_preflight( ctx );
3064 0 : if( FD_UNLIKELY( err ) ) return err;
3065 0 : err = fd_bincode_uint64_decode_preflight( ctx );
3066 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3067 0 : err = fd_solana_account_decode_preflight( ctx );
3068 0 : if( FD_UNLIKELY( err ) ) return err;
3069 0 : return FD_BINCODE_SUCCESS;
3070 0 : }
3071 0 : void fd_vote_accounts_pair_serializable_decode_unsafe( fd_vote_accounts_pair_serializable_t * self, fd_bincode_decode_ctx_t * ctx ) {
3072 0 : fd_pubkey_decode_unsafe( &self->key, ctx );
3073 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
3074 0 : fd_solana_account_decode_unsafe( &self->value, ctx );
3075 0 : }
3076 0 : int fd_vote_accounts_pair_serializable_encode( fd_vote_accounts_pair_serializable_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3077 0 : int err;
3078 0 : err = fd_pubkey_encode( &self->key, ctx );
3079 0 : if( FD_UNLIKELY( err ) ) return err;
3080 0 : err = fd_bincode_uint64_encode( self->stake, ctx );
3081 0 : if( FD_UNLIKELY( err ) ) return err;
3082 0 : err = fd_solana_account_encode( &self->value, ctx );
3083 0 : if( FD_UNLIKELY( err ) ) return err;
3084 0 : return FD_BINCODE_SUCCESS;
3085 0 : }
3086 0 : int fd_vote_accounts_pair_serializable_decode_offsets( fd_vote_accounts_pair_serializable_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
3087 0 : uchar const * data = ctx->data;
3088 0 : int err;
3089 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
3090 0 : err = fd_pubkey_decode_preflight( ctx );
3091 0 : if( FD_UNLIKELY( err ) ) return err;
3092 0 : self->stake_off = (uint)( (ulong)ctx->data - (ulong)data );
3093 0 : err = fd_bincode_uint64_decode_preflight( ctx );
3094 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3095 0 : self->value_off = (uint)( (ulong)ctx->data - (ulong)data );
3096 0 : err = fd_solana_account_decode_preflight( ctx );
3097 0 : if( FD_UNLIKELY( err ) ) return err;
3098 0 : return FD_BINCODE_SUCCESS;
3099 0 : }
3100 0 : void fd_vote_accounts_pair_serializable_new(fd_vote_accounts_pair_serializable_t * self) {
3101 0 : fd_memset( self, 0, sizeof(fd_vote_accounts_pair_serializable_t) );
3102 0 : fd_pubkey_new( &self->key );
3103 0 : fd_solana_account_new( &self->value );
3104 0 : }
3105 0 : void fd_vote_accounts_pair_serializable_destroy( fd_vote_accounts_pair_serializable_t * self, fd_bincode_destroy_ctx_t * ctx ) {
3106 0 : fd_pubkey_destroy( &self->key, ctx );
3107 0 : fd_solana_account_destroy( &self->value, ctx );
3108 0 : }
3109 :
3110 0 : ulong fd_vote_accounts_pair_serializable_footprint( void ){ return FD_VOTE_ACCOUNTS_PAIR_SERIALIZABLE_FOOTPRINT; }
3111 0 : ulong fd_vote_accounts_pair_serializable_align( void ){ return FD_VOTE_ACCOUNTS_PAIR_SERIALIZABLE_ALIGN; }
3112 :
3113 0 : void fd_vote_accounts_pair_serializable_walk( void * w, fd_vote_accounts_pair_serializable_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3114 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_accounts_pair_serializable", level++ );
3115 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
3116 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3117 0 : fd_solana_account_walk( w, &self->value, fun, "value", level );
3118 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_accounts_pair_serializable", level-- );
3119 0 : }
3120 0 : ulong fd_vote_accounts_pair_serializable_size( fd_vote_accounts_pair_serializable_t const * self ) {
3121 0 : ulong size = 0;
3122 0 : size += fd_pubkey_size( &self->key );
3123 0 : size += sizeof(ulong);
3124 0 : size += fd_solana_account_size( &self->value );
3125 0 : return size;
3126 0 : }
3127 :
3128 0 : int fd_vote_accounts_serializable_decode( fd_vote_accounts_serializable_t * self, fd_bincode_decode_ctx_t * ctx ) {
3129 0 : void const * data = ctx->data;
3130 0 : int err = fd_vote_accounts_serializable_decode_preflight( ctx );
3131 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3132 0 : ctx->data = data;
3133 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3134 0 : fd_vote_accounts_serializable_new( self );
3135 0 : }
3136 0 : fd_vote_accounts_serializable_decode_unsafe( self, ctx );
3137 0 : return FD_BINCODE_SUCCESS;
3138 0 : }
3139 0 : int fd_vote_accounts_serializable_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
3140 0 : int err;
3141 0 : ulong vote_accounts_len;
3142 0 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
3143 0 : if( FD_UNLIKELY( err ) ) return err;
3144 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
3145 0 : err = fd_vote_accounts_pair_serializable_decode_preflight( ctx );
3146 0 : if( FD_UNLIKELY( err ) ) return err;
3147 0 : }
3148 0 : return FD_BINCODE_SUCCESS;
3149 0 : }
3150 0 : void fd_vote_accounts_serializable_decode_unsafe( fd_vote_accounts_serializable_t * self, fd_bincode_decode_ctx_t * ctx ) {
3151 0 : ulong vote_accounts_len;
3152 0 : fd_bincode_uint64_decode_unsafe( &vote_accounts_len, ctx );
3153 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3154 0 : self->vote_accounts_pool = fd_vote_accounts_pair_serializable_t_map_alloc( ctx->valloc, fd_ulong_max(vote_accounts_len, 15000 ) );
3155 0 : self->vote_accounts_root = NULL;
3156 0 : }
3157 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
3158 0 : fd_vote_accounts_pair_serializable_t_mapnode_t * node = fd_vote_accounts_pair_serializable_t_map_acquire( self->vote_accounts_pool );
3159 0 : fd_vote_accounts_pair_serializable_new( &node->elem );
3160 0 : fd_vote_accounts_pair_serializable_decode_unsafe( &node->elem, ctx );
3161 0 : fd_vote_accounts_pair_serializable_t_map_insert( self->vote_accounts_pool, &self->vote_accounts_root, node );
3162 0 : }
3163 0 : }
3164 0 : int fd_vote_accounts_serializable_encode( fd_vote_accounts_serializable_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3165 0 : int err;
3166 0 : if( self->vote_accounts_root ) {
3167 0 : ulong vote_accounts_len = fd_vote_accounts_pair_serializable_t_map_size( self->vote_accounts_pool, self->vote_accounts_root );
3168 0 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
3169 0 : if( FD_UNLIKELY( err ) ) return err;
3170 0 : for( fd_vote_accounts_pair_serializable_t_mapnode_t * n = fd_vote_accounts_pair_serializable_t_map_minimum( self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_serializable_t_map_successor( self->vote_accounts_pool, n ) ) {
3171 0 : err = fd_vote_accounts_pair_serializable_encode( &n->elem, ctx );
3172 0 : if( FD_UNLIKELY( err ) ) return err;
3173 0 : }
3174 0 : } else {
3175 0 : ulong vote_accounts_len = 0;
3176 0 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
3177 0 : if( FD_UNLIKELY( err ) ) return err;
3178 0 : }
3179 0 : return FD_BINCODE_SUCCESS;
3180 0 : }
3181 0 : int fd_vote_accounts_serializable_decode_offsets( fd_vote_accounts_serializable_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
3182 0 : uchar const * data = ctx->data;
3183 0 : int err;
3184 0 : self->vote_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
3185 0 : ulong vote_accounts_len;
3186 0 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
3187 0 : if( FD_UNLIKELY( err ) ) return err;
3188 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
3189 0 : err = fd_vote_accounts_pair_serializable_decode_preflight( ctx );
3190 0 : if( FD_UNLIKELY( err ) ) return err;
3191 0 : }
3192 0 : return FD_BINCODE_SUCCESS;
3193 0 : }
3194 0 : void fd_vote_accounts_serializable_new(fd_vote_accounts_serializable_t * self) {
3195 0 : fd_memset( self, 0, sizeof(fd_vote_accounts_serializable_t) );
3196 0 : }
3197 0 : void fd_vote_accounts_serializable_destroy( fd_vote_accounts_serializable_t * self, fd_bincode_destroy_ctx_t * ctx ) {
3198 0 : for( fd_vote_accounts_pair_serializable_t_mapnode_t * n = fd_vote_accounts_pair_serializable_t_map_minimum(self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_serializable_t_map_successor(self->vote_accounts_pool, n) ) {
3199 0 : fd_vote_accounts_pair_serializable_destroy( &n->elem, ctx );
3200 0 : }
3201 0 : fd_valloc_free( ctx->valloc, fd_vote_accounts_pair_serializable_t_map_delete( fd_vote_accounts_pair_serializable_t_map_leave( self->vote_accounts_pool ) ) );
3202 0 : self->vote_accounts_pool = NULL;
3203 0 : self->vote_accounts_root = NULL;
3204 0 : }
3205 :
3206 0 : ulong fd_vote_accounts_serializable_footprint( void ){ return FD_VOTE_ACCOUNTS_SERIALIZABLE_FOOTPRINT; }
3207 0 : ulong fd_vote_accounts_serializable_align( void ){ return FD_VOTE_ACCOUNTS_SERIALIZABLE_ALIGN; }
3208 :
3209 0 : void fd_vote_accounts_serializable_walk( void * w, fd_vote_accounts_serializable_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3210 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_accounts_serializable", level++ );
3211 0 : if( self->vote_accounts_root ) {
3212 0 : for( fd_vote_accounts_pair_serializable_t_mapnode_t * n = fd_vote_accounts_pair_serializable_t_map_minimum(self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_serializable_t_map_successor( self->vote_accounts_pool, n ) ) {
3213 0 : fd_vote_accounts_pair_serializable_walk(w, &n->elem, fun, "vote_accounts", level );
3214 0 : }
3215 0 : }
3216 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_accounts_serializable", level-- );
3217 0 : }
3218 0 : ulong fd_vote_accounts_serializable_size( fd_vote_accounts_serializable_t const * self ) {
3219 0 : ulong size = 0;
3220 0 : if( self->vote_accounts_root ) {
3221 0 : size += sizeof(ulong);
3222 0 : for( fd_vote_accounts_pair_serializable_t_mapnode_t * n = fd_vote_accounts_pair_serializable_t_map_minimum( self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_serializable_t_map_successor( self->vote_accounts_pool, n ) ) {
3223 0 : size += fd_vote_accounts_pair_serializable_size( &n->elem );
3224 0 : }
3225 0 : } else {
3226 0 : size += sizeof(ulong);
3227 0 : }
3228 0 : return size;
3229 0 : }
3230 :
3231 0 : int fd_vote_accounts_decode( fd_vote_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
3232 0 : void const * data = ctx->data;
3233 0 : int err = fd_vote_accounts_decode_preflight( ctx );
3234 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3235 0 : ctx->data = data;
3236 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3237 0 : fd_vote_accounts_new( self );
3238 0 : }
3239 0 : fd_vote_accounts_decode_unsafe( self, ctx );
3240 0 : return FD_BINCODE_SUCCESS;
3241 0 : }
3242 6 : int fd_vote_accounts_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
3243 6 : int err;
3244 6 : ulong vote_accounts_len;
3245 6 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
3246 6 : if( FD_UNLIKELY( err ) ) return err;
3247 6 : for( ulong i=0; i < vote_accounts_len; i++ ) {
3248 0 : err = fd_vote_accounts_pair_decode_preflight( ctx );
3249 0 : if( FD_UNLIKELY( err ) ) return err;
3250 0 : }
3251 6 : return FD_BINCODE_SUCCESS;
3252 6 : }
3253 6 : void fd_vote_accounts_decode_unsafe( fd_vote_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
3254 6 : ulong vote_accounts_len;
3255 6 : fd_bincode_uint64_decode_unsafe( &vote_accounts_len, ctx );
3256 6 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3257 6 : self->vote_accounts_pool = fd_vote_accounts_pair_t_map_alloc( ctx->valloc, fd_ulong_max(vote_accounts_len, 15000 ) );
3258 6 : self->vote_accounts_root = NULL;
3259 6 : }
3260 6 : for( ulong i=0; i < vote_accounts_len; i++ ) {
3261 0 : fd_vote_accounts_pair_t_mapnode_t * node = fd_vote_accounts_pair_t_map_acquire( self->vote_accounts_pool );
3262 0 : fd_vote_accounts_pair_new( &node->elem );
3263 0 : fd_vote_accounts_pair_decode_unsafe( &node->elem, ctx );
3264 0 : fd_vote_accounts_pair_t_map_insert( self->vote_accounts_pool, &self->vote_accounts_root, node );
3265 0 : }
3266 6 : }
3267 6 : int fd_vote_accounts_encode( fd_vote_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3268 6 : int err;
3269 6 : if( self->vote_accounts_root ) {
3270 0 : ulong vote_accounts_len = fd_vote_accounts_pair_t_map_size( self->vote_accounts_pool, self->vote_accounts_root );
3271 0 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
3272 0 : if( FD_UNLIKELY( err ) ) return err;
3273 0 : for( fd_vote_accounts_pair_t_mapnode_t * n = fd_vote_accounts_pair_t_map_minimum( self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_t_map_successor( self->vote_accounts_pool, n ) ) {
3274 0 : err = fd_vote_accounts_pair_encode( &n->elem, ctx );
3275 0 : if( FD_UNLIKELY( err ) ) return err;
3276 0 : }
3277 6 : } else {
3278 6 : ulong vote_accounts_len = 0;
3279 6 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
3280 6 : if( FD_UNLIKELY( err ) ) return err;
3281 6 : }
3282 6 : return FD_BINCODE_SUCCESS;
3283 6 : }
3284 : enum {
3285 : fd_vote_accounts_vote_accounts_TAG = (0 << 6) | FD_ARCHIVE_META_MAP,
3286 : };
3287 0 : int fd_vote_accounts_decode_archival( fd_vote_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
3288 0 : void const * data = ctx->data;
3289 0 : int err = fd_vote_accounts_decode_archival_preflight( ctx );
3290 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3291 0 : ctx->data = data;
3292 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3293 0 : fd_vote_accounts_new( self );
3294 0 : }
3295 0 : fd_vote_accounts_decode_archival_unsafe( self, ctx );
3296 0 : return FD_BINCODE_SUCCESS;
3297 0 : }
3298 0 : int fd_vote_accounts_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
3299 0 : int err;
3300 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
3301 0 : void * offset = NULL;
3302 0 : for(;;) {
3303 0 : err = fd_bincode_uint16_decode( &tag, ctx );
3304 0 : if( FD_UNLIKELY( err ) ) return err;
3305 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
3306 0 : switch( tag ) {
3307 0 : case (ushort)fd_vote_accounts_vote_accounts_TAG: {
3308 0 : err = fd_archive_decode_setup_length( ctx, &offset );
3309 0 : if( FD_UNLIKELY( err ) ) return err;
3310 0 : ulong vote_accounts_len;
3311 0 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
3312 0 : if( FD_UNLIKELY( err ) ) return err;
3313 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
3314 0 : err = fd_vote_accounts_pair_decode_archival_preflight( ctx );
3315 0 : if( FD_UNLIKELY( err ) ) return err;
3316 0 : }
3317 0 : err = fd_archive_decode_check_length( ctx, offset );
3318 0 : if( FD_UNLIKELY( err ) ) return err;
3319 0 : break;
3320 0 : }
3321 0 : default:
3322 0 : err = fd_archive_decode_skip_field( ctx, tag );
3323 0 : if( FD_UNLIKELY( err ) ) return err;
3324 0 : break;
3325 0 : }
3326 0 : }
3327 0 : return FD_BINCODE_SUCCESS;
3328 0 : }
3329 0 : void fd_vote_accounts_decode_archival_unsafe( fd_vote_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
3330 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
3331 0 : void * offset = NULL;
3332 0 : for(;;) {
3333 0 : fd_bincode_uint16_decode( &tag, ctx );
3334 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
3335 0 : switch( tag ) {
3336 0 : case (ushort)fd_vote_accounts_vote_accounts_TAG: {
3337 0 : fd_archive_decode_setup_length( ctx, &offset );
3338 0 : ulong vote_accounts_len;
3339 0 : fd_bincode_uint64_decode_unsafe( &vote_accounts_len, ctx );
3340 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3341 0 : self->vote_accounts_pool = fd_vote_accounts_pair_t_map_alloc( ctx->valloc, fd_ulong_max(vote_accounts_len, 15000 ) );
3342 0 : self->vote_accounts_root = NULL;
3343 0 : }
3344 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
3345 0 : fd_vote_accounts_pair_t_mapnode_t * node = fd_vote_accounts_pair_t_map_acquire( self->vote_accounts_pool );
3346 0 : fd_vote_accounts_pair_new( &node->elem );
3347 0 : fd_vote_accounts_pair_decode_archival_unsafe( &node->elem, ctx );
3348 0 : fd_vote_accounts_pair_t_map_insert( self->vote_accounts_pool, &self->vote_accounts_root, node );
3349 0 : }
3350 0 : break;
3351 0 : }
3352 0 : default:
3353 0 : fd_archive_decode_skip_field( ctx, tag );
3354 0 : break;
3355 0 : }
3356 0 : }
3357 0 : }
3358 0 : int fd_vote_accounts_encode_archival( fd_vote_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3359 0 : int err;
3360 0 : void * offset = NULL;
3361 0 : err = fd_bincode_uint16_encode( (ushort)fd_vote_accounts_vote_accounts_TAG, ctx );
3362 0 : if( FD_UNLIKELY( err ) ) return err;
3363 0 : err = fd_archive_encode_setup_length( ctx, &offset );
3364 0 : if( FD_UNLIKELY( err ) ) return err;
3365 0 : if( self->vote_accounts_root ) {
3366 0 : ulong vote_accounts_len = fd_vote_accounts_pair_t_map_size( self->vote_accounts_pool, self->vote_accounts_root );
3367 0 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
3368 0 : if( FD_UNLIKELY( err ) ) return err;
3369 0 : for( fd_vote_accounts_pair_t_mapnode_t * n = fd_vote_accounts_pair_t_map_minimum( self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_t_map_successor( self->vote_accounts_pool, n ) ) {
3370 0 : err = fd_vote_accounts_pair_encode_archival( &n->elem, ctx );
3371 0 : if( FD_UNLIKELY( err ) ) return err;
3372 0 : }
3373 0 : } else {
3374 0 : ulong vote_accounts_len = 0;
3375 0 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
3376 0 : if( FD_UNLIKELY( err ) ) return err;
3377 0 : }
3378 0 : err = fd_archive_encode_set_length( ctx, offset );
3379 0 : if( FD_UNLIKELY( err ) ) return err;
3380 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
3381 0 : if( FD_UNLIKELY( err ) ) return err;
3382 0 : return FD_BINCODE_SUCCESS;
3383 0 : }
3384 0 : int fd_vote_accounts_decode_offsets( fd_vote_accounts_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
3385 0 : uchar const * data = ctx->data;
3386 0 : int err;
3387 0 : self->vote_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
3388 0 : ulong vote_accounts_len;
3389 0 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
3390 0 : if( FD_UNLIKELY( err ) ) return err;
3391 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
3392 0 : err = fd_vote_accounts_pair_decode_preflight( ctx );
3393 0 : if( FD_UNLIKELY( err ) ) return err;
3394 0 : }
3395 0 : return FD_BINCODE_SUCCESS;
3396 0 : }
3397 2447160 : void fd_vote_accounts_new(fd_vote_accounts_t * self) {
3398 2447160 : fd_memset( self, 0, sizeof(fd_vote_accounts_t) );
3399 2447160 : }
3400 1631436 : void fd_vote_accounts_destroy( fd_vote_accounts_t * self, fd_bincode_destroy_ctx_t * ctx ) {
3401 1631436 : for( fd_vote_accounts_pair_t_mapnode_t * n = fd_vote_accounts_pair_t_map_minimum(self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_t_map_successor(self->vote_accounts_pool, n) ) {
3402 0 : fd_vote_accounts_pair_destroy( &n->elem, ctx );
3403 0 : }
3404 1631436 : fd_valloc_free( ctx->valloc, fd_vote_accounts_pair_t_map_delete( fd_vote_accounts_pair_t_map_leave( self->vote_accounts_pool ) ) );
3405 1631436 : self->vote_accounts_pool = NULL;
3406 1631436 : self->vote_accounts_root = NULL;
3407 1631436 : }
3408 :
3409 0 : ulong fd_vote_accounts_footprint( void ){ return FD_VOTE_ACCOUNTS_FOOTPRINT; }
3410 0 : ulong fd_vote_accounts_align( void ){ return FD_VOTE_ACCOUNTS_ALIGN; }
3411 :
3412 0 : void fd_vote_accounts_walk( void * w, fd_vote_accounts_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3413 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_accounts", level++ );
3414 0 : if( self->vote_accounts_root ) {
3415 0 : for( fd_vote_accounts_pair_t_mapnode_t * n = fd_vote_accounts_pair_t_map_minimum(self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_t_map_successor( self->vote_accounts_pool, n ) ) {
3416 0 : fd_vote_accounts_pair_walk(w, &n->elem, fun, "vote_accounts", level );
3417 0 : }
3418 0 : }
3419 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_accounts", level-- );
3420 0 : }
3421 6 : ulong fd_vote_accounts_size( fd_vote_accounts_t const * self ) {
3422 6 : ulong size = 0;
3423 6 : if( self->vote_accounts_root ) {
3424 0 : size += sizeof(ulong);
3425 0 : for( fd_vote_accounts_pair_t_mapnode_t * n = fd_vote_accounts_pair_t_map_minimum( self->vote_accounts_pool, self->vote_accounts_root ); n; n = fd_vote_accounts_pair_t_map_successor( self->vote_accounts_pool, n ) ) {
3426 0 : size += fd_vote_accounts_pair_size( &n->elem );
3427 0 : }
3428 6 : } else {
3429 6 : size += sizeof(ulong);
3430 6 : }
3431 6 : return size;
3432 6 : }
3433 :
3434 0 : int fd_stake_accounts_pair_decode( fd_stake_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
3435 0 : void const * data = ctx->data;
3436 0 : int err = fd_stake_accounts_pair_decode_preflight( ctx );
3437 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3438 0 : ctx->data = data;
3439 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3440 0 : fd_stake_accounts_pair_new( self );
3441 0 : }
3442 0 : fd_stake_accounts_pair_decode_unsafe( self, ctx );
3443 0 : return FD_BINCODE_SUCCESS;
3444 0 : }
3445 0 : int fd_stake_accounts_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
3446 0 : return fd_bincode_bytes_decode_preflight( 36, ctx );
3447 0 : }
3448 0 : void fd_stake_accounts_pair_decode_unsafe( fd_stake_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
3449 0 : fd_pubkey_decode_unsafe( &self->key, ctx );
3450 0 : fd_bincode_uint32_decode_unsafe( &self->exists, ctx );
3451 0 : }
3452 0 : int fd_stake_accounts_pair_encode( fd_stake_accounts_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3453 0 : int err;
3454 0 : err = fd_pubkey_encode( &self->key, ctx );
3455 0 : if( FD_UNLIKELY( err ) ) return err;
3456 0 : err = fd_bincode_uint32_encode( self->exists, ctx );
3457 0 : if( FD_UNLIKELY( err ) ) return err;
3458 0 : return FD_BINCODE_SUCCESS;
3459 0 : }
3460 : enum {
3461 : fd_stake_accounts_pair_key_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
3462 : fd_stake_accounts_pair_exists_TAG = (1 << 6) | FD_ARCHIVE_META_UINT,
3463 : };
3464 0 : int fd_stake_accounts_pair_decode_archival( fd_stake_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
3465 0 : void const * data = ctx->data;
3466 0 : int err = fd_stake_accounts_pair_decode_archival_preflight( ctx );
3467 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3468 0 : ctx->data = data;
3469 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3470 0 : fd_stake_accounts_pair_new( self );
3471 0 : }
3472 0 : fd_stake_accounts_pair_decode_archival_unsafe( self, ctx );
3473 0 : return FD_BINCODE_SUCCESS;
3474 0 : }
3475 0 : int fd_stake_accounts_pair_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
3476 0 : int err;
3477 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
3478 0 : void * offset = NULL;
3479 0 : for(;;) {
3480 0 : err = fd_bincode_uint16_decode( &tag, ctx );
3481 0 : if( FD_UNLIKELY( err ) ) return err;
3482 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
3483 0 : switch( tag ) {
3484 0 : case (ushort)fd_stake_accounts_pair_key_TAG: {
3485 0 : err = fd_archive_decode_setup_length( ctx, &offset );
3486 0 : if( FD_UNLIKELY( err ) ) return err;
3487 0 : err = fd_pubkey_decode_archival_preflight( ctx );
3488 0 : if( FD_UNLIKELY( err ) ) return err;
3489 0 : err = fd_archive_decode_check_length( ctx, offset );
3490 0 : if( FD_UNLIKELY( err ) ) return err;
3491 0 : break;
3492 0 : }
3493 0 : case (ushort)fd_stake_accounts_pair_exists_TAG: {
3494 0 : err = fd_bincode_uint32_decode_preflight( ctx );
3495 0 : if( FD_UNLIKELY( err ) ) return err;
3496 0 : break;
3497 0 : }
3498 0 : default:
3499 0 : err = fd_archive_decode_skip_field( ctx, tag );
3500 0 : if( FD_UNLIKELY( err ) ) return err;
3501 0 : break;
3502 0 : }
3503 0 : }
3504 0 : return FD_BINCODE_SUCCESS;
3505 0 : }
3506 0 : void fd_stake_accounts_pair_decode_archival_unsafe( fd_stake_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
3507 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
3508 0 : void * offset = NULL;
3509 0 : for(;;) {
3510 0 : fd_bincode_uint16_decode( &tag, ctx );
3511 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
3512 0 : switch( tag ) {
3513 0 : case (ushort)fd_stake_accounts_pair_key_TAG: {
3514 0 : fd_archive_decode_setup_length( ctx, &offset );
3515 0 : fd_pubkey_decode_archival_unsafe( &self->key, ctx );
3516 0 : break;
3517 0 : }
3518 0 : case (ushort)fd_stake_accounts_pair_exists_TAG: {
3519 0 : fd_bincode_uint32_decode_unsafe( &self->exists, ctx );
3520 0 : break;
3521 0 : }
3522 0 : default:
3523 0 : fd_archive_decode_skip_field( ctx, tag );
3524 0 : break;
3525 0 : }
3526 0 : }
3527 0 : }
3528 0 : int fd_stake_accounts_pair_encode_archival( fd_stake_accounts_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3529 0 : int err;
3530 0 : void * offset = NULL;
3531 0 : err = fd_bincode_uint16_encode( (ushort)fd_stake_accounts_pair_key_TAG, ctx );
3532 0 : if( FD_UNLIKELY( err ) ) return err;
3533 0 : err = fd_archive_encode_setup_length( ctx, &offset );
3534 0 : if( FD_UNLIKELY( err ) ) return err;
3535 0 : err = fd_pubkey_encode_archival( &self->key, ctx );
3536 0 : if( FD_UNLIKELY( err ) ) return err;
3537 0 : err = fd_archive_encode_set_length( ctx, offset );
3538 0 : if( FD_UNLIKELY( err ) ) return err;
3539 0 : err = fd_bincode_uint16_encode( (ushort)fd_stake_accounts_pair_exists_TAG, ctx );
3540 0 : if( FD_UNLIKELY( err ) ) return err;
3541 0 : err = fd_bincode_uint32_encode( self->exists, ctx );
3542 0 : if( FD_UNLIKELY( err ) ) return err;
3543 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
3544 0 : if( FD_UNLIKELY( err ) ) return err;
3545 0 : return FD_BINCODE_SUCCESS;
3546 0 : }
3547 0 : int fd_stake_accounts_pair_decode_offsets( fd_stake_accounts_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
3548 0 : uchar const * data = ctx->data;
3549 0 : int err;
3550 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
3551 0 : err = fd_pubkey_decode_preflight( ctx );
3552 0 : if( FD_UNLIKELY( err ) ) return err;
3553 0 : self->exists_off = (uint)( (ulong)ctx->data - (ulong)data );
3554 0 : err = fd_bincode_uint32_decode_preflight( ctx );
3555 0 : if( FD_UNLIKELY( err ) ) return err;
3556 0 : return FD_BINCODE_SUCCESS;
3557 0 : }
3558 0 : void fd_stake_accounts_pair_new(fd_stake_accounts_pair_t * self) {
3559 0 : fd_memset( self, 0, sizeof(fd_stake_accounts_pair_t) );
3560 0 : fd_pubkey_new( &self->key );
3561 0 : }
3562 0 : void fd_stake_accounts_pair_destroy( fd_stake_accounts_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
3563 0 : fd_pubkey_destroy( &self->key, ctx );
3564 0 : }
3565 :
3566 0 : ulong fd_stake_accounts_pair_footprint( void ){ return FD_STAKE_ACCOUNTS_PAIR_FOOTPRINT; }
3567 0 : ulong fd_stake_accounts_pair_align( void ){ return FD_STAKE_ACCOUNTS_PAIR_ALIGN; }
3568 :
3569 0 : void fd_stake_accounts_pair_walk( void * w, fd_stake_accounts_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3570 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_accounts_pair", level++ );
3571 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
3572 0 : fun( w, &self->exists, "exists", FD_FLAMENCO_TYPE_UINT, "uint", level );
3573 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_accounts_pair", level-- );
3574 0 : }
3575 0 : ulong fd_stake_accounts_pair_size( fd_stake_accounts_pair_t const * self ) {
3576 0 : ulong size = 0;
3577 0 : size += fd_pubkey_size( &self->key );
3578 0 : size += sizeof(uint);
3579 0 : return size;
3580 0 : }
3581 :
3582 0 : int fd_stake_accounts_decode( fd_stake_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
3583 0 : void const * data = ctx->data;
3584 0 : int err = fd_stake_accounts_decode_preflight( ctx );
3585 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3586 0 : ctx->data = data;
3587 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3588 0 : fd_stake_accounts_new( self );
3589 0 : }
3590 0 : fd_stake_accounts_decode_unsafe( self, ctx );
3591 0 : return FD_BINCODE_SUCCESS;
3592 0 : }
3593 0 : int fd_stake_accounts_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
3594 0 : int err;
3595 0 : ulong stake_accounts_len;
3596 0 : err = fd_bincode_uint64_decode( &stake_accounts_len, ctx );
3597 0 : if( FD_UNLIKELY( err ) ) return err;
3598 0 : for( ulong i=0; i < stake_accounts_len; i++ ) {
3599 0 : err = fd_stake_accounts_pair_decode_preflight( ctx );
3600 0 : if( FD_UNLIKELY( err ) ) return err;
3601 0 : }
3602 0 : return FD_BINCODE_SUCCESS;
3603 0 : }
3604 0 : void fd_stake_accounts_decode_unsafe( fd_stake_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
3605 0 : ulong stake_accounts_len;
3606 0 : fd_bincode_uint64_decode_unsafe( &stake_accounts_len, ctx );
3607 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3608 0 : self->stake_accounts_pool = fd_stake_accounts_pair_t_map_alloc( ctx->valloc, fd_ulong_max(stake_accounts_len, 100000 ) );
3609 0 : self->stake_accounts_root = NULL;
3610 0 : }
3611 0 : for( ulong i=0; i < stake_accounts_len; i++ ) {
3612 0 : fd_stake_accounts_pair_t_mapnode_t * node = fd_stake_accounts_pair_t_map_acquire( self->stake_accounts_pool );
3613 0 : fd_stake_accounts_pair_new( &node->elem );
3614 0 : fd_stake_accounts_pair_decode_unsafe( &node->elem, ctx );
3615 0 : fd_stake_accounts_pair_t_map_insert( self->stake_accounts_pool, &self->stake_accounts_root, node );
3616 0 : }
3617 0 : }
3618 0 : int fd_stake_accounts_encode( fd_stake_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3619 0 : int err;
3620 0 : if( self->stake_accounts_root ) {
3621 0 : ulong stake_accounts_len = fd_stake_accounts_pair_t_map_size( self->stake_accounts_pool, self->stake_accounts_root );
3622 0 : err = fd_bincode_uint64_encode( stake_accounts_len, ctx );
3623 0 : if( FD_UNLIKELY( err ) ) return err;
3624 0 : for( fd_stake_accounts_pair_t_mapnode_t * n = fd_stake_accounts_pair_t_map_minimum( self->stake_accounts_pool, self->stake_accounts_root ); n; n = fd_stake_accounts_pair_t_map_successor( self->stake_accounts_pool, n ) ) {
3625 0 : err = fd_stake_accounts_pair_encode( &n->elem, ctx );
3626 0 : if( FD_UNLIKELY( err ) ) return err;
3627 0 : }
3628 0 : } else {
3629 0 : ulong stake_accounts_len = 0;
3630 0 : err = fd_bincode_uint64_encode( stake_accounts_len, ctx );
3631 0 : if( FD_UNLIKELY( err ) ) return err;
3632 0 : }
3633 0 : return FD_BINCODE_SUCCESS;
3634 0 : }
3635 : enum {
3636 : fd_stake_accounts_stake_accounts_TAG = (0 << 6) | FD_ARCHIVE_META_MAP,
3637 : };
3638 0 : int fd_stake_accounts_decode_archival( fd_stake_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
3639 0 : void const * data = ctx->data;
3640 0 : int err = fd_stake_accounts_decode_archival_preflight( ctx );
3641 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3642 0 : ctx->data = data;
3643 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3644 0 : fd_stake_accounts_new( self );
3645 0 : }
3646 0 : fd_stake_accounts_decode_archival_unsafe( self, ctx );
3647 0 : return FD_BINCODE_SUCCESS;
3648 0 : }
3649 0 : int fd_stake_accounts_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
3650 0 : int err;
3651 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
3652 0 : void * offset = NULL;
3653 0 : for(;;) {
3654 0 : err = fd_bincode_uint16_decode( &tag, ctx );
3655 0 : if( FD_UNLIKELY( err ) ) return err;
3656 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
3657 0 : switch( tag ) {
3658 0 : case (ushort)fd_stake_accounts_stake_accounts_TAG: {
3659 0 : err = fd_archive_decode_setup_length( ctx, &offset );
3660 0 : if( FD_UNLIKELY( err ) ) return err;
3661 0 : ulong stake_accounts_len;
3662 0 : err = fd_bincode_uint64_decode( &stake_accounts_len, ctx );
3663 0 : if( FD_UNLIKELY( err ) ) return err;
3664 0 : for( ulong i=0; i < stake_accounts_len; i++ ) {
3665 0 : err = fd_stake_accounts_pair_decode_archival_preflight( ctx );
3666 0 : if( FD_UNLIKELY( err ) ) return err;
3667 0 : }
3668 0 : err = fd_archive_decode_check_length( ctx, offset );
3669 0 : if( FD_UNLIKELY( err ) ) return err;
3670 0 : break;
3671 0 : }
3672 0 : default:
3673 0 : err = fd_archive_decode_skip_field( ctx, tag );
3674 0 : if( FD_UNLIKELY( err ) ) return err;
3675 0 : break;
3676 0 : }
3677 0 : }
3678 0 : return FD_BINCODE_SUCCESS;
3679 0 : }
3680 0 : void fd_stake_accounts_decode_archival_unsafe( fd_stake_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
3681 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
3682 0 : void * offset = NULL;
3683 0 : for(;;) {
3684 0 : fd_bincode_uint16_decode( &tag, ctx );
3685 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
3686 0 : switch( tag ) {
3687 0 : case (ushort)fd_stake_accounts_stake_accounts_TAG: {
3688 0 : fd_archive_decode_setup_length( ctx, &offset );
3689 0 : ulong stake_accounts_len;
3690 0 : fd_bincode_uint64_decode_unsafe( &stake_accounts_len, ctx );
3691 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3692 0 : self->stake_accounts_pool = fd_stake_accounts_pair_t_map_alloc( ctx->valloc, fd_ulong_max(stake_accounts_len, 100000 ) );
3693 0 : self->stake_accounts_root = NULL;
3694 0 : }
3695 0 : for( ulong i=0; i < stake_accounts_len; i++ ) {
3696 0 : fd_stake_accounts_pair_t_mapnode_t * node = fd_stake_accounts_pair_t_map_acquire( self->stake_accounts_pool );
3697 0 : fd_stake_accounts_pair_new( &node->elem );
3698 0 : fd_stake_accounts_pair_decode_archival_unsafe( &node->elem, ctx );
3699 0 : fd_stake_accounts_pair_t_map_insert( self->stake_accounts_pool, &self->stake_accounts_root, node );
3700 0 : }
3701 0 : break;
3702 0 : }
3703 0 : default:
3704 0 : fd_archive_decode_skip_field( ctx, tag );
3705 0 : break;
3706 0 : }
3707 0 : }
3708 0 : }
3709 0 : int fd_stake_accounts_encode_archival( fd_stake_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3710 0 : int err;
3711 0 : void * offset = NULL;
3712 0 : err = fd_bincode_uint16_encode( (ushort)fd_stake_accounts_stake_accounts_TAG, ctx );
3713 0 : if( FD_UNLIKELY( err ) ) return err;
3714 0 : err = fd_archive_encode_setup_length( ctx, &offset );
3715 0 : if( FD_UNLIKELY( err ) ) return err;
3716 0 : if( self->stake_accounts_root ) {
3717 0 : ulong stake_accounts_len = fd_stake_accounts_pair_t_map_size( self->stake_accounts_pool, self->stake_accounts_root );
3718 0 : err = fd_bincode_uint64_encode( stake_accounts_len, ctx );
3719 0 : if( FD_UNLIKELY( err ) ) return err;
3720 0 : for( fd_stake_accounts_pair_t_mapnode_t * n = fd_stake_accounts_pair_t_map_minimum( self->stake_accounts_pool, self->stake_accounts_root ); n; n = fd_stake_accounts_pair_t_map_successor( self->stake_accounts_pool, n ) ) {
3721 0 : err = fd_stake_accounts_pair_encode_archival( &n->elem, ctx );
3722 0 : if( FD_UNLIKELY( err ) ) return err;
3723 0 : }
3724 0 : } else {
3725 0 : ulong stake_accounts_len = 0;
3726 0 : err = fd_bincode_uint64_encode( stake_accounts_len, ctx );
3727 0 : if( FD_UNLIKELY( err ) ) return err;
3728 0 : }
3729 0 : err = fd_archive_encode_set_length( ctx, offset );
3730 0 : if( FD_UNLIKELY( err ) ) return err;
3731 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
3732 0 : if( FD_UNLIKELY( err ) ) return err;
3733 0 : return FD_BINCODE_SUCCESS;
3734 0 : }
3735 0 : int fd_stake_accounts_decode_offsets( fd_stake_accounts_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
3736 0 : uchar const * data = ctx->data;
3737 0 : int err;
3738 0 : self->stake_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
3739 0 : ulong stake_accounts_len;
3740 0 : err = fd_bincode_uint64_decode( &stake_accounts_len, ctx );
3741 0 : if( FD_UNLIKELY( err ) ) return err;
3742 0 : for( ulong i=0; i < stake_accounts_len; i++ ) {
3743 0 : err = fd_stake_accounts_pair_decode_preflight( ctx );
3744 0 : if( FD_UNLIKELY( err ) ) return err;
3745 0 : }
3746 0 : return FD_BINCODE_SUCCESS;
3747 0 : }
3748 815718 : void fd_stake_accounts_new(fd_stake_accounts_t * self) {
3749 815718 : fd_memset( self, 0, sizeof(fd_stake_accounts_t) );
3750 815718 : }
3751 815718 : void fd_stake_accounts_destroy( fd_stake_accounts_t * self, fd_bincode_destroy_ctx_t * ctx ) {
3752 815718 : for( fd_stake_accounts_pair_t_mapnode_t * n = fd_stake_accounts_pair_t_map_minimum(self->stake_accounts_pool, self->stake_accounts_root ); n; n = fd_stake_accounts_pair_t_map_successor(self->stake_accounts_pool, n) ) {
3753 0 : fd_stake_accounts_pair_destroy( &n->elem, ctx );
3754 0 : }
3755 815718 : fd_valloc_free( ctx->valloc, fd_stake_accounts_pair_t_map_delete( fd_stake_accounts_pair_t_map_leave( self->stake_accounts_pool ) ) );
3756 815718 : self->stake_accounts_pool = NULL;
3757 815718 : self->stake_accounts_root = NULL;
3758 815718 : }
3759 :
3760 0 : ulong fd_stake_accounts_footprint( void ){ return FD_STAKE_ACCOUNTS_FOOTPRINT; }
3761 0 : ulong fd_stake_accounts_align( void ){ return FD_STAKE_ACCOUNTS_ALIGN; }
3762 :
3763 0 : void fd_stake_accounts_walk( void * w, fd_stake_accounts_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3764 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_accounts", level++ );
3765 0 : if( self->stake_accounts_root ) {
3766 0 : for( fd_stake_accounts_pair_t_mapnode_t * n = fd_stake_accounts_pair_t_map_minimum(self->stake_accounts_pool, self->stake_accounts_root ); n; n = fd_stake_accounts_pair_t_map_successor( self->stake_accounts_pool, n ) ) {
3767 0 : fd_stake_accounts_pair_walk(w, &n->elem, fun, "stake_accounts", level );
3768 0 : }
3769 0 : }
3770 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_accounts", level-- );
3771 0 : }
3772 0 : ulong fd_stake_accounts_size( fd_stake_accounts_t const * self ) {
3773 0 : ulong size = 0;
3774 0 : if( self->stake_accounts_root ) {
3775 0 : size += sizeof(ulong);
3776 0 : for( fd_stake_accounts_pair_t_mapnode_t * n = fd_stake_accounts_pair_t_map_minimum( self->stake_accounts_pool, self->stake_accounts_root ); n; n = fd_stake_accounts_pair_t_map_successor( self->stake_accounts_pool, n ) ) {
3777 0 : size += fd_stake_accounts_pair_size( &n->elem );
3778 0 : }
3779 0 : } else {
3780 0 : size += sizeof(ulong);
3781 0 : }
3782 0 : return size;
3783 0 : }
3784 :
3785 0 : int fd_stake_weight_decode( fd_stake_weight_t * self, fd_bincode_decode_ctx_t * ctx ) {
3786 0 : void const * data = ctx->data;
3787 0 : int err = fd_stake_weight_decode_preflight( ctx );
3788 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3789 0 : ctx->data = data;
3790 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3791 0 : fd_stake_weight_new( self );
3792 0 : }
3793 0 : fd_stake_weight_decode_unsafe( self, ctx );
3794 0 : return FD_BINCODE_SUCCESS;
3795 0 : }
3796 0 : int fd_stake_weight_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
3797 0 : return fd_bincode_bytes_decode_preflight( 40, ctx );
3798 0 : }
3799 0 : void fd_stake_weight_decode_unsafe( fd_stake_weight_t * self, fd_bincode_decode_ctx_t * ctx ) {
3800 0 : fd_pubkey_decode_unsafe( &self->key, ctx );
3801 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
3802 0 : }
3803 0 : int fd_stake_weight_encode( fd_stake_weight_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3804 0 : int err;
3805 0 : err = fd_pubkey_encode( &self->key, ctx );
3806 0 : if( FD_UNLIKELY( err ) ) return err;
3807 0 : err = fd_bincode_uint64_encode( self->stake, ctx );
3808 0 : if( FD_UNLIKELY( err ) ) return err;
3809 0 : return FD_BINCODE_SUCCESS;
3810 0 : }
3811 0 : int fd_stake_weight_decode_offsets( fd_stake_weight_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
3812 0 : uchar const * data = ctx->data;
3813 0 : int err;
3814 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
3815 0 : err = fd_pubkey_decode_preflight( ctx );
3816 0 : if( FD_UNLIKELY( err ) ) return err;
3817 0 : self->stake_off = (uint)( (ulong)ctx->data - (ulong)data );
3818 0 : err = fd_bincode_uint64_decode_preflight( ctx );
3819 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3820 0 : return FD_BINCODE_SUCCESS;
3821 0 : }
3822 0 : void fd_stake_weight_new(fd_stake_weight_t * self) {
3823 0 : fd_memset( self, 0, sizeof(fd_stake_weight_t) );
3824 0 : fd_pubkey_new( &self->key );
3825 0 : }
3826 0 : void fd_stake_weight_destroy( fd_stake_weight_t * self, fd_bincode_destroy_ctx_t * ctx ) {
3827 0 : fd_pubkey_destroy( &self->key, ctx );
3828 0 : }
3829 :
3830 0 : ulong fd_stake_weight_footprint( void ){ return FD_STAKE_WEIGHT_FOOTPRINT; }
3831 0 : ulong fd_stake_weight_align( void ){ return FD_STAKE_WEIGHT_ALIGN; }
3832 :
3833 0 : void fd_stake_weight_walk( void * w, fd_stake_weight_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3834 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_weight", level++ );
3835 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
3836 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
3837 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_weight", level-- );
3838 0 : }
3839 0 : ulong fd_stake_weight_size( fd_stake_weight_t const * self ) {
3840 0 : ulong size = 0;
3841 0 : size += fd_pubkey_size( &self->key );
3842 0 : size += sizeof(ulong);
3843 0 : return size;
3844 0 : }
3845 :
3846 0 : int fd_stake_weights_decode( fd_stake_weights_t * self, fd_bincode_decode_ctx_t * ctx ) {
3847 0 : void const * data = ctx->data;
3848 0 : int err = fd_stake_weights_decode_preflight( ctx );
3849 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3850 0 : ctx->data = data;
3851 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3852 0 : fd_stake_weights_new( self );
3853 0 : }
3854 0 : fd_stake_weights_decode_unsafe( self, ctx );
3855 0 : return FD_BINCODE_SUCCESS;
3856 0 : }
3857 0 : int fd_stake_weights_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
3858 0 : int err;
3859 0 : ulong stake_weights_len;
3860 0 : err = fd_bincode_uint64_decode( &stake_weights_len, ctx );
3861 0 : if( FD_UNLIKELY( err ) ) return err;
3862 0 : for( ulong i=0; i < stake_weights_len; i++ ) {
3863 0 : err = fd_stake_weight_decode_preflight( ctx );
3864 0 : if( FD_UNLIKELY( err ) ) return err;
3865 0 : }
3866 0 : return FD_BINCODE_SUCCESS;
3867 0 : }
3868 0 : void fd_stake_weights_decode_unsafe( fd_stake_weights_t * self, fd_bincode_decode_ctx_t * ctx ) {
3869 0 : ulong stake_weights_len;
3870 0 : fd_bincode_uint64_decode_unsafe( &stake_weights_len, ctx );
3871 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3872 0 : self->stake_weights_pool = fd_stake_weight_t_map_alloc( ctx->valloc, stake_weights_len );
3873 0 : self->stake_weights_root = NULL;
3874 0 : }
3875 0 : for( ulong i=0; i < stake_weights_len; i++ ) {
3876 0 : fd_stake_weight_t_mapnode_t * node = fd_stake_weight_t_map_acquire( self->stake_weights_pool );
3877 0 : fd_stake_weight_new( &node->elem );
3878 0 : fd_stake_weight_decode_unsafe( &node->elem, ctx );
3879 0 : fd_stake_weight_t_map_insert( self->stake_weights_pool, &self->stake_weights_root, node );
3880 0 : }
3881 0 : }
3882 0 : int fd_stake_weights_encode( fd_stake_weights_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3883 0 : int err;
3884 0 : if( self->stake_weights_root ) {
3885 0 : ulong stake_weights_len = fd_stake_weight_t_map_size( self->stake_weights_pool, self->stake_weights_root );
3886 0 : err = fd_bincode_uint64_encode( stake_weights_len, ctx );
3887 0 : if( FD_UNLIKELY( err ) ) return err;
3888 0 : for( fd_stake_weight_t_mapnode_t * n = fd_stake_weight_t_map_minimum( self->stake_weights_pool, self->stake_weights_root ); n; n = fd_stake_weight_t_map_successor( self->stake_weights_pool, n ) ) {
3889 0 : err = fd_stake_weight_encode( &n->elem, ctx );
3890 0 : if( FD_UNLIKELY( err ) ) return err;
3891 0 : }
3892 0 : } else {
3893 0 : ulong stake_weights_len = 0;
3894 0 : err = fd_bincode_uint64_encode( stake_weights_len, ctx );
3895 0 : if( FD_UNLIKELY( err ) ) return err;
3896 0 : }
3897 0 : return FD_BINCODE_SUCCESS;
3898 0 : }
3899 0 : int fd_stake_weights_decode_offsets( fd_stake_weights_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
3900 0 : uchar const * data = ctx->data;
3901 0 : int err;
3902 0 : self->stake_weights_off = (uint)( (ulong)ctx->data - (ulong)data );
3903 0 : ulong stake_weights_len;
3904 0 : err = fd_bincode_uint64_decode( &stake_weights_len, ctx );
3905 0 : if( FD_UNLIKELY( err ) ) return err;
3906 0 : for( ulong i=0; i < stake_weights_len; i++ ) {
3907 0 : err = fd_stake_weight_decode_preflight( ctx );
3908 0 : if( FD_UNLIKELY( err ) ) return err;
3909 0 : }
3910 0 : return FD_BINCODE_SUCCESS;
3911 0 : }
3912 0 : void fd_stake_weights_new(fd_stake_weights_t * self) {
3913 0 : fd_memset( self, 0, sizeof(fd_stake_weights_t) );
3914 0 : }
3915 0 : void fd_stake_weights_destroy( fd_stake_weights_t * self, fd_bincode_destroy_ctx_t * ctx ) {
3916 0 : for( fd_stake_weight_t_mapnode_t * n = fd_stake_weight_t_map_minimum(self->stake_weights_pool, self->stake_weights_root ); n; n = fd_stake_weight_t_map_successor(self->stake_weights_pool, n) ) {
3917 0 : fd_stake_weight_destroy( &n->elem, ctx );
3918 0 : }
3919 0 : fd_valloc_free( ctx->valloc, fd_stake_weight_t_map_delete( fd_stake_weight_t_map_leave( self->stake_weights_pool ) ) );
3920 0 : self->stake_weights_pool = NULL;
3921 0 : self->stake_weights_root = NULL;
3922 0 : }
3923 :
3924 0 : ulong fd_stake_weights_footprint( void ){ return FD_STAKE_WEIGHTS_FOOTPRINT; }
3925 0 : ulong fd_stake_weights_align( void ){ return FD_STAKE_WEIGHTS_ALIGN; }
3926 :
3927 0 : void fd_stake_weights_walk( void * w, fd_stake_weights_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
3928 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_weights", level++ );
3929 0 : if( self->stake_weights_root ) {
3930 0 : for( fd_stake_weight_t_mapnode_t * n = fd_stake_weight_t_map_minimum(self->stake_weights_pool, self->stake_weights_root ); n; n = fd_stake_weight_t_map_successor( self->stake_weights_pool, n ) ) {
3931 0 : fd_stake_weight_walk(w, &n->elem, fun, "stake_weights", level );
3932 0 : }
3933 0 : }
3934 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_weights", level-- );
3935 0 : }
3936 0 : ulong fd_stake_weights_size( fd_stake_weights_t const * self ) {
3937 0 : ulong size = 0;
3938 0 : if( self->stake_weights_root ) {
3939 0 : size += sizeof(ulong);
3940 0 : for( fd_stake_weight_t_mapnode_t * n = fd_stake_weight_t_map_minimum( self->stake_weights_pool, self->stake_weights_root ); n; n = fd_stake_weight_t_map_successor( self->stake_weights_pool, n ) ) {
3941 0 : size += fd_stake_weight_size( &n->elem );
3942 0 : }
3943 0 : } else {
3944 0 : size += sizeof(ulong);
3945 0 : }
3946 0 : return size;
3947 0 : }
3948 :
3949 0 : int fd_delegation_decode( fd_delegation_t * self, fd_bincode_decode_ctx_t * ctx ) {
3950 0 : void const * data = ctx->data;
3951 0 : int err = fd_delegation_decode_preflight( ctx );
3952 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3953 0 : ctx->data = data;
3954 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3955 0 : fd_delegation_new( self );
3956 0 : }
3957 0 : fd_delegation_decode_unsafe( self, ctx );
3958 0 : return FD_BINCODE_SUCCESS;
3959 0 : }
3960 0 : int fd_delegation_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
3961 0 : return fd_bincode_bytes_decode_preflight( 64, ctx );
3962 0 : }
3963 4998 : void fd_delegation_decode_unsafe( fd_delegation_t * self, fd_bincode_decode_ctx_t * ctx ) {
3964 4998 : fd_pubkey_decode_unsafe( &self->voter_pubkey, ctx );
3965 4998 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
3966 4998 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
3967 4998 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
3968 4998 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
3969 4998 : }
3970 1842 : int fd_delegation_encode( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3971 1842 : int err;
3972 1842 : err = fd_pubkey_encode( &self->voter_pubkey, ctx );
3973 1842 : if( FD_UNLIKELY( err ) ) return err;
3974 1842 : err = fd_bincode_uint64_encode( self->stake, ctx );
3975 1842 : if( FD_UNLIKELY( err ) ) return err;
3976 1842 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
3977 1842 : if( FD_UNLIKELY( err ) ) return err;
3978 1842 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
3979 1842 : if( FD_UNLIKELY( err ) ) return err;
3980 1842 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
3981 1842 : if( FD_UNLIKELY( err ) ) return err;
3982 1842 : return FD_BINCODE_SUCCESS;
3983 1842 : }
3984 : enum {
3985 : fd_delegation_voter_pubkey_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
3986 : fd_delegation_stake_TAG = (1 << 6) | FD_ARCHIVE_META_ULONG,
3987 : fd_delegation_activation_epoch_TAG = (2 << 6) | FD_ARCHIVE_META_ULONG,
3988 : fd_delegation_deactivation_epoch_TAG = (3 << 6) | FD_ARCHIVE_META_ULONG,
3989 : fd_delegation_warmup_cooldown_rate_TAG = (4 << 6) | FD_ARCHIVE_META_DOUBLE,
3990 : };
3991 0 : int fd_delegation_decode_archival( fd_delegation_t * self, fd_bincode_decode_ctx_t * ctx ) {
3992 0 : void const * data = ctx->data;
3993 0 : int err = fd_delegation_decode_archival_preflight( ctx );
3994 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3995 0 : ctx->data = data;
3996 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
3997 0 : fd_delegation_new( self );
3998 0 : }
3999 0 : fd_delegation_decode_archival_unsafe( self, ctx );
4000 0 : return FD_BINCODE_SUCCESS;
4001 0 : }
4002 0 : int fd_delegation_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
4003 0 : int err;
4004 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
4005 0 : void * offset = NULL;
4006 0 : for(;;) {
4007 0 : err = fd_bincode_uint16_decode( &tag, ctx );
4008 0 : if( FD_UNLIKELY( err ) ) return err;
4009 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
4010 0 : switch( tag ) {
4011 0 : case (ushort)fd_delegation_voter_pubkey_TAG: {
4012 0 : err = fd_archive_decode_setup_length( ctx, &offset );
4013 0 : if( FD_UNLIKELY( err ) ) return err;
4014 0 : err = fd_pubkey_decode_archival_preflight( ctx );
4015 0 : if( FD_UNLIKELY( err ) ) return err;
4016 0 : err = fd_archive_decode_check_length( ctx, offset );
4017 0 : if( FD_UNLIKELY( err ) ) return err;
4018 0 : break;
4019 0 : }
4020 0 : case (ushort)fd_delegation_stake_TAG: {
4021 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4022 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4023 0 : break;
4024 0 : }
4025 0 : case (ushort)fd_delegation_activation_epoch_TAG: {
4026 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4027 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4028 0 : break;
4029 0 : }
4030 0 : case (ushort)fd_delegation_deactivation_epoch_TAG: {
4031 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4032 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4033 0 : break;
4034 0 : }
4035 0 : case (ushort)fd_delegation_warmup_cooldown_rate_TAG: {
4036 0 : err = fd_bincode_double_decode_preflight( ctx );
4037 0 : if( FD_UNLIKELY( err ) ) return err;
4038 0 : break;
4039 0 : }
4040 0 : default:
4041 0 : err = fd_archive_decode_skip_field( ctx, tag );
4042 0 : if( FD_UNLIKELY( err ) ) return err;
4043 0 : break;
4044 0 : }
4045 0 : }
4046 0 : return FD_BINCODE_SUCCESS;
4047 0 : }
4048 0 : void fd_delegation_decode_archival_unsafe( fd_delegation_t * self, fd_bincode_decode_ctx_t * ctx ) {
4049 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
4050 0 : void * offset = NULL;
4051 0 : for(;;) {
4052 0 : fd_bincode_uint16_decode( &tag, ctx );
4053 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
4054 0 : switch( tag ) {
4055 0 : case (ushort)fd_delegation_voter_pubkey_TAG: {
4056 0 : fd_archive_decode_setup_length( ctx, &offset );
4057 0 : fd_pubkey_decode_archival_unsafe( &self->voter_pubkey, ctx );
4058 0 : break;
4059 0 : }
4060 0 : case (ushort)fd_delegation_stake_TAG: {
4061 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
4062 0 : break;
4063 0 : }
4064 0 : case (ushort)fd_delegation_activation_epoch_TAG: {
4065 0 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
4066 0 : break;
4067 0 : }
4068 0 : case (ushort)fd_delegation_deactivation_epoch_TAG: {
4069 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
4070 0 : break;
4071 0 : }
4072 0 : case (ushort)fd_delegation_warmup_cooldown_rate_TAG: {
4073 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
4074 0 : break;
4075 0 : }
4076 0 : default:
4077 0 : fd_archive_decode_skip_field( ctx, tag );
4078 0 : break;
4079 0 : }
4080 0 : }
4081 0 : }
4082 0 : int fd_delegation_encode_archival( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4083 0 : int err;
4084 0 : void * offset = NULL;
4085 0 : err = fd_bincode_uint16_encode( (ushort)fd_delegation_voter_pubkey_TAG, ctx );
4086 0 : if( FD_UNLIKELY( err ) ) return err;
4087 0 : err = fd_archive_encode_setup_length( ctx, &offset );
4088 0 : if( FD_UNLIKELY( err ) ) return err;
4089 0 : err = fd_pubkey_encode_archival( &self->voter_pubkey, ctx );
4090 0 : if( FD_UNLIKELY( err ) ) return err;
4091 0 : err = fd_archive_encode_set_length( ctx, offset );
4092 0 : if( FD_UNLIKELY( err ) ) return err;
4093 0 : err = fd_bincode_uint16_encode( (ushort)fd_delegation_stake_TAG, ctx );
4094 0 : if( FD_UNLIKELY( err ) ) return err;
4095 0 : err = fd_bincode_uint64_encode( self->stake, ctx );
4096 0 : if( FD_UNLIKELY( err ) ) return err;
4097 0 : err = fd_bincode_uint16_encode( (ushort)fd_delegation_activation_epoch_TAG, ctx );
4098 0 : if( FD_UNLIKELY( err ) ) return err;
4099 0 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
4100 0 : if( FD_UNLIKELY( err ) ) return err;
4101 0 : err = fd_bincode_uint16_encode( (ushort)fd_delegation_deactivation_epoch_TAG, ctx );
4102 0 : if( FD_UNLIKELY( err ) ) return err;
4103 0 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
4104 0 : if( FD_UNLIKELY( err ) ) return err;
4105 0 : err = fd_bincode_uint16_encode( (ushort)fd_delegation_warmup_cooldown_rate_TAG, ctx );
4106 0 : if( FD_UNLIKELY( err ) ) return err;
4107 0 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
4108 0 : if( FD_UNLIKELY( err ) ) return err;
4109 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
4110 0 : if( FD_UNLIKELY( err ) ) return err;
4111 0 : return FD_BINCODE_SUCCESS;
4112 0 : }
4113 0 : int fd_delegation_decode_offsets( fd_delegation_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
4114 0 : uchar const * data = ctx->data;
4115 0 : int err;
4116 0 : self->voter_pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
4117 0 : err = fd_pubkey_decode_preflight( ctx );
4118 0 : if( FD_UNLIKELY( err ) ) return err;
4119 0 : self->stake_off = (uint)( (ulong)ctx->data - (ulong)data );
4120 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4121 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4122 0 : self->activation_epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
4123 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4124 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4125 0 : self->deactivation_epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
4126 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4127 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4128 0 : self->warmup_cooldown_rate_off = (uint)( (ulong)ctx->data - (ulong)data );
4129 0 : err = fd_bincode_double_decode_preflight( ctx );
4130 0 : if( FD_UNLIKELY( err ) ) return err;
4131 0 : return FD_BINCODE_SUCCESS;
4132 0 : }
4133 12 : void fd_delegation_new(fd_delegation_t * self) {
4134 12 : fd_memset( self, 0, sizeof(fd_delegation_t) );
4135 12 : fd_pubkey_new( &self->voter_pubkey );
4136 12 : }
4137 0 : void fd_delegation_destroy( fd_delegation_t * self, fd_bincode_destroy_ctx_t * ctx ) {
4138 0 : fd_pubkey_destroy( &self->voter_pubkey, ctx );
4139 0 : }
4140 :
4141 0 : ulong fd_delegation_footprint( void ){ return FD_DELEGATION_FOOTPRINT; }
4142 0 : ulong fd_delegation_align( void ){ return FD_DELEGATION_ALIGN; }
4143 :
4144 0 : void fd_delegation_walk( void * w, fd_delegation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4145 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_delegation", level++ );
4146 0 : fd_pubkey_walk( w, &self->voter_pubkey, fun, "voter_pubkey", level );
4147 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4148 0 : fun( w, &self->activation_epoch, "activation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4149 0 : fun( w, &self->deactivation_epoch, "deactivation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4150 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
4151 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_delegation", level-- );
4152 0 : }
4153 1830 : ulong fd_delegation_size( fd_delegation_t const * self ) {
4154 1830 : ulong size = 0;
4155 1830 : size += fd_pubkey_size( &self->voter_pubkey );
4156 1830 : size += sizeof(ulong);
4157 1830 : size += sizeof(ulong);
4158 1830 : size += sizeof(ulong);
4159 1830 : size += sizeof(double);
4160 1830 : return size;
4161 1830 : }
4162 :
4163 0 : int fd_delegation_pair_decode( fd_delegation_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4164 0 : void const * data = ctx->data;
4165 0 : int err = fd_delegation_pair_decode_preflight( ctx );
4166 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4167 0 : ctx->data = data;
4168 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4169 0 : fd_delegation_pair_new( self );
4170 0 : }
4171 0 : fd_delegation_pair_decode_unsafe( self, ctx );
4172 0 : return FD_BINCODE_SUCCESS;
4173 0 : }
4174 0 : int fd_delegation_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
4175 0 : return fd_bincode_bytes_decode_preflight( 96, ctx );
4176 0 : }
4177 0 : void fd_delegation_pair_decode_unsafe( fd_delegation_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4178 0 : fd_pubkey_decode_unsafe( &self->account, ctx );
4179 0 : fd_delegation_decode_unsafe( &self->delegation, ctx );
4180 0 : }
4181 0 : int fd_delegation_pair_encode( fd_delegation_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4182 0 : int err;
4183 0 : err = fd_pubkey_encode( &self->account, ctx );
4184 0 : if( FD_UNLIKELY( err ) ) return err;
4185 0 : err = fd_delegation_encode( &self->delegation, ctx );
4186 0 : if( FD_UNLIKELY( err ) ) return err;
4187 0 : return FD_BINCODE_SUCCESS;
4188 0 : }
4189 : enum {
4190 : fd_delegation_pair_account_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
4191 : fd_delegation_pair_delegation_TAG = (1 << 6) | FD_ARCHIVE_META_STRUCT,
4192 : };
4193 0 : int fd_delegation_pair_decode_archival( fd_delegation_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4194 0 : void const * data = ctx->data;
4195 0 : int err = fd_delegation_pair_decode_archival_preflight( ctx );
4196 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4197 0 : ctx->data = data;
4198 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4199 0 : fd_delegation_pair_new( self );
4200 0 : }
4201 0 : fd_delegation_pair_decode_archival_unsafe( self, ctx );
4202 0 : return FD_BINCODE_SUCCESS;
4203 0 : }
4204 0 : int fd_delegation_pair_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
4205 0 : int err;
4206 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
4207 0 : void * offset = NULL;
4208 0 : for(;;) {
4209 0 : err = fd_bincode_uint16_decode( &tag, ctx );
4210 0 : if( FD_UNLIKELY( err ) ) return err;
4211 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
4212 0 : switch( tag ) {
4213 0 : case (ushort)fd_delegation_pair_account_TAG: {
4214 0 : err = fd_archive_decode_setup_length( ctx, &offset );
4215 0 : if( FD_UNLIKELY( err ) ) return err;
4216 0 : err = fd_pubkey_decode_archival_preflight( ctx );
4217 0 : if( FD_UNLIKELY( err ) ) return err;
4218 0 : err = fd_archive_decode_check_length( ctx, offset );
4219 0 : if( FD_UNLIKELY( err ) ) return err;
4220 0 : break;
4221 0 : }
4222 0 : case (ushort)fd_delegation_pair_delegation_TAG: {
4223 0 : err = fd_archive_decode_setup_length( ctx, &offset );
4224 0 : if( FD_UNLIKELY( err ) ) return err;
4225 0 : err = fd_delegation_decode_archival_preflight( ctx );
4226 0 : if( FD_UNLIKELY( err ) ) return err;
4227 0 : err = fd_archive_decode_check_length( ctx, offset );
4228 0 : if( FD_UNLIKELY( err ) ) return err;
4229 0 : break;
4230 0 : }
4231 0 : default:
4232 0 : err = fd_archive_decode_skip_field( ctx, tag );
4233 0 : if( FD_UNLIKELY( err ) ) return err;
4234 0 : break;
4235 0 : }
4236 0 : }
4237 0 : return FD_BINCODE_SUCCESS;
4238 0 : }
4239 0 : void fd_delegation_pair_decode_archival_unsafe( fd_delegation_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4240 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
4241 0 : void * offset = NULL;
4242 0 : for(;;) {
4243 0 : fd_bincode_uint16_decode( &tag, ctx );
4244 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
4245 0 : switch( tag ) {
4246 0 : case (ushort)fd_delegation_pair_account_TAG: {
4247 0 : fd_archive_decode_setup_length( ctx, &offset );
4248 0 : fd_pubkey_decode_archival_unsafe( &self->account, ctx );
4249 0 : break;
4250 0 : }
4251 0 : case (ushort)fd_delegation_pair_delegation_TAG: {
4252 0 : fd_archive_decode_setup_length( ctx, &offset );
4253 0 : fd_delegation_decode_archival_unsafe( &self->delegation, ctx );
4254 0 : break;
4255 0 : }
4256 0 : default:
4257 0 : fd_archive_decode_skip_field( ctx, tag );
4258 0 : break;
4259 0 : }
4260 0 : }
4261 0 : }
4262 0 : int fd_delegation_pair_encode_archival( fd_delegation_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4263 0 : int err;
4264 0 : void * offset = NULL;
4265 0 : err = fd_bincode_uint16_encode( (ushort)fd_delegation_pair_account_TAG, ctx );
4266 0 : if( FD_UNLIKELY( err ) ) return err;
4267 0 : err = fd_archive_encode_setup_length( ctx, &offset );
4268 0 : if( FD_UNLIKELY( err ) ) return err;
4269 0 : err = fd_pubkey_encode_archival( &self->account, ctx );
4270 0 : if( FD_UNLIKELY( err ) ) return err;
4271 0 : err = fd_archive_encode_set_length( ctx, offset );
4272 0 : if( FD_UNLIKELY( err ) ) return err;
4273 0 : err = fd_bincode_uint16_encode( (ushort)fd_delegation_pair_delegation_TAG, ctx );
4274 0 : if( FD_UNLIKELY( err ) ) return err;
4275 0 : err = fd_archive_encode_setup_length( ctx, &offset );
4276 0 : if( FD_UNLIKELY( err ) ) return err;
4277 0 : err = fd_delegation_encode_archival( &self->delegation, ctx );
4278 0 : if( FD_UNLIKELY( err ) ) return err;
4279 0 : err = fd_archive_encode_set_length( ctx, offset );
4280 0 : if( FD_UNLIKELY( err ) ) return err;
4281 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
4282 0 : if( FD_UNLIKELY( err ) ) return err;
4283 0 : return FD_BINCODE_SUCCESS;
4284 0 : }
4285 0 : int fd_delegation_pair_decode_offsets( fd_delegation_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
4286 0 : uchar const * data = ctx->data;
4287 0 : int err;
4288 0 : self->account_off = (uint)( (ulong)ctx->data - (ulong)data );
4289 0 : err = fd_pubkey_decode_preflight( ctx );
4290 0 : if( FD_UNLIKELY( err ) ) return err;
4291 0 : self->delegation_off = (uint)( (ulong)ctx->data - (ulong)data );
4292 0 : err = fd_delegation_decode_preflight( ctx );
4293 0 : if( FD_UNLIKELY( err ) ) return err;
4294 0 : return FD_BINCODE_SUCCESS;
4295 0 : }
4296 0 : void fd_delegation_pair_new(fd_delegation_pair_t * self) {
4297 0 : fd_memset( self, 0, sizeof(fd_delegation_pair_t) );
4298 0 : fd_pubkey_new( &self->account );
4299 0 : fd_delegation_new( &self->delegation );
4300 0 : }
4301 0 : void fd_delegation_pair_destroy( fd_delegation_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
4302 0 : fd_pubkey_destroy( &self->account, ctx );
4303 0 : fd_delegation_destroy( &self->delegation, ctx );
4304 0 : }
4305 :
4306 0 : ulong fd_delegation_pair_footprint( void ){ return FD_DELEGATION_PAIR_FOOTPRINT; }
4307 0 : ulong fd_delegation_pair_align( void ){ return FD_DELEGATION_PAIR_ALIGN; }
4308 :
4309 0 : void fd_delegation_pair_walk( void * w, fd_delegation_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4310 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_delegation_pair", level++ );
4311 0 : fd_pubkey_walk( w, &self->account, fun, "account", level );
4312 0 : fd_delegation_walk( w, &self->delegation, fun, "delegation", level );
4313 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_delegation_pair", level-- );
4314 0 : }
4315 0 : ulong fd_delegation_pair_size( fd_delegation_pair_t const * self ) {
4316 0 : ulong size = 0;
4317 0 : size += fd_pubkey_size( &self->account );
4318 0 : size += fd_delegation_size( &self->delegation );
4319 0 : return size;
4320 0 : }
4321 :
4322 0 : int fd_stake_decode( fd_stake_t * self, fd_bincode_decode_ctx_t * ctx ) {
4323 0 : void const * data = ctx->data;
4324 0 : int err = fd_stake_decode_preflight( ctx );
4325 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4326 0 : ctx->data = data;
4327 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4328 0 : fd_stake_new( self );
4329 0 : }
4330 0 : fd_stake_decode_unsafe( self, ctx );
4331 0 : return FD_BINCODE_SUCCESS;
4332 0 : }
4333 0 : int fd_stake_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
4334 0 : return fd_bincode_bytes_decode_preflight( 72, ctx );
4335 0 : }
4336 4998 : void fd_stake_decode_unsafe( fd_stake_t * self, fd_bincode_decode_ctx_t * ctx ) {
4337 4998 : fd_delegation_decode_unsafe( &self->delegation, ctx );
4338 4998 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
4339 4998 : }
4340 1842 : int fd_stake_encode( fd_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4341 1842 : int err;
4342 1842 : err = fd_delegation_encode( &self->delegation, ctx );
4343 1842 : if( FD_UNLIKELY( err ) ) return err;
4344 1842 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
4345 1842 : if( FD_UNLIKELY( err ) ) return err;
4346 1842 : return FD_BINCODE_SUCCESS;
4347 1842 : }
4348 0 : int fd_stake_decode_offsets( fd_stake_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
4349 0 : uchar const * data = ctx->data;
4350 0 : int err;
4351 0 : self->delegation_off = (uint)( (ulong)ctx->data - (ulong)data );
4352 0 : err = fd_delegation_decode_preflight( ctx );
4353 0 : if( FD_UNLIKELY( err ) ) return err;
4354 0 : self->credits_observed_off = (uint)( (ulong)ctx->data - (ulong)data );
4355 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4356 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4357 0 : return FD_BINCODE_SUCCESS;
4358 0 : }
4359 12 : void fd_stake_new(fd_stake_t * self) {
4360 12 : fd_memset( self, 0, sizeof(fd_stake_t) );
4361 12 : fd_delegation_new( &self->delegation );
4362 12 : }
4363 0 : void fd_stake_destroy( fd_stake_t * self, fd_bincode_destroy_ctx_t * ctx ) {
4364 0 : fd_delegation_destroy( &self->delegation, ctx );
4365 0 : }
4366 :
4367 0 : ulong fd_stake_footprint( void ){ return FD_STAKE_FOOTPRINT; }
4368 0 : ulong fd_stake_align( void ){ return FD_STAKE_ALIGN; }
4369 :
4370 0 : void fd_stake_walk( void * w, fd_stake_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4371 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake", level++ );
4372 0 : fd_delegation_walk( w, &self->delegation, fun, "delegation", level );
4373 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4374 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake", level-- );
4375 0 : }
4376 1830 : ulong fd_stake_size( fd_stake_t const * self ) {
4377 1830 : ulong size = 0;
4378 1830 : size += fd_delegation_size( &self->delegation );
4379 1830 : size += sizeof(ulong);
4380 1830 : return size;
4381 1830 : }
4382 :
4383 0 : int fd_epoch_info_pair_decode( fd_epoch_info_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4384 0 : void const * data = ctx->data;
4385 0 : int err = fd_epoch_info_pair_decode_preflight( ctx );
4386 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4387 0 : ctx->data = data;
4388 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4389 0 : fd_epoch_info_pair_new( self );
4390 0 : }
4391 0 : fd_epoch_info_pair_decode_unsafe( self, ctx );
4392 0 : return FD_BINCODE_SUCCESS;
4393 0 : }
4394 0 : int fd_epoch_info_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
4395 0 : return fd_bincode_bytes_decode_preflight( 104, ctx );
4396 0 : }
4397 0 : void fd_epoch_info_pair_decode_unsafe( fd_epoch_info_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4398 0 : fd_pubkey_decode_unsafe( &self->account, ctx );
4399 0 : fd_stake_decode_unsafe( &self->stake, ctx );
4400 0 : }
4401 0 : int fd_epoch_info_pair_encode( fd_epoch_info_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4402 0 : int err;
4403 0 : err = fd_pubkey_encode( &self->account, ctx );
4404 0 : if( FD_UNLIKELY( err ) ) return err;
4405 0 : err = fd_stake_encode( &self->stake, ctx );
4406 0 : if( FD_UNLIKELY( err ) ) return err;
4407 0 : return FD_BINCODE_SUCCESS;
4408 0 : }
4409 0 : int fd_epoch_info_pair_decode_offsets( fd_epoch_info_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
4410 0 : uchar const * data = ctx->data;
4411 0 : int err;
4412 0 : self->account_off = (uint)( (ulong)ctx->data - (ulong)data );
4413 0 : err = fd_pubkey_decode_preflight( ctx );
4414 0 : if( FD_UNLIKELY( err ) ) return err;
4415 0 : self->stake_off = (uint)( (ulong)ctx->data - (ulong)data );
4416 0 : err = fd_stake_decode_preflight( ctx );
4417 0 : if( FD_UNLIKELY( err ) ) return err;
4418 0 : return FD_BINCODE_SUCCESS;
4419 0 : }
4420 0 : void fd_epoch_info_pair_new(fd_epoch_info_pair_t * self) {
4421 0 : fd_memset( self, 0, sizeof(fd_epoch_info_pair_t) );
4422 0 : fd_pubkey_new( &self->account );
4423 0 : fd_stake_new( &self->stake );
4424 0 : }
4425 0 : void fd_epoch_info_pair_destroy( fd_epoch_info_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
4426 0 : fd_pubkey_destroy( &self->account, ctx );
4427 0 : fd_stake_destroy( &self->stake, ctx );
4428 0 : }
4429 :
4430 0 : ulong fd_epoch_info_pair_footprint( void ){ return FD_EPOCH_INFO_PAIR_FOOTPRINT; }
4431 0 : ulong fd_epoch_info_pair_align( void ){ return FD_EPOCH_INFO_PAIR_ALIGN; }
4432 :
4433 0 : void fd_epoch_info_pair_walk( void * w, fd_epoch_info_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4434 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_info_pair", level++ );
4435 0 : fd_pubkey_walk( w, &self->account, fun, "account", level );
4436 0 : fd_stake_walk( w, &self->stake, fun, "stake", level );
4437 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_info_pair", level-- );
4438 0 : }
4439 0 : ulong fd_epoch_info_pair_size( fd_epoch_info_pair_t const * self ) {
4440 0 : ulong size = 0;
4441 0 : size += fd_pubkey_size( &self->account );
4442 0 : size += fd_stake_size( &self->stake );
4443 0 : return size;
4444 0 : }
4445 :
4446 0 : int fd_epoch_info_decode( fd_epoch_info_t * self, fd_bincode_decode_ctx_t * ctx ) {
4447 0 : void const * data = ctx->data;
4448 0 : int err = fd_epoch_info_decode_preflight( ctx );
4449 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4450 0 : ctx->data = data;
4451 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4452 0 : fd_epoch_info_new( self );
4453 0 : }
4454 0 : fd_epoch_info_decode_unsafe( self, ctx );
4455 0 : return FD_BINCODE_SUCCESS;
4456 0 : }
4457 0 : int fd_epoch_info_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
4458 0 : int err;
4459 0 : ulong infos_len;
4460 0 : err = fd_bincode_uint64_decode( &infos_len, ctx );
4461 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4462 0 : if( infos_len ) {
4463 0 : for( ulong i=0; i < infos_len; i++ ) {
4464 0 : err = fd_epoch_info_pair_decode_preflight( ctx );
4465 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4466 0 : }
4467 0 : }
4468 0 : return FD_BINCODE_SUCCESS;
4469 0 : }
4470 0 : void fd_epoch_info_decode_unsafe( fd_epoch_info_t * self, fd_bincode_decode_ctx_t * ctx ) {
4471 0 : fd_bincode_uint64_decode_unsafe( &self->infos_len, ctx );
4472 0 : if( self->infos_len ) {
4473 0 : self->infos = (fd_epoch_info_pair_t *)fd_valloc_malloc( ctx->valloc, FD_EPOCH_INFO_PAIR_ALIGN, FD_EPOCH_INFO_PAIR_FOOTPRINT*self->infos_len );
4474 0 : for( ulong i=0; i < self->infos_len; i++ ) {
4475 0 : fd_epoch_info_pair_new( self->infos + i );
4476 0 : fd_epoch_info_pair_decode_unsafe( self->infos + i, ctx );
4477 0 : }
4478 0 : } else
4479 0 : self->infos = NULL;
4480 0 : }
4481 0 : int fd_epoch_info_encode( fd_epoch_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4482 0 : int err;
4483 0 : err = fd_bincode_uint64_encode( self->infos_len, ctx );
4484 0 : if( FD_UNLIKELY(err) ) return err;
4485 0 : if( self->infos_len ) {
4486 0 : for( ulong i=0; i < self->infos_len; i++ ) {
4487 0 : err = fd_epoch_info_pair_encode( self->infos + i, ctx );
4488 0 : if( FD_UNLIKELY( err ) ) return err;
4489 0 : }
4490 0 : }
4491 0 : return FD_BINCODE_SUCCESS;
4492 0 : }
4493 0 : int fd_epoch_info_decode_offsets( fd_epoch_info_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
4494 0 : uchar const * data = ctx->data;
4495 0 : int err;
4496 0 : self->infos_off = (uint)( (ulong)ctx->data - (ulong)data );
4497 0 : ulong infos_len;
4498 0 : err = fd_bincode_uint64_decode( &infos_len, ctx );
4499 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4500 0 : if( infos_len ) {
4501 0 : for( ulong i=0; i < infos_len; i++ ) {
4502 0 : err = fd_epoch_info_pair_decode_preflight( ctx );
4503 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4504 0 : }
4505 0 : }
4506 0 : return FD_BINCODE_SUCCESS;
4507 0 : }
4508 0 : void fd_epoch_info_new(fd_epoch_info_t * self) {
4509 0 : fd_memset( self, 0, sizeof(fd_epoch_info_t) );
4510 0 : }
4511 0 : void fd_epoch_info_destroy( fd_epoch_info_t * self, fd_bincode_destroy_ctx_t * ctx ) {
4512 0 : if( self->infos ) {
4513 0 : for( ulong i=0; i < self->infos_len; i++ )
4514 0 : fd_epoch_info_pair_destroy( self->infos + i, ctx );
4515 0 : fd_valloc_free( ctx->valloc, self->infos );
4516 0 : self->infos = NULL;
4517 0 : }
4518 0 : }
4519 :
4520 0 : ulong fd_epoch_info_footprint( void ){ return FD_EPOCH_INFO_FOOTPRINT; }
4521 0 : ulong fd_epoch_info_align( void ){ return FD_EPOCH_INFO_ALIGN; }
4522 :
4523 0 : void fd_epoch_info_walk( void * w, fd_epoch_info_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4524 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_info", level++ );
4525 0 : if( self->infos_len ) {
4526 0 : fun( w, NULL, "infos", FD_FLAMENCO_TYPE_ARR, "array", level++ );
4527 0 : for( ulong i=0; i < self->infos_len; i++ )
4528 0 : fd_epoch_info_pair_walk(w, self->infos + i, fun, "epoch_info_pair", level );
4529 0 : fun( w, NULL, "infos", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
4530 0 : }
4531 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_info", level-- );
4532 0 : }
4533 0 : ulong fd_epoch_info_size( fd_epoch_info_t const * self ) {
4534 0 : ulong size = 0;
4535 0 : do {
4536 0 : size += sizeof(ulong);
4537 0 : for( ulong i=0; i < self->infos_len; i++ )
4538 0 : size += fd_epoch_info_pair_size( self->infos + i );
4539 0 : } while(0);
4540 0 : return size;
4541 0 : }
4542 :
4543 0 : int fd_stake_pair_decode( fd_stake_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4544 0 : void const * data = ctx->data;
4545 0 : int err = fd_stake_pair_decode_preflight( ctx );
4546 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4547 0 : ctx->data = data;
4548 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4549 0 : fd_stake_pair_new( self );
4550 0 : }
4551 0 : fd_stake_pair_decode_unsafe( self, ctx );
4552 0 : return FD_BINCODE_SUCCESS;
4553 0 : }
4554 0 : int fd_stake_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
4555 0 : return fd_bincode_bytes_decode_preflight( 104, ctx );
4556 0 : }
4557 0 : void fd_stake_pair_decode_unsafe( fd_stake_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
4558 0 : fd_pubkey_decode_unsafe( &self->account, ctx );
4559 0 : fd_stake_decode_unsafe( &self->stake, ctx );
4560 0 : }
4561 0 : int fd_stake_pair_encode( fd_stake_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4562 0 : int err;
4563 0 : err = fd_pubkey_encode( &self->account, ctx );
4564 0 : if( FD_UNLIKELY( err ) ) return err;
4565 0 : err = fd_stake_encode( &self->stake, ctx );
4566 0 : if( FD_UNLIKELY( err ) ) return err;
4567 0 : return FD_BINCODE_SUCCESS;
4568 0 : }
4569 0 : int fd_stake_pair_decode_offsets( fd_stake_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
4570 0 : uchar const * data = ctx->data;
4571 0 : int err;
4572 0 : self->account_off = (uint)( (ulong)ctx->data - (ulong)data );
4573 0 : err = fd_pubkey_decode_preflight( ctx );
4574 0 : if( FD_UNLIKELY( err ) ) return err;
4575 0 : self->stake_off = (uint)( (ulong)ctx->data - (ulong)data );
4576 0 : err = fd_stake_decode_preflight( ctx );
4577 0 : if( FD_UNLIKELY( err ) ) return err;
4578 0 : return FD_BINCODE_SUCCESS;
4579 0 : }
4580 0 : void fd_stake_pair_new(fd_stake_pair_t * self) {
4581 0 : fd_memset( self, 0, sizeof(fd_stake_pair_t) );
4582 0 : fd_pubkey_new( &self->account );
4583 0 : fd_stake_new( &self->stake );
4584 0 : }
4585 0 : void fd_stake_pair_destroy( fd_stake_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
4586 0 : fd_pubkey_destroy( &self->account, ctx );
4587 0 : fd_stake_destroy( &self->stake, ctx );
4588 0 : }
4589 :
4590 0 : ulong fd_stake_pair_footprint( void ){ return FD_STAKE_PAIR_FOOTPRINT; }
4591 0 : ulong fd_stake_pair_align( void ){ return FD_STAKE_PAIR_ALIGN; }
4592 :
4593 0 : void fd_stake_pair_walk( void * w, fd_stake_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4594 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_pair", level++ );
4595 0 : fd_pubkey_walk( w, &self->account, fun, "account", level );
4596 0 : fd_stake_walk( w, &self->stake, fun, "stake", level );
4597 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_pair", level-- );
4598 0 : }
4599 0 : ulong fd_stake_pair_size( fd_stake_pair_t const * self ) {
4600 0 : ulong size = 0;
4601 0 : size += fd_pubkey_size( &self->account );
4602 0 : size += fd_stake_size( &self->stake );
4603 0 : return size;
4604 0 : }
4605 :
4606 0 : int fd_stakes_decode( fd_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
4607 0 : void const * data = ctx->data;
4608 0 : int err = fd_stakes_decode_preflight( ctx );
4609 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4610 0 : ctx->data = data;
4611 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4612 0 : fd_stakes_new( self );
4613 0 : }
4614 0 : fd_stakes_decode_unsafe( self, ctx );
4615 0 : return FD_BINCODE_SUCCESS;
4616 0 : }
4617 6 : int fd_stakes_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
4618 6 : int err;
4619 6 : err = fd_vote_accounts_decode_preflight( ctx );
4620 6 : if( FD_UNLIKELY( err ) ) return err;
4621 6 : ulong stake_delegations_len;
4622 6 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
4623 6 : if( FD_UNLIKELY( err ) ) return err;
4624 6 : for( ulong i=0; i < stake_delegations_len; i++ ) {
4625 0 : err = fd_delegation_pair_decode_preflight( ctx );
4626 0 : if( FD_UNLIKELY( err ) ) return err;
4627 0 : }
4628 6 : err = fd_bincode_uint64_decode_preflight( ctx );
4629 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4630 6 : err = fd_bincode_uint64_decode_preflight( ctx );
4631 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4632 6 : err = fd_stake_history_decode_preflight( ctx );
4633 6 : if( FD_UNLIKELY( err ) ) return err;
4634 6 : return FD_BINCODE_SUCCESS;
4635 6 : }
4636 6 : void fd_stakes_decode_unsafe( fd_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
4637 6 : fd_vote_accounts_decode_unsafe( &self->vote_accounts, ctx );
4638 6 : ulong stake_delegations_len;
4639 6 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
4640 6 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4641 6 : self->stake_delegations_pool = fd_delegation_pair_t_map_alloc( ctx->valloc, stake_delegations_len );
4642 6 : self->stake_delegations_root = NULL;
4643 6 : }
4644 6 : for( ulong i=0; i < stake_delegations_len; i++ ) {
4645 0 : fd_delegation_pair_t_mapnode_t * node = fd_delegation_pair_t_map_acquire( self->stake_delegations_pool );
4646 0 : fd_delegation_pair_new( &node->elem );
4647 0 : fd_delegation_pair_decode_unsafe( &node->elem, ctx );
4648 0 : fd_delegation_pair_t_map_insert( self->stake_delegations_pool, &self->stake_delegations_root, node );
4649 0 : }
4650 6 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
4651 6 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
4652 6 : fd_stake_history_decode_unsafe( &self->stake_history, ctx );
4653 6 : }
4654 6 : int fd_stakes_encode( fd_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4655 6 : int err;
4656 6 : err = fd_vote_accounts_encode( &self->vote_accounts, ctx );
4657 6 : if( FD_UNLIKELY( err ) ) return err;
4658 6 : if( self->stake_delegations_root ) {
4659 0 : ulong stake_delegations_len = fd_delegation_pair_t_map_size( self->stake_delegations_pool, self->stake_delegations_root );
4660 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
4661 0 : if( FD_UNLIKELY( err ) ) return err;
4662 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
4663 0 : err = fd_delegation_pair_encode( &n->elem, ctx );
4664 0 : if( FD_UNLIKELY( err ) ) return err;
4665 0 : }
4666 6 : } else {
4667 6 : ulong stake_delegations_len = 0;
4668 6 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
4669 6 : if( FD_UNLIKELY( err ) ) return err;
4670 6 : }
4671 6 : err = fd_bincode_uint64_encode( self->unused, ctx );
4672 6 : if( FD_UNLIKELY( err ) ) return err;
4673 6 : err = fd_bincode_uint64_encode( self->epoch, ctx );
4674 6 : if( FD_UNLIKELY( err ) ) return err;
4675 6 : err = fd_stake_history_encode( &self->stake_history, ctx );
4676 6 : if( FD_UNLIKELY( err ) ) return err;
4677 6 : return FD_BINCODE_SUCCESS;
4678 6 : }
4679 : enum {
4680 : fd_stakes_vote_accounts_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
4681 : fd_stakes_stake_delegations_TAG = (1 << 6) | FD_ARCHIVE_META_MAP,
4682 : fd_stakes_unused_TAG = (2 << 6) | FD_ARCHIVE_META_ULONG,
4683 : fd_stakes_epoch_TAG = (3 << 6) | FD_ARCHIVE_META_ULONG,
4684 : fd_stakes_stake_history_TAG = (4 << 6) | FD_ARCHIVE_META_STRUCT,
4685 : };
4686 0 : int fd_stakes_decode_archival( fd_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
4687 0 : void const * data = ctx->data;
4688 0 : int err = fd_stakes_decode_archival_preflight( ctx );
4689 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4690 0 : ctx->data = data;
4691 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4692 0 : fd_stakes_new( self );
4693 0 : }
4694 0 : fd_stakes_decode_archival_unsafe( self, ctx );
4695 0 : return FD_BINCODE_SUCCESS;
4696 0 : }
4697 0 : int fd_stakes_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
4698 0 : int err;
4699 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
4700 0 : void * offset = NULL;
4701 0 : for(;;) {
4702 0 : err = fd_bincode_uint16_decode( &tag, ctx );
4703 0 : if( FD_UNLIKELY( err ) ) return err;
4704 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
4705 0 : switch( tag ) {
4706 0 : case (ushort)fd_stakes_vote_accounts_TAG: {
4707 0 : err = fd_archive_decode_setup_length( ctx, &offset );
4708 0 : if( FD_UNLIKELY( err ) ) return err;
4709 0 : err = fd_vote_accounts_decode_archival_preflight( ctx );
4710 0 : if( FD_UNLIKELY( err ) ) return err;
4711 0 : err = fd_archive_decode_check_length( ctx, offset );
4712 0 : if( FD_UNLIKELY( err ) ) return err;
4713 0 : break;
4714 0 : }
4715 0 : case (ushort)fd_stakes_stake_delegations_TAG: {
4716 0 : err = fd_archive_decode_setup_length( ctx, &offset );
4717 0 : if( FD_UNLIKELY( err ) ) return err;
4718 0 : ulong stake_delegations_len;
4719 0 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
4720 0 : if( FD_UNLIKELY( err ) ) return err;
4721 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
4722 0 : err = fd_delegation_pair_decode_archival_preflight( ctx );
4723 0 : if( FD_UNLIKELY( err ) ) return err;
4724 0 : }
4725 0 : err = fd_archive_decode_check_length( ctx, offset );
4726 0 : if( FD_UNLIKELY( err ) ) return err;
4727 0 : break;
4728 0 : }
4729 0 : case (ushort)fd_stakes_unused_TAG: {
4730 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4731 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4732 0 : break;
4733 0 : }
4734 0 : case (ushort)fd_stakes_epoch_TAG: {
4735 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4736 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4737 0 : break;
4738 0 : }
4739 0 : case (ushort)fd_stakes_stake_history_TAG: {
4740 0 : err = fd_archive_decode_setup_length( ctx, &offset );
4741 0 : if( FD_UNLIKELY( err ) ) return err;
4742 0 : err = fd_stake_history_decode_archival_preflight( ctx );
4743 0 : if( FD_UNLIKELY( err ) ) return err;
4744 0 : err = fd_archive_decode_check_length( ctx, offset );
4745 0 : if( FD_UNLIKELY( err ) ) return err;
4746 0 : break;
4747 0 : }
4748 0 : default:
4749 0 : err = fd_archive_decode_skip_field( ctx, tag );
4750 0 : if( FD_UNLIKELY( err ) ) return err;
4751 0 : break;
4752 0 : }
4753 0 : }
4754 0 : return FD_BINCODE_SUCCESS;
4755 0 : }
4756 0 : void fd_stakes_decode_archival_unsafe( fd_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
4757 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
4758 0 : void * offset = NULL;
4759 0 : for(;;) {
4760 0 : fd_bincode_uint16_decode( &tag, ctx );
4761 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
4762 0 : switch( tag ) {
4763 0 : case (ushort)fd_stakes_vote_accounts_TAG: {
4764 0 : fd_archive_decode_setup_length( ctx, &offset );
4765 0 : fd_vote_accounts_decode_archival_unsafe( &self->vote_accounts, ctx );
4766 0 : break;
4767 0 : }
4768 0 : case (ushort)fd_stakes_stake_delegations_TAG: {
4769 0 : fd_archive_decode_setup_length( ctx, &offset );
4770 0 : ulong stake_delegations_len;
4771 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
4772 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4773 0 : self->stake_delegations_pool = fd_delegation_pair_t_map_alloc( ctx->valloc, stake_delegations_len );
4774 0 : self->stake_delegations_root = NULL;
4775 0 : }
4776 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
4777 0 : fd_delegation_pair_t_mapnode_t * node = fd_delegation_pair_t_map_acquire( self->stake_delegations_pool );
4778 0 : fd_delegation_pair_new( &node->elem );
4779 0 : fd_delegation_pair_decode_archival_unsafe( &node->elem, ctx );
4780 0 : fd_delegation_pair_t_map_insert( self->stake_delegations_pool, &self->stake_delegations_root, node );
4781 0 : }
4782 0 : break;
4783 0 : }
4784 0 : case (ushort)fd_stakes_unused_TAG: {
4785 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
4786 0 : break;
4787 0 : }
4788 0 : case (ushort)fd_stakes_epoch_TAG: {
4789 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
4790 0 : break;
4791 0 : }
4792 0 : case (ushort)fd_stakes_stake_history_TAG: {
4793 0 : fd_archive_decode_setup_length( ctx, &offset );
4794 0 : fd_stake_history_decode_archival_unsafe( &self->stake_history, ctx );
4795 0 : break;
4796 0 : }
4797 0 : default:
4798 0 : fd_archive_decode_skip_field( ctx, tag );
4799 0 : break;
4800 0 : }
4801 0 : }
4802 0 : }
4803 0 : int fd_stakes_encode_archival( fd_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4804 0 : int err;
4805 0 : void * offset = NULL;
4806 0 : err = fd_bincode_uint16_encode( (ushort)fd_stakes_vote_accounts_TAG, ctx );
4807 0 : if( FD_UNLIKELY( err ) ) return err;
4808 0 : err = fd_archive_encode_setup_length( ctx, &offset );
4809 0 : if( FD_UNLIKELY( err ) ) return err;
4810 0 : err = fd_vote_accounts_encode_archival( &self->vote_accounts, ctx );
4811 0 : if( FD_UNLIKELY( err ) ) return err;
4812 0 : err = fd_archive_encode_set_length( ctx, offset );
4813 0 : if( FD_UNLIKELY( err ) ) return err;
4814 0 : err = fd_bincode_uint16_encode( (ushort)fd_stakes_stake_delegations_TAG, ctx );
4815 0 : if( FD_UNLIKELY( err ) ) return err;
4816 0 : err = fd_archive_encode_setup_length( ctx, &offset );
4817 0 : if( FD_UNLIKELY( err ) ) return err;
4818 0 : if( self->stake_delegations_root ) {
4819 0 : ulong stake_delegations_len = fd_delegation_pair_t_map_size( self->stake_delegations_pool, self->stake_delegations_root );
4820 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
4821 0 : if( FD_UNLIKELY( err ) ) return err;
4822 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
4823 0 : err = fd_delegation_pair_encode_archival( &n->elem, ctx );
4824 0 : if( FD_UNLIKELY( err ) ) return err;
4825 0 : }
4826 0 : } else {
4827 0 : ulong stake_delegations_len = 0;
4828 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
4829 0 : if( FD_UNLIKELY( err ) ) return err;
4830 0 : }
4831 0 : err = fd_archive_encode_set_length( ctx, offset );
4832 0 : if( FD_UNLIKELY( err ) ) return err;
4833 0 : err = fd_bincode_uint16_encode( (ushort)fd_stakes_unused_TAG, ctx );
4834 0 : if( FD_UNLIKELY( err ) ) return err;
4835 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
4836 0 : if( FD_UNLIKELY( err ) ) return err;
4837 0 : err = fd_bincode_uint16_encode( (ushort)fd_stakes_epoch_TAG, ctx );
4838 0 : if( FD_UNLIKELY( err ) ) return err;
4839 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
4840 0 : if( FD_UNLIKELY( err ) ) return err;
4841 0 : err = fd_bincode_uint16_encode( (ushort)fd_stakes_stake_history_TAG, ctx );
4842 0 : if( FD_UNLIKELY( err ) ) return err;
4843 0 : err = fd_archive_encode_setup_length( ctx, &offset );
4844 0 : if( FD_UNLIKELY( err ) ) return err;
4845 0 : err = fd_stake_history_encode_archival( &self->stake_history, ctx );
4846 0 : if( FD_UNLIKELY( err ) ) return err;
4847 0 : err = fd_archive_encode_set_length( ctx, offset );
4848 0 : if( FD_UNLIKELY( err ) ) return err;
4849 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
4850 0 : if( FD_UNLIKELY( err ) ) return err;
4851 0 : return FD_BINCODE_SUCCESS;
4852 0 : }
4853 0 : int fd_stakes_decode_offsets( fd_stakes_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
4854 0 : uchar const * data = ctx->data;
4855 0 : int err;
4856 0 : self->vote_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
4857 0 : err = fd_vote_accounts_decode_preflight( ctx );
4858 0 : if( FD_UNLIKELY( err ) ) return err;
4859 0 : self->stake_delegations_off = (uint)( (ulong)ctx->data - (ulong)data );
4860 0 : ulong stake_delegations_len;
4861 0 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
4862 0 : if( FD_UNLIKELY( err ) ) return err;
4863 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
4864 0 : err = fd_delegation_pair_decode_preflight( ctx );
4865 0 : if( FD_UNLIKELY( err ) ) return err;
4866 0 : }
4867 0 : self->unused_off = (uint)( (ulong)ctx->data - (ulong)data );
4868 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4869 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4870 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
4871 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4872 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4873 0 : self->stake_history_off = (uint)( (ulong)ctx->data - (ulong)data );
4874 0 : err = fd_stake_history_decode_preflight( ctx );
4875 0 : if( FD_UNLIKELY( err ) ) return err;
4876 0 : return FD_BINCODE_SUCCESS;
4877 0 : }
4878 407865 : void fd_stakes_new(fd_stakes_t * self) {
4879 407865 : fd_memset( self, 0, sizeof(fd_stakes_t) );
4880 407865 : fd_vote_accounts_new( &self->vote_accounts );
4881 407865 : fd_stake_history_new( &self->stake_history );
4882 407865 : }
4883 0 : void fd_stakes_destroy( fd_stakes_t * self, fd_bincode_destroy_ctx_t * ctx ) {
4884 0 : fd_vote_accounts_destroy( &self->vote_accounts, ctx );
4885 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor(self->stake_delegations_pool, n) ) {
4886 0 : fd_delegation_pair_destroy( &n->elem, ctx );
4887 0 : }
4888 0 : fd_valloc_free( ctx->valloc, fd_delegation_pair_t_map_delete( fd_delegation_pair_t_map_leave( self->stake_delegations_pool ) ) );
4889 0 : self->stake_delegations_pool = NULL;
4890 0 : self->stake_delegations_root = NULL;
4891 0 : fd_stake_history_destroy( &self->stake_history, ctx );
4892 0 : }
4893 :
4894 0 : ulong fd_stakes_footprint( void ){ return FD_STAKES_FOOTPRINT; }
4895 0 : ulong fd_stakes_align( void ){ return FD_STAKES_ALIGN; }
4896 :
4897 0 : void fd_stakes_walk( void * w, fd_stakes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
4898 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stakes", level++ );
4899 0 : fd_vote_accounts_walk( w, &self->vote_accounts, fun, "vote_accounts", level );
4900 0 : if( self->stake_delegations_root ) {
4901 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
4902 0 : fd_delegation_pair_walk(w, &n->elem, fun, "stake_delegations", level );
4903 0 : }
4904 0 : }
4905 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4906 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
4907 0 : fd_stake_history_walk( w, &self->stake_history, fun, "stake_history", level );
4908 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stakes", level-- );
4909 0 : }
4910 6 : ulong fd_stakes_size( fd_stakes_t const * self ) {
4911 6 : ulong size = 0;
4912 6 : size += fd_vote_accounts_size( &self->vote_accounts );
4913 6 : if( self->stake_delegations_root ) {
4914 0 : size += sizeof(ulong);
4915 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
4916 0 : size += fd_delegation_pair_size( &n->elem );
4917 0 : }
4918 6 : } else {
4919 6 : size += sizeof(ulong);
4920 6 : }
4921 6 : size += sizeof(ulong);
4922 6 : size += sizeof(ulong);
4923 6 : size += fd_stake_history_size( &self->stake_history );
4924 6 : return size;
4925 6 : }
4926 :
4927 0 : int fd_stakes_serializable_decode( fd_stakes_serializable_t * self, fd_bincode_decode_ctx_t * ctx ) {
4928 0 : void const * data = ctx->data;
4929 0 : int err = fd_stakes_serializable_decode_preflight( ctx );
4930 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4931 0 : ctx->data = data;
4932 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4933 0 : fd_stakes_serializable_new( self );
4934 0 : }
4935 0 : fd_stakes_serializable_decode_unsafe( self, ctx );
4936 0 : return FD_BINCODE_SUCCESS;
4937 0 : }
4938 0 : int fd_stakes_serializable_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
4939 0 : int err;
4940 0 : err = fd_vote_accounts_serializable_decode_preflight( ctx );
4941 0 : if( FD_UNLIKELY( err ) ) return err;
4942 0 : ulong stake_delegations_len;
4943 0 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
4944 0 : if( FD_UNLIKELY( err ) ) return err;
4945 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
4946 0 : err = fd_delegation_pair_decode_preflight( ctx );
4947 0 : if( FD_UNLIKELY( err ) ) return err;
4948 0 : }
4949 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4950 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4951 0 : err = fd_bincode_uint64_decode_preflight( ctx );
4952 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4953 0 : err = fd_stake_history_decode_preflight( ctx );
4954 0 : if( FD_UNLIKELY( err ) ) return err;
4955 0 : return FD_BINCODE_SUCCESS;
4956 0 : }
4957 0 : void fd_stakes_serializable_decode_unsafe( fd_stakes_serializable_t * self, fd_bincode_decode_ctx_t * ctx ) {
4958 0 : fd_vote_accounts_serializable_decode_unsafe( &self->vote_accounts, ctx );
4959 0 : ulong stake_delegations_len;
4960 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
4961 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
4962 0 : self->stake_delegations_pool = fd_delegation_pair_t_map_alloc( ctx->valloc, stake_delegations_len );
4963 0 : self->stake_delegations_root = NULL;
4964 0 : }
4965 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
4966 0 : fd_delegation_pair_t_mapnode_t * node = fd_delegation_pair_t_map_acquire( self->stake_delegations_pool );
4967 0 : fd_delegation_pair_new( &node->elem );
4968 0 : fd_delegation_pair_decode_unsafe( &node->elem, ctx );
4969 0 : fd_delegation_pair_t_map_insert( self->stake_delegations_pool, &self->stake_delegations_root, node );
4970 0 : }
4971 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
4972 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
4973 0 : fd_stake_history_decode_unsafe( &self->stake_history, ctx );
4974 0 : }
4975 0 : int fd_stakes_serializable_encode( fd_stakes_serializable_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4976 0 : int err;
4977 0 : err = fd_vote_accounts_serializable_encode( &self->vote_accounts, ctx );
4978 0 : if( FD_UNLIKELY( err ) ) return err;
4979 0 : if( self->stake_delegations_root ) {
4980 0 : ulong stake_delegations_len = fd_delegation_pair_t_map_size( self->stake_delegations_pool, self->stake_delegations_root );
4981 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
4982 0 : if( FD_UNLIKELY( err ) ) return err;
4983 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
4984 0 : err = fd_delegation_pair_encode( &n->elem, ctx );
4985 0 : if( FD_UNLIKELY( err ) ) return err;
4986 0 : }
4987 0 : } else {
4988 0 : ulong stake_delegations_len = 0;
4989 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
4990 0 : if( FD_UNLIKELY( err ) ) return err;
4991 0 : }
4992 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
4993 0 : if( FD_UNLIKELY( err ) ) return err;
4994 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
4995 0 : if( FD_UNLIKELY( err ) ) return err;
4996 0 : err = fd_stake_history_encode( &self->stake_history, ctx );
4997 0 : if( FD_UNLIKELY( err ) ) return err;
4998 0 : return FD_BINCODE_SUCCESS;
4999 0 : }
5000 0 : int fd_stakes_serializable_decode_offsets( fd_stakes_serializable_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5001 0 : uchar const * data = ctx->data;
5002 0 : int err;
5003 0 : self->vote_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
5004 0 : err = fd_vote_accounts_serializable_decode_preflight( ctx );
5005 0 : if( FD_UNLIKELY( err ) ) return err;
5006 0 : self->stake_delegations_off = (uint)( (ulong)ctx->data - (ulong)data );
5007 0 : ulong stake_delegations_len;
5008 0 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
5009 0 : if( FD_UNLIKELY( err ) ) return err;
5010 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
5011 0 : err = fd_delegation_pair_decode_preflight( ctx );
5012 0 : if( FD_UNLIKELY( err ) ) return err;
5013 0 : }
5014 0 : self->unused_off = (uint)( (ulong)ctx->data - (ulong)data );
5015 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5016 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5017 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
5018 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5019 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5020 0 : self->stake_history_off = (uint)( (ulong)ctx->data - (ulong)data );
5021 0 : err = fd_stake_history_decode_preflight( ctx );
5022 0 : if( FD_UNLIKELY( err ) ) return err;
5023 0 : return FD_BINCODE_SUCCESS;
5024 0 : }
5025 0 : void fd_stakes_serializable_new(fd_stakes_serializable_t * self) {
5026 0 : fd_memset( self, 0, sizeof(fd_stakes_serializable_t) );
5027 0 : fd_vote_accounts_serializable_new( &self->vote_accounts );
5028 0 : fd_stake_history_new( &self->stake_history );
5029 0 : }
5030 0 : void fd_stakes_serializable_destroy( fd_stakes_serializable_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5031 0 : fd_vote_accounts_serializable_destroy( &self->vote_accounts, ctx );
5032 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor(self->stake_delegations_pool, n) ) {
5033 0 : fd_delegation_pair_destroy( &n->elem, ctx );
5034 0 : }
5035 0 : fd_valloc_free( ctx->valloc, fd_delegation_pair_t_map_delete( fd_delegation_pair_t_map_leave( self->stake_delegations_pool ) ) );
5036 0 : self->stake_delegations_pool = NULL;
5037 0 : self->stake_delegations_root = NULL;
5038 0 : fd_stake_history_destroy( &self->stake_history, ctx );
5039 0 : }
5040 :
5041 0 : ulong fd_stakes_serializable_footprint( void ){ return FD_STAKES_SERIALIZABLE_FOOTPRINT; }
5042 0 : ulong fd_stakes_serializable_align( void ){ return FD_STAKES_SERIALIZABLE_ALIGN; }
5043 :
5044 0 : void fd_stakes_serializable_walk( void * w, fd_stakes_serializable_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5045 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stakes_serializable", level++ );
5046 0 : fd_vote_accounts_serializable_walk( w, &self->vote_accounts, fun, "vote_accounts", level );
5047 0 : if( self->stake_delegations_root ) {
5048 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
5049 0 : fd_delegation_pair_walk(w, &n->elem, fun, "stake_delegations", level );
5050 0 : }
5051 0 : }
5052 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5053 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5054 0 : fd_stake_history_walk( w, &self->stake_history, fun, "stake_history", level );
5055 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stakes_serializable", level-- );
5056 0 : }
5057 0 : ulong fd_stakes_serializable_size( fd_stakes_serializable_t const * self ) {
5058 0 : ulong size = 0;
5059 0 : size += fd_vote_accounts_serializable_size( &self->vote_accounts );
5060 0 : if( self->stake_delegations_root ) {
5061 0 : size += sizeof(ulong);
5062 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
5063 0 : size += fd_delegation_pair_size( &n->elem );
5064 0 : }
5065 0 : } else {
5066 0 : size += sizeof(ulong);
5067 0 : }
5068 0 : size += sizeof(ulong);
5069 0 : size += sizeof(ulong);
5070 0 : size += fd_stake_history_size( &self->stake_history );
5071 0 : return size;
5072 0 : }
5073 :
5074 0 : int fd_stakes_stake_decode( fd_stakes_stake_t * self, fd_bincode_decode_ctx_t * ctx ) {
5075 0 : void const * data = ctx->data;
5076 0 : int err = fd_stakes_stake_decode_preflight( ctx );
5077 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5078 0 : ctx->data = data;
5079 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5080 0 : fd_stakes_stake_new( self );
5081 0 : }
5082 0 : fd_stakes_stake_decode_unsafe( self, ctx );
5083 0 : return FD_BINCODE_SUCCESS;
5084 0 : }
5085 0 : int fd_stakes_stake_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
5086 0 : int err;
5087 0 : err = fd_vote_accounts_decode_preflight( ctx );
5088 0 : if( FD_UNLIKELY( err ) ) return err;
5089 0 : ulong stake_delegations_len;
5090 0 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
5091 0 : if( FD_UNLIKELY( err ) ) return err;
5092 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
5093 0 : err = fd_stake_pair_decode_preflight( ctx );
5094 0 : if( FD_UNLIKELY( err ) ) return err;
5095 0 : }
5096 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5097 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5098 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5099 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5100 0 : err = fd_stake_history_decode_preflight( ctx );
5101 0 : if( FD_UNLIKELY( err ) ) return err;
5102 0 : return FD_BINCODE_SUCCESS;
5103 0 : }
5104 0 : void fd_stakes_stake_decode_unsafe( fd_stakes_stake_t * self, fd_bincode_decode_ctx_t * ctx ) {
5105 0 : fd_vote_accounts_decode_unsafe( &self->vote_accounts, ctx );
5106 0 : ulong stake_delegations_len;
5107 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
5108 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5109 0 : self->stake_delegations_pool = fd_stake_pair_t_map_alloc( ctx->valloc, stake_delegations_len );
5110 0 : self->stake_delegations_root = NULL;
5111 0 : }
5112 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
5113 0 : fd_stake_pair_t_mapnode_t * node = fd_stake_pair_t_map_acquire( self->stake_delegations_pool );
5114 0 : fd_stake_pair_new( &node->elem );
5115 0 : fd_stake_pair_decode_unsafe( &node->elem, ctx );
5116 0 : fd_stake_pair_t_map_insert( self->stake_delegations_pool, &self->stake_delegations_root, node );
5117 0 : }
5118 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
5119 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
5120 0 : fd_stake_history_decode_unsafe( &self->stake_history, ctx );
5121 0 : }
5122 0 : int fd_stakes_stake_encode( fd_stakes_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5123 0 : int err;
5124 0 : err = fd_vote_accounts_encode( &self->vote_accounts, ctx );
5125 0 : if( FD_UNLIKELY( err ) ) return err;
5126 0 : if( self->stake_delegations_root ) {
5127 0 : ulong stake_delegations_len = fd_stake_pair_t_map_size( self->stake_delegations_pool, self->stake_delegations_root );
5128 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
5129 0 : if( FD_UNLIKELY( err ) ) return err;
5130 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_stake_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
5131 0 : err = fd_stake_pair_encode( &n->elem, ctx );
5132 0 : if( FD_UNLIKELY( err ) ) return err;
5133 0 : }
5134 0 : } else {
5135 0 : ulong stake_delegations_len = 0;
5136 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
5137 0 : if( FD_UNLIKELY( err ) ) return err;
5138 0 : }
5139 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
5140 0 : if( FD_UNLIKELY( err ) ) return err;
5141 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
5142 0 : if( FD_UNLIKELY( err ) ) return err;
5143 0 : err = fd_stake_history_encode( &self->stake_history, ctx );
5144 0 : if( FD_UNLIKELY( err ) ) return err;
5145 0 : return FD_BINCODE_SUCCESS;
5146 0 : }
5147 0 : int fd_stakes_stake_decode_offsets( fd_stakes_stake_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5148 0 : uchar const * data = ctx->data;
5149 0 : int err;
5150 0 : self->vote_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
5151 0 : err = fd_vote_accounts_decode_preflight( ctx );
5152 0 : if( FD_UNLIKELY( err ) ) return err;
5153 0 : self->stake_delegations_off = (uint)( (ulong)ctx->data - (ulong)data );
5154 0 : ulong stake_delegations_len;
5155 0 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
5156 0 : if( FD_UNLIKELY( err ) ) return err;
5157 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
5158 0 : err = fd_stake_pair_decode_preflight( ctx );
5159 0 : if( FD_UNLIKELY( err ) ) return err;
5160 0 : }
5161 0 : self->unused_off = (uint)( (ulong)ctx->data - (ulong)data );
5162 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5163 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5164 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
5165 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5166 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5167 0 : self->stake_history_off = (uint)( (ulong)ctx->data - (ulong)data );
5168 0 : err = fd_stake_history_decode_preflight( ctx );
5169 0 : if( FD_UNLIKELY( err ) ) return err;
5170 0 : return FD_BINCODE_SUCCESS;
5171 0 : }
5172 0 : void fd_stakes_stake_new(fd_stakes_stake_t * self) {
5173 0 : fd_memset( self, 0, sizeof(fd_stakes_stake_t) );
5174 0 : fd_vote_accounts_new( &self->vote_accounts );
5175 0 : fd_stake_history_new( &self->stake_history );
5176 0 : }
5177 0 : void fd_stakes_stake_destroy( fd_stakes_stake_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5178 0 : fd_vote_accounts_destroy( &self->vote_accounts, ctx );
5179 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_stake_pair_t_map_successor(self->stake_delegations_pool, n) ) {
5180 0 : fd_stake_pair_destroy( &n->elem, ctx );
5181 0 : }
5182 0 : fd_valloc_free( ctx->valloc, fd_stake_pair_t_map_delete( fd_stake_pair_t_map_leave( self->stake_delegations_pool ) ) );
5183 0 : self->stake_delegations_pool = NULL;
5184 0 : self->stake_delegations_root = NULL;
5185 0 : fd_stake_history_destroy( &self->stake_history, ctx );
5186 0 : }
5187 :
5188 0 : ulong fd_stakes_stake_footprint( void ){ return FD_STAKES_STAKE_FOOTPRINT; }
5189 0 : ulong fd_stakes_stake_align( void ){ return FD_STAKES_STAKE_ALIGN; }
5190 :
5191 0 : void fd_stakes_stake_walk( void * w, fd_stakes_stake_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5192 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stakes_stake", level++ );
5193 0 : fd_vote_accounts_walk( w, &self->vote_accounts, fun, "vote_accounts", level );
5194 0 : if( self->stake_delegations_root ) {
5195 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum(self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_stake_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
5196 0 : fd_stake_pair_walk(w, &n->elem, fun, "stake_delegations", level );
5197 0 : }
5198 0 : }
5199 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5200 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5201 0 : fd_stake_history_walk( w, &self->stake_history, fun, "stake_history", level );
5202 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stakes_stake", level-- );
5203 0 : }
5204 0 : ulong fd_stakes_stake_size( fd_stakes_stake_t const * self ) {
5205 0 : ulong size = 0;
5206 0 : size += fd_vote_accounts_size( &self->vote_accounts );
5207 0 : if( self->stake_delegations_root ) {
5208 0 : size += sizeof(ulong);
5209 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum( self->stake_delegations_pool, self->stake_delegations_root ); n; n = fd_stake_pair_t_map_successor( self->stake_delegations_pool, n ) ) {
5210 0 : size += fd_stake_pair_size( &n->elem );
5211 0 : }
5212 0 : } else {
5213 0 : size += sizeof(ulong);
5214 0 : }
5215 0 : size += sizeof(ulong);
5216 0 : size += sizeof(ulong);
5217 0 : size += fd_stake_history_size( &self->stake_history );
5218 0 : return size;
5219 0 : }
5220 :
5221 0 : int fd_bank_incremental_snapshot_persistence_decode( fd_bank_incremental_snapshot_persistence_t * self, fd_bincode_decode_ctx_t * ctx ) {
5222 0 : void const * data = ctx->data;
5223 0 : int err = fd_bank_incremental_snapshot_persistence_decode_preflight( ctx );
5224 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5225 0 : ctx->data = data;
5226 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5227 0 : fd_bank_incremental_snapshot_persistence_new( self );
5228 0 : }
5229 0 : fd_bank_incremental_snapshot_persistence_decode_unsafe( self, ctx );
5230 0 : return FD_BINCODE_SUCCESS;
5231 0 : }
5232 0 : int fd_bank_incremental_snapshot_persistence_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
5233 0 : return fd_bincode_bytes_decode_preflight( 88, ctx );
5234 0 : }
5235 0 : void fd_bank_incremental_snapshot_persistence_decode_unsafe( fd_bank_incremental_snapshot_persistence_t * self, fd_bincode_decode_ctx_t * ctx ) {
5236 0 : fd_bincode_uint64_decode_unsafe( &self->full_slot, ctx );
5237 0 : fd_hash_decode_unsafe( &self->full_hash, ctx );
5238 0 : fd_bincode_uint64_decode_unsafe( &self->full_capitalization, ctx );
5239 0 : fd_hash_decode_unsafe( &self->incremental_hash, ctx );
5240 0 : fd_bincode_uint64_decode_unsafe( &self->incremental_capitalization, ctx );
5241 0 : }
5242 0 : int fd_bank_incremental_snapshot_persistence_encode( fd_bank_incremental_snapshot_persistence_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5243 0 : int err;
5244 0 : err = fd_bincode_uint64_encode( self->full_slot, ctx );
5245 0 : if( FD_UNLIKELY( err ) ) return err;
5246 0 : err = fd_hash_encode( &self->full_hash, ctx );
5247 0 : if( FD_UNLIKELY( err ) ) return err;
5248 0 : err = fd_bincode_uint64_encode( self->full_capitalization, ctx );
5249 0 : if( FD_UNLIKELY( err ) ) return err;
5250 0 : err = fd_hash_encode( &self->incremental_hash, ctx );
5251 0 : if( FD_UNLIKELY( err ) ) return err;
5252 0 : err = fd_bincode_uint64_encode( self->incremental_capitalization, ctx );
5253 0 : if( FD_UNLIKELY( err ) ) return err;
5254 0 : return FD_BINCODE_SUCCESS;
5255 0 : }
5256 0 : int fd_bank_incremental_snapshot_persistence_decode_offsets( fd_bank_incremental_snapshot_persistence_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5257 0 : uchar const * data = ctx->data;
5258 0 : int err;
5259 0 : self->full_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
5260 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5261 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5262 0 : self->full_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
5263 0 : err = fd_hash_decode_preflight( ctx );
5264 0 : if( FD_UNLIKELY( err ) ) return err;
5265 0 : self->full_capitalization_off = (uint)( (ulong)ctx->data - (ulong)data );
5266 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5267 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5268 0 : self->incremental_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
5269 0 : err = fd_hash_decode_preflight( ctx );
5270 0 : if( FD_UNLIKELY( err ) ) return err;
5271 0 : self->incremental_capitalization_off = (uint)( (ulong)ctx->data - (ulong)data );
5272 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5273 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5274 0 : return FD_BINCODE_SUCCESS;
5275 0 : }
5276 0 : void fd_bank_incremental_snapshot_persistence_new(fd_bank_incremental_snapshot_persistence_t * self) {
5277 0 : fd_memset( self, 0, sizeof(fd_bank_incremental_snapshot_persistence_t) );
5278 0 : fd_hash_new( &self->full_hash );
5279 0 : fd_hash_new( &self->incremental_hash );
5280 0 : }
5281 0 : void fd_bank_incremental_snapshot_persistence_destroy( fd_bank_incremental_snapshot_persistence_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5282 0 : fd_hash_destroy( &self->full_hash, ctx );
5283 0 : fd_hash_destroy( &self->incremental_hash, ctx );
5284 0 : }
5285 :
5286 0 : ulong fd_bank_incremental_snapshot_persistence_footprint( void ){ return FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_FOOTPRINT; }
5287 0 : ulong fd_bank_incremental_snapshot_persistence_align( void ){ return FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN; }
5288 :
5289 0 : void fd_bank_incremental_snapshot_persistence_walk( void * w, fd_bank_incremental_snapshot_persistence_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5290 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_incremental_snapshot_persistence", level++ );
5291 0 : fun( w, &self->full_slot, "full_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5292 0 : fd_hash_walk( w, &self->full_hash, fun, "full_hash", level );
5293 0 : fun( w, &self->full_capitalization, "full_capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5294 0 : fd_hash_walk( w, &self->incremental_hash, fun, "incremental_hash", level );
5295 0 : fun( w, &self->incremental_capitalization, "incremental_capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5296 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_incremental_snapshot_persistence", level-- );
5297 0 : }
5298 0 : ulong fd_bank_incremental_snapshot_persistence_size( fd_bank_incremental_snapshot_persistence_t const * self ) {
5299 0 : ulong size = 0;
5300 0 : size += sizeof(ulong);
5301 0 : size += fd_hash_size( &self->full_hash );
5302 0 : size += sizeof(ulong);
5303 0 : size += fd_hash_size( &self->incremental_hash );
5304 0 : size += sizeof(ulong);
5305 0 : return size;
5306 0 : }
5307 :
5308 0 : int fd_node_vote_accounts_decode( fd_node_vote_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
5309 0 : void const * data = ctx->data;
5310 0 : int err = fd_node_vote_accounts_decode_preflight( ctx );
5311 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5312 0 : ctx->data = data;
5313 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5314 0 : fd_node_vote_accounts_new( self );
5315 0 : }
5316 0 : fd_node_vote_accounts_decode_unsafe( self, ctx );
5317 0 : return FD_BINCODE_SUCCESS;
5318 0 : }
5319 0 : int fd_node_vote_accounts_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
5320 0 : int err;
5321 0 : ulong vote_accounts_len;
5322 0 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
5323 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5324 0 : if( vote_accounts_len ) {
5325 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
5326 0 : err = fd_pubkey_decode_preflight( ctx );
5327 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5328 0 : }
5329 0 : }
5330 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5331 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5332 0 : return FD_BINCODE_SUCCESS;
5333 0 : }
5334 0 : void fd_node_vote_accounts_decode_unsafe( fd_node_vote_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
5335 0 : fd_bincode_uint64_decode_unsafe( &self->vote_accounts_len, ctx );
5336 0 : if( self->vote_accounts_len ) {
5337 0 : self->vote_accounts = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT*self->vote_accounts_len );
5338 0 : for( ulong i=0; i < self->vote_accounts_len; i++ ) {
5339 0 : fd_pubkey_new( self->vote_accounts + i );
5340 0 : fd_pubkey_decode_unsafe( self->vote_accounts + i, ctx );
5341 0 : }
5342 0 : } else
5343 0 : self->vote_accounts = NULL;
5344 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
5345 0 : }
5346 0 : int fd_node_vote_accounts_encode( fd_node_vote_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5347 0 : int err;
5348 0 : err = fd_bincode_uint64_encode( self->vote_accounts_len, ctx );
5349 0 : if( FD_UNLIKELY(err) ) return err;
5350 0 : if( self->vote_accounts_len ) {
5351 0 : for( ulong i=0; i < self->vote_accounts_len; i++ ) {
5352 0 : err = fd_pubkey_encode( self->vote_accounts + i, ctx );
5353 0 : if( FD_UNLIKELY( err ) ) return err;
5354 0 : }
5355 0 : }
5356 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
5357 0 : if( FD_UNLIKELY( err ) ) return err;
5358 0 : return FD_BINCODE_SUCCESS;
5359 0 : }
5360 0 : int fd_node_vote_accounts_decode_offsets( fd_node_vote_accounts_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5361 0 : uchar const * data = ctx->data;
5362 0 : int err;
5363 0 : self->vote_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
5364 0 : ulong vote_accounts_len;
5365 0 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
5366 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5367 0 : if( vote_accounts_len ) {
5368 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
5369 0 : err = fd_pubkey_decode_preflight( ctx );
5370 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5371 0 : }
5372 0 : }
5373 0 : self->total_stake_off = (uint)( (ulong)ctx->data - (ulong)data );
5374 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5375 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5376 0 : return FD_BINCODE_SUCCESS;
5377 0 : }
5378 0 : void fd_node_vote_accounts_new(fd_node_vote_accounts_t * self) {
5379 0 : fd_memset( self, 0, sizeof(fd_node_vote_accounts_t) );
5380 0 : }
5381 0 : void fd_node_vote_accounts_destroy( fd_node_vote_accounts_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5382 0 : if( self->vote_accounts ) {
5383 0 : for( ulong i=0; i < self->vote_accounts_len; i++ )
5384 0 : fd_pubkey_destroy( self->vote_accounts + i, ctx );
5385 0 : fd_valloc_free( ctx->valloc, self->vote_accounts );
5386 0 : self->vote_accounts = NULL;
5387 0 : }
5388 0 : }
5389 :
5390 0 : ulong fd_node_vote_accounts_footprint( void ){ return FD_NODE_VOTE_ACCOUNTS_FOOTPRINT; }
5391 0 : ulong fd_node_vote_accounts_align( void ){ return FD_NODE_VOTE_ACCOUNTS_ALIGN; }
5392 :
5393 0 : void fd_node_vote_accounts_walk( void * w, fd_node_vote_accounts_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5394 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_node_vote_accounts", level++ );
5395 0 : if( self->vote_accounts_len ) {
5396 0 : fun( w, NULL, "vote_accounts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
5397 0 : for( ulong i=0; i < self->vote_accounts_len; i++ )
5398 0 : fd_pubkey_walk(w, self->vote_accounts + i, fun, "pubkey", level );
5399 0 : fun( w, NULL, "vote_accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
5400 0 : }
5401 0 : fun( w, &self->total_stake, "total_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5402 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_node_vote_accounts", level-- );
5403 0 : }
5404 0 : ulong fd_node_vote_accounts_size( fd_node_vote_accounts_t const * self ) {
5405 0 : ulong size = 0;
5406 0 : do {
5407 0 : size += sizeof(ulong);
5408 0 : for( ulong i=0; i < self->vote_accounts_len; i++ )
5409 0 : size += fd_pubkey_size( self->vote_accounts + i );
5410 0 : } while(0);
5411 0 : size += sizeof(ulong);
5412 0 : return size;
5413 0 : }
5414 :
5415 0 : int fd_pubkey_node_vote_accounts_pair_decode( fd_pubkey_node_vote_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
5416 0 : void const * data = ctx->data;
5417 0 : int err = fd_pubkey_node_vote_accounts_pair_decode_preflight( ctx );
5418 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5419 0 : ctx->data = data;
5420 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5421 0 : fd_pubkey_node_vote_accounts_pair_new( self );
5422 0 : }
5423 0 : fd_pubkey_node_vote_accounts_pair_decode_unsafe( self, ctx );
5424 0 : return FD_BINCODE_SUCCESS;
5425 0 : }
5426 0 : int fd_pubkey_node_vote_accounts_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
5427 0 : int err;
5428 0 : err = fd_pubkey_decode_preflight( ctx );
5429 0 : if( FD_UNLIKELY( err ) ) return err;
5430 0 : err = fd_node_vote_accounts_decode_preflight( ctx );
5431 0 : if( FD_UNLIKELY( err ) ) return err;
5432 0 : return FD_BINCODE_SUCCESS;
5433 0 : }
5434 0 : void fd_pubkey_node_vote_accounts_pair_decode_unsafe( fd_pubkey_node_vote_accounts_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
5435 0 : fd_pubkey_decode_unsafe( &self->key, ctx );
5436 0 : fd_node_vote_accounts_decode_unsafe( &self->value, ctx );
5437 0 : }
5438 0 : int fd_pubkey_node_vote_accounts_pair_encode( fd_pubkey_node_vote_accounts_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5439 0 : int err;
5440 0 : err = fd_pubkey_encode( &self->key, ctx );
5441 0 : if( FD_UNLIKELY( err ) ) return err;
5442 0 : err = fd_node_vote_accounts_encode( &self->value, ctx );
5443 0 : if( FD_UNLIKELY( err ) ) return err;
5444 0 : return FD_BINCODE_SUCCESS;
5445 0 : }
5446 0 : int fd_pubkey_node_vote_accounts_pair_decode_offsets( fd_pubkey_node_vote_accounts_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5447 0 : uchar const * data = ctx->data;
5448 0 : int err;
5449 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
5450 0 : err = fd_pubkey_decode_preflight( ctx );
5451 0 : if( FD_UNLIKELY( err ) ) return err;
5452 0 : self->value_off = (uint)( (ulong)ctx->data - (ulong)data );
5453 0 : err = fd_node_vote_accounts_decode_preflight( ctx );
5454 0 : if( FD_UNLIKELY( err ) ) return err;
5455 0 : return FD_BINCODE_SUCCESS;
5456 0 : }
5457 0 : void fd_pubkey_node_vote_accounts_pair_new(fd_pubkey_node_vote_accounts_pair_t * self) {
5458 0 : fd_memset( self, 0, sizeof(fd_pubkey_node_vote_accounts_pair_t) );
5459 0 : fd_pubkey_new( &self->key );
5460 0 : fd_node_vote_accounts_new( &self->value );
5461 0 : }
5462 0 : void fd_pubkey_node_vote_accounts_pair_destroy( fd_pubkey_node_vote_accounts_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5463 0 : fd_pubkey_destroy( &self->key, ctx );
5464 0 : fd_node_vote_accounts_destroy( &self->value, ctx );
5465 0 : }
5466 :
5467 0 : ulong fd_pubkey_node_vote_accounts_pair_footprint( void ){ return FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT; }
5468 0 : ulong fd_pubkey_node_vote_accounts_pair_align( void ){ return FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN; }
5469 :
5470 0 : void fd_pubkey_node_vote_accounts_pair_walk( void * w, fd_pubkey_node_vote_accounts_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5471 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_node_vote_accounts_pair", level++ );
5472 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
5473 0 : fd_node_vote_accounts_walk( w, &self->value, fun, "value", level );
5474 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_node_vote_accounts_pair", level-- );
5475 0 : }
5476 0 : ulong fd_pubkey_node_vote_accounts_pair_size( fd_pubkey_node_vote_accounts_pair_t const * self ) {
5477 0 : ulong size = 0;
5478 0 : size += fd_pubkey_size( &self->key );
5479 0 : size += fd_node_vote_accounts_size( &self->value );
5480 0 : return size;
5481 0 : }
5482 :
5483 0 : int fd_pubkey_pubkey_pair_decode( fd_pubkey_pubkey_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
5484 0 : void const * data = ctx->data;
5485 0 : int err = fd_pubkey_pubkey_pair_decode_preflight( ctx );
5486 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5487 0 : ctx->data = data;
5488 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5489 0 : fd_pubkey_pubkey_pair_new( self );
5490 0 : }
5491 0 : fd_pubkey_pubkey_pair_decode_unsafe( self, ctx );
5492 0 : return FD_BINCODE_SUCCESS;
5493 0 : }
5494 0 : int fd_pubkey_pubkey_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
5495 0 : return fd_bincode_bytes_decode_preflight( 64, ctx );
5496 0 : }
5497 0 : void fd_pubkey_pubkey_pair_decode_unsafe( fd_pubkey_pubkey_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
5498 0 : fd_pubkey_decode_unsafe( &self->key, ctx );
5499 0 : fd_pubkey_decode_unsafe( &self->value, ctx );
5500 0 : }
5501 0 : int fd_pubkey_pubkey_pair_encode( fd_pubkey_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5502 0 : int err;
5503 0 : err = fd_pubkey_encode( &self->key, ctx );
5504 0 : if( FD_UNLIKELY( err ) ) return err;
5505 0 : err = fd_pubkey_encode( &self->value, ctx );
5506 0 : if( FD_UNLIKELY( err ) ) return err;
5507 0 : return FD_BINCODE_SUCCESS;
5508 0 : }
5509 0 : int fd_pubkey_pubkey_pair_decode_offsets( fd_pubkey_pubkey_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5510 0 : uchar const * data = ctx->data;
5511 0 : int err;
5512 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
5513 0 : err = fd_pubkey_decode_preflight( ctx );
5514 0 : if( FD_UNLIKELY( err ) ) return err;
5515 0 : self->value_off = (uint)( (ulong)ctx->data - (ulong)data );
5516 0 : err = fd_pubkey_decode_preflight( ctx );
5517 0 : if( FD_UNLIKELY( err ) ) return err;
5518 0 : return FD_BINCODE_SUCCESS;
5519 0 : }
5520 0 : void fd_pubkey_pubkey_pair_new(fd_pubkey_pubkey_pair_t * self) {
5521 0 : fd_memset( self, 0, sizeof(fd_pubkey_pubkey_pair_t) );
5522 0 : fd_pubkey_new( &self->key );
5523 0 : fd_pubkey_new( &self->value );
5524 0 : }
5525 0 : void fd_pubkey_pubkey_pair_destroy( fd_pubkey_pubkey_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5526 0 : fd_pubkey_destroy( &self->key, ctx );
5527 0 : fd_pubkey_destroy( &self->value, ctx );
5528 0 : }
5529 :
5530 0 : ulong fd_pubkey_pubkey_pair_footprint( void ){ return FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT; }
5531 0 : ulong fd_pubkey_pubkey_pair_align( void ){ return FD_PUBKEY_PUBKEY_PAIR_ALIGN; }
5532 :
5533 0 : void fd_pubkey_pubkey_pair_walk( void * w, fd_pubkey_pubkey_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5534 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_pubkey_pair", level++ );
5535 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
5536 0 : fd_pubkey_walk( w, &self->value, fun, "value", level );
5537 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_pubkey_pair", level-- );
5538 0 : }
5539 0 : ulong fd_pubkey_pubkey_pair_size( fd_pubkey_pubkey_pair_t const * self ) {
5540 0 : ulong size = 0;
5541 0 : size += fd_pubkey_size( &self->key );
5542 0 : size += fd_pubkey_size( &self->value );
5543 0 : return size;
5544 0 : }
5545 :
5546 0 : int fd_epoch_stakes_decode( fd_epoch_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
5547 0 : void const * data = ctx->data;
5548 0 : int err = fd_epoch_stakes_decode_preflight( ctx );
5549 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5550 0 : ctx->data = data;
5551 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5552 0 : fd_epoch_stakes_new( self );
5553 0 : }
5554 0 : fd_epoch_stakes_decode_unsafe( self, ctx );
5555 0 : return FD_BINCODE_SUCCESS;
5556 0 : }
5557 0 : int fd_epoch_stakes_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
5558 0 : int err;
5559 0 : err = fd_stakes_decode_preflight( ctx );
5560 0 : if( FD_UNLIKELY( err ) ) return err;
5561 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5562 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5563 0 : ulong node_id_to_vote_accounts_len;
5564 0 : err = fd_bincode_uint64_decode( &node_id_to_vote_accounts_len, ctx );
5565 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5566 0 : if( node_id_to_vote_accounts_len ) {
5567 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
5568 0 : err = fd_pubkey_node_vote_accounts_pair_decode_preflight( ctx );
5569 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5570 0 : }
5571 0 : }
5572 0 : ulong epoch_authorized_voters_len;
5573 0 : err = fd_bincode_uint64_decode( &epoch_authorized_voters_len, ctx );
5574 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5575 0 : if( epoch_authorized_voters_len ) {
5576 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
5577 0 : err = fd_pubkey_pubkey_pair_decode_preflight( ctx );
5578 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5579 0 : }
5580 0 : }
5581 0 : return FD_BINCODE_SUCCESS;
5582 0 : }
5583 0 : void fd_epoch_stakes_decode_unsafe( fd_epoch_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
5584 0 : fd_stakes_decode_unsafe( &self->stakes, ctx );
5585 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
5586 0 : fd_bincode_uint64_decode_unsafe( &self->node_id_to_vote_accounts_len, ctx );
5587 0 : if( self->node_id_to_vote_accounts_len ) {
5588 0 : self->node_id_to_vote_accounts = (fd_pubkey_node_vote_accounts_pair_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN, FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT*self->node_id_to_vote_accounts_len );
5589 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
5590 0 : fd_pubkey_node_vote_accounts_pair_new( self->node_id_to_vote_accounts + i );
5591 0 : fd_pubkey_node_vote_accounts_pair_decode_unsafe( self->node_id_to_vote_accounts + i, ctx );
5592 0 : }
5593 0 : } else
5594 0 : self->node_id_to_vote_accounts = NULL;
5595 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_authorized_voters_len, ctx );
5596 0 : if( self->epoch_authorized_voters_len ) {
5597 0 : self->epoch_authorized_voters = (fd_pubkey_pubkey_pair_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_PUBKEY_PAIR_ALIGN, FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT*self->epoch_authorized_voters_len );
5598 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
5599 0 : fd_pubkey_pubkey_pair_new( self->epoch_authorized_voters + i );
5600 0 : fd_pubkey_pubkey_pair_decode_unsafe( self->epoch_authorized_voters + i, ctx );
5601 0 : }
5602 0 : } else
5603 0 : self->epoch_authorized_voters = NULL;
5604 0 : }
5605 0 : int fd_epoch_stakes_encode( fd_epoch_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5606 0 : int err;
5607 0 : err = fd_stakes_encode( &self->stakes, ctx );
5608 0 : if( FD_UNLIKELY( err ) ) return err;
5609 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
5610 0 : if( FD_UNLIKELY( err ) ) return err;
5611 0 : err = fd_bincode_uint64_encode( self->node_id_to_vote_accounts_len, ctx );
5612 0 : if( FD_UNLIKELY(err) ) return err;
5613 0 : if( self->node_id_to_vote_accounts_len ) {
5614 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
5615 0 : err = fd_pubkey_node_vote_accounts_pair_encode( self->node_id_to_vote_accounts + i, ctx );
5616 0 : if( FD_UNLIKELY( err ) ) return err;
5617 0 : }
5618 0 : }
5619 0 : err = fd_bincode_uint64_encode( self->epoch_authorized_voters_len, ctx );
5620 0 : if( FD_UNLIKELY(err) ) return err;
5621 0 : if( self->epoch_authorized_voters_len ) {
5622 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
5623 0 : err = fd_pubkey_pubkey_pair_encode( self->epoch_authorized_voters + i, ctx );
5624 0 : if( FD_UNLIKELY( err ) ) return err;
5625 0 : }
5626 0 : }
5627 0 : return FD_BINCODE_SUCCESS;
5628 0 : }
5629 0 : int fd_epoch_stakes_decode_offsets( fd_epoch_stakes_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5630 0 : uchar const * data = ctx->data;
5631 0 : int err;
5632 0 : self->stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
5633 0 : err = fd_stakes_decode_preflight( ctx );
5634 0 : if( FD_UNLIKELY( err ) ) return err;
5635 0 : self->total_stake_off = (uint)( (ulong)ctx->data - (ulong)data );
5636 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5637 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5638 0 : self->node_id_to_vote_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
5639 0 : ulong node_id_to_vote_accounts_len;
5640 0 : err = fd_bincode_uint64_decode( &node_id_to_vote_accounts_len, ctx );
5641 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5642 0 : if( node_id_to_vote_accounts_len ) {
5643 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
5644 0 : err = fd_pubkey_node_vote_accounts_pair_decode_preflight( ctx );
5645 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5646 0 : }
5647 0 : }
5648 0 : self->epoch_authorized_voters_off = (uint)( (ulong)ctx->data - (ulong)data );
5649 0 : ulong epoch_authorized_voters_len;
5650 0 : err = fd_bincode_uint64_decode( &epoch_authorized_voters_len, ctx );
5651 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5652 0 : if( epoch_authorized_voters_len ) {
5653 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
5654 0 : err = fd_pubkey_pubkey_pair_decode_preflight( ctx );
5655 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5656 0 : }
5657 0 : }
5658 0 : return FD_BINCODE_SUCCESS;
5659 0 : }
5660 0 : void fd_epoch_stakes_new(fd_epoch_stakes_t * self) {
5661 0 : fd_memset( self, 0, sizeof(fd_epoch_stakes_t) );
5662 0 : fd_stakes_new( &self->stakes );
5663 0 : }
5664 0 : void fd_epoch_stakes_destroy( fd_epoch_stakes_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5665 0 : fd_stakes_destroy( &self->stakes, ctx );
5666 0 : if( self->node_id_to_vote_accounts ) {
5667 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
5668 0 : fd_pubkey_node_vote_accounts_pair_destroy( self->node_id_to_vote_accounts + i, ctx );
5669 0 : fd_valloc_free( ctx->valloc, self->node_id_to_vote_accounts );
5670 0 : self->node_id_to_vote_accounts = NULL;
5671 0 : }
5672 0 : if( self->epoch_authorized_voters ) {
5673 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
5674 0 : fd_pubkey_pubkey_pair_destroy( self->epoch_authorized_voters + i, ctx );
5675 0 : fd_valloc_free( ctx->valloc, self->epoch_authorized_voters );
5676 0 : self->epoch_authorized_voters = NULL;
5677 0 : }
5678 0 : }
5679 :
5680 0 : ulong fd_epoch_stakes_footprint( void ){ return FD_EPOCH_STAKES_FOOTPRINT; }
5681 0 : ulong fd_epoch_stakes_align( void ){ return FD_EPOCH_STAKES_ALIGN; }
5682 :
5683 0 : void fd_epoch_stakes_walk( void * w, fd_epoch_stakes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5684 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_stakes", level++ );
5685 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level );
5686 0 : fun( w, &self->total_stake, "total_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5687 0 : if( self->node_id_to_vote_accounts_len ) {
5688 0 : fun( w, NULL, "node_id_to_vote_accounts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
5689 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
5690 0 : fd_pubkey_node_vote_accounts_pair_walk(w, self->node_id_to_vote_accounts + i, fun, "pubkey_node_vote_accounts_pair", level );
5691 0 : fun( w, NULL, "node_id_to_vote_accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
5692 0 : }
5693 0 : if( self->epoch_authorized_voters_len ) {
5694 0 : fun( w, NULL, "epoch_authorized_voters", FD_FLAMENCO_TYPE_ARR, "array", level++ );
5695 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
5696 0 : fd_pubkey_pubkey_pair_walk(w, self->epoch_authorized_voters + i, fun, "pubkey_pubkey_pair", level );
5697 0 : fun( w, NULL, "epoch_authorized_voters", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
5698 0 : }
5699 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_stakes", level-- );
5700 0 : }
5701 0 : ulong fd_epoch_stakes_size( fd_epoch_stakes_t const * self ) {
5702 0 : ulong size = 0;
5703 0 : size += fd_stakes_size( &self->stakes );
5704 0 : size += sizeof(ulong);
5705 0 : do {
5706 0 : size += sizeof(ulong);
5707 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
5708 0 : size += fd_pubkey_node_vote_accounts_pair_size( self->node_id_to_vote_accounts + i );
5709 0 : } while(0);
5710 0 : do {
5711 0 : size += sizeof(ulong);
5712 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
5713 0 : size += fd_pubkey_pubkey_pair_size( self->epoch_authorized_voters + i );
5714 0 : } while(0);
5715 0 : return size;
5716 0 : }
5717 :
5718 0 : int fd_epoch_epoch_stakes_pair_decode( fd_epoch_epoch_stakes_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
5719 0 : void const * data = ctx->data;
5720 0 : int err = fd_epoch_epoch_stakes_pair_decode_preflight( ctx );
5721 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5722 0 : ctx->data = data;
5723 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5724 0 : fd_epoch_epoch_stakes_pair_new( self );
5725 0 : }
5726 0 : fd_epoch_epoch_stakes_pair_decode_unsafe( self, ctx );
5727 0 : return FD_BINCODE_SUCCESS;
5728 0 : }
5729 0 : int fd_epoch_epoch_stakes_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
5730 0 : int err;
5731 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5732 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5733 0 : err = fd_epoch_stakes_decode_preflight( ctx );
5734 0 : if( FD_UNLIKELY( err ) ) return err;
5735 0 : return FD_BINCODE_SUCCESS;
5736 0 : }
5737 0 : void fd_epoch_epoch_stakes_pair_decode_unsafe( fd_epoch_epoch_stakes_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
5738 0 : fd_bincode_uint64_decode_unsafe( &self->key, ctx );
5739 0 : fd_epoch_stakes_decode_unsafe( &self->value, ctx );
5740 0 : }
5741 0 : int fd_epoch_epoch_stakes_pair_encode( fd_epoch_epoch_stakes_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5742 0 : int err;
5743 0 : err = fd_bincode_uint64_encode( self->key, ctx );
5744 0 : if( FD_UNLIKELY( err ) ) return err;
5745 0 : err = fd_epoch_stakes_encode( &self->value, ctx );
5746 0 : if( FD_UNLIKELY( err ) ) return err;
5747 0 : return FD_BINCODE_SUCCESS;
5748 0 : }
5749 0 : int fd_epoch_epoch_stakes_pair_decode_offsets( fd_epoch_epoch_stakes_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5750 0 : uchar const * data = ctx->data;
5751 0 : int err;
5752 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
5753 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5754 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5755 0 : self->value_off = (uint)( (ulong)ctx->data - (ulong)data );
5756 0 : err = fd_epoch_stakes_decode_preflight( ctx );
5757 0 : if( FD_UNLIKELY( err ) ) return err;
5758 0 : return FD_BINCODE_SUCCESS;
5759 0 : }
5760 0 : void fd_epoch_epoch_stakes_pair_new(fd_epoch_epoch_stakes_pair_t * self) {
5761 0 : fd_memset( self, 0, sizeof(fd_epoch_epoch_stakes_pair_t) );
5762 0 : fd_epoch_stakes_new( &self->value );
5763 0 : }
5764 0 : void fd_epoch_epoch_stakes_pair_destroy( fd_epoch_epoch_stakes_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5765 0 : fd_epoch_stakes_destroy( &self->value, ctx );
5766 0 : }
5767 :
5768 0 : ulong fd_epoch_epoch_stakes_pair_footprint( void ){ return FD_EPOCH_EPOCH_STAKES_PAIR_FOOTPRINT; }
5769 0 : ulong fd_epoch_epoch_stakes_pair_align( void ){ return FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN; }
5770 :
5771 0 : void fd_epoch_epoch_stakes_pair_walk( void * w, fd_epoch_epoch_stakes_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5772 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_epoch_stakes_pair", level++ );
5773 0 : fun( w, &self->key, "key", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5774 0 : fd_epoch_stakes_walk( w, &self->value, fun, "value", level );
5775 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_epoch_stakes_pair", level-- );
5776 0 : }
5777 0 : ulong fd_epoch_epoch_stakes_pair_size( fd_epoch_epoch_stakes_pair_t const * self ) {
5778 0 : ulong size = 0;
5779 0 : size += sizeof(ulong);
5780 0 : size += fd_epoch_stakes_size( &self->value );
5781 0 : return size;
5782 0 : }
5783 :
5784 0 : int fd_pubkey_u64_pair_decode( fd_pubkey_u64_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
5785 0 : void const * data = ctx->data;
5786 0 : int err = fd_pubkey_u64_pair_decode_preflight( ctx );
5787 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5788 0 : ctx->data = data;
5789 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5790 0 : fd_pubkey_u64_pair_new( self );
5791 0 : }
5792 0 : fd_pubkey_u64_pair_decode_unsafe( self, ctx );
5793 0 : return FD_BINCODE_SUCCESS;
5794 0 : }
5795 0 : int fd_pubkey_u64_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
5796 0 : return fd_bincode_bytes_decode_preflight( 40, ctx );
5797 0 : }
5798 0 : void fd_pubkey_u64_pair_decode_unsafe( fd_pubkey_u64_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
5799 0 : fd_pubkey_decode_unsafe( &self->_0, ctx );
5800 0 : fd_bincode_uint64_decode_unsafe( &self->_1, ctx );
5801 0 : }
5802 0 : int fd_pubkey_u64_pair_encode( fd_pubkey_u64_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5803 0 : int err;
5804 0 : err = fd_pubkey_encode( &self->_0, ctx );
5805 0 : if( FD_UNLIKELY( err ) ) return err;
5806 0 : err = fd_bincode_uint64_encode( self->_1, ctx );
5807 0 : if( FD_UNLIKELY( err ) ) return err;
5808 0 : return FD_BINCODE_SUCCESS;
5809 0 : }
5810 0 : int fd_pubkey_u64_pair_decode_offsets( fd_pubkey_u64_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5811 0 : uchar const * data = ctx->data;
5812 0 : int err;
5813 0 : self->_0_off = (uint)( (ulong)ctx->data - (ulong)data );
5814 0 : err = fd_pubkey_decode_preflight( ctx );
5815 0 : if( FD_UNLIKELY( err ) ) return err;
5816 0 : self->_1_off = (uint)( (ulong)ctx->data - (ulong)data );
5817 0 : err = fd_bincode_uint64_decode_preflight( ctx );
5818 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5819 0 : return FD_BINCODE_SUCCESS;
5820 0 : }
5821 0 : void fd_pubkey_u64_pair_new(fd_pubkey_u64_pair_t * self) {
5822 0 : fd_memset( self, 0, sizeof(fd_pubkey_u64_pair_t) );
5823 0 : fd_pubkey_new( &self->_0 );
5824 0 : }
5825 0 : void fd_pubkey_u64_pair_destroy( fd_pubkey_u64_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5826 0 : fd_pubkey_destroy( &self->_0, ctx );
5827 0 : }
5828 :
5829 0 : ulong fd_pubkey_u64_pair_footprint( void ){ return FD_PUBKEY_U64_PAIR_FOOTPRINT; }
5830 0 : ulong fd_pubkey_u64_pair_align( void ){ return FD_PUBKEY_U64_PAIR_ALIGN; }
5831 :
5832 0 : void fd_pubkey_u64_pair_walk( void * w, fd_pubkey_u64_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
5833 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_u64_pair", level++ );
5834 0 : fd_pubkey_walk( w, &self->_0, fun, "_0", level );
5835 0 : fun( w, &self->_1, "_1", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
5836 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_u64_pair", level-- );
5837 0 : }
5838 0 : ulong fd_pubkey_u64_pair_size( fd_pubkey_u64_pair_t const * self ) {
5839 0 : ulong size = 0;
5840 0 : size += fd_pubkey_size( &self->_0 );
5841 0 : size += sizeof(ulong);
5842 0 : return size;
5843 0 : }
5844 :
5845 0 : int fd_unused_accounts_decode( fd_unused_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
5846 0 : void const * data = ctx->data;
5847 0 : int err = fd_unused_accounts_decode_preflight( ctx );
5848 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5849 0 : ctx->data = data;
5850 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
5851 0 : fd_unused_accounts_new( self );
5852 0 : }
5853 0 : fd_unused_accounts_decode_unsafe( self, ctx );
5854 0 : return FD_BINCODE_SUCCESS;
5855 0 : }
5856 6 : int fd_unused_accounts_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
5857 6 : int err;
5858 6 : ulong unused1_len;
5859 6 : err = fd_bincode_uint64_decode( &unused1_len, ctx );
5860 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5861 6 : if( unused1_len ) {
5862 0 : for( ulong i=0; i < unused1_len; i++ ) {
5863 0 : err = fd_pubkey_decode_preflight( ctx );
5864 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5865 0 : }
5866 0 : }
5867 6 : ulong unused2_len;
5868 6 : err = fd_bincode_uint64_decode( &unused2_len, ctx );
5869 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5870 6 : if( unused2_len ) {
5871 0 : for( ulong i=0; i < unused2_len; i++ ) {
5872 0 : err = fd_pubkey_decode_preflight( ctx );
5873 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5874 0 : }
5875 0 : }
5876 6 : ulong unused3_len;
5877 6 : err = fd_bincode_uint64_decode( &unused3_len, ctx );
5878 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5879 6 : if( unused3_len ) {
5880 0 : for( ulong i=0; i < unused3_len; i++ ) {
5881 0 : err = fd_pubkey_u64_pair_decode_preflight( ctx );
5882 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5883 0 : }
5884 0 : }
5885 6 : return FD_BINCODE_SUCCESS;
5886 6 : }
5887 6 : void fd_unused_accounts_decode_unsafe( fd_unused_accounts_t * self, fd_bincode_decode_ctx_t * ctx ) {
5888 6 : fd_bincode_uint64_decode_unsafe( &self->unused1_len, ctx );
5889 6 : if( self->unused1_len ) {
5890 0 : self->unused1 = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT*self->unused1_len );
5891 0 : for( ulong i=0; i < self->unused1_len; i++ ) {
5892 0 : fd_pubkey_new( self->unused1 + i );
5893 0 : fd_pubkey_decode_unsafe( self->unused1 + i, ctx );
5894 0 : }
5895 0 : } else
5896 6 : self->unused1 = NULL;
5897 6 : fd_bincode_uint64_decode_unsafe( &self->unused2_len, ctx );
5898 6 : if( self->unused2_len ) {
5899 0 : self->unused2 = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT*self->unused2_len );
5900 0 : for( ulong i=0; i < self->unused2_len; i++ ) {
5901 0 : fd_pubkey_new( self->unused2 + i );
5902 0 : fd_pubkey_decode_unsafe( self->unused2 + i, ctx );
5903 0 : }
5904 0 : } else
5905 6 : self->unused2 = NULL;
5906 6 : fd_bincode_uint64_decode_unsafe( &self->unused3_len, ctx );
5907 6 : if( self->unused3_len ) {
5908 0 : self->unused3 = (fd_pubkey_u64_pair_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_U64_PAIR_ALIGN, FD_PUBKEY_U64_PAIR_FOOTPRINT*self->unused3_len );
5909 0 : for( ulong i=0; i < self->unused3_len; i++ ) {
5910 0 : fd_pubkey_u64_pair_new( self->unused3 + i );
5911 0 : fd_pubkey_u64_pair_decode_unsafe( self->unused3 + i, ctx );
5912 0 : }
5913 0 : } else
5914 6 : self->unused3 = NULL;
5915 6 : }
5916 6 : int fd_unused_accounts_encode( fd_unused_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5917 6 : int err;
5918 6 : err = fd_bincode_uint64_encode( self->unused1_len, ctx );
5919 6 : if( FD_UNLIKELY(err) ) return err;
5920 6 : if( self->unused1_len ) {
5921 0 : for( ulong i=0; i < self->unused1_len; i++ ) {
5922 0 : err = fd_pubkey_encode( self->unused1 + i, ctx );
5923 0 : if( FD_UNLIKELY( err ) ) return err;
5924 0 : }
5925 0 : }
5926 6 : err = fd_bincode_uint64_encode( self->unused2_len, ctx );
5927 6 : if( FD_UNLIKELY(err) ) return err;
5928 6 : if( self->unused2_len ) {
5929 0 : for( ulong i=0; i < self->unused2_len; i++ ) {
5930 0 : err = fd_pubkey_encode( self->unused2 + i, ctx );
5931 0 : if( FD_UNLIKELY( err ) ) return err;
5932 0 : }
5933 0 : }
5934 6 : err = fd_bincode_uint64_encode( self->unused3_len, ctx );
5935 6 : if( FD_UNLIKELY(err) ) return err;
5936 6 : if( self->unused3_len ) {
5937 0 : for( ulong i=0; i < self->unused3_len; i++ ) {
5938 0 : err = fd_pubkey_u64_pair_encode( self->unused3 + i, ctx );
5939 0 : if( FD_UNLIKELY( err ) ) return err;
5940 0 : }
5941 0 : }
5942 6 : return FD_BINCODE_SUCCESS;
5943 6 : }
5944 0 : int fd_unused_accounts_decode_offsets( fd_unused_accounts_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
5945 0 : uchar const * data = ctx->data;
5946 0 : int err;
5947 0 : self->unused1_off = (uint)( (ulong)ctx->data - (ulong)data );
5948 0 : ulong unused1_len;
5949 0 : err = fd_bincode_uint64_decode( &unused1_len, ctx );
5950 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5951 0 : if( unused1_len ) {
5952 0 : for( ulong i=0; i < unused1_len; i++ ) {
5953 0 : err = fd_pubkey_decode_preflight( ctx );
5954 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5955 0 : }
5956 0 : }
5957 0 : self->unused2_off = (uint)( (ulong)ctx->data - (ulong)data );
5958 0 : ulong unused2_len;
5959 0 : err = fd_bincode_uint64_decode( &unused2_len, ctx );
5960 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5961 0 : if( unused2_len ) {
5962 0 : for( ulong i=0; i < unused2_len; i++ ) {
5963 0 : err = fd_pubkey_decode_preflight( ctx );
5964 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5965 0 : }
5966 0 : }
5967 0 : self->unused3_off = (uint)( (ulong)ctx->data - (ulong)data );
5968 0 : ulong unused3_len;
5969 0 : err = fd_bincode_uint64_decode( &unused3_len, ctx );
5970 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5971 0 : if( unused3_len ) {
5972 0 : for( ulong i=0; i < unused3_len; i++ ) {
5973 0 : err = fd_pubkey_u64_pair_decode_preflight( ctx );
5974 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5975 0 : }
5976 0 : }
5977 0 : return FD_BINCODE_SUCCESS;
5978 0 : }
5979 6 : void fd_unused_accounts_new(fd_unused_accounts_t * self) {
5980 6 : fd_memset( self, 0, sizeof(fd_unused_accounts_t) );
5981 6 : }
5982 0 : void fd_unused_accounts_destroy( fd_unused_accounts_t * self, fd_bincode_destroy_ctx_t * ctx ) {
5983 0 : if( self->unused1 ) {
5984 0 : for( ulong i=0; i < self->unused1_len; i++ )
5985 0 : fd_pubkey_destroy( self->unused1 + i, ctx );
5986 0 : fd_valloc_free( ctx->valloc, self->unused1 );
5987 0 : self->unused1 = NULL;
5988 0 : }
5989 0 : if( self->unused2 ) {
5990 0 : for( ulong i=0; i < self->unused2_len; i++ )
5991 0 : fd_pubkey_destroy( self->unused2 + i, ctx );
5992 0 : fd_valloc_free( ctx->valloc, self->unused2 );
5993 0 : self->unused2 = NULL;
5994 0 : }
5995 0 : if( self->unused3 ) {
5996 0 : for( ulong i=0; i < self->unused3_len; i++ )
5997 0 : fd_pubkey_u64_pair_destroy( self->unused3 + i, ctx );
5998 0 : fd_valloc_free( ctx->valloc, self->unused3 );
5999 0 : self->unused3 = NULL;
6000 0 : }
6001 0 : }
6002 :
6003 0 : ulong fd_unused_accounts_footprint( void ){ return FD_UNUSED_ACCOUNTS_FOOTPRINT; }
6004 0 : ulong fd_unused_accounts_align( void ){ return FD_UNUSED_ACCOUNTS_ALIGN; }
6005 :
6006 0 : void fd_unused_accounts_walk( void * w, fd_unused_accounts_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6007 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_unused_accounts", level++ );
6008 0 : if( self->unused1_len ) {
6009 0 : fun( w, NULL, "unused1", FD_FLAMENCO_TYPE_ARR, "array", level++ );
6010 0 : for( ulong i=0; i < self->unused1_len; i++ )
6011 0 : fd_pubkey_walk(w, self->unused1 + i, fun, "pubkey", level );
6012 0 : fun( w, NULL, "unused1", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
6013 0 : }
6014 0 : if( self->unused2_len ) {
6015 0 : fun( w, NULL, "unused2", FD_FLAMENCO_TYPE_ARR, "array", level++ );
6016 0 : for( ulong i=0; i < self->unused2_len; i++ )
6017 0 : fd_pubkey_walk(w, self->unused2 + i, fun, "pubkey", level );
6018 0 : fun( w, NULL, "unused2", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
6019 0 : }
6020 0 : if( self->unused3_len ) {
6021 0 : fun( w, NULL, "unused3", FD_FLAMENCO_TYPE_ARR, "array", level++ );
6022 0 : for( ulong i=0; i < self->unused3_len; i++ )
6023 0 : fd_pubkey_u64_pair_walk(w, self->unused3 + i, fun, "pubkey_u64_pair", level );
6024 0 : fun( w, NULL, "unused3", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
6025 0 : }
6026 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_unused_accounts", level-- );
6027 0 : }
6028 6 : ulong fd_unused_accounts_size( fd_unused_accounts_t const * self ) {
6029 6 : ulong size = 0;
6030 6 : do {
6031 6 : size += sizeof(ulong);
6032 6 : for( ulong i=0; i < self->unused1_len; i++ )
6033 0 : size += fd_pubkey_size( self->unused1 + i );
6034 6 : } while(0);
6035 6 : do {
6036 6 : size += sizeof(ulong);
6037 6 : for( ulong i=0; i < self->unused2_len; i++ )
6038 0 : size += fd_pubkey_size( self->unused2 + i );
6039 6 : } while(0);
6040 6 : do {
6041 6 : size += sizeof(ulong);
6042 6 : for( ulong i=0; i < self->unused3_len; i++ )
6043 0 : size += fd_pubkey_u64_pair_size( self->unused3 + i );
6044 6 : } while(0);
6045 6 : return size;
6046 6 : }
6047 :
6048 0 : int fd_deserializable_versioned_bank_decode( fd_deserializable_versioned_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
6049 0 : void const * data = ctx->data;
6050 0 : int err = fd_deserializable_versioned_bank_decode_preflight( ctx );
6051 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6052 0 : ctx->data = data;
6053 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
6054 0 : fd_deserializable_versioned_bank_new( self );
6055 0 : }
6056 0 : fd_deserializable_versioned_bank_decode_unsafe( self, ctx );
6057 0 : return FD_BINCODE_SUCCESS;
6058 0 : }
6059 9 : int fd_deserializable_versioned_bank_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
6060 9 : int err;
6061 9 : err = fd_block_hash_vec_decode_preflight( ctx );
6062 9 : if( FD_UNLIKELY( err ) ) return err;
6063 6 : ulong ancestors_len;
6064 6 : err = fd_bincode_uint64_decode( &ancestors_len, ctx );
6065 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6066 6 : if( ancestors_len ) {
6067 0 : for( ulong i=0; i < ancestors_len; i++ ) {
6068 0 : err = fd_slot_pair_decode_preflight( ctx );
6069 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6070 0 : }
6071 0 : }
6072 6 : err = fd_hash_decode_preflight( ctx );
6073 6 : if( FD_UNLIKELY( err ) ) return err;
6074 6 : err = fd_hash_decode_preflight( ctx );
6075 6 : if( FD_UNLIKELY( err ) ) return err;
6076 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6077 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6078 6 : err = fd_hard_forks_decode_preflight( ctx );
6079 6 : if( FD_UNLIKELY( err ) ) return err;
6080 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6081 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6082 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6083 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6084 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6085 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6086 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6087 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6088 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6089 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6090 6 : {
6091 6 : uchar o;
6092 6 : err = fd_bincode_bool_decode( &o, ctx );
6093 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6094 6 : if( o ) {
6095 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6096 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6097 0 : }
6098 6 : }
6099 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6100 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6101 6 : err = fd_bincode_uint128_decode_preflight( ctx );
6102 6 : if( FD_UNLIKELY( err ) ) return err;
6103 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6104 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6105 6 : err = fd_bincode_double_decode_preflight( ctx );
6106 6 : if( FD_UNLIKELY( err ) ) return err;
6107 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6108 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6109 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6110 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6111 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6112 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6113 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6114 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6115 6 : err = fd_pubkey_decode_preflight( ctx );
6116 6 : if( FD_UNLIKELY( err ) ) return err;
6117 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6118 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6119 6 : err = fd_fee_calculator_decode_preflight( ctx );
6120 6 : if( FD_UNLIKELY( err ) ) return err;
6121 6 : err = fd_fee_rate_governor_decode_preflight( ctx );
6122 6 : if( FD_UNLIKELY( err ) ) return err;
6123 6 : err = fd_bincode_uint64_decode_preflight( ctx );
6124 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6125 6 : err = fd_rent_collector_decode_preflight( ctx );
6126 6 : if( FD_UNLIKELY( err ) ) return err;
6127 6 : err = fd_epoch_schedule_decode_preflight( ctx );
6128 6 : if( FD_UNLIKELY( err ) ) return err;
6129 6 : err = fd_inflation_decode_preflight( ctx );
6130 6 : if( FD_UNLIKELY( err ) ) return err;
6131 6 : err = fd_stakes_decode_preflight( ctx );
6132 6 : if( FD_UNLIKELY( err ) ) return err;
6133 6 : err = fd_unused_accounts_decode_preflight( ctx );
6134 6 : if( FD_UNLIKELY( err ) ) return err;
6135 6 : ulong epoch_stakes_len;
6136 6 : err = fd_bincode_uint64_decode( &epoch_stakes_len, ctx );
6137 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6138 6 : if( epoch_stakes_len ) {
6139 0 : for( ulong i=0; i < epoch_stakes_len; i++ ) {
6140 0 : err = fd_epoch_epoch_stakes_pair_decode_preflight( ctx );
6141 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6142 0 : }
6143 0 : }
6144 6 : err = fd_bincode_bool_decode_preflight( ctx );
6145 6 : if( FD_UNLIKELY( err ) ) return err;
6146 6 : return FD_BINCODE_SUCCESS;
6147 6 : }
6148 6 : void fd_deserializable_versioned_bank_decode_unsafe( fd_deserializable_versioned_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
6149 6 : fd_block_hash_vec_decode_unsafe( &self->blockhash_queue, ctx );
6150 6 : fd_bincode_uint64_decode_unsafe( &self->ancestors_len, ctx );
6151 6 : if( self->ancestors_len ) {
6152 0 : self->ancestors = (fd_slot_pair_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_PAIR_ALIGN, FD_SLOT_PAIR_FOOTPRINT*self->ancestors_len );
6153 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
6154 0 : fd_slot_pair_new( self->ancestors + i );
6155 0 : fd_slot_pair_decode_unsafe( self->ancestors + i, ctx );
6156 0 : }
6157 0 : } else
6158 6 : self->ancestors = NULL;
6159 6 : fd_hash_decode_unsafe( &self->hash, ctx );
6160 6 : fd_hash_decode_unsafe( &self->parent_hash, ctx );
6161 6 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
6162 6 : fd_hard_forks_decode_unsafe( &self->hard_forks, ctx );
6163 6 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
6164 6 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
6165 6 : fd_bincode_uint64_decode_unsafe( &self->signature_count, ctx );
6166 6 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
6167 6 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
6168 6 : {
6169 6 : uchar o;
6170 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
6171 6 : if( o ) {
6172 0 : self->hashes_per_tick = fd_valloc_malloc( ctx->valloc, 8, sizeof(ulong) );
6173 0 : fd_bincode_uint64_decode_unsafe( self->hashes_per_tick, ctx );
6174 0 : } else
6175 6 : self->hashes_per_tick = NULL;
6176 6 : }
6177 6 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
6178 6 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
6179 6 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
6180 6 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
6181 6 : fd_bincode_uint64_decode_unsafe( &self->accounts_data_len, ctx );
6182 6 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
6183 6 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6184 6 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
6185 6 : fd_pubkey_decode_unsafe( &self->collector_id, ctx );
6186 6 : fd_bincode_uint64_decode_unsafe( &self->collector_fees, ctx );
6187 6 : fd_fee_calculator_decode_unsafe( &self->fee_calculator, ctx );
6188 6 : fd_fee_rate_governor_decode_unsafe( &self->fee_rate_governor, ctx );
6189 6 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
6190 6 : fd_rent_collector_decode_unsafe( &self->rent_collector, ctx );
6191 6 : fd_epoch_schedule_decode_unsafe( &self->epoch_schedule, ctx );
6192 6 : fd_inflation_decode_unsafe( &self->inflation, ctx );
6193 6 : fd_stakes_decode_unsafe( &self->stakes, ctx );
6194 6 : fd_unused_accounts_decode_unsafe( &self->unused_accounts, ctx );
6195 6 : fd_bincode_uint64_decode_unsafe( &self->epoch_stakes_len, ctx );
6196 6 : if( self->epoch_stakes_len ) {
6197 0 : self->epoch_stakes = (fd_epoch_epoch_stakes_pair_t *)fd_valloc_malloc( ctx->valloc, FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN, FD_EPOCH_EPOCH_STAKES_PAIR_FOOTPRINT*self->epoch_stakes_len );
6198 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
6199 0 : fd_epoch_epoch_stakes_pair_new( self->epoch_stakes + i );
6200 0 : fd_epoch_epoch_stakes_pair_decode_unsafe( self->epoch_stakes + i, ctx );
6201 0 : }
6202 0 : } else
6203 6 : self->epoch_stakes = NULL;
6204 6 : fd_bincode_bool_decode_unsafe( &self->is_delta, ctx );
6205 6 : }
6206 6 : int fd_deserializable_versioned_bank_encode( fd_deserializable_versioned_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6207 6 : int err;
6208 6 : err = fd_block_hash_vec_encode( &self->blockhash_queue, ctx );
6209 6 : if( FD_UNLIKELY( err ) ) return err;
6210 6 : err = fd_bincode_uint64_encode( self->ancestors_len, ctx );
6211 6 : if( FD_UNLIKELY(err) ) return err;
6212 6 : if( self->ancestors_len ) {
6213 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
6214 0 : err = fd_slot_pair_encode( self->ancestors + i, ctx );
6215 0 : if( FD_UNLIKELY( err ) ) return err;
6216 0 : }
6217 0 : }
6218 6 : err = fd_hash_encode( &self->hash, ctx );
6219 6 : if( FD_UNLIKELY( err ) ) return err;
6220 6 : err = fd_hash_encode( &self->parent_hash, ctx );
6221 6 : if( FD_UNLIKELY( err ) ) return err;
6222 6 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
6223 6 : if( FD_UNLIKELY( err ) ) return err;
6224 6 : err = fd_hard_forks_encode( &self->hard_forks, ctx );
6225 6 : if( FD_UNLIKELY( err ) ) return err;
6226 6 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
6227 6 : if( FD_UNLIKELY( err ) ) return err;
6228 6 : err = fd_bincode_uint64_encode( self->tick_height, ctx );
6229 6 : if( FD_UNLIKELY( err ) ) return err;
6230 6 : err = fd_bincode_uint64_encode( self->signature_count, ctx );
6231 6 : if( FD_UNLIKELY( err ) ) return err;
6232 6 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
6233 6 : if( FD_UNLIKELY( err ) ) return err;
6234 6 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
6235 6 : if( FD_UNLIKELY( err ) ) return err;
6236 6 : if( self->hashes_per_tick != NULL ) {
6237 0 : err = fd_bincode_bool_encode( 1, ctx );
6238 0 : if( FD_UNLIKELY( err ) ) return err;
6239 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick[0], ctx );
6240 0 : if( FD_UNLIKELY( err ) ) return err;
6241 6 : } else {
6242 6 : err = fd_bincode_bool_encode( 0, ctx );
6243 6 : if( FD_UNLIKELY( err ) ) return err;
6244 6 : }
6245 6 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
6246 6 : if( FD_UNLIKELY( err ) ) return err;
6247 6 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
6248 6 : if( FD_UNLIKELY( err ) ) return err;
6249 6 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
6250 6 : if( FD_UNLIKELY( err ) ) return err;
6251 6 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
6252 6 : if( FD_UNLIKELY( err ) ) return err;
6253 6 : err = fd_bincode_uint64_encode( self->accounts_data_len, ctx );
6254 6 : if( FD_UNLIKELY( err ) ) return err;
6255 6 : err = fd_bincode_uint64_encode( self->slot, ctx );
6256 6 : if( FD_UNLIKELY( err ) ) return err;
6257 6 : err = fd_bincode_uint64_encode( self->epoch, ctx );
6258 6 : if( FD_UNLIKELY( err ) ) return err;
6259 6 : err = fd_bincode_uint64_encode( self->block_height, ctx );
6260 6 : if( FD_UNLIKELY( err ) ) return err;
6261 6 : err = fd_pubkey_encode( &self->collector_id, ctx );
6262 6 : if( FD_UNLIKELY( err ) ) return err;
6263 6 : err = fd_bincode_uint64_encode( self->collector_fees, ctx );
6264 6 : if( FD_UNLIKELY( err ) ) return err;
6265 6 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
6266 6 : if( FD_UNLIKELY( err ) ) return err;
6267 6 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
6268 6 : if( FD_UNLIKELY( err ) ) return err;
6269 6 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
6270 6 : if( FD_UNLIKELY( err ) ) return err;
6271 6 : err = fd_rent_collector_encode( &self->rent_collector, ctx );
6272 6 : if( FD_UNLIKELY( err ) ) return err;
6273 6 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
6274 6 : if( FD_UNLIKELY( err ) ) return err;
6275 6 : err = fd_inflation_encode( &self->inflation, ctx );
6276 6 : if( FD_UNLIKELY( err ) ) return err;
6277 6 : err = fd_stakes_encode( &self->stakes, ctx );
6278 6 : if( FD_UNLIKELY( err ) ) return err;
6279 6 : err = fd_unused_accounts_encode( &self->unused_accounts, ctx );
6280 6 : if( FD_UNLIKELY( err ) ) return err;
6281 6 : err = fd_bincode_uint64_encode( self->epoch_stakes_len, ctx );
6282 6 : if( FD_UNLIKELY(err) ) return err;
6283 6 : if( self->epoch_stakes_len ) {
6284 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
6285 0 : err = fd_epoch_epoch_stakes_pair_encode( self->epoch_stakes + i, ctx );
6286 0 : if( FD_UNLIKELY( err ) ) return err;
6287 0 : }
6288 0 : }
6289 6 : err = fd_bincode_bool_encode( (uchar)(self->is_delta), ctx );
6290 6 : if( FD_UNLIKELY( err ) ) return err;
6291 6 : return FD_BINCODE_SUCCESS;
6292 6 : }
6293 0 : int fd_deserializable_versioned_bank_decode_offsets( fd_deserializable_versioned_bank_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
6294 0 : uchar const * data = ctx->data;
6295 0 : int err;
6296 0 : self->blockhash_queue_off = (uint)( (ulong)ctx->data - (ulong)data );
6297 0 : err = fd_block_hash_vec_decode_preflight( ctx );
6298 0 : if( FD_UNLIKELY( err ) ) return err;
6299 0 : self->ancestors_off = (uint)( (ulong)ctx->data - (ulong)data );
6300 0 : ulong ancestors_len;
6301 0 : err = fd_bincode_uint64_decode( &ancestors_len, ctx );
6302 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6303 0 : if( ancestors_len ) {
6304 0 : for( ulong i=0; i < ancestors_len; i++ ) {
6305 0 : err = fd_slot_pair_decode_preflight( ctx );
6306 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6307 0 : }
6308 0 : }
6309 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
6310 0 : err = fd_hash_decode_preflight( ctx );
6311 0 : if( FD_UNLIKELY( err ) ) return err;
6312 0 : self->parent_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
6313 0 : err = fd_hash_decode_preflight( ctx );
6314 0 : if( FD_UNLIKELY( err ) ) return err;
6315 0 : self->parent_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
6316 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6317 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6318 0 : self->hard_forks_off = (uint)( (ulong)ctx->data - (ulong)data );
6319 0 : err = fd_hard_forks_decode_preflight( ctx );
6320 0 : if( FD_UNLIKELY( err ) ) return err;
6321 0 : self->transaction_count_off = (uint)( (ulong)ctx->data - (ulong)data );
6322 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6323 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6324 0 : self->tick_height_off = (uint)( (ulong)ctx->data - (ulong)data );
6325 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6326 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6327 0 : self->signature_count_off = (uint)( (ulong)ctx->data - (ulong)data );
6328 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6329 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6330 0 : self->capitalization_off = (uint)( (ulong)ctx->data - (ulong)data );
6331 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6332 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6333 0 : self->max_tick_height_off = (uint)( (ulong)ctx->data - (ulong)data );
6334 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6335 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6336 0 : self->hashes_per_tick_off = (uint)( (ulong)ctx->data - (ulong)data );
6337 0 : {
6338 0 : uchar o;
6339 0 : err = fd_bincode_bool_decode( &o, ctx );
6340 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6341 0 : if( o ) {
6342 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6343 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6344 0 : }
6345 0 : }
6346 0 : self->ticks_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
6347 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6348 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6349 0 : self->ns_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
6350 0 : err = fd_bincode_uint128_decode_preflight( ctx );
6351 0 : if( FD_UNLIKELY( err ) ) return err;
6352 0 : self->genesis_creation_time_off = (uint)( (ulong)ctx->data - (ulong)data );
6353 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6354 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6355 0 : self->slots_per_year_off = (uint)( (ulong)ctx->data - (ulong)data );
6356 0 : err = fd_bincode_double_decode_preflight( ctx );
6357 0 : if( FD_UNLIKELY( err ) ) return err;
6358 0 : self->accounts_data_len_off = (uint)( (ulong)ctx->data - (ulong)data );
6359 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6360 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6361 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
6362 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6363 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6364 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
6365 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6366 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6367 0 : self->block_height_off = (uint)( (ulong)ctx->data - (ulong)data );
6368 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6369 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6370 0 : self->collector_id_off = (uint)( (ulong)ctx->data - (ulong)data );
6371 0 : err = fd_pubkey_decode_preflight( ctx );
6372 0 : if( FD_UNLIKELY( err ) ) return err;
6373 0 : self->collector_fees_off = (uint)( (ulong)ctx->data - (ulong)data );
6374 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6375 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6376 0 : self->fee_calculator_off = (uint)( (ulong)ctx->data - (ulong)data );
6377 0 : err = fd_fee_calculator_decode_preflight( ctx );
6378 0 : if( FD_UNLIKELY( err ) ) return err;
6379 0 : self->fee_rate_governor_off = (uint)( (ulong)ctx->data - (ulong)data );
6380 0 : err = fd_fee_rate_governor_decode_preflight( ctx );
6381 0 : if( FD_UNLIKELY( err ) ) return err;
6382 0 : self->collected_rent_off = (uint)( (ulong)ctx->data - (ulong)data );
6383 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6384 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6385 0 : self->rent_collector_off = (uint)( (ulong)ctx->data - (ulong)data );
6386 0 : err = fd_rent_collector_decode_preflight( ctx );
6387 0 : if( FD_UNLIKELY( err ) ) return err;
6388 0 : self->epoch_schedule_off = (uint)( (ulong)ctx->data - (ulong)data );
6389 0 : err = fd_epoch_schedule_decode_preflight( ctx );
6390 0 : if( FD_UNLIKELY( err ) ) return err;
6391 0 : self->inflation_off = (uint)( (ulong)ctx->data - (ulong)data );
6392 0 : err = fd_inflation_decode_preflight( ctx );
6393 0 : if( FD_UNLIKELY( err ) ) return err;
6394 0 : self->stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
6395 0 : err = fd_stakes_decode_preflight( ctx );
6396 0 : if( FD_UNLIKELY( err ) ) return err;
6397 0 : self->unused_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
6398 0 : err = fd_unused_accounts_decode_preflight( ctx );
6399 0 : if( FD_UNLIKELY( err ) ) return err;
6400 0 : self->epoch_stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
6401 0 : ulong epoch_stakes_len;
6402 0 : err = fd_bincode_uint64_decode( &epoch_stakes_len, ctx );
6403 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6404 0 : if( epoch_stakes_len ) {
6405 0 : for( ulong i=0; i < epoch_stakes_len; i++ ) {
6406 0 : err = fd_epoch_epoch_stakes_pair_decode_preflight( ctx );
6407 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6408 0 : }
6409 0 : }
6410 0 : self->is_delta_off = (uint)( (ulong)ctx->data - (ulong)data );
6411 0 : err = fd_bincode_bool_decode_preflight( ctx );
6412 0 : if( FD_UNLIKELY( err ) ) return err;
6413 0 : return FD_BINCODE_SUCCESS;
6414 0 : }
6415 6 : void fd_deserializable_versioned_bank_new(fd_deserializable_versioned_bank_t * self) {
6416 6 : fd_memset( self, 0, sizeof(fd_deserializable_versioned_bank_t) );
6417 6 : fd_block_hash_vec_new( &self->blockhash_queue );
6418 6 : fd_hash_new( &self->hash );
6419 6 : fd_hash_new( &self->parent_hash );
6420 6 : fd_hard_forks_new( &self->hard_forks );
6421 6 : fd_pubkey_new( &self->collector_id );
6422 6 : fd_fee_calculator_new( &self->fee_calculator );
6423 6 : fd_fee_rate_governor_new( &self->fee_rate_governor );
6424 6 : fd_rent_collector_new( &self->rent_collector );
6425 6 : fd_epoch_schedule_new( &self->epoch_schedule );
6426 6 : fd_inflation_new( &self->inflation );
6427 6 : fd_stakes_new( &self->stakes );
6428 6 : fd_unused_accounts_new( &self->unused_accounts );
6429 6 : }
6430 0 : void fd_deserializable_versioned_bank_destroy( fd_deserializable_versioned_bank_t * self, fd_bincode_destroy_ctx_t * ctx ) {
6431 0 : fd_block_hash_vec_destroy( &self->blockhash_queue, ctx );
6432 0 : if( self->ancestors ) {
6433 0 : for( ulong i=0; i < self->ancestors_len; i++ )
6434 0 : fd_slot_pair_destroy( self->ancestors + i, ctx );
6435 0 : fd_valloc_free( ctx->valloc, self->ancestors );
6436 0 : self->ancestors = NULL;
6437 0 : }
6438 0 : fd_hash_destroy( &self->hash, ctx );
6439 0 : fd_hash_destroy( &self->parent_hash, ctx );
6440 0 : fd_hard_forks_destroy( &self->hard_forks, ctx );
6441 0 : if( self->hashes_per_tick ) {
6442 0 : fd_valloc_free( ctx->valloc, self->hashes_per_tick );
6443 0 : self->hashes_per_tick = NULL;
6444 0 : }
6445 0 : fd_pubkey_destroy( &self->collector_id, ctx );
6446 0 : fd_fee_calculator_destroy( &self->fee_calculator, ctx );
6447 0 : fd_fee_rate_governor_destroy( &self->fee_rate_governor, ctx );
6448 0 : fd_rent_collector_destroy( &self->rent_collector, ctx );
6449 0 : fd_epoch_schedule_destroy( &self->epoch_schedule, ctx );
6450 0 : fd_inflation_destroy( &self->inflation, ctx );
6451 0 : fd_stakes_destroy( &self->stakes, ctx );
6452 0 : fd_unused_accounts_destroy( &self->unused_accounts, ctx );
6453 0 : if( self->epoch_stakes ) {
6454 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
6455 0 : fd_epoch_epoch_stakes_pair_destroy( self->epoch_stakes + i, ctx );
6456 0 : fd_valloc_free( ctx->valloc, self->epoch_stakes );
6457 0 : self->epoch_stakes = NULL;
6458 0 : }
6459 0 : }
6460 :
6461 0 : ulong fd_deserializable_versioned_bank_footprint( void ){ return FD_DESERIALIZABLE_VERSIONED_BANK_FOOTPRINT; }
6462 0 : ulong fd_deserializable_versioned_bank_align( void ){ return FD_DESERIALIZABLE_VERSIONED_BANK_ALIGN; }
6463 :
6464 0 : void fd_deserializable_versioned_bank_walk( void * w, fd_deserializable_versioned_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6465 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_deserializable_versioned_bank", level++ );
6466 0 : fd_block_hash_vec_walk( w, &self->blockhash_queue, fun, "blockhash_queue", level );
6467 0 : if( self->ancestors_len ) {
6468 0 : fun( w, NULL, "ancestors", FD_FLAMENCO_TYPE_ARR, "array", level++ );
6469 0 : for( ulong i=0; i < self->ancestors_len; i++ )
6470 0 : fd_slot_pair_walk(w, self->ancestors + i, fun, "slot_pair", level );
6471 0 : fun( w, NULL, "ancestors", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
6472 0 : }
6473 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
6474 0 : fd_hash_walk( w, &self->parent_hash, fun, "parent_hash", level );
6475 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6476 0 : fd_hard_forks_walk( w, &self->hard_forks, fun, "hard_forks", level );
6477 0 : fun( w, &self->transaction_count, "transaction_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6478 0 : fun( w, &self->tick_height, "tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6479 0 : fun( w, &self->signature_count, "signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6480 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6481 0 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6482 0 : if( !self->hashes_per_tick ) {
6483 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level );
6484 0 : } else {
6485 0 : fun( w, self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6486 0 : }
6487 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6488 0 : fun( w, &self->ns_per_slot, "ns_per_slot", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
6489 0 : fun( w, &self->genesis_creation_time, "genesis_creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6490 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
6491 0 : fun( w, &self->accounts_data_len, "accounts_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6492 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6493 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6494 0 : fun( w, &self->block_height, "block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6495 0 : fd_pubkey_walk( w, &self->collector_id, fun, "collector_id", level );
6496 0 : fun( w, &self->collector_fees, "collector_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6497 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
6498 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level );
6499 0 : fun( w, &self->collected_rent, "collected_rent", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6500 0 : fd_rent_collector_walk( w, &self->rent_collector, fun, "rent_collector", level );
6501 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
6502 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level );
6503 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level );
6504 0 : fd_unused_accounts_walk( w, &self->unused_accounts, fun, "unused_accounts", level );
6505 0 : if( self->epoch_stakes_len ) {
6506 0 : fun( w, NULL, "epoch_stakes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
6507 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
6508 0 : fd_epoch_epoch_stakes_pair_walk(w, self->epoch_stakes + i, fun, "epoch_epoch_stakes_pair", level );
6509 0 : fun( w, NULL, "epoch_stakes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
6510 0 : }
6511 0 : fun( w, &self->is_delta, "is_delta", FD_FLAMENCO_TYPE_BOOL, "bool", level );
6512 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_deserializable_versioned_bank", level-- );
6513 0 : }
6514 6 : ulong fd_deserializable_versioned_bank_size( fd_deserializable_versioned_bank_t const * self ) {
6515 6 : ulong size = 0;
6516 6 : size += fd_block_hash_vec_size( &self->blockhash_queue );
6517 6 : do {
6518 6 : size += sizeof(ulong);
6519 6 : for( ulong i=0; i < self->ancestors_len; i++ )
6520 0 : size += fd_slot_pair_size( self->ancestors + i );
6521 6 : } while(0);
6522 6 : size += fd_hash_size( &self->hash );
6523 6 : size += fd_hash_size( &self->parent_hash );
6524 6 : size += sizeof(ulong);
6525 6 : size += fd_hard_forks_size( &self->hard_forks );
6526 6 : size += sizeof(ulong);
6527 6 : size += sizeof(ulong);
6528 6 : size += sizeof(ulong);
6529 6 : size += sizeof(ulong);
6530 6 : size += sizeof(ulong);
6531 6 : size += sizeof(char);
6532 6 : if( NULL != self->hashes_per_tick ) {
6533 0 : size += sizeof(ulong);
6534 0 : }
6535 6 : size += sizeof(ulong);
6536 6 : size += sizeof(uint128);
6537 6 : size += sizeof(ulong);
6538 6 : size += sizeof(double);
6539 6 : size += sizeof(ulong);
6540 6 : size += sizeof(ulong);
6541 6 : size += sizeof(ulong);
6542 6 : size += sizeof(ulong);
6543 6 : size += fd_pubkey_size( &self->collector_id );
6544 6 : size += sizeof(ulong);
6545 6 : size += fd_fee_calculator_size( &self->fee_calculator );
6546 6 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
6547 6 : size += sizeof(ulong);
6548 6 : size += fd_rent_collector_size( &self->rent_collector );
6549 6 : size += fd_epoch_schedule_size( &self->epoch_schedule );
6550 6 : size += fd_inflation_size( &self->inflation );
6551 6 : size += fd_stakes_size( &self->stakes );
6552 6 : size += fd_unused_accounts_size( &self->unused_accounts );
6553 6 : do {
6554 6 : size += sizeof(ulong);
6555 6 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
6556 0 : size += fd_epoch_epoch_stakes_pair_size( self->epoch_stakes + i );
6557 6 : } while(0);
6558 6 : size += sizeof(char);
6559 6 : return size;
6560 6 : }
6561 :
6562 0 : int fd_serializable_versioned_bank_decode( fd_serializable_versioned_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
6563 0 : void const * data = ctx->data;
6564 0 : int err = fd_serializable_versioned_bank_decode_preflight( ctx );
6565 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6566 0 : ctx->data = data;
6567 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
6568 0 : fd_serializable_versioned_bank_new( self );
6569 0 : }
6570 0 : fd_serializable_versioned_bank_decode_unsafe( self, ctx );
6571 0 : return FD_BINCODE_SUCCESS;
6572 0 : }
6573 0 : int fd_serializable_versioned_bank_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
6574 0 : int err;
6575 0 : err = fd_block_hash_vec_decode_preflight( ctx );
6576 0 : if( FD_UNLIKELY( err ) ) return err;
6577 0 : ulong ancestors_len;
6578 0 : err = fd_bincode_uint64_decode( &ancestors_len, ctx );
6579 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6580 0 : if( ancestors_len ) {
6581 0 : for( ulong i=0; i < ancestors_len; i++ ) {
6582 0 : err = fd_slot_pair_decode_preflight( ctx );
6583 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6584 0 : }
6585 0 : }
6586 0 : err = fd_hash_decode_preflight( ctx );
6587 0 : if( FD_UNLIKELY( err ) ) return err;
6588 0 : err = fd_hash_decode_preflight( ctx );
6589 0 : if( FD_UNLIKELY( err ) ) return err;
6590 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6591 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6592 0 : err = fd_hard_forks_decode_preflight( ctx );
6593 0 : if( FD_UNLIKELY( err ) ) return err;
6594 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6595 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6596 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6597 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6598 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6599 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6600 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6601 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6602 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6603 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6604 0 : {
6605 0 : uchar o;
6606 0 : err = fd_bincode_bool_decode( &o, ctx );
6607 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6608 0 : if( o ) {
6609 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6610 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6611 0 : }
6612 0 : }
6613 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6614 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6615 0 : err = fd_bincode_uint128_decode_preflight( ctx );
6616 0 : if( FD_UNLIKELY( err ) ) return err;
6617 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6618 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6619 0 : err = fd_bincode_double_decode_preflight( ctx );
6620 0 : if( FD_UNLIKELY( err ) ) return err;
6621 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6622 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6623 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6624 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6625 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6626 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6627 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6628 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6629 0 : err = fd_pubkey_decode_preflight( ctx );
6630 0 : if( FD_UNLIKELY( err ) ) return err;
6631 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6632 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6633 0 : err = fd_fee_calculator_decode_preflight( ctx );
6634 0 : if( FD_UNLIKELY( err ) ) return err;
6635 0 : err = fd_fee_rate_governor_decode_preflight( ctx );
6636 0 : if( FD_UNLIKELY( err ) ) return err;
6637 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6638 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6639 0 : err = fd_rent_collector_decode_preflight( ctx );
6640 0 : if( FD_UNLIKELY( err ) ) return err;
6641 0 : err = fd_epoch_schedule_decode_preflight( ctx );
6642 0 : if( FD_UNLIKELY( err ) ) return err;
6643 0 : err = fd_inflation_decode_preflight( ctx );
6644 0 : if( FD_UNLIKELY( err ) ) return err;
6645 0 : err = fd_stakes_serializable_decode_preflight( ctx );
6646 0 : if( FD_UNLIKELY( err ) ) return err;
6647 0 : err = fd_unused_accounts_decode_preflight( ctx );
6648 0 : if( FD_UNLIKELY( err ) ) return err;
6649 0 : ulong epoch_stakes_len;
6650 0 : err = fd_bincode_uint64_decode( &epoch_stakes_len, ctx );
6651 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6652 0 : if( epoch_stakes_len ) {
6653 0 : for( ulong i=0; i < epoch_stakes_len; i++ ) {
6654 0 : err = fd_epoch_epoch_stakes_pair_decode_preflight( ctx );
6655 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6656 0 : }
6657 0 : }
6658 0 : err = fd_bincode_bool_decode_preflight( ctx );
6659 0 : if( FD_UNLIKELY( err ) ) return err;
6660 0 : return FD_BINCODE_SUCCESS;
6661 0 : }
6662 0 : void fd_serializable_versioned_bank_decode_unsafe( fd_serializable_versioned_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
6663 0 : fd_block_hash_vec_decode_unsafe( &self->blockhash_queue, ctx );
6664 0 : fd_bincode_uint64_decode_unsafe( &self->ancestors_len, ctx );
6665 0 : if( self->ancestors_len ) {
6666 0 : self->ancestors = (fd_slot_pair_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_PAIR_ALIGN, FD_SLOT_PAIR_FOOTPRINT*self->ancestors_len );
6667 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
6668 0 : fd_slot_pair_new( self->ancestors + i );
6669 0 : fd_slot_pair_decode_unsafe( self->ancestors + i, ctx );
6670 0 : }
6671 0 : } else
6672 0 : self->ancestors = NULL;
6673 0 : fd_hash_decode_unsafe( &self->hash, ctx );
6674 0 : fd_hash_decode_unsafe( &self->parent_hash, ctx );
6675 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
6676 0 : fd_hard_forks_decode_unsafe( &self->hard_forks, ctx );
6677 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
6678 0 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
6679 0 : fd_bincode_uint64_decode_unsafe( &self->signature_count, ctx );
6680 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
6681 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
6682 0 : {
6683 0 : uchar o;
6684 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6685 0 : if( o ) {
6686 0 : self->hashes_per_tick = fd_valloc_malloc( ctx->valloc, 8, sizeof(ulong) );
6687 0 : fd_bincode_uint64_decode_unsafe( self->hashes_per_tick, ctx );
6688 0 : } else
6689 0 : self->hashes_per_tick = NULL;
6690 0 : }
6691 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
6692 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
6693 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
6694 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
6695 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_data_len, ctx );
6696 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
6697 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6698 0 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
6699 0 : fd_pubkey_decode_unsafe( &self->collector_id, ctx );
6700 0 : fd_bincode_uint64_decode_unsafe( &self->collector_fees, ctx );
6701 0 : fd_fee_calculator_decode_unsafe( &self->fee_calculator, ctx );
6702 0 : fd_fee_rate_governor_decode_unsafe( &self->fee_rate_governor, ctx );
6703 0 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
6704 0 : fd_rent_collector_decode_unsafe( &self->rent_collector, ctx );
6705 0 : fd_epoch_schedule_decode_unsafe( &self->epoch_schedule, ctx );
6706 0 : fd_inflation_decode_unsafe( &self->inflation, ctx );
6707 0 : fd_stakes_serializable_decode_unsafe( &self->stakes, ctx );
6708 0 : fd_unused_accounts_decode_unsafe( &self->unused_accounts, ctx );
6709 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_stakes_len, ctx );
6710 0 : if( self->epoch_stakes_len ) {
6711 0 : self->epoch_stakes = (fd_epoch_epoch_stakes_pair_t *)fd_valloc_malloc( ctx->valloc, FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN, FD_EPOCH_EPOCH_STAKES_PAIR_FOOTPRINT*self->epoch_stakes_len );
6712 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
6713 0 : fd_epoch_epoch_stakes_pair_new( self->epoch_stakes + i );
6714 0 : fd_epoch_epoch_stakes_pair_decode_unsafe( self->epoch_stakes + i, ctx );
6715 0 : }
6716 0 : } else
6717 0 : self->epoch_stakes = NULL;
6718 0 : fd_bincode_bool_decode_unsafe( &self->is_delta, ctx );
6719 0 : }
6720 0 : int fd_serializable_versioned_bank_encode( fd_serializable_versioned_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6721 0 : int err;
6722 0 : err = fd_block_hash_vec_encode( &self->blockhash_queue, ctx );
6723 0 : if( FD_UNLIKELY( err ) ) return err;
6724 0 : err = fd_bincode_uint64_encode( self->ancestors_len, ctx );
6725 0 : if( FD_UNLIKELY(err) ) return err;
6726 0 : if( self->ancestors_len ) {
6727 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
6728 0 : err = fd_slot_pair_encode( self->ancestors + i, ctx );
6729 0 : if( FD_UNLIKELY( err ) ) return err;
6730 0 : }
6731 0 : }
6732 0 : err = fd_hash_encode( &self->hash, ctx );
6733 0 : if( FD_UNLIKELY( err ) ) return err;
6734 0 : err = fd_hash_encode( &self->parent_hash, ctx );
6735 0 : if( FD_UNLIKELY( err ) ) return err;
6736 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
6737 0 : if( FD_UNLIKELY( err ) ) return err;
6738 0 : err = fd_hard_forks_encode( &self->hard_forks, ctx );
6739 0 : if( FD_UNLIKELY( err ) ) return err;
6740 0 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
6741 0 : if( FD_UNLIKELY( err ) ) return err;
6742 0 : err = fd_bincode_uint64_encode( self->tick_height, ctx );
6743 0 : if( FD_UNLIKELY( err ) ) return err;
6744 0 : err = fd_bincode_uint64_encode( self->signature_count, ctx );
6745 0 : if( FD_UNLIKELY( err ) ) return err;
6746 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
6747 0 : if( FD_UNLIKELY( err ) ) return err;
6748 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
6749 0 : if( FD_UNLIKELY( err ) ) return err;
6750 0 : if( self->hashes_per_tick != NULL ) {
6751 0 : err = fd_bincode_bool_encode( 1, ctx );
6752 0 : if( FD_UNLIKELY( err ) ) return err;
6753 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick[0], ctx );
6754 0 : if( FD_UNLIKELY( err ) ) return err;
6755 0 : } else {
6756 0 : err = fd_bincode_bool_encode( 0, ctx );
6757 0 : if( FD_UNLIKELY( err ) ) return err;
6758 0 : }
6759 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
6760 0 : if( FD_UNLIKELY( err ) ) return err;
6761 0 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
6762 0 : if( FD_UNLIKELY( err ) ) return err;
6763 0 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
6764 0 : if( FD_UNLIKELY( err ) ) return err;
6765 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
6766 0 : if( FD_UNLIKELY( err ) ) return err;
6767 0 : err = fd_bincode_uint64_encode( self->accounts_data_len, ctx );
6768 0 : if( FD_UNLIKELY( err ) ) return err;
6769 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
6770 0 : if( FD_UNLIKELY( err ) ) return err;
6771 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
6772 0 : if( FD_UNLIKELY( err ) ) return err;
6773 0 : err = fd_bincode_uint64_encode( self->block_height, ctx );
6774 0 : if( FD_UNLIKELY( err ) ) return err;
6775 0 : err = fd_pubkey_encode( &self->collector_id, ctx );
6776 0 : if( FD_UNLIKELY( err ) ) return err;
6777 0 : err = fd_bincode_uint64_encode( self->collector_fees, ctx );
6778 0 : if( FD_UNLIKELY( err ) ) return err;
6779 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
6780 0 : if( FD_UNLIKELY( err ) ) return err;
6781 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
6782 0 : if( FD_UNLIKELY( err ) ) return err;
6783 0 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
6784 0 : if( FD_UNLIKELY( err ) ) return err;
6785 0 : err = fd_rent_collector_encode( &self->rent_collector, ctx );
6786 0 : if( FD_UNLIKELY( err ) ) return err;
6787 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
6788 0 : if( FD_UNLIKELY( err ) ) return err;
6789 0 : err = fd_inflation_encode( &self->inflation, ctx );
6790 0 : if( FD_UNLIKELY( err ) ) return err;
6791 0 : err = fd_stakes_serializable_encode( &self->stakes, ctx );
6792 0 : if( FD_UNLIKELY( err ) ) return err;
6793 0 : err = fd_unused_accounts_encode( &self->unused_accounts, ctx );
6794 0 : if( FD_UNLIKELY( err ) ) return err;
6795 0 : err = fd_bincode_uint64_encode( self->epoch_stakes_len, ctx );
6796 0 : if( FD_UNLIKELY(err) ) return err;
6797 0 : if( self->epoch_stakes_len ) {
6798 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
6799 0 : err = fd_epoch_epoch_stakes_pair_encode( self->epoch_stakes + i, ctx );
6800 0 : if( FD_UNLIKELY( err ) ) return err;
6801 0 : }
6802 0 : }
6803 0 : err = fd_bincode_bool_encode( (uchar)(self->is_delta), ctx );
6804 0 : if( FD_UNLIKELY( err ) ) return err;
6805 0 : return FD_BINCODE_SUCCESS;
6806 0 : }
6807 0 : int fd_serializable_versioned_bank_decode_offsets( fd_serializable_versioned_bank_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
6808 0 : uchar const * data = ctx->data;
6809 0 : int err;
6810 0 : self->blockhash_queue_off = (uint)( (ulong)ctx->data - (ulong)data );
6811 0 : err = fd_block_hash_vec_decode_preflight( ctx );
6812 0 : if( FD_UNLIKELY( err ) ) return err;
6813 0 : self->ancestors_off = (uint)( (ulong)ctx->data - (ulong)data );
6814 0 : ulong ancestors_len;
6815 0 : err = fd_bincode_uint64_decode( &ancestors_len, ctx );
6816 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6817 0 : if( ancestors_len ) {
6818 0 : for( ulong i=0; i < ancestors_len; i++ ) {
6819 0 : err = fd_slot_pair_decode_preflight( ctx );
6820 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6821 0 : }
6822 0 : }
6823 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
6824 0 : err = fd_hash_decode_preflight( ctx );
6825 0 : if( FD_UNLIKELY( err ) ) return err;
6826 0 : self->parent_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
6827 0 : err = fd_hash_decode_preflight( ctx );
6828 0 : if( FD_UNLIKELY( err ) ) return err;
6829 0 : self->parent_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
6830 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6831 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6832 0 : self->hard_forks_off = (uint)( (ulong)ctx->data - (ulong)data );
6833 0 : err = fd_hard_forks_decode_preflight( ctx );
6834 0 : if( FD_UNLIKELY( err ) ) return err;
6835 0 : self->transaction_count_off = (uint)( (ulong)ctx->data - (ulong)data );
6836 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6837 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6838 0 : self->tick_height_off = (uint)( (ulong)ctx->data - (ulong)data );
6839 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6840 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6841 0 : self->signature_count_off = (uint)( (ulong)ctx->data - (ulong)data );
6842 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6843 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6844 0 : self->capitalization_off = (uint)( (ulong)ctx->data - (ulong)data );
6845 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6846 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6847 0 : self->max_tick_height_off = (uint)( (ulong)ctx->data - (ulong)data );
6848 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6849 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6850 0 : self->hashes_per_tick_off = (uint)( (ulong)ctx->data - (ulong)data );
6851 0 : {
6852 0 : uchar o;
6853 0 : err = fd_bincode_bool_decode( &o, ctx );
6854 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6855 0 : if( o ) {
6856 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6857 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6858 0 : }
6859 0 : }
6860 0 : self->ticks_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
6861 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6862 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6863 0 : self->ns_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
6864 0 : err = fd_bincode_uint128_decode_preflight( ctx );
6865 0 : if( FD_UNLIKELY( err ) ) return err;
6866 0 : self->genesis_creation_time_off = (uint)( (ulong)ctx->data - (ulong)data );
6867 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6868 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6869 0 : self->slots_per_year_off = (uint)( (ulong)ctx->data - (ulong)data );
6870 0 : err = fd_bincode_double_decode_preflight( ctx );
6871 0 : if( FD_UNLIKELY( err ) ) return err;
6872 0 : self->accounts_data_len_off = (uint)( (ulong)ctx->data - (ulong)data );
6873 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6874 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6875 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
6876 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6877 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6878 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
6879 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6880 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6881 0 : self->block_height_off = (uint)( (ulong)ctx->data - (ulong)data );
6882 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6883 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6884 0 : self->collector_id_off = (uint)( (ulong)ctx->data - (ulong)data );
6885 0 : err = fd_pubkey_decode_preflight( ctx );
6886 0 : if( FD_UNLIKELY( err ) ) return err;
6887 0 : self->collector_fees_off = (uint)( (ulong)ctx->data - (ulong)data );
6888 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6889 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6890 0 : self->fee_calculator_off = (uint)( (ulong)ctx->data - (ulong)data );
6891 0 : err = fd_fee_calculator_decode_preflight( ctx );
6892 0 : if( FD_UNLIKELY( err ) ) return err;
6893 0 : self->fee_rate_governor_off = (uint)( (ulong)ctx->data - (ulong)data );
6894 0 : err = fd_fee_rate_governor_decode_preflight( ctx );
6895 0 : if( FD_UNLIKELY( err ) ) return err;
6896 0 : self->collected_rent_off = (uint)( (ulong)ctx->data - (ulong)data );
6897 0 : err = fd_bincode_uint64_decode_preflight( ctx );
6898 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6899 0 : self->rent_collector_off = (uint)( (ulong)ctx->data - (ulong)data );
6900 0 : err = fd_rent_collector_decode_preflight( ctx );
6901 0 : if( FD_UNLIKELY( err ) ) return err;
6902 0 : self->epoch_schedule_off = (uint)( (ulong)ctx->data - (ulong)data );
6903 0 : err = fd_epoch_schedule_decode_preflight( ctx );
6904 0 : if( FD_UNLIKELY( err ) ) return err;
6905 0 : self->inflation_off = (uint)( (ulong)ctx->data - (ulong)data );
6906 0 : err = fd_inflation_decode_preflight( ctx );
6907 0 : if( FD_UNLIKELY( err ) ) return err;
6908 0 : self->stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
6909 0 : err = fd_stakes_serializable_decode_preflight( ctx );
6910 0 : if( FD_UNLIKELY( err ) ) return err;
6911 0 : self->unused_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
6912 0 : err = fd_unused_accounts_decode_preflight( ctx );
6913 0 : if( FD_UNLIKELY( err ) ) return err;
6914 0 : self->epoch_stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
6915 0 : ulong epoch_stakes_len;
6916 0 : err = fd_bincode_uint64_decode( &epoch_stakes_len, ctx );
6917 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6918 0 : if( epoch_stakes_len ) {
6919 0 : for( ulong i=0; i < epoch_stakes_len; i++ ) {
6920 0 : err = fd_epoch_epoch_stakes_pair_decode_preflight( ctx );
6921 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6922 0 : }
6923 0 : }
6924 0 : self->is_delta_off = (uint)( (ulong)ctx->data - (ulong)data );
6925 0 : err = fd_bincode_bool_decode_preflight( ctx );
6926 0 : if( FD_UNLIKELY( err ) ) return err;
6927 0 : return FD_BINCODE_SUCCESS;
6928 0 : }
6929 0 : void fd_serializable_versioned_bank_new(fd_serializable_versioned_bank_t * self) {
6930 0 : fd_memset( self, 0, sizeof(fd_serializable_versioned_bank_t) );
6931 0 : fd_block_hash_vec_new( &self->blockhash_queue );
6932 0 : fd_hash_new( &self->hash );
6933 0 : fd_hash_new( &self->parent_hash );
6934 0 : fd_hard_forks_new( &self->hard_forks );
6935 0 : fd_pubkey_new( &self->collector_id );
6936 0 : fd_fee_calculator_new( &self->fee_calculator );
6937 0 : fd_fee_rate_governor_new( &self->fee_rate_governor );
6938 0 : fd_rent_collector_new( &self->rent_collector );
6939 0 : fd_epoch_schedule_new( &self->epoch_schedule );
6940 0 : fd_inflation_new( &self->inflation );
6941 0 : fd_stakes_serializable_new( &self->stakes );
6942 0 : fd_unused_accounts_new( &self->unused_accounts );
6943 0 : }
6944 0 : void fd_serializable_versioned_bank_destroy( fd_serializable_versioned_bank_t * self, fd_bincode_destroy_ctx_t * ctx ) {
6945 0 : fd_block_hash_vec_destroy( &self->blockhash_queue, ctx );
6946 0 : if( self->ancestors ) {
6947 0 : for( ulong i=0; i < self->ancestors_len; i++ )
6948 0 : fd_slot_pair_destroy( self->ancestors + i, ctx );
6949 0 : fd_valloc_free( ctx->valloc, self->ancestors );
6950 0 : self->ancestors = NULL;
6951 0 : }
6952 0 : fd_hash_destroy( &self->hash, ctx );
6953 0 : fd_hash_destroy( &self->parent_hash, ctx );
6954 0 : fd_hard_forks_destroy( &self->hard_forks, ctx );
6955 0 : if( self->hashes_per_tick ) {
6956 0 : fd_valloc_free( ctx->valloc, self->hashes_per_tick );
6957 0 : self->hashes_per_tick = NULL;
6958 0 : }
6959 0 : fd_pubkey_destroy( &self->collector_id, ctx );
6960 0 : fd_fee_calculator_destroy( &self->fee_calculator, ctx );
6961 0 : fd_fee_rate_governor_destroy( &self->fee_rate_governor, ctx );
6962 0 : fd_rent_collector_destroy( &self->rent_collector, ctx );
6963 0 : fd_epoch_schedule_destroy( &self->epoch_schedule, ctx );
6964 0 : fd_inflation_destroy( &self->inflation, ctx );
6965 0 : fd_stakes_serializable_destroy( &self->stakes, ctx );
6966 0 : fd_unused_accounts_destroy( &self->unused_accounts, ctx );
6967 0 : if( self->epoch_stakes ) {
6968 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
6969 0 : fd_epoch_epoch_stakes_pair_destroy( self->epoch_stakes + i, ctx );
6970 0 : fd_valloc_free( ctx->valloc, self->epoch_stakes );
6971 0 : self->epoch_stakes = NULL;
6972 0 : }
6973 0 : }
6974 :
6975 0 : ulong fd_serializable_versioned_bank_footprint( void ){ return FD_SERIALIZABLE_VERSIONED_BANK_FOOTPRINT; }
6976 0 : ulong fd_serializable_versioned_bank_align( void ){ return FD_SERIALIZABLE_VERSIONED_BANK_ALIGN; }
6977 :
6978 0 : void fd_serializable_versioned_bank_walk( void * w, fd_serializable_versioned_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
6979 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_serializable_versioned_bank", level++ );
6980 0 : fd_block_hash_vec_walk( w, &self->blockhash_queue, fun, "blockhash_queue", level );
6981 0 : if( self->ancestors_len ) {
6982 0 : fun( w, NULL, "ancestors", FD_FLAMENCO_TYPE_ARR, "array", level++ );
6983 0 : for( ulong i=0; i < self->ancestors_len; i++ )
6984 0 : fd_slot_pair_walk(w, self->ancestors + i, fun, "slot_pair", level );
6985 0 : fun( w, NULL, "ancestors", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
6986 0 : }
6987 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
6988 0 : fd_hash_walk( w, &self->parent_hash, fun, "parent_hash", level );
6989 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6990 0 : fd_hard_forks_walk( w, &self->hard_forks, fun, "hard_forks", level );
6991 0 : fun( w, &self->transaction_count, "transaction_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6992 0 : fun( w, &self->tick_height, "tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6993 0 : fun( w, &self->signature_count, "signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6994 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6995 0 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
6996 0 : if( !self->hashes_per_tick ) {
6997 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level );
6998 0 : } else {
6999 0 : fun( w, self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7000 0 : }
7001 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7002 0 : fun( w, &self->ns_per_slot, "ns_per_slot", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
7003 0 : fun( w, &self->genesis_creation_time, "genesis_creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7004 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
7005 0 : fun( w, &self->accounts_data_len, "accounts_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7006 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7007 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7008 0 : fun( w, &self->block_height, "block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7009 0 : fd_pubkey_walk( w, &self->collector_id, fun, "collector_id", level );
7010 0 : fun( w, &self->collector_fees, "collector_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7011 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
7012 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level );
7013 0 : fun( w, &self->collected_rent, "collected_rent", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7014 0 : fd_rent_collector_walk( w, &self->rent_collector, fun, "rent_collector", level );
7015 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
7016 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level );
7017 0 : fd_stakes_serializable_walk( w, &self->stakes, fun, "stakes", level );
7018 0 : fd_unused_accounts_walk( w, &self->unused_accounts, fun, "unused_accounts", level );
7019 0 : if( self->epoch_stakes_len ) {
7020 0 : fun( w, NULL, "epoch_stakes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7021 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
7022 0 : fd_epoch_epoch_stakes_pair_walk(w, self->epoch_stakes + i, fun, "epoch_epoch_stakes_pair", level );
7023 0 : fun( w, NULL, "epoch_stakes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7024 0 : }
7025 0 : fun( w, &self->is_delta, "is_delta", FD_FLAMENCO_TYPE_BOOL, "bool", level );
7026 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_serializable_versioned_bank", level-- );
7027 0 : }
7028 0 : ulong fd_serializable_versioned_bank_size( fd_serializable_versioned_bank_t const * self ) {
7029 0 : ulong size = 0;
7030 0 : size += fd_block_hash_vec_size( &self->blockhash_queue );
7031 0 : do {
7032 0 : size += sizeof(ulong);
7033 0 : for( ulong i=0; i < self->ancestors_len; i++ )
7034 0 : size += fd_slot_pair_size( self->ancestors + i );
7035 0 : } while(0);
7036 0 : size += fd_hash_size( &self->hash );
7037 0 : size += fd_hash_size( &self->parent_hash );
7038 0 : size += sizeof(ulong);
7039 0 : size += fd_hard_forks_size( &self->hard_forks );
7040 0 : size += sizeof(ulong);
7041 0 : size += sizeof(ulong);
7042 0 : size += sizeof(ulong);
7043 0 : size += sizeof(ulong);
7044 0 : size += sizeof(ulong);
7045 0 : size += sizeof(char);
7046 0 : if( NULL != self->hashes_per_tick ) {
7047 0 : size += sizeof(ulong);
7048 0 : }
7049 0 : size += sizeof(ulong);
7050 0 : size += sizeof(uint128);
7051 0 : size += sizeof(ulong);
7052 0 : size += sizeof(double);
7053 0 : size += sizeof(ulong);
7054 0 : size += sizeof(ulong);
7055 0 : size += sizeof(ulong);
7056 0 : size += sizeof(ulong);
7057 0 : size += fd_pubkey_size( &self->collector_id );
7058 0 : size += sizeof(ulong);
7059 0 : size += fd_fee_calculator_size( &self->fee_calculator );
7060 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
7061 0 : size += sizeof(ulong);
7062 0 : size += fd_rent_collector_size( &self->rent_collector );
7063 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
7064 0 : size += fd_inflation_size( &self->inflation );
7065 0 : size += fd_stakes_serializable_size( &self->stakes );
7066 0 : size += fd_unused_accounts_size( &self->unused_accounts );
7067 0 : do {
7068 0 : size += sizeof(ulong);
7069 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
7070 0 : size += fd_epoch_epoch_stakes_pair_size( self->epoch_stakes + i );
7071 0 : } while(0);
7072 0 : size += sizeof(char);
7073 0 : return size;
7074 0 : }
7075 :
7076 0 : int fd_bank_hash_stats_decode( fd_bank_hash_stats_t * self, fd_bincode_decode_ctx_t * ctx ) {
7077 0 : void const * data = ctx->data;
7078 0 : int err = fd_bank_hash_stats_decode_preflight( ctx );
7079 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7080 0 : ctx->data = data;
7081 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
7082 0 : fd_bank_hash_stats_new( self );
7083 0 : }
7084 0 : fd_bank_hash_stats_decode_unsafe( self, ctx );
7085 0 : return FD_BINCODE_SUCCESS;
7086 0 : }
7087 0 : int fd_bank_hash_stats_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
7088 0 : return fd_bincode_bytes_decode_preflight( 40, ctx );
7089 0 : }
7090 6 : void fd_bank_hash_stats_decode_unsafe( fd_bank_hash_stats_t * self, fd_bincode_decode_ctx_t * ctx ) {
7091 6 : fd_bincode_uint64_decode_unsafe( &self->num_updated_accounts, ctx );
7092 6 : fd_bincode_uint64_decode_unsafe( &self->num_removed_accounts, ctx );
7093 6 : fd_bincode_uint64_decode_unsafe( &self->num_lamports_stored, ctx );
7094 6 : fd_bincode_uint64_decode_unsafe( &self->total_data_len, ctx );
7095 6 : fd_bincode_uint64_decode_unsafe( &self->num_executable_accounts, ctx );
7096 6 : }
7097 6 : int fd_bank_hash_stats_encode( fd_bank_hash_stats_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7098 6 : int err;
7099 6 : err = fd_bincode_uint64_encode( self->num_updated_accounts, ctx );
7100 6 : if( FD_UNLIKELY( err ) ) return err;
7101 6 : err = fd_bincode_uint64_encode( self->num_removed_accounts, ctx );
7102 6 : if( FD_UNLIKELY( err ) ) return err;
7103 6 : err = fd_bincode_uint64_encode( self->num_lamports_stored, ctx );
7104 6 : if( FD_UNLIKELY( err ) ) return err;
7105 6 : err = fd_bincode_uint64_encode( self->total_data_len, ctx );
7106 6 : if( FD_UNLIKELY( err ) ) return err;
7107 6 : err = fd_bincode_uint64_encode( self->num_executable_accounts, ctx );
7108 6 : if( FD_UNLIKELY( err ) ) return err;
7109 6 : return FD_BINCODE_SUCCESS;
7110 6 : }
7111 0 : int fd_bank_hash_stats_decode_offsets( fd_bank_hash_stats_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
7112 0 : uchar const * data = ctx->data;
7113 0 : int err;
7114 0 : self->num_updated_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
7115 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7116 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7117 0 : self->num_removed_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
7118 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7119 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7120 0 : self->num_lamports_stored_off = (uint)( (ulong)ctx->data - (ulong)data );
7121 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7122 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7123 0 : self->total_data_len_off = (uint)( (ulong)ctx->data - (ulong)data );
7124 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7125 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7126 0 : self->num_executable_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
7127 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7128 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7129 0 : return FD_BINCODE_SUCCESS;
7130 0 : }
7131 6 : void fd_bank_hash_stats_new(fd_bank_hash_stats_t * self) {
7132 6 : fd_memset( self, 0, sizeof(fd_bank_hash_stats_t) );
7133 6 : }
7134 6 : void fd_bank_hash_stats_destroy( fd_bank_hash_stats_t * self, fd_bincode_destroy_ctx_t * ctx ) {
7135 6 : }
7136 :
7137 0 : ulong fd_bank_hash_stats_footprint( void ){ return FD_BANK_HASH_STATS_FOOTPRINT; }
7138 0 : ulong fd_bank_hash_stats_align( void ){ return FD_BANK_HASH_STATS_ALIGN; }
7139 :
7140 0 : void fd_bank_hash_stats_walk( void * w, fd_bank_hash_stats_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7141 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_hash_stats", level++ );
7142 0 : fun( w, &self->num_updated_accounts, "num_updated_accounts", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7143 0 : fun( w, &self->num_removed_accounts, "num_removed_accounts", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7144 0 : fun( w, &self->num_lamports_stored, "num_lamports_stored", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7145 0 : fun( w, &self->total_data_len, "total_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7146 0 : fun( w, &self->num_executable_accounts, "num_executable_accounts", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7147 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_hash_stats", level-- );
7148 0 : }
7149 6 : ulong fd_bank_hash_stats_size( fd_bank_hash_stats_t const * self ) {
7150 6 : ulong size = 0;
7151 6 : size += sizeof(ulong);
7152 6 : size += sizeof(ulong);
7153 6 : size += sizeof(ulong);
7154 6 : size += sizeof(ulong);
7155 6 : size += sizeof(ulong);
7156 6 : return size;
7157 6 : }
7158 :
7159 0 : int fd_bank_hash_info_decode( fd_bank_hash_info_t * self, fd_bincode_decode_ctx_t * ctx ) {
7160 0 : void const * data = ctx->data;
7161 0 : int err = fd_bank_hash_info_decode_preflight( ctx );
7162 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7163 0 : ctx->data = data;
7164 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
7165 0 : fd_bank_hash_info_new( self );
7166 0 : }
7167 0 : fd_bank_hash_info_decode_unsafe( self, ctx );
7168 0 : return FD_BINCODE_SUCCESS;
7169 0 : }
7170 6 : int fd_bank_hash_info_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
7171 6 : return fd_bincode_bytes_decode_preflight( 104, ctx );
7172 6 : }
7173 6 : void fd_bank_hash_info_decode_unsafe( fd_bank_hash_info_t * self, fd_bincode_decode_ctx_t * ctx ) {
7174 6 : fd_hash_decode_unsafe( &self->accounts_delta_hash, ctx );
7175 6 : fd_hash_decode_unsafe( &self->accounts_hash, ctx );
7176 6 : fd_bank_hash_stats_decode_unsafe( &self->stats, ctx );
7177 6 : }
7178 6 : int fd_bank_hash_info_encode( fd_bank_hash_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7179 6 : int err;
7180 6 : err = fd_hash_encode( &self->accounts_delta_hash, ctx );
7181 6 : if( FD_UNLIKELY( err ) ) return err;
7182 6 : err = fd_hash_encode( &self->accounts_hash, ctx );
7183 6 : if( FD_UNLIKELY( err ) ) return err;
7184 6 : err = fd_bank_hash_stats_encode( &self->stats, ctx );
7185 6 : if( FD_UNLIKELY( err ) ) return err;
7186 6 : return FD_BINCODE_SUCCESS;
7187 6 : }
7188 0 : int fd_bank_hash_info_decode_offsets( fd_bank_hash_info_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
7189 0 : uchar const * data = ctx->data;
7190 0 : int err;
7191 0 : self->accounts_delta_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
7192 0 : err = fd_hash_decode_preflight( ctx );
7193 0 : if( FD_UNLIKELY( err ) ) return err;
7194 0 : self->accounts_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
7195 0 : err = fd_hash_decode_preflight( ctx );
7196 0 : if( FD_UNLIKELY( err ) ) return err;
7197 0 : self->stats_off = (uint)( (ulong)ctx->data - (ulong)data );
7198 0 : err = fd_bank_hash_stats_decode_preflight( ctx );
7199 0 : if( FD_UNLIKELY( err ) ) return err;
7200 0 : return FD_BINCODE_SUCCESS;
7201 0 : }
7202 6 : void fd_bank_hash_info_new(fd_bank_hash_info_t * self) {
7203 6 : fd_memset( self, 0, sizeof(fd_bank_hash_info_t) );
7204 6 : fd_hash_new( &self->accounts_delta_hash );
7205 6 : fd_hash_new( &self->accounts_hash );
7206 6 : fd_bank_hash_stats_new( &self->stats );
7207 6 : }
7208 6 : void fd_bank_hash_info_destroy( fd_bank_hash_info_t * self, fd_bincode_destroy_ctx_t * ctx ) {
7209 6 : fd_hash_destroy( &self->accounts_delta_hash, ctx );
7210 6 : fd_hash_destroy( &self->accounts_hash, ctx );
7211 6 : fd_bank_hash_stats_destroy( &self->stats, ctx );
7212 6 : }
7213 :
7214 0 : ulong fd_bank_hash_info_footprint( void ){ return FD_BANK_HASH_INFO_FOOTPRINT; }
7215 0 : ulong fd_bank_hash_info_align( void ){ return FD_BANK_HASH_INFO_ALIGN; }
7216 :
7217 0 : void fd_bank_hash_info_walk( void * w, fd_bank_hash_info_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7218 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_hash_info", level++ );
7219 0 : fd_hash_walk( w, &self->accounts_delta_hash, fun, "accounts_delta_hash", level );
7220 0 : fd_hash_walk( w, &self->accounts_hash, fun, "accounts_hash", level );
7221 0 : fd_bank_hash_stats_walk( w, &self->stats, fun, "stats", level );
7222 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_hash_info", level-- );
7223 0 : }
7224 6 : ulong fd_bank_hash_info_size( fd_bank_hash_info_t const * self ) {
7225 6 : ulong size = 0;
7226 6 : size += fd_hash_size( &self->accounts_delta_hash );
7227 6 : size += fd_hash_size( &self->accounts_hash );
7228 6 : size += fd_bank_hash_stats_size( &self->stats );
7229 6 : return size;
7230 6 : }
7231 :
7232 0 : int fd_slot_map_pair_decode( fd_slot_map_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
7233 0 : void const * data = ctx->data;
7234 0 : int err = fd_slot_map_pair_decode_preflight( ctx );
7235 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7236 0 : ctx->data = data;
7237 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
7238 0 : fd_slot_map_pair_new( self );
7239 0 : }
7240 0 : fd_slot_map_pair_decode_unsafe( self, ctx );
7241 0 : return FD_BINCODE_SUCCESS;
7242 0 : }
7243 0 : int fd_slot_map_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
7244 0 : return fd_bincode_bytes_decode_preflight( 40, ctx );
7245 0 : }
7246 0 : void fd_slot_map_pair_decode_unsafe( fd_slot_map_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
7247 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7248 0 : fd_hash_decode_unsafe( &self->hash, ctx );
7249 0 : }
7250 0 : int fd_slot_map_pair_encode( fd_slot_map_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7251 0 : int err;
7252 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
7253 0 : if( FD_UNLIKELY( err ) ) return err;
7254 0 : err = fd_hash_encode( &self->hash, ctx );
7255 0 : if( FD_UNLIKELY( err ) ) return err;
7256 0 : return FD_BINCODE_SUCCESS;
7257 0 : }
7258 0 : int fd_slot_map_pair_decode_offsets( fd_slot_map_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
7259 0 : uchar const * data = ctx->data;
7260 0 : int err;
7261 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
7262 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7263 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7264 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
7265 0 : err = fd_hash_decode_preflight( ctx );
7266 0 : if( FD_UNLIKELY( err ) ) return err;
7267 0 : return FD_BINCODE_SUCCESS;
7268 0 : }
7269 0 : void fd_slot_map_pair_new(fd_slot_map_pair_t * self) {
7270 0 : fd_memset( self, 0, sizeof(fd_slot_map_pair_t) );
7271 0 : fd_hash_new( &self->hash );
7272 0 : }
7273 0 : void fd_slot_map_pair_destroy( fd_slot_map_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
7274 0 : fd_hash_destroy( &self->hash, ctx );
7275 0 : }
7276 :
7277 0 : ulong fd_slot_map_pair_footprint( void ){ return FD_SLOT_MAP_PAIR_FOOTPRINT; }
7278 0 : ulong fd_slot_map_pair_align( void ){ return FD_SLOT_MAP_PAIR_ALIGN; }
7279 :
7280 0 : void fd_slot_map_pair_walk( void * w, fd_slot_map_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7281 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_map_pair", level++ );
7282 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7283 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
7284 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_map_pair", level-- );
7285 0 : }
7286 0 : ulong fd_slot_map_pair_size( fd_slot_map_pair_t const * self ) {
7287 0 : ulong size = 0;
7288 0 : size += sizeof(ulong);
7289 0 : size += fd_hash_size( &self->hash );
7290 0 : return size;
7291 0 : }
7292 :
7293 0 : int fd_snapshot_acc_vec_decode( fd_snapshot_acc_vec_t * self, fd_bincode_decode_ctx_t * ctx ) {
7294 0 : void const * data = ctx->data;
7295 0 : int err = fd_snapshot_acc_vec_decode_preflight( ctx );
7296 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7297 0 : ctx->data = data;
7298 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
7299 0 : fd_snapshot_acc_vec_new( self );
7300 0 : }
7301 0 : fd_snapshot_acc_vec_decode_unsafe( self, ctx );
7302 0 : return FD_BINCODE_SUCCESS;
7303 0 : }
7304 0 : int fd_snapshot_acc_vec_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
7305 0 : return fd_bincode_bytes_decode_preflight( 16, ctx );
7306 0 : }
7307 0 : void fd_snapshot_acc_vec_decode_unsafe( fd_snapshot_acc_vec_t * self, fd_bincode_decode_ctx_t * ctx ) {
7308 0 : fd_bincode_uint64_decode_unsafe( &self->id, ctx );
7309 0 : fd_bincode_uint64_decode_unsafe( &self->file_sz, ctx );
7310 0 : }
7311 0 : int fd_snapshot_acc_vec_encode( fd_snapshot_acc_vec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7312 0 : int err;
7313 0 : err = fd_bincode_uint64_encode( self->id, ctx );
7314 0 : if( FD_UNLIKELY( err ) ) return err;
7315 0 : err = fd_bincode_uint64_encode( self->file_sz, ctx );
7316 0 : if( FD_UNLIKELY( err ) ) return err;
7317 0 : return FD_BINCODE_SUCCESS;
7318 0 : }
7319 0 : int fd_snapshot_acc_vec_decode_offsets( fd_snapshot_acc_vec_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
7320 0 : uchar const * data = ctx->data;
7321 0 : int err;
7322 0 : self->id_off = (uint)( (ulong)ctx->data - (ulong)data );
7323 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7324 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7325 0 : self->file_sz_off = (uint)( (ulong)ctx->data - (ulong)data );
7326 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7327 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7328 0 : return FD_BINCODE_SUCCESS;
7329 0 : }
7330 0 : void fd_snapshot_acc_vec_new(fd_snapshot_acc_vec_t * self) {
7331 0 : fd_memset( self, 0, sizeof(fd_snapshot_acc_vec_t) );
7332 0 : }
7333 0 : void fd_snapshot_acc_vec_destroy( fd_snapshot_acc_vec_t * self, fd_bincode_destroy_ctx_t * ctx ) {
7334 0 : }
7335 :
7336 0 : ulong fd_snapshot_acc_vec_footprint( void ){ return FD_SNAPSHOT_ACC_VEC_FOOTPRINT; }
7337 0 : ulong fd_snapshot_acc_vec_align( void ){ return FD_SNAPSHOT_ACC_VEC_ALIGN; }
7338 :
7339 0 : void fd_snapshot_acc_vec_walk( void * w, fd_snapshot_acc_vec_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7340 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_snapshot_acc_vec", level++ );
7341 0 : fun( w, &self->id, "id", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7342 0 : fun( w, &self->file_sz, "file_sz", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7343 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_snapshot_acc_vec", level-- );
7344 0 : }
7345 0 : ulong fd_snapshot_acc_vec_size( fd_snapshot_acc_vec_t const * self ) {
7346 0 : ulong size = 0;
7347 0 : size += sizeof(ulong);
7348 0 : size += sizeof(ulong);
7349 0 : return size;
7350 0 : }
7351 :
7352 0 : int fd_snapshot_slot_acc_vecs_decode( fd_snapshot_slot_acc_vecs_t * self, fd_bincode_decode_ctx_t * ctx ) {
7353 0 : void const * data = ctx->data;
7354 0 : int err = fd_snapshot_slot_acc_vecs_decode_preflight( ctx );
7355 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7356 0 : ctx->data = data;
7357 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
7358 0 : fd_snapshot_slot_acc_vecs_new( self );
7359 0 : }
7360 0 : fd_snapshot_slot_acc_vecs_decode_unsafe( self, ctx );
7361 0 : return FD_BINCODE_SUCCESS;
7362 0 : }
7363 0 : int fd_snapshot_slot_acc_vecs_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
7364 0 : int err;
7365 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7366 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7367 0 : ulong account_vecs_len;
7368 0 : err = fd_bincode_uint64_decode( &account_vecs_len, ctx );
7369 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7370 0 : if( account_vecs_len ) {
7371 0 : for( ulong i=0; i < account_vecs_len; i++ ) {
7372 0 : err = fd_snapshot_acc_vec_decode_preflight( ctx );
7373 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7374 0 : }
7375 0 : }
7376 0 : return FD_BINCODE_SUCCESS;
7377 0 : }
7378 0 : void fd_snapshot_slot_acc_vecs_decode_unsafe( fd_snapshot_slot_acc_vecs_t * self, fd_bincode_decode_ctx_t * ctx ) {
7379 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7380 0 : fd_bincode_uint64_decode_unsafe( &self->account_vecs_len, ctx );
7381 0 : if( self->account_vecs_len ) {
7382 0 : self->account_vecs = (fd_snapshot_acc_vec_t *)fd_valloc_malloc( ctx->valloc, FD_SNAPSHOT_ACC_VEC_ALIGN, FD_SNAPSHOT_ACC_VEC_FOOTPRINT*self->account_vecs_len );
7383 0 : for( ulong i=0; i < self->account_vecs_len; i++ ) {
7384 0 : fd_snapshot_acc_vec_new( self->account_vecs + i );
7385 0 : fd_snapshot_acc_vec_decode_unsafe( self->account_vecs + i, ctx );
7386 0 : }
7387 0 : } else
7388 0 : self->account_vecs = NULL;
7389 0 : }
7390 0 : int fd_snapshot_slot_acc_vecs_encode( fd_snapshot_slot_acc_vecs_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7391 0 : int err;
7392 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
7393 0 : if( FD_UNLIKELY( err ) ) return err;
7394 0 : err = fd_bincode_uint64_encode( self->account_vecs_len, ctx );
7395 0 : if( FD_UNLIKELY(err) ) return err;
7396 0 : if( self->account_vecs_len ) {
7397 0 : for( ulong i=0; i < self->account_vecs_len; i++ ) {
7398 0 : err = fd_snapshot_acc_vec_encode( self->account_vecs + i, ctx );
7399 0 : if( FD_UNLIKELY( err ) ) return err;
7400 0 : }
7401 0 : }
7402 0 : return FD_BINCODE_SUCCESS;
7403 0 : }
7404 0 : int fd_snapshot_slot_acc_vecs_decode_offsets( fd_snapshot_slot_acc_vecs_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
7405 0 : uchar const * data = ctx->data;
7406 0 : int err;
7407 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
7408 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7409 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7410 0 : self->account_vecs_off = (uint)( (ulong)ctx->data - (ulong)data );
7411 0 : ulong account_vecs_len;
7412 0 : err = fd_bincode_uint64_decode( &account_vecs_len, ctx );
7413 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7414 0 : if( account_vecs_len ) {
7415 0 : for( ulong i=0; i < account_vecs_len; i++ ) {
7416 0 : err = fd_snapshot_acc_vec_decode_preflight( ctx );
7417 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7418 0 : }
7419 0 : }
7420 0 : return FD_BINCODE_SUCCESS;
7421 0 : }
7422 0 : void fd_snapshot_slot_acc_vecs_new(fd_snapshot_slot_acc_vecs_t * self) {
7423 0 : fd_memset( self, 0, sizeof(fd_snapshot_slot_acc_vecs_t) );
7424 0 : }
7425 0 : void fd_snapshot_slot_acc_vecs_destroy( fd_snapshot_slot_acc_vecs_t * self, fd_bincode_destroy_ctx_t * ctx ) {
7426 0 : if( self->account_vecs ) {
7427 0 : for( ulong i=0; i < self->account_vecs_len; i++ )
7428 0 : fd_snapshot_acc_vec_destroy( self->account_vecs + i, ctx );
7429 0 : fd_valloc_free( ctx->valloc, self->account_vecs );
7430 0 : self->account_vecs = NULL;
7431 0 : }
7432 0 : }
7433 :
7434 0 : ulong fd_snapshot_slot_acc_vecs_footprint( void ){ return FD_SNAPSHOT_SLOT_ACC_VECS_FOOTPRINT; }
7435 0 : ulong fd_snapshot_slot_acc_vecs_align( void ){ return FD_SNAPSHOT_SLOT_ACC_VECS_ALIGN; }
7436 :
7437 0 : void fd_snapshot_slot_acc_vecs_walk( void * w, fd_snapshot_slot_acc_vecs_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7438 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_snapshot_slot_acc_vecs", level++ );
7439 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7440 0 : if( self->account_vecs_len ) {
7441 0 : fun( w, NULL, "account_vecs", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7442 0 : for( ulong i=0; i < self->account_vecs_len; i++ )
7443 0 : fd_snapshot_acc_vec_walk(w, self->account_vecs + i, fun, "snapshot_acc_vec", level );
7444 0 : fun( w, NULL, "account_vecs", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7445 0 : }
7446 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_snapshot_slot_acc_vecs", level-- );
7447 0 : }
7448 0 : ulong fd_snapshot_slot_acc_vecs_size( fd_snapshot_slot_acc_vecs_t const * self ) {
7449 0 : ulong size = 0;
7450 0 : size += sizeof(ulong);
7451 0 : do {
7452 0 : size += sizeof(ulong);
7453 0 : for( ulong i=0; i < self->account_vecs_len; i++ )
7454 0 : size += fd_snapshot_acc_vec_size( self->account_vecs + i );
7455 0 : } while(0);
7456 0 : return size;
7457 0 : }
7458 :
7459 0 : FD_FN_PURE uchar fd_reward_type_is_fee(fd_reward_type_t const * self) {
7460 0 : return self->discriminant == 0;
7461 0 : }
7462 0 : FD_FN_PURE uchar fd_reward_type_is_rent(fd_reward_type_t const * self) {
7463 0 : return self->discriminant == 1;
7464 0 : }
7465 0 : FD_FN_PURE uchar fd_reward_type_is_staking(fd_reward_type_t const * self) {
7466 0 : return self->discriminant == 2;
7467 0 : }
7468 0 : FD_FN_PURE uchar fd_reward_type_is_voting(fd_reward_type_t const * self) {
7469 0 : return self->discriminant == 3;
7470 0 : }
7471 : void fd_reward_type_inner_new( fd_reward_type_inner_t * self, uint discriminant );
7472 0 : int fd_reward_type_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
7473 0 : int err;
7474 0 : switch (discriminant) {
7475 0 : case 0: {
7476 0 : return FD_BINCODE_SUCCESS;
7477 0 : }
7478 0 : case 1: {
7479 0 : return FD_BINCODE_SUCCESS;
7480 0 : }
7481 0 : case 2: {
7482 0 : return FD_BINCODE_SUCCESS;
7483 0 : }
7484 0 : case 3: {
7485 0 : return FD_BINCODE_SUCCESS;
7486 0 : }
7487 0 : default: return FD_BINCODE_ERR_ENCODING;
7488 0 : }
7489 0 : }
7490 0 : void fd_reward_type_inner_decode_unsafe( fd_reward_type_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
7491 0 : switch (discriminant) {
7492 0 : case 0: {
7493 0 : break;
7494 0 : }
7495 0 : case 1: {
7496 0 : break;
7497 0 : }
7498 0 : case 2: {
7499 0 : break;
7500 0 : }
7501 0 : case 3: {
7502 0 : break;
7503 0 : }
7504 0 : }
7505 0 : }
7506 0 : int fd_reward_type_decode( fd_reward_type_t * self, fd_bincode_decode_ctx_t * ctx ) {
7507 0 : void const * data = ctx->data;
7508 0 : int err = fd_reward_type_decode_preflight( ctx );
7509 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7510 0 : ctx->data = data;
7511 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
7512 0 : fd_reward_type_new( self );
7513 0 : }
7514 0 : fd_reward_type_decode_unsafe( self, ctx );
7515 0 : return FD_BINCODE_SUCCESS;
7516 0 : }
7517 0 : int fd_reward_type_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
7518 0 : uint discriminant = 0;
7519 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7520 0 : if( FD_UNLIKELY( err ) ) return err;
7521 0 : return fd_reward_type_inner_decode_preflight( discriminant, ctx );
7522 0 : }
7523 0 : void fd_reward_type_decode_unsafe( fd_reward_type_t * self, fd_bincode_decode_ctx_t * ctx ) {
7524 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7525 0 : fd_reward_type_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
7526 0 : }
7527 0 : void fd_reward_type_inner_new( fd_reward_type_inner_t * self, uint discriminant ) {
7528 0 : switch( discriminant ) {
7529 0 : case 0: {
7530 0 : break;
7531 0 : }
7532 0 : case 1: {
7533 0 : break;
7534 0 : }
7535 0 : case 2: {
7536 0 : break;
7537 0 : }
7538 0 : case 3: {
7539 0 : break;
7540 0 : }
7541 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7542 0 : }
7543 0 : }
7544 0 : void fd_reward_type_new_disc( fd_reward_type_t * self, uint discriminant ) {
7545 0 : self->discriminant = discriminant;
7546 0 : fd_reward_type_inner_new( &self->inner, self->discriminant );
7547 0 : }
7548 0 : void fd_reward_type_new( fd_reward_type_t * self ) {
7549 0 : fd_memset( self, 0, sizeof(fd_reward_type_t) );
7550 0 : fd_reward_type_new_disc( self, UINT_MAX );
7551 0 : }
7552 0 : void fd_reward_type_inner_destroy( fd_reward_type_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
7553 0 : switch( discriminant ) {
7554 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
7555 0 : }
7556 0 : }
7557 0 : void fd_reward_type_destroy( fd_reward_type_t * self, fd_bincode_destroy_ctx_t * ctx ) {
7558 0 : fd_reward_type_inner_destroy( &self->inner, self->discriminant, ctx );
7559 0 : }
7560 :
7561 0 : ulong fd_reward_type_footprint( void ){ return FD_REWARD_TYPE_FOOTPRINT; }
7562 0 : ulong fd_reward_type_align( void ){ return FD_REWARD_TYPE_ALIGN; }
7563 :
7564 0 : void fd_reward_type_walk( void * w, fd_reward_type_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7565 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_reward_type", level++);
7566 0 : switch( self->discriminant ) {
7567 0 : case 0: {
7568 0 : fun( w, self, "fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
7569 0 : break;
7570 0 : }
7571 0 : case 1: {
7572 0 : fun( w, self, "rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
7573 0 : break;
7574 0 : }
7575 0 : case 2: {
7576 0 : fun( w, self, "staking", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
7577 0 : break;
7578 0 : }
7579 0 : case 3: {
7580 0 : fun( w, self, "voting", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
7581 0 : break;
7582 0 : }
7583 0 : }
7584 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_reward_type", level-- );
7585 0 : }
7586 0 : ulong fd_reward_type_size( fd_reward_type_t const * self ) {
7587 0 : ulong size = 0;
7588 0 : size += sizeof(uint);
7589 0 : switch (self->discriminant) {
7590 0 : }
7591 0 : return size;
7592 0 : }
7593 :
7594 0 : int fd_reward_type_inner_encode( fd_reward_type_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7595 0 : return FD_BINCODE_SUCCESS;
7596 0 : }
7597 0 : int fd_reward_type_encode( fd_reward_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7598 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7599 0 : if( FD_UNLIKELY( err ) ) return err;
7600 0 : return fd_reward_type_inner_encode( &self->inner, self->discriminant, ctx );
7601 0 : }
7602 :
7603 0 : int fd_solana_accounts_db_fields_decode( fd_solana_accounts_db_fields_t * self, fd_bincode_decode_ctx_t * ctx ) {
7604 0 : void const * data = ctx->data;
7605 0 : int err = fd_solana_accounts_db_fields_decode_preflight( ctx );
7606 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7607 0 : ctx->data = data;
7608 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
7609 0 : fd_solana_accounts_db_fields_new( self );
7610 0 : }
7611 0 : fd_solana_accounts_db_fields_decode_unsafe( self, ctx );
7612 0 : return FD_BINCODE_SUCCESS;
7613 0 : }
7614 6 : int fd_solana_accounts_db_fields_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
7615 6 : int err;
7616 6 : ulong storages_len;
7617 6 : err = fd_bincode_uint64_decode( &storages_len, ctx );
7618 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7619 6 : if( storages_len ) {
7620 0 : for( ulong i=0; i < storages_len; i++ ) {
7621 0 : err = fd_snapshot_slot_acc_vecs_decode_preflight( ctx );
7622 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7623 0 : }
7624 0 : }
7625 6 : err = fd_bincode_uint64_decode_preflight( ctx );
7626 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7627 6 : err = fd_bincode_uint64_decode_preflight( ctx );
7628 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7629 6 : err = fd_bank_hash_info_decode_preflight( ctx );
7630 6 : if( FD_UNLIKELY( err ) ) return err;
7631 6 : ulong historical_roots_len;
7632 6 : err = fd_bincode_uint64_decode( &historical_roots_len, ctx );
7633 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7634 6 : if( historical_roots_len ) {
7635 0 : for( ulong i=0; i < historical_roots_len; i++ ) {
7636 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7637 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7638 0 : }
7639 0 : }
7640 6 : ulong historical_roots_with_hash_len;
7641 6 : err = fd_bincode_uint64_decode( &historical_roots_with_hash_len, ctx );
7642 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7643 6 : if( historical_roots_with_hash_len ) {
7644 0 : for( ulong i=0; i < historical_roots_with_hash_len; i++ ) {
7645 0 : err = fd_slot_map_pair_decode_preflight( ctx );
7646 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7647 0 : }
7648 0 : }
7649 6 : return FD_BINCODE_SUCCESS;
7650 6 : }
7651 6 : void fd_solana_accounts_db_fields_decode_unsafe( fd_solana_accounts_db_fields_t * self, fd_bincode_decode_ctx_t * ctx ) {
7652 6 : fd_bincode_uint64_decode_unsafe( &self->storages_len, ctx );
7653 6 : if( self->storages_len ) {
7654 0 : self->storages = (fd_snapshot_slot_acc_vecs_t *)fd_valloc_malloc( ctx->valloc, FD_SNAPSHOT_SLOT_ACC_VECS_ALIGN, FD_SNAPSHOT_SLOT_ACC_VECS_FOOTPRINT*self->storages_len );
7655 0 : for( ulong i=0; i < self->storages_len; i++ ) {
7656 0 : fd_snapshot_slot_acc_vecs_new( self->storages + i );
7657 0 : fd_snapshot_slot_acc_vecs_decode_unsafe( self->storages + i, ctx );
7658 0 : }
7659 0 : } else
7660 6 : self->storages = NULL;
7661 6 : fd_bincode_uint64_decode_unsafe( &self->version, ctx );
7662 6 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7663 6 : fd_bank_hash_info_decode_unsafe( &self->bank_hash_info, ctx );
7664 6 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_len, ctx );
7665 6 : if( self->historical_roots_len ) {
7666 0 : self->historical_roots = fd_valloc_malloc( ctx->valloc, 8UL, sizeof(ulong)*self->historical_roots_len );
7667 0 : for( ulong i=0; i < self->historical_roots_len; i++ ) {
7668 0 : fd_bincode_uint64_decode_unsafe( self->historical_roots + i, ctx );
7669 0 : }
7670 0 : } else
7671 6 : self->historical_roots = NULL;
7672 6 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_with_hash_len, ctx );
7673 6 : if( self->historical_roots_with_hash_len ) {
7674 0 : self->historical_roots_with_hash = (fd_slot_map_pair_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_MAP_PAIR_ALIGN, FD_SLOT_MAP_PAIR_FOOTPRINT*self->historical_roots_with_hash_len );
7675 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ ) {
7676 0 : fd_slot_map_pair_new( self->historical_roots_with_hash + i );
7677 0 : fd_slot_map_pair_decode_unsafe( self->historical_roots_with_hash + i, ctx );
7678 0 : }
7679 0 : } else
7680 6 : self->historical_roots_with_hash = NULL;
7681 6 : }
7682 6 : int fd_solana_accounts_db_fields_encode( fd_solana_accounts_db_fields_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7683 6 : int err;
7684 6 : err = fd_bincode_uint64_encode( self->storages_len, ctx );
7685 6 : if( FD_UNLIKELY(err) ) return err;
7686 6 : if( self->storages_len ) {
7687 0 : for( ulong i=0; i < self->storages_len; i++ ) {
7688 0 : err = fd_snapshot_slot_acc_vecs_encode( self->storages + i, ctx );
7689 0 : if( FD_UNLIKELY( err ) ) return err;
7690 0 : }
7691 0 : }
7692 6 : err = fd_bincode_uint64_encode( self->version, ctx );
7693 6 : if( FD_UNLIKELY( err ) ) return err;
7694 6 : err = fd_bincode_uint64_encode( self->slot, ctx );
7695 6 : if( FD_UNLIKELY( err ) ) return err;
7696 6 : err = fd_bank_hash_info_encode( &self->bank_hash_info, ctx );
7697 6 : if( FD_UNLIKELY( err ) ) return err;
7698 6 : err = fd_bincode_uint64_encode( self->historical_roots_len, ctx );
7699 6 : if( FD_UNLIKELY(err) ) return err;
7700 6 : if( self->historical_roots_len ) {
7701 0 : for( ulong i=0; i < self->historical_roots_len; i++ ) {
7702 0 : err = fd_bincode_uint64_encode( self->historical_roots[i], ctx );
7703 0 : }
7704 0 : }
7705 6 : err = fd_bincode_uint64_encode( self->historical_roots_with_hash_len, ctx );
7706 6 : if( FD_UNLIKELY(err) ) return err;
7707 6 : if( self->historical_roots_with_hash_len ) {
7708 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ ) {
7709 0 : err = fd_slot_map_pair_encode( self->historical_roots_with_hash + i, ctx );
7710 0 : if( FD_UNLIKELY( err ) ) return err;
7711 0 : }
7712 0 : }
7713 6 : return FD_BINCODE_SUCCESS;
7714 6 : }
7715 0 : int fd_solana_accounts_db_fields_decode_offsets( fd_solana_accounts_db_fields_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
7716 0 : uchar const * data = ctx->data;
7717 0 : int err;
7718 0 : self->storages_off = (uint)( (ulong)ctx->data - (ulong)data );
7719 0 : ulong storages_len;
7720 0 : err = fd_bincode_uint64_decode( &storages_len, ctx );
7721 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7722 0 : if( storages_len ) {
7723 0 : for( ulong i=0; i < storages_len; i++ ) {
7724 0 : err = fd_snapshot_slot_acc_vecs_decode_preflight( ctx );
7725 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7726 0 : }
7727 0 : }
7728 0 : self->version_off = (uint)( (ulong)ctx->data - (ulong)data );
7729 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7730 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7731 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
7732 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7733 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7734 0 : self->bank_hash_info_off = (uint)( (ulong)ctx->data - (ulong)data );
7735 0 : err = fd_bank_hash_info_decode_preflight( ctx );
7736 0 : if( FD_UNLIKELY( err ) ) return err;
7737 0 : self->historical_roots_off = (uint)( (ulong)ctx->data - (ulong)data );
7738 0 : ulong historical_roots_len;
7739 0 : err = fd_bincode_uint64_decode( &historical_roots_len, ctx );
7740 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7741 0 : if( historical_roots_len ) {
7742 0 : for( ulong i=0; i < historical_roots_len; i++ ) {
7743 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7744 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7745 0 : }
7746 0 : }
7747 0 : self->historical_roots_with_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
7748 0 : ulong historical_roots_with_hash_len;
7749 0 : err = fd_bincode_uint64_decode( &historical_roots_with_hash_len, ctx );
7750 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7751 0 : if( historical_roots_with_hash_len ) {
7752 0 : for( ulong i=0; i < historical_roots_with_hash_len; i++ ) {
7753 0 : err = fd_slot_map_pair_decode_preflight( ctx );
7754 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7755 0 : }
7756 0 : }
7757 0 : return FD_BINCODE_SUCCESS;
7758 0 : }
7759 6 : void fd_solana_accounts_db_fields_new(fd_solana_accounts_db_fields_t * self) {
7760 6 : fd_memset( self, 0, sizeof(fd_solana_accounts_db_fields_t) );
7761 6 : fd_bank_hash_info_new( &self->bank_hash_info );
7762 6 : }
7763 6 : void fd_solana_accounts_db_fields_destroy( fd_solana_accounts_db_fields_t * self, fd_bincode_destroy_ctx_t * ctx ) {
7764 6 : if( self->storages ) {
7765 0 : for( ulong i=0; i < self->storages_len; i++ )
7766 0 : fd_snapshot_slot_acc_vecs_destroy( self->storages + i, ctx );
7767 0 : fd_valloc_free( ctx->valloc, self->storages );
7768 0 : self->storages = NULL;
7769 0 : }
7770 6 : fd_bank_hash_info_destroy( &self->bank_hash_info, ctx );
7771 6 : if( self->historical_roots ) {
7772 0 : fd_valloc_free( ctx->valloc, self->historical_roots );
7773 0 : self->historical_roots = NULL;
7774 0 : }
7775 6 : if( self->historical_roots_with_hash ) {
7776 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ )
7777 0 : fd_slot_map_pair_destroy( self->historical_roots_with_hash + i, ctx );
7778 0 : fd_valloc_free( ctx->valloc, self->historical_roots_with_hash );
7779 0 : self->historical_roots_with_hash = NULL;
7780 0 : }
7781 6 : }
7782 :
7783 0 : ulong fd_solana_accounts_db_fields_footprint( void ){ return FD_SOLANA_ACCOUNTS_DB_FIELDS_FOOTPRINT; }
7784 0 : ulong fd_solana_accounts_db_fields_align( void ){ return FD_SOLANA_ACCOUNTS_DB_FIELDS_ALIGN; }
7785 :
7786 0 : void fd_solana_accounts_db_fields_walk( void * w, fd_solana_accounts_db_fields_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7787 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_accounts_db_fields", level++ );
7788 0 : if( self->storages_len ) {
7789 0 : fun( w, NULL, "storages", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7790 0 : for( ulong i=0; i < self->storages_len; i++ )
7791 0 : fd_snapshot_slot_acc_vecs_walk(w, self->storages + i, fun, "snapshot_slot_acc_vecs", level );
7792 0 : fun( w, NULL, "storages", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7793 0 : }
7794 0 : fun( w, &self->version, "version", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7795 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7796 0 : fd_bank_hash_info_walk( w, &self->bank_hash_info, fun, "bank_hash_info", level );
7797 0 : if( self->historical_roots_len ) {
7798 0 : fun( w, NULL, "historical_roots", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7799 0 : for( ulong i=0; i < self->historical_roots_len; i++ )
7800 0 : fun( w, self->historical_roots + i, "historical_roots", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7801 0 : fun( w, NULL, "historical_roots", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7802 0 : }
7803 0 : if( self->historical_roots_with_hash_len ) {
7804 0 : fun( w, NULL, "historical_roots_with_hash", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7805 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ )
7806 0 : fd_slot_map_pair_walk(w, self->historical_roots_with_hash + i, fun, "slot_map_pair", level );
7807 0 : fun( w, NULL, "historical_roots_with_hash", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7808 0 : }
7809 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_accounts_db_fields", level-- );
7810 0 : }
7811 6 : ulong fd_solana_accounts_db_fields_size( fd_solana_accounts_db_fields_t const * self ) {
7812 6 : ulong size = 0;
7813 6 : do {
7814 6 : size += sizeof(ulong);
7815 6 : for( ulong i=0; i < self->storages_len; i++ )
7816 0 : size += fd_snapshot_slot_acc_vecs_size( self->storages + i );
7817 6 : } while(0);
7818 6 : size += sizeof(ulong);
7819 6 : size += sizeof(ulong);
7820 6 : size += fd_bank_hash_info_size( &self->bank_hash_info );
7821 6 : do {
7822 6 : size += sizeof(ulong);
7823 6 : size += self->historical_roots_len * sizeof(ulong);
7824 6 : } while(0);
7825 6 : do {
7826 6 : size += sizeof(ulong);
7827 6 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ )
7828 0 : size += fd_slot_map_pair_size( self->historical_roots_with_hash + i );
7829 6 : } while(0);
7830 6 : return size;
7831 6 : }
7832 :
7833 0 : int fd_versioned_epoch_stakes_current_decode( fd_versioned_epoch_stakes_current_t * self, fd_bincode_decode_ctx_t * ctx ) {
7834 0 : void const * data = ctx->data;
7835 0 : int err = fd_versioned_epoch_stakes_current_decode_preflight( ctx );
7836 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7837 0 : ctx->data = data;
7838 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
7839 0 : fd_versioned_epoch_stakes_current_new( self );
7840 0 : }
7841 0 : fd_versioned_epoch_stakes_current_decode_unsafe( self, ctx );
7842 0 : return FD_BINCODE_SUCCESS;
7843 0 : }
7844 0 : int fd_versioned_epoch_stakes_current_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
7845 0 : int err;
7846 0 : err = fd_stakes_stake_decode_preflight( ctx );
7847 0 : if( FD_UNLIKELY( err ) ) return err;
7848 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7849 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7850 0 : ulong node_id_to_vote_accounts_len;
7851 0 : err = fd_bincode_uint64_decode( &node_id_to_vote_accounts_len, ctx );
7852 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7853 0 : if( node_id_to_vote_accounts_len ) {
7854 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
7855 0 : err = fd_pubkey_node_vote_accounts_pair_decode_preflight( ctx );
7856 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7857 0 : }
7858 0 : }
7859 0 : ulong epoch_authorized_voters_len;
7860 0 : err = fd_bincode_uint64_decode( &epoch_authorized_voters_len, ctx );
7861 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7862 0 : if( epoch_authorized_voters_len ) {
7863 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
7864 0 : err = fd_pubkey_pubkey_pair_decode_preflight( ctx );
7865 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7866 0 : }
7867 0 : }
7868 0 : return FD_BINCODE_SUCCESS;
7869 0 : }
7870 0 : void fd_versioned_epoch_stakes_current_decode_unsafe( fd_versioned_epoch_stakes_current_t * self, fd_bincode_decode_ctx_t * ctx ) {
7871 0 : fd_stakes_stake_decode_unsafe( &self->stakes, ctx );
7872 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
7873 0 : fd_bincode_uint64_decode_unsafe( &self->node_id_to_vote_accounts_len, ctx );
7874 0 : if( self->node_id_to_vote_accounts_len ) {
7875 0 : self->node_id_to_vote_accounts = (fd_pubkey_node_vote_accounts_pair_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_ALIGN, FD_PUBKEY_NODE_VOTE_ACCOUNTS_PAIR_FOOTPRINT*self->node_id_to_vote_accounts_len );
7876 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
7877 0 : fd_pubkey_node_vote_accounts_pair_new( self->node_id_to_vote_accounts + i );
7878 0 : fd_pubkey_node_vote_accounts_pair_decode_unsafe( self->node_id_to_vote_accounts + i, ctx );
7879 0 : }
7880 0 : } else
7881 0 : self->node_id_to_vote_accounts = NULL;
7882 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_authorized_voters_len, ctx );
7883 0 : if( self->epoch_authorized_voters_len ) {
7884 0 : self->epoch_authorized_voters = (fd_pubkey_pubkey_pair_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_PUBKEY_PAIR_ALIGN, FD_PUBKEY_PUBKEY_PAIR_FOOTPRINT*self->epoch_authorized_voters_len );
7885 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
7886 0 : fd_pubkey_pubkey_pair_new( self->epoch_authorized_voters + i );
7887 0 : fd_pubkey_pubkey_pair_decode_unsafe( self->epoch_authorized_voters + i, ctx );
7888 0 : }
7889 0 : } else
7890 0 : self->epoch_authorized_voters = NULL;
7891 0 : }
7892 0 : int fd_versioned_epoch_stakes_current_encode( fd_versioned_epoch_stakes_current_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7893 0 : int err;
7894 0 : err = fd_stakes_stake_encode( &self->stakes, ctx );
7895 0 : if( FD_UNLIKELY( err ) ) return err;
7896 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
7897 0 : if( FD_UNLIKELY( err ) ) return err;
7898 0 : err = fd_bincode_uint64_encode( self->node_id_to_vote_accounts_len, ctx );
7899 0 : if( FD_UNLIKELY(err) ) return err;
7900 0 : if( self->node_id_to_vote_accounts_len ) {
7901 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ ) {
7902 0 : err = fd_pubkey_node_vote_accounts_pair_encode( self->node_id_to_vote_accounts + i, ctx );
7903 0 : if( FD_UNLIKELY( err ) ) return err;
7904 0 : }
7905 0 : }
7906 0 : err = fd_bincode_uint64_encode( self->epoch_authorized_voters_len, ctx );
7907 0 : if( FD_UNLIKELY(err) ) return err;
7908 0 : if( self->epoch_authorized_voters_len ) {
7909 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ ) {
7910 0 : err = fd_pubkey_pubkey_pair_encode( self->epoch_authorized_voters + i, ctx );
7911 0 : if( FD_UNLIKELY( err ) ) return err;
7912 0 : }
7913 0 : }
7914 0 : return FD_BINCODE_SUCCESS;
7915 0 : }
7916 0 : int fd_versioned_epoch_stakes_current_decode_offsets( fd_versioned_epoch_stakes_current_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
7917 0 : uchar const * data = ctx->data;
7918 0 : int err;
7919 0 : self->stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
7920 0 : err = fd_stakes_stake_decode_preflight( ctx );
7921 0 : if( FD_UNLIKELY( err ) ) return err;
7922 0 : self->total_stake_off = (uint)( (ulong)ctx->data - (ulong)data );
7923 0 : err = fd_bincode_uint64_decode_preflight( ctx );
7924 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7925 0 : self->node_id_to_vote_accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
7926 0 : ulong node_id_to_vote_accounts_len;
7927 0 : err = fd_bincode_uint64_decode( &node_id_to_vote_accounts_len, ctx );
7928 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7929 0 : if( node_id_to_vote_accounts_len ) {
7930 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
7931 0 : err = fd_pubkey_node_vote_accounts_pair_decode_preflight( ctx );
7932 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7933 0 : }
7934 0 : }
7935 0 : self->epoch_authorized_voters_off = (uint)( (ulong)ctx->data - (ulong)data );
7936 0 : ulong epoch_authorized_voters_len;
7937 0 : err = fd_bincode_uint64_decode( &epoch_authorized_voters_len, ctx );
7938 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7939 0 : if( epoch_authorized_voters_len ) {
7940 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
7941 0 : err = fd_pubkey_pubkey_pair_decode_preflight( ctx );
7942 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7943 0 : }
7944 0 : }
7945 0 : return FD_BINCODE_SUCCESS;
7946 0 : }
7947 0 : void fd_versioned_epoch_stakes_current_new(fd_versioned_epoch_stakes_current_t * self) {
7948 0 : fd_memset( self, 0, sizeof(fd_versioned_epoch_stakes_current_t) );
7949 0 : fd_stakes_stake_new( &self->stakes );
7950 0 : }
7951 0 : void fd_versioned_epoch_stakes_current_destroy( fd_versioned_epoch_stakes_current_t * self, fd_bincode_destroy_ctx_t * ctx ) {
7952 0 : fd_stakes_stake_destroy( &self->stakes, ctx );
7953 0 : if( self->node_id_to_vote_accounts ) {
7954 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
7955 0 : fd_pubkey_node_vote_accounts_pair_destroy( self->node_id_to_vote_accounts + i, ctx );
7956 0 : fd_valloc_free( ctx->valloc, self->node_id_to_vote_accounts );
7957 0 : self->node_id_to_vote_accounts = NULL;
7958 0 : }
7959 0 : if( self->epoch_authorized_voters ) {
7960 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
7961 0 : fd_pubkey_pubkey_pair_destroy( self->epoch_authorized_voters + i, ctx );
7962 0 : fd_valloc_free( ctx->valloc, self->epoch_authorized_voters );
7963 0 : self->epoch_authorized_voters = NULL;
7964 0 : }
7965 0 : }
7966 :
7967 0 : ulong fd_versioned_epoch_stakes_current_footprint( void ){ return FD_VERSIONED_EPOCH_STAKES_CURRENT_FOOTPRINT; }
7968 0 : ulong fd_versioned_epoch_stakes_current_align( void ){ return FD_VERSIONED_EPOCH_STAKES_CURRENT_ALIGN; }
7969 :
7970 0 : void fd_versioned_epoch_stakes_current_walk( void * w, fd_versioned_epoch_stakes_current_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
7971 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_versioned_epoch_stakes_current", level++ );
7972 0 : fd_stakes_stake_walk( w, &self->stakes, fun, "stakes", level );
7973 0 : fun( w, &self->total_stake, "total_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
7974 0 : if( self->node_id_to_vote_accounts_len ) {
7975 0 : fun( w, NULL, "node_id_to_vote_accounts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7976 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
7977 0 : fd_pubkey_node_vote_accounts_pair_walk(w, self->node_id_to_vote_accounts + i, fun, "pubkey_node_vote_accounts_pair", level );
7978 0 : fun( w, NULL, "node_id_to_vote_accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7979 0 : }
7980 0 : if( self->epoch_authorized_voters_len ) {
7981 0 : fun( w, NULL, "epoch_authorized_voters", FD_FLAMENCO_TYPE_ARR, "array", level++ );
7982 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
7983 0 : fd_pubkey_pubkey_pair_walk(w, self->epoch_authorized_voters + i, fun, "pubkey_pubkey_pair", level );
7984 0 : fun( w, NULL, "epoch_authorized_voters", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
7985 0 : }
7986 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_versioned_epoch_stakes_current", level-- );
7987 0 : }
7988 0 : ulong fd_versioned_epoch_stakes_current_size( fd_versioned_epoch_stakes_current_t const * self ) {
7989 0 : ulong size = 0;
7990 0 : size += fd_stakes_stake_size( &self->stakes );
7991 0 : size += sizeof(ulong);
7992 0 : do {
7993 0 : size += sizeof(ulong);
7994 0 : for( ulong i=0; i < self->node_id_to_vote_accounts_len; i++ )
7995 0 : size += fd_pubkey_node_vote_accounts_pair_size( self->node_id_to_vote_accounts + i );
7996 0 : } while(0);
7997 0 : do {
7998 0 : size += sizeof(ulong);
7999 0 : for( ulong i=0; i < self->epoch_authorized_voters_len; i++ )
8000 0 : size += fd_pubkey_pubkey_pair_size( self->epoch_authorized_voters + i );
8001 0 : } while(0);
8002 0 : return size;
8003 0 : }
8004 :
8005 0 : FD_FN_PURE uchar fd_versioned_epoch_stakes_is_Current(fd_versioned_epoch_stakes_t const * self) {
8006 0 : return self->discriminant == 0;
8007 0 : }
8008 : void fd_versioned_epoch_stakes_inner_new( fd_versioned_epoch_stakes_inner_t * self, uint discriminant );
8009 0 : int fd_versioned_epoch_stakes_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
8010 0 : int err;
8011 0 : switch (discriminant) {
8012 0 : case 0: {
8013 0 : err = fd_versioned_epoch_stakes_current_decode_preflight( ctx );
8014 0 : if( FD_UNLIKELY( err ) ) return err;
8015 0 : return FD_BINCODE_SUCCESS;
8016 0 : }
8017 0 : default: return FD_BINCODE_ERR_ENCODING;
8018 0 : }
8019 0 : }
8020 0 : void fd_versioned_epoch_stakes_inner_decode_unsafe( fd_versioned_epoch_stakes_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
8021 0 : switch (discriminant) {
8022 0 : case 0: {
8023 0 : fd_versioned_epoch_stakes_current_decode_unsafe( &self->Current, ctx );
8024 0 : break;
8025 0 : }
8026 0 : }
8027 0 : }
8028 0 : int fd_versioned_epoch_stakes_decode( fd_versioned_epoch_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
8029 0 : void const * data = ctx->data;
8030 0 : int err = fd_versioned_epoch_stakes_decode_preflight( ctx );
8031 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8032 0 : ctx->data = data;
8033 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
8034 0 : fd_versioned_epoch_stakes_new( self );
8035 0 : }
8036 0 : fd_versioned_epoch_stakes_decode_unsafe( self, ctx );
8037 0 : return FD_BINCODE_SUCCESS;
8038 0 : }
8039 0 : int fd_versioned_epoch_stakes_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
8040 0 : uint discriminant = 0;
8041 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8042 0 : if( FD_UNLIKELY( err ) ) return err;
8043 0 : return fd_versioned_epoch_stakes_inner_decode_preflight( discriminant, ctx );
8044 0 : }
8045 0 : void fd_versioned_epoch_stakes_decode_unsafe( fd_versioned_epoch_stakes_t * self, fd_bincode_decode_ctx_t * ctx ) {
8046 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8047 0 : fd_versioned_epoch_stakes_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
8048 0 : }
8049 0 : void fd_versioned_epoch_stakes_inner_new( fd_versioned_epoch_stakes_inner_t * self, uint discriminant ) {
8050 0 : switch( discriminant ) {
8051 0 : case 0: {
8052 0 : fd_versioned_epoch_stakes_current_new( &self->Current );
8053 0 : break;
8054 0 : }
8055 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8056 0 : }
8057 0 : }
8058 0 : void fd_versioned_epoch_stakes_new_disc( fd_versioned_epoch_stakes_t * self, uint discriminant ) {
8059 0 : self->discriminant = discriminant;
8060 0 : fd_versioned_epoch_stakes_inner_new( &self->inner, self->discriminant );
8061 0 : }
8062 0 : void fd_versioned_epoch_stakes_new( fd_versioned_epoch_stakes_t * self ) {
8063 0 : fd_memset( self, 0, sizeof(fd_versioned_epoch_stakes_t) );
8064 0 : fd_versioned_epoch_stakes_new_disc( self, UINT_MAX );
8065 0 : }
8066 0 : void fd_versioned_epoch_stakes_inner_destroy( fd_versioned_epoch_stakes_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
8067 0 : switch( discriminant ) {
8068 0 : case 0: {
8069 0 : fd_versioned_epoch_stakes_current_destroy( &self->Current, ctx );
8070 0 : break;
8071 0 : }
8072 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
8073 0 : }
8074 0 : }
8075 0 : void fd_versioned_epoch_stakes_destroy( fd_versioned_epoch_stakes_t * self, fd_bincode_destroy_ctx_t * ctx ) {
8076 0 : fd_versioned_epoch_stakes_inner_destroy( &self->inner, self->discriminant, ctx );
8077 0 : }
8078 :
8079 0 : ulong fd_versioned_epoch_stakes_footprint( void ){ return FD_VERSIONED_EPOCH_STAKES_FOOTPRINT; }
8080 0 : ulong fd_versioned_epoch_stakes_align( void ){ return FD_VERSIONED_EPOCH_STAKES_ALIGN; }
8081 :
8082 0 : void fd_versioned_epoch_stakes_walk( void * w, fd_versioned_epoch_stakes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8083 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_versioned_epoch_stakes", level++);
8084 0 : switch( self->discriminant ) {
8085 0 : case 0: {
8086 0 : fun( w, self, "Current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
8087 0 : fd_versioned_epoch_stakes_current_walk( w, &self->inner.Current, fun, "Current", level );
8088 0 : break;
8089 0 : }
8090 0 : }
8091 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_versioned_epoch_stakes", level-- );
8092 0 : }
8093 0 : ulong fd_versioned_epoch_stakes_size( fd_versioned_epoch_stakes_t const * self ) {
8094 0 : ulong size = 0;
8095 0 : size += sizeof(uint);
8096 0 : switch (self->discriminant) {
8097 0 : case 0: {
8098 0 : size += fd_versioned_epoch_stakes_current_size( &self->inner.Current );
8099 0 : break;
8100 0 : }
8101 0 : }
8102 0 : return size;
8103 0 : }
8104 :
8105 0 : int fd_versioned_epoch_stakes_inner_encode( fd_versioned_epoch_stakes_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
8106 0 : int err;
8107 0 : switch (discriminant) {
8108 0 : case 0: {
8109 0 : err = fd_versioned_epoch_stakes_current_encode( &self->Current, ctx );
8110 0 : if( FD_UNLIKELY( err ) ) return err;
8111 0 : break;
8112 0 : }
8113 0 : }
8114 0 : return FD_BINCODE_SUCCESS;
8115 0 : }
8116 0 : int fd_versioned_epoch_stakes_encode( fd_versioned_epoch_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8117 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8118 0 : if( FD_UNLIKELY( err ) ) return err;
8119 0 : return fd_versioned_epoch_stakes_inner_encode( &self->inner, self->discriminant, ctx );
8120 0 : }
8121 :
8122 0 : int fd_versioned_epoch_stakes_pair_decode( fd_versioned_epoch_stakes_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
8123 0 : void const * data = ctx->data;
8124 0 : int err = fd_versioned_epoch_stakes_pair_decode_preflight( ctx );
8125 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8126 0 : ctx->data = data;
8127 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
8128 0 : fd_versioned_epoch_stakes_pair_new( self );
8129 0 : }
8130 0 : fd_versioned_epoch_stakes_pair_decode_unsafe( self, ctx );
8131 0 : return FD_BINCODE_SUCCESS;
8132 0 : }
8133 0 : int fd_versioned_epoch_stakes_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
8134 0 : int err;
8135 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8136 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8137 0 : err = fd_versioned_epoch_stakes_decode_preflight( ctx );
8138 0 : if( FD_UNLIKELY( err ) ) return err;
8139 0 : return FD_BINCODE_SUCCESS;
8140 0 : }
8141 0 : void fd_versioned_epoch_stakes_pair_decode_unsafe( fd_versioned_epoch_stakes_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
8142 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
8143 0 : fd_versioned_epoch_stakes_decode_unsafe( &self->val, ctx );
8144 0 : }
8145 0 : int fd_versioned_epoch_stakes_pair_encode( fd_versioned_epoch_stakes_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8146 0 : int err;
8147 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
8148 0 : if( FD_UNLIKELY( err ) ) return err;
8149 0 : err = fd_versioned_epoch_stakes_encode( &self->val, ctx );
8150 0 : if( FD_UNLIKELY( err ) ) return err;
8151 0 : return FD_BINCODE_SUCCESS;
8152 0 : }
8153 0 : int fd_versioned_epoch_stakes_pair_decode_offsets( fd_versioned_epoch_stakes_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
8154 0 : uchar const * data = ctx->data;
8155 0 : int err;
8156 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
8157 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8158 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8159 0 : self->val_off = (uint)( (ulong)ctx->data - (ulong)data );
8160 0 : err = fd_versioned_epoch_stakes_decode_preflight( ctx );
8161 0 : if( FD_UNLIKELY( err ) ) return err;
8162 0 : return FD_BINCODE_SUCCESS;
8163 0 : }
8164 0 : void fd_versioned_epoch_stakes_pair_new(fd_versioned_epoch_stakes_pair_t * self) {
8165 0 : fd_memset( self, 0, sizeof(fd_versioned_epoch_stakes_pair_t) );
8166 0 : fd_versioned_epoch_stakes_new( &self->val );
8167 0 : }
8168 0 : void fd_versioned_epoch_stakes_pair_destroy( fd_versioned_epoch_stakes_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
8169 0 : fd_versioned_epoch_stakes_destroy( &self->val, ctx );
8170 0 : }
8171 :
8172 0 : ulong fd_versioned_epoch_stakes_pair_footprint( void ){ return FD_VERSIONED_EPOCH_STAKES_PAIR_FOOTPRINT; }
8173 0 : ulong fd_versioned_epoch_stakes_pair_align( void ){ return FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN; }
8174 :
8175 0 : void fd_versioned_epoch_stakes_pair_walk( void * w, fd_versioned_epoch_stakes_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8176 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_versioned_epoch_stakes_pair", level++ );
8177 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8178 0 : fd_versioned_epoch_stakes_walk( w, &self->val, fun, "val", level );
8179 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_versioned_epoch_stakes_pair", level-- );
8180 0 : }
8181 0 : ulong fd_versioned_epoch_stakes_pair_size( fd_versioned_epoch_stakes_pair_t const * self ) {
8182 0 : ulong size = 0;
8183 0 : size += sizeof(ulong);
8184 0 : size += fd_versioned_epoch_stakes_size( &self->val );
8185 0 : return size;
8186 0 : }
8187 :
8188 0 : int fd_reward_info_decode( fd_reward_info_t * self, fd_bincode_decode_ctx_t * ctx ) {
8189 0 : void const * data = ctx->data;
8190 0 : int err = fd_reward_info_decode_preflight( ctx );
8191 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8192 0 : ctx->data = data;
8193 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
8194 0 : fd_reward_info_new( self );
8195 0 : }
8196 0 : fd_reward_info_decode_unsafe( self, ctx );
8197 0 : return FD_BINCODE_SUCCESS;
8198 0 : }
8199 0 : int fd_reward_info_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
8200 0 : int err;
8201 0 : err = fd_reward_type_decode_preflight( ctx );
8202 0 : if( FD_UNLIKELY( err ) ) return err;
8203 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8204 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8205 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8206 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8207 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8208 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8209 0 : return FD_BINCODE_SUCCESS;
8210 0 : }
8211 0 : void fd_reward_info_decode_unsafe( fd_reward_info_t * self, fd_bincode_decode_ctx_t * ctx ) {
8212 0 : fd_reward_type_decode_unsafe( &self->reward_type, ctx );
8213 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
8214 0 : fd_bincode_uint64_decode_unsafe( &self->post_balance, ctx );
8215 0 : fd_bincode_uint64_decode_unsafe( &self->commission, ctx );
8216 0 : }
8217 0 : int fd_reward_info_encode( fd_reward_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8218 0 : int err;
8219 0 : err = fd_reward_type_encode( &self->reward_type, ctx );
8220 0 : if( FD_UNLIKELY( err ) ) return err;
8221 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
8222 0 : if( FD_UNLIKELY( err ) ) return err;
8223 0 : err = fd_bincode_uint64_encode( self->post_balance, ctx );
8224 0 : if( FD_UNLIKELY( err ) ) return err;
8225 0 : err = fd_bincode_uint64_encode( self->commission, ctx );
8226 0 : if( FD_UNLIKELY( err ) ) return err;
8227 0 : return FD_BINCODE_SUCCESS;
8228 0 : }
8229 0 : int fd_reward_info_decode_offsets( fd_reward_info_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
8230 0 : uchar const * data = ctx->data;
8231 0 : int err;
8232 0 : self->reward_type_off = (uint)( (ulong)ctx->data - (ulong)data );
8233 0 : err = fd_reward_type_decode_preflight( ctx );
8234 0 : if( FD_UNLIKELY( err ) ) return err;
8235 0 : self->lamports_off = (uint)( (ulong)ctx->data - (ulong)data );
8236 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8237 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8238 0 : self->post_balance_off = (uint)( (ulong)ctx->data - (ulong)data );
8239 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8240 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8241 0 : self->commission_off = (uint)( (ulong)ctx->data - (ulong)data );
8242 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8243 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8244 0 : return FD_BINCODE_SUCCESS;
8245 0 : }
8246 0 : void fd_reward_info_new(fd_reward_info_t * self) {
8247 0 : fd_memset( self, 0, sizeof(fd_reward_info_t) );
8248 0 : fd_reward_type_new( &self->reward_type );
8249 0 : }
8250 0 : void fd_reward_info_destroy( fd_reward_info_t * self, fd_bincode_destroy_ctx_t * ctx ) {
8251 0 : fd_reward_type_destroy( &self->reward_type, ctx );
8252 0 : }
8253 :
8254 0 : ulong fd_reward_info_footprint( void ){ return FD_REWARD_INFO_FOOTPRINT; }
8255 0 : ulong fd_reward_info_align( void ){ return FD_REWARD_INFO_ALIGN; }
8256 :
8257 0 : void fd_reward_info_walk( void * w, fd_reward_info_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8258 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_reward_info", level++ );
8259 0 : fd_reward_type_walk( w, &self->reward_type, fun, "reward_type", level );
8260 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8261 0 : fun( w, &self->post_balance, "post_balance", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8262 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8263 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_reward_info", level-- );
8264 0 : }
8265 0 : ulong fd_reward_info_size( fd_reward_info_t const * self ) {
8266 0 : ulong size = 0;
8267 0 : size += fd_reward_type_size( &self->reward_type );
8268 0 : size += sizeof(ulong);
8269 0 : size += sizeof(ulong);
8270 0 : size += sizeof(ulong);
8271 0 : return size;
8272 0 : }
8273 :
8274 0 : int fd_slot_lthash_decode( fd_slot_lthash_t * self, fd_bincode_decode_ctx_t * ctx ) {
8275 0 : void const * data = ctx->data;
8276 0 : int err = fd_slot_lthash_decode_preflight( ctx );
8277 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8278 0 : ctx->data = data;
8279 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
8280 0 : fd_slot_lthash_new( self );
8281 0 : }
8282 0 : fd_slot_lthash_decode_unsafe( self, ctx );
8283 0 : return FD_BINCODE_SUCCESS;
8284 0 : }
8285 0 : int fd_slot_lthash_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
8286 0 : return fd_bincode_bytes_decode_preflight( 2048, ctx );
8287 0 : }
8288 0 : void fd_slot_lthash_decode_unsafe( fd_slot_lthash_t * self, fd_bincode_decode_ctx_t * ctx ) {
8289 0 : fd_bincode_bytes_decode_unsafe( &self->lthash[0], sizeof(self->lthash), ctx );
8290 0 : }
8291 0 : int fd_slot_lthash_encode( fd_slot_lthash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8292 0 : int err;
8293 0 : err = fd_bincode_bytes_encode( self->lthash, sizeof(self->lthash), ctx );
8294 0 : if( FD_UNLIKELY( err ) ) return err;
8295 0 : return FD_BINCODE_SUCCESS;
8296 0 : }
8297 : enum {
8298 : fd_slot_lthash_lthash_TAG = (0 << 6) | FD_ARCHIVE_META_UCHAR2048,
8299 : };
8300 0 : int fd_slot_lthash_decode_archival( fd_slot_lthash_t * self, fd_bincode_decode_ctx_t * ctx ) {
8301 0 : void const * data = ctx->data;
8302 0 : int err = fd_slot_lthash_decode_archival_preflight( ctx );
8303 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8304 0 : ctx->data = data;
8305 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
8306 0 : fd_slot_lthash_new( self );
8307 0 : }
8308 0 : fd_slot_lthash_decode_archival_unsafe( self, ctx );
8309 0 : return FD_BINCODE_SUCCESS;
8310 0 : }
8311 0 : int fd_slot_lthash_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
8312 0 : int err;
8313 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
8314 0 : void * offset = NULL;
8315 0 : for(;;) {
8316 0 : err = fd_bincode_uint16_decode( &tag, ctx );
8317 0 : if( FD_UNLIKELY( err ) ) return err;
8318 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
8319 0 : switch( tag ) {
8320 0 : case (ushort)fd_slot_lthash_lthash_TAG: {
8321 0 : err = fd_bincode_bytes_decode_preflight( 2048, ctx );
8322 0 : if( FD_UNLIKELY( err ) ) return err;
8323 0 : break;
8324 0 : }
8325 0 : default:
8326 0 : err = fd_archive_decode_skip_field( ctx, tag );
8327 0 : if( FD_UNLIKELY( err ) ) return err;
8328 0 : break;
8329 0 : }
8330 0 : }
8331 0 : return FD_BINCODE_SUCCESS;
8332 0 : }
8333 0 : void fd_slot_lthash_decode_archival_unsafe( fd_slot_lthash_t * self, fd_bincode_decode_ctx_t * ctx ) {
8334 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
8335 0 : void * offset = NULL;
8336 0 : for(;;) {
8337 0 : fd_bincode_uint16_decode( &tag, ctx );
8338 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
8339 0 : switch( tag ) {
8340 0 : case (ushort)fd_slot_lthash_lthash_TAG: {
8341 0 : fd_bincode_bytes_decode_unsafe( &self->lthash[0], sizeof(self->lthash), ctx );
8342 0 : break;
8343 0 : }
8344 0 : default:
8345 0 : fd_archive_decode_skip_field( ctx, tag );
8346 0 : break;
8347 0 : }
8348 0 : }
8349 0 : }
8350 0 : int fd_slot_lthash_encode_archival( fd_slot_lthash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8351 0 : int err;
8352 0 : void * offset = NULL;
8353 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_lthash_lthash_TAG, ctx );
8354 0 : if( FD_UNLIKELY( err ) ) return err;
8355 0 : err = fd_bincode_bytes_encode( self->lthash, sizeof(self->lthash), ctx );
8356 0 : if( FD_UNLIKELY( err ) ) return err;
8357 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
8358 0 : if( FD_UNLIKELY( err ) ) return err;
8359 0 : return FD_BINCODE_SUCCESS;
8360 0 : }
8361 0 : int fd_slot_lthash_decode_offsets( fd_slot_lthash_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
8362 0 : uchar const * data = ctx->data;
8363 0 : int err;
8364 0 : self->lthash_off = (uint)( (ulong)ctx->data - (ulong)data );
8365 0 : err = fd_bincode_bytes_decode_preflight( 2048, ctx );
8366 0 : if( FD_UNLIKELY( err ) ) return err;
8367 0 : return FD_BINCODE_SUCCESS;
8368 0 : }
8369 815718 : void fd_slot_lthash_new(fd_slot_lthash_t * self) {
8370 815718 : fd_memset( self, 0, sizeof(fd_slot_lthash_t) );
8371 815718 : }
8372 815718 : void fd_slot_lthash_destroy( fd_slot_lthash_t * self, fd_bincode_destroy_ctx_t * ctx ) {
8373 815718 : }
8374 :
8375 0 : ulong fd_slot_lthash_footprint( void ){ return FD_SLOT_LTHASH_FOOTPRINT; }
8376 0 : ulong fd_slot_lthash_align( void ){ return FD_SLOT_LTHASH_ALIGN; }
8377 :
8378 0 : void fd_slot_lthash_walk( void * w, fd_slot_lthash_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8379 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_lthash", level++ );
8380 0 : fun( w, self->lthash, "lthash", FD_FLAMENCO_TYPE_HASH16384, "uchar[2048]", level );
8381 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_lthash", level-- );
8382 0 : }
8383 0 : ulong fd_slot_lthash_size( fd_slot_lthash_t const * self ) {
8384 0 : ulong size = 0;
8385 0 : size += sizeof(char) * 2048;
8386 0 : return size;
8387 0 : }
8388 :
8389 9 : int fd_solana_manifest_decode( fd_solana_manifest_t * self, fd_bincode_decode_ctx_t * ctx ) {
8390 9 : void const * data = ctx->data;
8391 9 : int err = fd_solana_manifest_decode_preflight( ctx );
8392 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8393 6 : ctx->data = data;
8394 6 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
8395 6 : fd_solana_manifest_new( self );
8396 6 : }
8397 6 : fd_solana_manifest_decode_unsafe( self, ctx );
8398 6 : return FD_BINCODE_SUCCESS;
8399 9 : }
8400 9 : int fd_solana_manifest_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
8401 9 : int err;
8402 9 : err = fd_deserializable_versioned_bank_decode_preflight( ctx );
8403 9 : if( FD_UNLIKELY( err ) ) return err;
8404 6 : err = fd_solana_accounts_db_fields_decode_preflight( ctx );
8405 6 : if( FD_UNLIKELY( err ) ) return err;
8406 6 : err = fd_bincode_uint64_decode_preflight( ctx );
8407 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8408 6 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8409 6 : {
8410 6 : uchar o;
8411 6 : err = fd_bincode_bool_decode( &o, ctx );
8412 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8413 6 : if( o ) {
8414 0 : err = fd_bank_incremental_snapshot_persistence_decode_preflight( ctx );
8415 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8416 0 : }
8417 6 : }
8418 6 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8419 6 : {
8420 6 : uchar o;
8421 6 : err = fd_bincode_bool_decode( &o, ctx );
8422 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8423 6 : if( o ) {
8424 0 : err = fd_hash_decode_preflight( ctx );
8425 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8426 0 : }
8427 6 : }
8428 6 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8429 6 : ulong versioned_epoch_stakes_len;
8430 6 : err = fd_bincode_uint64_decode( &versioned_epoch_stakes_len, ctx );
8431 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8432 6 : if( versioned_epoch_stakes_len ) {
8433 0 : for( ulong i=0; i < versioned_epoch_stakes_len; i++ ) {
8434 0 : err = fd_versioned_epoch_stakes_pair_decode_preflight( ctx );
8435 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8436 0 : }
8437 0 : }
8438 6 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8439 6 : {
8440 6 : uchar o;
8441 6 : err = fd_bincode_bool_decode( &o, ctx );
8442 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8443 6 : if( o ) {
8444 0 : err = fd_slot_lthash_decode_preflight( ctx );
8445 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8446 0 : }
8447 6 : }
8448 6 : return FD_BINCODE_SUCCESS;
8449 6 : }
8450 6 : void fd_solana_manifest_decode_unsafe( fd_solana_manifest_t * self, fd_bincode_decode_ctx_t * ctx ) {
8451 6 : fd_deserializable_versioned_bank_decode_unsafe( &self->bank, ctx );
8452 6 : fd_solana_accounts_db_fields_decode_unsafe( &self->accounts_db, ctx );
8453 6 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
8454 6 : if( ctx->data == ctx->dataend ) return;
8455 6 : {
8456 6 : uchar o;
8457 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
8458 6 : if( o ) {
8459 0 : self->bank_incremental_snapshot_persistence = (fd_bank_incremental_snapshot_persistence_t *)fd_valloc_malloc( ctx->valloc, FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN, FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_FOOTPRINT );
8460 0 : fd_bank_incremental_snapshot_persistence_new( self->bank_incremental_snapshot_persistence );
8461 0 : fd_bank_incremental_snapshot_persistence_decode_unsafe( self->bank_incremental_snapshot_persistence, ctx );
8462 0 : } else
8463 6 : self->bank_incremental_snapshot_persistence = NULL;
8464 6 : }
8465 6 : if( ctx->data == ctx->dataend ) return;
8466 6 : {
8467 6 : uchar o;
8468 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
8469 6 : if( o ) {
8470 0 : self->epoch_account_hash = (fd_hash_t *)fd_valloc_malloc( ctx->valloc, FD_HASH_ALIGN, FD_HASH_FOOTPRINT );
8471 0 : fd_hash_new( self->epoch_account_hash );
8472 0 : fd_hash_decode_unsafe( self->epoch_account_hash, ctx );
8473 0 : } else
8474 6 : self->epoch_account_hash = NULL;
8475 6 : }
8476 6 : if( ctx->data == ctx->dataend ) return;
8477 6 : fd_bincode_uint64_decode_unsafe( &self->versioned_epoch_stakes_len, ctx );
8478 6 : if( self->versioned_epoch_stakes_len ) {
8479 0 : self->versioned_epoch_stakes = (fd_versioned_epoch_stakes_pair_t *)fd_valloc_malloc( ctx->valloc, FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN, FD_VERSIONED_EPOCH_STAKES_PAIR_FOOTPRINT*self->versioned_epoch_stakes_len );
8480 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
8481 0 : fd_versioned_epoch_stakes_pair_new( self->versioned_epoch_stakes + i );
8482 0 : fd_versioned_epoch_stakes_pair_decode_unsafe( self->versioned_epoch_stakes + i, ctx );
8483 0 : }
8484 0 : } else
8485 6 : self->versioned_epoch_stakes = NULL;
8486 6 : if( ctx->data == ctx->dataend ) return;
8487 6 : {
8488 6 : uchar o;
8489 6 : fd_bincode_bool_decode_unsafe( &o, ctx );
8490 6 : if( o ) {
8491 0 : self->lthash = (fd_slot_lthash_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_LTHASH_ALIGN, FD_SLOT_LTHASH_FOOTPRINT );
8492 0 : fd_slot_lthash_new( self->lthash );
8493 0 : fd_slot_lthash_decode_unsafe( self->lthash, ctx );
8494 0 : } else
8495 6 : self->lthash = NULL;
8496 6 : }
8497 6 : }
8498 6 : int fd_solana_manifest_encode( fd_solana_manifest_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8499 6 : int err;
8500 6 : err = fd_deserializable_versioned_bank_encode( &self->bank, ctx );
8501 6 : if( FD_UNLIKELY( err ) ) return err;
8502 6 : err = fd_solana_accounts_db_fields_encode( &self->accounts_db, ctx );
8503 6 : if( FD_UNLIKELY( err ) ) return err;
8504 6 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
8505 6 : if( FD_UNLIKELY( err ) ) return err;
8506 6 : if( self->bank_incremental_snapshot_persistence != NULL ) {
8507 0 : err = fd_bincode_bool_encode( 1, ctx );
8508 0 : if( FD_UNLIKELY( err ) ) return err;
8509 0 : err = fd_bank_incremental_snapshot_persistence_encode( self->bank_incremental_snapshot_persistence, ctx );
8510 0 : if( FD_UNLIKELY( err ) ) return err;
8511 6 : } else {
8512 6 : err = fd_bincode_bool_encode( 0, ctx );
8513 6 : if( FD_UNLIKELY( err ) ) return err;
8514 6 : }
8515 6 : if( self->epoch_account_hash != NULL ) {
8516 0 : err = fd_bincode_bool_encode( 1, ctx );
8517 0 : if( FD_UNLIKELY( err ) ) return err;
8518 0 : err = fd_hash_encode( self->epoch_account_hash, ctx );
8519 0 : if( FD_UNLIKELY( err ) ) return err;
8520 6 : } else {
8521 6 : err = fd_bincode_bool_encode( 0, ctx );
8522 6 : if( FD_UNLIKELY( err ) ) return err;
8523 6 : }
8524 6 : err = fd_bincode_uint64_encode( self->versioned_epoch_stakes_len, ctx );
8525 6 : if( FD_UNLIKELY(err) ) return err;
8526 6 : if( self->versioned_epoch_stakes_len ) {
8527 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
8528 0 : err = fd_versioned_epoch_stakes_pair_encode( self->versioned_epoch_stakes + i, ctx );
8529 0 : if( FD_UNLIKELY( err ) ) return err;
8530 0 : }
8531 0 : }
8532 6 : if( self->lthash != NULL ) {
8533 0 : err = fd_bincode_bool_encode( 1, ctx );
8534 0 : if( FD_UNLIKELY( err ) ) return err;
8535 0 : err = fd_slot_lthash_encode( self->lthash, ctx );
8536 0 : if( FD_UNLIKELY( err ) ) return err;
8537 6 : } else {
8538 6 : err = fd_bincode_bool_encode( 0, ctx );
8539 6 : if( FD_UNLIKELY( err ) ) return err;
8540 6 : }
8541 6 : return FD_BINCODE_SUCCESS;
8542 6 : }
8543 0 : int fd_solana_manifest_decode_offsets( fd_solana_manifest_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
8544 0 : uchar const * data = ctx->data;
8545 0 : int err;
8546 0 : self->bank_off = (uint)( (ulong)ctx->data - (ulong)data );
8547 0 : err = fd_deserializable_versioned_bank_decode_preflight( ctx );
8548 0 : if( FD_UNLIKELY( err ) ) return err;
8549 0 : self->accounts_db_off = (uint)( (ulong)ctx->data - (ulong)data );
8550 0 : err = fd_solana_accounts_db_fields_decode_preflight( ctx );
8551 0 : if( FD_UNLIKELY( err ) ) return err;
8552 0 : self->lamports_per_signature_off = (uint)( (ulong)ctx->data - (ulong)data );
8553 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8554 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8555 0 : self->bank_incremental_snapshot_persistence_off = (uint)( (ulong)ctx->data - (ulong)data );
8556 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8557 0 : {
8558 0 : uchar o;
8559 0 : err = fd_bincode_bool_decode( &o, ctx );
8560 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8561 0 : if( o ) {
8562 0 : err = fd_bank_incremental_snapshot_persistence_decode_preflight( ctx );
8563 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8564 0 : }
8565 0 : }
8566 0 : self->epoch_account_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
8567 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8568 0 : {
8569 0 : uchar o;
8570 0 : err = fd_bincode_bool_decode( &o, ctx );
8571 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8572 0 : if( o ) {
8573 0 : err = fd_hash_decode_preflight( ctx );
8574 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8575 0 : }
8576 0 : }
8577 0 : self->versioned_epoch_stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
8578 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8579 0 : ulong versioned_epoch_stakes_len;
8580 0 : err = fd_bincode_uint64_decode( &versioned_epoch_stakes_len, ctx );
8581 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8582 0 : if( versioned_epoch_stakes_len ) {
8583 0 : for( ulong i=0; i < versioned_epoch_stakes_len; i++ ) {
8584 0 : err = fd_versioned_epoch_stakes_pair_decode_preflight( ctx );
8585 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8586 0 : }
8587 0 : }
8588 0 : self->lthash_off = (uint)( (ulong)ctx->data - (ulong)data );
8589 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8590 0 : {
8591 0 : uchar o;
8592 0 : err = fd_bincode_bool_decode( &o, ctx );
8593 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8594 0 : if( o ) {
8595 0 : err = fd_slot_lthash_decode_preflight( ctx );
8596 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8597 0 : }
8598 0 : }
8599 0 : return FD_BINCODE_SUCCESS;
8600 0 : }
8601 6 : void fd_solana_manifest_new(fd_solana_manifest_t * self) {
8602 6 : fd_memset( self, 0, sizeof(fd_solana_manifest_t) );
8603 6 : fd_deserializable_versioned_bank_new( &self->bank );
8604 6 : fd_solana_accounts_db_fields_new( &self->accounts_db );
8605 6 : }
8606 0 : void fd_solana_manifest_destroy( fd_solana_manifest_t * self, fd_bincode_destroy_ctx_t * ctx ) {
8607 0 : fd_deserializable_versioned_bank_destroy( &self->bank, ctx );
8608 0 : fd_solana_accounts_db_fields_destroy( &self->accounts_db, ctx );
8609 0 : if( self->bank_incremental_snapshot_persistence ) {
8610 0 : fd_bank_incremental_snapshot_persistence_destroy( self->bank_incremental_snapshot_persistence, ctx );
8611 0 : fd_valloc_free( ctx->valloc, self->bank_incremental_snapshot_persistence );
8612 0 : self->bank_incremental_snapshot_persistence = NULL;
8613 0 : }
8614 0 : if( self->epoch_account_hash ) {
8615 0 : fd_hash_destroy( self->epoch_account_hash, ctx );
8616 0 : fd_valloc_free( ctx->valloc, self->epoch_account_hash );
8617 0 : self->epoch_account_hash = NULL;
8618 0 : }
8619 0 : if( self->versioned_epoch_stakes ) {
8620 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
8621 0 : fd_versioned_epoch_stakes_pair_destroy( self->versioned_epoch_stakes + i, ctx );
8622 0 : fd_valloc_free( ctx->valloc, self->versioned_epoch_stakes );
8623 0 : self->versioned_epoch_stakes = NULL;
8624 0 : }
8625 0 : if( self->lthash ) {
8626 0 : fd_slot_lthash_destroy( self->lthash, ctx );
8627 0 : fd_valloc_free( ctx->valloc, self->lthash );
8628 0 : self->lthash = NULL;
8629 0 : }
8630 0 : }
8631 :
8632 0 : ulong fd_solana_manifest_footprint( void ){ return FD_SOLANA_MANIFEST_FOOTPRINT; }
8633 0 : ulong fd_solana_manifest_align( void ){ return FD_SOLANA_MANIFEST_ALIGN; }
8634 :
8635 0 : void fd_solana_manifest_walk( void * w, fd_solana_manifest_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8636 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_manifest", level++ );
8637 0 : fd_deserializable_versioned_bank_walk( w, &self->bank, fun, "bank", level );
8638 0 : fd_solana_accounts_db_fields_walk( w, &self->accounts_db, fun, "accounts_db", level );
8639 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8640 0 : if( !self->bank_incremental_snapshot_persistence ) {
8641 0 : fun( w, NULL, "bank_incremental_snapshot_persistence", FD_FLAMENCO_TYPE_NULL, "bank_incremental_snapshot_persistence", level );
8642 0 : } else {
8643 0 : fd_bank_incremental_snapshot_persistence_walk( w, self->bank_incremental_snapshot_persistence, fun, "bank_incremental_snapshot_persistence", level );
8644 0 : }
8645 0 : if( !self->epoch_account_hash ) {
8646 0 : fun( w, NULL, "epoch_account_hash", FD_FLAMENCO_TYPE_NULL, "hash", level );
8647 0 : } else {
8648 0 : fd_hash_walk( w, self->epoch_account_hash, fun, "epoch_account_hash", level );
8649 0 : }
8650 0 : if( self->versioned_epoch_stakes_len ) {
8651 0 : fun( w, NULL, "versioned_epoch_stakes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
8652 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
8653 0 : fd_versioned_epoch_stakes_pair_walk(w, self->versioned_epoch_stakes + i, fun, "versioned_epoch_stakes_pair", level );
8654 0 : fun( w, NULL, "versioned_epoch_stakes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
8655 0 : }
8656 0 : if( !self->lthash ) {
8657 0 : fun( w, NULL, "lthash", FD_FLAMENCO_TYPE_NULL, "slot_lthash", level );
8658 0 : } else {
8659 0 : fd_slot_lthash_walk( w, self->lthash, fun, "lthash", level );
8660 0 : }
8661 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_manifest", level-- );
8662 0 : }
8663 6 : ulong fd_solana_manifest_size( fd_solana_manifest_t const * self ) {
8664 6 : ulong size = 0;
8665 6 : size += fd_deserializable_versioned_bank_size( &self->bank );
8666 6 : size += fd_solana_accounts_db_fields_size( &self->accounts_db );
8667 6 : size += sizeof(ulong);
8668 6 : size += sizeof(char);
8669 6 : if( NULL != self->bank_incremental_snapshot_persistence ) {
8670 0 : size += fd_bank_incremental_snapshot_persistence_size( self->bank_incremental_snapshot_persistence );
8671 0 : }
8672 6 : size += sizeof(char);
8673 6 : if( NULL != self->epoch_account_hash ) {
8674 0 : size += fd_hash_size( self->epoch_account_hash );
8675 0 : }
8676 6 : do {
8677 6 : size += sizeof(ulong);
8678 6 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
8679 0 : size += fd_versioned_epoch_stakes_pair_size( self->versioned_epoch_stakes + i );
8680 6 : } while(0);
8681 6 : size += sizeof(char);
8682 6 : if( NULL != self->lthash ) {
8683 0 : size += fd_slot_lthash_size( self->lthash );
8684 0 : }
8685 6 : return size;
8686 6 : }
8687 :
8688 0 : int fd_solana_manifest_serializable_decode( fd_solana_manifest_serializable_t * self, fd_bincode_decode_ctx_t * ctx ) {
8689 0 : void const * data = ctx->data;
8690 0 : int err = fd_solana_manifest_serializable_decode_preflight( ctx );
8691 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8692 0 : ctx->data = data;
8693 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
8694 0 : fd_solana_manifest_serializable_new( self );
8695 0 : }
8696 0 : fd_solana_manifest_serializable_decode_unsafe( self, ctx );
8697 0 : return FD_BINCODE_SUCCESS;
8698 0 : }
8699 0 : int fd_solana_manifest_serializable_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
8700 0 : int err;
8701 0 : err = fd_serializable_versioned_bank_decode_preflight( ctx );
8702 0 : if( FD_UNLIKELY( err ) ) return err;
8703 0 : err = fd_solana_accounts_db_fields_decode_preflight( ctx );
8704 0 : if( FD_UNLIKELY( err ) ) return err;
8705 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8706 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8707 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8708 0 : {
8709 0 : uchar o;
8710 0 : err = fd_bincode_bool_decode( &o, ctx );
8711 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8712 0 : if( o ) {
8713 0 : err = fd_bank_incremental_snapshot_persistence_decode_preflight( ctx );
8714 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8715 0 : }
8716 0 : }
8717 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8718 0 : {
8719 0 : uchar o;
8720 0 : err = fd_bincode_bool_decode( &o, ctx );
8721 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8722 0 : if( o ) {
8723 0 : err = fd_hash_decode_preflight( ctx );
8724 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8725 0 : }
8726 0 : }
8727 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8728 0 : ulong versioned_epoch_stakes_len;
8729 0 : err = fd_bincode_uint64_decode( &versioned_epoch_stakes_len, ctx );
8730 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8731 0 : if( versioned_epoch_stakes_len ) {
8732 0 : for( ulong i=0; i < versioned_epoch_stakes_len; i++ ) {
8733 0 : err = fd_versioned_epoch_stakes_pair_decode_preflight( ctx );
8734 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8735 0 : }
8736 0 : }
8737 0 : return FD_BINCODE_SUCCESS;
8738 0 : }
8739 0 : void fd_solana_manifest_serializable_decode_unsafe( fd_solana_manifest_serializable_t * self, fd_bincode_decode_ctx_t * ctx ) {
8740 0 : fd_serializable_versioned_bank_decode_unsafe( &self->bank, ctx );
8741 0 : fd_solana_accounts_db_fields_decode_unsafe( &self->accounts_db, ctx );
8742 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
8743 0 : if( ctx->data == ctx->dataend ) return;
8744 0 : {
8745 0 : uchar o;
8746 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8747 0 : if( o ) {
8748 0 : self->bank_incremental_snapshot_persistence = (fd_bank_incremental_snapshot_persistence_t *)fd_valloc_malloc( ctx->valloc, FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN, FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_FOOTPRINT );
8749 0 : fd_bank_incremental_snapshot_persistence_new( self->bank_incremental_snapshot_persistence );
8750 0 : fd_bank_incremental_snapshot_persistence_decode_unsafe( self->bank_incremental_snapshot_persistence, ctx );
8751 0 : } else
8752 0 : self->bank_incremental_snapshot_persistence = NULL;
8753 0 : }
8754 0 : if( ctx->data == ctx->dataend ) return;
8755 0 : {
8756 0 : uchar o;
8757 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8758 0 : if( o ) {
8759 0 : self->epoch_account_hash = (fd_hash_t *)fd_valloc_malloc( ctx->valloc, FD_HASH_ALIGN, FD_HASH_FOOTPRINT );
8760 0 : fd_hash_new( self->epoch_account_hash );
8761 0 : fd_hash_decode_unsafe( self->epoch_account_hash, ctx );
8762 0 : } else
8763 0 : self->epoch_account_hash = NULL;
8764 0 : }
8765 0 : if( ctx->data == ctx->dataend ) return;
8766 0 : fd_bincode_uint64_decode_unsafe( &self->versioned_epoch_stakes_len, ctx );
8767 0 : if( self->versioned_epoch_stakes_len ) {
8768 0 : self->versioned_epoch_stakes = (fd_versioned_epoch_stakes_pair_t *)fd_valloc_malloc( ctx->valloc, FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN, FD_VERSIONED_EPOCH_STAKES_PAIR_FOOTPRINT*self->versioned_epoch_stakes_len );
8769 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
8770 0 : fd_versioned_epoch_stakes_pair_new( self->versioned_epoch_stakes + i );
8771 0 : fd_versioned_epoch_stakes_pair_decode_unsafe( self->versioned_epoch_stakes + i, ctx );
8772 0 : }
8773 0 : } else
8774 0 : self->versioned_epoch_stakes = NULL;
8775 0 : }
8776 0 : int fd_solana_manifest_serializable_encode( fd_solana_manifest_serializable_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8777 0 : int err;
8778 0 : err = fd_serializable_versioned_bank_encode( &self->bank, ctx );
8779 0 : if( FD_UNLIKELY( err ) ) return err;
8780 0 : err = fd_solana_accounts_db_fields_encode( &self->accounts_db, ctx );
8781 0 : if( FD_UNLIKELY( err ) ) return err;
8782 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
8783 0 : if( FD_UNLIKELY( err ) ) return err;
8784 0 : if( self->bank_incremental_snapshot_persistence != NULL ) {
8785 0 : err = fd_bincode_bool_encode( 1, ctx );
8786 0 : if( FD_UNLIKELY( err ) ) return err;
8787 0 : err = fd_bank_incremental_snapshot_persistence_encode( self->bank_incremental_snapshot_persistence, ctx );
8788 0 : if( FD_UNLIKELY( err ) ) return err;
8789 0 : } else {
8790 0 : err = fd_bincode_bool_encode( 0, ctx );
8791 0 : if( FD_UNLIKELY( err ) ) return err;
8792 0 : }
8793 0 : if( self->epoch_account_hash != NULL ) {
8794 0 : err = fd_bincode_bool_encode( 1, ctx );
8795 0 : if( FD_UNLIKELY( err ) ) return err;
8796 0 : err = fd_hash_encode( self->epoch_account_hash, ctx );
8797 0 : if( FD_UNLIKELY( err ) ) return err;
8798 0 : } else {
8799 0 : err = fd_bincode_bool_encode( 0, ctx );
8800 0 : if( FD_UNLIKELY( err ) ) return err;
8801 0 : }
8802 0 : err = fd_bincode_uint64_encode( self->versioned_epoch_stakes_len, ctx );
8803 0 : if( FD_UNLIKELY(err) ) return err;
8804 0 : if( self->versioned_epoch_stakes_len ) {
8805 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
8806 0 : err = fd_versioned_epoch_stakes_pair_encode( self->versioned_epoch_stakes + i, ctx );
8807 0 : if( FD_UNLIKELY( err ) ) return err;
8808 0 : }
8809 0 : }
8810 0 : return FD_BINCODE_SUCCESS;
8811 0 : }
8812 0 : int fd_solana_manifest_serializable_decode_offsets( fd_solana_manifest_serializable_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
8813 0 : uchar const * data = ctx->data;
8814 0 : int err;
8815 0 : self->bank_off = (uint)( (ulong)ctx->data - (ulong)data );
8816 0 : err = fd_serializable_versioned_bank_decode_preflight( ctx );
8817 0 : if( FD_UNLIKELY( err ) ) return err;
8818 0 : self->accounts_db_off = (uint)( (ulong)ctx->data - (ulong)data );
8819 0 : err = fd_solana_accounts_db_fields_decode_preflight( ctx );
8820 0 : if( FD_UNLIKELY( err ) ) return err;
8821 0 : self->lamports_per_signature_off = (uint)( (ulong)ctx->data - (ulong)data );
8822 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8823 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8824 0 : self->bank_incremental_snapshot_persistence_off = (uint)( (ulong)ctx->data - (ulong)data );
8825 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8826 0 : {
8827 0 : uchar o;
8828 0 : err = fd_bincode_bool_decode( &o, ctx );
8829 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8830 0 : if( o ) {
8831 0 : err = fd_bank_incremental_snapshot_persistence_decode_preflight( ctx );
8832 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8833 0 : }
8834 0 : }
8835 0 : self->epoch_account_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
8836 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8837 0 : {
8838 0 : uchar o;
8839 0 : err = fd_bincode_bool_decode( &o, ctx );
8840 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8841 0 : if( o ) {
8842 0 : err = fd_hash_decode_preflight( ctx );
8843 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8844 0 : }
8845 0 : }
8846 0 : self->versioned_epoch_stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
8847 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
8848 0 : ulong versioned_epoch_stakes_len;
8849 0 : err = fd_bincode_uint64_decode( &versioned_epoch_stakes_len, ctx );
8850 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8851 0 : if( versioned_epoch_stakes_len ) {
8852 0 : for( ulong i=0; i < versioned_epoch_stakes_len; i++ ) {
8853 0 : err = fd_versioned_epoch_stakes_pair_decode_preflight( ctx );
8854 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8855 0 : }
8856 0 : }
8857 0 : return FD_BINCODE_SUCCESS;
8858 0 : }
8859 0 : void fd_solana_manifest_serializable_new(fd_solana_manifest_serializable_t * self) {
8860 0 : fd_memset( self, 0, sizeof(fd_solana_manifest_serializable_t) );
8861 0 : fd_serializable_versioned_bank_new( &self->bank );
8862 0 : fd_solana_accounts_db_fields_new( &self->accounts_db );
8863 0 : }
8864 0 : void fd_solana_manifest_serializable_destroy( fd_solana_manifest_serializable_t * self, fd_bincode_destroy_ctx_t * ctx ) {
8865 0 : fd_serializable_versioned_bank_destroy( &self->bank, ctx );
8866 0 : fd_solana_accounts_db_fields_destroy( &self->accounts_db, ctx );
8867 0 : if( self->bank_incremental_snapshot_persistence ) {
8868 0 : fd_bank_incremental_snapshot_persistence_destroy( self->bank_incremental_snapshot_persistence, ctx );
8869 0 : fd_valloc_free( ctx->valloc, self->bank_incremental_snapshot_persistence );
8870 0 : self->bank_incremental_snapshot_persistence = NULL;
8871 0 : }
8872 0 : if( self->epoch_account_hash ) {
8873 0 : fd_hash_destroy( self->epoch_account_hash, ctx );
8874 0 : fd_valloc_free( ctx->valloc, self->epoch_account_hash );
8875 0 : self->epoch_account_hash = NULL;
8876 0 : }
8877 0 : if( self->versioned_epoch_stakes ) {
8878 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
8879 0 : fd_versioned_epoch_stakes_pair_destroy( self->versioned_epoch_stakes + i, ctx );
8880 0 : fd_valloc_free( ctx->valloc, self->versioned_epoch_stakes );
8881 0 : self->versioned_epoch_stakes = NULL;
8882 0 : }
8883 0 : }
8884 :
8885 0 : ulong fd_solana_manifest_serializable_footprint( void ){ return FD_SOLANA_MANIFEST_SERIALIZABLE_FOOTPRINT; }
8886 0 : ulong fd_solana_manifest_serializable_align( void ){ return FD_SOLANA_MANIFEST_SERIALIZABLE_ALIGN; }
8887 :
8888 0 : void fd_solana_manifest_serializable_walk( void * w, fd_solana_manifest_serializable_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8889 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_manifest_serializable", level++ );
8890 0 : fd_serializable_versioned_bank_walk( w, &self->bank, fun, "bank", level );
8891 0 : fd_solana_accounts_db_fields_walk( w, &self->accounts_db, fun, "accounts_db", level );
8892 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8893 0 : if( !self->bank_incremental_snapshot_persistence ) {
8894 0 : fun( w, NULL, "bank_incremental_snapshot_persistence", FD_FLAMENCO_TYPE_NULL, "bank_incremental_snapshot_persistence", level );
8895 0 : } else {
8896 0 : fd_bank_incremental_snapshot_persistence_walk( w, self->bank_incremental_snapshot_persistence, fun, "bank_incremental_snapshot_persistence", level );
8897 0 : }
8898 0 : if( !self->epoch_account_hash ) {
8899 0 : fun( w, NULL, "epoch_account_hash", FD_FLAMENCO_TYPE_NULL, "hash", level );
8900 0 : } else {
8901 0 : fd_hash_walk( w, self->epoch_account_hash, fun, "epoch_account_hash", level );
8902 0 : }
8903 0 : if( self->versioned_epoch_stakes_len ) {
8904 0 : fun( w, NULL, "versioned_epoch_stakes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
8905 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
8906 0 : fd_versioned_epoch_stakes_pair_walk(w, self->versioned_epoch_stakes + i, fun, "versioned_epoch_stakes_pair", level );
8907 0 : fun( w, NULL, "versioned_epoch_stakes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
8908 0 : }
8909 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_manifest_serializable", level-- );
8910 0 : }
8911 0 : ulong fd_solana_manifest_serializable_size( fd_solana_manifest_serializable_t const * self ) {
8912 0 : ulong size = 0;
8913 0 : size += fd_serializable_versioned_bank_size( &self->bank );
8914 0 : size += fd_solana_accounts_db_fields_size( &self->accounts_db );
8915 0 : size += sizeof(ulong);
8916 0 : size += sizeof(char);
8917 0 : if( NULL != self->bank_incremental_snapshot_persistence ) {
8918 0 : size += fd_bank_incremental_snapshot_persistence_size( self->bank_incremental_snapshot_persistence );
8919 0 : }
8920 0 : size += sizeof(char);
8921 0 : if( NULL != self->epoch_account_hash ) {
8922 0 : size += fd_hash_size( self->epoch_account_hash );
8923 0 : }
8924 0 : do {
8925 0 : size += sizeof(ulong);
8926 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
8927 0 : size += fd_versioned_epoch_stakes_pair_size( self->versioned_epoch_stakes + i );
8928 0 : } while(0);
8929 0 : return size;
8930 0 : }
8931 :
8932 0 : int fd_rust_duration_decode( fd_rust_duration_t * self, fd_bincode_decode_ctx_t * ctx ) {
8933 0 : void const * data = ctx->data;
8934 0 : int err = fd_rust_duration_decode_preflight( ctx );
8935 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8936 0 : ctx->data = data;
8937 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
8938 0 : fd_rust_duration_new( self );
8939 0 : }
8940 0 : fd_rust_duration_decode_unsafe( self, ctx );
8941 0 : return FD_BINCODE_SUCCESS;
8942 0 : }
8943 0 : int fd_rust_duration_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
8944 0 : return fd_bincode_bytes_decode_preflight( 12, ctx );
8945 0 : }
8946 0 : void fd_rust_duration_decode_unsafe( fd_rust_duration_t * self, fd_bincode_decode_ctx_t * ctx ) {
8947 0 : fd_bincode_uint64_decode_unsafe( &self->seconds, ctx );
8948 0 : fd_bincode_uint32_decode_unsafe( &self->nanoseconds, ctx );
8949 0 : }
8950 9 : int fd_rust_duration_encode( fd_rust_duration_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8951 9 : int err;
8952 9 : err = fd_bincode_uint64_encode( self->seconds, ctx );
8953 9 : if( FD_UNLIKELY( err ) ) return err;
8954 9 : err = fd_bincode_uint32_encode( self->nanoseconds, ctx );
8955 9 : if( FD_UNLIKELY( err ) ) return err;
8956 9 : return FD_BINCODE_SUCCESS;
8957 9 : }
8958 0 : int fd_rust_duration_decode_offsets( fd_rust_duration_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
8959 0 : uchar const * data = ctx->data;
8960 0 : int err;
8961 0 : self->seconds_off = (uint)( (ulong)ctx->data - (ulong)data );
8962 0 : err = fd_bincode_uint64_decode_preflight( ctx );
8963 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8964 0 : self->nanoseconds_off = (uint)( (ulong)ctx->data - (ulong)data );
8965 0 : err = fd_bincode_uint32_decode_preflight( ctx );
8966 0 : if( FD_UNLIKELY( err ) ) return err;
8967 0 : return FD_BINCODE_SUCCESS;
8968 0 : }
8969 12 : void fd_rust_duration_new(fd_rust_duration_t * self) {
8970 12 : fd_memset( self, 0, sizeof(fd_rust_duration_t) );
8971 12 : }
8972 0 : void fd_rust_duration_destroy( fd_rust_duration_t * self, fd_bincode_destroy_ctx_t * ctx ) {
8973 0 : }
8974 :
8975 0 : ulong fd_rust_duration_footprint( void ){ return FD_RUST_DURATION_FOOTPRINT; }
8976 0 : ulong fd_rust_duration_align( void ){ return FD_RUST_DURATION_ALIGN; }
8977 :
8978 0 : void fd_rust_duration_walk( void * w, fd_rust_duration_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
8979 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rust_duration", level++ );
8980 0 : fun( w, &self->seconds, "seconds", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
8981 0 : fun( w, &self->nanoseconds, "nanoseconds", FD_FLAMENCO_TYPE_UINT, "uint", level );
8982 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rust_duration", level-- );
8983 0 : }
8984 0 : ulong fd_rust_duration_size( fd_rust_duration_t const * self ) {
8985 0 : ulong size = 0;
8986 0 : size += sizeof(ulong);
8987 0 : size += sizeof(uint);
8988 0 : return size;
8989 0 : }
8990 :
8991 0 : int fd_poh_config_decode( fd_poh_config_t * self, fd_bincode_decode_ctx_t * ctx ) {
8992 0 : void const * data = ctx->data;
8993 0 : int err = fd_poh_config_decode_preflight( ctx );
8994 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8995 0 : ctx->data = data;
8996 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
8997 0 : fd_poh_config_new( self );
8998 0 : }
8999 0 : fd_poh_config_decode_unsafe( self, ctx );
9000 0 : return FD_BINCODE_SUCCESS;
9001 0 : }
9002 0 : int fd_poh_config_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
9003 0 : int err;
9004 0 : err = fd_rust_duration_decode_preflight( ctx );
9005 0 : if( FD_UNLIKELY( err ) ) return err;
9006 0 : {
9007 0 : uchar o;
9008 0 : err = fd_bincode_bool_decode( &o, ctx );
9009 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9010 0 : if( o ) {
9011 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9012 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9013 0 : }
9014 0 : }
9015 0 : {
9016 0 : uchar o;
9017 0 : err = fd_bincode_bool_decode( &o, ctx );
9018 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9019 0 : if( o ) {
9020 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9021 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9022 0 : }
9023 0 : }
9024 0 : return FD_BINCODE_SUCCESS;
9025 0 : }
9026 0 : void fd_poh_config_decode_unsafe( fd_poh_config_t * self, fd_bincode_decode_ctx_t * ctx ) {
9027 0 : fd_rust_duration_decode_unsafe( &self->target_tick_duration, ctx );
9028 0 : {
9029 0 : uchar o;
9030 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9031 0 : if( o ) {
9032 0 : self->target_tick_count = fd_valloc_malloc( ctx->valloc, 8, sizeof(ulong) );
9033 0 : fd_bincode_uint64_decode_unsafe( self->target_tick_count, ctx );
9034 0 : } else
9035 0 : self->target_tick_count = NULL;
9036 0 : }
9037 0 : {
9038 0 : uchar o;
9039 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9040 0 : self->has_hashes_per_tick = !!o;
9041 0 : if( o ) {
9042 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
9043 0 : }
9044 0 : }
9045 0 : }
9046 9 : int fd_poh_config_encode( fd_poh_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9047 9 : int err;
9048 9 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
9049 9 : if( FD_UNLIKELY( err ) ) return err;
9050 9 : if( self->target_tick_count != NULL ) {
9051 0 : err = fd_bincode_bool_encode( 1, ctx );
9052 0 : if( FD_UNLIKELY( err ) ) return err;
9053 0 : err = fd_bincode_uint64_encode( self->target_tick_count[0], ctx );
9054 0 : if( FD_UNLIKELY( err ) ) return err;
9055 9 : } else {
9056 9 : err = fd_bincode_bool_encode( 0, ctx );
9057 9 : if( FD_UNLIKELY( err ) ) return err;
9058 9 : }
9059 9 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
9060 9 : if( FD_UNLIKELY( err ) ) return err;
9061 9 : if( self->has_hashes_per_tick ) {
9062 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
9063 0 : if( FD_UNLIKELY( err ) ) return err;
9064 0 : }
9065 9 : return FD_BINCODE_SUCCESS;
9066 9 : }
9067 0 : int fd_poh_config_decode_offsets( fd_poh_config_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
9068 0 : uchar const * data = ctx->data;
9069 0 : int err;
9070 0 : self->target_tick_duration_off = (uint)( (ulong)ctx->data - (ulong)data );
9071 0 : err = fd_rust_duration_decode_preflight( ctx );
9072 0 : if( FD_UNLIKELY( err ) ) return err;
9073 0 : self->target_tick_count_off = (uint)( (ulong)ctx->data - (ulong)data );
9074 0 : {
9075 0 : uchar o;
9076 0 : err = fd_bincode_bool_decode( &o, ctx );
9077 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9078 0 : if( o ) {
9079 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9080 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9081 0 : }
9082 0 : }
9083 0 : self->hashes_per_tick_off = (uint)( (ulong)ctx->data - (ulong)data );
9084 0 : {
9085 0 : uchar o;
9086 0 : err = fd_bincode_bool_decode( &o, ctx );
9087 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9088 0 : if( o ) {
9089 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9090 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9091 0 : }
9092 0 : }
9093 0 : return FD_BINCODE_SUCCESS;
9094 0 : }
9095 12 : void fd_poh_config_new(fd_poh_config_t * self) {
9096 12 : fd_memset( self, 0, sizeof(fd_poh_config_t) );
9097 12 : fd_rust_duration_new( &self->target_tick_duration );
9098 12 : }
9099 0 : void fd_poh_config_destroy( fd_poh_config_t * self, fd_bincode_destroy_ctx_t * ctx ) {
9100 0 : fd_rust_duration_destroy( &self->target_tick_duration, ctx );
9101 0 : if( self->target_tick_count ) {
9102 0 : fd_valloc_free( ctx->valloc, self->target_tick_count );
9103 0 : self->target_tick_count = NULL;
9104 0 : }
9105 0 : if( self->has_hashes_per_tick ) {
9106 0 : self->has_hashes_per_tick = 0;
9107 0 : }
9108 0 : }
9109 :
9110 0 : ulong fd_poh_config_footprint( void ){ return FD_POH_CONFIG_FOOTPRINT; }
9111 0 : ulong fd_poh_config_align( void ){ return FD_POH_CONFIG_ALIGN; }
9112 :
9113 0 : void fd_poh_config_walk( void * w, fd_poh_config_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9114 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_poh_config", level++ );
9115 0 : fd_rust_duration_walk( w, &self->target_tick_duration, fun, "target_tick_duration", level );
9116 0 : if( !self->target_tick_count ) {
9117 0 : fun( w, NULL, "target_tick_count", FD_FLAMENCO_TYPE_NULL, "ulong", level );
9118 0 : } else {
9119 0 : fun( w, self->target_tick_count, "target_tick_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9120 0 : }
9121 0 : if( !self->has_hashes_per_tick ) {
9122 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level );
9123 0 : } else {
9124 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9125 0 : }
9126 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_poh_config", level-- );
9127 0 : }
9128 0 : ulong fd_poh_config_size( fd_poh_config_t const * self ) {
9129 0 : ulong size = 0;
9130 0 : size += fd_rust_duration_size( &self->target_tick_duration );
9131 0 : size += sizeof(char);
9132 0 : if( NULL != self->target_tick_count ) {
9133 0 : size += sizeof(ulong);
9134 0 : }
9135 0 : size += sizeof(char);
9136 0 : if( self->has_hashes_per_tick ) {
9137 0 : size += sizeof(ulong);
9138 0 : }
9139 0 : return size;
9140 0 : }
9141 :
9142 0 : int fd_string_pubkey_pair_decode( fd_string_pubkey_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
9143 0 : void const * data = ctx->data;
9144 0 : int err = fd_string_pubkey_pair_decode_preflight( ctx );
9145 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9146 0 : ctx->data = data;
9147 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
9148 0 : fd_string_pubkey_pair_new( self );
9149 0 : }
9150 0 : fd_string_pubkey_pair_decode_unsafe( self, ctx );
9151 0 : return FD_BINCODE_SUCCESS;
9152 0 : }
9153 0 : int fd_string_pubkey_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
9154 0 : int err;
9155 0 : ulong string_len;
9156 0 : err = fd_bincode_uint64_decode( &string_len, ctx );
9157 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9158 0 : if( string_len ) {
9159 0 : err = fd_bincode_bytes_decode_preflight( string_len, ctx );
9160 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9161 0 : err = !fd_utf8_verify( (char const *) ctx->data - string_len, string_len );
9162 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9163 0 : }
9164 0 : err = fd_pubkey_decode_preflight( ctx );
9165 0 : if( FD_UNLIKELY( err ) ) return err;
9166 0 : return FD_BINCODE_SUCCESS;
9167 0 : }
9168 0 : void fd_string_pubkey_pair_decode_unsafe( fd_string_pubkey_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
9169 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
9170 0 : if( self->string_len ) {
9171 0 : self->string = fd_valloc_malloc( ctx->valloc, 8UL, self->string_len );
9172 0 : fd_bincode_bytes_decode_unsafe( self->string, self->string_len, ctx );
9173 0 : } else
9174 0 : self->string = NULL;
9175 0 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
9176 0 : }
9177 0 : int fd_string_pubkey_pair_encode( fd_string_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9178 0 : int err;
9179 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
9180 0 : if( FD_UNLIKELY(err) ) return err;
9181 0 : if( self->string_len ) {
9182 0 : err = fd_bincode_bytes_encode( self->string, self->string_len, ctx );
9183 0 : if( FD_UNLIKELY( err ) ) return err;
9184 0 : }
9185 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
9186 0 : if( FD_UNLIKELY( err ) ) return err;
9187 0 : return FD_BINCODE_SUCCESS;
9188 0 : }
9189 0 : int fd_string_pubkey_pair_decode_offsets( fd_string_pubkey_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
9190 0 : uchar const * data = ctx->data;
9191 0 : int err;
9192 0 : self->string_off = (uint)( (ulong)ctx->data - (ulong)data );
9193 0 : ulong string_len;
9194 0 : err = fd_bincode_uint64_decode( &string_len, ctx );
9195 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9196 0 : if( string_len ) {
9197 0 : err = fd_bincode_bytes_decode_preflight( string_len, ctx );
9198 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9199 0 : err = !fd_utf8_verify( (char const *) ctx->data - string_len, string_len );
9200 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9201 0 : }
9202 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
9203 0 : err = fd_pubkey_decode_preflight( ctx );
9204 0 : if( FD_UNLIKELY( err ) ) return err;
9205 0 : return FD_BINCODE_SUCCESS;
9206 0 : }
9207 0 : void fd_string_pubkey_pair_new(fd_string_pubkey_pair_t * self) {
9208 0 : fd_memset( self, 0, sizeof(fd_string_pubkey_pair_t) );
9209 0 : fd_pubkey_new( &self->pubkey );
9210 0 : }
9211 0 : void fd_string_pubkey_pair_destroy( fd_string_pubkey_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
9212 0 : if( self->string ) {
9213 0 : fd_valloc_free( ctx->valloc, self->string );
9214 0 : self->string = NULL;
9215 0 : }
9216 0 : fd_pubkey_destroy( &self->pubkey, ctx );
9217 0 : }
9218 :
9219 0 : ulong fd_string_pubkey_pair_footprint( void ){ return FD_STRING_PUBKEY_PAIR_FOOTPRINT; }
9220 0 : ulong fd_string_pubkey_pair_align( void ){ return FD_STRING_PUBKEY_PAIR_ALIGN; }
9221 :
9222 0 : void fd_string_pubkey_pair_walk( void * w, fd_string_pubkey_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9223 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_string_pubkey_pair", level++ );
9224 0 : fun(w, self->string, "string", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
9225 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
9226 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_string_pubkey_pair", level-- );
9227 0 : }
9228 0 : ulong fd_string_pubkey_pair_size( fd_string_pubkey_pair_t const * self ) {
9229 0 : ulong size = 0;
9230 0 : do {
9231 0 : size += sizeof(ulong);
9232 0 : size += self->string_len;
9233 0 : } while(0);
9234 0 : size += fd_pubkey_size( &self->pubkey );
9235 0 : return size;
9236 0 : }
9237 :
9238 0 : int fd_pubkey_account_pair_decode( fd_pubkey_account_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
9239 0 : void const * data = ctx->data;
9240 0 : int err = fd_pubkey_account_pair_decode_preflight( ctx );
9241 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9242 0 : ctx->data = data;
9243 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
9244 0 : fd_pubkey_account_pair_new( self );
9245 0 : }
9246 0 : fd_pubkey_account_pair_decode_unsafe( self, ctx );
9247 0 : return FD_BINCODE_SUCCESS;
9248 0 : }
9249 0 : int fd_pubkey_account_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
9250 0 : int err;
9251 0 : err = fd_pubkey_decode_preflight( ctx );
9252 0 : if( FD_UNLIKELY( err ) ) return err;
9253 0 : err = fd_solana_account_decode_preflight( ctx );
9254 0 : if( FD_UNLIKELY( err ) ) return err;
9255 0 : return FD_BINCODE_SUCCESS;
9256 0 : }
9257 0 : void fd_pubkey_account_pair_decode_unsafe( fd_pubkey_account_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
9258 0 : fd_pubkey_decode_unsafe( &self->key, ctx );
9259 0 : fd_solana_account_decode_unsafe( &self->account, ctx );
9260 0 : }
9261 144 : int fd_pubkey_account_pair_encode( fd_pubkey_account_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9262 144 : int err;
9263 144 : err = fd_pubkey_encode( &self->key, ctx );
9264 144 : if( FD_UNLIKELY( err ) ) return err;
9265 144 : err = fd_solana_account_encode( &self->account, ctx );
9266 144 : if( FD_UNLIKELY( err ) ) return err;
9267 144 : return FD_BINCODE_SUCCESS;
9268 144 : }
9269 0 : int fd_pubkey_account_pair_decode_offsets( fd_pubkey_account_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
9270 0 : uchar const * data = ctx->data;
9271 0 : int err;
9272 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
9273 0 : err = fd_pubkey_decode_preflight( ctx );
9274 0 : if( FD_UNLIKELY( err ) ) return err;
9275 0 : self->account_off = (uint)( (ulong)ctx->data - (ulong)data );
9276 0 : err = fd_solana_account_decode_preflight( ctx );
9277 0 : if( FD_UNLIKELY( err ) ) return err;
9278 0 : return FD_BINCODE_SUCCESS;
9279 0 : }
9280 0 : void fd_pubkey_account_pair_new(fd_pubkey_account_pair_t * self) {
9281 0 : fd_memset( self, 0, sizeof(fd_pubkey_account_pair_t) );
9282 0 : fd_pubkey_new( &self->key );
9283 0 : fd_solana_account_new( &self->account );
9284 0 : }
9285 0 : void fd_pubkey_account_pair_destroy( fd_pubkey_account_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
9286 0 : fd_pubkey_destroy( &self->key, ctx );
9287 0 : fd_solana_account_destroy( &self->account, ctx );
9288 0 : }
9289 :
9290 0 : ulong fd_pubkey_account_pair_footprint( void ){ return FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT; }
9291 0 : ulong fd_pubkey_account_pair_align( void ){ return FD_PUBKEY_ACCOUNT_PAIR_ALIGN; }
9292 :
9293 0 : void fd_pubkey_account_pair_walk( void * w, fd_pubkey_account_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9294 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_account_pair", level++ );
9295 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
9296 0 : fd_solana_account_walk( w, &self->account, fun, "account", level );
9297 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_account_pair", level-- );
9298 0 : }
9299 0 : ulong fd_pubkey_account_pair_size( fd_pubkey_account_pair_t const * self ) {
9300 0 : ulong size = 0;
9301 0 : size += fd_pubkey_size( &self->key );
9302 0 : size += fd_solana_account_size( &self->account );
9303 0 : return size;
9304 0 : }
9305 :
9306 0 : int fd_genesis_solana_decode( fd_genesis_solana_t * self, fd_bincode_decode_ctx_t * ctx ) {
9307 0 : void const * data = ctx->data;
9308 0 : int err = fd_genesis_solana_decode_preflight( ctx );
9309 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9310 0 : ctx->data = data;
9311 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
9312 0 : fd_genesis_solana_new( self );
9313 0 : }
9314 0 : fd_genesis_solana_decode_unsafe( self, ctx );
9315 0 : return FD_BINCODE_SUCCESS;
9316 0 : }
9317 0 : int fd_genesis_solana_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
9318 0 : int err;
9319 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9320 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9321 0 : ulong accounts_len;
9322 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
9323 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9324 0 : if( accounts_len ) {
9325 0 : for( ulong i=0; i < accounts_len; i++ ) {
9326 0 : err = fd_pubkey_account_pair_decode_preflight( ctx );
9327 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9328 0 : }
9329 0 : }
9330 0 : ulong native_instruction_processors_len;
9331 0 : err = fd_bincode_uint64_decode( &native_instruction_processors_len, ctx );
9332 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9333 0 : if( native_instruction_processors_len ) {
9334 0 : for( ulong i=0; i < native_instruction_processors_len; i++ ) {
9335 0 : err = fd_string_pubkey_pair_decode_preflight( ctx );
9336 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9337 0 : }
9338 0 : }
9339 0 : ulong rewards_pools_len;
9340 0 : err = fd_bincode_uint64_decode( &rewards_pools_len, ctx );
9341 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9342 0 : if( rewards_pools_len ) {
9343 0 : for( ulong i=0; i < rewards_pools_len; i++ ) {
9344 0 : err = fd_pubkey_account_pair_decode_preflight( ctx );
9345 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9346 0 : }
9347 0 : }
9348 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9349 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9350 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9351 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9352 0 : err = fd_poh_config_decode_preflight( ctx );
9353 0 : if( FD_UNLIKELY( err ) ) return err;
9354 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9355 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9356 0 : err = fd_fee_rate_governor_decode_preflight( ctx );
9357 0 : if( FD_UNLIKELY( err ) ) return err;
9358 0 : err = fd_rent_decode_preflight( ctx );
9359 0 : if( FD_UNLIKELY( err ) ) return err;
9360 0 : err = fd_inflation_decode_preflight( ctx );
9361 0 : if( FD_UNLIKELY( err ) ) return err;
9362 0 : err = fd_epoch_schedule_decode_preflight( ctx );
9363 0 : if( FD_UNLIKELY( err ) ) return err;
9364 0 : err = fd_bincode_uint32_decode_preflight( ctx );
9365 0 : if( FD_UNLIKELY( err ) ) return err;
9366 0 : return FD_BINCODE_SUCCESS;
9367 0 : }
9368 0 : void fd_genesis_solana_decode_unsafe( fd_genesis_solana_t * self, fd_bincode_decode_ctx_t * ctx ) {
9369 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
9370 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
9371 0 : if( self->accounts_len ) {
9372 0 : self->accounts = (fd_pubkey_account_pair_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ACCOUNT_PAIR_ALIGN, FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT*self->accounts_len );
9373 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
9374 0 : fd_pubkey_account_pair_new( self->accounts + i );
9375 0 : fd_pubkey_account_pair_decode_unsafe( self->accounts + i, ctx );
9376 0 : }
9377 0 : } else
9378 0 : self->accounts = NULL;
9379 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
9380 0 : if( self->native_instruction_processors_len ) {
9381 0 : self->native_instruction_processors = (fd_string_pubkey_pair_t *)fd_valloc_malloc( ctx->valloc, FD_STRING_PUBKEY_PAIR_ALIGN, FD_STRING_PUBKEY_PAIR_FOOTPRINT*self->native_instruction_processors_len );
9382 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
9383 0 : fd_string_pubkey_pair_new( self->native_instruction_processors + i );
9384 0 : fd_string_pubkey_pair_decode_unsafe( self->native_instruction_processors + i, ctx );
9385 0 : }
9386 0 : } else
9387 0 : self->native_instruction_processors = NULL;
9388 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
9389 0 : if( self->rewards_pools_len ) {
9390 0 : self->rewards_pools = (fd_pubkey_account_pair_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ACCOUNT_PAIR_ALIGN, FD_PUBKEY_ACCOUNT_PAIR_FOOTPRINT*self->rewards_pools_len );
9391 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
9392 0 : fd_pubkey_account_pair_new( self->rewards_pools + i );
9393 0 : fd_pubkey_account_pair_decode_unsafe( self->rewards_pools + i, ctx );
9394 0 : }
9395 0 : } else
9396 0 : self->rewards_pools = NULL;
9397 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
9398 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
9399 0 : fd_poh_config_decode_unsafe( &self->poh_config, ctx );
9400 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
9401 0 : fd_fee_rate_governor_decode_unsafe( &self->fee_rate_governor, ctx );
9402 0 : fd_rent_decode_unsafe( &self->rent, ctx );
9403 0 : fd_inflation_decode_unsafe( &self->inflation, ctx );
9404 0 : fd_epoch_schedule_decode_unsafe( &self->epoch_schedule, ctx );
9405 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
9406 0 : }
9407 12 : int fd_genesis_solana_encode( fd_genesis_solana_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9408 12 : int err;
9409 12 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
9410 12 : if( FD_UNLIKELY( err ) ) return err;
9411 9 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
9412 9 : if( FD_UNLIKELY(err) ) return err;
9413 9 : if( self->accounts_len ) {
9414 153 : for( ulong i=0; i < self->accounts_len; i++ ) {
9415 144 : err = fd_pubkey_account_pair_encode( self->accounts + i, ctx );
9416 144 : if( FD_UNLIKELY( err ) ) return err;
9417 144 : }
9418 9 : }
9419 9 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
9420 9 : if( FD_UNLIKELY(err) ) return err;
9421 9 : if( self->native_instruction_processors_len ) {
9422 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
9423 0 : err = fd_string_pubkey_pair_encode( self->native_instruction_processors + i, ctx );
9424 0 : if( FD_UNLIKELY( err ) ) return err;
9425 0 : }
9426 0 : }
9427 9 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
9428 9 : if( FD_UNLIKELY(err) ) return err;
9429 9 : if( self->rewards_pools_len ) {
9430 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
9431 0 : err = fd_pubkey_account_pair_encode( self->rewards_pools + i, ctx );
9432 0 : if( FD_UNLIKELY( err ) ) return err;
9433 0 : }
9434 0 : }
9435 9 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
9436 9 : if( FD_UNLIKELY( err ) ) return err;
9437 9 : err = fd_bincode_uint64_encode( self->unused, ctx );
9438 9 : if( FD_UNLIKELY( err ) ) return err;
9439 9 : err = fd_poh_config_encode( &self->poh_config, ctx );
9440 9 : if( FD_UNLIKELY( err ) ) return err;
9441 9 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
9442 9 : if( FD_UNLIKELY( err ) ) return err;
9443 9 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
9444 9 : if( FD_UNLIKELY( err ) ) return err;
9445 9 : err = fd_rent_encode( &self->rent, ctx );
9446 9 : if( FD_UNLIKELY( err ) ) return err;
9447 9 : err = fd_inflation_encode( &self->inflation, ctx );
9448 9 : if( FD_UNLIKELY( err ) ) return err;
9449 9 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
9450 9 : if( FD_UNLIKELY( err ) ) return err;
9451 9 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
9452 9 : if( FD_UNLIKELY( err ) ) return err;
9453 9 : return FD_BINCODE_SUCCESS;
9454 9 : }
9455 0 : int fd_genesis_solana_decode_offsets( fd_genesis_solana_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
9456 0 : uchar const * data = ctx->data;
9457 0 : int err;
9458 0 : self->creation_time_off = (uint)( (ulong)ctx->data - (ulong)data );
9459 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9460 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9461 0 : self->accounts_off = (uint)( (ulong)ctx->data - (ulong)data );
9462 0 : ulong accounts_len;
9463 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
9464 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9465 0 : if( accounts_len ) {
9466 0 : for( ulong i=0; i < accounts_len; i++ ) {
9467 0 : err = fd_pubkey_account_pair_decode_preflight( ctx );
9468 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9469 0 : }
9470 0 : }
9471 0 : self->native_instruction_processors_off = (uint)( (ulong)ctx->data - (ulong)data );
9472 0 : ulong native_instruction_processors_len;
9473 0 : err = fd_bincode_uint64_decode( &native_instruction_processors_len, ctx );
9474 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9475 0 : if( native_instruction_processors_len ) {
9476 0 : for( ulong i=0; i < native_instruction_processors_len; i++ ) {
9477 0 : err = fd_string_pubkey_pair_decode_preflight( ctx );
9478 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9479 0 : }
9480 0 : }
9481 0 : self->rewards_pools_off = (uint)( (ulong)ctx->data - (ulong)data );
9482 0 : ulong rewards_pools_len;
9483 0 : err = fd_bincode_uint64_decode( &rewards_pools_len, ctx );
9484 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9485 0 : if( rewards_pools_len ) {
9486 0 : for( ulong i=0; i < rewards_pools_len; i++ ) {
9487 0 : err = fd_pubkey_account_pair_decode_preflight( ctx );
9488 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9489 0 : }
9490 0 : }
9491 0 : self->ticks_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
9492 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9493 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9494 0 : self->unused_off = (uint)( (ulong)ctx->data - (ulong)data );
9495 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9496 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9497 0 : self->poh_config_off = (uint)( (ulong)ctx->data - (ulong)data );
9498 0 : err = fd_poh_config_decode_preflight( ctx );
9499 0 : if( FD_UNLIKELY( err ) ) return err;
9500 0 : self->__backwards_compat_with_v0_23_off = (uint)( (ulong)ctx->data - (ulong)data );
9501 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9502 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9503 0 : self->fee_rate_governor_off = (uint)( (ulong)ctx->data - (ulong)data );
9504 0 : err = fd_fee_rate_governor_decode_preflight( ctx );
9505 0 : if( FD_UNLIKELY( err ) ) return err;
9506 0 : self->rent_off = (uint)( (ulong)ctx->data - (ulong)data );
9507 0 : err = fd_rent_decode_preflight( ctx );
9508 0 : if( FD_UNLIKELY( err ) ) return err;
9509 0 : self->inflation_off = (uint)( (ulong)ctx->data - (ulong)data );
9510 0 : err = fd_inflation_decode_preflight( ctx );
9511 0 : if( FD_UNLIKELY( err ) ) return err;
9512 0 : self->epoch_schedule_off = (uint)( (ulong)ctx->data - (ulong)data );
9513 0 : err = fd_epoch_schedule_decode_preflight( ctx );
9514 0 : if( FD_UNLIKELY( err ) ) return err;
9515 0 : self->cluster_type_off = (uint)( (ulong)ctx->data - (ulong)data );
9516 0 : err = fd_bincode_uint32_decode_preflight( ctx );
9517 0 : if( FD_UNLIKELY( err ) ) return err;
9518 0 : return FD_BINCODE_SUCCESS;
9519 0 : }
9520 12 : void fd_genesis_solana_new(fd_genesis_solana_t * self) {
9521 12 : fd_memset( self, 0, sizeof(fd_genesis_solana_t) );
9522 12 : fd_poh_config_new( &self->poh_config );
9523 12 : fd_fee_rate_governor_new( &self->fee_rate_governor );
9524 12 : fd_rent_new( &self->rent );
9525 12 : fd_inflation_new( &self->inflation );
9526 12 : fd_epoch_schedule_new( &self->epoch_schedule );
9527 12 : }
9528 0 : void fd_genesis_solana_destroy( fd_genesis_solana_t * self, fd_bincode_destroy_ctx_t * ctx ) {
9529 0 : if( self->accounts ) {
9530 0 : for( ulong i=0; i < self->accounts_len; i++ )
9531 0 : fd_pubkey_account_pair_destroy( self->accounts + i, ctx );
9532 0 : fd_valloc_free( ctx->valloc, self->accounts );
9533 0 : self->accounts = NULL;
9534 0 : }
9535 0 : if( self->native_instruction_processors ) {
9536 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
9537 0 : fd_string_pubkey_pair_destroy( self->native_instruction_processors + i, ctx );
9538 0 : fd_valloc_free( ctx->valloc, self->native_instruction_processors );
9539 0 : self->native_instruction_processors = NULL;
9540 0 : }
9541 0 : if( self->rewards_pools ) {
9542 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
9543 0 : fd_pubkey_account_pair_destroy( self->rewards_pools + i, ctx );
9544 0 : fd_valloc_free( ctx->valloc, self->rewards_pools );
9545 0 : self->rewards_pools = NULL;
9546 0 : }
9547 0 : fd_poh_config_destroy( &self->poh_config, ctx );
9548 0 : fd_fee_rate_governor_destroy( &self->fee_rate_governor, ctx );
9549 0 : fd_rent_destroy( &self->rent, ctx );
9550 0 : fd_inflation_destroy( &self->inflation, ctx );
9551 0 : fd_epoch_schedule_destroy( &self->epoch_schedule, ctx );
9552 0 : }
9553 :
9554 0 : ulong fd_genesis_solana_footprint( void ){ return FD_GENESIS_SOLANA_FOOTPRINT; }
9555 0 : ulong fd_genesis_solana_align( void ){ return FD_GENESIS_SOLANA_ALIGN; }
9556 :
9557 0 : void fd_genesis_solana_walk( void * w, fd_genesis_solana_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9558 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_genesis_solana", level++ );
9559 0 : fun( w, &self->creation_time, "creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9560 0 : if( self->accounts_len ) {
9561 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
9562 0 : for( ulong i=0; i < self->accounts_len; i++ )
9563 0 : fd_pubkey_account_pair_walk(w, self->accounts + i, fun, "pubkey_account_pair", level );
9564 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
9565 0 : }
9566 0 : if( self->native_instruction_processors_len ) {
9567 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR, "array", level++ );
9568 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
9569 0 : fd_string_pubkey_pair_walk(w, self->native_instruction_processors + i, fun, "string_pubkey_pair", level );
9570 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
9571 0 : }
9572 0 : if( self->rewards_pools_len ) {
9573 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR, "array", level++ );
9574 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
9575 0 : fd_pubkey_account_pair_walk(w, self->rewards_pools + i, fun, "pubkey_account_pair", level );
9576 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
9577 0 : }
9578 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9579 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9580 0 : fd_poh_config_walk( w, &self->poh_config, fun, "poh_config", level );
9581 0 : fun( w, &self->__backwards_compat_with_v0_23, "__backwards_compat_with_v0_23", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9582 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level );
9583 0 : fd_rent_walk( w, &self->rent, fun, "rent", level );
9584 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level );
9585 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
9586 0 : fun( w, &self->cluster_type, "cluster_type", FD_FLAMENCO_TYPE_UINT, "uint", level );
9587 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_genesis_solana", level-- );
9588 0 : }
9589 0 : ulong fd_genesis_solana_size( fd_genesis_solana_t const * self ) {
9590 0 : ulong size = 0;
9591 0 : size += sizeof(ulong);
9592 0 : do {
9593 0 : size += sizeof(ulong);
9594 0 : for( ulong i=0; i < self->accounts_len; i++ )
9595 0 : size += fd_pubkey_account_pair_size( self->accounts + i );
9596 0 : } while(0);
9597 0 : do {
9598 0 : size += sizeof(ulong);
9599 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
9600 0 : size += fd_string_pubkey_pair_size( self->native_instruction_processors + i );
9601 0 : } while(0);
9602 0 : do {
9603 0 : size += sizeof(ulong);
9604 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
9605 0 : size += fd_pubkey_account_pair_size( self->rewards_pools + i );
9606 0 : } while(0);
9607 0 : size += sizeof(ulong);
9608 0 : size += sizeof(ulong);
9609 0 : size += fd_poh_config_size( &self->poh_config );
9610 0 : size += sizeof(ulong);
9611 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
9612 0 : size += fd_rent_size( &self->rent );
9613 0 : size += fd_inflation_size( &self->inflation );
9614 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
9615 0 : size += sizeof(uint);
9616 0 : return size;
9617 0 : }
9618 :
9619 72438 : int fd_sol_sysvar_clock_decode( fd_sol_sysvar_clock_t * self, fd_bincode_decode_ctx_t * ctx ) {
9620 72438 : void const * data = ctx->data;
9621 72438 : int err = fd_sol_sysvar_clock_decode_preflight( ctx );
9622 72438 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9623 72381 : ctx->data = data;
9624 72381 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
9625 56946 : fd_sol_sysvar_clock_new( self );
9626 56946 : }
9627 72381 : fd_sol_sysvar_clock_decode_unsafe( self, ctx );
9628 72381 : return FD_BINCODE_SUCCESS;
9629 72438 : }
9630 72438 : int fd_sol_sysvar_clock_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
9631 72438 : return fd_bincode_bytes_decode_preflight( 40, ctx );
9632 72438 : }
9633 72381 : void fd_sol_sysvar_clock_decode_unsafe( fd_sol_sysvar_clock_t * self, fd_bincode_decode_ctx_t * ctx ) {
9634 72381 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
9635 72381 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
9636 72381 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
9637 72381 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
9638 72381 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
9639 72381 : }
9640 19848 : int fd_sol_sysvar_clock_encode( fd_sol_sysvar_clock_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9641 19848 : int err;
9642 19848 : err = fd_bincode_uint64_encode( self->slot, ctx );
9643 19848 : if( FD_UNLIKELY( err ) ) return err;
9644 19848 : err = fd_bincode_uint64_encode( (ulong)self->epoch_start_timestamp, ctx );
9645 19848 : if( FD_UNLIKELY( err ) ) return err;
9646 19848 : err = fd_bincode_uint64_encode( self->epoch, ctx );
9647 19848 : if( FD_UNLIKELY( err ) ) return err;
9648 19848 : err = fd_bincode_uint64_encode( self->leader_schedule_epoch, ctx );
9649 19848 : if( FD_UNLIKELY( err ) ) return err;
9650 19848 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
9651 19848 : if( FD_UNLIKELY( err ) ) return err;
9652 19848 : return FD_BINCODE_SUCCESS;
9653 19848 : }
9654 0 : int fd_sol_sysvar_clock_decode_offsets( fd_sol_sysvar_clock_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
9655 0 : uchar const * data = ctx->data;
9656 0 : int err;
9657 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
9658 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9659 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9660 0 : self->epoch_start_timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
9661 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9662 0 : if( FD_UNLIKELY( err ) ) return err;
9663 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
9664 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9665 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9666 0 : self->leader_schedule_epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
9667 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9668 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9669 0 : self->unix_timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
9670 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9671 0 : if( FD_UNLIKELY( err ) ) return err;
9672 0 : return FD_BINCODE_SUCCESS;
9673 0 : }
9674 57069 : void fd_sol_sysvar_clock_new(fd_sol_sysvar_clock_t * self) {
9675 57069 : fd_memset( self, 0, sizeof(fd_sol_sysvar_clock_t) );
9676 57069 : }
9677 454938 : void fd_sol_sysvar_clock_destroy( fd_sol_sysvar_clock_t * self, fd_bincode_destroy_ctx_t * ctx ) {
9678 454938 : }
9679 :
9680 0 : ulong fd_sol_sysvar_clock_footprint( void ){ return FD_SOL_SYSVAR_CLOCK_FOOTPRINT; }
9681 0 : ulong fd_sol_sysvar_clock_align( void ){ return FD_SOL_SYSVAR_CLOCK_ALIGN; }
9682 :
9683 0 : void fd_sol_sysvar_clock_walk( void * w, fd_sol_sysvar_clock_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9684 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_clock", level++ );
9685 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9686 0 : fun( w, &self->epoch_start_timestamp, "epoch_start_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
9687 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9688 0 : fun( w, &self->leader_schedule_epoch, "leader_schedule_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9689 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
9690 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_clock", level-- );
9691 0 : }
9692 19848 : ulong fd_sol_sysvar_clock_size( fd_sol_sysvar_clock_t const * self ) {
9693 19848 : ulong size = 0;
9694 19848 : size += sizeof(ulong);
9695 19848 : size += sizeof(long);
9696 19848 : size += sizeof(ulong);
9697 19848 : size += sizeof(ulong);
9698 19848 : size += sizeof(long);
9699 19848 : return size;
9700 19848 : }
9701 :
9702 5322 : int fd_sol_sysvar_last_restart_slot_decode( fd_sol_sysvar_last_restart_slot_t * self, fd_bincode_decode_ctx_t * ctx ) {
9703 5322 : void const * data = ctx->data;
9704 5322 : int err = fd_sol_sysvar_last_restart_slot_decode_preflight( ctx );
9705 5322 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9706 5280 : ctx->data = data;
9707 5280 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
9708 5280 : fd_sol_sysvar_last_restart_slot_new( self );
9709 5280 : }
9710 5280 : fd_sol_sysvar_last_restart_slot_decode_unsafe( self, ctx );
9711 5280 : return FD_BINCODE_SUCCESS;
9712 5322 : }
9713 5322 : int fd_sol_sysvar_last_restart_slot_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
9714 5322 : return fd_bincode_bytes_decode_preflight( 8, ctx );
9715 5322 : }
9716 5280 : void fd_sol_sysvar_last_restart_slot_decode_unsafe( fd_sol_sysvar_last_restart_slot_t * self, fd_bincode_decode_ctx_t * ctx ) {
9717 5280 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
9718 5280 : }
9719 1935 : int fd_sol_sysvar_last_restart_slot_encode( fd_sol_sysvar_last_restart_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9720 1935 : int err;
9721 1935 : err = fd_bincode_uint64_encode( self->slot, ctx );
9722 1935 : if( FD_UNLIKELY( err ) ) return err;
9723 1935 : return FD_BINCODE_SUCCESS;
9724 1935 : }
9725 : enum {
9726 : fd_sol_sysvar_last_restart_slot_slot_TAG = (0 << 6) | FD_ARCHIVE_META_ULONG,
9727 : };
9728 0 : int fd_sol_sysvar_last_restart_slot_decode_archival( fd_sol_sysvar_last_restart_slot_t * self, fd_bincode_decode_ctx_t * ctx ) {
9729 0 : void const * data = ctx->data;
9730 0 : int err = fd_sol_sysvar_last_restart_slot_decode_archival_preflight( ctx );
9731 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9732 0 : ctx->data = data;
9733 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
9734 0 : fd_sol_sysvar_last_restart_slot_new( self );
9735 0 : }
9736 0 : fd_sol_sysvar_last_restart_slot_decode_archival_unsafe( self, ctx );
9737 0 : return FD_BINCODE_SUCCESS;
9738 0 : }
9739 0 : int fd_sol_sysvar_last_restart_slot_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
9740 0 : int err;
9741 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
9742 0 : void * offset = NULL;
9743 0 : for(;;) {
9744 0 : err = fd_bincode_uint16_decode( &tag, ctx );
9745 0 : if( FD_UNLIKELY( err ) ) return err;
9746 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
9747 0 : switch( tag ) {
9748 0 : case (ushort)fd_sol_sysvar_last_restart_slot_slot_TAG: {
9749 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9750 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9751 0 : break;
9752 0 : }
9753 0 : default:
9754 0 : err = fd_archive_decode_skip_field( ctx, tag );
9755 0 : if( FD_UNLIKELY( err ) ) return err;
9756 0 : break;
9757 0 : }
9758 0 : }
9759 0 : return FD_BINCODE_SUCCESS;
9760 0 : }
9761 0 : void fd_sol_sysvar_last_restart_slot_decode_archival_unsafe( fd_sol_sysvar_last_restart_slot_t * self, fd_bincode_decode_ctx_t * ctx ) {
9762 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
9763 0 : void * offset = NULL;
9764 0 : for(;;) {
9765 0 : fd_bincode_uint16_decode( &tag, ctx );
9766 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
9767 0 : switch( tag ) {
9768 0 : case (ushort)fd_sol_sysvar_last_restart_slot_slot_TAG: {
9769 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
9770 0 : break;
9771 0 : }
9772 0 : default:
9773 0 : fd_archive_decode_skip_field( ctx, tag );
9774 0 : break;
9775 0 : }
9776 0 : }
9777 0 : }
9778 0 : int fd_sol_sysvar_last_restart_slot_encode_archival( fd_sol_sysvar_last_restart_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9779 0 : int err;
9780 0 : void * offset = NULL;
9781 0 : err = fd_bincode_uint16_encode( (ushort)fd_sol_sysvar_last_restart_slot_slot_TAG, ctx );
9782 0 : if( FD_UNLIKELY( err ) ) return err;
9783 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
9784 0 : if( FD_UNLIKELY( err ) ) return err;
9785 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
9786 0 : if( FD_UNLIKELY( err ) ) return err;
9787 0 : return FD_BINCODE_SUCCESS;
9788 0 : }
9789 0 : int fd_sol_sysvar_last_restart_slot_decode_offsets( fd_sol_sysvar_last_restart_slot_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
9790 0 : uchar const * data = ctx->data;
9791 0 : int err;
9792 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
9793 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9794 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9795 0 : return FD_BINCODE_SUCCESS;
9796 0 : }
9797 820998 : void fd_sol_sysvar_last_restart_slot_new(fd_sol_sysvar_last_restart_slot_t * self) {
9798 820998 : fd_memset( self, 0, sizeof(fd_sol_sysvar_last_restart_slot_t) );
9799 820998 : }
9800 1228899 : void fd_sol_sysvar_last_restart_slot_destroy( fd_sol_sysvar_last_restart_slot_t * self, fd_bincode_destroy_ctx_t * ctx ) {
9801 1228899 : }
9802 :
9803 0 : ulong fd_sol_sysvar_last_restart_slot_footprint( void ){ return FD_SOL_SYSVAR_LAST_RESTART_SLOT_FOOTPRINT; }
9804 0 : ulong fd_sol_sysvar_last_restart_slot_align( void ){ return FD_SOL_SYSVAR_LAST_RESTART_SLOT_ALIGN; }
9805 :
9806 0 : void fd_sol_sysvar_last_restart_slot_walk( void * w, fd_sol_sysvar_last_restart_slot_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9807 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_last_restart_slot", level++ );
9808 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9809 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_last_restart_slot", level-- );
9810 0 : }
9811 1935 : ulong fd_sol_sysvar_last_restart_slot_size( fd_sol_sysvar_last_restart_slot_t const * self ) {
9812 1935 : ulong size = 0;
9813 1935 : size += sizeof(ulong);
9814 1935 : return size;
9815 1935 : }
9816 :
9817 0 : int fd_vote_lockout_decode( fd_vote_lockout_t * self, fd_bincode_decode_ctx_t * ctx ) {
9818 0 : void const * data = ctx->data;
9819 0 : int err = fd_vote_lockout_decode_preflight( ctx );
9820 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9821 0 : ctx->data = data;
9822 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
9823 0 : fd_vote_lockout_new( self );
9824 0 : }
9825 0 : fd_vote_lockout_decode_unsafe( self, ctx );
9826 0 : return FD_BINCODE_SUCCESS;
9827 0 : }
9828 0 : int fd_vote_lockout_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
9829 0 : return fd_bincode_bytes_decode_preflight( 12, ctx );
9830 0 : }
9831 239397 : void fd_vote_lockout_decode_unsafe( fd_vote_lockout_t * self, fd_bincode_decode_ctx_t * ctx ) {
9832 239397 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
9833 239397 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
9834 239397 : }
9835 10389 : int fd_vote_lockout_encode( fd_vote_lockout_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9836 10389 : int err;
9837 10389 : err = fd_bincode_uint64_encode( self->slot, ctx );
9838 10389 : if( FD_UNLIKELY( err ) ) return err;
9839 10389 : err = fd_bincode_uint32_encode( self->confirmation_count, ctx );
9840 10389 : if( FD_UNLIKELY( err ) ) return err;
9841 10389 : return FD_BINCODE_SUCCESS;
9842 10389 : }
9843 0 : int fd_vote_lockout_decode_offsets( fd_vote_lockout_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
9844 0 : uchar const * data = ctx->data;
9845 0 : int err;
9846 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
9847 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9848 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9849 0 : self->confirmation_count_off = (uint)( (ulong)ctx->data - (ulong)data );
9850 0 : err = fd_bincode_uint32_decode_preflight( ctx );
9851 0 : if( FD_UNLIKELY( err ) ) return err;
9852 0 : return FD_BINCODE_SUCCESS;
9853 0 : }
9854 350388 : void fd_vote_lockout_new(fd_vote_lockout_t * self) {
9855 350388 : fd_memset( self, 0, sizeof(fd_vote_lockout_t) );
9856 350388 : }
9857 110817 : void fd_vote_lockout_destroy( fd_vote_lockout_t * self, fd_bincode_destroy_ctx_t * ctx ) {
9858 110817 : }
9859 :
9860 0 : ulong fd_vote_lockout_footprint( void ){ return FD_VOTE_LOCKOUT_FOOTPRINT; }
9861 0 : ulong fd_vote_lockout_align( void ){ return FD_VOTE_LOCKOUT_ALIGN; }
9862 :
9863 3 : void fd_vote_lockout_walk( void * w, fd_vote_lockout_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9864 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_lockout", level++ );
9865 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9866 3 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UINT, "uint", level );
9867 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_lockout", level-- );
9868 3 : }
9869 11580 : ulong fd_vote_lockout_size( fd_vote_lockout_t const * self ) {
9870 11580 : ulong size = 0;
9871 11580 : size += sizeof(ulong);
9872 11580 : size += sizeof(uint);
9873 11580 : return size;
9874 11580 : }
9875 :
9876 0 : int fd_lockout_offset_decode( fd_lockout_offset_t * self, fd_bincode_decode_ctx_t * ctx ) {
9877 0 : void const * data = ctx->data;
9878 0 : int err = fd_lockout_offset_decode_preflight( ctx );
9879 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9880 0 : ctx->data = data;
9881 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
9882 0 : fd_lockout_offset_new( self );
9883 0 : }
9884 0 : fd_lockout_offset_decode_unsafe( self, ctx );
9885 0 : return FD_BINCODE_SUCCESS;
9886 0 : }
9887 77853 : int fd_lockout_offset_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
9888 77853 : int err;
9889 77853 : err = fd_bincode_varint_decode_preflight( ctx );
9890 77853 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9891 77577 : err = fd_bincode_uint8_decode_preflight( ctx );
9892 77577 : if( FD_UNLIKELY( err ) ) return err;
9893 77544 : return FD_BINCODE_SUCCESS;
9894 77577 : }
9895 11700 : void fd_lockout_offset_decode_unsafe( fd_lockout_offset_t * self, fd_bincode_decode_ctx_t * ctx ) {
9896 11700 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
9897 11700 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
9898 11700 : }
9899 0 : int fd_lockout_offset_encode( fd_lockout_offset_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9900 0 : int err;
9901 0 : err = fd_bincode_varint_encode( self->offset, ctx );
9902 0 : if( FD_UNLIKELY( err ) ) return err;
9903 0 : err = fd_bincode_uint8_encode( (uchar)(self->confirmation_count), ctx );
9904 0 : if( FD_UNLIKELY( err ) ) return err;
9905 0 : return FD_BINCODE_SUCCESS;
9906 0 : }
9907 0 : int fd_lockout_offset_decode_offsets( fd_lockout_offset_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
9908 0 : uchar const * data = ctx->data;
9909 0 : int err;
9910 0 : self->offset_off = (uint)( (ulong)ctx->data - (ulong)data );
9911 0 : err = fd_bincode_varint_decode_preflight( ctx );
9912 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9913 0 : self->confirmation_count_off = (uint)( (ulong)ctx->data - (ulong)data );
9914 0 : err = fd_bincode_uint8_decode_preflight( ctx );
9915 0 : if( FD_UNLIKELY( err ) ) return err;
9916 0 : return FD_BINCODE_SUCCESS;
9917 0 : }
9918 9432 : void fd_lockout_offset_new(fd_lockout_offset_t * self) {
9919 9432 : fd_memset( self, 0, sizeof(fd_lockout_offset_t) );
9920 9432 : }
9921 0 : void fd_lockout_offset_destroy( fd_lockout_offset_t * self, fd_bincode_destroy_ctx_t * ctx ) {
9922 0 : }
9923 :
9924 0 : ulong fd_lockout_offset_footprint( void ){ return FD_LOCKOUT_OFFSET_FOOTPRINT; }
9925 0 : ulong fd_lockout_offset_align( void ){ return FD_LOCKOUT_OFFSET_ALIGN; }
9926 :
9927 0 : void fd_lockout_offset_walk( void * w, fd_lockout_offset_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9928 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockout_offset", level++ );
9929 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9930 0 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
9931 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockout_offset", level-- );
9932 0 : }
9933 0 : ulong fd_lockout_offset_size( fd_lockout_offset_t const * self ) {
9934 0 : ulong size = 0;
9935 0 : size += fd_bincode_varint_size( self->offset );
9936 0 : size += sizeof(char);
9937 0 : return size;
9938 0 : }
9939 :
9940 0 : int fd_vote_authorized_voter_decode( fd_vote_authorized_voter_t * self, fd_bincode_decode_ctx_t * ctx ) {
9941 0 : void const * data = ctx->data;
9942 0 : int err = fd_vote_authorized_voter_decode_preflight( ctx );
9943 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9944 0 : ctx->data = data;
9945 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
9946 0 : fd_vote_authorized_voter_new( self );
9947 0 : }
9948 0 : fd_vote_authorized_voter_decode_unsafe( self, ctx );
9949 0 : return FD_BINCODE_SUCCESS;
9950 0 : }
9951 131478 : int fd_vote_authorized_voter_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
9952 131478 : return fd_bincode_bytes_decode_preflight( 40, ctx );
9953 131478 : }
9954 108234 : void fd_vote_authorized_voter_decode_unsafe( fd_vote_authorized_voter_t * self, fd_bincode_decode_ctx_t * ctx ) {
9955 108234 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
9956 108234 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
9957 108234 : }
9958 6111 : int fd_vote_authorized_voter_encode( fd_vote_authorized_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9959 6111 : int err;
9960 6111 : err = fd_bincode_uint64_encode( self->epoch, ctx );
9961 6111 : if( FD_UNLIKELY( err ) ) return err;
9962 6111 : err = fd_pubkey_encode( &self->pubkey, ctx );
9963 6111 : if( FD_UNLIKELY( err ) ) return err;
9964 6111 : return FD_BINCODE_SUCCESS;
9965 6111 : }
9966 0 : int fd_vote_authorized_voter_decode_offsets( fd_vote_authorized_voter_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
9967 0 : uchar const * data = ctx->data;
9968 0 : int err;
9969 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
9970 0 : err = fd_bincode_uint64_decode_preflight( ctx );
9971 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9972 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
9973 0 : err = fd_pubkey_decode_preflight( ctx );
9974 0 : if( FD_UNLIKELY( err ) ) return err;
9975 0 : self->parent_off = (uint)( (ulong)ctx->data - (ulong)data );
9976 0 : self->left_off = (uint)( (ulong)ctx->data - (ulong)data );
9977 0 : self->right_off = (uint)( (ulong)ctx->data - (ulong)data );
9978 0 : self->prio_off = (uint)( (ulong)ctx->data - (ulong)data );
9979 0 : return FD_BINCODE_SUCCESS;
9980 0 : }
9981 108234 : void fd_vote_authorized_voter_new(fd_vote_authorized_voter_t * self) {
9982 108234 : fd_memset( self, 0, sizeof(fd_vote_authorized_voter_t) );
9983 108234 : fd_pubkey_new( &self->pubkey );
9984 108234 : }
9985 3642 : void fd_vote_authorized_voter_destroy( fd_vote_authorized_voter_t * self, fd_bincode_destroy_ctx_t * ctx ) {
9986 3642 : fd_pubkey_destroy( &self->pubkey, ctx );
9987 3642 : }
9988 :
9989 0 : ulong fd_vote_authorized_voter_footprint( void ){ return FD_VOTE_AUTHORIZED_VOTER_FOOTPRINT; }
9990 0 : ulong fd_vote_authorized_voter_align( void ){ return FD_VOTE_AUTHORIZED_VOTER_ALIGN; }
9991 :
9992 3 : void fd_vote_authorized_voter_walk( void * w, fd_vote_authorized_voter_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
9993 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voter", level++ );
9994 3 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
9995 3 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
9996 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voter", level-- );
9997 3 : }
9998 6510 : ulong fd_vote_authorized_voter_size( fd_vote_authorized_voter_t const * self ) {
9999 6510 : ulong size = 0;
10000 6510 : size += sizeof(ulong);
10001 6510 : size += fd_pubkey_size( &self->pubkey );
10002 6510 : return size;
10003 6510 : }
10004 :
10005 0 : int fd_vote_prior_voter_decode( fd_vote_prior_voter_t * self, fd_bincode_decode_ctx_t * ctx ) {
10006 0 : void const * data = ctx->data;
10007 0 : int err = fd_vote_prior_voter_decode_preflight( ctx );
10008 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10009 0 : ctx->data = data;
10010 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10011 0 : fd_vote_prior_voter_new( self );
10012 0 : }
10013 0 : fd_vote_prior_voter_decode_unsafe( self, ctx );
10014 0 : return FD_BINCODE_SUCCESS;
10015 0 : }
10016 208848 : int fd_vote_prior_voter_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10017 208848 : return fd_bincode_bytes_decode_preflight( 48, ctx );
10018 208848 : }
10019 190080 : void fd_vote_prior_voter_decode_unsafe( fd_vote_prior_voter_t * self, fd_bincode_decode_ctx_t * ctx ) {
10020 190080 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
10021 190080 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
10022 190080 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
10023 190080 : }
10024 26784 : int fd_vote_prior_voter_encode( fd_vote_prior_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10025 26784 : int err;
10026 26784 : err = fd_pubkey_encode( &self->pubkey, ctx );
10027 26784 : if( FD_UNLIKELY( err ) ) return err;
10028 26784 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
10029 26784 : if( FD_UNLIKELY( err ) ) return err;
10030 26784 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
10031 26784 : if( FD_UNLIKELY( err ) ) return err;
10032 26784 : return FD_BINCODE_SUCCESS;
10033 26784 : }
10034 0 : int fd_vote_prior_voter_decode_offsets( fd_vote_prior_voter_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
10035 0 : uchar const * data = ctx->data;
10036 0 : int err;
10037 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
10038 0 : err = fd_pubkey_decode_preflight( ctx );
10039 0 : if( FD_UNLIKELY( err ) ) return err;
10040 0 : self->epoch_start_off = (uint)( (ulong)ctx->data - (ulong)data );
10041 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10042 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10043 0 : self->epoch_end_off = (uint)( (ulong)ctx->data - (ulong)data );
10044 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10045 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10046 0 : return FD_BINCODE_SUCCESS;
10047 0 : }
10048 13632 : void fd_vote_prior_voter_new(fd_vote_prior_voter_t * self) {
10049 13632 : fd_memset( self, 0, sizeof(fd_vote_prior_voter_t) );
10050 13632 : fd_pubkey_new( &self->pubkey );
10051 13632 : }
10052 86496 : void fd_vote_prior_voter_destroy( fd_vote_prior_voter_t * self, fd_bincode_destroy_ctx_t * ctx ) {
10053 86496 : fd_pubkey_destroy( &self->pubkey, ctx );
10054 86496 : }
10055 :
10056 0 : ulong fd_vote_prior_voter_footprint( void ){ return FD_VOTE_PRIOR_VOTER_FOOTPRINT; }
10057 0 : ulong fd_vote_prior_voter_align( void ){ return FD_VOTE_PRIOR_VOTER_ALIGN; }
10058 :
10059 96 : void fd_vote_prior_voter_walk( void * w, fd_vote_prior_voter_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10060 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter", level++ );
10061 96 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
10062 96 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10063 96 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10064 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter", level-- );
10065 96 : }
10066 27072 : ulong fd_vote_prior_voter_size( fd_vote_prior_voter_t const * self ) {
10067 27072 : ulong size = 0;
10068 27072 : size += fd_pubkey_size( &self->pubkey );
10069 27072 : size += sizeof(ulong);
10070 27072 : size += sizeof(ulong);
10071 27072 : return size;
10072 27072 : }
10073 :
10074 0 : int fd_vote_prior_voter_0_23_5_decode( fd_vote_prior_voter_0_23_5_t * self, fd_bincode_decode_ctx_t * ctx ) {
10075 0 : void const * data = ctx->data;
10076 0 : int err = fd_vote_prior_voter_0_23_5_decode_preflight( ctx );
10077 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10078 0 : ctx->data = data;
10079 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10080 0 : fd_vote_prior_voter_0_23_5_new( self );
10081 0 : }
10082 0 : fd_vote_prior_voter_0_23_5_decode_unsafe( self, ctx );
10083 0 : return FD_BINCODE_SUCCESS;
10084 0 : }
10085 0 : int fd_vote_prior_voter_0_23_5_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10086 0 : return fd_bincode_bytes_decode_preflight( 56, ctx );
10087 0 : }
10088 68256 : void fd_vote_prior_voter_0_23_5_decode_unsafe( fd_vote_prior_voter_0_23_5_t * self, fd_bincode_decode_ctx_t * ctx ) {
10089 68256 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
10090 68256 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
10091 68256 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
10092 68256 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
10093 68256 : }
10094 0 : int fd_vote_prior_voter_0_23_5_encode( fd_vote_prior_voter_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10095 0 : int err;
10096 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
10097 0 : if( FD_UNLIKELY( err ) ) return err;
10098 0 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
10099 0 : if( FD_UNLIKELY( err ) ) return err;
10100 0 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
10101 0 : if( FD_UNLIKELY( err ) ) return err;
10102 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
10103 0 : if( FD_UNLIKELY( err ) ) return err;
10104 0 : return FD_BINCODE_SUCCESS;
10105 0 : }
10106 0 : int fd_vote_prior_voter_0_23_5_decode_offsets( fd_vote_prior_voter_0_23_5_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
10107 0 : uchar const * data = ctx->data;
10108 0 : int err;
10109 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
10110 0 : err = fd_pubkey_decode_preflight( ctx );
10111 0 : if( FD_UNLIKELY( err ) ) return err;
10112 0 : self->epoch_start_off = (uint)( (ulong)ctx->data - (ulong)data );
10113 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10114 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10115 0 : self->epoch_end_off = (uint)( (ulong)ctx->data - (ulong)data );
10116 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10117 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10118 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
10119 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10120 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10121 0 : return FD_BINCODE_SUCCESS;
10122 0 : }
10123 0 : void fd_vote_prior_voter_0_23_5_new(fd_vote_prior_voter_0_23_5_t * self) {
10124 0 : fd_memset( self, 0, sizeof(fd_vote_prior_voter_0_23_5_t) );
10125 0 : fd_pubkey_new( &self->pubkey );
10126 0 : }
10127 61440 : void fd_vote_prior_voter_0_23_5_destroy( fd_vote_prior_voter_0_23_5_t * self, fd_bincode_destroy_ctx_t * ctx ) {
10128 61440 : fd_pubkey_destroy( &self->pubkey, ctx );
10129 61440 : }
10130 :
10131 0 : ulong fd_vote_prior_voter_0_23_5_footprint( void ){ return FD_VOTE_PRIOR_VOTER_0_23_5_FOOTPRINT; }
10132 0 : ulong fd_vote_prior_voter_0_23_5_align( void ){ return FD_VOTE_PRIOR_VOTER_0_23_5_ALIGN; }
10133 :
10134 0 : void fd_vote_prior_voter_0_23_5_walk( void * w, fd_vote_prior_voter_0_23_5_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10135 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter_0_23_5", level++ );
10136 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
10137 0 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10138 0 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10139 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10140 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter_0_23_5", level-- );
10141 0 : }
10142 0 : ulong fd_vote_prior_voter_0_23_5_size( fd_vote_prior_voter_0_23_5_t const * self ) {
10143 0 : ulong size = 0;
10144 0 : size += fd_pubkey_size( &self->pubkey );
10145 0 : size += sizeof(ulong);
10146 0 : size += sizeof(ulong);
10147 0 : size += sizeof(ulong);
10148 0 : return size;
10149 0 : }
10150 :
10151 0 : int fd_vote_epoch_credits_decode( fd_vote_epoch_credits_t * self, fd_bincode_decode_ctx_t * ctx ) {
10152 0 : void const * data = ctx->data;
10153 0 : int err = fd_vote_epoch_credits_decode_preflight( ctx );
10154 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10155 0 : ctx->data = data;
10156 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10157 0 : fd_vote_epoch_credits_new( self );
10158 0 : }
10159 0 : fd_vote_epoch_credits_decode_unsafe( self, ctx );
10160 0 : return FD_BINCODE_SUCCESS;
10161 0 : }
10162 0 : int fd_vote_epoch_credits_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10163 0 : return fd_bincode_bytes_decode_preflight( 24, ctx );
10164 0 : }
10165 120588 : void fd_vote_epoch_credits_decode_unsafe( fd_vote_epoch_credits_t * self, fd_bincode_decode_ctx_t * ctx ) {
10166 120588 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
10167 120588 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
10168 120588 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
10169 120588 : }
10170 10452 : int fd_vote_epoch_credits_encode( fd_vote_epoch_credits_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10171 10452 : int err;
10172 10452 : err = fd_bincode_uint64_encode( self->epoch, ctx );
10173 10452 : if( FD_UNLIKELY( err ) ) return err;
10174 10452 : err = fd_bincode_uint64_encode( self->credits, ctx );
10175 10452 : if( FD_UNLIKELY( err ) ) return err;
10176 10452 : err = fd_bincode_uint64_encode( self->prev_credits, ctx );
10177 10452 : if( FD_UNLIKELY( err ) ) return err;
10178 10452 : return FD_BINCODE_SUCCESS;
10179 10452 : }
10180 0 : int fd_vote_epoch_credits_decode_offsets( fd_vote_epoch_credits_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
10181 0 : uchar const * data = ctx->data;
10182 0 : int err;
10183 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
10184 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10185 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10186 0 : self->credits_off = (uint)( (ulong)ctx->data - (ulong)data );
10187 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10188 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10189 0 : self->prev_credits_off = (uint)( (ulong)ctx->data - (ulong)data );
10190 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10191 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10192 0 : return FD_BINCODE_SUCCESS;
10193 0 : }
10194 120588 : void fd_vote_epoch_credits_new(fd_vote_epoch_credits_t * self) {
10195 120588 : fd_memset( self, 0, sizeof(fd_vote_epoch_credits_t) );
10196 120588 : }
10197 0 : void fd_vote_epoch_credits_destroy( fd_vote_epoch_credits_t * self, fd_bincode_destroy_ctx_t * ctx ) {
10198 0 : }
10199 :
10200 0 : ulong fd_vote_epoch_credits_footprint( void ){ return FD_VOTE_EPOCH_CREDITS_FOOTPRINT; }
10201 0 : ulong fd_vote_epoch_credits_align( void ){ return FD_VOTE_EPOCH_CREDITS_ALIGN; }
10202 :
10203 3 : void fd_vote_epoch_credits_walk( void * w, fd_vote_epoch_credits_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10204 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_epoch_credits", level++ );
10205 3 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10206 3 : fun( w, &self->credits, "credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10207 3 : fun( w, &self->prev_credits, "prev_credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10208 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_epoch_credits", level-- );
10209 3 : }
10210 10869 : ulong fd_vote_epoch_credits_size( fd_vote_epoch_credits_t const * self ) {
10211 10869 : ulong size = 0;
10212 10869 : size += sizeof(ulong);
10213 10869 : size += sizeof(ulong);
10214 10869 : size += sizeof(ulong);
10215 10869 : return size;
10216 10869 : }
10217 :
10218 0 : int fd_vote_block_timestamp_decode( fd_vote_block_timestamp_t * self, fd_bincode_decode_ctx_t * ctx ) {
10219 0 : void const * data = ctx->data;
10220 0 : int err = fd_vote_block_timestamp_decode_preflight( ctx );
10221 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10222 0 : ctx->data = data;
10223 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10224 0 : fd_vote_block_timestamp_new( self );
10225 0 : }
10226 0 : fd_vote_block_timestamp_decode_unsafe( self, ctx );
10227 0 : return FD_BINCODE_SUCCESS;
10228 0 : }
10229 8151 : int fd_vote_block_timestamp_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10230 8151 : return fd_bincode_bytes_decode_preflight( 16, ctx );
10231 8151 : }
10232 8073 : void fd_vote_block_timestamp_decode_unsafe( fd_vote_block_timestamp_t * self, fd_bincode_decode_ctx_t * ctx ) {
10233 8073 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
10234 8073 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
10235 8073 : }
10236 837 : int fd_vote_block_timestamp_encode( fd_vote_block_timestamp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10237 837 : int err;
10238 837 : err = fd_bincode_uint64_encode( self->slot, ctx );
10239 837 : if( FD_UNLIKELY( err ) ) return err;
10240 837 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
10241 837 : if( FD_UNLIKELY( err ) ) return err;
10242 837 : return FD_BINCODE_SUCCESS;
10243 837 : }
10244 0 : int fd_vote_block_timestamp_decode_offsets( fd_vote_block_timestamp_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
10245 0 : uchar const * data = ctx->data;
10246 0 : int err;
10247 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
10248 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10249 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10250 0 : self->timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
10251 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10252 0 : if( FD_UNLIKELY( err ) ) return err;
10253 0 : return FD_BINCODE_SUCCESS;
10254 0 : }
10255 426 : void fd_vote_block_timestamp_new(fd_vote_block_timestamp_t * self) {
10256 426 : fd_memset( self, 0, sizeof(fd_vote_block_timestamp_t) );
10257 426 : }
10258 4623 : void fd_vote_block_timestamp_destroy( fd_vote_block_timestamp_t * self, fd_bincode_destroy_ctx_t * ctx ) {
10259 4623 : }
10260 :
10261 0 : ulong fd_vote_block_timestamp_footprint( void ){ return FD_VOTE_BLOCK_TIMESTAMP_FOOTPRINT; }
10262 0 : ulong fd_vote_block_timestamp_align( void ){ return FD_VOTE_BLOCK_TIMESTAMP_ALIGN; }
10263 :
10264 3 : void fd_vote_block_timestamp_walk( void * w, fd_vote_block_timestamp_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10265 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_block_timestamp", level++ );
10266 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10267 3 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
10268 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_block_timestamp", level-- );
10269 3 : }
10270 846 : ulong fd_vote_block_timestamp_size( fd_vote_block_timestamp_t const * self ) {
10271 846 : ulong size = 0;
10272 846 : size += sizeof(ulong);
10273 846 : size += sizeof(long);
10274 846 : return size;
10275 846 : }
10276 :
10277 0 : int fd_vote_prior_voters_decode( fd_vote_prior_voters_t * self, fd_bincode_decode_ctx_t * ctx ) {
10278 0 : void const * data = ctx->data;
10279 0 : int err = fd_vote_prior_voters_decode_preflight( ctx );
10280 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10281 0 : ctx->data = data;
10282 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10283 0 : fd_vote_prior_voters_new( self );
10284 0 : }
10285 0 : fd_vote_prior_voters_decode_unsafe( self, ctx );
10286 0 : return FD_BINCODE_SUCCESS;
10287 0 : }
10288 6849 : int fd_vote_prior_voters_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10289 6849 : int err;
10290 215043 : for( ulong i=0; i<32; i++ ) {
10291 208848 : err = fd_vote_prior_voter_decode_preflight( ctx );
10292 208848 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10293 208848 : }
10294 6195 : err = fd_bincode_uint64_decode_preflight( ctx );
10295 6195 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10296 6165 : err = fd_bincode_bool_decode_preflight( ctx );
10297 6165 : if( FD_UNLIKELY( err ) ) return err;
10298 6087 : return FD_BINCODE_SUCCESS;
10299 6165 : }
10300 5940 : void fd_vote_prior_voters_decode_unsafe( fd_vote_prior_voters_t * self, fd_bincode_decode_ctx_t * ctx ) {
10301 196020 : for( ulong i=0; i<32; i++ ) {
10302 190080 : fd_vote_prior_voter_decode_unsafe( self->buf + i, ctx );
10303 190080 : }
10304 5940 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
10305 5940 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
10306 5940 : }
10307 837 : int fd_vote_prior_voters_encode( fd_vote_prior_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10308 837 : int err;
10309 27621 : for( ulong i=0; i<32; i++ ) {
10310 26784 : err = fd_vote_prior_voter_encode( self->buf + i, ctx );
10311 26784 : if( FD_UNLIKELY( err ) ) return err;
10312 26784 : }
10313 837 : err = fd_bincode_uint64_encode( self->idx, ctx );
10314 837 : if( FD_UNLIKELY( err ) ) return err;
10315 837 : err = fd_bincode_bool_encode( (uchar)(self->is_empty), ctx );
10316 837 : if( FD_UNLIKELY( err ) ) return err;
10317 837 : return FD_BINCODE_SUCCESS;
10318 837 : }
10319 0 : int fd_vote_prior_voters_decode_offsets( fd_vote_prior_voters_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
10320 0 : uchar const * data = ctx->data;
10321 0 : int err;
10322 0 : self->buf_off = (uint)( (ulong)ctx->data - (ulong)data );
10323 0 : for( ulong i=0; i<32; i++ ) {
10324 0 : err = fd_vote_prior_voter_decode_preflight( ctx );
10325 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10326 0 : }
10327 0 : self->idx_off = (uint)( (ulong)ctx->data - (ulong)data );
10328 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10329 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10330 0 : self->is_empty_off = (uint)( (ulong)ctx->data - (ulong)data );
10331 0 : err = fd_bincode_bool_decode_preflight( ctx );
10332 0 : if( FD_UNLIKELY( err ) ) return err;
10333 0 : return FD_BINCODE_SUCCESS;
10334 0 : }
10335 426 : void fd_vote_prior_voters_new(fd_vote_prior_voters_t * self) {
10336 426 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_t) );
10337 14058 : for( ulong i=0; i<32; i++ )
10338 13632 : fd_vote_prior_voter_new( self->buf + i );
10339 426 : }
10340 2703 : void fd_vote_prior_voters_destroy( fd_vote_prior_voters_t * self, fd_bincode_destroy_ctx_t * ctx ) {
10341 89199 : for( ulong i=0; i<32; i++ )
10342 86496 : fd_vote_prior_voter_destroy( self->buf + i, ctx );
10343 2703 : }
10344 :
10345 0 : ulong fd_vote_prior_voters_footprint( void ){ return FD_VOTE_PRIOR_VOTERS_FOOTPRINT; }
10346 0 : ulong fd_vote_prior_voters_align( void ){ return FD_VOTE_PRIOR_VOTERS_ALIGN; }
10347 :
10348 3 : void fd_vote_prior_voters_walk( void * w, fd_vote_prior_voters_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10349 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters", level++ );
10350 3 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter[]", level++ );
10351 99 : for( ulong i=0; i<32; i++ )
10352 96 : fd_vote_prior_voter_walk( w, self->buf + i, fun, "vote_prior_voter", level );
10353 3 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter[]", level-- );
10354 3 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10355 3 : fun( w, &self->is_empty, "is_empty", FD_FLAMENCO_TYPE_BOOL, "bool", level );
10356 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters", level-- );
10357 3 : }
10358 846 : ulong fd_vote_prior_voters_size( fd_vote_prior_voters_t const * self ) {
10359 846 : ulong size = 0;
10360 27918 : for( ulong i=0; i<32; i++ )
10361 27072 : size += fd_vote_prior_voter_size( self->buf + i );
10362 846 : size += sizeof(ulong);
10363 846 : size += sizeof(char);
10364 846 : return size;
10365 846 : }
10366 :
10367 0 : int fd_vote_prior_voters_0_23_5_decode( fd_vote_prior_voters_0_23_5_t * self, fd_bincode_decode_ctx_t * ctx ) {
10368 0 : void const * data = ctx->data;
10369 0 : int err = fd_vote_prior_voters_0_23_5_decode_preflight( ctx );
10370 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10371 0 : ctx->data = data;
10372 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10373 0 : fd_vote_prior_voters_0_23_5_new( self );
10374 0 : }
10375 0 : fd_vote_prior_voters_0_23_5_decode_unsafe( self, ctx );
10376 0 : return FD_BINCODE_SUCCESS;
10377 0 : }
10378 2973 : int fd_vote_prior_voters_0_23_5_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10379 2973 : return fd_bincode_bytes_decode_preflight( 1800, ctx );
10380 2973 : }
10381 2133 : void fd_vote_prior_voters_0_23_5_decode_unsafe( fd_vote_prior_voters_0_23_5_t * self, fd_bincode_decode_ctx_t * ctx ) {
10382 70389 : for( ulong i=0; i<32; i++ ) {
10383 68256 : fd_vote_prior_voter_0_23_5_decode_unsafe( self->buf + i, ctx );
10384 68256 : }
10385 2133 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
10386 2133 : }
10387 0 : int fd_vote_prior_voters_0_23_5_encode( fd_vote_prior_voters_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10388 0 : int err;
10389 0 : for( ulong i=0; i<32; i++ ) {
10390 0 : err = fd_vote_prior_voter_0_23_5_encode( self->buf + i, ctx );
10391 0 : if( FD_UNLIKELY( err ) ) return err;
10392 0 : }
10393 0 : err = fd_bincode_uint64_encode( self->idx, ctx );
10394 0 : if( FD_UNLIKELY( err ) ) return err;
10395 0 : return FD_BINCODE_SUCCESS;
10396 0 : }
10397 0 : int fd_vote_prior_voters_0_23_5_decode_offsets( fd_vote_prior_voters_0_23_5_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
10398 0 : uchar const * data = ctx->data;
10399 0 : int err;
10400 0 : self->buf_off = (uint)( (ulong)ctx->data - (ulong)data );
10401 0 : for( ulong i=0; i<32; i++ ) {
10402 0 : err = fd_vote_prior_voter_0_23_5_decode_preflight( ctx );
10403 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10404 0 : }
10405 0 : self->idx_off = (uint)( (ulong)ctx->data - (ulong)data );
10406 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10407 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10408 0 : return FD_BINCODE_SUCCESS;
10409 0 : }
10410 0 : void fd_vote_prior_voters_0_23_5_new(fd_vote_prior_voters_0_23_5_t * self) {
10411 0 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_0_23_5_t) );
10412 0 : for( ulong i=0; i<32; i++ )
10413 0 : fd_vote_prior_voter_0_23_5_new( self->buf + i );
10414 0 : }
10415 1920 : void fd_vote_prior_voters_0_23_5_destroy( fd_vote_prior_voters_0_23_5_t * self, fd_bincode_destroy_ctx_t * ctx ) {
10416 63360 : for( ulong i=0; i<32; i++ )
10417 61440 : fd_vote_prior_voter_0_23_5_destroy( self->buf + i, ctx );
10418 1920 : }
10419 :
10420 0 : ulong fd_vote_prior_voters_0_23_5_footprint( void ){ return FD_VOTE_PRIOR_VOTERS_0_23_5_FOOTPRINT; }
10421 0 : ulong fd_vote_prior_voters_0_23_5_align( void ){ return FD_VOTE_PRIOR_VOTERS_0_23_5_ALIGN; }
10422 :
10423 0 : void fd_vote_prior_voters_0_23_5_walk( void * w, fd_vote_prior_voters_0_23_5_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10424 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters_0_23_5", level++ );
10425 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter_0_23_5[]", level++ );
10426 0 : for( ulong i=0; i<32; i++ )
10427 0 : fd_vote_prior_voter_0_23_5_walk( w, self->buf + i, fun, "vote_prior_voter_0_23_5", level );
10428 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter_0_23_5[]", level-- );
10429 0 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10430 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters_0_23_5", level-- );
10431 0 : }
10432 0 : ulong fd_vote_prior_voters_0_23_5_size( fd_vote_prior_voters_0_23_5_t const * self ) {
10433 0 : ulong size = 0;
10434 0 : for( ulong i=0; i<32; i++ )
10435 0 : size += fd_vote_prior_voter_0_23_5_size( self->buf + i );
10436 0 : size += sizeof(ulong);
10437 0 : return size;
10438 0 : }
10439 :
10440 0 : int fd_landed_vote_decode( fd_landed_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
10441 0 : void const * data = ctx->data;
10442 0 : int err = fd_landed_vote_decode_preflight( ctx );
10443 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10444 0 : ctx->data = data;
10445 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10446 0 : fd_landed_vote_new( self );
10447 0 : }
10448 0 : fd_landed_vote_decode_unsafe( self, ctx );
10449 0 : return FD_BINCODE_SUCCESS;
10450 0 : }
10451 0 : int fd_landed_vote_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10452 0 : return fd_bincode_bytes_decode_preflight( 13, ctx );
10453 0 : }
10454 67557 : void fd_landed_vote_decode_unsafe( fd_landed_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
10455 67557 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
10456 67557 : fd_vote_lockout_decode_unsafe( &self->lockout, ctx );
10457 67557 : }
10458 9672 : int fd_landed_vote_encode( fd_landed_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10459 9672 : int err;
10460 9672 : err = fd_bincode_uint8_encode( (uchar)(self->latency), ctx );
10461 9672 : if( FD_UNLIKELY( err ) ) return err;
10462 9672 : err = fd_vote_lockout_encode( &self->lockout, ctx );
10463 9672 : if( FD_UNLIKELY( err ) ) return err;
10464 9672 : return FD_BINCODE_SUCCESS;
10465 9672 : }
10466 0 : int fd_landed_vote_decode_offsets( fd_landed_vote_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
10467 0 : uchar const * data = ctx->data;
10468 0 : int err;
10469 0 : self->latency_off = (uint)( (ulong)ctx->data - (ulong)data );
10470 0 : err = fd_bincode_uint8_decode_preflight( ctx );
10471 0 : if( FD_UNLIKELY( err ) ) return err;
10472 0 : self->lockout_off = (uint)( (ulong)ctx->data - (ulong)data );
10473 0 : err = fd_vote_lockout_decode_preflight( ctx );
10474 0 : if( FD_UNLIKELY( err ) ) return err;
10475 0 : return FD_BINCODE_SUCCESS;
10476 0 : }
10477 174156 : void fd_landed_vote_new(fd_landed_vote_t * self) {
10478 174156 : fd_memset( self, 0, sizeof(fd_landed_vote_t) );
10479 174156 : fd_vote_lockout_new( &self->lockout );
10480 174156 : }
10481 4224 : void fd_landed_vote_destroy( fd_landed_vote_t * self, fd_bincode_destroy_ctx_t * ctx ) {
10482 4224 : fd_vote_lockout_destroy( &self->lockout, ctx );
10483 4224 : }
10484 :
10485 0 : ulong fd_landed_vote_footprint( void ){ return FD_LANDED_VOTE_FOOTPRINT; }
10486 0 : ulong fd_landed_vote_align( void ){ return FD_LANDED_VOTE_ALIGN; }
10487 :
10488 3 : void fd_landed_vote_walk( void * w, fd_landed_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10489 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_landed_vote", level++ );
10490 3 : fun( w, &self->latency, "latency", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
10491 3 : fd_vote_lockout_walk( w, &self->lockout, fun, "lockout", level );
10492 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_landed_vote", level-- );
10493 3 : }
10494 10818 : ulong fd_landed_vote_size( fd_landed_vote_t const * self ) {
10495 10818 : ulong size = 0;
10496 10818 : size += sizeof(char);
10497 10818 : size += fd_vote_lockout_size( &self->lockout );
10498 10818 : return size;
10499 10818 : }
10500 :
10501 0 : int fd_vote_state_0_23_5_decode( fd_vote_state_0_23_5_t * self, fd_bincode_decode_ctx_t * ctx ) {
10502 0 : void const * data = ctx->data;
10503 0 : int err = fd_vote_state_0_23_5_decode_preflight( ctx );
10504 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10505 0 : ctx->data = data;
10506 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10507 0 : fd_vote_state_0_23_5_new( self );
10508 0 : }
10509 0 : fd_vote_state_0_23_5_decode_unsafe( self, ctx );
10510 0 : return FD_BINCODE_SUCCESS;
10511 0 : }
10512 3123 : int fd_vote_state_0_23_5_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10513 3123 : int err;
10514 3123 : err = fd_pubkey_decode_preflight( ctx );
10515 3123 : if( FD_UNLIKELY( err ) ) return err;
10516 3021 : err = fd_pubkey_decode_preflight( ctx );
10517 3021 : if( FD_UNLIKELY( err ) ) return err;
10518 2988 : err = fd_bincode_uint64_decode_preflight( ctx );
10519 2988 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10520 2973 : err = fd_vote_prior_voters_0_23_5_decode_preflight( ctx );
10521 2973 : if( FD_UNLIKELY( err ) ) return err;
10522 2367 : err = fd_pubkey_decode_preflight( ctx );
10523 2367 : if( FD_UNLIKELY( err ) ) return err;
10524 2349 : err = fd_bincode_uint8_decode_preflight( ctx );
10525 2349 : if( FD_UNLIKELY( err ) ) return err;
10526 2331 : ulong votes_len;
10527 2331 : err = fd_bincode_uint64_decode( &votes_len, ctx );
10528 2331 : if( FD_UNLIKELY( err ) ) return err;
10529 2316 : ulong votes_sz;
10530 2316 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
10531 2292 : err = fd_bincode_bytes_decode_preflight( votes_sz, ctx );
10532 2292 : if( FD_UNLIKELY( err ) ) return err;
10533 2274 : {
10534 2274 : uchar o;
10535 2274 : err = fd_bincode_bool_decode( &o, ctx );
10536 2274 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10537 2241 : if( o ) {
10538 1089 : err = fd_bincode_uint64_decode_preflight( ctx );
10539 1089 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10540 1089 : }
10541 2241 : }
10542 2229 : ulong epoch_credits_len;
10543 2229 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
10544 2229 : if( FD_UNLIKELY( err ) ) return err;
10545 2217 : ulong epoch_credits_sz;
10546 2217 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
10547 2190 : err = fd_bincode_bytes_decode_preflight( epoch_credits_sz, ctx );
10548 2190 : if( FD_UNLIKELY( err ) ) return err;
10549 2163 : err = fd_vote_block_timestamp_decode_preflight( ctx );
10550 2163 : if( FD_UNLIKELY( err ) ) return err;
10551 2133 : return FD_BINCODE_SUCCESS;
10552 2163 : }
10553 2133 : void fd_vote_state_0_23_5_decode_unsafe( fd_vote_state_0_23_5_t * self, fd_bincode_decode_ctx_t * ctx ) {
10554 2133 : fd_pubkey_decode_unsafe( &self->node_pubkey, ctx );
10555 2133 : fd_pubkey_decode_unsafe( &self->authorized_voter, ctx );
10556 2133 : fd_bincode_uint64_decode_unsafe( &self->authorized_voter_epoch, ctx );
10557 2133 : fd_vote_prior_voters_0_23_5_decode_unsafe( &self->prior_voters, ctx );
10558 2133 : fd_pubkey_decode_unsafe( &self->authorized_withdrawer, ctx );
10559 2133 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
10560 2133 : ulong votes_len;
10561 2133 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
10562 2133 : ulong votes_max = fd_ulong_max( votes_len, 32 );
10563 2133 : self->votes = deq_fd_vote_lockout_t_alloc( ctx->valloc, votes_max );
10564 60939 : for( ulong i=0; i < votes_len; i++ ) {
10565 58806 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
10566 58806 : fd_vote_lockout_new( elem );
10567 58806 : fd_vote_lockout_decode_unsafe( elem, ctx );
10568 58806 : }
10569 2133 : {
10570 2133 : uchar o;
10571 2133 : fd_bincode_bool_decode_unsafe( &o, ctx );
10572 2133 : self->has_root_slot = !!o;
10573 2133 : if( o ) {
10574 1068 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
10575 1068 : }
10576 2133 : }
10577 2133 : ulong epoch_credits_len;
10578 2133 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
10579 2133 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
10580 2133 : self->epoch_credits = deq_fd_vote_epoch_credits_t_alloc( ctx->valloc, epoch_credits_max );
10581 39129 : for( ulong i=0; i < epoch_credits_len; i++ ) {
10582 36996 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
10583 36996 : fd_vote_epoch_credits_new( elem );
10584 36996 : fd_vote_epoch_credits_decode_unsafe( elem, ctx );
10585 36996 : }
10586 2133 : fd_vote_block_timestamp_decode_unsafe( &self->last_timestamp, ctx );
10587 2133 : }
10588 0 : int fd_vote_state_0_23_5_encode( fd_vote_state_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10589 0 : int err;
10590 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
10591 0 : if( FD_UNLIKELY( err ) ) return err;
10592 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
10593 0 : if( FD_UNLIKELY( err ) ) return err;
10594 0 : err = fd_bincode_uint64_encode( self->authorized_voter_epoch, ctx );
10595 0 : if( FD_UNLIKELY( err ) ) return err;
10596 0 : err = fd_vote_prior_voters_0_23_5_encode( &self->prior_voters, ctx );
10597 0 : if( FD_UNLIKELY( err ) ) return err;
10598 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
10599 0 : if( FD_UNLIKELY( err ) ) return err;
10600 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
10601 0 : if( FD_UNLIKELY( err ) ) return err;
10602 0 : if( self->votes ) {
10603 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
10604 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
10605 0 : if( FD_UNLIKELY( err ) ) return err;
10606 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
10607 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
10608 0 : err = fd_vote_lockout_encode( ele, ctx );
10609 0 : if( FD_UNLIKELY( err ) ) return err;
10610 0 : }
10611 0 : } else {
10612 0 : ulong votes_len = 0;
10613 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
10614 0 : if( FD_UNLIKELY( err ) ) return err;
10615 0 : }
10616 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
10617 0 : if( FD_UNLIKELY( err ) ) return err;
10618 0 : if( self->has_root_slot ) {
10619 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
10620 0 : if( FD_UNLIKELY( err ) ) return err;
10621 0 : }
10622 0 : if( self->epoch_credits ) {
10623 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
10624 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
10625 0 : if( FD_UNLIKELY( err ) ) return err;
10626 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
10627 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
10628 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
10629 0 : if( FD_UNLIKELY( err ) ) return err;
10630 0 : }
10631 0 : } else {
10632 0 : ulong epoch_credits_len = 0;
10633 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
10634 0 : if( FD_UNLIKELY( err ) ) return err;
10635 0 : }
10636 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
10637 0 : if( FD_UNLIKELY( err ) ) return err;
10638 0 : return FD_BINCODE_SUCCESS;
10639 0 : }
10640 0 : int fd_vote_state_0_23_5_decode_offsets( fd_vote_state_0_23_5_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
10641 0 : uchar const * data = ctx->data;
10642 0 : int err;
10643 0 : self->node_pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
10644 0 : err = fd_pubkey_decode_preflight( ctx );
10645 0 : if( FD_UNLIKELY( err ) ) return err;
10646 0 : self->authorized_voter_off = (uint)( (ulong)ctx->data - (ulong)data );
10647 0 : err = fd_pubkey_decode_preflight( ctx );
10648 0 : if( FD_UNLIKELY( err ) ) return err;
10649 0 : self->authorized_voter_epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
10650 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10651 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10652 0 : self->prior_voters_off = (uint)( (ulong)ctx->data - (ulong)data );
10653 0 : err = fd_vote_prior_voters_0_23_5_decode_preflight( ctx );
10654 0 : if( FD_UNLIKELY( err ) ) return err;
10655 0 : self->authorized_withdrawer_off = (uint)( (ulong)ctx->data - (ulong)data );
10656 0 : err = fd_pubkey_decode_preflight( ctx );
10657 0 : if( FD_UNLIKELY( err ) ) return err;
10658 0 : self->commission_off = (uint)( (ulong)ctx->data - (ulong)data );
10659 0 : err = fd_bincode_uint8_decode_preflight( ctx );
10660 0 : if( FD_UNLIKELY( err ) ) return err;
10661 0 : self->votes_off = (uint)( (ulong)ctx->data - (ulong)data );
10662 0 : ulong votes_len;
10663 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
10664 0 : if( FD_UNLIKELY( err ) ) return err;
10665 0 : ulong votes_sz;
10666 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
10667 0 : err = fd_bincode_bytes_decode_preflight( votes_sz, ctx );
10668 0 : if( FD_UNLIKELY( err ) ) return err;
10669 0 : self->root_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
10670 0 : {
10671 0 : uchar o;
10672 0 : err = fd_bincode_bool_decode( &o, ctx );
10673 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10674 0 : if( o ) {
10675 0 : err = fd_bincode_uint64_decode_preflight( ctx );
10676 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10677 0 : }
10678 0 : }
10679 0 : self->epoch_credits_off = (uint)( (ulong)ctx->data - (ulong)data );
10680 0 : ulong epoch_credits_len;
10681 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
10682 0 : if( FD_UNLIKELY( err ) ) return err;
10683 0 : ulong epoch_credits_sz;
10684 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
10685 0 : err = fd_bincode_bytes_decode_preflight( epoch_credits_sz, ctx );
10686 0 : if( FD_UNLIKELY( err ) ) return err;
10687 0 : self->last_timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
10688 0 : err = fd_vote_block_timestamp_decode_preflight( ctx );
10689 0 : if( FD_UNLIKELY( err ) ) return err;
10690 0 : return FD_BINCODE_SUCCESS;
10691 0 : }
10692 0 : void fd_vote_state_0_23_5_new(fd_vote_state_0_23_5_t * self) {
10693 0 : fd_memset( self, 0, sizeof(fd_vote_state_0_23_5_t) );
10694 0 : fd_pubkey_new( &self->node_pubkey );
10695 0 : fd_pubkey_new( &self->authorized_voter );
10696 0 : fd_vote_prior_voters_0_23_5_new( &self->prior_voters );
10697 0 : fd_pubkey_new( &self->authorized_withdrawer );
10698 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
10699 0 : }
10700 1920 : void fd_vote_state_0_23_5_destroy( fd_vote_state_0_23_5_t * self, fd_bincode_destroy_ctx_t * ctx ) {
10701 1920 : fd_pubkey_destroy( &self->node_pubkey, ctx );
10702 1920 : fd_pubkey_destroy( &self->authorized_voter, ctx );
10703 1920 : fd_vote_prior_voters_0_23_5_destroy( &self->prior_voters, ctx );
10704 1920 : fd_pubkey_destroy( &self->authorized_withdrawer, ctx );
10705 1920 : if( self->votes ) {
10706 56346 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
10707 54426 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
10708 54426 : fd_vote_lockout_destroy( ele, ctx );
10709 54426 : }
10710 1920 : fd_valloc_free( ctx->valloc, deq_fd_vote_lockout_t_delete( deq_fd_vote_lockout_t_leave( self->votes) ) );
10711 1920 : self->votes = NULL;
10712 1920 : }
10713 1920 : if( self->has_root_slot ) {
10714 972 : self->has_root_slot = 0;
10715 972 : }
10716 1920 : if( self->epoch_credits ) {
10717 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
10718 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
10719 0 : fd_vote_epoch_credits_destroy( ele, ctx );
10720 0 : }
10721 0 : fd_valloc_free( ctx->valloc, deq_fd_vote_epoch_credits_t_delete( deq_fd_vote_epoch_credits_t_leave( self->epoch_credits) ) );
10722 0 : self->epoch_credits = NULL;
10723 0 : }
10724 1920 : fd_vote_block_timestamp_destroy( &self->last_timestamp, ctx );
10725 1920 : }
10726 :
10727 0 : ulong fd_vote_state_0_23_5_footprint( void ){ return FD_VOTE_STATE_0_23_5_FOOTPRINT; }
10728 0 : ulong fd_vote_state_0_23_5_align( void ){ return FD_VOTE_STATE_0_23_5_ALIGN; }
10729 :
10730 0 : void fd_vote_state_0_23_5_walk( void * w, fd_vote_state_0_23_5_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10731 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_0_23_5", level++ );
10732 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level );
10733 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level );
10734 0 : fun( w, &self->authorized_voter_epoch, "authorized_voter_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10735 0 : fd_vote_prior_voters_0_23_5_walk( w, &self->prior_voters, fun, "prior_voters", level );
10736 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level );
10737 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
10738 :
10739 : /* Walk deque */
10740 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++ );
10741 0 : if( self->votes ) {
10742 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
10743 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
10744 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
10745 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
10746 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level );
10747 0 : }
10748 0 : }
10749 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level-- );
10750 : /* Done walking deque */
10751 :
10752 0 : if( !self->has_root_slot ) {
10753 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level );
10754 0 : } else {
10755 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
10756 0 : }
10757 :
10758 : /* Walk deque */
10759 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++ );
10760 0 : if( self->epoch_credits ) {
10761 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
10762 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
10763 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
10764 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
10765 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level );
10766 0 : }
10767 0 : }
10768 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level-- );
10769 : /* Done walking deque */
10770 :
10771 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level );
10772 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_0_23_5", level-- );
10773 0 : }
10774 0 : ulong fd_vote_state_0_23_5_size( fd_vote_state_0_23_5_t const * self ) {
10775 0 : ulong size = 0;
10776 0 : size += fd_pubkey_size( &self->node_pubkey );
10777 0 : size += fd_pubkey_size( &self->authorized_voter );
10778 0 : size += sizeof(ulong);
10779 0 : size += fd_vote_prior_voters_0_23_5_size( &self->prior_voters );
10780 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
10781 0 : size += sizeof(char);
10782 0 : if( self->votes ) {
10783 0 : size += sizeof(ulong);
10784 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
10785 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
10786 0 : size += fd_vote_lockout_size( ele );
10787 0 : }
10788 0 : } else {
10789 0 : size += sizeof(ulong);
10790 0 : }
10791 0 : size += sizeof(char);
10792 0 : if( self->has_root_slot ) {
10793 0 : size += sizeof(ulong);
10794 0 : }
10795 0 : if( self->epoch_credits ) {
10796 0 : size += sizeof(ulong);
10797 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
10798 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
10799 0 : size += fd_vote_epoch_credits_size( ele );
10800 0 : }
10801 0 : } else {
10802 0 : size += sizeof(ulong);
10803 0 : }
10804 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
10805 0 : return size;
10806 0 : }
10807 :
10808 0 : int fd_vote_authorized_voters_decode( fd_vote_authorized_voters_t * self, fd_bincode_decode_ctx_t * ctx ) {
10809 0 : void const * data = ctx->data;
10810 0 : int err = fd_vote_authorized_voters_decode_preflight( ctx );
10811 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10812 0 : ctx->data = data;
10813 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10814 0 : fd_vote_authorized_voters_new( self );
10815 0 : }
10816 0 : fd_vote_authorized_voters_decode_unsafe( self, ctx );
10817 0 : return FD_BINCODE_SUCCESS;
10818 0 : }
10819 7233 : int fd_vote_authorized_voters_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10820 7233 : int err;
10821 7233 : ulong fd_vote_authorized_voters_treap_len;
10822 7233 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
10823 7233 : if( FD_UNLIKELY( err ) ) return err;
10824 138327 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
10825 131478 : err = fd_vote_authorized_voter_decode_preflight( ctx );
10826 131478 : if( FD_UNLIKELY ( err ) ) return err;
10827 131478 : }
10828 6849 : return FD_BINCODE_SUCCESS;
10829 7203 : }
10830 5940 : void fd_vote_authorized_voters_decode_unsafe( fd_vote_authorized_voters_t * self, fd_bincode_decode_ctx_t * ctx ) {
10831 5940 : fd_bincode_destroy_ctx_t destroy_ctx = { .valloc = ctx->valloc };
10832 5940 : ulong fd_vote_authorized_voters_treap_len;
10833 5940 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
10834 5940 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10835 5940 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
10836 5940 : self->pool = fd_vote_authorized_voters_pool_alloc( ctx->valloc, fd_vote_authorized_voters_treap_max );
10837 5940 : self->treap = fd_vote_authorized_voters_treap_alloc( ctx->valloc, fd_vote_authorized_voters_treap_max );
10838 5940 : }
10839 114174 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
10840 108234 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( self->pool );
10841 108234 : fd_vote_authorized_voter_new( ele );
10842 108234 : fd_vote_authorized_voter_decode_unsafe( ele, ctx );
10843 108234 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( self->treap, ele->epoch, self->pool );
10844 108234 : if( repeated_entry ) {
10845 3642 : fd_vote_authorized_voters_treap_ele_remove( self->treap, repeated_entry, self->pool ); // Remove the element before inserting it back to avoid duplication
10846 3642 : fd_vote_authorized_voter_destroy( repeated_entry, &destroy_ctx );
10847 3642 : fd_vote_authorized_voters_pool_ele_release( self->pool, repeated_entry );
10848 3642 : }
10849 108234 : fd_vote_authorized_voters_treap_ele_insert( self->treap, ele, self->pool ); /* this cannot fail */
10850 108234 : }
10851 5940 : }
10852 837 : int fd_vote_authorized_voters_encode( fd_vote_authorized_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10853 837 : int err;
10854 837 : if( self->treap ) {
10855 792 : ulong fd_vote_authorized_voters_len = fd_vote_authorized_voters_treap_ele_cnt( self->treap );
10856 792 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
10857 792 : if( FD_UNLIKELY( err ) ) return err;
10858 792 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
10859 6903 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
10860 6111 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
10861 6111 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
10862 6111 : err = fd_vote_authorized_voter_encode( ele, ctx );
10863 6111 : if( FD_UNLIKELY( err ) ) return err;
10864 6111 : }
10865 792 : } else {
10866 45 : ulong fd_vote_authorized_voters_len = 0;
10867 45 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
10868 45 : if( FD_UNLIKELY( err ) ) return err;
10869 45 : }
10870 837 : return FD_BINCODE_SUCCESS;
10871 837 : }
10872 0 : int fd_vote_authorized_voters_decode_offsets( fd_vote_authorized_voters_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
10873 0 : uchar const * data = ctx->data;
10874 0 : int err;
10875 0 : self->fd_vote_authorized_voters_off = (uint)( (ulong)ctx->data - (ulong)data );
10876 0 : ulong fd_vote_authorized_voters_treap_len;
10877 0 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
10878 0 : if( FD_UNLIKELY( err ) ) return err;
10879 0 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
10880 0 : err = fd_vote_authorized_voter_decode_preflight( ctx );
10881 0 : if( FD_UNLIKELY ( err ) ) return err;
10882 0 : }
10883 0 : return FD_BINCODE_SUCCESS;
10884 0 : }
10885 426 : void fd_vote_authorized_voters_new(fd_vote_authorized_voters_t * self) {
10886 426 : fd_memset( self, 0, sizeof(fd_vote_authorized_voters_t) );
10887 426 : }
10888 2703 : void fd_vote_authorized_voters_destroy( fd_vote_authorized_voters_t * self, fd_bincode_destroy_ctx_t * ctx ) {
10889 2703 : if( !self->treap || !self->pool ) return;
10890 0 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
10891 0 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
10892 0 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
10893 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
10894 0 : fd_vote_authorized_voter_destroy( ele, ctx );
10895 0 : }
10896 0 : fd_valloc_free( ctx->valloc, fd_vote_authorized_voters_treap_delete(fd_vote_authorized_voters_treap_leave( self->treap) ) );
10897 0 : fd_valloc_free( ctx->valloc, fd_vote_authorized_voters_pool_delete(fd_vote_authorized_voters_pool_leave( self->pool) ) );
10898 0 : self->pool = NULL;
10899 0 : self->treap = NULL;
10900 0 : }
10901 :
10902 0 : ulong fd_vote_authorized_voters_footprint( void ){ return FD_VOTE_AUTHORIZED_VOTERS_FOOTPRINT; }
10903 0 : ulong fd_vote_authorized_voters_align( void ){ return FD_VOTE_AUTHORIZED_VOTERS_ALIGN; }
10904 :
10905 3 : void fd_vote_authorized_voters_walk( void * w, fd_vote_authorized_voters_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
10906 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voters", level++ );
10907 3 : if( self->treap ) {
10908 3 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
10909 6 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
10910 3 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
10911 3 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
10912 3 : fd_vote_authorized_voter_walk( w, ele, fun, "fd_vote_authorized_voter_t", level );
10913 3 : }
10914 3 : }
10915 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voters", level-- );
10916 3 : }
10917 846 : ulong fd_vote_authorized_voters_size( fd_vote_authorized_voters_t const * self ) {
10918 846 : ulong size = 0;
10919 846 : size += sizeof(ulong);
10920 846 : if( self->treap ) {
10921 801 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
10922 7311 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
10923 6510 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
10924 6510 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
10925 6510 : size += fd_vote_authorized_voter_size( ele );
10926 6510 : }
10927 801 : }
10928 846 : return size;
10929 846 : }
10930 :
10931 0 : int fd_vote_state_1_14_11_decode( fd_vote_state_1_14_11_t * self, fd_bincode_decode_ctx_t * ctx ) {
10932 0 : void const * data = ctx->data;
10933 0 : int err = fd_vote_state_1_14_11_decode_preflight( ctx );
10934 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10935 0 : ctx->data = data;
10936 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
10937 0 : fd_vote_state_1_14_11_new( self );
10938 0 : }
10939 0 : fd_vote_state_1_14_11_decode_unsafe( self, ctx );
10940 0 : return FD_BINCODE_SUCCESS;
10941 0 : }
10942 3309 : int fd_vote_state_1_14_11_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
10943 3309 : int err;
10944 3309 : err = fd_pubkey_decode_preflight( ctx );
10945 3309 : if( FD_UNLIKELY( err ) ) return err;
10946 3294 : err = fd_pubkey_decode_preflight( ctx );
10947 3294 : if( FD_UNLIKELY( err ) ) return err;
10948 3255 : err = fd_bincode_uint8_decode_preflight( ctx );
10949 3255 : if( FD_UNLIKELY( err ) ) return err;
10950 3240 : ulong votes_len;
10951 3240 : err = fd_bincode_uint64_decode( &votes_len, ctx );
10952 3240 : if( FD_UNLIKELY( err ) ) return err;
10953 3225 : ulong votes_sz;
10954 3225 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
10955 3201 : err = fd_bincode_bytes_decode_preflight( votes_sz, ctx );
10956 3201 : if( FD_UNLIKELY( err ) ) return err;
10957 3186 : {
10958 3186 : uchar o;
10959 3186 : err = fd_bincode_bool_decode( &o, ctx );
10960 3186 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10961 3156 : if( o ) {
10962 1554 : err = fd_bincode_uint64_decode_preflight( ctx );
10963 1554 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10964 1554 : }
10965 3156 : }
10966 3147 : err = fd_vote_authorized_voters_decode_preflight( ctx );
10967 3147 : if( FD_UNLIKELY( err ) ) return err;
10968 2988 : err = fd_vote_prior_voters_decode_preflight( ctx );
10969 2988 : if( FD_UNLIKELY( err ) ) return err;
10970 2541 : ulong epoch_credits_len;
10971 2541 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
10972 2541 : if( FD_UNLIKELY( err ) ) return err;
10973 2526 : ulong epoch_credits_sz;
10974 2526 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
10975 2502 : err = fd_bincode_bytes_decode_preflight( epoch_credits_sz, ctx );
10976 2502 : if( FD_UNLIKELY( err ) ) return err;
10977 2487 : err = fd_vote_block_timestamp_decode_preflight( ctx );
10978 2487 : if( FD_UNLIKELY( err ) ) return err;
10979 2463 : return FD_BINCODE_SUCCESS;
10980 2487 : }
10981 2463 : void fd_vote_state_1_14_11_decode_unsafe( fd_vote_state_1_14_11_t * self, fd_bincode_decode_ctx_t * ctx ) {
10982 2463 : fd_pubkey_decode_unsafe( &self->node_pubkey, ctx );
10983 2463 : fd_pubkey_decode_unsafe( &self->authorized_withdrawer, ctx );
10984 2463 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
10985 2463 : ulong votes_len;
10986 2463 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
10987 2463 : ulong votes_max = fd_ulong_max( votes_len, 32 );
10988 2463 : self->votes = deq_fd_vote_lockout_t_alloc( ctx->valloc, votes_max );
10989 59802 : for( ulong i=0; i < votes_len; i++ ) {
10990 57339 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
10991 57339 : fd_vote_lockout_new( elem );
10992 57339 : fd_vote_lockout_decode_unsafe( elem, ctx );
10993 57339 : }
10994 2463 : {
10995 2463 : uchar o;
10996 2463 : fd_bincode_bool_decode_unsafe( &o, ctx );
10997 2463 : self->has_root_slot = !!o;
10998 2463 : if( o ) {
10999 1389 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
11000 1389 : }
11001 2463 : }
11002 2463 : fd_vote_authorized_voters_decode_unsafe( &self->authorized_voters, ctx );
11003 2463 : fd_vote_prior_voters_decode_unsafe( &self->prior_voters, ctx );
11004 2463 : ulong epoch_credits_len;
11005 2463 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
11006 2463 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
11007 2463 : self->epoch_credits = deq_fd_vote_epoch_credits_t_alloc( ctx->valloc, epoch_credits_max );
11008 44112 : for( ulong i=0; i < epoch_credits_len; i++ ) {
11009 41649 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
11010 41649 : fd_vote_epoch_credits_new( elem );
11011 41649 : fd_vote_epoch_credits_decode_unsafe( elem, ctx );
11012 41649 : }
11013 2463 : fd_vote_block_timestamp_decode_unsafe( &self->last_timestamp, ctx );
11014 2463 : }
11015 75 : int fd_vote_state_1_14_11_encode( fd_vote_state_1_14_11_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11016 75 : int err;
11017 75 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
11018 75 : if( FD_UNLIKELY( err ) ) return err;
11019 75 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
11020 75 : if( FD_UNLIKELY( err ) ) return err;
11021 75 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
11022 75 : if( FD_UNLIKELY( err ) ) return err;
11023 75 : if( self->votes ) {
11024 72 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
11025 72 : err = fd_bincode_uint64_encode( votes_len, ctx );
11026 72 : if( FD_UNLIKELY( err ) ) return err;
11027 789 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
11028 717 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
11029 717 : err = fd_vote_lockout_encode( ele, ctx );
11030 717 : if( FD_UNLIKELY( err ) ) return err;
11031 717 : }
11032 72 : } else {
11033 3 : ulong votes_len = 0;
11034 3 : err = fd_bincode_uint64_encode( votes_len, ctx );
11035 3 : if( FD_UNLIKELY( err ) ) return err;
11036 3 : }
11037 75 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
11038 75 : if( FD_UNLIKELY( err ) ) return err;
11039 75 : if( self->has_root_slot ) {
11040 42 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
11041 42 : if( FD_UNLIKELY( err ) ) return err;
11042 42 : }
11043 75 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
11044 75 : if( FD_UNLIKELY( err ) ) return err;
11045 75 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
11046 75 : if( FD_UNLIKELY( err ) ) return err;
11047 75 : if( self->epoch_credits ) {
11048 72 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
11049 72 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
11050 72 : if( FD_UNLIKELY( err ) ) return err;
11051 570 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
11052 498 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
11053 498 : err = fd_vote_epoch_credits_encode( ele, ctx );
11054 498 : if( FD_UNLIKELY( err ) ) return err;
11055 498 : }
11056 72 : } else {
11057 3 : ulong epoch_credits_len = 0;
11058 3 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
11059 3 : if( FD_UNLIKELY( err ) ) return err;
11060 3 : }
11061 75 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
11062 75 : if( FD_UNLIKELY( err ) ) return err;
11063 75 : return FD_BINCODE_SUCCESS;
11064 75 : }
11065 0 : int fd_vote_state_1_14_11_decode_offsets( fd_vote_state_1_14_11_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
11066 0 : uchar const * data = ctx->data;
11067 0 : int err;
11068 0 : self->node_pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
11069 0 : err = fd_pubkey_decode_preflight( ctx );
11070 0 : if( FD_UNLIKELY( err ) ) return err;
11071 0 : self->authorized_withdrawer_off = (uint)( (ulong)ctx->data - (ulong)data );
11072 0 : err = fd_pubkey_decode_preflight( ctx );
11073 0 : if( FD_UNLIKELY( err ) ) return err;
11074 0 : self->commission_off = (uint)( (ulong)ctx->data - (ulong)data );
11075 0 : err = fd_bincode_uint8_decode_preflight( ctx );
11076 0 : if( FD_UNLIKELY( err ) ) return err;
11077 0 : self->votes_off = (uint)( (ulong)ctx->data - (ulong)data );
11078 0 : ulong votes_len;
11079 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
11080 0 : if( FD_UNLIKELY( err ) ) return err;
11081 0 : ulong votes_sz;
11082 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11083 0 : err = fd_bincode_bytes_decode_preflight( votes_sz, ctx );
11084 0 : if( FD_UNLIKELY( err ) ) return err;
11085 0 : self->root_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
11086 0 : {
11087 0 : uchar o;
11088 0 : err = fd_bincode_bool_decode( &o, ctx );
11089 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11090 0 : if( o ) {
11091 0 : err = fd_bincode_uint64_decode_preflight( ctx );
11092 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11093 0 : }
11094 0 : }
11095 0 : self->authorized_voters_off = (uint)( (ulong)ctx->data - (ulong)data );
11096 0 : err = fd_vote_authorized_voters_decode_preflight( ctx );
11097 0 : if( FD_UNLIKELY( err ) ) return err;
11098 0 : self->prior_voters_off = (uint)( (ulong)ctx->data - (ulong)data );
11099 0 : err = fd_vote_prior_voters_decode_preflight( ctx );
11100 0 : if( FD_UNLIKELY( err ) ) return err;
11101 0 : self->epoch_credits_off = (uint)( (ulong)ctx->data - (ulong)data );
11102 0 : ulong epoch_credits_len;
11103 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
11104 0 : if( FD_UNLIKELY( err ) ) return err;
11105 0 : ulong epoch_credits_sz;
11106 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11107 0 : err = fd_bincode_bytes_decode_preflight( epoch_credits_sz, ctx );
11108 0 : if( FD_UNLIKELY( err ) ) return err;
11109 0 : self->last_timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
11110 0 : err = fd_vote_block_timestamp_decode_preflight( ctx );
11111 0 : if( FD_UNLIKELY( err ) ) return err;
11112 0 : return FD_BINCODE_SUCCESS;
11113 0 : }
11114 348 : void fd_vote_state_1_14_11_new(fd_vote_state_1_14_11_t * self) {
11115 348 : fd_memset( self, 0, sizeof(fd_vote_state_1_14_11_t) );
11116 348 : fd_pubkey_new( &self->node_pubkey );
11117 348 : fd_pubkey_new( &self->authorized_withdrawer );
11118 348 : fd_vote_authorized_voters_new( &self->authorized_voters );
11119 348 : fd_vote_prior_voters_new( &self->prior_voters );
11120 348 : fd_vote_block_timestamp_new( &self->last_timestamp );
11121 348 : }
11122 2355 : void fd_vote_state_1_14_11_destroy( fd_vote_state_1_14_11_t * self, fd_bincode_destroy_ctx_t * ctx ) {
11123 2355 : fd_pubkey_destroy( &self->node_pubkey, ctx );
11124 2355 : fd_pubkey_destroy( &self->authorized_withdrawer, ctx );
11125 2355 : if( self->votes ) {
11126 54522 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
11127 52167 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
11128 52167 : fd_vote_lockout_destroy( ele, ctx );
11129 52167 : }
11130 2355 : fd_valloc_free( ctx->valloc, deq_fd_vote_lockout_t_delete( deq_fd_vote_lockout_t_leave( self->votes) ) );
11131 2355 : self->votes = NULL;
11132 2355 : }
11133 2355 : if( self->has_root_slot ) {
11134 1326 : self->has_root_slot = 0;
11135 1326 : }
11136 2355 : fd_vote_authorized_voters_destroy( &self->authorized_voters, ctx );
11137 2355 : fd_vote_prior_voters_destroy( &self->prior_voters, ctx );
11138 2355 : if( self->epoch_credits ) {
11139 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
11140 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
11141 0 : fd_vote_epoch_credits_destroy( ele, ctx );
11142 0 : }
11143 0 : fd_valloc_free( ctx->valloc, deq_fd_vote_epoch_credits_t_delete( deq_fd_vote_epoch_credits_t_leave( self->epoch_credits) ) );
11144 0 : self->epoch_credits = NULL;
11145 0 : }
11146 2355 : fd_vote_block_timestamp_destroy( &self->last_timestamp, ctx );
11147 2355 : }
11148 :
11149 0 : ulong fd_vote_state_1_14_11_footprint( void ){ return FD_VOTE_STATE_1_14_11_FOOTPRINT; }
11150 0 : ulong fd_vote_state_1_14_11_align( void ){ return FD_VOTE_STATE_1_14_11_ALIGN; }
11151 :
11152 0 : void fd_vote_state_1_14_11_walk( void * w, fd_vote_state_1_14_11_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11153 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_1_14_11", level++ );
11154 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level );
11155 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level );
11156 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
11157 :
11158 : /* Walk deque */
11159 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++ );
11160 0 : if( self->votes ) {
11161 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
11162 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
11163 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
11164 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
11165 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level );
11166 0 : }
11167 0 : }
11168 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level-- );
11169 : /* Done walking deque */
11170 :
11171 0 : if( !self->has_root_slot ) {
11172 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level );
11173 0 : } else {
11174 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11175 0 : }
11176 0 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level );
11177 0 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level );
11178 :
11179 : /* Walk deque */
11180 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++ );
11181 0 : if( self->epoch_credits ) {
11182 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
11183 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
11184 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
11185 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
11186 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level );
11187 0 : }
11188 0 : }
11189 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level-- );
11190 : /* Done walking deque */
11191 :
11192 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level );
11193 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_1_14_11", level-- );
11194 0 : }
11195 81 : ulong fd_vote_state_1_14_11_size( fd_vote_state_1_14_11_t const * self ) {
11196 81 : ulong size = 0;
11197 81 : size += fd_pubkey_size( &self->node_pubkey );
11198 81 : size += fd_pubkey_size( &self->authorized_withdrawer );
11199 81 : size += sizeof(char);
11200 81 : if( self->votes ) {
11201 78 : size += sizeof(ulong);
11202 840 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes ); !deq_fd_vote_lockout_t_iter_done( self->votes, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
11203 762 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
11204 762 : size += fd_vote_lockout_size( ele );
11205 762 : }
11206 78 : } else {
11207 3 : size += sizeof(ulong);
11208 3 : }
11209 81 : size += sizeof(char);
11210 81 : if( self->has_root_slot ) {
11211 42 : size += sizeof(ulong);
11212 42 : }
11213 81 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
11214 81 : size += fd_vote_prior_voters_size( &self->prior_voters );
11215 81 : if( self->epoch_credits ) {
11216 78 : size += sizeof(ulong);
11217 609 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
11218 531 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
11219 531 : size += fd_vote_epoch_credits_size( ele );
11220 531 : }
11221 78 : } else {
11222 3 : size += sizeof(ulong);
11223 3 : }
11224 81 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
11225 81 : return size;
11226 81 : }
11227 :
11228 0 : int fd_vote_state_decode( fd_vote_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
11229 0 : void const * data = ctx->data;
11230 0 : int err = fd_vote_state_decode_preflight( ctx );
11231 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11232 0 : ctx->data = data;
11233 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
11234 0 : fd_vote_state_new( self );
11235 0 : }
11236 0 : fd_vote_state_decode_unsafe( self, ctx );
11237 0 : return FD_BINCODE_SUCCESS;
11238 0 : }
11239 4299 : int fd_vote_state_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
11240 4299 : int err;
11241 4299 : err = fd_pubkey_decode_preflight( ctx );
11242 4299 : if( FD_UNLIKELY( err ) ) return err;
11243 4263 : err = fd_pubkey_decode_preflight( ctx );
11244 4263 : if( FD_UNLIKELY( err ) ) return err;
11245 4239 : err = fd_bincode_uint8_decode_preflight( ctx );
11246 4239 : if( FD_UNLIKELY( err ) ) return err;
11247 4224 : ulong votes_len;
11248 4224 : err = fd_bincode_uint64_decode( &votes_len, ctx );
11249 4224 : if( FD_UNLIKELY( err ) ) return err;
11250 4209 : ulong votes_sz;
11251 4209 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11252 4143 : err = fd_bincode_bytes_decode_preflight( votes_sz, ctx );
11253 4143 : if( FD_UNLIKELY( err ) ) return err;
11254 4131 : {
11255 4131 : uchar o;
11256 4131 : err = fd_bincode_bool_decode( &o, ctx );
11257 4131 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11258 4098 : if( o ) {
11259 1578 : err = fd_bincode_uint64_decode_preflight( ctx );
11260 1578 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11261 1578 : }
11262 4098 : }
11263 4086 : err = fd_vote_authorized_voters_decode_preflight( ctx );
11264 4086 : if( FD_UNLIKELY( err ) ) return err;
11265 3861 : err = fd_vote_prior_voters_decode_preflight( ctx );
11266 3861 : if( FD_UNLIKELY( err ) ) return err;
11267 3546 : ulong epoch_credits_len;
11268 3546 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
11269 3546 : if( FD_UNLIKELY( err ) ) return err;
11270 3531 : ulong epoch_credits_sz;
11271 3531 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11272 3516 : err = fd_bincode_bytes_decode_preflight( epoch_credits_sz, ctx );
11273 3516 : if( FD_UNLIKELY( err ) ) return err;
11274 3501 : err = fd_vote_block_timestamp_decode_preflight( ctx );
11275 3501 : if( FD_UNLIKELY( err ) ) return err;
11276 3477 : return FD_BINCODE_SUCCESS;
11277 3501 : }
11278 3477 : void fd_vote_state_decode_unsafe( fd_vote_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
11279 3477 : fd_pubkey_decode_unsafe( &self->node_pubkey, ctx );
11280 3477 : fd_pubkey_decode_unsafe( &self->authorized_withdrawer, ctx );
11281 3477 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
11282 3477 : ulong votes_len;
11283 3477 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
11284 3477 : ulong votes_max = fd_ulong_max( votes_len, 32 );
11285 3477 : self->votes = deq_fd_landed_vote_t_alloc( ctx->valloc, votes_max );
11286 71034 : for( ulong i=0; i < votes_len; i++ ) {
11287 67557 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
11288 67557 : fd_landed_vote_new( elem );
11289 67557 : fd_landed_vote_decode_unsafe( elem, ctx );
11290 67557 : }
11291 3477 : {
11292 3477 : uchar o;
11293 3477 : fd_bincode_bool_decode_unsafe( &o, ctx );
11294 3477 : self->has_root_slot = !!o;
11295 3477 : if( o ) {
11296 1395 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
11297 1395 : }
11298 3477 : }
11299 3477 : fd_vote_authorized_voters_decode_unsafe( &self->authorized_voters, ctx );
11300 3477 : fd_vote_prior_voters_decode_unsafe( &self->prior_voters, ctx );
11301 3477 : ulong epoch_credits_len;
11302 3477 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
11303 3477 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
11304 3477 : self->epoch_credits = deq_fd_vote_epoch_credits_t_alloc( ctx->valloc, epoch_credits_max );
11305 45420 : for( ulong i=0; i < epoch_credits_len; i++ ) {
11306 41943 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
11307 41943 : fd_vote_epoch_credits_new( elem );
11308 41943 : fd_vote_epoch_credits_decode_unsafe( elem, ctx );
11309 41943 : }
11310 3477 : fd_vote_block_timestamp_decode_unsafe( &self->last_timestamp, ctx );
11311 3477 : }
11312 762 : int fd_vote_state_encode( fd_vote_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11313 762 : int err;
11314 762 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
11315 762 : if( FD_UNLIKELY( err ) ) return err;
11316 762 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
11317 762 : if( FD_UNLIKELY( err ) ) return err;
11318 762 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
11319 762 : if( FD_UNLIKELY( err ) ) return err;
11320 762 : if( self->votes ) {
11321 699 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
11322 699 : err = fd_bincode_uint64_encode( votes_len, ctx );
11323 699 : if( FD_UNLIKELY( err ) ) return err;
11324 10371 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes ); !deq_fd_landed_vote_t_iter_done( self->votes, iter ); iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
11325 9672 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
11326 9672 : err = fd_landed_vote_encode( ele, ctx );
11327 9672 : if( FD_UNLIKELY( err ) ) return err;
11328 9672 : }
11329 699 : } else {
11330 63 : ulong votes_len = 0;
11331 63 : err = fd_bincode_uint64_encode( votes_len, ctx );
11332 63 : if( FD_UNLIKELY( err ) ) return err;
11333 63 : }
11334 762 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
11335 762 : if( FD_UNLIKELY( err ) ) return err;
11336 762 : if( self->has_root_slot ) {
11337 342 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
11338 342 : if( FD_UNLIKELY( err ) ) return err;
11339 342 : }
11340 762 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
11341 762 : if( FD_UNLIKELY( err ) ) return err;
11342 762 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
11343 762 : if( FD_UNLIKELY( err ) ) return err;
11344 762 : if( self->epoch_credits ) {
11345 699 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
11346 699 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
11347 699 : if( FD_UNLIKELY( err ) ) return err;
11348 10653 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
11349 9954 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
11350 9954 : err = fd_vote_epoch_credits_encode( ele, ctx );
11351 9954 : if( FD_UNLIKELY( err ) ) return err;
11352 9954 : }
11353 699 : } else {
11354 63 : ulong epoch_credits_len = 0;
11355 63 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
11356 63 : if( FD_UNLIKELY( err ) ) return err;
11357 63 : }
11358 762 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
11359 762 : if( FD_UNLIKELY( err ) ) return err;
11360 762 : return FD_BINCODE_SUCCESS;
11361 762 : }
11362 0 : int fd_vote_state_decode_offsets( fd_vote_state_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
11363 0 : uchar const * data = ctx->data;
11364 0 : int err;
11365 0 : self->node_pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
11366 0 : err = fd_pubkey_decode_preflight( ctx );
11367 0 : if( FD_UNLIKELY( err ) ) return err;
11368 0 : self->authorized_withdrawer_off = (uint)( (ulong)ctx->data - (ulong)data );
11369 0 : err = fd_pubkey_decode_preflight( ctx );
11370 0 : if( FD_UNLIKELY( err ) ) return err;
11371 0 : self->commission_off = (uint)( (ulong)ctx->data - (ulong)data );
11372 0 : err = fd_bincode_uint8_decode_preflight( ctx );
11373 0 : if( FD_UNLIKELY( err ) ) return err;
11374 0 : self->votes_off = (uint)( (ulong)ctx->data - (ulong)data );
11375 0 : ulong votes_len;
11376 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
11377 0 : if( FD_UNLIKELY( err ) ) return err;
11378 0 : ulong votes_sz;
11379 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11380 0 : err = fd_bincode_bytes_decode_preflight( votes_sz, ctx );
11381 0 : if( FD_UNLIKELY( err ) ) return err;
11382 0 : self->root_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
11383 0 : {
11384 0 : uchar o;
11385 0 : err = fd_bincode_bool_decode( &o, ctx );
11386 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11387 0 : if( o ) {
11388 0 : err = fd_bincode_uint64_decode_preflight( ctx );
11389 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11390 0 : }
11391 0 : }
11392 0 : self->authorized_voters_off = (uint)( (ulong)ctx->data - (ulong)data );
11393 0 : err = fd_vote_authorized_voters_decode_preflight( ctx );
11394 0 : if( FD_UNLIKELY( err ) ) return err;
11395 0 : self->prior_voters_off = (uint)( (ulong)ctx->data - (ulong)data );
11396 0 : err = fd_vote_prior_voters_decode_preflight( ctx );
11397 0 : if( FD_UNLIKELY( err ) ) return err;
11398 0 : self->epoch_credits_off = (uint)( (ulong)ctx->data - (ulong)data );
11399 0 : ulong epoch_credits_len;
11400 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
11401 0 : if( FD_UNLIKELY( err ) ) return err;
11402 0 : ulong epoch_credits_sz;
11403 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11404 0 : err = fd_bincode_bytes_decode_preflight( epoch_credits_sz, ctx );
11405 0 : if( FD_UNLIKELY( err ) ) return err;
11406 0 : self->last_timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
11407 0 : err = fd_vote_block_timestamp_decode_preflight( ctx );
11408 0 : if( FD_UNLIKELY( err ) ) return err;
11409 0 : return FD_BINCODE_SUCCESS;
11410 0 : }
11411 78 : void fd_vote_state_new(fd_vote_state_t * self) {
11412 78 : fd_memset( self, 0, sizeof(fd_vote_state_t) );
11413 78 : fd_pubkey_new( &self->node_pubkey );
11414 78 : fd_pubkey_new( &self->authorized_withdrawer );
11415 78 : fd_vote_authorized_voters_new( &self->authorized_voters );
11416 78 : fd_vote_prior_voters_new( &self->prior_voters );
11417 78 : fd_vote_block_timestamp_new( &self->last_timestamp );
11418 78 : }
11419 348 : void fd_vote_state_destroy( fd_vote_state_t * self, fd_bincode_destroy_ctx_t * ctx ) {
11420 348 : fd_pubkey_destroy( &self->node_pubkey, ctx );
11421 348 : fd_pubkey_destroy( &self->authorized_withdrawer, ctx );
11422 348 : if( self->votes ) {
11423 4551 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes ); !deq_fd_landed_vote_t_iter_done( self->votes, iter ); iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
11424 4224 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
11425 4224 : fd_landed_vote_destroy( ele, ctx );
11426 4224 : }
11427 327 : fd_valloc_free( ctx->valloc, deq_fd_landed_vote_t_delete( deq_fd_landed_vote_t_leave( self->votes) ) );
11428 327 : self->votes = NULL;
11429 327 : }
11430 348 : if( self->has_root_slot ) {
11431 186 : self->has_root_slot = 0;
11432 186 : }
11433 348 : fd_vote_authorized_voters_destroy( &self->authorized_voters, ctx );
11434 348 : fd_vote_prior_voters_destroy( &self->prior_voters, ctx );
11435 348 : if( self->epoch_credits ) {
11436 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
11437 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
11438 0 : fd_vote_epoch_credits_destroy( ele, ctx );
11439 0 : }
11440 0 : fd_valloc_free( ctx->valloc, deq_fd_vote_epoch_credits_t_delete( deq_fd_vote_epoch_credits_t_leave( self->epoch_credits) ) );
11441 0 : self->epoch_credits = NULL;
11442 0 : }
11443 348 : fd_vote_block_timestamp_destroy( &self->last_timestamp, ctx );
11444 348 : }
11445 :
11446 0 : ulong fd_vote_state_footprint( void ){ return FD_VOTE_STATE_FOOTPRINT; }
11447 0 : ulong fd_vote_state_align( void ){ return FD_VOTE_STATE_ALIGN; }
11448 :
11449 3 : void fd_vote_state_walk( void * w, fd_vote_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11450 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state", level++ );
11451 3 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level );
11452 3 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level );
11453 3 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
11454 :
11455 : /* Walk deque */
11456 3 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++ );
11457 3 : if( self->votes ) {
11458 3 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes );
11459 6 : !deq_fd_landed_vote_t_iter_done( self->votes, iter );
11460 3 : iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
11461 3 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
11462 3 : fd_landed_vote_walk(w, ele, fun, "votes", level );
11463 3 : }
11464 3 : }
11465 3 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level-- );
11466 : /* Done walking deque */
11467 :
11468 3 : if( !self->has_root_slot ) {
11469 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level );
11470 3 : } else {
11471 3 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11472 3 : }
11473 3 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level );
11474 3 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level );
11475 :
11476 : /* Walk deque */
11477 3 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++ );
11478 3 : if( self->epoch_credits ) {
11479 3 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
11480 6 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
11481 3 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
11482 3 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
11483 3 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level );
11484 3 : }
11485 3 : }
11486 3 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level-- );
11487 : /* Done walking deque */
11488 :
11489 3 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level );
11490 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state", level-- );
11491 3 : }
11492 765 : ulong fd_vote_state_size( fd_vote_state_t const * self ) {
11493 765 : ulong size = 0;
11494 765 : size += fd_pubkey_size( &self->node_pubkey );
11495 765 : size += fd_pubkey_size( &self->authorized_withdrawer );
11496 765 : size += sizeof(char);
11497 765 : if( self->votes ) {
11498 714 : size += sizeof(ulong);
11499 11532 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes ); !deq_fd_landed_vote_t_iter_done( self->votes, iter ); iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
11500 10818 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
11501 10818 : size += fd_landed_vote_size( ele );
11502 10818 : }
11503 714 : } else {
11504 51 : size += sizeof(ulong);
11505 51 : }
11506 765 : size += sizeof(char);
11507 765 : if( self->has_root_slot ) {
11508 345 : size += sizeof(ulong);
11509 345 : }
11510 765 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
11511 765 : size += fd_vote_prior_voters_size( &self->prior_voters );
11512 765 : if( self->epoch_credits ) {
11513 714 : size += sizeof(ulong);
11514 11052 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits ); !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter ); iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
11515 10338 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
11516 10338 : size += fd_vote_epoch_credits_size( ele );
11517 10338 : }
11518 714 : } else {
11519 51 : size += sizeof(ulong);
11520 51 : }
11521 765 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
11522 765 : return size;
11523 765 : }
11524 :
11525 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v0_23_5(fd_vote_state_versioned_t const * self) {
11526 0 : return self->discriminant == 0;
11527 0 : }
11528 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v1_14_11(fd_vote_state_versioned_t const * self) {
11529 0 : return self->discriminant == 1;
11530 0 : }
11531 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_current(fd_vote_state_versioned_t const * self) {
11532 0 : return self->discriminant == 2;
11533 0 : }
11534 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant );
11535 11829 : int fd_vote_state_versioned_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
11536 11829 : int err;
11537 11829 : switch (discriminant) {
11538 3123 : case 0: {
11539 3123 : err = fd_vote_state_0_23_5_decode_preflight( ctx );
11540 3123 : if( FD_UNLIKELY( err ) ) return err;
11541 2133 : return FD_BINCODE_SUCCESS;
11542 3123 : }
11543 3309 : case 1: {
11544 3309 : err = fd_vote_state_1_14_11_decode_preflight( ctx );
11545 3309 : if( FD_UNLIKELY( err ) ) return err;
11546 2463 : return FD_BINCODE_SUCCESS;
11547 3309 : }
11548 4299 : case 2: {
11549 4299 : err = fd_vote_state_decode_preflight( ctx );
11550 4299 : if( FD_UNLIKELY( err ) ) return err;
11551 3477 : return FD_BINCODE_SUCCESS;
11552 4299 : }
11553 1098 : default: return FD_BINCODE_ERR_ENCODING;
11554 11829 : }
11555 11829 : }
11556 8073 : void fd_vote_state_versioned_inner_decode_unsafe( fd_vote_state_versioned_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
11557 8073 : switch (discriminant) {
11558 2133 : case 0: {
11559 2133 : fd_vote_state_0_23_5_decode_unsafe( &self->v0_23_5, ctx );
11560 2133 : break;
11561 0 : }
11562 2463 : case 1: {
11563 2463 : fd_vote_state_1_14_11_decode_unsafe( &self->v1_14_11, ctx );
11564 2463 : break;
11565 0 : }
11566 3477 : case 2: {
11567 3477 : fd_vote_state_decode_unsafe( &self->current, ctx );
11568 3477 : break;
11569 0 : }
11570 8073 : }
11571 8073 : }
11572 12003 : int fd_vote_state_versioned_decode( fd_vote_state_versioned_t * self, fd_bincode_decode_ctx_t * ctx ) {
11573 12003 : void const * data = ctx->data;
11574 12003 : int err = fd_vote_state_versioned_decode_preflight( ctx );
11575 12003 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11576 8073 : ctx->data = data;
11577 8073 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
11578 8073 : fd_vote_state_versioned_new( self );
11579 8073 : }
11580 8073 : fd_vote_state_versioned_decode_unsafe( self, ctx );
11581 8073 : return FD_BINCODE_SUCCESS;
11582 12003 : }
11583 12003 : int fd_vote_state_versioned_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
11584 12003 : uint discriminant = 0;
11585 12003 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11586 12003 : if( FD_UNLIKELY( err ) ) return err;
11587 11829 : return fd_vote_state_versioned_inner_decode_preflight( discriminant, ctx );
11588 12003 : }
11589 8073 : void fd_vote_state_versioned_decode_unsafe( fd_vote_state_versioned_t * self, fd_bincode_decode_ctx_t * ctx ) {
11590 8073 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11591 8073 : fd_vote_state_versioned_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
11592 8073 : }
11593 8508 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
11594 8508 : switch( discriminant ) {
11595 0 : case 0: {
11596 0 : fd_vote_state_0_23_5_new( &self->v0_23_5 );
11597 0 : break;
11598 0 : }
11599 348 : case 1: {
11600 348 : fd_vote_state_1_14_11_new( &self->v1_14_11 );
11601 348 : break;
11602 0 : }
11603 78 : case 2: {
11604 78 : fd_vote_state_new( &self->current );
11605 78 : break;
11606 0 : }
11607 8082 : default: break; // FD_LOG_ERR(( "unhandled type"));
11608 8508 : }
11609 8508 : }
11610 8508 : void fd_vote_state_versioned_new_disc( fd_vote_state_versioned_t * self, uint discriminant ) {
11611 8508 : self->discriminant = discriminant;
11612 8508 : fd_vote_state_versioned_inner_new( &self->inner, self->discriminant );
11613 8508 : }
11614 8082 : void fd_vote_state_versioned_new( fd_vote_state_versioned_t * self ) {
11615 8082 : fd_memset( self, 0, sizeof(fd_vote_state_versioned_t) );
11616 8082 : fd_vote_state_versioned_new_disc( self, UINT_MAX );
11617 8082 : }
11618 0 : void fd_vote_state_versioned_inner_destroy( fd_vote_state_versioned_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
11619 0 : switch( discriminant ) {
11620 0 : case 0: {
11621 0 : fd_vote_state_0_23_5_destroy( &self->v0_23_5, ctx );
11622 0 : break;
11623 0 : }
11624 0 : case 1: {
11625 0 : fd_vote_state_1_14_11_destroy( &self->v1_14_11, ctx );
11626 0 : break;
11627 0 : }
11628 0 : case 2: {
11629 0 : fd_vote_state_destroy( &self->current, ctx );
11630 0 : break;
11631 0 : }
11632 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
11633 0 : }
11634 0 : }
11635 0 : void fd_vote_state_versioned_destroy( fd_vote_state_versioned_t * self, fd_bincode_destroy_ctx_t * ctx ) {
11636 0 : fd_vote_state_versioned_inner_destroy( &self->inner, self->discriminant, ctx );
11637 0 : }
11638 :
11639 0 : ulong fd_vote_state_versioned_footprint( void ){ return FD_VOTE_STATE_VERSIONED_FOOTPRINT; }
11640 0 : ulong fd_vote_state_versioned_align( void ){ return FD_VOTE_STATE_VERSIONED_ALIGN; }
11641 :
11642 3 : void fd_vote_state_versioned_walk( void * w, fd_vote_state_versioned_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11643 3 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_state_versioned", level++);
11644 3 : switch( self->discriminant ) {
11645 0 : case 0: {
11646 0 : fun( w, self, "v0_23_5", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
11647 0 : fd_vote_state_0_23_5_walk( w, &self->inner.v0_23_5, fun, "v0_23_5", level );
11648 0 : break;
11649 0 : }
11650 0 : case 1: {
11651 0 : fun( w, self, "v1_14_11", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
11652 0 : fd_vote_state_1_14_11_walk( w, &self->inner.v1_14_11, fun, "v1_14_11", level );
11653 0 : break;
11654 0 : }
11655 3 : case 2: {
11656 3 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
11657 3 : fd_vote_state_walk( w, &self->inner.current, fun, "current", level );
11658 3 : break;
11659 0 : }
11660 3 : }
11661 3 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_state_versioned", level-- );
11662 3 : }
11663 846 : ulong fd_vote_state_versioned_size( fd_vote_state_versioned_t const * self ) {
11664 846 : ulong size = 0;
11665 846 : size += sizeof(uint);
11666 846 : switch (self->discriminant) {
11667 0 : case 0: {
11668 0 : size += fd_vote_state_0_23_5_size( &self->inner.v0_23_5 );
11669 0 : break;
11670 0 : }
11671 81 : case 1: {
11672 81 : size += fd_vote_state_1_14_11_size( &self->inner.v1_14_11 );
11673 81 : break;
11674 0 : }
11675 765 : case 2: {
11676 765 : size += fd_vote_state_size( &self->inner.current );
11677 765 : break;
11678 0 : }
11679 846 : }
11680 846 : return size;
11681 846 : }
11682 :
11683 837 : int fd_vote_state_versioned_inner_encode( fd_vote_state_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
11684 837 : int err;
11685 837 : switch (discriminant) {
11686 0 : case 0: {
11687 0 : err = fd_vote_state_0_23_5_encode( &self->v0_23_5, ctx );
11688 0 : if( FD_UNLIKELY( err ) ) return err;
11689 0 : break;
11690 0 : }
11691 75 : case 1: {
11692 75 : err = fd_vote_state_1_14_11_encode( &self->v1_14_11, ctx );
11693 75 : if( FD_UNLIKELY( err ) ) return err;
11694 75 : break;
11695 75 : }
11696 762 : case 2: {
11697 762 : err = fd_vote_state_encode( &self->current, ctx );
11698 762 : if( FD_UNLIKELY( err ) ) return err;
11699 762 : break;
11700 762 : }
11701 837 : }
11702 837 : return FD_BINCODE_SUCCESS;
11703 837 : }
11704 837 : int fd_vote_state_versioned_encode( fd_vote_state_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11705 837 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11706 837 : if( FD_UNLIKELY( err ) ) return err;
11707 837 : return fd_vote_state_versioned_inner_encode( &self->inner, self->discriminant, ctx );
11708 837 : }
11709 :
11710 0 : int fd_vote_state_update_decode( fd_vote_state_update_t * self, fd_bincode_decode_ctx_t * ctx ) {
11711 0 : void const * data = ctx->data;
11712 0 : int err = fd_vote_state_update_decode_preflight( ctx );
11713 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11714 0 : ctx->data = data;
11715 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
11716 0 : fd_vote_state_update_new( self );
11717 0 : }
11718 0 : fd_vote_state_update_decode_unsafe( self, ctx );
11719 0 : return FD_BINCODE_SUCCESS;
11720 0 : }
11721 1722 : int fd_vote_state_update_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
11722 1722 : int err;
11723 1722 : ulong lockouts_len;
11724 1722 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
11725 1722 : if( FD_UNLIKELY( err ) ) return err;
11726 1710 : ulong lockouts_sz;
11727 1710 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11728 1698 : err = fd_bincode_bytes_decode_preflight( lockouts_sz, ctx );
11729 1698 : if( FD_UNLIKELY( err ) ) return err;
11730 1686 : {
11731 1686 : uchar o;
11732 1686 : err = fd_bincode_bool_decode( &o, ctx );
11733 1686 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11734 1662 : if( o ) {
11735 912 : err = fd_bincode_uint64_decode_preflight( ctx );
11736 912 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11737 912 : }
11738 1662 : }
11739 1650 : err = fd_hash_decode_preflight( ctx );
11740 1650 : if( FD_UNLIKELY( err ) ) return err;
11741 1635 : {
11742 1635 : uchar o;
11743 1635 : err = fd_bincode_bool_decode( &o, ctx );
11744 1635 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11745 1611 : if( o ) {
11746 795 : err = fd_bincode_int64_decode_preflight( ctx );
11747 795 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11748 795 : }
11749 1611 : }
11750 1599 : return FD_BINCODE_SUCCESS;
11751 1611 : }
11752 1593 : void fd_vote_state_update_decode_unsafe( fd_vote_state_update_t * self, fd_bincode_decode_ctx_t * ctx ) {
11753 1593 : ulong lockouts_len;
11754 1593 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
11755 1593 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
11756 1593 : self->lockouts = deq_fd_vote_lockout_t_alloc( ctx->valloc, lockouts_max );
11757 57288 : for( ulong i=0; i < lockouts_len; i++ ) {
11758 55695 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->lockouts );
11759 55695 : fd_vote_lockout_new( elem );
11760 55695 : fd_vote_lockout_decode_unsafe( elem, ctx );
11761 55695 : }
11762 1593 : {
11763 1593 : uchar o;
11764 1593 : fd_bincode_bool_decode_unsafe( &o, ctx );
11765 1593 : self->has_root = !!o;
11766 1593 : if( o ) {
11767 876 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
11768 876 : }
11769 1593 : }
11770 1593 : fd_hash_decode_unsafe( &self->hash, ctx );
11771 1593 : {
11772 1593 : uchar o;
11773 1593 : fd_bincode_bool_decode_unsafe( &o, ctx );
11774 1593 : self->has_timestamp = !!o;
11775 1593 : if( o ) {
11776 783 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
11777 783 : }
11778 1593 : }
11779 1593 : }
11780 0 : int fd_vote_state_update_encode( fd_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11781 0 : int err;
11782 0 : if( self->lockouts ) {
11783 0 : ulong lockouts_len = deq_fd_vote_lockout_t_cnt( self->lockouts );
11784 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
11785 0 : if( FD_UNLIKELY( err ) ) return err;
11786 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts ); !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
11787 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->lockouts, iter );
11788 0 : err = fd_vote_lockout_encode( ele, ctx );
11789 0 : if( FD_UNLIKELY( err ) ) return err;
11790 0 : }
11791 0 : } else {
11792 0 : ulong lockouts_len = 0;
11793 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
11794 0 : if( FD_UNLIKELY( err ) ) return err;
11795 0 : }
11796 0 : err = fd_bincode_bool_encode( self->has_root, ctx );
11797 0 : if( FD_UNLIKELY( err ) ) return err;
11798 0 : if( self->has_root ) {
11799 0 : err = fd_bincode_uint64_encode( self->root, ctx );
11800 0 : if( FD_UNLIKELY( err ) ) return err;
11801 0 : }
11802 0 : err = fd_hash_encode( &self->hash, ctx );
11803 0 : if( FD_UNLIKELY( err ) ) return err;
11804 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
11805 0 : if( FD_UNLIKELY( err ) ) return err;
11806 0 : if( self->has_timestamp ) {
11807 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
11808 0 : if( FD_UNLIKELY( err ) ) return err;
11809 0 : }
11810 0 : return FD_BINCODE_SUCCESS;
11811 0 : }
11812 0 : int fd_vote_state_update_decode_offsets( fd_vote_state_update_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
11813 0 : uchar const * data = ctx->data;
11814 0 : int err;
11815 0 : self->lockouts_off = (uint)( (ulong)ctx->data - (ulong)data );
11816 0 : ulong lockouts_len;
11817 0 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
11818 0 : if( FD_UNLIKELY( err ) ) return err;
11819 0 : ulong lockouts_sz;
11820 0 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
11821 0 : err = fd_bincode_bytes_decode_preflight( lockouts_sz, ctx );
11822 0 : if( FD_UNLIKELY( err ) ) return err;
11823 0 : self->root_off = (uint)( (ulong)ctx->data - (ulong)data );
11824 0 : {
11825 0 : uchar o;
11826 0 : err = fd_bincode_bool_decode( &o, ctx );
11827 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11828 0 : if( o ) {
11829 0 : err = fd_bincode_uint64_decode_preflight( ctx );
11830 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11831 0 : }
11832 0 : }
11833 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
11834 0 : err = fd_hash_decode_preflight( ctx );
11835 0 : if( FD_UNLIKELY( err ) ) return err;
11836 0 : self->timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
11837 0 : {
11838 0 : uchar o;
11839 0 : err = fd_bincode_bool_decode( &o, ctx );
11840 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11841 0 : if( o ) {
11842 0 : err = fd_bincode_int64_decode_preflight( ctx );
11843 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11844 0 : }
11845 0 : }
11846 0 : return FD_BINCODE_SUCCESS;
11847 0 : }
11848 402 : void fd_vote_state_update_new(fd_vote_state_update_t * self) {
11849 402 : fd_memset( self, 0, sizeof(fd_vote_state_update_t) );
11850 402 : fd_hash_new( &self->hash );
11851 402 : }
11852 0 : void fd_vote_state_update_destroy( fd_vote_state_update_t * self, fd_bincode_destroy_ctx_t * ctx ) {
11853 0 : if( self->lockouts ) {
11854 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts ); !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
11855 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
11856 0 : fd_vote_lockout_destroy( ele, ctx );
11857 0 : }
11858 0 : fd_valloc_free( ctx->valloc, deq_fd_vote_lockout_t_delete( deq_fd_vote_lockout_t_leave( self->lockouts) ) );
11859 0 : self->lockouts = NULL;
11860 0 : }
11861 0 : if( self->has_root ) {
11862 0 : self->has_root = 0;
11863 0 : }
11864 0 : fd_hash_destroy( &self->hash, ctx );
11865 0 : if( self->has_timestamp ) {
11866 0 : self->has_timestamp = 0;
11867 0 : }
11868 0 : }
11869 :
11870 0 : ulong fd_vote_state_update_footprint( void ){ return FD_VOTE_STATE_UPDATE_FOOTPRINT; }
11871 0 : ulong fd_vote_state_update_align( void ){ return FD_VOTE_STATE_UPDATE_ALIGN; }
11872 :
11873 0 : void fd_vote_state_update_walk( void * w, fd_vote_state_update_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
11874 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_update", level++ );
11875 :
11876 : /* Walk deque */
11877 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++ );
11878 0 : if( self->lockouts ) {
11879 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
11880 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
11881 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
11882 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
11883 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level );
11884 0 : }
11885 0 : }
11886 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level-- );
11887 : /* Done walking deque */
11888 :
11889 0 : if( !self->has_root ) {
11890 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level );
11891 0 : } else {
11892 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
11893 0 : }
11894 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
11895 0 : if( !self->has_timestamp ) {
11896 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
11897 0 : } else {
11898 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
11899 0 : }
11900 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_update", level-- );
11901 0 : }
11902 0 : ulong fd_vote_state_update_size( fd_vote_state_update_t const * self ) {
11903 0 : ulong size = 0;
11904 0 : if( self->lockouts ) {
11905 0 : size += sizeof(ulong);
11906 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts ); !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
11907 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
11908 0 : size += fd_vote_lockout_size( ele );
11909 0 : }
11910 0 : } else {
11911 0 : size += sizeof(ulong);
11912 0 : }
11913 0 : size += sizeof(char);
11914 0 : if( self->has_root ) {
11915 0 : size += sizeof(ulong);
11916 0 : }
11917 0 : size += fd_hash_size( &self->hash );
11918 0 : size += sizeof(char);
11919 0 : if( self->has_timestamp ) {
11920 0 : size += sizeof(long);
11921 0 : }
11922 0 : return size;
11923 0 : }
11924 :
11925 0 : int fd_compact_vote_state_update_decode( fd_compact_vote_state_update_t * self, fd_bincode_decode_ctx_t * ctx ) {
11926 0 : void const * data = ctx->data;
11927 0 : int err = fd_compact_vote_state_update_decode_preflight( ctx );
11928 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11929 0 : ctx->data = data;
11930 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
11931 0 : fd_compact_vote_state_update_new( self );
11932 0 : }
11933 0 : fd_compact_vote_state_update_decode_unsafe( self, ctx );
11934 0 : return FD_BINCODE_SUCCESS;
11935 0 : }
11936 1371 : int fd_compact_vote_state_update_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
11937 1371 : int err;
11938 1371 : err = fd_bincode_uint64_decode_preflight( ctx );
11939 1371 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11940 1365 : ushort lockouts_len;
11941 1365 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
11942 1365 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11943 1332 : if( lockouts_len ) {
11944 64932 : for( ulong i=0; i < lockouts_len; i++ ) {
11945 63837 : err = fd_lockout_offset_decode_preflight( ctx );
11946 63837 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11947 63837 : }
11948 1212 : }
11949 1215 : err = fd_hash_decode_preflight( ctx );
11950 1215 : if( FD_UNLIKELY( err ) ) return err;
11951 1206 : {
11952 1206 : uchar o;
11953 1206 : err = fd_bincode_bool_decode( &o, ctx );
11954 1206 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11955 417 : if( o ) {
11956 108 : err = fd_bincode_int64_decode_preflight( ctx );
11957 108 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11958 108 : }
11959 417 : }
11960 408 : return FD_BINCODE_SUCCESS;
11961 417 : }
11962 402 : void fd_compact_vote_state_update_decode_unsafe( fd_compact_vote_state_update_t * self, fd_bincode_decode_ctx_t * ctx ) {
11963 402 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
11964 402 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
11965 402 : if( self->lockouts_len ) {
11966 336 : self->lockouts = (fd_lockout_offset_t *)fd_valloc_malloc( ctx->valloc, FD_LOCKOUT_OFFSET_ALIGN, FD_LOCKOUT_OFFSET_FOOTPRINT*self->lockouts_len );
11967 5109 : for( ulong i=0; i < self->lockouts_len; i++ ) {
11968 4773 : fd_lockout_offset_new( self->lockouts + i );
11969 4773 : fd_lockout_offset_decode_unsafe( self->lockouts + i, ctx );
11970 4773 : }
11971 336 : } else
11972 66 : self->lockouts = NULL;
11973 402 : fd_hash_decode_unsafe( &self->hash, ctx );
11974 402 : {
11975 402 : uchar o;
11976 402 : fd_bincode_bool_decode_unsafe( &o, ctx );
11977 402 : self->has_timestamp = !!o;
11978 402 : if( o ) {
11979 99 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
11980 99 : }
11981 402 : }
11982 402 : }
11983 0 : int fd_compact_vote_state_update_encode( fd_compact_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11984 0 : int err;
11985 0 : err = fd_bincode_uint64_encode( self->root, ctx );
11986 0 : if( FD_UNLIKELY( err ) ) return err;
11987 0 : err = fd_bincode_compact_u16_encode( &self->lockouts_len, ctx );
11988 0 : if( FD_UNLIKELY(err) ) return err;
11989 0 : if( self->lockouts_len ) {
11990 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
11991 0 : err = fd_lockout_offset_encode( self->lockouts + i, ctx );
11992 0 : if( FD_UNLIKELY( err ) ) return err;
11993 0 : }
11994 0 : }
11995 0 : err = fd_hash_encode( &self->hash, ctx );
11996 0 : if( FD_UNLIKELY( err ) ) return err;
11997 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
11998 0 : if( FD_UNLIKELY( err ) ) return err;
11999 0 : if( self->has_timestamp ) {
12000 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
12001 0 : if( FD_UNLIKELY( err ) ) return err;
12002 0 : }
12003 0 : return FD_BINCODE_SUCCESS;
12004 0 : }
12005 0 : int fd_compact_vote_state_update_decode_offsets( fd_compact_vote_state_update_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
12006 0 : uchar const * data = ctx->data;
12007 0 : int err;
12008 0 : self->root_off = (uint)( (ulong)ctx->data - (ulong)data );
12009 0 : err = fd_bincode_uint64_decode_preflight( ctx );
12010 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12011 0 : self->lockouts_off = (uint)( (ulong)ctx->data - (ulong)data );
12012 0 : ushort lockouts_len;
12013 0 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
12014 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12015 0 : if( lockouts_len ) {
12016 0 : for( ulong i=0; i < lockouts_len; i++ ) {
12017 0 : err = fd_lockout_offset_decode_preflight( ctx );
12018 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12019 0 : }
12020 0 : }
12021 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
12022 0 : err = fd_hash_decode_preflight( ctx );
12023 0 : if( FD_UNLIKELY( err ) ) return err;
12024 0 : self->timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
12025 0 : {
12026 0 : uchar o;
12027 0 : err = fd_bincode_bool_decode( &o, ctx );
12028 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12029 0 : if( o ) {
12030 0 : err = fd_bincode_int64_decode_preflight( ctx );
12031 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12032 0 : }
12033 0 : }
12034 0 : return FD_BINCODE_SUCCESS;
12035 0 : }
12036 0 : void fd_compact_vote_state_update_new(fd_compact_vote_state_update_t * self) {
12037 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_t) );
12038 0 : fd_hash_new( &self->hash );
12039 0 : }
12040 0 : void fd_compact_vote_state_update_destroy( fd_compact_vote_state_update_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12041 0 : if( self->lockouts ) {
12042 0 : for( ulong i=0; i < self->lockouts_len; i++ )
12043 0 : fd_lockout_offset_destroy( self->lockouts + i, ctx );
12044 0 : fd_valloc_free( ctx->valloc, self->lockouts );
12045 0 : self->lockouts = NULL;
12046 0 : }
12047 0 : fd_hash_destroy( &self->hash, ctx );
12048 0 : if( self->has_timestamp ) {
12049 0 : self->has_timestamp = 0;
12050 0 : }
12051 0 : }
12052 :
12053 0 : ulong fd_compact_vote_state_update_footprint( void ){ return FD_COMPACT_VOTE_STATE_UPDATE_FOOTPRINT; }
12054 0 : ulong fd_compact_vote_state_update_align( void ){ return FD_COMPACT_VOTE_STATE_UPDATE_ALIGN; }
12055 :
12056 0 : void fd_compact_vote_state_update_walk( void * w, fd_compact_vote_state_update_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12057 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update", level++ );
12058 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12059 0 : if( self->lockouts_len ) {
12060 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR, "array", level++ );
12061 0 : for( ulong i=0; i < self->lockouts_len; i++ )
12062 0 : fd_lockout_offset_walk(w, self->lockouts + i, fun, "lockout_offset", level );
12063 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
12064 0 : }
12065 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
12066 0 : if( !self->has_timestamp ) {
12067 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
12068 0 : } else {
12069 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
12070 0 : }
12071 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update", level-- );
12072 0 : }
12073 0 : ulong fd_compact_vote_state_update_size( fd_compact_vote_state_update_t const * self ) {
12074 0 : ulong size = 0;
12075 0 : size += sizeof(ulong);
12076 0 : do {
12077 0 : ushort tmp = (ushort)self->lockouts_len;
12078 0 : size += fd_bincode_compact_u16_size( &tmp );
12079 0 : for( ulong i=0; i < self->lockouts_len; i++ )
12080 0 : size += fd_lockout_offset_size( self->lockouts + i );
12081 0 : } while(0);
12082 0 : size += fd_hash_size( &self->hash );
12083 0 : size += sizeof(char);
12084 0 : if( self->has_timestamp ) {
12085 0 : size += sizeof(long);
12086 0 : }
12087 0 : return size;
12088 0 : }
12089 :
12090 0 : int fd_compact_vote_state_update_switch_decode( fd_compact_vote_state_update_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
12091 0 : void const * data = ctx->data;
12092 0 : int err = fd_compact_vote_state_update_switch_decode_preflight( ctx );
12093 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12094 0 : ctx->data = data;
12095 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12096 0 : fd_compact_vote_state_update_switch_new( self );
12097 0 : }
12098 0 : fd_compact_vote_state_update_switch_decode_unsafe( self, ctx );
12099 0 : return FD_BINCODE_SUCCESS;
12100 0 : }
12101 597 : int fd_compact_vote_state_update_switch_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
12102 597 : int err;
12103 597 : err = fd_compact_vote_state_update_decode_preflight( ctx );
12104 597 : if( FD_UNLIKELY( err ) ) return err;
12105 168 : err = fd_hash_decode_preflight( ctx );
12106 168 : if( FD_UNLIKELY( err ) ) return err;
12107 162 : return FD_BINCODE_SUCCESS;
12108 168 : }
12109 162 : void fd_compact_vote_state_update_switch_decode_unsafe( fd_compact_vote_state_update_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
12110 162 : fd_compact_vote_state_update_decode_unsafe( &self->compact_vote_state_update, ctx );
12111 162 : fd_hash_decode_unsafe( &self->hash, ctx );
12112 162 : }
12113 0 : int fd_compact_vote_state_update_switch_encode( fd_compact_vote_state_update_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12114 0 : int err;
12115 0 : err = fd_compact_vote_state_update_encode( &self->compact_vote_state_update, ctx );
12116 0 : if( FD_UNLIKELY( err ) ) return err;
12117 0 : err = fd_hash_encode( &self->hash, ctx );
12118 0 : if( FD_UNLIKELY( err ) ) return err;
12119 0 : return FD_BINCODE_SUCCESS;
12120 0 : }
12121 0 : int fd_compact_vote_state_update_switch_decode_offsets( fd_compact_vote_state_update_switch_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
12122 0 : uchar const * data = ctx->data;
12123 0 : int err;
12124 0 : self->compact_vote_state_update_off = (uint)( (ulong)ctx->data - (ulong)data );
12125 0 : err = fd_compact_vote_state_update_decode_preflight( ctx );
12126 0 : if( FD_UNLIKELY( err ) ) return err;
12127 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
12128 0 : err = fd_hash_decode_preflight( ctx );
12129 0 : if( FD_UNLIKELY( err ) ) return err;
12130 0 : return FD_BINCODE_SUCCESS;
12131 0 : }
12132 0 : void fd_compact_vote_state_update_switch_new(fd_compact_vote_state_update_switch_t * self) {
12133 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_switch_t) );
12134 0 : fd_compact_vote_state_update_new( &self->compact_vote_state_update );
12135 0 : fd_hash_new( &self->hash );
12136 0 : }
12137 0 : void fd_compact_vote_state_update_switch_destroy( fd_compact_vote_state_update_switch_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12138 0 : fd_compact_vote_state_update_destroy( &self->compact_vote_state_update, ctx );
12139 0 : fd_hash_destroy( &self->hash, ctx );
12140 0 : }
12141 :
12142 0 : ulong fd_compact_vote_state_update_switch_footprint( void ){ return FD_COMPACT_VOTE_STATE_UPDATE_SWITCH_FOOTPRINT; }
12143 0 : ulong fd_compact_vote_state_update_switch_align( void ){ return FD_COMPACT_VOTE_STATE_UPDATE_SWITCH_ALIGN; }
12144 :
12145 0 : void fd_compact_vote_state_update_switch_walk( void * w, fd_compact_vote_state_update_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12146 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update_switch", level++ );
12147 0 : fd_compact_vote_state_update_walk( w, &self->compact_vote_state_update, fun, "compact_vote_state_update", level );
12148 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
12149 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update_switch", level-- );
12150 0 : }
12151 0 : ulong fd_compact_vote_state_update_switch_size( fd_compact_vote_state_update_switch_t const * self ) {
12152 0 : ulong size = 0;
12153 0 : size += fd_compact_vote_state_update_size( &self->compact_vote_state_update );
12154 0 : size += fd_hash_size( &self->hash );
12155 0 : return size;
12156 0 : }
12157 :
12158 1248 : int fd_compact_tower_sync_decode( fd_compact_tower_sync_t * self, fd_bincode_decode_ctx_t * ctx ) {
12159 1248 : void const * data = ctx->data;
12160 1248 : int err = fd_compact_tower_sync_decode_preflight( ctx );
12161 1248 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12162 285 : ctx->data = data;
12163 285 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12164 285 : fd_compact_tower_sync_new( self );
12165 285 : }
12166 285 : fd_compact_tower_sync_decode_unsafe( self, ctx );
12167 285 : return FD_BINCODE_SUCCESS;
12168 1248 : }
12169 1248 : int fd_compact_tower_sync_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
12170 1248 : int err;
12171 1248 : err = fd_bincode_uint64_decode_preflight( ctx );
12172 1248 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12173 1242 : ushort lockout_offsets_len;
12174 1242 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
12175 1242 : if( FD_UNLIKELY( err ) ) return err;
12176 14346 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
12177 14016 : err = fd_lockout_offset_decode_preflight( ctx );
12178 14016 : if( FD_UNLIKELY( err ) ) return err;
12179 14016 : }
12180 330 : err = fd_hash_decode_preflight( ctx );
12181 330 : if( FD_UNLIKELY( err ) ) return err;
12182 321 : {
12183 321 : uchar o;
12184 321 : err = fd_bincode_bool_decode( &o, ctx );
12185 321 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12186 300 : if( o ) {
12187 72 : err = fd_bincode_int64_decode_preflight( ctx );
12188 72 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12189 72 : }
12190 300 : }
12191 291 : err = fd_hash_decode_preflight( ctx );
12192 291 : if( FD_UNLIKELY( err ) ) return err;
12193 285 : return FD_BINCODE_SUCCESS;
12194 291 : }
12195 285 : void fd_compact_tower_sync_decode_unsafe( fd_compact_tower_sync_t * self, fd_bincode_decode_ctx_t * ctx ) {
12196 285 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
12197 285 : ushort lockout_offsets_len;
12198 285 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
12199 285 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
12200 285 : self->lockout_offsets = deq_fd_lockout_offset_t_alloc( ctx->valloc, lockout_offsets_max );
12201 4944 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
12202 4659 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( self->lockout_offsets );
12203 4659 : fd_lockout_offset_new( elem );
12204 4659 : fd_lockout_offset_decode_unsafe( elem, ctx );
12205 4659 : }
12206 285 : fd_hash_decode_unsafe( &self->hash, ctx );
12207 285 : {
12208 285 : uchar o;
12209 285 : fd_bincode_bool_decode_unsafe( &o, ctx );
12210 285 : self->has_timestamp = !!o;
12211 285 : if( o ) {
12212 63 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
12213 63 : }
12214 285 : }
12215 285 : fd_hash_decode_unsafe( &self->block_id, ctx );
12216 285 : }
12217 0 : int fd_compact_tower_sync_encode( fd_compact_tower_sync_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12218 0 : int err;
12219 0 : err = fd_bincode_uint64_encode( self->root, ctx );
12220 0 : if( FD_UNLIKELY( err ) ) return err;
12221 0 : if( self->lockout_offsets ) {
12222 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
12223 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
12224 0 : if( FD_UNLIKELY( err ) ) return err;
12225 0 : for( deq_fd_lockout_offset_t_iter_t iter = deq_fd_lockout_offset_t_iter_init( self->lockout_offsets ); !deq_fd_lockout_offset_t_iter_done( self->lockout_offsets, iter ); iter = deq_fd_lockout_offset_t_iter_next( self->lockout_offsets, iter ) ) {
12226 0 : fd_lockout_offset_t const * ele = deq_fd_lockout_offset_t_iter_ele_const( self->lockout_offsets, iter );
12227 0 : err = fd_lockout_offset_encode( ele, ctx );
12228 0 : if( FD_UNLIKELY( err ) ) return err;
12229 0 : }
12230 0 : } else {
12231 0 : ushort lockout_offsets_len = 0;
12232 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
12233 0 : if( FD_UNLIKELY( err ) ) return err;
12234 0 : }
12235 0 : err = fd_hash_encode( &self->hash, ctx );
12236 0 : if( FD_UNLIKELY( err ) ) return err;
12237 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
12238 0 : if( FD_UNLIKELY( err ) ) return err;
12239 0 : if( self->has_timestamp ) {
12240 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
12241 0 : if( FD_UNLIKELY( err ) ) return err;
12242 0 : }
12243 0 : err = fd_hash_encode( &self->block_id, ctx );
12244 0 : if( FD_UNLIKELY( err ) ) return err;
12245 0 : return FD_BINCODE_SUCCESS;
12246 0 : }
12247 0 : int fd_compact_tower_sync_decode_offsets( fd_compact_tower_sync_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
12248 0 : uchar const * data = ctx->data;
12249 0 : int err;
12250 0 : self->root_off = (uint)( (ulong)ctx->data - (ulong)data );
12251 0 : err = fd_bincode_uint64_decode_preflight( ctx );
12252 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12253 0 : self->lockout_offsets_off = (uint)( (ulong)ctx->data - (ulong)data );
12254 0 : ushort lockout_offsets_len;
12255 0 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
12256 0 : if( FD_UNLIKELY( err ) ) return err;
12257 0 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
12258 0 : err = fd_lockout_offset_decode_preflight( ctx );
12259 0 : if( FD_UNLIKELY( err ) ) return err;
12260 0 : }
12261 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
12262 0 : err = fd_hash_decode_preflight( ctx );
12263 0 : if( FD_UNLIKELY( err ) ) return err;
12264 0 : self->timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
12265 0 : {
12266 0 : uchar o;
12267 0 : err = fd_bincode_bool_decode( &o, ctx );
12268 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12269 0 : if( o ) {
12270 0 : err = fd_bincode_int64_decode_preflight( ctx );
12271 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12272 0 : }
12273 0 : }
12274 0 : self->block_id_off = (uint)( (ulong)ctx->data - (ulong)data );
12275 0 : err = fd_hash_decode_preflight( ctx );
12276 0 : if( FD_UNLIKELY( err ) ) return err;
12277 0 : return FD_BINCODE_SUCCESS;
12278 0 : }
12279 285 : void fd_compact_tower_sync_new(fd_compact_tower_sync_t * self) {
12280 285 : fd_memset( self, 0, sizeof(fd_compact_tower_sync_t) );
12281 285 : fd_hash_new( &self->hash );
12282 285 : fd_hash_new( &self->block_id );
12283 285 : }
12284 0 : void fd_compact_tower_sync_destroy( fd_compact_tower_sync_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12285 0 : if( self->lockout_offsets ) {
12286 0 : for( deq_fd_lockout_offset_t_iter_t iter = deq_fd_lockout_offset_t_iter_init( self->lockout_offsets ); !deq_fd_lockout_offset_t_iter_done( self->lockout_offsets, iter ); iter = deq_fd_lockout_offset_t_iter_next( self->lockout_offsets, iter ) ) {
12287 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
12288 0 : fd_lockout_offset_destroy( ele, ctx );
12289 0 : }
12290 0 : fd_valloc_free( ctx->valloc, deq_fd_lockout_offset_t_delete( deq_fd_lockout_offset_t_leave( self->lockout_offsets) ) );
12291 0 : self->lockout_offsets = NULL;
12292 0 : }
12293 0 : fd_hash_destroy( &self->hash, ctx );
12294 0 : if( self->has_timestamp ) {
12295 0 : self->has_timestamp = 0;
12296 0 : }
12297 0 : fd_hash_destroy( &self->block_id, ctx );
12298 0 : }
12299 :
12300 0 : ulong fd_compact_tower_sync_footprint( void ){ return FD_COMPACT_TOWER_SYNC_FOOTPRINT; }
12301 0 : ulong fd_compact_tower_sync_align( void ){ return FD_COMPACT_TOWER_SYNC_ALIGN; }
12302 :
12303 0 : void fd_compact_tower_sync_walk( void * w, fd_compact_tower_sync_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12304 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_tower_sync", level++ );
12305 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12306 :
12307 : /* Walk deque */
12308 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR, "lockout_offsets", level++ );
12309 0 : if( self->lockout_offsets ) {
12310 0 : for( deq_fd_lockout_offset_t_iter_t iter = deq_fd_lockout_offset_t_iter_init( self->lockout_offsets );
12311 0 : !deq_fd_lockout_offset_t_iter_done( self->lockout_offsets, iter );
12312 0 : iter = deq_fd_lockout_offset_t_iter_next( self->lockout_offsets, iter ) ) {
12313 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
12314 0 : fd_lockout_offset_walk(w, ele, fun, "lockout_offsets", level );
12315 0 : }
12316 0 : }
12317 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR_END, "lockout_offsets", level-- );
12318 : /* Done walking deque */
12319 :
12320 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
12321 0 : if( !self->has_timestamp ) {
12322 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
12323 0 : } else {
12324 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
12325 0 : }
12326 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level );
12327 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_tower_sync", level-- );
12328 0 : }
12329 0 : ulong fd_compact_tower_sync_size( fd_compact_tower_sync_t const * self ) {
12330 0 : ulong size = 0;
12331 0 : size += sizeof(ulong);
12332 0 : if( self->lockout_offsets ) {
12333 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
12334 0 : size += fd_bincode_compact_u16_size( &lockout_offsets_len );
12335 0 : for( deq_fd_lockout_offset_t_iter_t iter = deq_fd_lockout_offset_t_iter_init( self->lockout_offsets ); !deq_fd_lockout_offset_t_iter_done( self->lockout_offsets, iter ); iter = deq_fd_lockout_offset_t_iter_next( self->lockout_offsets, iter ) ) {
12336 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
12337 0 : size += fd_lockout_offset_size( ele );
12338 0 : }
12339 0 : } else {
12340 0 : size += 1;
12341 0 : }
12342 0 : size += fd_hash_size( &self->hash );
12343 0 : size += sizeof(char);
12344 0 : if( self->has_timestamp ) {
12345 0 : size += sizeof(long);
12346 0 : }
12347 0 : size += fd_hash_size( &self->block_id );
12348 0 : return size;
12349 0 : }
12350 :
12351 0 : void fd_tower_sync_new(fd_tower_sync_t * self) {
12352 0 : fd_memset( self, 0, sizeof(fd_tower_sync_t) );
12353 0 : fd_hash_new( &self->hash );
12354 0 : fd_hash_new( &self->block_id );
12355 0 : }
12356 0 : void fd_tower_sync_destroy( fd_tower_sync_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12357 0 : if( self->lockouts ) {
12358 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts ); !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
12359 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
12360 0 : fd_vote_lockout_destroy( ele, ctx );
12361 0 : }
12362 0 : fd_valloc_free( ctx->valloc, deq_fd_vote_lockout_t_delete( deq_fd_vote_lockout_t_leave( self->lockouts) ) );
12363 0 : self->lockouts = NULL;
12364 0 : }
12365 0 : if( self->has_root ) {
12366 0 : self->has_root = 0;
12367 0 : }
12368 0 : fd_hash_destroy( &self->hash, ctx );
12369 0 : if( self->has_timestamp ) {
12370 0 : self->has_timestamp = 0;
12371 0 : }
12372 0 : fd_hash_destroy( &self->block_id, ctx );
12373 0 : }
12374 :
12375 0 : ulong fd_tower_sync_footprint( void ){ return FD_TOWER_SYNC_FOOTPRINT; }
12376 0 : ulong fd_tower_sync_align( void ){ return FD_TOWER_SYNC_ALIGN; }
12377 :
12378 0 : void fd_tower_sync_walk( void * w, fd_tower_sync_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12379 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync", level++ );
12380 :
12381 : /* Walk deque */
12382 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++ );
12383 0 : if( self->lockouts ) {
12384 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
12385 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
12386 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
12387 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
12388 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level );
12389 0 : }
12390 0 : }
12391 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level-- );
12392 : /* Done walking deque */
12393 :
12394 0 : fun( w, &self->lockouts_cnt, "lockouts_cnt", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12395 0 : if( !self->has_root ) {
12396 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level );
12397 0 : } else {
12398 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12399 0 : }
12400 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
12401 0 : if( !self->has_timestamp ) {
12402 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
12403 0 : } else {
12404 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
12405 0 : }
12406 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level );
12407 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync", level-- );
12408 0 : }
12409 0 : ulong fd_tower_sync_size( fd_tower_sync_t const * self ) {
12410 0 : ulong size = 0;
12411 0 : if( self->lockouts ) {
12412 0 : size += sizeof(ulong);
12413 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts ); !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter ); iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
12414 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
12415 0 : size += fd_vote_lockout_size( ele );
12416 0 : }
12417 0 : } else {
12418 0 : size += sizeof(ulong);
12419 0 : }
12420 0 : size += sizeof(ulong);
12421 0 : size += sizeof(char);
12422 0 : if( self->has_root ) {
12423 0 : size += sizeof(ulong);
12424 0 : }
12425 0 : size += fd_hash_size( &self->hash );
12426 0 : size += sizeof(char);
12427 0 : if( self->has_timestamp ) {
12428 0 : size += sizeof(long);
12429 0 : }
12430 0 : size += fd_hash_size( &self->block_id );
12431 0 : return size;
12432 0 : }
12433 :
12434 0 : int fd_tower_sync_switch_decode( fd_tower_sync_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
12435 0 : void const * data = ctx->data;
12436 0 : int err = fd_tower_sync_switch_decode_preflight( ctx );
12437 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12438 0 : ctx->data = data;
12439 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12440 0 : fd_tower_sync_switch_new( self );
12441 0 : }
12442 0 : fd_tower_sync_switch_decode_unsafe( self, ctx );
12443 0 : return FD_BINCODE_SUCCESS;
12444 0 : }
12445 687 : int fd_tower_sync_switch_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
12446 687 : int err;
12447 687 : err = fd_tower_sync_decode_preflight( ctx );
12448 687 : if( FD_UNLIKELY( err ) ) return err;
12449 84 : err = fd_hash_decode_preflight( ctx );
12450 84 : if( FD_UNLIKELY( err ) ) return err;
12451 60 : return FD_BINCODE_SUCCESS;
12452 84 : }
12453 60 : void fd_tower_sync_switch_decode_unsafe( fd_tower_sync_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
12454 60 : fd_tower_sync_decode_unsafe( &self->tower_sync, ctx );
12455 60 : fd_hash_decode_unsafe( &self->hash, ctx );
12456 60 : }
12457 0 : int fd_tower_sync_switch_encode( fd_tower_sync_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12458 0 : int err;
12459 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
12460 0 : if( FD_UNLIKELY( err ) ) return err;
12461 0 : err = fd_hash_encode( &self->hash, ctx );
12462 0 : if( FD_UNLIKELY( err ) ) return err;
12463 0 : return FD_BINCODE_SUCCESS;
12464 0 : }
12465 0 : int fd_tower_sync_switch_decode_offsets( fd_tower_sync_switch_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
12466 0 : uchar const * data = ctx->data;
12467 0 : int err;
12468 0 : self->tower_sync_off = (uint)( (ulong)ctx->data - (ulong)data );
12469 0 : err = fd_tower_sync_decode_preflight( ctx );
12470 0 : if( FD_UNLIKELY( err ) ) return err;
12471 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
12472 0 : err = fd_hash_decode_preflight( ctx );
12473 0 : if( FD_UNLIKELY( err ) ) return err;
12474 0 : return FD_BINCODE_SUCCESS;
12475 0 : }
12476 0 : void fd_tower_sync_switch_new(fd_tower_sync_switch_t * self) {
12477 0 : fd_memset( self, 0, sizeof(fd_tower_sync_switch_t) );
12478 0 : fd_tower_sync_new( &self->tower_sync );
12479 0 : fd_hash_new( &self->hash );
12480 0 : }
12481 0 : void fd_tower_sync_switch_destroy( fd_tower_sync_switch_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12482 0 : fd_tower_sync_destroy( &self->tower_sync, ctx );
12483 0 : fd_hash_destroy( &self->hash, ctx );
12484 0 : }
12485 :
12486 0 : ulong fd_tower_sync_switch_footprint( void ){ return FD_TOWER_SYNC_SWITCH_FOOTPRINT; }
12487 0 : ulong fd_tower_sync_switch_align( void ){ return FD_TOWER_SYNC_SWITCH_ALIGN; }
12488 :
12489 0 : void fd_tower_sync_switch_walk( void * w, fd_tower_sync_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12490 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync_switch", level++ );
12491 0 : fd_tower_sync_walk( w, &self->tower_sync, fun, "tower_sync", level );
12492 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
12493 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync_switch", level-- );
12494 0 : }
12495 0 : ulong fd_tower_sync_switch_size( fd_tower_sync_switch_t const * self ) {
12496 0 : ulong size = 0;
12497 0 : size += fd_tower_sync_size( &self->tower_sync );
12498 0 : size += fd_hash_size( &self->hash );
12499 0 : return size;
12500 0 : }
12501 :
12502 0 : int fd_slot_history_inner_decode( fd_slot_history_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
12503 0 : void const * data = ctx->data;
12504 0 : int err = fd_slot_history_inner_decode_preflight( ctx );
12505 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12506 0 : ctx->data = data;
12507 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12508 0 : fd_slot_history_inner_new( self );
12509 0 : }
12510 0 : fd_slot_history_inner_decode_unsafe( self, ctx );
12511 0 : return FD_BINCODE_SUCCESS;
12512 0 : }
12513 0 : int fd_slot_history_inner_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
12514 0 : int err;
12515 0 : ulong blocks_len;
12516 0 : err = fd_bincode_uint64_decode( &blocks_len, ctx );
12517 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12518 0 : if( blocks_len ) {
12519 0 : for( ulong i=0; i < blocks_len; i++ ) {
12520 0 : err = fd_bincode_uint64_decode_preflight( ctx );
12521 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12522 0 : }
12523 0 : }
12524 0 : return FD_BINCODE_SUCCESS;
12525 0 : }
12526 0 : void fd_slot_history_inner_decode_unsafe( fd_slot_history_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
12527 0 : fd_bincode_uint64_decode_unsafe( &self->blocks_len, ctx );
12528 0 : if( self->blocks_len ) {
12529 0 : self->blocks = fd_valloc_malloc( ctx->valloc, 8UL, sizeof(ulong)*self->blocks_len );
12530 0 : for( ulong i=0; i < self->blocks_len; i++ ) {
12531 0 : fd_bincode_uint64_decode_unsafe( self->blocks + i, ctx );
12532 0 : }
12533 0 : } else
12534 0 : self->blocks = NULL;
12535 0 : }
12536 0 : int fd_slot_history_inner_encode( fd_slot_history_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12537 0 : int err;
12538 0 : err = fd_bincode_uint64_encode( self->blocks_len, ctx );
12539 0 : if( FD_UNLIKELY(err) ) return err;
12540 0 : if( self->blocks_len ) {
12541 0 : for( ulong i=0; i < self->blocks_len; i++ ) {
12542 0 : err = fd_bincode_uint64_encode( self->blocks[i], ctx );
12543 0 : }
12544 0 : }
12545 0 : return FD_BINCODE_SUCCESS;
12546 0 : }
12547 0 : int fd_slot_history_inner_decode_offsets( fd_slot_history_inner_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
12548 0 : uchar const * data = ctx->data;
12549 0 : int err;
12550 0 : self->blocks_off = (uint)( (ulong)ctx->data - (ulong)data );
12551 0 : ulong blocks_len;
12552 0 : err = fd_bincode_uint64_decode( &blocks_len, ctx );
12553 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12554 0 : if( blocks_len ) {
12555 0 : for( ulong i=0; i < blocks_len; i++ ) {
12556 0 : err = fd_bincode_uint64_decode_preflight( ctx );
12557 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12558 0 : }
12559 0 : }
12560 0 : return FD_BINCODE_SUCCESS;
12561 0 : }
12562 0 : void fd_slot_history_inner_new(fd_slot_history_inner_t * self) {
12563 0 : fd_memset( self, 0, sizeof(fd_slot_history_inner_t) );
12564 0 : }
12565 0 : void fd_slot_history_inner_destroy( fd_slot_history_inner_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12566 0 : if( self->blocks ) {
12567 0 : fd_valloc_free( ctx->valloc, self->blocks );
12568 0 : self->blocks = NULL;
12569 0 : }
12570 0 : }
12571 :
12572 0 : ulong fd_slot_history_inner_footprint( void ){ return FD_SLOT_HISTORY_INNER_FOOTPRINT; }
12573 0 : ulong fd_slot_history_inner_align( void ){ return FD_SLOT_HISTORY_INNER_ALIGN; }
12574 :
12575 0 : void fd_slot_history_inner_walk( void * w, fd_slot_history_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12576 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history_inner", level++ );
12577 0 : if( self->blocks_len ) {
12578 0 : fun( w, NULL, "blocks", FD_FLAMENCO_TYPE_ARR, "array", level++ );
12579 0 : for( ulong i=0; i < self->blocks_len; i++ )
12580 0 : fun( w, self->blocks + i, "blocks", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12581 0 : fun( w, NULL, "blocks", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
12582 0 : }
12583 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history_inner", level-- );
12584 0 : }
12585 0 : ulong fd_slot_history_inner_size( fd_slot_history_inner_t const * self ) {
12586 0 : ulong size = 0;
12587 0 : do {
12588 0 : size += sizeof(ulong);
12589 0 : size += self->blocks_len * sizeof(ulong);
12590 0 : } while(0);
12591 0 : return size;
12592 0 : }
12593 :
12594 0 : int fd_slot_history_bitvec_decode( fd_slot_history_bitvec_t * self, fd_bincode_decode_ctx_t * ctx ) {
12595 0 : void const * data = ctx->data;
12596 0 : int err = fd_slot_history_bitvec_decode_preflight( ctx );
12597 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12598 0 : ctx->data = data;
12599 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12600 0 : fd_slot_history_bitvec_new( self );
12601 0 : }
12602 0 : fd_slot_history_bitvec_decode_unsafe( self, ctx );
12603 0 : return FD_BINCODE_SUCCESS;
12604 0 : }
12605 0 : int fd_slot_history_bitvec_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
12606 0 : int err;
12607 0 : {
12608 0 : uchar o;
12609 0 : err = fd_bincode_bool_decode( &o, ctx );
12610 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12611 0 : if( o ) {
12612 0 : err = fd_slot_history_inner_decode_preflight( ctx );
12613 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12614 0 : }
12615 0 : }
12616 0 : err = fd_bincode_uint64_decode_preflight( ctx );
12617 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12618 0 : return FD_BINCODE_SUCCESS;
12619 0 : }
12620 0 : void fd_slot_history_bitvec_decode_unsafe( fd_slot_history_bitvec_t * self, fd_bincode_decode_ctx_t * ctx ) {
12621 0 : {
12622 0 : uchar o;
12623 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
12624 0 : if( o ) {
12625 0 : self->bits = (fd_slot_history_inner_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_HISTORY_INNER_ALIGN, FD_SLOT_HISTORY_INNER_FOOTPRINT );
12626 0 : fd_slot_history_inner_new( self->bits );
12627 0 : fd_slot_history_inner_decode_unsafe( self->bits, ctx );
12628 0 : } else
12629 0 : self->bits = NULL;
12630 0 : }
12631 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
12632 0 : }
12633 0 : int fd_slot_history_bitvec_encode( fd_slot_history_bitvec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12634 0 : int err;
12635 0 : if( self->bits != NULL ) {
12636 0 : err = fd_bincode_bool_encode( 1, ctx );
12637 0 : if( FD_UNLIKELY( err ) ) return err;
12638 0 : err = fd_slot_history_inner_encode( self->bits, ctx );
12639 0 : if( FD_UNLIKELY( err ) ) return err;
12640 0 : } else {
12641 0 : err = fd_bincode_bool_encode( 0, ctx );
12642 0 : if( FD_UNLIKELY( err ) ) return err;
12643 0 : }
12644 0 : err = fd_bincode_uint64_encode( self->len, ctx );
12645 0 : if( FD_UNLIKELY( err ) ) return err;
12646 0 : return FD_BINCODE_SUCCESS;
12647 0 : }
12648 0 : int fd_slot_history_bitvec_decode_offsets( fd_slot_history_bitvec_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
12649 0 : uchar const * data = ctx->data;
12650 0 : int err;
12651 0 : self->bits_off = (uint)( (ulong)ctx->data - (ulong)data );
12652 0 : {
12653 0 : uchar o;
12654 0 : err = fd_bincode_bool_decode( &o, ctx );
12655 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12656 0 : if( o ) {
12657 0 : err = fd_slot_history_inner_decode_preflight( ctx );
12658 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12659 0 : }
12660 0 : }
12661 0 : self->len_off = (uint)( (ulong)ctx->data - (ulong)data );
12662 0 : err = fd_bincode_uint64_decode_preflight( ctx );
12663 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12664 0 : return FD_BINCODE_SUCCESS;
12665 0 : }
12666 0 : void fd_slot_history_bitvec_new(fd_slot_history_bitvec_t * self) {
12667 0 : fd_memset( self, 0, sizeof(fd_slot_history_bitvec_t) );
12668 0 : }
12669 0 : void fd_slot_history_bitvec_destroy( fd_slot_history_bitvec_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12670 0 : if( self->bits ) {
12671 0 : fd_slot_history_inner_destroy( self->bits, ctx );
12672 0 : fd_valloc_free( ctx->valloc, self->bits );
12673 0 : self->bits = NULL;
12674 0 : }
12675 0 : }
12676 :
12677 0 : ulong fd_slot_history_bitvec_footprint( void ){ return FD_SLOT_HISTORY_BITVEC_FOOTPRINT; }
12678 0 : ulong fd_slot_history_bitvec_align( void ){ return FD_SLOT_HISTORY_BITVEC_ALIGN; }
12679 :
12680 0 : void fd_slot_history_bitvec_walk( void * w, fd_slot_history_bitvec_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12681 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history_bitvec", level++ );
12682 0 : if( !self->bits ) {
12683 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "slot_history_inner", level );
12684 0 : } else {
12685 0 : fd_slot_history_inner_walk( w, self->bits, fun, "bits", level );
12686 0 : }
12687 0 : fun( w, &self->len, "len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12688 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history_bitvec", level-- );
12689 0 : }
12690 0 : ulong fd_slot_history_bitvec_size( fd_slot_history_bitvec_t const * self ) {
12691 0 : ulong size = 0;
12692 0 : size += sizeof(char);
12693 0 : if( NULL != self->bits ) {
12694 0 : size += fd_slot_history_inner_size( self->bits );
12695 0 : }
12696 0 : size += sizeof(ulong);
12697 0 : return size;
12698 0 : }
12699 :
12700 0 : int fd_slot_history_decode( fd_slot_history_t * self, fd_bincode_decode_ctx_t * ctx ) {
12701 0 : void const * data = ctx->data;
12702 0 : int err = fd_slot_history_decode_preflight( ctx );
12703 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12704 0 : ctx->data = data;
12705 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12706 0 : fd_slot_history_new( self );
12707 0 : }
12708 0 : fd_slot_history_decode_unsafe( self, ctx );
12709 0 : return FD_BINCODE_SUCCESS;
12710 0 : }
12711 0 : int fd_slot_history_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
12712 0 : int err;
12713 0 : err = fd_slot_history_bitvec_decode_preflight( ctx );
12714 0 : if( FD_UNLIKELY( err ) ) return err;
12715 0 : err = fd_bincode_uint64_decode_preflight( ctx );
12716 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12717 0 : return FD_BINCODE_SUCCESS;
12718 0 : }
12719 0 : void fd_slot_history_decode_unsafe( fd_slot_history_t * self, fd_bincode_decode_ctx_t * ctx ) {
12720 0 : fd_slot_history_bitvec_decode_unsafe( &self->bits, ctx );
12721 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
12722 0 : }
12723 0 : int fd_slot_history_encode( fd_slot_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12724 0 : int err;
12725 0 : err = fd_slot_history_bitvec_encode( &self->bits, ctx );
12726 0 : if( FD_UNLIKELY( err ) ) return err;
12727 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
12728 0 : if( FD_UNLIKELY( err ) ) return err;
12729 0 : return FD_BINCODE_SUCCESS;
12730 0 : }
12731 0 : int fd_slot_history_decode_offsets( fd_slot_history_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
12732 0 : uchar const * data = ctx->data;
12733 0 : int err;
12734 0 : self->bits_off = (uint)( (ulong)ctx->data - (ulong)data );
12735 0 : err = fd_slot_history_bitvec_decode_preflight( ctx );
12736 0 : if( FD_UNLIKELY( err ) ) return err;
12737 0 : self->next_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
12738 0 : err = fd_bincode_uint64_decode_preflight( ctx );
12739 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12740 0 : return FD_BINCODE_SUCCESS;
12741 0 : }
12742 0 : void fd_slot_history_new(fd_slot_history_t * self) {
12743 0 : fd_memset( self, 0, sizeof(fd_slot_history_t) );
12744 0 : fd_slot_history_bitvec_new( &self->bits );
12745 0 : }
12746 0 : void fd_slot_history_destroy( fd_slot_history_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12747 0 : fd_slot_history_bitvec_destroy( &self->bits, ctx );
12748 0 : }
12749 :
12750 0 : ulong fd_slot_history_footprint( void ){ return FD_SLOT_HISTORY_FOOTPRINT; }
12751 0 : ulong fd_slot_history_align( void ){ return FD_SLOT_HISTORY_ALIGN; }
12752 :
12753 0 : void fd_slot_history_walk( void * w, fd_slot_history_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12754 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history", level++ );
12755 0 : fd_slot_history_bitvec_walk( w, &self->bits, fun, "bits", level );
12756 0 : fun( w, &self->next_slot, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12757 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history", level-- );
12758 0 : }
12759 0 : ulong fd_slot_history_size( fd_slot_history_t const * self ) {
12760 0 : ulong size = 0;
12761 0 : size += fd_slot_history_bitvec_size( &self->bits );
12762 0 : size += sizeof(ulong);
12763 0 : return size;
12764 0 : }
12765 :
12766 0 : int fd_slot_hash_decode( fd_slot_hash_t * self, fd_bincode_decode_ctx_t * ctx ) {
12767 0 : void const * data = ctx->data;
12768 0 : int err = fd_slot_hash_decode_preflight( ctx );
12769 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12770 0 : ctx->data = data;
12771 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12772 0 : fd_slot_hash_new( self );
12773 0 : }
12774 0 : fd_slot_hash_decode_unsafe( self, ctx );
12775 0 : return FD_BINCODE_SUCCESS;
12776 0 : }
12777 3 : int fd_slot_hash_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
12778 3 : return fd_bincode_bytes_decode_preflight( 40, ctx );
12779 3 : }
12780 2052078 : void fd_slot_hash_decode_unsafe( fd_slot_hash_t * self, fd_bincode_decode_ctx_t * ctx ) {
12781 2052078 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
12782 2052078 : fd_hash_decode_unsafe( &self->hash, ctx );
12783 2052078 : }
12784 11718 : int fd_slot_hash_encode( fd_slot_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12785 11718 : int err;
12786 11718 : err = fd_bincode_uint64_encode( self->slot, ctx );
12787 11718 : if( FD_UNLIKELY( err ) ) return err;
12788 11718 : err = fd_hash_encode( &self->hash, ctx );
12789 11718 : if( FD_UNLIKELY( err ) ) return err;
12790 11718 : return FD_BINCODE_SUCCESS;
12791 11718 : }
12792 0 : int fd_slot_hash_decode_offsets( fd_slot_hash_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
12793 0 : uchar const * data = ctx->data;
12794 0 : int err;
12795 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
12796 0 : err = fd_bincode_uint64_decode_preflight( ctx );
12797 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12798 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
12799 0 : err = fd_hash_decode_preflight( ctx );
12800 0 : if( FD_UNLIKELY( err ) ) return err;
12801 0 : return FD_BINCODE_SUCCESS;
12802 0 : }
12803 2052078 : void fd_slot_hash_new(fd_slot_hash_t * self) {
12804 2052078 : fd_memset( self, 0, sizeof(fd_slot_hash_t) );
12805 2052078 : fd_hash_new( &self->hash );
12806 2052078 : }
12807 2052075 : void fd_slot_hash_destroy( fd_slot_hash_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12808 2052075 : fd_hash_destroy( &self->hash, ctx );
12809 2052075 : }
12810 :
12811 0 : ulong fd_slot_hash_footprint( void ){ return FD_SLOT_HASH_FOOTPRINT; }
12812 0 : ulong fd_slot_hash_align( void ){ return FD_SLOT_HASH_ALIGN; }
12813 :
12814 3 : void fd_slot_hash_walk( void * w, fd_slot_hash_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12815 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hash", level++ );
12816 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
12817 3 : fd_hash_walk( w, &self->hash, fun, "hash", level );
12818 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hash", level-- );
12819 3 : }
12820 11718 : ulong fd_slot_hash_size( fd_slot_hash_t const * self ) {
12821 11718 : ulong size = 0;
12822 11718 : size += sizeof(ulong);
12823 11718 : size += fd_hash_size( &self->hash );
12824 11718 : return size;
12825 11718 : }
12826 :
12827 22659 : int fd_slot_hashes_decode( fd_slot_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
12828 22659 : void const * data = ctx->data;
12829 22659 : int err = fd_slot_hashes_decode_preflight( ctx );
12830 22659 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12831 22491 : ctx->data = data;
12832 22491 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12833 22491 : fd_slot_hashes_new( self );
12834 22491 : }
12835 22491 : fd_slot_hashes_decode_unsafe( self, ctx );
12836 22491 : return FD_BINCODE_SUCCESS;
12837 22659 : }
12838 22659 : int fd_slot_hashes_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
12839 22659 : int err;
12840 22659 : ulong hashes_len;
12841 22659 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
12842 22659 : if( FD_UNLIKELY( err ) ) return err;
12843 22614 : ulong hashes_sz;
12844 22614 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
12845 22512 : err = fd_bincode_bytes_decode_preflight( hashes_sz, ctx );
12846 22512 : if( FD_UNLIKELY( err ) ) return err;
12847 22491 : return FD_BINCODE_SUCCESS;
12848 22512 : }
12849 22491 : void fd_slot_hashes_decode_unsafe( fd_slot_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
12850 22491 : ulong hashes_len;
12851 22491 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
12852 22491 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
12853 22491 : self->hashes = deq_fd_slot_hash_t_alloc( ctx->valloc, hashes_max );
12854 2074566 : for( ulong i=0; i < hashes_len; i++ ) {
12855 2052075 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( self->hashes );
12856 2052075 : fd_slot_hash_new( elem );
12857 2052075 : fd_slot_hash_decode_unsafe( elem, ctx );
12858 2052075 : }
12859 22491 : }
12860 11718 : int fd_slot_hashes_encode( fd_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12861 11718 : int err;
12862 11718 : if( self->hashes ) {
12863 11718 : ulong hashes_len = deq_fd_slot_hash_t_cnt( self->hashes );
12864 11718 : err = fd_bincode_uint64_encode( hashes_len, ctx );
12865 11718 : if( FD_UNLIKELY( err ) ) return err;
12866 23436 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( self->hashes ); !deq_fd_slot_hash_t_iter_done( self->hashes, iter ); iter = deq_fd_slot_hash_t_iter_next( self->hashes, iter ) ) {
12867 11718 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( self->hashes, iter );
12868 11718 : err = fd_slot_hash_encode( ele, ctx );
12869 11718 : if( FD_UNLIKELY( err ) ) return err;
12870 11718 : }
12871 11718 : } else {
12872 0 : ulong hashes_len = 0;
12873 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
12874 0 : if( FD_UNLIKELY( err ) ) return err;
12875 0 : }
12876 11718 : return FD_BINCODE_SUCCESS;
12877 11718 : }
12878 0 : int fd_slot_hashes_decode_offsets( fd_slot_hashes_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
12879 0 : uchar const * data = ctx->data;
12880 0 : int err;
12881 0 : self->hashes_off = (uint)( (ulong)ctx->data - (ulong)data );
12882 0 : ulong hashes_len;
12883 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
12884 0 : if( FD_UNLIKELY( err ) ) return err;
12885 0 : ulong hashes_sz;
12886 0 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
12887 0 : err = fd_bincode_bytes_decode_preflight( hashes_sz, ctx );
12888 0 : if( FD_UNLIKELY( err ) ) return err;
12889 0 : return FD_BINCODE_SUCCESS;
12890 0 : }
12891 22491 : void fd_slot_hashes_new(fd_slot_hashes_t * self) {
12892 22491 : fd_memset( self, 0, sizeof(fd_slot_hashes_t) );
12893 22491 : }
12894 430518 : void fd_slot_hashes_destroy( fd_slot_hashes_t * self, fd_bincode_destroy_ctx_t * ctx ) {
12895 430518 : if( self->hashes ) {
12896 2074566 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( self->hashes ); !deq_fd_slot_hash_t_iter_done( self->hashes, iter ); iter = deq_fd_slot_hash_t_iter_next( self->hashes, iter ) ) {
12897 2052075 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
12898 2052075 : fd_slot_hash_destroy( ele, ctx );
12899 2052075 : }
12900 22491 : fd_valloc_free( ctx->valloc, deq_fd_slot_hash_t_delete( deq_fd_slot_hash_t_leave( self->hashes) ) );
12901 22491 : self->hashes = NULL;
12902 22491 : }
12903 430518 : }
12904 :
12905 0 : ulong fd_slot_hashes_footprint( void ){ return FD_SLOT_HASHES_FOOTPRINT; }
12906 0 : ulong fd_slot_hashes_align( void ){ return FD_SLOT_HASHES_ALIGN; }
12907 :
12908 0 : void fd_slot_hashes_walk( void * w, fd_slot_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
12909 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hashes", level++ );
12910 :
12911 : /* Walk deque */
12912 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++ );
12913 0 : if( self->hashes ) {
12914 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( self->hashes );
12915 0 : !deq_fd_slot_hash_t_iter_done( self->hashes, iter );
12916 0 : iter = deq_fd_slot_hash_t_iter_next( self->hashes, iter ) ) {
12917 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
12918 0 : fd_slot_hash_walk(w, ele, fun, "hashes", level );
12919 0 : }
12920 0 : }
12921 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level-- );
12922 : /* Done walking deque */
12923 :
12924 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hashes", level-- );
12925 0 : }
12926 11718 : ulong fd_slot_hashes_size( fd_slot_hashes_t const * self ) {
12927 11718 : ulong size = 0;
12928 11718 : if( self->hashes ) {
12929 11718 : size += sizeof(ulong);
12930 23436 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( self->hashes ); !deq_fd_slot_hash_t_iter_done( self->hashes, iter ); iter = deq_fd_slot_hash_t_iter_next( self->hashes, iter ) ) {
12931 11718 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
12932 11718 : size += fd_slot_hash_size( ele );
12933 11718 : }
12934 11718 : } else {
12935 0 : size += sizeof(ulong);
12936 0 : }
12937 11718 : return size;
12938 11718 : }
12939 :
12940 0 : int fd_block_block_hash_entry_decode( fd_block_block_hash_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
12941 0 : void const * data = ctx->data;
12942 0 : int err = fd_block_block_hash_entry_decode_preflight( ctx );
12943 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12944 0 : ctx->data = data;
12945 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12946 0 : fd_block_block_hash_entry_new( self );
12947 0 : }
12948 0 : fd_block_block_hash_entry_decode_unsafe( self, ctx );
12949 0 : return FD_BINCODE_SUCCESS;
12950 0 : }
12951 0 : int fd_block_block_hash_entry_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
12952 0 : return fd_bincode_bytes_decode_preflight( 40, ctx );
12953 0 : }
12954 1184220 : void fd_block_block_hash_entry_decode_unsafe( fd_block_block_hash_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
12955 1184220 : fd_hash_decode_unsafe( &self->blockhash, ctx );
12956 1184220 : fd_fee_calculator_decode_unsafe( &self->fee_calculator, ctx );
12957 1184220 : }
12958 74656068 : int fd_block_block_hash_entry_encode( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12959 74656068 : int err;
12960 74656068 : err = fd_hash_encode( &self->blockhash, ctx );
12961 74656068 : if( FD_UNLIKELY( err ) ) return err;
12962 74656068 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
12963 74656068 : if( FD_UNLIKELY( err ) ) return err;
12964 74656068 : return FD_BINCODE_SUCCESS;
12965 74656068 : }
12966 : enum {
12967 : fd_block_block_hash_entry_blockhash_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
12968 : fd_block_block_hash_entry_fee_calculator_TAG = (1 << 6) | FD_ARCHIVE_META_STRUCT,
12969 : };
12970 0 : int fd_block_block_hash_entry_decode_archival( fd_block_block_hash_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
12971 0 : void const * data = ctx->data;
12972 0 : int err = fd_block_block_hash_entry_decode_archival_preflight( ctx );
12973 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12974 0 : ctx->data = data;
12975 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
12976 0 : fd_block_block_hash_entry_new( self );
12977 0 : }
12978 0 : fd_block_block_hash_entry_decode_archival_unsafe( self, ctx );
12979 0 : return FD_BINCODE_SUCCESS;
12980 0 : }
12981 0 : int fd_block_block_hash_entry_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
12982 0 : int err;
12983 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
12984 0 : void * offset = NULL;
12985 0 : for(;;) {
12986 0 : err = fd_bincode_uint16_decode( &tag, ctx );
12987 0 : if( FD_UNLIKELY( err ) ) return err;
12988 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
12989 0 : switch( tag ) {
12990 0 : case (ushort)fd_block_block_hash_entry_blockhash_TAG: {
12991 0 : err = fd_archive_decode_setup_length( ctx, &offset );
12992 0 : if( FD_UNLIKELY( err ) ) return err;
12993 0 : err = fd_hash_decode_archival_preflight( ctx );
12994 0 : if( FD_UNLIKELY( err ) ) return err;
12995 0 : err = fd_archive_decode_check_length( ctx, offset );
12996 0 : if( FD_UNLIKELY( err ) ) return err;
12997 0 : break;
12998 0 : }
12999 0 : case (ushort)fd_block_block_hash_entry_fee_calculator_TAG: {
13000 0 : err = fd_archive_decode_setup_length( ctx, &offset );
13001 0 : if( FD_UNLIKELY( err ) ) return err;
13002 0 : err = fd_fee_calculator_decode_archival_preflight( ctx );
13003 0 : if( FD_UNLIKELY( err ) ) return err;
13004 0 : err = fd_archive_decode_check_length( ctx, offset );
13005 0 : if( FD_UNLIKELY( err ) ) return err;
13006 0 : break;
13007 0 : }
13008 0 : default:
13009 0 : err = fd_archive_decode_skip_field( ctx, tag );
13010 0 : if( FD_UNLIKELY( err ) ) return err;
13011 0 : break;
13012 0 : }
13013 0 : }
13014 0 : return FD_BINCODE_SUCCESS;
13015 0 : }
13016 0 : void fd_block_block_hash_entry_decode_archival_unsafe( fd_block_block_hash_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
13017 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
13018 0 : void * offset = NULL;
13019 0 : for(;;) {
13020 0 : fd_bincode_uint16_decode( &tag, ctx );
13021 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
13022 0 : switch( tag ) {
13023 0 : case (ushort)fd_block_block_hash_entry_blockhash_TAG: {
13024 0 : fd_archive_decode_setup_length( ctx, &offset );
13025 0 : fd_hash_decode_archival_unsafe( &self->blockhash, ctx );
13026 0 : break;
13027 0 : }
13028 0 : case (ushort)fd_block_block_hash_entry_fee_calculator_TAG: {
13029 0 : fd_archive_decode_setup_length( ctx, &offset );
13030 0 : fd_fee_calculator_decode_archival_unsafe( &self->fee_calculator, ctx );
13031 0 : break;
13032 0 : }
13033 0 : default:
13034 0 : fd_archive_decode_skip_field( ctx, tag );
13035 0 : break;
13036 0 : }
13037 0 : }
13038 0 : }
13039 0 : int fd_block_block_hash_entry_encode_archival( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13040 0 : int err;
13041 0 : void * offset = NULL;
13042 0 : err = fd_bincode_uint16_encode( (ushort)fd_block_block_hash_entry_blockhash_TAG, ctx );
13043 0 : if( FD_UNLIKELY( err ) ) return err;
13044 0 : err = fd_archive_encode_setup_length( ctx, &offset );
13045 0 : if( FD_UNLIKELY( err ) ) return err;
13046 0 : err = fd_hash_encode_archival( &self->blockhash, ctx );
13047 0 : if( FD_UNLIKELY( err ) ) return err;
13048 0 : err = fd_archive_encode_set_length( ctx, offset );
13049 0 : if( FD_UNLIKELY( err ) ) return err;
13050 0 : err = fd_bincode_uint16_encode( (ushort)fd_block_block_hash_entry_fee_calculator_TAG, ctx );
13051 0 : if( FD_UNLIKELY( err ) ) return err;
13052 0 : err = fd_archive_encode_setup_length( ctx, &offset );
13053 0 : if( FD_UNLIKELY( err ) ) return err;
13054 0 : err = fd_fee_calculator_encode_archival( &self->fee_calculator, ctx );
13055 0 : if( FD_UNLIKELY( err ) ) return err;
13056 0 : err = fd_archive_encode_set_length( ctx, offset );
13057 0 : if( FD_UNLIKELY( err ) ) return err;
13058 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
13059 0 : if( FD_UNLIKELY( err ) ) return err;
13060 0 : return FD_BINCODE_SUCCESS;
13061 0 : }
13062 0 : int fd_block_block_hash_entry_decode_offsets( fd_block_block_hash_entry_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
13063 0 : uchar const * data = ctx->data;
13064 0 : int err;
13065 0 : self->blockhash_off = (uint)( (ulong)ctx->data - (ulong)data );
13066 0 : err = fd_hash_decode_preflight( ctx );
13067 0 : if( FD_UNLIKELY( err ) ) return err;
13068 0 : self->fee_calculator_off = (uint)( (ulong)ctx->data - (ulong)data );
13069 0 : err = fd_fee_calculator_decode_preflight( ctx );
13070 0 : if( FD_UNLIKELY( err ) ) return err;
13071 0 : return FD_BINCODE_SUCCESS;
13072 0 : }
13073 2056881 : void fd_block_block_hash_entry_new(fd_block_block_hash_entry_t * self) {
13074 2056881 : fd_memset( self, 0, sizeof(fd_block_block_hash_entry_t) );
13075 2056881 : fd_hash_new( &self->blockhash );
13076 2056881 : fd_fee_calculator_new( &self->fee_calculator );
13077 2056881 : }
13078 2936994 : void fd_block_block_hash_entry_destroy( fd_block_block_hash_entry_t * self, fd_bincode_destroy_ctx_t * ctx ) {
13079 2936994 : fd_hash_destroy( &self->blockhash, ctx );
13080 2936994 : fd_fee_calculator_destroy( &self->fee_calculator, ctx );
13081 2936994 : }
13082 :
13083 0 : ulong fd_block_block_hash_entry_footprint( void ){ return FD_BLOCK_BLOCK_HASH_ENTRY_FOOTPRINT; }
13084 0 : ulong fd_block_block_hash_entry_align( void ){ return FD_BLOCK_BLOCK_HASH_ENTRY_ALIGN; }
13085 :
13086 0 : void fd_block_block_hash_entry_walk( void * w, fd_block_block_hash_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13087 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_block_hash_entry", level++ );
13088 0 : fd_hash_walk( w, &self->blockhash, fun, "blockhash", level );
13089 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
13090 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_block_hash_entry", level-- );
13091 0 : }
13092 74656068 : ulong fd_block_block_hash_entry_size( fd_block_block_hash_entry_t const * self ) {
13093 74656068 : ulong size = 0;
13094 74656068 : size += fd_hash_size( &self->blockhash );
13095 74656068 : size += fd_fee_calculator_size( &self->fee_calculator );
13096 74656068 : return size;
13097 74656068 : }
13098 :
13099 7278 : int fd_recent_block_hashes_decode( fd_recent_block_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
13100 7278 : void const * data = ctx->data;
13101 7278 : int err = fd_recent_block_hashes_decode_preflight( ctx );
13102 7278 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13103 7098 : ctx->data = data;
13104 7098 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13105 7098 : fd_recent_block_hashes_new( self );
13106 7098 : }
13107 7098 : fd_recent_block_hashes_decode_unsafe( self, ctx );
13108 7098 : return FD_BINCODE_SUCCESS;
13109 7278 : }
13110 7278 : int fd_recent_block_hashes_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
13111 7278 : int err;
13112 7278 : ulong hashes_len;
13113 7278 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
13114 7278 : if( FD_UNLIKELY( err ) ) return err;
13115 7230 : ulong hashes_sz;
13116 7230 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
13117 7116 : err = fd_bincode_bytes_decode_preflight( hashes_sz, ctx );
13118 7116 : if( FD_UNLIKELY( err ) ) return err;
13119 7098 : return FD_BINCODE_SUCCESS;
13120 7116 : }
13121 7098 : void fd_recent_block_hashes_decode_unsafe( fd_recent_block_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
13122 7098 : ulong hashes_len;
13123 7098 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
13124 7098 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
13125 7098 : self->hashes = deq_fd_block_block_hash_entry_t_alloc( ctx->valloc, hashes_max );
13126 1191318 : for( ulong i=0; i < hashes_len; i++ ) {
13127 1184220 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
13128 1184220 : fd_block_block_hash_entry_new( elem );
13129 1184220 : fd_block_block_hash_entry_decode_unsafe( elem, ctx );
13130 1184220 : }
13131 7098 : }
13132 872661 : int fd_recent_block_hashes_encode( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13133 872661 : int err;
13134 872661 : if( self->hashes ) {
13135 872661 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
13136 872661 : err = fd_bincode_uint64_encode( hashes_len, ctx );
13137 872661 : if( FD_UNLIKELY( err ) ) return err;
13138 75528729 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes ); !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter ); iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
13139 74656068 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
13140 74656068 : err = fd_block_block_hash_entry_encode( ele, ctx );
13141 74656068 : if( FD_UNLIKELY( err ) ) return err;
13142 74656068 : }
13143 872661 : } else {
13144 0 : ulong hashes_len = 0;
13145 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
13146 0 : if( FD_UNLIKELY( err ) ) return err;
13147 0 : }
13148 872661 : return FD_BINCODE_SUCCESS;
13149 872661 : }
13150 : enum {
13151 : fd_recent_block_hashes_hashes_TAG = (0 << 6) | FD_ARCHIVE_META_DEQUE,
13152 : };
13153 0 : int fd_recent_block_hashes_decode_archival( fd_recent_block_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
13154 0 : void const * data = ctx->data;
13155 0 : int err = fd_recent_block_hashes_decode_archival_preflight( ctx );
13156 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13157 0 : ctx->data = data;
13158 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13159 0 : fd_recent_block_hashes_new( self );
13160 0 : }
13161 0 : fd_recent_block_hashes_decode_archival_unsafe( self, ctx );
13162 0 : return FD_BINCODE_SUCCESS;
13163 0 : }
13164 0 : int fd_recent_block_hashes_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
13165 0 : int err;
13166 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
13167 0 : void * offset = NULL;
13168 0 : for(;;) {
13169 0 : err = fd_bincode_uint16_decode( &tag, ctx );
13170 0 : if( FD_UNLIKELY( err ) ) return err;
13171 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
13172 0 : switch( tag ) {
13173 0 : case (ushort)fd_recent_block_hashes_hashes_TAG: {
13174 0 : err = fd_archive_decode_setup_length( ctx, &offset );
13175 0 : if( FD_UNLIKELY( err ) ) return err;
13176 0 : ulong hashes_len;
13177 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
13178 0 : if( FD_UNLIKELY( err ) ) return err;
13179 0 : ulong hashes_sz;
13180 0 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
13181 0 : err = fd_bincode_bytes_decode_preflight( hashes_sz, ctx );
13182 0 : if( FD_UNLIKELY( err ) ) return err;
13183 0 : err = fd_archive_decode_check_length( ctx, offset );
13184 0 : if( FD_UNLIKELY( err ) ) return err;
13185 0 : break;
13186 0 : }
13187 0 : default:
13188 0 : err = fd_archive_decode_skip_field( ctx, tag );
13189 0 : if( FD_UNLIKELY( err ) ) return err;
13190 0 : break;
13191 0 : }
13192 0 : }
13193 0 : return FD_BINCODE_SUCCESS;
13194 0 : }
13195 0 : void fd_recent_block_hashes_decode_archival_unsafe( fd_recent_block_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
13196 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
13197 0 : void * offset = NULL;
13198 0 : for(;;) {
13199 0 : fd_bincode_uint16_decode( &tag, ctx );
13200 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
13201 0 : switch( tag ) {
13202 0 : case (ushort)fd_recent_block_hashes_hashes_TAG: {
13203 0 : fd_archive_decode_setup_length( ctx, &offset );
13204 0 : ulong hashes_len;
13205 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
13206 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
13207 0 : self->hashes = deq_fd_block_block_hash_entry_t_alloc( ctx->valloc, hashes_max );
13208 0 : for( ulong i=0; i < hashes_len; i++ ) {
13209 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
13210 0 : fd_block_block_hash_entry_new( elem );
13211 0 : fd_block_block_hash_entry_decode_archival_unsafe( elem, ctx );
13212 0 : }
13213 0 : break;
13214 0 : }
13215 0 : default:
13216 0 : fd_archive_decode_skip_field( ctx, tag );
13217 0 : break;
13218 0 : }
13219 0 : }
13220 0 : }
13221 0 : int fd_recent_block_hashes_encode_archival( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13222 0 : int err;
13223 0 : void * offset = NULL;
13224 0 : err = fd_bincode_uint16_encode( (ushort)fd_recent_block_hashes_hashes_TAG, ctx );
13225 0 : if( FD_UNLIKELY( err ) ) return err;
13226 0 : err = fd_archive_encode_setup_length( ctx, &offset );
13227 0 : if( FD_UNLIKELY( err ) ) return err;
13228 0 : if( self->hashes ) {
13229 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
13230 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
13231 0 : if( FD_UNLIKELY( err ) ) return err;
13232 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes ); !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter ); iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
13233 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
13234 0 : err = fd_block_block_hash_entry_encode_archival( ele, ctx );
13235 0 : if( FD_UNLIKELY( err ) ) return err;
13236 0 : }
13237 0 : } else {
13238 0 : ulong hashes_len = 0;
13239 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
13240 0 : if( FD_UNLIKELY( err ) ) return err;
13241 0 : }
13242 0 : err = fd_archive_encode_set_length( ctx, offset );
13243 0 : if( FD_UNLIKELY( err ) ) return err;
13244 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
13245 0 : if( FD_UNLIKELY( err ) ) return err;
13246 0 : return FD_BINCODE_SUCCESS;
13247 0 : }
13248 0 : int fd_recent_block_hashes_decode_offsets( fd_recent_block_hashes_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
13249 0 : uchar const * data = ctx->data;
13250 0 : int err;
13251 0 : self->hashes_off = (uint)( (ulong)ctx->data - (ulong)data );
13252 0 : ulong hashes_len;
13253 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
13254 0 : if( FD_UNLIKELY( err ) ) return err;
13255 0 : ulong hashes_sz;
13256 0 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
13257 0 : err = fd_bincode_bytes_decode_preflight( hashes_sz, ctx );
13258 0 : if( FD_UNLIKELY( err ) ) return err;
13259 0 : return FD_BINCODE_SUCCESS;
13260 0 : }
13261 822816 : void fd_recent_block_hashes_new(fd_recent_block_hashes_t * self) {
13262 822816 : fd_memset( self, 0, sizeof(fd_recent_block_hashes_t) );
13263 822816 : }
13264 1230855 : void fd_recent_block_hashes_destroy( fd_recent_block_hashes_t * self, fd_bincode_destroy_ctx_t * ctx ) {
13265 1230855 : if( self->hashes ) {
13266 3147954 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes ); !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter ); iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
13267 2721318 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
13268 2721318 : fd_block_block_hash_entry_destroy( ele, ctx );
13269 2721318 : }
13270 426636 : fd_valloc_free( ctx->valloc, deq_fd_block_block_hash_entry_t_delete( deq_fd_block_block_hash_entry_t_leave( self->hashes) ) );
13271 426636 : self->hashes = NULL;
13272 426636 : }
13273 1230855 : }
13274 :
13275 0 : ulong fd_recent_block_hashes_footprint( void ){ return FD_RECENT_BLOCK_HASHES_FOOTPRINT; }
13276 0 : ulong fd_recent_block_hashes_align( void ){ return FD_RECENT_BLOCK_HASHES_ALIGN; }
13277 :
13278 0 : void fd_recent_block_hashes_walk( void * w, fd_recent_block_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13279 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_recent_block_hashes", level++ );
13280 :
13281 : /* Walk deque */
13282 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++ );
13283 0 : if( self->hashes ) {
13284 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes );
13285 0 : !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter );
13286 0 : iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
13287 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
13288 0 : fd_block_block_hash_entry_walk(w, ele, fun, "hashes", level );
13289 0 : }
13290 0 : }
13291 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level-- );
13292 : /* Done walking deque */
13293 :
13294 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_recent_block_hashes", level-- );
13295 0 : }
13296 872661 : ulong fd_recent_block_hashes_size( fd_recent_block_hashes_t const * self ) {
13297 872661 : ulong size = 0;
13298 872661 : if( self->hashes ) {
13299 872661 : size += sizeof(ulong);
13300 75528729 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes ); !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter ); iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
13301 74656068 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
13302 74656068 : size += fd_block_block_hash_entry_size( ele );
13303 74656068 : }
13304 872661 : } else {
13305 0 : size += sizeof(ulong);
13306 0 : }
13307 872661 : return size;
13308 872661 : }
13309 :
13310 0 : int fd_slot_meta_decode( fd_slot_meta_t * self, fd_bincode_decode_ctx_t * ctx ) {
13311 0 : void const * data = ctx->data;
13312 0 : int err = fd_slot_meta_decode_preflight( ctx );
13313 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13314 0 : ctx->data = data;
13315 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13316 0 : fd_slot_meta_new( self );
13317 0 : }
13318 0 : fd_slot_meta_decode_unsafe( self, ctx );
13319 0 : return FD_BINCODE_SUCCESS;
13320 0 : }
13321 0 : int fd_slot_meta_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
13322 0 : int err;
13323 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13324 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13325 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13326 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13327 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13328 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13329 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13330 0 : if( FD_UNLIKELY( err ) ) return err;
13331 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13332 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13333 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13334 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13335 0 : ulong next_slot_len;
13336 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
13337 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13338 0 : if( next_slot_len ) {
13339 0 : for( ulong i=0; i < next_slot_len; i++ ) {
13340 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13341 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13342 0 : }
13343 0 : }
13344 0 : err = fd_bincode_uint8_decode_preflight( ctx );
13345 0 : if( FD_UNLIKELY( err ) ) return err;
13346 0 : ulong entry_end_indexes_len;
13347 0 : err = fd_bincode_uint64_decode( &entry_end_indexes_len, ctx );
13348 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13349 0 : if( entry_end_indexes_len ) {
13350 0 : for( ulong i=0; i < entry_end_indexes_len; i++ ) {
13351 0 : err = fd_bincode_uint32_decode_preflight( ctx );
13352 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13353 0 : }
13354 0 : }
13355 0 : return FD_BINCODE_SUCCESS;
13356 0 : }
13357 0 : void fd_slot_meta_decode_unsafe( fd_slot_meta_t * self, fd_bincode_decode_ctx_t * ctx ) {
13358 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
13359 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
13360 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
13361 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
13362 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
13363 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
13364 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
13365 0 : if( self->next_slot_len ) {
13366 0 : self->next_slot = fd_valloc_malloc( ctx->valloc, 8UL, sizeof(ulong)*self->next_slot_len );
13367 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
13368 0 : fd_bincode_uint64_decode_unsafe( self->next_slot + i, ctx );
13369 0 : }
13370 0 : } else
13371 0 : self->next_slot = NULL;
13372 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
13373 0 : fd_bincode_uint64_decode_unsafe( &self->entry_end_indexes_len, ctx );
13374 0 : if( self->entry_end_indexes_len ) {
13375 0 : self->entry_end_indexes = fd_valloc_malloc( ctx->valloc, 8UL, sizeof(uint)*self->entry_end_indexes_len );
13376 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
13377 0 : fd_bincode_uint32_decode_unsafe( self->entry_end_indexes + i, ctx );
13378 0 : }
13379 0 : } else
13380 0 : self->entry_end_indexes = NULL;
13381 0 : }
13382 0 : int fd_slot_meta_encode( fd_slot_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13383 0 : int err;
13384 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
13385 0 : if( FD_UNLIKELY( err ) ) return err;
13386 0 : err = fd_bincode_uint64_encode( self->consumed, ctx );
13387 0 : if( FD_UNLIKELY( err ) ) return err;
13388 0 : err = fd_bincode_uint64_encode( self->received, ctx );
13389 0 : if( FD_UNLIKELY( err ) ) return err;
13390 0 : err = fd_bincode_uint64_encode( (ulong)self->first_shred_timestamp, ctx );
13391 0 : if( FD_UNLIKELY( err ) ) return err;
13392 0 : err = fd_bincode_uint64_encode( self->last_index, ctx );
13393 0 : if( FD_UNLIKELY( err ) ) return err;
13394 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
13395 0 : if( FD_UNLIKELY( err ) ) return err;
13396 0 : err = fd_bincode_uint64_encode( self->next_slot_len, ctx );
13397 0 : if( FD_UNLIKELY(err) ) return err;
13398 0 : if( self->next_slot_len ) {
13399 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
13400 0 : err = fd_bincode_uint64_encode( self->next_slot[i], ctx );
13401 0 : }
13402 0 : }
13403 0 : err = fd_bincode_uint8_encode( (uchar)(self->is_connected), ctx );
13404 0 : if( FD_UNLIKELY( err ) ) return err;
13405 0 : err = fd_bincode_uint64_encode( self->entry_end_indexes_len, ctx );
13406 0 : if( FD_UNLIKELY(err) ) return err;
13407 0 : if( self->entry_end_indexes_len ) {
13408 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
13409 0 : err = fd_bincode_uint32_encode( self->entry_end_indexes[i], ctx );
13410 0 : }
13411 0 : }
13412 0 : return FD_BINCODE_SUCCESS;
13413 0 : }
13414 0 : int fd_slot_meta_decode_offsets( fd_slot_meta_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
13415 0 : uchar const * data = ctx->data;
13416 0 : int err;
13417 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
13418 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13419 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13420 0 : self->consumed_off = (uint)( (ulong)ctx->data - (ulong)data );
13421 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13422 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13423 0 : self->received_off = (uint)( (ulong)ctx->data - (ulong)data );
13424 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13425 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13426 0 : self->first_shred_timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
13427 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13428 0 : if( FD_UNLIKELY( err ) ) return err;
13429 0 : self->last_index_off = (uint)( (ulong)ctx->data - (ulong)data );
13430 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13431 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13432 0 : self->parent_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
13433 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13434 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13435 0 : self->next_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
13436 0 : ulong next_slot_len;
13437 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
13438 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13439 0 : if( next_slot_len ) {
13440 0 : for( ulong i=0; i < next_slot_len; i++ ) {
13441 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13442 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13443 0 : }
13444 0 : }
13445 0 : self->is_connected_off = (uint)( (ulong)ctx->data - (ulong)data );
13446 0 : err = fd_bincode_uint8_decode_preflight( ctx );
13447 0 : if( FD_UNLIKELY( err ) ) return err;
13448 0 : self->entry_end_indexes_off = (uint)( (ulong)ctx->data - (ulong)data );
13449 0 : ulong entry_end_indexes_len;
13450 0 : err = fd_bincode_uint64_decode( &entry_end_indexes_len, ctx );
13451 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13452 0 : if( entry_end_indexes_len ) {
13453 0 : for( ulong i=0; i < entry_end_indexes_len; i++ ) {
13454 0 : err = fd_bincode_uint32_decode_preflight( ctx );
13455 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13456 0 : }
13457 0 : }
13458 0 : return FD_BINCODE_SUCCESS;
13459 0 : }
13460 0 : void fd_slot_meta_new(fd_slot_meta_t * self) {
13461 0 : fd_memset( self, 0, sizeof(fd_slot_meta_t) );
13462 0 : }
13463 0 : void fd_slot_meta_destroy( fd_slot_meta_t * self, fd_bincode_destroy_ctx_t * ctx ) {
13464 0 : if( self->next_slot ) {
13465 0 : fd_valloc_free( ctx->valloc, self->next_slot );
13466 0 : self->next_slot = NULL;
13467 0 : }
13468 0 : if( self->entry_end_indexes ) {
13469 0 : fd_valloc_free( ctx->valloc, self->entry_end_indexes );
13470 0 : self->entry_end_indexes = NULL;
13471 0 : }
13472 0 : }
13473 :
13474 0 : ulong fd_slot_meta_footprint( void ){ return FD_SLOT_META_FOOTPRINT; }
13475 0 : ulong fd_slot_meta_align( void ){ return FD_SLOT_META_ALIGN; }
13476 :
13477 0 : void fd_slot_meta_walk( void * w, fd_slot_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13478 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_meta", level++ );
13479 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13480 0 : fun( w, &self->consumed, "consumed", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13481 0 : fun( w, &self->received, "received", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13482 0 : fun( w, &self->first_shred_timestamp, "first_shred_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
13483 0 : fun( w, &self->last_index, "last_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13484 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13485 0 : if( self->next_slot_len ) {
13486 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR, "array", level++ );
13487 0 : for( ulong i=0; i < self->next_slot_len; i++ )
13488 0 : fun( w, self->next_slot + i, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13489 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
13490 0 : }
13491 0 : fun( w, &self->is_connected, "is_connected", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
13492 0 : if( self->entry_end_indexes_len ) {
13493 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
13494 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ )
13495 0 : fun( w, self->entry_end_indexes + i, "entry_end_indexes", FD_FLAMENCO_TYPE_UINT, "uint", level );
13496 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
13497 0 : }
13498 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_meta", level-- );
13499 0 : }
13500 0 : ulong fd_slot_meta_size( fd_slot_meta_t const * self ) {
13501 0 : ulong size = 0;
13502 0 : size += sizeof(ulong);
13503 0 : size += sizeof(ulong);
13504 0 : size += sizeof(ulong);
13505 0 : size += sizeof(long);
13506 0 : size += sizeof(ulong);
13507 0 : size += sizeof(ulong);
13508 0 : do {
13509 0 : size += sizeof(ulong);
13510 0 : size += self->next_slot_len * sizeof(ulong);
13511 0 : } while(0);
13512 0 : size += sizeof(char);
13513 0 : do {
13514 0 : size += sizeof(ulong);
13515 0 : size += self->entry_end_indexes_len * sizeof(uint);
13516 0 : } while(0);
13517 0 : return size;
13518 0 : }
13519 :
13520 0 : int fd_clock_timestamp_vote_decode( fd_clock_timestamp_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
13521 0 : void const * data = ctx->data;
13522 0 : int err = fd_clock_timestamp_vote_decode_preflight( ctx );
13523 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13524 0 : ctx->data = data;
13525 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13526 0 : fd_clock_timestamp_vote_new( self );
13527 0 : }
13528 0 : fd_clock_timestamp_vote_decode_unsafe( self, ctx );
13529 0 : return FD_BINCODE_SUCCESS;
13530 0 : }
13531 0 : int fd_clock_timestamp_vote_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
13532 0 : return fd_bincode_bytes_decode_preflight( 48, ctx );
13533 0 : }
13534 0 : void fd_clock_timestamp_vote_decode_unsafe( fd_clock_timestamp_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
13535 0 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
13536 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
13537 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
13538 0 : }
13539 0 : int fd_clock_timestamp_vote_encode( fd_clock_timestamp_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13540 0 : int err;
13541 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
13542 0 : if( FD_UNLIKELY( err ) ) return err;
13543 0 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
13544 0 : if( FD_UNLIKELY( err ) ) return err;
13545 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
13546 0 : if( FD_UNLIKELY( err ) ) return err;
13547 0 : return FD_BINCODE_SUCCESS;
13548 0 : }
13549 : enum {
13550 : fd_clock_timestamp_vote_pubkey_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
13551 : fd_clock_timestamp_vote_timestamp_TAG = (1 << 6) | FD_ARCHIVE_META_LONG,
13552 : fd_clock_timestamp_vote_slot_TAG = (2 << 6) | FD_ARCHIVE_META_ULONG,
13553 : };
13554 0 : int fd_clock_timestamp_vote_decode_archival( fd_clock_timestamp_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
13555 0 : void const * data = ctx->data;
13556 0 : int err = fd_clock_timestamp_vote_decode_archival_preflight( ctx );
13557 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13558 0 : ctx->data = data;
13559 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13560 0 : fd_clock_timestamp_vote_new( self );
13561 0 : }
13562 0 : fd_clock_timestamp_vote_decode_archival_unsafe( self, ctx );
13563 0 : return FD_BINCODE_SUCCESS;
13564 0 : }
13565 0 : int fd_clock_timestamp_vote_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
13566 0 : int err;
13567 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
13568 0 : void * offset = NULL;
13569 0 : for(;;) {
13570 0 : err = fd_bincode_uint16_decode( &tag, ctx );
13571 0 : if( FD_UNLIKELY( err ) ) return err;
13572 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
13573 0 : switch( tag ) {
13574 0 : case (ushort)fd_clock_timestamp_vote_pubkey_TAG: {
13575 0 : err = fd_archive_decode_setup_length( ctx, &offset );
13576 0 : if( FD_UNLIKELY( err ) ) return err;
13577 0 : err = fd_pubkey_decode_archival_preflight( ctx );
13578 0 : if( FD_UNLIKELY( err ) ) return err;
13579 0 : err = fd_archive_decode_check_length( ctx, offset );
13580 0 : if( FD_UNLIKELY( err ) ) return err;
13581 0 : break;
13582 0 : }
13583 0 : case (ushort)fd_clock_timestamp_vote_timestamp_TAG: {
13584 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13585 0 : if( FD_UNLIKELY( err ) ) return err;
13586 0 : break;
13587 0 : }
13588 0 : case (ushort)fd_clock_timestamp_vote_slot_TAG: {
13589 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13590 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13591 0 : break;
13592 0 : }
13593 0 : default:
13594 0 : err = fd_archive_decode_skip_field( ctx, tag );
13595 0 : if( FD_UNLIKELY( err ) ) return err;
13596 0 : break;
13597 0 : }
13598 0 : }
13599 0 : return FD_BINCODE_SUCCESS;
13600 0 : }
13601 0 : void fd_clock_timestamp_vote_decode_archival_unsafe( fd_clock_timestamp_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
13602 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
13603 0 : void * offset = NULL;
13604 0 : for(;;) {
13605 0 : fd_bincode_uint16_decode( &tag, ctx );
13606 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
13607 0 : switch( tag ) {
13608 0 : case (ushort)fd_clock_timestamp_vote_pubkey_TAG: {
13609 0 : fd_archive_decode_setup_length( ctx, &offset );
13610 0 : fd_pubkey_decode_archival_unsafe( &self->pubkey, ctx );
13611 0 : break;
13612 0 : }
13613 0 : case (ushort)fd_clock_timestamp_vote_timestamp_TAG: {
13614 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
13615 0 : break;
13616 0 : }
13617 0 : case (ushort)fd_clock_timestamp_vote_slot_TAG: {
13618 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
13619 0 : break;
13620 0 : }
13621 0 : default:
13622 0 : fd_archive_decode_skip_field( ctx, tag );
13623 0 : break;
13624 0 : }
13625 0 : }
13626 0 : }
13627 0 : int fd_clock_timestamp_vote_encode_archival( fd_clock_timestamp_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13628 0 : int err;
13629 0 : void * offset = NULL;
13630 0 : err = fd_bincode_uint16_encode( (ushort)fd_clock_timestamp_vote_pubkey_TAG, ctx );
13631 0 : if( FD_UNLIKELY( err ) ) return err;
13632 0 : err = fd_archive_encode_setup_length( ctx, &offset );
13633 0 : if( FD_UNLIKELY( err ) ) return err;
13634 0 : err = fd_pubkey_encode_archival( &self->pubkey, ctx );
13635 0 : if( FD_UNLIKELY( err ) ) return err;
13636 0 : err = fd_archive_encode_set_length( ctx, offset );
13637 0 : if( FD_UNLIKELY( err ) ) return err;
13638 0 : err = fd_bincode_uint16_encode( (ushort)fd_clock_timestamp_vote_timestamp_TAG, ctx );
13639 0 : if( FD_UNLIKELY( err ) ) return err;
13640 0 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
13641 0 : if( FD_UNLIKELY( err ) ) return err;
13642 0 : err = fd_bincode_uint16_encode( (ushort)fd_clock_timestamp_vote_slot_TAG, ctx );
13643 0 : if( FD_UNLIKELY( err ) ) return err;
13644 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
13645 0 : if( FD_UNLIKELY( err ) ) return err;
13646 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
13647 0 : if( FD_UNLIKELY( err ) ) return err;
13648 0 : return FD_BINCODE_SUCCESS;
13649 0 : }
13650 0 : int fd_clock_timestamp_vote_decode_offsets( fd_clock_timestamp_vote_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
13651 0 : uchar const * data = ctx->data;
13652 0 : int err;
13653 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
13654 0 : err = fd_pubkey_decode_preflight( ctx );
13655 0 : if( FD_UNLIKELY( err ) ) return err;
13656 0 : self->timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
13657 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13658 0 : if( FD_UNLIKELY( err ) ) return err;
13659 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
13660 0 : err = fd_bincode_uint64_decode_preflight( ctx );
13661 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13662 0 : return FD_BINCODE_SUCCESS;
13663 0 : }
13664 0 : void fd_clock_timestamp_vote_new(fd_clock_timestamp_vote_t * self) {
13665 0 : fd_memset( self, 0, sizeof(fd_clock_timestamp_vote_t) );
13666 0 : fd_pubkey_new( &self->pubkey );
13667 0 : }
13668 0 : void fd_clock_timestamp_vote_destroy( fd_clock_timestamp_vote_t * self, fd_bincode_destroy_ctx_t * ctx ) {
13669 0 : fd_pubkey_destroy( &self->pubkey, ctx );
13670 0 : }
13671 :
13672 0 : ulong fd_clock_timestamp_vote_footprint( void ){ return FD_CLOCK_TIMESTAMP_VOTE_FOOTPRINT; }
13673 0 : ulong fd_clock_timestamp_vote_align( void ){ return FD_CLOCK_TIMESTAMP_VOTE_ALIGN; }
13674 :
13675 0 : void fd_clock_timestamp_vote_walk( void * w, fd_clock_timestamp_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13676 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_vote", level++ );
13677 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
13678 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
13679 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
13680 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_vote", level-- );
13681 0 : }
13682 0 : ulong fd_clock_timestamp_vote_size( fd_clock_timestamp_vote_t const * self ) {
13683 0 : ulong size = 0;
13684 0 : size += fd_pubkey_size( &self->pubkey );
13685 0 : size += sizeof(long);
13686 0 : size += sizeof(ulong);
13687 0 : return size;
13688 0 : }
13689 :
13690 0 : int fd_clock_timestamp_votes_decode( fd_clock_timestamp_votes_t * self, fd_bincode_decode_ctx_t * ctx ) {
13691 0 : void const * data = ctx->data;
13692 0 : int err = fd_clock_timestamp_votes_decode_preflight( ctx );
13693 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13694 0 : ctx->data = data;
13695 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13696 0 : fd_clock_timestamp_votes_new( self );
13697 0 : }
13698 0 : fd_clock_timestamp_votes_decode_unsafe( self, ctx );
13699 0 : return FD_BINCODE_SUCCESS;
13700 0 : }
13701 0 : int fd_clock_timestamp_votes_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
13702 0 : int err;
13703 0 : ulong votes_len;
13704 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
13705 0 : if( FD_UNLIKELY( err ) ) return err;
13706 0 : for( ulong i=0; i < votes_len; i++ ) {
13707 0 : err = fd_clock_timestamp_vote_decode_preflight( ctx );
13708 0 : if( FD_UNLIKELY( err ) ) return err;
13709 0 : }
13710 0 : return FD_BINCODE_SUCCESS;
13711 0 : }
13712 0 : void fd_clock_timestamp_votes_decode_unsafe( fd_clock_timestamp_votes_t * self, fd_bincode_decode_ctx_t * ctx ) {
13713 0 : ulong votes_len;
13714 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
13715 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13716 0 : self->votes_pool = fd_clock_timestamp_vote_t_map_alloc( ctx->valloc, fd_ulong_max(votes_len, 15000 ) );
13717 0 : self->votes_root = NULL;
13718 0 : }
13719 0 : for( ulong i=0; i < votes_len; i++ ) {
13720 0 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( self->votes_pool );
13721 0 : fd_clock_timestamp_vote_new( &node->elem );
13722 0 : fd_clock_timestamp_vote_decode_unsafe( &node->elem, ctx );
13723 0 : fd_clock_timestamp_vote_t_map_insert( self->votes_pool, &self->votes_root, node );
13724 0 : }
13725 0 : }
13726 0 : int fd_clock_timestamp_votes_encode( fd_clock_timestamp_votes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13727 0 : int err;
13728 0 : if( self->votes_root ) {
13729 0 : ulong votes_len = fd_clock_timestamp_vote_t_map_size( self->votes_pool, self->votes_root );
13730 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
13731 0 : if( FD_UNLIKELY( err ) ) return err;
13732 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum( self->votes_pool, self->votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( self->votes_pool, n ) ) {
13733 0 : err = fd_clock_timestamp_vote_encode( &n->elem, ctx );
13734 0 : if( FD_UNLIKELY( err ) ) return err;
13735 0 : }
13736 0 : } else {
13737 0 : ulong votes_len = 0;
13738 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
13739 0 : if( FD_UNLIKELY( err ) ) return err;
13740 0 : }
13741 0 : return FD_BINCODE_SUCCESS;
13742 0 : }
13743 : enum {
13744 : fd_clock_timestamp_votes_votes_TAG = (0 << 6) | FD_ARCHIVE_META_MAP,
13745 : };
13746 0 : int fd_clock_timestamp_votes_decode_archival( fd_clock_timestamp_votes_t * self, fd_bincode_decode_ctx_t * ctx ) {
13747 0 : void const * data = ctx->data;
13748 0 : int err = fd_clock_timestamp_votes_decode_archival_preflight( ctx );
13749 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13750 0 : ctx->data = data;
13751 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13752 0 : fd_clock_timestamp_votes_new( self );
13753 0 : }
13754 0 : fd_clock_timestamp_votes_decode_archival_unsafe( self, ctx );
13755 0 : return FD_BINCODE_SUCCESS;
13756 0 : }
13757 0 : int fd_clock_timestamp_votes_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
13758 0 : int err;
13759 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
13760 0 : void * offset = NULL;
13761 0 : for(;;) {
13762 0 : err = fd_bincode_uint16_decode( &tag, ctx );
13763 0 : if( FD_UNLIKELY( err ) ) return err;
13764 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
13765 0 : switch( tag ) {
13766 0 : case (ushort)fd_clock_timestamp_votes_votes_TAG: {
13767 0 : err = fd_archive_decode_setup_length( ctx, &offset );
13768 0 : if( FD_UNLIKELY( err ) ) return err;
13769 0 : ulong votes_len;
13770 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
13771 0 : if( FD_UNLIKELY( err ) ) return err;
13772 0 : for( ulong i=0; i < votes_len; i++ ) {
13773 0 : err = fd_clock_timestamp_vote_decode_archival_preflight( ctx );
13774 0 : if( FD_UNLIKELY( err ) ) return err;
13775 0 : }
13776 0 : err = fd_archive_decode_check_length( ctx, offset );
13777 0 : if( FD_UNLIKELY( err ) ) return err;
13778 0 : break;
13779 0 : }
13780 0 : default:
13781 0 : err = fd_archive_decode_skip_field( ctx, tag );
13782 0 : if( FD_UNLIKELY( err ) ) return err;
13783 0 : break;
13784 0 : }
13785 0 : }
13786 0 : return FD_BINCODE_SUCCESS;
13787 0 : }
13788 0 : void fd_clock_timestamp_votes_decode_archival_unsafe( fd_clock_timestamp_votes_t * self, fd_bincode_decode_ctx_t * ctx ) {
13789 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
13790 0 : void * offset = NULL;
13791 0 : for(;;) {
13792 0 : fd_bincode_uint16_decode( &tag, ctx );
13793 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
13794 0 : switch( tag ) {
13795 0 : case (ushort)fd_clock_timestamp_votes_votes_TAG: {
13796 0 : fd_archive_decode_setup_length( ctx, &offset );
13797 0 : ulong votes_len;
13798 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
13799 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13800 0 : self->votes_pool = fd_clock_timestamp_vote_t_map_alloc( ctx->valloc, fd_ulong_max(votes_len, 15000 ) );
13801 0 : self->votes_root = NULL;
13802 0 : }
13803 0 : for( ulong i=0; i < votes_len; i++ ) {
13804 0 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( self->votes_pool );
13805 0 : fd_clock_timestamp_vote_new( &node->elem );
13806 0 : fd_clock_timestamp_vote_decode_archival_unsafe( &node->elem, ctx );
13807 0 : fd_clock_timestamp_vote_t_map_insert( self->votes_pool, &self->votes_root, node );
13808 0 : }
13809 0 : break;
13810 0 : }
13811 0 : default:
13812 0 : fd_archive_decode_skip_field( ctx, tag );
13813 0 : break;
13814 0 : }
13815 0 : }
13816 0 : }
13817 0 : int fd_clock_timestamp_votes_encode_archival( fd_clock_timestamp_votes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13818 0 : int err;
13819 0 : void * offset = NULL;
13820 0 : err = fd_bincode_uint16_encode( (ushort)fd_clock_timestamp_votes_votes_TAG, ctx );
13821 0 : if( FD_UNLIKELY( err ) ) return err;
13822 0 : err = fd_archive_encode_setup_length( ctx, &offset );
13823 0 : if( FD_UNLIKELY( err ) ) return err;
13824 0 : if( self->votes_root ) {
13825 0 : ulong votes_len = fd_clock_timestamp_vote_t_map_size( self->votes_pool, self->votes_root );
13826 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
13827 0 : if( FD_UNLIKELY( err ) ) return err;
13828 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum( self->votes_pool, self->votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( self->votes_pool, n ) ) {
13829 0 : err = fd_clock_timestamp_vote_encode_archival( &n->elem, ctx );
13830 0 : if( FD_UNLIKELY( err ) ) return err;
13831 0 : }
13832 0 : } else {
13833 0 : ulong votes_len = 0;
13834 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
13835 0 : if( FD_UNLIKELY( err ) ) return err;
13836 0 : }
13837 0 : err = fd_archive_encode_set_length( ctx, offset );
13838 0 : if( FD_UNLIKELY( err ) ) return err;
13839 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
13840 0 : if( FD_UNLIKELY( err ) ) return err;
13841 0 : return FD_BINCODE_SUCCESS;
13842 0 : }
13843 0 : int fd_clock_timestamp_votes_decode_offsets( fd_clock_timestamp_votes_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
13844 0 : uchar const * data = ctx->data;
13845 0 : int err;
13846 0 : self->votes_off = (uint)( (ulong)ctx->data - (ulong)data );
13847 0 : ulong votes_len;
13848 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
13849 0 : if( FD_UNLIKELY( err ) ) return err;
13850 0 : for( ulong i=0; i < votes_len; i++ ) {
13851 0 : err = fd_clock_timestamp_vote_decode_preflight( ctx );
13852 0 : if( FD_UNLIKELY( err ) ) return err;
13853 0 : }
13854 0 : return FD_BINCODE_SUCCESS;
13855 0 : }
13856 815718 : void fd_clock_timestamp_votes_new(fd_clock_timestamp_votes_t * self) {
13857 815718 : fd_memset( self, 0, sizeof(fd_clock_timestamp_votes_t) );
13858 815718 : }
13859 815718 : void fd_clock_timestamp_votes_destroy( fd_clock_timestamp_votes_t * self, fd_bincode_destroy_ctx_t * ctx ) {
13860 815718 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum(self->votes_pool, self->votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor(self->votes_pool, n) ) {
13861 0 : fd_clock_timestamp_vote_destroy( &n->elem, ctx );
13862 0 : }
13863 815718 : fd_valloc_free( ctx->valloc, fd_clock_timestamp_vote_t_map_delete( fd_clock_timestamp_vote_t_map_leave( self->votes_pool ) ) );
13864 815718 : self->votes_pool = NULL;
13865 815718 : self->votes_root = NULL;
13866 815718 : }
13867 :
13868 0 : ulong fd_clock_timestamp_votes_footprint( void ){ return FD_CLOCK_TIMESTAMP_VOTES_FOOTPRINT; }
13869 0 : ulong fd_clock_timestamp_votes_align( void ){ return FD_CLOCK_TIMESTAMP_VOTES_ALIGN; }
13870 :
13871 0 : void fd_clock_timestamp_votes_walk( void * w, fd_clock_timestamp_votes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13872 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_votes", level++ );
13873 0 : if( self->votes_root ) {
13874 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum(self->votes_pool, self->votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( self->votes_pool, n ) ) {
13875 0 : fd_clock_timestamp_vote_walk(w, &n->elem, fun, "votes", level );
13876 0 : }
13877 0 : }
13878 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_votes", level-- );
13879 0 : }
13880 0 : ulong fd_clock_timestamp_votes_size( fd_clock_timestamp_votes_t const * self ) {
13881 0 : ulong size = 0;
13882 0 : if( self->votes_root ) {
13883 0 : size += sizeof(ulong);
13884 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum( self->votes_pool, self->votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( self->votes_pool, n ) ) {
13885 0 : size += fd_clock_timestamp_vote_size( &n->elem );
13886 0 : }
13887 0 : } else {
13888 0 : size += sizeof(ulong);
13889 0 : }
13890 0 : return size;
13891 0 : }
13892 :
13893 3252 : int fd_sysvar_fees_decode( fd_sysvar_fees_t * self, fd_bincode_decode_ctx_t * ctx ) {
13894 3252 : void const * data = ctx->data;
13895 3252 : int err = fd_sysvar_fees_decode_preflight( ctx );
13896 3252 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13897 3213 : ctx->data = data;
13898 3213 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13899 3213 : fd_sysvar_fees_new( self );
13900 3213 : }
13901 3213 : fd_sysvar_fees_decode_unsafe( self, ctx );
13902 3213 : return FD_BINCODE_SUCCESS;
13903 3252 : }
13904 3252 : int fd_sysvar_fees_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
13905 3252 : return fd_bincode_bytes_decode_preflight( 8, ctx );
13906 3252 : }
13907 3213 : void fd_sysvar_fees_decode_unsafe( fd_sysvar_fees_t * self, fd_bincode_decode_ctx_t * ctx ) {
13908 3213 : fd_fee_calculator_decode_unsafe( &self->fee_calculator, ctx );
13909 3213 : }
13910 0 : int fd_sysvar_fees_encode( fd_sysvar_fees_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13911 0 : int err;
13912 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
13913 0 : if( FD_UNLIKELY( err ) ) return err;
13914 0 : return FD_BINCODE_SUCCESS;
13915 0 : }
13916 0 : int fd_sysvar_fees_decode_offsets( fd_sysvar_fees_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
13917 0 : uchar const * data = ctx->data;
13918 0 : int err;
13919 0 : self->fee_calculator_off = (uint)( (ulong)ctx->data - (ulong)data );
13920 0 : err = fd_fee_calculator_decode_preflight( ctx );
13921 0 : if( FD_UNLIKELY( err ) ) return err;
13922 0 : return FD_BINCODE_SUCCESS;
13923 0 : }
13924 3213 : void fd_sysvar_fees_new(fd_sysvar_fees_t * self) {
13925 3213 : fd_memset( self, 0, sizeof(fd_sysvar_fees_t) );
13926 3213 : fd_fee_calculator_new( &self->fee_calculator );
13927 3213 : }
13928 411111 : void fd_sysvar_fees_destroy( fd_sysvar_fees_t * self, fd_bincode_destroy_ctx_t * ctx ) {
13929 411111 : fd_fee_calculator_destroy( &self->fee_calculator, ctx );
13930 411111 : }
13931 :
13932 0 : ulong fd_sysvar_fees_footprint( void ){ return FD_SYSVAR_FEES_FOOTPRINT; }
13933 0 : ulong fd_sysvar_fees_align( void ){ return FD_SYSVAR_FEES_ALIGN; }
13934 :
13935 0 : void fd_sysvar_fees_walk( void * w, fd_sysvar_fees_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
13936 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_fees", level++ );
13937 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
13938 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_fees", level-- );
13939 0 : }
13940 0 : ulong fd_sysvar_fees_size( fd_sysvar_fees_t const * self ) {
13941 0 : ulong size = 0;
13942 0 : size += fd_fee_calculator_size( &self->fee_calculator );
13943 0 : return size;
13944 0 : }
13945 :
13946 4767 : int fd_sysvar_epoch_rewards_decode( fd_sysvar_epoch_rewards_t * self, fd_bincode_decode_ctx_t * ctx ) {
13947 4767 : void const * data = ctx->data;
13948 4767 : int err = fd_sysvar_epoch_rewards_decode_preflight( ctx );
13949 4767 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13950 4344 : ctx->data = data;
13951 4344 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
13952 4344 : fd_sysvar_epoch_rewards_new( self );
13953 4344 : }
13954 4344 : fd_sysvar_epoch_rewards_decode_unsafe( self, ctx );
13955 4344 : return FD_BINCODE_SUCCESS;
13956 4767 : }
13957 4767 : int fd_sysvar_epoch_rewards_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
13958 4767 : int err;
13959 4767 : err = fd_bincode_uint64_decode_preflight( ctx );
13960 4767 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13961 4716 : err = fd_bincode_uint64_decode_preflight( ctx );
13962 4716 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13963 4707 : err = fd_hash_decode_preflight( ctx );
13964 4707 : if( FD_UNLIKELY( err ) ) return err;
13965 4425 : err = fd_bincode_uint128_decode_preflight( ctx );
13966 4425 : if( FD_UNLIKELY( err ) ) return err;
13967 4422 : err = fd_bincode_uint64_decode_preflight( ctx );
13968 4422 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13969 4416 : err = fd_bincode_uint64_decode_preflight( ctx );
13970 4416 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13971 4413 : err = fd_bincode_bool_decode_preflight( ctx );
13972 4413 : if( FD_UNLIKELY( err ) ) return err;
13973 4344 : return FD_BINCODE_SUCCESS;
13974 4413 : }
13975 4344 : void fd_sysvar_epoch_rewards_decode_unsafe( fd_sysvar_epoch_rewards_t * self, fd_bincode_decode_ctx_t * ctx ) {
13976 4344 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
13977 4344 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
13978 4344 : fd_hash_decode_unsafe( &self->parent_blockhash, ctx );
13979 4344 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
13980 4344 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
13981 4344 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
13982 4344 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
13983 4344 : }
13984 1845 : int fd_sysvar_epoch_rewards_encode( fd_sysvar_epoch_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13985 1845 : int err;
13986 1845 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
13987 1845 : if( FD_UNLIKELY( err ) ) return err;
13988 1845 : err = fd_bincode_uint64_encode( self->num_partitions, ctx );
13989 1845 : if( FD_UNLIKELY( err ) ) return err;
13990 1845 : err = fd_hash_encode( &self->parent_blockhash, ctx );
13991 1845 : if( FD_UNLIKELY( err ) ) return err;
13992 1845 : err = fd_bincode_uint128_encode( self->total_points, ctx );
13993 1845 : if( FD_UNLIKELY( err ) ) return err;
13994 1845 : err = fd_bincode_uint64_encode( self->total_rewards, ctx );
13995 1845 : if( FD_UNLIKELY( err ) ) return err;
13996 1845 : err = fd_bincode_uint64_encode( self->distributed_rewards, ctx );
13997 1845 : if( FD_UNLIKELY( err ) ) return err;
13998 1845 : err = fd_bincode_bool_encode( (uchar)(self->active), ctx );
13999 1845 : if( FD_UNLIKELY( err ) ) return err;
14000 1845 : return FD_BINCODE_SUCCESS;
14001 1845 : }
14002 0 : int fd_sysvar_epoch_rewards_decode_offsets( fd_sysvar_epoch_rewards_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
14003 0 : uchar const * data = ctx->data;
14004 0 : int err;
14005 0 : self->distribution_starting_block_height_off = (uint)( (ulong)ctx->data - (ulong)data );
14006 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14007 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14008 0 : self->num_partitions_off = (uint)( (ulong)ctx->data - (ulong)data );
14009 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14010 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14011 0 : self->parent_blockhash_off = (uint)( (ulong)ctx->data - (ulong)data );
14012 0 : err = fd_hash_decode_preflight( ctx );
14013 0 : if( FD_UNLIKELY( err ) ) return err;
14014 0 : self->total_points_off = (uint)( (ulong)ctx->data - (ulong)data );
14015 0 : err = fd_bincode_uint128_decode_preflight( ctx );
14016 0 : if( FD_UNLIKELY( err ) ) return err;
14017 0 : self->total_rewards_off = (uint)( (ulong)ctx->data - (ulong)data );
14018 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14019 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14020 0 : self->distributed_rewards_off = (uint)( (ulong)ctx->data - (ulong)data );
14021 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14022 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14023 0 : self->active_off = (uint)( (ulong)ctx->data - (ulong)data );
14024 0 : err = fd_bincode_bool_decode_preflight( ctx );
14025 0 : if( FD_UNLIKELY( err ) ) return err;
14026 0 : return FD_BINCODE_SUCCESS;
14027 0 : }
14028 4344 : void fd_sysvar_epoch_rewards_new(fd_sysvar_epoch_rewards_t * self) {
14029 4344 : fd_memset( self, 0, sizeof(fd_sysvar_epoch_rewards_t) );
14030 4344 : fd_hash_new( &self->parent_blockhash );
14031 4344 : }
14032 412626 : void fd_sysvar_epoch_rewards_destroy( fd_sysvar_epoch_rewards_t * self, fd_bincode_destroy_ctx_t * ctx ) {
14033 412626 : fd_hash_destroy( &self->parent_blockhash, ctx );
14034 412626 : }
14035 :
14036 0 : ulong fd_sysvar_epoch_rewards_footprint( void ){ return FD_SYSVAR_EPOCH_REWARDS_FOOTPRINT; }
14037 0 : ulong fd_sysvar_epoch_rewards_align( void ){ return FD_SYSVAR_EPOCH_REWARDS_ALIGN; }
14038 :
14039 0 : void fd_sysvar_epoch_rewards_walk( void * w, fd_sysvar_epoch_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14040 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_epoch_rewards", level++ );
14041 0 : fun( w, &self->distribution_starting_block_height, "distribution_starting_block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14042 0 : fun( w, &self->num_partitions, "num_partitions", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14043 0 : fd_hash_walk( w, &self->parent_blockhash, fun, "parent_blockhash", level );
14044 0 : fun( w, &self->total_points, "total_points", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
14045 0 : fun( w, &self->total_rewards, "total_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14046 0 : fun( w, &self->distributed_rewards, "distributed_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14047 0 : fun( w, &self->active, "active", FD_FLAMENCO_TYPE_BOOL, "bool", level );
14048 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_epoch_rewards", level-- );
14049 0 : }
14050 1845 : ulong fd_sysvar_epoch_rewards_size( fd_sysvar_epoch_rewards_t const * self ) {
14051 1845 : ulong size = 0;
14052 1845 : size += sizeof(ulong);
14053 1845 : size += sizeof(ulong);
14054 1845 : size += fd_hash_size( &self->parent_blockhash );
14055 1845 : size += sizeof(uint128);
14056 1845 : size += sizeof(ulong);
14057 1845 : size += sizeof(ulong);
14058 1845 : size += sizeof(char);
14059 1845 : return size;
14060 1845 : }
14061 :
14062 0 : int fd_config_keys_pair_decode( fd_config_keys_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
14063 0 : void const * data = ctx->data;
14064 0 : int err = fd_config_keys_pair_decode_preflight( ctx );
14065 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14066 0 : ctx->data = data;
14067 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
14068 0 : fd_config_keys_pair_new( self );
14069 0 : }
14070 0 : fd_config_keys_pair_decode_unsafe( self, ctx );
14071 0 : return FD_BINCODE_SUCCESS;
14072 0 : }
14073 0 : int fd_config_keys_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
14074 0 : int err;
14075 0 : err = fd_pubkey_decode_preflight( ctx );
14076 0 : if( FD_UNLIKELY( err ) ) return err;
14077 0 : err = fd_bincode_bool_decode_preflight( ctx );
14078 0 : if( FD_UNLIKELY( err ) ) return err;
14079 0 : return FD_BINCODE_SUCCESS;
14080 0 : }
14081 0 : void fd_config_keys_pair_decode_unsafe( fd_config_keys_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
14082 0 : fd_pubkey_decode_unsafe( &self->key, ctx );
14083 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
14084 0 : }
14085 0 : int fd_config_keys_pair_encode( fd_config_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14086 0 : int err;
14087 0 : err = fd_pubkey_encode( &self->key, ctx );
14088 0 : if( FD_UNLIKELY( err ) ) return err;
14089 0 : err = fd_bincode_bool_encode( (uchar)(self->signer), ctx );
14090 0 : if( FD_UNLIKELY( err ) ) return err;
14091 0 : return FD_BINCODE_SUCCESS;
14092 0 : }
14093 0 : int fd_config_keys_pair_decode_offsets( fd_config_keys_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
14094 0 : uchar const * data = ctx->data;
14095 0 : int err;
14096 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
14097 0 : err = fd_pubkey_decode_preflight( ctx );
14098 0 : if( FD_UNLIKELY( err ) ) return err;
14099 0 : self->signer_off = (uint)( (ulong)ctx->data - (ulong)data );
14100 0 : err = fd_bincode_bool_decode_preflight( ctx );
14101 0 : if( FD_UNLIKELY( err ) ) return err;
14102 0 : return FD_BINCODE_SUCCESS;
14103 0 : }
14104 0 : void fd_config_keys_pair_new(fd_config_keys_pair_t * self) {
14105 0 : fd_memset( self, 0, sizeof(fd_config_keys_pair_t) );
14106 0 : fd_pubkey_new( &self->key );
14107 0 : }
14108 0 : void fd_config_keys_pair_destroy( fd_config_keys_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
14109 0 : fd_pubkey_destroy( &self->key, ctx );
14110 0 : }
14111 :
14112 0 : ulong fd_config_keys_pair_footprint( void ){ return FD_CONFIG_KEYS_PAIR_FOOTPRINT; }
14113 0 : ulong fd_config_keys_pair_align( void ){ return FD_CONFIG_KEYS_PAIR_ALIGN; }
14114 :
14115 0 : void fd_config_keys_pair_walk( void * w, fd_config_keys_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14116 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys_pair", level++ );
14117 0 : fd_pubkey_walk( w, &self->key, fun, "key", level );
14118 0 : fun( w, &self->signer, "signer", FD_FLAMENCO_TYPE_BOOL, "bool", level );
14119 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys_pair", level-- );
14120 0 : }
14121 0 : ulong fd_config_keys_pair_size( fd_config_keys_pair_t const * self ) {
14122 0 : ulong size = 0;
14123 0 : size += fd_pubkey_size( &self->key );
14124 0 : size += sizeof(char);
14125 0 : return size;
14126 0 : }
14127 :
14128 0 : int fd_stake_config_decode( fd_stake_config_t * self, fd_bincode_decode_ctx_t * ctx ) {
14129 0 : void const * data = ctx->data;
14130 0 : int err = fd_stake_config_decode_preflight( ctx );
14131 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14132 0 : ctx->data = data;
14133 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
14134 0 : fd_stake_config_new( self );
14135 0 : }
14136 0 : fd_stake_config_decode_unsafe( self, ctx );
14137 0 : return FD_BINCODE_SUCCESS;
14138 0 : }
14139 0 : int fd_stake_config_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
14140 0 : int err;
14141 0 : ushort config_keys_len;
14142 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
14143 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14144 0 : if( config_keys_len ) {
14145 0 : for( ulong i=0; i < config_keys_len; i++ ) {
14146 0 : err = fd_config_keys_pair_decode_preflight( ctx );
14147 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14148 0 : }
14149 0 : }
14150 0 : err = fd_bincode_double_decode_preflight( ctx );
14151 0 : if( FD_UNLIKELY( err ) ) return err;
14152 0 : err = fd_bincode_uint8_decode_preflight( ctx );
14153 0 : if( FD_UNLIKELY( err ) ) return err;
14154 0 : return FD_BINCODE_SUCCESS;
14155 0 : }
14156 0 : void fd_stake_config_decode_unsafe( fd_stake_config_t * self, fd_bincode_decode_ctx_t * ctx ) {
14157 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
14158 0 : if( self->config_keys_len ) {
14159 0 : self->config_keys = (fd_config_keys_pair_t *)fd_valloc_malloc( ctx->valloc, FD_CONFIG_KEYS_PAIR_ALIGN, FD_CONFIG_KEYS_PAIR_FOOTPRINT*self->config_keys_len );
14160 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
14161 0 : fd_config_keys_pair_new( self->config_keys + i );
14162 0 : fd_config_keys_pair_decode_unsafe( self->config_keys + i, ctx );
14163 0 : }
14164 0 : } else
14165 0 : self->config_keys = NULL;
14166 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
14167 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
14168 0 : }
14169 12 : int fd_stake_config_encode( fd_stake_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14170 12 : int err;
14171 12 : err = fd_bincode_compact_u16_encode( &self->config_keys_len, ctx );
14172 12 : if( FD_UNLIKELY(err) ) return err;
14173 12 : if( self->config_keys_len ) {
14174 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
14175 0 : err = fd_config_keys_pair_encode( self->config_keys + i, ctx );
14176 0 : if( FD_UNLIKELY( err ) ) return err;
14177 0 : }
14178 0 : }
14179 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
14180 12 : if( FD_UNLIKELY( err ) ) return err;
14181 12 : err = fd_bincode_uint8_encode( (uchar)(self->slash_penalty), ctx );
14182 12 : if( FD_UNLIKELY( err ) ) return err;
14183 12 : return FD_BINCODE_SUCCESS;
14184 12 : }
14185 0 : int fd_stake_config_decode_offsets( fd_stake_config_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
14186 0 : uchar const * data = ctx->data;
14187 0 : int err;
14188 0 : self->config_keys_off = (uint)( (ulong)ctx->data - (ulong)data );
14189 0 : ushort config_keys_len;
14190 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
14191 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14192 0 : if( config_keys_len ) {
14193 0 : for( ulong i=0; i < config_keys_len; i++ ) {
14194 0 : err = fd_config_keys_pair_decode_preflight( ctx );
14195 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14196 0 : }
14197 0 : }
14198 0 : self->warmup_cooldown_rate_off = (uint)( (ulong)ctx->data - (ulong)data );
14199 0 : err = fd_bincode_double_decode_preflight( ctx );
14200 0 : if( FD_UNLIKELY( err ) ) return err;
14201 0 : self->slash_penalty_off = (uint)( (ulong)ctx->data - (ulong)data );
14202 0 : err = fd_bincode_uint8_decode_preflight( ctx );
14203 0 : if( FD_UNLIKELY( err ) ) return err;
14204 0 : return FD_BINCODE_SUCCESS;
14205 0 : }
14206 0 : void fd_stake_config_new(fd_stake_config_t * self) {
14207 0 : fd_memset( self, 0, sizeof(fd_stake_config_t) );
14208 0 : }
14209 0 : void fd_stake_config_destroy( fd_stake_config_t * self, fd_bincode_destroy_ctx_t * ctx ) {
14210 0 : if( self->config_keys ) {
14211 0 : for( ulong i=0; i < self->config_keys_len; i++ )
14212 0 : fd_config_keys_pair_destroy( self->config_keys + i, ctx );
14213 0 : fd_valloc_free( ctx->valloc, self->config_keys );
14214 0 : self->config_keys = NULL;
14215 0 : }
14216 0 : }
14217 :
14218 0 : ulong fd_stake_config_footprint( void ){ return FD_STAKE_CONFIG_FOOTPRINT; }
14219 0 : ulong fd_stake_config_align( void ){ return FD_STAKE_CONFIG_ALIGN; }
14220 :
14221 0 : void fd_stake_config_walk( void * w, fd_stake_config_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14222 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_config", level++ );
14223 0 : if( self->config_keys_len ) {
14224 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR, "array", level++ );
14225 0 : for( ulong i=0; i < self->config_keys_len; i++ )
14226 0 : fd_config_keys_pair_walk(w, self->config_keys + i, fun, "config_keys_pair", level );
14227 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
14228 0 : }
14229 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
14230 0 : fun( w, &self->slash_penalty, "slash_penalty", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
14231 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_config", level-- );
14232 0 : }
14233 0 : ulong fd_stake_config_size( fd_stake_config_t const * self ) {
14234 0 : ulong size = 0;
14235 0 : do {
14236 0 : ushort tmp = (ushort)self->config_keys_len;
14237 0 : size += fd_bincode_compact_u16_size( &tmp );
14238 0 : for( ulong i=0; i < self->config_keys_len; i++ )
14239 0 : size += fd_config_keys_pair_size( self->config_keys + i );
14240 0 : } while(0);
14241 0 : size += sizeof(double);
14242 0 : size += sizeof(char);
14243 0 : return size;
14244 0 : }
14245 :
14246 0 : int fd_feature_entry_decode( fd_feature_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
14247 0 : void const * data = ctx->data;
14248 0 : int err = fd_feature_entry_decode_preflight( ctx );
14249 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14250 0 : ctx->data = data;
14251 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
14252 0 : fd_feature_entry_new( self );
14253 0 : }
14254 0 : fd_feature_entry_decode_unsafe( self, ctx );
14255 0 : return FD_BINCODE_SUCCESS;
14256 0 : }
14257 0 : int fd_feature_entry_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
14258 0 : int err;
14259 0 : err = fd_pubkey_decode_preflight( ctx );
14260 0 : if( FD_UNLIKELY( err ) ) return err;
14261 0 : ulong description_len;
14262 0 : err = fd_bincode_uint64_decode( &description_len, ctx );
14263 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14264 0 : if( description_len ) {
14265 0 : err = fd_bincode_bytes_decode_preflight( description_len, ctx );
14266 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14267 0 : err = !fd_utf8_verify( (char const *) ctx->data - description_len, description_len );
14268 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14269 0 : }
14270 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14271 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14272 0 : return FD_BINCODE_SUCCESS;
14273 0 : }
14274 0 : void fd_feature_entry_decode_unsafe( fd_feature_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
14275 0 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
14276 0 : fd_bincode_uint64_decode_unsafe( &self->description_len, ctx );
14277 0 : if( self->description_len ) {
14278 0 : self->description = fd_valloc_malloc( ctx->valloc, 8UL, self->description_len );
14279 0 : fd_bincode_bytes_decode_unsafe( self->description, self->description_len, ctx );
14280 0 : } else
14281 0 : self->description = NULL;
14282 0 : fd_bincode_uint64_decode_unsafe( &self->since_slot, ctx );
14283 0 : }
14284 0 : int fd_feature_entry_encode( fd_feature_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14285 0 : int err;
14286 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
14287 0 : if( FD_UNLIKELY( err ) ) return err;
14288 0 : err = fd_bincode_uint64_encode( self->description_len, ctx );
14289 0 : if( FD_UNLIKELY(err) ) return err;
14290 0 : if( self->description_len ) {
14291 0 : err = fd_bincode_bytes_encode( self->description, self->description_len, ctx );
14292 0 : if( FD_UNLIKELY( err ) ) return err;
14293 0 : }
14294 0 : err = fd_bincode_uint64_encode( self->since_slot, ctx );
14295 0 : if( FD_UNLIKELY( err ) ) return err;
14296 0 : return FD_BINCODE_SUCCESS;
14297 0 : }
14298 0 : int fd_feature_entry_decode_offsets( fd_feature_entry_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
14299 0 : uchar const * data = ctx->data;
14300 0 : int err;
14301 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
14302 0 : err = fd_pubkey_decode_preflight( ctx );
14303 0 : if( FD_UNLIKELY( err ) ) return err;
14304 0 : self->description_off = (uint)( (ulong)ctx->data - (ulong)data );
14305 0 : ulong description_len;
14306 0 : err = fd_bincode_uint64_decode( &description_len, ctx );
14307 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14308 0 : if( description_len ) {
14309 0 : err = fd_bincode_bytes_decode_preflight( description_len, ctx );
14310 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14311 0 : err = !fd_utf8_verify( (char const *) ctx->data - description_len, description_len );
14312 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14313 0 : }
14314 0 : self->since_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
14315 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14316 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14317 0 : return FD_BINCODE_SUCCESS;
14318 0 : }
14319 0 : void fd_feature_entry_new(fd_feature_entry_t * self) {
14320 0 : fd_memset( self, 0, sizeof(fd_feature_entry_t) );
14321 0 : fd_pubkey_new( &self->pubkey );
14322 0 : }
14323 0 : void fd_feature_entry_destroy( fd_feature_entry_t * self, fd_bincode_destroy_ctx_t * ctx ) {
14324 0 : fd_pubkey_destroy( &self->pubkey, ctx );
14325 0 : if( self->description ) {
14326 0 : fd_valloc_free( ctx->valloc, self->description );
14327 0 : self->description = NULL;
14328 0 : }
14329 0 : }
14330 :
14331 0 : ulong fd_feature_entry_footprint( void ){ return FD_FEATURE_ENTRY_FOOTPRINT; }
14332 0 : ulong fd_feature_entry_align( void ){ return FD_FEATURE_ENTRY_ALIGN; }
14333 :
14334 0 : void fd_feature_entry_walk( void * w, fd_feature_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14335 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature_entry", level++ );
14336 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
14337 0 : fun(w, self->description, "description", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
14338 0 : fun( w, &self->since_slot, "since_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14339 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature_entry", level-- );
14340 0 : }
14341 0 : ulong fd_feature_entry_size( fd_feature_entry_t const * self ) {
14342 0 : ulong size = 0;
14343 0 : size += fd_pubkey_size( &self->pubkey );
14344 0 : do {
14345 0 : size += sizeof(ulong);
14346 0 : size += self->description_len;
14347 0 : } while(0);
14348 0 : size += sizeof(ulong);
14349 0 : return size;
14350 0 : }
14351 :
14352 0 : int fd_firedancer_bank_decode( fd_firedancer_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
14353 0 : void const * data = ctx->data;
14354 0 : int err = fd_firedancer_bank_decode_preflight( ctx );
14355 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14356 0 : ctx->data = data;
14357 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
14358 0 : fd_firedancer_bank_new( self );
14359 0 : }
14360 0 : fd_firedancer_bank_decode_unsafe( self, ctx );
14361 0 : return FD_BINCODE_SUCCESS;
14362 0 : }
14363 0 : int fd_firedancer_bank_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
14364 0 : int err;
14365 0 : err = fd_stakes_decode_preflight( ctx );
14366 0 : if( FD_UNLIKELY( err ) ) return err;
14367 0 : err = fd_recent_block_hashes_decode_preflight( ctx );
14368 0 : if( FD_UNLIKELY( err ) ) return err;
14369 0 : err = fd_clock_timestamp_votes_decode_preflight( ctx );
14370 0 : if( FD_UNLIKELY( err ) ) return err;
14371 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14372 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14373 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14374 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14375 0 : err = fd_hash_decode_preflight( ctx );
14376 0 : if( FD_UNLIKELY( err ) ) return err;
14377 0 : err = fd_hash_decode_preflight( ctx );
14378 0 : if( FD_UNLIKELY( err ) ) return err;
14379 0 : err = fd_fee_rate_governor_decode_preflight( ctx );
14380 0 : if( FD_UNLIKELY( err ) ) return err;
14381 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14382 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14383 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14384 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14385 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14386 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14387 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14388 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14389 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14390 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14391 0 : err = fd_bincode_uint128_decode_preflight( ctx );
14392 0 : if( FD_UNLIKELY( err ) ) return err;
14393 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14394 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14395 0 : err = fd_bincode_double_decode_preflight( ctx );
14396 0 : if( FD_UNLIKELY( err ) ) return err;
14397 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14398 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14399 0 : err = fd_inflation_decode_preflight( ctx );
14400 0 : if( FD_UNLIKELY( err ) ) return err;
14401 0 : err = fd_epoch_schedule_decode_preflight( ctx );
14402 0 : if( FD_UNLIKELY( err ) ) return err;
14403 0 : err = fd_rent_decode_preflight( ctx );
14404 0 : if( FD_UNLIKELY( err ) ) return err;
14405 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14406 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14407 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14408 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14409 0 : err = fd_vote_accounts_decode_preflight( ctx );
14410 0 : if( FD_UNLIKELY( err ) ) return err;
14411 0 : err = fd_sol_sysvar_last_restart_slot_decode_preflight( ctx );
14412 0 : if( FD_UNLIKELY( err ) ) return err;
14413 0 : return FD_BINCODE_SUCCESS;
14414 0 : }
14415 0 : void fd_firedancer_bank_decode_unsafe( fd_firedancer_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
14416 0 : fd_stakes_decode_unsafe( &self->stakes, ctx );
14417 0 : fd_recent_block_hashes_decode_unsafe( &self->recent_block_hashes, ctx );
14418 0 : fd_clock_timestamp_votes_decode_unsafe( &self->timestamp_votes, ctx );
14419 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
14420 0 : fd_bincode_uint64_decode_unsafe( &self->prev_slot, ctx );
14421 0 : fd_hash_decode_unsafe( &self->poh, ctx );
14422 0 : fd_hash_decode_unsafe( &self->banks_hash, ctx );
14423 0 : fd_fee_rate_governor_decode_unsafe( &self->fee_rate_governor, ctx );
14424 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
14425 0 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
14426 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
14427 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
14428 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
14429 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
14430 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
14431 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
14432 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
14433 0 : fd_inflation_decode_unsafe( &self->inflation, ctx );
14434 0 : fd_epoch_schedule_decode_unsafe( &self->epoch_schedule, ctx );
14435 0 : fd_rent_decode_unsafe( &self->rent, ctx );
14436 0 : fd_bincode_uint64_decode_unsafe( &self->collected_fees, ctx );
14437 0 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
14438 0 : fd_vote_accounts_decode_unsafe( &self->epoch_stakes, ctx );
14439 0 : fd_sol_sysvar_last_restart_slot_decode_unsafe( &self->last_restart_slot, ctx );
14440 0 : }
14441 0 : int fd_firedancer_bank_encode( fd_firedancer_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14442 0 : int err;
14443 0 : err = fd_stakes_encode( &self->stakes, ctx );
14444 0 : if( FD_UNLIKELY( err ) ) return err;
14445 0 : err = fd_recent_block_hashes_encode( &self->recent_block_hashes, ctx );
14446 0 : if( FD_UNLIKELY( err ) ) return err;
14447 0 : err = fd_clock_timestamp_votes_encode( &self->timestamp_votes, ctx );
14448 0 : if( FD_UNLIKELY( err ) ) return err;
14449 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
14450 0 : if( FD_UNLIKELY( err ) ) return err;
14451 0 : err = fd_bincode_uint64_encode( self->prev_slot, ctx );
14452 0 : if( FD_UNLIKELY( err ) ) return err;
14453 0 : err = fd_hash_encode( &self->poh, ctx );
14454 0 : if( FD_UNLIKELY( err ) ) return err;
14455 0 : err = fd_hash_encode( &self->banks_hash, ctx );
14456 0 : if( FD_UNLIKELY( err ) ) return err;
14457 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
14458 0 : if( FD_UNLIKELY( err ) ) return err;
14459 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
14460 0 : if( FD_UNLIKELY( err ) ) return err;
14461 0 : err = fd_bincode_uint64_encode( self->block_height, ctx );
14462 0 : if( FD_UNLIKELY( err ) ) return err;
14463 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
14464 0 : if( FD_UNLIKELY( err ) ) return err;
14465 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
14466 0 : if( FD_UNLIKELY( err ) ) return err;
14467 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
14468 0 : if( FD_UNLIKELY( err ) ) return err;
14469 0 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
14470 0 : if( FD_UNLIKELY( err ) ) return err;
14471 0 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
14472 0 : if( FD_UNLIKELY( err ) ) return err;
14473 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
14474 0 : if( FD_UNLIKELY( err ) ) return err;
14475 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
14476 0 : if( FD_UNLIKELY( err ) ) return err;
14477 0 : err = fd_inflation_encode( &self->inflation, ctx );
14478 0 : if( FD_UNLIKELY( err ) ) return err;
14479 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
14480 0 : if( FD_UNLIKELY( err ) ) return err;
14481 0 : err = fd_rent_encode( &self->rent, ctx );
14482 0 : if( FD_UNLIKELY( err ) ) return err;
14483 0 : err = fd_bincode_uint64_encode( self->collected_fees, ctx );
14484 0 : if( FD_UNLIKELY( err ) ) return err;
14485 0 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
14486 0 : if( FD_UNLIKELY( err ) ) return err;
14487 0 : err = fd_vote_accounts_encode( &self->epoch_stakes, ctx );
14488 0 : if( FD_UNLIKELY( err ) ) return err;
14489 0 : err = fd_sol_sysvar_last_restart_slot_encode( &self->last_restart_slot, ctx );
14490 0 : if( FD_UNLIKELY( err ) ) return err;
14491 0 : return FD_BINCODE_SUCCESS;
14492 0 : }
14493 0 : int fd_firedancer_bank_decode_offsets( fd_firedancer_bank_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
14494 0 : uchar const * data = ctx->data;
14495 0 : int err;
14496 0 : self->stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
14497 0 : err = fd_stakes_decode_preflight( ctx );
14498 0 : if( FD_UNLIKELY( err ) ) return err;
14499 0 : self->recent_block_hashes_off = (uint)( (ulong)ctx->data - (ulong)data );
14500 0 : err = fd_recent_block_hashes_decode_preflight( ctx );
14501 0 : if( FD_UNLIKELY( err ) ) return err;
14502 0 : self->timestamp_votes_off = (uint)( (ulong)ctx->data - (ulong)data );
14503 0 : err = fd_clock_timestamp_votes_decode_preflight( ctx );
14504 0 : if( FD_UNLIKELY( err ) ) return err;
14505 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
14506 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14507 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14508 0 : self->prev_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
14509 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14510 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14511 0 : self->poh_off = (uint)( (ulong)ctx->data - (ulong)data );
14512 0 : err = fd_hash_decode_preflight( ctx );
14513 0 : if( FD_UNLIKELY( err ) ) return err;
14514 0 : self->banks_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
14515 0 : err = fd_hash_decode_preflight( ctx );
14516 0 : if( FD_UNLIKELY( err ) ) return err;
14517 0 : self->fee_rate_governor_off = (uint)( (ulong)ctx->data - (ulong)data );
14518 0 : err = fd_fee_rate_governor_decode_preflight( ctx );
14519 0 : if( FD_UNLIKELY( err ) ) return err;
14520 0 : self->capitalization_off = (uint)( (ulong)ctx->data - (ulong)data );
14521 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14522 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14523 0 : self->block_height_off = (uint)( (ulong)ctx->data - (ulong)data );
14524 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14525 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14526 0 : self->lamports_per_signature_off = (uint)( (ulong)ctx->data - (ulong)data );
14527 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14528 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14529 0 : self->hashes_per_tick_off = (uint)( (ulong)ctx->data - (ulong)data );
14530 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14531 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14532 0 : self->ticks_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
14533 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14534 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14535 0 : self->ns_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
14536 0 : err = fd_bincode_uint128_decode_preflight( ctx );
14537 0 : if( FD_UNLIKELY( err ) ) return err;
14538 0 : self->genesis_creation_time_off = (uint)( (ulong)ctx->data - (ulong)data );
14539 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14540 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14541 0 : self->slots_per_year_off = (uint)( (ulong)ctx->data - (ulong)data );
14542 0 : err = fd_bincode_double_decode_preflight( ctx );
14543 0 : if( FD_UNLIKELY( err ) ) return err;
14544 0 : self->max_tick_height_off = (uint)( (ulong)ctx->data - (ulong)data );
14545 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14546 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14547 0 : self->inflation_off = (uint)( (ulong)ctx->data - (ulong)data );
14548 0 : err = fd_inflation_decode_preflight( ctx );
14549 0 : if( FD_UNLIKELY( err ) ) return err;
14550 0 : self->epoch_schedule_off = (uint)( (ulong)ctx->data - (ulong)data );
14551 0 : err = fd_epoch_schedule_decode_preflight( ctx );
14552 0 : if( FD_UNLIKELY( err ) ) return err;
14553 0 : self->rent_off = (uint)( (ulong)ctx->data - (ulong)data );
14554 0 : err = fd_rent_decode_preflight( ctx );
14555 0 : if( FD_UNLIKELY( err ) ) return err;
14556 0 : self->collected_fees_off = (uint)( (ulong)ctx->data - (ulong)data );
14557 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14558 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14559 0 : self->collected_rent_off = (uint)( (ulong)ctx->data - (ulong)data );
14560 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14561 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14562 0 : self->epoch_stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
14563 0 : err = fd_vote_accounts_decode_preflight( ctx );
14564 0 : if( FD_UNLIKELY( err ) ) return err;
14565 0 : self->last_restart_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
14566 0 : err = fd_sol_sysvar_last_restart_slot_decode_preflight( ctx );
14567 0 : if( FD_UNLIKELY( err ) ) return err;
14568 0 : return FD_BINCODE_SUCCESS;
14569 0 : }
14570 0 : void fd_firedancer_bank_new(fd_firedancer_bank_t * self) {
14571 0 : fd_memset( self, 0, sizeof(fd_firedancer_bank_t) );
14572 0 : fd_stakes_new( &self->stakes );
14573 0 : fd_recent_block_hashes_new( &self->recent_block_hashes );
14574 0 : fd_clock_timestamp_votes_new( &self->timestamp_votes );
14575 0 : fd_hash_new( &self->poh );
14576 0 : fd_hash_new( &self->banks_hash );
14577 0 : fd_fee_rate_governor_new( &self->fee_rate_governor );
14578 0 : fd_inflation_new( &self->inflation );
14579 0 : fd_epoch_schedule_new( &self->epoch_schedule );
14580 0 : fd_rent_new( &self->rent );
14581 0 : fd_vote_accounts_new( &self->epoch_stakes );
14582 0 : fd_sol_sysvar_last_restart_slot_new( &self->last_restart_slot );
14583 0 : }
14584 0 : void fd_firedancer_bank_destroy( fd_firedancer_bank_t * self, fd_bincode_destroy_ctx_t * ctx ) {
14585 0 : fd_stakes_destroy( &self->stakes, ctx );
14586 0 : fd_recent_block_hashes_destroy( &self->recent_block_hashes, ctx );
14587 0 : fd_clock_timestamp_votes_destroy( &self->timestamp_votes, ctx );
14588 0 : fd_hash_destroy( &self->poh, ctx );
14589 0 : fd_hash_destroy( &self->banks_hash, ctx );
14590 0 : fd_fee_rate_governor_destroy( &self->fee_rate_governor, ctx );
14591 0 : fd_inflation_destroy( &self->inflation, ctx );
14592 0 : fd_epoch_schedule_destroy( &self->epoch_schedule, ctx );
14593 0 : fd_rent_destroy( &self->rent, ctx );
14594 0 : fd_vote_accounts_destroy( &self->epoch_stakes, ctx );
14595 0 : fd_sol_sysvar_last_restart_slot_destroy( &self->last_restart_slot, ctx );
14596 0 : }
14597 :
14598 0 : ulong fd_firedancer_bank_footprint( void ){ return FD_FIREDANCER_BANK_FOOTPRINT; }
14599 0 : ulong fd_firedancer_bank_align( void ){ return FD_FIREDANCER_BANK_ALIGN; }
14600 :
14601 0 : void fd_firedancer_bank_walk( void * w, fd_firedancer_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14602 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_firedancer_bank", level++ );
14603 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level );
14604 0 : fd_recent_block_hashes_walk( w, &self->recent_block_hashes, fun, "recent_block_hashes", level );
14605 0 : fd_clock_timestamp_votes_walk( w, &self->timestamp_votes, fun, "timestamp_votes", level );
14606 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14607 0 : fun( w, &self->prev_slot, "prev_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14608 0 : fd_hash_walk( w, &self->poh, fun, "poh", level );
14609 0 : fd_hash_walk( w, &self->banks_hash, fun, "banks_hash", level );
14610 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level );
14611 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14612 0 : fun( w, &self->block_height, "block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14613 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14614 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14615 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14616 0 : fun( w, &self->ns_per_slot, "ns_per_slot", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
14617 0 : fun( w, &self->genesis_creation_time, "genesis_creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14618 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
14619 0 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14620 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level );
14621 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
14622 0 : fd_rent_walk( w, &self->rent, fun, "rent", level );
14623 0 : fun( w, &self->collected_fees, "collected_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14624 0 : fun( w, &self->collected_rent, "collected_rent", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
14625 0 : fd_vote_accounts_walk( w, &self->epoch_stakes, fun, "epoch_stakes", level );
14626 0 : fd_sol_sysvar_last_restart_slot_walk( w, &self->last_restart_slot, fun, "last_restart_slot", level );
14627 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_firedancer_bank", level-- );
14628 0 : }
14629 0 : ulong fd_firedancer_bank_size( fd_firedancer_bank_t const * self ) {
14630 0 : ulong size = 0;
14631 0 : size += fd_stakes_size( &self->stakes );
14632 0 : size += fd_recent_block_hashes_size( &self->recent_block_hashes );
14633 0 : size += fd_clock_timestamp_votes_size( &self->timestamp_votes );
14634 0 : size += sizeof(ulong);
14635 0 : size += sizeof(ulong);
14636 0 : size += fd_hash_size( &self->poh );
14637 0 : size += fd_hash_size( &self->banks_hash );
14638 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
14639 0 : size += sizeof(ulong);
14640 0 : size += sizeof(ulong);
14641 0 : size += sizeof(ulong);
14642 0 : size += sizeof(ulong);
14643 0 : size += sizeof(ulong);
14644 0 : size += sizeof(uint128);
14645 0 : size += sizeof(ulong);
14646 0 : size += sizeof(double);
14647 0 : size += sizeof(ulong);
14648 0 : size += fd_inflation_size( &self->inflation );
14649 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
14650 0 : size += fd_rent_size( &self->rent );
14651 0 : size += sizeof(ulong);
14652 0 : size += sizeof(ulong);
14653 0 : size += fd_vote_accounts_size( &self->epoch_stakes );
14654 0 : size += fd_sol_sysvar_last_restart_slot_size( &self->last_restart_slot );
14655 0 : return size;
14656 0 : }
14657 :
14658 0 : FD_FN_PURE uchar fd_cluster_type_is_Testnet(fd_cluster_type_t const * self) {
14659 0 : return self->discriminant == 0;
14660 0 : }
14661 0 : FD_FN_PURE uchar fd_cluster_type_is_MainnetBeta(fd_cluster_type_t const * self) {
14662 0 : return self->discriminant == 1;
14663 0 : }
14664 0 : FD_FN_PURE uchar fd_cluster_type_is_Devnet(fd_cluster_type_t const * self) {
14665 0 : return self->discriminant == 2;
14666 0 : }
14667 0 : FD_FN_PURE uchar fd_cluster_type_is_Development(fd_cluster_type_t const * self) {
14668 0 : return self->discriminant == 3;
14669 0 : }
14670 : void fd_cluster_type_inner_new( fd_cluster_type_inner_t * self, uint discriminant );
14671 0 : int fd_cluster_type_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
14672 0 : int err;
14673 0 : switch (discriminant) {
14674 0 : case 0: {
14675 0 : return FD_BINCODE_SUCCESS;
14676 0 : }
14677 0 : case 1: {
14678 0 : return FD_BINCODE_SUCCESS;
14679 0 : }
14680 0 : case 2: {
14681 0 : return FD_BINCODE_SUCCESS;
14682 0 : }
14683 0 : case 3: {
14684 0 : return FD_BINCODE_SUCCESS;
14685 0 : }
14686 0 : default: return FD_BINCODE_ERR_ENCODING;
14687 0 : }
14688 0 : }
14689 0 : void fd_cluster_type_inner_decode_unsafe( fd_cluster_type_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
14690 0 : switch (discriminant) {
14691 0 : case 0: {
14692 0 : break;
14693 0 : }
14694 0 : case 1: {
14695 0 : break;
14696 0 : }
14697 0 : case 2: {
14698 0 : break;
14699 0 : }
14700 0 : case 3: {
14701 0 : break;
14702 0 : }
14703 0 : }
14704 0 : }
14705 0 : int fd_cluster_type_decode( fd_cluster_type_t * self, fd_bincode_decode_ctx_t * ctx ) {
14706 0 : void const * data = ctx->data;
14707 0 : int err = fd_cluster_type_decode_preflight( ctx );
14708 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14709 0 : ctx->data = data;
14710 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
14711 0 : fd_cluster_type_new( self );
14712 0 : }
14713 0 : fd_cluster_type_decode_unsafe( self, ctx );
14714 0 : return FD_BINCODE_SUCCESS;
14715 0 : }
14716 0 : int fd_cluster_type_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
14717 0 : uint discriminant = 0;
14718 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
14719 0 : if( FD_UNLIKELY( err ) ) return err;
14720 0 : return fd_cluster_type_inner_decode_preflight( discriminant, ctx );
14721 0 : }
14722 0 : void fd_cluster_type_decode_unsafe( fd_cluster_type_t * self, fd_bincode_decode_ctx_t * ctx ) {
14723 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
14724 0 : fd_cluster_type_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
14725 0 : }
14726 0 : void fd_cluster_type_inner_new( fd_cluster_type_inner_t * self, uint discriminant ) {
14727 0 : switch( discriminant ) {
14728 0 : case 0: {
14729 0 : break;
14730 0 : }
14731 0 : case 1: {
14732 0 : break;
14733 0 : }
14734 0 : case 2: {
14735 0 : break;
14736 0 : }
14737 0 : case 3: {
14738 0 : break;
14739 0 : }
14740 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
14741 0 : }
14742 0 : }
14743 0 : void fd_cluster_type_new_disc( fd_cluster_type_t * self, uint discriminant ) {
14744 0 : self->discriminant = discriminant;
14745 0 : fd_cluster_type_inner_new( &self->inner, self->discriminant );
14746 0 : }
14747 0 : void fd_cluster_type_new( fd_cluster_type_t * self ) {
14748 0 : fd_memset( self, 0, sizeof(fd_cluster_type_t) );
14749 0 : fd_cluster_type_new_disc( self, UINT_MAX );
14750 0 : }
14751 0 : void fd_cluster_type_inner_destroy( fd_cluster_type_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
14752 0 : switch( discriminant ) {
14753 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
14754 0 : }
14755 0 : }
14756 0 : void fd_cluster_type_destroy( fd_cluster_type_t * self, fd_bincode_destroy_ctx_t * ctx ) {
14757 0 : fd_cluster_type_inner_destroy( &self->inner, self->discriminant, ctx );
14758 0 : }
14759 :
14760 0 : ulong fd_cluster_type_footprint( void ){ return FD_CLUSTER_TYPE_FOOTPRINT; }
14761 0 : ulong fd_cluster_type_align( void ){ return FD_CLUSTER_TYPE_ALIGN; }
14762 :
14763 0 : void fd_cluster_type_walk( void * w, fd_cluster_type_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
14764 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_cluster_type", level++);
14765 0 : switch( self->discriminant ) {
14766 0 : case 0: {
14767 0 : fun( w, self, "Testnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
14768 0 : break;
14769 0 : }
14770 0 : case 1: {
14771 0 : fun( w, self, "MainnetBeta", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
14772 0 : break;
14773 0 : }
14774 0 : case 2: {
14775 0 : fun( w, self, "Devnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
14776 0 : break;
14777 0 : }
14778 0 : case 3: {
14779 0 : fun( w, self, "Development", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
14780 0 : break;
14781 0 : }
14782 0 : }
14783 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_cluster_type", level-- );
14784 0 : }
14785 0 : ulong fd_cluster_type_size( fd_cluster_type_t const * self ) {
14786 0 : ulong size = 0;
14787 0 : size += sizeof(uint);
14788 0 : switch (self->discriminant) {
14789 0 : }
14790 0 : return size;
14791 0 : }
14792 :
14793 0 : int fd_cluster_type_inner_encode( fd_cluster_type_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
14794 0 : return FD_BINCODE_SUCCESS;
14795 0 : }
14796 0 : int fd_cluster_type_encode( fd_cluster_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14797 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
14798 0 : if( FD_UNLIKELY( err ) ) return err;
14799 0 : return fd_cluster_type_inner_encode( &self->inner, self->discriminant, ctx );
14800 0 : }
14801 :
14802 0 : int fd_epoch_bank_decode( fd_epoch_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
14803 0 : void const * data = ctx->data;
14804 0 : int err = fd_epoch_bank_decode_preflight( ctx );
14805 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14806 0 : ctx->data = data;
14807 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
14808 0 : fd_epoch_bank_new( self );
14809 0 : }
14810 0 : fd_epoch_bank_decode_unsafe( self, ctx );
14811 0 : return FD_BINCODE_SUCCESS;
14812 0 : }
14813 0 : int fd_epoch_bank_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
14814 0 : int err;
14815 0 : err = fd_stakes_decode_preflight( ctx );
14816 0 : if( FD_UNLIKELY( err ) ) return err;
14817 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14818 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14819 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14820 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14821 0 : err = fd_bincode_uint128_decode_preflight( ctx );
14822 0 : if( FD_UNLIKELY( err ) ) return err;
14823 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14824 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14825 0 : err = fd_bincode_double_decode_preflight( ctx );
14826 0 : if( FD_UNLIKELY( err ) ) return err;
14827 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14828 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14829 0 : err = fd_inflation_decode_preflight( ctx );
14830 0 : if( FD_UNLIKELY( err ) ) return err;
14831 0 : err = fd_epoch_schedule_decode_preflight( ctx );
14832 0 : if( FD_UNLIKELY( err ) ) return err;
14833 0 : err = fd_rent_decode_preflight( ctx );
14834 0 : if( FD_UNLIKELY( err ) ) return err;
14835 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14836 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14837 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14838 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14839 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14840 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14841 0 : err = fd_hash_decode_preflight( ctx );
14842 0 : if( FD_UNLIKELY( err ) ) return err;
14843 0 : err = fd_bincode_uint32_decode_preflight( ctx );
14844 0 : if( FD_UNLIKELY( err ) ) return err;
14845 0 : for( ulong i=0; i<3; i++ ) {
14846 0 : err = fd_bincode_uint32_decode_preflight( ctx );
14847 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14848 0 : }
14849 0 : err = fd_vote_accounts_decode_preflight( ctx );
14850 0 : if( FD_UNLIKELY( err ) ) return err;
14851 0 : err = fd_epoch_schedule_decode_preflight( ctx );
14852 0 : if( FD_UNLIKELY( err ) ) return err;
14853 0 : return FD_BINCODE_SUCCESS;
14854 0 : }
14855 0 : void fd_epoch_bank_decode_unsafe( fd_epoch_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
14856 0 : fd_stakes_decode_unsafe( &self->stakes, ctx );
14857 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
14858 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
14859 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
14860 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
14861 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
14862 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
14863 0 : fd_inflation_decode_unsafe( &self->inflation, ctx );
14864 0 : fd_epoch_schedule_decode_unsafe( &self->epoch_schedule, ctx );
14865 0 : fd_rent_decode_unsafe( &self->rent, ctx );
14866 0 : fd_bincode_uint64_decode_unsafe( &self->eah_start_slot, ctx );
14867 0 : fd_bincode_uint64_decode_unsafe( &self->eah_stop_slot, ctx );
14868 0 : fd_bincode_uint64_decode_unsafe( &self->eah_interval, ctx );
14869 0 : fd_hash_decode_unsafe( &self->genesis_hash, ctx );
14870 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
14871 0 : for( ulong i=0; i<3; i++ ) {
14872 0 : fd_bincode_uint32_decode_unsafe( self->cluster_version + i, ctx );
14873 0 : }
14874 0 : fd_vote_accounts_decode_unsafe( &self->next_epoch_stakes, ctx );
14875 0 : fd_epoch_schedule_decode_unsafe( &self->rent_epoch_schedule, ctx );
14876 0 : }
14877 0 : int fd_epoch_bank_encode( fd_epoch_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14878 0 : int err;
14879 0 : err = fd_stakes_encode( &self->stakes, ctx );
14880 0 : if( FD_UNLIKELY( err ) ) return err;
14881 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
14882 0 : if( FD_UNLIKELY( err ) ) return err;
14883 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
14884 0 : if( FD_UNLIKELY( err ) ) return err;
14885 0 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
14886 0 : if( FD_UNLIKELY( err ) ) return err;
14887 0 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
14888 0 : if( FD_UNLIKELY( err ) ) return err;
14889 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
14890 0 : if( FD_UNLIKELY( err ) ) return err;
14891 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
14892 0 : if( FD_UNLIKELY( err ) ) return err;
14893 0 : err = fd_inflation_encode( &self->inflation, ctx );
14894 0 : if( FD_UNLIKELY( err ) ) return err;
14895 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
14896 0 : if( FD_UNLIKELY( err ) ) return err;
14897 0 : err = fd_rent_encode( &self->rent, ctx );
14898 0 : if( FD_UNLIKELY( err ) ) return err;
14899 0 : err = fd_bincode_uint64_encode( self->eah_start_slot, ctx );
14900 0 : if( FD_UNLIKELY( err ) ) return err;
14901 0 : err = fd_bincode_uint64_encode( self->eah_stop_slot, ctx );
14902 0 : if( FD_UNLIKELY( err ) ) return err;
14903 0 : err = fd_bincode_uint64_encode( self->eah_interval, ctx );
14904 0 : if( FD_UNLIKELY( err ) ) return err;
14905 0 : err = fd_hash_encode( &self->genesis_hash, ctx );
14906 0 : if( FD_UNLIKELY( err ) ) return err;
14907 0 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
14908 0 : if( FD_UNLIKELY( err ) ) return err;
14909 0 : for( ulong i=0; i<3; i++ ) {
14910 0 : err = fd_bincode_uint32_encode( self->cluster_version[i], ctx );
14911 0 : if( FD_UNLIKELY( err ) ) return err;
14912 0 : }
14913 0 : err = fd_vote_accounts_encode( &self->next_epoch_stakes, ctx );
14914 0 : if( FD_UNLIKELY( err ) ) return err;
14915 0 : err = fd_epoch_schedule_encode( &self->rent_epoch_schedule, ctx );
14916 0 : if( FD_UNLIKELY( err ) ) return err;
14917 0 : return FD_BINCODE_SUCCESS;
14918 0 : }
14919 : enum {
14920 : fd_epoch_bank_stakes_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
14921 : fd_epoch_bank_hashes_per_tick_TAG = (1 << 6) | FD_ARCHIVE_META_ULONG,
14922 : fd_epoch_bank_ticks_per_slot_TAG = (2 << 6) | FD_ARCHIVE_META_ULONG,
14923 : fd_epoch_bank_ns_per_slot_TAG = (3 << 6) | FD_ARCHIVE_META_UINT128,
14924 : fd_epoch_bank_genesis_creation_time_TAG = (4 << 6) | FD_ARCHIVE_META_ULONG,
14925 : fd_epoch_bank_slots_per_year_TAG = (5 << 6) | FD_ARCHIVE_META_DOUBLE,
14926 : fd_epoch_bank_max_tick_height_TAG = (6 << 6) | FD_ARCHIVE_META_ULONG,
14927 : fd_epoch_bank_inflation_TAG = (7 << 6) | FD_ARCHIVE_META_STRUCT,
14928 : fd_epoch_bank_epoch_schedule_TAG = (8 << 6) | FD_ARCHIVE_META_STRUCT,
14929 : fd_epoch_bank_rent_TAG = (9 << 6) | FD_ARCHIVE_META_STRUCT,
14930 : fd_epoch_bank_eah_start_slot_TAG = (10 << 6) | FD_ARCHIVE_META_ULONG,
14931 : fd_epoch_bank_eah_stop_slot_TAG = (11 << 6) | FD_ARCHIVE_META_ULONG,
14932 : fd_epoch_bank_eah_interval_TAG = (12 << 6) | FD_ARCHIVE_META_ULONG,
14933 : fd_epoch_bank_genesis_hash_TAG = (13 << 6) | FD_ARCHIVE_META_STRUCT,
14934 : fd_epoch_bank_cluster_type_TAG = (14 << 6) | FD_ARCHIVE_META_UINT,
14935 : fd_epoch_bank_cluster_version_TAG = (15 << 6) | FD_ARCHIVE_META_ARRAY,
14936 : fd_epoch_bank_next_epoch_stakes_TAG = (16 << 6) | FD_ARCHIVE_META_STRUCT,
14937 : fd_epoch_bank_rent_epoch_schedule_TAG = (17 << 6) | FD_ARCHIVE_META_STRUCT,
14938 : };
14939 0 : int fd_epoch_bank_decode_archival( fd_epoch_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
14940 0 : void const * data = ctx->data;
14941 0 : int err = fd_epoch_bank_decode_archival_preflight( ctx );
14942 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14943 0 : ctx->data = data;
14944 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
14945 0 : fd_epoch_bank_new( self );
14946 0 : }
14947 0 : fd_epoch_bank_decode_archival_unsafe( self, ctx );
14948 0 : return FD_BINCODE_SUCCESS;
14949 0 : }
14950 0 : int fd_epoch_bank_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
14951 0 : int err;
14952 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
14953 0 : void * offset = NULL;
14954 0 : for(;;) {
14955 0 : err = fd_bincode_uint16_decode( &tag, ctx );
14956 0 : if( FD_UNLIKELY( err ) ) return err;
14957 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
14958 0 : switch( tag ) {
14959 0 : case (ushort)fd_epoch_bank_stakes_TAG: {
14960 0 : err = fd_archive_decode_setup_length( ctx, &offset );
14961 0 : if( FD_UNLIKELY( err ) ) return err;
14962 0 : err = fd_stakes_decode_archival_preflight( ctx );
14963 0 : if( FD_UNLIKELY( err ) ) return err;
14964 0 : err = fd_archive_decode_check_length( ctx, offset );
14965 0 : if( FD_UNLIKELY( err ) ) return err;
14966 0 : break;
14967 0 : }
14968 0 : case (ushort)fd_epoch_bank_hashes_per_tick_TAG: {
14969 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14970 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14971 0 : break;
14972 0 : }
14973 0 : case (ushort)fd_epoch_bank_ticks_per_slot_TAG: {
14974 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14975 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14976 0 : break;
14977 0 : }
14978 0 : case (ushort)fd_epoch_bank_ns_per_slot_TAG: {
14979 0 : err = fd_bincode_uint128_decode_preflight( ctx );
14980 0 : if( FD_UNLIKELY( err ) ) return err;
14981 0 : break;
14982 0 : }
14983 0 : case (ushort)fd_epoch_bank_genesis_creation_time_TAG: {
14984 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14985 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14986 0 : break;
14987 0 : }
14988 0 : case (ushort)fd_epoch_bank_slots_per_year_TAG: {
14989 0 : err = fd_bincode_double_decode_preflight( ctx );
14990 0 : if( FD_UNLIKELY( err ) ) return err;
14991 0 : break;
14992 0 : }
14993 0 : case (ushort)fd_epoch_bank_max_tick_height_TAG: {
14994 0 : err = fd_bincode_uint64_decode_preflight( ctx );
14995 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14996 0 : break;
14997 0 : }
14998 0 : case (ushort)fd_epoch_bank_inflation_TAG: {
14999 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15000 0 : if( FD_UNLIKELY( err ) ) return err;
15001 0 : err = fd_inflation_decode_archival_preflight( ctx );
15002 0 : if( FD_UNLIKELY( err ) ) return err;
15003 0 : err = fd_archive_decode_check_length( ctx, offset );
15004 0 : if( FD_UNLIKELY( err ) ) return err;
15005 0 : break;
15006 0 : }
15007 0 : case (ushort)fd_epoch_bank_epoch_schedule_TAG: {
15008 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15009 0 : if( FD_UNLIKELY( err ) ) return err;
15010 0 : err = fd_epoch_schedule_decode_archival_preflight( ctx );
15011 0 : if( FD_UNLIKELY( err ) ) return err;
15012 0 : err = fd_archive_decode_check_length( ctx, offset );
15013 0 : if( FD_UNLIKELY( err ) ) return err;
15014 0 : break;
15015 0 : }
15016 0 : case (ushort)fd_epoch_bank_rent_TAG: {
15017 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15018 0 : if( FD_UNLIKELY( err ) ) return err;
15019 0 : err = fd_rent_decode_archival_preflight( ctx );
15020 0 : if( FD_UNLIKELY( err ) ) return err;
15021 0 : err = fd_archive_decode_check_length( ctx, offset );
15022 0 : if( FD_UNLIKELY( err ) ) return err;
15023 0 : break;
15024 0 : }
15025 0 : case (ushort)fd_epoch_bank_eah_start_slot_TAG: {
15026 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15027 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15028 0 : break;
15029 0 : }
15030 0 : case (ushort)fd_epoch_bank_eah_stop_slot_TAG: {
15031 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15032 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15033 0 : break;
15034 0 : }
15035 0 : case (ushort)fd_epoch_bank_eah_interval_TAG: {
15036 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15037 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15038 0 : break;
15039 0 : }
15040 0 : case (ushort)fd_epoch_bank_genesis_hash_TAG: {
15041 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15042 0 : if( FD_UNLIKELY( err ) ) return err;
15043 0 : err = fd_hash_decode_archival_preflight( ctx );
15044 0 : if( FD_UNLIKELY( err ) ) return err;
15045 0 : err = fd_archive_decode_check_length( ctx, offset );
15046 0 : if( FD_UNLIKELY( err ) ) return err;
15047 0 : break;
15048 0 : }
15049 0 : case (ushort)fd_epoch_bank_cluster_type_TAG: {
15050 0 : err = fd_bincode_uint32_decode_preflight( ctx );
15051 0 : if( FD_UNLIKELY( err ) ) return err;
15052 0 : break;
15053 0 : }
15054 0 : case (ushort)fd_epoch_bank_cluster_version_TAG: {
15055 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15056 0 : if( FD_UNLIKELY( err ) ) return err;
15057 0 : for( ulong i=0; i<3; i++ ) {
15058 0 : err = fd_bincode_uint32_decode_preflight( ctx );
15059 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15060 0 : }
15061 0 : err = fd_archive_decode_check_length( ctx, offset );
15062 0 : if( FD_UNLIKELY( err ) ) return err;
15063 0 : break;
15064 0 : }
15065 0 : case (ushort)fd_epoch_bank_next_epoch_stakes_TAG: {
15066 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15067 0 : if( FD_UNLIKELY( err ) ) return err;
15068 0 : err = fd_vote_accounts_decode_archival_preflight( ctx );
15069 0 : if( FD_UNLIKELY( err ) ) return err;
15070 0 : err = fd_archive_decode_check_length( ctx, offset );
15071 0 : if( FD_UNLIKELY( err ) ) return err;
15072 0 : break;
15073 0 : }
15074 0 : case (ushort)fd_epoch_bank_rent_epoch_schedule_TAG: {
15075 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15076 0 : if( FD_UNLIKELY( err ) ) return err;
15077 0 : err = fd_epoch_schedule_decode_archival_preflight( ctx );
15078 0 : if( FD_UNLIKELY( err ) ) return err;
15079 0 : err = fd_archive_decode_check_length( ctx, offset );
15080 0 : if( FD_UNLIKELY( err ) ) return err;
15081 0 : break;
15082 0 : }
15083 0 : default:
15084 0 : err = fd_archive_decode_skip_field( ctx, tag );
15085 0 : if( FD_UNLIKELY( err ) ) return err;
15086 0 : break;
15087 0 : }
15088 0 : }
15089 0 : return FD_BINCODE_SUCCESS;
15090 0 : }
15091 0 : void fd_epoch_bank_decode_archival_unsafe( fd_epoch_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
15092 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
15093 0 : void * offset = NULL;
15094 0 : for(;;) {
15095 0 : fd_bincode_uint16_decode( &tag, ctx );
15096 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
15097 0 : switch( tag ) {
15098 0 : case (ushort)fd_epoch_bank_stakes_TAG: {
15099 0 : fd_archive_decode_setup_length( ctx, &offset );
15100 0 : fd_stakes_decode_archival_unsafe( &self->stakes, ctx );
15101 0 : break;
15102 0 : }
15103 0 : case (ushort)fd_epoch_bank_hashes_per_tick_TAG: {
15104 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
15105 0 : break;
15106 0 : }
15107 0 : case (ushort)fd_epoch_bank_ticks_per_slot_TAG: {
15108 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
15109 0 : break;
15110 0 : }
15111 0 : case (ushort)fd_epoch_bank_ns_per_slot_TAG: {
15112 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
15113 0 : break;
15114 0 : }
15115 0 : case (ushort)fd_epoch_bank_genesis_creation_time_TAG: {
15116 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
15117 0 : break;
15118 0 : }
15119 0 : case (ushort)fd_epoch_bank_slots_per_year_TAG: {
15120 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
15121 0 : break;
15122 0 : }
15123 0 : case (ushort)fd_epoch_bank_max_tick_height_TAG: {
15124 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
15125 0 : break;
15126 0 : }
15127 0 : case (ushort)fd_epoch_bank_inflation_TAG: {
15128 0 : fd_archive_decode_setup_length( ctx, &offset );
15129 0 : fd_inflation_decode_archival_unsafe( &self->inflation, ctx );
15130 0 : break;
15131 0 : }
15132 0 : case (ushort)fd_epoch_bank_epoch_schedule_TAG: {
15133 0 : fd_archive_decode_setup_length( ctx, &offset );
15134 0 : fd_epoch_schedule_decode_archival_unsafe( &self->epoch_schedule, ctx );
15135 0 : break;
15136 0 : }
15137 0 : case (ushort)fd_epoch_bank_rent_TAG: {
15138 0 : fd_archive_decode_setup_length( ctx, &offset );
15139 0 : fd_rent_decode_archival_unsafe( &self->rent, ctx );
15140 0 : break;
15141 0 : }
15142 0 : case (ushort)fd_epoch_bank_eah_start_slot_TAG: {
15143 0 : fd_bincode_uint64_decode_unsafe( &self->eah_start_slot, ctx );
15144 0 : break;
15145 0 : }
15146 0 : case (ushort)fd_epoch_bank_eah_stop_slot_TAG: {
15147 0 : fd_bincode_uint64_decode_unsafe( &self->eah_stop_slot, ctx );
15148 0 : break;
15149 0 : }
15150 0 : case (ushort)fd_epoch_bank_eah_interval_TAG: {
15151 0 : fd_bincode_uint64_decode_unsafe( &self->eah_interval, ctx );
15152 0 : break;
15153 0 : }
15154 0 : case (ushort)fd_epoch_bank_genesis_hash_TAG: {
15155 0 : fd_archive_decode_setup_length( ctx, &offset );
15156 0 : fd_hash_decode_archival_unsafe( &self->genesis_hash, ctx );
15157 0 : break;
15158 0 : }
15159 0 : case (ushort)fd_epoch_bank_cluster_type_TAG: {
15160 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
15161 0 : break;
15162 0 : }
15163 0 : case (ushort)fd_epoch_bank_cluster_version_TAG: {
15164 0 : fd_archive_decode_setup_length( ctx, &offset );
15165 0 : for( ulong i=0; i<3; i++ ) {
15166 0 : fd_bincode_uint32_decode_unsafe( self->cluster_version + i, ctx );
15167 0 : }
15168 0 : break;
15169 0 : }
15170 0 : case (ushort)fd_epoch_bank_next_epoch_stakes_TAG: {
15171 0 : fd_archive_decode_setup_length( ctx, &offset );
15172 0 : fd_vote_accounts_decode_archival_unsafe( &self->next_epoch_stakes, ctx );
15173 0 : break;
15174 0 : }
15175 0 : case (ushort)fd_epoch_bank_rent_epoch_schedule_TAG: {
15176 0 : fd_archive_decode_setup_length( ctx, &offset );
15177 0 : fd_epoch_schedule_decode_archival_unsafe( &self->rent_epoch_schedule, ctx );
15178 0 : break;
15179 0 : }
15180 0 : default:
15181 0 : fd_archive_decode_skip_field( ctx, tag );
15182 0 : break;
15183 0 : }
15184 0 : }
15185 0 : }
15186 0 : int fd_epoch_bank_encode_archival( fd_epoch_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15187 0 : int err;
15188 0 : void * offset = NULL;
15189 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_stakes_TAG, ctx );
15190 0 : if( FD_UNLIKELY( err ) ) return err;
15191 0 : err = fd_archive_encode_setup_length( ctx, &offset );
15192 0 : if( FD_UNLIKELY( err ) ) return err;
15193 0 : err = fd_stakes_encode_archival( &self->stakes, ctx );
15194 0 : if( FD_UNLIKELY( err ) ) return err;
15195 0 : err = fd_archive_encode_set_length( ctx, offset );
15196 0 : if( FD_UNLIKELY( err ) ) return err;
15197 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_hashes_per_tick_TAG, ctx );
15198 0 : if( FD_UNLIKELY( err ) ) return err;
15199 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
15200 0 : if( FD_UNLIKELY( err ) ) return err;
15201 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_ticks_per_slot_TAG, ctx );
15202 0 : if( FD_UNLIKELY( err ) ) return err;
15203 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
15204 0 : if( FD_UNLIKELY( err ) ) return err;
15205 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_ns_per_slot_TAG, ctx );
15206 0 : if( FD_UNLIKELY( err ) ) return err;
15207 0 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
15208 0 : if( FD_UNLIKELY( err ) ) return err;
15209 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_genesis_creation_time_TAG, ctx );
15210 0 : if( FD_UNLIKELY( err ) ) return err;
15211 0 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
15212 0 : if( FD_UNLIKELY( err ) ) return err;
15213 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_slots_per_year_TAG, ctx );
15214 0 : if( FD_UNLIKELY( err ) ) return err;
15215 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
15216 0 : if( FD_UNLIKELY( err ) ) return err;
15217 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_max_tick_height_TAG, ctx );
15218 0 : if( FD_UNLIKELY( err ) ) return err;
15219 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
15220 0 : if( FD_UNLIKELY( err ) ) return err;
15221 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_inflation_TAG, ctx );
15222 0 : if( FD_UNLIKELY( err ) ) return err;
15223 0 : err = fd_archive_encode_setup_length( ctx, &offset );
15224 0 : if( FD_UNLIKELY( err ) ) return err;
15225 0 : err = fd_inflation_encode_archival( &self->inflation, ctx );
15226 0 : if( FD_UNLIKELY( err ) ) return err;
15227 0 : err = fd_archive_encode_set_length( ctx, offset );
15228 0 : if( FD_UNLIKELY( err ) ) return err;
15229 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_epoch_schedule_TAG, ctx );
15230 0 : if( FD_UNLIKELY( err ) ) return err;
15231 0 : err = fd_archive_encode_setup_length( ctx, &offset );
15232 0 : if( FD_UNLIKELY( err ) ) return err;
15233 0 : err = fd_epoch_schedule_encode_archival( &self->epoch_schedule, ctx );
15234 0 : if( FD_UNLIKELY( err ) ) return err;
15235 0 : err = fd_archive_encode_set_length( ctx, offset );
15236 0 : if( FD_UNLIKELY( err ) ) return err;
15237 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_rent_TAG, ctx );
15238 0 : if( FD_UNLIKELY( err ) ) return err;
15239 0 : err = fd_archive_encode_setup_length( ctx, &offset );
15240 0 : if( FD_UNLIKELY( err ) ) return err;
15241 0 : err = fd_rent_encode_archival( &self->rent, ctx );
15242 0 : if( FD_UNLIKELY( err ) ) return err;
15243 0 : err = fd_archive_encode_set_length( ctx, offset );
15244 0 : if( FD_UNLIKELY( err ) ) return err;
15245 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_eah_start_slot_TAG, ctx );
15246 0 : if( FD_UNLIKELY( err ) ) return err;
15247 0 : err = fd_bincode_uint64_encode( self->eah_start_slot, ctx );
15248 0 : if( FD_UNLIKELY( err ) ) return err;
15249 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_eah_stop_slot_TAG, ctx );
15250 0 : if( FD_UNLIKELY( err ) ) return err;
15251 0 : err = fd_bincode_uint64_encode( self->eah_stop_slot, ctx );
15252 0 : if( FD_UNLIKELY( err ) ) return err;
15253 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_eah_interval_TAG, ctx );
15254 0 : if( FD_UNLIKELY( err ) ) return err;
15255 0 : err = fd_bincode_uint64_encode( self->eah_interval, ctx );
15256 0 : if( FD_UNLIKELY( err ) ) return err;
15257 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_genesis_hash_TAG, ctx );
15258 0 : if( FD_UNLIKELY( err ) ) return err;
15259 0 : err = fd_archive_encode_setup_length( ctx, &offset );
15260 0 : if( FD_UNLIKELY( err ) ) return err;
15261 0 : err = fd_hash_encode_archival( &self->genesis_hash, ctx );
15262 0 : if( FD_UNLIKELY( err ) ) return err;
15263 0 : err = fd_archive_encode_set_length( ctx, offset );
15264 0 : if( FD_UNLIKELY( err ) ) return err;
15265 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_cluster_type_TAG, ctx );
15266 0 : if( FD_UNLIKELY( err ) ) return err;
15267 0 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
15268 0 : if( FD_UNLIKELY( err ) ) return err;
15269 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_cluster_version_TAG, ctx );
15270 0 : if( FD_UNLIKELY( err ) ) return err;
15271 0 : err = fd_archive_encode_setup_length( ctx, &offset );
15272 0 : if( FD_UNLIKELY( err ) ) return err;
15273 0 : for( ulong i=0; i<3; i++ ) {
15274 0 : err = fd_bincode_uint32_encode( self->cluster_version[i], ctx );
15275 0 : if( FD_UNLIKELY( err ) ) return err;
15276 0 : }
15277 0 : err = fd_archive_encode_set_length( ctx, offset );
15278 0 : if( FD_UNLIKELY( err ) ) return err;
15279 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_next_epoch_stakes_TAG, ctx );
15280 0 : if( FD_UNLIKELY( err ) ) return err;
15281 0 : err = fd_archive_encode_setup_length( ctx, &offset );
15282 0 : if( FD_UNLIKELY( err ) ) return err;
15283 0 : err = fd_vote_accounts_encode_archival( &self->next_epoch_stakes, ctx );
15284 0 : if( FD_UNLIKELY( err ) ) return err;
15285 0 : err = fd_archive_encode_set_length( ctx, offset );
15286 0 : if( FD_UNLIKELY( err ) ) return err;
15287 0 : err = fd_bincode_uint16_encode( (ushort)fd_epoch_bank_rent_epoch_schedule_TAG, ctx );
15288 0 : if( FD_UNLIKELY( err ) ) return err;
15289 0 : err = fd_archive_encode_setup_length( ctx, &offset );
15290 0 : if( FD_UNLIKELY( err ) ) return err;
15291 0 : err = fd_epoch_schedule_encode_archival( &self->rent_epoch_schedule, ctx );
15292 0 : if( FD_UNLIKELY( err ) ) return err;
15293 0 : err = fd_archive_encode_set_length( ctx, offset );
15294 0 : if( FD_UNLIKELY( err ) ) return err;
15295 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
15296 0 : if( FD_UNLIKELY( err ) ) return err;
15297 0 : return FD_BINCODE_SUCCESS;
15298 0 : }
15299 0 : int fd_epoch_bank_decode_offsets( fd_epoch_bank_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
15300 0 : uchar const * data = ctx->data;
15301 0 : int err;
15302 0 : self->stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
15303 0 : err = fd_stakes_decode_preflight( ctx );
15304 0 : if( FD_UNLIKELY( err ) ) return err;
15305 0 : self->hashes_per_tick_off = (uint)( (ulong)ctx->data - (ulong)data );
15306 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15307 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15308 0 : self->ticks_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
15309 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15310 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15311 0 : self->ns_per_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
15312 0 : err = fd_bincode_uint128_decode_preflight( ctx );
15313 0 : if( FD_UNLIKELY( err ) ) return err;
15314 0 : self->genesis_creation_time_off = (uint)( (ulong)ctx->data - (ulong)data );
15315 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15316 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15317 0 : self->slots_per_year_off = (uint)( (ulong)ctx->data - (ulong)data );
15318 0 : err = fd_bincode_double_decode_preflight( ctx );
15319 0 : if( FD_UNLIKELY( err ) ) return err;
15320 0 : self->max_tick_height_off = (uint)( (ulong)ctx->data - (ulong)data );
15321 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15322 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15323 0 : self->inflation_off = (uint)( (ulong)ctx->data - (ulong)data );
15324 0 : err = fd_inflation_decode_preflight( ctx );
15325 0 : if( FD_UNLIKELY( err ) ) return err;
15326 0 : self->epoch_schedule_off = (uint)( (ulong)ctx->data - (ulong)data );
15327 0 : err = fd_epoch_schedule_decode_preflight( ctx );
15328 0 : if( FD_UNLIKELY( err ) ) return err;
15329 0 : self->rent_off = (uint)( (ulong)ctx->data - (ulong)data );
15330 0 : err = fd_rent_decode_preflight( ctx );
15331 0 : if( FD_UNLIKELY( err ) ) return err;
15332 0 : self->eah_start_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
15333 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15334 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15335 0 : self->eah_stop_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
15336 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15337 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15338 0 : self->eah_interval_off = (uint)( (ulong)ctx->data - (ulong)data );
15339 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15340 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15341 0 : self->genesis_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
15342 0 : err = fd_hash_decode_preflight( ctx );
15343 0 : if( FD_UNLIKELY( err ) ) return err;
15344 0 : self->cluster_type_off = (uint)( (ulong)ctx->data - (ulong)data );
15345 0 : err = fd_bincode_uint32_decode_preflight( ctx );
15346 0 : if( FD_UNLIKELY( err ) ) return err;
15347 0 : self->cluster_version_off = (uint)( (ulong)ctx->data - (ulong)data );
15348 0 : for( ulong i=0; i<3; i++ ) {
15349 0 : err = fd_bincode_uint32_decode_preflight( ctx );
15350 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15351 0 : }
15352 0 : self->next_epoch_stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
15353 0 : err = fd_vote_accounts_decode_preflight( ctx );
15354 0 : if( FD_UNLIKELY( err ) ) return err;
15355 0 : self->rent_epoch_schedule_off = (uint)( (ulong)ctx->data - (ulong)data );
15356 0 : err = fd_epoch_schedule_decode_preflight( ctx );
15357 0 : if( FD_UNLIKELY( err ) ) return err;
15358 0 : return FD_BINCODE_SUCCESS;
15359 0 : }
15360 407859 : void fd_epoch_bank_new(fd_epoch_bank_t * self) {
15361 407859 : fd_memset( self, 0, sizeof(fd_epoch_bank_t) );
15362 407859 : fd_stakes_new( &self->stakes );
15363 407859 : fd_inflation_new( &self->inflation );
15364 407859 : fd_epoch_schedule_new( &self->epoch_schedule );
15365 407859 : fd_rent_new( &self->rent );
15366 407859 : fd_hash_new( &self->genesis_hash );
15367 407859 : fd_vote_accounts_new( &self->next_epoch_stakes );
15368 407859 : fd_epoch_schedule_new( &self->rent_epoch_schedule );
15369 407859 : }
15370 0 : void fd_epoch_bank_destroy( fd_epoch_bank_t * self, fd_bincode_destroy_ctx_t * ctx ) {
15371 0 : fd_stakes_destroy( &self->stakes, ctx );
15372 0 : fd_inflation_destroy( &self->inflation, ctx );
15373 0 : fd_epoch_schedule_destroy( &self->epoch_schedule, ctx );
15374 0 : fd_rent_destroy( &self->rent, ctx );
15375 0 : fd_hash_destroy( &self->genesis_hash, ctx );
15376 0 : fd_vote_accounts_destroy( &self->next_epoch_stakes, ctx );
15377 0 : fd_epoch_schedule_destroy( &self->rent_epoch_schedule, ctx );
15378 0 : }
15379 :
15380 0 : ulong fd_epoch_bank_footprint( void ){ return FD_EPOCH_BANK_FOOTPRINT; }
15381 0 : ulong fd_epoch_bank_align( void ){ return FD_EPOCH_BANK_ALIGN; }
15382 :
15383 0 : void fd_epoch_bank_walk( void * w, fd_epoch_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
15384 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_bank", level++ );
15385 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level );
15386 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15387 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15388 0 : fun( w, &self->ns_per_slot, "ns_per_slot", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
15389 0 : fun( w, &self->genesis_creation_time, "genesis_creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15390 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
15391 0 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15392 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level );
15393 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level );
15394 0 : fd_rent_walk( w, &self->rent, fun, "rent", level );
15395 0 : fun( w, &self->eah_start_slot, "eah_start_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15396 0 : fun( w, &self->eah_stop_slot, "eah_stop_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15397 0 : fun( w, &self->eah_interval, "eah_interval", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
15398 0 : fd_hash_walk( w, &self->genesis_hash, fun, "genesis_hash", level );
15399 0 : fun( w, &self->cluster_type, "cluster_type", FD_FLAMENCO_TYPE_UINT, "uint", level );
15400 0 : fun( w, NULL, "cluster_version", FD_FLAMENCO_TYPE_ARR, "uint[]", level++ );
15401 0 : for( ulong i=0; i<3; i++ )
15402 0 : fun( w, self->cluster_version + i, "cluster_version", FD_FLAMENCO_TYPE_UINT, "uint", level );
15403 0 : fun( w, NULL, "cluster_version", FD_FLAMENCO_TYPE_ARR_END, "uint[]", level-- );
15404 0 : fd_vote_accounts_walk( w, &self->next_epoch_stakes, fun, "next_epoch_stakes", level );
15405 0 : fd_epoch_schedule_walk( w, &self->rent_epoch_schedule, fun, "rent_epoch_schedule", level );
15406 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_bank", level-- );
15407 0 : }
15408 0 : ulong fd_epoch_bank_size( fd_epoch_bank_t const * self ) {
15409 0 : ulong size = 0;
15410 0 : size += fd_stakes_size( &self->stakes );
15411 0 : size += sizeof(ulong);
15412 0 : size += sizeof(ulong);
15413 0 : size += sizeof(uint128);
15414 0 : size += sizeof(ulong);
15415 0 : size += sizeof(double);
15416 0 : size += sizeof(ulong);
15417 0 : size += fd_inflation_size( &self->inflation );
15418 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
15419 0 : size += fd_rent_size( &self->rent );
15420 0 : size += sizeof(ulong);
15421 0 : size += sizeof(ulong);
15422 0 : size += sizeof(ulong);
15423 0 : size += fd_hash_size( &self->genesis_hash );
15424 0 : size += sizeof(uint);
15425 0 : size += 3 * sizeof(uint);
15426 0 : size += fd_vote_accounts_size( &self->next_epoch_stakes );
15427 0 : size += fd_epoch_schedule_size( &self->rent_epoch_schedule );
15428 0 : return size;
15429 0 : }
15430 :
15431 0 : int fd_slot_bank_decode( fd_slot_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
15432 0 : void const * data = ctx->data;
15433 0 : int err = fd_slot_bank_decode_preflight( ctx );
15434 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15435 0 : ctx->data = data;
15436 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
15437 0 : fd_slot_bank_new( self );
15438 0 : }
15439 0 : fd_slot_bank_decode_unsafe( self, ctx );
15440 0 : return FD_BINCODE_SUCCESS;
15441 0 : }
15442 0 : int fd_slot_bank_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
15443 0 : int err;
15444 0 : err = fd_recent_block_hashes_decode_preflight( ctx );
15445 0 : if( FD_UNLIKELY( err ) ) return err;
15446 0 : err = fd_clock_timestamp_votes_decode_preflight( ctx );
15447 0 : if( FD_UNLIKELY( err ) ) return err;
15448 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15449 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15450 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15451 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15452 0 : err = fd_hash_decode_preflight( ctx );
15453 0 : if( FD_UNLIKELY( err ) ) return err;
15454 0 : err = fd_hash_decode_preflight( ctx );
15455 0 : if( FD_UNLIKELY( err ) ) return err;
15456 0 : err = fd_hash_decode_preflight( ctx );
15457 0 : if( FD_UNLIKELY( err ) ) return err;
15458 0 : err = fd_fee_rate_governor_decode_preflight( ctx );
15459 0 : if( FD_UNLIKELY( err ) ) return err;
15460 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15461 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15462 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15463 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15464 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15465 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15466 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15467 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15468 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15469 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15470 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15471 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15472 0 : err = fd_vote_accounts_decode_preflight( ctx );
15473 0 : if( FD_UNLIKELY( err ) ) return err;
15474 0 : err = fd_sol_sysvar_last_restart_slot_decode_preflight( ctx );
15475 0 : if( FD_UNLIKELY( err ) ) return err;
15476 0 : err = fd_stake_accounts_decode_preflight( ctx );
15477 0 : if( FD_UNLIKELY( err ) ) return err;
15478 0 : err = fd_vote_accounts_decode_preflight( ctx );
15479 0 : if( FD_UNLIKELY( err ) ) return err;
15480 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15481 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15482 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15483 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15484 0 : err = fd_slot_lthash_decode_preflight( ctx );
15485 0 : if( FD_UNLIKELY( err ) ) return err;
15486 0 : err = fd_block_hash_queue_decode_preflight( ctx );
15487 0 : if( FD_UNLIKELY( err ) ) return err;
15488 0 : err = fd_hash_decode_preflight( ctx );
15489 0 : if( FD_UNLIKELY( err ) ) return err;
15490 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15491 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15492 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15493 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15494 0 : {
15495 0 : uchar o;
15496 0 : err = fd_bincode_bool_decode( &o, ctx );
15497 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15498 0 : if( o ) {
15499 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15500 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15501 0 : }
15502 0 : }
15503 0 : err = fd_hard_forks_decode_preflight( ctx );
15504 0 : if( FD_UNLIKELY( err ) ) return err;
15505 0 : return FD_BINCODE_SUCCESS;
15506 0 : }
15507 0 : void fd_slot_bank_decode_unsafe( fd_slot_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
15508 0 : fd_recent_block_hashes_decode_unsafe( &self->recent_block_hashes, ctx );
15509 0 : fd_clock_timestamp_votes_decode_unsafe( &self->timestamp_votes, ctx );
15510 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
15511 0 : fd_bincode_uint64_decode_unsafe( &self->prev_slot, ctx );
15512 0 : fd_hash_decode_unsafe( &self->poh, ctx );
15513 0 : fd_hash_decode_unsafe( &self->banks_hash, ctx );
15514 0 : fd_hash_decode_unsafe( &self->epoch_account_hash, ctx );
15515 0 : fd_fee_rate_governor_decode_unsafe( &self->fee_rate_governor, ctx );
15516 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
15517 0 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
15518 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
15519 0 : fd_bincode_uint64_decode_unsafe( &self->collected_execution_fees, ctx );
15520 0 : fd_bincode_uint64_decode_unsafe( &self->collected_priority_fees, ctx );
15521 0 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
15522 0 : fd_vote_accounts_decode_unsafe( &self->epoch_stakes, ctx );
15523 0 : fd_sol_sysvar_last_restart_slot_decode_unsafe( &self->last_restart_slot, ctx );
15524 0 : fd_stake_accounts_decode_unsafe( &self->stake_account_keys, ctx );
15525 0 : fd_vote_accounts_decode_unsafe( &self->vote_account_keys, ctx );
15526 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
15527 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
15528 0 : fd_slot_lthash_decode_unsafe( &self->lthash, ctx );
15529 0 : fd_block_hash_queue_decode_unsafe( &self->block_hash_queue, ctx );
15530 0 : fd_hash_decode_unsafe( &self->prev_banks_hash, ctx );
15531 0 : fd_bincode_uint64_decode_unsafe( &self->parent_signature_cnt, ctx );
15532 0 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
15533 0 : {
15534 0 : uchar o;
15535 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
15536 0 : self->has_use_preceeding_epoch_stakes = !!o;
15537 0 : if( o ) {
15538 0 : fd_bincode_uint64_decode_unsafe( &self->use_preceeding_epoch_stakes, ctx );
15539 0 : }
15540 0 : }
15541 0 : fd_hard_forks_decode_unsafe( &self->hard_forks, ctx );
15542 0 : }
15543 0 : int fd_slot_bank_encode( fd_slot_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15544 0 : int err;
15545 0 : err = fd_recent_block_hashes_encode( &self->recent_block_hashes, ctx );
15546 0 : if( FD_UNLIKELY( err ) ) return err;
15547 0 : err = fd_clock_timestamp_votes_encode( &self->timestamp_votes, ctx );
15548 0 : if( FD_UNLIKELY( err ) ) return err;
15549 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
15550 0 : if( FD_UNLIKELY( err ) ) return err;
15551 0 : err = fd_bincode_uint64_encode( self->prev_slot, ctx );
15552 0 : if( FD_UNLIKELY( err ) ) return err;
15553 0 : err = fd_hash_encode( &self->poh, ctx );
15554 0 : if( FD_UNLIKELY( err ) ) return err;
15555 0 : err = fd_hash_encode( &self->banks_hash, ctx );
15556 0 : if( FD_UNLIKELY( err ) ) return err;
15557 0 : err = fd_hash_encode( &self->epoch_account_hash, ctx );
15558 0 : if( FD_UNLIKELY( err ) ) return err;
15559 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
15560 0 : if( FD_UNLIKELY( err ) ) return err;
15561 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
15562 0 : if( FD_UNLIKELY( err ) ) return err;
15563 0 : err = fd_bincode_uint64_encode( self->block_height, ctx );
15564 0 : if( FD_UNLIKELY( err ) ) return err;
15565 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
15566 0 : if( FD_UNLIKELY( err ) ) return err;
15567 0 : err = fd_bincode_uint64_encode( self->collected_execution_fees, ctx );
15568 0 : if( FD_UNLIKELY( err ) ) return err;
15569 0 : err = fd_bincode_uint64_encode( self->collected_priority_fees, ctx );
15570 0 : if( FD_UNLIKELY( err ) ) return err;
15571 0 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
15572 0 : if( FD_UNLIKELY( err ) ) return err;
15573 0 : err = fd_vote_accounts_encode( &self->epoch_stakes, ctx );
15574 0 : if( FD_UNLIKELY( err ) ) return err;
15575 0 : err = fd_sol_sysvar_last_restart_slot_encode( &self->last_restart_slot, ctx );
15576 0 : if( FD_UNLIKELY( err ) ) return err;
15577 0 : err = fd_stake_accounts_encode( &self->stake_account_keys, ctx );
15578 0 : if( FD_UNLIKELY( err ) ) return err;
15579 0 : err = fd_vote_accounts_encode( &self->vote_account_keys, ctx );
15580 0 : if( FD_UNLIKELY( err ) ) return err;
15581 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
15582 0 : if( FD_UNLIKELY( err ) ) return err;
15583 0 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
15584 0 : if( FD_UNLIKELY( err ) ) return err;
15585 0 : err = fd_slot_lthash_encode( &self->lthash, ctx );
15586 0 : if( FD_UNLIKELY( err ) ) return err;
15587 0 : err = fd_block_hash_queue_encode( &self->block_hash_queue, ctx );
15588 0 : if( FD_UNLIKELY( err ) ) return err;
15589 0 : err = fd_hash_encode( &self->prev_banks_hash, ctx );
15590 0 : if( FD_UNLIKELY( err ) ) return err;
15591 0 : err = fd_bincode_uint64_encode( self->parent_signature_cnt, ctx );
15592 0 : if( FD_UNLIKELY( err ) ) return err;
15593 0 : err = fd_bincode_uint64_encode( self->tick_height, ctx );
15594 0 : if( FD_UNLIKELY( err ) ) return err;
15595 0 : err = fd_bincode_bool_encode( self->has_use_preceeding_epoch_stakes, ctx );
15596 0 : if( FD_UNLIKELY( err ) ) return err;
15597 0 : if( self->has_use_preceeding_epoch_stakes ) {
15598 0 : err = fd_bincode_uint64_encode( self->use_preceeding_epoch_stakes, ctx );
15599 0 : if( FD_UNLIKELY( err ) ) return err;
15600 0 : }
15601 0 : err = fd_hard_forks_encode( &self->hard_forks, ctx );
15602 0 : if( FD_UNLIKELY( err ) ) return err;
15603 0 : return FD_BINCODE_SUCCESS;
15604 0 : }
15605 : enum {
15606 : fd_slot_bank_recent_block_hashes_TAG = (0 << 6) | FD_ARCHIVE_META_STRUCT,
15607 : fd_slot_bank_timestamp_votes_TAG = (1 << 6) | FD_ARCHIVE_META_STRUCT,
15608 : fd_slot_bank_slot_TAG = (2 << 6) | FD_ARCHIVE_META_ULONG,
15609 : fd_slot_bank_prev_slot_TAG = (3 << 6) | FD_ARCHIVE_META_ULONG,
15610 : fd_slot_bank_poh_TAG = (4 << 6) | FD_ARCHIVE_META_STRUCT,
15611 : fd_slot_bank_banks_hash_TAG = (5 << 6) | FD_ARCHIVE_META_STRUCT,
15612 : fd_slot_bank_epoch_account_hash_TAG = (6 << 6) | FD_ARCHIVE_META_STRUCT,
15613 : fd_slot_bank_fee_rate_governor_TAG = (7 << 6) | FD_ARCHIVE_META_STRUCT,
15614 : fd_slot_bank_capitalization_TAG = (8 << 6) | FD_ARCHIVE_META_ULONG,
15615 : fd_slot_bank_block_height_TAG = (9 << 6) | FD_ARCHIVE_META_ULONG,
15616 : fd_slot_bank_max_tick_height_TAG = (10 << 6) | FD_ARCHIVE_META_ULONG,
15617 : fd_slot_bank_collected_execution_fees_TAG = (11 << 6) | FD_ARCHIVE_META_ULONG,
15618 : fd_slot_bank_collected_priority_fees_TAG = (12 << 6) | FD_ARCHIVE_META_ULONG,
15619 : fd_slot_bank_collected_rent_TAG = (13 << 6) | FD_ARCHIVE_META_ULONG,
15620 : fd_slot_bank_epoch_stakes_TAG = (14 << 6) | FD_ARCHIVE_META_STRUCT,
15621 : fd_slot_bank_last_restart_slot_TAG = (15 << 6) | FD_ARCHIVE_META_STRUCT,
15622 : fd_slot_bank_stake_account_keys_TAG = (16 << 6) | FD_ARCHIVE_META_STRUCT,
15623 : fd_slot_bank_vote_account_keys_TAG = (17 << 6) | FD_ARCHIVE_META_STRUCT,
15624 : fd_slot_bank_lamports_per_signature_TAG = (18 << 6) | FD_ARCHIVE_META_ULONG,
15625 : fd_slot_bank_transaction_count_TAG = (19 << 6) | FD_ARCHIVE_META_ULONG,
15626 : fd_slot_bank_lthash_TAG = (20 << 6) | FD_ARCHIVE_META_STRUCT,
15627 : fd_slot_bank_block_hash_queue_TAG = (21 << 6) | FD_ARCHIVE_META_STRUCT,
15628 : fd_slot_bank_prev_banks_hash_TAG = (22 << 6) | FD_ARCHIVE_META_STRUCT,
15629 : fd_slot_bank_parent_signature_cnt_TAG = (23 << 6) | FD_ARCHIVE_META_ULONG,
15630 : fd_slot_bank_tick_height_TAG = (24 << 6) | FD_ARCHIVE_META_ULONG,
15631 : fd_slot_bank_use_preceeding_epoch_stakes_TAG = (25 << 6) | FD_ARCHIVE_META_OPTION,
15632 : fd_slot_bank_hard_forks_TAG = (26 << 6) | FD_ARCHIVE_META_STRUCT,
15633 : };
15634 0 : int fd_slot_bank_decode_archival( fd_slot_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
15635 0 : void const * data = ctx->data;
15636 0 : int err = fd_slot_bank_decode_archival_preflight( ctx );
15637 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15638 0 : ctx->data = data;
15639 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
15640 0 : fd_slot_bank_new( self );
15641 0 : }
15642 0 : fd_slot_bank_decode_archival_unsafe( self, ctx );
15643 0 : return FD_BINCODE_SUCCESS;
15644 0 : }
15645 0 : int fd_slot_bank_decode_archival_preflight( fd_bincode_decode_ctx_t * ctx ) {
15646 0 : int err;
15647 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
15648 0 : void * offset = NULL;
15649 0 : for(;;) {
15650 0 : err = fd_bincode_uint16_decode( &tag, ctx );
15651 0 : if( FD_UNLIKELY( err ) ) return err;
15652 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
15653 0 : switch( tag ) {
15654 0 : case (ushort)fd_slot_bank_recent_block_hashes_TAG: {
15655 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15656 0 : if( FD_UNLIKELY( err ) ) return err;
15657 0 : err = fd_recent_block_hashes_decode_archival_preflight( ctx );
15658 0 : if( FD_UNLIKELY( err ) ) return err;
15659 0 : err = fd_archive_decode_check_length( ctx, offset );
15660 0 : if( FD_UNLIKELY( err ) ) return err;
15661 0 : break;
15662 0 : }
15663 0 : case (ushort)fd_slot_bank_timestamp_votes_TAG: {
15664 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15665 0 : if( FD_UNLIKELY( err ) ) return err;
15666 0 : err = fd_clock_timestamp_votes_decode_archival_preflight( ctx );
15667 0 : if( FD_UNLIKELY( err ) ) return err;
15668 0 : err = fd_archive_decode_check_length( ctx, offset );
15669 0 : if( FD_UNLIKELY( err ) ) return err;
15670 0 : break;
15671 0 : }
15672 0 : case (ushort)fd_slot_bank_slot_TAG: {
15673 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15674 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15675 0 : break;
15676 0 : }
15677 0 : case (ushort)fd_slot_bank_prev_slot_TAG: {
15678 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15679 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15680 0 : break;
15681 0 : }
15682 0 : case (ushort)fd_slot_bank_poh_TAG: {
15683 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15684 0 : if( FD_UNLIKELY( err ) ) return err;
15685 0 : err = fd_hash_decode_archival_preflight( ctx );
15686 0 : if( FD_UNLIKELY( err ) ) return err;
15687 0 : err = fd_archive_decode_check_length( ctx, offset );
15688 0 : if( FD_UNLIKELY( err ) ) return err;
15689 0 : break;
15690 0 : }
15691 0 : case (ushort)fd_slot_bank_banks_hash_TAG: {
15692 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15693 0 : if( FD_UNLIKELY( err ) ) return err;
15694 0 : err = fd_hash_decode_archival_preflight( ctx );
15695 0 : if( FD_UNLIKELY( err ) ) return err;
15696 0 : err = fd_archive_decode_check_length( ctx, offset );
15697 0 : if( FD_UNLIKELY( err ) ) return err;
15698 0 : break;
15699 0 : }
15700 0 : case (ushort)fd_slot_bank_epoch_account_hash_TAG: {
15701 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15702 0 : if( FD_UNLIKELY( err ) ) return err;
15703 0 : err = fd_hash_decode_archival_preflight( ctx );
15704 0 : if( FD_UNLIKELY( err ) ) return err;
15705 0 : err = fd_archive_decode_check_length( ctx, offset );
15706 0 : if( FD_UNLIKELY( err ) ) return err;
15707 0 : break;
15708 0 : }
15709 0 : case (ushort)fd_slot_bank_fee_rate_governor_TAG: {
15710 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15711 0 : if( FD_UNLIKELY( err ) ) return err;
15712 0 : err = fd_fee_rate_governor_decode_archival_preflight( ctx );
15713 0 : if( FD_UNLIKELY( err ) ) return err;
15714 0 : err = fd_archive_decode_check_length( ctx, offset );
15715 0 : if( FD_UNLIKELY( err ) ) return err;
15716 0 : break;
15717 0 : }
15718 0 : case (ushort)fd_slot_bank_capitalization_TAG: {
15719 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15720 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15721 0 : break;
15722 0 : }
15723 0 : case (ushort)fd_slot_bank_block_height_TAG: {
15724 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15725 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15726 0 : break;
15727 0 : }
15728 0 : case (ushort)fd_slot_bank_max_tick_height_TAG: {
15729 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15730 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15731 0 : break;
15732 0 : }
15733 0 : case (ushort)fd_slot_bank_collected_execution_fees_TAG: {
15734 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15735 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15736 0 : break;
15737 0 : }
15738 0 : case (ushort)fd_slot_bank_collected_priority_fees_TAG: {
15739 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15740 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15741 0 : break;
15742 0 : }
15743 0 : case (ushort)fd_slot_bank_collected_rent_TAG: {
15744 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15745 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15746 0 : break;
15747 0 : }
15748 0 : case (ushort)fd_slot_bank_epoch_stakes_TAG: {
15749 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15750 0 : if( FD_UNLIKELY( err ) ) return err;
15751 0 : err = fd_vote_accounts_decode_archival_preflight( ctx );
15752 0 : if( FD_UNLIKELY( err ) ) return err;
15753 0 : err = fd_archive_decode_check_length( ctx, offset );
15754 0 : if( FD_UNLIKELY( err ) ) return err;
15755 0 : break;
15756 0 : }
15757 0 : case (ushort)fd_slot_bank_last_restart_slot_TAG: {
15758 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15759 0 : if( FD_UNLIKELY( err ) ) return err;
15760 0 : err = fd_sol_sysvar_last_restart_slot_decode_archival_preflight( ctx );
15761 0 : if( FD_UNLIKELY( err ) ) return err;
15762 0 : err = fd_archive_decode_check_length( ctx, offset );
15763 0 : if( FD_UNLIKELY( err ) ) return err;
15764 0 : break;
15765 0 : }
15766 0 : case (ushort)fd_slot_bank_stake_account_keys_TAG: {
15767 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15768 0 : if( FD_UNLIKELY( err ) ) return err;
15769 0 : err = fd_stake_accounts_decode_archival_preflight( ctx );
15770 0 : if( FD_UNLIKELY( err ) ) return err;
15771 0 : err = fd_archive_decode_check_length( ctx, offset );
15772 0 : if( FD_UNLIKELY( err ) ) return err;
15773 0 : break;
15774 0 : }
15775 0 : case (ushort)fd_slot_bank_vote_account_keys_TAG: {
15776 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15777 0 : if( FD_UNLIKELY( err ) ) return err;
15778 0 : err = fd_vote_accounts_decode_archival_preflight( ctx );
15779 0 : if( FD_UNLIKELY( err ) ) return err;
15780 0 : err = fd_archive_decode_check_length( ctx, offset );
15781 0 : if( FD_UNLIKELY( err ) ) return err;
15782 0 : break;
15783 0 : }
15784 0 : case (ushort)fd_slot_bank_lamports_per_signature_TAG: {
15785 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15786 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15787 0 : break;
15788 0 : }
15789 0 : case (ushort)fd_slot_bank_transaction_count_TAG: {
15790 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15791 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15792 0 : break;
15793 0 : }
15794 0 : case (ushort)fd_slot_bank_lthash_TAG: {
15795 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15796 0 : if( FD_UNLIKELY( err ) ) return err;
15797 0 : err = fd_slot_lthash_decode_archival_preflight( ctx );
15798 0 : if( FD_UNLIKELY( err ) ) return err;
15799 0 : err = fd_archive_decode_check_length( ctx, offset );
15800 0 : if( FD_UNLIKELY( err ) ) return err;
15801 0 : break;
15802 0 : }
15803 0 : case (ushort)fd_slot_bank_block_hash_queue_TAG: {
15804 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15805 0 : if( FD_UNLIKELY( err ) ) return err;
15806 0 : err = fd_block_hash_queue_decode_archival_preflight( ctx );
15807 0 : if( FD_UNLIKELY( err ) ) return err;
15808 0 : err = fd_archive_decode_check_length( ctx, offset );
15809 0 : if( FD_UNLIKELY( err ) ) return err;
15810 0 : break;
15811 0 : }
15812 0 : case (ushort)fd_slot_bank_prev_banks_hash_TAG: {
15813 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15814 0 : if( FD_UNLIKELY( err ) ) return err;
15815 0 : err = fd_hash_decode_archival_preflight( ctx );
15816 0 : if( FD_UNLIKELY( err ) ) return err;
15817 0 : err = fd_archive_decode_check_length( ctx, offset );
15818 0 : if( FD_UNLIKELY( err ) ) return err;
15819 0 : break;
15820 0 : }
15821 0 : case (ushort)fd_slot_bank_parent_signature_cnt_TAG: {
15822 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15823 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15824 0 : break;
15825 0 : }
15826 0 : case (ushort)fd_slot_bank_tick_height_TAG: {
15827 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15828 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15829 0 : break;
15830 0 : }
15831 0 : case (ushort)fd_slot_bank_use_preceeding_epoch_stakes_TAG: {
15832 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15833 0 : if( FD_UNLIKELY( err ) ) return err;
15834 0 : {
15835 0 : uchar o;
15836 0 : err = fd_bincode_bool_decode( &o, ctx );
15837 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15838 0 : if( o ) {
15839 0 : err = fd_bincode_uint64_decode_preflight( ctx );
15840 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15841 0 : }
15842 0 : }
15843 0 : err = fd_archive_decode_check_length( ctx, offset );
15844 0 : if( FD_UNLIKELY( err ) ) return err;
15845 0 : break;
15846 0 : }
15847 0 : case (ushort)fd_slot_bank_hard_forks_TAG: {
15848 0 : err = fd_archive_decode_setup_length( ctx, &offset );
15849 0 : if( FD_UNLIKELY( err ) ) return err;
15850 0 : err = fd_hard_forks_decode_archival_preflight( ctx );
15851 0 : if( FD_UNLIKELY( err ) ) return err;
15852 0 : err = fd_archive_decode_check_length( ctx, offset );
15853 0 : if( FD_UNLIKELY( err ) ) return err;
15854 0 : break;
15855 0 : }
15856 0 : default:
15857 0 : err = fd_archive_decode_skip_field( ctx, tag );
15858 0 : if( FD_UNLIKELY( err ) ) return err;
15859 0 : break;
15860 0 : }
15861 0 : }
15862 0 : return FD_BINCODE_SUCCESS;
15863 0 : }
15864 0 : void fd_slot_bank_decode_archival_unsafe( fd_slot_bank_t * self, fd_bincode_decode_ctx_t * ctx ) {
15865 0 : ushort tag = FD_ARCHIVE_META_SENTINAL;
15866 0 : void * offset = NULL;
15867 0 : for(;;) {
15868 0 : fd_bincode_uint16_decode( &tag, ctx );
15869 0 : if( FD_UNLIKELY( tag == FD_ARCHIVE_META_SENTINAL ) ) break;
15870 0 : switch( tag ) {
15871 0 : case (ushort)fd_slot_bank_recent_block_hashes_TAG: {
15872 0 : fd_archive_decode_setup_length( ctx, &offset );
15873 0 : fd_recent_block_hashes_decode_archival_unsafe( &self->recent_block_hashes, ctx );
15874 0 : break;
15875 0 : }
15876 0 : case (ushort)fd_slot_bank_timestamp_votes_TAG: {
15877 0 : fd_archive_decode_setup_length( ctx, &offset );
15878 0 : fd_clock_timestamp_votes_decode_archival_unsafe( &self->timestamp_votes, ctx );
15879 0 : break;
15880 0 : }
15881 0 : case (ushort)fd_slot_bank_slot_TAG: {
15882 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
15883 0 : break;
15884 0 : }
15885 0 : case (ushort)fd_slot_bank_prev_slot_TAG: {
15886 0 : fd_bincode_uint64_decode_unsafe( &self->prev_slot, ctx );
15887 0 : break;
15888 0 : }
15889 0 : case (ushort)fd_slot_bank_poh_TAG: {
15890 0 : fd_archive_decode_setup_length( ctx, &offset );
15891 0 : fd_hash_decode_archival_unsafe( &self->poh, ctx );
15892 0 : break;
15893 0 : }
15894 0 : case (ushort)fd_slot_bank_banks_hash_TAG: {
15895 0 : fd_archive_decode_setup_length( ctx, &offset );
15896 0 : fd_hash_decode_archival_unsafe( &self->banks_hash, ctx );
15897 0 : break;
15898 0 : }
15899 0 : case (ushort)fd_slot_bank_epoch_account_hash_TAG: {
15900 0 : fd_archive_decode_setup_length( ctx, &offset );
15901 0 : fd_hash_decode_archival_unsafe( &self->epoch_account_hash, ctx );
15902 0 : break;
15903 0 : }
15904 0 : case (ushort)fd_slot_bank_fee_rate_governor_TAG: {
15905 0 : fd_archive_decode_setup_length( ctx, &offset );
15906 0 : fd_fee_rate_governor_decode_archival_unsafe( &self->fee_rate_governor, ctx );
15907 0 : break;
15908 0 : }
15909 0 : case (ushort)fd_slot_bank_capitalization_TAG: {
15910 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
15911 0 : break;
15912 0 : }
15913 0 : case (ushort)fd_slot_bank_block_height_TAG: {
15914 0 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
15915 0 : break;
15916 0 : }
15917 0 : case (ushort)fd_slot_bank_max_tick_height_TAG: {
15918 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
15919 0 : break;
15920 0 : }
15921 0 : case (ushort)fd_slot_bank_collected_execution_fees_TAG: {
15922 0 : fd_bincode_uint64_decode_unsafe( &self->collected_execution_fees, ctx );
15923 0 : break;
15924 0 : }
15925 0 : case (ushort)fd_slot_bank_collected_priority_fees_TAG: {
15926 0 : fd_bincode_uint64_decode_unsafe( &self->collected_priority_fees, ctx );
15927 0 : break;
15928 0 : }
15929 0 : case (ushort)fd_slot_bank_collected_rent_TAG: {
15930 0 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
15931 0 : break;
15932 0 : }
15933 0 : case (ushort)fd_slot_bank_epoch_stakes_TAG: {
15934 0 : fd_archive_decode_setup_length( ctx, &offset );
15935 0 : fd_vote_accounts_decode_archival_unsafe( &self->epoch_stakes, ctx );
15936 0 : break;
15937 0 : }
15938 0 : case (ushort)fd_slot_bank_last_restart_slot_TAG: {
15939 0 : fd_archive_decode_setup_length( ctx, &offset );
15940 0 : fd_sol_sysvar_last_restart_slot_decode_archival_unsafe( &self->last_restart_slot, ctx );
15941 0 : break;
15942 0 : }
15943 0 : case (ushort)fd_slot_bank_stake_account_keys_TAG: {
15944 0 : fd_archive_decode_setup_length( ctx, &offset );
15945 0 : fd_stake_accounts_decode_archival_unsafe( &self->stake_account_keys, ctx );
15946 0 : break;
15947 0 : }
15948 0 : case (ushort)fd_slot_bank_vote_account_keys_TAG: {
15949 0 : fd_archive_decode_setup_length( ctx, &offset );
15950 0 : fd_vote_accounts_decode_archival_unsafe( &self->vote_account_keys, ctx );
15951 0 : break;
15952 0 : }
15953 0 : case (ushort)fd_slot_bank_lamports_per_signature_TAG: {
15954 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
15955 0 : break;
15956 0 : }
15957 0 : case (ushort)fd_slot_bank_transaction_count_TAG: {
15958 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
15959 0 : break;
15960 0 : }
15961 0 : case (ushort)fd_slot_bank_lthash_TAG: {
15962 0 : fd_archive_decode_setup_length( ctx, &offset );
15963 0 : fd_slot_lthash_decode_archival_unsafe( &self->lthash, ctx );
15964 0 : break;
15965 0 : }
15966 0 : case (ushort)fd_slot_bank_block_hash_queue_TAG: {
15967 0 : fd_archive_decode_setup_length( ctx, &offset );
15968 0 : fd_block_hash_queue_decode_archival_unsafe( &self->block_hash_queue, ctx );
15969 0 : break;
15970 0 : }
15971 0 : case (ushort)fd_slot_bank_prev_banks_hash_TAG: {
15972 0 : fd_archive_decode_setup_length( ctx, &offset );
15973 0 : fd_hash_decode_archival_unsafe( &self->prev_banks_hash, ctx );
15974 0 : break;
15975 0 : }
15976 0 : case (ushort)fd_slot_bank_parent_signature_cnt_TAG: {
15977 0 : fd_bincode_uint64_decode_unsafe( &self->parent_signature_cnt, ctx );
15978 0 : break;
15979 0 : }
15980 0 : case (ushort)fd_slot_bank_tick_height_TAG: {
15981 0 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
15982 0 : break;
15983 0 : }
15984 0 : case (ushort)fd_slot_bank_use_preceeding_epoch_stakes_TAG: {
15985 0 : fd_archive_decode_setup_length( ctx, &offset );
15986 0 : {
15987 0 : uchar o;
15988 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
15989 0 : self->has_use_preceeding_epoch_stakes = !!o;
15990 0 : if( o ) {
15991 0 : fd_bincode_uint64_decode_unsafe( &self->use_preceeding_epoch_stakes, ctx );
15992 0 : }
15993 0 : }
15994 0 : break;
15995 0 : }
15996 0 : case (ushort)fd_slot_bank_hard_forks_TAG: {
15997 0 : fd_archive_decode_setup_length( ctx, &offset );
15998 0 : fd_hard_forks_decode_archival_unsafe( &self->hard_forks, ctx );
15999 0 : break;
16000 0 : }
16001 0 : default:
16002 0 : fd_archive_decode_skip_field( ctx, tag );
16003 0 : break;
16004 0 : }
16005 0 : }
16006 0 : }
16007 0 : int fd_slot_bank_encode_archival( fd_slot_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16008 0 : int err;
16009 0 : void * offset = NULL;
16010 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_recent_block_hashes_TAG, ctx );
16011 0 : if( FD_UNLIKELY( err ) ) return err;
16012 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16013 0 : if( FD_UNLIKELY( err ) ) return err;
16014 0 : err = fd_recent_block_hashes_encode_archival( &self->recent_block_hashes, ctx );
16015 0 : if( FD_UNLIKELY( err ) ) return err;
16016 0 : err = fd_archive_encode_set_length( ctx, offset );
16017 0 : if( FD_UNLIKELY( err ) ) return err;
16018 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_timestamp_votes_TAG, ctx );
16019 0 : if( FD_UNLIKELY( err ) ) return err;
16020 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16021 0 : if( FD_UNLIKELY( err ) ) return err;
16022 0 : err = fd_clock_timestamp_votes_encode_archival( &self->timestamp_votes, ctx );
16023 0 : if( FD_UNLIKELY( err ) ) return err;
16024 0 : err = fd_archive_encode_set_length( ctx, offset );
16025 0 : if( FD_UNLIKELY( err ) ) return err;
16026 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_slot_TAG, ctx );
16027 0 : if( FD_UNLIKELY( err ) ) return err;
16028 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
16029 0 : if( FD_UNLIKELY( err ) ) return err;
16030 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_prev_slot_TAG, ctx );
16031 0 : if( FD_UNLIKELY( err ) ) return err;
16032 0 : err = fd_bincode_uint64_encode( self->prev_slot, ctx );
16033 0 : if( FD_UNLIKELY( err ) ) return err;
16034 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_poh_TAG, ctx );
16035 0 : if( FD_UNLIKELY( err ) ) return err;
16036 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16037 0 : if( FD_UNLIKELY( err ) ) return err;
16038 0 : err = fd_hash_encode_archival( &self->poh, ctx );
16039 0 : if( FD_UNLIKELY( err ) ) return err;
16040 0 : err = fd_archive_encode_set_length( ctx, offset );
16041 0 : if( FD_UNLIKELY( err ) ) return err;
16042 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_banks_hash_TAG, ctx );
16043 0 : if( FD_UNLIKELY( err ) ) return err;
16044 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16045 0 : if( FD_UNLIKELY( err ) ) return err;
16046 0 : err = fd_hash_encode_archival( &self->banks_hash, ctx );
16047 0 : if( FD_UNLIKELY( err ) ) return err;
16048 0 : err = fd_archive_encode_set_length( ctx, offset );
16049 0 : if( FD_UNLIKELY( err ) ) return err;
16050 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_epoch_account_hash_TAG, ctx );
16051 0 : if( FD_UNLIKELY( err ) ) return err;
16052 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16053 0 : if( FD_UNLIKELY( err ) ) return err;
16054 0 : err = fd_hash_encode_archival( &self->epoch_account_hash, ctx );
16055 0 : if( FD_UNLIKELY( err ) ) return err;
16056 0 : err = fd_archive_encode_set_length( ctx, offset );
16057 0 : if( FD_UNLIKELY( err ) ) return err;
16058 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_fee_rate_governor_TAG, ctx );
16059 0 : if( FD_UNLIKELY( err ) ) return err;
16060 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16061 0 : if( FD_UNLIKELY( err ) ) return err;
16062 0 : err = fd_fee_rate_governor_encode_archival( &self->fee_rate_governor, ctx );
16063 0 : if( FD_UNLIKELY( err ) ) return err;
16064 0 : err = fd_archive_encode_set_length( ctx, offset );
16065 0 : if( FD_UNLIKELY( err ) ) return err;
16066 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_capitalization_TAG, ctx );
16067 0 : if( FD_UNLIKELY( err ) ) return err;
16068 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
16069 0 : if( FD_UNLIKELY( err ) ) return err;
16070 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_block_height_TAG, ctx );
16071 0 : if( FD_UNLIKELY( err ) ) return err;
16072 0 : err = fd_bincode_uint64_encode( self->block_height, ctx );
16073 0 : if( FD_UNLIKELY( err ) ) return err;
16074 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_max_tick_height_TAG, ctx );
16075 0 : if( FD_UNLIKELY( err ) ) return err;
16076 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
16077 0 : if( FD_UNLIKELY( err ) ) return err;
16078 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_collected_execution_fees_TAG, ctx );
16079 0 : if( FD_UNLIKELY( err ) ) return err;
16080 0 : err = fd_bincode_uint64_encode( self->collected_execution_fees, ctx );
16081 0 : if( FD_UNLIKELY( err ) ) return err;
16082 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_collected_priority_fees_TAG, ctx );
16083 0 : if( FD_UNLIKELY( err ) ) return err;
16084 0 : err = fd_bincode_uint64_encode( self->collected_priority_fees, ctx );
16085 0 : if( FD_UNLIKELY( err ) ) return err;
16086 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_collected_rent_TAG, ctx );
16087 0 : if( FD_UNLIKELY( err ) ) return err;
16088 0 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
16089 0 : if( FD_UNLIKELY( err ) ) return err;
16090 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_epoch_stakes_TAG, ctx );
16091 0 : if( FD_UNLIKELY( err ) ) return err;
16092 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16093 0 : if( FD_UNLIKELY( err ) ) return err;
16094 0 : err = fd_vote_accounts_encode_archival( &self->epoch_stakes, ctx );
16095 0 : if( FD_UNLIKELY( err ) ) return err;
16096 0 : err = fd_archive_encode_set_length( ctx, offset );
16097 0 : if( FD_UNLIKELY( err ) ) return err;
16098 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_last_restart_slot_TAG, ctx );
16099 0 : if( FD_UNLIKELY( err ) ) return err;
16100 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16101 0 : if( FD_UNLIKELY( err ) ) return err;
16102 0 : err = fd_sol_sysvar_last_restart_slot_encode_archival( &self->last_restart_slot, ctx );
16103 0 : if( FD_UNLIKELY( err ) ) return err;
16104 0 : err = fd_archive_encode_set_length( ctx, offset );
16105 0 : if( FD_UNLIKELY( err ) ) return err;
16106 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_stake_account_keys_TAG, ctx );
16107 0 : if( FD_UNLIKELY( err ) ) return err;
16108 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16109 0 : if( FD_UNLIKELY( err ) ) return err;
16110 0 : err = fd_stake_accounts_encode_archival( &self->stake_account_keys, ctx );
16111 0 : if( FD_UNLIKELY( err ) ) return err;
16112 0 : err = fd_archive_encode_set_length( ctx, offset );
16113 0 : if( FD_UNLIKELY( err ) ) return err;
16114 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_vote_account_keys_TAG, ctx );
16115 0 : if( FD_UNLIKELY( err ) ) return err;
16116 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16117 0 : if( FD_UNLIKELY( err ) ) return err;
16118 0 : err = fd_vote_accounts_encode_archival( &self->vote_account_keys, ctx );
16119 0 : if( FD_UNLIKELY( err ) ) return err;
16120 0 : err = fd_archive_encode_set_length( ctx, offset );
16121 0 : if( FD_UNLIKELY( err ) ) return err;
16122 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_lamports_per_signature_TAG, ctx );
16123 0 : if( FD_UNLIKELY( err ) ) return err;
16124 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
16125 0 : if( FD_UNLIKELY( err ) ) return err;
16126 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_transaction_count_TAG, ctx );
16127 0 : if( FD_UNLIKELY( err ) ) return err;
16128 0 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
16129 0 : if( FD_UNLIKELY( err ) ) return err;
16130 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_lthash_TAG, ctx );
16131 0 : if( FD_UNLIKELY( err ) ) return err;
16132 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16133 0 : if( FD_UNLIKELY( err ) ) return err;
16134 0 : err = fd_slot_lthash_encode_archival( &self->lthash, ctx );
16135 0 : if( FD_UNLIKELY( err ) ) return err;
16136 0 : err = fd_archive_encode_set_length( ctx, offset );
16137 0 : if( FD_UNLIKELY( err ) ) return err;
16138 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_block_hash_queue_TAG, ctx );
16139 0 : if( FD_UNLIKELY( err ) ) return err;
16140 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16141 0 : if( FD_UNLIKELY( err ) ) return err;
16142 0 : err = fd_block_hash_queue_encode_archival( &self->block_hash_queue, ctx );
16143 0 : if( FD_UNLIKELY( err ) ) return err;
16144 0 : err = fd_archive_encode_set_length( ctx, offset );
16145 0 : if( FD_UNLIKELY( err ) ) return err;
16146 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_prev_banks_hash_TAG, ctx );
16147 0 : if( FD_UNLIKELY( err ) ) return err;
16148 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16149 0 : if( FD_UNLIKELY( err ) ) return err;
16150 0 : err = fd_hash_encode_archival( &self->prev_banks_hash, ctx );
16151 0 : if( FD_UNLIKELY( err ) ) return err;
16152 0 : err = fd_archive_encode_set_length( ctx, offset );
16153 0 : if( FD_UNLIKELY( err ) ) return err;
16154 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_parent_signature_cnt_TAG, ctx );
16155 0 : if( FD_UNLIKELY( err ) ) return err;
16156 0 : err = fd_bincode_uint64_encode( self->parent_signature_cnt, ctx );
16157 0 : if( FD_UNLIKELY( err ) ) return err;
16158 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_tick_height_TAG, ctx );
16159 0 : if( FD_UNLIKELY( err ) ) return err;
16160 0 : err = fd_bincode_uint64_encode( self->tick_height, ctx );
16161 0 : if( FD_UNLIKELY( err ) ) return err;
16162 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_use_preceeding_epoch_stakes_TAG, ctx );
16163 0 : if( FD_UNLIKELY( err ) ) return err;
16164 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16165 0 : if( FD_UNLIKELY( err ) ) return err;
16166 0 : err = fd_bincode_bool_encode( self->has_use_preceeding_epoch_stakes, ctx );
16167 0 : if( FD_UNLIKELY( err ) ) return err;
16168 0 : if( self->has_use_preceeding_epoch_stakes ) {
16169 0 : err = fd_bincode_uint64_encode( self->use_preceeding_epoch_stakes, ctx );
16170 0 : if( FD_UNLIKELY( err ) ) return err;
16171 0 : }
16172 0 : err = fd_archive_encode_set_length( ctx, offset );
16173 0 : if( FD_UNLIKELY( err ) ) return err;
16174 0 : err = fd_bincode_uint16_encode( (ushort)fd_slot_bank_hard_forks_TAG, ctx );
16175 0 : if( FD_UNLIKELY( err ) ) return err;
16176 0 : err = fd_archive_encode_setup_length( ctx, &offset );
16177 0 : if( FD_UNLIKELY( err ) ) return err;
16178 0 : err = fd_hard_forks_encode_archival( &self->hard_forks, ctx );
16179 0 : if( FD_UNLIKELY( err ) ) return err;
16180 0 : err = fd_archive_encode_set_length( ctx, offset );
16181 0 : if( FD_UNLIKELY( err ) ) return err;
16182 0 : err = fd_bincode_uint16_encode( FD_ARCHIVE_META_SENTINAL, ctx );
16183 0 : if( FD_UNLIKELY( err ) ) return err;
16184 0 : return FD_BINCODE_SUCCESS;
16185 0 : }
16186 0 : int fd_slot_bank_decode_offsets( fd_slot_bank_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
16187 0 : uchar const * data = ctx->data;
16188 0 : int err;
16189 0 : self->recent_block_hashes_off = (uint)( (ulong)ctx->data - (ulong)data );
16190 0 : err = fd_recent_block_hashes_decode_preflight( ctx );
16191 0 : if( FD_UNLIKELY( err ) ) return err;
16192 0 : self->timestamp_votes_off = (uint)( (ulong)ctx->data - (ulong)data );
16193 0 : err = fd_clock_timestamp_votes_decode_preflight( ctx );
16194 0 : if( FD_UNLIKELY( err ) ) return err;
16195 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
16196 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16197 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16198 0 : self->prev_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
16199 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16200 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16201 0 : self->poh_off = (uint)( (ulong)ctx->data - (ulong)data );
16202 0 : err = fd_hash_decode_preflight( ctx );
16203 0 : if( FD_UNLIKELY( err ) ) return err;
16204 0 : self->banks_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
16205 0 : err = fd_hash_decode_preflight( ctx );
16206 0 : if( FD_UNLIKELY( err ) ) return err;
16207 0 : self->epoch_account_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
16208 0 : err = fd_hash_decode_preflight( ctx );
16209 0 : if( FD_UNLIKELY( err ) ) return err;
16210 0 : self->fee_rate_governor_off = (uint)( (ulong)ctx->data - (ulong)data );
16211 0 : err = fd_fee_rate_governor_decode_preflight( ctx );
16212 0 : if( FD_UNLIKELY( err ) ) return err;
16213 0 : self->capitalization_off = (uint)( (ulong)ctx->data - (ulong)data );
16214 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16215 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16216 0 : self->block_height_off = (uint)( (ulong)ctx->data - (ulong)data );
16217 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16218 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16219 0 : self->max_tick_height_off = (uint)( (ulong)ctx->data - (ulong)data );
16220 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16221 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16222 0 : self->collected_execution_fees_off = (uint)( (ulong)ctx->data - (ulong)data );
16223 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16224 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16225 0 : self->collected_priority_fees_off = (uint)( (ulong)ctx->data - (ulong)data );
16226 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16227 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16228 0 : self->collected_rent_off = (uint)( (ulong)ctx->data - (ulong)data );
16229 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16230 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16231 0 : self->epoch_stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
16232 0 : err = fd_vote_accounts_decode_preflight( ctx );
16233 0 : if( FD_UNLIKELY( err ) ) return err;
16234 0 : self->last_restart_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
16235 0 : err = fd_sol_sysvar_last_restart_slot_decode_preflight( ctx );
16236 0 : if( FD_UNLIKELY( err ) ) return err;
16237 0 : self->stake_account_keys_off = (uint)( (ulong)ctx->data - (ulong)data );
16238 0 : err = fd_stake_accounts_decode_preflight( ctx );
16239 0 : if( FD_UNLIKELY( err ) ) return err;
16240 0 : self->vote_account_keys_off = (uint)( (ulong)ctx->data - (ulong)data );
16241 0 : err = fd_vote_accounts_decode_preflight( ctx );
16242 0 : if( FD_UNLIKELY( err ) ) return err;
16243 0 : self->lamports_per_signature_off = (uint)( (ulong)ctx->data - (ulong)data );
16244 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16245 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16246 0 : self->transaction_count_off = (uint)( (ulong)ctx->data - (ulong)data );
16247 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16248 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16249 0 : self->lthash_off = (uint)( (ulong)ctx->data - (ulong)data );
16250 0 : err = fd_slot_lthash_decode_preflight( ctx );
16251 0 : if( FD_UNLIKELY( err ) ) return err;
16252 0 : self->block_hash_queue_off = (uint)( (ulong)ctx->data - (ulong)data );
16253 0 : err = fd_block_hash_queue_decode_preflight( ctx );
16254 0 : if( FD_UNLIKELY( err ) ) return err;
16255 0 : self->prev_banks_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
16256 0 : err = fd_hash_decode_preflight( ctx );
16257 0 : if( FD_UNLIKELY( err ) ) return err;
16258 0 : self->parent_signature_cnt_off = (uint)( (ulong)ctx->data - (ulong)data );
16259 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16260 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16261 0 : self->tick_height_off = (uint)( (ulong)ctx->data - (ulong)data );
16262 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16263 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16264 0 : self->use_preceeding_epoch_stakes_off = (uint)( (ulong)ctx->data - (ulong)data );
16265 0 : {
16266 0 : uchar o;
16267 0 : err = fd_bincode_bool_decode( &o, ctx );
16268 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16269 0 : if( o ) {
16270 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16271 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16272 0 : }
16273 0 : }
16274 0 : self->hard_forks_off = (uint)( (ulong)ctx->data - (ulong)data );
16275 0 : err = fd_hard_forks_decode_preflight( ctx );
16276 0 : if( FD_UNLIKELY( err ) ) return err;
16277 0 : return FD_BINCODE_SUCCESS;
16278 0 : }
16279 815718 : void fd_slot_bank_new(fd_slot_bank_t * self) {
16280 815718 : fd_memset( self, 0, sizeof(fd_slot_bank_t) );
16281 815718 : fd_recent_block_hashes_new( &self->recent_block_hashes );
16282 815718 : fd_clock_timestamp_votes_new( &self->timestamp_votes );
16283 815718 : fd_hash_new( &self->poh );
16284 815718 : fd_hash_new( &self->banks_hash );
16285 815718 : fd_hash_new( &self->epoch_account_hash );
16286 815718 : fd_fee_rate_governor_new( &self->fee_rate_governor );
16287 815718 : fd_vote_accounts_new( &self->epoch_stakes );
16288 815718 : fd_sol_sysvar_last_restart_slot_new( &self->last_restart_slot );
16289 815718 : fd_stake_accounts_new( &self->stake_account_keys );
16290 815718 : fd_vote_accounts_new( &self->vote_account_keys );
16291 815718 : fd_slot_lthash_new( &self->lthash );
16292 815718 : fd_block_hash_queue_new( &self->block_hash_queue );
16293 815718 : fd_hash_new( &self->prev_banks_hash );
16294 815718 : fd_hard_forks_new( &self->hard_forks );
16295 815718 : }
16296 815718 : void fd_slot_bank_destroy( fd_slot_bank_t * self, fd_bincode_destroy_ctx_t * ctx ) {
16297 815718 : fd_recent_block_hashes_destroy( &self->recent_block_hashes, ctx );
16298 815718 : fd_clock_timestamp_votes_destroy( &self->timestamp_votes, ctx );
16299 815718 : fd_hash_destroy( &self->poh, ctx );
16300 815718 : fd_hash_destroy( &self->banks_hash, ctx );
16301 815718 : fd_hash_destroy( &self->epoch_account_hash, ctx );
16302 815718 : fd_fee_rate_governor_destroy( &self->fee_rate_governor, ctx );
16303 815718 : fd_vote_accounts_destroy( &self->epoch_stakes, ctx );
16304 815718 : fd_sol_sysvar_last_restart_slot_destroy( &self->last_restart_slot, ctx );
16305 815718 : fd_stake_accounts_destroy( &self->stake_account_keys, ctx );
16306 815718 : fd_vote_accounts_destroy( &self->vote_account_keys, ctx );
16307 815718 : fd_slot_lthash_destroy( &self->lthash, ctx );
16308 815718 : fd_block_hash_queue_destroy( &self->block_hash_queue, ctx );
16309 815718 : fd_hash_destroy( &self->prev_banks_hash, ctx );
16310 815718 : if( self->has_use_preceeding_epoch_stakes ) {
16311 0 : self->has_use_preceeding_epoch_stakes = 0;
16312 0 : }
16313 815718 : fd_hard_forks_destroy( &self->hard_forks, ctx );
16314 815718 : }
16315 :
16316 0 : ulong fd_slot_bank_footprint( void ){ return FD_SLOT_BANK_FOOTPRINT; }
16317 0 : ulong fd_slot_bank_align( void ){ return FD_SLOT_BANK_ALIGN; }
16318 :
16319 0 : void fd_slot_bank_walk( void * w, fd_slot_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16320 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_bank", level++ );
16321 0 : fd_recent_block_hashes_walk( w, &self->recent_block_hashes, fun, "recent_block_hashes", level );
16322 0 : fd_clock_timestamp_votes_walk( w, &self->timestamp_votes, fun, "timestamp_votes", level );
16323 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16324 0 : fun( w, &self->prev_slot, "prev_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16325 0 : fd_hash_walk( w, &self->poh, fun, "poh", level );
16326 0 : fd_hash_walk( w, &self->banks_hash, fun, "banks_hash", level );
16327 0 : fd_hash_walk( w, &self->epoch_account_hash, fun, "epoch_account_hash", level );
16328 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level );
16329 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16330 0 : fun( w, &self->block_height, "block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16331 0 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16332 0 : fun( w, &self->collected_execution_fees, "collected_execution_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16333 0 : fun( w, &self->collected_priority_fees, "collected_priority_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16334 0 : fun( w, &self->collected_rent, "collected_rent", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16335 0 : fd_vote_accounts_walk( w, &self->epoch_stakes, fun, "epoch_stakes", level );
16336 0 : fd_sol_sysvar_last_restart_slot_walk( w, &self->last_restart_slot, fun, "last_restart_slot", level );
16337 0 : fd_stake_accounts_walk( w, &self->stake_account_keys, fun, "stake_account_keys", level );
16338 0 : fd_vote_accounts_walk( w, &self->vote_account_keys, fun, "vote_account_keys", level );
16339 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16340 0 : fun( w, &self->transaction_count, "transaction_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16341 0 : fd_slot_lthash_walk( w, &self->lthash, fun, "lthash", level );
16342 0 : fd_block_hash_queue_walk( w, &self->block_hash_queue, fun, "block_hash_queue", level );
16343 0 : fd_hash_walk( w, &self->prev_banks_hash, fun, "prev_banks_hash", level );
16344 0 : fun( w, &self->parent_signature_cnt, "parent_signature_cnt", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16345 0 : fun( w, &self->tick_height, "tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16346 0 : if( !self->has_use_preceeding_epoch_stakes ) {
16347 0 : fun( w, NULL, "use_preceeding_epoch_stakes", FD_FLAMENCO_TYPE_NULL, "ulong", level );
16348 0 : } else {
16349 0 : fun( w, &self->use_preceeding_epoch_stakes, "use_preceeding_epoch_stakes", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16350 0 : }
16351 0 : fd_hard_forks_walk( w, &self->hard_forks, fun, "hard_forks", level );
16352 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_bank", level-- );
16353 0 : }
16354 0 : ulong fd_slot_bank_size( fd_slot_bank_t const * self ) {
16355 0 : ulong size = 0;
16356 0 : size += fd_recent_block_hashes_size( &self->recent_block_hashes );
16357 0 : size += fd_clock_timestamp_votes_size( &self->timestamp_votes );
16358 0 : size += sizeof(ulong);
16359 0 : size += sizeof(ulong);
16360 0 : size += fd_hash_size( &self->poh );
16361 0 : size += fd_hash_size( &self->banks_hash );
16362 0 : size += fd_hash_size( &self->epoch_account_hash );
16363 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
16364 0 : size += sizeof(ulong);
16365 0 : size += sizeof(ulong);
16366 0 : size += sizeof(ulong);
16367 0 : size += sizeof(ulong);
16368 0 : size += sizeof(ulong);
16369 0 : size += sizeof(ulong);
16370 0 : size += fd_vote_accounts_size( &self->epoch_stakes );
16371 0 : size += fd_sol_sysvar_last_restart_slot_size( &self->last_restart_slot );
16372 0 : size += fd_stake_accounts_size( &self->stake_account_keys );
16373 0 : size += fd_vote_accounts_size( &self->vote_account_keys );
16374 0 : size += sizeof(ulong);
16375 0 : size += sizeof(ulong);
16376 0 : size += fd_slot_lthash_size( &self->lthash );
16377 0 : size += fd_block_hash_queue_size( &self->block_hash_queue );
16378 0 : size += fd_hash_size( &self->prev_banks_hash );
16379 0 : size += sizeof(ulong);
16380 0 : size += sizeof(ulong);
16381 0 : size += sizeof(char);
16382 0 : if( self->has_use_preceeding_epoch_stakes ) {
16383 0 : size += sizeof(ulong);
16384 0 : }
16385 0 : size += fd_hard_forks_size( &self->hard_forks );
16386 0 : return size;
16387 0 : }
16388 :
16389 0 : int fd_prev_epoch_inflation_rewards_decode( fd_prev_epoch_inflation_rewards_t * self, fd_bincode_decode_ctx_t * ctx ) {
16390 0 : void const * data = ctx->data;
16391 0 : int err = fd_prev_epoch_inflation_rewards_decode_preflight( ctx );
16392 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16393 0 : ctx->data = data;
16394 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
16395 0 : fd_prev_epoch_inflation_rewards_new( self );
16396 0 : }
16397 0 : fd_prev_epoch_inflation_rewards_decode_unsafe( self, ctx );
16398 0 : return FD_BINCODE_SUCCESS;
16399 0 : }
16400 0 : int fd_prev_epoch_inflation_rewards_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
16401 0 : return fd_bincode_bytes_decode_preflight( 32, ctx );
16402 0 : }
16403 0 : void fd_prev_epoch_inflation_rewards_decode_unsafe( fd_prev_epoch_inflation_rewards_t * self, fd_bincode_decode_ctx_t * ctx ) {
16404 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
16405 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
16406 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
16407 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
16408 0 : }
16409 0 : int fd_prev_epoch_inflation_rewards_encode( fd_prev_epoch_inflation_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16410 0 : int err;
16411 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
16412 0 : if( FD_UNLIKELY( err ) ) return err;
16413 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
16414 0 : if( FD_UNLIKELY( err ) ) return err;
16415 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
16416 0 : if( FD_UNLIKELY( err ) ) return err;
16417 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
16418 0 : if( FD_UNLIKELY( err ) ) return err;
16419 0 : return FD_BINCODE_SUCCESS;
16420 0 : }
16421 0 : int fd_prev_epoch_inflation_rewards_decode_offsets( fd_prev_epoch_inflation_rewards_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
16422 0 : uchar const * data = ctx->data;
16423 0 : int err;
16424 0 : self->validator_rewards_off = (uint)( (ulong)ctx->data - (ulong)data );
16425 0 : err = fd_bincode_uint64_decode_preflight( ctx );
16426 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16427 0 : self->prev_epoch_duration_in_years_off = (uint)( (ulong)ctx->data - (ulong)data );
16428 0 : err = fd_bincode_double_decode_preflight( ctx );
16429 0 : if( FD_UNLIKELY( err ) ) return err;
16430 0 : self->validator_rate_off = (uint)( (ulong)ctx->data - (ulong)data );
16431 0 : err = fd_bincode_double_decode_preflight( ctx );
16432 0 : if( FD_UNLIKELY( err ) ) return err;
16433 0 : self->foundation_rate_off = (uint)( (ulong)ctx->data - (ulong)data );
16434 0 : err = fd_bincode_double_decode_preflight( ctx );
16435 0 : if( FD_UNLIKELY( err ) ) return err;
16436 0 : return FD_BINCODE_SUCCESS;
16437 0 : }
16438 0 : void fd_prev_epoch_inflation_rewards_new(fd_prev_epoch_inflation_rewards_t * self) {
16439 0 : fd_memset( self, 0, sizeof(fd_prev_epoch_inflation_rewards_t) );
16440 0 : }
16441 0 : void fd_prev_epoch_inflation_rewards_destroy( fd_prev_epoch_inflation_rewards_t * self, fd_bincode_destroy_ctx_t * ctx ) {
16442 0 : }
16443 :
16444 0 : ulong fd_prev_epoch_inflation_rewards_footprint( void ){ return FD_PREV_EPOCH_INFLATION_REWARDS_FOOTPRINT; }
16445 0 : ulong fd_prev_epoch_inflation_rewards_align( void ){ return FD_PREV_EPOCH_INFLATION_REWARDS_ALIGN; }
16446 :
16447 0 : void fd_prev_epoch_inflation_rewards_walk( void * w, fd_prev_epoch_inflation_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16448 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_prev_epoch_inflation_rewards", level++ );
16449 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
16450 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
16451 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
16452 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level );
16453 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_prev_epoch_inflation_rewards", level-- );
16454 0 : }
16455 0 : ulong fd_prev_epoch_inflation_rewards_size( fd_prev_epoch_inflation_rewards_t const * self ) {
16456 0 : ulong size = 0;
16457 0 : size += sizeof(ulong);
16458 0 : size += sizeof(double);
16459 0 : size += sizeof(double);
16460 0 : size += sizeof(double);
16461 0 : return size;
16462 0 : }
16463 :
16464 0 : int fd_vote_decode( fd_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
16465 0 : void const * data = ctx->data;
16466 0 : int err = fd_vote_decode_preflight( ctx );
16467 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16468 0 : ctx->data = data;
16469 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
16470 0 : fd_vote_new( self );
16471 0 : }
16472 0 : fd_vote_decode_unsafe( self, ctx );
16473 0 : return FD_BINCODE_SUCCESS;
16474 0 : }
16475 1404 : int fd_vote_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
16476 1404 : int err;
16477 1404 : ulong slots_len;
16478 1404 : err = fd_bincode_uint64_decode( &slots_len, ctx );
16479 1404 : if( FD_UNLIKELY( err ) ) return err;
16480 1392 : ulong slots_sz;
16481 1392 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
16482 1383 : err = fd_bincode_bytes_decode_preflight( slots_sz, ctx );
16483 1383 : if( FD_UNLIKELY( err ) ) return err;
16484 1371 : err = fd_hash_decode_preflight( ctx );
16485 1371 : if( FD_UNLIKELY( err ) ) return err;
16486 1356 : {
16487 1356 : uchar o;
16488 1356 : err = fd_bincode_bool_decode( &o, ctx );
16489 1356 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16490 1326 : if( o ) {
16491 639 : err = fd_bincode_int64_decode_preflight( ctx );
16492 639 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16493 639 : }
16494 1326 : }
16495 1314 : return FD_BINCODE_SUCCESS;
16496 1326 : }
16497 1308 : void fd_vote_decode_unsafe( fd_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
16498 1308 : ulong slots_len;
16499 1308 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
16500 1308 : self->slots = deq_ulong_alloc( ctx->valloc, slots_len );
16501 24498 : for( ulong i=0; i < slots_len; i++ ) {
16502 23190 : ulong * elem = deq_ulong_push_tail_nocopy( self->slots );
16503 23190 : fd_bincode_uint64_decode_unsafe( elem, ctx );
16504 23190 : }
16505 1308 : fd_hash_decode_unsafe( &self->hash, ctx );
16506 1308 : {
16507 1308 : uchar o;
16508 1308 : fd_bincode_bool_decode_unsafe( &o, ctx );
16509 1308 : if( o ) {
16510 627 : self->timestamp = fd_valloc_malloc( ctx->valloc, 8, sizeof(long) );
16511 627 : fd_bincode_int64_decode_unsafe( self->timestamp, ctx );
16512 627 : } else
16513 681 : self->timestamp = NULL;
16514 1308 : }
16515 1308 : }
16516 0 : int fd_vote_encode( fd_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16517 0 : int err;
16518 0 : if( self->slots ) {
16519 0 : ulong slots_len = deq_ulong_cnt( self->slots );
16520 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
16521 0 : if( FD_UNLIKELY( err ) ) return err;
16522 0 : for( deq_ulong_iter_t iter = deq_ulong_iter_init( self->slots ); !deq_ulong_iter_done( self->slots, iter ); iter = deq_ulong_iter_next( self->slots, iter ) ) {
16523 0 : ulong const * ele = deq_ulong_iter_ele_const( self->slots, iter );
16524 0 : err = fd_bincode_uint64_encode( ele[0], ctx );
16525 0 : }
16526 0 : } else {
16527 0 : ulong slots_len = 0;
16528 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
16529 0 : if( FD_UNLIKELY( err ) ) return err;
16530 0 : }
16531 0 : err = fd_hash_encode( &self->hash, ctx );
16532 0 : if( FD_UNLIKELY( err ) ) return err;
16533 0 : if( self->timestamp != NULL ) {
16534 0 : err = fd_bincode_bool_encode( 1, ctx );
16535 0 : if( FD_UNLIKELY( err ) ) return err;
16536 0 : err = fd_bincode_int64_encode( self->timestamp[0], ctx );
16537 0 : if( FD_UNLIKELY( err ) ) return err;
16538 0 : } else {
16539 0 : err = fd_bincode_bool_encode( 0, ctx );
16540 0 : if( FD_UNLIKELY( err ) ) return err;
16541 0 : }
16542 0 : return FD_BINCODE_SUCCESS;
16543 0 : }
16544 0 : int fd_vote_decode_offsets( fd_vote_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
16545 0 : uchar const * data = ctx->data;
16546 0 : int err;
16547 0 : self->slots_off = (uint)( (ulong)ctx->data - (ulong)data );
16548 0 : ulong slots_len;
16549 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
16550 0 : if( FD_UNLIKELY( err ) ) return err;
16551 0 : ulong slots_sz;
16552 0 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
16553 0 : err = fd_bincode_bytes_decode_preflight( slots_sz, ctx );
16554 0 : if( FD_UNLIKELY( err ) ) return err;
16555 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
16556 0 : err = fd_hash_decode_preflight( ctx );
16557 0 : if( FD_UNLIKELY( err ) ) return err;
16558 0 : self->timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
16559 0 : {
16560 0 : uchar o;
16561 0 : err = fd_bincode_bool_decode( &o, ctx );
16562 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16563 0 : if( o ) {
16564 0 : err = fd_bincode_int64_decode_preflight( ctx );
16565 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16566 0 : }
16567 0 : }
16568 0 : return FD_BINCODE_SUCCESS;
16569 0 : }
16570 0 : void fd_vote_new(fd_vote_t * self) {
16571 0 : fd_memset( self, 0, sizeof(fd_vote_t) );
16572 0 : fd_hash_new( &self->hash );
16573 0 : }
16574 0 : void fd_vote_destroy( fd_vote_t * self, fd_bincode_destroy_ctx_t * ctx ) {
16575 0 : if( self->slots ) {
16576 0 : fd_valloc_free( ctx->valloc, deq_ulong_delete( deq_ulong_leave( self->slots) ) );
16577 0 : self->slots = NULL;
16578 0 : }
16579 0 : fd_hash_destroy( &self->hash, ctx );
16580 0 : if( self->timestamp ) {
16581 0 : fd_valloc_free( ctx->valloc, self->timestamp );
16582 0 : self->timestamp = NULL;
16583 0 : }
16584 0 : }
16585 :
16586 0 : ulong fd_vote_footprint( void ){ return FD_VOTE_FOOTPRINT; }
16587 0 : ulong fd_vote_align( void ){ return FD_VOTE_ALIGN; }
16588 :
16589 0 : void fd_vote_walk( void * w, fd_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16590 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote", level++ );
16591 :
16592 : /* Walk deque */
16593 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR, "slots", level++ );
16594 0 : if( self->slots ) {
16595 0 : for( deq_ulong_iter_t iter = deq_ulong_iter_init( self->slots );
16596 0 : !deq_ulong_iter_done( self->slots, iter );
16597 0 : iter = deq_ulong_iter_next( self->slots, iter ) ) {
16598 0 : ulong * ele = deq_ulong_iter_ele( self->slots, iter );
16599 0 : fun(w, ele, "ele", FD_FLAMENCO_TYPE_ULONG, "long", level );
16600 0 : }
16601 0 : }
16602 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR_END, "slots", level-- );
16603 : /* Done walking deque */
16604 :
16605 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
16606 0 : if( !self->timestamp ) {
16607 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
16608 0 : } else {
16609 0 : fun( w, self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
16610 0 : }
16611 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote", level-- );
16612 0 : }
16613 0 : ulong fd_vote_size( fd_vote_t const * self ) {
16614 0 : ulong size = 0;
16615 0 : if( self->slots ) {
16616 0 : size += sizeof(ulong);
16617 0 : ulong slots_len = deq_ulong_cnt(self->slots);
16618 0 : size += slots_len * sizeof(ulong);
16619 0 : } else {
16620 0 : size += sizeof(ulong);
16621 0 : }
16622 0 : size += fd_hash_size( &self->hash );
16623 0 : size += sizeof(char);
16624 0 : if( NULL != self->timestamp ) {
16625 0 : size += sizeof(long);
16626 0 : }
16627 0 : return size;
16628 0 : }
16629 :
16630 0 : int fd_vote_init_decode( fd_vote_init_t * self, fd_bincode_decode_ctx_t * ctx ) {
16631 0 : void const * data = ctx->data;
16632 0 : int err = fd_vote_init_decode_preflight( ctx );
16633 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16634 0 : ctx->data = data;
16635 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
16636 0 : fd_vote_init_new( self );
16637 0 : }
16638 0 : fd_vote_init_decode_unsafe( self, ctx );
16639 0 : return FD_BINCODE_SUCCESS;
16640 0 : }
16641 447 : int fd_vote_init_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
16642 447 : return fd_bincode_bytes_decode_preflight( 97, ctx );
16643 447 : }
16644 279 : void fd_vote_init_decode_unsafe( fd_vote_init_t * self, fd_bincode_decode_ctx_t * ctx ) {
16645 279 : fd_pubkey_decode_unsafe( &self->node_pubkey, ctx );
16646 279 : fd_pubkey_decode_unsafe( &self->authorized_voter, ctx );
16647 279 : fd_pubkey_decode_unsafe( &self->authorized_withdrawer, ctx );
16648 279 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
16649 279 : }
16650 0 : int fd_vote_init_encode( fd_vote_init_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16651 0 : int err;
16652 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
16653 0 : if( FD_UNLIKELY( err ) ) return err;
16654 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
16655 0 : if( FD_UNLIKELY( err ) ) return err;
16656 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
16657 0 : if( FD_UNLIKELY( err ) ) return err;
16658 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
16659 0 : if( FD_UNLIKELY( err ) ) return err;
16660 0 : return FD_BINCODE_SUCCESS;
16661 0 : }
16662 0 : int fd_vote_init_decode_offsets( fd_vote_init_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
16663 0 : uchar const * data = ctx->data;
16664 0 : int err;
16665 0 : self->node_pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
16666 0 : err = fd_pubkey_decode_preflight( ctx );
16667 0 : if( FD_UNLIKELY( err ) ) return err;
16668 0 : self->authorized_voter_off = (uint)( (ulong)ctx->data - (ulong)data );
16669 0 : err = fd_pubkey_decode_preflight( ctx );
16670 0 : if( FD_UNLIKELY( err ) ) return err;
16671 0 : self->authorized_withdrawer_off = (uint)( (ulong)ctx->data - (ulong)data );
16672 0 : err = fd_pubkey_decode_preflight( ctx );
16673 0 : if( FD_UNLIKELY( err ) ) return err;
16674 0 : self->commission_off = (uint)( (ulong)ctx->data - (ulong)data );
16675 0 : err = fd_bincode_uint8_decode_preflight( ctx );
16676 0 : if( FD_UNLIKELY( err ) ) return err;
16677 0 : return FD_BINCODE_SUCCESS;
16678 0 : }
16679 0 : void fd_vote_init_new(fd_vote_init_t * self) {
16680 0 : fd_memset( self, 0, sizeof(fd_vote_init_t) );
16681 0 : fd_pubkey_new( &self->node_pubkey );
16682 0 : fd_pubkey_new( &self->authorized_voter );
16683 0 : fd_pubkey_new( &self->authorized_withdrawer );
16684 0 : }
16685 0 : void fd_vote_init_destroy( fd_vote_init_t * self, fd_bincode_destroy_ctx_t * ctx ) {
16686 0 : fd_pubkey_destroy( &self->node_pubkey, ctx );
16687 0 : fd_pubkey_destroy( &self->authorized_voter, ctx );
16688 0 : fd_pubkey_destroy( &self->authorized_withdrawer, ctx );
16689 0 : }
16690 :
16691 0 : ulong fd_vote_init_footprint( void ){ return FD_VOTE_INIT_FOOTPRINT; }
16692 0 : ulong fd_vote_init_align( void ){ return FD_VOTE_INIT_ALIGN; }
16693 :
16694 0 : void fd_vote_init_walk( void * w, fd_vote_init_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16695 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_init", level++ );
16696 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level );
16697 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level );
16698 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level );
16699 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
16700 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_init", level-- );
16701 0 : }
16702 0 : ulong fd_vote_init_size( fd_vote_init_t const * self ) {
16703 0 : ulong size = 0;
16704 0 : size += fd_pubkey_size( &self->node_pubkey );
16705 0 : size += fd_pubkey_size( &self->authorized_voter );
16706 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
16707 0 : size += sizeof(char);
16708 0 : return size;
16709 0 : }
16710 :
16711 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter(fd_vote_authorize_t const * self) {
16712 0 : return self->discriminant == 0;
16713 0 : }
16714 0 : FD_FN_PURE uchar fd_vote_authorize_is_withdrawer(fd_vote_authorize_t const * self) {
16715 0 : return self->discriminant == 1;
16716 0 : }
16717 : void fd_vote_authorize_inner_new( fd_vote_authorize_inner_t * self, uint discriminant );
16718 3423 : int fd_vote_authorize_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
16719 3423 : int err;
16720 3423 : switch (discriminant) {
16721 1959 : case 0: {
16722 1959 : return FD_BINCODE_SUCCESS;
16723 0 : }
16724 1431 : case 1: {
16725 1431 : return FD_BINCODE_SUCCESS;
16726 0 : }
16727 33 : default: return FD_BINCODE_ERR_ENCODING;
16728 3423 : }
16729 3423 : }
16730 2487 : void fd_vote_authorize_inner_decode_unsafe( fd_vote_authorize_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
16731 2487 : switch (discriminant) {
16732 1494 : case 0: {
16733 1494 : break;
16734 0 : }
16735 993 : case 1: {
16736 993 : break;
16737 0 : }
16738 2487 : }
16739 2487 : }
16740 0 : int fd_vote_authorize_decode( fd_vote_authorize_t * self, fd_bincode_decode_ctx_t * ctx ) {
16741 0 : void const * data = ctx->data;
16742 0 : int err = fd_vote_authorize_decode_preflight( ctx );
16743 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16744 0 : ctx->data = data;
16745 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
16746 0 : fd_vote_authorize_new( self );
16747 0 : }
16748 0 : fd_vote_authorize_decode_unsafe( self, ctx );
16749 0 : return FD_BINCODE_SUCCESS;
16750 0 : }
16751 3447 : int fd_vote_authorize_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
16752 3447 : uint discriminant = 0;
16753 3447 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
16754 3447 : if( FD_UNLIKELY( err ) ) return err;
16755 3423 : return fd_vote_authorize_inner_decode_preflight( discriminant, ctx );
16756 3447 : }
16757 2487 : void fd_vote_authorize_decode_unsafe( fd_vote_authorize_t * self, fd_bincode_decode_ctx_t * ctx ) {
16758 2487 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16759 2487 : fd_vote_authorize_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
16760 2487 : }
16761 0 : void fd_vote_authorize_inner_new( fd_vote_authorize_inner_t * self, uint discriminant ) {
16762 0 : switch( discriminant ) {
16763 0 : case 0: {
16764 0 : break;
16765 0 : }
16766 0 : case 1: {
16767 0 : break;
16768 0 : }
16769 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
16770 0 : }
16771 0 : }
16772 0 : void fd_vote_authorize_new_disc( fd_vote_authorize_t * self, uint discriminant ) {
16773 0 : self->discriminant = discriminant;
16774 0 : fd_vote_authorize_inner_new( &self->inner, self->discriminant );
16775 0 : }
16776 0 : void fd_vote_authorize_new( fd_vote_authorize_t * self ) {
16777 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_t) );
16778 0 : fd_vote_authorize_new_disc( self, UINT_MAX );
16779 0 : }
16780 0 : void fd_vote_authorize_inner_destroy( fd_vote_authorize_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
16781 0 : switch( discriminant ) {
16782 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
16783 0 : }
16784 0 : }
16785 0 : void fd_vote_authorize_destroy( fd_vote_authorize_t * self, fd_bincode_destroy_ctx_t * ctx ) {
16786 0 : fd_vote_authorize_inner_destroy( &self->inner, self->discriminant, ctx );
16787 0 : }
16788 :
16789 0 : ulong fd_vote_authorize_footprint( void ){ return FD_VOTE_AUTHORIZE_FOOTPRINT; }
16790 0 : ulong fd_vote_authorize_align( void ){ return FD_VOTE_AUTHORIZE_ALIGN; }
16791 :
16792 0 : void fd_vote_authorize_walk( void * w, fd_vote_authorize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16793 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_authorize", level++);
16794 0 : switch( self->discriminant ) {
16795 0 : case 0: {
16796 0 : fun( w, self, "voter", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16797 0 : break;
16798 0 : }
16799 0 : case 1: {
16800 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
16801 0 : break;
16802 0 : }
16803 0 : }
16804 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_authorize", level-- );
16805 0 : }
16806 0 : ulong fd_vote_authorize_size( fd_vote_authorize_t const * self ) {
16807 0 : ulong size = 0;
16808 0 : size += sizeof(uint);
16809 0 : switch (self->discriminant) {
16810 0 : }
16811 0 : return size;
16812 0 : }
16813 :
16814 0 : int fd_vote_authorize_inner_encode( fd_vote_authorize_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
16815 0 : return FD_BINCODE_SUCCESS;
16816 0 : }
16817 0 : int fd_vote_authorize_encode( fd_vote_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16818 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
16819 0 : if( FD_UNLIKELY( err ) ) return err;
16820 0 : return fd_vote_authorize_inner_encode( &self->inner, self->discriminant, ctx );
16821 0 : }
16822 :
16823 0 : int fd_vote_authorize_pubkey_decode( fd_vote_authorize_pubkey_t * self, fd_bincode_decode_ctx_t * ctx ) {
16824 0 : void const * data = ctx->data;
16825 0 : int err = fd_vote_authorize_pubkey_decode_preflight( ctx );
16826 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16827 0 : ctx->data = data;
16828 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
16829 0 : fd_vote_authorize_pubkey_new( self );
16830 0 : }
16831 0 : fd_vote_authorize_pubkey_decode_unsafe( self, ctx );
16832 0 : return FD_BINCODE_SUCCESS;
16833 0 : }
16834 1338 : int fd_vote_authorize_pubkey_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
16835 1338 : int err;
16836 1338 : err = fd_pubkey_decode_preflight( ctx );
16837 1338 : if( FD_UNLIKELY( err ) ) return err;
16838 1275 : err = fd_vote_authorize_decode_preflight( ctx );
16839 1275 : if( FD_UNLIKELY( err ) ) return err;
16840 1257 : return FD_BINCODE_SUCCESS;
16841 1275 : }
16842 1257 : void fd_vote_authorize_pubkey_decode_unsafe( fd_vote_authorize_pubkey_t * self, fd_bincode_decode_ctx_t * ctx ) {
16843 1257 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
16844 1257 : fd_vote_authorize_decode_unsafe( &self->vote_authorize, ctx );
16845 1257 : }
16846 0 : int fd_vote_authorize_pubkey_encode( fd_vote_authorize_pubkey_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16847 0 : int err;
16848 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
16849 0 : if( FD_UNLIKELY( err ) ) return err;
16850 0 : err = fd_vote_authorize_encode( &self->vote_authorize, ctx );
16851 0 : if( FD_UNLIKELY( err ) ) return err;
16852 0 : return FD_BINCODE_SUCCESS;
16853 0 : }
16854 0 : int fd_vote_authorize_pubkey_decode_offsets( fd_vote_authorize_pubkey_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
16855 0 : uchar const * data = ctx->data;
16856 0 : int err;
16857 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
16858 0 : err = fd_pubkey_decode_preflight( ctx );
16859 0 : if( FD_UNLIKELY( err ) ) return err;
16860 0 : self->vote_authorize_off = (uint)( (ulong)ctx->data - (ulong)data );
16861 0 : err = fd_vote_authorize_decode_preflight( ctx );
16862 0 : if( FD_UNLIKELY( err ) ) return err;
16863 0 : return FD_BINCODE_SUCCESS;
16864 0 : }
16865 0 : void fd_vote_authorize_pubkey_new(fd_vote_authorize_pubkey_t * self) {
16866 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_pubkey_t) );
16867 0 : fd_pubkey_new( &self->pubkey );
16868 0 : fd_vote_authorize_new( &self->vote_authorize );
16869 0 : }
16870 0 : void fd_vote_authorize_pubkey_destroy( fd_vote_authorize_pubkey_t * self, fd_bincode_destroy_ctx_t * ctx ) {
16871 0 : fd_pubkey_destroy( &self->pubkey, ctx );
16872 0 : fd_vote_authorize_destroy( &self->vote_authorize, ctx );
16873 0 : }
16874 :
16875 0 : ulong fd_vote_authorize_pubkey_footprint( void ){ return FD_VOTE_AUTHORIZE_PUBKEY_FOOTPRINT; }
16876 0 : ulong fd_vote_authorize_pubkey_align( void ){ return FD_VOTE_AUTHORIZE_PUBKEY_ALIGN; }
16877 :
16878 0 : void fd_vote_authorize_pubkey_walk( void * w, fd_vote_authorize_pubkey_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16879 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_pubkey", level++ );
16880 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
16881 0 : fd_vote_authorize_walk( w, &self->vote_authorize, fun, "vote_authorize", level );
16882 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_pubkey", level-- );
16883 0 : }
16884 0 : ulong fd_vote_authorize_pubkey_size( fd_vote_authorize_pubkey_t const * self ) {
16885 0 : ulong size = 0;
16886 0 : size += fd_pubkey_size( &self->pubkey );
16887 0 : size += fd_vote_authorize_size( &self->vote_authorize );
16888 0 : return size;
16889 0 : }
16890 :
16891 0 : int fd_vote_switch_decode( fd_vote_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
16892 0 : void const * data = ctx->data;
16893 0 : int err = fd_vote_switch_decode_preflight( ctx );
16894 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16895 0 : ctx->data = data;
16896 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
16897 0 : fd_vote_switch_new( self );
16898 0 : }
16899 0 : fd_vote_switch_decode_unsafe( self, ctx );
16900 0 : return FD_BINCODE_SUCCESS;
16901 0 : }
16902 693 : int fd_vote_switch_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
16903 693 : int err;
16904 693 : err = fd_vote_decode_preflight( ctx );
16905 693 : if( FD_UNLIKELY( err ) ) return err;
16906 645 : err = fd_hash_decode_preflight( ctx );
16907 645 : if( FD_UNLIKELY( err ) ) return err;
16908 639 : return FD_BINCODE_SUCCESS;
16909 645 : }
16910 639 : void fd_vote_switch_decode_unsafe( fd_vote_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
16911 639 : fd_vote_decode_unsafe( &self->vote, ctx );
16912 639 : fd_hash_decode_unsafe( &self->hash, ctx );
16913 639 : }
16914 0 : int fd_vote_switch_encode( fd_vote_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16915 0 : int err;
16916 0 : err = fd_vote_encode( &self->vote, ctx );
16917 0 : if( FD_UNLIKELY( err ) ) return err;
16918 0 : err = fd_hash_encode( &self->hash, ctx );
16919 0 : if( FD_UNLIKELY( err ) ) return err;
16920 0 : return FD_BINCODE_SUCCESS;
16921 0 : }
16922 0 : int fd_vote_switch_decode_offsets( fd_vote_switch_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
16923 0 : uchar const * data = ctx->data;
16924 0 : int err;
16925 0 : self->vote_off = (uint)( (ulong)ctx->data - (ulong)data );
16926 0 : err = fd_vote_decode_preflight( ctx );
16927 0 : if( FD_UNLIKELY( err ) ) return err;
16928 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
16929 0 : err = fd_hash_decode_preflight( ctx );
16930 0 : if( FD_UNLIKELY( err ) ) return err;
16931 0 : return FD_BINCODE_SUCCESS;
16932 0 : }
16933 0 : void fd_vote_switch_new(fd_vote_switch_t * self) {
16934 0 : fd_memset( self, 0, sizeof(fd_vote_switch_t) );
16935 0 : fd_vote_new( &self->vote );
16936 0 : fd_hash_new( &self->hash );
16937 0 : }
16938 0 : void fd_vote_switch_destroy( fd_vote_switch_t * self, fd_bincode_destroy_ctx_t * ctx ) {
16939 0 : fd_vote_destroy( &self->vote, ctx );
16940 0 : fd_hash_destroy( &self->hash, ctx );
16941 0 : }
16942 :
16943 0 : ulong fd_vote_switch_footprint( void ){ return FD_VOTE_SWITCH_FOOTPRINT; }
16944 0 : ulong fd_vote_switch_align( void ){ return FD_VOTE_SWITCH_ALIGN; }
16945 :
16946 0 : void fd_vote_switch_walk( void * w, fd_vote_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
16947 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_switch", level++ );
16948 0 : fd_vote_walk( w, &self->vote, fun, "vote", level );
16949 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
16950 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_switch", level-- );
16951 0 : }
16952 0 : ulong fd_vote_switch_size( fd_vote_switch_t const * self ) {
16953 0 : ulong size = 0;
16954 0 : size += fd_vote_size( &self->vote );
16955 0 : size += fd_hash_size( &self->hash );
16956 0 : return size;
16957 0 : }
16958 :
16959 0 : int fd_update_vote_state_switch_decode( fd_update_vote_state_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
16960 0 : void const * data = ctx->data;
16961 0 : int err = fd_update_vote_state_switch_decode_preflight( ctx );
16962 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16963 0 : ctx->data = data;
16964 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
16965 0 : fd_update_vote_state_switch_new( self );
16966 0 : }
16967 0 : fd_update_vote_state_switch_decode_unsafe( self, ctx );
16968 0 : return FD_BINCODE_SUCCESS;
16969 0 : }
16970 819 : int fd_update_vote_state_switch_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
16971 819 : int err;
16972 819 : err = fd_vote_state_update_decode_preflight( ctx );
16973 819 : if( FD_UNLIKELY( err ) ) return err;
16974 759 : err = fd_hash_decode_preflight( ctx );
16975 759 : if( FD_UNLIKELY( err ) ) return err;
16976 753 : return FD_BINCODE_SUCCESS;
16977 759 : }
16978 753 : void fd_update_vote_state_switch_decode_unsafe( fd_update_vote_state_switch_t * self, fd_bincode_decode_ctx_t * ctx ) {
16979 753 : fd_vote_state_update_decode_unsafe( &self->vote_state_update, ctx );
16980 753 : fd_hash_decode_unsafe( &self->hash, ctx );
16981 753 : }
16982 0 : int fd_update_vote_state_switch_encode( fd_update_vote_state_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16983 0 : int err;
16984 0 : err = fd_vote_state_update_encode( &self->vote_state_update, ctx );
16985 0 : if( FD_UNLIKELY( err ) ) return err;
16986 0 : err = fd_hash_encode( &self->hash, ctx );
16987 0 : if( FD_UNLIKELY( err ) ) return err;
16988 0 : return FD_BINCODE_SUCCESS;
16989 0 : }
16990 0 : int fd_update_vote_state_switch_decode_offsets( fd_update_vote_state_switch_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
16991 0 : uchar const * data = ctx->data;
16992 0 : int err;
16993 0 : self->vote_state_update_off = (uint)( (ulong)ctx->data - (ulong)data );
16994 0 : err = fd_vote_state_update_decode_preflight( ctx );
16995 0 : if( FD_UNLIKELY( err ) ) return err;
16996 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
16997 0 : err = fd_hash_decode_preflight( ctx );
16998 0 : if( FD_UNLIKELY( err ) ) return err;
16999 0 : return FD_BINCODE_SUCCESS;
17000 0 : }
17001 0 : void fd_update_vote_state_switch_new(fd_update_vote_state_switch_t * self) {
17002 0 : fd_memset( self, 0, sizeof(fd_update_vote_state_switch_t) );
17003 0 : fd_vote_state_update_new( &self->vote_state_update );
17004 0 : fd_hash_new( &self->hash );
17005 0 : }
17006 0 : void fd_update_vote_state_switch_destroy( fd_update_vote_state_switch_t * self, fd_bincode_destroy_ctx_t * ctx ) {
17007 0 : fd_vote_state_update_destroy( &self->vote_state_update, ctx );
17008 0 : fd_hash_destroy( &self->hash, ctx );
17009 0 : }
17010 :
17011 0 : ulong fd_update_vote_state_switch_footprint( void ){ return FD_UPDATE_VOTE_STATE_SWITCH_FOOTPRINT; }
17012 0 : ulong fd_update_vote_state_switch_align( void ){ return FD_UPDATE_VOTE_STATE_SWITCH_ALIGN; }
17013 :
17014 0 : void fd_update_vote_state_switch_walk( void * w, fd_update_vote_state_switch_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17015 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_update_vote_state_switch", level++ );
17016 0 : fd_vote_state_update_walk( w, &self->vote_state_update, fun, "vote_state_update", level );
17017 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
17018 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_update_vote_state_switch", level-- );
17019 0 : }
17020 0 : ulong fd_update_vote_state_switch_size( fd_update_vote_state_switch_t const * self ) {
17021 0 : ulong size = 0;
17022 0 : size += fd_vote_state_update_size( &self->vote_state_update );
17023 0 : size += fd_hash_size( &self->hash );
17024 0 : return size;
17025 0 : }
17026 :
17027 0 : int fd_vote_authorize_with_seed_args_decode( fd_vote_authorize_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
17028 0 : void const * data = ctx->data;
17029 0 : int err = fd_vote_authorize_with_seed_args_decode_preflight( ctx );
17030 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17031 0 : ctx->data = data;
17032 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
17033 0 : fd_vote_authorize_with_seed_args_new( self );
17034 0 : }
17035 0 : fd_vote_authorize_with_seed_args_decode_unsafe( self, ctx );
17036 0 : return FD_BINCODE_SUCCESS;
17037 0 : }
17038 627 : int fd_vote_authorize_with_seed_args_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
17039 627 : int err;
17040 627 : err = fd_vote_authorize_decode_preflight( ctx );
17041 627 : if( FD_UNLIKELY( err ) ) return err;
17042 615 : err = fd_pubkey_decode_preflight( ctx );
17043 615 : if( FD_UNLIKELY( err ) ) return err;
17044 606 : ulong current_authority_derived_key_seed_len;
17045 606 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
17046 606 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17047 600 : if( current_authority_derived_key_seed_len ) {
17048 525 : err = fd_bincode_bytes_decode_preflight( current_authority_derived_key_seed_len, ctx );
17049 525 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17050 516 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
17051 516 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17052 516 : }
17053 234 : err = fd_pubkey_decode_preflight( ctx );
17054 234 : if( FD_UNLIKELY( err ) ) return err;
17055 228 : return FD_BINCODE_SUCCESS;
17056 234 : }
17057 228 : void fd_vote_authorize_with_seed_args_decode_unsafe( fd_vote_authorize_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
17058 228 : fd_vote_authorize_decode_unsafe( &self->authorization_type, ctx );
17059 228 : fd_pubkey_decode_unsafe( &self->current_authority_derived_key_owner, ctx );
17060 228 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
17061 228 : if( self->current_authority_derived_key_seed_len ) {
17062 159 : self->current_authority_derived_key_seed = fd_valloc_malloc( ctx->valloc, 8UL, self->current_authority_derived_key_seed_len );
17063 159 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
17064 159 : } else
17065 69 : self->current_authority_derived_key_seed = NULL;
17066 228 : fd_pubkey_decode_unsafe( &self->new_authority, ctx );
17067 228 : }
17068 0 : int fd_vote_authorize_with_seed_args_encode( fd_vote_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17069 0 : int err;
17070 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
17071 0 : if( FD_UNLIKELY( err ) ) return err;
17072 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
17073 0 : if( FD_UNLIKELY( err ) ) return err;
17074 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
17075 0 : if( FD_UNLIKELY(err) ) return err;
17076 0 : if( self->current_authority_derived_key_seed_len ) {
17077 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
17078 0 : if( FD_UNLIKELY( err ) ) return err;
17079 0 : }
17080 0 : err = fd_pubkey_encode( &self->new_authority, ctx );
17081 0 : if( FD_UNLIKELY( err ) ) return err;
17082 0 : return FD_BINCODE_SUCCESS;
17083 0 : }
17084 0 : int fd_vote_authorize_with_seed_args_decode_offsets( fd_vote_authorize_with_seed_args_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
17085 0 : uchar const * data = ctx->data;
17086 0 : int err;
17087 0 : self->authorization_type_off = (uint)( (ulong)ctx->data - (ulong)data );
17088 0 : err = fd_vote_authorize_decode_preflight( ctx );
17089 0 : if( FD_UNLIKELY( err ) ) return err;
17090 0 : self->current_authority_derived_key_owner_off = (uint)( (ulong)ctx->data - (ulong)data );
17091 0 : err = fd_pubkey_decode_preflight( ctx );
17092 0 : if( FD_UNLIKELY( err ) ) return err;
17093 0 : self->current_authority_derived_key_seed_off = (uint)( (ulong)ctx->data - (ulong)data );
17094 0 : ulong current_authority_derived_key_seed_len;
17095 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
17096 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17097 0 : if( current_authority_derived_key_seed_len ) {
17098 0 : err = fd_bincode_bytes_decode_preflight( current_authority_derived_key_seed_len, ctx );
17099 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17100 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
17101 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17102 0 : }
17103 0 : self->new_authority_off = (uint)( (ulong)ctx->data - (ulong)data );
17104 0 : err = fd_pubkey_decode_preflight( ctx );
17105 0 : if( FD_UNLIKELY( err ) ) return err;
17106 0 : return FD_BINCODE_SUCCESS;
17107 0 : }
17108 0 : void fd_vote_authorize_with_seed_args_new(fd_vote_authorize_with_seed_args_t * self) {
17109 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_with_seed_args_t) );
17110 0 : fd_vote_authorize_new( &self->authorization_type );
17111 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
17112 0 : fd_pubkey_new( &self->new_authority );
17113 0 : }
17114 0 : void fd_vote_authorize_with_seed_args_destroy( fd_vote_authorize_with_seed_args_t * self, fd_bincode_destroy_ctx_t * ctx ) {
17115 0 : fd_vote_authorize_destroy( &self->authorization_type, ctx );
17116 0 : fd_pubkey_destroy( &self->current_authority_derived_key_owner, ctx );
17117 0 : if( self->current_authority_derived_key_seed ) {
17118 0 : fd_valloc_free( ctx->valloc, self->current_authority_derived_key_seed );
17119 0 : self->current_authority_derived_key_seed = NULL;
17120 0 : }
17121 0 : fd_pubkey_destroy( &self->new_authority, ctx );
17122 0 : }
17123 :
17124 0 : ulong fd_vote_authorize_with_seed_args_footprint( void ){ return FD_VOTE_AUTHORIZE_WITH_SEED_ARGS_FOOTPRINT; }
17125 0 : ulong fd_vote_authorize_with_seed_args_align( void ){ return FD_VOTE_AUTHORIZE_WITH_SEED_ARGS_ALIGN; }
17126 :
17127 0 : void fd_vote_authorize_with_seed_args_walk( void * w, fd_vote_authorize_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17128 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_with_seed_args", level++ );
17129 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level );
17130 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level );
17131 0 : fun(w, self->current_authority_derived_key_seed, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
17132 0 : fd_pubkey_walk( w, &self->new_authority, fun, "new_authority", level );
17133 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_with_seed_args", level-- );
17134 0 : }
17135 0 : ulong fd_vote_authorize_with_seed_args_size( fd_vote_authorize_with_seed_args_t const * self ) {
17136 0 : ulong size = 0;
17137 0 : size += fd_vote_authorize_size( &self->authorization_type );
17138 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
17139 0 : do {
17140 0 : size += sizeof(ulong);
17141 0 : size += self->current_authority_derived_key_seed_len;
17142 0 : } while(0);
17143 0 : size += fd_pubkey_size( &self->new_authority );
17144 0 : return size;
17145 0 : }
17146 :
17147 0 : int fd_vote_authorize_checked_with_seed_args_decode( fd_vote_authorize_checked_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
17148 0 : void const * data = ctx->data;
17149 0 : int err = fd_vote_authorize_checked_with_seed_args_decode_preflight( ctx );
17150 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17151 0 : ctx->data = data;
17152 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
17153 0 : fd_vote_authorize_checked_with_seed_args_new( self );
17154 0 : }
17155 0 : fd_vote_authorize_checked_with_seed_args_decode_unsafe( self, ctx );
17156 0 : return FD_BINCODE_SUCCESS;
17157 0 : }
17158 642 : int fd_vote_authorize_checked_with_seed_args_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
17159 642 : int err;
17160 642 : err = fd_vote_authorize_decode_preflight( ctx );
17161 642 : if( FD_UNLIKELY( err ) ) return err;
17162 630 : err = fd_pubkey_decode_preflight( ctx );
17163 630 : if( FD_UNLIKELY( err ) ) return err;
17164 621 : ulong current_authority_derived_key_seed_len;
17165 621 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
17166 621 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17167 615 : if( current_authority_derived_key_seed_len ) {
17168 573 : err = fd_bincode_bytes_decode_preflight( current_authority_derived_key_seed_len, ctx );
17169 573 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17170 525 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
17171 525 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17172 525 : }
17173 114 : return FD_BINCODE_SUCCESS;
17174 615 : }
17175 114 : void fd_vote_authorize_checked_with_seed_args_decode_unsafe( fd_vote_authorize_checked_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
17176 114 : fd_vote_authorize_decode_unsafe( &self->authorization_type, ctx );
17177 114 : fd_pubkey_decode_unsafe( &self->current_authority_derived_key_owner, ctx );
17178 114 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
17179 114 : if( self->current_authority_derived_key_seed_len ) {
17180 72 : self->current_authority_derived_key_seed = fd_valloc_malloc( ctx->valloc, 8UL, self->current_authority_derived_key_seed_len );
17181 72 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
17182 72 : } else
17183 42 : self->current_authority_derived_key_seed = NULL;
17184 114 : }
17185 0 : int fd_vote_authorize_checked_with_seed_args_encode( fd_vote_authorize_checked_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17186 0 : int err;
17187 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
17188 0 : if( FD_UNLIKELY( err ) ) return err;
17189 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
17190 0 : if( FD_UNLIKELY( err ) ) return err;
17191 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
17192 0 : if( FD_UNLIKELY(err) ) return err;
17193 0 : if( self->current_authority_derived_key_seed_len ) {
17194 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
17195 0 : if( FD_UNLIKELY( err ) ) return err;
17196 0 : }
17197 0 : return FD_BINCODE_SUCCESS;
17198 0 : }
17199 0 : int fd_vote_authorize_checked_with_seed_args_decode_offsets( fd_vote_authorize_checked_with_seed_args_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
17200 0 : uchar const * data = ctx->data;
17201 0 : int err;
17202 0 : self->authorization_type_off = (uint)( (ulong)ctx->data - (ulong)data );
17203 0 : err = fd_vote_authorize_decode_preflight( ctx );
17204 0 : if( FD_UNLIKELY( err ) ) return err;
17205 0 : self->current_authority_derived_key_owner_off = (uint)( (ulong)ctx->data - (ulong)data );
17206 0 : err = fd_pubkey_decode_preflight( ctx );
17207 0 : if( FD_UNLIKELY( err ) ) return err;
17208 0 : self->current_authority_derived_key_seed_off = (uint)( (ulong)ctx->data - (ulong)data );
17209 0 : ulong current_authority_derived_key_seed_len;
17210 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
17211 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17212 0 : if( current_authority_derived_key_seed_len ) {
17213 0 : err = fd_bincode_bytes_decode_preflight( current_authority_derived_key_seed_len, ctx );
17214 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17215 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
17216 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17217 0 : }
17218 0 : return FD_BINCODE_SUCCESS;
17219 0 : }
17220 0 : void fd_vote_authorize_checked_with_seed_args_new(fd_vote_authorize_checked_with_seed_args_t * self) {
17221 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_checked_with_seed_args_t) );
17222 0 : fd_vote_authorize_new( &self->authorization_type );
17223 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
17224 0 : }
17225 0 : void fd_vote_authorize_checked_with_seed_args_destroy( fd_vote_authorize_checked_with_seed_args_t * self, fd_bincode_destroy_ctx_t * ctx ) {
17226 0 : fd_vote_authorize_destroy( &self->authorization_type, ctx );
17227 0 : fd_pubkey_destroy( &self->current_authority_derived_key_owner, ctx );
17228 0 : if( self->current_authority_derived_key_seed ) {
17229 0 : fd_valloc_free( ctx->valloc, self->current_authority_derived_key_seed );
17230 0 : self->current_authority_derived_key_seed = NULL;
17231 0 : }
17232 0 : }
17233 :
17234 0 : ulong fd_vote_authorize_checked_with_seed_args_footprint( void ){ return FD_VOTE_AUTHORIZE_CHECKED_WITH_SEED_ARGS_FOOTPRINT; }
17235 0 : ulong fd_vote_authorize_checked_with_seed_args_align( void ){ return FD_VOTE_AUTHORIZE_CHECKED_WITH_SEED_ARGS_ALIGN; }
17236 :
17237 0 : void fd_vote_authorize_checked_with_seed_args_walk( void * w, fd_vote_authorize_checked_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17238 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_checked_with_seed_args", level++ );
17239 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level );
17240 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level );
17241 0 : fun(w, self->current_authority_derived_key_seed, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
17242 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_checked_with_seed_args", level-- );
17243 0 : }
17244 0 : ulong fd_vote_authorize_checked_with_seed_args_size( fd_vote_authorize_checked_with_seed_args_t const * self ) {
17245 0 : ulong size = 0;
17246 0 : size += fd_vote_authorize_size( &self->authorization_type );
17247 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
17248 0 : do {
17249 0 : size += sizeof(ulong);
17250 0 : size += self->current_authority_derived_key_seed_len;
17251 0 : } while(0);
17252 0 : return size;
17253 0 : }
17254 :
17255 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account(fd_vote_instruction_t const * self) {
17256 0 : return self->discriminant == 0;
17257 0 : }
17258 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize(fd_vote_instruction_t const * self) {
17259 0 : return self->discriminant == 1;
17260 0 : }
17261 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote(fd_vote_instruction_t const * self) {
17262 0 : return self->discriminant == 2;
17263 0 : }
17264 0 : FD_FN_PURE uchar fd_vote_instruction_is_withdraw(fd_vote_instruction_t const * self) {
17265 0 : return self->discriminant == 3;
17266 0 : }
17267 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_validator_identity(fd_vote_instruction_t const * self) {
17268 0 : return self->discriminant == 4;
17269 0 : }
17270 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission(fd_vote_instruction_t const * self) {
17271 0 : return self->discriminant == 5;
17272 0 : }
17273 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote_switch(fd_vote_instruction_t const * self) {
17274 0 : return self->discriminant == 6;
17275 0 : }
17276 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked(fd_vote_instruction_t const * self) {
17277 0 : return self->discriminant == 7;
17278 0 : }
17279 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state(fd_vote_instruction_t const * self) {
17280 0 : return self->discriminant == 8;
17281 0 : }
17282 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state_switch(fd_vote_instruction_t const * self) {
17283 0 : return self->discriminant == 9;
17284 0 : }
17285 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_with_seed(fd_vote_instruction_t const * self) {
17286 0 : return self->discriminant == 10;
17287 0 : }
17288 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked_with_seed(fd_vote_instruction_t const * self) {
17289 0 : return self->discriminant == 11;
17290 0 : }
17291 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state(fd_vote_instruction_t const * self) {
17292 0 : return self->discriminant == 12;
17293 0 : }
17294 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state_switch(fd_vote_instruction_t const * self) {
17295 0 : return self->discriminant == 13;
17296 0 : }
17297 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync(fd_vote_instruction_t const * self) {
17298 0 : return self->discriminant == 14;
17299 0 : }
17300 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync_switch(fd_vote_instruction_t const * self) {
17301 0 : return self->discriminant == 15;
17302 0 : }
17303 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant );
17304 13623 : int fd_vote_instruction_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17305 13623 : int err;
17306 13623 : switch (discriminant) {
17307 447 : case 0: {
17308 447 : err = fd_vote_init_decode_preflight( ctx );
17309 447 : if( FD_UNLIKELY( err ) ) return err;
17310 279 : return FD_BINCODE_SUCCESS;
17311 447 : }
17312 1338 : case 1: {
17313 1338 : err = fd_vote_authorize_pubkey_decode_preflight( ctx );
17314 1338 : if( FD_UNLIKELY( err ) ) return err;
17315 1257 : return FD_BINCODE_SUCCESS;
17316 1338 : }
17317 711 : case 2: {
17318 711 : err = fd_vote_decode_preflight( ctx );
17319 711 : if( FD_UNLIKELY( err ) ) return err;
17320 669 : return FD_BINCODE_SUCCESS;
17321 711 : }
17322 912 : case 3: {
17323 912 : err = fd_bincode_uint64_decode_preflight( ctx );
17324 912 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17325 906 : return FD_BINCODE_SUCCESS;
17326 912 : }
17327 1323 : case 4: {
17328 1323 : return FD_BINCODE_SUCCESS;
17329 912 : }
17330 1407 : case 5: {
17331 1407 : err = fd_bincode_uint8_decode_preflight( ctx );
17332 1407 : if( FD_UNLIKELY( err ) ) return err;
17333 1401 : return FD_BINCODE_SUCCESS;
17334 1407 : }
17335 693 : case 6: {
17336 693 : err = fd_vote_switch_decode_preflight( ctx );
17337 693 : if( FD_UNLIKELY( err ) ) return err;
17338 639 : return FD_BINCODE_SUCCESS;
17339 693 : }
17340 903 : case 7: {
17341 903 : err = fd_vote_authorize_decode_preflight( ctx );
17342 903 : if( FD_UNLIKELY( err ) ) return err;
17343 888 : return FD_BINCODE_SUCCESS;
17344 903 : }
17345 903 : case 8: {
17346 903 : err = fd_vote_state_update_decode_preflight( ctx );
17347 903 : if( FD_UNLIKELY( err ) ) return err;
17348 840 : return FD_BINCODE_SUCCESS;
17349 903 : }
17350 819 : case 9: {
17351 819 : err = fd_update_vote_state_switch_decode_preflight( ctx );
17352 819 : if( FD_UNLIKELY( err ) ) return err;
17353 753 : return FD_BINCODE_SUCCESS;
17354 819 : }
17355 627 : case 10: {
17356 627 : err = fd_vote_authorize_with_seed_args_decode_preflight( ctx );
17357 627 : if( FD_UNLIKELY( err ) ) return err;
17358 228 : return FD_BINCODE_SUCCESS;
17359 627 : }
17360 642 : case 11: {
17361 642 : err = fd_vote_authorize_checked_with_seed_args_decode_preflight( ctx );
17362 642 : if( FD_UNLIKELY( err ) ) return err;
17363 114 : return FD_BINCODE_SUCCESS;
17364 642 : }
17365 774 : case 12: {
17366 774 : err = fd_compact_vote_state_update_decode_preflight( ctx );
17367 774 : if( FD_UNLIKELY( err ) ) return err;
17368 240 : return FD_BINCODE_SUCCESS;
17369 774 : }
17370 597 : case 13: {
17371 597 : err = fd_compact_vote_state_update_switch_decode_preflight( ctx );
17372 597 : if( FD_UNLIKELY( err ) ) return err;
17373 162 : return FD_BINCODE_SUCCESS;
17374 597 : }
17375 561 : case 14: {
17376 561 : err = fd_tower_sync_decode_preflight( ctx );
17377 561 : if( FD_UNLIKELY( err ) ) return err;
17378 105 : return FD_BINCODE_SUCCESS;
17379 561 : }
17380 687 : case 15: {
17381 687 : err = fd_tower_sync_switch_decode_preflight( ctx );
17382 687 : if( FD_UNLIKELY( err ) ) return err;
17383 60 : return FD_BINCODE_SUCCESS;
17384 687 : }
17385 279 : default: return FD_BINCODE_ERR_ENCODING;
17386 13623 : }
17387 13623 : }
17388 9864 : void fd_vote_instruction_inner_decode_unsafe( fd_vote_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17389 9864 : switch (discriminant) {
17390 279 : case 0: {
17391 279 : fd_vote_init_decode_unsafe( &self->initialize_account, ctx );
17392 279 : break;
17393 0 : }
17394 1257 : case 1: {
17395 1257 : fd_vote_authorize_pubkey_decode_unsafe( &self->authorize, ctx );
17396 1257 : break;
17397 0 : }
17398 669 : case 2: {
17399 669 : fd_vote_decode_unsafe( &self->vote, ctx );
17400 669 : break;
17401 0 : }
17402 906 : case 3: {
17403 906 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
17404 906 : break;
17405 0 : }
17406 1323 : case 4: {
17407 1323 : break;
17408 0 : }
17409 1401 : case 5: {
17410 1401 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
17411 1401 : break;
17412 0 : }
17413 639 : case 6: {
17414 639 : fd_vote_switch_decode_unsafe( &self->vote_switch, ctx );
17415 639 : break;
17416 0 : }
17417 888 : case 7: {
17418 888 : fd_vote_authorize_decode_unsafe( &self->authorize_checked, ctx );
17419 888 : break;
17420 0 : }
17421 840 : case 8: {
17422 840 : fd_vote_state_update_decode_unsafe( &self->update_vote_state, ctx );
17423 840 : break;
17424 0 : }
17425 753 : case 9: {
17426 753 : fd_update_vote_state_switch_decode_unsafe( &self->update_vote_state_switch, ctx );
17427 753 : break;
17428 0 : }
17429 228 : case 10: {
17430 228 : fd_vote_authorize_with_seed_args_decode_unsafe( &self->authorize_with_seed, ctx );
17431 228 : break;
17432 0 : }
17433 114 : case 11: {
17434 114 : fd_vote_authorize_checked_with_seed_args_decode_unsafe( &self->authorize_checked_with_seed, ctx );
17435 114 : break;
17436 0 : }
17437 240 : case 12: {
17438 240 : fd_compact_vote_state_update_decode_unsafe( &self->compact_update_vote_state, ctx );
17439 240 : break;
17440 0 : }
17441 162 : case 13: {
17442 162 : fd_compact_vote_state_update_switch_decode_unsafe( &self->compact_update_vote_state_switch, ctx );
17443 162 : break;
17444 0 : }
17445 105 : case 14: {
17446 105 : fd_tower_sync_decode_unsafe( &self->tower_sync, ctx );
17447 105 : break;
17448 0 : }
17449 60 : case 15: {
17450 60 : fd_tower_sync_switch_decode_unsafe( &self->tower_sync_switch, ctx );
17451 60 : break;
17452 0 : }
17453 9864 : }
17454 9864 : }
17455 13656 : int fd_vote_instruction_decode( fd_vote_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
17456 13656 : void const * data = ctx->data;
17457 13656 : int err = fd_vote_instruction_decode_preflight( ctx );
17458 13656 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17459 9864 : ctx->data = data;
17460 9864 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
17461 9864 : fd_vote_instruction_new( self );
17462 9864 : }
17463 9864 : fd_vote_instruction_decode_unsafe( self, ctx );
17464 9864 : return FD_BINCODE_SUCCESS;
17465 13656 : }
17466 13656 : int fd_vote_instruction_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
17467 13656 : uint discriminant = 0;
17468 13656 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
17469 13656 : if( FD_UNLIKELY( err ) ) return err;
17470 13623 : return fd_vote_instruction_inner_decode_preflight( discriminant, ctx );
17471 13656 : }
17472 9864 : void fd_vote_instruction_decode_unsafe( fd_vote_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
17473 9864 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
17474 9864 : fd_vote_instruction_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
17475 9864 : }
17476 9864 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant ) {
17477 9864 : switch( discriminant ) {
17478 0 : case 0: {
17479 0 : fd_vote_init_new( &self->initialize_account );
17480 0 : break;
17481 0 : }
17482 0 : case 1: {
17483 0 : fd_vote_authorize_pubkey_new( &self->authorize );
17484 0 : break;
17485 0 : }
17486 0 : case 2: {
17487 0 : fd_vote_new( &self->vote );
17488 0 : break;
17489 0 : }
17490 0 : case 3: {
17491 0 : break;
17492 0 : }
17493 0 : case 4: {
17494 0 : break;
17495 0 : }
17496 0 : case 5: {
17497 0 : break;
17498 0 : }
17499 0 : case 6: {
17500 0 : fd_vote_switch_new( &self->vote_switch );
17501 0 : break;
17502 0 : }
17503 0 : case 7: {
17504 0 : fd_vote_authorize_new( &self->authorize_checked );
17505 0 : break;
17506 0 : }
17507 0 : case 8: {
17508 0 : fd_vote_state_update_new( &self->update_vote_state );
17509 0 : break;
17510 0 : }
17511 0 : case 9: {
17512 0 : fd_update_vote_state_switch_new( &self->update_vote_state_switch );
17513 0 : break;
17514 0 : }
17515 0 : case 10: {
17516 0 : fd_vote_authorize_with_seed_args_new( &self->authorize_with_seed );
17517 0 : break;
17518 0 : }
17519 0 : case 11: {
17520 0 : fd_vote_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
17521 0 : break;
17522 0 : }
17523 0 : case 12: {
17524 0 : fd_compact_vote_state_update_new( &self->compact_update_vote_state );
17525 0 : break;
17526 0 : }
17527 0 : case 13: {
17528 0 : fd_compact_vote_state_update_switch_new( &self->compact_update_vote_state_switch );
17529 0 : break;
17530 0 : }
17531 0 : case 14: {
17532 0 : fd_tower_sync_new( &self->tower_sync );
17533 0 : break;
17534 0 : }
17535 0 : case 15: {
17536 0 : fd_tower_sync_switch_new( &self->tower_sync_switch );
17537 0 : break;
17538 0 : }
17539 9864 : default: break; // FD_LOG_ERR(( "unhandled type"));
17540 9864 : }
17541 9864 : }
17542 9864 : void fd_vote_instruction_new_disc( fd_vote_instruction_t * self, uint discriminant ) {
17543 9864 : self->discriminant = discriminant;
17544 9864 : fd_vote_instruction_inner_new( &self->inner, self->discriminant );
17545 9864 : }
17546 9864 : void fd_vote_instruction_new( fd_vote_instruction_t * self ) {
17547 9864 : fd_memset( self, 0, sizeof(fd_vote_instruction_t) );
17548 9864 : fd_vote_instruction_new_disc( self, UINT_MAX );
17549 9864 : }
17550 0 : void fd_vote_instruction_inner_destroy( fd_vote_instruction_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
17551 0 : switch( discriminant ) {
17552 0 : case 0: {
17553 0 : fd_vote_init_destroy( &self->initialize_account, ctx );
17554 0 : break;
17555 0 : }
17556 0 : case 1: {
17557 0 : fd_vote_authorize_pubkey_destroy( &self->authorize, ctx );
17558 0 : break;
17559 0 : }
17560 0 : case 2: {
17561 0 : fd_vote_destroy( &self->vote, ctx );
17562 0 : break;
17563 0 : }
17564 0 : case 3: {
17565 0 : break;
17566 0 : }
17567 0 : case 5: {
17568 0 : break;
17569 0 : }
17570 0 : case 6: {
17571 0 : fd_vote_switch_destroy( &self->vote_switch, ctx );
17572 0 : break;
17573 0 : }
17574 0 : case 7: {
17575 0 : fd_vote_authorize_destroy( &self->authorize_checked, ctx );
17576 0 : break;
17577 0 : }
17578 0 : case 8: {
17579 0 : fd_vote_state_update_destroy( &self->update_vote_state, ctx );
17580 0 : break;
17581 0 : }
17582 0 : case 9: {
17583 0 : fd_update_vote_state_switch_destroy( &self->update_vote_state_switch, ctx );
17584 0 : break;
17585 0 : }
17586 0 : case 10: {
17587 0 : fd_vote_authorize_with_seed_args_destroy( &self->authorize_with_seed, ctx );
17588 0 : break;
17589 0 : }
17590 0 : case 11: {
17591 0 : fd_vote_authorize_checked_with_seed_args_destroy( &self->authorize_checked_with_seed, ctx );
17592 0 : break;
17593 0 : }
17594 0 : case 12: {
17595 0 : fd_compact_vote_state_update_destroy( &self->compact_update_vote_state, ctx );
17596 0 : break;
17597 0 : }
17598 0 : case 13: {
17599 0 : fd_compact_vote_state_update_switch_destroy( &self->compact_update_vote_state_switch, ctx );
17600 0 : break;
17601 0 : }
17602 0 : case 14: {
17603 0 : fd_tower_sync_destroy( &self->tower_sync, ctx );
17604 0 : break;
17605 0 : }
17606 0 : case 15: {
17607 0 : fd_tower_sync_switch_destroy( &self->tower_sync_switch, ctx );
17608 0 : break;
17609 0 : }
17610 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
17611 0 : }
17612 0 : }
17613 0 : void fd_vote_instruction_destroy( fd_vote_instruction_t * self, fd_bincode_destroy_ctx_t * ctx ) {
17614 0 : fd_vote_instruction_inner_destroy( &self->inner, self->discriminant, ctx );
17615 0 : }
17616 :
17617 0 : ulong fd_vote_instruction_footprint( void ){ return FD_VOTE_INSTRUCTION_FOOTPRINT; }
17618 0 : ulong fd_vote_instruction_align( void ){ return FD_VOTE_INSTRUCTION_ALIGN; }
17619 :
17620 0 : void fd_vote_instruction_walk( void * w, fd_vote_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17621 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_instruction", level++);
17622 0 : switch( self->discriminant ) {
17623 0 : case 0: {
17624 0 : fun( w, self, "initialize_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17625 0 : fd_vote_init_walk( w, &self->inner.initialize_account, fun, "initialize_account", level );
17626 0 : break;
17627 0 : }
17628 0 : case 1: {
17629 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17630 0 : fd_vote_authorize_pubkey_walk( w, &self->inner.authorize, fun, "authorize", level );
17631 0 : break;
17632 0 : }
17633 0 : case 2: {
17634 0 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17635 0 : fd_vote_walk( w, &self->inner.vote, fun, "vote", level );
17636 0 : break;
17637 0 : }
17638 0 : case 3: {
17639 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17640 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
17641 0 : break;
17642 0 : }
17643 0 : case 4: {
17644 0 : fun( w, self, "update_validator_identity", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17645 0 : break;
17646 0 : }
17647 0 : case 5: {
17648 0 : fun( w, self, "update_commission", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17649 0 : fun( w, &self->inner.update_commission, "update_commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
17650 0 : break;
17651 0 : }
17652 0 : case 6: {
17653 0 : fun( w, self, "vote_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17654 0 : fd_vote_switch_walk( w, &self->inner.vote_switch, fun, "vote_switch", level );
17655 0 : break;
17656 0 : }
17657 0 : case 7: {
17658 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17659 0 : fd_vote_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level );
17660 0 : break;
17661 0 : }
17662 0 : case 8: {
17663 0 : fun( w, self, "update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17664 0 : fd_vote_state_update_walk( w, &self->inner.update_vote_state, fun, "update_vote_state", level );
17665 0 : break;
17666 0 : }
17667 0 : case 9: {
17668 0 : fun( w, self, "update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17669 0 : fd_update_vote_state_switch_walk( w, &self->inner.update_vote_state_switch, fun, "update_vote_state_switch", level );
17670 0 : break;
17671 0 : }
17672 0 : case 10: {
17673 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17674 0 : fd_vote_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level );
17675 0 : break;
17676 0 : }
17677 0 : case 11: {
17678 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17679 0 : fd_vote_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level );
17680 0 : break;
17681 0 : }
17682 0 : case 12: {
17683 0 : fun( w, self, "compact_update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17684 0 : fd_compact_vote_state_update_walk( w, &self->inner.compact_update_vote_state, fun, "compact_update_vote_state", level );
17685 0 : break;
17686 0 : }
17687 0 : case 13: {
17688 0 : fun( w, self, "compact_update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17689 0 : fd_compact_vote_state_update_switch_walk( w, &self->inner.compact_update_vote_state_switch, fun, "compact_update_vote_state_switch", level );
17690 0 : break;
17691 0 : }
17692 0 : case 14: {
17693 0 : fun( w, self, "tower_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17694 0 : fd_tower_sync_walk( w, &self->inner.tower_sync, fun, "tower_sync", level );
17695 0 : break;
17696 0 : }
17697 0 : case 15: {
17698 0 : fun( w, self, "tower_sync_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
17699 0 : fd_tower_sync_switch_walk( w, &self->inner.tower_sync_switch, fun, "tower_sync_switch", level );
17700 0 : break;
17701 0 : }
17702 0 : }
17703 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_instruction", level-- );
17704 0 : }
17705 0 : ulong fd_vote_instruction_size( fd_vote_instruction_t const * self ) {
17706 0 : ulong size = 0;
17707 0 : size += sizeof(uint);
17708 0 : switch (self->discriminant) {
17709 0 : case 0: {
17710 0 : size += fd_vote_init_size( &self->inner.initialize_account );
17711 0 : break;
17712 0 : }
17713 0 : case 1: {
17714 0 : size += fd_vote_authorize_pubkey_size( &self->inner.authorize );
17715 0 : break;
17716 0 : }
17717 0 : case 2: {
17718 0 : size += fd_vote_size( &self->inner.vote );
17719 0 : break;
17720 0 : }
17721 0 : case 3: {
17722 0 : size += sizeof(ulong);
17723 0 : break;
17724 0 : }
17725 0 : case 5: {
17726 0 : size += sizeof(char);
17727 0 : break;
17728 0 : }
17729 0 : case 6: {
17730 0 : size += fd_vote_switch_size( &self->inner.vote_switch );
17731 0 : break;
17732 0 : }
17733 0 : case 7: {
17734 0 : size += fd_vote_authorize_size( &self->inner.authorize_checked );
17735 0 : break;
17736 0 : }
17737 0 : case 8: {
17738 0 : size += fd_vote_state_update_size( &self->inner.update_vote_state );
17739 0 : break;
17740 0 : }
17741 0 : case 9: {
17742 0 : size += fd_update_vote_state_switch_size( &self->inner.update_vote_state_switch );
17743 0 : break;
17744 0 : }
17745 0 : case 10: {
17746 0 : size += fd_vote_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
17747 0 : break;
17748 0 : }
17749 0 : case 11: {
17750 0 : size += fd_vote_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
17751 0 : break;
17752 0 : }
17753 0 : case 12: {
17754 0 : size += fd_compact_vote_state_update_size( &self->inner.compact_update_vote_state );
17755 0 : break;
17756 0 : }
17757 0 : case 13: {
17758 0 : size += fd_compact_vote_state_update_switch_size( &self->inner.compact_update_vote_state_switch );
17759 0 : break;
17760 0 : }
17761 0 : case 14: {
17762 0 : size += fd_tower_sync_size( &self->inner.tower_sync );
17763 0 : break;
17764 0 : }
17765 0 : case 15: {
17766 0 : size += fd_tower_sync_switch_size( &self->inner.tower_sync_switch );
17767 0 : break;
17768 0 : }
17769 0 : }
17770 0 : return size;
17771 0 : }
17772 :
17773 0 : int fd_vote_instruction_inner_encode( fd_vote_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
17774 0 : int err;
17775 0 : switch (discriminant) {
17776 0 : case 0: {
17777 0 : err = fd_vote_init_encode( &self->initialize_account, ctx );
17778 0 : if( FD_UNLIKELY( err ) ) return err;
17779 0 : break;
17780 0 : }
17781 0 : case 1: {
17782 0 : err = fd_vote_authorize_pubkey_encode( &self->authorize, ctx );
17783 0 : if( FD_UNLIKELY( err ) ) return err;
17784 0 : break;
17785 0 : }
17786 0 : case 2: {
17787 0 : err = fd_vote_encode( &self->vote, ctx );
17788 0 : if( FD_UNLIKELY( err ) ) return err;
17789 0 : break;
17790 0 : }
17791 0 : case 3: {
17792 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
17793 0 : if( FD_UNLIKELY( err ) ) return err;
17794 0 : break;
17795 0 : }
17796 0 : case 5: {
17797 0 : err = fd_bincode_uint8_encode( (uchar)(self->update_commission), ctx );
17798 0 : if( FD_UNLIKELY( err ) ) return err;
17799 0 : break;
17800 0 : }
17801 0 : case 6: {
17802 0 : err = fd_vote_switch_encode( &self->vote_switch, ctx );
17803 0 : if( FD_UNLIKELY( err ) ) return err;
17804 0 : break;
17805 0 : }
17806 0 : case 7: {
17807 0 : err = fd_vote_authorize_encode( &self->authorize_checked, ctx );
17808 0 : if( FD_UNLIKELY( err ) ) return err;
17809 0 : break;
17810 0 : }
17811 0 : case 8: {
17812 0 : err = fd_vote_state_update_encode( &self->update_vote_state, ctx );
17813 0 : if( FD_UNLIKELY( err ) ) return err;
17814 0 : break;
17815 0 : }
17816 0 : case 9: {
17817 0 : err = fd_update_vote_state_switch_encode( &self->update_vote_state_switch, ctx );
17818 0 : if( FD_UNLIKELY( err ) ) return err;
17819 0 : break;
17820 0 : }
17821 0 : case 10: {
17822 0 : err = fd_vote_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
17823 0 : if( FD_UNLIKELY( err ) ) return err;
17824 0 : break;
17825 0 : }
17826 0 : case 11: {
17827 0 : err = fd_vote_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
17828 0 : if( FD_UNLIKELY( err ) ) return err;
17829 0 : break;
17830 0 : }
17831 0 : case 12: {
17832 0 : err = fd_compact_vote_state_update_encode( &self->compact_update_vote_state, ctx );
17833 0 : if( FD_UNLIKELY( err ) ) return err;
17834 0 : break;
17835 0 : }
17836 0 : case 13: {
17837 0 : err = fd_compact_vote_state_update_switch_encode( &self->compact_update_vote_state_switch, ctx );
17838 0 : if( FD_UNLIKELY( err ) ) return err;
17839 0 : break;
17840 0 : }
17841 0 : case 14: {
17842 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
17843 0 : if( FD_UNLIKELY( err ) ) return err;
17844 0 : break;
17845 0 : }
17846 0 : case 15: {
17847 0 : err = fd_tower_sync_switch_encode( &self->tower_sync_switch, ctx );
17848 0 : if( FD_UNLIKELY( err ) ) return err;
17849 0 : break;
17850 0 : }
17851 0 : }
17852 0 : return FD_BINCODE_SUCCESS;
17853 0 : }
17854 0 : int fd_vote_instruction_encode( fd_vote_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17855 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
17856 0 : if( FD_UNLIKELY( err ) ) return err;
17857 0 : return fd_vote_instruction_inner_encode( &self->inner, self->discriminant, ctx );
17858 0 : }
17859 :
17860 0 : int fd_system_program_instruction_create_account_decode( fd_system_program_instruction_create_account_t * self, fd_bincode_decode_ctx_t * ctx ) {
17861 0 : void const * data = ctx->data;
17862 0 : int err = fd_system_program_instruction_create_account_decode_preflight( ctx );
17863 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17864 0 : ctx->data = data;
17865 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
17866 0 : fd_system_program_instruction_create_account_new( self );
17867 0 : }
17868 0 : fd_system_program_instruction_create_account_decode_unsafe( self, ctx );
17869 0 : return FD_BINCODE_SUCCESS;
17870 0 : }
17871 1188 : int fd_system_program_instruction_create_account_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
17872 1188 : return fd_bincode_bytes_decode_preflight( 48, ctx );
17873 1188 : }
17874 801 : void fd_system_program_instruction_create_account_decode_unsafe( fd_system_program_instruction_create_account_t * self, fd_bincode_decode_ctx_t * ctx ) {
17875 801 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
17876 801 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
17877 801 : fd_pubkey_decode_unsafe( &self->owner, ctx );
17878 801 : }
17879 162 : int fd_system_program_instruction_create_account_encode( fd_system_program_instruction_create_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17880 162 : int err;
17881 162 : err = fd_bincode_uint64_encode( self->lamports, ctx );
17882 162 : if( FD_UNLIKELY( err ) ) return err;
17883 162 : err = fd_bincode_uint64_encode( self->space, ctx );
17884 162 : if( FD_UNLIKELY( err ) ) return err;
17885 162 : err = fd_pubkey_encode( &self->owner, ctx );
17886 162 : if( FD_UNLIKELY( err ) ) return err;
17887 162 : return FD_BINCODE_SUCCESS;
17888 162 : }
17889 0 : int fd_system_program_instruction_create_account_decode_offsets( fd_system_program_instruction_create_account_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
17890 0 : uchar const * data = ctx->data;
17891 0 : int err;
17892 0 : self->lamports_off = (uint)( (ulong)ctx->data - (ulong)data );
17893 0 : err = fd_bincode_uint64_decode_preflight( ctx );
17894 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17895 0 : self->space_off = (uint)( (ulong)ctx->data - (ulong)data );
17896 0 : err = fd_bincode_uint64_decode_preflight( ctx );
17897 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17898 0 : self->owner_off = (uint)( (ulong)ctx->data - (ulong)data );
17899 0 : err = fd_pubkey_decode_preflight( ctx );
17900 0 : if( FD_UNLIKELY( err ) ) return err;
17901 0 : return FD_BINCODE_SUCCESS;
17902 0 : }
17903 0 : void fd_system_program_instruction_create_account_new(fd_system_program_instruction_create_account_t * self) {
17904 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_t) );
17905 0 : fd_pubkey_new( &self->owner );
17906 0 : }
17907 801 : void fd_system_program_instruction_create_account_destroy( fd_system_program_instruction_create_account_t * self, fd_bincode_destroy_ctx_t * ctx ) {
17908 801 : fd_pubkey_destroy( &self->owner, ctx );
17909 801 : }
17910 :
17911 0 : ulong fd_system_program_instruction_create_account_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_CREATE_ACCOUNT_FOOTPRINT; }
17912 0 : ulong fd_system_program_instruction_create_account_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_CREATE_ACCOUNT_ALIGN; }
17913 :
17914 0 : void fd_system_program_instruction_create_account_walk( void * w, fd_system_program_instruction_create_account_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
17915 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account", level++ );
17916 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
17917 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
17918 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
17919 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account", level-- );
17920 0 : }
17921 0 : ulong fd_system_program_instruction_create_account_size( fd_system_program_instruction_create_account_t const * self ) {
17922 0 : ulong size = 0;
17923 0 : size += sizeof(ulong);
17924 0 : size += sizeof(ulong);
17925 0 : size += fd_pubkey_size( &self->owner );
17926 0 : return size;
17927 0 : }
17928 :
17929 0 : int fd_system_program_instruction_create_account_with_seed_decode( fd_system_program_instruction_create_account_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
17930 0 : void const * data = ctx->data;
17931 0 : int err = fd_system_program_instruction_create_account_with_seed_decode_preflight( ctx );
17932 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17933 0 : ctx->data = data;
17934 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
17935 0 : fd_system_program_instruction_create_account_with_seed_new( self );
17936 0 : }
17937 0 : fd_system_program_instruction_create_account_with_seed_decode_unsafe( self, ctx );
17938 0 : return FD_BINCODE_SUCCESS;
17939 0 : }
17940 1701 : int fd_system_program_instruction_create_account_with_seed_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
17941 1701 : int err;
17942 1701 : err = fd_pubkey_decode_preflight( ctx );
17943 1701 : if( FD_UNLIKELY( err ) ) return err;
17944 1677 : ulong seed_len;
17945 1677 : err = fd_bincode_uint64_decode( &seed_len, ctx );
17946 1677 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17947 1665 : if( seed_len ) {
17948 1617 : err = fd_bincode_bytes_decode_preflight( seed_len, ctx );
17949 1617 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17950 1575 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
17951 1575 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17952 1575 : }
17953 1551 : err = fd_bincode_uint64_decode_preflight( ctx );
17954 1551 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17955 1539 : err = fd_bincode_uint64_decode_preflight( ctx );
17956 1539 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17957 1527 : err = fd_pubkey_decode_preflight( ctx );
17958 1527 : if( FD_UNLIKELY( err ) ) return err;
17959 1515 : return FD_BINCODE_SUCCESS;
17960 1527 : }
17961 1515 : void fd_system_program_instruction_create_account_with_seed_decode_unsafe( fd_system_program_instruction_create_account_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
17962 1515 : fd_pubkey_decode_unsafe( &self->base, ctx );
17963 1515 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
17964 1515 : if( self->seed_len ) {
17965 1473 : self->seed = fd_valloc_malloc( ctx->valloc, 8UL, self->seed_len );
17966 1473 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
17967 1473 : } else
17968 42 : self->seed = NULL;
17969 1515 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
17970 1515 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
17971 1515 : fd_pubkey_decode_unsafe( &self->owner, ctx );
17972 1515 : }
17973 0 : int fd_system_program_instruction_create_account_with_seed_encode( fd_system_program_instruction_create_account_with_seed_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17974 0 : int err;
17975 0 : err = fd_pubkey_encode( &self->base, ctx );
17976 0 : if( FD_UNLIKELY( err ) ) return err;
17977 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
17978 0 : if( FD_UNLIKELY(err) ) return err;
17979 0 : if( self->seed_len ) {
17980 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
17981 0 : if( FD_UNLIKELY( err ) ) return err;
17982 0 : }
17983 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
17984 0 : if( FD_UNLIKELY( err ) ) return err;
17985 0 : err = fd_bincode_uint64_encode( self->space, ctx );
17986 0 : if( FD_UNLIKELY( err ) ) return err;
17987 0 : err = fd_pubkey_encode( &self->owner, ctx );
17988 0 : if( FD_UNLIKELY( err ) ) return err;
17989 0 : return FD_BINCODE_SUCCESS;
17990 0 : }
17991 0 : int fd_system_program_instruction_create_account_with_seed_decode_offsets( fd_system_program_instruction_create_account_with_seed_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
17992 0 : uchar const * data = ctx->data;
17993 0 : int err;
17994 0 : self->base_off = (uint)( (ulong)ctx->data - (ulong)data );
17995 0 : err = fd_pubkey_decode_preflight( ctx );
17996 0 : if( FD_UNLIKELY( err ) ) return err;
17997 0 : self->seed_off = (uint)( (ulong)ctx->data - (ulong)data );
17998 0 : ulong seed_len;
17999 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
18000 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18001 0 : if( seed_len ) {
18002 0 : err = fd_bincode_bytes_decode_preflight( seed_len, ctx );
18003 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18004 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
18005 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18006 0 : }
18007 0 : self->lamports_off = (uint)( (ulong)ctx->data - (ulong)data );
18008 0 : err = fd_bincode_uint64_decode_preflight( ctx );
18009 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18010 0 : self->space_off = (uint)( (ulong)ctx->data - (ulong)data );
18011 0 : err = fd_bincode_uint64_decode_preflight( ctx );
18012 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18013 0 : self->owner_off = (uint)( (ulong)ctx->data - (ulong)data );
18014 0 : err = fd_pubkey_decode_preflight( ctx );
18015 0 : if( FD_UNLIKELY( err ) ) return err;
18016 0 : return FD_BINCODE_SUCCESS;
18017 0 : }
18018 0 : void fd_system_program_instruction_create_account_with_seed_new(fd_system_program_instruction_create_account_with_seed_t * self) {
18019 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_with_seed_t) );
18020 0 : fd_pubkey_new( &self->base );
18021 0 : fd_pubkey_new( &self->owner );
18022 0 : }
18023 1515 : void fd_system_program_instruction_create_account_with_seed_destroy( fd_system_program_instruction_create_account_with_seed_t * self, fd_bincode_destroy_ctx_t * ctx ) {
18024 1515 : fd_pubkey_destroy( &self->base, ctx );
18025 1515 : if( self->seed ) {
18026 1473 : fd_valloc_free( ctx->valloc, self->seed );
18027 1473 : self->seed = NULL;
18028 1473 : }
18029 1515 : fd_pubkey_destroy( &self->owner, ctx );
18030 1515 : }
18031 :
18032 0 : ulong fd_system_program_instruction_create_account_with_seed_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_CREATE_ACCOUNT_WITH_SEED_FOOTPRINT; }
18033 0 : ulong fd_system_program_instruction_create_account_with_seed_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_CREATE_ACCOUNT_WITH_SEED_ALIGN; }
18034 :
18035 0 : void fd_system_program_instruction_create_account_with_seed_walk( void * w, fd_system_program_instruction_create_account_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
18036 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account_with_seed", level++ );
18037 0 : fd_pubkey_walk( w, &self->base, fun, "base", level );
18038 0 : fun(w, self->seed, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
18039 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
18040 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
18041 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
18042 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account_with_seed", level-- );
18043 0 : }
18044 0 : ulong fd_system_program_instruction_create_account_with_seed_size( fd_system_program_instruction_create_account_with_seed_t const * self ) {
18045 0 : ulong size = 0;
18046 0 : size += fd_pubkey_size( &self->base );
18047 0 : do {
18048 0 : size += sizeof(ulong);
18049 0 : size += self->seed_len;
18050 0 : } while(0);
18051 0 : size += sizeof(ulong);
18052 0 : size += sizeof(ulong);
18053 0 : size += fd_pubkey_size( &self->owner );
18054 0 : return size;
18055 0 : }
18056 :
18057 0 : int fd_system_program_instruction_allocate_with_seed_decode( fd_system_program_instruction_allocate_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
18058 0 : void const * data = ctx->data;
18059 0 : int err = fd_system_program_instruction_allocate_with_seed_decode_preflight( ctx );
18060 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18061 0 : ctx->data = data;
18062 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
18063 0 : fd_system_program_instruction_allocate_with_seed_new( self );
18064 0 : }
18065 0 : fd_system_program_instruction_allocate_with_seed_decode_unsafe( self, ctx );
18066 0 : return FD_BINCODE_SUCCESS;
18067 0 : }
18068 738 : int fd_system_program_instruction_allocate_with_seed_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
18069 738 : int err;
18070 738 : err = fd_pubkey_decode_preflight( ctx );
18071 738 : if( FD_UNLIKELY( err ) ) return err;
18072 723 : ulong seed_len;
18073 723 : err = fd_bincode_uint64_decode( &seed_len, ctx );
18074 723 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18075 711 : if( seed_len ) {
18076 633 : err = fd_bincode_bytes_decode_preflight( seed_len, ctx );
18077 633 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18078 615 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
18079 615 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18080 615 : }
18081 663 : err = fd_bincode_uint64_decode_preflight( ctx );
18082 663 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18083 651 : err = fd_pubkey_decode_preflight( ctx );
18084 651 : if( FD_UNLIKELY( err ) ) return err;
18085 630 : return FD_BINCODE_SUCCESS;
18086 651 : }
18087 630 : void fd_system_program_instruction_allocate_with_seed_decode_unsafe( fd_system_program_instruction_allocate_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
18088 630 : fd_pubkey_decode_unsafe( &self->base, ctx );
18089 630 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
18090 630 : if( self->seed_len ) {
18091 555 : self->seed = fd_valloc_malloc( ctx->valloc, 8UL, self->seed_len );
18092 555 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
18093 555 : } else
18094 75 : self->seed = NULL;
18095 630 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
18096 630 : fd_pubkey_decode_unsafe( &self->owner, ctx );
18097 630 : }
18098 0 : int fd_system_program_instruction_allocate_with_seed_encode( fd_system_program_instruction_allocate_with_seed_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18099 0 : int err;
18100 0 : err = fd_pubkey_encode( &self->base, ctx );
18101 0 : if( FD_UNLIKELY( err ) ) return err;
18102 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
18103 0 : if( FD_UNLIKELY(err) ) return err;
18104 0 : if( self->seed_len ) {
18105 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
18106 0 : if( FD_UNLIKELY( err ) ) return err;
18107 0 : }
18108 0 : err = fd_bincode_uint64_encode( self->space, ctx );
18109 0 : if( FD_UNLIKELY( err ) ) return err;
18110 0 : err = fd_pubkey_encode( &self->owner, ctx );
18111 0 : if( FD_UNLIKELY( err ) ) return err;
18112 0 : return FD_BINCODE_SUCCESS;
18113 0 : }
18114 0 : int fd_system_program_instruction_allocate_with_seed_decode_offsets( fd_system_program_instruction_allocate_with_seed_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
18115 0 : uchar const * data = ctx->data;
18116 0 : int err;
18117 0 : self->base_off = (uint)( (ulong)ctx->data - (ulong)data );
18118 0 : err = fd_pubkey_decode_preflight( ctx );
18119 0 : if( FD_UNLIKELY( err ) ) return err;
18120 0 : self->seed_off = (uint)( (ulong)ctx->data - (ulong)data );
18121 0 : ulong seed_len;
18122 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
18123 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18124 0 : if( seed_len ) {
18125 0 : err = fd_bincode_bytes_decode_preflight( seed_len, ctx );
18126 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18127 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
18128 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18129 0 : }
18130 0 : self->space_off = (uint)( (ulong)ctx->data - (ulong)data );
18131 0 : err = fd_bincode_uint64_decode_preflight( ctx );
18132 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18133 0 : self->owner_off = (uint)( (ulong)ctx->data - (ulong)data );
18134 0 : err = fd_pubkey_decode_preflight( ctx );
18135 0 : if( FD_UNLIKELY( err ) ) return err;
18136 0 : return FD_BINCODE_SUCCESS;
18137 0 : }
18138 0 : void fd_system_program_instruction_allocate_with_seed_new(fd_system_program_instruction_allocate_with_seed_t * self) {
18139 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_allocate_with_seed_t) );
18140 0 : fd_pubkey_new( &self->base );
18141 0 : fd_pubkey_new( &self->owner );
18142 0 : }
18143 630 : void fd_system_program_instruction_allocate_with_seed_destroy( fd_system_program_instruction_allocate_with_seed_t * self, fd_bincode_destroy_ctx_t * ctx ) {
18144 630 : fd_pubkey_destroy( &self->base, ctx );
18145 630 : if( self->seed ) {
18146 555 : fd_valloc_free( ctx->valloc, self->seed );
18147 555 : self->seed = NULL;
18148 555 : }
18149 630 : fd_pubkey_destroy( &self->owner, ctx );
18150 630 : }
18151 :
18152 0 : ulong fd_system_program_instruction_allocate_with_seed_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ALLOCATE_WITH_SEED_FOOTPRINT; }
18153 0 : ulong fd_system_program_instruction_allocate_with_seed_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ALLOCATE_WITH_SEED_ALIGN; }
18154 :
18155 0 : void fd_system_program_instruction_allocate_with_seed_walk( void * w, fd_system_program_instruction_allocate_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
18156 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_allocate_with_seed", level++ );
18157 0 : fd_pubkey_walk( w, &self->base, fun, "base", level );
18158 0 : fun(w, self->seed, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
18159 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
18160 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
18161 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_allocate_with_seed", level-- );
18162 0 : }
18163 0 : ulong fd_system_program_instruction_allocate_with_seed_size( fd_system_program_instruction_allocate_with_seed_t const * self ) {
18164 0 : ulong size = 0;
18165 0 : size += fd_pubkey_size( &self->base );
18166 0 : do {
18167 0 : size += sizeof(ulong);
18168 0 : size += self->seed_len;
18169 0 : } while(0);
18170 0 : size += sizeof(ulong);
18171 0 : size += fd_pubkey_size( &self->owner );
18172 0 : return size;
18173 0 : }
18174 :
18175 0 : int fd_system_program_instruction_assign_with_seed_decode( fd_system_program_instruction_assign_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
18176 0 : void const * data = ctx->data;
18177 0 : int err = fd_system_program_instruction_assign_with_seed_decode_preflight( ctx );
18178 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18179 0 : ctx->data = data;
18180 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
18181 0 : fd_system_program_instruction_assign_with_seed_new( self );
18182 0 : }
18183 0 : fd_system_program_instruction_assign_with_seed_decode_unsafe( self, ctx );
18184 0 : return FD_BINCODE_SUCCESS;
18185 0 : }
18186 690 : int fd_system_program_instruction_assign_with_seed_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
18187 690 : int err;
18188 690 : err = fd_pubkey_decode_preflight( ctx );
18189 690 : if( FD_UNLIKELY( err ) ) return err;
18190 678 : ulong seed_len;
18191 678 : err = fd_bincode_uint64_decode( &seed_len, ctx );
18192 678 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18193 666 : if( seed_len ) {
18194 651 : err = fd_bincode_bytes_decode_preflight( seed_len, ctx );
18195 651 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18196 627 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
18197 627 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18198 627 : }
18199 615 : err = fd_pubkey_decode_preflight( ctx );
18200 615 : if( FD_UNLIKELY( err ) ) return err;
18201 603 : return FD_BINCODE_SUCCESS;
18202 615 : }
18203 603 : void fd_system_program_instruction_assign_with_seed_decode_unsafe( fd_system_program_instruction_assign_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
18204 603 : fd_pubkey_decode_unsafe( &self->base, ctx );
18205 603 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
18206 603 : if( self->seed_len ) {
18207 588 : self->seed = fd_valloc_malloc( ctx->valloc, 8UL, self->seed_len );
18208 588 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
18209 588 : } else
18210 15 : self->seed = NULL;
18211 603 : fd_pubkey_decode_unsafe( &self->owner, ctx );
18212 603 : }
18213 0 : int fd_system_program_instruction_assign_with_seed_encode( fd_system_program_instruction_assign_with_seed_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18214 0 : int err;
18215 0 : err = fd_pubkey_encode( &self->base, ctx );
18216 0 : if( FD_UNLIKELY( err ) ) return err;
18217 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
18218 0 : if( FD_UNLIKELY(err) ) return err;
18219 0 : if( self->seed_len ) {
18220 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
18221 0 : if( FD_UNLIKELY( err ) ) return err;
18222 0 : }
18223 0 : err = fd_pubkey_encode( &self->owner, ctx );
18224 0 : if( FD_UNLIKELY( err ) ) return err;
18225 0 : return FD_BINCODE_SUCCESS;
18226 0 : }
18227 0 : int fd_system_program_instruction_assign_with_seed_decode_offsets( fd_system_program_instruction_assign_with_seed_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
18228 0 : uchar const * data = ctx->data;
18229 0 : int err;
18230 0 : self->base_off = (uint)( (ulong)ctx->data - (ulong)data );
18231 0 : err = fd_pubkey_decode_preflight( ctx );
18232 0 : if( FD_UNLIKELY( err ) ) return err;
18233 0 : self->seed_off = (uint)( (ulong)ctx->data - (ulong)data );
18234 0 : ulong seed_len;
18235 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
18236 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18237 0 : if( seed_len ) {
18238 0 : err = fd_bincode_bytes_decode_preflight( seed_len, ctx );
18239 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18240 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
18241 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18242 0 : }
18243 0 : self->owner_off = (uint)( (ulong)ctx->data - (ulong)data );
18244 0 : err = fd_pubkey_decode_preflight( ctx );
18245 0 : if( FD_UNLIKELY( err ) ) return err;
18246 0 : return FD_BINCODE_SUCCESS;
18247 0 : }
18248 0 : void fd_system_program_instruction_assign_with_seed_new(fd_system_program_instruction_assign_with_seed_t * self) {
18249 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_assign_with_seed_t) );
18250 0 : fd_pubkey_new( &self->base );
18251 0 : fd_pubkey_new( &self->owner );
18252 0 : }
18253 603 : void fd_system_program_instruction_assign_with_seed_destroy( fd_system_program_instruction_assign_with_seed_t * self, fd_bincode_destroy_ctx_t * ctx ) {
18254 603 : fd_pubkey_destroy( &self->base, ctx );
18255 603 : if( self->seed ) {
18256 588 : fd_valloc_free( ctx->valloc, self->seed );
18257 588 : self->seed = NULL;
18258 588 : }
18259 603 : fd_pubkey_destroy( &self->owner, ctx );
18260 603 : }
18261 :
18262 0 : ulong fd_system_program_instruction_assign_with_seed_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ASSIGN_WITH_SEED_FOOTPRINT; }
18263 0 : ulong fd_system_program_instruction_assign_with_seed_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ASSIGN_WITH_SEED_ALIGN; }
18264 :
18265 0 : void fd_system_program_instruction_assign_with_seed_walk( void * w, fd_system_program_instruction_assign_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
18266 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_assign_with_seed", level++ );
18267 0 : fd_pubkey_walk( w, &self->base, fun, "base", level );
18268 0 : fun(w, self->seed, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
18269 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level );
18270 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_assign_with_seed", level-- );
18271 0 : }
18272 0 : ulong fd_system_program_instruction_assign_with_seed_size( fd_system_program_instruction_assign_with_seed_t const * self ) {
18273 0 : ulong size = 0;
18274 0 : size += fd_pubkey_size( &self->base );
18275 0 : do {
18276 0 : size += sizeof(ulong);
18277 0 : size += self->seed_len;
18278 0 : } while(0);
18279 0 : size += fd_pubkey_size( &self->owner );
18280 0 : return size;
18281 0 : }
18282 :
18283 0 : int fd_system_program_instruction_transfer_with_seed_decode( fd_system_program_instruction_transfer_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
18284 0 : void const * data = ctx->data;
18285 0 : int err = fd_system_program_instruction_transfer_with_seed_decode_preflight( ctx );
18286 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18287 0 : ctx->data = data;
18288 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
18289 0 : fd_system_program_instruction_transfer_with_seed_new( self );
18290 0 : }
18291 0 : fd_system_program_instruction_transfer_with_seed_decode_unsafe( self, ctx );
18292 0 : return FD_BINCODE_SUCCESS;
18293 0 : }
18294 1365 : int fd_system_program_instruction_transfer_with_seed_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
18295 1365 : int err;
18296 1365 : err = fd_bincode_uint64_decode_preflight( ctx );
18297 1365 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18298 1350 : ulong from_seed_len;
18299 1350 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
18300 1350 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18301 1341 : if( from_seed_len ) {
18302 1317 : err = fd_bincode_bytes_decode_preflight( from_seed_len, ctx );
18303 1317 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18304 1266 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
18305 1266 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18306 1266 : }
18307 1266 : err = fd_pubkey_decode_preflight( ctx );
18308 1266 : if( FD_UNLIKELY( err ) ) return err;
18309 1239 : return FD_BINCODE_SUCCESS;
18310 1266 : }
18311 1239 : void fd_system_program_instruction_transfer_with_seed_decode_unsafe( fd_system_program_instruction_transfer_with_seed_t * self, fd_bincode_decode_ctx_t * ctx ) {
18312 1239 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
18313 1239 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
18314 1239 : if( self->from_seed_len ) {
18315 1218 : self->from_seed = fd_valloc_malloc( ctx->valloc, 8UL, self->from_seed_len );
18316 1218 : fd_bincode_bytes_decode_unsafe( self->from_seed, self->from_seed_len, ctx );
18317 1218 : } else
18318 21 : self->from_seed = NULL;
18319 1239 : fd_pubkey_decode_unsafe( &self->from_owner, ctx );
18320 1239 : }
18321 0 : int fd_system_program_instruction_transfer_with_seed_encode( fd_system_program_instruction_transfer_with_seed_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18322 0 : int err;
18323 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
18324 0 : if( FD_UNLIKELY( err ) ) return err;
18325 0 : err = fd_bincode_uint64_encode( self->from_seed_len, ctx );
18326 0 : if( FD_UNLIKELY(err) ) return err;
18327 0 : if( self->from_seed_len ) {
18328 0 : err = fd_bincode_bytes_encode( self->from_seed, self->from_seed_len, ctx );
18329 0 : if( FD_UNLIKELY( err ) ) return err;
18330 0 : }
18331 0 : err = fd_pubkey_encode( &self->from_owner, ctx );
18332 0 : if( FD_UNLIKELY( err ) ) return err;
18333 0 : return FD_BINCODE_SUCCESS;
18334 0 : }
18335 0 : int fd_system_program_instruction_transfer_with_seed_decode_offsets( fd_system_program_instruction_transfer_with_seed_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
18336 0 : uchar const * data = ctx->data;
18337 0 : int err;
18338 0 : self->lamports_off = (uint)( (ulong)ctx->data - (ulong)data );
18339 0 : err = fd_bincode_uint64_decode_preflight( ctx );
18340 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18341 0 : self->from_seed_off = (uint)( (ulong)ctx->data - (ulong)data );
18342 0 : ulong from_seed_len;
18343 0 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
18344 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18345 0 : if( from_seed_len ) {
18346 0 : err = fd_bincode_bytes_decode_preflight( from_seed_len, ctx );
18347 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18348 0 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
18349 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18350 0 : }
18351 0 : self->from_owner_off = (uint)( (ulong)ctx->data - (ulong)data );
18352 0 : err = fd_pubkey_decode_preflight( ctx );
18353 0 : if( FD_UNLIKELY( err ) ) return err;
18354 0 : return FD_BINCODE_SUCCESS;
18355 0 : }
18356 0 : void fd_system_program_instruction_transfer_with_seed_new(fd_system_program_instruction_transfer_with_seed_t * self) {
18357 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_transfer_with_seed_t) );
18358 0 : fd_pubkey_new( &self->from_owner );
18359 0 : }
18360 1239 : void fd_system_program_instruction_transfer_with_seed_destroy( fd_system_program_instruction_transfer_with_seed_t * self, fd_bincode_destroy_ctx_t * ctx ) {
18361 1239 : if( self->from_seed ) {
18362 1218 : fd_valloc_free( ctx->valloc, self->from_seed );
18363 1218 : self->from_seed = NULL;
18364 1218 : }
18365 1239 : fd_pubkey_destroy( &self->from_owner, ctx );
18366 1239 : }
18367 :
18368 0 : ulong fd_system_program_instruction_transfer_with_seed_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_TRANSFER_WITH_SEED_FOOTPRINT; }
18369 0 : ulong fd_system_program_instruction_transfer_with_seed_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_TRANSFER_WITH_SEED_ALIGN; }
18370 :
18371 0 : void fd_system_program_instruction_transfer_with_seed_walk( void * w, fd_system_program_instruction_transfer_with_seed_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
18372 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_transfer_with_seed", level++ );
18373 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
18374 0 : fun(w, self->from_seed, "from_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
18375 0 : fd_pubkey_walk( w, &self->from_owner, fun, "from_owner", level );
18376 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_transfer_with_seed", level-- );
18377 0 : }
18378 0 : ulong fd_system_program_instruction_transfer_with_seed_size( fd_system_program_instruction_transfer_with_seed_t const * self ) {
18379 0 : ulong size = 0;
18380 0 : size += sizeof(ulong);
18381 0 : do {
18382 0 : size += sizeof(ulong);
18383 0 : size += self->from_seed_len;
18384 0 : } while(0);
18385 0 : size += fd_pubkey_size( &self->from_owner );
18386 0 : return size;
18387 0 : }
18388 :
18389 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account(fd_system_program_instruction_t const * self) {
18390 0 : return self->discriminant == 0;
18391 0 : }
18392 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign(fd_system_program_instruction_t const * self) {
18393 0 : return self->discriminant == 1;
18394 0 : }
18395 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer(fd_system_program_instruction_t const * self) {
18396 0 : return self->discriminant == 2;
18397 0 : }
18398 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_with_seed(fd_system_program_instruction_t const * self) {
18399 0 : return self->discriminant == 3;
18400 0 : }
18401 0 : FD_FN_PURE uchar fd_system_program_instruction_is_advance_nonce_account(fd_system_program_instruction_t const * self) {
18402 0 : return self->discriminant == 4;
18403 0 : }
18404 0 : FD_FN_PURE uchar fd_system_program_instruction_is_withdraw_nonce_account(fd_system_program_instruction_t const * self) {
18405 0 : return self->discriminant == 5;
18406 0 : }
18407 0 : FD_FN_PURE uchar fd_system_program_instruction_is_initialize_nonce_account(fd_system_program_instruction_t const * self) {
18408 0 : return self->discriminant == 6;
18409 0 : }
18410 0 : FD_FN_PURE uchar fd_system_program_instruction_is_authorize_nonce_account(fd_system_program_instruction_t const * self) {
18411 0 : return self->discriminant == 7;
18412 0 : }
18413 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate(fd_system_program_instruction_t const * self) {
18414 0 : return self->discriminant == 8;
18415 0 : }
18416 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate_with_seed(fd_system_program_instruction_t const * self) {
18417 0 : return self->discriminant == 9;
18418 0 : }
18419 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign_with_seed(fd_system_program_instruction_t const * self) {
18420 0 : return self->discriminant == 10;
18421 0 : }
18422 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer_with_seed(fd_system_program_instruction_t const * self) {
18423 0 : return self->discriminant == 11;
18424 0 : }
18425 0 : FD_FN_PURE uchar fd_system_program_instruction_is_upgrade_nonce_account(fd_system_program_instruction_t const * self) {
18426 0 : return self->discriminant == 12;
18427 0 : }
18428 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant );
18429 15714 : int fd_system_program_instruction_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18430 15714 : int err;
18431 15714 : switch (discriminant) {
18432 1188 : case 0: {
18433 1188 : err = fd_system_program_instruction_create_account_decode_preflight( ctx );
18434 1188 : if( FD_UNLIKELY( err ) ) return err;
18435 801 : return FD_BINCODE_SUCCESS;
18436 1188 : }
18437 876 : case 1: {
18438 876 : err = fd_pubkey_decode_preflight( ctx );
18439 876 : if( FD_UNLIKELY( err ) ) return err;
18440 750 : return FD_BINCODE_SUCCESS;
18441 876 : }
18442 807 : case 2: {
18443 807 : err = fd_bincode_uint64_decode_preflight( ctx );
18444 807 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18445 786 : return FD_BINCODE_SUCCESS;
18446 807 : }
18447 1701 : case 3: {
18448 1701 : err = fd_system_program_instruction_create_account_with_seed_decode_preflight( ctx );
18449 1701 : if( FD_UNLIKELY( err ) ) return err;
18450 1515 : return FD_BINCODE_SUCCESS;
18451 1701 : }
18452 1593 : case 4: {
18453 1593 : return FD_BINCODE_SUCCESS;
18454 1701 : }
18455 1383 : case 5: {
18456 1383 : err = fd_bincode_uint64_decode_preflight( ctx );
18457 1383 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18458 1365 : return FD_BINCODE_SUCCESS;
18459 1383 : }
18460 606 : case 6: {
18461 606 : err = fd_pubkey_decode_preflight( ctx );
18462 606 : if( FD_UNLIKELY( err ) ) return err;
18463 594 : return FD_BINCODE_SUCCESS;
18464 606 : }
18465 1260 : case 7: {
18466 1260 : err = fd_pubkey_decode_preflight( ctx );
18467 1260 : if( FD_UNLIKELY( err ) ) return err;
18468 1224 : return FD_BINCODE_SUCCESS;
18469 1260 : }
18470 1065 : case 8: {
18471 1065 : err = fd_bincode_uint64_decode_preflight( ctx );
18472 1065 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18473 1053 : return FD_BINCODE_SUCCESS;
18474 1065 : }
18475 738 : case 9: {
18476 738 : err = fd_system_program_instruction_allocate_with_seed_decode_preflight( ctx );
18477 738 : if( FD_UNLIKELY( err ) ) return err;
18478 630 : return FD_BINCODE_SUCCESS;
18479 738 : }
18480 690 : case 10: {
18481 690 : err = fd_system_program_instruction_assign_with_seed_decode_preflight( ctx );
18482 690 : if( FD_UNLIKELY( err ) ) return err;
18483 603 : return FD_BINCODE_SUCCESS;
18484 690 : }
18485 1365 : case 11: {
18486 1365 : err = fd_system_program_instruction_transfer_with_seed_decode_preflight( ctx );
18487 1365 : if( FD_UNLIKELY( err ) ) return err;
18488 1239 : return FD_BINCODE_SUCCESS;
18489 1365 : }
18490 612 : case 12: {
18491 612 : return FD_BINCODE_SUCCESS;
18492 1365 : }
18493 1830 : default: return FD_BINCODE_ERR_ENCODING;
18494 15714 : }
18495 15714 : }
18496 12765 : void fd_system_program_instruction_inner_decode_unsafe( fd_system_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18497 12765 : switch (discriminant) {
18498 801 : case 0: {
18499 801 : fd_system_program_instruction_create_account_decode_unsafe( &self->create_account, ctx );
18500 801 : break;
18501 0 : }
18502 750 : case 1: {
18503 750 : fd_pubkey_decode_unsafe( &self->assign, ctx );
18504 750 : break;
18505 0 : }
18506 786 : case 2: {
18507 786 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
18508 786 : break;
18509 0 : }
18510 1515 : case 3: {
18511 1515 : fd_system_program_instruction_create_account_with_seed_decode_unsafe( &self->create_account_with_seed, ctx );
18512 1515 : break;
18513 0 : }
18514 1593 : case 4: {
18515 1593 : break;
18516 0 : }
18517 1365 : case 5: {
18518 1365 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
18519 1365 : break;
18520 0 : }
18521 594 : case 6: {
18522 594 : fd_pubkey_decode_unsafe( &self->initialize_nonce_account, ctx );
18523 594 : break;
18524 0 : }
18525 1224 : case 7: {
18526 1224 : fd_pubkey_decode_unsafe( &self->authorize_nonce_account, ctx );
18527 1224 : break;
18528 0 : }
18529 1053 : case 8: {
18530 1053 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
18531 1053 : break;
18532 0 : }
18533 630 : case 9: {
18534 630 : fd_system_program_instruction_allocate_with_seed_decode_unsafe( &self->allocate_with_seed, ctx );
18535 630 : break;
18536 0 : }
18537 603 : case 10: {
18538 603 : fd_system_program_instruction_assign_with_seed_decode_unsafe( &self->assign_with_seed, ctx );
18539 603 : break;
18540 0 : }
18541 1239 : case 11: {
18542 1239 : fd_system_program_instruction_transfer_with_seed_decode_unsafe( &self->transfer_with_seed, ctx );
18543 1239 : break;
18544 0 : }
18545 612 : case 12: {
18546 612 : break;
18547 0 : }
18548 12765 : }
18549 12765 : }
18550 15768 : int fd_system_program_instruction_decode( fd_system_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
18551 15768 : void const * data = ctx->data;
18552 15768 : int err = fd_system_program_instruction_decode_preflight( ctx );
18553 15768 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18554 12765 : ctx->data = data;
18555 12765 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
18556 12765 : fd_system_program_instruction_new( self );
18557 12765 : }
18558 12765 : fd_system_program_instruction_decode_unsafe( self, ctx );
18559 12765 : return FD_BINCODE_SUCCESS;
18560 15768 : }
18561 15768 : int fd_system_program_instruction_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
18562 15768 : uint discriminant = 0;
18563 15768 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
18564 15768 : if( FD_UNLIKELY( err ) ) return err;
18565 15714 : return fd_system_program_instruction_inner_decode_preflight( discriminant, ctx );
18566 15768 : }
18567 12765 : void fd_system_program_instruction_decode_unsafe( fd_system_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
18568 12765 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
18569 12765 : fd_system_program_instruction_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
18570 12765 : }
18571 12765 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant ) {
18572 12765 : switch( discriminant ) {
18573 0 : case 0: {
18574 0 : fd_system_program_instruction_create_account_new( &self->create_account );
18575 0 : break;
18576 0 : }
18577 0 : case 1: {
18578 0 : fd_pubkey_new( &self->assign );
18579 0 : break;
18580 0 : }
18581 0 : case 2: {
18582 0 : break;
18583 0 : }
18584 0 : case 3: {
18585 0 : fd_system_program_instruction_create_account_with_seed_new( &self->create_account_with_seed );
18586 0 : break;
18587 0 : }
18588 0 : case 4: {
18589 0 : break;
18590 0 : }
18591 0 : case 5: {
18592 0 : break;
18593 0 : }
18594 0 : case 6: {
18595 0 : fd_pubkey_new( &self->initialize_nonce_account );
18596 0 : break;
18597 0 : }
18598 0 : case 7: {
18599 0 : fd_pubkey_new( &self->authorize_nonce_account );
18600 0 : break;
18601 0 : }
18602 0 : case 8: {
18603 0 : break;
18604 0 : }
18605 0 : case 9: {
18606 0 : fd_system_program_instruction_allocate_with_seed_new( &self->allocate_with_seed );
18607 0 : break;
18608 0 : }
18609 0 : case 10: {
18610 0 : fd_system_program_instruction_assign_with_seed_new( &self->assign_with_seed );
18611 0 : break;
18612 0 : }
18613 0 : case 11: {
18614 0 : fd_system_program_instruction_transfer_with_seed_new( &self->transfer_with_seed );
18615 0 : break;
18616 0 : }
18617 0 : case 12: {
18618 0 : break;
18619 0 : }
18620 12765 : default: break; // FD_LOG_ERR(( "unhandled type"));
18621 12765 : }
18622 12765 : }
18623 12765 : void fd_system_program_instruction_new_disc( fd_system_program_instruction_t * self, uint discriminant ) {
18624 12765 : self->discriminant = discriminant;
18625 12765 : fd_system_program_instruction_inner_new( &self->inner, self->discriminant );
18626 12765 : }
18627 12765 : void fd_system_program_instruction_new( fd_system_program_instruction_t * self ) {
18628 12765 : fd_memset( self, 0, sizeof(fd_system_program_instruction_t) );
18629 12765 : fd_system_program_instruction_new_disc( self, UINT_MAX );
18630 12765 : }
18631 12765 : void fd_system_program_instruction_inner_destroy( fd_system_program_instruction_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
18632 12765 : switch( discriminant ) {
18633 801 : case 0: {
18634 801 : fd_system_program_instruction_create_account_destroy( &self->create_account, ctx );
18635 801 : break;
18636 0 : }
18637 750 : case 1: {
18638 750 : fd_pubkey_destroy( &self->assign, ctx );
18639 750 : break;
18640 0 : }
18641 786 : case 2: {
18642 786 : break;
18643 0 : }
18644 1515 : case 3: {
18645 1515 : fd_system_program_instruction_create_account_with_seed_destroy( &self->create_account_with_seed, ctx );
18646 1515 : break;
18647 0 : }
18648 1365 : case 5: {
18649 1365 : break;
18650 0 : }
18651 594 : case 6: {
18652 594 : fd_pubkey_destroy( &self->initialize_nonce_account, ctx );
18653 594 : break;
18654 0 : }
18655 1224 : case 7: {
18656 1224 : fd_pubkey_destroy( &self->authorize_nonce_account, ctx );
18657 1224 : break;
18658 0 : }
18659 1053 : case 8: {
18660 1053 : break;
18661 0 : }
18662 630 : case 9: {
18663 630 : fd_system_program_instruction_allocate_with_seed_destroy( &self->allocate_with_seed, ctx );
18664 630 : break;
18665 0 : }
18666 603 : case 10: {
18667 603 : fd_system_program_instruction_assign_with_seed_destroy( &self->assign_with_seed, ctx );
18668 603 : break;
18669 0 : }
18670 1239 : case 11: {
18671 1239 : fd_system_program_instruction_transfer_with_seed_destroy( &self->transfer_with_seed, ctx );
18672 1239 : break;
18673 0 : }
18674 2205 : default: break; // FD_LOG_ERR(( "unhandled type" ));
18675 12765 : }
18676 12765 : }
18677 12765 : void fd_system_program_instruction_destroy( fd_system_program_instruction_t * self, fd_bincode_destroy_ctx_t * ctx ) {
18678 12765 : fd_system_program_instruction_inner_destroy( &self->inner, self->discriminant, ctx );
18679 12765 : }
18680 :
18681 0 : ulong fd_system_program_instruction_footprint( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_FOOTPRINT; }
18682 0 : ulong fd_system_program_instruction_align( void ){ return FD_SYSTEM_PROGRAM_INSTRUCTION_ALIGN; }
18683 :
18684 0 : void fd_system_program_instruction_walk( void * w, fd_system_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
18685 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_program_instruction", level++);
18686 0 : switch( self->discriminant ) {
18687 0 : case 0: {
18688 0 : fun( w, self, "create_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18689 0 : fd_system_program_instruction_create_account_walk( w, &self->inner.create_account, fun, "create_account", level );
18690 0 : break;
18691 0 : }
18692 0 : case 1: {
18693 0 : fun( w, self, "assign", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18694 0 : fd_pubkey_walk( w, &self->inner.assign, fun, "assign", level );
18695 0 : break;
18696 0 : }
18697 0 : case 2: {
18698 0 : fun( w, self, "transfer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18699 0 : fun( w, &self->inner.transfer, "transfer", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
18700 0 : break;
18701 0 : }
18702 0 : case 3: {
18703 0 : fun( w, self, "create_account_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18704 0 : fd_system_program_instruction_create_account_with_seed_walk( w, &self->inner.create_account_with_seed, fun, "create_account_with_seed", level );
18705 0 : break;
18706 0 : }
18707 0 : case 4: {
18708 0 : fun( w, self, "advance_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18709 0 : break;
18710 0 : }
18711 0 : case 5: {
18712 0 : fun( w, self, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18713 0 : fun( w, &self->inner.withdraw_nonce_account, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
18714 0 : break;
18715 0 : }
18716 0 : case 6: {
18717 0 : fun( w, self, "initialize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18718 0 : fd_pubkey_walk( w, &self->inner.initialize_nonce_account, fun, "initialize_nonce_account", level );
18719 0 : break;
18720 0 : }
18721 0 : case 7: {
18722 0 : fun( w, self, "authorize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18723 0 : fd_pubkey_walk( w, &self->inner.authorize_nonce_account, fun, "authorize_nonce_account", level );
18724 0 : break;
18725 0 : }
18726 0 : case 8: {
18727 0 : fun( w, self, "allocate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18728 0 : fun( w, &self->inner.allocate, "allocate", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
18729 0 : break;
18730 0 : }
18731 0 : case 9: {
18732 0 : fun( w, self, "allocate_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18733 0 : fd_system_program_instruction_allocate_with_seed_walk( w, &self->inner.allocate_with_seed, fun, "allocate_with_seed", level );
18734 0 : break;
18735 0 : }
18736 0 : case 10: {
18737 0 : fun( w, self, "assign_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18738 0 : fd_system_program_instruction_assign_with_seed_walk( w, &self->inner.assign_with_seed, fun, "assign_with_seed", level );
18739 0 : break;
18740 0 : }
18741 0 : case 11: {
18742 0 : fun( w, self, "transfer_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18743 0 : fd_system_program_instruction_transfer_with_seed_walk( w, &self->inner.transfer_with_seed, fun, "transfer_with_seed", level );
18744 0 : break;
18745 0 : }
18746 0 : case 12: {
18747 0 : fun( w, self, "upgrade_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
18748 0 : break;
18749 0 : }
18750 0 : }
18751 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_program_instruction", level-- );
18752 0 : }
18753 0 : ulong fd_system_program_instruction_size( fd_system_program_instruction_t const * self ) {
18754 0 : ulong size = 0;
18755 0 : size += sizeof(uint);
18756 0 : switch (self->discriminant) {
18757 0 : case 0: {
18758 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account );
18759 0 : break;
18760 0 : }
18761 0 : case 1: {
18762 0 : size += fd_pubkey_size( &self->inner.assign );
18763 0 : break;
18764 0 : }
18765 0 : case 2: {
18766 0 : size += sizeof(ulong);
18767 0 : break;
18768 0 : }
18769 0 : case 3: {
18770 0 : size += fd_system_program_instruction_create_account_with_seed_size( &self->inner.create_account_with_seed );
18771 0 : break;
18772 0 : }
18773 0 : case 5: {
18774 0 : size += sizeof(ulong);
18775 0 : break;
18776 0 : }
18777 0 : case 6: {
18778 0 : size += fd_pubkey_size( &self->inner.initialize_nonce_account );
18779 0 : break;
18780 0 : }
18781 0 : case 7: {
18782 0 : size += fd_pubkey_size( &self->inner.authorize_nonce_account );
18783 0 : break;
18784 0 : }
18785 0 : case 8: {
18786 0 : size += sizeof(ulong);
18787 0 : break;
18788 0 : }
18789 0 : case 9: {
18790 0 : size += fd_system_program_instruction_allocate_with_seed_size( &self->inner.allocate_with_seed );
18791 0 : break;
18792 0 : }
18793 0 : case 10: {
18794 0 : size += fd_system_program_instruction_assign_with_seed_size( &self->inner.assign_with_seed );
18795 0 : break;
18796 0 : }
18797 0 : case 11: {
18798 0 : size += fd_system_program_instruction_transfer_with_seed_size( &self->inner.transfer_with_seed );
18799 0 : break;
18800 0 : }
18801 0 : }
18802 0 : return size;
18803 0 : }
18804 :
18805 273 : int fd_system_program_instruction_inner_encode( fd_system_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
18806 273 : int err;
18807 273 : switch (discriminant) {
18808 162 : case 0: {
18809 162 : err = fd_system_program_instruction_create_account_encode( &self->create_account, ctx );
18810 162 : if( FD_UNLIKELY( err ) ) return err;
18811 162 : break;
18812 162 : }
18813 162 : case 1: {
18814 0 : err = fd_pubkey_encode( &self->assign, ctx );
18815 0 : if( FD_UNLIKELY( err ) ) return err;
18816 0 : break;
18817 0 : }
18818 111 : case 2: {
18819 111 : err = fd_bincode_uint64_encode( self->transfer, ctx );
18820 111 : if( FD_UNLIKELY( err ) ) return err;
18821 111 : break;
18822 111 : }
18823 111 : case 3: {
18824 0 : err = fd_system_program_instruction_create_account_with_seed_encode( &self->create_account_with_seed, ctx );
18825 0 : if( FD_UNLIKELY( err ) ) return err;
18826 0 : break;
18827 0 : }
18828 0 : case 5: {
18829 0 : err = fd_bincode_uint64_encode( self->withdraw_nonce_account, ctx );
18830 0 : if( FD_UNLIKELY( err ) ) return err;
18831 0 : break;
18832 0 : }
18833 0 : case 6: {
18834 0 : err = fd_pubkey_encode( &self->initialize_nonce_account, ctx );
18835 0 : if( FD_UNLIKELY( err ) ) return err;
18836 0 : break;
18837 0 : }
18838 0 : case 7: {
18839 0 : err = fd_pubkey_encode( &self->authorize_nonce_account, ctx );
18840 0 : if( FD_UNLIKELY( err ) ) return err;
18841 0 : break;
18842 0 : }
18843 0 : case 8: {
18844 0 : err = fd_bincode_uint64_encode( self->allocate, ctx );
18845 0 : if( FD_UNLIKELY( err ) ) return err;
18846 0 : break;
18847 0 : }
18848 0 : case 9: {
18849 0 : err = fd_system_program_instruction_allocate_with_seed_encode( &self->allocate_with_seed, ctx );
18850 0 : if( FD_UNLIKELY( err ) ) return err;
18851 0 : break;
18852 0 : }
18853 0 : case 10: {
18854 0 : err = fd_system_program_instruction_assign_with_seed_encode( &self->assign_with_seed, ctx );
18855 0 : if( FD_UNLIKELY( err ) ) return err;
18856 0 : break;
18857 0 : }
18858 0 : case 11: {
18859 0 : err = fd_system_program_instruction_transfer_with_seed_encode( &self->transfer_with_seed, ctx );
18860 0 : if( FD_UNLIKELY( err ) ) return err;
18861 0 : break;
18862 0 : }
18863 273 : }
18864 273 : return FD_BINCODE_SUCCESS;
18865 273 : }
18866 273 : int fd_system_program_instruction_encode( fd_system_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18867 273 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
18868 273 : if( FD_UNLIKELY( err ) ) return err;
18869 273 : return fd_system_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
18870 273 : }
18871 :
18872 0 : FD_FN_PURE uchar fd_system_error_is_account_already_in_use(fd_system_error_t const * self) {
18873 0 : return self->discriminant == 0;
18874 0 : }
18875 0 : FD_FN_PURE uchar fd_system_error_is_result_with_negative_lamports(fd_system_error_t const * self) {
18876 0 : return self->discriminant == 1;
18877 0 : }
18878 0 : FD_FN_PURE uchar fd_system_error_is_invalid_program_id(fd_system_error_t const * self) {
18879 0 : return self->discriminant == 2;
18880 0 : }
18881 0 : FD_FN_PURE uchar fd_system_error_is_invalid_account_data_length(fd_system_error_t const * self) {
18882 0 : return self->discriminant == 3;
18883 0 : }
18884 0 : FD_FN_PURE uchar fd_system_error_is_max_seed_length_exceeded(fd_system_error_t const * self) {
18885 0 : return self->discriminant == 4;
18886 0 : }
18887 0 : FD_FN_PURE uchar fd_system_error_is_address_with_seed_mismatch(fd_system_error_t const * self) {
18888 0 : return self->discriminant == 5;
18889 0 : }
18890 0 : FD_FN_PURE uchar fd_system_error_is_nonce_no_recent_blockhashes(fd_system_error_t const * self) {
18891 0 : return self->discriminant == 6;
18892 0 : }
18893 0 : FD_FN_PURE uchar fd_system_error_is_nonce_blockhash_not_expired(fd_system_error_t const * self) {
18894 0 : return self->discriminant == 7;
18895 0 : }
18896 0 : FD_FN_PURE uchar fd_system_error_is_nonce_unexpected_blockhash_value(fd_system_error_t const * self) {
18897 0 : return self->discriminant == 8;
18898 0 : }
18899 : void fd_system_error_inner_new( fd_system_error_inner_t * self, uint discriminant );
18900 0 : int fd_system_error_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18901 0 : int err;
18902 0 : switch (discriminant) {
18903 0 : case 0: {
18904 0 : return FD_BINCODE_SUCCESS;
18905 0 : }
18906 0 : case 1: {
18907 0 : return FD_BINCODE_SUCCESS;
18908 0 : }
18909 0 : case 2: {
18910 0 : return FD_BINCODE_SUCCESS;
18911 0 : }
18912 0 : case 3: {
18913 0 : return FD_BINCODE_SUCCESS;
18914 0 : }
18915 0 : case 4: {
18916 0 : return FD_BINCODE_SUCCESS;
18917 0 : }
18918 0 : case 5: {
18919 0 : return FD_BINCODE_SUCCESS;
18920 0 : }
18921 0 : case 6: {
18922 0 : return FD_BINCODE_SUCCESS;
18923 0 : }
18924 0 : case 7: {
18925 0 : return FD_BINCODE_SUCCESS;
18926 0 : }
18927 0 : case 8: {
18928 0 : return FD_BINCODE_SUCCESS;
18929 0 : }
18930 0 : default: return FD_BINCODE_ERR_ENCODING;
18931 0 : }
18932 0 : }
18933 0 : void fd_system_error_inner_decode_unsafe( fd_system_error_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18934 0 : switch (discriminant) {
18935 0 : case 0: {
18936 0 : break;
18937 0 : }
18938 0 : case 1: {
18939 0 : break;
18940 0 : }
18941 0 : case 2: {
18942 0 : break;
18943 0 : }
18944 0 : case 3: {
18945 0 : break;
18946 0 : }
18947 0 : case 4: {
18948 0 : break;
18949 0 : }
18950 0 : case 5: {
18951 0 : break;
18952 0 : }
18953 0 : case 6: {
18954 0 : break;
18955 0 : }
18956 0 : case 7: {
18957 0 : break;
18958 0 : }
18959 0 : case 8: {
18960 0 : break;
18961 0 : }
18962 0 : }
18963 0 : }
18964 0 : int fd_system_error_decode( fd_system_error_t * self, fd_bincode_decode_ctx_t * ctx ) {
18965 0 : void const * data = ctx->data;
18966 0 : int err = fd_system_error_decode_preflight( ctx );
18967 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18968 0 : ctx->data = data;
18969 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
18970 0 : fd_system_error_new( self );
18971 0 : }
18972 0 : fd_system_error_decode_unsafe( self, ctx );
18973 0 : return FD_BINCODE_SUCCESS;
18974 0 : }
18975 0 : int fd_system_error_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
18976 0 : uint discriminant = 0;
18977 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
18978 0 : if( FD_UNLIKELY( err ) ) return err;
18979 0 : return fd_system_error_inner_decode_preflight( discriminant, ctx );
18980 0 : }
18981 0 : void fd_system_error_decode_unsafe( fd_system_error_t * self, fd_bincode_decode_ctx_t * ctx ) {
18982 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
18983 0 : fd_system_error_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
18984 0 : }
18985 0 : void fd_system_error_inner_new( fd_system_error_inner_t * self, uint discriminant ) {
18986 0 : switch( discriminant ) {
18987 0 : case 0: {
18988 0 : break;
18989 0 : }
18990 0 : case 1: {
18991 0 : break;
18992 0 : }
18993 0 : case 2: {
18994 0 : break;
18995 0 : }
18996 0 : case 3: {
18997 0 : break;
18998 0 : }
18999 0 : case 4: {
19000 0 : break;
19001 0 : }
19002 0 : case 5: {
19003 0 : break;
19004 0 : }
19005 0 : case 6: {
19006 0 : break;
19007 0 : }
19008 0 : case 7: {
19009 0 : break;
19010 0 : }
19011 0 : case 8: {
19012 0 : break;
19013 0 : }
19014 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
19015 0 : }
19016 0 : }
19017 0 : void fd_system_error_new_disc( fd_system_error_t * self, uint discriminant ) {
19018 0 : self->discriminant = discriminant;
19019 0 : fd_system_error_inner_new( &self->inner, self->discriminant );
19020 0 : }
19021 0 : void fd_system_error_new( fd_system_error_t * self ) {
19022 0 : fd_memset( self, 0, sizeof(fd_system_error_t) );
19023 0 : fd_system_error_new_disc( self, UINT_MAX );
19024 0 : }
19025 0 : void fd_system_error_inner_destroy( fd_system_error_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
19026 0 : switch( discriminant ) {
19027 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
19028 0 : }
19029 0 : }
19030 0 : void fd_system_error_destroy( fd_system_error_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19031 0 : fd_system_error_inner_destroy( &self->inner, self->discriminant, ctx );
19032 0 : }
19033 :
19034 0 : ulong fd_system_error_footprint( void ){ return FD_SYSTEM_ERROR_FOOTPRINT; }
19035 0 : ulong fd_system_error_align( void ){ return FD_SYSTEM_ERROR_ALIGN; }
19036 :
19037 0 : void fd_system_error_walk( void * w, fd_system_error_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19038 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_error", level++);
19039 0 : switch( self->discriminant ) {
19040 0 : case 0: {
19041 0 : fun( w, self, "account_already_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19042 0 : break;
19043 0 : }
19044 0 : case 1: {
19045 0 : fun( w, self, "result_with_negative_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19046 0 : break;
19047 0 : }
19048 0 : case 2: {
19049 0 : fun( w, self, "invalid_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19050 0 : break;
19051 0 : }
19052 0 : case 3: {
19053 0 : fun( w, self, "invalid_account_data_length", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19054 0 : break;
19055 0 : }
19056 0 : case 4: {
19057 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19058 0 : break;
19059 0 : }
19060 0 : case 5: {
19061 0 : fun( w, self, "address_with_seed_mismatch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19062 0 : break;
19063 0 : }
19064 0 : case 6: {
19065 0 : fun( w, self, "nonce_no_recent_blockhashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19066 0 : break;
19067 0 : }
19068 0 : case 7: {
19069 0 : fun( w, self, "nonce_blockhash_not_expired", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19070 0 : break;
19071 0 : }
19072 0 : case 8: {
19073 0 : fun( w, self, "nonce_unexpected_blockhash_value", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19074 0 : break;
19075 0 : }
19076 0 : }
19077 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_error", level-- );
19078 0 : }
19079 0 : ulong fd_system_error_size( fd_system_error_t const * self ) {
19080 0 : ulong size = 0;
19081 0 : size += sizeof(uint);
19082 0 : switch (self->discriminant) {
19083 0 : }
19084 0 : return size;
19085 0 : }
19086 :
19087 0 : int fd_system_error_inner_encode( fd_system_error_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
19088 0 : return FD_BINCODE_SUCCESS;
19089 0 : }
19090 0 : int fd_system_error_encode( fd_system_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19091 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
19092 0 : if( FD_UNLIKELY( err ) ) return err;
19093 0 : return fd_system_error_inner_encode( &self->inner, self->discriminant, ctx );
19094 0 : }
19095 :
19096 0 : int fd_stake_authorized_decode( fd_stake_authorized_t * self, fd_bincode_decode_ctx_t * ctx ) {
19097 0 : void const * data = ctx->data;
19098 0 : int err = fd_stake_authorized_decode_preflight( ctx );
19099 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19100 0 : ctx->data = data;
19101 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19102 0 : fd_stake_authorized_new( self );
19103 0 : }
19104 0 : fd_stake_authorized_decode_unsafe( self, ctx );
19105 0 : return FD_BINCODE_SUCCESS;
19106 0 : }
19107 0 : int fd_stake_authorized_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19108 0 : return fd_bincode_bytes_decode_preflight( 64, ctx );
19109 0 : }
19110 8232 : void fd_stake_authorized_decode_unsafe( fd_stake_authorized_t * self, fd_bincode_decode_ctx_t * ctx ) {
19111 8232 : fd_pubkey_decode_unsafe( &self->staker, ctx );
19112 8232 : fd_pubkey_decode_unsafe( &self->withdrawer, ctx );
19113 8232 : }
19114 2625 : int fd_stake_authorized_encode( fd_stake_authorized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19115 2625 : int err;
19116 2625 : err = fd_pubkey_encode( &self->staker, ctx );
19117 2625 : if( FD_UNLIKELY( err ) ) return err;
19118 2625 : err = fd_pubkey_encode( &self->withdrawer, ctx );
19119 2625 : if( FD_UNLIKELY( err ) ) return err;
19120 2625 : return FD_BINCODE_SUCCESS;
19121 2625 : }
19122 0 : int fd_stake_authorized_decode_offsets( fd_stake_authorized_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
19123 0 : uchar const * data = ctx->data;
19124 0 : int err;
19125 0 : self->staker_off = (uint)( (ulong)ctx->data - (ulong)data );
19126 0 : err = fd_pubkey_decode_preflight( ctx );
19127 0 : if( FD_UNLIKELY( err ) ) return err;
19128 0 : self->withdrawer_off = (uint)( (ulong)ctx->data - (ulong)data );
19129 0 : err = fd_pubkey_decode_preflight( ctx );
19130 0 : if( FD_UNLIKELY( err ) ) return err;
19131 0 : return FD_BINCODE_SUCCESS;
19132 0 : }
19133 12 : void fd_stake_authorized_new(fd_stake_authorized_t * self) {
19134 12 : fd_memset( self, 0, sizeof(fd_stake_authorized_t) );
19135 12 : fd_pubkey_new( &self->staker );
19136 12 : fd_pubkey_new( &self->withdrawer );
19137 12 : }
19138 0 : void fd_stake_authorized_destroy( fd_stake_authorized_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19139 0 : fd_pubkey_destroy( &self->staker, ctx );
19140 0 : fd_pubkey_destroy( &self->withdrawer, ctx );
19141 0 : }
19142 :
19143 0 : ulong fd_stake_authorized_footprint( void ){ return FD_STAKE_AUTHORIZED_FOOTPRINT; }
19144 0 : ulong fd_stake_authorized_align( void ){ return FD_STAKE_AUTHORIZED_ALIGN; }
19145 :
19146 0 : void fd_stake_authorized_walk( void * w, fd_stake_authorized_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19147 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_authorized", level++ );
19148 0 : fd_pubkey_walk( w, &self->staker, fun, "staker", level );
19149 0 : fd_pubkey_walk( w, &self->withdrawer, fun, "withdrawer", level );
19150 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_authorized", level-- );
19151 0 : }
19152 2613 : ulong fd_stake_authorized_size( fd_stake_authorized_t const * self ) {
19153 2613 : ulong size = 0;
19154 2613 : size += fd_pubkey_size( &self->staker );
19155 2613 : size += fd_pubkey_size( &self->withdrawer );
19156 2613 : return size;
19157 2613 : }
19158 :
19159 0 : int fd_stake_lockup_decode( fd_stake_lockup_t * self, fd_bincode_decode_ctx_t * ctx ) {
19160 0 : void const * data = ctx->data;
19161 0 : int err = fd_stake_lockup_decode_preflight( ctx );
19162 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19163 0 : ctx->data = data;
19164 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19165 0 : fd_stake_lockup_new( self );
19166 0 : }
19167 0 : fd_stake_lockup_decode_unsafe( self, ctx );
19168 0 : return FD_BINCODE_SUCCESS;
19169 0 : }
19170 0 : int fd_stake_lockup_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19171 0 : return fd_bincode_bytes_decode_preflight( 48, ctx );
19172 0 : }
19173 8232 : void fd_stake_lockup_decode_unsafe( fd_stake_lockup_t * self, fd_bincode_decode_ctx_t * ctx ) {
19174 8232 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
19175 8232 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
19176 8232 : fd_pubkey_decode_unsafe( &self->custodian, ctx );
19177 8232 : }
19178 2625 : int fd_stake_lockup_encode( fd_stake_lockup_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19179 2625 : int err;
19180 2625 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
19181 2625 : if( FD_UNLIKELY( err ) ) return err;
19182 2625 : err = fd_bincode_uint64_encode( self->epoch, ctx );
19183 2625 : if( FD_UNLIKELY( err ) ) return err;
19184 2625 : err = fd_pubkey_encode( &self->custodian, ctx );
19185 2625 : if( FD_UNLIKELY( err ) ) return err;
19186 2625 : return FD_BINCODE_SUCCESS;
19187 2625 : }
19188 0 : int fd_stake_lockup_decode_offsets( fd_stake_lockup_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
19189 0 : uchar const * data = ctx->data;
19190 0 : int err;
19191 0 : self->unix_timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
19192 0 : err = fd_bincode_uint64_decode_preflight( ctx );
19193 0 : if( FD_UNLIKELY( err ) ) return err;
19194 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
19195 0 : err = fd_bincode_uint64_decode_preflight( ctx );
19196 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19197 0 : self->custodian_off = (uint)( (ulong)ctx->data - (ulong)data );
19198 0 : err = fd_pubkey_decode_preflight( ctx );
19199 0 : if( FD_UNLIKELY( err ) ) return err;
19200 0 : return FD_BINCODE_SUCCESS;
19201 0 : }
19202 12 : void fd_stake_lockup_new(fd_stake_lockup_t * self) {
19203 12 : fd_memset( self, 0, sizeof(fd_stake_lockup_t) );
19204 12 : fd_pubkey_new( &self->custodian );
19205 12 : }
19206 0 : void fd_stake_lockup_destroy( fd_stake_lockup_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19207 0 : fd_pubkey_destroy( &self->custodian, ctx );
19208 0 : }
19209 :
19210 0 : ulong fd_stake_lockup_footprint( void ){ return FD_STAKE_LOCKUP_FOOTPRINT; }
19211 0 : ulong fd_stake_lockup_align( void ){ return FD_STAKE_LOCKUP_ALIGN; }
19212 :
19213 0 : void fd_stake_lockup_walk( void * w, fd_stake_lockup_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19214 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup", level++ );
19215 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
19216 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
19217 0 : fd_pubkey_walk( w, &self->custodian, fun, "custodian", level );
19218 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup", level-- );
19219 0 : }
19220 2613 : ulong fd_stake_lockup_size( fd_stake_lockup_t const * self ) {
19221 2613 : ulong size = 0;
19222 2613 : size += sizeof(long);
19223 2613 : size += sizeof(ulong);
19224 2613 : size += fd_pubkey_size( &self->custodian );
19225 2613 : return size;
19226 2613 : }
19227 :
19228 0 : int fd_stake_instruction_initialize_decode( fd_stake_instruction_initialize_t * self, fd_bincode_decode_ctx_t * ctx ) {
19229 0 : void const * data = ctx->data;
19230 0 : int err = fd_stake_instruction_initialize_decode_preflight( ctx );
19231 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19232 0 : ctx->data = data;
19233 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19234 0 : fd_stake_instruction_initialize_new( self );
19235 0 : }
19236 0 : fd_stake_instruction_initialize_decode_unsafe( self, ctx );
19237 0 : return FD_BINCODE_SUCCESS;
19238 0 : }
19239 645 : int fd_stake_instruction_initialize_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19240 645 : return fd_bincode_bytes_decode_preflight( 112, ctx );
19241 645 : }
19242 513 : void fd_stake_instruction_initialize_decode_unsafe( fd_stake_instruction_initialize_t * self, fd_bincode_decode_ctx_t * ctx ) {
19243 513 : fd_stake_authorized_decode_unsafe( &self->authorized, ctx );
19244 513 : fd_stake_lockup_decode_unsafe( &self->lockup, ctx );
19245 513 : }
19246 0 : int fd_stake_instruction_initialize_encode( fd_stake_instruction_initialize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19247 0 : int err;
19248 0 : err = fd_stake_authorized_encode( &self->authorized, ctx );
19249 0 : if( FD_UNLIKELY( err ) ) return err;
19250 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
19251 0 : if( FD_UNLIKELY( err ) ) return err;
19252 0 : return FD_BINCODE_SUCCESS;
19253 0 : }
19254 0 : int fd_stake_instruction_initialize_decode_offsets( fd_stake_instruction_initialize_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
19255 0 : uchar const * data = ctx->data;
19256 0 : int err;
19257 0 : self->authorized_off = (uint)( (ulong)ctx->data - (ulong)data );
19258 0 : err = fd_stake_authorized_decode_preflight( ctx );
19259 0 : if( FD_UNLIKELY( err ) ) return err;
19260 0 : self->lockup_off = (uint)( (ulong)ctx->data - (ulong)data );
19261 0 : err = fd_stake_lockup_decode_preflight( ctx );
19262 0 : if( FD_UNLIKELY( err ) ) return err;
19263 0 : return FD_BINCODE_SUCCESS;
19264 0 : }
19265 0 : void fd_stake_instruction_initialize_new(fd_stake_instruction_initialize_t * self) {
19266 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_initialize_t) );
19267 0 : fd_stake_authorized_new( &self->authorized );
19268 0 : fd_stake_lockup_new( &self->lockup );
19269 0 : }
19270 0 : void fd_stake_instruction_initialize_destroy( fd_stake_instruction_initialize_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19271 0 : fd_stake_authorized_destroy( &self->authorized, ctx );
19272 0 : fd_stake_lockup_destroy( &self->lockup, ctx );
19273 0 : }
19274 :
19275 0 : ulong fd_stake_instruction_initialize_footprint( void ){ return FD_STAKE_INSTRUCTION_INITIALIZE_FOOTPRINT; }
19276 0 : ulong fd_stake_instruction_initialize_align( void ){ return FD_STAKE_INSTRUCTION_INITIALIZE_ALIGN; }
19277 :
19278 0 : void fd_stake_instruction_initialize_walk( void * w, fd_stake_instruction_initialize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19279 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_initialize", level++ );
19280 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level );
19281 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level );
19282 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_initialize", level-- );
19283 0 : }
19284 0 : ulong fd_stake_instruction_initialize_size( fd_stake_instruction_initialize_t const * self ) {
19285 0 : ulong size = 0;
19286 0 : size += fd_stake_authorized_size( &self->authorized );
19287 0 : size += fd_stake_lockup_size( &self->lockup );
19288 0 : return size;
19289 0 : }
19290 :
19291 0 : int fd_stake_lockup_custodian_args_decode( fd_stake_lockup_custodian_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
19292 0 : void const * data = ctx->data;
19293 0 : int err = fd_stake_lockup_custodian_args_decode_preflight( ctx );
19294 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19295 0 : ctx->data = data;
19296 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19297 0 : fd_stake_lockup_custodian_args_new( self );
19298 0 : }
19299 0 : fd_stake_lockup_custodian_args_decode_unsafe( self, ctx );
19300 0 : return FD_BINCODE_SUCCESS;
19301 0 : }
19302 0 : int fd_stake_lockup_custodian_args_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19303 0 : int err;
19304 0 : err = fd_stake_lockup_decode_preflight( ctx );
19305 0 : if( FD_UNLIKELY( err ) ) return err;
19306 0 : err = fd_sol_sysvar_clock_decode_preflight( ctx );
19307 0 : if( FD_UNLIKELY( err ) ) return err;
19308 0 : {
19309 0 : uchar o;
19310 0 : err = fd_bincode_bool_decode( &o, ctx );
19311 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19312 0 : if( o ) {
19313 0 : err = fd_pubkey_decode_preflight( ctx );
19314 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19315 0 : }
19316 0 : }
19317 0 : return FD_BINCODE_SUCCESS;
19318 0 : }
19319 0 : void fd_stake_lockup_custodian_args_decode_unsafe( fd_stake_lockup_custodian_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
19320 0 : fd_stake_lockup_decode_unsafe( &self->lockup, ctx );
19321 0 : fd_sol_sysvar_clock_decode_unsafe( &self->clock, ctx );
19322 0 : {
19323 0 : uchar o;
19324 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
19325 0 : if( o ) {
19326 0 : self->custodian = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT );
19327 0 : fd_pubkey_new( self->custodian );
19328 0 : fd_pubkey_decode_unsafe( self->custodian, ctx );
19329 0 : } else
19330 0 : self->custodian = NULL;
19331 0 : }
19332 0 : }
19333 0 : int fd_stake_lockup_custodian_args_encode( fd_stake_lockup_custodian_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19334 0 : int err;
19335 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
19336 0 : if( FD_UNLIKELY( err ) ) return err;
19337 0 : err = fd_sol_sysvar_clock_encode( &self->clock, ctx );
19338 0 : if( FD_UNLIKELY( err ) ) return err;
19339 0 : if( self->custodian != NULL ) {
19340 0 : err = fd_bincode_bool_encode( 1, ctx );
19341 0 : if( FD_UNLIKELY( err ) ) return err;
19342 0 : err = fd_pubkey_encode( self->custodian, ctx );
19343 0 : if( FD_UNLIKELY( err ) ) return err;
19344 0 : } else {
19345 0 : err = fd_bincode_bool_encode( 0, ctx );
19346 0 : if( FD_UNLIKELY( err ) ) return err;
19347 0 : }
19348 0 : return FD_BINCODE_SUCCESS;
19349 0 : }
19350 0 : int fd_stake_lockup_custodian_args_decode_offsets( fd_stake_lockup_custodian_args_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
19351 0 : uchar const * data = ctx->data;
19352 0 : int err;
19353 0 : self->lockup_off = (uint)( (ulong)ctx->data - (ulong)data );
19354 0 : err = fd_stake_lockup_decode_preflight( ctx );
19355 0 : if( FD_UNLIKELY( err ) ) return err;
19356 0 : self->clock_off = (uint)( (ulong)ctx->data - (ulong)data );
19357 0 : err = fd_sol_sysvar_clock_decode_preflight( ctx );
19358 0 : if( FD_UNLIKELY( err ) ) return err;
19359 0 : self->custodian_off = (uint)( (ulong)ctx->data - (ulong)data );
19360 0 : {
19361 0 : uchar o;
19362 0 : err = fd_bincode_bool_decode( &o, ctx );
19363 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19364 0 : if( o ) {
19365 0 : err = fd_pubkey_decode_preflight( ctx );
19366 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19367 0 : }
19368 0 : }
19369 0 : return FD_BINCODE_SUCCESS;
19370 0 : }
19371 0 : void fd_stake_lockup_custodian_args_new(fd_stake_lockup_custodian_args_t * self) {
19372 0 : fd_memset( self, 0, sizeof(fd_stake_lockup_custodian_args_t) );
19373 0 : fd_stake_lockup_new( &self->lockup );
19374 0 : fd_sol_sysvar_clock_new( &self->clock );
19375 0 : }
19376 0 : void fd_stake_lockup_custodian_args_destroy( fd_stake_lockup_custodian_args_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19377 0 : fd_stake_lockup_destroy( &self->lockup, ctx );
19378 0 : fd_sol_sysvar_clock_destroy( &self->clock, ctx );
19379 0 : if( self->custodian ) {
19380 0 : fd_pubkey_destroy( self->custodian, ctx );
19381 0 : fd_valloc_free( ctx->valloc, self->custodian );
19382 0 : self->custodian = NULL;
19383 0 : }
19384 0 : }
19385 :
19386 0 : ulong fd_stake_lockup_custodian_args_footprint( void ){ return FD_STAKE_LOCKUP_CUSTODIAN_ARGS_FOOTPRINT; }
19387 0 : ulong fd_stake_lockup_custodian_args_align( void ){ return FD_STAKE_LOCKUP_CUSTODIAN_ARGS_ALIGN; }
19388 :
19389 0 : void fd_stake_lockup_custodian_args_walk( void * w, fd_stake_lockup_custodian_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19390 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup_custodian_args", level++ );
19391 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level );
19392 0 : fd_sol_sysvar_clock_walk( w, &self->clock, fun, "clock", level );
19393 0 : if( !self->custodian ) {
19394 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
19395 0 : } else {
19396 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level );
19397 0 : }
19398 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup_custodian_args", level-- );
19399 0 : }
19400 0 : ulong fd_stake_lockup_custodian_args_size( fd_stake_lockup_custodian_args_t const * self ) {
19401 0 : ulong size = 0;
19402 0 : size += fd_stake_lockup_size( &self->lockup );
19403 0 : size += fd_sol_sysvar_clock_size( &self->clock );
19404 0 : size += sizeof(char);
19405 0 : if( NULL != self->custodian ) {
19406 0 : size += fd_pubkey_size( self->custodian );
19407 0 : }
19408 0 : return size;
19409 0 : }
19410 :
19411 0 : FD_FN_PURE uchar fd_stake_authorize_is_staker(fd_stake_authorize_t const * self) {
19412 0 : return self->discriminant == 0;
19413 0 : }
19414 0 : FD_FN_PURE uchar fd_stake_authorize_is_withdrawer(fd_stake_authorize_t const * self) {
19415 0 : return self->discriminant == 1;
19416 0 : }
19417 : void fd_stake_authorize_inner_new( fd_stake_authorize_inner_t * self, uint discriminant );
19418 1866 : int fd_stake_authorize_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
19419 1866 : int err;
19420 1866 : switch (discriminant) {
19421 993 : case 0: {
19422 993 : return FD_BINCODE_SUCCESS;
19423 0 : }
19424 843 : case 1: {
19425 843 : return FD_BINCODE_SUCCESS;
19426 0 : }
19427 30 : default: return FD_BINCODE_ERR_ENCODING;
19428 1866 : }
19429 1866 : }
19430 1551 : void fd_stake_authorize_inner_decode_unsafe( fd_stake_authorize_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
19431 1551 : switch (discriminant) {
19432 855 : case 0: {
19433 855 : break;
19434 0 : }
19435 696 : case 1: {
19436 696 : break;
19437 0 : }
19438 1551 : }
19439 1551 : }
19440 0 : int fd_stake_authorize_decode( fd_stake_authorize_t * self, fd_bincode_decode_ctx_t * ctx ) {
19441 0 : void const * data = ctx->data;
19442 0 : int err = fd_stake_authorize_decode_preflight( ctx );
19443 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19444 0 : ctx->data = data;
19445 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19446 0 : fd_stake_authorize_new( self );
19447 0 : }
19448 0 : fd_stake_authorize_decode_unsafe( self, ctx );
19449 0 : return FD_BINCODE_SUCCESS;
19450 0 : }
19451 1887 : int fd_stake_authorize_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19452 1887 : uint discriminant = 0;
19453 1887 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
19454 1887 : if( FD_UNLIKELY( err ) ) return err;
19455 1866 : return fd_stake_authorize_inner_decode_preflight( discriminant, ctx );
19456 1887 : }
19457 1551 : void fd_stake_authorize_decode_unsafe( fd_stake_authorize_t * self, fd_bincode_decode_ctx_t * ctx ) {
19458 1551 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
19459 1551 : fd_stake_authorize_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
19460 1551 : }
19461 0 : void fd_stake_authorize_inner_new( fd_stake_authorize_inner_t * self, uint discriminant ) {
19462 0 : switch( discriminant ) {
19463 0 : case 0: {
19464 0 : break;
19465 0 : }
19466 0 : case 1: {
19467 0 : break;
19468 0 : }
19469 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
19470 0 : }
19471 0 : }
19472 0 : void fd_stake_authorize_new_disc( fd_stake_authorize_t * self, uint discriminant ) {
19473 0 : self->discriminant = discriminant;
19474 0 : fd_stake_authorize_inner_new( &self->inner, self->discriminant );
19475 0 : }
19476 0 : void fd_stake_authorize_new( fd_stake_authorize_t * self ) {
19477 0 : fd_memset( self, 0, sizeof(fd_stake_authorize_t) );
19478 0 : fd_stake_authorize_new_disc( self, UINT_MAX );
19479 0 : }
19480 0 : void fd_stake_authorize_inner_destroy( fd_stake_authorize_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
19481 0 : switch( discriminant ) {
19482 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
19483 0 : }
19484 0 : }
19485 0 : void fd_stake_authorize_destroy( fd_stake_authorize_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19486 0 : fd_stake_authorize_inner_destroy( &self->inner, self->discriminant, ctx );
19487 0 : }
19488 :
19489 0 : ulong fd_stake_authorize_footprint( void ){ return FD_STAKE_AUTHORIZE_FOOTPRINT; }
19490 0 : ulong fd_stake_authorize_align( void ){ return FD_STAKE_AUTHORIZE_ALIGN; }
19491 :
19492 0 : void fd_stake_authorize_walk( void * w, fd_stake_authorize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19493 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_authorize", level++);
19494 0 : switch( self->discriminant ) {
19495 0 : case 0: {
19496 0 : fun( w, self, "staker", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19497 0 : break;
19498 0 : }
19499 0 : case 1: {
19500 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
19501 0 : break;
19502 0 : }
19503 0 : }
19504 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_authorize", level-- );
19505 0 : }
19506 0 : ulong fd_stake_authorize_size( fd_stake_authorize_t const * self ) {
19507 0 : ulong size = 0;
19508 0 : size += sizeof(uint);
19509 0 : switch (self->discriminant) {
19510 0 : }
19511 0 : return size;
19512 0 : }
19513 :
19514 0 : int fd_stake_authorize_inner_encode( fd_stake_authorize_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
19515 0 : return FD_BINCODE_SUCCESS;
19516 0 : }
19517 0 : int fd_stake_authorize_encode( fd_stake_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19518 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
19519 0 : if( FD_UNLIKELY( err ) ) return err;
19520 0 : return fd_stake_authorize_inner_encode( &self->inner, self->discriminant, ctx );
19521 0 : }
19522 :
19523 0 : int fd_stake_instruction_authorize_decode( fd_stake_instruction_authorize_t * self, fd_bincode_decode_ctx_t * ctx ) {
19524 0 : void const * data = ctx->data;
19525 0 : int err = fd_stake_instruction_authorize_decode_preflight( ctx );
19526 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19527 0 : ctx->data = data;
19528 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19529 0 : fd_stake_instruction_authorize_new( self );
19530 0 : }
19531 0 : fd_stake_instruction_authorize_decode_unsafe( self, ctx );
19532 0 : return FD_BINCODE_SUCCESS;
19533 0 : }
19534 624 : int fd_stake_instruction_authorize_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19535 624 : int err;
19536 624 : err = fd_pubkey_decode_preflight( ctx );
19537 624 : if( FD_UNLIKELY( err ) ) return err;
19538 588 : err = fd_stake_authorize_decode_preflight( ctx );
19539 588 : if( FD_UNLIKELY( err ) ) return err;
19540 573 : return FD_BINCODE_SUCCESS;
19541 588 : }
19542 573 : void fd_stake_instruction_authorize_decode_unsafe( fd_stake_instruction_authorize_t * self, fd_bincode_decode_ctx_t * ctx ) {
19543 573 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
19544 573 : fd_stake_authorize_decode_unsafe( &self->stake_authorize, ctx );
19545 573 : }
19546 0 : int fd_stake_instruction_authorize_encode( fd_stake_instruction_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19547 0 : int err;
19548 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
19549 0 : if( FD_UNLIKELY( err ) ) return err;
19550 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
19551 0 : if( FD_UNLIKELY( err ) ) return err;
19552 0 : return FD_BINCODE_SUCCESS;
19553 0 : }
19554 0 : int fd_stake_instruction_authorize_decode_offsets( fd_stake_instruction_authorize_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
19555 0 : uchar const * data = ctx->data;
19556 0 : int err;
19557 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
19558 0 : err = fd_pubkey_decode_preflight( ctx );
19559 0 : if( FD_UNLIKELY( err ) ) return err;
19560 0 : self->stake_authorize_off = (uint)( (ulong)ctx->data - (ulong)data );
19561 0 : err = fd_stake_authorize_decode_preflight( ctx );
19562 0 : if( FD_UNLIKELY( err ) ) return err;
19563 0 : return FD_BINCODE_SUCCESS;
19564 0 : }
19565 0 : void fd_stake_instruction_authorize_new(fd_stake_instruction_authorize_t * self) {
19566 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_authorize_t) );
19567 0 : fd_pubkey_new( &self->pubkey );
19568 0 : fd_stake_authorize_new( &self->stake_authorize );
19569 0 : }
19570 0 : void fd_stake_instruction_authorize_destroy( fd_stake_instruction_authorize_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19571 0 : fd_pubkey_destroy( &self->pubkey, ctx );
19572 0 : fd_stake_authorize_destroy( &self->stake_authorize, ctx );
19573 0 : }
19574 :
19575 0 : ulong fd_stake_instruction_authorize_footprint( void ){ return FD_STAKE_INSTRUCTION_AUTHORIZE_FOOTPRINT; }
19576 0 : ulong fd_stake_instruction_authorize_align( void ){ return FD_STAKE_INSTRUCTION_AUTHORIZE_ALIGN; }
19577 :
19578 0 : void fd_stake_instruction_authorize_walk( void * w, fd_stake_instruction_authorize_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19579 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_authorize", level++ );
19580 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
19581 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level );
19582 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_authorize", level-- );
19583 0 : }
19584 0 : ulong fd_stake_instruction_authorize_size( fd_stake_instruction_authorize_t const * self ) {
19585 0 : ulong size = 0;
19586 0 : size += fd_pubkey_size( &self->pubkey );
19587 0 : size += fd_stake_authorize_size( &self->stake_authorize );
19588 0 : return size;
19589 0 : }
19590 :
19591 0 : int fd_authorize_with_seed_args_decode( fd_authorize_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
19592 0 : void const * data = ctx->data;
19593 0 : int err = fd_authorize_with_seed_args_decode_preflight( ctx );
19594 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19595 0 : ctx->data = data;
19596 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19597 0 : fd_authorize_with_seed_args_new( self );
19598 0 : }
19599 0 : fd_authorize_with_seed_args_decode_unsafe( self, ctx );
19600 0 : return FD_BINCODE_SUCCESS;
19601 0 : }
19602 444 : int fd_authorize_with_seed_args_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19603 444 : int err;
19604 444 : err = fd_pubkey_decode_preflight( ctx );
19605 444 : if( FD_UNLIKELY( err ) ) return err;
19606 438 : err = fd_stake_authorize_decode_preflight( ctx );
19607 438 : if( FD_UNLIKELY( err ) ) return err;
19608 429 : ulong authority_seed_len;
19609 429 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
19610 429 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19611 426 : if( authority_seed_len ) {
19612 387 : err = fd_bincode_bytes_decode_preflight( authority_seed_len, ctx );
19613 387 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19614 378 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
19615 378 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19616 378 : }
19617 408 : err = fd_pubkey_decode_preflight( ctx );
19618 408 : if( FD_UNLIKELY( err ) ) return err;
19619 405 : return FD_BINCODE_SUCCESS;
19620 408 : }
19621 405 : void fd_authorize_with_seed_args_decode_unsafe( fd_authorize_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
19622 405 : fd_pubkey_decode_unsafe( &self->new_authorized_pubkey, ctx );
19623 405 : fd_stake_authorize_decode_unsafe( &self->stake_authorize, ctx );
19624 405 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
19625 405 : if( self->authority_seed_len ) {
19626 366 : self->authority_seed = fd_valloc_malloc( ctx->valloc, 8UL, self->authority_seed_len );
19627 366 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
19628 366 : } else
19629 39 : self->authority_seed = NULL;
19630 405 : fd_pubkey_decode_unsafe( &self->authority_owner, ctx );
19631 405 : }
19632 0 : int fd_authorize_with_seed_args_encode( fd_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19633 0 : int err;
19634 0 : err = fd_pubkey_encode( &self->new_authorized_pubkey, ctx );
19635 0 : if( FD_UNLIKELY( err ) ) return err;
19636 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
19637 0 : if( FD_UNLIKELY( err ) ) return err;
19638 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
19639 0 : if( FD_UNLIKELY(err) ) return err;
19640 0 : if( self->authority_seed_len ) {
19641 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
19642 0 : if( FD_UNLIKELY( err ) ) return err;
19643 0 : }
19644 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
19645 0 : if( FD_UNLIKELY( err ) ) return err;
19646 0 : return FD_BINCODE_SUCCESS;
19647 0 : }
19648 0 : int fd_authorize_with_seed_args_decode_offsets( fd_authorize_with_seed_args_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
19649 0 : uchar const * data = ctx->data;
19650 0 : int err;
19651 0 : self->new_authorized_pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
19652 0 : err = fd_pubkey_decode_preflight( ctx );
19653 0 : if( FD_UNLIKELY( err ) ) return err;
19654 0 : self->stake_authorize_off = (uint)( (ulong)ctx->data - (ulong)data );
19655 0 : err = fd_stake_authorize_decode_preflight( ctx );
19656 0 : if( FD_UNLIKELY( err ) ) return err;
19657 0 : self->authority_seed_off = (uint)( (ulong)ctx->data - (ulong)data );
19658 0 : ulong authority_seed_len;
19659 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
19660 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19661 0 : if( authority_seed_len ) {
19662 0 : err = fd_bincode_bytes_decode_preflight( authority_seed_len, ctx );
19663 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19664 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
19665 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19666 0 : }
19667 0 : self->authority_owner_off = (uint)( (ulong)ctx->data - (ulong)data );
19668 0 : err = fd_pubkey_decode_preflight( ctx );
19669 0 : if( FD_UNLIKELY( err ) ) return err;
19670 0 : return FD_BINCODE_SUCCESS;
19671 0 : }
19672 0 : void fd_authorize_with_seed_args_new(fd_authorize_with_seed_args_t * self) {
19673 0 : fd_memset( self, 0, sizeof(fd_authorize_with_seed_args_t) );
19674 0 : fd_pubkey_new( &self->new_authorized_pubkey );
19675 0 : fd_stake_authorize_new( &self->stake_authorize );
19676 0 : fd_pubkey_new( &self->authority_owner );
19677 0 : }
19678 0 : void fd_authorize_with_seed_args_destroy( fd_authorize_with_seed_args_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19679 0 : fd_pubkey_destroy( &self->new_authorized_pubkey, ctx );
19680 0 : fd_stake_authorize_destroy( &self->stake_authorize, ctx );
19681 0 : if( self->authority_seed ) {
19682 0 : fd_valloc_free( ctx->valloc, self->authority_seed );
19683 0 : self->authority_seed = NULL;
19684 0 : }
19685 0 : fd_pubkey_destroy( &self->authority_owner, ctx );
19686 0 : }
19687 :
19688 0 : ulong fd_authorize_with_seed_args_footprint( void ){ return FD_AUTHORIZE_WITH_SEED_ARGS_FOOTPRINT; }
19689 0 : ulong fd_authorize_with_seed_args_align( void ){ return FD_AUTHORIZE_WITH_SEED_ARGS_ALIGN; }
19690 :
19691 0 : void fd_authorize_with_seed_args_walk( void * w, fd_authorize_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19692 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_with_seed_args", level++ );
19693 0 : fd_pubkey_walk( w, &self->new_authorized_pubkey, fun, "new_authorized_pubkey", level );
19694 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level );
19695 0 : fun(w, self->authority_seed, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
19696 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level );
19697 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_with_seed_args", level-- );
19698 0 : }
19699 0 : ulong fd_authorize_with_seed_args_size( fd_authorize_with_seed_args_t const * self ) {
19700 0 : ulong size = 0;
19701 0 : size += fd_pubkey_size( &self->new_authorized_pubkey );
19702 0 : size += fd_stake_authorize_size( &self->stake_authorize );
19703 0 : do {
19704 0 : size += sizeof(ulong);
19705 0 : size += self->authority_seed_len;
19706 0 : } while(0);
19707 0 : size += fd_pubkey_size( &self->authority_owner );
19708 0 : return size;
19709 0 : }
19710 :
19711 0 : int fd_authorize_checked_with_seed_args_decode( fd_authorize_checked_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
19712 0 : void const * data = ctx->data;
19713 0 : int err = fd_authorize_checked_with_seed_args_decode_preflight( ctx );
19714 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19715 0 : ctx->data = data;
19716 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19717 0 : fd_authorize_checked_with_seed_args_new( self );
19718 0 : }
19719 0 : fd_authorize_checked_with_seed_args_decode_unsafe( self, ctx );
19720 0 : return FD_BINCODE_SUCCESS;
19721 0 : }
19722 453 : int fd_authorize_checked_with_seed_args_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19723 453 : int err;
19724 453 : err = fd_stake_authorize_decode_preflight( ctx );
19725 453 : if( FD_UNLIKELY( err ) ) return err;
19726 441 : ulong authority_seed_len;
19727 441 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
19728 441 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19729 438 : if( authority_seed_len ) {
19730 411 : err = fd_bincode_bytes_decode_preflight( authority_seed_len, ctx );
19731 411 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19732 405 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
19733 405 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19734 405 : }
19735 186 : err = fd_pubkey_decode_preflight( ctx );
19736 186 : if( FD_UNLIKELY( err ) ) return err;
19737 180 : return FD_BINCODE_SUCCESS;
19738 186 : }
19739 180 : void fd_authorize_checked_with_seed_args_decode_unsafe( fd_authorize_checked_with_seed_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
19740 180 : fd_stake_authorize_decode_unsafe( &self->stake_authorize, ctx );
19741 180 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
19742 180 : if( self->authority_seed_len ) {
19743 156 : self->authority_seed = fd_valloc_malloc( ctx->valloc, 8UL, self->authority_seed_len );
19744 156 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
19745 156 : } else
19746 24 : self->authority_seed = NULL;
19747 180 : fd_pubkey_decode_unsafe( &self->authority_owner, ctx );
19748 180 : }
19749 0 : int fd_authorize_checked_with_seed_args_encode( fd_authorize_checked_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19750 0 : int err;
19751 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
19752 0 : if( FD_UNLIKELY( err ) ) return err;
19753 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
19754 0 : if( FD_UNLIKELY(err) ) return err;
19755 0 : if( self->authority_seed_len ) {
19756 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
19757 0 : if( FD_UNLIKELY( err ) ) return err;
19758 0 : }
19759 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
19760 0 : if( FD_UNLIKELY( err ) ) return err;
19761 0 : return FD_BINCODE_SUCCESS;
19762 0 : }
19763 0 : int fd_authorize_checked_with_seed_args_decode_offsets( fd_authorize_checked_with_seed_args_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
19764 0 : uchar const * data = ctx->data;
19765 0 : int err;
19766 0 : self->stake_authorize_off = (uint)( (ulong)ctx->data - (ulong)data );
19767 0 : err = fd_stake_authorize_decode_preflight( ctx );
19768 0 : if( FD_UNLIKELY( err ) ) return err;
19769 0 : self->authority_seed_off = (uint)( (ulong)ctx->data - (ulong)data );
19770 0 : ulong authority_seed_len;
19771 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
19772 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19773 0 : if( authority_seed_len ) {
19774 0 : err = fd_bincode_bytes_decode_preflight( authority_seed_len, ctx );
19775 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19776 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
19777 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19778 0 : }
19779 0 : self->authority_owner_off = (uint)( (ulong)ctx->data - (ulong)data );
19780 0 : err = fd_pubkey_decode_preflight( ctx );
19781 0 : if( FD_UNLIKELY( err ) ) return err;
19782 0 : return FD_BINCODE_SUCCESS;
19783 0 : }
19784 0 : void fd_authorize_checked_with_seed_args_new(fd_authorize_checked_with_seed_args_t * self) {
19785 0 : fd_memset( self, 0, sizeof(fd_authorize_checked_with_seed_args_t) );
19786 0 : fd_stake_authorize_new( &self->stake_authorize );
19787 0 : fd_pubkey_new( &self->authority_owner );
19788 0 : }
19789 0 : void fd_authorize_checked_with_seed_args_destroy( fd_authorize_checked_with_seed_args_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19790 0 : fd_stake_authorize_destroy( &self->stake_authorize, ctx );
19791 0 : if( self->authority_seed ) {
19792 0 : fd_valloc_free( ctx->valloc, self->authority_seed );
19793 0 : self->authority_seed = NULL;
19794 0 : }
19795 0 : fd_pubkey_destroy( &self->authority_owner, ctx );
19796 0 : }
19797 :
19798 0 : ulong fd_authorize_checked_with_seed_args_footprint( void ){ return FD_AUTHORIZE_CHECKED_WITH_SEED_ARGS_FOOTPRINT; }
19799 0 : ulong fd_authorize_checked_with_seed_args_align( void ){ return FD_AUTHORIZE_CHECKED_WITH_SEED_ARGS_ALIGN; }
19800 :
19801 0 : void fd_authorize_checked_with_seed_args_walk( void * w, fd_authorize_checked_with_seed_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19802 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_checked_with_seed_args", level++ );
19803 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level );
19804 0 : fun(w, self->authority_seed, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
19805 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level );
19806 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_checked_with_seed_args", level-- );
19807 0 : }
19808 0 : ulong fd_authorize_checked_with_seed_args_size( fd_authorize_checked_with_seed_args_t const * self ) {
19809 0 : ulong size = 0;
19810 0 : size += fd_stake_authorize_size( &self->stake_authorize );
19811 0 : do {
19812 0 : size += sizeof(ulong);
19813 0 : size += self->authority_seed_len;
19814 0 : } while(0);
19815 0 : size += fd_pubkey_size( &self->authority_owner );
19816 0 : return size;
19817 0 : }
19818 :
19819 0 : int fd_lockup_checked_args_decode( fd_lockup_checked_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
19820 0 : void const * data = ctx->data;
19821 0 : int err = fd_lockup_checked_args_decode_preflight( ctx );
19822 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19823 0 : ctx->data = data;
19824 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19825 0 : fd_lockup_checked_args_new( self );
19826 0 : }
19827 0 : fd_lockup_checked_args_decode_unsafe( self, ctx );
19828 0 : return FD_BINCODE_SUCCESS;
19829 0 : }
19830 342 : int fd_lockup_checked_args_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19831 342 : int err;
19832 342 : {
19833 342 : uchar o;
19834 342 : err = fd_bincode_bool_decode( &o, ctx );
19835 342 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19836 333 : if( o ) {
19837 141 : err = fd_bincode_int64_decode_preflight( ctx );
19838 141 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19839 141 : }
19840 333 : }
19841 327 : {
19842 327 : uchar o;
19843 327 : err = fd_bincode_bool_decode( &o, ctx );
19844 327 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19845 312 : if( o ) {
19846 192 : err = fd_bincode_uint64_decode_preflight( ctx );
19847 192 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19848 192 : }
19849 312 : }
19850 306 : return FD_BINCODE_SUCCESS;
19851 312 : }
19852 306 : void fd_lockup_checked_args_decode_unsafe( fd_lockup_checked_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
19853 306 : {
19854 306 : uchar o;
19855 306 : fd_bincode_bool_decode_unsafe( &o, ctx );
19856 306 : if( o ) {
19857 120 : self->unix_timestamp = fd_valloc_malloc( ctx->valloc, 8, sizeof(long) );
19858 120 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
19859 120 : } else
19860 186 : self->unix_timestamp = NULL;
19861 306 : }
19862 306 : {
19863 306 : uchar o;
19864 306 : fd_bincode_bool_decode_unsafe( &o, ctx );
19865 306 : if( o ) {
19866 186 : self->epoch = fd_valloc_malloc( ctx->valloc, 8, sizeof(ulong) );
19867 186 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
19868 186 : } else
19869 120 : self->epoch = NULL;
19870 306 : }
19871 306 : }
19872 0 : int fd_lockup_checked_args_encode( fd_lockup_checked_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19873 0 : int err;
19874 0 : if( self->unix_timestamp != NULL ) {
19875 0 : err = fd_bincode_bool_encode( 1, ctx );
19876 0 : if( FD_UNLIKELY( err ) ) return err;
19877 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
19878 0 : if( FD_UNLIKELY( err ) ) return err;
19879 0 : } else {
19880 0 : err = fd_bincode_bool_encode( 0, ctx );
19881 0 : if( FD_UNLIKELY( err ) ) return err;
19882 0 : }
19883 0 : if( self->epoch != NULL ) {
19884 0 : err = fd_bincode_bool_encode( 1, ctx );
19885 0 : if( FD_UNLIKELY( err ) ) return err;
19886 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
19887 0 : if( FD_UNLIKELY( err ) ) return err;
19888 0 : } else {
19889 0 : err = fd_bincode_bool_encode( 0, ctx );
19890 0 : if( FD_UNLIKELY( err ) ) return err;
19891 0 : }
19892 0 : return FD_BINCODE_SUCCESS;
19893 0 : }
19894 0 : int fd_lockup_checked_args_decode_offsets( fd_lockup_checked_args_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
19895 0 : uchar const * data = ctx->data;
19896 0 : int err;
19897 0 : self->unix_timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
19898 0 : {
19899 0 : uchar o;
19900 0 : err = fd_bincode_bool_decode( &o, ctx );
19901 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19902 0 : if( o ) {
19903 0 : err = fd_bincode_int64_decode_preflight( ctx );
19904 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19905 0 : }
19906 0 : }
19907 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
19908 0 : {
19909 0 : uchar o;
19910 0 : err = fd_bincode_bool_decode( &o, ctx );
19911 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19912 0 : if( o ) {
19913 0 : err = fd_bincode_uint64_decode_preflight( ctx );
19914 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19915 0 : }
19916 0 : }
19917 0 : return FD_BINCODE_SUCCESS;
19918 0 : }
19919 0 : void fd_lockup_checked_args_new(fd_lockup_checked_args_t * self) {
19920 0 : fd_memset( self, 0, sizeof(fd_lockup_checked_args_t) );
19921 0 : }
19922 0 : void fd_lockup_checked_args_destroy( fd_lockup_checked_args_t * self, fd_bincode_destroy_ctx_t * ctx ) {
19923 0 : if( self->unix_timestamp ) {
19924 0 : fd_valloc_free( ctx->valloc, self->unix_timestamp );
19925 0 : self->unix_timestamp = NULL;
19926 0 : }
19927 0 : if( self->epoch ) {
19928 0 : fd_valloc_free( ctx->valloc, self->epoch );
19929 0 : self->epoch = NULL;
19930 0 : }
19931 0 : }
19932 :
19933 0 : ulong fd_lockup_checked_args_footprint( void ){ return FD_LOCKUP_CHECKED_ARGS_FOOTPRINT; }
19934 0 : ulong fd_lockup_checked_args_align( void ){ return FD_LOCKUP_CHECKED_ARGS_ALIGN; }
19935 :
19936 0 : void fd_lockup_checked_args_walk( void * w, fd_lockup_checked_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
19937 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_checked_args", level++ );
19938 0 : if( !self->unix_timestamp ) {
19939 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
19940 0 : } else {
19941 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
19942 0 : }
19943 0 : if( !self->epoch ) {
19944 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level );
19945 0 : } else {
19946 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
19947 0 : }
19948 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_checked_args", level-- );
19949 0 : }
19950 0 : ulong fd_lockup_checked_args_size( fd_lockup_checked_args_t const * self ) {
19951 0 : ulong size = 0;
19952 0 : size += sizeof(char);
19953 0 : if( NULL != self->unix_timestamp ) {
19954 0 : size += sizeof(long);
19955 0 : }
19956 0 : size += sizeof(char);
19957 0 : if( NULL != self->epoch ) {
19958 0 : size += sizeof(ulong);
19959 0 : }
19960 0 : return size;
19961 0 : }
19962 :
19963 0 : int fd_lockup_args_decode( fd_lockup_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
19964 0 : void const * data = ctx->data;
19965 0 : int err = fd_lockup_args_decode_preflight( ctx );
19966 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19967 0 : ctx->data = data;
19968 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
19969 0 : fd_lockup_args_new( self );
19970 0 : }
19971 0 : fd_lockup_args_decode_unsafe( self, ctx );
19972 0 : return FD_BINCODE_SUCCESS;
19973 0 : }
19974 693 : int fd_lockup_args_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
19975 693 : int err;
19976 693 : {
19977 693 : uchar o;
19978 693 : err = fd_bincode_bool_decode( &o, ctx );
19979 693 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19980 675 : if( o ) {
19981 405 : err = fd_bincode_int64_decode_preflight( ctx );
19982 405 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19983 405 : }
19984 675 : }
19985 672 : {
19986 672 : uchar o;
19987 672 : err = fd_bincode_bool_decode( &o, ctx );
19988 672 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19989 660 : if( o ) {
19990 342 : err = fd_bincode_uint64_decode_preflight( ctx );
19991 342 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19992 342 : }
19993 660 : }
19994 654 : {
19995 654 : uchar o;
19996 654 : err = fd_bincode_bool_decode( &o, ctx );
19997 654 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19998 642 : if( o ) {
19999 273 : err = fd_pubkey_decode_preflight( ctx );
20000 273 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20001 273 : }
20002 642 : }
20003 624 : return FD_BINCODE_SUCCESS;
20004 642 : }
20005 624 : void fd_lockup_args_decode_unsafe( fd_lockup_args_t * self, fd_bincode_decode_ctx_t * ctx ) {
20006 624 : {
20007 624 : uchar o;
20008 624 : fd_bincode_bool_decode_unsafe( &o, ctx );
20009 624 : if( o ) {
20010 390 : self->unix_timestamp = fd_valloc_malloc( ctx->valloc, 8, sizeof(long) );
20011 390 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
20012 390 : } else
20013 234 : self->unix_timestamp = NULL;
20014 624 : }
20015 624 : {
20016 624 : uchar o;
20017 624 : fd_bincode_bool_decode_unsafe( &o, ctx );
20018 624 : if( o ) {
20019 324 : self->epoch = fd_valloc_malloc( ctx->valloc, 8, sizeof(ulong) );
20020 324 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
20021 324 : } else
20022 300 : self->epoch = NULL;
20023 624 : }
20024 624 : {
20025 624 : uchar o;
20026 624 : fd_bincode_bool_decode_unsafe( &o, ctx );
20027 624 : if( o ) {
20028 255 : self->custodian = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT );
20029 255 : fd_pubkey_new( self->custodian );
20030 255 : fd_pubkey_decode_unsafe( self->custodian, ctx );
20031 255 : } else
20032 369 : self->custodian = NULL;
20033 624 : }
20034 624 : }
20035 0 : int fd_lockup_args_encode( fd_lockup_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20036 0 : int err;
20037 0 : if( self->unix_timestamp != NULL ) {
20038 0 : err = fd_bincode_bool_encode( 1, ctx );
20039 0 : if( FD_UNLIKELY( err ) ) return err;
20040 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
20041 0 : if( FD_UNLIKELY( err ) ) return err;
20042 0 : } else {
20043 0 : err = fd_bincode_bool_encode( 0, ctx );
20044 0 : if( FD_UNLIKELY( err ) ) return err;
20045 0 : }
20046 0 : if( self->epoch != NULL ) {
20047 0 : err = fd_bincode_bool_encode( 1, ctx );
20048 0 : if( FD_UNLIKELY( err ) ) return err;
20049 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
20050 0 : if( FD_UNLIKELY( err ) ) return err;
20051 0 : } else {
20052 0 : err = fd_bincode_bool_encode( 0, ctx );
20053 0 : if( FD_UNLIKELY( err ) ) return err;
20054 0 : }
20055 0 : if( self->custodian != NULL ) {
20056 0 : err = fd_bincode_bool_encode( 1, ctx );
20057 0 : if( FD_UNLIKELY( err ) ) return err;
20058 0 : err = fd_pubkey_encode( self->custodian, ctx );
20059 0 : if( FD_UNLIKELY( err ) ) return err;
20060 0 : } else {
20061 0 : err = fd_bincode_bool_encode( 0, ctx );
20062 0 : if( FD_UNLIKELY( err ) ) return err;
20063 0 : }
20064 0 : return FD_BINCODE_SUCCESS;
20065 0 : }
20066 0 : int fd_lockup_args_decode_offsets( fd_lockup_args_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
20067 0 : uchar const * data = ctx->data;
20068 0 : int err;
20069 0 : self->unix_timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
20070 0 : {
20071 0 : uchar o;
20072 0 : err = fd_bincode_bool_decode( &o, ctx );
20073 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20074 0 : if( o ) {
20075 0 : err = fd_bincode_int64_decode_preflight( ctx );
20076 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20077 0 : }
20078 0 : }
20079 0 : self->epoch_off = (uint)( (ulong)ctx->data - (ulong)data );
20080 0 : {
20081 0 : uchar o;
20082 0 : err = fd_bincode_bool_decode( &o, ctx );
20083 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20084 0 : if( o ) {
20085 0 : err = fd_bincode_uint64_decode_preflight( ctx );
20086 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20087 0 : }
20088 0 : }
20089 0 : self->custodian_off = (uint)( (ulong)ctx->data - (ulong)data );
20090 0 : {
20091 0 : uchar o;
20092 0 : err = fd_bincode_bool_decode( &o, ctx );
20093 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20094 0 : if( o ) {
20095 0 : err = fd_pubkey_decode_preflight( ctx );
20096 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20097 0 : }
20098 0 : }
20099 0 : return FD_BINCODE_SUCCESS;
20100 0 : }
20101 0 : void fd_lockup_args_new(fd_lockup_args_t * self) {
20102 0 : fd_memset( self, 0, sizeof(fd_lockup_args_t) );
20103 0 : }
20104 0 : void fd_lockup_args_destroy( fd_lockup_args_t * self, fd_bincode_destroy_ctx_t * ctx ) {
20105 0 : if( self->unix_timestamp ) {
20106 0 : fd_valloc_free( ctx->valloc, self->unix_timestamp );
20107 0 : self->unix_timestamp = NULL;
20108 0 : }
20109 0 : if( self->epoch ) {
20110 0 : fd_valloc_free( ctx->valloc, self->epoch );
20111 0 : self->epoch = NULL;
20112 0 : }
20113 0 : if( self->custodian ) {
20114 0 : fd_pubkey_destroy( self->custodian, ctx );
20115 0 : fd_valloc_free( ctx->valloc, self->custodian );
20116 0 : self->custodian = NULL;
20117 0 : }
20118 0 : }
20119 :
20120 0 : ulong fd_lockup_args_footprint( void ){ return FD_LOCKUP_ARGS_FOOTPRINT; }
20121 0 : ulong fd_lockup_args_align( void ){ return FD_LOCKUP_ARGS_ALIGN; }
20122 :
20123 0 : void fd_lockup_args_walk( void * w, fd_lockup_args_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20124 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_args", level++ );
20125 0 : if( !self->unix_timestamp ) {
20126 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level );
20127 0 : } else {
20128 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
20129 0 : }
20130 0 : if( !self->epoch ) {
20131 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level );
20132 0 : } else {
20133 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
20134 0 : }
20135 0 : if( !self->custodian ) {
20136 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
20137 0 : } else {
20138 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level );
20139 0 : }
20140 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_args", level-- );
20141 0 : }
20142 0 : ulong fd_lockup_args_size( fd_lockup_args_t const * self ) {
20143 0 : ulong size = 0;
20144 0 : size += sizeof(char);
20145 0 : if( NULL != self->unix_timestamp ) {
20146 0 : size += sizeof(long);
20147 0 : }
20148 0 : size += sizeof(char);
20149 0 : if( NULL != self->epoch ) {
20150 0 : size += sizeof(ulong);
20151 0 : }
20152 0 : size += sizeof(char);
20153 0 : if( NULL != self->custodian ) {
20154 0 : size += fd_pubkey_size( self->custodian );
20155 0 : }
20156 0 : return size;
20157 0 : }
20158 :
20159 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize(fd_stake_instruction_t const * self) {
20160 0 : return self->discriminant == 0;
20161 0 : }
20162 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize(fd_stake_instruction_t const * self) {
20163 0 : return self->discriminant == 1;
20164 0 : }
20165 0 : FD_FN_PURE uchar fd_stake_instruction_is_delegate_stake(fd_stake_instruction_t const * self) {
20166 0 : return self->discriminant == 2;
20167 0 : }
20168 0 : FD_FN_PURE uchar fd_stake_instruction_is_split(fd_stake_instruction_t const * self) {
20169 0 : return self->discriminant == 3;
20170 0 : }
20171 0 : FD_FN_PURE uchar fd_stake_instruction_is_withdraw(fd_stake_instruction_t const * self) {
20172 0 : return self->discriminant == 4;
20173 0 : }
20174 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate(fd_stake_instruction_t const * self) {
20175 0 : return self->discriminant == 5;
20176 0 : }
20177 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup(fd_stake_instruction_t const * self) {
20178 0 : return self->discriminant == 6;
20179 0 : }
20180 0 : FD_FN_PURE uchar fd_stake_instruction_is_merge(fd_stake_instruction_t const * self) {
20181 0 : return self->discriminant == 7;
20182 0 : }
20183 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_with_seed(fd_stake_instruction_t const * self) {
20184 0 : return self->discriminant == 8;
20185 0 : }
20186 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize_checked(fd_stake_instruction_t const * self) {
20187 0 : return self->discriminant == 9;
20188 0 : }
20189 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked(fd_stake_instruction_t const * self) {
20190 0 : return self->discriminant == 10;
20191 0 : }
20192 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked_with_seed(fd_stake_instruction_t const * self) {
20193 0 : return self->discriminant == 11;
20194 0 : }
20195 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup_checked(fd_stake_instruction_t const * self) {
20196 0 : return self->discriminant == 12;
20197 0 : }
20198 0 : FD_FN_PURE uchar fd_stake_instruction_is_get_minimum_delegation(fd_stake_instruction_t const * self) {
20199 0 : return self->discriminant == 13;
20200 0 : }
20201 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate_delinquent(fd_stake_instruction_t const * self) {
20202 0 : return self->discriminant == 14;
20203 0 : }
20204 0 : FD_FN_PURE uchar fd_stake_instruction_is_redelegate(fd_stake_instruction_t const * self) {
20205 0 : return self->discriminant == 15;
20206 0 : }
20207 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_stake(fd_stake_instruction_t const * self) {
20208 0 : return self->discriminant == 16;
20209 0 : }
20210 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_lamports(fd_stake_instruction_t const * self) {
20211 0 : return self->discriminant == 17;
20212 0 : }
20213 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant );
20214 17172 : int fd_stake_instruction_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20215 17172 : int err;
20216 17172 : switch (discriminant) {
20217 645 : case 0: {
20218 645 : err = fd_stake_instruction_initialize_decode_preflight( ctx );
20219 645 : if( FD_UNLIKELY( err ) ) return err;
20220 513 : return FD_BINCODE_SUCCESS;
20221 645 : }
20222 624 : case 1: {
20223 624 : err = fd_stake_instruction_authorize_decode_preflight( ctx );
20224 624 : if( FD_UNLIKELY( err ) ) return err;
20225 573 : return FD_BINCODE_SUCCESS;
20226 624 : }
20227 1491 : case 2: {
20228 1491 : return FD_BINCODE_SUCCESS;
20229 624 : }
20230 2883 : case 3: {
20231 2883 : err = fd_bincode_uint64_decode_preflight( ctx );
20232 2883 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20233 2874 : return FD_BINCODE_SUCCESS;
20234 2883 : }
20235 918 : case 4: {
20236 918 : err = fd_bincode_uint64_decode_preflight( ctx );
20237 918 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20238 909 : return FD_BINCODE_SUCCESS;
20239 918 : }
20240 585 : case 5: {
20241 585 : return FD_BINCODE_SUCCESS;
20242 918 : }
20243 693 : case 6: {
20244 693 : err = fd_lockup_args_decode_preflight( ctx );
20245 693 : if( FD_UNLIKELY( err ) ) return err;
20246 624 : return FD_BINCODE_SUCCESS;
20247 693 : }
20248 2025 : case 7: {
20249 2025 : return FD_BINCODE_SUCCESS;
20250 693 : }
20251 444 : case 8: {
20252 444 : err = fd_authorize_with_seed_args_decode_preflight( ctx );
20253 444 : if( FD_UNLIKELY( err ) ) return err;
20254 405 : return FD_BINCODE_SUCCESS;
20255 444 : }
20256 195 : case 9: {
20257 195 : return FD_BINCODE_SUCCESS;
20258 444 : }
20259 408 : case 10: {
20260 408 : err = fd_stake_authorize_decode_preflight( ctx );
20261 408 : if( FD_UNLIKELY( err ) ) return err;
20262 393 : return FD_BINCODE_SUCCESS;
20263 408 : }
20264 453 : case 11: {
20265 453 : err = fd_authorize_checked_with_seed_args_decode_preflight( ctx );
20266 453 : if( FD_UNLIKELY( err ) ) return err;
20267 180 : return FD_BINCODE_SUCCESS;
20268 453 : }
20269 342 : case 12: {
20270 342 : err = fd_lockup_checked_args_decode_preflight( ctx );
20271 342 : if( FD_UNLIKELY( err ) ) return err;
20272 306 : return FD_BINCODE_SUCCESS;
20273 342 : }
20274 2223 : case 13: {
20275 2223 : return FD_BINCODE_SUCCESS;
20276 342 : }
20277 1446 : case 14: {
20278 1446 : return FD_BINCODE_SUCCESS;
20279 342 : }
20280 555 : case 15: {
20281 555 : return FD_BINCODE_SUCCESS;
20282 342 : }
20283 630 : case 16: {
20284 630 : err = fd_bincode_uint64_decode_preflight( ctx );
20285 630 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20286 624 : return FD_BINCODE_SUCCESS;
20287 630 : }
20288 399 : case 17: {
20289 399 : err = fd_bincode_uint64_decode_preflight( ctx );
20290 399 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20291 393 : return FD_BINCODE_SUCCESS;
20292 399 : }
20293 213 : default: return FD_BINCODE_ERR_ENCODING;
20294 17172 : }
20295 17172 : }
20296 16314 : void fd_stake_instruction_inner_decode_unsafe( fd_stake_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20297 16314 : switch (discriminant) {
20298 513 : case 0: {
20299 513 : fd_stake_instruction_initialize_decode_unsafe( &self->initialize, ctx );
20300 513 : break;
20301 0 : }
20302 573 : case 1: {
20303 573 : fd_stake_instruction_authorize_decode_unsafe( &self->authorize, ctx );
20304 573 : break;
20305 0 : }
20306 1491 : case 2: {
20307 1491 : break;
20308 0 : }
20309 2874 : case 3: {
20310 2874 : fd_bincode_uint64_decode_unsafe( &self->split, ctx );
20311 2874 : break;
20312 0 : }
20313 909 : case 4: {
20314 909 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
20315 909 : break;
20316 0 : }
20317 585 : case 5: {
20318 585 : break;
20319 0 : }
20320 624 : case 6: {
20321 624 : fd_lockup_args_decode_unsafe( &self->set_lockup, ctx );
20322 624 : break;
20323 0 : }
20324 2025 : case 7: {
20325 2025 : break;
20326 0 : }
20327 405 : case 8: {
20328 405 : fd_authorize_with_seed_args_decode_unsafe( &self->authorize_with_seed, ctx );
20329 405 : break;
20330 0 : }
20331 195 : case 9: {
20332 195 : break;
20333 0 : }
20334 393 : case 10: {
20335 393 : fd_stake_authorize_decode_unsafe( &self->authorize_checked, ctx );
20336 393 : break;
20337 0 : }
20338 180 : case 11: {
20339 180 : fd_authorize_checked_with_seed_args_decode_unsafe( &self->authorize_checked_with_seed, ctx );
20340 180 : break;
20341 0 : }
20342 306 : case 12: {
20343 306 : fd_lockup_checked_args_decode_unsafe( &self->set_lockup_checked, ctx );
20344 306 : break;
20345 0 : }
20346 2223 : case 13: {
20347 2223 : break;
20348 0 : }
20349 1446 : case 14: {
20350 1446 : break;
20351 0 : }
20352 555 : case 15: {
20353 555 : break;
20354 0 : }
20355 624 : case 16: {
20356 624 : fd_bincode_uint64_decode_unsafe( &self->move_stake, ctx );
20357 624 : break;
20358 0 : }
20359 393 : case 17: {
20360 393 : fd_bincode_uint64_decode_unsafe( &self->move_lamports, ctx );
20361 393 : break;
20362 0 : }
20363 16314 : }
20364 16314 : }
20365 17298 : int fd_stake_instruction_decode( fd_stake_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
20366 17298 : void const * data = ctx->data;
20367 17298 : int err = fd_stake_instruction_decode_preflight( ctx );
20368 17298 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20369 16314 : ctx->data = data;
20370 16314 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
20371 16314 : fd_stake_instruction_new( self );
20372 16314 : }
20373 16314 : fd_stake_instruction_decode_unsafe( self, ctx );
20374 16314 : return FD_BINCODE_SUCCESS;
20375 17298 : }
20376 17298 : int fd_stake_instruction_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
20377 17298 : uint discriminant = 0;
20378 17298 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
20379 17298 : if( FD_UNLIKELY( err ) ) return err;
20380 17172 : return fd_stake_instruction_inner_decode_preflight( discriminant, ctx );
20381 17298 : }
20382 16314 : void fd_stake_instruction_decode_unsafe( fd_stake_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
20383 16314 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
20384 16314 : fd_stake_instruction_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
20385 16314 : }
20386 16314 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant ) {
20387 16314 : switch( discriminant ) {
20388 0 : case 0: {
20389 0 : fd_stake_instruction_initialize_new( &self->initialize );
20390 0 : break;
20391 0 : }
20392 0 : case 1: {
20393 0 : fd_stake_instruction_authorize_new( &self->authorize );
20394 0 : break;
20395 0 : }
20396 0 : case 2: {
20397 0 : break;
20398 0 : }
20399 0 : case 3: {
20400 0 : break;
20401 0 : }
20402 0 : case 4: {
20403 0 : break;
20404 0 : }
20405 0 : case 5: {
20406 0 : break;
20407 0 : }
20408 0 : case 6: {
20409 0 : fd_lockup_args_new( &self->set_lockup );
20410 0 : break;
20411 0 : }
20412 0 : case 7: {
20413 0 : break;
20414 0 : }
20415 0 : case 8: {
20416 0 : fd_authorize_with_seed_args_new( &self->authorize_with_seed );
20417 0 : break;
20418 0 : }
20419 0 : case 9: {
20420 0 : break;
20421 0 : }
20422 0 : case 10: {
20423 0 : fd_stake_authorize_new( &self->authorize_checked );
20424 0 : break;
20425 0 : }
20426 0 : case 11: {
20427 0 : fd_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
20428 0 : break;
20429 0 : }
20430 0 : case 12: {
20431 0 : fd_lockup_checked_args_new( &self->set_lockup_checked );
20432 0 : break;
20433 0 : }
20434 0 : case 13: {
20435 0 : break;
20436 0 : }
20437 0 : case 14: {
20438 0 : break;
20439 0 : }
20440 0 : case 15: {
20441 0 : break;
20442 0 : }
20443 0 : case 16: {
20444 0 : break;
20445 0 : }
20446 0 : case 17: {
20447 0 : break;
20448 0 : }
20449 16314 : default: break; // FD_LOG_ERR(( "unhandled type"));
20450 16314 : }
20451 16314 : }
20452 16314 : void fd_stake_instruction_new_disc( fd_stake_instruction_t * self, uint discriminant ) {
20453 16314 : self->discriminant = discriminant;
20454 16314 : fd_stake_instruction_inner_new( &self->inner, self->discriminant );
20455 16314 : }
20456 16314 : void fd_stake_instruction_new( fd_stake_instruction_t * self ) {
20457 16314 : fd_memset( self, 0, sizeof(fd_stake_instruction_t) );
20458 16314 : fd_stake_instruction_new_disc( self, UINT_MAX );
20459 16314 : }
20460 0 : void fd_stake_instruction_inner_destroy( fd_stake_instruction_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
20461 0 : switch( discriminant ) {
20462 0 : case 0: {
20463 0 : fd_stake_instruction_initialize_destroy( &self->initialize, ctx );
20464 0 : break;
20465 0 : }
20466 0 : case 1: {
20467 0 : fd_stake_instruction_authorize_destroy( &self->authorize, ctx );
20468 0 : break;
20469 0 : }
20470 0 : case 3: {
20471 0 : break;
20472 0 : }
20473 0 : case 4: {
20474 0 : break;
20475 0 : }
20476 0 : case 6: {
20477 0 : fd_lockup_args_destroy( &self->set_lockup, ctx );
20478 0 : break;
20479 0 : }
20480 0 : case 8: {
20481 0 : fd_authorize_with_seed_args_destroy( &self->authorize_with_seed, ctx );
20482 0 : break;
20483 0 : }
20484 0 : case 10: {
20485 0 : fd_stake_authorize_destroy( &self->authorize_checked, ctx );
20486 0 : break;
20487 0 : }
20488 0 : case 11: {
20489 0 : fd_authorize_checked_with_seed_args_destroy( &self->authorize_checked_with_seed, ctx );
20490 0 : break;
20491 0 : }
20492 0 : case 12: {
20493 0 : fd_lockup_checked_args_destroy( &self->set_lockup_checked, ctx );
20494 0 : break;
20495 0 : }
20496 0 : case 16: {
20497 0 : break;
20498 0 : }
20499 0 : case 17: {
20500 0 : break;
20501 0 : }
20502 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
20503 0 : }
20504 0 : }
20505 0 : void fd_stake_instruction_destroy( fd_stake_instruction_t * self, fd_bincode_destroy_ctx_t * ctx ) {
20506 0 : fd_stake_instruction_inner_destroy( &self->inner, self->discriminant, ctx );
20507 0 : }
20508 :
20509 0 : ulong fd_stake_instruction_footprint( void ){ return FD_STAKE_INSTRUCTION_FOOTPRINT; }
20510 0 : ulong fd_stake_instruction_align( void ){ return FD_STAKE_INSTRUCTION_ALIGN; }
20511 :
20512 0 : void fd_stake_instruction_walk( void * w, fd_stake_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20513 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_instruction", level++);
20514 0 : switch( self->discriminant ) {
20515 0 : case 0: {
20516 0 : fun( w, self, "initialize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20517 0 : fd_stake_instruction_initialize_walk( w, &self->inner.initialize, fun, "initialize", level );
20518 0 : break;
20519 0 : }
20520 0 : case 1: {
20521 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20522 0 : fd_stake_instruction_authorize_walk( w, &self->inner.authorize, fun, "authorize", level );
20523 0 : break;
20524 0 : }
20525 0 : case 2: {
20526 0 : fun( w, self, "delegate_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20527 0 : break;
20528 0 : }
20529 0 : case 3: {
20530 0 : fun( w, self, "split", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20531 0 : fun( w, &self->inner.split, "split", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
20532 0 : break;
20533 0 : }
20534 0 : case 4: {
20535 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20536 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
20537 0 : break;
20538 0 : }
20539 0 : case 5: {
20540 0 : fun( w, self, "deactivate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20541 0 : break;
20542 0 : }
20543 0 : case 6: {
20544 0 : fun( w, self, "set_lockup", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20545 0 : fd_lockup_args_walk( w, &self->inner.set_lockup, fun, "set_lockup", level );
20546 0 : break;
20547 0 : }
20548 0 : case 7: {
20549 0 : fun( w, self, "merge", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20550 0 : break;
20551 0 : }
20552 0 : case 8: {
20553 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20554 0 : fd_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level );
20555 0 : break;
20556 0 : }
20557 0 : case 9: {
20558 0 : fun( w, self, "initialize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20559 0 : break;
20560 0 : }
20561 0 : case 10: {
20562 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20563 0 : fd_stake_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level );
20564 0 : break;
20565 0 : }
20566 0 : case 11: {
20567 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20568 0 : fd_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level );
20569 0 : break;
20570 0 : }
20571 0 : case 12: {
20572 0 : fun( w, self, "set_lockup_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20573 0 : fd_lockup_checked_args_walk( w, &self->inner.set_lockup_checked, fun, "set_lockup_checked", level );
20574 0 : break;
20575 0 : }
20576 0 : case 13: {
20577 0 : fun( w, self, "get_minimum_delegation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20578 0 : break;
20579 0 : }
20580 0 : case 14: {
20581 0 : fun( w, self, "deactivate_delinquent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20582 0 : break;
20583 0 : }
20584 0 : case 15: {
20585 0 : fun( w, self, "redelegate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20586 0 : break;
20587 0 : }
20588 0 : case 16: {
20589 0 : fun( w, self, "move_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20590 0 : fun( w, &self->inner.move_stake, "move_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
20591 0 : break;
20592 0 : }
20593 0 : case 17: {
20594 0 : fun( w, self, "move_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
20595 0 : fun( w, &self->inner.move_lamports, "move_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
20596 0 : break;
20597 0 : }
20598 0 : }
20599 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_instruction", level-- );
20600 0 : }
20601 0 : ulong fd_stake_instruction_size( fd_stake_instruction_t const * self ) {
20602 0 : ulong size = 0;
20603 0 : size += sizeof(uint);
20604 0 : switch (self->discriminant) {
20605 0 : case 0: {
20606 0 : size += fd_stake_instruction_initialize_size( &self->inner.initialize );
20607 0 : break;
20608 0 : }
20609 0 : case 1: {
20610 0 : size += fd_stake_instruction_authorize_size( &self->inner.authorize );
20611 0 : break;
20612 0 : }
20613 0 : case 3: {
20614 0 : size += sizeof(ulong);
20615 0 : break;
20616 0 : }
20617 0 : case 4: {
20618 0 : size += sizeof(ulong);
20619 0 : break;
20620 0 : }
20621 0 : case 6: {
20622 0 : size += fd_lockup_args_size( &self->inner.set_lockup );
20623 0 : break;
20624 0 : }
20625 0 : case 8: {
20626 0 : size += fd_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
20627 0 : break;
20628 0 : }
20629 0 : case 10: {
20630 0 : size += fd_stake_authorize_size( &self->inner.authorize_checked );
20631 0 : break;
20632 0 : }
20633 0 : case 11: {
20634 0 : size += fd_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
20635 0 : break;
20636 0 : }
20637 0 : case 12: {
20638 0 : size += fd_lockup_checked_args_size( &self->inner.set_lockup_checked );
20639 0 : break;
20640 0 : }
20641 0 : case 16: {
20642 0 : size += sizeof(ulong);
20643 0 : break;
20644 0 : }
20645 0 : case 17: {
20646 0 : size += sizeof(ulong);
20647 0 : break;
20648 0 : }
20649 0 : }
20650 0 : return size;
20651 0 : }
20652 :
20653 0 : int fd_stake_instruction_inner_encode( fd_stake_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
20654 0 : int err;
20655 0 : switch (discriminant) {
20656 0 : case 0: {
20657 0 : err = fd_stake_instruction_initialize_encode( &self->initialize, ctx );
20658 0 : if( FD_UNLIKELY( err ) ) return err;
20659 0 : break;
20660 0 : }
20661 0 : case 1: {
20662 0 : err = fd_stake_instruction_authorize_encode( &self->authorize, ctx );
20663 0 : if( FD_UNLIKELY( err ) ) return err;
20664 0 : break;
20665 0 : }
20666 0 : case 3: {
20667 0 : err = fd_bincode_uint64_encode( self->split, ctx );
20668 0 : if( FD_UNLIKELY( err ) ) return err;
20669 0 : break;
20670 0 : }
20671 0 : case 4: {
20672 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
20673 0 : if( FD_UNLIKELY( err ) ) return err;
20674 0 : break;
20675 0 : }
20676 0 : case 6: {
20677 0 : err = fd_lockup_args_encode( &self->set_lockup, ctx );
20678 0 : if( FD_UNLIKELY( err ) ) return err;
20679 0 : break;
20680 0 : }
20681 0 : case 8: {
20682 0 : err = fd_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
20683 0 : if( FD_UNLIKELY( err ) ) return err;
20684 0 : break;
20685 0 : }
20686 0 : case 10: {
20687 0 : err = fd_stake_authorize_encode( &self->authorize_checked, ctx );
20688 0 : if( FD_UNLIKELY( err ) ) return err;
20689 0 : break;
20690 0 : }
20691 0 : case 11: {
20692 0 : err = fd_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
20693 0 : if( FD_UNLIKELY( err ) ) return err;
20694 0 : break;
20695 0 : }
20696 0 : case 12: {
20697 0 : err = fd_lockup_checked_args_encode( &self->set_lockup_checked, ctx );
20698 0 : if( FD_UNLIKELY( err ) ) return err;
20699 0 : break;
20700 0 : }
20701 0 : case 16: {
20702 0 : err = fd_bincode_uint64_encode( self->move_stake, ctx );
20703 0 : if( FD_UNLIKELY( err ) ) return err;
20704 0 : break;
20705 0 : }
20706 0 : case 17: {
20707 0 : err = fd_bincode_uint64_encode( self->move_lamports, ctx );
20708 0 : if( FD_UNLIKELY( err ) ) return err;
20709 0 : break;
20710 0 : }
20711 0 : }
20712 0 : return FD_BINCODE_SUCCESS;
20713 0 : }
20714 0 : int fd_stake_instruction_encode( fd_stake_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20715 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
20716 0 : if( FD_UNLIKELY( err ) ) return err;
20717 0 : return fd_stake_instruction_inner_encode( &self->inner, self->discriminant, ctx );
20718 0 : }
20719 :
20720 0 : int fd_stake_meta_decode( fd_stake_meta_t * self, fd_bincode_decode_ctx_t * ctx ) {
20721 0 : void const * data = ctx->data;
20722 0 : int err = fd_stake_meta_decode_preflight( ctx );
20723 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20724 0 : ctx->data = data;
20725 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
20726 0 : fd_stake_meta_new( self );
20727 0 : }
20728 0 : fd_stake_meta_decode_unsafe( self, ctx );
20729 0 : return FD_BINCODE_SUCCESS;
20730 0 : }
20731 0 : int fd_stake_meta_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
20732 0 : return fd_bincode_bytes_decode_preflight( 120, ctx );
20733 0 : }
20734 7719 : void fd_stake_meta_decode_unsafe( fd_stake_meta_t * self, fd_bincode_decode_ctx_t * ctx ) {
20735 7719 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
20736 7719 : fd_stake_authorized_decode_unsafe( &self->authorized, ctx );
20737 7719 : fd_stake_lockup_decode_unsafe( &self->lockup, ctx );
20738 7719 : }
20739 2625 : int fd_stake_meta_encode( fd_stake_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20740 2625 : int err;
20741 2625 : err = fd_bincode_uint64_encode( self->rent_exempt_reserve, ctx );
20742 2625 : if( FD_UNLIKELY( err ) ) return err;
20743 2625 : err = fd_stake_authorized_encode( &self->authorized, ctx );
20744 2625 : if( FD_UNLIKELY( err ) ) return err;
20745 2625 : err = fd_stake_lockup_encode( &self->lockup, ctx );
20746 2625 : if( FD_UNLIKELY( err ) ) return err;
20747 2625 : return FD_BINCODE_SUCCESS;
20748 2625 : }
20749 0 : int fd_stake_meta_decode_offsets( fd_stake_meta_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
20750 0 : uchar const * data = ctx->data;
20751 0 : int err;
20752 0 : self->rent_exempt_reserve_off = (uint)( (ulong)ctx->data - (ulong)data );
20753 0 : err = fd_bincode_uint64_decode_preflight( ctx );
20754 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20755 0 : self->authorized_off = (uint)( (ulong)ctx->data - (ulong)data );
20756 0 : err = fd_stake_authorized_decode_preflight( ctx );
20757 0 : if( FD_UNLIKELY( err ) ) return err;
20758 0 : self->lockup_off = (uint)( (ulong)ctx->data - (ulong)data );
20759 0 : err = fd_stake_lockup_decode_preflight( ctx );
20760 0 : if( FD_UNLIKELY( err ) ) return err;
20761 0 : return FD_BINCODE_SUCCESS;
20762 0 : }
20763 12 : void fd_stake_meta_new(fd_stake_meta_t * self) {
20764 12 : fd_memset( self, 0, sizeof(fd_stake_meta_t) );
20765 12 : fd_stake_authorized_new( &self->authorized );
20766 12 : fd_stake_lockup_new( &self->lockup );
20767 12 : }
20768 0 : void fd_stake_meta_destroy( fd_stake_meta_t * self, fd_bincode_destroy_ctx_t * ctx ) {
20769 0 : fd_stake_authorized_destroy( &self->authorized, ctx );
20770 0 : fd_stake_lockup_destroy( &self->lockup, ctx );
20771 0 : }
20772 :
20773 0 : ulong fd_stake_meta_footprint( void ){ return FD_STAKE_META_FOOTPRINT; }
20774 0 : ulong fd_stake_meta_align( void ){ return FD_STAKE_META_ALIGN; }
20775 :
20776 0 : void fd_stake_meta_walk( void * w, fd_stake_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20777 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_meta", level++ );
20778 0 : fun( w, &self->rent_exempt_reserve, "rent_exempt_reserve", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
20779 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level );
20780 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level );
20781 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_meta", level-- );
20782 0 : }
20783 2613 : ulong fd_stake_meta_size( fd_stake_meta_t const * self ) {
20784 2613 : ulong size = 0;
20785 2613 : size += sizeof(ulong);
20786 2613 : size += fd_stake_authorized_size( &self->authorized );
20787 2613 : size += fd_stake_lockup_size( &self->lockup );
20788 2613 : return size;
20789 2613 : }
20790 :
20791 0 : int fd_stake_flags_decode( fd_stake_flags_t * self, fd_bincode_decode_ctx_t * ctx ) {
20792 0 : void const * data = ctx->data;
20793 0 : int err = fd_stake_flags_decode_preflight( ctx );
20794 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20795 0 : ctx->data = data;
20796 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
20797 0 : fd_stake_flags_new( self );
20798 0 : }
20799 0 : fd_stake_flags_decode_unsafe( self, ctx );
20800 0 : return FD_BINCODE_SUCCESS;
20801 0 : }
20802 0 : int fd_stake_flags_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
20803 0 : return fd_bincode_bytes_decode_preflight( 1, ctx );
20804 0 : }
20805 4998 : void fd_stake_flags_decode_unsafe( fd_stake_flags_t * self, fd_bincode_decode_ctx_t * ctx ) {
20806 4998 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
20807 4998 : }
20808 1842 : int fd_stake_flags_encode( fd_stake_flags_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20809 1842 : int err;
20810 1842 : err = fd_bincode_uint8_encode( (uchar)(self->bits), ctx );
20811 1842 : if( FD_UNLIKELY( err ) ) return err;
20812 1842 : return FD_BINCODE_SUCCESS;
20813 1842 : }
20814 0 : int fd_stake_flags_decode_offsets( fd_stake_flags_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
20815 0 : uchar const * data = ctx->data;
20816 0 : int err;
20817 0 : self->bits_off = (uint)( (ulong)ctx->data - (ulong)data );
20818 0 : err = fd_bincode_uint8_decode_preflight( ctx );
20819 0 : if( FD_UNLIKELY( err ) ) return err;
20820 0 : return FD_BINCODE_SUCCESS;
20821 0 : }
20822 12 : void fd_stake_flags_new(fd_stake_flags_t * self) {
20823 12 : fd_memset( self, 0, sizeof(fd_stake_flags_t) );
20824 12 : }
20825 0 : void fd_stake_flags_destroy( fd_stake_flags_t * self, fd_bincode_destroy_ctx_t * ctx ) {
20826 0 : }
20827 :
20828 0 : ulong fd_stake_flags_footprint( void ){ return FD_STAKE_FLAGS_FOOTPRINT; }
20829 0 : ulong fd_stake_flags_align( void ){ return FD_STAKE_FLAGS_ALIGN; }
20830 :
20831 0 : void fd_stake_flags_walk( void * w, fd_stake_flags_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20832 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_flags", level++ );
20833 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
20834 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_flags", level-- );
20835 0 : }
20836 1830 : ulong fd_stake_flags_size( fd_stake_flags_t const * self ) {
20837 1830 : ulong size = 0;
20838 1830 : size += sizeof(char);
20839 1830 : return size;
20840 1830 : }
20841 :
20842 0 : int fd_stake_state_v2_initialized_decode( fd_stake_state_v2_initialized_t * self, fd_bincode_decode_ctx_t * ctx ) {
20843 0 : void const * data = ctx->data;
20844 0 : int err = fd_stake_state_v2_initialized_decode_preflight( ctx );
20845 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20846 0 : ctx->data = data;
20847 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
20848 0 : fd_stake_state_v2_initialized_new( self );
20849 0 : }
20850 0 : fd_stake_state_v2_initialized_decode_unsafe( self, ctx );
20851 0 : return FD_BINCODE_SUCCESS;
20852 0 : }
20853 2784 : int fd_stake_state_v2_initialized_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
20854 2784 : return fd_bincode_bytes_decode_preflight( 120, ctx );
20855 2784 : }
20856 2721 : void fd_stake_state_v2_initialized_decode_unsafe( fd_stake_state_v2_initialized_t * self, fd_bincode_decode_ctx_t * ctx ) {
20857 2721 : fd_stake_meta_decode_unsafe( &self->meta, ctx );
20858 2721 : }
20859 783 : int fd_stake_state_v2_initialized_encode( fd_stake_state_v2_initialized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20860 783 : int err;
20861 783 : err = fd_stake_meta_encode( &self->meta, ctx );
20862 783 : if( FD_UNLIKELY( err ) ) return err;
20863 783 : return FD_BINCODE_SUCCESS;
20864 783 : }
20865 0 : int fd_stake_state_v2_initialized_decode_offsets( fd_stake_state_v2_initialized_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
20866 0 : uchar const * data = ctx->data;
20867 0 : int err;
20868 0 : self->meta_off = (uint)( (ulong)ctx->data - (ulong)data );
20869 0 : err = fd_stake_meta_decode_preflight( ctx );
20870 0 : if( FD_UNLIKELY( err ) ) return err;
20871 0 : return FD_BINCODE_SUCCESS;
20872 0 : }
20873 0 : void fd_stake_state_v2_initialized_new(fd_stake_state_v2_initialized_t * self) {
20874 0 : fd_memset( self, 0, sizeof(fd_stake_state_v2_initialized_t) );
20875 0 : fd_stake_meta_new( &self->meta );
20876 0 : }
20877 0 : void fd_stake_state_v2_initialized_destroy( fd_stake_state_v2_initialized_t * self, fd_bincode_destroy_ctx_t * ctx ) {
20878 0 : fd_stake_meta_destroy( &self->meta, ctx );
20879 0 : }
20880 :
20881 0 : ulong fd_stake_state_v2_initialized_footprint( void ){ return FD_STAKE_STATE_V2_INITIALIZED_FOOTPRINT; }
20882 0 : ulong fd_stake_state_v2_initialized_align( void ){ return FD_STAKE_STATE_V2_INITIALIZED_ALIGN; }
20883 :
20884 0 : void fd_stake_state_v2_initialized_walk( void * w, fd_stake_state_v2_initialized_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20885 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_initialized", level++ );
20886 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level );
20887 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_initialized", level-- );
20888 0 : }
20889 783 : ulong fd_stake_state_v2_initialized_size( fd_stake_state_v2_initialized_t const * self ) {
20890 783 : ulong size = 0;
20891 783 : size += fd_stake_meta_size( &self->meta );
20892 783 : return size;
20893 783 : }
20894 :
20895 0 : int fd_stake_state_v2_stake_decode( fd_stake_state_v2_stake_t * self, fd_bincode_decode_ctx_t * ctx ) {
20896 0 : void const * data = ctx->data;
20897 0 : int err = fd_stake_state_v2_stake_decode_preflight( ctx );
20898 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20899 0 : ctx->data = data;
20900 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
20901 0 : fd_stake_state_v2_stake_new( self );
20902 0 : }
20903 0 : fd_stake_state_v2_stake_decode_unsafe( self, ctx );
20904 0 : return FD_BINCODE_SUCCESS;
20905 0 : }
20906 5196 : int fd_stake_state_v2_stake_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
20907 5196 : return fd_bincode_bytes_decode_preflight( 193, ctx );
20908 5196 : }
20909 4998 : void fd_stake_state_v2_stake_decode_unsafe( fd_stake_state_v2_stake_t * self, fd_bincode_decode_ctx_t * ctx ) {
20910 4998 : fd_stake_meta_decode_unsafe( &self->meta, ctx );
20911 4998 : fd_stake_decode_unsafe( &self->stake, ctx );
20912 4998 : fd_stake_flags_decode_unsafe( &self->stake_flags, ctx );
20913 4998 : }
20914 1842 : int fd_stake_state_v2_stake_encode( fd_stake_state_v2_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20915 1842 : int err;
20916 1842 : err = fd_stake_meta_encode( &self->meta, ctx );
20917 1842 : if( FD_UNLIKELY( err ) ) return err;
20918 1842 : err = fd_stake_encode( &self->stake, ctx );
20919 1842 : if( FD_UNLIKELY( err ) ) return err;
20920 1842 : err = fd_stake_flags_encode( &self->stake_flags, ctx );
20921 1842 : if( FD_UNLIKELY( err ) ) return err;
20922 1842 : return FD_BINCODE_SUCCESS;
20923 1842 : }
20924 0 : int fd_stake_state_v2_stake_decode_offsets( fd_stake_state_v2_stake_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
20925 0 : uchar const * data = ctx->data;
20926 0 : int err;
20927 0 : self->meta_off = (uint)( (ulong)ctx->data - (ulong)data );
20928 0 : err = fd_stake_meta_decode_preflight( ctx );
20929 0 : if( FD_UNLIKELY( err ) ) return err;
20930 0 : self->stake_off = (uint)( (ulong)ctx->data - (ulong)data );
20931 0 : err = fd_stake_decode_preflight( ctx );
20932 0 : if( FD_UNLIKELY( err ) ) return err;
20933 0 : self->stake_flags_off = (uint)( (ulong)ctx->data - (ulong)data );
20934 0 : err = fd_stake_flags_decode_preflight( ctx );
20935 0 : if( FD_UNLIKELY( err ) ) return err;
20936 0 : return FD_BINCODE_SUCCESS;
20937 0 : }
20938 12 : void fd_stake_state_v2_stake_new(fd_stake_state_v2_stake_t * self) {
20939 12 : fd_memset( self, 0, sizeof(fd_stake_state_v2_stake_t) );
20940 12 : fd_stake_meta_new( &self->meta );
20941 12 : fd_stake_new( &self->stake );
20942 12 : fd_stake_flags_new( &self->stake_flags );
20943 12 : }
20944 0 : void fd_stake_state_v2_stake_destroy( fd_stake_state_v2_stake_t * self, fd_bincode_destroy_ctx_t * ctx ) {
20945 0 : fd_stake_meta_destroy( &self->meta, ctx );
20946 0 : fd_stake_destroy( &self->stake, ctx );
20947 0 : fd_stake_flags_destroy( &self->stake_flags, ctx );
20948 0 : }
20949 :
20950 0 : ulong fd_stake_state_v2_stake_footprint( void ){ return FD_STAKE_STATE_V2_STAKE_FOOTPRINT; }
20951 0 : ulong fd_stake_state_v2_stake_align( void ){ return FD_STAKE_STATE_V2_STAKE_ALIGN; }
20952 :
20953 0 : void fd_stake_state_v2_stake_walk( void * w, fd_stake_state_v2_stake_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
20954 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_stake", level++ );
20955 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level );
20956 0 : fd_stake_walk( w, &self->stake, fun, "stake", level );
20957 0 : fd_stake_flags_walk( w, &self->stake_flags, fun, "stake_flags", level );
20958 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_stake", level-- );
20959 0 : }
20960 1830 : ulong fd_stake_state_v2_stake_size( fd_stake_state_v2_stake_t const * self ) {
20961 1830 : ulong size = 0;
20962 1830 : size += fd_stake_meta_size( &self->meta );
20963 1830 : size += fd_stake_size( &self->stake );
20964 1830 : size += fd_stake_flags_size( &self->stake_flags );
20965 1830 : return size;
20966 1830 : }
20967 :
20968 0 : FD_FN_PURE uchar fd_stake_state_v2_is_uninitialized(fd_stake_state_v2_t const * self) {
20969 0 : return self->discriminant == 0;
20970 0 : }
20971 0 : FD_FN_PURE uchar fd_stake_state_v2_is_initialized(fd_stake_state_v2_t const * self) {
20972 0 : return self->discriminant == 1;
20973 0 : }
20974 0 : FD_FN_PURE uchar fd_stake_state_v2_is_stake(fd_stake_state_v2_t const * self) {
20975 0 : return self->discriminant == 2;
20976 0 : }
20977 0 : FD_FN_PURE uchar fd_stake_state_v2_is_rewards_pool(fd_stake_state_v2_t const * self) {
20978 0 : return self->discriminant == 3;
20979 0 : }
20980 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant );
20981 11460 : int fd_stake_state_v2_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20982 11460 : int err;
20983 11460 : switch (discriminant) {
20984 3027 : case 0: {
20985 3027 : return FD_BINCODE_SUCCESS;
20986 0 : }
20987 2784 : case 1: {
20988 2784 : err = fd_stake_state_v2_initialized_decode_preflight( ctx );
20989 2784 : if( FD_UNLIKELY( err ) ) return err;
20990 2721 : return FD_BINCODE_SUCCESS;
20991 2784 : }
20992 5196 : case 2: {
20993 5196 : err = fd_stake_state_v2_stake_decode_preflight( ctx );
20994 5196 : if( FD_UNLIKELY( err ) ) return err;
20995 4998 : return FD_BINCODE_SUCCESS;
20996 5196 : }
20997 102 : case 3: {
20998 102 : return FD_BINCODE_SUCCESS;
20999 5196 : }
21000 351 : default: return FD_BINCODE_ERR_ENCODING;
21001 11460 : }
21002 11460 : }
21003 10848 : void fd_stake_state_v2_inner_decode_unsafe( fd_stake_state_v2_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21004 10848 : switch (discriminant) {
21005 3027 : case 0: {
21006 3027 : break;
21007 0 : }
21008 2721 : case 1: {
21009 2721 : fd_stake_state_v2_initialized_decode_unsafe( &self->initialized, ctx );
21010 2721 : break;
21011 0 : }
21012 4998 : case 2: {
21013 4998 : fd_stake_state_v2_stake_decode_unsafe( &self->stake, ctx );
21014 4998 : break;
21015 0 : }
21016 102 : case 3: {
21017 102 : break;
21018 0 : }
21019 10848 : }
21020 10848 : }
21021 11616 : int fd_stake_state_v2_decode( fd_stake_state_v2_t * self, fd_bincode_decode_ctx_t * ctx ) {
21022 11616 : void const * data = ctx->data;
21023 11616 : int err = fd_stake_state_v2_decode_preflight( ctx );
21024 11616 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21025 10848 : ctx->data = data;
21026 10848 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
21027 10848 : fd_stake_state_v2_new( self );
21028 10848 : }
21029 10848 : fd_stake_state_v2_decode_unsafe( self, ctx );
21030 10848 : return FD_BINCODE_SUCCESS;
21031 11616 : }
21032 11616 : int fd_stake_state_v2_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
21033 11616 : uint discriminant = 0;
21034 11616 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
21035 11616 : if( FD_UNLIKELY( err ) ) return err;
21036 11460 : return fd_stake_state_v2_inner_decode_preflight( discriminant, ctx );
21037 11616 : }
21038 10848 : void fd_stake_state_v2_decode_unsafe( fd_stake_state_v2_t * self, fd_bincode_decode_ctx_t * ctx ) {
21039 10848 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21040 10848 : fd_stake_state_v2_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
21041 10848 : }
21042 10860 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant ) {
21043 10860 : switch( discriminant ) {
21044 0 : case 0: {
21045 0 : break;
21046 0 : }
21047 0 : case 1: {
21048 0 : fd_stake_state_v2_initialized_new( &self->initialized );
21049 0 : break;
21050 0 : }
21051 12 : case 2: {
21052 12 : fd_stake_state_v2_stake_new( &self->stake );
21053 12 : break;
21054 0 : }
21055 0 : case 3: {
21056 0 : break;
21057 0 : }
21058 10848 : default: break; // FD_LOG_ERR(( "unhandled type"));
21059 10860 : }
21060 10860 : }
21061 10860 : void fd_stake_state_v2_new_disc( fd_stake_state_v2_t * self, uint discriminant ) {
21062 10860 : self->discriminant = discriminant;
21063 10860 : fd_stake_state_v2_inner_new( &self->inner, self->discriminant );
21064 10860 : }
21065 10848 : void fd_stake_state_v2_new( fd_stake_state_v2_t * self ) {
21066 10848 : fd_memset( self, 0, sizeof(fd_stake_state_v2_t) );
21067 10848 : fd_stake_state_v2_new_disc( self, UINT_MAX );
21068 10848 : }
21069 0 : void fd_stake_state_v2_inner_destroy( fd_stake_state_v2_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
21070 0 : switch( discriminant ) {
21071 0 : case 1: {
21072 0 : fd_stake_state_v2_initialized_destroy( &self->initialized, ctx );
21073 0 : break;
21074 0 : }
21075 0 : case 2: {
21076 0 : fd_stake_state_v2_stake_destroy( &self->stake, ctx );
21077 0 : break;
21078 0 : }
21079 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
21080 0 : }
21081 0 : }
21082 0 : void fd_stake_state_v2_destroy( fd_stake_state_v2_t * self, fd_bincode_destroy_ctx_t * ctx ) {
21083 0 : fd_stake_state_v2_inner_destroy( &self->inner, self->discriminant, ctx );
21084 0 : }
21085 :
21086 0 : ulong fd_stake_state_v2_footprint( void ){ return FD_STAKE_STATE_V2_FOOTPRINT; }
21087 0 : ulong fd_stake_state_v2_align( void ){ return FD_STAKE_STATE_V2_ALIGN; }
21088 :
21089 0 : void fd_stake_state_v2_walk( void * w, fd_stake_state_v2_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21090 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_state_v2", level++);
21091 0 : switch( self->discriminant ) {
21092 0 : case 0: {
21093 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21094 0 : break;
21095 0 : }
21096 0 : case 1: {
21097 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21098 0 : fd_stake_state_v2_initialized_walk( w, &self->inner.initialized, fun, "initialized", level );
21099 0 : break;
21100 0 : }
21101 0 : case 2: {
21102 0 : fun( w, self, "stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21103 0 : fd_stake_state_v2_stake_walk( w, &self->inner.stake, fun, "stake", level );
21104 0 : break;
21105 0 : }
21106 0 : case 3: {
21107 0 : fun( w, self, "rewards_pool", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21108 0 : break;
21109 0 : }
21110 0 : }
21111 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_state_v2", level-- );
21112 0 : }
21113 3288 : ulong fd_stake_state_v2_size( fd_stake_state_v2_t const * self ) {
21114 3288 : ulong size = 0;
21115 3288 : size += sizeof(uint);
21116 3288 : switch (self->discriminant) {
21117 783 : case 1: {
21118 783 : size += fd_stake_state_v2_initialized_size( &self->inner.initialized );
21119 783 : break;
21120 0 : }
21121 1830 : case 2: {
21122 1830 : size += fd_stake_state_v2_stake_size( &self->inner.stake );
21123 1830 : break;
21124 0 : }
21125 3288 : }
21126 3288 : return size;
21127 3288 : }
21128 :
21129 3300 : int fd_stake_state_v2_inner_encode( fd_stake_state_v2_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
21130 3300 : int err;
21131 3300 : switch (discriminant) {
21132 783 : case 1: {
21133 783 : err = fd_stake_state_v2_initialized_encode( &self->initialized, ctx );
21134 783 : if( FD_UNLIKELY( err ) ) return err;
21135 783 : break;
21136 783 : }
21137 1842 : case 2: {
21138 1842 : err = fd_stake_state_v2_stake_encode( &self->stake, ctx );
21139 1842 : if( FD_UNLIKELY( err ) ) return err;
21140 1842 : break;
21141 1842 : }
21142 3300 : }
21143 3300 : return FD_BINCODE_SUCCESS;
21144 3300 : }
21145 3300 : int fd_stake_state_v2_encode( fd_stake_state_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21146 3300 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21147 3300 : if( FD_UNLIKELY( err ) ) return err;
21148 3300 : return fd_stake_state_v2_inner_encode( &self->inner, self->discriminant, ctx );
21149 3300 : }
21150 :
21151 0 : int fd_nonce_data_decode( fd_nonce_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
21152 0 : void const * data = ctx->data;
21153 0 : int err = fd_nonce_data_decode_preflight( ctx );
21154 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21155 0 : ctx->data = data;
21156 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
21157 0 : fd_nonce_data_new( self );
21158 0 : }
21159 0 : fd_nonce_data_decode_unsafe( self, ctx );
21160 0 : return FD_BINCODE_SUCCESS;
21161 0 : }
21162 4290 : int fd_nonce_data_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
21163 4290 : return fd_bincode_bytes_decode_preflight( 72, ctx );
21164 4290 : }
21165 3771 : void fd_nonce_data_decode_unsafe( fd_nonce_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
21166 3771 : fd_pubkey_decode_unsafe( &self->authority, ctx );
21167 3771 : fd_hash_decode_unsafe( &self->durable_nonce, ctx );
21168 3771 : fd_fee_calculator_decode_unsafe( &self->fee_calculator, ctx );
21169 3771 : }
21170 1854 : int fd_nonce_data_encode( fd_nonce_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21171 1854 : int err;
21172 1854 : err = fd_pubkey_encode( &self->authority, ctx );
21173 1854 : if( FD_UNLIKELY( err ) ) return err;
21174 1854 : err = fd_hash_encode( &self->durable_nonce, ctx );
21175 1854 : if( FD_UNLIKELY( err ) ) return err;
21176 1854 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
21177 1854 : if( FD_UNLIKELY( err ) ) return err;
21178 1854 : return FD_BINCODE_SUCCESS;
21179 1854 : }
21180 0 : int fd_nonce_data_decode_offsets( fd_nonce_data_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
21181 0 : uchar const * data = ctx->data;
21182 0 : int err;
21183 0 : self->authority_off = (uint)( (ulong)ctx->data - (ulong)data );
21184 0 : err = fd_pubkey_decode_preflight( ctx );
21185 0 : if( FD_UNLIKELY( err ) ) return err;
21186 0 : self->durable_nonce_off = (uint)( (ulong)ctx->data - (ulong)data );
21187 0 : err = fd_hash_decode_preflight( ctx );
21188 0 : if( FD_UNLIKELY( err ) ) return err;
21189 0 : self->fee_calculator_off = (uint)( (ulong)ctx->data - (ulong)data );
21190 0 : err = fd_fee_calculator_decode_preflight( ctx );
21191 0 : if( FD_UNLIKELY( err ) ) return err;
21192 0 : return FD_BINCODE_SUCCESS;
21193 0 : }
21194 0 : void fd_nonce_data_new(fd_nonce_data_t * self) {
21195 0 : fd_memset( self, 0, sizeof(fd_nonce_data_t) );
21196 0 : fd_pubkey_new( &self->authority );
21197 0 : fd_hash_new( &self->durable_nonce );
21198 0 : fd_fee_calculator_new( &self->fee_calculator );
21199 0 : }
21200 0 : void fd_nonce_data_destroy( fd_nonce_data_t * self, fd_bincode_destroy_ctx_t * ctx ) {
21201 0 : fd_pubkey_destroy( &self->authority, ctx );
21202 0 : fd_hash_destroy( &self->durable_nonce, ctx );
21203 0 : fd_fee_calculator_destroy( &self->fee_calculator, ctx );
21204 0 : }
21205 :
21206 0 : ulong fd_nonce_data_footprint( void ){ return FD_NONCE_DATA_FOOTPRINT; }
21207 0 : ulong fd_nonce_data_align( void ){ return FD_NONCE_DATA_ALIGN; }
21208 :
21209 0 : void fd_nonce_data_walk( void * w, fd_nonce_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21210 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_nonce_data", level++ );
21211 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level );
21212 0 : fd_hash_walk( w, &self->durable_nonce, fun, "durable_nonce", level );
21213 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level );
21214 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_nonce_data", level-- );
21215 0 : }
21216 1863 : ulong fd_nonce_data_size( fd_nonce_data_t const * self ) {
21217 1863 : ulong size = 0;
21218 1863 : size += fd_pubkey_size( &self->authority );
21219 1863 : size += fd_hash_size( &self->durable_nonce );
21220 1863 : size += fd_fee_calculator_size( &self->fee_calculator );
21221 1863 : return size;
21222 1863 : }
21223 :
21224 1536 : FD_FN_PURE uchar fd_nonce_state_is_uninitialized(fd_nonce_state_t const * self) {
21225 1536 : return self->discriminant == 0;
21226 1536 : }
21227 66 : FD_FN_PURE uchar fd_nonce_state_is_initialized(fd_nonce_state_t const * self) {
21228 66 : return self->discriminant == 1;
21229 66 : }
21230 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant );
21231 4890 : int fd_nonce_state_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21232 4890 : int err;
21233 4890 : switch (discriminant) {
21234 558 : case 0: {
21235 558 : return FD_BINCODE_SUCCESS;
21236 0 : }
21237 4290 : case 1: {
21238 4290 : err = fd_nonce_data_decode_preflight( ctx );
21239 4290 : if( FD_UNLIKELY( err ) ) return err;
21240 3771 : return FD_BINCODE_SUCCESS;
21241 4290 : }
21242 42 : default: return FD_BINCODE_ERR_ENCODING;
21243 4890 : }
21244 4890 : }
21245 4329 : void fd_nonce_state_inner_decode_unsafe( fd_nonce_state_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21246 4329 : switch (discriminant) {
21247 558 : case 0: {
21248 558 : break;
21249 0 : }
21250 3771 : case 1: {
21251 3771 : fd_nonce_data_decode_unsafe( &self->initialized, ctx );
21252 3771 : break;
21253 0 : }
21254 4329 : }
21255 4329 : }
21256 0 : int fd_nonce_state_decode( fd_nonce_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
21257 0 : void const * data = ctx->data;
21258 0 : int err = fd_nonce_state_decode_preflight( ctx );
21259 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21260 0 : ctx->data = data;
21261 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
21262 0 : fd_nonce_state_new( self );
21263 0 : }
21264 0 : fd_nonce_state_decode_unsafe( self, ctx );
21265 0 : return FD_BINCODE_SUCCESS;
21266 0 : }
21267 4926 : int fd_nonce_state_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
21268 4926 : uint discriminant = 0;
21269 4926 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
21270 4926 : if( FD_UNLIKELY( err ) ) return err;
21271 4890 : return fd_nonce_state_inner_decode_preflight( discriminant, ctx );
21272 4926 : }
21273 4329 : void fd_nonce_state_decode_unsafe( fd_nonce_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
21274 4329 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21275 4329 : fd_nonce_state_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
21276 4329 : }
21277 0 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant ) {
21278 0 : switch( discriminant ) {
21279 0 : case 0: {
21280 0 : break;
21281 0 : }
21282 0 : case 1: {
21283 0 : fd_nonce_data_new( &self->initialized );
21284 0 : break;
21285 0 : }
21286 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
21287 0 : }
21288 0 : }
21289 0 : void fd_nonce_state_new_disc( fd_nonce_state_t * self, uint discriminant ) {
21290 0 : self->discriminant = discriminant;
21291 0 : fd_nonce_state_inner_new( &self->inner, self->discriminant );
21292 0 : }
21293 0 : void fd_nonce_state_new( fd_nonce_state_t * self ) {
21294 0 : fd_memset( self, 0, sizeof(fd_nonce_state_t) );
21295 0 : fd_nonce_state_new_disc( self, UINT_MAX );
21296 0 : }
21297 0 : void fd_nonce_state_inner_destroy( fd_nonce_state_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
21298 0 : switch( discriminant ) {
21299 0 : case 1: {
21300 0 : fd_nonce_data_destroy( &self->initialized, ctx );
21301 0 : break;
21302 0 : }
21303 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
21304 0 : }
21305 0 : }
21306 0 : void fd_nonce_state_destroy( fd_nonce_state_t * self, fd_bincode_destroy_ctx_t * ctx ) {
21307 0 : fd_nonce_state_inner_destroy( &self->inner, self->discriminant, ctx );
21308 0 : }
21309 :
21310 0 : ulong fd_nonce_state_footprint( void ){ return FD_NONCE_STATE_FOOTPRINT; }
21311 0 : ulong fd_nonce_state_align( void ){ return FD_NONCE_STATE_ALIGN; }
21312 :
21313 0 : void fd_nonce_state_walk( void * w, fd_nonce_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21314 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state", level++);
21315 0 : switch( self->discriminant ) {
21316 0 : case 0: {
21317 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21318 0 : break;
21319 0 : }
21320 0 : case 1: {
21321 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21322 0 : fd_nonce_data_walk( w, &self->inner.initialized, fun, "initialized", level );
21323 0 : break;
21324 0 : }
21325 0 : }
21326 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state", level-- );
21327 0 : }
21328 1902 : ulong fd_nonce_state_size( fd_nonce_state_t const * self ) {
21329 1902 : ulong size = 0;
21330 1902 : size += sizeof(uint);
21331 1902 : switch (self->discriminant) {
21332 1863 : case 1: {
21333 1863 : size += fd_nonce_data_size( &self->inner.initialized );
21334 1863 : break;
21335 0 : }
21336 1902 : }
21337 1902 : return size;
21338 1902 : }
21339 :
21340 1893 : int fd_nonce_state_inner_encode( fd_nonce_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
21341 1893 : int err;
21342 1893 : switch (discriminant) {
21343 1854 : case 1: {
21344 1854 : err = fd_nonce_data_encode( &self->initialized, ctx );
21345 1854 : if( FD_UNLIKELY( err ) ) return err;
21346 1854 : break;
21347 1854 : }
21348 1893 : }
21349 1893 : return FD_BINCODE_SUCCESS;
21350 1893 : }
21351 1893 : int fd_nonce_state_encode( fd_nonce_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21352 1893 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21353 1893 : if( FD_UNLIKELY( err ) ) return err;
21354 1893 : return fd_nonce_state_inner_encode( &self->inner, self->discriminant, ctx );
21355 1893 : }
21356 :
21357 1539 : FD_FN_PURE uchar fd_nonce_state_versions_is_legacy(fd_nonce_state_versions_t const * self) {
21358 1539 : return self->discriminant == 0;
21359 1539 : }
21360 66 : FD_FN_PURE uchar fd_nonce_state_versions_is_current(fd_nonce_state_versions_t const * self) {
21361 66 : return self->discriminant == 1;
21362 66 : }
21363 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant );
21364 5373 : int fd_nonce_state_versions_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21365 5373 : int err;
21366 5373 : switch (discriminant) {
21367 1134 : case 0: {
21368 1134 : err = fd_nonce_state_decode_preflight( ctx );
21369 1134 : if( FD_UNLIKELY( err ) ) return err;
21370 867 : return FD_BINCODE_SUCCESS;
21371 1134 : }
21372 3792 : case 1: {
21373 3792 : err = fd_nonce_state_decode_preflight( ctx );
21374 3792 : if( FD_UNLIKELY( err ) ) return err;
21375 3462 : return FD_BINCODE_SUCCESS;
21376 3792 : }
21377 447 : default: return FD_BINCODE_ERR_ENCODING;
21378 5373 : }
21379 5373 : }
21380 4329 : void fd_nonce_state_versions_inner_decode_unsafe( fd_nonce_state_versions_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21381 4329 : switch (discriminant) {
21382 867 : case 0: {
21383 867 : fd_nonce_state_decode_unsafe( &self->legacy, ctx );
21384 867 : break;
21385 0 : }
21386 3462 : case 1: {
21387 3462 : fd_nonce_state_decode_unsafe( &self->current, ctx );
21388 3462 : break;
21389 0 : }
21390 4329 : }
21391 4329 : }
21392 5439 : int fd_nonce_state_versions_decode( fd_nonce_state_versions_t * self, fd_bincode_decode_ctx_t * ctx ) {
21393 5439 : void const * data = ctx->data;
21394 5439 : int err = fd_nonce_state_versions_decode_preflight( ctx );
21395 5439 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21396 4329 : ctx->data = data;
21397 4329 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
21398 4329 : fd_nonce_state_versions_new( self );
21399 4329 : }
21400 4329 : fd_nonce_state_versions_decode_unsafe( self, ctx );
21401 4329 : return FD_BINCODE_SUCCESS;
21402 5439 : }
21403 5439 : int fd_nonce_state_versions_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
21404 5439 : uint discriminant = 0;
21405 5439 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
21406 5439 : if( FD_UNLIKELY( err ) ) return err;
21407 5373 : return fd_nonce_state_versions_inner_decode_preflight( discriminant, ctx );
21408 5439 : }
21409 4329 : void fd_nonce_state_versions_decode_unsafe( fd_nonce_state_versions_t * self, fd_bincode_decode_ctx_t * ctx ) {
21410 4329 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21411 4329 : fd_nonce_state_versions_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
21412 4329 : }
21413 4329 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
21414 4329 : switch( discriminant ) {
21415 0 : case 0: {
21416 0 : fd_nonce_state_new( &self->legacy );
21417 0 : break;
21418 0 : }
21419 0 : case 1: {
21420 0 : fd_nonce_state_new( &self->current );
21421 0 : break;
21422 0 : }
21423 4329 : default: break; // FD_LOG_ERR(( "unhandled type"));
21424 4329 : }
21425 4329 : }
21426 4329 : void fd_nonce_state_versions_new_disc( fd_nonce_state_versions_t * self, uint discriminant ) {
21427 4329 : self->discriminant = discriminant;
21428 4329 : fd_nonce_state_versions_inner_new( &self->inner, self->discriminant );
21429 4329 : }
21430 4329 : void fd_nonce_state_versions_new( fd_nonce_state_versions_t * self ) {
21431 4329 : fd_memset( self, 0, sizeof(fd_nonce_state_versions_t) );
21432 4329 : fd_nonce_state_versions_new_disc( self, UINT_MAX );
21433 4329 : }
21434 0 : void fd_nonce_state_versions_inner_destroy( fd_nonce_state_versions_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
21435 0 : switch( discriminant ) {
21436 0 : case 0: {
21437 0 : fd_nonce_state_destroy( &self->legacy, ctx );
21438 0 : break;
21439 0 : }
21440 0 : case 1: {
21441 0 : fd_nonce_state_destroy( &self->current, ctx );
21442 0 : break;
21443 0 : }
21444 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
21445 0 : }
21446 0 : }
21447 0 : void fd_nonce_state_versions_destroy( fd_nonce_state_versions_t * self, fd_bincode_destroy_ctx_t * ctx ) {
21448 0 : fd_nonce_state_versions_inner_destroy( &self->inner, self->discriminant, ctx );
21449 0 : }
21450 :
21451 0 : ulong fd_nonce_state_versions_footprint( void ){ return FD_NONCE_STATE_VERSIONS_FOOTPRINT; }
21452 0 : ulong fd_nonce_state_versions_align( void ){ return FD_NONCE_STATE_VERSIONS_ALIGN; }
21453 :
21454 0 : void fd_nonce_state_versions_walk( void * w, fd_nonce_state_versions_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21455 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state_versions", level++);
21456 0 : switch( self->discriminant ) {
21457 0 : case 0: {
21458 0 : fun( w, self, "legacy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21459 0 : fd_nonce_state_walk( w, &self->inner.legacy, fun, "legacy", level );
21460 0 : break;
21461 0 : }
21462 0 : case 1: {
21463 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21464 0 : fd_nonce_state_walk( w, &self->inner.current, fun, "current", level );
21465 0 : break;
21466 0 : }
21467 0 : }
21468 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state_versions", level-- );
21469 0 : }
21470 1902 : ulong fd_nonce_state_versions_size( fd_nonce_state_versions_t const * self ) {
21471 1902 : ulong size = 0;
21472 1902 : size += sizeof(uint);
21473 1902 : switch (self->discriminant) {
21474 99 : case 0: {
21475 99 : size += fd_nonce_state_size( &self->inner.legacy );
21476 99 : break;
21477 0 : }
21478 1803 : case 1: {
21479 1803 : size += fd_nonce_state_size( &self->inner.current );
21480 1803 : break;
21481 0 : }
21482 1902 : }
21483 1902 : return size;
21484 1902 : }
21485 :
21486 1893 : int fd_nonce_state_versions_inner_encode( fd_nonce_state_versions_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
21487 1893 : int err;
21488 1893 : switch (discriminant) {
21489 99 : case 0: {
21490 99 : err = fd_nonce_state_encode( &self->legacy, ctx );
21491 99 : if( FD_UNLIKELY( err ) ) return err;
21492 99 : break;
21493 99 : }
21494 1794 : case 1: {
21495 1794 : err = fd_nonce_state_encode( &self->current, ctx );
21496 1794 : if( FD_UNLIKELY( err ) ) return err;
21497 1794 : break;
21498 1794 : }
21499 1893 : }
21500 1893 : return FD_BINCODE_SUCCESS;
21501 1893 : }
21502 1893 : int fd_nonce_state_versions_encode( fd_nonce_state_versions_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21503 1893 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21504 1893 : if( FD_UNLIKELY( err ) ) return err;
21505 1893 : return fd_nonce_state_versions_inner_encode( &self->inner, self->discriminant, ctx );
21506 1893 : }
21507 :
21508 0 : int fd_compute_budget_program_instruction_request_units_deprecated_decode( fd_compute_budget_program_instruction_request_units_deprecated_t * self, fd_bincode_decode_ctx_t * ctx ) {
21509 0 : void const * data = ctx->data;
21510 0 : int err = fd_compute_budget_program_instruction_request_units_deprecated_decode_preflight( ctx );
21511 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21512 0 : ctx->data = data;
21513 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
21514 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( self );
21515 0 : }
21516 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_unsafe( self, ctx );
21517 0 : return FD_BINCODE_SUCCESS;
21518 0 : }
21519 12 : int fd_compute_budget_program_instruction_request_units_deprecated_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
21520 12 : return fd_bincode_bytes_decode_preflight( 8, ctx );
21521 12 : }
21522 6 : void fd_compute_budget_program_instruction_request_units_deprecated_decode_unsafe( fd_compute_budget_program_instruction_request_units_deprecated_t * self, fd_bincode_decode_ctx_t * ctx ) {
21523 6 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
21524 6 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
21525 6 : }
21526 0 : int fd_compute_budget_program_instruction_request_units_deprecated_encode( fd_compute_budget_program_instruction_request_units_deprecated_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21527 0 : int err;
21528 0 : err = fd_bincode_uint32_encode( self->units, ctx );
21529 0 : if( FD_UNLIKELY( err ) ) return err;
21530 0 : err = fd_bincode_uint32_encode( self->additional_fee, ctx );
21531 0 : if( FD_UNLIKELY( err ) ) return err;
21532 0 : return FD_BINCODE_SUCCESS;
21533 0 : }
21534 0 : int fd_compute_budget_program_instruction_request_units_deprecated_decode_offsets( fd_compute_budget_program_instruction_request_units_deprecated_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
21535 0 : uchar const * data = ctx->data;
21536 0 : int err;
21537 0 : self->units_off = (uint)( (ulong)ctx->data - (ulong)data );
21538 0 : err = fd_bincode_uint32_decode_preflight( ctx );
21539 0 : if( FD_UNLIKELY( err ) ) return err;
21540 0 : self->additional_fee_off = (uint)( (ulong)ctx->data - (ulong)data );
21541 0 : err = fd_bincode_uint32_decode_preflight( ctx );
21542 0 : if( FD_UNLIKELY( err ) ) return err;
21543 0 : return FD_BINCODE_SUCCESS;
21544 0 : }
21545 0 : void fd_compute_budget_program_instruction_request_units_deprecated_new(fd_compute_budget_program_instruction_request_units_deprecated_t * self) {
21546 0 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t) );
21547 0 : }
21548 0 : void fd_compute_budget_program_instruction_request_units_deprecated_destroy( fd_compute_budget_program_instruction_request_units_deprecated_t * self, fd_bincode_destroy_ctx_t * ctx ) {
21549 0 : }
21550 :
21551 0 : ulong fd_compute_budget_program_instruction_request_units_deprecated_footprint( void ){ return FD_COMPUTE_BUDGET_PROGRAM_INSTRUCTION_REQUEST_UNITS_DEPRECATED_FOOTPRINT; }
21552 0 : ulong fd_compute_budget_program_instruction_request_units_deprecated_align( void ){ return FD_COMPUTE_BUDGET_PROGRAM_INSTRUCTION_REQUEST_UNITS_DEPRECATED_ALIGN; }
21553 :
21554 0 : void fd_compute_budget_program_instruction_request_units_deprecated_walk( void * w, fd_compute_budget_program_instruction_request_units_deprecated_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21555 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compute_budget_program_instruction_request_units_deprecated", level++ );
21556 0 : fun( w, &self->units, "units", FD_FLAMENCO_TYPE_UINT, "uint", level );
21557 0 : fun( w, &self->additional_fee, "additional_fee", FD_FLAMENCO_TYPE_UINT, "uint", level );
21558 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compute_budget_program_instruction_request_units_deprecated", level-- );
21559 0 : }
21560 0 : ulong fd_compute_budget_program_instruction_request_units_deprecated_size( fd_compute_budget_program_instruction_request_units_deprecated_t const * self ) {
21561 0 : ulong size = 0;
21562 0 : size += sizeof(uint);
21563 0 : size += sizeof(uint);
21564 0 : return size;
21565 0 : }
21566 :
21567 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_units_deprecated(fd_compute_budget_program_instruction_t const * self) {
21568 0 : return self->discriminant == 0;
21569 0 : }
21570 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_heap_frame(fd_compute_budget_program_instruction_t const * self) {
21571 0 : return self->discriminant == 1;
21572 0 : }
21573 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_limit(fd_compute_budget_program_instruction_t const * self) {
21574 0 : return self->discriminant == 2;
21575 0 : }
21576 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_price(fd_compute_budget_program_instruction_t const * self) {
21577 0 : return self->discriminant == 3;
21578 0 : }
21579 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_loaded_accounts_data_size_limit(fd_compute_budget_program_instruction_t const * self) {
21580 0 : return self->discriminant == 4;
21581 0 : }
21582 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant );
21583 321 : int fd_compute_budget_program_instruction_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21584 321 : int err;
21585 321 : switch (discriminant) {
21586 12 : case 0: {
21587 12 : err = fd_compute_budget_program_instruction_request_units_deprecated_decode_preflight( ctx );
21588 12 : if( FD_UNLIKELY( err ) ) return err;
21589 6 : return FD_BINCODE_SUCCESS;
21590 12 : }
21591 69 : case 1: {
21592 69 : err = fd_bincode_uint32_decode_preflight( ctx );
21593 69 : if( FD_UNLIKELY( err ) ) return err;
21594 69 : return FD_BINCODE_SUCCESS;
21595 69 : }
21596 81 : case 2: {
21597 81 : err = fd_bincode_uint32_decode_preflight( ctx );
21598 81 : if( FD_UNLIKELY( err ) ) return err;
21599 81 : return FD_BINCODE_SUCCESS;
21600 81 : }
21601 66 : case 3: {
21602 66 : err = fd_bincode_uint64_decode_preflight( ctx );
21603 66 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21604 66 : return FD_BINCODE_SUCCESS;
21605 66 : }
21606 51 : case 4: {
21607 51 : err = fd_bincode_uint32_decode_preflight( ctx );
21608 51 : if( FD_UNLIKELY( err ) ) return err;
21609 48 : return FD_BINCODE_SUCCESS;
21610 51 : }
21611 42 : default: return FD_BINCODE_ERR_ENCODING;
21612 321 : }
21613 321 : }
21614 270 : void fd_compute_budget_program_instruction_inner_decode_unsafe( fd_compute_budget_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21615 270 : switch (discriminant) {
21616 6 : case 0: {
21617 6 : fd_compute_budget_program_instruction_request_units_deprecated_decode_unsafe( &self->request_units_deprecated, ctx );
21618 6 : break;
21619 0 : }
21620 69 : case 1: {
21621 69 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
21622 69 : break;
21623 0 : }
21624 81 : case 2: {
21625 81 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
21626 81 : break;
21627 0 : }
21628 66 : case 3: {
21629 66 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
21630 66 : break;
21631 0 : }
21632 48 : case 4: {
21633 48 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
21634 48 : break;
21635 0 : }
21636 270 : }
21637 270 : }
21638 336 : int fd_compute_budget_program_instruction_decode( fd_compute_budget_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
21639 336 : void const * data = ctx->data;
21640 336 : int err = fd_compute_budget_program_instruction_decode_preflight( ctx );
21641 336 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21642 270 : ctx->data = data;
21643 270 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
21644 270 : fd_compute_budget_program_instruction_new( self );
21645 270 : }
21646 270 : fd_compute_budget_program_instruction_decode_unsafe( self, ctx );
21647 270 : return FD_BINCODE_SUCCESS;
21648 336 : }
21649 336 : int fd_compute_budget_program_instruction_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
21650 336 : ushort discriminant = 0;
21651 336 : int err = fd_bincode_compact_u16_decode( &discriminant, ctx );
21652 336 : if( FD_UNLIKELY( err ) ) return err;
21653 321 : return fd_compute_budget_program_instruction_inner_decode_preflight( discriminant, ctx );
21654 336 : }
21655 270 : void fd_compute_budget_program_instruction_decode_unsafe( fd_compute_budget_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
21656 270 : ushort tmp = 0;
21657 270 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
21658 270 : self->discriminant = tmp;
21659 270 : fd_compute_budget_program_instruction_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
21660 270 : }
21661 270 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
21662 270 : switch( discriminant ) {
21663 0 : case 0: {
21664 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( &self->request_units_deprecated );
21665 0 : break;
21666 0 : }
21667 0 : case 1: {
21668 0 : break;
21669 0 : }
21670 0 : case 2: {
21671 0 : break;
21672 0 : }
21673 0 : case 3: {
21674 0 : break;
21675 0 : }
21676 0 : case 4: {
21677 0 : break;
21678 0 : }
21679 270 : default: break; // FD_LOG_ERR(( "unhandled type"));
21680 270 : }
21681 270 : }
21682 270 : void fd_compute_budget_program_instruction_new_disc( fd_compute_budget_program_instruction_t * self, uint discriminant ) {
21683 270 : self->discriminant = discriminant;
21684 270 : fd_compute_budget_program_instruction_inner_new( &self->inner, self->discriminant );
21685 270 : }
21686 270 : void fd_compute_budget_program_instruction_new( fd_compute_budget_program_instruction_t * self ) {
21687 270 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_t) );
21688 270 : fd_compute_budget_program_instruction_new_disc( self, UINT_MAX );
21689 270 : }
21690 0 : void fd_compute_budget_program_instruction_inner_destroy( fd_compute_budget_program_instruction_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
21691 0 : switch( discriminant ) {
21692 0 : case 0: {
21693 0 : fd_compute_budget_program_instruction_request_units_deprecated_destroy( &self->request_units_deprecated, ctx );
21694 0 : break;
21695 0 : }
21696 0 : case 1: {
21697 0 : break;
21698 0 : }
21699 0 : case 2: {
21700 0 : break;
21701 0 : }
21702 0 : case 3: {
21703 0 : break;
21704 0 : }
21705 0 : case 4: {
21706 0 : break;
21707 0 : }
21708 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
21709 0 : }
21710 0 : }
21711 0 : void fd_compute_budget_program_instruction_destroy( fd_compute_budget_program_instruction_t * self, fd_bincode_destroy_ctx_t * ctx ) {
21712 0 : fd_compute_budget_program_instruction_inner_destroy( &self->inner, self->discriminant, ctx );
21713 0 : }
21714 :
21715 0 : ulong fd_compute_budget_program_instruction_footprint( void ){ return FD_COMPUTE_BUDGET_PROGRAM_INSTRUCTION_FOOTPRINT; }
21716 0 : ulong fd_compute_budget_program_instruction_align( void ){ return FD_COMPUTE_BUDGET_PROGRAM_INSTRUCTION_ALIGN; }
21717 :
21718 0 : void fd_compute_budget_program_instruction_walk( void * w, fd_compute_budget_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21719 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_compute_budget_program_instruction", level++);
21720 0 : switch( self->discriminant ) {
21721 0 : case 0: {
21722 0 : fun( w, self, "request_units_deprecated", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21723 0 : fd_compute_budget_program_instruction_request_units_deprecated_walk( w, &self->inner.request_units_deprecated, fun, "request_units_deprecated", level );
21724 0 : break;
21725 0 : }
21726 0 : case 1: {
21727 0 : fun( w, self, "request_heap_frame", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21728 0 : fun( w, &self->inner.request_heap_frame, "request_heap_frame", FD_FLAMENCO_TYPE_UINT, "uint", level );
21729 0 : break;
21730 0 : }
21731 0 : case 2: {
21732 0 : fun( w, self, "set_compute_unit_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21733 0 : fun( w, &self->inner.set_compute_unit_limit, "set_compute_unit_limit", FD_FLAMENCO_TYPE_UINT, "uint", level );
21734 0 : break;
21735 0 : }
21736 0 : case 3: {
21737 0 : fun( w, self, "set_compute_unit_price", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21738 0 : fun( w, &self->inner.set_compute_unit_price, "set_compute_unit_price", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
21739 0 : break;
21740 0 : }
21741 0 : case 4: {
21742 0 : fun( w, self, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
21743 0 : fun( w, &self->inner.set_loaded_accounts_data_size_limit, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_UINT, "uint", level );
21744 0 : break;
21745 0 : }
21746 0 : }
21747 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_compute_budget_program_instruction", level-- );
21748 0 : }
21749 0 : ulong fd_compute_budget_program_instruction_size( fd_compute_budget_program_instruction_t const * self ) {
21750 0 : ulong size = 0;
21751 0 : size += sizeof(uint);
21752 0 : switch (self->discriminant) {
21753 0 : case 0: {
21754 0 : size += fd_compute_budget_program_instruction_request_units_deprecated_size( &self->inner.request_units_deprecated );
21755 0 : break;
21756 0 : }
21757 0 : case 1: {
21758 0 : size += sizeof(uint);
21759 0 : break;
21760 0 : }
21761 0 : case 2: {
21762 0 : size += sizeof(uint);
21763 0 : break;
21764 0 : }
21765 0 : case 3: {
21766 0 : size += sizeof(ulong);
21767 0 : break;
21768 0 : }
21769 0 : case 4: {
21770 0 : size += sizeof(uint);
21771 0 : break;
21772 0 : }
21773 0 : }
21774 0 : return size;
21775 0 : }
21776 :
21777 0 : int fd_compute_budget_program_instruction_inner_encode( fd_compute_budget_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
21778 0 : int err;
21779 0 : switch (discriminant) {
21780 0 : case 0: {
21781 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_encode( &self->request_units_deprecated, ctx );
21782 0 : if( FD_UNLIKELY( err ) ) return err;
21783 0 : break;
21784 0 : }
21785 0 : case 1: {
21786 0 : err = fd_bincode_uint32_encode( self->request_heap_frame, ctx );
21787 0 : if( FD_UNLIKELY( err ) ) return err;
21788 0 : break;
21789 0 : }
21790 0 : case 2: {
21791 0 : err = fd_bincode_uint32_encode( self->set_compute_unit_limit, ctx );
21792 0 : if( FD_UNLIKELY( err ) ) return err;
21793 0 : break;
21794 0 : }
21795 0 : case 3: {
21796 0 : err = fd_bincode_uint64_encode( self->set_compute_unit_price, ctx );
21797 0 : if( FD_UNLIKELY( err ) ) return err;
21798 0 : break;
21799 0 : }
21800 0 : case 4: {
21801 0 : err = fd_bincode_uint32_encode( self->set_loaded_accounts_data_size_limit, ctx );
21802 0 : if( FD_UNLIKELY( err ) ) return err;
21803 0 : break;
21804 0 : }
21805 0 : }
21806 0 : return FD_BINCODE_SUCCESS;
21807 0 : }
21808 0 : int fd_compute_budget_program_instruction_encode( fd_compute_budget_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21809 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21810 0 : if( FD_UNLIKELY( err ) ) return err;
21811 0 : return fd_compute_budget_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
21812 0 : }
21813 :
21814 0 : int fd_config_keys_decode( fd_config_keys_t * self, fd_bincode_decode_ctx_t * ctx ) {
21815 0 : void const * data = ctx->data;
21816 0 : int err = fd_config_keys_decode_preflight( ctx );
21817 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21818 0 : ctx->data = data;
21819 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
21820 0 : fd_config_keys_new( self );
21821 0 : }
21822 0 : fd_config_keys_decode_unsafe( self, ctx );
21823 0 : return FD_BINCODE_SUCCESS;
21824 0 : }
21825 0 : int fd_config_keys_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
21826 0 : int err;
21827 0 : ushort keys_len;
21828 0 : err = fd_bincode_compact_u16_decode( &keys_len, ctx );
21829 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21830 0 : if( keys_len ) {
21831 0 : for( ulong i=0; i < keys_len; i++ ) {
21832 0 : err = fd_config_keys_pair_decode_preflight( ctx );
21833 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21834 0 : }
21835 0 : }
21836 0 : return FD_BINCODE_SUCCESS;
21837 0 : }
21838 0 : void fd_config_keys_decode_unsafe( fd_config_keys_t * self, fd_bincode_decode_ctx_t * ctx ) {
21839 0 : fd_bincode_compact_u16_decode_unsafe( &self->keys_len, ctx );
21840 0 : if( self->keys_len ) {
21841 0 : self->keys = (fd_config_keys_pair_t *)fd_valloc_malloc( ctx->valloc, FD_CONFIG_KEYS_PAIR_ALIGN, FD_CONFIG_KEYS_PAIR_FOOTPRINT*self->keys_len );
21842 0 : for( ulong i=0; i < self->keys_len; i++ ) {
21843 0 : fd_config_keys_pair_new( self->keys + i );
21844 0 : fd_config_keys_pair_decode_unsafe( self->keys + i, ctx );
21845 0 : }
21846 0 : } else
21847 0 : self->keys = NULL;
21848 0 : }
21849 0 : int fd_config_keys_encode( fd_config_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21850 0 : int err;
21851 0 : err = fd_bincode_compact_u16_encode( &self->keys_len, ctx );
21852 0 : if( FD_UNLIKELY(err) ) return err;
21853 0 : if( self->keys_len ) {
21854 0 : for( ulong i=0; i < self->keys_len; i++ ) {
21855 0 : err = fd_config_keys_pair_encode( self->keys + i, ctx );
21856 0 : if( FD_UNLIKELY( err ) ) return err;
21857 0 : }
21858 0 : }
21859 0 : return FD_BINCODE_SUCCESS;
21860 0 : }
21861 0 : int fd_config_keys_decode_offsets( fd_config_keys_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
21862 0 : uchar const * data = ctx->data;
21863 0 : int err;
21864 0 : self->keys_off = (uint)( (ulong)ctx->data - (ulong)data );
21865 0 : ushort keys_len;
21866 0 : err = fd_bincode_compact_u16_decode( &keys_len, ctx );
21867 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21868 0 : if( keys_len ) {
21869 0 : for( ulong i=0; i < keys_len; i++ ) {
21870 0 : err = fd_config_keys_pair_decode_preflight( ctx );
21871 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21872 0 : }
21873 0 : }
21874 0 : return FD_BINCODE_SUCCESS;
21875 0 : }
21876 0 : void fd_config_keys_new(fd_config_keys_t * self) {
21877 0 : fd_memset( self, 0, sizeof(fd_config_keys_t) );
21878 0 : }
21879 0 : void fd_config_keys_destroy( fd_config_keys_t * self, fd_bincode_destroy_ctx_t * ctx ) {
21880 0 : if( self->keys ) {
21881 0 : for( ulong i=0; i < self->keys_len; i++ )
21882 0 : fd_config_keys_pair_destroy( self->keys + i, ctx );
21883 0 : fd_valloc_free( ctx->valloc, self->keys );
21884 0 : self->keys = NULL;
21885 0 : }
21886 0 : }
21887 :
21888 0 : ulong fd_config_keys_footprint( void ){ return FD_CONFIG_KEYS_FOOTPRINT; }
21889 0 : ulong fd_config_keys_align( void ){ return FD_CONFIG_KEYS_ALIGN; }
21890 :
21891 0 : void fd_config_keys_walk( void * w, fd_config_keys_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21892 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys", level++ );
21893 0 : if( self->keys_len ) {
21894 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++ );
21895 0 : for( ulong i=0; i < self->keys_len; i++ )
21896 0 : fd_config_keys_pair_walk(w, self->keys + i, fun, "config_keys_pair", level );
21897 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
21898 0 : }
21899 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys", level-- );
21900 0 : }
21901 0 : ulong fd_config_keys_size( fd_config_keys_t const * self ) {
21902 0 : ulong size = 0;
21903 0 : do {
21904 0 : ushort tmp = (ushort)self->keys_len;
21905 0 : size += fd_bincode_compact_u16_size( &tmp );
21906 0 : for( ulong i=0; i < self->keys_len; i++ )
21907 0 : size += fd_config_keys_pair_size( self->keys + i );
21908 0 : } while(0);
21909 0 : return size;
21910 0 : }
21911 :
21912 0 : int fd_bpf_loader_program_instruction_write_decode( fd_bpf_loader_program_instruction_write_t * self, fd_bincode_decode_ctx_t * ctx ) {
21913 0 : void const * data = ctx->data;
21914 0 : int err = fd_bpf_loader_program_instruction_write_decode_preflight( ctx );
21915 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21916 0 : ctx->data = data;
21917 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
21918 0 : fd_bpf_loader_program_instruction_write_new( self );
21919 0 : }
21920 0 : fd_bpf_loader_program_instruction_write_decode_unsafe( self, ctx );
21921 0 : return FD_BINCODE_SUCCESS;
21922 0 : }
21923 0 : int fd_bpf_loader_program_instruction_write_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
21924 0 : int err;
21925 0 : err = fd_bincode_uint32_decode_preflight( ctx );
21926 0 : if( FD_UNLIKELY( err ) ) return err;
21927 0 : ulong bytes_len;
21928 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
21929 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21930 0 : if( bytes_len ) {
21931 0 : err = fd_bincode_bytes_decode_preflight( bytes_len, ctx );
21932 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21933 0 : }
21934 0 : return FD_BINCODE_SUCCESS;
21935 0 : }
21936 0 : void fd_bpf_loader_program_instruction_write_decode_unsafe( fd_bpf_loader_program_instruction_write_t * self, fd_bincode_decode_ctx_t * ctx ) {
21937 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
21938 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
21939 0 : if( self->bytes_len ) {
21940 0 : self->bytes = fd_valloc_malloc( ctx->valloc, 8UL, self->bytes_len );
21941 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
21942 0 : } else
21943 0 : self->bytes = NULL;
21944 0 : }
21945 0 : int fd_bpf_loader_program_instruction_write_encode( fd_bpf_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21946 0 : int err;
21947 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
21948 0 : if( FD_UNLIKELY( err ) ) return err;
21949 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
21950 0 : if( FD_UNLIKELY(err) ) return err;
21951 0 : if( self->bytes_len ) {
21952 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
21953 0 : if( FD_UNLIKELY( err ) ) return err;
21954 0 : }
21955 0 : return FD_BINCODE_SUCCESS;
21956 0 : }
21957 0 : int fd_bpf_loader_program_instruction_write_decode_offsets( fd_bpf_loader_program_instruction_write_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
21958 0 : uchar const * data = ctx->data;
21959 0 : int err;
21960 0 : self->offset_off = (uint)( (ulong)ctx->data - (ulong)data );
21961 0 : err = fd_bincode_uint32_decode_preflight( ctx );
21962 0 : if( FD_UNLIKELY( err ) ) return err;
21963 0 : self->bytes_off = (uint)( (ulong)ctx->data - (ulong)data );
21964 0 : ulong bytes_len;
21965 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
21966 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21967 0 : if( bytes_len ) {
21968 0 : err = fd_bincode_bytes_decode_preflight( bytes_len, ctx );
21969 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21970 0 : }
21971 0 : return FD_BINCODE_SUCCESS;
21972 0 : }
21973 0 : void fd_bpf_loader_program_instruction_write_new(fd_bpf_loader_program_instruction_write_t * self) {
21974 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_write_t) );
21975 0 : }
21976 0 : void fd_bpf_loader_program_instruction_write_destroy( fd_bpf_loader_program_instruction_write_t * self, fd_bincode_destroy_ctx_t * ctx ) {
21977 0 : if( self->bytes ) {
21978 0 : fd_valloc_free( ctx->valloc, self->bytes );
21979 0 : self->bytes = NULL;
21980 0 : }
21981 0 : }
21982 :
21983 0 : ulong fd_bpf_loader_program_instruction_write_footprint( void ){ return FD_BPF_LOADER_PROGRAM_INSTRUCTION_WRITE_FOOTPRINT; }
21984 0 : ulong fd_bpf_loader_program_instruction_write_align( void ){ return FD_BPF_LOADER_PROGRAM_INSTRUCTION_WRITE_ALIGN; }
21985 :
21986 0 : void fd_bpf_loader_program_instruction_write_walk( void * w, fd_bpf_loader_program_instruction_write_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
21987 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_loader_program_instruction_write", level++ );
21988 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level );
21989 0 : fun(w, self->bytes, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
21990 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_loader_program_instruction_write", level-- );
21991 0 : }
21992 0 : ulong fd_bpf_loader_program_instruction_write_size( fd_bpf_loader_program_instruction_write_t const * self ) {
21993 0 : ulong size = 0;
21994 0 : size += sizeof(uint);
21995 0 : do {
21996 0 : size += sizeof(ulong);
21997 0 : size += self->bytes_len;
21998 0 : } while(0);
21999 0 : return size;
22000 0 : }
22001 :
22002 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_write(fd_bpf_loader_program_instruction_t const * self) {
22003 0 : return self->discriminant == 0;
22004 0 : }
22005 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_finalize(fd_bpf_loader_program_instruction_t const * self) {
22006 0 : return self->discriminant == 1;
22007 0 : }
22008 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant );
22009 0 : int fd_bpf_loader_program_instruction_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22010 0 : int err;
22011 0 : switch (discriminant) {
22012 0 : case 0: {
22013 0 : err = fd_bpf_loader_program_instruction_write_decode_preflight( ctx );
22014 0 : if( FD_UNLIKELY( err ) ) return err;
22015 0 : return FD_BINCODE_SUCCESS;
22016 0 : }
22017 0 : case 1: {
22018 0 : return FD_BINCODE_SUCCESS;
22019 0 : }
22020 0 : default: return FD_BINCODE_ERR_ENCODING;
22021 0 : }
22022 0 : }
22023 0 : void fd_bpf_loader_program_instruction_inner_decode_unsafe( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22024 0 : switch (discriminant) {
22025 0 : case 0: {
22026 0 : fd_bpf_loader_program_instruction_write_decode_unsafe( &self->write, ctx );
22027 0 : break;
22028 0 : }
22029 0 : case 1: {
22030 0 : break;
22031 0 : }
22032 0 : }
22033 0 : }
22034 0 : int fd_bpf_loader_program_instruction_decode( fd_bpf_loader_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
22035 0 : void const * data = ctx->data;
22036 0 : int err = fd_bpf_loader_program_instruction_decode_preflight( ctx );
22037 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22038 0 : ctx->data = data;
22039 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
22040 0 : fd_bpf_loader_program_instruction_new( self );
22041 0 : }
22042 0 : fd_bpf_loader_program_instruction_decode_unsafe( self, ctx );
22043 0 : return FD_BINCODE_SUCCESS;
22044 0 : }
22045 0 : int fd_bpf_loader_program_instruction_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
22046 0 : uint discriminant = 0;
22047 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
22048 0 : if( FD_UNLIKELY( err ) ) return err;
22049 0 : return fd_bpf_loader_program_instruction_inner_decode_preflight( discriminant, ctx );
22050 0 : }
22051 0 : void fd_bpf_loader_program_instruction_decode_unsafe( fd_bpf_loader_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
22052 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
22053 0 : fd_bpf_loader_program_instruction_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
22054 0 : }
22055 0 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
22056 0 : switch( discriminant ) {
22057 0 : case 0: {
22058 0 : fd_bpf_loader_program_instruction_write_new( &self->write );
22059 0 : break;
22060 0 : }
22061 0 : case 1: {
22062 0 : break;
22063 0 : }
22064 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
22065 0 : }
22066 0 : }
22067 0 : void fd_bpf_loader_program_instruction_new_disc( fd_bpf_loader_program_instruction_t * self, uint discriminant ) {
22068 0 : self->discriminant = discriminant;
22069 0 : fd_bpf_loader_program_instruction_inner_new( &self->inner, self->discriminant );
22070 0 : }
22071 0 : void fd_bpf_loader_program_instruction_new( fd_bpf_loader_program_instruction_t * self ) {
22072 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_t) );
22073 0 : fd_bpf_loader_program_instruction_new_disc( self, UINT_MAX );
22074 0 : }
22075 0 : void fd_bpf_loader_program_instruction_inner_destroy( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
22076 0 : switch( discriminant ) {
22077 0 : case 0: {
22078 0 : fd_bpf_loader_program_instruction_write_destroy( &self->write, ctx );
22079 0 : break;
22080 0 : }
22081 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
22082 0 : }
22083 0 : }
22084 0 : void fd_bpf_loader_program_instruction_destroy( fd_bpf_loader_program_instruction_t * self, fd_bincode_destroy_ctx_t * ctx ) {
22085 0 : fd_bpf_loader_program_instruction_inner_destroy( &self->inner, self->discriminant, ctx );
22086 0 : }
22087 :
22088 0 : ulong fd_bpf_loader_program_instruction_footprint( void ){ return FD_BPF_LOADER_PROGRAM_INSTRUCTION_FOOTPRINT; }
22089 0 : ulong fd_bpf_loader_program_instruction_align( void ){ return FD_BPF_LOADER_PROGRAM_INSTRUCTION_ALIGN; }
22090 :
22091 0 : void fd_bpf_loader_program_instruction_walk( void * w, fd_bpf_loader_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22092 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_loader_program_instruction", level++);
22093 0 : switch( self->discriminant ) {
22094 0 : case 0: {
22095 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22096 0 : fd_bpf_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level );
22097 0 : break;
22098 0 : }
22099 0 : case 1: {
22100 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22101 0 : break;
22102 0 : }
22103 0 : }
22104 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_loader_program_instruction", level-- );
22105 0 : }
22106 0 : ulong fd_bpf_loader_program_instruction_size( fd_bpf_loader_program_instruction_t const * self ) {
22107 0 : ulong size = 0;
22108 0 : size += sizeof(uint);
22109 0 : switch (self->discriminant) {
22110 0 : case 0: {
22111 0 : size += fd_bpf_loader_program_instruction_write_size( &self->inner.write );
22112 0 : break;
22113 0 : }
22114 0 : }
22115 0 : return size;
22116 0 : }
22117 :
22118 0 : int fd_bpf_loader_program_instruction_inner_encode( fd_bpf_loader_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
22119 0 : int err;
22120 0 : switch (discriminant) {
22121 0 : case 0: {
22122 0 : err = fd_bpf_loader_program_instruction_write_encode( &self->write, ctx );
22123 0 : if( FD_UNLIKELY( err ) ) return err;
22124 0 : break;
22125 0 : }
22126 0 : }
22127 0 : return FD_BINCODE_SUCCESS;
22128 0 : }
22129 0 : int fd_bpf_loader_program_instruction_encode( fd_bpf_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22130 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
22131 0 : if( FD_UNLIKELY( err ) ) return err;
22132 0 : return fd_bpf_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
22133 0 : }
22134 :
22135 0 : int fd_loader_v4_program_instruction_write_decode( fd_loader_v4_program_instruction_write_t * self, fd_bincode_decode_ctx_t * ctx ) {
22136 0 : void const * data = ctx->data;
22137 0 : int err = fd_loader_v4_program_instruction_write_decode_preflight( ctx );
22138 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22139 0 : ctx->data = data;
22140 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
22141 0 : fd_loader_v4_program_instruction_write_new( self );
22142 0 : }
22143 0 : fd_loader_v4_program_instruction_write_decode_unsafe( self, ctx );
22144 0 : return FD_BINCODE_SUCCESS;
22145 0 : }
22146 0 : int fd_loader_v4_program_instruction_write_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
22147 0 : int err;
22148 0 : err = fd_bincode_uint32_decode_preflight( ctx );
22149 0 : if( FD_UNLIKELY( err ) ) return err;
22150 0 : ulong bytes_len;
22151 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
22152 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22153 0 : if( bytes_len ) {
22154 0 : err = fd_bincode_bytes_decode_preflight( bytes_len, ctx );
22155 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22156 0 : }
22157 0 : return FD_BINCODE_SUCCESS;
22158 0 : }
22159 0 : void fd_loader_v4_program_instruction_write_decode_unsafe( fd_loader_v4_program_instruction_write_t * self, fd_bincode_decode_ctx_t * ctx ) {
22160 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
22161 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
22162 0 : if( self->bytes_len ) {
22163 0 : self->bytes = fd_valloc_malloc( ctx->valloc, 8UL, self->bytes_len );
22164 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
22165 0 : } else
22166 0 : self->bytes = NULL;
22167 0 : }
22168 0 : int fd_loader_v4_program_instruction_write_encode( fd_loader_v4_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22169 0 : int err;
22170 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
22171 0 : if( FD_UNLIKELY( err ) ) return err;
22172 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
22173 0 : if( FD_UNLIKELY(err) ) return err;
22174 0 : if( self->bytes_len ) {
22175 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
22176 0 : if( FD_UNLIKELY( err ) ) return err;
22177 0 : }
22178 0 : return FD_BINCODE_SUCCESS;
22179 0 : }
22180 0 : int fd_loader_v4_program_instruction_write_decode_offsets( fd_loader_v4_program_instruction_write_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
22181 0 : uchar const * data = ctx->data;
22182 0 : int err;
22183 0 : self->offset_off = (uint)( (ulong)ctx->data - (ulong)data );
22184 0 : err = fd_bincode_uint32_decode_preflight( ctx );
22185 0 : if( FD_UNLIKELY( err ) ) return err;
22186 0 : self->bytes_off = (uint)( (ulong)ctx->data - (ulong)data );
22187 0 : ulong bytes_len;
22188 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
22189 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22190 0 : if( bytes_len ) {
22191 0 : err = fd_bincode_bytes_decode_preflight( bytes_len, ctx );
22192 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22193 0 : }
22194 0 : return FD_BINCODE_SUCCESS;
22195 0 : }
22196 0 : void fd_loader_v4_program_instruction_write_new(fd_loader_v4_program_instruction_write_t * self) {
22197 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_write_t) );
22198 0 : }
22199 0 : void fd_loader_v4_program_instruction_write_destroy( fd_loader_v4_program_instruction_write_t * self, fd_bincode_destroy_ctx_t * ctx ) {
22200 0 : if( self->bytes ) {
22201 0 : fd_valloc_free( ctx->valloc, self->bytes );
22202 0 : self->bytes = NULL;
22203 0 : }
22204 0 : }
22205 :
22206 0 : ulong fd_loader_v4_program_instruction_write_footprint( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_WRITE_FOOTPRINT; }
22207 0 : ulong fd_loader_v4_program_instruction_write_align( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_WRITE_ALIGN; }
22208 :
22209 0 : void fd_loader_v4_program_instruction_write_walk( void * w, fd_loader_v4_program_instruction_write_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22210 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_write", level++ );
22211 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level );
22212 0 : fun(w, self->bytes, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
22213 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_write", level-- );
22214 0 : }
22215 0 : ulong fd_loader_v4_program_instruction_write_size( fd_loader_v4_program_instruction_write_t const * self ) {
22216 0 : ulong size = 0;
22217 0 : size += sizeof(uint);
22218 0 : do {
22219 0 : size += sizeof(ulong);
22220 0 : size += self->bytes_len;
22221 0 : } while(0);
22222 0 : return size;
22223 0 : }
22224 :
22225 0 : int fd_loader_v4_program_instruction_truncate_decode( fd_loader_v4_program_instruction_truncate_t * self, fd_bincode_decode_ctx_t * ctx ) {
22226 0 : void const * data = ctx->data;
22227 0 : int err = fd_loader_v4_program_instruction_truncate_decode_preflight( ctx );
22228 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22229 0 : ctx->data = data;
22230 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
22231 0 : fd_loader_v4_program_instruction_truncate_new( self );
22232 0 : }
22233 0 : fd_loader_v4_program_instruction_truncate_decode_unsafe( self, ctx );
22234 0 : return FD_BINCODE_SUCCESS;
22235 0 : }
22236 0 : int fd_loader_v4_program_instruction_truncate_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
22237 0 : return fd_bincode_bytes_decode_preflight( 4, ctx );
22238 0 : }
22239 0 : void fd_loader_v4_program_instruction_truncate_decode_unsafe( fd_loader_v4_program_instruction_truncate_t * self, fd_bincode_decode_ctx_t * ctx ) {
22240 0 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
22241 0 : }
22242 0 : int fd_loader_v4_program_instruction_truncate_encode( fd_loader_v4_program_instruction_truncate_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22243 0 : int err;
22244 0 : err = fd_bincode_uint32_encode( self->new_size, ctx );
22245 0 : if( FD_UNLIKELY( err ) ) return err;
22246 0 : return FD_BINCODE_SUCCESS;
22247 0 : }
22248 0 : int fd_loader_v4_program_instruction_truncate_decode_offsets( fd_loader_v4_program_instruction_truncate_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
22249 0 : uchar const * data = ctx->data;
22250 0 : int err;
22251 0 : self->new_size_off = (uint)( (ulong)ctx->data - (ulong)data );
22252 0 : err = fd_bincode_uint32_decode_preflight( ctx );
22253 0 : if( FD_UNLIKELY( err ) ) return err;
22254 0 : return FD_BINCODE_SUCCESS;
22255 0 : }
22256 0 : void fd_loader_v4_program_instruction_truncate_new(fd_loader_v4_program_instruction_truncate_t * self) {
22257 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_truncate_t) );
22258 0 : }
22259 0 : void fd_loader_v4_program_instruction_truncate_destroy( fd_loader_v4_program_instruction_truncate_t * self, fd_bincode_destroy_ctx_t * ctx ) {
22260 0 : }
22261 :
22262 0 : ulong fd_loader_v4_program_instruction_truncate_footprint( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_TRUNCATE_FOOTPRINT; }
22263 0 : ulong fd_loader_v4_program_instruction_truncate_align( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_TRUNCATE_ALIGN; }
22264 :
22265 0 : void fd_loader_v4_program_instruction_truncate_walk( void * w, fd_loader_v4_program_instruction_truncate_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22266 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_truncate", level++ );
22267 0 : fun( w, &self->new_size, "new_size", FD_FLAMENCO_TYPE_UINT, "uint", level );
22268 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_truncate", level-- );
22269 0 : }
22270 0 : ulong fd_loader_v4_program_instruction_truncate_size( fd_loader_v4_program_instruction_truncate_t const * self ) {
22271 0 : ulong size = 0;
22272 0 : size += sizeof(uint);
22273 0 : return size;
22274 0 : }
22275 :
22276 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_write(fd_loader_v4_program_instruction_t const * self) {
22277 0 : return self->discriminant == 0;
22278 0 : }
22279 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_truncate(fd_loader_v4_program_instruction_t const * self) {
22280 0 : return self->discriminant == 1;
22281 0 : }
22282 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_deploy(fd_loader_v4_program_instruction_t const * self) {
22283 0 : return self->discriminant == 2;
22284 0 : }
22285 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_retract(fd_loader_v4_program_instruction_t const * self) {
22286 0 : return self->discriminant == 3;
22287 0 : }
22288 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_transfer_authority(fd_loader_v4_program_instruction_t const * self) {
22289 0 : return self->discriminant == 4;
22290 0 : }
22291 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_finalize(fd_loader_v4_program_instruction_t const * self) {
22292 0 : return self->discriminant == 5;
22293 0 : }
22294 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant );
22295 0 : int fd_loader_v4_program_instruction_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22296 0 : int err;
22297 0 : switch (discriminant) {
22298 0 : case 0: {
22299 0 : err = fd_loader_v4_program_instruction_write_decode_preflight( ctx );
22300 0 : if( FD_UNLIKELY( err ) ) return err;
22301 0 : return FD_BINCODE_SUCCESS;
22302 0 : }
22303 0 : case 1: {
22304 0 : err = fd_loader_v4_program_instruction_truncate_decode_preflight( ctx );
22305 0 : if( FD_UNLIKELY( err ) ) return err;
22306 0 : return FD_BINCODE_SUCCESS;
22307 0 : }
22308 0 : case 2: {
22309 0 : return FD_BINCODE_SUCCESS;
22310 0 : }
22311 0 : case 3: {
22312 0 : return FD_BINCODE_SUCCESS;
22313 0 : }
22314 0 : case 4: {
22315 0 : return FD_BINCODE_SUCCESS;
22316 0 : }
22317 0 : case 5: {
22318 0 : return FD_BINCODE_SUCCESS;
22319 0 : }
22320 0 : default: return FD_BINCODE_ERR_ENCODING;
22321 0 : }
22322 0 : }
22323 0 : void fd_loader_v4_program_instruction_inner_decode_unsafe( fd_loader_v4_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22324 0 : switch (discriminant) {
22325 0 : case 0: {
22326 0 : fd_loader_v4_program_instruction_write_decode_unsafe( &self->write, ctx );
22327 0 : break;
22328 0 : }
22329 0 : case 1: {
22330 0 : fd_loader_v4_program_instruction_truncate_decode_unsafe( &self->truncate, ctx );
22331 0 : break;
22332 0 : }
22333 0 : case 2: {
22334 0 : break;
22335 0 : }
22336 0 : case 3: {
22337 0 : break;
22338 0 : }
22339 0 : case 4: {
22340 0 : break;
22341 0 : }
22342 0 : case 5: {
22343 0 : break;
22344 0 : }
22345 0 : }
22346 0 : }
22347 0 : int fd_loader_v4_program_instruction_decode( fd_loader_v4_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
22348 0 : void const * data = ctx->data;
22349 0 : int err = fd_loader_v4_program_instruction_decode_preflight( ctx );
22350 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22351 0 : ctx->data = data;
22352 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
22353 0 : fd_loader_v4_program_instruction_new( self );
22354 0 : }
22355 0 : fd_loader_v4_program_instruction_decode_unsafe( self, ctx );
22356 0 : return FD_BINCODE_SUCCESS;
22357 0 : }
22358 0 : int fd_loader_v4_program_instruction_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
22359 0 : uint discriminant = 0;
22360 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
22361 0 : if( FD_UNLIKELY( err ) ) return err;
22362 0 : return fd_loader_v4_program_instruction_inner_decode_preflight( discriminant, ctx );
22363 0 : }
22364 0 : void fd_loader_v4_program_instruction_decode_unsafe( fd_loader_v4_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
22365 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
22366 0 : fd_loader_v4_program_instruction_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
22367 0 : }
22368 0 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
22369 0 : switch( discriminant ) {
22370 0 : case 0: {
22371 0 : fd_loader_v4_program_instruction_write_new( &self->write );
22372 0 : break;
22373 0 : }
22374 0 : case 1: {
22375 0 : fd_loader_v4_program_instruction_truncate_new( &self->truncate );
22376 0 : break;
22377 0 : }
22378 0 : case 2: {
22379 0 : break;
22380 0 : }
22381 0 : case 3: {
22382 0 : break;
22383 0 : }
22384 0 : case 4: {
22385 0 : break;
22386 0 : }
22387 0 : case 5: {
22388 0 : break;
22389 0 : }
22390 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
22391 0 : }
22392 0 : }
22393 0 : void fd_loader_v4_program_instruction_new_disc( fd_loader_v4_program_instruction_t * self, uint discriminant ) {
22394 0 : self->discriminant = discriminant;
22395 0 : fd_loader_v4_program_instruction_inner_new( &self->inner, self->discriminant );
22396 0 : }
22397 0 : void fd_loader_v4_program_instruction_new( fd_loader_v4_program_instruction_t * self ) {
22398 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_t) );
22399 0 : fd_loader_v4_program_instruction_new_disc( self, UINT_MAX );
22400 0 : }
22401 0 : void fd_loader_v4_program_instruction_inner_destroy( fd_loader_v4_program_instruction_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
22402 0 : switch( discriminant ) {
22403 0 : case 0: {
22404 0 : fd_loader_v4_program_instruction_write_destroy( &self->write, ctx );
22405 0 : break;
22406 0 : }
22407 0 : case 1: {
22408 0 : fd_loader_v4_program_instruction_truncate_destroy( &self->truncate, ctx );
22409 0 : break;
22410 0 : }
22411 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
22412 0 : }
22413 0 : }
22414 0 : void fd_loader_v4_program_instruction_destroy( fd_loader_v4_program_instruction_t * self, fd_bincode_destroy_ctx_t * ctx ) {
22415 0 : fd_loader_v4_program_instruction_inner_destroy( &self->inner, self->discriminant, ctx );
22416 0 : }
22417 :
22418 0 : ulong fd_loader_v4_program_instruction_footprint( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_FOOTPRINT; }
22419 0 : ulong fd_loader_v4_program_instruction_align( void ){ return FD_LOADER_V4_PROGRAM_INSTRUCTION_ALIGN; }
22420 :
22421 0 : void fd_loader_v4_program_instruction_walk( void * w, fd_loader_v4_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22422 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_loader_v4_program_instruction", level++);
22423 0 : switch( self->discriminant ) {
22424 0 : case 0: {
22425 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22426 0 : fd_loader_v4_program_instruction_write_walk( w, &self->inner.write, fun, "write", level );
22427 0 : break;
22428 0 : }
22429 0 : case 1: {
22430 0 : fun( w, self, "truncate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22431 0 : fd_loader_v4_program_instruction_truncate_walk( w, &self->inner.truncate, fun, "truncate", level );
22432 0 : break;
22433 0 : }
22434 0 : case 2: {
22435 0 : fun( w, self, "deploy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22436 0 : break;
22437 0 : }
22438 0 : case 3: {
22439 0 : fun( w, self, "retract", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22440 0 : break;
22441 0 : }
22442 0 : case 4: {
22443 0 : fun( w, self, "transfer_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22444 0 : break;
22445 0 : }
22446 0 : case 5: {
22447 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22448 0 : break;
22449 0 : }
22450 0 : }
22451 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_loader_v4_program_instruction", level-- );
22452 0 : }
22453 0 : ulong fd_loader_v4_program_instruction_size( fd_loader_v4_program_instruction_t const * self ) {
22454 0 : ulong size = 0;
22455 0 : size += sizeof(uint);
22456 0 : switch (self->discriminant) {
22457 0 : case 0: {
22458 0 : size += fd_loader_v4_program_instruction_write_size( &self->inner.write );
22459 0 : break;
22460 0 : }
22461 0 : case 1: {
22462 0 : size += fd_loader_v4_program_instruction_truncate_size( &self->inner.truncate );
22463 0 : break;
22464 0 : }
22465 0 : }
22466 0 : return size;
22467 0 : }
22468 :
22469 0 : int fd_loader_v4_program_instruction_inner_encode( fd_loader_v4_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
22470 0 : int err;
22471 0 : switch (discriminant) {
22472 0 : case 0: {
22473 0 : err = fd_loader_v4_program_instruction_write_encode( &self->write, ctx );
22474 0 : if( FD_UNLIKELY( err ) ) return err;
22475 0 : break;
22476 0 : }
22477 0 : case 1: {
22478 0 : err = fd_loader_v4_program_instruction_truncate_encode( &self->truncate, ctx );
22479 0 : if( FD_UNLIKELY( err ) ) return err;
22480 0 : break;
22481 0 : }
22482 0 : }
22483 0 : return FD_BINCODE_SUCCESS;
22484 0 : }
22485 0 : int fd_loader_v4_program_instruction_encode( fd_loader_v4_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22486 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
22487 0 : if( FD_UNLIKELY( err ) ) return err;
22488 0 : return fd_loader_v4_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
22489 0 : }
22490 :
22491 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode( fd_bpf_upgradeable_loader_program_instruction_write_t * self, fd_bincode_decode_ctx_t * ctx ) {
22492 0 : void const * data = ctx->data;
22493 0 : int err = fd_bpf_upgradeable_loader_program_instruction_write_decode_preflight( ctx );
22494 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22495 0 : ctx->data = data;
22496 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
22497 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( self );
22498 0 : }
22499 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_unsafe( self, ctx );
22500 0 : return FD_BINCODE_SUCCESS;
22501 0 : }
22502 54 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
22503 54 : int err;
22504 54 : err = fd_bincode_uint32_decode_preflight( ctx );
22505 54 : if( FD_UNLIKELY( err ) ) return err;
22506 54 : ulong bytes_len;
22507 54 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
22508 54 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22509 54 : if( bytes_len ) {
22510 48 : err = fd_bincode_bytes_decode_preflight( bytes_len, ctx );
22511 48 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22512 48 : }
22513 48 : return FD_BINCODE_SUCCESS;
22514 54 : }
22515 48 : void fd_bpf_upgradeable_loader_program_instruction_write_decode_unsafe( fd_bpf_upgradeable_loader_program_instruction_write_t * self, fd_bincode_decode_ctx_t * ctx ) {
22516 48 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
22517 48 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
22518 48 : if( self->bytes_len ) {
22519 42 : self->bytes = fd_valloc_malloc( ctx->valloc, 8UL, self->bytes_len );
22520 42 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
22521 42 : } else
22522 6 : self->bytes = NULL;
22523 48 : }
22524 0 : int fd_bpf_upgradeable_loader_program_instruction_write_encode( fd_bpf_upgradeable_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22525 0 : int err;
22526 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
22527 0 : if( FD_UNLIKELY( err ) ) return err;
22528 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
22529 0 : if( FD_UNLIKELY(err) ) return err;
22530 0 : if( self->bytes_len ) {
22531 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
22532 0 : if( FD_UNLIKELY( err ) ) return err;
22533 0 : }
22534 0 : return FD_BINCODE_SUCCESS;
22535 0 : }
22536 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_offsets( fd_bpf_upgradeable_loader_program_instruction_write_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
22537 0 : uchar const * data = ctx->data;
22538 0 : int err;
22539 0 : self->offset_off = (uint)( (ulong)ctx->data - (ulong)data );
22540 0 : err = fd_bincode_uint32_decode_preflight( ctx );
22541 0 : if( FD_UNLIKELY( err ) ) return err;
22542 0 : self->bytes_off = (uint)( (ulong)ctx->data - (ulong)data );
22543 0 : ulong bytes_len;
22544 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
22545 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22546 0 : if( bytes_len ) {
22547 0 : err = fd_bincode_bytes_decode_preflight( bytes_len, ctx );
22548 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22549 0 : }
22550 0 : return FD_BINCODE_SUCCESS;
22551 0 : }
22552 0 : void fd_bpf_upgradeable_loader_program_instruction_write_new(fd_bpf_upgradeable_loader_program_instruction_write_t * self) {
22553 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t) );
22554 0 : }
22555 0 : void fd_bpf_upgradeable_loader_program_instruction_write_destroy( fd_bpf_upgradeable_loader_program_instruction_write_t * self, fd_bincode_destroy_ctx_t * ctx ) {
22556 0 : if( self->bytes ) {
22557 0 : fd_valloc_free( ctx->valloc, self->bytes );
22558 0 : self->bytes = NULL;
22559 0 : }
22560 0 : }
22561 :
22562 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_WRITE_FOOTPRINT; }
22563 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_WRITE_ALIGN; }
22564 :
22565 0 : void fd_bpf_upgradeable_loader_program_instruction_write_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_write_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22566 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_write", level++ );
22567 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level );
22568 0 : fun(w, self->bytes, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
22569 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_write", level-- );
22570 0 : }
22571 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_size( fd_bpf_upgradeable_loader_program_instruction_write_t const * self ) {
22572 0 : ulong size = 0;
22573 0 : size += sizeof(uint);
22574 0 : do {
22575 0 : size += sizeof(ulong);
22576 0 : size += self->bytes_len;
22577 0 : } while(0);
22578 0 : return size;
22579 0 : }
22580 :
22581 0 : int fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode( fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self, fd_bincode_decode_ctx_t * ctx ) {
22582 0 : void const * data = ctx->data;
22583 0 : int err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_preflight( ctx );
22584 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22585 0 : ctx->data = data;
22586 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
22587 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( self );
22588 0 : }
22589 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_unsafe( self, ctx );
22590 0 : return FD_BINCODE_SUCCESS;
22591 0 : }
22592 210 : int fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
22593 210 : return fd_bincode_bytes_decode_preflight( 8, ctx );
22594 210 : }
22595 210 : void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_unsafe( fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self, fd_bincode_decode_ctx_t * ctx ) {
22596 210 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
22597 210 : }
22598 0 : int fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22599 0 : int err;
22600 0 : err = fd_bincode_uint64_encode( self->max_data_len, ctx );
22601 0 : if( FD_UNLIKELY( err ) ) return err;
22602 0 : return FD_BINCODE_SUCCESS;
22603 0 : }
22604 0 : int fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_offsets( fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
22605 0 : uchar const * data = ctx->data;
22606 0 : int err;
22607 0 : self->max_data_len_off = (uint)( (ulong)ctx->data - (ulong)data );
22608 0 : err = fd_bincode_uint64_decode_preflight( ctx );
22609 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22610 0 : return FD_BINCODE_SUCCESS;
22611 0 : }
22612 0 : void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self) {
22613 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t) );
22614 0 : }
22615 0 : void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_destroy( fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self, fd_bincode_destroy_ctx_t * ctx ) {
22616 0 : }
22617 :
22618 0 : ulong fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_DEPLOY_WITH_MAX_DATA_LEN_FOOTPRINT; }
22619 0 : ulong fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_DEPLOY_WITH_MAX_DATA_LEN_ALIGN; }
22620 :
22621 0 : void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22622 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level++ );
22623 0 : fun( w, &self->max_data_len, "max_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
22624 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level-- );
22625 0 : }
22626 0 : ulong fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t const * self ) {
22627 0 : ulong size = 0;
22628 0 : size += sizeof(ulong);
22629 0 : return size;
22630 0 : }
22631 :
22632 0 : int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode( fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self, fd_bincode_decode_ctx_t * ctx ) {
22633 0 : void const * data = ctx->data;
22634 0 : int err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_preflight( ctx );
22635 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22636 0 : ctx->data = data;
22637 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
22638 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( self );
22639 0 : }
22640 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_unsafe( self, ctx );
22641 0 : return FD_BINCODE_SUCCESS;
22642 0 : }
22643 195 : int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
22644 195 : return fd_bincode_bytes_decode_preflight( 4, ctx );
22645 195 : }
22646 195 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_unsafe( fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self, fd_bincode_decode_ctx_t * ctx ) {
22647 195 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
22648 195 : }
22649 0 : int fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( fd_bpf_upgradeable_loader_program_instruction_extend_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22650 0 : int err;
22651 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
22652 0 : if( FD_UNLIKELY( err ) ) return err;
22653 0 : return FD_BINCODE_SUCCESS;
22654 0 : }
22655 0 : int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_offsets( fd_bpf_upgradeable_loader_program_instruction_extend_program_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
22656 0 : uchar const * data = ctx->data;
22657 0 : int err;
22658 0 : self->additional_bytes_off = (uint)( (ulong)ctx->data - (ulong)data );
22659 0 : err = fd_bincode_uint32_decode_preflight( ctx );
22660 0 : if( FD_UNLIKELY( err ) ) return err;
22661 0 : return FD_BINCODE_SUCCESS;
22662 0 : }
22663 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_new(fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self) {
22664 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t) );
22665 0 : }
22666 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_destroy( fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self, fd_bincode_destroy_ctx_t * ctx ) {
22667 0 : }
22668 :
22669 0 : ulong fd_bpf_upgradeable_loader_program_instruction_extend_program_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_EXTEND_PROGRAM_FOOTPRINT; }
22670 0 : ulong fd_bpf_upgradeable_loader_program_instruction_extend_program_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_EXTEND_PROGRAM_ALIGN; }
22671 :
22672 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_extend_program_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22673 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level++ );
22674 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level );
22675 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level-- );
22676 0 : }
22677 0 : ulong fd_bpf_upgradeable_loader_program_instruction_extend_program_size( fd_bpf_upgradeable_loader_program_instruction_extend_program_t const * self ) {
22678 0 : ulong size = 0;
22679 0 : size += sizeof(uint);
22680 0 : return size;
22681 0 : }
22682 :
22683 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_initialize_buffer(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22684 0 : return self->discriminant == 0;
22685 0 : }
22686 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_write(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22687 0 : return self->discriminant == 1;
22688 0 : }
22689 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_deploy_with_max_data_len(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22690 0 : return self->discriminant == 2;
22691 0 : }
22692 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_upgrade(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22693 0 : return self->discriminant == 3;
22694 0 : }
22695 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22696 0 : return self->discriminant == 4;
22697 0 : }
22698 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_close(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22699 0 : return self->discriminant == 5;
22700 0 : }
22701 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22702 0 : return self->discriminant == 6;
22703 0 : }
22704 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
22705 0 : return self->discriminant == 7;
22706 0 : }
22707 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant );
22708 1269 : int fd_bpf_upgradeable_loader_program_instruction_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22709 1269 : int err;
22710 1269 : switch (discriminant) {
22711 39 : case 0: {
22712 39 : return FD_BINCODE_SUCCESS;
22713 0 : }
22714 54 : case 1: {
22715 54 : err = fd_bpf_upgradeable_loader_program_instruction_write_decode_preflight( ctx );
22716 54 : if( FD_UNLIKELY( err ) ) return err;
22717 48 : return FD_BINCODE_SUCCESS;
22718 54 : }
22719 210 : case 2: {
22720 210 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_preflight( ctx );
22721 210 : if( FD_UNLIKELY( err ) ) return err;
22722 210 : return FD_BINCODE_SUCCESS;
22723 210 : }
22724 633 : case 3: {
22725 633 : return FD_BINCODE_SUCCESS;
22726 210 : }
22727 30 : case 4: {
22728 30 : return FD_BINCODE_SUCCESS;
22729 210 : }
22730 54 : case 5: {
22731 54 : return FD_BINCODE_SUCCESS;
22732 210 : }
22733 195 : case 6: {
22734 195 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_preflight( ctx );
22735 195 : if( FD_UNLIKELY( err ) ) return err;
22736 195 : return FD_BINCODE_SUCCESS;
22737 195 : }
22738 51 : case 7: {
22739 51 : return FD_BINCODE_SUCCESS;
22740 195 : }
22741 3 : default: return FD_BINCODE_ERR_ENCODING;
22742 1269 : }
22743 1269 : }
22744 1260 : void fd_bpf_upgradeable_loader_program_instruction_inner_decode_unsafe( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22745 1260 : switch (discriminant) {
22746 39 : case 0: {
22747 39 : break;
22748 0 : }
22749 48 : case 1: {
22750 48 : fd_bpf_upgradeable_loader_program_instruction_write_decode_unsafe( &self->write, ctx );
22751 48 : break;
22752 0 : }
22753 210 : case 2: {
22754 210 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_unsafe( &self->deploy_with_max_data_len, ctx );
22755 210 : break;
22756 0 : }
22757 633 : case 3: {
22758 633 : break;
22759 0 : }
22760 30 : case 4: {
22761 30 : break;
22762 0 : }
22763 54 : case 5: {
22764 54 : break;
22765 0 : }
22766 195 : case 6: {
22767 195 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_unsafe( &self->extend_program, ctx );
22768 195 : break;
22769 0 : }
22770 51 : case 7: {
22771 51 : break;
22772 0 : }
22773 1260 : }
22774 1260 : }
22775 1272 : int fd_bpf_upgradeable_loader_program_instruction_decode( fd_bpf_upgradeable_loader_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
22776 1272 : void const * data = ctx->data;
22777 1272 : int err = fd_bpf_upgradeable_loader_program_instruction_decode_preflight( ctx );
22778 1272 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22779 1260 : ctx->data = data;
22780 1260 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
22781 1260 : fd_bpf_upgradeable_loader_program_instruction_new( self );
22782 1260 : }
22783 1260 : fd_bpf_upgradeable_loader_program_instruction_decode_unsafe( self, ctx );
22784 1260 : return FD_BINCODE_SUCCESS;
22785 1272 : }
22786 1272 : int fd_bpf_upgradeable_loader_program_instruction_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
22787 1272 : uint discriminant = 0;
22788 1272 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
22789 1272 : if( FD_UNLIKELY( err ) ) return err;
22790 1269 : return fd_bpf_upgradeable_loader_program_instruction_inner_decode_preflight( discriminant, ctx );
22791 1272 : }
22792 1260 : void fd_bpf_upgradeable_loader_program_instruction_decode_unsafe( fd_bpf_upgradeable_loader_program_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
22793 1260 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
22794 1260 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
22795 1260 : }
22796 1260 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
22797 1260 : switch( discriminant ) {
22798 0 : case 0: {
22799 0 : break;
22800 0 : }
22801 0 : case 1: {
22802 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( &self->write );
22803 0 : break;
22804 0 : }
22805 0 : case 2: {
22806 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( &self->deploy_with_max_data_len );
22807 0 : break;
22808 0 : }
22809 0 : case 3: {
22810 0 : break;
22811 0 : }
22812 0 : case 4: {
22813 0 : break;
22814 0 : }
22815 0 : case 5: {
22816 0 : break;
22817 0 : }
22818 0 : case 6: {
22819 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( &self->extend_program );
22820 0 : break;
22821 0 : }
22822 0 : case 7: {
22823 0 : break;
22824 0 : }
22825 1260 : default: break; // FD_LOG_ERR(( "unhandled type"));
22826 1260 : }
22827 1260 : }
22828 1260 : void fd_bpf_upgradeable_loader_program_instruction_new_disc( fd_bpf_upgradeable_loader_program_instruction_t * self, uint discriminant ) {
22829 1260 : self->discriminant = discriminant;
22830 1260 : fd_bpf_upgradeable_loader_program_instruction_inner_new( &self->inner, self->discriminant );
22831 1260 : }
22832 1260 : void fd_bpf_upgradeable_loader_program_instruction_new( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
22833 1260 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_t) );
22834 1260 : fd_bpf_upgradeable_loader_program_instruction_new_disc( self, UINT_MAX );
22835 1260 : }
22836 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_destroy( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
22837 0 : switch( discriminant ) {
22838 0 : case 1: {
22839 0 : fd_bpf_upgradeable_loader_program_instruction_write_destroy( &self->write, ctx );
22840 0 : break;
22841 0 : }
22842 0 : case 2: {
22843 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_destroy( &self->deploy_with_max_data_len, ctx );
22844 0 : break;
22845 0 : }
22846 0 : case 6: {
22847 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_destroy( &self->extend_program, ctx );
22848 0 : break;
22849 0 : }
22850 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
22851 0 : }
22852 0 : }
22853 0 : void fd_bpf_upgradeable_loader_program_instruction_destroy( fd_bpf_upgradeable_loader_program_instruction_t * self, fd_bincode_destroy_ctx_t * ctx ) {
22854 0 : fd_bpf_upgradeable_loader_program_instruction_inner_destroy( &self->inner, self->discriminant, ctx );
22855 0 : }
22856 :
22857 0 : ulong fd_bpf_upgradeable_loader_program_instruction_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_FOOTPRINT; }
22858 0 : ulong fd_bpf_upgradeable_loader_program_instruction_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_PROGRAM_INSTRUCTION_ALIGN; }
22859 :
22860 0 : void fd_bpf_upgradeable_loader_program_instruction_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
22861 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_program_instruction", level++);
22862 0 : switch( self->discriminant ) {
22863 0 : case 0: {
22864 0 : fun( w, self, "initialize_buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22865 0 : break;
22866 0 : }
22867 0 : case 1: {
22868 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22869 0 : fd_bpf_upgradeable_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level );
22870 0 : break;
22871 0 : }
22872 0 : case 2: {
22873 0 : fun( w, self, "deploy_with_max_data_len", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22874 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_walk( w, &self->inner.deploy_with_max_data_len, fun, "deploy_with_max_data_len", level );
22875 0 : break;
22876 0 : }
22877 0 : case 3: {
22878 0 : fun( w, self, "upgrade", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22879 0 : break;
22880 0 : }
22881 0 : case 4: {
22882 0 : fun( w, self, "set_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22883 0 : break;
22884 0 : }
22885 0 : case 5: {
22886 0 : fun( w, self, "close", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22887 0 : break;
22888 0 : }
22889 0 : case 6: {
22890 0 : fun( w, self, "extend_program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22891 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_walk( w, &self->inner.extend_program, fun, "extend_program", level );
22892 0 : break;
22893 0 : }
22894 0 : case 7: {
22895 0 : fun( w, self, "set_authority_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
22896 0 : break;
22897 0 : }
22898 0 : }
22899 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_program_instruction", level-- );
22900 0 : }
22901 0 : ulong fd_bpf_upgradeable_loader_program_instruction_size( fd_bpf_upgradeable_loader_program_instruction_t const * self ) {
22902 0 : ulong size = 0;
22903 0 : size += sizeof(uint);
22904 0 : switch (self->discriminant) {
22905 0 : case 1: {
22906 0 : size += fd_bpf_upgradeable_loader_program_instruction_write_size( &self->inner.write );
22907 0 : break;
22908 0 : }
22909 0 : case 2: {
22910 0 : size += fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( &self->inner.deploy_with_max_data_len );
22911 0 : break;
22912 0 : }
22913 0 : case 6: {
22914 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_size( &self->inner.extend_program );
22915 0 : break;
22916 0 : }
22917 0 : }
22918 0 : return size;
22919 0 : }
22920 :
22921 0 : int fd_bpf_upgradeable_loader_program_instruction_inner_encode( fd_bpf_upgradeable_loader_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
22922 0 : int err;
22923 0 : switch (discriminant) {
22924 0 : case 1: {
22925 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_encode( &self->write, ctx );
22926 0 : if( FD_UNLIKELY( err ) ) return err;
22927 0 : break;
22928 0 : }
22929 0 : case 2: {
22930 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( &self->deploy_with_max_data_len, ctx );
22931 0 : if( FD_UNLIKELY( err ) ) return err;
22932 0 : break;
22933 0 : }
22934 0 : case 6: {
22935 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( &self->extend_program, ctx );
22936 0 : if( FD_UNLIKELY( err ) ) return err;
22937 0 : break;
22938 0 : }
22939 0 : }
22940 0 : return FD_BINCODE_SUCCESS;
22941 0 : }
22942 0 : int fd_bpf_upgradeable_loader_program_instruction_encode( fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22943 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
22944 0 : if( FD_UNLIKELY( err ) ) return err;
22945 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
22946 0 : }
22947 :
22948 0 : int fd_bpf_upgradeable_loader_state_buffer_decode( fd_bpf_upgradeable_loader_state_buffer_t * self, fd_bincode_decode_ctx_t * ctx ) {
22949 0 : void const * data = ctx->data;
22950 0 : int err = fd_bpf_upgradeable_loader_state_buffer_decode_preflight( ctx );
22951 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22952 0 : ctx->data = data;
22953 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
22954 0 : fd_bpf_upgradeable_loader_state_buffer_new( self );
22955 0 : }
22956 0 : fd_bpf_upgradeable_loader_state_buffer_decode_unsafe( self, ctx );
22957 0 : return FD_BINCODE_SUCCESS;
22958 0 : }
22959 13503 : int fd_bpf_upgradeable_loader_state_buffer_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
22960 13503 : int err;
22961 13503 : {
22962 13503 : uchar o;
22963 13503 : err = fd_bincode_bool_decode( &o, ctx );
22964 13503 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22965 11961 : if( o ) {
22966 8499 : err = fd_pubkey_decode_preflight( ctx );
22967 8499 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22968 8499 : }
22969 11961 : }
22970 7305 : return FD_BINCODE_SUCCESS;
22971 11961 : }
22972 7305 : void fd_bpf_upgradeable_loader_state_buffer_decode_unsafe( fd_bpf_upgradeable_loader_state_buffer_t * self, fd_bincode_decode_ctx_t * ctx ) {
22973 7305 : {
22974 7305 : uchar o;
22975 7305 : fd_bincode_bool_decode_unsafe( &o, ctx );
22976 7305 : if( o ) {
22977 3843 : self->authority_address = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT );
22978 3843 : fd_pubkey_new( self->authority_address );
22979 3843 : fd_pubkey_decode_unsafe( self->authority_address, ctx );
22980 3843 : } else
22981 3462 : self->authority_address = NULL;
22982 7305 : }
22983 7305 : }
22984 57 : int fd_bpf_upgradeable_loader_state_buffer_encode( fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22985 57 : int err;
22986 57 : if( self->authority_address != NULL ) {
22987 57 : err = fd_bincode_bool_encode( 1, ctx );
22988 57 : if( FD_UNLIKELY( err ) ) return err;
22989 57 : err = fd_pubkey_encode( self->authority_address, ctx );
22990 57 : if( FD_UNLIKELY( err ) ) return err;
22991 57 : } else {
22992 0 : err = fd_bincode_bool_encode( 0, ctx );
22993 0 : if( FD_UNLIKELY( err ) ) return err;
22994 0 : }
22995 57 : return FD_BINCODE_SUCCESS;
22996 57 : }
22997 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_offsets( fd_bpf_upgradeable_loader_state_buffer_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
22998 0 : uchar const * data = ctx->data;
22999 0 : int err;
23000 0 : self->authority_address_off = (uint)( (ulong)ctx->data - (ulong)data );
23001 0 : {
23002 0 : uchar o;
23003 0 : err = fd_bincode_bool_decode( &o, ctx );
23004 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23005 0 : if( o ) {
23006 0 : err = fd_pubkey_decode_preflight( ctx );
23007 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23008 0 : }
23009 0 : }
23010 0 : return FD_BINCODE_SUCCESS;
23011 0 : }
23012 0 : void fd_bpf_upgradeable_loader_state_buffer_new(fd_bpf_upgradeable_loader_state_buffer_t * self) {
23013 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_buffer_t) );
23014 0 : }
23015 0 : void fd_bpf_upgradeable_loader_state_buffer_destroy( fd_bpf_upgradeable_loader_state_buffer_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23016 0 : if( self->authority_address ) {
23017 0 : fd_pubkey_destroy( self->authority_address, ctx );
23018 0 : fd_valloc_free( ctx->valloc, self->authority_address );
23019 0 : self->authority_address = NULL;
23020 0 : }
23021 0 : }
23022 :
23023 0 : ulong fd_bpf_upgradeable_loader_state_buffer_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_BUFFER_FOOTPRINT; }
23024 0 : ulong fd_bpf_upgradeable_loader_state_buffer_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_BUFFER_ALIGN; }
23025 :
23026 0 : void fd_bpf_upgradeable_loader_state_buffer_walk( void * w, fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23027 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_buffer", level++ );
23028 0 : if( !self->authority_address ) {
23029 0 : fun( w, NULL, "authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
23030 0 : } else {
23031 0 : fd_pubkey_walk( w, self->authority_address, fun, "authority_address", level );
23032 0 : }
23033 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_buffer", level-- );
23034 0 : }
23035 60 : ulong fd_bpf_upgradeable_loader_state_buffer_size( fd_bpf_upgradeable_loader_state_buffer_t const * self ) {
23036 60 : ulong size = 0;
23037 60 : size += sizeof(char);
23038 60 : if( NULL != self->authority_address ) {
23039 60 : size += fd_pubkey_size( self->authority_address );
23040 60 : }
23041 60 : return size;
23042 60 : }
23043 :
23044 0 : int fd_bpf_upgradeable_loader_state_program_decode( fd_bpf_upgradeable_loader_state_program_t * self, fd_bincode_decode_ctx_t * ctx ) {
23045 0 : void const * data = ctx->data;
23046 0 : int err = fd_bpf_upgradeable_loader_state_program_decode_preflight( ctx );
23047 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23048 0 : ctx->data = data;
23049 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23050 0 : fd_bpf_upgradeable_loader_state_program_new( self );
23051 0 : }
23052 0 : fd_bpf_upgradeable_loader_state_program_decode_unsafe( self, ctx );
23053 0 : return FD_BINCODE_SUCCESS;
23054 0 : }
23055 43989 : int fd_bpf_upgradeable_loader_state_program_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23056 43989 : return fd_bincode_bytes_decode_preflight( 32, ctx );
23057 43989 : }
23058 28719 : void fd_bpf_upgradeable_loader_state_program_decode_unsafe( fd_bpf_upgradeable_loader_state_program_t * self, fd_bincode_decode_ctx_t * ctx ) {
23059 28719 : fd_pubkey_decode_unsafe( &self->programdata_address, ctx );
23060 28719 : }
23061 0 : int fd_bpf_upgradeable_loader_state_program_encode( fd_bpf_upgradeable_loader_state_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23062 0 : int err;
23063 0 : err = fd_pubkey_encode( &self->programdata_address, ctx );
23064 0 : if( FD_UNLIKELY( err ) ) return err;
23065 0 : return FD_BINCODE_SUCCESS;
23066 0 : }
23067 0 : int fd_bpf_upgradeable_loader_state_program_decode_offsets( fd_bpf_upgradeable_loader_state_program_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
23068 0 : uchar const * data = ctx->data;
23069 0 : int err;
23070 0 : self->programdata_address_off = (uint)( (ulong)ctx->data - (ulong)data );
23071 0 : err = fd_pubkey_decode_preflight( ctx );
23072 0 : if( FD_UNLIKELY( err ) ) return err;
23073 0 : return FD_BINCODE_SUCCESS;
23074 0 : }
23075 0 : void fd_bpf_upgradeable_loader_state_program_new(fd_bpf_upgradeable_loader_state_program_t * self) {
23076 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_t) );
23077 0 : fd_pubkey_new( &self->programdata_address );
23078 0 : }
23079 0 : void fd_bpf_upgradeable_loader_state_program_destroy( fd_bpf_upgradeable_loader_state_program_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23080 0 : fd_pubkey_destroy( &self->programdata_address, ctx );
23081 0 : }
23082 :
23083 0 : ulong fd_bpf_upgradeable_loader_state_program_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_PROGRAM_FOOTPRINT; }
23084 0 : ulong fd_bpf_upgradeable_loader_state_program_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_PROGRAM_ALIGN; }
23085 :
23086 0 : void fd_bpf_upgradeable_loader_state_program_walk( void * w, fd_bpf_upgradeable_loader_state_program_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23087 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program", level++ );
23088 0 : fd_pubkey_walk( w, &self->programdata_address, fun, "programdata_address", level );
23089 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program", level-- );
23090 0 : }
23091 0 : ulong fd_bpf_upgradeable_loader_state_program_size( fd_bpf_upgradeable_loader_state_program_t const * self ) {
23092 0 : ulong size = 0;
23093 0 : size += fd_pubkey_size( &self->programdata_address );
23094 0 : return size;
23095 0 : }
23096 :
23097 0 : int fd_bpf_upgradeable_loader_state_program_data_decode( fd_bpf_upgradeable_loader_state_program_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
23098 0 : void const * data = ctx->data;
23099 0 : int err = fd_bpf_upgradeable_loader_state_program_data_decode_preflight( ctx );
23100 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23101 0 : ctx->data = data;
23102 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23103 0 : fd_bpf_upgradeable_loader_state_program_data_new( self );
23104 0 : }
23105 0 : fd_bpf_upgradeable_loader_state_program_data_decode_unsafe( self, ctx );
23106 0 : return FD_BINCODE_SUCCESS;
23107 0 : }
23108 13506 : int fd_bpf_upgradeable_loader_state_program_data_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23109 13506 : int err;
23110 13506 : err = fd_bincode_uint64_decode_preflight( ctx );
23111 13506 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23112 12723 : {
23113 12723 : uchar o;
23114 12723 : err = fd_bincode_bool_decode( &o, ctx );
23115 12723 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23116 10593 : if( o ) {
23117 8967 : err = fd_pubkey_decode_preflight( ctx );
23118 8967 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23119 8967 : }
23120 10593 : }
23121 9312 : return FD_BINCODE_SUCCESS;
23122 10593 : }
23123 9312 : void fd_bpf_upgradeable_loader_state_program_data_decode_unsafe( fd_bpf_upgradeable_loader_state_program_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
23124 9312 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
23125 9312 : {
23126 9312 : uchar o;
23127 9312 : fd_bincode_bool_decode_unsafe( &o, ctx );
23128 9312 : if( o ) {
23129 7686 : self->upgrade_authority_address = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT );
23130 7686 : fd_pubkey_new( self->upgrade_authority_address );
23131 7686 : fd_pubkey_decode_unsafe( self->upgrade_authority_address, ctx );
23132 7686 : } else
23133 1626 : self->upgrade_authority_address = NULL;
23134 9312 : }
23135 9312 : }
23136 60 : int fd_bpf_upgradeable_loader_state_program_data_encode( fd_bpf_upgradeable_loader_state_program_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23137 60 : int err;
23138 60 : err = fd_bincode_uint64_encode( self->slot, ctx );
23139 60 : if( FD_UNLIKELY( err ) ) return err;
23140 60 : if( self->upgrade_authority_address != NULL ) {
23141 60 : err = fd_bincode_bool_encode( 1, ctx );
23142 60 : if( FD_UNLIKELY( err ) ) return err;
23143 60 : err = fd_pubkey_encode( self->upgrade_authority_address, ctx );
23144 60 : if( FD_UNLIKELY( err ) ) return err;
23145 60 : } else {
23146 0 : err = fd_bincode_bool_encode( 0, ctx );
23147 0 : if( FD_UNLIKELY( err ) ) return err;
23148 0 : }
23149 60 : return FD_BINCODE_SUCCESS;
23150 60 : }
23151 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_offsets( fd_bpf_upgradeable_loader_state_program_data_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
23152 0 : uchar const * data = ctx->data;
23153 0 : int err;
23154 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
23155 0 : err = fd_bincode_uint64_decode_preflight( ctx );
23156 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23157 0 : self->upgrade_authority_address_off = (uint)( (ulong)ctx->data - (ulong)data );
23158 0 : {
23159 0 : uchar o;
23160 0 : err = fd_bincode_bool_decode( &o, ctx );
23161 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23162 0 : if( o ) {
23163 0 : err = fd_pubkey_decode_preflight( ctx );
23164 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23165 0 : }
23166 0 : }
23167 0 : return FD_BINCODE_SUCCESS;
23168 0 : }
23169 0 : void fd_bpf_upgradeable_loader_state_program_data_new(fd_bpf_upgradeable_loader_state_program_data_t * self) {
23170 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_data_t) );
23171 0 : }
23172 0 : void fd_bpf_upgradeable_loader_state_program_data_destroy( fd_bpf_upgradeable_loader_state_program_data_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23173 0 : if( self->upgrade_authority_address ) {
23174 0 : fd_pubkey_destroy( self->upgrade_authority_address, ctx );
23175 0 : fd_valloc_free( ctx->valloc, self->upgrade_authority_address );
23176 0 : self->upgrade_authority_address = NULL;
23177 0 : }
23178 0 : }
23179 :
23180 0 : ulong fd_bpf_upgradeable_loader_state_program_data_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_PROGRAM_DATA_FOOTPRINT; }
23181 0 : ulong fd_bpf_upgradeable_loader_state_program_data_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_PROGRAM_DATA_ALIGN; }
23182 :
23183 0 : void fd_bpf_upgradeable_loader_state_program_data_walk( void * w, fd_bpf_upgradeable_loader_state_program_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23184 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program_data", level++ );
23185 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23186 0 : if( !self->upgrade_authority_address ) {
23187 0 : fun( w, NULL, "upgrade_authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
23188 0 : } else {
23189 0 : fd_pubkey_walk( w, self->upgrade_authority_address, fun, "upgrade_authority_address", level );
23190 0 : }
23191 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program_data", level-- );
23192 0 : }
23193 60 : ulong fd_bpf_upgradeable_loader_state_program_data_size( fd_bpf_upgradeable_loader_state_program_data_t const * self ) {
23194 60 : ulong size = 0;
23195 60 : size += sizeof(ulong);
23196 60 : size += sizeof(char);
23197 60 : if( NULL != self->upgrade_authority_address ) {
23198 60 : size += fd_pubkey_size( self->upgrade_authority_address );
23199 60 : }
23200 60 : return size;
23201 60 : }
23202 :
23203 297 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_uninitialized(fd_bpf_upgradeable_loader_state_t const * self) {
23204 297 : return self->discriminant == 0;
23205 297 : }
23206 933 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_buffer(fd_bpf_upgradeable_loader_state_t const * self) {
23207 933 : return self->discriminant == 1;
23208 933 : }
23209 26856 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program(fd_bpf_upgradeable_loader_state_t const * self) {
23210 26856 : return self->discriminant == 2;
23211 26856 : }
23212 1638 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program_data(fd_bpf_upgradeable_loader_state_t const * self) {
23213 1638 : return self->discriminant == 3;
23214 1638 : }
23215 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant );
23216 106278 : int fd_bpf_upgradeable_loader_state_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23217 106278 : int err;
23218 106278 : switch (discriminant) {
23219 8256 : case 0: {
23220 8256 : return FD_BINCODE_SUCCESS;
23221 0 : }
23222 13503 : case 1: {
23223 13503 : err = fd_bpf_upgradeable_loader_state_buffer_decode_preflight( ctx );
23224 13503 : if( FD_UNLIKELY( err ) ) return err;
23225 7305 : return FD_BINCODE_SUCCESS;
23226 13503 : }
23227 43989 : case 2: {
23228 43989 : err = fd_bpf_upgradeable_loader_state_program_decode_preflight( ctx );
23229 43989 : if( FD_UNLIKELY( err ) ) return err;
23230 28719 : return FD_BINCODE_SUCCESS;
23231 43989 : }
23232 13506 : case 3: {
23233 13506 : err = fd_bpf_upgradeable_loader_state_program_data_decode_preflight( ctx );
23234 13506 : if( FD_UNLIKELY( err ) ) return err;
23235 9312 : return FD_BINCODE_SUCCESS;
23236 13506 : }
23237 27024 : default: return FD_BINCODE_ERR_ENCODING;
23238 106278 : }
23239 106278 : }
23240 53592 : void fd_bpf_upgradeable_loader_state_inner_decode_unsafe( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23241 53592 : switch (discriminant) {
23242 8256 : case 0: {
23243 8256 : break;
23244 0 : }
23245 7305 : case 1: {
23246 7305 : fd_bpf_upgradeable_loader_state_buffer_decode_unsafe( &self->buffer, ctx );
23247 7305 : break;
23248 0 : }
23249 28719 : case 2: {
23250 28719 : fd_bpf_upgradeable_loader_state_program_decode_unsafe( &self->program, ctx );
23251 28719 : break;
23252 0 : }
23253 9312 : case 3: {
23254 9312 : fd_bpf_upgradeable_loader_state_program_data_decode_unsafe( &self->program_data, ctx );
23255 9312 : break;
23256 0 : }
23257 53592 : }
23258 53592 : }
23259 129831 : int fd_bpf_upgradeable_loader_state_decode( fd_bpf_upgradeable_loader_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
23260 129831 : void const * data = ctx->data;
23261 129831 : int err = fd_bpf_upgradeable_loader_state_decode_preflight( ctx );
23262 129831 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23263 53592 : ctx->data = data;
23264 53592 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23265 53592 : fd_bpf_upgradeable_loader_state_new( self );
23266 53592 : }
23267 53592 : fd_bpf_upgradeable_loader_state_decode_unsafe( self, ctx );
23268 53592 : return FD_BINCODE_SUCCESS;
23269 129831 : }
23270 129831 : int fd_bpf_upgradeable_loader_state_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23271 129831 : uint discriminant = 0;
23272 129831 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
23273 129831 : if( FD_UNLIKELY( err ) ) return err;
23274 106278 : return fd_bpf_upgradeable_loader_state_inner_decode_preflight( discriminant, ctx );
23275 129831 : }
23276 53592 : void fd_bpf_upgradeable_loader_state_decode_unsafe( fd_bpf_upgradeable_loader_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
23277 53592 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
23278 53592 : fd_bpf_upgradeable_loader_state_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
23279 53592 : }
23280 53592 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
23281 53592 : switch( discriminant ) {
23282 0 : case 0: {
23283 0 : break;
23284 0 : }
23285 0 : case 1: {
23286 0 : fd_bpf_upgradeable_loader_state_buffer_new( &self->buffer );
23287 0 : break;
23288 0 : }
23289 0 : case 2: {
23290 0 : fd_bpf_upgradeable_loader_state_program_new( &self->program );
23291 0 : break;
23292 0 : }
23293 0 : case 3: {
23294 0 : fd_bpf_upgradeable_loader_state_program_data_new( &self->program_data );
23295 0 : break;
23296 0 : }
23297 53592 : default: break; // FD_LOG_ERR(( "unhandled type"));
23298 53592 : }
23299 53592 : }
23300 53592 : void fd_bpf_upgradeable_loader_state_new_disc( fd_bpf_upgradeable_loader_state_t * self, uint discriminant ) {
23301 53592 : self->discriminant = discriminant;
23302 53592 : fd_bpf_upgradeable_loader_state_inner_new( &self->inner, self->discriminant );
23303 53592 : }
23304 53592 : void fd_bpf_upgradeable_loader_state_new( fd_bpf_upgradeable_loader_state_t * self ) {
23305 53592 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_t) );
23306 53592 : fd_bpf_upgradeable_loader_state_new_disc( self, UINT_MAX );
23307 53592 : }
23308 0 : void fd_bpf_upgradeable_loader_state_inner_destroy( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
23309 0 : switch( discriminant ) {
23310 0 : case 1: {
23311 0 : fd_bpf_upgradeable_loader_state_buffer_destroy( &self->buffer, ctx );
23312 0 : break;
23313 0 : }
23314 0 : case 2: {
23315 0 : fd_bpf_upgradeable_loader_state_program_destroy( &self->program, ctx );
23316 0 : break;
23317 0 : }
23318 0 : case 3: {
23319 0 : fd_bpf_upgradeable_loader_state_program_data_destroy( &self->program_data, ctx );
23320 0 : break;
23321 0 : }
23322 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
23323 0 : }
23324 0 : }
23325 0 : void fd_bpf_upgradeable_loader_state_destroy( fd_bpf_upgradeable_loader_state_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23326 0 : fd_bpf_upgradeable_loader_state_inner_destroy( &self->inner, self->discriminant, ctx );
23327 0 : }
23328 :
23329 0 : ulong fd_bpf_upgradeable_loader_state_footprint( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_FOOTPRINT; }
23330 0 : ulong fd_bpf_upgradeable_loader_state_align( void ){ return FD_BPF_UPGRADEABLE_LOADER_STATE_ALIGN; }
23331 :
23332 0 : void fd_bpf_upgradeable_loader_state_walk( void * w, fd_bpf_upgradeable_loader_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23333 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_state", level++);
23334 0 : switch( self->discriminant ) {
23335 0 : case 0: {
23336 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23337 0 : break;
23338 0 : }
23339 0 : case 1: {
23340 0 : fun( w, self, "buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23341 0 : fd_bpf_upgradeable_loader_state_buffer_walk( w, &self->inner.buffer, fun, "buffer", level );
23342 0 : break;
23343 0 : }
23344 0 : case 2: {
23345 0 : fun( w, self, "program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23346 0 : fd_bpf_upgradeable_loader_state_program_walk( w, &self->inner.program, fun, "program", level );
23347 0 : break;
23348 0 : }
23349 0 : case 3: {
23350 0 : fun( w, self, "program_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23351 0 : fd_bpf_upgradeable_loader_state_program_data_walk( w, &self->inner.program_data, fun, "program_data", level );
23352 0 : break;
23353 0 : }
23354 0 : }
23355 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_state", level-- );
23356 0 : }
23357 120 : ulong fd_bpf_upgradeable_loader_state_size( fd_bpf_upgradeable_loader_state_t const * self ) {
23358 120 : ulong size = 0;
23359 120 : size += sizeof(uint);
23360 120 : switch (self->discriminant) {
23361 60 : case 1: {
23362 60 : size += fd_bpf_upgradeable_loader_state_buffer_size( &self->inner.buffer );
23363 60 : break;
23364 0 : }
23365 0 : case 2: {
23366 0 : size += fd_bpf_upgradeable_loader_state_program_size( &self->inner.program );
23367 0 : break;
23368 0 : }
23369 60 : case 3: {
23370 60 : size += fd_bpf_upgradeable_loader_state_program_data_size( &self->inner.program_data );
23371 60 : break;
23372 0 : }
23373 120 : }
23374 120 : return size;
23375 120 : }
23376 :
23377 117 : int fd_bpf_upgradeable_loader_state_inner_encode( fd_bpf_upgradeable_loader_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
23378 117 : int err;
23379 117 : switch (discriminant) {
23380 57 : case 1: {
23381 57 : err = fd_bpf_upgradeable_loader_state_buffer_encode( &self->buffer, ctx );
23382 57 : if( FD_UNLIKELY( err ) ) return err;
23383 57 : break;
23384 57 : }
23385 57 : case 2: {
23386 0 : err = fd_bpf_upgradeable_loader_state_program_encode( &self->program, ctx );
23387 0 : if( FD_UNLIKELY( err ) ) return err;
23388 0 : break;
23389 0 : }
23390 60 : case 3: {
23391 60 : err = fd_bpf_upgradeable_loader_state_program_data_encode( &self->program_data, ctx );
23392 60 : if( FD_UNLIKELY( err ) ) return err;
23393 60 : break;
23394 60 : }
23395 117 : }
23396 117 : return FD_BINCODE_SUCCESS;
23397 117 : }
23398 117 : int fd_bpf_upgradeable_loader_state_encode( fd_bpf_upgradeable_loader_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23399 117 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
23400 117 : if( FD_UNLIKELY( err ) ) return err;
23401 117 : return fd_bpf_upgradeable_loader_state_inner_encode( &self->inner, self->discriminant, ctx );
23402 117 : }
23403 :
23404 0 : int fd_loader_v4_state_decode( fd_loader_v4_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
23405 0 : void const * data = ctx->data;
23406 0 : int err = fd_loader_v4_state_decode_preflight( ctx );
23407 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23408 0 : ctx->data = data;
23409 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23410 0 : fd_loader_v4_state_new( self );
23411 0 : }
23412 0 : fd_loader_v4_state_decode_unsafe( self, ctx );
23413 0 : return FD_BINCODE_SUCCESS;
23414 0 : }
23415 0 : int fd_loader_v4_state_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23416 0 : return fd_bincode_bytes_decode_preflight( 48, ctx );
23417 0 : }
23418 0 : void fd_loader_v4_state_decode_unsafe( fd_loader_v4_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
23419 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
23420 0 : fd_pubkey_decode_unsafe( &self->authority_address_or_next_version, ctx );
23421 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
23422 0 : }
23423 0 : int fd_loader_v4_state_encode( fd_loader_v4_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23424 0 : int err;
23425 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
23426 0 : if( FD_UNLIKELY( err ) ) return err;
23427 0 : err = fd_pubkey_encode( &self->authority_address_or_next_version, ctx );
23428 0 : if( FD_UNLIKELY( err ) ) return err;
23429 0 : err = fd_bincode_uint64_encode( self->status, ctx );
23430 0 : if( FD_UNLIKELY( err ) ) return err;
23431 0 : return FD_BINCODE_SUCCESS;
23432 0 : }
23433 0 : int fd_loader_v4_state_decode_offsets( fd_loader_v4_state_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
23434 0 : uchar const * data = ctx->data;
23435 0 : int err;
23436 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
23437 0 : err = fd_bincode_uint64_decode_preflight( ctx );
23438 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23439 0 : self->authority_address_or_next_version_off = (uint)( (ulong)ctx->data - (ulong)data );
23440 0 : err = fd_pubkey_decode_preflight( ctx );
23441 0 : if( FD_UNLIKELY( err ) ) return err;
23442 0 : self->status_off = (uint)( (ulong)ctx->data - (ulong)data );
23443 0 : err = fd_bincode_uint64_decode_preflight( ctx );
23444 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23445 0 : return FD_BINCODE_SUCCESS;
23446 0 : }
23447 0 : void fd_loader_v4_state_new(fd_loader_v4_state_t * self) {
23448 0 : fd_memset( self, 0, sizeof(fd_loader_v4_state_t) );
23449 0 : fd_pubkey_new( &self->authority_address_or_next_version );
23450 0 : }
23451 0 : void fd_loader_v4_state_destroy( fd_loader_v4_state_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23452 0 : fd_pubkey_destroy( &self->authority_address_or_next_version, ctx );
23453 0 : }
23454 :
23455 0 : ulong fd_loader_v4_state_footprint( void ){ return FD_LOADER_V4_STATE_FOOTPRINT; }
23456 0 : ulong fd_loader_v4_state_align( void ){ return FD_LOADER_V4_STATE_ALIGN; }
23457 :
23458 0 : void fd_loader_v4_state_walk( void * w, fd_loader_v4_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23459 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_state", level++ );
23460 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23461 0 : fd_pubkey_walk( w, &self->authority_address_or_next_version, fun, "authority_address_or_next_version", level );
23462 0 : fun( w, &self->status, "status", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23463 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_state", level-- );
23464 0 : }
23465 0 : ulong fd_loader_v4_state_size( fd_loader_v4_state_t const * self ) {
23466 0 : ulong size = 0;
23467 0 : size += sizeof(ulong);
23468 0 : size += fd_pubkey_size( &self->authority_address_or_next_version );
23469 0 : size += sizeof(ulong);
23470 0 : return size;
23471 0 : }
23472 :
23473 0 : int fd_frozen_hash_status_decode( fd_frozen_hash_status_t * self, fd_bincode_decode_ctx_t * ctx ) {
23474 0 : void const * data = ctx->data;
23475 0 : int err = fd_frozen_hash_status_decode_preflight( ctx );
23476 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23477 0 : ctx->data = data;
23478 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23479 0 : fd_frozen_hash_status_new( self );
23480 0 : }
23481 0 : fd_frozen_hash_status_decode_unsafe( self, ctx );
23482 0 : return FD_BINCODE_SUCCESS;
23483 0 : }
23484 0 : int fd_frozen_hash_status_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23485 0 : int err;
23486 0 : err = fd_hash_decode_preflight( ctx );
23487 0 : if( FD_UNLIKELY( err ) ) return err;
23488 0 : err = fd_bincode_bool_decode_preflight( ctx );
23489 0 : if( FD_UNLIKELY( err ) ) return err;
23490 0 : return FD_BINCODE_SUCCESS;
23491 0 : }
23492 0 : void fd_frozen_hash_status_decode_unsafe( fd_frozen_hash_status_t * self, fd_bincode_decode_ctx_t * ctx ) {
23493 0 : fd_hash_decode_unsafe( &self->frozen_hash, ctx );
23494 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
23495 0 : }
23496 0 : int fd_frozen_hash_status_encode( fd_frozen_hash_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23497 0 : int err;
23498 0 : err = fd_hash_encode( &self->frozen_hash, ctx );
23499 0 : if( FD_UNLIKELY( err ) ) return err;
23500 0 : err = fd_bincode_bool_encode( (uchar)(self->is_duplicate_confirmed), ctx );
23501 0 : if( FD_UNLIKELY( err ) ) return err;
23502 0 : return FD_BINCODE_SUCCESS;
23503 0 : }
23504 0 : int fd_frozen_hash_status_decode_offsets( fd_frozen_hash_status_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
23505 0 : uchar const * data = ctx->data;
23506 0 : int err;
23507 0 : self->frozen_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
23508 0 : err = fd_hash_decode_preflight( ctx );
23509 0 : if( FD_UNLIKELY( err ) ) return err;
23510 0 : self->is_duplicate_confirmed_off = (uint)( (ulong)ctx->data - (ulong)data );
23511 0 : err = fd_bincode_bool_decode_preflight( ctx );
23512 0 : if( FD_UNLIKELY( err ) ) return err;
23513 0 : return FD_BINCODE_SUCCESS;
23514 0 : }
23515 0 : void fd_frozen_hash_status_new(fd_frozen_hash_status_t * self) {
23516 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_status_t) );
23517 0 : fd_hash_new( &self->frozen_hash );
23518 0 : }
23519 0 : void fd_frozen_hash_status_destroy( fd_frozen_hash_status_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23520 0 : fd_hash_destroy( &self->frozen_hash, ctx );
23521 0 : }
23522 :
23523 0 : ulong fd_frozen_hash_status_footprint( void ){ return FD_FROZEN_HASH_STATUS_FOOTPRINT; }
23524 0 : ulong fd_frozen_hash_status_align( void ){ return FD_FROZEN_HASH_STATUS_ALIGN; }
23525 :
23526 0 : void fd_frozen_hash_status_walk( void * w, fd_frozen_hash_status_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23527 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_frozen_hash_status", level++ );
23528 0 : fd_hash_walk( w, &self->frozen_hash, fun, "frozen_hash", level );
23529 0 : fun( w, &self->is_duplicate_confirmed, "is_duplicate_confirmed", FD_FLAMENCO_TYPE_BOOL, "bool", level );
23530 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_frozen_hash_status", level-- );
23531 0 : }
23532 0 : ulong fd_frozen_hash_status_size( fd_frozen_hash_status_t const * self ) {
23533 0 : ulong size = 0;
23534 0 : size += fd_hash_size( &self->frozen_hash );
23535 0 : size += sizeof(char);
23536 0 : return size;
23537 0 : }
23538 :
23539 0 : FD_FN_PURE uchar fd_frozen_hash_versioned_is_current(fd_frozen_hash_versioned_t const * self) {
23540 0 : return self->discriminant == 0;
23541 0 : }
23542 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant );
23543 0 : int fd_frozen_hash_versioned_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23544 0 : int err;
23545 0 : switch (discriminant) {
23546 0 : case 0: {
23547 0 : err = fd_frozen_hash_status_decode_preflight( ctx );
23548 0 : if( FD_UNLIKELY( err ) ) return err;
23549 0 : return FD_BINCODE_SUCCESS;
23550 0 : }
23551 0 : default: return FD_BINCODE_ERR_ENCODING;
23552 0 : }
23553 0 : }
23554 0 : void fd_frozen_hash_versioned_inner_decode_unsafe( fd_frozen_hash_versioned_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23555 0 : switch (discriminant) {
23556 0 : case 0: {
23557 0 : fd_frozen_hash_status_decode_unsafe( &self->current, ctx );
23558 0 : break;
23559 0 : }
23560 0 : }
23561 0 : }
23562 0 : int fd_frozen_hash_versioned_decode( fd_frozen_hash_versioned_t * self, fd_bincode_decode_ctx_t * ctx ) {
23563 0 : void const * data = ctx->data;
23564 0 : int err = fd_frozen_hash_versioned_decode_preflight( ctx );
23565 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23566 0 : ctx->data = data;
23567 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23568 0 : fd_frozen_hash_versioned_new( self );
23569 0 : }
23570 0 : fd_frozen_hash_versioned_decode_unsafe( self, ctx );
23571 0 : return FD_BINCODE_SUCCESS;
23572 0 : }
23573 0 : int fd_frozen_hash_versioned_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23574 0 : uint discriminant = 0;
23575 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
23576 0 : if( FD_UNLIKELY( err ) ) return err;
23577 0 : return fd_frozen_hash_versioned_inner_decode_preflight( discriminant, ctx );
23578 0 : }
23579 0 : void fd_frozen_hash_versioned_decode_unsafe( fd_frozen_hash_versioned_t * self, fd_bincode_decode_ctx_t * ctx ) {
23580 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
23581 0 : fd_frozen_hash_versioned_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
23582 0 : }
23583 0 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
23584 0 : switch( discriminant ) {
23585 0 : case 0: {
23586 0 : fd_frozen_hash_status_new( &self->current );
23587 0 : break;
23588 0 : }
23589 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
23590 0 : }
23591 0 : }
23592 0 : void fd_frozen_hash_versioned_new_disc( fd_frozen_hash_versioned_t * self, uint discriminant ) {
23593 0 : self->discriminant = discriminant;
23594 0 : fd_frozen_hash_versioned_inner_new( &self->inner, self->discriminant );
23595 0 : }
23596 0 : void fd_frozen_hash_versioned_new( fd_frozen_hash_versioned_t * self ) {
23597 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_versioned_t) );
23598 0 : fd_frozen_hash_versioned_new_disc( self, UINT_MAX );
23599 0 : }
23600 0 : void fd_frozen_hash_versioned_inner_destroy( fd_frozen_hash_versioned_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
23601 0 : switch( discriminant ) {
23602 0 : case 0: {
23603 0 : fd_frozen_hash_status_destroy( &self->current, ctx );
23604 0 : break;
23605 0 : }
23606 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
23607 0 : }
23608 0 : }
23609 0 : void fd_frozen_hash_versioned_destroy( fd_frozen_hash_versioned_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23610 0 : fd_frozen_hash_versioned_inner_destroy( &self->inner, self->discriminant, ctx );
23611 0 : }
23612 :
23613 0 : ulong fd_frozen_hash_versioned_footprint( void ){ return FD_FROZEN_HASH_VERSIONED_FOOTPRINT; }
23614 0 : ulong fd_frozen_hash_versioned_align( void ){ return FD_FROZEN_HASH_VERSIONED_ALIGN; }
23615 :
23616 0 : void fd_frozen_hash_versioned_walk( void * w, fd_frozen_hash_versioned_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23617 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_frozen_hash_versioned", level++);
23618 0 : switch( self->discriminant ) {
23619 0 : case 0: {
23620 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23621 0 : fd_frozen_hash_status_walk( w, &self->inner.current, fun, "current", level );
23622 0 : break;
23623 0 : }
23624 0 : }
23625 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_frozen_hash_versioned", level-- );
23626 0 : }
23627 0 : ulong fd_frozen_hash_versioned_size( fd_frozen_hash_versioned_t const * self ) {
23628 0 : ulong size = 0;
23629 0 : size += sizeof(uint);
23630 0 : switch (self->discriminant) {
23631 0 : case 0: {
23632 0 : size += fd_frozen_hash_status_size( &self->inner.current );
23633 0 : break;
23634 0 : }
23635 0 : }
23636 0 : return size;
23637 0 : }
23638 :
23639 0 : int fd_frozen_hash_versioned_inner_encode( fd_frozen_hash_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
23640 0 : int err;
23641 0 : switch (discriminant) {
23642 0 : case 0: {
23643 0 : err = fd_frozen_hash_status_encode( &self->current, ctx );
23644 0 : if( FD_UNLIKELY( err ) ) return err;
23645 0 : break;
23646 0 : }
23647 0 : }
23648 0 : return FD_BINCODE_SUCCESS;
23649 0 : }
23650 0 : int fd_frozen_hash_versioned_encode( fd_frozen_hash_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23651 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
23652 0 : if( FD_UNLIKELY( err ) ) return err;
23653 0 : return fd_frozen_hash_versioned_inner_encode( &self->inner, self->discriminant, ctx );
23654 0 : }
23655 :
23656 0 : int fd_lookup_table_meta_decode( fd_lookup_table_meta_t * self, fd_bincode_decode_ctx_t * ctx ) {
23657 0 : void const * data = ctx->data;
23658 0 : int err = fd_lookup_table_meta_decode_preflight( ctx );
23659 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23660 0 : ctx->data = data;
23661 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23662 0 : fd_lookup_table_meta_new( self );
23663 0 : }
23664 0 : fd_lookup_table_meta_decode_unsafe( self, ctx );
23665 0 : return FD_BINCODE_SUCCESS;
23666 0 : }
23667 7569 : int fd_lookup_table_meta_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23668 7569 : int err;
23669 7569 : err = fd_bincode_uint64_decode_preflight( ctx );
23670 7569 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23671 7569 : err = fd_bincode_uint64_decode_preflight( ctx );
23672 7569 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23673 7569 : err = fd_bincode_uint8_decode_preflight( ctx );
23674 7569 : if( FD_UNLIKELY( err ) ) return err;
23675 7569 : {
23676 7569 : uchar o;
23677 7569 : err = fd_bincode_bool_decode( &o, ctx );
23678 7569 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23679 7563 : if( o ) {
23680 3858 : err = fd_pubkey_decode_preflight( ctx );
23681 3858 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23682 3858 : }
23683 7563 : }
23684 7563 : err = fd_bincode_uint16_decode_preflight( ctx );
23685 7563 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23686 7563 : return FD_BINCODE_SUCCESS;
23687 7563 : }
23688 7563 : void fd_lookup_table_meta_decode_unsafe( fd_lookup_table_meta_t * self, fd_bincode_decode_ctx_t * ctx ) {
23689 7563 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
23690 7563 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
23691 7563 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
23692 7563 : {
23693 7563 : uchar o;
23694 7563 : fd_bincode_bool_decode_unsafe( &o, ctx );
23695 7563 : self->has_authority = !!o;
23696 7563 : if( o ) {
23697 3858 : fd_pubkey_new( &self->authority );
23698 3858 : fd_pubkey_decode_unsafe( &self->authority, ctx );
23699 3858 : }
23700 7563 : }
23701 7563 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
23702 7563 : }
23703 0 : int fd_lookup_table_meta_encode( fd_lookup_table_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23704 0 : int err;
23705 0 : err = fd_bincode_uint64_encode( self->deactivation_slot, ctx );
23706 0 : if( FD_UNLIKELY( err ) ) return err;
23707 0 : err = fd_bincode_uint64_encode( self->last_extended_slot, ctx );
23708 0 : if( FD_UNLIKELY( err ) ) return err;
23709 0 : err = fd_bincode_uint8_encode( (uchar)(self->last_extended_slot_start_index), ctx );
23710 0 : if( FD_UNLIKELY( err ) ) return err;
23711 0 : err = fd_bincode_bool_encode( self->has_authority, ctx );
23712 0 : if( FD_UNLIKELY( err ) ) return err;
23713 0 : if( self->has_authority ) {
23714 0 : err = fd_pubkey_encode( &self->authority, ctx );
23715 0 : if( FD_UNLIKELY( err ) ) return err;
23716 0 : }
23717 0 : err = fd_bincode_uint16_encode( self->_padding, ctx );
23718 0 : if( FD_UNLIKELY( err ) ) return err;
23719 0 : return FD_BINCODE_SUCCESS;
23720 0 : }
23721 0 : int fd_lookup_table_meta_decode_offsets( fd_lookup_table_meta_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
23722 0 : uchar const * data = ctx->data;
23723 0 : int err;
23724 0 : self->deactivation_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
23725 0 : err = fd_bincode_uint64_decode_preflight( ctx );
23726 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23727 0 : self->last_extended_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
23728 0 : err = fd_bincode_uint64_decode_preflight( ctx );
23729 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23730 0 : self->last_extended_slot_start_index_off = (uint)( (ulong)ctx->data - (ulong)data );
23731 0 : err = fd_bincode_uint8_decode_preflight( ctx );
23732 0 : if( FD_UNLIKELY( err ) ) return err;
23733 0 : self->authority_off = (uint)( (ulong)ctx->data - (ulong)data );
23734 0 : {
23735 0 : uchar o;
23736 0 : err = fd_bincode_bool_decode( &o, ctx );
23737 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23738 0 : if( o ) {
23739 0 : err = fd_pubkey_decode_preflight( ctx );
23740 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23741 0 : }
23742 0 : }
23743 0 : self->_padding_off = (uint)( (ulong)ctx->data - (ulong)data );
23744 0 : err = fd_bincode_uint16_decode_preflight( ctx );
23745 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23746 0 : return FD_BINCODE_SUCCESS;
23747 0 : }
23748 0 : void fd_lookup_table_meta_new(fd_lookup_table_meta_t * self) {
23749 0 : fd_memset( self, 0, sizeof(fd_lookup_table_meta_t) );
23750 0 : }
23751 0 : void fd_lookup_table_meta_destroy( fd_lookup_table_meta_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23752 0 : if( self->has_authority ) {
23753 0 : fd_pubkey_destroy( &self->authority, ctx );
23754 0 : self->has_authority = 0;
23755 0 : }
23756 0 : }
23757 :
23758 0 : ulong fd_lookup_table_meta_footprint( void ){ return FD_LOOKUP_TABLE_META_FOOTPRINT; }
23759 0 : ulong fd_lookup_table_meta_align( void ){ return FD_LOOKUP_TABLE_META_ALIGN; }
23760 :
23761 0 : void fd_lookup_table_meta_walk( void * w, fd_lookup_table_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23762 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lookup_table_meta", level++ );
23763 0 : fun( w, &self->deactivation_slot, "deactivation_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23764 0 : fun( w, &self->last_extended_slot, "last_extended_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
23765 0 : fun( w, &self->last_extended_slot_start_index, "last_extended_slot_start_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
23766 0 : if( !self->has_authority ) {
23767 0 : fun( w, NULL, "authority", FD_FLAMENCO_TYPE_NULL, "pubkey", level );
23768 0 : } else {
23769 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level );
23770 0 : }
23771 0 : fun( w, &self->_padding, "_padding", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
23772 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lookup_table_meta", level-- );
23773 0 : }
23774 0 : ulong fd_lookup_table_meta_size( fd_lookup_table_meta_t const * self ) {
23775 0 : ulong size = 0;
23776 0 : size += sizeof(ulong);
23777 0 : size += sizeof(ulong);
23778 0 : size += sizeof(char);
23779 0 : size += sizeof(char);
23780 0 : if( self->has_authority ) {
23781 0 : size += fd_pubkey_size( &self->authority );
23782 0 : }
23783 0 : size += sizeof(ushort);
23784 0 : return size;
23785 0 : }
23786 :
23787 0 : int fd_address_lookup_table_decode( fd_address_lookup_table_t * self, fd_bincode_decode_ctx_t * ctx ) {
23788 0 : void const * data = ctx->data;
23789 0 : int err = fd_address_lookup_table_decode_preflight( ctx );
23790 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23791 0 : ctx->data = data;
23792 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23793 0 : fd_address_lookup_table_new( self );
23794 0 : }
23795 0 : fd_address_lookup_table_decode_unsafe( self, ctx );
23796 0 : return FD_BINCODE_SUCCESS;
23797 0 : }
23798 7569 : int fd_address_lookup_table_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23799 7569 : int err;
23800 7569 : err = fd_lookup_table_meta_decode_preflight( ctx );
23801 7569 : if( FD_UNLIKELY( err ) ) return err;
23802 7563 : return FD_BINCODE_SUCCESS;
23803 7569 : }
23804 7563 : void fd_address_lookup_table_decode_unsafe( fd_address_lookup_table_t * self, fd_bincode_decode_ctx_t * ctx ) {
23805 7563 : fd_lookup_table_meta_decode_unsafe( &self->meta, ctx );
23806 7563 : }
23807 0 : int fd_address_lookup_table_encode( fd_address_lookup_table_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23808 0 : int err;
23809 0 : err = fd_lookup_table_meta_encode( &self->meta, ctx );
23810 0 : if( FD_UNLIKELY( err ) ) return err;
23811 0 : return FD_BINCODE_SUCCESS;
23812 0 : }
23813 0 : int fd_address_lookup_table_decode_offsets( fd_address_lookup_table_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
23814 0 : uchar const * data = ctx->data;
23815 0 : int err;
23816 0 : self->meta_off = (uint)( (ulong)ctx->data - (ulong)data );
23817 0 : err = fd_lookup_table_meta_decode_preflight( ctx );
23818 0 : if( FD_UNLIKELY( err ) ) return err;
23819 0 : return FD_BINCODE_SUCCESS;
23820 0 : }
23821 0 : void fd_address_lookup_table_new(fd_address_lookup_table_t * self) {
23822 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_t) );
23823 0 : fd_lookup_table_meta_new( &self->meta );
23824 0 : }
23825 0 : void fd_address_lookup_table_destroy( fd_address_lookup_table_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23826 0 : fd_lookup_table_meta_destroy( &self->meta, ctx );
23827 0 : }
23828 :
23829 0 : ulong fd_address_lookup_table_footprint( void ){ return FD_ADDRESS_LOOKUP_TABLE_FOOTPRINT; }
23830 0 : ulong fd_address_lookup_table_align( void ){ return FD_ADDRESS_LOOKUP_TABLE_ALIGN; }
23831 :
23832 0 : void fd_address_lookup_table_walk( void * w, fd_address_lookup_table_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23833 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_address_lookup_table", level++ );
23834 0 : fd_lookup_table_meta_walk( w, &self->meta, fun, "meta", level );
23835 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_address_lookup_table", level-- );
23836 0 : }
23837 0 : ulong fd_address_lookup_table_size( fd_address_lookup_table_t const * self ) {
23838 0 : ulong size = 0;
23839 0 : size += fd_lookup_table_meta_size( &self->meta );
23840 0 : return size;
23841 0 : }
23842 :
23843 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_uninitialized(fd_address_lookup_table_state_t const * self) {
23844 0 : return self->discriminant == 0;
23845 0 : }
23846 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_lookup_table(fd_address_lookup_table_state_t const * self) {
23847 0 : return self->discriminant == 1;
23848 0 : }
23849 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant );
23850 7575 : int fd_address_lookup_table_state_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23851 7575 : int err;
23852 7575 : switch (discriminant) {
23853 3 : case 0: {
23854 3 : return FD_BINCODE_SUCCESS;
23855 0 : }
23856 7569 : case 1: {
23857 7569 : err = fd_address_lookup_table_decode_preflight( ctx );
23858 7569 : if( FD_UNLIKELY( err ) ) return err;
23859 7563 : return FD_BINCODE_SUCCESS;
23860 7569 : }
23861 3 : default: return FD_BINCODE_ERR_ENCODING;
23862 7575 : }
23863 7575 : }
23864 7566 : void fd_address_lookup_table_state_inner_decode_unsafe( fd_address_lookup_table_state_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23865 7566 : switch (discriminant) {
23866 3 : case 0: {
23867 3 : break;
23868 0 : }
23869 7563 : case 1: {
23870 7563 : fd_address_lookup_table_decode_unsafe( &self->lookup_table, ctx );
23871 7563 : break;
23872 0 : }
23873 7566 : }
23874 7566 : }
23875 7575 : int fd_address_lookup_table_state_decode( fd_address_lookup_table_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
23876 7575 : void const * data = ctx->data;
23877 7575 : int err = fd_address_lookup_table_state_decode_preflight( ctx );
23878 7575 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23879 7566 : ctx->data = data;
23880 7566 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23881 7566 : fd_address_lookup_table_state_new( self );
23882 7566 : }
23883 7566 : fd_address_lookup_table_state_decode_unsafe( self, ctx );
23884 7566 : return FD_BINCODE_SUCCESS;
23885 7575 : }
23886 7575 : int fd_address_lookup_table_state_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23887 7575 : uint discriminant = 0;
23888 7575 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
23889 7575 : if( FD_UNLIKELY( err ) ) return err;
23890 7575 : return fd_address_lookup_table_state_inner_decode_preflight( discriminant, ctx );
23891 7575 : }
23892 7566 : void fd_address_lookup_table_state_decode_unsafe( fd_address_lookup_table_state_t * self, fd_bincode_decode_ctx_t * ctx ) {
23893 7566 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
23894 7566 : fd_address_lookup_table_state_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
23895 7566 : }
23896 7566 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
23897 7566 : switch( discriminant ) {
23898 0 : case 0: {
23899 0 : break;
23900 0 : }
23901 0 : case 1: {
23902 0 : fd_address_lookup_table_new( &self->lookup_table );
23903 0 : break;
23904 0 : }
23905 7566 : default: break; // FD_LOG_ERR(( "unhandled type"));
23906 7566 : }
23907 7566 : }
23908 7566 : void fd_address_lookup_table_state_new_disc( fd_address_lookup_table_state_t * self, uint discriminant ) {
23909 7566 : self->discriminant = discriminant;
23910 7566 : fd_address_lookup_table_state_inner_new( &self->inner, self->discriminant );
23911 7566 : }
23912 7566 : void fd_address_lookup_table_state_new( fd_address_lookup_table_state_t * self ) {
23913 7566 : fd_memset( self, 0, sizeof(fd_address_lookup_table_state_t) );
23914 7566 : fd_address_lookup_table_state_new_disc( self, UINT_MAX );
23915 7566 : }
23916 0 : void fd_address_lookup_table_state_inner_destroy( fd_address_lookup_table_state_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
23917 0 : switch( discriminant ) {
23918 0 : case 1: {
23919 0 : fd_address_lookup_table_destroy( &self->lookup_table, ctx );
23920 0 : break;
23921 0 : }
23922 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
23923 0 : }
23924 0 : }
23925 0 : void fd_address_lookup_table_state_destroy( fd_address_lookup_table_state_t * self, fd_bincode_destroy_ctx_t * ctx ) {
23926 0 : fd_address_lookup_table_state_inner_destroy( &self->inner, self->discriminant, ctx );
23927 0 : }
23928 :
23929 0 : ulong fd_address_lookup_table_state_footprint( void ){ return FD_ADDRESS_LOOKUP_TABLE_STATE_FOOTPRINT; }
23930 0 : ulong fd_address_lookup_table_state_align( void ){ return FD_ADDRESS_LOOKUP_TABLE_STATE_ALIGN; }
23931 :
23932 0 : void fd_address_lookup_table_state_walk( void * w, fd_address_lookup_table_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
23933 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_address_lookup_table_state", level++);
23934 0 : switch( self->discriminant ) {
23935 0 : case 0: {
23936 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23937 0 : break;
23938 0 : }
23939 0 : case 1: {
23940 0 : fun( w, self, "lookup_table", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
23941 0 : fd_address_lookup_table_walk( w, &self->inner.lookup_table, fun, "lookup_table", level );
23942 0 : break;
23943 0 : }
23944 0 : }
23945 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_address_lookup_table_state", level-- );
23946 0 : }
23947 0 : ulong fd_address_lookup_table_state_size( fd_address_lookup_table_state_t const * self ) {
23948 0 : ulong size = 0;
23949 0 : size += sizeof(uint);
23950 0 : switch (self->discriminant) {
23951 0 : case 1: {
23952 0 : size += fd_address_lookup_table_size( &self->inner.lookup_table );
23953 0 : break;
23954 0 : }
23955 0 : }
23956 0 : return size;
23957 0 : }
23958 :
23959 0 : int fd_address_lookup_table_state_inner_encode( fd_address_lookup_table_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
23960 0 : int err;
23961 0 : switch (discriminant) {
23962 0 : case 1: {
23963 0 : err = fd_address_lookup_table_encode( &self->lookup_table, ctx );
23964 0 : if( FD_UNLIKELY( err ) ) return err;
23965 0 : break;
23966 0 : }
23967 0 : }
23968 0 : return FD_BINCODE_SUCCESS;
23969 0 : }
23970 0 : int fd_address_lookup_table_state_encode( fd_address_lookup_table_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23971 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
23972 0 : if( FD_UNLIKELY( err ) ) return err;
23973 0 : return fd_address_lookup_table_state_inner_encode( &self->inner, self->discriminant, ctx );
23974 0 : }
23975 :
23976 0 : int fd_gossip_bitvec_u8_inner_decode( fd_gossip_bitvec_u8_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
23977 0 : void const * data = ctx->data;
23978 0 : int err = fd_gossip_bitvec_u8_inner_decode_preflight( ctx );
23979 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23980 0 : ctx->data = data;
23981 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
23982 0 : fd_gossip_bitvec_u8_inner_new( self );
23983 0 : }
23984 0 : fd_gossip_bitvec_u8_inner_decode_unsafe( self, ctx );
23985 0 : return FD_BINCODE_SUCCESS;
23986 0 : }
23987 0 : int fd_gossip_bitvec_u8_inner_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
23988 0 : int err;
23989 0 : ulong vec_len;
23990 0 : err = fd_bincode_uint64_decode( &vec_len, ctx );
23991 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23992 0 : if( vec_len ) {
23993 0 : err = fd_bincode_bytes_decode_preflight( vec_len, ctx );
23994 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
23995 0 : }
23996 0 : return FD_BINCODE_SUCCESS;
23997 0 : }
23998 0 : void fd_gossip_bitvec_u8_inner_decode_unsafe( fd_gossip_bitvec_u8_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
23999 0 : fd_bincode_uint64_decode_unsafe( &self->vec_len, ctx );
24000 0 : if( self->vec_len ) {
24001 0 : self->vec = fd_valloc_malloc( ctx->valloc, 8UL, self->vec_len );
24002 0 : fd_bincode_bytes_decode_unsafe( self->vec, self->vec_len, ctx );
24003 0 : } else
24004 0 : self->vec = NULL;
24005 0 : }
24006 0 : int fd_gossip_bitvec_u8_inner_encode( fd_gossip_bitvec_u8_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24007 0 : int err;
24008 0 : err = fd_bincode_uint64_encode( self->vec_len, ctx );
24009 0 : if( FD_UNLIKELY(err) ) return err;
24010 0 : if( self->vec_len ) {
24011 0 : err = fd_bincode_bytes_encode( self->vec, self->vec_len, ctx );
24012 0 : if( FD_UNLIKELY( err ) ) return err;
24013 0 : }
24014 0 : return FD_BINCODE_SUCCESS;
24015 0 : }
24016 0 : int fd_gossip_bitvec_u8_inner_decode_offsets( fd_gossip_bitvec_u8_inner_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
24017 0 : uchar const * data = ctx->data;
24018 0 : int err;
24019 0 : self->vec_off = (uint)( (ulong)ctx->data - (ulong)data );
24020 0 : ulong vec_len;
24021 0 : err = fd_bincode_uint64_decode( &vec_len, ctx );
24022 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24023 0 : if( vec_len ) {
24024 0 : err = fd_bincode_bytes_decode_preflight( vec_len, ctx );
24025 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24026 0 : }
24027 0 : return FD_BINCODE_SUCCESS;
24028 0 : }
24029 0 : void fd_gossip_bitvec_u8_inner_new(fd_gossip_bitvec_u8_inner_t * self) {
24030 0 : fd_memset( self, 0, sizeof(fd_gossip_bitvec_u8_inner_t) );
24031 0 : }
24032 0 : void fd_gossip_bitvec_u8_inner_destroy( fd_gossip_bitvec_u8_inner_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24033 0 : if( self->vec ) {
24034 0 : fd_valloc_free( ctx->valloc, self->vec );
24035 0 : self->vec = NULL;
24036 0 : }
24037 0 : }
24038 :
24039 0 : ulong fd_gossip_bitvec_u8_inner_footprint( void ){ return FD_GOSSIP_BITVEC_U8_INNER_FOOTPRINT; }
24040 0 : ulong fd_gossip_bitvec_u8_inner_align( void ){ return FD_GOSSIP_BITVEC_U8_INNER_ALIGN; }
24041 :
24042 0 : void fd_gossip_bitvec_u8_inner_walk( void * w, fd_gossip_bitvec_u8_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24043 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_bitvec_u8_inner", level++ );
24044 0 : fun(w, self->vec, "vec", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
24045 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_bitvec_u8_inner", level-- );
24046 0 : }
24047 0 : ulong fd_gossip_bitvec_u8_inner_size( fd_gossip_bitvec_u8_inner_t const * self ) {
24048 0 : ulong size = 0;
24049 0 : do {
24050 0 : size += sizeof(ulong);
24051 0 : size += self->vec_len;
24052 0 : } while(0);
24053 0 : return size;
24054 0 : }
24055 :
24056 0 : int fd_gossip_bitvec_u8_decode( fd_gossip_bitvec_u8_t * self, fd_bincode_decode_ctx_t * ctx ) {
24057 0 : void const * data = ctx->data;
24058 0 : int err = fd_gossip_bitvec_u8_decode_preflight( ctx );
24059 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24060 0 : ctx->data = data;
24061 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
24062 0 : fd_gossip_bitvec_u8_new( self );
24063 0 : }
24064 0 : fd_gossip_bitvec_u8_decode_unsafe( self, ctx );
24065 0 : return FD_BINCODE_SUCCESS;
24066 0 : }
24067 0 : int fd_gossip_bitvec_u8_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
24068 0 : int err;
24069 0 : {
24070 0 : uchar o;
24071 0 : err = fd_bincode_bool_decode( &o, ctx );
24072 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24073 0 : if( o ) {
24074 0 : err = fd_gossip_bitvec_u8_inner_decode_preflight( ctx );
24075 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24076 0 : }
24077 0 : }
24078 0 : err = fd_bincode_uint64_decode_preflight( ctx );
24079 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24080 0 : return FD_BINCODE_SUCCESS;
24081 0 : }
24082 0 : void fd_gossip_bitvec_u8_decode_unsafe( fd_gossip_bitvec_u8_t * self, fd_bincode_decode_ctx_t * ctx ) {
24083 0 : {
24084 0 : uchar o;
24085 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
24086 0 : self->has_bits = !!o;
24087 0 : if( o ) {
24088 0 : fd_gossip_bitvec_u8_inner_new( &self->bits );
24089 0 : fd_gossip_bitvec_u8_inner_decode_unsafe( &self->bits, ctx );
24090 0 : }
24091 0 : }
24092 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
24093 0 : }
24094 0 : int fd_gossip_bitvec_u8_encode( fd_gossip_bitvec_u8_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24095 0 : int err;
24096 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
24097 0 : if( FD_UNLIKELY( err ) ) return err;
24098 0 : if( self->has_bits ) {
24099 0 : err = fd_gossip_bitvec_u8_inner_encode( &self->bits, ctx );
24100 0 : if( FD_UNLIKELY( err ) ) return err;
24101 0 : }
24102 0 : err = fd_bincode_uint64_encode( self->len, ctx );
24103 0 : if( FD_UNLIKELY( err ) ) return err;
24104 0 : return FD_BINCODE_SUCCESS;
24105 0 : }
24106 0 : int fd_gossip_bitvec_u8_decode_offsets( fd_gossip_bitvec_u8_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
24107 0 : uchar const * data = ctx->data;
24108 0 : int err;
24109 0 : self->bits_off = (uint)( (ulong)ctx->data - (ulong)data );
24110 0 : {
24111 0 : uchar o;
24112 0 : err = fd_bincode_bool_decode( &o, ctx );
24113 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24114 0 : if( o ) {
24115 0 : err = fd_gossip_bitvec_u8_inner_decode_preflight( ctx );
24116 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24117 0 : }
24118 0 : }
24119 0 : self->len_off = (uint)( (ulong)ctx->data - (ulong)data );
24120 0 : err = fd_bincode_uint64_decode_preflight( ctx );
24121 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24122 0 : return FD_BINCODE_SUCCESS;
24123 0 : }
24124 0 : void fd_gossip_bitvec_u8_new(fd_gossip_bitvec_u8_t * self) {
24125 0 : fd_memset( self, 0, sizeof(fd_gossip_bitvec_u8_t) );
24126 0 : }
24127 0 : void fd_gossip_bitvec_u8_destroy( fd_gossip_bitvec_u8_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24128 0 : if( self->has_bits ) {
24129 0 : fd_gossip_bitvec_u8_inner_destroy( &self->bits, ctx );
24130 0 : self->has_bits = 0;
24131 0 : }
24132 0 : }
24133 :
24134 0 : ulong fd_gossip_bitvec_u8_footprint( void ){ return FD_GOSSIP_BITVEC_U8_FOOTPRINT; }
24135 0 : ulong fd_gossip_bitvec_u8_align( void ){ return FD_GOSSIP_BITVEC_U8_ALIGN; }
24136 :
24137 0 : void fd_gossip_bitvec_u8_walk( void * w, fd_gossip_bitvec_u8_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24138 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_bitvec_u8", level++ );
24139 0 : if( !self->has_bits ) {
24140 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "gossip_bitvec_u8_inner", level );
24141 0 : } else {
24142 0 : fd_gossip_bitvec_u8_inner_walk( w, &self->bits, fun, "bits", level );
24143 0 : }
24144 0 : fun( w, &self->len, "len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
24145 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_bitvec_u8", level-- );
24146 0 : }
24147 0 : ulong fd_gossip_bitvec_u8_size( fd_gossip_bitvec_u8_t const * self ) {
24148 0 : ulong size = 0;
24149 0 : size += sizeof(char);
24150 0 : if( self->has_bits ) {
24151 0 : size += fd_gossip_bitvec_u8_inner_size( &self->bits );
24152 0 : }
24153 0 : size += sizeof(ulong);
24154 0 : return size;
24155 0 : }
24156 :
24157 0 : int fd_gossip_bitvec_u64_inner_decode( fd_gossip_bitvec_u64_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
24158 0 : void const * data = ctx->data;
24159 0 : int err = fd_gossip_bitvec_u64_inner_decode_preflight( ctx );
24160 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24161 0 : ctx->data = data;
24162 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
24163 0 : fd_gossip_bitvec_u64_inner_new( self );
24164 0 : }
24165 0 : fd_gossip_bitvec_u64_inner_decode_unsafe( self, ctx );
24166 0 : return FD_BINCODE_SUCCESS;
24167 0 : }
24168 3 : int fd_gossip_bitvec_u64_inner_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
24169 3 : int err;
24170 3 : ulong vec_len;
24171 3 : err = fd_bincode_uint64_decode( &vec_len, ctx );
24172 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24173 3 : if( vec_len ) {
24174 294 : for( ulong i=0; i < vec_len; i++ ) {
24175 291 : err = fd_bincode_uint64_decode_preflight( ctx );
24176 291 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24177 291 : }
24178 3 : }
24179 3 : return FD_BINCODE_SUCCESS;
24180 3 : }
24181 3 : void fd_gossip_bitvec_u64_inner_decode_unsafe( fd_gossip_bitvec_u64_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
24182 3 : fd_bincode_uint64_decode_unsafe( &self->vec_len, ctx );
24183 3 : if( self->vec_len ) {
24184 3 : self->vec = fd_valloc_malloc( ctx->valloc, 8UL, sizeof(ulong)*self->vec_len );
24185 294 : for( ulong i=0; i < self->vec_len; i++ ) {
24186 291 : fd_bincode_uint64_decode_unsafe( self->vec + i, ctx );
24187 291 : }
24188 3 : } else
24189 0 : self->vec = NULL;
24190 3 : }
24191 0 : int fd_gossip_bitvec_u64_inner_encode( fd_gossip_bitvec_u64_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24192 0 : int err;
24193 0 : err = fd_bincode_uint64_encode( self->vec_len, ctx );
24194 0 : if( FD_UNLIKELY(err) ) return err;
24195 0 : if( self->vec_len ) {
24196 0 : for( ulong i=0; i < self->vec_len; i++ ) {
24197 0 : err = fd_bincode_uint64_encode( self->vec[i], ctx );
24198 0 : }
24199 0 : }
24200 0 : return FD_BINCODE_SUCCESS;
24201 0 : }
24202 0 : int fd_gossip_bitvec_u64_inner_decode_offsets( fd_gossip_bitvec_u64_inner_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
24203 0 : uchar const * data = ctx->data;
24204 0 : int err;
24205 0 : self->vec_off = (uint)( (ulong)ctx->data - (ulong)data );
24206 0 : ulong vec_len;
24207 0 : err = fd_bincode_uint64_decode( &vec_len, ctx );
24208 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24209 0 : if( vec_len ) {
24210 0 : for( ulong i=0; i < vec_len; i++ ) {
24211 0 : err = fd_bincode_uint64_decode_preflight( ctx );
24212 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24213 0 : }
24214 0 : }
24215 0 : return FD_BINCODE_SUCCESS;
24216 0 : }
24217 3 : void fd_gossip_bitvec_u64_inner_new(fd_gossip_bitvec_u64_inner_t * self) {
24218 3 : fd_memset( self, 0, sizeof(fd_gossip_bitvec_u64_inner_t) );
24219 3 : }
24220 0 : void fd_gossip_bitvec_u64_inner_destroy( fd_gossip_bitvec_u64_inner_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24221 0 : if( self->vec ) {
24222 0 : fd_valloc_free( ctx->valloc, self->vec );
24223 0 : self->vec = NULL;
24224 0 : }
24225 0 : }
24226 :
24227 0 : ulong fd_gossip_bitvec_u64_inner_footprint( void ){ return FD_GOSSIP_BITVEC_U64_INNER_FOOTPRINT; }
24228 0 : ulong fd_gossip_bitvec_u64_inner_align( void ){ return FD_GOSSIP_BITVEC_U64_INNER_ALIGN; }
24229 :
24230 3 : void fd_gossip_bitvec_u64_inner_walk( void * w, fd_gossip_bitvec_u64_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24231 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_bitvec_u64_inner", level++ );
24232 3 : if( self->vec_len ) {
24233 3 : fun( w, NULL, "vec", FD_FLAMENCO_TYPE_ARR, "array", level++ );
24234 294 : for( ulong i=0; i < self->vec_len; i++ )
24235 291 : fun( w, self->vec + i, "vec", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
24236 3 : fun( w, NULL, "vec", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
24237 3 : }
24238 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_bitvec_u64_inner", level-- );
24239 3 : }
24240 0 : ulong fd_gossip_bitvec_u64_inner_size( fd_gossip_bitvec_u64_inner_t const * self ) {
24241 0 : ulong size = 0;
24242 0 : do {
24243 0 : size += sizeof(ulong);
24244 0 : size += self->vec_len * sizeof(ulong);
24245 0 : } while(0);
24246 0 : return size;
24247 0 : }
24248 :
24249 0 : int fd_gossip_bitvec_u64_decode( fd_gossip_bitvec_u64_t * self, fd_bincode_decode_ctx_t * ctx ) {
24250 0 : void const * data = ctx->data;
24251 0 : int err = fd_gossip_bitvec_u64_decode_preflight( ctx );
24252 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24253 0 : ctx->data = data;
24254 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
24255 0 : fd_gossip_bitvec_u64_new( self );
24256 0 : }
24257 0 : fd_gossip_bitvec_u64_decode_unsafe( self, ctx );
24258 0 : return FD_BINCODE_SUCCESS;
24259 0 : }
24260 3 : int fd_gossip_bitvec_u64_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
24261 3 : int err;
24262 3 : {
24263 3 : uchar o;
24264 3 : err = fd_bincode_bool_decode( &o, ctx );
24265 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24266 3 : if( o ) {
24267 3 : err = fd_gossip_bitvec_u64_inner_decode_preflight( ctx );
24268 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24269 3 : }
24270 3 : }
24271 3 : err = fd_bincode_uint64_decode_preflight( ctx );
24272 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24273 3 : return FD_BINCODE_SUCCESS;
24274 3 : }
24275 3 : void fd_gossip_bitvec_u64_decode_unsafe( fd_gossip_bitvec_u64_t * self, fd_bincode_decode_ctx_t * ctx ) {
24276 3 : {
24277 3 : uchar o;
24278 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
24279 3 : self->has_bits = !!o;
24280 3 : if( o ) {
24281 3 : fd_gossip_bitvec_u64_inner_new( &self->bits );
24282 3 : fd_gossip_bitvec_u64_inner_decode_unsafe( &self->bits, ctx );
24283 3 : }
24284 3 : }
24285 3 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
24286 3 : }
24287 0 : int fd_gossip_bitvec_u64_encode( fd_gossip_bitvec_u64_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24288 0 : int err;
24289 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
24290 0 : if( FD_UNLIKELY( err ) ) return err;
24291 0 : if( self->has_bits ) {
24292 0 : err = fd_gossip_bitvec_u64_inner_encode( &self->bits, ctx );
24293 0 : if( FD_UNLIKELY( err ) ) return err;
24294 0 : }
24295 0 : err = fd_bincode_uint64_encode( self->len, ctx );
24296 0 : if( FD_UNLIKELY( err ) ) return err;
24297 0 : return FD_BINCODE_SUCCESS;
24298 0 : }
24299 0 : int fd_gossip_bitvec_u64_decode_offsets( fd_gossip_bitvec_u64_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
24300 0 : uchar const * data = ctx->data;
24301 0 : int err;
24302 0 : self->bits_off = (uint)( (ulong)ctx->data - (ulong)data );
24303 0 : {
24304 0 : uchar o;
24305 0 : err = fd_bincode_bool_decode( &o, ctx );
24306 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24307 0 : if( o ) {
24308 0 : err = fd_gossip_bitvec_u64_inner_decode_preflight( ctx );
24309 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24310 0 : }
24311 0 : }
24312 0 : self->len_off = (uint)( (ulong)ctx->data - (ulong)data );
24313 0 : err = fd_bincode_uint64_decode_preflight( ctx );
24314 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24315 0 : return FD_BINCODE_SUCCESS;
24316 0 : }
24317 0 : void fd_gossip_bitvec_u64_new(fd_gossip_bitvec_u64_t * self) {
24318 0 : fd_memset( self, 0, sizeof(fd_gossip_bitvec_u64_t) );
24319 0 : }
24320 0 : void fd_gossip_bitvec_u64_destroy( fd_gossip_bitvec_u64_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24321 0 : if( self->has_bits ) {
24322 0 : fd_gossip_bitvec_u64_inner_destroy( &self->bits, ctx );
24323 0 : self->has_bits = 0;
24324 0 : }
24325 0 : }
24326 :
24327 0 : ulong fd_gossip_bitvec_u64_footprint( void ){ return FD_GOSSIP_BITVEC_U64_FOOTPRINT; }
24328 0 : ulong fd_gossip_bitvec_u64_align( void ){ return FD_GOSSIP_BITVEC_U64_ALIGN; }
24329 :
24330 3 : void fd_gossip_bitvec_u64_walk( void * w, fd_gossip_bitvec_u64_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24331 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_bitvec_u64", level++ );
24332 3 : if( !self->has_bits ) {
24333 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "gossip_bitvec_u64_inner", level );
24334 3 : } else {
24335 3 : fd_gossip_bitvec_u64_inner_walk( w, &self->bits, fun, "bits", level );
24336 3 : }
24337 3 : fun( w, &self->len, "len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
24338 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_bitvec_u64", level-- );
24339 3 : }
24340 0 : ulong fd_gossip_bitvec_u64_size( fd_gossip_bitvec_u64_t const * self ) {
24341 0 : ulong size = 0;
24342 0 : size += sizeof(char);
24343 0 : if( self->has_bits ) {
24344 0 : size += fd_gossip_bitvec_u64_inner_size( &self->bits );
24345 0 : }
24346 0 : size += sizeof(ulong);
24347 0 : return size;
24348 0 : }
24349 :
24350 0 : int fd_gossip_ping_decode( fd_gossip_ping_t * self, fd_bincode_decode_ctx_t * ctx ) {
24351 0 : void const * data = ctx->data;
24352 0 : int err = fd_gossip_ping_decode_preflight( ctx );
24353 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24354 0 : ctx->data = data;
24355 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
24356 0 : fd_gossip_ping_new( self );
24357 0 : }
24358 0 : fd_gossip_ping_decode_unsafe( self, ctx );
24359 0 : return FD_BINCODE_SUCCESS;
24360 0 : }
24361 0 : int fd_gossip_ping_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
24362 0 : return fd_bincode_bytes_decode_preflight( 128, ctx );
24363 0 : }
24364 0 : void fd_gossip_ping_decode_unsafe( fd_gossip_ping_t * self, fd_bincode_decode_ctx_t * ctx ) {
24365 0 : fd_pubkey_decode_unsafe( &self->from, ctx );
24366 0 : fd_hash_decode_unsafe( &self->token, ctx );
24367 0 : fd_signature_decode_unsafe( &self->signature, ctx );
24368 0 : }
24369 0 : int fd_gossip_ping_encode( fd_gossip_ping_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24370 0 : int err;
24371 0 : err = fd_pubkey_encode( &self->from, ctx );
24372 0 : if( FD_UNLIKELY( err ) ) return err;
24373 0 : err = fd_hash_encode( &self->token, ctx );
24374 0 : if( FD_UNLIKELY( err ) ) return err;
24375 0 : err = fd_signature_encode( &self->signature, ctx );
24376 0 : if( FD_UNLIKELY( err ) ) return err;
24377 0 : return FD_BINCODE_SUCCESS;
24378 0 : }
24379 0 : int fd_gossip_ping_decode_offsets( fd_gossip_ping_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
24380 0 : uchar const * data = ctx->data;
24381 0 : int err;
24382 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
24383 0 : err = fd_pubkey_decode_preflight( ctx );
24384 0 : if( FD_UNLIKELY( err ) ) return err;
24385 0 : self->token_off = (uint)( (ulong)ctx->data - (ulong)data );
24386 0 : err = fd_hash_decode_preflight( ctx );
24387 0 : if( FD_UNLIKELY( err ) ) return err;
24388 0 : self->signature_off = (uint)( (ulong)ctx->data - (ulong)data );
24389 0 : err = fd_signature_decode_preflight( ctx );
24390 0 : if( FD_UNLIKELY( err ) ) return err;
24391 0 : return FD_BINCODE_SUCCESS;
24392 0 : }
24393 0 : void fd_gossip_ping_new(fd_gossip_ping_t * self) {
24394 0 : fd_memset( self, 0, sizeof(fd_gossip_ping_t) );
24395 0 : fd_pubkey_new( &self->from );
24396 0 : fd_hash_new( &self->token );
24397 0 : fd_signature_new( &self->signature );
24398 0 : }
24399 0 : void fd_gossip_ping_destroy( fd_gossip_ping_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24400 0 : fd_pubkey_destroy( &self->from, ctx );
24401 0 : fd_hash_destroy( &self->token, ctx );
24402 0 : fd_signature_destroy( &self->signature, ctx );
24403 0 : }
24404 :
24405 0 : ulong fd_gossip_ping_footprint( void ){ return FD_GOSSIP_PING_FOOTPRINT; }
24406 0 : ulong fd_gossip_ping_align( void ){ return FD_GOSSIP_PING_ALIGN; }
24407 :
24408 0 : void fd_gossip_ping_walk( void * w, fd_gossip_ping_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24409 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_ping", level++ );
24410 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
24411 0 : fd_hash_walk( w, &self->token, fun, "token", level );
24412 0 : fd_signature_walk( w, &self->signature, fun, "signature", level );
24413 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_ping", level-- );
24414 0 : }
24415 0 : ulong fd_gossip_ping_size( fd_gossip_ping_t const * self ) {
24416 0 : ulong size = 0;
24417 0 : size += fd_pubkey_size( &self->from );
24418 0 : size += fd_hash_size( &self->token );
24419 0 : size += fd_signature_size( &self->signature );
24420 0 : return size;
24421 0 : }
24422 :
24423 0 : FD_FN_PURE uchar fd_gossip_ip_addr_is_ip4(fd_gossip_ip_addr_t const * self) {
24424 0 : return self->discriminant == 0;
24425 0 : }
24426 0 : FD_FN_PURE uchar fd_gossip_ip_addr_is_ip6(fd_gossip_ip_addr_t const * self) {
24427 0 : return self->discriminant == 1;
24428 0 : }
24429 : void fd_gossip_ip_addr_inner_new( fd_gossip_ip_addr_inner_t * self, uint discriminant );
24430 3 : int fd_gossip_ip_addr_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
24431 3 : int err;
24432 3 : switch (discriminant) {
24433 3 : case 0: {
24434 3 : err = fd_gossip_ip4_addr_decode_preflight( ctx );
24435 3 : if( FD_UNLIKELY( err ) ) return err;
24436 3 : return FD_BINCODE_SUCCESS;
24437 3 : }
24438 0 : case 1: {
24439 0 : err = fd_gossip_ip6_addr_decode_preflight( ctx );
24440 0 : if( FD_UNLIKELY( err ) ) return err;
24441 0 : return FD_BINCODE_SUCCESS;
24442 0 : }
24443 0 : default: return FD_BINCODE_ERR_ENCODING;
24444 3 : }
24445 3 : }
24446 3 : void fd_gossip_ip_addr_inner_decode_unsafe( fd_gossip_ip_addr_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
24447 3 : switch (discriminant) {
24448 3 : case 0: {
24449 3 : fd_gossip_ip4_addr_decode_unsafe( &self->ip4, ctx );
24450 3 : break;
24451 0 : }
24452 0 : case 1: {
24453 0 : fd_gossip_ip6_addr_decode_unsafe( &self->ip6, ctx );
24454 0 : break;
24455 0 : }
24456 3 : }
24457 3 : }
24458 0 : int fd_gossip_ip_addr_decode( fd_gossip_ip_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
24459 0 : void const * data = ctx->data;
24460 0 : int err = fd_gossip_ip_addr_decode_preflight( ctx );
24461 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24462 0 : ctx->data = data;
24463 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
24464 0 : fd_gossip_ip_addr_new( self );
24465 0 : }
24466 0 : fd_gossip_ip_addr_decode_unsafe( self, ctx );
24467 0 : return FD_BINCODE_SUCCESS;
24468 0 : }
24469 3 : int fd_gossip_ip_addr_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
24470 3 : uint discriminant = 0;
24471 3 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
24472 3 : if( FD_UNLIKELY( err ) ) return err;
24473 3 : return fd_gossip_ip_addr_inner_decode_preflight( discriminant, ctx );
24474 3 : }
24475 3 : void fd_gossip_ip_addr_decode_unsafe( fd_gossip_ip_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
24476 3 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
24477 3 : fd_gossip_ip_addr_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
24478 3 : }
24479 3 : void fd_gossip_ip_addr_inner_new( fd_gossip_ip_addr_inner_t * self, uint discriminant ) {
24480 3 : switch( discriminant ) {
24481 0 : case 0: {
24482 0 : fd_gossip_ip4_addr_new( &self->ip4 );
24483 0 : break;
24484 0 : }
24485 0 : case 1: {
24486 0 : fd_gossip_ip6_addr_new( &self->ip6 );
24487 0 : break;
24488 0 : }
24489 3 : default: break; // FD_LOG_ERR(( "unhandled type"));
24490 3 : }
24491 3 : }
24492 3 : void fd_gossip_ip_addr_new_disc( fd_gossip_ip_addr_t * self, uint discriminant ) {
24493 3 : self->discriminant = discriminant;
24494 3 : fd_gossip_ip_addr_inner_new( &self->inner, self->discriminant );
24495 3 : }
24496 3 : void fd_gossip_ip_addr_new( fd_gossip_ip_addr_t * self ) {
24497 3 : fd_memset( self, 0, sizeof(fd_gossip_ip_addr_t) );
24498 3 : fd_gossip_ip_addr_new_disc( self, UINT_MAX );
24499 3 : }
24500 0 : void fd_gossip_ip_addr_inner_destroy( fd_gossip_ip_addr_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
24501 0 : switch( discriminant ) {
24502 0 : case 0: {
24503 0 : fd_gossip_ip4_addr_destroy( &self->ip4, ctx );
24504 0 : break;
24505 0 : }
24506 0 : case 1: {
24507 0 : fd_gossip_ip6_addr_destroy( &self->ip6, ctx );
24508 0 : break;
24509 0 : }
24510 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
24511 0 : }
24512 0 : }
24513 0 : void fd_gossip_ip_addr_destroy( fd_gossip_ip_addr_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24514 0 : fd_gossip_ip_addr_inner_destroy( &self->inner, self->discriminant, ctx );
24515 0 : }
24516 :
24517 0 : ulong fd_gossip_ip_addr_footprint( void ){ return FD_GOSSIP_IP_ADDR_FOOTPRINT; }
24518 0 : ulong fd_gossip_ip_addr_align( void ){ return FD_GOSSIP_IP_ADDR_ALIGN; }
24519 :
24520 3 : void fd_gossip_ip_addr_walk( void * w, fd_gossip_ip_addr_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24521 3 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_ip_addr", level++);
24522 3 : switch( self->discriminant ) {
24523 3 : case 0: {
24524 3 : fun( w, self, "ip4", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
24525 3 : fd_gossip_ip4_addr_walk( w, &self->inner.ip4, fun, "ip4", level );
24526 3 : break;
24527 0 : }
24528 0 : case 1: {
24529 0 : fun( w, self, "ip6", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
24530 0 : fd_gossip_ip6_addr_walk( w, &self->inner.ip6, fun, "ip6", level );
24531 0 : break;
24532 0 : }
24533 3 : }
24534 3 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_ip_addr", level-- );
24535 3 : }
24536 0 : ulong fd_gossip_ip_addr_size( fd_gossip_ip_addr_t const * self ) {
24537 0 : ulong size = 0;
24538 0 : size += sizeof(uint);
24539 0 : switch (self->discriminant) {
24540 0 : case 0: {
24541 0 : size += fd_gossip_ip4_addr_size( &self->inner.ip4 );
24542 0 : break;
24543 0 : }
24544 0 : case 1: {
24545 0 : size += fd_gossip_ip6_addr_size( &self->inner.ip6 );
24546 0 : break;
24547 0 : }
24548 0 : }
24549 0 : return size;
24550 0 : }
24551 :
24552 0 : int fd_gossip_ip_addr_inner_encode( fd_gossip_ip_addr_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
24553 0 : int err;
24554 0 : switch (discriminant) {
24555 0 : case 0: {
24556 0 : err = fd_gossip_ip4_addr_encode( &self->ip4, ctx );
24557 0 : if( FD_UNLIKELY( err ) ) return err;
24558 0 : break;
24559 0 : }
24560 0 : case 1: {
24561 0 : err = fd_gossip_ip6_addr_encode( &self->ip6, ctx );
24562 0 : if( FD_UNLIKELY( err ) ) return err;
24563 0 : break;
24564 0 : }
24565 0 : }
24566 0 : return FD_BINCODE_SUCCESS;
24567 0 : }
24568 0 : int fd_gossip_ip_addr_encode( fd_gossip_ip_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24569 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
24570 0 : if( FD_UNLIKELY( err ) ) return err;
24571 0 : return fd_gossip_ip_addr_inner_encode( &self->inner, self->discriminant, ctx );
24572 0 : }
24573 :
24574 0 : int fd_gossip_prune_data_decode( fd_gossip_prune_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
24575 0 : void const * data = ctx->data;
24576 0 : int err = fd_gossip_prune_data_decode_preflight( ctx );
24577 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24578 0 : ctx->data = data;
24579 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
24580 0 : fd_gossip_prune_data_new( self );
24581 0 : }
24582 0 : fd_gossip_prune_data_decode_unsafe( self, ctx );
24583 0 : return FD_BINCODE_SUCCESS;
24584 0 : }
24585 0 : int fd_gossip_prune_data_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
24586 0 : int err;
24587 0 : err = fd_pubkey_decode_preflight( ctx );
24588 0 : if( FD_UNLIKELY( err ) ) return err;
24589 0 : ulong prunes_len;
24590 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
24591 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24592 0 : if( prunes_len ) {
24593 0 : for( ulong i=0; i < prunes_len; i++ ) {
24594 0 : err = fd_pubkey_decode_preflight( ctx );
24595 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24596 0 : }
24597 0 : }
24598 0 : err = fd_signature_decode_preflight( ctx );
24599 0 : if( FD_UNLIKELY( err ) ) return err;
24600 0 : err = fd_pubkey_decode_preflight( ctx );
24601 0 : if( FD_UNLIKELY( err ) ) return err;
24602 0 : err = fd_bincode_uint64_decode_preflight( ctx );
24603 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24604 0 : return FD_BINCODE_SUCCESS;
24605 0 : }
24606 0 : void fd_gossip_prune_data_decode_unsafe( fd_gossip_prune_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
24607 0 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
24608 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
24609 0 : if( self->prunes_len ) {
24610 0 : self->prunes = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT*self->prunes_len );
24611 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24612 0 : fd_pubkey_new( self->prunes + i );
24613 0 : fd_pubkey_decode_unsafe( self->prunes + i, ctx );
24614 0 : }
24615 0 : } else
24616 0 : self->prunes = NULL;
24617 0 : fd_signature_decode_unsafe( &self->signature, ctx );
24618 0 : fd_pubkey_decode_unsafe( &self->destination, ctx );
24619 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
24620 0 : }
24621 0 : int fd_gossip_prune_data_encode( fd_gossip_prune_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24622 0 : int err;
24623 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
24624 0 : if( FD_UNLIKELY( err ) ) return err;
24625 0 : err = fd_bincode_uint64_encode( self->prunes_len, ctx );
24626 0 : if( FD_UNLIKELY(err) ) return err;
24627 0 : if( self->prunes_len ) {
24628 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24629 0 : err = fd_pubkey_encode( self->prunes + i, ctx );
24630 0 : if( FD_UNLIKELY( err ) ) return err;
24631 0 : }
24632 0 : }
24633 0 : err = fd_signature_encode( &self->signature, ctx );
24634 0 : if( FD_UNLIKELY( err ) ) return err;
24635 0 : err = fd_pubkey_encode( &self->destination, ctx );
24636 0 : if( FD_UNLIKELY( err ) ) return err;
24637 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
24638 0 : if( FD_UNLIKELY( err ) ) return err;
24639 0 : return FD_BINCODE_SUCCESS;
24640 0 : }
24641 0 : int fd_gossip_prune_data_decode_offsets( fd_gossip_prune_data_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
24642 0 : uchar const * data = ctx->data;
24643 0 : int err;
24644 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
24645 0 : err = fd_pubkey_decode_preflight( ctx );
24646 0 : if( FD_UNLIKELY( err ) ) return err;
24647 0 : self->prunes_off = (uint)( (ulong)ctx->data - (ulong)data );
24648 0 : ulong prunes_len;
24649 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
24650 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24651 0 : if( prunes_len ) {
24652 0 : for( ulong i=0; i < prunes_len; i++ ) {
24653 0 : err = fd_pubkey_decode_preflight( ctx );
24654 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24655 0 : }
24656 0 : }
24657 0 : self->signature_off = (uint)( (ulong)ctx->data - (ulong)data );
24658 0 : err = fd_signature_decode_preflight( ctx );
24659 0 : if( FD_UNLIKELY( err ) ) return err;
24660 0 : self->destination_off = (uint)( (ulong)ctx->data - (ulong)data );
24661 0 : err = fd_pubkey_decode_preflight( ctx );
24662 0 : if( FD_UNLIKELY( err ) ) return err;
24663 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
24664 0 : err = fd_bincode_uint64_decode_preflight( ctx );
24665 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24666 0 : return FD_BINCODE_SUCCESS;
24667 0 : }
24668 0 : void fd_gossip_prune_data_new(fd_gossip_prune_data_t * self) {
24669 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_data_t) );
24670 0 : fd_pubkey_new( &self->pubkey );
24671 0 : fd_signature_new( &self->signature );
24672 0 : fd_pubkey_new( &self->destination );
24673 0 : }
24674 0 : void fd_gossip_prune_data_destroy( fd_gossip_prune_data_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24675 0 : fd_pubkey_destroy( &self->pubkey, ctx );
24676 0 : if( self->prunes ) {
24677 0 : for( ulong i=0; i < self->prunes_len; i++ )
24678 0 : fd_pubkey_destroy( self->prunes + i, ctx );
24679 0 : fd_valloc_free( ctx->valloc, self->prunes );
24680 0 : self->prunes = NULL;
24681 0 : }
24682 0 : fd_signature_destroy( &self->signature, ctx );
24683 0 : fd_pubkey_destroy( &self->destination, ctx );
24684 0 : }
24685 :
24686 0 : ulong fd_gossip_prune_data_footprint( void ){ return FD_GOSSIP_PRUNE_DATA_FOOTPRINT; }
24687 0 : ulong fd_gossip_prune_data_align( void ){ return FD_GOSSIP_PRUNE_DATA_ALIGN; }
24688 :
24689 0 : void fd_gossip_prune_data_walk( void * w, fd_gossip_prune_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24690 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_data", level++ );
24691 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
24692 0 : if( self->prunes_len ) {
24693 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
24694 0 : for( ulong i=0; i < self->prunes_len; i++ )
24695 0 : fd_pubkey_walk(w, self->prunes + i, fun, "pubkey", level );
24696 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
24697 0 : }
24698 0 : fd_signature_walk( w, &self->signature, fun, "signature", level );
24699 0 : fd_pubkey_walk( w, &self->destination, fun, "destination", level );
24700 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
24701 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_data", level-- );
24702 0 : }
24703 0 : ulong fd_gossip_prune_data_size( fd_gossip_prune_data_t const * self ) {
24704 0 : ulong size = 0;
24705 0 : size += fd_pubkey_size( &self->pubkey );
24706 0 : do {
24707 0 : size += sizeof(ulong);
24708 0 : for( ulong i=0; i < self->prunes_len; i++ )
24709 0 : size += fd_pubkey_size( self->prunes + i );
24710 0 : } while(0);
24711 0 : size += fd_signature_size( &self->signature );
24712 0 : size += fd_pubkey_size( &self->destination );
24713 0 : size += sizeof(ulong);
24714 0 : return size;
24715 0 : }
24716 :
24717 0 : int fd_gossip_prune_sign_data_decode( fd_gossip_prune_sign_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
24718 0 : void const * data = ctx->data;
24719 0 : int err = fd_gossip_prune_sign_data_decode_preflight( ctx );
24720 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24721 0 : ctx->data = data;
24722 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
24723 0 : fd_gossip_prune_sign_data_new( self );
24724 0 : }
24725 0 : fd_gossip_prune_sign_data_decode_unsafe( self, ctx );
24726 0 : return FD_BINCODE_SUCCESS;
24727 0 : }
24728 0 : int fd_gossip_prune_sign_data_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
24729 0 : int err;
24730 0 : err = fd_pubkey_decode_preflight( ctx );
24731 0 : if( FD_UNLIKELY( err ) ) return err;
24732 0 : ulong prunes_len;
24733 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
24734 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24735 0 : if( prunes_len ) {
24736 0 : for( ulong i=0; i < prunes_len; i++ ) {
24737 0 : err = fd_pubkey_decode_preflight( ctx );
24738 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24739 0 : }
24740 0 : }
24741 0 : err = fd_pubkey_decode_preflight( ctx );
24742 0 : if( FD_UNLIKELY( err ) ) return err;
24743 0 : err = fd_bincode_uint64_decode_preflight( ctx );
24744 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24745 0 : return FD_BINCODE_SUCCESS;
24746 0 : }
24747 0 : void fd_gossip_prune_sign_data_decode_unsafe( fd_gossip_prune_sign_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
24748 0 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
24749 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
24750 0 : if( self->prunes_len ) {
24751 0 : self->prunes = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT*self->prunes_len );
24752 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24753 0 : fd_pubkey_new( self->prunes + i );
24754 0 : fd_pubkey_decode_unsafe( self->prunes + i, ctx );
24755 0 : }
24756 0 : } else
24757 0 : self->prunes = NULL;
24758 0 : fd_pubkey_decode_unsafe( &self->destination, ctx );
24759 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
24760 0 : }
24761 0 : int fd_gossip_prune_sign_data_encode( fd_gossip_prune_sign_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24762 0 : int err;
24763 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
24764 0 : if( FD_UNLIKELY( err ) ) return err;
24765 0 : err = fd_bincode_uint64_encode( self->prunes_len, ctx );
24766 0 : if( FD_UNLIKELY(err) ) return err;
24767 0 : if( self->prunes_len ) {
24768 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
24769 0 : err = fd_pubkey_encode( self->prunes + i, ctx );
24770 0 : if( FD_UNLIKELY( err ) ) return err;
24771 0 : }
24772 0 : }
24773 0 : err = fd_pubkey_encode( &self->destination, ctx );
24774 0 : if( FD_UNLIKELY( err ) ) return err;
24775 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
24776 0 : if( FD_UNLIKELY( err ) ) return err;
24777 0 : return FD_BINCODE_SUCCESS;
24778 0 : }
24779 0 : int fd_gossip_prune_sign_data_decode_offsets( fd_gossip_prune_sign_data_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
24780 0 : uchar const * data = ctx->data;
24781 0 : int err;
24782 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
24783 0 : err = fd_pubkey_decode_preflight( ctx );
24784 0 : if( FD_UNLIKELY( err ) ) return err;
24785 0 : self->prunes_off = (uint)( (ulong)ctx->data - (ulong)data );
24786 0 : ulong prunes_len;
24787 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
24788 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24789 0 : if( prunes_len ) {
24790 0 : for( ulong i=0; i < prunes_len; i++ ) {
24791 0 : err = fd_pubkey_decode_preflight( ctx );
24792 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24793 0 : }
24794 0 : }
24795 0 : self->destination_off = (uint)( (ulong)ctx->data - (ulong)data );
24796 0 : err = fd_pubkey_decode_preflight( ctx );
24797 0 : if( FD_UNLIKELY( err ) ) return err;
24798 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
24799 0 : err = fd_bincode_uint64_decode_preflight( ctx );
24800 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24801 0 : return FD_BINCODE_SUCCESS;
24802 0 : }
24803 0 : void fd_gossip_prune_sign_data_new(fd_gossip_prune_sign_data_t * self) {
24804 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_sign_data_t) );
24805 0 : fd_pubkey_new( &self->pubkey );
24806 0 : fd_pubkey_new( &self->destination );
24807 0 : }
24808 0 : void fd_gossip_prune_sign_data_destroy( fd_gossip_prune_sign_data_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24809 0 : fd_pubkey_destroy( &self->pubkey, ctx );
24810 0 : if( self->prunes ) {
24811 0 : for( ulong i=0; i < self->prunes_len; i++ )
24812 0 : fd_pubkey_destroy( self->prunes + i, ctx );
24813 0 : fd_valloc_free( ctx->valloc, self->prunes );
24814 0 : self->prunes = NULL;
24815 0 : }
24816 0 : fd_pubkey_destroy( &self->destination, ctx );
24817 0 : }
24818 :
24819 0 : ulong fd_gossip_prune_sign_data_footprint( void ){ return FD_GOSSIP_PRUNE_SIGN_DATA_FOOTPRINT; }
24820 0 : ulong fd_gossip_prune_sign_data_align( void ){ return FD_GOSSIP_PRUNE_SIGN_DATA_ALIGN; }
24821 :
24822 0 : void fd_gossip_prune_sign_data_walk( void * w, fd_gossip_prune_sign_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24823 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_sign_data", level++ );
24824 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
24825 0 : if( self->prunes_len ) {
24826 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
24827 0 : for( ulong i=0; i < self->prunes_len; i++ )
24828 0 : fd_pubkey_walk(w, self->prunes + i, fun, "pubkey", level );
24829 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
24830 0 : }
24831 0 : fd_pubkey_walk( w, &self->destination, fun, "destination", level );
24832 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
24833 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_sign_data", level-- );
24834 0 : }
24835 0 : ulong fd_gossip_prune_sign_data_size( fd_gossip_prune_sign_data_t const * self ) {
24836 0 : ulong size = 0;
24837 0 : size += fd_pubkey_size( &self->pubkey );
24838 0 : do {
24839 0 : size += sizeof(ulong);
24840 0 : for( ulong i=0; i < self->prunes_len; i++ )
24841 0 : size += fd_pubkey_size( self->prunes + i );
24842 0 : } while(0);
24843 0 : size += fd_pubkey_size( &self->destination );
24844 0 : size += sizeof(ulong);
24845 0 : return size;
24846 0 : }
24847 :
24848 0 : int fd_gossip_prune_sign_data_with_prefix_decode( fd_gossip_prune_sign_data_with_prefix_t * self, fd_bincode_decode_ctx_t * ctx ) {
24849 0 : void const * data = ctx->data;
24850 0 : int err = fd_gossip_prune_sign_data_with_prefix_decode_preflight( ctx );
24851 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24852 0 : ctx->data = data;
24853 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
24854 0 : fd_gossip_prune_sign_data_with_prefix_new( self );
24855 0 : }
24856 0 : fd_gossip_prune_sign_data_with_prefix_decode_unsafe( self, ctx );
24857 0 : return FD_BINCODE_SUCCESS;
24858 0 : }
24859 0 : int fd_gossip_prune_sign_data_with_prefix_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
24860 0 : int err;
24861 0 : ulong prefix_len;
24862 0 : err = fd_bincode_uint64_decode( &prefix_len, ctx );
24863 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24864 0 : if( prefix_len ) {
24865 0 : err = fd_bincode_bytes_decode_preflight( prefix_len, ctx );
24866 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24867 0 : err = !fd_utf8_verify( (char const *) ctx->data - prefix_len, prefix_len );
24868 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24869 0 : }
24870 0 : err = fd_gossip_prune_sign_data_decode_preflight( ctx );
24871 0 : if( FD_UNLIKELY( err ) ) return err;
24872 0 : return FD_BINCODE_SUCCESS;
24873 0 : }
24874 0 : void fd_gossip_prune_sign_data_with_prefix_decode_unsafe( fd_gossip_prune_sign_data_with_prefix_t * self, fd_bincode_decode_ctx_t * ctx ) {
24875 0 : fd_bincode_uint64_decode_unsafe( &self->prefix_len, ctx );
24876 0 : if( self->prefix_len ) {
24877 0 : self->prefix = fd_valloc_malloc( ctx->valloc, 8UL, self->prefix_len );
24878 0 : fd_bincode_bytes_decode_unsafe( self->prefix, self->prefix_len, ctx );
24879 0 : } else
24880 0 : self->prefix = NULL;
24881 0 : fd_gossip_prune_sign_data_decode_unsafe( &self->data, ctx );
24882 0 : }
24883 0 : int fd_gossip_prune_sign_data_with_prefix_encode( fd_gossip_prune_sign_data_with_prefix_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24884 0 : int err;
24885 0 : err = fd_bincode_uint64_encode( self->prefix_len, ctx );
24886 0 : if( FD_UNLIKELY(err) ) return err;
24887 0 : if( self->prefix_len ) {
24888 0 : err = fd_bincode_bytes_encode( self->prefix, self->prefix_len, ctx );
24889 0 : if( FD_UNLIKELY( err ) ) return err;
24890 0 : }
24891 0 : err = fd_gossip_prune_sign_data_encode( &self->data, ctx );
24892 0 : if( FD_UNLIKELY( err ) ) return err;
24893 0 : return FD_BINCODE_SUCCESS;
24894 0 : }
24895 0 : int fd_gossip_prune_sign_data_with_prefix_decode_offsets( fd_gossip_prune_sign_data_with_prefix_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
24896 0 : uchar const * data = ctx->data;
24897 0 : int err;
24898 0 : self->prefix_off = (uint)( (ulong)ctx->data - (ulong)data );
24899 0 : ulong prefix_len;
24900 0 : err = fd_bincode_uint64_decode( &prefix_len, ctx );
24901 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24902 0 : if( prefix_len ) {
24903 0 : err = fd_bincode_bytes_decode_preflight( prefix_len, ctx );
24904 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24905 0 : err = !fd_utf8_verify( (char const *) ctx->data - prefix_len, prefix_len );
24906 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24907 0 : }
24908 0 : self->data_off = (uint)( (ulong)ctx->data - (ulong)data );
24909 0 : err = fd_gossip_prune_sign_data_decode_preflight( ctx );
24910 0 : if( FD_UNLIKELY( err ) ) return err;
24911 0 : return FD_BINCODE_SUCCESS;
24912 0 : }
24913 0 : void fd_gossip_prune_sign_data_with_prefix_new(fd_gossip_prune_sign_data_with_prefix_t * self) {
24914 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_sign_data_with_prefix_t) );
24915 0 : fd_gossip_prune_sign_data_new( &self->data );
24916 0 : }
24917 0 : void fd_gossip_prune_sign_data_with_prefix_destroy( fd_gossip_prune_sign_data_with_prefix_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24918 0 : if( self->prefix ) {
24919 0 : fd_valloc_free( ctx->valloc, self->prefix );
24920 0 : self->prefix = NULL;
24921 0 : }
24922 0 : fd_gossip_prune_sign_data_destroy( &self->data, ctx );
24923 0 : }
24924 :
24925 0 : ulong fd_gossip_prune_sign_data_with_prefix_footprint( void ){ return FD_GOSSIP_PRUNE_SIGN_DATA_WITH_PREFIX_FOOTPRINT; }
24926 0 : ulong fd_gossip_prune_sign_data_with_prefix_align( void ){ return FD_GOSSIP_PRUNE_SIGN_DATA_WITH_PREFIX_ALIGN; }
24927 :
24928 0 : void fd_gossip_prune_sign_data_with_prefix_walk( void * w, fd_gossip_prune_sign_data_with_prefix_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24929 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_sign_data_with_prefix", level++ );
24930 0 : fun(w, self->prefix, "prefix", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
24931 0 : fd_gossip_prune_sign_data_walk( w, &self->data, fun, "data", level );
24932 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_sign_data_with_prefix", level-- );
24933 0 : }
24934 0 : ulong fd_gossip_prune_sign_data_with_prefix_size( fd_gossip_prune_sign_data_with_prefix_t const * self ) {
24935 0 : ulong size = 0;
24936 0 : do {
24937 0 : size += sizeof(ulong);
24938 0 : size += self->prefix_len;
24939 0 : } while(0);
24940 0 : size += fd_gossip_prune_sign_data_size( &self->data );
24941 0 : return size;
24942 0 : }
24943 :
24944 0 : int fd_gossip_socket_addr_old_decode( fd_gossip_socket_addr_old_t * self, fd_bincode_decode_ctx_t * ctx ) {
24945 0 : void const * data = ctx->data;
24946 0 : int err = fd_gossip_socket_addr_old_decode_preflight( ctx );
24947 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24948 0 : ctx->data = data;
24949 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
24950 0 : fd_gossip_socket_addr_old_new( self );
24951 0 : }
24952 0 : fd_gossip_socket_addr_old_decode_unsafe( self, ctx );
24953 0 : return FD_BINCODE_SUCCESS;
24954 0 : }
24955 0 : int fd_gossip_socket_addr_old_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
24956 0 : int err;
24957 0 : err = fd_gossip_ip_addr_decode_preflight( ctx );
24958 0 : if( FD_UNLIKELY( err ) ) return err;
24959 0 : err = fd_bincode_uint16_decode_preflight( ctx );
24960 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24961 0 : return FD_BINCODE_SUCCESS;
24962 0 : }
24963 0 : void fd_gossip_socket_addr_old_decode_unsafe( fd_gossip_socket_addr_old_t * self, fd_bincode_decode_ctx_t * ctx ) {
24964 0 : fd_gossip_ip_addr_decode_unsafe( &self->addr, ctx );
24965 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
24966 0 : }
24967 0 : int fd_gossip_socket_addr_old_encode( fd_gossip_socket_addr_old_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24968 0 : int err;
24969 0 : err = fd_gossip_ip_addr_encode( &self->addr, ctx );
24970 0 : if( FD_UNLIKELY( err ) ) return err;
24971 0 : err = fd_bincode_uint16_encode( self->port, ctx );
24972 0 : if( FD_UNLIKELY( err ) ) return err;
24973 0 : return FD_BINCODE_SUCCESS;
24974 0 : }
24975 0 : int fd_gossip_socket_addr_old_decode_offsets( fd_gossip_socket_addr_old_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
24976 0 : uchar const * data = ctx->data;
24977 0 : int err;
24978 0 : self->addr_off = (uint)( (ulong)ctx->data - (ulong)data );
24979 0 : err = fd_gossip_ip_addr_decode_preflight( ctx );
24980 0 : if( FD_UNLIKELY( err ) ) return err;
24981 0 : self->port_off = (uint)( (ulong)ctx->data - (ulong)data );
24982 0 : err = fd_bincode_uint16_decode_preflight( ctx );
24983 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24984 0 : return FD_BINCODE_SUCCESS;
24985 0 : }
24986 0 : void fd_gossip_socket_addr_old_new(fd_gossip_socket_addr_old_t * self) {
24987 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_old_t) );
24988 0 : fd_gossip_ip_addr_new( &self->addr );
24989 0 : }
24990 0 : void fd_gossip_socket_addr_old_destroy( fd_gossip_socket_addr_old_t * self, fd_bincode_destroy_ctx_t * ctx ) {
24991 0 : fd_gossip_ip_addr_destroy( &self->addr, ctx );
24992 0 : }
24993 :
24994 0 : ulong fd_gossip_socket_addr_old_footprint( void ){ return FD_GOSSIP_SOCKET_ADDR_OLD_FOOTPRINT; }
24995 0 : ulong fd_gossip_socket_addr_old_align( void ){ return FD_GOSSIP_SOCKET_ADDR_OLD_ALIGN; }
24996 :
24997 0 : void fd_gossip_socket_addr_old_walk( void * w, fd_gossip_socket_addr_old_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
24998 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_old", level++ );
24999 0 : fd_gossip_ip_addr_walk( w, &self->addr, fun, "addr", level );
25000 0 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
25001 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_old", level-- );
25002 0 : }
25003 0 : ulong fd_gossip_socket_addr_old_size( fd_gossip_socket_addr_old_t const * self ) {
25004 0 : ulong size = 0;
25005 0 : size += fd_gossip_ip_addr_size( &self->addr );
25006 0 : size += sizeof(ushort);
25007 0 : return size;
25008 0 : }
25009 :
25010 0 : int fd_gossip_socket_addr_ip4_decode( fd_gossip_socket_addr_ip4_t * self, fd_bincode_decode_ctx_t * ctx ) {
25011 0 : void const * data = ctx->data;
25012 0 : int err = fd_gossip_socket_addr_ip4_decode_preflight( ctx );
25013 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25014 0 : ctx->data = data;
25015 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
25016 0 : fd_gossip_socket_addr_ip4_new( self );
25017 0 : }
25018 0 : fd_gossip_socket_addr_ip4_decode_unsafe( self, ctx );
25019 0 : return FD_BINCODE_SUCCESS;
25020 0 : }
25021 90 : int fd_gossip_socket_addr_ip4_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
25022 90 : int err;
25023 90 : err = fd_gossip_ip4_addr_decode_preflight( ctx );
25024 90 : if( FD_UNLIKELY( err ) ) return err;
25025 90 : err = fd_bincode_uint16_decode_preflight( ctx );
25026 90 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25027 90 : return FD_BINCODE_SUCCESS;
25028 90 : }
25029 90 : void fd_gossip_socket_addr_ip4_decode_unsafe( fd_gossip_socket_addr_ip4_t * self, fd_bincode_decode_ctx_t * ctx ) {
25030 90 : fd_gossip_ip4_addr_decode_unsafe( &self->addr, ctx );
25031 90 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
25032 90 : }
25033 0 : int fd_gossip_socket_addr_ip4_encode( fd_gossip_socket_addr_ip4_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25034 0 : int err;
25035 0 : err = fd_gossip_ip4_addr_encode( &self->addr, ctx );
25036 0 : if( FD_UNLIKELY( err ) ) return err;
25037 0 : err = fd_bincode_uint16_encode( self->port, ctx );
25038 0 : if( FD_UNLIKELY( err ) ) return err;
25039 0 : return FD_BINCODE_SUCCESS;
25040 0 : }
25041 0 : int fd_gossip_socket_addr_ip4_decode_offsets( fd_gossip_socket_addr_ip4_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
25042 0 : uchar const * data = ctx->data;
25043 0 : int err;
25044 0 : self->addr_off = (uint)( (ulong)ctx->data - (ulong)data );
25045 0 : err = fd_gossip_ip4_addr_decode_preflight( ctx );
25046 0 : if( FD_UNLIKELY( err ) ) return err;
25047 0 : self->port_off = (uint)( (ulong)ctx->data - (ulong)data );
25048 0 : err = fd_bincode_uint16_decode_preflight( ctx );
25049 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25050 0 : return FD_BINCODE_SUCCESS;
25051 0 : }
25052 0 : void fd_gossip_socket_addr_ip4_new(fd_gossip_socket_addr_ip4_t * self) {
25053 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_ip4_t) );
25054 0 : fd_gossip_ip4_addr_new( &self->addr );
25055 0 : }
25056 0 : void fd_gossip_socket_addr_ip4_destroy( fd_gossip_socket_addr_ip4_t * self, fd_bincode_destroy_ctx_t * ctx ) {
25057 0 : fd_gossip_ip4_addr_destroy( &self->addr, ctx );
25058 0 : }
25059 :
25060 0 : ulong fd_gossip_socket_addr_ip4_footprint( void ){ return FD_GOSSIP_SOCKET_ADDR_IP4_FOOTPRINT; }
25061 0 : ulong fd_gossip_socket_addr_ip4_align( void ){ return FD_GOSSIP_SOCKET_ADDR_IP4_ALIGN; }
25062 :
25063 90 : void fd_gossip_socket_addr_ip4_walk( void * w, fd_gossip_socket_addr_ip4_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25064 90 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_ip4", level++ );
25065 90 : fd_gossip_ip4_addr_walk( w, &self->addr, fun, "addr", level );
25066 90 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
25067 90 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_ip4", level-- );
25068 90 : }
25069 0 : ulong fd_gossip_socket_addr_ip4_size( fd_gossip_socket_addr_ip4_t const * self ) {
25070 0 : ulong size = 0;
25071 0 : size += fd_gossip_ip4_addr_size( &self->addr );
25072 0 : size += sizeof(ushort);
25073 0 : return size;
25074 0 : }
25075 :
25076 0 : int fd_gossip_socket_addr_ip6_decode( fd_gossip_socket_addr_ip6_t * self, fd_bincode_decode_ctx_t * ctx ) {
25077 0 : void const * data = ctx->data;
25078 0 : int err = fd_gossip_socket_addr_ip6_decode_preflight( ctx );
25079 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25080 0 : ctx->data = data;
25081 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
25082 0 : fd_gossip_socket_addr_ip6_new( self );
25083 0 : }
25084 0 : fd_gossip_socket_addr_ip6_decode_unsafe( self, ctx );
25085 0 : return FD_BINCODE_SUCCESS;
25086 0 : }
25087 0 : int fd_gossip_socket_addr_ip6_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
25088 0 : int err;
25089 0 : err = fd_gossip_ip6_addr_decode_preflight( ctx );
25090 0 : if( FD_UNLIKELY( err ) ) return err;
25091 0 : err = fd_bincode_uint16_decode_preflight( ctx );
25092 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25093 0 : err = fd_bincode_uint32_decode_preflight( ctx );
25094 0 : if( FD_UNLIKELY( err ) ) return err;
25095 0 : err = fd_bincode_uint32_decode_preflight( ctx );
25096 0 : if( FD_UNLIKELY( err ) ) return err;
25097 0 : return FD_BINCODE_SUCCESS;
25098 0 : }
25099 0 : void fd_gossip_socket_addr_ip6_decode_unsafe( fd_gossip_socket_addr_ip6_t * self, fd_bincode_decode_ctx_t * ctx ) {
25100 0 : fd_gossip_ip6_addr_decode_unsafe( &self->addr, ctx );
25101 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
25102 0 : fd_bincode_uint32_decode_unsafe( &self->flowinfo, ctx );
25103 0 : fd_bincode_uint32_decode_unsafe( &self->scope_id, ctx );
25104 0 : }
25105 0 : int fd_gossip_socket_addr_ip6_encode( fd_gossip_socket_addr_ip6_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25106 0 : int err;
25107 0 : err = fd_gossip_ip6_addr_encode( &self->addr, ctx );
25108 0 : if( FD_UNLIKELY( err ) ) return err;
25109 0 : err = fd_bincode_uint16_encode( self->port, ctx );
25110 0 : if( FD_UNLIKELY( err ) ) return err;
25111 0 : err = fd_bincode_uint32_encode( self->flowinfo, ctx );
25112 0 : if( FD_UNLIKELY( err ) ) return err;
25113 0 : err = fd_bincode_uint32_encode( self->scope_id, ctx );
25114 0 : if( FD_UNLIKELY( err ) ) return err;
25115 0 : return FD_BINCODE_SUCCESS;
25116 0 : }
25117 0 : int fd_gossip_socket_addr_ip6_decode_offsets( fd_gossip_socket_addr_ip6_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
25118 0 : uchar const * data = ctx->data;
25119 0 : int err;
25120 0 : self->addr_off = (uint)( (ulong)ctx->data - (ulong)data );
25121 0 : err = fd_gossip_ip6_addr_decode_preflight( ctx );
25122 0 : if( FD_UNLIKELY( err ) ) return err;
25123 0 : self->port_off = (uint)( (ulong)ctx->data - (ulong)data );
25124 0 : err = fd_bincode_uint16_decode_preflight( ctx );
25125 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25126 0 : self->flowinfo_off = (uint)( (ulong)ctx->data - (ulong)data );
25127 0 : err = fd_bincode_uint32_decode_preflight( ctx );
25128 0 : if( FD_UNLIKELY( err ) ) return err;
25129 0 : self->scope_id_off = (uint)( (ulong)ctx->data - (ulong)data );
25130 0 : err = fd_bincode_uint32_decode_preflight( ctx );
25131 0 : if( FD_UNLIKELY( err ) ) return err;
25132 0 : return FD_BINCODE_SUCCESS;
25133 0 : }
25134 0 : void fd_gossip_socket_addr_ip6_new(fd_gossip_socket_addr_ip6_t * self) {
25135 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_ip6_t) );
25136 0 : fd_gossip_ip6_addr_new( &self->addr );
25137 0 : }
25138 0 : void fd_gossip_socket_addr_ip6_destroy( fd_gossip_socket_addr_ip6_t * self, fd_bincode_destroy_ctx_t * ctx ) {
25139 0 : fd_gossip_ip6_addr_destroy( &self->addr, ctx );
25140 0 : }
25141 :
25142 0 : ulong fd_gossip_socket_addr_ip6_footprint( void ){ return FD_GOSSIP_SOCKET_ADDR_IP6_FOOTPRINT; }
25143 0 : ulong fd_gossip_socket_addr_ip6_align( void ){ return FD_GOSSIP_SOCKET_ADDR_IP6_ALIGN; }
25144 :
25145 0 : void fd_gossip_socket_addr_ip6_walk( void * w, fd_gossip_socket_addr_ip6_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25146 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_ip6", level++ );
25147 0 : fd_gossip_ip6_addr_walk( w, &self->addr, fun, "addr", level );
25148 0 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
25149 0 : fun( w, &self->flowinfo, "flowinfo", FD_FLAMENCO_TYPE_UINT, "uint", level );
25150 0 : fun( w, &self->scope_id, "scope_id", FD_FLAMENCO_TYPE_UINT, "uint", level );
25151 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_ip6", level-- );
25152 0 : }
25153 0 : ulong fd_gossip_socket_addr_ip6_size( fd_gossip_socket_addr_ip6_t const * self ) {
25154 0 : ulong size = 0;
25155 0 : size += fd_gossip_ip6_addr_size( &self->addr );
25156 0 : size += sizeof(ushort);
25157 0 : size += sizeof(uint);
25158 0 : size += sizeof(uint);
25159 0 : return size;
25160 0 : }
25161 :
25162 0 : FD_FN_PURE uchar fd_gossip_socket_addr_is_ip4(fd_gossip_socket_addr_t const * self) {
25163 0 : return self->discriminant == 0;
25164 0 : }
25165 0 : FD_FN_PURE uchar fd_gossip_socket_addr_is_ip6(fd_gossip_socket_addr_t const * self) {
25166 0 : return self->discriminant == 1;
25167 0 : }
25168 : void fd_gossip_socket_addr_inner_new( fd_gossip_socket_addr_inner_t * self, uint discriminant );
25169 90 : int fd_gossip_socket_addr_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
25170 90 : int err;
25171 90 : switch (discriminant) {
25172 90 : case 0: {
25173 90 : err = fd_gossip_socket_addr_ip4_decode_preflight( ctx );
25174 90 : if( FD_UNLIKELY( err ) ) return err;
25175 90 : return FD_BINCODE_SUCCESS;
25176 90 : }
25177 0 : case 1: {
25178 0 : err = fd_gossip_socket_addr_ip6_decode_preflight( ctx );
25179 0 : if( FD_UNLIKELY( err ) ) return err;
25180 0 : return FD_BINCODE_SUCCESS;
25181 0 : }
25182 0 : default: return FD_BINCODE_ERR_ENCODING;
25183 90 : }
25184 90 : }
25185 90 : void fd_gossip_socket_addr_inner_decode_unsafe( fd_gossip_socket_addr_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
25186 90 : switch (discriminant) {
25187 90 : case 0: {
25188 90 : fd_gossip_socket_addr_ip4_decode_unsafe( &self->ip4, ctx );
25189 90 : break;
25190 0 : }
25191 0 : case 1: {
25192 0 : fd_gossip_socket_addr_ip6_decode_unsafe( &self->ip6, ctx );
25193 0 : break;
25194 0 : }
25195 90 : }
25196 90 : }
25197 0 : int fd_gossip_socket_addr_decode( fd_gossip_socket_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
25198 0 : void const * data = ctx->data;
25199 0 : int err = fd_gossip_socket_addr_decode_preflight( ctx );
25200 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25201 0 : ctx->data = data;
25202 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
25203 0 : fd_gossip_socket_addr_new( self );
25204 0 : }
25205 0 : fd_gossip_socket_addr_decode_unsafe( self, ctx );
25206 0 : return FD_BINCODE_SUCCESS;
25207 0 : }
25208 90 : int fd_gossip_socket_addr_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
25209 90 : uint discriminant = 0;
25210 90 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
25211 90 : if( FD_UNLIKELY( err ) ) return err;
25212 90 : return fd_gossip_socket_addr_inner_decode_preflight( discriminant, ctx );
25213 90 : }
25214 90 : void fd_gossip_socket_addr_decode_unsafe( fd_gossip_socket_addr_t * self, fd_bincode_decode_ctx_t * ctx ) {
25215 90 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
25216 90 : fd_gossip_socket_addr_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
25217 90 : }
25218 0 : void fd_gossip_socket_addr_inner_new( fd_gossip_socket_addr_inner_t * self, uint discriminant ) {
25219 0 : switch( discriminant ) {
25220 0 : case 0: {
25221 0 : fd_gossip_socket_addr_ip4_new( &self->ip4 );
25222 0 : break;
25223 0 : }
25224 0 : case 1: {
25225 0 : fd_gossip_socket_addr_ip6_new( &self->ip6 );
25226 0 : break;
25227 0 : }
25228 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
25229 0 : }
25230 0 : }
25231 0 : void fd_gossip_socket_addr_new_disc( fd_gossip_socket_addr_t * self, uint discriminant ) {
25232 0 : self->discriminant = discriminant;
25233 0 : fd_gossip_socket_addr_inner_new( &self->inner, self->discriminant );
25234 0 : }
25235 0 : void fd_gossip_socket_addr_new( fd_gossip_socket_addr_t * self ) {
25236 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_t) );
25237 0 : fd_gossip_socket_addr_new_disc( self, UINT_MAX );
25238 0 : }
25239 0 : void fd_gossip_socket_addr_inner_destroy( fd_gossip_socket_addr_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
25240 0 : switch( discriminant ) {
25241 0 : case 0: {
25242 0 : fd_gossip_socket_addr_ip4_destroy( &self->ip4, ctx );
25243 0 : break;
25244 0 : }
25245 0 : case 1: {
25246 0 : fd_gossip_socket_addr_ip6_destroy( &self->ip6, ctx );
25247 0 : break;
25248 0 : }
25249 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
25250 0 : }
25251 0 : }
25252 0 : void fd_gossip_socket_addr_destroy( fd_gossip_socket_addr_t * self, fd_bincode_destroy_ctx_t * ctx ) {
25253 0 : fd_gossip_socket_addr_inner_destroy( &self->inner, self->discriminant, ctx );
25254 0 : }
25255 :
25256 0 : ulong fd_gossip_socket_addr_footprint( void ){ return FD_GOSSIP_SOCKET_ADDR_FOOTPRINT; }
25257 0 : ulong fd_gossip_socket_addr_align( void ){ return FD_GOSSIP_SOCKET_ADDR_ALIGN; }
25258 :
25259 90 : void fd_gossip_socket_addr_walk( void * w, fd_gossip_socket_addr_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25260 90 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_socket_addr", level++);
25261 90 : switch( self->discriminant ) {
25262 90 : case 0: {
25263 90 : fun( w, self, "ip4", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
25264 90 : fd_gossip_socket_addr_ip4_walk( w, &self->inner.ip4, fun, "ip4", level );
25265 90 : break;
25266 0 : }
25267 0 : case 1: {
25268 0 : fun( w, self, "ip6", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
25269 0 : fd_gossip_socket_addr_ip6_walk( w, &self->inner.ip6, fun, "ip6", level );
25270 0 : break;
25271 0 : }
25272 90 : }
25273 90 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_socket_addr", level-- );
25274 90 : }
25275 0 : ulong fd_gossip_socket_addr_size( fd_gossip_socket_addr_t const * self ) {
25276 0 : ulong size = 0;
25277 0 : size += sizeof(uint);
25278 0 : switch (self->discriminant) {
25279 0 : case 0: {
25280 0 : size += fd_gossip_socket_addr_ip4_size( &self->inner.ip4 );
25281 0 : break;
25282 0 : }
25283 0 : case 1: {
25284 0 : size += fd_gossip_socket_addr_ip6_size( &self->inner.ip6 );
25285 0 : break;
25286 0 : }
25287 0 : }
25288 0 : return size;
25289 0 : }
25290 :
25291 0 : int fd_gossip_socket_addr_inner_encode( fd_gossip_socket_addr_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
25292 0 : int err;
25293 0 : switch (discriminant) {
25294 0 : case 0: {
25295 0 : err = fd_gossip_socket_addr_ip4_encode( &self->ip4, ctx );
25296 0 : if( FD_UNLIKELY( err ) ) return err;
25297 0 : break;
25298 0 : }
25299 0 : case 1: {
25300 0 : err = fd_gossip_socket_addr_ip6_encode( &self->ip6, ctx );
25301 0 : if( FD_UNLIKELY( err ) ) return err;
25302 0 : break;
25303 0 : }
25304 0 : }
25305 0 : return FD_BINCODE_SUCCESS;
25306 0 : }
25307 0 : int fd_gossip_socket_addr_encode( fd_gossip_socket_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25308 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
25309 0 : if( FD_UNLIKELY( err ) ) return err;
25310 0 : return fd_gossip_socket_addr_inner_encode( &self->inner, self->discriminant, ctx );
25311 0 : }
25312 :
25313 0 : int fd_gossip_contact_info_v1_decode( fd_gossip_contact_info_v1_t * self, fd_bincode_decode_ctx_t * ctx ) {
25314 0 : void const * data = ctx->data;
25315 0 : int err = fd_gossip_contact_info_v1_decode_preflight( ctx );
25316 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25317 0 : ctx->data = data;
25318 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
25319 0 : fd_gossip_contact_info_v1_new( self );
25320 0 : }
25321 0 : fd_gossip_contact_info_v1_decode_unsafe( self, ctx );
25322 0 : return FD_BINCODE_SUCCESS;
25323 0 : }
25324 9 : int fd_gossip_contact_info_v1_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
25325 9 : int err;
25326 9 : err = fd_pubkey_decode_preflight( ctx );
25327 9 : if( FD_UNLIKELY( err ) ) return err;
25328 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25329 9 : if( FD_UNLIKELY( err ) ) return err;
25330 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25331 9 : if( FD_UNLIKELY( err ) ) return err;
25332 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25333 9 : if( FD_UNLIKELY( err ) ) return err;
25334 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25335 9 : if( FD_UNLIKELY( err ) ) return err;
25336 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25337 9 : if( FD_UNLIKELY( err ) ) return err;
25338 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25339 9 : if( FD_UNLIKELY( err ) ) return err;
25340 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25341 9 : if( FD_UNLIKELY( err ) ) return err;
25342 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25343 9 : if( FD_UNLIKELY( err ) ) return err;
25344 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25345 9 : if( FD_UNLIKELY( err ) ) return err;
25346 9 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25347 9 : if( FD_UNLIKELY( err ) ) return err;
25348 9 : err = fd_bincode_uint64_decode_preflight( ctx );
25349 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25350 9 : err = fd_bincode_uint16_decode_preflight( ctx );
25351 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25352 9 : return FD_BINCODE_SUCCESS;
25353 9 : }
25354 9 : void fd_gossip_contact_info_v1_decode_unsafe( fd_gossip_contact_info_v1_t * self, fd_bincode_decode_ctx_t * ctx ) {
25355 9 : fd_pubkey_decode_unsafe( &self->id, ctx );
25356 9 : fd_gossip_socket_addr_decode_unsafe( &self->gossip, ctx );
25357 9 : fd_gossip_socket_addr_decode_unsafe( &self->tvu, ctx );
25358 9 : fd_gossip_socket_addr_decode_unsafe( &self->tvu_fwd, ctx );
25359 9 : fd_gossip_socket_addr_decode_unsafe( &self->repair, ctx );
25360 9 : fd_gossip_socket_addr_decode_unsafe( &self->tpu, ctx );
25361 9 : fd_gossip_socket_addr_decode_unsafe( &self->tpu_fwd, ctx );
25362 9 : fd_gossip_socket_addr_decode_unsafe( &self->tpu_vote, ctx );
25363 9 : fd_gossip_socket_addr_decode_unsafe( &self->rpc, ctx );
25364 9 : fd_gossip_socket_addr_decode_unsafe( &self->rpc_pubsub, ctx );
25365 9 : fd_gossip_socket_addr_decode_unsafe( &self->serve_repair, ctx );
25366 9 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25367 9 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
25368 9 : }
25369 0 : int fd_gossip_contact_info_v1_encode( fd_gossip_contact_info_v1_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25370 0 : int err;
25371 0 : err = fd_pubkey_encode( &self->id, ctx );
25372 0 : if( FD_UNLIKELY( err ) ) return err;
25373 0 : err = fd_gossip_socket_addr_encode( &self->gossip, ctx );
25374 0 : if( FD_UNLIKELY( err ) ) return err;
25375 0 : err = fd_gossip_socket_addr_encode( &self->tvu, ctx );
25376 0 : if( FD_UNLIKELY( err ) ) return err;
25377 0 : err = fd_gossip_socket_addr_encode( &self->tvu_fwd, ctx );
25378 0 : if( FD_UNLIKELY( err ) ) return err;
25379 0 : err = fd_gossip_socket_addr_encode( &self->repair, ctx );
25380 0 : if( FD_UNLIKELY( err ) ) return err;
25381 0 : err = fd_gossip_socket_addr_encode( &self->tpu, ctx );
25382 0 : if( FD_UNLIKELY( err ) ) return err;
25383 0 : err = fd_gossip_socket_addr_encode( &self->tpu_fwd, ctx );
25384 0 : if( FD_UNLIKELY( err ) ) return err;
25385 0 : err = fd_gossip_socket_addr_encode( &self->tpu_vote, ctx );
25386 0 : if( FD_UNLIKELY( err ) ) return err;
25387 0 : err = fd_gossip_socket_addr_encode( &self->rpc, ctx );
25388 0 : if( FD_UNLIKELY( err ) ) return err;
25389 0 : err = fd_gossip_socket_addr_encode( &self->rpc_pubsub, ctx );
25390 0 : if( FD_UNLIKELY( err ) ) return err;
25391 0 : err = fd_gossip_socket_addr_encode( &self->serve_repair, ctx );
25392 0 : if( FD_UNLIKELY( err ) ) return err;
25393 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
25394 0 : if( FD_UNLIKELY( err ) ) return err;
25395 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
25396 0 : if( FD_UNLIKELY( err ) ) return err;
25397 0 : return FD_BINCODE_SUCCESS;
25398 0 : }
25399 0 : int fd_gossip_contact_info_v1_decode_offsets( fd_gossip_contact_info_v1_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
25400 0 : uchar const * data = ctx->data;
25401 0 : int err;
25402 0 : self->id_off = (uint)( (ulong)ctx->data - (ulong)data );
25403 0 : err = fd_pubkey_decode_preflight( ctx );
25404 0 : if( FD_UNLIKELY( err ) ) return err;
25405 0 : self->gossip_off = (uint)( (ulong)ctx->data - (ulong)data );
25406 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25407 0 : if( FD_UNLIKELY( err ) ) return err;
25408 0 : self->tvu_off = (uint)( (ulong)ctx->data - (ulong)data );
25409 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25410 0 : if( FD_UNLIKELY( err ) ) return err;
25411 0 : self->tvu_fwd_off = (uint)( (ulong)ctx->data - (ulong)data );
25412 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25413 0 : if( FD_UNLIKELY( err ) ) return err;
25414 0 : self->repair_off = (uint)( (ulong)ctx->data - (ulong)data );
25415 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25416 0 : if( FD_UNLIKELY( err ) ) return err;
25417 0 : self->tpu_off = (uint)( (ulong)ctx->data - (ulong)data );
25418 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25419 0 : if( FD_UNLIKELY( err ) ) return err;
25420 0 : self->tpu_fwd_off = (uint)( (ulong)ctx->data - (ulong)data );
25421 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25422 0 : if( FD_UNLIKELY( err ) ) return err;
25423 0 : self->tpu_vote_off = (uint)( (ulong)ctx->data - (ulong)data );
25424 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25425 0 : if( FD_UNLIKELY( err ) ) return err;
25426 0 : self->rpc_off = (uint)( (ulong)ctx->data - (ulong)data );
25427 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25428 0 : if( FD_UNLIKELY( err ) ) return err;
25429 0 : self->rpc_pubsub_off = (uint)( (ulong)ctx->data - (ulong)data );
25430 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25431 0 : if( FD_UNLIKELY( err ) ) return err;
25432 0 : self->serve_repair_off = (uint)( (ulong)ctx->data - (ulong)data );
25433 0 : err = fd_gossip_socket_addr_decode_preflight( ctx );
25434 0 : if( FD_UNLIKELY( err ) ) return err;
25435 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
25436 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25437 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25438 0 : self->shred_version_off = (uint)( (ulong)ctx->data - (ulong)data );
25439 0 : err = fd_bincode_uint16_decode_preflight( ctx );
25440 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25441 0 : return FD_BINCODE_SUCCESS;
25442 0 : }
25443 0 : void fd_gossip_contact_info_v1_new(fd_gossip_contact_info_v1_t * self) {
25444 0 : fd_memset( self, 0, sizeof(fd_gossip_contact_info_v1_t) );
25445 0 : fd_pubkey_new( &self->id );
25446 0 : fd_gossip_socket_addr_new( &self->gossip );
25447 0 : fd_gossip_socket_addr_new( &self->tvu );
25448 0 : fd_gossip_socket_addr_new( &self->tvu_fwd );
25449 0 : fd_gossip_socket_addr_new( &self->repair );
25450 0 : fd_gossip_socket_addr_new( &self->tpu );
25451 0 : fd_gossip_socket_addr_new( &self->tpu_fwd );
25452 0 : fd_gossip_socket_addr_new( &self->tpu_vote );
25453 0 : fd_gossip_socket_addr_new( &self->rpc );
25454 0 : fd_gossip_socket_addr_new( &self->rpc_pubsub );
25455 0 : fd_gossip_socket_addr_new( &self->serve_repair );
25456 0 : }
25457 0 : void fd_gossip_contact_info_v1_destroy( fd_gossip_contact_info_v1_t * self, fd_bincode_destroy_ctx_t * ctx ) {
25458 0 : fd_pubkey_destroy( &self->id, ctx );
25459 0 : fd_gossip_socket_addr_destroy( &self->gossip, ctx );
25460 0 : fd_gossip_socket_addr_destroy( &self->tvu, ctx );
25461 0 : fd_gossip_socket_addr_destroy( &self->tvu_fwd, ctx );
25462 0 : fd_gossip_socket_addr_destroy( &self->repair, ctx );
25463 0 : fd_gossip_socket_addr_destroy( &self->tpu, ctx );
25464 0 : fd_gossip_socket_addr_destroy( &self->tpu_fwd, ctx );
25465 0 : fd_gossip_socket_addr_destroy( &self->tpu_vote, ctx );
25466 0 : fd_gossip_socket_addr_destroy( &self->rpc, ctx );
25467 0 : fd_gossip_socket_addr_destroy( &self->rpc_pubsub, ctx );
25468 0 : fd_gossip_socket_addr_destroy( &self->serve_repair, ctx );
25469 0 : }
25470 :
25471 0 : ulong fd_gossip_contact_info_v1_footprint( void ){ return FD_GOSSIP_CONTACT_INFO_V1_FOOTPRINT; }
25472 0 : ulong fd_gossip_contact_info_v1_align( void ){ return FD_GOSSIP_CONTACT_INFO_V1_ALIGN; }
25473 :
25474 9 : void fd_gossip_contact_info_v1_walk( void * w, fd_gossip_contact_info_v1_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25475 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_contact_info_v1", level++ );
25476 9 : fd_pubkey_walk( w, &self->id, fun, "id", level );
25477 9 : fd_gossip_socket_addr_walk( w, &self->gossip, fun, "gossip", level );
25478 9 : fd_gossip_socket_addr_walk( w, &self->tvu, fun, "tvu", level );
25479 9 : fd_gossip_socket_addr_walk( w, &self->tvu_fwd, fun, "tvu_fwd", level );
25480 9 : fd_gossip_socket_addr_walk( w, &self->repair, fun, "repair", level );
25481 9 : fd_gossip_socket_addr_walk( w, &self->tpu, fun, "tpu", level );
25482 9 : fd_gossip_socket_addr_walk( w, &self->tpu_fwd, fun, "tpu_fwd", level );
25483 9 : fd_gossip_socket_addr_walk( w, &self->tpu_vote, fun, "tpu_vote", level );
25484 9 : fd_gossip_socket_addr_walk( w, &self->rpc, fun, "rpc", level );
25485 9 : fd_gossip_socket_addr_walk( w, &self->rpc_pubsub, fun, "rpc_pubsub", level );
25486 9 : fd_gossip_socket_addr_walk( w, &self->serve_repair, fun, "serve_repair", level );
25487 9 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25488 9 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
25489 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_contact_info_v1", level-- );
25490 9 : }
25491 0 : ulong fd_gossip_contact_info_v1_size( fd_gossip_contact_info_v1_t const * self ) {
25492 0 : ulong size = 0;
25493 0 : size += fd_pubkey_size( &self->id );
25494 0 : size += fd_gossip_socket_addr_size( &self->gossip );
25495 0 : size += fd_gossip_socket_addr_size( &self->tvu );
25496 0 : size += fd_gossip_socket_addr_size( &self->tvu_fwd );
25497 0 : size += fd_gossip_socket_addr_size( &self->repair );
25498 0 : size += fd_gossip_socket_addr_size( &self->tpu );
25499 0 : size += fd_gossip_socket_addr_size( &self->tpu_fwd );
25500 0 : size += fd_gossip_socket_addr_size( &self->tpu_vote );
25501 0 : size += fd_gossip_socket_addr_size( &self->rpc );
25502 0 : size += fd_gossip_socket_addr_size( &self->rpc_pubsub );
25503 0 : size += fd_gossip_socket_addr_size( &self->serve_repair );
25504 0 : size += sizeof(ulong);
25505 0 : size += sizeof(ushort);
25506 0 : return size;
25507 0 : }
25508 :
25509 0 : int fd_gossip_vote_decode( fd_gossip_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
25510 0 : void const * data = ctx->data;
25511 0 : int err = fd_gossip_vote_decode_preflight( ctx );
25512 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25513 0 : ctx->data = data;
25514 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
25515 0 : fd_gossip_vote_new( self );
25516 0 : }
25517 0 : fd_gossip_vote_decode_unsafe( self, ctx );
25518 0 : return FD_BINCODE_SUCCESS;
25519 0 : }
25520 6 : int fd_gossip_vote_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
25521 6 : int err;
25522 6 : err = fd_bincode_uint8_decode_preflight( ctx );
25523 6 : if( FD_UNLIKELY( err ) ) return err;
25524 6 : err = fd_pubkey_decode_preflight( ctx );
25525 6 : if( FD_UNLIKELY( err ) ) return err;
25526 6 : err = fd_flamenco_txn_decode_preflight( ctx );
25527 6 : if( FD_UNLIKELY( err ) ) return err;
25528 6 : err = fd_bincode_uint64_decode_preflight( ctx );
25529 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25530 6 : return FD_BINCODE_SUCCESS;
25531 6 : }
25532 6 : void fd_gossip_vote_decode_unsafe( fd_gossip_vote_t * self, fd_bincode_decode_ctx_t * ctx ) {
25533 6 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
25534 6 : fd_pubkey_decode_unsafe( &self->from, ctx );
25535 6 : fd_flamenco_txn_decode_unsafe( &self->txn, ctx );
25536 6 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25537 6 : }
25538 0 : int fd_gossip_vote_encode( fd_gossip_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25539 0 : int err;
25540 0 : err = fd_bincode_uint8_encode( (uchar)(self->index), ctx );
25541 0 : if( FD_UNLIKELY( err ) ) return err;
25542 0 : err = fd_pubkey_encode( &self->from, ctx );
25543 0 : if( FD_UNLIKELY( err ) ) return err;
25544 0 : err = fd_flamenco_txn_encode( &self->txn, ctx );
25545 0 : if( FD_UNLIKELY( err ) ) return err;
25546 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
25547 0 : if( FD_UNLIKELY( err ) ) return err;
25548 0 : return FD_BINCODE_SUCCESS;
25549 0 : }
25550 0 : int fd_gossip_vote_decode_offsets( fd_gossip_vote_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
25551 0 : uchar const * data = ctx->data;
25552 0 : int err;
25553 0 : self->index_off = (uint)( (ulong)ctx->data - (ulong)data );
25554 0 : err = fd_bincode_uint8_decode_preflight( ctx );
25555 0 : if( FD_UNLIKELY( err ) ) return err;
25556 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
25557 0 : err = fd_pubkey_decode_preflight( ctx );
25558 0 : if( FD_UNLIKELY( err ) ) return err;
25559 0 : self->txn_off = (uint)( (ulong)ctx->data - (ulong)data );
25560 0 : err = fd_flamenco_txn_decode_preflight( ctx );
25561 0 : if( FD_UNLIKELY( err ) ) return err;
25562 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
25563 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25564 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25565 0 : return FD_BINCODE_SUCCESS;
25566 0 : }
25567 0 : void fd_gossip_vote_new(fd_gossip_vote_t * self) {
25568 0 : fd_memset( self, 0, sizeof(fd_gossip_vote_t) );
25569 0 : fd_pubkey_new( &self->from );
25570 0 : fd_flamenco_txn_new( &self->txn );
25571 0 : }
25572 0 : void fd_gossip_vote_destroy( fd_gossip_vote_t * self, fd_bincode_destroy_ctx_t * ctx ) {
25573 0 : fd_pubkey_destroy( &self->from, ctx );
25574 0 : fd_flamenco_txn_destroy( &self->txn, ctx );
25575 0 : }
25576 :
25577 0 : ulong fd_gossip_vote_footprint( void ){ return FD_GOSSIP_VOTE_FOOTPRINT; }
25578 0 : ulong fd_gossip_vote_align( void ){ return FD_GOSSIP_VOTE_ALIGN; }
25579 :
25580 6 : void fd_gossip_vote_walk( void * w, fd_gossip_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25581 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_vote", level++ );
25582 6 : fun( w, &self->index, "index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
25583 6 : fd_pubkey_walk( w, &self->from, fun, "from", level );
25584 6 : fd_flamenco_txn_walk( w, &self->txn, fun, "txn", level );
25585 6 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25586 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_vote", level-- );
25587 6 : }
25588 0 : ulong fd_gossip_vote_size( fd_gossip_vote_t const * self ) {
25589 0 : ulong size = 0;
25590 0 : size += sizeof(char);
25591 0 : size += fd_pubkey_size( &self->from );
25592 0 : size += fd_flamenco_txn_size( &self->txn );
25593 0 : size += sizeof(ulong);
25594 0 : return size;
25595 0 : }
25596 :
25597 0 : int fd_gossip_lowest_slot_decode( fd_gossip_lowest_slot_t * self, fd_bincode_decode_ctx_t * ctx ) {
25598 0 : void const * data = ctx->data;
25599 0 : int err = fd_gossip_lowest_slot_decode_preflight( ctx );
25600 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25601 0 : ctx->data = data;
25602 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
25603 0 : fd_gossip_lowest_slot_new( self );
25604 0 : }
25605 0 : fd_gossip_lowest_slot_decode_unsafe( self, ctx );
25606 0 : return FD_BINCODE_SUCCESS;
25607 0 : }
25608 0 : int fd_gossip_lowest_slot_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
25609 0 : int err;
25610 0 : err = fd_bincode_uint8_decode_preflight( ctx );
25611 0 : if( FD_UNLIKELY( err ) ) return err;
25612 0 : err = fd_pubkey_decode_preflight( ctx );
25613 0 : if( FD_UNLIKELY( err ) ) return err;
25614 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25615 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25616 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25617 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25618 0 : ulong slots_len;
25619 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
25620 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25621 0 : if( slots_len ) {
25622 0 : for( ulong i=0; i < slots_len; i++ ) {
25623 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25624 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25625 0 : }
25626 0 : }
25627 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25628 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25629 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25630 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25631 0 : return FD_BINCODE_SUCCESS;
25632 0 : }
25633 0 : void fd_gossip_lowest_slot_decode_unsafe( fd_gossip_lowest_slot_t * self, fd_bincode_decode_ctx_t * ctx ) {
25634 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
25635 0 : fd_pubkey_decode_unsafe( &self->from, ctx );
25636 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
25637 0 : fd_bincode_uint64_decode_unsafe( &self->lowest, ctx );
25638 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
25639 0 : if( self->slots_len ) {
25640 0 : self->slots = fd_valloc_malloc( ctx->valloc, 8UL, sizeof(ulong)*self->slots_len );
25641 0 : for( ulong i=0; i < self->slots_len; i++ ) {
25642 0 : fd_bincode_uint64_decode_unsafe( self->slots + i, ctx );
25643 0 : }
25644 0 : } else
25645 0 : self->slots = NULL;
25646 0 : fd_bincode_uint64_decode_unsafe( &self->i_dont_know, ctx );
25647 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25648 0 : }
25649 0 : int fd_gossip_lowest_slot_encode( fd_gossip_lowest_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25650 0 : int err;
25651 0 : err = fd_bincode_uint8_encode( (uchar)(self->u8), ctx );
25652 0 : if( FD_UNLIKELY( err ) ) return err;
25653 0 : err = fd_pubkey_encode( &self->from, ctx );
25654 0 : if( FD_UNLIKELY( err ) ) return err;
25655 0 : err = fd_bincode_uint64_encode( self->root, ctx );
25656 0 : if( FD_UNLIKELY( err ) ) return err;
25657 0 : err = fd_bincode_uint64_encode( self->lowest, ctx );
25658 0 : if( FD_UNLIKELY( err ) ) return err;
25659 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
25660 0 : if( FD_UNLIKELY(err) ) return err;
25661 0 : if( self->slots_len ) {
25662 0 : for( ulong i=0; i < self->slots_len; i++ ) {
25663 0 : err = fd_bincode_uint64_encode( self->slots[i], ctx );
25664 0 : }
25665 0 : }
25666 0 : err = fd_bincode_uint64_encode( self->i_dont_know, ctx );
25667 0 : if( FD_UNLIKELY( err ) ) return err;
25668 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
25669 0 : if( FD_UNLIKELY( err ) ) return err;
25670 0 : return FD_BINCODE_SUCCESS;
25671 0 : }
25672 0 : int fd_gossip_lowest_slot_decode_offsets( fd_gossip_lowest_slot_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
25673 0 : uchar const * data = ctx->data;
25674 0 : int err;
25675 0 : self->u8_off = (uint)( (ulong)ctx->data - (ulong)data );
25676 0 : err = fd_bincode_uint8_decode_preflight( ctx );
25677 0 : if( FD_UNLIKELY( err ) ) return err;
25678 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
25679 0 : err = fd_pubkey_decode_preflight( ctx );
25680 0 : if( FD_UNLIKELY( err ) ) return err;
25681 0 : self->root_off = (uint)( (ulong)ctx->data - (ulong)data );
25682 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25683 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25684 0 : self->lowest_off = (uint)( (ulong)ctx->data - (ulong)data );
25685 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25686 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25687 0 : self->slots_off = (uint)( (ulong)ctx->data - (ulong)data );
25688 0 : ulong slots_len;
25689 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
25690 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25691 0 : if( slots_len ) {
25692 0 : for( ulong i=0; i < slots_len; i++ ) {
25693 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25694 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25695 0 : }
25696 0 : }
25697 0 : self->i_dont_know_off = (uint)( (ulong)ctx->data - (ulong)data );
25698 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25699 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25700 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
25701 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25702 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25703 0 : return FD_BINCODE_SUCCESS;
25704 0 : }
25705 0 : void fd_gossip_lowest_slot_new(fd_gossip_lowest_slot_t * self) {
25706 0 : fd_memset( self, 0, sizeof(fd_gossip_lowest_slot_t) );
25707 0 : fd_pubkey_new( &self->from );
25708 0 : }
25709 0 : void fd_gossip_lowest_slot_destroy( fd_gossip_lowest_slot_t * self, fd_bincode_destroy_ctx_t * ctx ) {
25710 0 : fd_pubkey_destroy( &self->from, ctx );
25711 0 : if( self->slots ) {
25712 0 : fd_valloc_free( ctx->valloc, self->slots );
25713 0 : self->slots = NULL;
25714 0 : }
25715 0 : }
25716 :
25717 0 : ulong fd_gossip_lowest_slot_footprint( void ){ return FD_GOSSIP_LOWEST_SLOT_FOOTPRINT; }
25718 0 : ulong fd_gossip_lowest_slot_align( void ){ return FD_GOSSIP_LOWEST_SLOT_ALIGN; }
25719 :
25720 0 : void fd_gossip_lowest_slot_walk( void * w, fd_gossip_lowest_slot_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25721 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_lowest_slot", level++ );
25722 0 : fun( w, &self->u8, "u8", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
25723 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
25724 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25725 0 : fun( w, &self->lowest, "lowest", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25726 0 : if( self->slots_len ) {
25727 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR, "array", level++ );
25728 0 : for( ulong i=0; i < self->slots_len; i++ )
25729 0 : fun( w, self->slots + i, "slots", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25730 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
25731 0 : }
25732 0 : fun( w, &self->i_dont_know, "i_dont_know", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25733 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25734 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_lowest_slot", level-- );
25735 0 : }
25736 0 : ulong fd_gossip_lowest_slot_size( fd_gossip_lowest_slot_t const * self ) {
25737 0 : ulong size = 0;
25738 0 : size += sizeof(char);
25739 0 : size += fd_pubkey_size( &self->from );
25740 0 : size += sizeof(ulong);
25741 0 : size += sizeof(ulong);
25742 0 : do {
25743 0 : size += sizeof(ulong);
25744 0 : size += self->slots_len * sizeof(ulong);
25745 0 : } while(0);
25746 0 : size += sizeof(ulong);
25747 0 : size += sizeof(ulong);
25748 0 : return size;
25749 0 : }
25750 :
25751 0 : int fd_gossip_slot_hashes_decode( fd_gossip_slot_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
25752 0 : void const * data = ctx->data;
25753 0 : int err = fd_gossip_slot_hashes_decode_preflight( ctx );
25754 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25755 0 : ctx->data = data;
25756 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
25757 0 : fd_gossip_slot_hashes_new( self );
25758 0 : }
25759 0 : fd_gossip_slot_hashes_decode_unsafe( self, ctx );
25760 0 : return FD_BINCODE_SUCCESS;
25761 0 : }
25762 3 : int fd_gossip_slot_hashes_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
25763 3 : int err;
25764 3 : err = fd_pubkey_decode_preflight( ctx );
25765 3 : if( FD_UNLIKELY( err ) ) return err;
25766 3 : ulong hashes_len;
25767 3 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
25768 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25769 3 : if( hashes_len ) {
25770 6 : for( ulong i=0; i < hashes_len; i++ ) {
25771 3 : err = fd_slot_hash_decode_preflight( ctx );
25772 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25773 3 : }
25774 3 : }
25775 3 : err = fd_bincode_uint64_decode_preflight( ctx );
25776 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25777 3 : return FD_BINCODE_SUCCESS;
25778 3 : }
25779 3 : void fd_gossip_slot_hashes_decode_unsafe( fd_gossip_slot_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
25780 3 : fd_pubkey_decode_unsafe( &self->from, ctx );
25781 3 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
25782 3 : if( self->hashes_len ) {
25783 3 : self->hashes = (fd_slot_hash_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_HASH_ALIGN, FD_SLOT_HASH_FOOTPRINT*self->hashes_len );
25784 6 : for( ulong i=0; i < self->hashes_len; i++ ) {
25785 3 : fd_slot_hash_new( self->hashes + i );
25786 3 : fd_slot_hash_decode_unsafe( self->hashes + i, ctx );
25787 3 : }
25788 3 : } else
25789 0 : self->hashes = NULL;
25790 3 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
25791 3 : }
25792 0 : int fd_gossip_slot_hashes_encode( fd_gossip_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25793 0 : int err;
25794 0 : err = fd_pubkey_encode( &self->from, ctx );
25795 0 : if( FD_UNLIKELY( err ) ) return err;
25796 0 : err = fd_bincode_uint64_encode( self->hashes_len, ctx );
25797 0 : if( FD_UNLIKELY(err) ) return err;
25798 0 : if( self->hashes_len ) {
25799 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
25800 0 : err = fd_slot_hash_encode( self->hashes + i, ctx );
25801 0 : if( FD_UNLIKELY( err ) ) return err;
25802 0 : }
25803 0 : }
25804 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
25805 0 : if( FD_UNLIKELY( err ) ) return err;
25806 0 : return FD_BINCODE_SUCCESS;
25807 0 : }
25808 0 : int fd_gossip_slot_hashes_decode_offsets( fd_gossip_slot_hashes_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
25809 0 : uchar const * data = ctx->data;
25810 0 : int err;
25811 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
25812 0 : err = fd_pubkey_decode_preflight( ctx );
25813 0 : if( FD_UNLIKELY( err ) ) return err;
25814 0 : self->hashes_off = (uint)( (ulong)ctx->data - (ulong)data );
25815 0 : ulong hashes_len;
25816 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
25817 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25818 0 : if( hashes_len ) {
25819 0 : for( ulong i=0; i < hashes_len; i++ ) {
25820 0 : err = fd_slot_hash_decode_preflight( ctx );
25821 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25822 0 : }
25823 0 : }
25824 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
25825 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25826 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25827 0 : return FD_BINCODE_SUCCESS;
25828 0 : }
25829 0 : void fd_gossip_slot_hashes_new(fd_gossip_slot_hashes_t * self) {
25830 0 : fd_memset( self, 0, sizeof(fd_gossip_slot_hashes_t) );
25831 0 : fd_pubkey_new( &self->from );
25832 0 : }
25833 0 : void fd_gossip_slot_hashes_destroy( fd_gossip_slot_hashes_t * self, fd_bincode_destroy_ctx_t * ctx ) {
25834 0 : fd_pubkey_destroy( &self->from, ctx );
25835 0 : if( self->hashes ) {
25836 0 : for( ulong i=0; i < self->hashes_len; i++ )
25837 0 : fd_slot_hash_destroy( self->hashes + i, ctx );
25838 0 : fd_valloc_free( ctx->valloc, self->hashes );
25839 0 : self->hashes = NULL;
25840 0 : }
25841 0 : }
25842 :
25843 0 : ulong fd_gossip_slot_hashes_footprint( void ){ return FD_GOSSIP_SLOT_HASHES_FOOTPRINT; }
25844 0 : ulong fd_gossip_slot_hashes_align( void ){ return FD_GOSSIP_SLOT_HASHES_ALIGN; }
25845 :
25846 3 : void fd_gossip_slot_hashes_walk( void * w, fd_gossip_slot_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25847 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_slot_hashes", level++ );
25848 3 : fd_pubkey_walk( w, &self->from, fun, "from", level );
25849 3 : if( self->hashes_len ) {
25850 3 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
25851 6 : for( ulong i=0; i < self->hashes_len; i++ )
25852 3 : fd_slot_hash_walk(w, self->hashes + i, fun, "slot_hash", level );
25853 3 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
25854 3 : }
25855 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25856 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_slot_hashes", level-- );
25857 3 : }
25858 0 : ulong fd_gossip_slot_hashes_size( fd_gossip_slot_hashes_t const * self ) {
25859 0 : ulong size = 0;
25860 0 : size += fd_pubkey_size( &self->from );
25861 0 : do {
25862 0 : size += sizeof(ulong);
25863 0 : for( ulong i=0; i < self->hashes_len; i++ )
25864 0 : size += fd_slot_hash_size( self->hashes + i );
25865 0 : } while(0);
25866 0 : size += sizeof(ulong);
25867 0 : return size;
25868 0 : }
25869 :
25870 0 : int fd_gossip_slots_decode( fd_gossip_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
25871 0 : void const * data = ctx->data;
25872 0 : int err = fd_gossip_slots_decode_preflight( ctx );
25873 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25874 0 : ctx->data = data;
25875 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
25876 0 : fd_gossip_slots_new( self );
25877 0 : }
25878 0 : fd_gossip_slots_decode_unsafe( self, ctx );
25879 0 : return FD_BINCODE_SUCCESS;
25880 0 : }
25881 0 : int fd_gossip_slots_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
25882 0 : int err;
25883 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25884 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25885 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25886 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25887 0 : err = fd_gossip_bitvec_u8_decode_preflight( ctx );
25888 0 : if( FD_UNLIKELY( err ) ) return err;
25889 0 : return FD_BINCODE_SUCCESS;
25890 0 : }
25891 0 : void fd_gossip_slots_decode_unsafe( fd_gossip_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
25892 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
25893 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
25894 0 : fd_gossip_bitvec_u8_decode_unsafe( &self->slots, ctx );
25895 0 : }
25896 0 : int fd_gossip_slots_encode( fd_gossip_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25897 0 : int err;
25898 0 : err = fd_bincode_uint64_encode( self->first_slot, ctx );
25899 0 : if( FD_UNLIKELY( err ) ) return err;
25900 0 : err = fd_bincode_uint64_encode( self->num, ctx );
25901 0 : if( FD_UNLIKELY( err ) ) return err;
25902 0 : err = fd_gossip_bitvec_u8_encode( &self->slots, ctx );
25903 0 : if( FD_UNLIKELY( err ) ) return err;
25904 0 : return FD_BINCODE_SUCCESS;
25905 0 : }
25906 0 : int fd_gossip_slots_decode_offsets( fd_gossip_slots_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
25907 0 : uchar const * data = ctx->data;
25908 0 : int err;
25909 0 : self->first_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
25910 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25911 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25912 0 : self->num_off = (uint)( (ulong)ctx->data - (ulong)data );
25913 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25914 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25915 0 : self->slots_off = (uint)( (ulong)ctx->data - (ulong)data );
25916 0 : err = fd_gossip_bitvec_u8_decode_preflight( ctx );
25917 0 : if( FD_UNLIKELY( err ) ) return err;
25918 0 : return FD_BINCODE_SUCCESS;
25919 0 : }
25920 0 : void fd_gossip_slots_new(fd_gossip_slots_t * self) {
25921 0 : fd_memset( self, 0, sizeof(fd_gossip_slots_t) );
25922 0 : fd_gossip_bitvec_u8_new( &self->slots );
25923 0 : }
25924 0 : void fd_gossip_slots_destroy( fd_gossip_slots_t * self, fd_bincode_destroy_ctx_t * ctx ) {
25925 0 : fd_gossip_bitvec_u8_destroy( &self->slots, ctx );
25926 0 : }
25927 :
25928 0 : ulong fd_gossip_slots_footprint( void ){ return FD_GOSSIP_SLOTS_FOOTPRINT; }
25929 0 : ulong fd_gossip_slots_align( void ){ return FD_GOSSIP_SLOTS_ALIGN; }
25930 :
25931 0 : void fd_gossip_slots_walk( void * w, fd_gossip_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
25932 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_slots", level++ );
25933 0 : fun( w, &self->first_slot, "first_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25934 0 : fun( w, &self->num, "num", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
25935 0 : fd_gossip_bitvec_u8_walk( w, &self->slots, fun, "slots", level );
25936 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_slots", level-- );
25937 0 : }
25938 0 : ulong fd_gossip_slots_size( fd_gossip_slots_t const * self ) {
25939 0 : ulong size = 0;
25940 0 : size += sizeof(ulong);
25941 0 : size += sizeof(ulong);
25942 0 : size += fd_gossip_bitvec_u8_size( &self->slots );
25943 0 : return size;
25944 0 : }
25945 :
25946 0 : int fd_gossip_flate2_slots_decode( fd_gossip_flate2_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
25947 0 : void const * data = ctx->data;
25948 0 : int err = fd_gossip_flate2_slots_decode_preflight( ctx );
25949 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25950 0 : ctx->data = data;
25951 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
25952 0 : fd_gossip_flate2_slots_new( self );
25953 0 : }
25954 0 : fd_gossip_flate2_slots_decode_unsafe( self, ctx );
25955 0 : return FD_BINCODE_SUCCESS;
25956 0 : }
25957 0 : int fd_gossip_flate2_slots_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
25958 0 : int err;
25959 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25960 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25961 0 : err = fd_bincode_uint64_decode_preflight( ctx );
25962 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25963 0 : ulong compressed_len;
25964 0 : err = fd_bincode_uint64_decode( &compressed_len, ctx );
25965 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25966 0 : if( compressed_len ) {
25967 0 : err = fd_bincode_bytes_decode_preflight( compressed_len, ctx );
25968 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25969 0 : }
25970 0 : return FD_BINCODE_SUCCESS;
25971 0 : }
25972 0 : void fd_gossip_flate2_slots_decode_unsafe( fd_gossip_flate2_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
25973 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
25974 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
25975 0 : fd_bincode_uint64_decode_unsafe( &self->compressed_len, ctx );
25976 0 : if( self->compressed_len ) {
25977 0 : self->compressed = fd_valloc_malloc( ctx->valloc, 8UL, self->compressed_len );
25978 0 : fd_bincode_bytes_decode_unsafe( self->compressed, self->compressed_len, ctx );
25979 0 : } else
25980 0 : self->compressed = NULL;
25981 0 : }
25982 0 : int fd_gossip_flate2_slots_encode( fd_gossip_flate2_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25983 0 : int err;
25984 0 : err = fd_bincode_uint64_encode( self->first_slot, ctx );
25985 0 : if( FD_UNLIKELY( err ) ) return err;
25986 0 : err = fd_bincode_uint64_encode( self->num, ctx );
25987 0 : if( FD_UNLIKELY( err ) ) return err;
25988 0 : err = fd_bincode_uint64_encode( self->compressed_len, ctx );
25989 0 : if( FD_UNLIKELY(err) ) return err;
25990 0 : if( self->compressed_len ) {
25991 0 : err = fd_bincode_bytes_encode( self->compressed, self->compressed_len, ctx );
25992 0 : if( FD_UNLIKELY( err ) ) return err;
25993 0 : }
25994 0 : return FD_BINCODE_SUCCESS;
25995 0 : }
25996 0 : int fd_gossip_flate2_slots_decode_offsets( fd_gossip_flate2_slots_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
25997 0 : uchar const * data = ctx->data;
25998 0 : int err;
25999 0 : self->first_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
26000 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26001 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26002 0 : self->num_off = (uint)( (ulong)ctx->data - (ulong)data );
26003 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26004 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26005 0 : self->compressed_off = (uint)( (ulong)ctx->data - (ulong)data );
26006 0 : ulong compressed_len;
26007 0 : err = fd_bincode_uint64_decode( &compressed_len, ctx );
26008 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26009 0 : if( compressed_len ) {
26010 0 : err = fd_bincode_bytes_decode_preflight( compressed_len, ctx );
26011 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26012 0 : }
26013 0 : return FD_BINCODE_SUCCESS;
26014 0 : }
26015 0 : void fd_gossip_flate2_slots_new(fd_gossip_flate2_slots_t * self) {
26016 0 : fd_memset( self, 0, sizeof(fd_gossip_flate2_slots_t) );
26017 0 : }
26018 0 : void fd_gossip_flate2_slots_destroy( fd_gossip_flate2_slots_t * self, fd_bincode_destroy_ctx_t * ctx ) {
26019 0 : if( self->compressed ) {
26020 0 : fd_valloc_free( ctx->valloc, self->compressed );
26021 0 : self->compressed = NULL;
26022 0 : }
26023 0 : }
26024 :
26025 0 : ulong fd_gossip_flate2_slots_footprint( void ){ return FD_GOSSIP_FLATE2_SLOTS_FOOTPRINT; }
26026 0 : ulong fd_gossip_flate2_slots_align( void ){ return FD_GOSSIP_FLATE2_SLOTS_ALIGN; }
26027 :
26028 0 : void fd_gossip_flate2_slots_walk( void * w, fd_gossip_flate2_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26029 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_flate2_slots", level++ );
26030 0 : fun( w, &self->first_slot, "first_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26031 0 : fun( w, &self->num, "num", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26032 0 : fun(w, self->compressed, "compressed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
26033 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_flate2_slots", level-- );
26034 0 : }
26035 0 : ulong fd_gossip_flate2_slots_size( fd_gossip_flate2_slots_t const * self ) {
26036 0 : ulong size = 0;
26037 0 : size += sizeof(ulong);
26038 0 : size += sizeof(ulong);
26039 0 : do {
26040 0 : size += sizeof(ulong);
26041 0 : size += self->compressed_len;
26042 0 : } while(0);
26043 0 : return size;
26044 0 : }
26045 :
26046 0 : FD_FN_PURE uchar fd_gossip_slots_enum_is_flate2(fd_gossip_slots_enum_t const * self) {
26047 0 : return self->discriminant == 0;
26048 0 : }
26049 0 : FD_FN_PURE uchar fd_gossip_slots_enum_is_uncompressed(fd_gossip_slots_enum_t const * self) {
26050 0 : return self->discriminant == 1;
26051 0 : }
26052 : void fd_gossip_slots_enum_inner_new( fd_gossip_slots_enum_inner_t * self, uint discriminant );
26053 0 : int fd_gossip_slots_enum_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
26054 0 : int err;
26055 0 : switch (discriminant) {
26056 0 : case 0: {
26057 0 : err = fd_gossip_flate2_slots_decode_preflight( ctx );
26058 0 : if( FD_UNLIKELY( err ) ) return err;
26059 0 : return FD_BINCODE_SUCCESS;
26060 0 : }
26061 0 : case 1: {
26062 0 : err = fd_gossip_slots_decode_preflight( ctx );
26063 0 : if( FD_UNLIKELY( err ) ) return err;
26064 0 : return FD_BINCODE_SUCCESS;
26065 0 : }
26066 0 : default: return FD_BINCODE_ERR_ENCODING;
26067 0 : }
26068 0 : }
26069 0 : void fd_gossip_slots_enum_inner_decode_unsafe( fd_gossip_slots_enum_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
26070 0 : switch (discriminant) {
26071 0 : case 0: {
26072 0 : fd_gossip_flate2_slots_decode_unsafe( &self->flate2, ctx );
26073 0 : break;
26074 0 : }
26075 0 : case 1: {
26076 0 : fd_gossip_slots_decode_unsafe( &self->uncompressed, ctx );
26077 0 : break;
26078 0 : }
26079 0 : }
26080 0 : }
26081 0 : int fd_gossip_slots_enum_decode( fd_gossip_slots_enum_t * self, fd_bincode_decode_ctx_t * ctx ) {
26082 0 : void const * data = ctx->data;
26083 0 : int err = fd_gossip_slots_enum_decode_preflight( ctx );
26084 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26085 0 : ctx->data = data;
26086 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
26087 0 : fd_gossip_slots_enum_new( self );
26088 0 : }
26089 0 : fd_gossip_slots_enum_decode_unsafe( self, ctx );
26090 0 : return FD_BINCODE_SUCCESS;
26091 0 : }
26092 0 : int fd_gossip_slots_enum_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
26093 0 : uint discriminant = 0;
26094 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
26095 0 : if( FD_UNLIKELY( err ) ) return err;
26096 0 : return fd_gossip_slots_enum_inner_decode_preflight( discriminant, ctx );
26097 0 : }
26098 0 : void fd_gossip_slots_enum_decode_unsafe( fd_gossip_slots_enum_t * self, fd_bincode_decode_ctx_t * ctx ) {
26099 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
26100 0 : fd_gossip_slots_enum_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
26101 0 : }
26102 0 : void fd_gossip_slots_enum_inner_new( fd_gossip_slots_enum_inner_t * self, uint discriminant ) {
26103 0 : switch( discriminant ) {
26104 0 : case 0: {
26105 0 : fd_gossip_flate2_slots_new( &self->flate2 );
26106 0 : break;
26107 0 : }
26108 0 : case 1: {
26109 0 : fd_gossip_slots_new( &self->uncompressed );
26110 0 : break;
26111 0 : }
26112 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
26113 0 : }
26114 0 : }
26115 0 : void fd_gossip_slots_enum_new_disc( fd_gossip_slots_enum_t * self, uint discriminant ) {
26116 0 : self->discriminant = discriminant;
26117 0 : fd_gossip_slots_enum_inner_new( &self->inner, self->discriminant );
26118 0 : }
26119 0 : void fd_gossip_slots_enum_new( fd_gossip_slots_enum_t * self ) {
26120 0 : fd_memset( self, 0, sizeof(fd_gossip_slots_enum_t) );
26121 0 : fd_gossip_slots_enum_new_disc( self, UINT_MAX );
26122 0 : }
26123 0 : void fd_gossip_slots_enum_inner_destroy( fd_gossip_slots_enum_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
26124 0 : switch( discriminant ) {
26125 0 : case 0: {
26126 0 : fd_gossip_flate2_slots_destroy( &self->flate2, ctx );
26127 0 : break;
26128 0 : }
26129 0 : case 1: {
26130 0 : fd_gossip_slots_destroy( &self->uncompressed, ctx );
26131 0 : break;
26132 0 : }
26133 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
26134 0 : }
26135 0 : }
26136 0 : void fd_gossip_slots_enum_destroy( fd_gossip_slots_enum_t * self, fd_bincode_destroy_ctx_t * ctx ) {
26137 0 : fd_gossip_slots_enum_inner_destroy( &self->inner, self->discriminant, ctx );
26138 0 : }
26139 :
26140 0 : ulong fd_gossip_slots_enum_footprint( void ){ return FD_GOSSIP_SLOTS_ENUM_FOOTPRINT; }
26141 0 : ulong fd_gossip_slots_enum_align( void ){ return FD_GOSSIP_SLOTS_ENUM_ALIGN; }
26142 :
26143 0 : void fd_gossip_slots_enum_walk( void * w, fd_gossip_slots_enum_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26144 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_slots_enum", level++);
26145 0 : switch( self->discriminant ) {
26146 0 : case 0: {
26147 0 : fun( w, self, "flate2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
26148 0 : fd_gossip_flate2_slots_walk( w, &self->inner.flate2, fun, "flate2", level );
26149 0 : break;
26150 0 : }
26151 0 : case 1: {
26152 0 : fun( w, self, "uncompressed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
26153 0 : fd_gossip_slots_walk( w, &self->inner.uncompressed, fun, "uncompressed", level );
26154 0 : break;
26155 0 : }
26156 0 : }
26157 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_slots_enum", level-- );
26158 0 : }
26159 0 : ulong fd_gossip_slots_enum_size( fd_gossip_slots_enum_t const * self ) {
26160 0 : ulong size = 0;
26161 0 : size += sizeof(uint);
26162 0 : switch (self->discriminant) {
26163 0 : case 0: {
26164 0 : size += fd_gossip_flate2_slots_size( &self->inner.flate2 );
26165 0 : break;
26166 0 : }
26167 0 : case 1: {
26168 0 : size += fd_gossip_slots_size( &self->inner.uncompressed );
26169 0 : break;
26170 0 : }
26171 0 : }
26172 0 : return size;
26173 0 : }
26174 :
26175 0 : int fd_gossip_slots_enum_inner_encode( fd_gossip_slots_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
26176 0 : int err;
26177 0 : switch (discriminant) {
26178 0 : case 0: {
26179 0 : err = fd_gossip_flate2_slots_encode( &self->flate2, ctx );
26180 0 : if( FD_UNLIKELY( err ) ) return err;
26181 0 : break;
26182 0 : }
26183 0 : case 1: {
26184 0 : err = fd_gossip_slots_encode( &self->uncompressed, ctx );
26185 0 : if( FD_UNLIKELY( err ) ) return err;
26186 0 : break;
26187 0 : }
26188 0 : }
26189 0 : return FD_BINCODE_SUCCESS;
26190 0 : }
26191 0 : int fd_gossip_slots_enum_encode( fd_gossip_slots_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26192 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
26193 0 : if( FD_UNLIKELY( err ) ) return err;
26194 0 : return fd_gossip_slots_enum_inner_encode( &self->inner, self->discriminant, ctx );
26195 0 : }
26196 :
26197 0 : int fd_gossip_epoch_slots_decode( fd_gossip_epoch_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
26198 0 : void const * data = ctx->data;
26199 0 : int err = fd_gossip_epoch_slots_decode_preflight( ctx );
26200 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26201 0 : ctx->data = data;
26202 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
26203 0 : fd_gossip_epoch_slots_new( self );
26204 0 : }
26205 0 : fd_gossip_epoch_slots_decode_unsafe( self, ctx );
26206 0 : return FD_BINCODE_SUCCESS;
26207 0 : }
26208 0 : int fd_gossip_epoch_slots_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
26209 0 : int err;
26210 0 : err = fd_bincode_uint8_decode_preflight( ctx );
26211 0 : if( FD_UNLIKELY( err ) ) return err;
26212 0 : err = fd_pubkey_decode_preflight( ctx );
26213 0 : if( FD_UNLIKELY( err ) ) return err;
26214 0 : ulong slots_len;
26215 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
26216 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26217 0 : if( slots_len ) {
26218 0 : for( ulong i=0; i < slots_len; i++ ) {
26219 0 : err = fd_gossip_slots_enum_decode_preflight( ctx );
26220 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26221 0 : }
26222 0 : }
26223 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26224 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26225 0 : return FD_BINCODE_SUCCESS;
26226 0 : }
26227 0 : void fd_gossip_epoch_slots_decode_unsafe( fd_gossip_epoch_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
26228 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
26229 0 : fd_pubkey_decode_unsafe( &self->from, ctx );
26230 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
26231 0 : if( self->slots_len ) {
26232 0 : self->slots = (fd_gossip_slots_enum_t *)fd_valloc_malloc( ctx->valloc, FD_GOSSIP_SLOTS_ENUM_ALIGN, FD_GOSSIP_SLOTS_ENUM_FOOTPRINT*self->slots_len );
26233 0 : for( ulong i=0; i < self->slots_len; i++ ) {
26234 0 : fd_gossip_slots_enum_new( self->slots + i );
26235 0 : fd_gossip_slots_enum_decode_unsafe( self->slots + i, ctx );
26236 0 : }
26237 0 : } else
26238 0 : self->slots = NULL;
26239 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26240 0 : }
26241 0 : int fd_gossip_epoch_slots_encode( fd_gossip_epoch_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26242 0 : int err;
26243 0 : err = fd_bincode_uint8_encode( (uchar)(self->u8), ctx );
26244 0 : if( FD_UNLIKELY( err ) ) return err;
26245 0 : err = fd_pubkey_encode( &self->from, ctx );
26246 0 : if( FD_UNLIKELY( err ) ) return err;
26247 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
26248 0 : if( FD_UNLIKELY(err) ) return err;
26249 0 : if( self->slots_len ) {
26250 0 : for( ulong i=0; i < self->slots_len; i++ ) {
26251 0 : err = fd_gossip_slots_enum_encode( self->slots + i, ctx );
26252 0 : if( FD_UNLIKELY( err ) ) return err;
26253 0 : }
26254 0 : }
26255 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
26256 0 : if( FD_UNLIKELY( err ) ) return err;
26257 0 : return FD_BINCODE_SUCCESS;
26258 0 : }
26259 0 : int fd_gossip_epoch_slots_decode_offsets( fd_gossip_epoch_slots_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
26260 0 : uchar const * data = ctx->data;
26261 0 : int err;
26262 0 : self->u8_off = (uint)( (ulong)ctx->data - (ulong)data );
26263 0 : err = fd_bincode_uint8_decode_preflight( ctx );
26264 0 : if( FD_UNLIKELY( err ) ) return err;
26265 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
26266 0 : err = fd_pubkey_decode_preflight( ctx );
26267 0 : if( FD_UNLIKELY( err ) ) return err;
26268 0 : self->slots_off = (uint)( (ulong)ctx->data - (ulong)data );
26269 0 : ulong slots_len;
26270 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
26271 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26272 0 : if( slots_len ) {
26273 0 : for( ulong i=0; i < slots_len; i++ ) {
26274 0 : err = fd_gossip_slots_enum_decode_preflight( ctx );
26275 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26276 0 : }
26277 0 : }
26278 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
26279 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26280 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26281 0 : return FD_BINCODE_SUCCESS;
26282 0 : }
26283 0 : void fd_gossip_epoch_slots_new(fd_gossip_epoch_slots_t * self) {
26284 0 : fd_memset( self, 0, sizeof(fd_gossip_epoch_slots_t) );
26285 0 : fd_pubkey_new( &self->from );
26286 0 : }
26287 0 : void fd_gossip_epoch_slots_destroy( fd_gossip_epoch_slots_t * self, fd_bincode_destroy_ctx_t * ctx ) {
26288 0 : fd_pubkey_destroy( &self->from, ctx );
26289 0 : if( self->slots ) {
26290 0 : for( ulong i=0; i < self->slots_len; i++ )
26291 0 : fd_gossip_slots_enum_destroy( self->slots + i, ctx );
26292 0 : fd_valloc_free( ctx->valloc, self->slots );
26293 0 : self->slots = NULL;
26294 0 : }
26295 0 : }
26296 :
26297 0 : ulong fd_gossip_epoch_slots_footprint( void ){ return FD_GOSSIP_EPOCH_SLOTS_FOOTPRINT; }
26298 0 : ulong fd_gossip_epoch_slots_align( void ){ return FD_GOSSIP_EPOCH_SLOTS_ALIGN; }
26299 :
26300 0 : void fd_gossip_epoch_slots_walk( void * w, fd_gossip_epoch_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26301 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_epoch_slots", level++ );
26302 0 : fun( w, &self->u8, "u8", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
26303 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
26304 0 : if( self->slots_len ) {
26305 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR, "array", level++ );
26306 0 : for( ulong i=0; i < self->slots_len; i++ )
26307 0 : fd_gossip_slots_enum_walk(w, self->slots + i, fun, "gossip_slots_enum", level );
26308 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
26309 0 : }
26310 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26311 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_epoch_slots", level-- );
26312 0 : }
26313 0 : ulong fd_gossip_epoch_slots_size( fd_gossip_epoch_slots_t const * self ) {
26314 0 : ulong size = 0;
26315 0 : size += sizeof(char);
26316 0 : size += fd_pubkey_size( &self->from );
26317 0 : do {
26318 0 : size += sizeof(ulong);
26319 0 : for( ulong i=0; i < self->slots_len; i++ )
26320 0 : size += fd_gossip_slots_enum_size( self->slots + i );
26321 0 : } while(0);
26322 0 : size += sizeof(ulong);
26323 0 : return size;
26324 0 : }
26325 :
26326 0 : int fd_gossip_version_v1_decode( fd_gossip_version_v1_t * self, fd_bincode_decode_ctx_t * ctx ) {
26327 0 : void const * data = ctx->data;
26328 0 : int err = fd_gossip_version_v1_decode_preflight( ctx );
26329 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26330 0 : ctx->data = data;
26331 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
26332 0 : fd_gossip_version_v1_new( self );
26333 0 : }
26334 0 : fd_gossip_version_v1_decode_unsafe( self, ctx );
26335 0 : return FD_BINCODE_SUCCESS;
26336 0 : }
26337 0 : int fd_gossip_version_v1_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
26338 0 : int err;
26339 0 : err = fd_pubkey_decode_preflight( ctx );
26340 0 : if( FD_UNLIKELY( err ) ) return err;
26341 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26342 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26343 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26344 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26345 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26346 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26347 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26348 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26349 0 : {
26350 0 : uchar o;
26351 0 : err = fd_bincode_bool_decode( &o, ctx );
26352 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26353 0 : if( o ) {
26354 0 : err = fd_bincode_uint32_decode_preflight( ctx );
26355 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26356 0 : }
26357 0 : }
26358 0 : return FD_BINCODE_SUCCESS;
26359 0 : }
26360 0 : void fd_gossip_version_v1_decode_unsafe( fd_gossip_version_v1_t * self, fd_bincode_decode_ctx_t * ctx ) {
26361 0 : fd_pubkey_decode_unsafe( &self->from, ctx );
26362 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26363 0 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
26364 0 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
26365 0 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
26366 0 : {
26367 0 : uchar o;
26368 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
26369 0 : self->has_commit = !!o;
26370 0 : if( o ) {
26371 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
26372 0 : }
26373 0 : }
26374 0 : }
26375 0 : int fd_gossip_version_v1_encode( fd_gossip_version_v1_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26376 0 : int err;
26377 0 : err = fd_pubkey_encode( &self->from, ctx );
26378 0 : if( FD_UNLIKELY( err ) ) return err;
26379 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
26380 0 : if( FD_UNLIKELY( err ) ) return err;
26381 0 : err = fd_bincode_uint16_encode( self->major, ctx );
26382 0 : if( FD_UNLIKELY( err ) ) return err;
26383 0 : err = fd_bincode_uint16_encode( self->minor, ctx );
26384 0 : if( FD_UNLIKELY( err ) ) return err;
26385 0 : err = fd_bincode_uint16_encode( self->patch, ctx );
26386 0 : if( FD_UNLIKELY( err ) ) return err;
26387 0 : err = fd_bincode_bool_encode( self->has_commit, ctx );
26388 0 : if( FD_UNLIKELY( err ) ) return err;
26389 0 : if( self->has_commit ) {
26390 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
26391 0 : if( FD_UNLIKELY( err ) ) return err;
26392 0 : }
26393 0 : return FD_BINCODE_SUCCESS;
26394 0 : }
26395 0 : int fd_gossip_version_v1_decode_offsets( fd_gossip_version_v1_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
26396 0 : uchar const * data = ctx->data;
26397 0 : int err;
26398 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
26399 0 : err = fd_pubkey_decode_preflight( ctx );
26400 0 : if( FD_UNLIKELY( err ) ) return err;
26401 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
26402 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26403 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26404 0 : self->major_off = (uint)( (ulong)ctx->data - (ulong)data );
26405 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26406 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26407 0 : self->minor_off = (uint)( (ulong)ctx->data - (ulong)data );
26408 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26409 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26410 0 : self->patch_off = (uint)( (ulong)ctx->data - (ulong)data );
26411 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26412 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26413 0 : self->commit_off = (uint)( (ulong)ctx->data - (ulong)data );
26414 0 : {
26415 0 : uchar o;
26416 0 : err = fd_bincode_bool_decode( &o, ctx );
26417 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26418 0 : if( o ) {
26419 0 : err = fd_bincode_uint32_decode_preflight( ctx );
26420 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26421 0 : }
26422 0 : }
26423 0 : return FD_BINCODE_SUCCESS;
26424 0 : }
26425 0 : void fd_gossip_version_v1_new(fd_gossip_version_v1_t * self) {
26426 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v1_t) );
26427 0 : fd_pubkey_new( &self->from );
26428 0 : }
26429 0 : void fd_gossip_version_v1_destroy( fd_gossip_version_v1_t * self, fd_bincode_destroy_ctx_t * ctx ) {
26430 0 : fd_pubkey_destroy( &self->from, ctx );
26431 0 : if( self->has_commit ) {
26432 0 : self->has_commit = 0;
26433 0 : }
26434 0 : }
26435 :
26436 0 : ulong fd_gossip_version_v1_footprint( void ){ return FD_GOSSIP_VERSION_V1_FOOTPRINT; }
26437 0 : ulong fd_gossip_version_v1_align( void ){ return FD_GOSSIP_VERSION_V1_ALIGN; }
26438 :
26439 0 : void fd_gossip_version_v1_walk( void * w, fd_gossip_version_v1_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26440 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v1", level++ );
26441 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
26442 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26443 0 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26444 0 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26445 0 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26446 0 : if( !self->has_commit ) {
26447 0 : fun( w, NULL, "commit", FD_FLAMENCO_TYPE_NULL, "uint", level );
26448 0 : } else {
26449 0 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level );
26450 0 : }
26451 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v1", level-- );
26452 0 : }
26453 0 : ulong fd_gossip_version_v1_size( fd_gossip_version_v1_t const * self ) {
26454 0 : ulong size = 0;
26455 0 : size += fd_pubkey_size( &self->from );
26456 0 : size += sizeof(ulong);
26457 0 : size += sizeof(ushort);
26458 0 : size += sizeof(ushort);
26459 0 : size += sizeof(ushort);
26460 0 : size += sizeof(char);
26461 0 : if( self->has_commit ) {
26462 0 : size += sizeof(uint);
26463 0 : }
26464 0 : return size;
26465 0 : }
26466 :
26467 0 : int fd_gossip_version_v2_decode( fd_gossip_version_v2_t * self, fd_bincode_decode_ctx_t * ctx ) {
26468 0 : void const * data = ctx->data;
26469 0 : int err = fd_gossip_version_v2_decode_preflight( ctx );
26470 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26471 0 : ctx->data = data;
26472 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
26473 0 : fd_gossip_version_v2_new( self );
26474 0 : }
26475 0 : fd_gossip_version_v2_decode_unsafe( self, ctx );
26476 0 : return FD_BINCODE_SUCCESS;
26477 0 : }
26478 3 : int fd_gossip_version_v2_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
26479 3 : int err;
26480 3 : err = fd_pubkey_decode_preflight( ctx );
26481 3 : if( FD_UNLIKELY( err ) ) return err;
26482 3 : err = fd_bincode_uint64_decode_preflight( ctx );
26483 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26484 3 : err = fd_bincode_uint16_decode_preflight( ctx );
26485 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26486 3 : err = fd_bincode_uint16_decode_preflight( ctx );
26487 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26488 3 : err = fd_bincode_uint16_decode_preflight( ctx );
26489 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26490 3 : {
26491 3 : uchar o;
26492 3 : err = fd_bincode_bool_decode( &o, ctx );
26493 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26494 3 : if( o ) {
26495 0 : err = fd_bincode_uint32_decode_preflight( ctx );
26496 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26497 0 : }
26498 3 : }
26499 3 : err = fd_bincode_uint32_decode_preflight( ctx );
26500 3 : if( FD_UNLIKELY( err ) ) return err;
26501 3 : return FD_BINCODE_SUCCESS;
26502 3 : }
26503 3 : void fd_gossip_version_v2_decode_unsafe( fd_gossip_version_v2_t * self, fd_bincode_decode_ctx_t * ctx ) {
26504 3 : fd_pubkey_decode_unsafe( &self->from, ctx );
26505 3 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26506 3 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
26507 3 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
26508 3 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
26509 3 : {
26510 3 : uchar o;
26511 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
26512 3 : self->has_commit = !!o;
26513 3 : if( o ) {
26514 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
26515 0 : }
26516 3 : }
26517 3 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
26518 3 : }
26519 0 : int fd_gossip_version_v2_encode( fd_gossip_version_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26520 0 : int err;
26521 0 : err = fd_pubkey_encode( &self->from, ctx );
26522 0 : if( FD_UNLIKELY( err ) ) return err;
26523 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
26524 0 : if( FD_UNLIKELY( err ) ) return err;
26525 0 : err = fd_bincode_uint16_encode( self->major, ctx );
26526 0 : if( FD_UNLIKELY( err ) ) return err;
26527 0 : err = fd_bincode_uint16_encode( self->minor, ctx );
26528 0 : if( FD_UNLIKELY( err ) ) return err;
26529 0 : err = fd_bincode_uint16_encode( self->patch, ctx );
26530 0 : if( FD_UNLIKELY( err ) ) return err;
26531 0 : err = fd_bincode_bool_encode( self->has_commit, ctx );
26532 0 : if( FD_UNLIKELY( err ) ) return err;
26533 0 : if( self->has_commit ) {
26534 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
26535 0 : if( FD_UNLIKELY( err ) ) return err;
26536 0 : }
26537 0 : err = fd_bincode_uint32_encode( self->feature_set, ctx );
26538 0 : if( FD_UNLIKELY( err ) ) return err;
26539 0 : return FD_BINCODE_SUCCESS;
26540 0 : }
26541 0 : int fd_gossip_version_v2_decode_offsets( fd_gossip_version_v2_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
26542 0 : uchar const * data = ctx->data;
26543 0 : int err;
26544 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
26545 0 : err = fd_pubkey_decode_preflight( ctx );
26546 0 : if( FD_UNLIKELY( err ) ) return err;
26547 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
26548 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26549 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26550 0 : self->major_off = (uint)( (ulong)ctx->data - (ulong)data );
26551 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26552 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26553 0 : self->minor_off = (uint)( (ulong)ctx->data - (ulong)data );
26554 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26555 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26556 0 : self->patch_off = (uint)( (ulong)ctx->data - (ulong)data );
26557 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26558 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26559 0 : self->commit_off = (uint)( (ulong)ctx->data - (ulong)data );
26560 0 : {
26561 0 : uchar o;
26562 0 : err = fd_bincode_bool_decode( &o, ctx );
26563 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26564 0 : if( o ) {
26565 0 : err = fd_bincode_uint32_decode_preflight( ctx );
26566 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26567 0 : }
26568 0 : }
26569 0 : self->feature_set_off = (uint)( (ulong)ctx->data - (ulong)data );
26570 0 : err = fd_bincode_uint32_decode_preflight( ctx );
26571 0 : if( FD_UNLIKELY( err ) ) return err;
26572 0 : return FD_BINCODE_SUCCESS;
26573 0 : }
26574 0 : void fd_gossip_version_v2_new(fd_gossip_version_v2_t * self) {
26575 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v2_t) );
26576 0 : fd_pubkey_new( &self->from );
26577 0 : }
26578 0 : void fd_gossip_version_v2_destroy( fd_gossip_version_v2_t * self, fd_bincode_destroy_ctx_t * ctx ) {
26579 0 : fd_pubkey_destroy( &self->from, ctx );
26580 0 : if( self->has_commit ) {
26581 0 : self->has_commit = 0;
26582 0 : }
26583 0 : }
26584 :
26585 0 : ulong fd_gossip_version_v2_footprint( void ){ return FD_GOSSIP_VERSION_V2_FOOTPRINT; }
26586 0 : ulong fd_gossip_version_v2_align( void ){ return FD_GOSSIP_VERSION_V2_ALIGN; }
26587 :
26588 3 : void fd_gossip_version_v2_walk( void * w, fd_gossip_version_v2_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26589 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v2", level++ );
26590 3 : fd_pubkey_walk( w, &self->from, fun, "from", level );
26591 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26592 3 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26593 3 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26594 3 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26595 3 : if( !self->has_commit ) {
26596 3 : fun( w, NULL, "commit", FD_FLAMENCO_TYPE_NULL, "uint", level );
26597 3 : } else {
26598 0 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level );
26599 0 : }
26600 3 : fun( w, &self->feature_set, "feature_set", FD_FLAMENCO_TYPE_UINT, "uint", level );
26601 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v2", level-- );
26602 3 : }
26603 0 : ulong fd_gossip_version_v2_size( fd_gossip_version_v2_t const * self ) {
26604 0 : ulong size = 0;
26605 0 : size += fd_pubkey_size( &self->from );
26606 0 : size += sizeof(ulong);
26607 0 : size += sizeof(ushort);
26608 0 : size += sizeof(ushort);
26609 0 : size += sizeof(ushort);
26610 0 : size += sizeof(char);
26611 0 : if( self->has_commit ) {
26612 0 : size += sizeof(uint);
26613 0 : }
26614 0 : size += sizeof(uint);
26615 0 : return size;
26616 0 : }
26617 :
26618 0 : int fd_gossip_version_v3_decode( fd_gossip_version_v3_t * self, fd_bincode_decode_ctx_t * ctx ) {
26619 0 : void const * data = ctx->data;
26620 0 : int err = fd_gossip_version_v3_decode_preflight( ctx );
26621 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26622 0 : ctx->data = data;
26623 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
26624 0 : fd_gossip_version_v3_new( self );
26625 0 : }
26626 0 : fd_gossip_version_v3_decode_unsafe( self, ctx );
26627 0 : return FD_BINCODE_SUCCESS;
26628 0 : }
26629 3 : int fd_gossip_version_v3_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
26630 3 : int err;
26631 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26632 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26633 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26634 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26635 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26636 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26637 3 : err = fd_bincode_uint32_decode_preflight( ctx );
26638 3 : if( FD_UNLIKELY( err ) ) return err;
26639 3 : err = fd_bincode_uint32_decode_preflight( ctx );
26640 3 : if( FD_UNLIKELY( err ) ) return err;
26641 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26642 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26643 3 : return FD_BINCODE_SUCCESS;
26644 3 : }
26645 3 : void fd_gossip_version_v3_decode_unsafe( fd_gossip_version_v3_t * self, fd_bincode_decode_ctx_t * ctx ) {
26646 3 : fd_bincode_compact_u16_decode_unsafe( &self->major, ctx );
26647 3 : fd_bincode_compact_u16_decode_unsafe( &self->minor, ctx );
26648 3 : fd_bincode_compact_u16_decode_unsafe( &self->patch, ctx );
26649 3 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
26650 3 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
26651 3 : fd_bincode_compact_u16_decode_unsafe( &self->client, ctx );
26652 3 : }
26653 0 : int fd_gossip_version_v3_encode( fd_gossip_version_v3_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26654 0 : int err;
26655 0 : err = fd_bincode_compact_u16_encode( &self->major, ctx );
26656 0 : if( FD_UNLIKELY( err ) ) return err;
26657 0 : err = fd_bincode_compact_u16_encode( &self->minor, ctx );
26658 0 : if( FD_UNLIKELY( err ) ) return err;
26659 0 : err = fd_bincode_compact_u16_encode( &self->patch, ctx );
26660 0 : if( FD_UNLIKELY( err ) ) return err;
26661 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
26662 0 : if( FD_UNLIKELY( err ) ) return err;
26663 0 : err = fd_bincode_uint32_encode( self->feature_set, ctx );
26664 0 : if( FD_UNLIKELY( err ) ) return err;
26665 0 : err = fd_bincode_compact_u16_encode( &self->client, ctx );
26666 0 : if( FD_UNLIKELY( err ) ) return err;
26667 0 : return FD_BINCODE_SUCCESS;
26668 0 : }
26669 0 : int fd_gossip_version_v3_decode_offsets( fd_gossip_version_v3_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
26670 0 : uchar const * data = ctx->data;
26671 0 : int err;
26672 0 : self->major_off = (uint)( (ulong)ctx->data - (ulong)data );
26673 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26674 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26675 0 : self->minor_off = (uint)( (ulong)ctx->data - (ulong)data );
26676 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26677 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26678 0 : self->patch_off = (uint)( (ulong)ctx->data - (ulong)data );
26679 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26680 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26681 0 : self->commit_off = (uint)( (ulong)ctx->data - (ulong)data );
26682 0 : err = fd_bincode_uint32_decode_preflight( ctx );
26683 0 : if( FD_UNLIKELY( err ) ) return err;
26684 0 : self->feature_set_off = (uint)( (ulong)ctx->data - (ulong)data );
26685 0 : err = fd_bincode_uint32_decode_preflight( ctx );
26686 0 : if( FD_UNLIKELY( err ) ) return err;
26687 0 : self->client_off = (uint)( (ulong)ctx->data - (ulong)data );
26688 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
26689 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26690 0 : return FD_BINCODE_SUCCESS;
26691 0 : }
26692 0 : void fd_gossip_version_v3_new(fd_gossip_version_v3_t * self) {
26693 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v3_t) );
26694 0 : }
26695 0 : void fd_gossip_version_v3_destroy( fd_gossip_version_v3_t * self, fd_bincode_destroy_ctx_t * ctx ) {
26696 0 : }
26697 :
26698 0 : ulong fd_gossip_version_v3_footprint( void ){ return FD_GOSSIP_VERSION_V3_FOOTPRINT; }
26699 0 : ulong fd_gossip_version_v3_align( void ){ return FD_GOSSIP_VERSION_V3_ALIGN; }
26700 :
26701 3 : void fd_gossip_version_v3_walk( void * w, fd_gossip_version_v3_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26702 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v3", level++ );
26703 3 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26704 3 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26705 3 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26706 3 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level );
26707 3 : fun( w, &self->feature_set, "feature_set", FD_FLAMENCO_TYPE_UINT, "uint", level );
26708 3 : fun( w, &self->client, "client", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26709 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v3", level-- );
26710 3 : }
26711 0 : ulong fd_gossip_version_v3_size( fd_gossip_version_v3_t const * self ) {
26712 0 : ulong size = 0;
26713 0 : size += fd_bincode_compact_u16_size( &self->major );
26714 0 : size += fd_bincode_compact_u16_size( &self->minor );
26715 0 : size += fd_bincode_compact_u16_size( &self->patch );
26716 0 : size += sizeof(uint);
26717 0 : size += sizeof(uint);
26718 0 : size += fd_bincode_compact_u16_size( &self->client );
26719 0 : return size;
26720 0 : }
26721 :
26722 0 : int fd_gossip_node_instance_decode( fd_gossip_node_instance_t * self, fd_bincode_decode_ctx_t * ctx ) {
26723 0 : void const * data = ctx->data;
26724 0 : int err = fd_gossip_node_instance_decode_preflight( ctx );
26725 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26726 0 : ctx->data = data;
26727 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
26728 0 : fd_gossip_node_instance_new( self );
26729 0 : }
26730 0 : fd_gossip_node_instance_decode_unsafe( self, ctx );
26731 0 : return FD_BINCODE_SUCCESS;
26732 0 : }
26733 6 : int fd_gossip_node_instance_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
26734 6 : return fd_bincode_bytes_decode_preflight( 56, ctx );
26735 6 : }
26736 6 : void fd_gossip_node_instance_decode_unsafe( fd_gossip_node_instance_t * self, fd_bincode_decode_ctx_t * ctx ) {
26737 6 : fd_pubkey_decode_unsafe( &self->from, ctx );
26738 6 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26739 6 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
26740 6 : fd_bincode_uint64_decode_unsafe( &self->token, ctx );
26741 6 : }
26742 0 : int fd_gossip_node_instance_encode( fd_gossip_node_instance_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26743 0 : int err;
26744 0 : err = fd_pubkey_encode( &self->from, ctx );
26745 0 : if( FD_UNLIKELY( err ) ) return err;
26746 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
26747 0 : if( FD_UNLIKELY( err ) ) return err;
26748 0 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
26749 0 : if( FD_UNLIKELY( err ) ) return err;
26750 0 : err = fd_bincode_uint64_encode( self->token, ctx );
26751 0 : if( FD_UNLIKELY( err ) ) return err;
26752 0 : return FD_BINCODE_SUCCESS;
26753 0 : }
26754 0 : int fd_gossip_node_instance_decode_offsets( fd_gossip_node_instance_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
26755 0 : uchar const * data = ctx->data;
26756 0 : int err;
26757 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
26758 0 : err = fd_pubkey_decode_preflight( ctx );
26759 0 : if( FD_UNLIKELY( err ) ) return err;
26760 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
26761 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26762 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26763 0 : self->timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
26764 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26765 0 : if( FD_UNLIKELY( err ) ) return err;
26766 0 : self->token_off = (uint)( (ulong)ctx->data - (ulong)data );
26767 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26768 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26769 0 : return FD_BINCODE_SUCCESS;
26770 0 : }
26771 0 : void fd_gossip_node_instance_new(fd_gossip_node_instance_t * self) {
26772 0 : fd_memset( self, 0, sizeof(fd_gossip_node_instance_t) );
26773 0 : fd_pubkey_new( &self->from );
26774 0 : }
26775 0 : void fd_gossip_node_instance_destroy( fd_gossip_node_instance_t * self, fd_bincode_destroy_ctx_t * ctx ) {
26776 0 : fd_pubkey_destroy( &self->from, ctx );
26777 0 : }
26778 :
26779 0 : ulong fd_gossip_node_instance_footprint( void ){ return FD_GOSSIP_NODE_INSTANCE_FOOTPRINT; }
26780 0 : ulong fd_gossip_node_instance_align( void ){ return FD_GOSSIP_NODE_INSTANCE_ALIGN; }
26781 :
26782 6 : void fd_gossip_node_instance_walk( void * w, fd_gossip_node_instance_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26783 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_node_instance", level++ );
26784 6 : fd_pubkey_walk( w, &self->from, fun, "from", level );
26785 6 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26786 6 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
26787 6 : fun( w, &self->token, "token", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26788 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_node_instance", level-- );
26789 6 : }
26790 0 : ulong fd_gossip_node_instance_size( fd_gossip_node_instance_t const * self ) {
26791 0 : ulong size = 0;
26792 0 : size += fd_pubkey_size( &self->from );
26793 0 : size += sizeof(ulong);
26794 0 : size += sizeof(long);
26795 0 : size += sizeof(ulong);
26796 0 : return size;
26797 0 : }
26798 :
26799 0 : int fd_gossip_duplicate_shred_decode( fd_gossip_duplicate_shred_t * self, fd_bincode_decode_ctx_t * ctx ) {
26800 0 : void const * data = ctx->data;
26801 0 : int err = fd_gossip_duplicate_shred_decode_preflight( ctx );
26802 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26803 0 : ctx->data = data;
26804 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
26805 0 : fd_gossip_duplicate_shred_new( self );
26806 0 : }
26807 0 : fd_gossip_duplicate_shred_decode_unsafe( self, ctx );
26808 0 : return FD_BINCODE_SUCCESS;
26809 0 : }
26810 0 : int fd_gossip_duplicate_shred_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
26811 0 : int err;
26812 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26813 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26814 0 : err = fd_pubkey_decode_preflight( ctx );
26815 0 : if( FD_UNLIKELY( err ) ) return err;
26816 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26817 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26818 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26819 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26820 0 : err = fd_bincode_uint32_decode_preflight( ctx );
26821 0 : if( FD_UNLIKELY( err ) ) return err;
26822 0 : err = fd_bincode_uint8_decode_preflight( ctx );
26823 0 : if( FD_UNLIKELY( err ) ) return err;
26824 0 : err = fd_bincode_uint8_decode_preflight( ctx );
26825 0 : if( FD_UNLIKELY( err ) ) return err;
26826 0 : err = fd_bincode_uint8_decode_preflight( ctx );
26827 0 : if( FD_UNLIKELY( err ) ) return err;
26828 0 : ulong chunk_len;
26829 0 : err = fd_bincode_uint64_decode( &chunk_len, ctx );
26830 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26831 0 : if( chunk_len ) {
26832 0 : err = fd_bincode_bytes_decode_preflight( chunk_len, ctx );
26833 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26834 0 : }
26835 0 : return FD_BINCODE_SUCCESS;
26836 0 : }
26837 0 : void fd_gossip_duplicate_shred_decode_unsafe( fd_gossip_duplicate_shred_t * self, fd_bincode_decode_ctx_t * ctx ) {
26838 0 : fd_bincode_uint16_decode_unsafe( &self->duplicate_shred_index, ctx );
26839 0 : fd_pubkey_decode_unsafe( &self->from, ctx );
26840 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
26841 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
26842 0 : fd_bincode_uint32_decode_unsafe( &self->_unused, ctx );
26843 0 : fd_bincode_uint8_decode_unsafe( &self->_unused_shred_type, ctx );
26844 0 : fd_bincode_uint8_decode_unsafe( &self->num_chunks, ctx );
26845 0 : fd_bincode_uint8_decode_unsafe( &self->chunk_index, ctx );
26846 0 : fd_bincode_uint64_decode_unsafe( &self->chunk_len, ctx );
26847 0 : if( self->chunk_len ) {
26848 0 : self->chunk = fd_valloc_malloc( ctx->valloc, 8UL, self->chunk_len );
26849 0 : fd_bincode_bytes_decode_unsafe( self->chunk, self->chunk_len, ctx );
26850 0 : } else
26851 0 : self->chunk = NULL;
26852 0 : }
26853 0 : int fd_gossip_duplicate_shred_encode( fd_gossip_duplicate_shred_t const * self, fd_bincode_encode_ctx_t * ctx ) {
26854 0 : int err;
26855 0 : err = fd_bincode_uint16_encode( self->duplicate_shred_index, ctx );
26856 0 : if( FD_UNLIKELY( err ) ) return err;
26857 0 : err = fd_pubkey_encode( &self->from, ctx );
26858 0 : if( FD_UNLIKELY( err ) ) return err;
26859 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
26860 0 : if( FD_UNLIKELY( err ) ) return err;
26861 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
26862 0 : if( FD_UNLIKELY( err ) ) return err;
26863 0 : err = fd_bincode_uint32_encode( self->_unused, ctx );
26864 0 : if( FD_UNLIKELY( err ) ) return err;
26865 0 : err = fd_bincode_uint8_encode( (uchar)(self->_unused_shred_type), ctx );
26866 0 : if( FD_UNLIKELY( err ) ) return err;
26867 0 : err = fd_bincode_uint8_encode( (uchar)(self->num_chunks), ctx );
26868 0 : if( FD_UNLIKELY( err ) ) return err;
26869 0 : err = fd_bincode_uint8_encode( (uchar)(self->chunk_index), ctx );
26870 0 : if( FD_UNLIKELY( err ) ) return err;
26871 0 : err = fd_bincode_uint64_encode( self->chunk_len, ctx );
26872 0 : if( FD_UNLIKELY(err) ) return err;
26873 0 : if( self->chunk_len ) {
26874 0 : err = fd_bincode_bytes_encode( self->chunk, self->chunk_len, ctx );
26875 0 : if( FD_UNLIKELY( err ) ) return err;
26876 0 : }
26877 0 : return FD_BINCODE_SUCCESS;
26878 0 : }
26879 0 : int fd_gossip_duplicate_shred_decode_offsets( fd_gossip_duplicate_shred_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
26880 0 : uchar const * data = ctx->data;
26881 0 : int err;
26882 0 : self->duplicate_shred_index_off = (uint)( (ulong)ctx->data - (ulong)data );
26883 0 : err = fd_bincode_uint16_decode_preflight( ctx );
26884 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26885 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
26886 0 : err = fd_pubkey_decode_preflight( ctx );
26887 0 : if( FD_UNLIKELY( err ) ) return err;
26888 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
26889 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26890 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26891 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
26892 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26893 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26894 0 : self->_unused_off = (uint)( (ulong)ctx->data - (ulong)data );
26895 0 : err = fd_bincode_uint32_decode_preflight( ctx );
26896 0 : if( FD_UNLIKELY( err ) ) return err;
26897 0 : self->_unused_shred_type_off = (uint)( (ulong)ctx->data - (ulong)data );
26898 0 : err = fd_bincode_uint8_decode_preflight( ctx );
26899 0 : if( FD_UNLIKELY( err ) ) return err;
26900 0 : self->num_chunks_off = (uint)( (ulong)ctx->data - (ulong)data );
26901 0 : err = fd_bincode_uint8_decode_preflight( ctx );
26902 0 : if( FD_UNLIKELY( err ) ) return err;
26903 0 : self->chunk_index_off = (uint)( (ulong)ctx->data - (ulong)data );
26904 0 : err = fd_bincode_uint8_decode_preflight( ctx );
26905 0 : if( FD_UNLIKELY( err ) ) return err;
26906 0 : self->chunk_off = (uint)( (ulong)ctx->data - (ulong)data );
26907 0 : ulong chunk_len;
26908 0 : err = fd_bincode_uint64_decode( &chunk_len, ctx );
26909 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26910 0 : if( chunk_len ) {
26911 0 : err = fd_bincode_bytes_decode_preflight( chunk_len, ctx );
26912 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26913 0 : }
26914 0 : return FD_BINCODE_SUCCESS;
26915 0 : }
26916 0 : void fd_gossip_duplicate_shred_new(fd_gossip_duplicate_shred_t * self) {
26917 0 : fd_memset( self, 0, sizeof(fd_gossip_duplicate_shred_t) );
26918 0 : fd_pubkey_new( &self->from );
26919 0 : }
26920 0 : void fd_gossip_duplicate_shred_destroy( fd_gossip_duplicate_shred_t * self, fd_bincode_destroy_ctx_t * ctx ) {
26921 0 : fd_pubkey_destroy( &self->from, ctx );
26922 0 : if( self->chunk ) {
26923 0 : fd_valloc_free( ctx->valloc, self->chunk );
26924 0 : self->chunk = NULL;
26925 0 : }
26926 0 : }
26927 :
26928 0 : ulong fd_gossip_duplicate_shred_footprint( void ){ return FD_GOSSIP_DUPLICATE_SHRED_FOOTPRINT; }
26929 0 : ulong fd_gossip_duplicate_shred_align( void ){ return FD_GOSSIP_DUPLICATE_SHRED_ALIGN; }
26930 :
26931 0 : void fd_gossip_duplicate_shred_walk( void * w, fd_gossip_duplicate_shred_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
26932 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_duplicate_shred", level++ );
26933 0 : fun( w, &self->duplicate_shred_index, "duplicate_shred_index", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
26934 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
26935 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26936 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
26937 0 : fun( w, &self->_unused, "_unused", FD_FLAMENCO_TYPE_UINT, "uint", level );
26938 0 : fun( w, &self->_unused_shred_type, "_unused_shred_type", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
26939 0 : fun( w, &self->num_chunks, "num_chunks", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
26940 0 : fun( w, &self->chunk_index, "chunk_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
26941 0 : fun(w, self->chunk, "chunk", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
26942 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_duplicate_shred", level-- );
26943 0 : }
26944 0 : ulong fd_gossip_duplicate_shred_size( fd_gossip_duplicate_shred_t const * self ) {
26945 0 : ulong size = 0;
26946 0 : size += sizeof(ushort);
26947 0 : size += fd_pubkey_size( &self->from );
26948 0 : size += sizeof(ulong);
26949 0 : size += sizeof(ulong);
26950 0 : size += sizeof(uint);
26951 0 : size += sizeof(char);
26952 0 : size += sizeof(char);
26953 0 : size += sizeof(char);
26954 0 : do {
26955 0 : size += sizeof(ulong);
26956 0 : size += self->chunk_len;
26957 0 : } while(0);
26958 0 : return size;
26959 0 : }
26960 :
26961 0 : int fd_gossip_incremental_snapshot_hashes_decode( fd_gossip_incremental_snapshot_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
26962 0 : void const * data = ctx->data;
26963 0 : int err = fd_gossip_incremental_snapshot_hashes_decode_preflight( ctx );
26964 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26965 0 : ctx->data = data;
26966 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
26967 0 : fd_gossip_incremental_snapshot_hashes_new( self );
26968 0 : }
26969 0 : fd_gossip_incremental_snapshot_hashes_decode_unsafe( self, ctx );
26970 0 : return FD_BINCODE_SUCCESS;
26971 0 : }
26972 0 : int fd_gossip_incremental_snapshot_hashes_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
26973 0 : int err;
26974 0 : err = fd_pubkey_decode_preflight( ctx );
26975 0 : if( FD_UNLIKELY( err ) ) return err;
26976 0 : err = fd_slot_hash_decode_preflight( ctx );
26977 0 : if( FD_UNLIKELY( err ) ) return err;
26978 0 : ulong hashes_len;
26979 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
26980 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26981 0 : if( hashes_len ) {
26982 0 : for( ulong i=0; i < hashes_len; i++ ) {
26983 0 : err = fd_slot_hash_decode_preflight( ctx );
26984 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26985 0 : }
26986 0 : }
26987 0 : err = fd_bincode_uint64_decode_preflight( ctx );
26988 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
26989 0 : return FD_BINCODE_SUCCESS;
26990 0 : }
26991 0 : void fd_gossip_incremental_snapshot_hashes_decode_unsafe( fd_gossip_incremental_snapshot_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
26992 0 : fd_pubkey_decode_unsafe( &self->from, ctx );
26993 0 : fd_slot_hash_decode_unsafe( &self->base_hash, ctx );
26994 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
26995 0 : if( self->hashes_len ) {
26996 0 : self->hashes = (fd_slot_hash_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_HASH_ALIGN, FD_SLOT_HASH_FOOTPRINT*self->hashes_len );
26997 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
26998 0 : fd_slot_hash_new( self->hashes + i );
26999 0 : fd_slot_hash_decode_unsafe( self->hashes + i, ctx );
27000 0 : }
27001 0 : } else
27002 0 : self->hashes = NULL;
27003 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
27004 0 : }
27005 0 : int fd_gossip_incremental_snapshot_hashes_encode( fd_gossip_incremental_snapshot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27006 0 : int err;
27007 0 : err = fd_pubkey_encode( &self->from, ctx );
27008 0 : if( FD_UNLIKELY( err ) ) return err;
27009 0 : err = fd_slot_hash_encode( &self->base_hash, ctx );
27010 0 : if( FD_UNLIKELY( err ) ) return err;
27011 0 : err = fd_bincode_uint64_encode( self->hashes_len, ctx );
27012 0 : if( FD_UNLIKELY(err) ) return err;
27013 0 : if( self->hashes_len ) {
27014 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
27015 0 : err = fd_slot_hash_encode( self->hashes + i, ctx );
27016 0 : if( FD_UNLIKELY( err ) ) return err;
27017 0 : }
27018 0 : }
27019 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
27020 0 : if( FD_UNLIKELY( err ) ) return err;
27021 0 : return FD_BINCODE_SUCCESS;
27022 0 : }
27023 0 : int fd_gossip_incremental_snapshot_hashes_decode_offsets( fd_gossip_incremental_snapshot_hashes_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
27024 0 : uchar const * data = ctx->data;
27025 0 : int err;
27026 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
27027 0 : err = fd_pubkey_decode_preflight( ctx );
27028 0 : if( FD_UNLIKELY( err ) ) return err;
27029 0 : self->base_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
27030 0 : err = fd_slot_hash_decode_preflight( ctx );
27031 0 : if( FD_UNLIKELY( err ) ) return err;
27032 0 : self->hashes_off = (uint)( (ulong)ctx->data - (ulong)data );
27033 0 : ulong hashes_len;
27034 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
27035 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27036 0 : if( hashes_len ) {
27037 0 : for( ulong i=0; i < hashes_len; i++ ) {
27038 0 : err = fd_slot_hash_decode_preflight( ctx );
27039 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27040 0 : }
27041 0 : }
27042 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
27043 0 : err = fd_bincode_uint64_decode_preflight( ctx );
27044 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27045 0 : return FD_BINCODE_SUCCESS;
27046 0 : }
27047 0 : void fd_gossip_incremental_snapshot_hashes_new(fd_gossip_incremental_snapshot_hashes_t * self) {
27048 0 : fd_memset( self, 0, sizeof(fd_gossip_incremental_snapshot_hashes_t) );
27049 0 : fd_pubkey_new( &self->from );
27050 0 : fd_slot_hash_new( &self->base_hash );
27051 0 : }
27052 0 : void fd_gossip_incremental_snapshot_hashes_destroy( fd_gossip_incremental_snapshot_hashes_t * self, fd_bincode_destroy_ctx_t * ctx ) {
27053 0 : fd_pubkey_destroy( &self->from, ctx );
27054 0 : fd_slot_hash_destroy( &self->base_hash, ctx );
27055 0 : if( self->hashes ) {
27056 0 : for( ulong i=0; i < self->hashes_len; i++ )
27057 0 : fd_slot_hash_destroy( self->hashes + i, ctx );
27058 0 : fd_valloc_free( ctx->valloc, self->hashes );
27059 0 : self->hashes = NULL;
27060 0 : }
27061 0 : }
27062 :
27063 0 : ulong fd_gossip_incremental_snapshot_hashes_footprint( void ){ return FD_GOSSIP_INCREMENTAL_SNAPSHOT_HASHES_FOOTPRINT; }
27064 0 : ulong fd_gossip_incremental_snapshot_hashes_align( void ){ return FD_GOSSIP_INCREMENTAL_SNAPSHOT_HASHES_ALIGN; }
27065 :
27066 0 : void fd_gossip_incremental_snapshot_hashes_walk( void * w, fd_gossip_incremental_snapshot_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27067 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_incremental_snapshot_hashes", level++ );
27068 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
27069 0 : fd_slot_hash_walk( w, &self->base_hash, fun, "base_hash", level );
27070 0 : if( self->hashes_len ) {
27071 0 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR, "array", level++ );
27072 0 : for( ulong i=0; i < self->hashes_len; i++ )
27073 0 : fd_slot_hash_walk(w, self->hashes + i, fun, "slot_hash", level );
27074 0 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
27075 0 : }
27076 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27077 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_incremental_snapshot_hashes", level-- );
27078 0 : }
27079 0 : ulong fd_gossip_incremental_snapshot_hashes_size( fd_gossip_incremental_snapshot_hashes_t const * self ) {
27080 0 : ulong size = 0;
27081 0 : size += fd_pubkey_size( &self->from );
27082 0 : size += fd_slot_hash_size( &self->base_hash );
27083 0 : do {
27084 0 : size += sizeof(ulong);
27085 0 : for( ulong i=0; i < self->hashes_len; i++ )
27086 0 : size += fd_slot_hash_size( self->hashes + i );
27087 0 : } while(0);
27088 0 : size += sizeof(ulong);
27089 0 : return size;
27090 0 : }
27091 :
27092 0 : int fd_gossip_socket_entry_decode( fd_gossip_socket_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
27093 0 : void const * data = ctx->data;
27094 0 : int err = fd_gossip_socket_entry_decode_preflight( ctx );
27095 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27096 0 : ctx->data = data;
27097 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
27098 0 : fd_gossip_socket_entry_new( self );
27099 0 : }
27100 0 : fd_gossip_socket_entry_decode_unsafe( self, ctx );
27101 0 : return FD_BINCODE_SUCCESS;
27102 0 : }
27103 36 : int fd_gossip_socket_entry_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
27104 36 : int err;
27105 36 : err = fd_bincode_uint8_decode_preflight( ctx );
27106 36 : if( FD_UNLIKELY( err ) ) return err;
27107 36 : err = fd_bincode_uint8_decode_preflight( ctx );
27108 36 : if( FD_UNLIKELY( err ) ) return err;
27109 36 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
27110 36 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27111 36 : return FD_BINCODE_SUCCESS;
27112 36 : }
27113 36 : void fd_gossip_socket_entry_decode_unsafe( fd_gossip_socket_entry_t * self, fd_bincode_decode_ctx_t * ctx ) {
27114 36 : fd_bincode_uint8_decode_unsafe( &self->key, ctx );
27115 36 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
27116 36 : fd_bincode_compact_u16_decode_unsafe( &self->offset, ctx );
27117 36 : }
27118 0 : int fd_gossip_socket_entry_encode( fd_gossip_socket_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27119 0 : int err;
27120 0 : err = fd_bincode_uint8_encode( (uchar)(self->key), ctx );
27121 0 : if( FD_UNLIKELY( err ) ) return err;
27122 0 : err = fd_bincode_uint8_encode( (uchar)(self->index), ctx );
27123 0 : if( FD_UNLIKELY( err ) ) return err;
27124 0 : err = fd_bincode_compact_u16_encode( &self->offset, ctx );
27125 0 : if( FD_UNLIKELY( err ) ) return err;
27126 0 : return FD_BINCODE_SUCCESS;
27127 0 : }
27128 0 : int fd_gossip_socket_entry_decode_offsets( fd_gossip_socket_entry_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
27129 0 : uchar const * data = ctx->data;
27130 0 : int err;
27131 0 : self->key_off = (uint)( (ulong)ctx->data - (ulong)data );
27132 0 : err = fd_bincode_uint8_decode_preflight( ctx );
27133 0 : if( FD_UNLIKELY( err ) ) return err;
27134 0 : self->index_off = (uint)( (ulong)ctx->data - (ulong)data );
27135 0 : err = fd_bincode_uint8_decode_preflight( ctx );
27136 0 : if( FD_UNLIKELY( err ) ) return err;
27137 0 : self->offset_off = (uint)( (ulong)ctx->data - (ulong)data );
27138 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
27139 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27140 0 : return FD_BINCODE_SUCCESS;
27141 0 : }
27142 36 : void fd_gossip_socket_entry_new(fd_gossip_socket_entry_t * self) {
27143 36 : fd_memset( self, 0, sizeof(fd_gossip_socket_entry_t) );
27144 36 : }
27145 0 : void fd_gossip_socket_entry_destroy( fd_gossip_socket_entry_t * self, fd_bincode_destroy_ctx_t * ctx ) {
27146 0 : }
27147 :
27148 0 : ulong fd_gossip_socket_entry_footprint( void ){ return FD_GOSSIP_SOCKET_ENTRY_FOOTPRINT; }
27149 0 : ulong fd_gossip_socket_entry_align( void ){ return FD_GOSSIP_SOCKET_ENTRY_ALIGN; }
27150 :
27151 36 : void fd_gossip_socket_entry_walk( void * w, fd_gossip_socket_entry_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27152 36 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_entry", level++ );
27153 36 : fun( w, &self->key, "key", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
27154 36 : fun( w, &self->index, "index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
27155 36 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27156 36 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_entry", level-- );
27157 36 : }
27158 0 : ulong fd_gossip_socket_entry_size( fd_gossip_socket_entry_t const * self ) {
27159 0 : ulong size = 0;
27160 0 : size += sizeof(char);
27161 0 : size += sizeof(char);
27162 0 : size += fd_bincode_compact_u16_size( &self->offset );
27163 0 : return size;
27164 0 : }
27165 :
27166 0 : int fd_gossip_contact_info_v2_decode( fd_gossip_contact_info_v2_t * self, fd_bincode_decode_ctx_t * ctx ) {
27167 0 : void const * data = ctx->data;
27168 0 : int err = fd_gossip_contact_info_v2_decode_preflight( ctx );
27169 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27170 0 : ctx->data = data;
27171 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
27172 0 : fd_gossip_contact_info_v2_new( self );
27173 0 : }
27174 0 : fd_gossip_contact_info_v2_decode_unsafe( self, ctx );
27175 0 : return FD_BINCODE_SUCCESS;
27176 0 : }
27177 3 : int fd_gossip_contact_info_v2_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
27178 3 : int err;
27179 3 : err = fd_pubkey_decode_preflight( ctx );
27180 3 : if( FD_UNLIKELY( err ) ) return err;
27181 3 : err = fd_bincode_varint_decode_preflight( ctx );
27182 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27183 3 : err = fd_bincode_uint64_decode_preflight( ctx );
27184 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27185 3 : err = fd_bincode_uint16_decode_preflight( ctx );
27186 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27187 3 : err = fd_gossip_version_v3_decode_preflight( ctx );
27188 3 : if( FD_UNLIKELY( err ) ) return err;
27189 3 : ushort addrs_len;
27190 3 : err = fd_bincode_compact_u16_decode( &addrs_len, ctx );
27191 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27192 3 : if( addrs_len ) {
27193 6 : for( ulong i=0; i < addrs_len; i++ ) {
27194 3 : err = fd_gossip_ip_addr_decode_preflight( ctx );
27195 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27196 3 : }
27197 3 : }
27198 3 : ushort sockets_len;
27199 3 : err = fd_bincode_compact_u16_decode( &sockets_len, ctx );
27200 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27201 3 : if( sockets_len ) {
27202 39 : for( ulong i=0; i < sockets_len; i++ ) {
27203 36 : err = fd_gossip_socket_entry_decode_preflight( ctx );
27204 36 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27205 36 : }
27206 3 : }
27207 3 : ushort extensions_len;
27208 3 : err = fd_bincode_compact_u16_decode( &extensions_len, ctx );
27209 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27210 3 : if( extensions_len ) {
27211 0 : for( ulong i=0; i < extensions_len; i++ ) {
27212 0 : err = fd_bincode_uint32_decode_preflight( ctx );
27213 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27214 0 : }
27215 0 : }
27216 3 : return FD_BINCODE_SUCCESS;
27217 3 : }
27218 3 : void fd_gossip_contact_info_v2_decode_unsafe( fd_gossip_contact_info_v2_t * self, fd_bincode_decode_ctx_t * ctx ) {
27219 3 : fd_pubkey_decode_unsafe( &self->from, ctx );
27220 3 : fd_bincode_varint_decode_unsafe( &self->wallclock, ctx );
27221 3 : fd_bincode_uint64_decode_unsafe( &self->outset, ctx );
27222 3 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
27223 3 : fd_gossip_version_v3_decode_unsafe( &self->version, ctx );
27224 3 : fd_bincode_compact_u16_decode_unsafe( &self->addrs_len, ctx );
27225 3 : if( self->addrs_len ) {
27226 3 : self->addrs = (fd_gossip_ip_addr_t *)fd_valloc_malloc( ctx->valloc, FD_GOSSIP_IP_ADDR_ALIGN, FD_GOSSIP_IP_ADDR_FOOTPRINT*self->addrs_len );
27227 6 : for( ulong i=0; i < self->addrs_len; i++ ) {
27228 3 : fd_gossip_ip_addr_new( self->addrs + i );
27229 3 : fd_gossip_ip_addr_decode_unsafe( self->addrs + i, ctx );
27230 3 : }
27231 3 : } else
27232 0 : self->addrs = NULL;
27233 3 : fd_bincode_compact_u16_decode_unsafe( &self->sockets_len, ctx );
27234 3 : if( self->sockets_len ) {
27235 3 : self->sockets = (fd_gossip_socket_entry_t *)fd_valloc_malloc( ctx->valloc, FD_GOSSIP_SOCKET_ENTRY_ALIGN, FD_GOSSIP_SOCKET_ENTRY_FOOTPRINT*self->sockets_len );
27236 39 : for( ulong i=0; i < self->sockets_len; i++ ) {
27237 36 : fd_gossip_socket_entry_new( self->sockets + i );
27238 36 : fd_gossip_socket_entry_decode_unsafe( self->sockets + i, ctx );
27239 36 : }
27240 3 : } else
27241 0 : self->sockets = NULL;
27242 3 : fd_bincode_compact_u16_decode_unsafe( &self->extensions_len, ctx );
27243 3 : if( self->extensions_len ) {
27244 0 : self->extensions = fd_valloc_malloc( ctx->valloc, 8UL, sizeof(uint)*self->extensions_len );
27245 0 : for( ulong i=0; i < self->extensions_len; i++ ) {
27246 0 : fd_bincode_uint32_decode_unsafe( self->extensions + i, ctx );
27247 0 : }
27248 0 : } else
27249 3 : self->extensions = NULL;
27250 3 : }
27251 0 : int fd_gossip_contact_info_v2_encode( fd_gossip_contact_info_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27252 0 : int err;
27253 0 : err = fd_pubkey_encode( &self->from, ctx );
27254 0 : if( FD_UNLIKELY( err ) ) return err;
27255 0 : err = fd_bincode_varint_encode( self->wallclock, ctx );
27256 0 : if( FD_UNLIKELY( err ) ) return err;
27257 0 : err = fd_bincode_uint64_encode( self->outset, ctx );
27258 0 : if( FD_UNLIKELY( err ) ) return err;
27259 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
27260 0 : if( FD_UNLIKELY( err ) ) return err;
27261 0 : err = fd_gossip_version_v3_encode( &self->version, ctx );
27262 0 : if( FD_UNLIKELY( err ) ) return err;
27263 0 : err = fd_bincode_compact_u16_encode( &self->addrs_len, ctx );
27264 0 : if( FD_UNLIKELY(err) ) return err;
27265 0 : if( self->addrs_len ) {
27266 0 : for( ulong i=0; i < self->addrs_len; i++ ) {
27267 0 : err = fd_gossip_ip_addr_encode( self->addrs + i, ctx );
27268 0 : if( FD_UNLIKELY( err ) ) return err;
27269 0 : }
27270 0 : }
27271 0 : err = fd_bincode_compact_u16_encode( &self->sockets_len, ctx );
27272 0 : if( FD_UNLIKELY(err) ) return err;
27273 0 : if( self->sockets_len ) {
27274 0 : for( ulong i=0; i < self->sockets_len; i++ ) {
27275 0 : err = fd_gossip_socket_entry_encode( self->sockets + i, ctx );
27276 0 : if( FD_UNLIKELY( err ) ) return err;
27277 0 : }
27278 0 : }
27279 0 : err = fd_bincode_compact_u16_encode( &self->extensions_len, ctx );
27280 0 : if( FD_UNLIKELY(err) ) return err;
27281 0 : if( self->extensions_len ) {
27282 0 : for( ulong i=0; i < self->extensions_len; i++ ) {
27283 0 : err = fd_bincode_uint32_encode( self->extensions[i], ctx );
27284 0 : }
27285 0 : }
27286 0 : return FD_BINCODE_SUCCESS;
27287 0 : }
27288 0 : int fd_gossip_contact_info_v2_decode_offsets( fd_gossip_contact_info_v2_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
27289 0 : uchar const * data = ctx->data;
27290 0 : int err;
27291 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
27292 0 : err = fd_pubkey_decode_preflight( ctx );
27293 0 : if( FD_UNLIKELY( err ) ) return err;
27294 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
27295 0 : err = fd_bincode_varint_decode_preflight( ctx );
27296 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27297 0 : self->outset_off = (uint)( (ulong)ctx->data - (ulong)data );
27298 0 : err = fd_bincode_uint64_decode_preflight( ctx );
27299 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27300 0 : self->shred_version_off = (uint)( (ulong)ctx->data - (ulong)data );
27301 0 : err = fd_bincode_uint16_decode_preflight( ctx );
27302 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27303 0 : self->version_off = (uint)( (ulong)ctx->data - (ulong)data );
27304 0 : err = fd_gossip_version_v3_decode_preflight( ctx );
27305 0 : if( FD_UNLIKELY( err ) ) return err;
27306 0 : self->addrs_off = (uint)( (ulong)ctx->data - (ulong)data );
27307 0 : ushort addrs_len;
27308 0 : err = fd_bincode_compact_u16_decode( &addrs_len, ctx );
27309 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27310 0 : if( addrs_len ) {
27311 0 : for( ulong i=0; i < addrs_len; i++ ) {
27312 0 : err = fd_gossip_ip_addr_decode_preflight( ctx );
27313 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27314 0 : }
27315 0 : }
27316 0 : self->sockets_off = (uint)( (ulong)ctx->data - (ulong)data );
27317 0 : ushort sockets_len;
27318 0 : err = fd_bincode_compact_u16_decode( &sockets_len, ctx );
27319 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27320 0 : if( sockets_len ) {
27321 0 : for( ulong i=0; i < sockets_len; i++ ) {
27322 0 : err = fd_gossip_socket_entry_decode_preflight( ctx );
27323 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27324 0 : }
27325 0 : }
27326 0 : self->extensions_off = (uint)( (ulong)ctx->data - (ulong)data );
27327 0 : ushort extensions_len;
27328 0 : err = fd_bincode_compact_u16_decode( &extensions_len, ctx );
27329 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27330 0 : if( extensions_len ) {
27331 0 : for( ulong i=0; i < extensions_len; i++ ) {
27332 0 : err = fd_bincode_uint32_decode_preflight( ctx );
27333 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27334 0 : }
27335 0 : }
27336 0 : return FD_BINCODE_SUCCESS;
27337 0 : }
27338 0 : void fd_gossip_contact_info_v2_new(fd_gossip_contact_info_v2_t * self) {
27339 0 : fd_memset( self, 0, sizeof(fd_gossip_contact_info_v2_t) );
27340 0 : fd_pubkey_new( &self->from );
27341 0 : fd_gossip_version_v3_new( &self->version );
27342 0 : }
27343 0 : void fd_gossip_contact_info_v2_destroy( fd_gossip_contact_info_v2_t * self, fd_bincode_destroy_ctx_t * ctx ) {
27344 0 : fd_pubkey_destroy( &self->from, ctx );
27345 0 : fd_gossip_version_v3_destroy( &self->version, ctx );
27346 0 : if( self->addrs ) {
27347 0 : for( ulong i=0; i < self->addrs_len; i++ )
27348 0 : fd_gossip_ip_addr_destroy( self->addrs + i, ctx );
27349 0 : fd_valloc_free( ctx->valloc, self->addrs );
27350 0 : self->addrs = NULL;
27351 0 : }
27352 0 : if( self->sockets ) {
27353 0 : for( ulong i=0; i < self->sockets_len; i++ )
27354 0 : fd_gossip_socket_entry_destroy( self->sockets + i, ctx );
27355 0 : fd_valloc_free( ctx->valloc, self->sockets );
27356 0 : self->sockets = NULL;
27357 0 : }
27358 0 : if( self->extensions ) {
27359 0 : fd_valloc_free( ctx->valloc, self->extensions );
27360 0 : self->extensions = NULL;
27361 0 : }
27362 0 : }
27363 :
27364 0 : ulong fd_gossip_contact_info_v2_footprint( void ){ return FD_GOSSIP_CONTACT_INFO_V2_FOOTPRINT; }
27365 0 : ulong fd_gossip_contact_info_v2_align( void ){ return FD_GOSSIP_CONTACT_INFO_V2_ALIGN; }
27366 :
27367 3 : void fd_gossip_contact_info_v2_walk( void * w, fd_gossip_contact_info_v2_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27368 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_contact_info_v2", level++ );
27369 3 : fd_pubkey_walk( w, &self->from, fun, "from", level );
27370 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27371 3 : fun( w, &self->outset, "outset", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27372 3 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27373 3 : fd_gossip_version_v3_walk( w, &self->version, fun, "version", level );
27374 3 : if( self->addrs_len ) {
27375 3 : fun( w, NULL, "addrs", FD_FLAMENCO_TYPE_ARR, "array", level++ );
27376 6 : for( ulong i=0; i < self->addrs_len; i++ )
27377 3 : fd_gossip_ip_addr_walk(w, self->addrs + i, fun, "gossip_ip_addr", level );
27378 3 : fun( w, NULL, "addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
27379 3 : }
27380 3 : if( self->sockets_len ) {
27381 3 : fun( w, NULL, "sockets", FD_FLAMENCO_TYPE_ARR, "array", level++ );
27382 39 : for( ulong i=0; i < self->sockets_len; i++ )
27383 36 : fd_gossip_socket_entry_walk(w, self->sockets + i, fun, "gossip_socket_entry", level );
27384 3 : fun( w, NULL, "sockets", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
27385 3 : }
27386 3 : if( self->extensions_len ) {
27387 0 : fun( w, NULL, "extensions", FD_FLAMENCO_TYPE_ARR, "array", level++ );
27388 0 : for( ulong i=0; i < self->extensions_len; i++ )
27389 0 : fun( w, self->extensions + i, "extensions", FD_FLAMENCO_TYPE_UINT, "uint", level );
27390 0 : fun( w, NULL, "extensions", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
27391 0 : }
27392 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_contact_info_v2", level-- );
27393 3 : }
27394 0 : ulong fd_gossip_contact_info_v2_size( fd_gossip_contact_info_v2_t const * self ) {
27395 0 : ulong size = 0;
27396 0 : size += fd_pubkey_size( &self->from );
27397 0 : size += fd_bincode_varint_size( self->wallclock );
27398 0 : size += sizeof(ulong);
27399 0 : size += sizeof(ushort);
27400 0 : size += fd_gossip_version_v3_size( &self->version );
27401 0 : do {
27402 0 : ushort tmp = (ushort)self->addrs_len;
27403 0 : size += fd_bincode_compact_u16_size( &tmp );
27404 0 : for( ulong i=0; i < self->addrs_len; i++ )
27405 0 : size += fd_gossip_ip_addr_size( self->addrs + i );
27406 0 : } while(0);
27407 0 : do {
27408 0 : ushort tmp = (ushort)self->sockets_len;
27409 0 : size += fd_bincode_compact_u16_size( &tmp );
27410 0 : for( ulong i=0; i < self->sockets_len; i++ )
27411 0 : size += fd_gossip_socket_entry_size( self->sockets + i );
27412 0 : } while(0);
27413 0 : do {
27414 0 : ushort tmp = (ushort)self->extensions_len;
27415 0 : size += fd_bincode_compact_u16_size( &tmp );
27416 0 : size += self->extensions_len * sizeof(uint);
27417 0 : } while(0);
27418 0 : return size;
27419 0 : }
27420 :
27421 0 : int fd_restart_run_length_encoding_inner_decode( fd_restart_run_length_encoding_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
27422 0 : void const * data = ctx->data;
27423 0 : int err = fd_restart_run_length_encoding_inner_decode_preflight( ctx );
27424 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27425 0 : ctx->data = data;
27426 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
27427 0 : fd_restart_run_length_encoding_inner_new( self );
27428 0 : }
27429 0 : fd_restart_run_length_encoding_inner_decode_unsafe( self, ctx );
27430 0 : return FD_BINCODE_SUCCESS;
27431 0 : }
27432 0 : int fd_restart_run_length_encoding_inner_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
27433 0 : int err;
27434 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
27435 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27436 0 : return FD_BINCODE_SUCCESS;
27437 0 : }
27438 0 : void fd_restart_run_length_encoding_inner_decode_unsafe( fd_restart_run_length_encoding_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
27439 0 : fd_bincode_compact_u16_decode_unsafe( &self->bits, ctx );
27440 0 : }
27441 0 : int fd_restart_run_length_encoding_inner_encode( fd_restart_run_length_encoding_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27442 0 : int err;
27443 0 : err = fd_bincode_compact_u16_encode( &self->bits, ctx );
27444 0 : if( FD_UNLIKELY( err ) ) return err;
27445 0 : return FD_BINCODE_SUCCESS;
27446 0 : }
27447 0 : int fd_restart_run_length_encoding_inner_decode_offsets( fd_restart_run_length_encoding_inner_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
27448 0 : uchar const * data = ctx->data;
27449 0 : int err;
27450 0 : self->bits_off = (uint)( (ulong)ctx->data - (ulong)data );
27451 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
27452 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27453 0 : return FD_BINCODE_SUCCESS;
27454 0 : }
27455 0 : void fd_restart_run_length_encoding_inner_new(fd_restart_run_length_encoding_inner_t * self) {
27456 0 : fd_memset( self, 0, sizeof(fd_restart_run_length_encoding_inner_t) );
27457 0 : }
27458 0 : void fd_restart_run_length_encoding_inner_destroy( fd_restart_run_length_encoding_inner_t * self, fd_bincode_destroy_ctx_t * ctx ) {
27459 0 : }
27460 :
27461 0 : ulong fd_restart_run_length_encoding_inner_footprint( void ){ return FD_RESTART_RUN_LENGTH_ENCODING_INNER_FOOTPRINT; }
27462 0 : ulong fd_restart_run_length_encoding_inner_align( void ){ return FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN; }
27463 :
27464 0 : void fd_restart_run_length_encoding_inner_walk( void * w, fd_restart_run_length_encoding_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27465 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_run_length_encoding_inner", level++ );
27466 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
27467 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_run_length_encoding_inner", level-- );
27468 0 : }
27469 0 : ulong fd_restart_run_length_encoding_inner_size( fd_restart_run_length_encoding_inner_t const * self ) {
27470 0 : ulong size = 0;
27471 0 : size += fd_bincode_compact_u16_size( &self->bits );
27472 0 : return size;
27473 0 : }
27474 :
27475 0 : int fd_restart_run_length_encoding_decode( fd_restart_run_length_encoding_t * self, fd_bincode_decode_ctx_t * ctx ) {
27476 0 : void const * data = ctx->data;
27477 0 : int err = fd_restart_run_length_encoding_decode_preflight( ctx );
27478 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27479 0 : ctx->data = data;
27480 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
27481 0 : fd_restart_run_length_encoding_new( self );
27482 0 : }
27483 0 : fd_restart_run_length_encoding_decode_unsafe( self, ctx );
27484 0 : return FD_BINCODE_SUCCESS;
27485 0 : }
27486 0 : int fd_restart_run_length_encoding_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
27487 0 : int err;
27488 0 : ulong offsets_len;
27489 0 : err = fd_bincode_uint64_decode( &offsets_len, ctx );
27490 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27491 0 : if( offsets_len ) {
27492 0 : for( ulong i=0; i < offsets_len; i++ ) {
27493 0 : err = fd_restart_run_length_encoding_inner_decode_preflight( ctx );
27494 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27495 0 : }
27496 0 : }
27497 0 : return FD_BINCODE_SUCCESS;
27498 0 : }
27499 0 : void fd_restart_run_length_encoding_decode_unsafe( fd_restart_run_length_encoding_t * self, fd_bincode_decode_ctx_t * ctx ) {
27500 0 : fd_bincode_uint64_decode_unsafe( &self->offsets_len, ctx );
27501 0 : if( self->offsets_len ) {
27502 0 : self->offsets = (fd_restart_run_length_encoding_inner_t *)fd_valloc_malloc( ctx->valloc, FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN, FD_RESTART_RUN_LENGTH_ENCODING_INNER_FOOTPRINT*self->offsets_len );
27503 0 : for( ulong i=0; i < self->offsets_len; i++ ) {
27504 0 : fd_restart_run_length_encoding_inner_new( self->offsets + i );
27505 0 : fd_restart_run_length_encoding_inner_decode_unsafe( self->offsets + i, ctx );
27506 0 : }
27507 0 : } else
27508 0 : self->offsets = NULL;
27509 0 : }
27510 0 : int fd_restart_run_length_encoding_encode( fd_restart_run_length_encoding_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27511 0 : int err;
27512 0 : err = fd_bincode_uint64_encode( self->offsets_len, ctx );
27513 0 : if( FD_UNLIKELY(err) ) return err;
27514 0 : if( self->offsets_len ) {
27515 0 : for( ulong i=0; i < self->offsets_len; i++ ) {
27516 0 : err = fd_restart_run_length_encoding_inner_encode( self->offsets + i, ctx );
27517 0 : if( FD_UNLIKELY( err ) ) return err;
27518 0 : }
27519 0 : }
27520 0 : return FD_BINCODE_SUCCESS;
27521 0 : }
27522 0 : int fd_restart_run_length_encoding_decode_offsets( fd_restart_run_length_encoding_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
27523 0 : uchar const * data = ctx->data;
27524 0 : int err;
27525 0 : self->offsets_off = (uint)( (ulong)ctx->data - (ulong)data );
27526 0 : ulong offsets_len;
27527 0 : err = fd_bincode_uint64_decode( &offsets_len, ctx );
27528 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27529 0 : if( offsets_len ) {
27530 0 : for( ulong i=0; i < offsets_len; i++ ) {
27531 0 : err = fd_restart_run_length_encoding_inner_decode_preflight( ctx );
27532 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27533 0 : }
27534 0 : }
27535 0 : return FD_BINCODE_SUCCESS;
27536 0 : }
27537 0 : void fd_restart_run_length_encoding_new(fd_restart_run_length_encoding_t * self) {
27538 0 : fd_memset( self, 0, sizeof(fd_restart_run_length_encoding_t) );
27539 0 : }
27540 0 : void fd_restart_run_length_encoding_destroy( fd_restart_run_length_encoding_t * self, fd_bincode_destroy_ctx_t * ctx ) {
27541 0 : if( self->offsets ) {
27542 0 : for( ulong i=0; i < self->offsets_len; i++ )
27543 0 : fd_restart_run_length_encoding_inner_destroy( self->offsets + i, ctx );
27544 0 : fd_valloc_free( ctx->valloc, self->offsets );
27545 0 : self->offsets = NULL;
27546 0 : }
27547 0 : }
27548 :
27549 0 : ulong fd_restart_run_length_encoding_footprint( void ){ return FD_RESTART_RUN_LENGTH_ENCODING_FOOTPRINT; }
27550 0 : ulong fd_restart_run_length_encoding_align( void ){ return FD_RESTART_RUN_LENGTH_ENCODING_ALIGN; }
27551 :
27552 0 : void fd_restart_run_length_encoding_walk( void * w, fd_restart_run_length_encoding_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27553 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_run_length_encoding", level++ );
27554 0 : if( self->offsets_len ) {
27555 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_ARR, "array", level++ );
27556 0 : for( ulong i=0; i < self->offsets_len; i++ )
27557 0 : fd_restart_run_length_encoding_inner_walk(w, self->offsets + i, fun, "restart_run_length_encoding_inner", level );
27558 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
27559 0 : }
27560 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_run_length_encoding", level-- );
27561 0 : }
27562 0 : ulong fd_restart_run_length_encoding_size( fd_restart_run_length_encoding_t const * self ) {
27563 0 : ulong size = 0;
27564 0 : do {
27565 0 : size += sizeof(ulong);
27566 0 : for( ulong i=0; i < self->offsets_len; i++ )
27567 0 : size += fd_restart_run_length_encoding_inner_size( self->offsets + i );
27568 0 : } while(0);
27569 0 : return size;
27570 0 : }
27571 :
27572 0 : int fd_restart_raw_offsets_bitvec_u8_inner_decode( fd_restart_raw_offsets_bitvec_u8_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
27573 0 : void const * data = ctx->data;
27574 0 : int err = fd_restart_raw_offsets_bitvec_u8_inner_decode_preflight( ctx );
27575 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27576 0 : ctx->data = data;
27577 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
27578 0 : fd_restart_raw_offsets_bitvec_u8_inner_new( self );
27579 0 : }
27580 0 : fd_restart_raw_offsets_bitvec_u8_inner_decode_unsafe( self, ctx );
27581 0 : return FD_BINCODE_SUCCESS;
27582 0 : }
27583 0 : int fd_restart_raw_offsets_bitvec_u8_inner_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
27584 0 : int err;
27585 0 : ulong bits_len;
27586 0 : err = fd_bincode_uint64_decode( &bits_len, ctx );
27587 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27588 0 : if( bits_len ) {
27589 0 : err = fd_bincode_bytes_decode_preflight( bits_len, ctx );
27590 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27591 0 : }
27592 0 : return FD_BINCODE_SUCCESS;
27593 0 : }
27594 0 : void fd_restart_raw_offsets_bitvec_u8_inner_decode_unsafe( fd_restart_raw_offsets_bitvec_u8_inner_t * self, fd_bincode_decode_ctx_t * ctx ) {
27595 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
27596 0 : if( self->bits_len ) {
27597 0 : self->bits = fd_valloc_malloc( ctx->valloc, 8UL, self->bits_len );
27598 0 : fd_bincode_bytes_decode_unsafe( self->bits, self->bits_len, ctx );
27599 0 : } else
27600 0 : self->bits = NULL;
27601 0 : }
27602 0 : int fd_restart_raw_offsets_bitvec_u8_inner_encode( fd_restart_raw_offsets_bitvec_u8_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27603 0 : int err;
27604 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
27605 0 : if( FD_UNLIKELY(err) ) return err;
27606 0 : if( self->bits_len ) {
27607 0 : err = fd_bincode_bytes_encode( self->bits, self->bits_len, ctx );
27608 0 : if( FD_UNLIKELY( err ) ) return err;
27609 0 : }
27610 0 : return FD_BINCODE_SUCCESS;
27611 0 : }
27612 0 : int fd_restart_raw_offsets_bitvec_u8_inner_decode_offsets( fd_restart_raw_offsets_bitvec_u8_inner_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
27613 0 : uchar const * data = ctx->data;
27614 0 : int err;
27615 0 : self->bits_off = (uint)( (ulong)ctx->data - (ulong)data );
27616 0 : ulong bits_len;
27617 0 : err = fd_bincode_uint64_decode( &bits_len, ctx );
27618 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27619 0 : if( bits_len ) {
27620 0 : err = fd_bincode_bytes_decode_preflight( bits_len, ctx );
27621 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27622 0 : }
27623 0 : return FD_BINCODE_SUCCESS;
27624 0 : }
27625 0 : void fd_restart_raw_offsets_bitvec_u8_inner_new(fd_restart_raw_offsets_bitvec_u8_inner_t * self) {
27626 0 : fd_memset( self, 0, sizeof(fd_restart_raw_offsets_bitvec_u8_inner_t) );
27627 0 : }
27628 0 : void fd_restart_raw_offsets_bitvec_u8_inner_destroy( fd_restart_raw_offsets_bitvec_u8_inner_t * self, fd_bincode_destroy_ctx_t * ctx ) {
27629 0 : if( self->bits ) {
27630 0 : fd_valloc_free( ctx->valloc, self->bits );
27631 0 : self->bits = NULL;
27632 0 : }
27633 0 : }
27634 :
27635 0 : ulong fd_restart_raw_offsets_bitvec_u8_inner_footprint( void ){ return FD_RESTART_RAW_OFFSETS_BITVEC_U8_INNER_FOOTPRINT; }
27636 0 : ulong fd_restart_raw_offsets_bitvec_u8_inner_align( void ){ return FD_RESTART_RAW_OFFSETS_BITVEC_U8_INNER_ALIGN; }
27637 :
27638 0 : void fd_restart_raw_offsets_bitvec_u8_inner_walk( void * w, fd_restart_raw_offsets_bitvec_u8_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27639 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_raw_offsets_bitvec_u8_inner", level++ );
27640 0 : fun(w, self->bits, "bits", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
27641 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_raw_offsets_bitvec_u8_inner", level-- );
27642 0 : }
27643 0 : ulong fd_restart_raw_offsets_bitvec_u8_inner_size( fd_restart_raw_offsets_bitvec_u8_inner_t const * self ) {
27644 0 : ulong size = 0;
27645 0 : do {
27646 0 : size += sizeof(ulong);
27647 0 : size += self->bits_len;
27648 0 : } while(0);
27649 0 : return size;
27650 0 : }
27651 :
27652 0 : int fd_restart_raw_offsets_bitvec_decode( fd_restart_raw_offsets_bitvec_t * self, fd_bincode_decode_ctx_t * ctx ) {
27653 0 : void const * data = ctx->data;
27654 0 : int err = fd_restart_raw_offsets_bitvec_decode_preflight( ctx );
27655 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27656 0 : ctx->data = data;
27657 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
27658 0 : fd_restart_raw_offsets_bitvec_new( self );
27659 0 : }
27660 0 : fd_restart_raw_offsets_bitvec_decode_unsafe( self, ctx );
27661 0 : return FD_BINCODE_SUCCESS;
27662 0 : }
27663 0 : int fd_restart_raw_offsets_bitvec_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
27664 0 : int err;
27665 0 : {
27666 0 : uchar o;
27667 0 : err = fd_bincode_bool_decode( &o, ctx );
27668 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27669 0 : if( o ) {
27670 0 : err = fd_restart_raw_offsets_bitvec_u8_inner_decode_preflight( ctx );
27671 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27672 0 : }
27673 0 : }
27674 0 : err = fd_bincode_uint64_decode_preflight( ctx );
27675 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27676 0 : return FD_BINCODE_SUCCESS;
27677 0 : }
27678 0 : void fd_restart_raw_offsets_bitvec_decode_unsafe( fd_restart_raw_offsets_bitvec_t * self, fd_bincode_decode_ctx_t * ctx ) {
27679 0 : {
27680 0 : uchar o;
27681 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
27682 0 : self->has_bits = !!o;
27683 0 : if( o ) {
27684 0 : fd_restart_raw_offsets_bitvec_u8_inner_new( &self->bits );
27685 0 : fd_restart_raw_offsets_bitvec_u8_inner_decode_unsafe( &self->bits, ctx );
27686 0 : }
27687 0 : }
27688 0 : fd_bincode_uint64_decode_unsafe( &self->len, ctx );
27689 0 : }
27690 0 : int fd_restart_raw_offsets_bitvec_encode( fd_restart_raw_offsets_bitvec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27691 0 : int err;
27692 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
27693 0 : if( FD_UNLIKELY( err ) ) return err;
27694 0 : if( self->has_bits ) {
27695 0 : err = fd_restart_raw_offsets_bitvec_u8_inner_encode( &self->bits, ctx );
27696 0 : if( FD_UNLIKELY( err ) ) return err;
27697 0 : }
27698 0 : err = fd_bincode_uint64_encode( self->len, ctx );
27699 0 : if( FD_UNLIKELY( err ) ) return err;
27700 0 : return FD_BINCODE_SUCCESS;
27701 0 : }
27702 0 : int fd_restart_raw_offsets_bitvec_decode_offsets( fd_restart_raw_offsets_bitvec_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
27703 0 : uchar const * data = ctx->data;
27704 0 : int err;
27705 0 : self->bits_off = (uint)( (ulong)ctx->data - (ulong)data );
27706 0 : {
27707 0 : uchar o;
27708 0 : err = fd_bincode_bool_decode( &o, ctx );
27709 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27710 0 : if( o ) {
27711 0 : err = fd_restart_raw_offsets_bitvec_u8_inner_decode_preflight( ctx );
27712 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27713 0 : }
27714 0 : }
27715 0 : self->len_off = (uint)( (ulong)ctx->data - (ulong)data );
27716 0 : err = fd_bincode_uint64_decode_preflight( ctx );
27717 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27718 0 : return FD_BINCODE_SUCCESS;
27719 0 : }
27720 0 : void fd_restart_raw_offsets_bitvec_new(fd_restart_raw_offsets_bitvec_t * self) {
27721 0 : fd_memset( self, 0, sizeof(fd_restart_raw_offsets_bitvec_t) );
27722 0 : }
27723 0 : void fd_restart_raw_offsets_bitvec_destroy( fd_restart_raw_offsets_bitvec_t * self, fd_bincode_destroy_ctx_t * ctx ) {
27724 0 : if( self->has_bits ) {
27725 0 : fd_restart_raw_offsets_bitvec_u8_inner_destroy( &self->bits, ctx );
27726 0 : self->has_bits = 0;
27727 0 : }
27728 0 : }
27729 :
27730 0 : ulong fd_restart_raw_offsets_bitvec_footprint( void ){ return FD_RESTART_RAW_OFFSETS_BITVEC_FOOTPRINT; }
27731 0 : ulong fd_restart_raw_offsets_bitvec_align( void ){ return FD_RESTART_RAW_OFFSETS_BITVEC_ALIGN; }
27732 :
27733 0 : void fd_restart_raw_offsets_bitvec_walk( void * w, fd_restart_raw_offsets_bitvec_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27734 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_raw_offsets_bitvec", level++ );
27735 0 : if( !self->has_bits ) {
27736 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "restart_raw_offsets_bitvec_u8_inner", level );
27737 0 : } else {
27738 0 : fd_restart_raw_offsets_bitvec_u8_inner_walk( w, &self->bits, fun, "bits", level );
27739 0 : }
27740 0 : fun( w, &self->len, "len", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
27741 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_raw_offsets_bitvec", level-- );
27742 0 : }
27743 0 : ulong fd_restart_raw_offsets_bitvec_size( fd_restart_raw_offsets_bitvec_t const * self ) {
27744 0 : ulong size = 0;
27745 0 : size += sizeof(char);
27746 0 : if( self->has_bits ) {
27747 0 : size += fd_restart_raw_offsets_bitvec_u8_inner_size( &self->bits );
27748 0 : }
27749 0 : size += sizeof(ulong);
27750 0 : return size;
27751 0 : }
27752 :
27753 0 : int fd_restart_raw_offsets_decode( fd_restart_raw_offsets_t * self, fd_bincode_decode_ctx_t * ctx ) {
27754 0 : void const * data = ctx->data;
27755 0 : int err = fd_restart_raw_offsets_decode_preflight( ctx );
27756 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27757 0 : ctx->data = data;
27758 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
27759 0 : fd_restart_raw_offsets_new( self );
27760 0 : }
27761 0 : fd_restart_raw_offsets_decode_unsafe( self, ctx );
27762 0 : return FD_BINCODE_SUCCESS;
27763 0 : }
27764 0 : int fd_restart_raw_offsets_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
27765 0 : int err;
27766 0 : err = fd_restart_raw_offsets_bitvec_decode_preflight( ctx );
27767 0 : if( FD_UNLIKELY( err ) ) return err;
27768 0 : return FD_BINCODE_SUCCESS;
27769 0 : }
27770 0 : void fd_restart_raw_offsets_decode_unsafe( fd_restart_raw_offsets_t * self, fd_bincode_decode_ctx_t * ctx ) {
27771 0 : fd_restart_raw_offsets_bitvec_decode_unsafe( &self->offsets, ctx );
27772 0 : }
27773 0 : int fd_restart_raw_offsets_encode( fd_restart_raw_offsets_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27774 0 : int err;
27775 0 : err = fd_restart_raw_offsets_bitvec_encode( &self->offsets, ctx );
27776 0 : if( FD_UNLIKELY( err ) ) return err;
27777 0 : return FD_BINCODE_SUCCESS;
27778 0 : }
27779 0 : int fd_restart_raw_offsets_decode_offsets( fd_restart_raw_offsets_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
27780 0 : uchar const * data = ctx->data;
27781 0 : int err;
27782 0 : self->offsets_off = (uint)( (ulong)ctx->data - (ulong)data );
27783 0 : err = fd_restart_raw_offsets_bitvec_decode_preflight( ctx );
27784 0 : if( FD_UNLIKELY( err ) ) return err;
27785 0 : return FD_BINCODE_SUCCESS;
27786 0 : }
27787 0 : void fd_restart_raw_offsets_new(fd_restart_raw_offsets_t * self) {
27788 0 : fd_memset( self, 0, sizeof(fd_restart_raw_offsets_t) );
27789 0 : fd_restart_raw_offsets_bitvec_new( &self->offsets );
27790 0 : }
27791 0 : void fd_restart_raw_offsets_destroy( fd_restart_raw_offsets_t * self, fd_bincode_destroy_ctx_t * ctx ) {
27792 0 : fd_restart_raw_offsets_bitvec_destroy( &self->offsets, ctx );
27793 0 : }
27794 :
27795 0 : ulong fd_restart_raw_offsets_footprint( void ){ return FD_RESTART_RAW_OFFSETS_FOOTPRINT; }
27796 0 : ulong fd_restart_raw_offsets_align( void ){ return FD_RESTART_RAW_OFFSETS_ALIGN; }
27797 :
27798 0 : void fd_restart_raw_offsets_walk( void * w, fd_restart_raw_offsets_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27799 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_raw_offsets", level++ );
27800 0 : fd_restart_raw_offsets_bitvec_walk( w, &self->offsets, fun, "offsets", level );
27801 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_raw_offsets", level-- );
27802 0 : }
27803 0 : ulong fd_restart_raw_offsets_size( fd_restart_raw_offsets_t const * self ) {
27804 0 : ulong size = 0;
27805 0 : size += fd_restart_raw_offsets_bitvec_size( &self->offsets );
27806 0 : return size;
27807 0 : }
27808 :
27809 0 : FD_FN_PURE uchar fd_restart_slots_offsets_is_run_length_encoding(fd_restart_slots_offsets_t const * self) {
27810 0 : return self->discriminant == 0;
27811 0 : }
27812 0 : FD_FN_PURE uchar fd_restart_slots_offsets_is_raw_offsets(fd_restart_slots_offsets_t const * self) {
27813 0 : return self->discriminant == 1;
27814 0 : }
27815 : void fd_restart_slots_offsets_inner_new( fd_restart_slots_offsets_inner_t * self, uint discriminant );
27816 0 : int fd_restart_slots_offsets_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
27817 0 : int err;
27818 0 : switch (discriminant) {
27819 0 : case 0: {
27820 0 : err = fd_restart_run_length_encoding_decode_preflight( ctx );
27821 0 : if( FD_UNLIKELY( err ) ) return err;
27822 0 : return FD_BINCODE_SUCCESS;
27823 0 : }
27824 0 : case 1: {
27825 0 : err = fd_restart_raw_offsets_decode_preflight( ctx );
27826 0 : if( FD_UNLIKELY( err ) ) return err;
27827 0 : return FD_BINCODE_SUCCESS;
27828 0 : }
27829 0 : default: return FD_BINCODE_ERR_ENCODING;
27830 0 : }
27831 0 : }
27832 0 : void fd_restart_slots_offsets_inner_decode_unsafe( fd_restart_slots_offsets_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
27833 0 : switch (discriminant) {
27834 0 : case 0: {
27835 0 : fd_restart_run_length_encoding_decode_unsafe( &self->run_length_encoding, ctx );
27836 0 : break;
27837 0 : }
27838 0 : case 1: {
27839 0 : fd_restart_raw_offsets_decode_unsafe( &self->raw_offsets, ctx );
27840 0 : break;
27841 0 : }
27842 0 : }
27843 0 : }
27844 0 : int fd_restart_slots_offsets_decode( fd_restart_slots_offsets_t * self, fd_bincode_decode_ctx_t * ctx ) {
27845 0 : void const * data = ctx->data;
27846 0 : int err = fd_restart_slots_offsets_decode_preflight( ctx );
27847 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27848 0 : ctx->data = data;
27849 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
27850 0 : fd_restart_slots_offsets_new( self );
27851 0 : }
27852 0 : fd_restart_slots_offsets_decode_unsafe( self, ctx );
27853 0 : return FD_BINCODE_SUCCESS;
27854 0 : }
27855 0 : int fd_restart_slots_offsets_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
27856 0 : uint discriminant = 0;
27857 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
27858 0 : if( FD_UNLIKELY( err ) ) return err;
27859 0 : return fd_restart_slots_offsets_inner_decode_preflight( discriminant, ctx );
27860 0 : }
27861 0 : void fd_restart_slots_offsets_decode_unsafe( fd_restart_slots_offsets_t * self, fd_bincode_decode_ctx_t * ctx ) {
27862 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
27863 0 : fd_restart_slots_offsets_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
27864 0 : }
27865 0 : void fd_restart_slots_offsets_inner_new( fd_restart_slots_offsets_inner_t * self, uint discriminant ) {
27866 0 : switch( discriminant ) {
27867 0 : case 0: {
27868 0 : fd_restart_run_length_encoding_new( &self->run_length_encoding );
27869 0 : break;
27870 0 : }
27871 0 : case 1: {
27872 0 : fd_restart_raw_offsets_new( &self->raw_offsets );
27873 0 : break;
27874 0 : }
27875 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
27876 0 : }
27877 0 : }
27878 0 : void fd_restart_slots_offsets_new_disc( fd_restart_slots_offsets_t * self, uint discriminant ) {
27879 0 : self->discriminant = discriminant;
27880 0 : fd_restart_slots_offsets_inner_new( &self->inner, self->discriminant );
27881 0 : }
27882 0 : void fd_restart_slots_offsets_new( fd_restart_slots_offsets_t * self ) {
27883 0 : fd_memset( self, 0, sizeof(fd_restart_slots_offsets_t) );
27884 0 : fd_restart_slots_offsets_new_disc( self, UINT_MAX );
27885 0 : }
27886 0 : void fd_restart_slots_offsets_inner_destroy( fd_restart_slots_offsets_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
27887 0 : switch( discriminant ) {
27888 0 : case 0: {
27889 0 : fd_restart_run_length_encoding_destroy( &self->run_length_encoding, ctx );
27890 0 : break;
27891 0 : }
27892 0 : case 1: {
27893 0 : fd_restart_raw_offsets_destroy( &self->raw_offsets, ctx );
27894 0 : break;
27895 0 : }
27896 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
27897 0 : }
27898 0 : }
27899 0 : void fd_restart_slots_offsets_destroy( fd_restart_slots_offsets_t * self, fd_bincode_destroy_ctx_t * ctx ) {
27900 0 : fd_restart_slots_offsets_inner_destroy( &self->inner, self->discriminant, ctx );
27901 0 : }
27902 :
27903 0 : ulong fd_restart_slots_offsets_footprint( void ){ return FD_RESTART_SLOTS_OFFSETS_FOOTPRINT; }
27904 0 : ulong fd_restart_slots_offsets_align( void ){ return FD_RESTART_SLOTS_OFFSETS_ALIGN; }
27905 :
27906 0 : void fd_restart_slots_offsets_walk( void * w, fd_restart_slots_offsets_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
27907 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_restart_slots_offsets", level++);
27908 0 : switch( self->discriminant ) {
27909 0 : case 0: {
27910 0 : fun( w, self, "run_length_encoding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
27911 0 : fd_restart_run_length_encoding_walk( w, &self->inner.run_length_encoding, fun, "run_length_encoding", level );
27912 0 : break;
27913 0 : }
27914 0 : case 1: {
27915 0 : fun( w, self, "raw_offsets", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
27916 0 : fd_restart_raw_offsets_walk( w, &self->inner.raw_offsets, fun, "raw_offsets", level );
27917 0 : break;
27918 0 : }
27919 0 : }
27920 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_restart_slots_offsets", level-- );
27921 0 : }
27922 0 : ulong fd_restart_slots_offsets_size( fd_restart_slots_offsets_t const * self ) {
27923 0 : ulong size = 0;
27924 0 : size += sizeof(uint);
27925 0 : switch (self->discriminant) {
27926 0 : case 0: {
27927 0 : size += fd_restart_run_length_encoding_size( &self->inner.run_length_encoding );
27928 0 : break;
27929 0 : }
27930 0 : case 1: {
27931 0 : size += fd_restart_raw_offsets_size( &self->inner.raw_offsets );
27932 0 : break;
27933 0 : }
27934 0 : }
27935 0 : return size;
27936 0 : }
27937 :
27938 0 : int fd_restart_slots_offsets_inner_encode( fd_restart_slots_offsets_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
27939 0 : int err;
27940 0 : switch (discriminant) {
27941 0 : case 0: {
27942 0 : err = fd_restart_run_length_encoding_encode( &self->run_length_encoding, ctx );
27943 0 : if( FD_UNLIKELY( err ) ) return err;
27944 0 : break;
27945 0 : }
27946 0 : case 1: {
27947 0 : err = fd_restart_raw_offsets_encode( &self->raw_offsets, ctx );
27948 0 : if( FD_UNLIKELY( err ) ) return err;
27949 0 : break;
27950 0 : }
27951 0 : }
27952 0 : return FD_BINCODE_SUCCESS;
27953 0 : }
27954 0 : int fd_restart_slots_offsets_encode( fd_restart_slots_offsets_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27955 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
27956 0 : if( FD_UNLIKELY( err ) ) return err;
27957 0 : return fd_restart_slots_offsets_inner_encode( &self->inner, self->discriminant, ctx );
27958 0 : }
27959 :
27960 0 : int fd_gossip_restart_last_voted_fork_slots_decode( fd_gossip_restart_last_voted_fork_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
27961 0 : void const * data = ctx->data;
27962 0 : int err = fd_gossip_restart_last_voted_fork_slots_decode_preflight( ctx );
27963 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27964 0 : ctx->data = data;
27965 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
27966 0 : fd_gossip_restart_last_voted_fork_slots_new( self );
27967 0 : }
27968 0 : fd_gossip_restart_last_voted_fork_slots_decode_unsafe( self, ctx );
27969 0 : return FD_BINCODE_SUCCESS;
27970 0 : }
27971 0 : int fd_gossip_restart_last_voted_fork_slots_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
27972 0 : int err;
27973 0 : err = fd_pubkey_decode_preflight( ctx );
27974 0 : if( FD_UNLIKELY( err ) ) return err;
27975 0 : err = fd_bincode_uint64_decode_preflight( ctx );
27976 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27977 0 : err = fd_restart_slots_offsets_decode_preflight( ctx );
27978 0 : if( FD_UNLIKELY( err ) ) return err;
27979 0 : err = fd_bincode_uint64_decode_preflight( ctx );
27980 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27981 0 : err = fd_hash_decode_preflight( ctx );
27982 0 : if( FD_UNLIKELY( err ) ) return err;
27983 0 : err = fd_bincode_uint16_decode_preflight( ctx );
27984 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
27985 0 : return FD_BINCODE_SUCCESS;
27986 0 : }
27987 0 : void fd_gossip_restart_last_voted_fork_slots_decode_unsafe( fd_gossip_restart_last_voted_fork_slots_t * self, fd_bincode_decode_ctx_t * ctx ) {
27988 0 : fd_pubkey_decode_unsafe( &self->from, ctx );
27989 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
27990 0 : fd_restart_slots_offsets_decode_unsafe( &self->offsets, ctx );
27991 0 : fd_bincode_uint64_decode_unsafe( &self->last_voted_slot, ctx );
27992 0 : fd_hash_decode_unsafe( &self->last_voted_hash, ctx );
27993 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
27994 0 : }
27995 0 : int fd_gossip_restart_last_voted_fork_slots_encode( fd_gossip_restart_last_voted_fork_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
27996 0 : int err;
27997 0 : err = fd_pubkey_encode( &self->from, ctx );
27998 0 : if( FD_UNLIKELY( err ) ) return err;
27999 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
28000 0 : if( FD_UNLIKELY( err ) ) return err;
28001 0 : err = fd_restart_slots_offsets_encode( &self->offsets, ctx );
28002 0 : if( FD_UNLIKELY( err ) ) return err;
28003 0 : err = fd_bincode_uint64_encode( self->last_voted_slot, ctx );
28004 0 : if( FD_UNLIKELY( err ) ) return err;
28005 0 : err = fd_hash_encode( &self->last_voted_hash, ctx );
28006 0 : if( FD_UNLIKELY( err ) ) return err;
28007 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
28008 0 : if( FD_UNLIKELY( err ) ) return err;
28009 0 : return FD_BINCODE_SUCCESS;
28010 0 : }
28011 0 : int fd_gossip_restart_last_voted_fork_slots_decode_offsets( fd_gossip_restart_last_voted_fork_slots_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
28012 0 : uchar const * data = ctx->data;
28013 0 : int err;
28014 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
28015 0 : err = fd_pubkey_decode_preflight( ctx );
28016 0 : if( FD_UNLIKELY( err ) ) return err;
28017 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
28018 0 : err = fd_bincode_uint64_decode_preflight( ctx );
28019 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28020 0 : self->offsets_off = (uint)( (ulong)ctx->data - (ulong)data );
28021 0 : err = fd_restart_slots_offsets_decode_preflight( ctx );
28022 0 : if( FD_UNLIKELY( err ) ) return err;
28023 0 : self->last_voted_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
28024 0 : err = fd_bincode_uint64_decode_preflight( ctx );
28025 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28026 0 : self->last_voted_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
28027 0 : err = fd_hash_decode_preflight( ctx );
28028 0 : if( FD_UNLIKELY( err ) ) return err;
28029 0 : self->shred_version_off = (uint)( (ulong)ctx->data - (ulong)data );
28030 0 : err = fd_bincode_uint16_decode_preflight( ctx );
28031 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28032 0 : return FD_BINCODE_SUCCESS;
28033 0 : }
28034 0 : void fd_gossip_restart_last_voted_fork_slots_new(fd_gossip_restart_last_voted_fork_slots_t * self) {
28035 0 : fd_memset( self, 0, sizeof(fd_gossip_restart_last_voted_fork_slots_t) );
28036 0 : fd_pubkey_new( &self->from );
28037 0 : fd_restart_slots_offsets_new( &self->offsets );
28038 0 : fd_hash_new( &self->last_voted_hash );
28039 0 : }
28040 0 : void fd_gossip_restart_last_voted_fork_slots_destroy( fd_gossip_restart_last_voted_fork_slots_t * self, fd_bincode_destroy_ctx_t * ctx ) {
28041 0 : fd_pubkey_destroy( &self->from, ctx );
28042 0 : fd_restart_slots_offsets_destroy( &self->offsets, ctx );
28043 0 : fd_hash_destroy( &self->last_voted_hash, ctx );
28044 0 : }
28045 :
28046 0 : ulong fd_gossip_restart_last_voted_fork_slots_footprint( void ){ return FD_GOSSIP_RESTART_LAST_VOTED_FORK_SLOTS_FOOTPRINT; }
28047 0 : ulong fd_gossip_restart_last_voted_fork_slots_align( void ){ return FD_GOSSIP_RESTART_LAST_VOTED_FORK_SLOTS_ALIGN; }
28048 :
28049 0 : void fd_gossip_restart_last_voted_fork_slots_walk( void * w, fd_gossip_restart_last_voted_fork_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28050 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_restart_last_voted_fork_slots", level++ );
28051 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
28052 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28053 0 : fd_restart_slots_offsets_walk( w, &self->offsets, fun, "offsets", level );
28054 0 : fun( w, &self->last_voted_slot, "last_voted_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28055 0 : fd_hash_walk( w, &self->last_voted_hash, fun, "last_voted_hash", level );
28056 0 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
28057 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_restart_last_voted_fork_slots", level-- );
28058 0 : }
28059 0 : ulong fd_gossip_restart_last_voted_fork_slots_size( fd_gossip_restart_last_voted_fork_slots_t const * self ) {
28060 0 : ulong size = 0;
28061 0 : size += fd_pubkey_size( &self->from );
28062 0 : size += sizeof(ulong);
28063 0 : size += fd_restart_slots_offsets_size( &self->offsets );
28064 0 : size += sizeof(ulong);
28065 0 : size += fd_hash_size( &self->last_voted_hash );
28066 0 : size += sizeof(ushort);
28067 0 : return size;
28068 0 : }
28069 :
28070 0 : int fd_gossip_restart_heaviest_fork_decode( fd_gossip_restart_heaviest_fork_t * self, fd_bincode_decode_ctx_t * ctx ) {
28071 0 : void const * data = ctx->data;
28072 0 : int err = fd_gossip_restart_heaviest_fork_decode_preflight( ctx );
28073 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28074 0 : ctx->data = data;
28075 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
28076 0 : fd_gossip_restart_heaviest_fork_new( self );
28077 0 : }
28078 0 : fd_gossip_restart_heaviest_fork_decode_unsafe( self, ctx );
28079 0 : return FD_BINCODE_SUCCESS;
28080 0 : }
28081 0 : int fd_gossip_restart_heaviest_fork_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
28082 0 : return fd_bincode_bytes_decode_preflight( 90, ctx );
28083 0 : }
28084 0 : void fd_gossip_restart_heaviest_fork_decode_unsafe( fd_gossip_restart_heaviest_fork_t * self, fd_bincode_decode_ctx_t * ctx ) {
28085 0 : fd_pubkey_decode_unsafe( &self->from, ctx );
28086 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
28087 0 : fd_bincode_uint64_decode_unsafe( &self->last_slot, ctx );
28088 0 : fd_hash_decode_unsafe( &self->last_slot_hash, ctx );
28089 0 : fd_bincode_uint64_decode_unsafe( &self->observed_stake, ctx );
28090 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
28091 0 : }
28092 0 : int fd_gossip_restart_heaviest_fork_encode( fd_gossip_restart_heaviest_fork_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28093 0 : int err;
28094 0 : err = fd_pubkey_encode( &self->from, ctx );
28095 0 : if( FD_UNLIKELY( err ) ) return err;
28096 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
28097 0 : if( FD_UNLIKELY( err ) ) return err;
28098 0 : err = fd_bincode_uint64_encode( self->last_slot, ctx );
28099 0 : if( FD_UNLIKELY( err ) ) return err;
28100 0 : err = fd_hash_encode( &self->last_slot_hash, ctx );
28101 0 : if( FD_UNLIKELY( err ) ) return err;
28102 0 : err = fd_bincode_uint64_encode( self->observed_stake, ctx );
28103 0 : if( FD_UNLIKELY( err ) ) return err;
28104 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
28105 0 : if( FD_UNLIKELY( err ) ) return err;
28106 0 : return FD_BINCODE_SUCCESS;
28107 0 : }
28108 0 : int fd_gossip_restart_heaviest_fork_decode_offsets( fd_gossip_restart_heaviest_fork_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
28109 0 : uchar const * data = ctx->data;
28110 0 : int err;
28111 0 : self->from_off = (uint)( (ulong)ctx->data - (ulong)data );
28112 0 : err = fd_pubkey_decode_preflight( ctx );
28113 0 : if( FD_UNLIKELY( err ) ) return err;
28114 0 : self->wallclock_off = (uint)( (ulong)ctx->data - (ulong)data );
28115 0 : err = fd_bincode_uint64_decode_preflight( ctx );
28116 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28117 0 : self->last_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
28118 0 : err = fd_bincode_uint64_decode_preflight( ctx );
28119 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28120 0 : self->last_slot_hash_off = (uint)( (ulong)ctx->data - (ulong)data );
28121 0 : err = fd_hash_decode_preflight( ctx );
28122 0 : if( FD_UNLIKELY( err ) ) return err;
28123 0 : self->observed_stake_off = (uint)( (ulong)ctx->data - (ulong)data );
28124 0 : err = fd_bincode_uint64_decode_preflight( ctx );
28125 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28126 0 : self->shred_version_off = (uint)( (ulong)ctx->data - (ulong)data );
28127 0 : err = fd_bincode_uint16_decode_preflight( ctx );
28128 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28129 0 : return FD_BINCODE_SUCCESS;
28130 0 : }
28131 0 : void fd_gossip_restart_heaviest_fork_new(fd_gossip_restart_heaviest_fork_t * self) {
28132 0 : fd_memset( self, 0, sizeof(fd_gossip_restart_heaviest_fork_t) );
28133 0 : fd_pubkey_new( &self->from );
28134 0 : fd_hash_new( &self->last_slot_hash );
28135 0 : }
28136 0 : void fd_gossip_restart_heaviest_fork_destroy( fd_gossip_restart_heaviest_fork_t * self, fd_bincode_destroy_ctx_t * ctx ) {
28137 0 : fd_pubkey_destroy( &self->from, ctx );
28138 0 : fd_hash_destroy( &self->last_slot_hash, ctx );
28139 0 : }
28140 :
28141 0 : ulong fd_gossip_restart_heaviest_fork_footprint( void ){ return FD_GOSSIP_RESTART_HEAVIEST_FORK_FOOTPRINT; }
28142 0 : ulong fd_gossip_restart_heaviest_fork_align( void ){ return FD_GOSSIP_RESTART_HEAVIEST_FORK_ALIGN; }
28143 :
28144 0 : void fd_gossip_restart_heaviest_fork_walk( void * w, fd_gossip_restart_heaviest_fork_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28145 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_restart_heaviest_fork", level++ );
28146 0 : fd_pubkey_walk( w, &self->from, fun, "from", level );
28147 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28148 0 : fun( w, &self->last_slot, "last_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28149 0 : fd_hash_walk( w, &self->last_slot_hash, fun, "last_slot_hash", level );
28150 0 : fun( w, &self->observed_stake, "observed_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28151 0 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level );
28152 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_restart_heaviest_fork", level-- );
28153 0 : }
28154 0 : ulong fd_gossip_restart_heaviest_fork_size( fd_gossip_restart_heaviest_fork_t const * self ) {
28155 0 : ulong size = 0;
28156 0 : size += fd_pubkey_size( &self->from );
28157 0 : size += sizeof(ulong);
28158 0 : size += sizeof(ulong);
28159 0 : size += fd_hash_size( &self->last_slot_hash );
28160 0 : size += sizeof(ulong);
28161 0 : size += sizeof(ushort);
28162 0 : return size;
28163 0 : }
28164 :
28165 0 : FD_FN_PURE uchar fd_crds_data_is_contact_info_v1(fd_crds_data_t const * self) {
28166 0 : return self->discriminant == 0;
28167 0 : }
28168 0 : FD_FN_PURE uchar fd_crds_data_is_vote(fd_crds_data_t const * self) {
28169 0 : return self->discriminant == 1;
28170 0 : }
28171 0 : FD_FN_PURE uchar fd_crds_data_is_lowest_slot(fd_crds_data_t const * self) {
28172 0 : return self->discriminant == 2;
28173 0 : }
28174 0 : FD_FN_PURE uchar fd_crds_data_is_snapshot_hashes(fd_crds_data_t const * self) {
28175 0 : return self->discriminant == 3;
28176 0 : }
28177 0 : FD_FN_PURE uchar fd_crds_data_is_accounts_hashes(fd_crds_data_t const * self) {
28178 0 : return self->discriminant == 4;
28179 0 : }
28180 0 : FD_FN_PURE uchar fd_crds_data_is_epoch_slots(fd_crds_data_t const * self) {
28181 0 : return self->discriminant == 5;
28182 0 : }
28183 0 : FD_FN_PURE uchar fd_crds_data_is_version_v1(fd_crds_data_t const * self) {
28184 0 : return self->discriminant == 6;
28185 0 : }
28186 0 : FD_FN_PURE uchar fd_crds_data_is_version_v2(fd_crds_data_t const * self) {
28187 0 : return self->discriminant == 7;
28188 0 : }
28189 0 : FD_FN_PURE uchar fd_crds_data_is_node_instance(fd_crds_data_t const * self) {
28190 0 : return self->discriminant == 8;
28191 0 : }
28192 0 : FD_FN_PURE uchar fd_crds_data_is_duplicate_shred(fd_crds_data_t const * self) {
28193 0 : return self->discriminant == 9;
28194 0 : }
28195 0 : FD_FN_PURE uchar fd_crds_data_is_incremental_snapshot_hashes(fd_crds_data_t const * self) {
28196 0 : return self->discriminant == 10;
28197 0 : }
28198 0 : FD_FN_PURE uchar fd_crds_data_is_contact_info_v2(fd_crds_data_t const * self) {
28199 0 : return self->discriminant == 11;
28200 0 : }
28201 0 : FD_FN_PURE uchar fd_crds_data_is_restart_last_voted_fork_slots(fd_crds_data_t const * self) {
28202 0 : return self->discriminant == 12;
28203 0 : }
28204 0 : FD_FN_PURE uchar fd_crds_data_is_restart_heaviest_fork(fd_crds_data_t const * self) {
28205 0 : return self->discriminant == 13;
28206 0 : }
28207 : void fd_crds_data_inner_new( fd_crds_data_inner_t * self, uint discriminant );
28208 30 : int fd_crds_data_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
28209 30 : int err;
28210 30 : switch (discriminant) {
28211 9 : case 0: {
28212 9 : err = fd_gossip_contact_info_v1_decode_preflight( ctx );
28213 9 : if( FD_UNLIKELY( err ) ) return err;
28214 9 : return FD_BINCODE_SUCCESS;
28215 9 : }
28216 6 : case 1: {
28217 6 : err = fd_gossip_vote_decode_preflight( ctx );
28218 6 : if( FD_UNLIKELY( err ) ) return err;
28219 6 : return FD_BINCODE_SUCCESS;
28220 6 : }
28221 0 : case 2: {
28222 0 : err = fd_gossip_lowest_slot_decode_preflight( ctx );
28223 0 : if( FD_UNLIKELY( err ) ) return err;
28224 0 : return FD_BINCODE_SUCCESS;
28225 0 : }
28226 3 : case 3: {
28227 3 : err = fd_gossip_slot_hashes_decode_preflight( ctx );
28228 3 : if( FD_UNLIKELY( err ) ) return err;
28229 3 : return FD_BINCODE_SUCCESS;
28230 3 : }
28231 0 : case 4: {
28232 0 : err = fd_gossip_slot_hashes_decode_preflight( ctx );
28233 0 : if( FD_UNLIKELY( err ) ) return err;
28234 0 : return FD_BINCODE_SUCCESS;
28235 0 : }
28236 0 : case 5: {
28237 0 : err = fd_gossip_epoch_slots_decode_preflight( ctx );
28238 0 : if( FD_UNLIKELY( err ) ) return err;
28239 0 : return FD_BINCODE_SUCCESS;
28240 0 : }
28241 0 : case 6: {
28242 0 : err = fd_gossip_version_v1_decode_preflight( ctx );
28243 0 : if( FD_UNLIKELY( err ) ) return err;
28244 0 : return FD_BINCODE_SUCCESS;
28245 0 : }
28246 3 : case 7: {
28247 3 : err = fd_gossip_version_v2_decode_preflight( ctx );
28248 3 : if( FD_UNLIKELY( err ) ) return err;
28249 3 : return FD_BINCODE_SUCCESS;
28250 3 : }
28251 6 : case 8: {
28252 6 : err = fd_gossip_node_instance_decode_preflight( ctx );
28253 6 : if( FD_UNLIKELY( err ) ) return err;
28254 6 : return FD_BINCODE_SUCCESS;
28255 6 : }
28256 0 : case 9: {
28257 0 : err = fd_gossip_duplicate_shred_decode_preflight( ctx );
28258 0 : if( FD_UNLIKELY( err ) ) return err;
28259 0 : return FD_BINCODE_SUCCESS;
28260 0 : }
28261 0 : case 10: {
28262 0 : err = fd_gossip_incremental_snapshot_hashes_decode_preflight( ctx );
28263 0 : if( FD_UNLIKELY( err ) ) return err;
28264 0 : return FD_BINCODE_SUCCESS;
28265 0 : }
28266 3 : case 11: {
28267 3 : err = fd_gossip_contact_info_v2_decode_preflight( ctx );
28268 3 : if( FD_UNLIKELY( err ) ) return err;
28269 3 : return FD_BINCODE_SUCCESS;
28270 3 : }
28271 0 : case 12: {
28272 0 : err = fd_gossip_restart_last_voted_fork_slots_decode_preflight( ctx );
28273 0 : if( FD_UNLIKELY( err ) ) return err;
28274 0 : return FD_BINCODE_SUCCESS;
28275 0 : }
28276 0 : case 13: {
28277 0 : err = fd_gossip_restart_heaviest_fork_decode_preflight( ctx );
28278 0 : if( FD_UNLIKELY( err ) ) return err;
28279 0 : return FD_BINCODE_SUCCESS;
28280 0 : }
28281 0 : default: return FD_BINCODE_ERR_ENCODING;
28282 30 : }
28283 30 : }
28284 30 : void fd_crds_data_inner_decode_unsafe( fd_crds_data_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
28285 30 : switch (discriminant) {
28286 9 : case 0: {
28287 9 : fd_gossip_contact_info_v1_decode_unsafe( &self->contact_info_v1, ctx );
28288 9 : break;
28289 0 : }
28290 6 : case 1: {
28291 6 : fd_gossip_vote_decode_unsafe( &self->vote, ctx );
28292 6 : break;
28293 0 : }
28294 0 : case 2: {
28295 0 : fd_gossip_lowest_slot_decode_unsafe( &self->lowest_slot, ctx );
28296 0 : break;
28297 0 : }
28298 3 : case 3: {
28299 3 : fd_gossip_slot_hashes_decode_unsafe( &self->snapshot_hashes, ctx );
28300 3 : break;
28301 0 : }
28302 0 : case 4: {
28303 0 : fd_gossip_slot_hashes_decode_unsafe( &self->accounts_hashes, ctx );
28304 0 : break;
28305 0 : }
28306 0 : case 5: {
28307 0 : fd_gossip_epoch_slots_decode_unsafe( &self->epoch_slots, ctx );
28308 0 : break;
28309 0 : }
28310 0 : case 6: {
28311 0 : fd_gossip_version_v1_decode_unsafe( &self->version_v1, ctx );
28312 0 : break;
28313 0 : }
28314 3 : case 7: {
28315 3 : fd_gossip_version_v2_decode_unsafe( &self->version_v2, ctx );
28316 3 : break;
28317 0 : }
28318 6 : case 8: {
28319 6 : fd_gossip_node_instance_decode_unsafe( &self->node_instance, ctx );
28320 6 : break;
28321 0 : }
28322 0 : case 9: {
28323 0 : fd_gossip_duplicate_shred_decode_unsafe( &self->duplicate_shred, ctx );
28324 0 : break;
28325 0 : }
28326 0 : case 10: {
28327 0 : fd_gossip_incremental_snapshot_hashes_decode_unsafe( &self->incremental_snapshot_hashes, ctx );
28328 0 : break;
28329 0 : }
28330 3 : case 11: {
28331 3 : fd_gossip_contact_info_v2_decode_unsafe( &self->contact_info_v2, ctx );
28332 3 : break;
28333 0 : }
28334 0 : case 12: {
28335 0 : fd_gossip_restart_last_voted_fork_slots_decode_unsafe( &self->restart_last_voted_fork_slots, ctx );
28336 0 : break;
28337 0 : }
28338 0 : case 13: {
28339 0 : fd_gossip_restart_heaviest_fork_decode_unsafe( &self->restart_heaviest_fork, ctx );
28340 0 : break;
28341 0 : }
28342 30 : }
28343 30 : }
28344 0 : int fd_crds_data_decode( fd_crds_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
28345 0 : void const * data = ctx->data;
28346 0 : int err = fd_crds_data_decode_preflight( ctx );
28347 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28348 0 : ctx->data = data;
28349 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
28350 0 : fd_crds_data_new( self );
28351 0 : }
28352 0 : fd_crds_data_decode_unsafe( self, ctx );
28353 0 : return FD_BINCODE_SUCCESS;
28354 0 : }
28355 30 : int fd_crds_data_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
28356 30 : uint discriminant = 0;
28357 30 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
28358 30 : if( FD_UNLIKELY( err ) ) return err;
28359 30 : return fd_crds_data_inner_decode_preflight( discriminant, ctx );
28360 30 : }
28361 30 : void fd_crds_data_decode_unsafe( fd_crds_data_t * self, fd_bincode_decode_ctx_t * ctx ) {
28362 30 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
28363 30 : fd_crds_data_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
28364 30 : }
28365 27 : void fd_crds_data_inner_new( fd_crds_data_inner_t * self, uint discriminant ) {
28366 27 : switch( discriminant ) {
28367 0 : case 0: {
28368 0 : fd_gossip_contact_info_v1_new( &self->contact_info_v1 );
28369 0 : break;
28370 0 : }
28371 0 : case 1: {
28372 0 : fd_gossip_vote_new( &self->vote );
28373 0 : break;
28374 0 : }
28375 0 : case 2: {
28376 0 : fd_gossip_lowest_slot_new( &self->lowest_slot );
28377 0 : break;
28378 0 : }
28379 0 : case 3: {
28380 0 : fd_gossip_slot_hashes_new( &self->snapshot_hashes );
28381 0 : break;
28382 0 : }
28383 0 : case 4: {
28384 0 : fd_gossip_slot_hashes_new( &self->accounts_hashes );
28385 0 : break;
28386 0 : }
28387 0 : case 5: {
28388 0 : fd_gossip_epoch_slots_new( &self->epoch_slots );
28389 0 : break;
28390 0 : }
28391 0 : case 6: {
28392 0 : fd_gossip_version_v1_new( &self->version_v1 );
28393 0 : break;
28394 0 : }
28395 0 : case 7: {
28396 0 : fd_gossip_version_v2_new( &self->version_v2 );
28397 0 : break;
28398 0 : }
28399 0 : case 8: {
28400 0 : fd_gossip_node_instance_new( &self->node_instance );
28401 0 : break;
28402 0 : }
28403 0 : case 9: {
28404 0 : fd_gossip_duplicate_shred_new( &self->duplicate_shred );
28405 0 : break;
28406 0 : }
28407 0 : case 10: {
28408 0 : fd_gossip_incremental_snapshot_hashes_new( &self->incremental_snapshot_hashes );
28409 0 : break;
28410 0 : }
28411 0 : case 11: {
28412 0 : fd_gossip_contact_info_v2_new( &self->contact_info_v2 );
28413 0 : break;
28414 0 : }
28415 0 : case 12: {
28416 0 : fd_gossip_restart_last_voted_fork_slots_new( &self->restart_last_voted_fork_slots );
28417 0 : break;
28418 0 : }
28419 0 : case 13: {
28420 0 : fd_gossip_restart_heaviest_fork_new( &self->restart_heaviest_fork );
28421 0 : break;
28422 0 : }
28423 27 : default: break; // FD_LOG_ERR(( "unhandled type"));
28424 27 : }
28425 27 : }
28426 27 : void fd_crds_data_new_disc( fd_crds_data_t * self, uint discriminant ) {
28427 27 : self->discriminant = discriminant;
28428 27 : fd_crds_data_inner_new( &self->inner, self->discriminant );
28429 27 : }
28430 27 : void fd_crds_data_new( fd_crds_data_t * self ) {
28431 27 : fd_memset( self, 0, sizeof(fd_crds_data_t) );
28432 27 : fd_crds_data_new_disc( self, UINT_MAX );
28433 27 : }
28434 0 : void fd_crds_data_inner_destroy( fd_crds_data_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
28435 0 : switch( discriminant ) {
28436 0 : case 0: {
28437 0 : fd_gossip_contact_info_v1_destroy( &self->contact_info_v1, ctx );
28438 0 : break;
28439 0 : }
28440 0 : case 1: {
28441 0 : fd_gossip_vote_destroy( &self->vote, ctx );
28442 0 : break;
28443 0 : }
28444 0 : case 2: {
28445 0 : fd_gossip_lowest_slot_destroy( &self->lowest_slot, ctx );
28446 0 : break;
28447 0 : }
28448 0 : case 3: {
28449 0 : fd_gossip_slot_hashes_destroy( &self->snapshot_hashes, ctx );
28450 0 : break;
28451 0 : }
28452 0 : case 4: {
28453 0 : fd_gossip_slot_hashes_destroy( &self->accounts_hashes, ctx );
28454 0 : break;
28455 0 : }
28456 0 : case 5: {
28457 0 : fd_gossip_epoch_slots_destroy( &self->epoch_slots, ctx );
28458 0 : break;
28459 0 : }
28460 0 : case 6: {
28461 0 : fd_gossip_version_v1_destroy( &self->version_v1, ctx );
28462 0 : break;
28463 0 : }
28464 0 : case 7: {
28465 0 : fd_gossip_version_v2_destroy( &self->version_v2, ctx );
28466 0 : break;
28467 0 : }
28468 0 : case 8: {
28469 0 : fd_gossip_node_instance_destroy( &self->node_instance, ctx );
28470 0 : break;
28471 0 : }
28472 0 : case 9: {
28473 0 : fd_gossip_duplicate_shred_destroy( &self->duplicate_shred, ctx );
28474 0 : break;
28475 0 : }
28476 0 : case 10: {
28477 0 : fd_gossip_incremental_snapshot_hashes_destroy( &self->incremental_snapshot_hashes, ctx );
28478 0 : break;
28479 0 : }
28480 0 : case 11: {
28481 0 : fd_gossip_contact_info_v2_destroy( &self->contact_info_v2, ctx );
28482 0 : break;
28483 0 : }
28484 0 : case 12: {
28485 0 : fd_gossip_restart_last_voted_fork_slots_destroy( &self->restart_last_voted_fork_slots, ctx );
28486 0 : break;
28487 0 : }
28488 0 : case 13: {
28489 0 : fd_gossip_restart_heaviest_fork_destroy( &self->restart_heaviest_fork, ctx );
28490 0 : break;
28491 0 : }
28492 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
28493 0 : }
28494 0 : }
28495 0 : void fd_crds_data_destroy( fd_crds_data_t * self, fd_bincode_destroy_ctx_t * ctx ) {
28496 0 : fd_crds_data_inner_destroy( &self->inner, self->discriminant, ctx );
28497 0 : }
28498 :
28499 0 : ulong fd_crds_data_footprint( void ){ return FD_CRDS_DATA_FOOTPRINT; }
28500 0 : ulong fd_crds_data_align( void ){ return FD_CRDS_DATA_ALIGN; }
28501 :
28502 30 : void fd_crds_data_walk( void * w, fd_crds_data_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28503 30 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_crds_data", level++);
28504 30 : switch( self->discriminant ) {
28505 9 : case 0: {
28506 9 : fun( w, self, "contact_info_v1", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28507 9 : fd_gossip_contact_info_v1_walk( w, &self->inner.contact_info_v1, fun, "contact_info_v1", level );
28508 9 : break;
28509 0 : }
28510 6 : case 1: {
28511 6 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28512 6 : fd_gossip_vote_walk( w, &self->inner.vote, fun, "vote", level );
28513 6 : break;
28514 0 : }
28515 0 : case 2: {
28516 0 : fun( w, self, "lowest_slot", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28517 0 : fd_gossip_lowest_slot_walk( w, &self->inner.lowest_slot, fun, "lowest_slot", level );
28518 0 : break;
28519 0 : }
28520 3 : case 3: {
28521 3 : fun( w, self, "snapshot_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28522 3 : fd_gossip_slot_hashes_walk( w, &self->inner.snapshot_hashes, fun, "snapshot_hashes", level );
28523 3 : break;
28524 0 : }
28525 0 : case 4: {
28526 0 : fun( w, self, "accounts_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28527 0 : fd_gossip_slot_hashes_walk( w, &self->inner.accounts_hashes, fun, "accounts_hashes", level );
28528 0 : break;
28529 0 : }
28530 0 : case 5: {
28531 0 : fun( w, self, "epoch_slots", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28532 0 : fd_gossip_epoch_slots_walk( w, &self->inner.epoch_slots, fun, "epoch_slots", level );
28533 0 : break;
28534 0 : }
28535 0 : case 6: {
28536 0 : fun( w, self, "version_v1", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28537 0 : fd_gossip_version_v1_walk( w, &self->inner.version_v1, fun, "version_v1", level );
28538 0 : break;
28539 0 : }
28540 3 : case 7: {
28541 3 : fun( w, self, "version_v2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28542 3 : fd_gossip_version_v2_walk( w, &self->inner.version_v2, fun, "version_v2", level );
28543 3 : break;
28544 0 : }
28545 6 : case 8: {
28546 6 : fun( w, self, "node_instance", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28547 6 : fd_gossip_node_instance_walk( w, &self->inner.node_instance, fun, "node_instance", level );
28548 6 : break;
28549 0 : }
28550 0 : case 9: {
28551 0 : fun( w, self, "duplicate_shred", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28552 0 : fd_gossip_duplicate_shred_walk( w, &self->inner.duplicate_shred, fun, "duplicate_shred", level );
28553 0 : break;
28554 0 : }
28555 0 : case 10: {
28556 0 : fun( w, self, "incremental_snapshot_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28557 0 : fd_gossip_incremental_snapshot_hashes_walk( w, &self->inner.incremental_snapshot_hashes, fun, "incremental_snapshot_hashes", level );
28558 0 : break;
28559 0 : }
28560 3 : case 11: {
28561 3 : fun( w, self, "contact_info_v2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28562 3 : fd_gossip_contact_info_v2_walk( w, &self->inner.contact_info_v2, fun, "contact_info_v2", level );
28563 3 : break;
28564 0 : }
28565 0 : case 12: {
28566 0 : fun( w, self, "restart_last_voted_fork_slots", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28567 0 : fd_gossip_restart_last_voted_fork_slots_walk( w, &self->inner.restart_last_voted_fork_slots, fun, "restart_last_voted_fork_slots", level );
28568 0 : break;
28569 0 : }
28570 0 : case 13: {
28571 0 : fun( w, self, "restart_heaviest_fork", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
28572 0 : fd_gossip_restart_heaviest_fork_walk( w, &self->inner.restart_heaviest_fork, fun, "restart_heaviest_fork", level );
28573 0 : break;
28574 0 : }
28575 30 : }
28576 30 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_crds_data", level-- );
28577 30 : }
28578 0 : ulong fd_crds_data_size( fd_crds_data_t const * self ) {
28579 0 : ulong size = 0;
28580 0 : size += sizeof(uint);
28581 0 : switch (self->discriminant) {
28582 0 : case 0: {
28583 0 : size += fd_gossip_contact_info_v1_size( &self->inner.contact_info_v1 );
28584 0 : break;
28585 0 : }
28586 0 : case 1: {
28587 0 : size += fd_gossip_vote_size( &self->inner.vote );
28588 0 : break;
28589 0 : }
28590 0 : case 2: {
28591 0 : size += fd_gossip_lowest_slot_size( &self->inner.lowest_slot );
28592 0 : break;
28593 0 : }
28594 0 : case 3: {
28595 0 : size += fd_gossip_slot_hashes_size( &self->inner.snapshot_hashes );
28596 0 : break;
28597 0 : }
28598 0 : case 4: {
28599 0 : size += fd_gossip_slot_hashes_size( &self->inner.accounts_hashes );
28600 0 : break;
28601 0 : }
28602 0 : case 5: {
28603 0 : size += fd_gossip_epoch_slots_size( &self->inner.epoch_slots );
28604 0 : break;
28605 0 : }
28606 0 : case 6: {
28607 0 : size += fd_gossip_version_v1_size( &self->inner.version_v1 );
28608 0 : break;
28609 0 : }
28610 0 : case 7: {
28611 0 : size += fd_gossip_version_v2_size( &self->inner.version_v2 );
28612 0 : break;
28613 0 : }
28614 0 : case 8: {
28615 0 : size += fd_gossip_node_instance_size( &self->inner.node_instance );
28616 0 : break;
28617 0 : }
28618 0 : case 9: {
28619 0 : size += fd_gossip_duplicate_shred_size( &self->inner.duplicate_shred );
28620 0 : break;
28621 0 : }
28622 0 : case 10: {
28623 0 : size += fd_gossip_incremental_snapshot_hashes_size( &self->inner.incremental_snapshot_hashes );
28624 0 : break;
28625 0 : }
28626 0 : case 11: {
28627 0 : size += fd_gossip_contact_info_v2_size( &self->inner.contact_info_v2 );
28628 0 : break;
28629 0 : }
28630 0 : case 12: {
28631 0 : size += fd_gossip_restart_last_voted_fork_slots_size( &self->inner.restart_last_voted_fork_slots );
28632 0 : break;
28633 0 : }
28634 0 : case 13: {
28635 0 : size += fd_gossip_restart_heaviest_fork_size( &self->inner.restart_heaviest_fork );
28636 0 : break;
28637 0 : }
28638 0 : }
28639 0 : return size;
28640 0 : }
28641 :
28642 0 : int fd_crds_data_inner_encode( fd_crds_data_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
28643 0 : int err;
28644 0 : switch (discriminant) {
28645 0 : case 0: {
28646 0 : err = fd_gossip_contact_info_v1_encode( &self->contact_info_v1, ctx );
28647 0 : if( FD_UNLIKELY( err ) ) return err;
28648 0 : break;
28649 0 : }
28650 0 : case 1: {
28651 0 : err = fd_gossip_vote_encode( &self->vote, ctx );
28652 0 : if( FD_UNLIKELY( err ) ) return err;
28653 0 : break;
28654 0 : }
28655 0 : case 2: {
28656 0 : err = fd_gossip_lowest_slot_encode( &self->lowest_slot, ctx );
28657 0 : if( FD_UNLIKELY( err ) ) return err;
28658 0 : break;
28659 0 : }
28660 0 : case 3: {
28661 0 : err = fd_gossip_slot_hashes_encode( &self->snapshot_hashes, ctx );
28662 0 : if( FD_UNLIKELY( err ) ) return err;
28663 0 : break;
28664 0 : }
28665 0 : case 4: {
28666 0 : err = fd_gossip_slot_hashes_encode( &self->accounts_hashes, ctx );
28667 0 : if( FD_UNLIKELY( err ) ) return err;
28668 0 : break;
28669 0 : }
28670 0 : case 5: {
28671 0 : err = fd_gossip_epoch_slots_encode( &self->epoch_slots, ctx );
28672 0 : if( FD_UNLIKELY( err ) ) return err;
28673 0 : break;
28674 0 : }
28675 0 : case 6: {
28676 0 : err = fd_gossip_version_v1_encode( &self->version_v1, ctx );
28677 0 : if( FD_UNLIKELY( err ) ) return err;
28678 0 : break;
28679 0 : }
28680 0 : case 7: {
28681 0 : err = fd_gossip_version_v2_encode( &self->version_v2, ctx );
28682 0 : if( FD_UNLIKELY( err ) ) return err;
28683 0 : break;
28684 0 : }
28685 0 : case 8: {
28686 0 : err = fd_gossip_node_instance_encode( &self->node_instance, ctx );
28687 0 : if( FD_UNLIKELY( err ) ) return err;
28688 0 : break;
28689 0 : }
28690 0 : case 9: {
28691 0 : err = fd_gossip_duplicate_shred_encode( &self->duplicate_shred, ctx );
28692 0 : if( FD_UNLIKELY( err ) ) return err;
28693 0 : break;
28694 0 : }
28695 0 : case 10: {
28696 0 : err = fd_gossip_incremental_snapshot_hashes_encode( &self->incremental_snapshot_hashes, ctx );
28697 0 : if( FD_UNLIKELY( err ) ) return err;
28698 0 : break;
28699 0 : }
28700 0 : case 11: {
28701 0 : err = fd_gossip_contact_info_v2_encode( &self->contact_info_v2, ctx );
28702 0 : if( FD_UNLIKELY( err ) ) return err;
28703 0 : break;
28704 0 : }
28705 0 : case 12: {
28706 0 : err = fd_gossip_restart_last_voted_fork_slots_encode( &self->restart_last_voted_fork_slots, ctx );
28707 0 : if( FD_UNLIKELY( err ) ) return err;
28708 0 : break;
28709 0 : }
28710 0 : case 13: {
28711 0 : err = fd_gossip_restart_heaviest_fork_encode( &self->restart_heaviest_fork, ctx );
28712 0 : if( FD_UNLIKELY( err ) ) return err;
28713 0 : break;
28714 0 : }
28715 0 : }
28716 0 : return FD_BINCODE_SUCCESS;
28717 0 : }
28718 0 : int fd_crds_data_encode( fd_crds_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28719 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
28720 0 : if( FD_UNLIKELY( err ) ) return err;
28721 0 : return fd_crds_data_inner_encode( &self->inner, self->discriminant, ctx );
28722 0 : }
28723 :
28724 0 : int fd_crds_bloom_decode( fd_crds_bloom_t * self, fd_bincode_decode_ctx_t * ctx ) {
28725 0 : void const * data = ctx->data;
28726 0 : int err = fd_crds_bloom_decode_preflight( ctx );
28727 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28728 0 : ctx->data = data;
28729 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
28730 0 : fd_crds_bloom_new( self );
28731 0 : }
28732 0 : fd_crds_bloom_decode_unsafe( self, ctx );
28733 0 : return FD_BINCODE_SUCCESS;
28734 0 : }
28735 3 : int fd_crds_bloom_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
28736 3 : int err;
28737 3 : ulong keys_len;
28738 3 : err = fd_bincode_uint64_decode( &keys_len, ctx );
28739 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28740 3 : if( keys_len ) {
28741 12 : for( ulong i=0; i < keys_len; i++ ) {
28742 9 : err = fd_bincode_uint64_decode_preflight( ctx );
28743 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28744 9 : }
28745 3 : }
28746 3 : err = fd_gossip_bitvec_u64_decode_preflight( ctx );
28747 3 : if( FD_UNLIKELY( err ) ) return err;
28748 3 : err = fd_bincode_uint64_decode_preflight( ctx );
28749 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28750 3 : return FD_BINCODE_SUCCESS;
28751 3 : }
28752 3 : void fd_crds_bloom_decode_unsafe( fd_crds_bloom_t * self, fd_bincode_decode_ctx_t * ctx ) {
28753 3 : fd_bincode_uint64_decode_unsafe( &self->keys_len, ctx );
28754 3 : if( self->keys_len ) {
28755 3 : self->keys = fd_valloc_malloc( ctx->valloc, 8UL, sizeof(ulong)*self->keys_len );
28756 12 : for( ulong i=0; i < self->keys_len; i++ ) {
28757 9 : fd_bincode_uint64_decode_unsafe( self->keys + i, ctx );
28758 9 : }
28759 3 : } else
28760 0 : self->keys = NULL;
28761 3 : fd_gossip_bitvec_u64_decode_unsafe( &self->bits, ctx );
28762 3 : fd_bincode_uint64_decode_unsafe( &self->num_bits_set, ctx );
28763 3 : }
28764 0 : int fd_crds_bloom_encode( fd_crds_bloom_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28765 0 : int err;
28766 0 : err = fd_bincode_uint64_encode( self->keys_len, ctx );
28767 0 : if( FD_UNLIKELY(err) ) return err;
28768 0 : if( self->keys_len ) {
28769 0 : for( ulong i=0; i < self->keys_len; i++ ) {
28770 0 : err = fd_bincode_uint64_encode( self->keys[i], ctx );
28771 0 : }
28772 0 : }
28773 0 : err = fd_gossip_bitvec_u64_encode( &self->bits, ctx );
28774 0 : if( FD_UNLIKELY( err ) ) return err;
28775 0 : err = fd_bincode_uint64_encode( self->num_bits_set, ctx );
28776 0 : if( FD_UNLIKELY( err ) ) return err;
28777 0 : return FD_BINCODE_SUCCESS;
28778 0 : }
28779 0 : int fd_crds_bloom_decode_offsets( fd_crds_bloom_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
28780 0 : uchar const * data = ctx->data;
28781 0 : int err;
28782 0 : self->keys_off = (uint)( (ulong)ctx->data - (ulong)data );
28783 0 : ulong keys_len;
28784 0 : err = fd_bincode_uint64_decode( &keys_len, ctx );
28785 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28786 0 : if( keys_len ) {
28787 0 : for( ulong i=0; i < keys_len; i++ ) {
28788 0 : err = fd_bincode_uint64_decode_preflight( ctx );
28789 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28790 0 : }
28791 0 : }
28792 0 : self->bits_off = (uint)( (ulong)ctx->data - (ulong)data );
28793 0 : err = fd_gossip_bitvec_u64_decode_preflight( ctx );
28794 0 : if( FD_UNLIKELY( err ) ) return err;
28795 0 : self->num_bits_set_off = (uint)( (ulong)ctx->data - (ulong)data );
28796 0 : err = fd_bincode_uint64_decode_preflight( ctx );
28797 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28798 0 : return FD_BINCODE_SUCCESS;
28799 0 : }
28800 0 : void fd_crds_bloom_new(fd_crds_bloom_t * self) {
28801 0 : fd_memset( self, 0, sizeof(fd_crds_bloom_t) );
28802 0 : fd_gossip_bitvec_u64_new( &self->bits );
28803 0 : }
28804 0 : void fd_crds_bloom_destroy( fd_crds_bloom_t * self, fd_bincode_destroy_ctx_t * ctx ) {
28805 0 : if( self->keys ) {
28806 0 : fd_valloc_free( ctx->valloc, self->keys );
28807 0 : self->keys = NULL;
28808 0 : }
28809 0 : fd_gossip_bitvec_u64_destroy( &self->bits, ctx );
28810 0 : }
28811 :
28812 0 : ulong fd_crds_bloom_footprint( void ){ return FD_CRDS_BLOOM_FOOTPRINT; }
28813 0 : ulong fd_crds_bloom_align( void ){ return FD_CRDS_BLOOM_ALIGN; }
28814 :
28815 3 : void fd_crds_bloom_walk( void * w, fd_crds_bloom_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28816 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_bloom", level++ );
28817 3 : if( self->keys_len ) {
28818 3 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++ );
28819 12 : for( ulong i=0; i < self->keys_len; i++ )
28820 9 : fun( w, self->keys + i, "keys", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28821 3 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
28822 3 : }
28823 3 : fd_gossip_bitvec_u64_walk( w, &self->bits, fun, "bits", level );
28824 3 : fun( w, &self->num_bits_set, "num_bits_set", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28825 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_bloom", level-- );
28826 3 : }
28827 0 : ulong fd_crds_bloom_size( fd_crds_bloom_t const * self ) {
28828 0 : ulong size = 0;
28829 0 : do {
28830 0 : size += sizeof(ulong);
28831 0 : size += self->keys_len * sizeof(ulong);
28832 0 : } while(0);
28833 0 : size += fd_gossip_bitvec_u64_size( &self->bits );
28834 0 : size += sizeof(ulong);
28835 0 : return size;
28836 0 : }
28837 :
28838 0 : int fd_crds_filter_decode( fd_crds_filter_t * self, fd_bincode_decode_ctx_t * ctx ) {
28839 0 : void const * data = ctx->data;
28840 0 : int err = fd_crds_filter_decode_preflight( ctx );
28841 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28842 0 : ctx->data = data;
28843 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
28844 0 : fd_crds_filter_new( self );
28845 0 : }
28846 0 : fd_crds_filter_decode_unsafe( self, ctx );
28847 0 : return FD_BINCODE_SUCCESS;
28848 0 : }
28849 3 : int fd_crds_filter_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
28850 3 : int err;
28851 3 : err = fd_crds_bloom_decode_preflight( ctx );
28852 3 : if( FD_UNLIKELY( err ) ) return err;
28853 3 : err = fd_bincode_uint64_decode_preflight( ctx );
28854 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28855 3 : err = fd_bincode_uint32_decode_preflight( ctx );
28856 3 : if( FD_UNLIKELY( err ) ) return err;
28857 3 : return FD_BINCODE_SUCCESS;
28858 3 : }
28859 3 : void fd_crds_filter_decode_unsafe( fd_crds_filter_t * self, fd_bincode_decode_ctx_t * ctx ) {
28860 3 : fd_crds_bloom_decode_unsafe( &self->filter, ctx );
28861 3 : fd_bincode_uint64_decode_unsafe( &self->mask, ctx );
28862 3 : fd_bincode_uint32_decode_unsafe( &self->mask_bits, ctx );
28863 3 : }
28864 0 : int fd_crds_filter_encode( fd_crds_filter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28865 0 : int err;
28866 0 : err = fd_crds_bloom_encode( &self->filter, ctx );
28867 0 : if( FD_UNLIKELY( err ) ) return err;
28868 0 : err = fd_bincode_uint64_encode( self->mask, ctx );
28869 0 : if( FD_UNLIKELY( err ) ) return err;
28870 0 : err = fd_bincode_uint32_encode( self->mask_bits, ctx );
28871 0 : if( FD_UNLIKELY( err ) ) return err;
28872 0 : return FD_BINCODE_SUCCESS;
28873 0 : }
28874 0 : int fd_crds_filter_decode_offsets( fd_crds_filter_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
28875 0 : uchar const * data = ctx->data;
28876 0 : int err;
28877 0 : self->filter_off = (uint)( (ulong)ctx->data - (ulong)data );
28878 0 : err = fd_crds_bloom_decode_preflight( ctx );
28879 0 : if( FD_UNLIKELY( err ) ) return err;
28880 0 : self->mask_off = (uint)( (ulong)ctx->data - (ulong)data );
28881 0 : err = fd_bincode_uint64_decode_preflight( ctx );
28882 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28883 0 : self->mask_bits_off = (uint)( (ulong)ctx->data - (ulong)data );
28884 0 : err = fd_bincode_uint32_decode_preflight( ctx );
28885 0 : if( FD_UNLIKELY( err ) ) return err;
28886 0 : return FD_BINCODE_SUCCESS;
28887 0 : }
28888 0 : void fd_crds_filter_new(fd_crds_filter_t * self) {
28889 0 : fd_memset( self, 0, sizeof(fd_crds_filter_t) );
28890 0 : fd_crds_bloom_new( &self->filter );
28891 0 : }
28892 0 : void fd_crds_filter_destroy( fd_crds_filter_t * self, fd_bincode_destroy_ctx_t * ctx ) {
28893 0 : fd_crds_bloom_destroy( &self->filter, ctx );
28894 0 : }
28895 :
28896 0 : ulong fd_crds_filter_footprint( void ){ return FD_CRDS_FILTER_FOOTPRINT; }
28897 0 : ulong fd_crds_filter_align( void ){ return FD_CRDS_FILTER_ALIGN; }
28898 :
28899 3 : void fd_crds_filter_walk( void * w, fd_crds_filter_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28900 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_filter", level++ );
28901 3 : fd_crds_bloom_walk( w, &self->filter, fun, "filter", level );
28902 3 : fun( w, &self->mask, "mask", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
28903 3 : fun( w, &self->mask_bits, "mask_bits", FD_FLAMENCO_TYPE_UINT, "uint", level );
28904 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_filter", level-- );
28905 3 : }
28906 0 : ulong fd_crds_filter_size( fd_crds_filter_t const * self ) {
28907 0 : ulong size = 0;
28908 0 : size += fd_crds_bloom_size( &self->filter );
28909 0 : size += sizeof(ulong);
28910 0 : size += sizeof(uint);
28911 0 : return size;
28912 0 : }
28913 :
28914 0 : int fd_crds_value_decode( fd_crds_value_t * self, fd_bincode_decode_ctx_t * ctx ) {
28915 0 : void const * data = ctx->data;
28916 0 : int err = fd_crds_value_decode_preflight( ctx );
28917 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28918 0 : ctx->data = data;
28919 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
28920 0 : fd_crds_value_new( self );
28921 0 : }
28922 0 : fd_crds_value_decode_unsafe( self, ctx );
28923 0 : return FD_BINCODE_SUCCESS;
28924 0 : }
28925 30 : int fd_crds_value_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
28926 30 : int err;
28927 30 : err = fd_signature_decode_preflight( ctx );
28928 30 : if( FD_UNLIKELY( err ) ) return err;
28929 30 : err = fd_crds_data_decode_preflight( ctx );
28930 30 : if( FD_UNLIKELY( err ) ) return err;
28931 30 : return FD_BINCODE_SUCCESS;
28932 30 : }
28933 30 : void fd_crds_value_decode_unsafe( fd_crds_value_t * self, fd_bincode_decode_ctx_t * ctx ) {
28934 30 : fd_signature_decode_unsafe( &self->signature, ctx );
28935 30 : fd_crds_data_decode_unsafe( &self->data, ctx );
28936 30 : }
28937 0 : int fd_crds_value_encode( fd_crds_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
28938 0 : int err;
28939 0 : err = fd_signature_encode( &self->signature, ctx );
28940 0 : if( FD_UNLIKELY( err ) ) return err;
28941 0 : err = fd_crds_data_encode( &self->data, ctx );
28942 0 : if( FD_UNLIKELY( err ) ) return err;
28943 0 : return FD_BINCODE_SUCCESS;
28944 0 : }
28945 0 : int fd_crds_value_decode_offsets( fd_crds_value_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
28946 0 : uchar const * data = ctx->data;
28947 0 : int err;
28948 0 : self->signature_off = (uint)( (ulong)ctx->data - (ulong)data );
28949 0 : err = fd_signature_decode_preflight( ctx );
28950 0 : if( FD_UNLIKELY( err ) ) return err;
28951 0 : self->data_off = (uint)( (ulong)ctx->data - (ulong)data );
28952 0 : err = fd_crds_data_decode_preflight( ctx );
28953 0 : if( FD_UNLIKELY( err ) ) return err;
28954 0 : return FD_BINCODE_SUCCESS;
28955 0 : }
28956 27 : void fd_crds_value_new(fd_crds_value_t * self) {
28957 27 : fd_memset( self, 0, sizeof(fd_crds_value_t) );
28958 27 : fd_signature_new( &self->signature );
28959 27 : fd_crds_data_new( &self->data );
28960 27 : }
28961 0 : void fd_crds_value_destroy( fd_crds_value_t * self, fd_bincode_destroy_ctx_t * ctx ) {
28962 0 : fd_signature_destroy( &self->signature, ctx );
28963 0 : fd_crds_data_destroy( &self->data, ctx );
28964 0 : }
28965 :
28966 0 : ulong fd_crds_value_footprint( void ){ return FD_CRDS_VALUE_FOOTPRINT; }
28967 0 : ulong fd_crds_value_align( void ){ return FD_CRDS_VALUE_ALIGN; }
28968 :
28969 30 : void fd_crds_value_walk( void * w, fd_crds_value_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
28970 30 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_value", level++ );
28971 30 : fd_signature_walk( w, &self->signature, fun, "signature", level );
28972 30 : fd_crds_data_walk( w, &self->data, fun, "data", level );
28973 30 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_value", level-- );
28974 30 : }
28975 0 : ulong fd_crds_value_size( fd_crds_value_t const * self ) {
28976 0 : ulong size = 0;
28977 0 : size += fd_signature_size( &self->signature );
28978 0 : size += fd_crds_data_size( &self->data );
28979 0 : return size;
28980 0 : }
28981 :
28982 0 : int fd_gossip_pull_req_decode( fd_gossip_pull_req_t * self, fd_bincode_decode_ctx_t * ctx ) {
28983 0 : void const * data = ctx->data;
28984 0 : int err = fd_gossip_pull_req_decode_preflight( ctx );
28985 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28986 0 : ctx->data = data;
28987 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
28988 0 : fd_gossip_pull_req_new( self );
28989 0 : }
28990 0 : fd_gossip_pull_req_decode_unsafe( self, ctx );
28991 0 : return FD_BINCODE_SUCCESS;
28992 0 : }
28993 3 : int fd_gossip_pull_req_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
28994 3 : int err;
28995 3 : err = fd_crds_filter_decode_preflight( ctx );
28996 3 : if( FD_UNLIKELY( err ) ) return err;
28997 3 : err = fd_crds_value_decode_preflight( ctx );
28998 3 : if( FD_UNLIKELY( err ) ) return err;
28999 3 : return FD_BINCODE_SUCCESS;
29000 3 : }
29001 3 : void fd_gossip_pull_req_decode_unsafe( fd_gossip_pull_req_t * self, fd_bincode_decode_ctx_t * ctx ) {
29002 3 : fd_crds_filter_decode_unsafe( &self->filter, ctx );
29003 3 : fd_crds_value_decode_unsafe( &self->value, ctx );
29004 3 : }
29005 0 : int fd_gossip_pull_req_encode( fd_gossip_pull_req_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29006 0 : int err;
29007 0 : err = fd_crds_filter_encode( &self->filter, ctx );
29008 0 : if( FD_UNLIKELY( err ) ) return err;
29009 0 : err = fd_crds_value_encode( &self->value, ctx );
29010 0 : if( FD_UNLIKELY( err ) ) return err;
29011 0 : return FD_BINCODE_SUCCESS;
29012 0 : }
29013 0 : int fd_gossip_pull_req_decode_offsets( fd_gossip_pull_req_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
29014 0 : uchar const * data = ctx->data;
29015 0 : int err;
29016 0 : self->filter_off = (uint)( (ulong)ctx->data - (ulong)data );
29017 0 : err = fd_crds_filter_decode_preflight( ctx );
29018 0 : if( FD_UNLIKELY( err ) ) return err;
29019 0 : self->value_off = (uint)( (ulong)ctx->data - (ulong)data );
29020 0 : err = fd_crds_value_decode_preflight( ctx );
29021 0 : if( FD_UNLIKELY( err ) ) return err;
29022 0 : return FD_BINCODE_SUCCESS;
29023 0 : }
29024 0 : void fd_gossip_pull_req_new(fd_gossip_pull_req_t * self) {
29025 0 : fd_memset( self, 0, sizeof(fd_gossip_pull_req_t) );
29026 0 : fd_crds_filter_new( &self->filter );
29027 0 : fd_crds_value_new( &self->value );
29028 0 : }
29029 0 : void fd_gossip_pull_req_destroy( fd_gossip_pull_req_t * self, fd_bincode_destroy_ctx_t * ctx ) {
29030 0 : fd_crds_filter_destroy( &self->filter, ctx );
29031 0 : fd_crds_value_destroy( &self->value, ctx );
29032 0 : }
29033 :
29034 0 : ulong fd_gossip_pull_req_footprint( void ){ return FD_GOSSIP_PULL_REQ_FOOTPRINT; }
29035 0 : ulong fd_gossip_pull_req_align( void ){ return FD_GOSSIP_PULL_REQ_ALIGN; }
29036 :
29037 3 : void fd_gossip_pull_req_walk( void * w, fd_gossip_pull_req_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29038 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_pull_req", level++ );
29039 3 : fd_crds_filter_walk( w, &self->filter, fun, "filter", level );
29040 3 : fd_crds_value_walk( w, &self->value, fun, "value", level );
29041 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_pull_req", level-- );
29042 3 : }
29043 0 : ulong fd_gossip_pull_req_size( fd_gossip_pull_req_t const * self ) {
29044 0 : ulong size = 0;
29045 0 : size += fd_crds_filter_size( &self->filter );
29046 0 : size += fd_crds_value_size( &self->value );
29047 0 : return size;
29048 0 : }
29049 :
29050 0 : int fd_gossip_pull_resp_decode( fd_gossip_pull_resp_t * self, fd_bincode_decode_ctx_t * ctx ) {
29051 0 : void const * data = ctx->data;
29052 0 : int err = fd_gossip_pull_resp_decode_preflight( ctx );
29053 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29054 0 : ctx->data = data;
29055 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
29056 0 : fd_gossip_pull_resp_new( self );
29057 0 : }
29058 0 : fd_gossip_pull_resp_decode_unsafe( self, ctx );
29059 0 : return FD_BINCODE_SUCCESS;
29060 0 : }
29061 12 : int fd_gossip_pull_resp_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
29062 12 : int err;
29063 12 : err = fd_pubkey_decode_preflight( ctx );
29064 12 : if( FD_UNLIKELY( err ) ) return err;
29065 12 : ulong crds_len;
29066 12 : err = fd_bincode_uint64_decode( &crds_len, ctx );
29067 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29068 12 : if( crds_len ) {
29069 24 : for( ulong i=0; i < crds_len; i++ ) {
29070 12 : err = fd_crds_value_decode_preflight( ctx );
29071 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29072 12 : }
29073 12 : }
29074 12 : return FD_BINCODE_SUCCESS;
29075 12 : }
29076 12 : void fd_gossip_pull_resp_decode_unsafe( fd_gossip_pull_resp_t * self, fd_bincode_decode_ctx_t * ctx ) {
29077 12 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
29078 12 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
29079 12 : if( self->crds_len ) {
29080 12 : self->crds = (fd_crds_value_t *)fd_valloc_malloc( ctx->valloc, FD_CRDS_VALUE_ALIGN, FD_CRDS_VALUE_FOOTPRINT*self->crds_len );
29081 24 : for( ulong i=0; i < self->crds_len; i++ ) {
29082 12 : fd_crds_value_new( self->crds + i );
29083 12 : fd_crds_value_decode_unsafe( self->crds + i, ctx );
29084 12 : }
29085 12 : } else
29086 0 : self->crds = NULL;
29087 12 : }
29088 0 : int fd_gossip_pull_resp_encode( fd_gossip_pull_resp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29089 0 : int err;
29090 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
29091 0 : if( FD_UNLIKELY( err ) ) return err;
29092 0 : err = fd_bincode_uint64_encode( self->crds_len, ctx );
29093 0 : if( FD_UNLIKELY(err) ) return err;
29094 0 : if( self->crds_len ) {
29095 0 : for( ulong i=0; i < self->crds_len; i++ ) {
29096 0 : err = fd_crds_value_encode( self->crds + i, ctx );
29097 0 : if( FD_UNLIKELY( err ) ) return err;
29098 0 : }
29099 0 : }
29100 0 : return FD_BINCODE_SUCCESS;
29101 0 : }
29102 0 : int fd_gossip_pull_resp_decode_offsets( fd_gossip_pull_resp_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
29103 0 : uchar const * data = ctx->data;
29104 0 : int err;
29105 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
29106 0 : err = fd_pubkey_decode_preflight( ctx );
29107 0 : if( FD_UNLIKELY( err ) ) return err;
29108 0 : self->crds_off = (uint)( (ulong)ctx->data - (ulong)data );
29109 0 : ulong crds_len;
29110 0 : err = fd_bincode_uint64_decode( &crds_len, ctx );
29111 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29112 0 : if( crds_len ) {
29113 0 : for( ulong i=0; i < crds_len; i++ ) {
29114 0 : err = fd_crds_value_decode_preflight( ctx );
29115 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29116 0 : }
29117 0 : }
29118 0 : return FD_BINCODE_SUCCESS;
29119 0 : }
29120 0 : void fd_gossip_pull_resp_new(fd_gossip_pull_resp_t * self) {
29121 0 : fd_memset( self, 0, sizeof(fd_gossip_pull_resp_t) );
29122 0 : fd_pubkey_new( &self->pubkey );
29123 0 : }
29124 0 : void fd_gossip_pull_resp_destroy( fd_gossip_pull_resp_t * self, fd_bincode_destroy_ctx_t * ctx ) {
29125 0 : fd_pubkey_destroy( &self->pubkey, ctx );
29126 0 : if( self->crds ) {
29127 0 : for( ulong i=0; i < self->crds_len; i++ )
29128 0 : fd_crds_value_destroy( self->crds + i, ctx );
29129 0 : fd_valloc_free( ctx->valloc, self->crds );
29130 0 : self->crds = NULL;
29131 0 : }
29132 0 : }
29133 :
29134 0 : ulong fd_gossip_pull_resp_footprint( void ){ return FD_GOSSIP_PULL_RESP_FOOTPRINT; }
29135 0 : ulong fd_gossip_pull_resp_align( void ){ return FD_GOSSIP_PULL_RESP_ALIGN; }
29136 :
29137 12 : void fd_gossip_pull_resp_walk( void * w, fd_gossip_pull_resp_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29138 12 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_pull_resp", level++ );
29139 12 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
29140 12 : if( self->crds_len ) {
29141 12 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR, "array", level++ );
29142 24 : for( ulong i=0; i < self->crds_len; i++ )
29143 12 : fd_crds_value_walk(w, self->crds + i, fun, "crds_value", level );
29144 12 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
29145 12 : }
29146 12 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_pull_resp", level-- );
29147 12 : }
29148 0 : ulong fd_gossip_pull_resp_size( fd_gossip_pull_resp_t const * self ) {
29149 0 : ulong size = 0;
29150 0 : size += fd_pubkey_size( &self->pubkey );
29151 0 : do {
29152 0 : size += sizeof(ulong);
29153 0 : for( ulong i=0; i < self->crds_len; i++ )
29154 0 : size += fd_crds_value_size( self->crds + i );
29155 0 : } while(0);
29156 0 : return size;
29157 0 : }
29158 :
29159 0 : int fd_gossip_push_msg_decode( fd_gossip_push_msg_t * self, fd_bincode_decode_ctx_t * ctx ) {
29160 0 : void const * data = ctx->data;
29161 0 : int err = fd_gossip_push_msg_decode_preflight( ctx );
29162 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29163 0 : ctx->data = data;
29164 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
29165 0 : fd_gossip_push_msg_new( self );
29166 0 : }
29167 0 : fd_gossip_push_msg_decode_unsafe( self, ctx );
29168 0 : return FD_BINCODE_SUCCESS;
29169 0 : }
29170 6 : int fd_gossip_push_msg_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
29171 6 : int err;
29172 6 : err = fd_pubkey_decode_preflight( ctx );
29173 6 : if( FD_UNLIKELY( err ) ) return err;
29174 6 : ulong crds_len;
29175 6 : err = fd_bincode_uint64_decode( &crds_len, ctx );
29176 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29177 6 : if( crds_len ) {
29178 21 : for( ulong i=0; i < crds_len; i++ ) {
29179 15 : err = fd_crds_value_decode_preflight( ctx );
29180 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29181 15 : }
29182 6 : }
29183 6 : return FD_BINCODE_SUCCESS;
29184 6 : }
29185 6 : void fd_gossip_push_msg_decode_unsafe( fd_gossip_push_msg_t * self, fd_bincode_decode_ctx_t * ctx ) {
29186 6 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
29187 6 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
29188 6 : if( self->crds_len ) {
29189 6 : self->crds = (fd_crds_value_t *)fd_valloc_malloc( ctx->valloc, FD_CRDS_VALUE_ALIGN, FD_CRDS_VALUE_FOOTPRINT*self->crds_len );
29190 21 : for( ulong i=0; i < self->crds_len; i++ ) {
29191 15 : fd_crds_value_new( self->crds + i );
29192 15 : fd_crds_value_decode_unsafe( self->crds + i, ctx );
29193 15 : }
29194 6 : } else
29195 0 : self->crds = NULL;
29196 6 : }
29197 0 : int fd_gossip_push_msg_encode( fd_gossip_push_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29198 0 : int err;
29199 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
29200 0 : if( FD_UNLIKELY( err ) ) return err;
29201 0 : err = fd_bincode_uint64_encode( self->crds_len, ctx );
29202 0 : if( FD_UNLIKELY(err) ) return err;
29203 0 : if( self->crds_len ) {
29204 0 : for( ulong i=0; i < self->crds_len; i++ ) {
29205 0 : err = fd_crds_value_encode( self->crds + i, ctx );
29206 0 : if( FD_UNLIKELY( err ) ) return err;
29207 0 : }
29208 0 : }
29209 0 : return FD_BINCODE_SUCCESS;
29210 0 : }
29211 0 : int fd_gossip_push_msg_decode_offsets( fd_gossip_push_msg_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
29212 0 : uchar const * data = ctx->data;
29213 0 : int err;
29214 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
29215 0 : err = fd_pubkey_decode_preflight( ctx );
29216 0 : if( FD_UNLIKELY( err ) ) return err;
29217 0 : self->crds_off = (uint)( (ulong)ctx->data - (ulong)data );
29218 0 : ulong crds_len;
29219 0 : err = fd_bincode_uint64_decode( &crds_len, ctx );
29220 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29221 0 : if( crds_len ) {
29222 0 : for( ulong i=0; i < crds_len; i++ ) {
29223 0 : err = fd_crds_value_decode_preflight( ctx );
29224 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29225 0 : }
29226 0 : }
29227 0 : return FD_BINCODE_SUCCESS;
29228 0 : }
29229 0 : void fd_gossip_push_msg_new(fd_gossip_push_msg_t * self) {
29230 0 : fd_memset( self, 0, sizeof(fd_gossip_push_msg_t) );
29231 0 : fd_pubkey_new( &self->pubkey );
29232 0 : }
29233 0 : void fd_gossip_push_msg_destroy( fd_gossip_push_msg_t * self, fd_bincode_destroy_ctx_t * ctx ) {
29234 0 : fd_pubkey_destroy( &self->pubkey, ctx );
29235 0 : if( self->crds ) {
29236 0 : for( ulong i=0; i < self->crds_len; i++ )
29237 0 : fd_crds_value_destroy( self->crds + i, ctx );
29238 0 : fd_valloc_free( ctx->valloc, self->crds );
29239 0 : self->crds = NULL;
29240 0 : }
29241 0 : }
29242 :
29243 0 : ulong fd_gossip_push_msg_footprint( void ){ return FD_GOSSIP_PUSH_MSG_FOOTPRINT; }
29244 0 : ulong fd_gossip_push_msg_align( void ){ return FD_GOSSIP_PUSH_MSG_ALIGN; }
29245 :
29246 6 : void fd_gossip_push_msg_walk( void * w, fd_gossip_push_msg_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29247 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_push_msg", level++ );
29248 6 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
29249 6 : if( self->crds_len ) {
29250 6 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR, "array", level++ );
29251 21 : for( ulong i=0; i < self->crds_len; i++ )
29252 15 : fd_crds_value_walk(w, self->crds + i, fun, "crds_value", level );
29253 6 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
29254 6 : }
29255 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_push_msg", level-- );
29256 6 : }
29257 0 : ulong fd_gossip_push_msg_size( fd_gossip_push_msg_t const * self ) {
29258 0 : ulong size = 0;
29259 0 : size += fd_pubkey_size( &self->pubkey );
29260 0 : do {
29261 0 : size += sizeof(ulong);
29262 0 : for( ulong i=0; i < self->crds_len; i++ )
29263 0 : size += fd_crds_value_size( self->crds + i );
29264 0 : } while(0);
29265 0 : return size;
29266 0 : }
29267 :
29268 0 : int fd_gossip_prune_msg_decode( fd_gossip_prune_msg_t * self, fd_bincode_decode_ctx_t * ctx ) {
29269 0 : void const * data = ctx->data;
29270 0 : int err = fd_gossip_prune_msg_decode_preflight( ctx );
29271 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29272 0 : ctx->data = data;
29273 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
29274 0 : fd_gossip_prune_msg_new( self );
29275 0 : }
29276 0 : fd_gossip_prune_msg_decode_unsafe( self, ctx );
29277 0 : return FD_BINCODE_SUCCESS;
29278 0 : }
29279 0 : int fd_gossip_prune_msg_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
29280 0 : int err;
29281 0 : err = fd_pubkey_decode_preflight( ctx );
29282 0 : if( FD_UNLIKELY( err ) ) return err;
29283 0 : err = fd_gossip_prune_data_decode_preflight( ctx );
29284 0 : if( FD_UNLIKELY( err ) ) return err;
29285 0 : return FD_BINCODE_SUCCESS;
29286 0 : }
29287 0 : void fd_gossip_prune_msg_decode_unsafe( fd_gossip_prune_msg_t * self, fd_bincode_decode_ctx_t * ctx ) {
29288 0 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
29289 0 : fd_gossip_prune_data_decode_unsafe( &self->data, ctx );
29290 0 : }
29291 0 : int fd_gossip_prune_msg_encode( fd_gossip_prune_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29292 0 : int err;
29293 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
29294 0 : if( FD_UNLIKELY( err ) ) return err;
29295 0 : err = fd_gossip_prune_data_encode( &self->data, ctx );
29296 0 : if( FD_UNLIKELY( err ) ) return err;
29297 0 : return FD_BINCODE_SUCCESS;
29298 0 : }
29299 0 : int fd_gossip_prune_msg_decode_offsets( fd_gossip_prune_msg_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
29300 0 : uchar const * data = ctx->data;
29301 0 : int err;
29302 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
29303 0 : err = fd_pubkey_decode_preflight( ctx );
29304 0 : if( FD_UNLIKELY( err ) ) return err;
29305 0 : self->data_off = (uint)( (ulong)ctx->data - (ulong)data );
29306 0 : err = fd_gossip_prune_data_decode_preflight( ctx );
29307 0 : if( FD_UNLIKELY( err ) ) return err;
29308 0 : return FD_BINCODE_SUCCESS;
29309 0 : }
29310 0 : void fd_gossip_prune_msg_new(fd_gossip_prune_msg_t * self) {
29311 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_msg_t) );
29312 0 : fd_pubkey_new( &self->pubkey );
29313 0 : fd_gossip_prune_data_new( &self->data );
29314 0 : }
29315 0 : void fd_gossip_prune_msg_destroy( fd_gossip_prune_msg_t * self, fd_bincode_destroy_ctx_t * ctx ) {
29316 0 : fd_pubkey_destroy( &self->pubkey, ctx );
29317 0 : fd_gossip_prune_data_destroy( &self->data, ctx );
29318 0 : }
29319 :
29320 0 : ulong fd_gossip_prune_msg_footprint( void ){ return FD_GOSSIP_PRUNE_MSG_FOOTPRINT; }
29321 0 : ulong fd_gossip_prune_msg_align( void ){ return FD_GOSSIP_PRUNE_MSG_ALIGN; }
29322 :
29323 0 : void fd_gossip_prune_msg_walk( void * w, fd_gossip_prune_msg_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29324 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_msg", level++ );
29325 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
29326 0 : fd_gossip_prune_data_walk( w, &self->data, fun, "data", level );
29327 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_msg", level-- );
29328 0 : }
29329 0 : ulong fd_gossip_prune_msg_size( fd_gossip_prune_msg_t const * self ) {
29330 0 : ulong size = 0;
29331 0 : size += fd_pubkey_size( &self->pubkey );
29332 0 : size += fd_gossip_prune_data_size( &self->data );
29333 0 : return size;
29334 0 : }
29335 :
29336 0 : FD_FN_PURE uchar fd_gossip_msg_is_pull_req(fd_gossip_msg_t const * self) {
29337 0 : return self->discriminant == 0;
29338 0 : }
29339 0 : FD_FN_PURE uchar fd_gossip_msg_is_pull_resp(fd_gossip_msg_t const * self) {
29340 0 : return self->discriminant == 1;
29341 0 : }
29342 0 : FD_FN_PURE uchar fd_gossip_msg_is_push_msg(fd_gossip_msg_t const * self) {
29343 0 : return self->discriminant == 2;
29344 0 : }
29345 0 : FD_FN_PURE uchar fd_gossip_msg_is_prune_msg(fd_gossip_msg_t const * self) {
29346 0 : return self->discriminant == 3;
29347 0 : }
29348 0 : FD_FN_PURE uchar fd_gossip_msg_is_ping(fd_gossip_msg_t const * self) {
29349 0 : return self->discriminant == 4;
29350 0 : }
29351 0 : FD_FN_PURE uchar fd_gossip_msg_is_pong(fd_gossip_msg_t const * self) {
29352 0 : return self->discriminant == 5;
29353 0 : }
29354 : void fd_gossip_msg_inner_new( fd_gossip_msg_inner_t * self, uint discriminant );
29355 21 : int fd_gossip_msg_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
29356 21 : int err;
29357 21 : switch (discriminant) {
29358 3 : case 0: {
29359 3 : err = fd_gossip_pull_req_decode_preflight( ctx );
29360 3 : if( FD_UNLIKELY( err ) ) return err;
29361 3 : return FD_BINCODE_SUCCESS;
29362 3 : }
29363 12 : case 1: {
29364 12 : err = fd_gossip_pull_resp_decode_preflight( ctx );
29365 12 : if( FD_UNLIKELY( err ) ) return err;
29366 12 : return FD_BINCODE_SUCCESS;
29367 12 : }
29368 6 : case 2: {
29369 6 : err = fd_gossip_push_msg_decode_preflight( ctx );
29370 6 : if( FD_UNLIKELY( err ) ) return err;
29371 6 : return FD_BINCODE_SUCCESS;
29372 6 : }
29373 0 : case 3: {
29374 0 : err = fd_gossip_prune_msg_decode_preflight( ctx );
29375 0 : if( FD_UNLIKELY( err ) ) return err;
29376 0 : return FD_BINCODE_SUCCESS;
29377 0 : }
29378 0 : case 4: {
29379 0 : err = fd_gossip_ping_decode_preflight( ctx );
29380 0 : if( FD_UNLIKELY( err ) ) return err;
29381 0 : return FD_BINCODE_SUCCESS;
29382 0 : }
29383 0 : case 5: {
29384 0 : err = fd_gossip_ping_decode_preflight( ctx );
29385 0 : if( FD_UNLIKELY( err ) ) return err;
29386 0 : return FD_BINCODE_SUCCESS;
29387 0 : }
29388 0 : default: return FD_BINCODE_ERR_ENCODING;
29389 21 : }
29390 21 : }
29391 21 : void fd_gossip_msg_inner_decode_unsafe( fd_gossip_msg_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
29392 21 : switch (discriminant) {
29393 3 : case 0: {
29394 3 : fd_gossip_pull_req_decode_unsafe( &self->pull_req, ctx );
29395 3 : break;
29396 0 : }
29397 12 : case 1: {
29398 12 : fd_gossip_pull_resp_decode_unsafe( &self->pull_resp, ctx );
29399 12 : break;
29400 0 : }
29401 6 : case 2: {
29402 6 : fd_gossip_push_msg_decode_unsafe( &self->push_msg, ctx );
29403 6 : break;
29404 0 : }
29405 0 : case 3: {
29406 0 : fd_gossip_prune_msg_decode_unsafe( &self->prune_msg, ctx );
29407 0 : break;
29408 0 : }
29409 0 : case 4: {
29410 0 : fd_gossip_ping_decode_unsafe( &self->ping, ctx );
29411 0 : break;
29412 0 : }
29413 0 : case 5: {
29414 0 : fd_gossip_ping_decode_unsafe( &self->pong, ctx );
29415 0 : break;
29416 0 : }
29417 21 : }
29418 21 : }
29419 21 : int fd_gossip_msg_decode( fd_gossip_msg_t * self, fd_bincode_decode_ctx_t * ctx ) {
29420 21 : void const * data = ctx->data;
29421 21 : int err = fd_gossip_msg_decode_preflight( ctx );
29422 21 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29423 21 : ctx->data = data;
29424 21 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
29425 21 : fd_gossip_msg_new( self );
29426 21 : }
29427 21 : fd_gossip_msg_decode_unsafe( self, ctx );
29428 21 : return FD_BINCODE_SUCCESS;
29429 21 : }
29430 21 : int fd_gossip_msg_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
29431 21 : uint discriminant = 0;
29432 21 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
29433 21 : if( FD_UNLIKELY( err ) ) return err;
29434 21 : return fd_gossip_msg_inner_decode_preflight( discriminant, ctx );
29435 21 : }
29436 21 : void fd_gossip_msg_decode_unsafe( fd_gossip_msg_t * self, fd_bincode_decode_ctx_t * ctx ) {
29437 21 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
29438 21 : fd_gossip_msg_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
29439 21 : }
29440 21 : void fd_gossip_msg_inner_new( fd_gossip_msg_inner_t * self, uint discriminant ) {
29441 21 : switch( discriminant ) {
29442 0 : case 0: {
29443 0 : fd_gossip_pull_req_new( &self->pull_req );
29444 0 : break;
29445 0 : }
29446 0 : case 1: {
29447 0 : fd_gossip_pull_resp_new( &self->pull_resp );
29448 0 : break;
29449 0 : }
29450 0 : case 2: {
29451 0 : fd_gossip_push_msg_new( &self->push_msg );
29452 0 : break;
29453 0 : }
29454 0 : case 3: {
29455 0 : fd_gossip_prune_msg_new( &self->prune_msg );
29456 0 : break;
29457 0 : }
29458 0 : case 4: {
29459 0 : fd_gossip_ping_new( &self->ping );
29460 0 : break;
29461 0 : }
29462 0 : case 5: {
29463 0 : fd_gossip_ping_new( &self->pong );
29464 0 : break;
29465 0 : }
29466 21 : default: break; // FD_LOG_ERR(( "unhandled type"));
29467 21 : }
29468 21 : }
29469 21 : void fd_gossip_msg_new_disc( fd_gossip_msg_t * self, uint discriminant ) {
29470 21 : self->discriminant = discriminant;
29471 21 : fd_gossip_msg_inner_new( &self->inner, self->discriminant );
29472 21 : }
29473 21 : void fd_gossip_msg_new( fd_gossip_msg_t * self ) {
29474 21 : fd_memset( self, 0, sizeof(fd_gossip_msg_t) );
29475 21 : fd_gossip_msg_new_disc( self, UINT_MAX );
29476 21 : }
29477 0 : void fd_gossip_msg_inner_destroy( fd_gossip_msg_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
29478 0 : switch( discriminant ) {
29479 0 : case 0: {
29480 0 : fd_gossip_pull_req_destroy( &self->pull_req, ctx );
29481 0 : break;
29482 0 : }
29483 0 : case 1: {
29484 0 : fd_gossip_pull_resp_destroy( &self->pull_resp, ctx );
29485 0 : break;
29486 0 : }
29487 0 : case 2: {
29488 0 : fd_gossip_push_msg_destroy( &self->push_msg, ctx );
29489 0 : break;
29490 0 : }
29491 0 : case 3: {
29492 0 : fd_gossip_prune_msg_destroy( &self->prune_msg, ctx );
29493 0 : break;
29494 0 : }
29495 0 : case 4: {
29496 0 : fd_gossip_ping_destroy( &self->ping, ctx );
29497 0 : break;
29498 0 : }
29499 0 : case 5: {
29500 0 : fd_gossip_ping_destroy( &self->pong, ctx );
29501 0 : break;
29502 0 : }
29503 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
29504 0 : }
29505 0 : }
29506 0 : void fd_gossip_msg_destroy( fd_gossip_msg_t * self, fd_bincode_destroy_ctx_t * ctx ) {
29507 0 : fd_gossip_msg_inner_destroy( &self->inner, self->discriminant, ctx );
29508 0 : }
29509 :
29510 0 : ulong fd_gossip_msg_footprint( void ){ return FD_GOSSIP_MSG_FOOTPRINT; }
29511 0 : ulong fd_gossip_msg_align( void ){ return FD_GOSSIP_MSG_ALIGN; }
29512 :
29513 21 : void fd_gossip_msg_walk( void * w, fd_gossip_msg_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29514 21 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_msg", level++);
29515 21 : switch( self->discriminant ) {
29516 3 : case 0: {
29517 3 : fun( w, self, "pull_req", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29518 3 : fd_gossip_pull_req_walk( w, &self->inner.pull_req, fun, "pull_req", level );
29519 3 : break;
29520 0 : }
29521 12 : case 1: {
29522 12 : fun( w, self, "pull_resp", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29523 12 : fd_gossip_pull_resp_walk( w, &self->inner.pull_resp, fun, "pull_resp", level );
29524 12 : break;
29525 0 : }
29526 6 : case 2: {
29527 6 : fun( w, self, "push_msg", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29528 6 : fd_gossip_push_msg_walk( w, &self->inner.push_msg, fun, "push_msg", level );
29529 6 : break;
29530 0 : }
29531 0 : case 3: {
29532 0 : fun( w, self, "prune_msg", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29533 0 : fd_gossip_prune_msg_walk( w, &self->inner.prune_msg, fun, "prune_msg", level );
29534 0 : break;
29535 0 : }
29536 0 : case 4: {
29537 0 : fun( w, self, "ping", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29538 0 : fd_gossip_ping_walk( w, &self->inner.ping, fun, "ping", level );
29539 0 : break;
29540 0 : }
29541 0 : case 5: {
29542 0 : fun( w, self, "pong", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29543 0 : fd_gossip_ping_walk( w, &self->inner.pong, fun, "pong", level );
29544 0 : break;
29545 0 : }
29546 21 : }
29547 21 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_msg", level-- );
29548 21 : }
29549 0 : ulong fd_gossip_msg_size( fd_gossip_msg_t const * self ) {
29550 0 : ulong size = 0;
29551 0 : size += sizeof(uint);
29552 0 : switch (self->discriminant) {
29553 0 : case 0: {
29554 0 : size += fd_gossip_pull_req_size( &self->inner.pull_req );
29555 0 : break;
29556 0 : }
29557 0 : case 1: {
29558 0 : size += fd_gossip_pull_resp_size( &self->inner.pull_resp );
29559 0 : break;
29560 0 : }
29561 0 : case 2: {
29562 0 : size += fd_gossip_push_msg_size( &self->inner.push_msg );
29563 0 : break;
29564 0 : }
29565 0 : case 3: {
29566 0 : size += fd_gossip_prune_msg_size( &self->inner.prune_msg );
29567 0 : break;
29568 0 : }
29569 0 : case 4: {
29570 0 : size += fd_gossip_ping_size( &self->inner.ping );
29571 0 : break;
29572 0 : }
29573 0 : case 5: {
29574 0 : size += fd_gossip_ping_size( &self->inner.pong );
29575 0 : break;
29576 0 : }
29577 0 : }
29578 0 : return size;
29579 0 : }
29580 :
29581 0 : int fd_gossip_msg_inner_encode( fd_gossip_msg_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
29582 0 : int err;
29583 0 : switch (discriminant) {
29584 0 : case 0: {
29585 0 : err = fd_gossip_pull_req_encode( &self->pull_req, ctx );
29586 0 : if( FD_UNLIKELY( err ) ) return err;
29587 0 : break;
29588 0 : }
29589 0 : case 1: {
29590 0 : err = fd_gossip_pull_resp_encode( &self->pull_resp, ctx );
29591 0 : if( FD_UNLIKELY( err ) ) return err;
29592 0 : break;
29593 0 : }
29594 0 : case 2: {
29595 0 : err = fd_gossip_push_msg_encode( &self->push_msg, ctx );
29596 0 : if( FD_UNLIKELY( err ) ) return err;
29597 0 : break;
29598 0 : }
29599 0 : case 3: {
29600 0 : err = fd_gossip_prune_msg_encode( &self->prune_msg, ctx );
29601 0 : if( FD_UNLIKELY( err ) ) return err;
29602 0 : break;
29603 0 : }
29604 0 : case 4: {
29605 0 : err = fd_gossip_ping_encode( &self->ping, ctx );
29606 0 : if( FD_UNLIKELY( err ) ) return err;
29607 0 : break;
29608 0 : }
29609 0 : case 5: {
29610 0 : err = fd_gossip_ping_encode( &self->pong, ctx );
29611 0 : if( FD_UNLIKELY( err ) ) return err;
29612 0 : break;
29613 0 : }
29614 0 : }
29615 0 : return FD_BINCODE_SUCCESS;
29616 0 : }
29617 0 : int fd_gossip_msg_encode( fd_gossip_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29618 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
29619 0 : if( FD_UNLIKELY( err ) ) return err;
29620 0 : return fd_gossip_msg_inner_encode( &self->inner, self->discriminant, ctx );
29621 0 : }
29622 :
29623 0 : int fd_addrlut_create_decode( fd_addrlut_create_t * self, fd_bincode_decode_ctx_t * ctx ) {
29624 0 : void const * data = ctx->data;
29625 0 : int err = fd_addrlut_create_decode_preflight( ctx );
29626 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29627 0 : ctx->data = data;
29628 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
29629 0 : fd_addrlut_create_new( self );
29630 0 : }
29631 0 : fd_addrlut_create_decode_unsafe( self, ctx );
29632 0 : return FD_BINCODE_SUCCESS;
29633 0 : }
29634 0 : int fd_addrlut_create_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
29635 0 : return fd_bincode_bytes_decode_preflight( 9, ctx );
29636 0 : }
29637 0 : void fd_addrlut_create_decode_unsafe( fd_addrlut_create_t * self, fd_bincode_decode_ctx_t * ctx ) {
29638 0 : fd_bincode_uint64_decode_unsafe( &self->recent_slot, ctx );
29639 0 : fd_bincode_uint8_decode_unsafe( &self->bump_seed, ctx );
29640 0 : }
29641 0 : int fd_addrlut_create_encode( fd_addrlut_create_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29642 0 : int err;
29643 0 : err = fd_bincode_uint64_encode( self->recent_slot, ctx );
29644 0 : if( FD_UNLIKELY( err ) ) return err;
29645 0 : err = fd_bincode_uint8_encode( (uchar)(self->bump_seed), ctx );
29646 0 : if( FD_UNLIKELY( err ) ) return err;
29647 0 : return FD_BINCODE_SUCCESS;
29648 0 : }
29649 0 : int fd_addrlut_create_decode_offsets( fd_addrlut_create_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
29650 0 : uchar const * data = ctx->data;
29651 0 : int err;
29652 0 : self->recent_slot_off = (uint)( (ulong)ctx->data - (ulong)data );
29653 0 : err = fd_bincode_uint64_decode_preflight( ctx );
29654 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29655 0 : self->bump_seed_off = (uint)( (ulong)ctx->data - (ulong)data );
29656 0 : err = fd_bincode_uint8_decode_preflight( ctx );
29657 0 : if( FD_UNLIKELY( err ) ) return err;
29658 0 : return FD_BINCODE_SUCCESS;
29659 0 : }
29660 0 : void fd_addrlut_create_new(fd_addrlut_create_t * self) {
29661 0 : fd_memset( self, 0, sizeof(fd_addrlut_create_t) );
29662 0 : }
29663 0 : void fd_addrlut_create_destroy( fd_addrlut_create_t * self, fd_bincode_destroy_ctx_t * ctx ) {
29664 0 : }
29665 :
29666 0 : ulong fd_addrlut_create_footprint( void ){ return FD_ADDRLUT_CREATE_FOOTPRINT; }
29667 0 : ulong fd_addrlut_create_align( void ){ return FD_ADDRLUT_CREATE_ALIGN; }
29668 :
29669 0 : void fd_addrlut_create_walk( void * w, fd_addrlut_create_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29670 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_create", level++ );
29671 0 : fun( w, &self->recent_slot, "recent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
29672 0 : fun( w, &self->bump_seed, "bump_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
29673 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_create", level-- );
29674 0 : }
29675 0 : ulong fd_addrlut_create_size( fd_addrlut_create_t const * self ) {
29676 0 : ulong size = 0;
29677 0 : size += sizeof(ulong);
29678 0 : size += sizeof(char);
29679 0 : return size;
29680 0 : }
29681 :
29682 0 : int fd_addrlut_extend_decode( fd_addrlut_extend_t * self, fd_bincode_decode_ctx_t * ctx ) {
29683 0 : void const * data = ctx->data;
29684 0 : int err = fd_addrlut_extend_decode_preflight( ctx );
29685 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29686 0 : ctx->data = data;
29687 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
29688 0 : fd_addrlut_extend_new( self );
29689 0 : }
29690 0 : fd_addrlut_extend_decode_unsafe( self, ctx );
29691 0 : return FD_BINCODE_SUCCESS;
29692 0 : }
29693 0 : int fd_addrlut_extend_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
29694 0 : int err;
29695 0 : ulong new_addrs_len;
29696 0 : err = fd_bincode_uint64_decode( &new_addrs_len, ctx );
29697 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29698 0 : if( new_addrs_len ) {
29699 0 : for( ulong i=0; i < new_addrs_len; i++ ) {
29700 0 : err = fd_pubkey_decode_preflight( ctx );
29701 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29702 0 : }
29703 0 : }
29704 0 : return FD_BINCODE_SUCCESS;
29705 0 : }
29706 0 : void fd_addrlut_extend_decode_unsafe( fd_addrlut_extend_t * self, fd_bincode_decode_ctx_t * ctx ) {
29707 0 : fd_bincode_uint64_decode_unsafe( &self->new_addrs_len, ctx );
29708 0 : if( self->new_addrs_len ) {
29709 0 : self->new_addrs = (fd_pubkey_t *)fd_valloc_malloc( ctx->valloc, FD_PUBKEY_ALIGN, FD_PUBKEY_FOOTPRINT*self->new_addrs_len );
29710 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
29711 0 : fd_pubkey_new( self->new_addrs + i );
29712 0 : fd_pubkey_decode_unsafe( self->new_addrs + i, ctx );
29713 0 : }
29714 0 : } else
29715 0 : self->new_addrs = NULL;
29716 0 : }
29717 0 : int fd_addrlut_extend_encode( fd_addrlut_extend_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29718 0 : int err;
29719 0 : err = fd_bincode_uint64_encode( self->new_addrs_len, ctx );
29720 0 : if( FD_UNLIKELY(err) ) return err;
29721 0 : if( self->new_addrs_len ) {
29722 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
29723 0 : err = fd_pubkey_encode( self->new_addrs + i, ctx );
29724 0 : if( FD_UNLIKELY( err ) ) return err;
29725 0 : }
29726 0 : }
29727 0 : return FD_BINCODE_SUCCESS;
29728 0 : }
29729 0 : int fd_addrlut_extend_decode_offsets( fd_addrlut_extend_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
29730 0 : uchar const * data = ctx->data;
29731 0 : int err;
29732 0 : self->new_addrs_off = (uint)( (ulong)ctx->data - (ulong)data );
29733 0 : ulong new_addrs_len;
29734 0 : err = fd_bincode_uint64_decode( &new_addrs_len, ctx );
29735 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29736 0 : if( new_addrs_len ) {
29737 0 : for( ulong i=0; i < new_addrs_len; i++ ) {
29738 0 : err = fd_pubkey_decode_preflight( ctx );
29739 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29740 0 : }
29741 0 : }
29742 0 : return FD_BINCODE_SUCCESS;
29743 0 : }
29744 0 : void fd_addrlut_extend_new(fd_addrlut_extend_t * self) {
29745 0 : fd_memset( self, 0, sizeof(fd_addrlut_extend_t) );
29746 0 : }
29747 0 : void fd_addrlut_extend_destroy( fd_addrlut_extend_t * self, fd_bincode_destroy_ctx_t * ctx ) {
29748 0 : if( self->new_addrs ) {
29749 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
29750 0 : fd_pubkey_destroy( self->new_addrs + i, ctx );
29751 0 : fd_valloc_free( ctx->valloc, self->new_addrs );
29752 0 : self->new_addrs = NULL;
29753 0 : }
29754 0 : }
29755 :
29756 0 : ulong fd_addrlut_extend_footprint( void ){ return FD_ADDRLUT_EXTEND_FOOTPRINT; }
29757 0 : ulong fd_addrlut_extend_align( void ){ return FD_ADDRLUT_EXTEND_ALIGN; }
29758 :
29759 0 : void fd_addrlut_extend_walk( void * w, fd_addrlut_extend_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29760 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_extend", level++ );
29761 0 : if( self->new_addrs_len ) {
29762 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR, "array", level++ );
29763 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
29764 0 : fd_pubkey_walk(w, self->new_addrs + i, fun, "pubkey", level );
29765 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
29766 0 : }
29767 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_extend", level-- );
29768 0 : }
29769 0 : ulong fd_addrlut_extend_size( fd_addrlut_extend_t const * self ) {
29770 0 : ulong size = 0;
29771 0 : do {
29772 0 : size += sizeof(ulong);
29773 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
29774 0 : size += fd_pubkey_size( self->new_addrs + i );
29775 0 : } while(0);
29776 0 : return size;
29777 0 : }
29778 :
29779 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_create_lut(fd_addrlut_instruction_t const * self) {
29780 0 : return self->discriminant == 0;
29781 0 : }
29782 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_freeze_lut(fd_addrlut_instruction_t const * self) {
29783 0 : return self->discriminant == 1;
29784 0 : }
29785 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_extend_lut(fd_addrlut_instruction_t const * self) {
29786 0 : return self->discriminant == 2;
29787 0 : }
29788 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_deactivate_lut(fd_addrlut_instruction_t const * self) {
29789 0 : return self->discriminant == 3;
29790 0 : }
29791 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_close_lut(fd_addrlut_instruction_t const * self) {
29792 0 : return self->discriminant == 4;
29793 0 : }
29794 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant );
29795 0 : int fd_addrlut_instruction_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
29796 0 : int err;
29797 0 : switch (discriminant) {
29798 0 : case 0: {
29799 0 : err = fd_addrlut_create_decode_preflight( ctx );
29800 0 : if( FD_UNLIKELY( err ) ) return err;
29801 0 : return FD_BINCODE_SUCCESS;
29802 0 : }
29803 0 : case 1: {
29804 0 : return FD_BINCODE_SUCCESS;
29805 0 : }
29806 0 : case 2: {
29807 0 : err = fd_addrlut_extend_decode_preflight( ctx );
29808 0 : if( FD_UNLIKELY( err ) ) return err;
29809 0 : return FD_BINCODE_SUCCESS;
29810 0 : }
29811 0 : case 3: {
29812 0 : return FD_BINCODE_SUCCESS;
29813 0 : }
29814 0 : case 4: {
29815 0 : return FD_BINCODE_SUCCESS;
29816 0 : }
29817 0 : default: return FD_BINCODE_ERR_ENCODING;
29818 0 : }
29819 0 : }
29820 0 : void fd_addrlut_instruction_inner_decode_unsafe( fd_addrlut_instruction_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
29821 0 : switch (discriminant) {
29822 0 : case 0: {
29823 0 : fd_addrlut_create_decode_unsafe( &self->create_lut, ctx );
29824 0 : break;
29825 0 : }
29826 0 : case 1: {
29827 0 : break;
29828 0 : }
29829 0 : case 2: {
29830 0 : fd_addrlut_extend_decode_unsafe( &self->extend_lut, ctx );
29831 0 : break;
29832 0 : }
29833 0 : case 3: {
29834 0 : break;
29835 0 : }
29836 0 : case 4: {
29837 0 : break;
29838 0 : }
29839 0 : }
29840 0 : }
29841 0 : int fd_addrlut_instruction_decode( fd_addrlut_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
29842 0 : void const * data = ctx->data;
29843 0 : int err = fd_addrlut_instruction_decode_preflight( ctx );
29844 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29845 0 : ctx->data = data;
29846 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
29847 0 : fd_addrlut_instruction_new( self );
29848 0 : }
29849 0 : fd_addrlut_instruction_decode_unsafe( self, ctx );
29850 0 : return FD_BINCODE_SUCCESS;
29851 0 : }
29852 0 : int fd_addrlut_instruction_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
29853 0 : uint discriminant = 0;
29854 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
29855 0 : if( FD_UNLIKELY( err ) ) return err;
29856 0 : return fd_addrlut_instruction_inner_decode_preflight( discriminant, ctx );
29857 0 : }
29858 0 : void fd_addrlut_instruction_decode_unsafe( fd_addrlut_instruction_t * self, fd_bincode_decode_ctx_t * ctx ) {
29859 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
29860 0 : fd_addrlut_instruction_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
29861 0 : }
29862 0 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant ) {
29863 0 : switch( discriminant ) {
29864 0 : case 0: {
29865 0 : fd_addrlut_create_new( &self->create_lut );
29866 0 : break;
29867 0 : }
29868 0 : case 1: {
29869 0 : break;
29870 0 : }
29871 0 : case 2: {
29872 0 : fd_addrlut_extend_new( &self->extend_lut );
29873 0 : break;
29874 0 : }
29875 0 : case 3: {
29876 0 : break;
29877 0 : }
29878 0 : case 4: {
29879 0 : break;
29880 0 : }
29881 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
29882 0 : }
29883 0 : }
29884 0 : void fd_addrlut_instruction_new_disc( fd_addrlut_instruction_t * self, uint discriminant ) {
29885 0 : self->discriminant = discriminant;
29886 0 : fd_addrlut_instruction_inner_new( &self->inner, self->discriminant );
29887 0 : }
29888 0 : void fd_addrlut_instruction_new( fd_addrlut_instruction_t * self ) {
29889 0 : fd_memset( self, 0, sizeof(fd_addrlut_instruction_t) );
29890 0 : fd_addrlut_instruction_new_disc( self, UINT_MAX );
29891 0 : }
29892 0 : void fd_addrlut_instruction_inner_destroy( fd_addrlut_instruction_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
29893 0 : switch( discriminant ) {
29894 0 : case 0: {
29895 0 : fd_addrlut_create_destroy( &self->create_lut, ctx );
29896 0 : break;
29897 0 : }
29898 0 : case 2: {
29899 0 : fd_addrlut_extend_destroy( &self->extend_lut, ctx );
29900 0 : break;
29901 0 : }
29902 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
29903 0 : }
29904 0 : }
29905 0 : void fd_addrlut_instruction_destroy( fd_addrlut_instruction_t * self, fd_bincode_destroy_ctx_t * ctx ) {
29906 0 : fd_addrlut_instruction_inner_destroy( &self->inner, self->discriminant, ctx );
29907 0 : }
29908 :
29909 0 : ulong fd_addrlut_instruction_footprint( void ){ return FD_ADDRLUT_INSTRUCTION_FOOTPRINT; }
29910 0 : ulong fd_addrlut_instruction_align( void ){ return FD_ADDRLUT_INSTRUCTION_ALIGN; }
29911 :
29912 0 : void fd_addrlut_instruction_walk( void * w, fd_addrlut_instruction_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
29913 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_addrlut_instruction", level++);
29914 0 : switch( self->discriminant ) {
29915 0 : case 0: {
29916 0 : fun( w, self, "create_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29917 0 : fd_addrlut_create_walk( w, &self->inner.create_lut, fun, "create_lut", level );
29918 0 : break;
29919 0 : }
29920 0 : case 1: {
29921 0 : fun( w, self, "freeze_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29922 0 : break;
29923 0 : }
29924 0 : case 2: {
29925 0 : fun( w, self, "extend_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29926 0 : fd_addrlut_extend_walk( w, &self->inner.extend_lut, fun, "extend_lut", level );
29927 0 : break;
29928 0 : }
29929 0 : case 3: {
29930 0 : fun( w, self, "deactivate_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29931 0 : break;
29932 0 : }
29933 0 : case 4: {
29934 0 : fun( w, self, "close_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
29935 0 : break;
29936 0 : }
29937 0 : }
29938 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_addrlut_instruction", level-- );
29939 0 : }
29940 0 : ulong fd_addrlut_instruction_size( fd_addrlut_instruction_t const * self ) {
29941 0 : ulong size = 0;
29942 0 : size += sizeof(uint);
29943 0 : switch (self->discriminant) {
29944 0 : case 0: {
29945 0 : size += fd_addrlut_create_size( &self->inner.create_lut );
29946 0 : break;
29947 0 : }
29948 0 : case 2: {
29949 0 : size += fd_addrlut_extend_size( &self->inner.extend_lut );
29950 0 : break;
29951 0 : }
29952 0 : }
29953 0 : return size;
29954 0 : }
29955 :
29956 0 : int fd_addrlut_instruction_inner_encode( fd_addrlut_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
29957 0 : int err;
29958 0 : switch (discriminant) {
29959 0 : case 0: {
29960 0 : err = fd_addrlut_create_encode( &self->create_lut, ctx );
29961 0 : if( FD_UNLIKELY( err ) ) return err;
29962 0 : break;
29963 0 : }
29964 0 : case 2: {
29965 0 : err = fd_addrlut_extend_encode( &self->extend_lut, ctx );
29966 0 : if( FD_UNLIKELY( err ) ) return err;
29967 0 : break;
29968 0 : }
29969 0 : }
29970 0 : return FD_BINCODE_SUCCESS;
29971 0 : }
29972 0 : int fd_addrlut_instruction_encode( fd_addrlut_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
29973 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
29974 0 : if( FD_UNLIKELY( err ) ) return err;
29975 0 : return fd_addrlut_instruction_inner_encode( &self->inner, self->discriminant, ctx );
29976 0 : }
29977 :
29978 0 : int fd_repair_request_header_decode( fd_repair_request_header_t * self, fd_bincode_decode_ctx_t * ctx ) {
29979 0 : void const * data = ctx->data;
29980 0 : int err = fd_repair_request_header_decode_preflight( ctx );
29981 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
29982 0 : ctx->data = data;
29983 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
29984 0 : fd_repair_request_header_new( self );
29985 0 : }
29986 0 : fd_repair_request_header_decode_unsafe( self, ctx );
29987 0 : return FD_BINCODE_SUCCESS;
29988 0 : }
29989 0 : int fd_repair_request_header_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
29990 0 : return fd_bincode_bytes_decode_preflight( 140, ctx );
29991 0 : }
29992 0 : void fd_repair_request_header_decode_unsafe( fd_repair_request_header_t * self, fd_bincode_decode_ctx_t * ctx ) {
29993 0 : fd_signature_decode_unsafe( &self->signature, ctx );
29994 0 : fd_pubkey_decode_unsafe( &self->sender, ctx );
29995 0 : fd_pubkey_decode_unsafe( &self->recipient, ctx );
29996 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
29997 0 : fd_bincode_uint32_decode_unsafe( &self->nonce, ctx );
29998 0 : }
29999 0 : int fd_repair_request_header_encode( fd_repair_request_header_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30000 0 : int err;
30001 0 : err = fd_signature_encode( &self->signature, ctx );
30002 0 : if( FD_UNLIKELY( err ) ) return err;
30003 0 : err = fd_pubkey_encode( &self->sender, ctx );
30004 0 : if( FD_UNLIKELY( err ) ) return err;
30005 0 : err = fd_pubkey_encode( &self->recipient, ctx );
30006 0 : if( FD_UNLIKELY( err ) ) return err;
30007 0 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
30008 0 : if( FD_UNLIKELY( err ) ) return err;
30009 0 : err = fd_bincode_uint32_encode( self->nonce, ctx );
30010 0 : if( FD_UNLIKELY( err ) ) return err;
30011 0 : return FD_BINCODE_SUCCESS;
30012 0 : }
30013 0 : int fd_repair_request_header_decode_offsets( fd_repair_request_header_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
30014 0 : uchar const * data = ctx->data;
30015 0 : int err;
30016 0 : self->signature_off = (uint)( (ulong)ctx->data - (ulong)data );
30017 0 : err = fd_signature_decode_preflight( ctx );
30018 0 : if( FD_UNLIKELY( err ) ) return err;
30019 0 : self->sender_off = (uint)( (ulong)ctx->data - (ulong)data );
30020 0 : err = fd_pubkey_decode_preflight( ctx );
30021 0 : if( FD_UNLIKELY( err ) ) return err;
30022 0 : self->recipient_off = (uint)( (ulong)ctx->data - (ulong)data );
30023 0 : err = fd_pubkey_decode_preflight( ctx );
30024 0 : if( FD_UNLIKELY( err ) ) return err;
30025 0 : self->timestamp_off = (uint)( (ulong)ctx->data - (ulong)data );
30026 0 : err = fd_bincode_uint64_decode_preflight( ctx );
30027 0 : if( FD_UNLIKELY( err ) ) return err;
30028 0 : self->nonce_off = (uint)( (ulong)ctx->data - (ulong)data );
30029 0 : err = fd_bincode_uint32_decode_preflight( ctx );
30030 0 : if( FD_UNLIKELY( err ) ) return err;
30031 0 : return FD_BINCODE_SUCCESS;
30032 0 : }
30033 0 : void fd_repair_request_header_new(fd_repair_request_header_t * self) {
30034 0 : fd_memset( self, 0, sizeof(fd_repair_request_header_t) );
30035 0 : fd_signature_new( &self->signature );
30036 0 : fd_pubkey_new( &self->sender );
30037 0 : fd_pubkey_new( &self->recipient );
30038 0 : }
30039 0 : void fd_repair_request_header_destroy( fd_repair_request_header_t * self, fd_bincode_destroy_ctx_t * ctx ) {
30040 0 : fd_signature_destroy( &self->signature, ctx );
30041 0 : fd_pubkey_destroy( &self->sender, ctx );
30042 0 : fd_pubkey_destroy( &self->recipient, ctx );
30043 0 : }
30044 :
30045 0 : ulong fd_repair_request_header_footprint( void ){ return FD_REPAIR_REQUEST_HEADER_FOOTPRINT; }
30046 0 : ulong fd_repair_request_header_align( void ){ return FD_REPAIR_REQUEST_HEADER_ALIGN; }
30047 :
30048 0 : void fd_repair_request_header_walk( void * w, fd_repair_request_header_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30049 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_request_header", level++ );
30050 0 : fd_signature_walk( w, &self->signature, fun, "signature", level );
30051 0 : fd_pubkey_walk( w, &self->sender, fun, "sender", level );
30052 0 : fd_pubkey_walk( w, &self->recipient, fun, "recipient", level );
30053 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level );
30054 0 : fun( w, &self->nonce, "nonce", FD_FLAMENCO_TYPE_UINT, "uint", level );
30055 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_request_header", level-- );
30056 0 : }
30057 0 : ulong fd_repair_request_header_size( fd_repair_request_header_t const * self ) {
30058 0 : ulong size = 0;
30059 0 : size += fd_signature_size( &self->signature );
30060 0 : size += fd_pubkey_size( &self->sender );
30061 0 : size += fd_pubkey_size( &self->recipient );
30062 0 : size += sizeof(long);
30063 0 : size += sizeof(uint);
30064 0 : return size;
30065 0 : }
30066 :
30067 0 : int fd_repair_window_index_decode( fd_repair_window_index_t * self, fd_bincode_decode_ctx_t * ctx ) {
30068 0 : void const * data = ctx->data;
30069 0 : int err = fd_repair_window_index_decode_preflight( ctx );
30070 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30071 0 : ctx->data = data;
30072 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
30073 0 : fd_repair_window_index_new( self );
30074 0 : }
30075 0 : fd_repair_window_index_decode_unsafe( self, ctx );
30076 0 : return FD_BINCODE_SUCCESS;
30077 0 : }
30078 0 : int fd_repair_window_index_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
30079 0 : return fd_bincode_bytes_decode_preflight( 156, ctx );
30080 0 : }
30081 0 : void fd_repair_window_index_decode_unsafe( fd_repair_window_index_t * self, fd_bincode_decode_ctx_t * ctx ) {
30082 0 : fd_repair_request_header_decode_unsafe( &self->header, ctx );
30083 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
30084 0 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
30085 0 : }
30086 0 : int fd_repair_window_index_encode( fd_repair_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30087 0 : int err;
30088 0 : err = fd_repair_request_header_encode( &self->header, ctx );
30089 0 : if( FD_UNLIKELY( err ) ) return err;
30090 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
30091 0 : if( FD_UNLIKELY( err ) ) return err;
30092 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
30093 0 : if( FD_UNLIKELY( err ) ) return err;
30094 0 : return FD_BINCODE_SUCCESS;
30095 0 : }
30096 0 : int fd_repair_window_index_decode_offsets( fd_repair_window_index_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
30097 0 : uchar const * data = ctx->data;
30098 0 : int err;
30099 0 : self->header_off = (uint)( (ulong)ctx->data - (ulong)data );
30100 0 : err = fd_repair_request_header_decode_preflight( ctx );
30101 0 : if( FD_UNLIKELY( err ) ) return err;
30102 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
30103 0 : err = fd_bincode_uint64_decode_preflight( ctx );
30104 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30105 0 : self->shred_index_off = (uint)( (ulong)ctx->data - (ulong)data );
30106 0 : err = fd_bincode_uint64_decode_preflight( ctx );
30107 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30108 0 : return FD_BINCODE_SUCCESS;
30109 0 : }
30110 0 : void fd_repair_window_index_new(fd_repair_window_index_t * self) {
30111 0 : fd_memset( self, 0, sizeof(fd_repair_window_index_t) );
30112 0 : fd_repair_request_header_new( &self->header );
30113 0 : }
30114 0 : void fd_repair_window_index_destroy( fd_repair_window_index_t * self, fd_bincode_destroy_ctx_t * ctx ) {
30115 0 : fd_repair_request_header_destroy( &self->header, ctx );
30116 0 : }
30117 :
30118 0 : ulong fd_repair_window_index_footprint( void ){ return FD_REPAIR_WINDOW_INDEX_FOOTPRINT; }
30119 0 : ulong fd_repair_window_index_align( void ){ return FD_REPAIR_WINDOW_INDEX_ALIGN; }
30120 :
30121 0 : void fd_repair_window_index_walk( void * w, fd_repair_window_index_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30122 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_window_index", level++ );
30123 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level );
30124 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
30125 0 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
30126 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_window_index", level-- );
30127 0 : }
30128 0 : ulong fd_repair_window_index_size( fd_repair_window_index_t const * self ) {
30129 0 : ulong size = 0;
30130 0 : size += fd_repair_request_header_size( &self->header );
30131 0 : size += sizeof(ulong);
30132 0 : size += sizeof(ulong);
30133 0 : return size;
30134 0 : }
30135 :
30136 0 : int fd_repair_highest_window_index_decode( fd_repair_highest_window_index_t * self, fd_bincode_decode_ctx_t * ctx ) {
30137 0 : void const * data = ctx->data;
30138 0 : int err = fd_repair_highest_window_index_decode_preflight( ctx );
30139 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30140 0 : ctx->data = data;
30141 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
30142 0 : fd_repair_highest_window_index_new( self );
30143 0 : }
30144 0 : fd_repair_highest_window_index_decode_unsafe( self, ctx );
30145 0 : return FD_BINCODE_SUCCESS;
30146 0 : }
30147 0 : int fd_repair_highest_window_index_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
30148 0 : return fd_bincode_bytes_decode_preflight( 156, ctx );
30149 0 : }
30150 0 : void fd_repair_highest_window_index_decode_unsafe( fd_repair_highest_window_index_t * self, fd_bincode_decode_ctx_t * ctx ) {
30151 0 : fd_repair_request_header_decode_unsafe( &self->header, ctx );
30152 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
30153 0 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
30154 0 : }
30155 0 : int fd_repair_highest_window_index_encode( fd_repair_highest_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30156 0 : int err;
30157 0 : err = fd_repair_request_header_encode( &self->header, ctx );
30158 0 : if( FD_UNLIKELY( err ) ) return err;
30159 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
30160 0 : if( FD_UNLIKELY( err ) ) return err;
30161 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
30162 0 : if( FD_UNLIKELY( err ) ) return err;
30163 0 : return FD_BINCODE_SUCCESS;
30164 0 : }
30165 0 : int fd_repair_highest_window_index_decode_offsets( fd_repair_highest_window_index_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
30166 0 : uchar const * data = ctx->data;
30167 0 : int err;
30168 0 : self->header_off = (uint)( (ulong)ctx->data - (ulong)data );
30169 0 : err = fd_repair_request_header_decode_preflight( ctx );
30170 0 : if( FD_UNLIKELY( err ) ) return err;
30171 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
30172 0 : err = fd_bincode_uint64_decode_preflight( ctx );
30173 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30174 0 : self->shred_index_off = (uint)( (ulong)ctx->data - (ulong)data );
30175 0 : err = fd_bincode_uint64_decode_preflight( ctx );
30176 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30177 0 : return FD_BINCODE_SUCCESS;
30178 0 : }
30179 0 : void fd_repair_highest_window_index_new(fd_repair_highest_window_index_t * self) {
30180 0 : fd_memset( self, 0, sizeof(fd_repair_highest_window_index_t) );
30181 0 : fd_repair_request_header_new( &self->header );
30182 0 : }
30183 0 : void fd_repair_highest_window_index_destroy( fd_repair_highest_window_index_t * self, fd_bincode_destroy_ctx_t * ctx ) {
30184 0 : fd_repair_request_header_destroy( &self->header, ctx );
30185 0 : }
30186 :
30187 0 : ulong fd_repair_highest_window_index_footprint( void ){ return FD_REPAIR_HIGHEST_WINDOW_INDEX_FOOTPRINT; }
30188 0 : ulong fd_repair_highest_window_index_align( void ){ return FD_REPAIR_HIGHEST_WINDOW_INDEX_ALIGN; }
30189 :
30190 0 : void fd_repair_highest_window_index_walk( void * w, fd_repair_highest_window_index_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30191 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_highest_window_index", level++ );
30192 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level );
30193 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
30194 0 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
30195 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_highest_window_index", level-- );
30196 0 : }
30197 0 : ulong fd_repair_highest_window_index_size( fd_repair_highest_window_index_t const * self ) {
30198 0 : ulong size = 0;
30199 0 : size += fd_repair_request_header_size( &self->header );
30200 0 : size += sizeof(ulong);
30201 0 : size += sizeof(ulong);
30202 0 : return size;
30203 0 : }
30204 :
30205 0 : int fd_repair_orphan_decode( fd_repair_orphan_t * self, fd_bincode_decode_ctx_t * ctx ) {
30206 0 : void const * data = ctx->data;
30207 0 : int err = fd_repair_orphan_decode_preflight( ctx );
30208 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30209 0 : ctx->data = data;
30210 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
30211 0 : fd_repair_orphan_new( self );
30212 0 : }
30213 0 : fd_repair_orphan_decode_unsafe( self, ctx );
30214 0 : return FD_BINCODE_SUCCESS;
30215 0 : }
30216 0 : int fd_repair_orphan_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
30217 0 : return fd_bincode_bytes_decode_preflight( 148, ctx );
30218 0 : }
30219 0 : void fd_repair_orphan_decode_unsafe( fd_repair_orphan_t * self, fd_bincode_decode_ctx_t * ctx ) {
30220 0 : fd_repair_request_header_decode_unsafe( &self->header, ctx );
30221 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
30222 0 : }
30223 0 : int fd_repair_orphan_encode( fd_repair_orphan_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30224 0 : int err;
30225 0 : err = fd_repair_request_header_encode( &self->header, ctx );
30226 0 : if( FD_UNLIKELY( err ) ) return err;
30227 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
30228 0 : if( FD_UNLIKELY( err ) ) return err;
30229 0 : return FD_BINCODE_SUCCESS;
30230 0 : }
30231 0 : int fd_repair_orphan_decode_offsets( fd_repair_orphan_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
30232 0 : uchar const * data = ctx->data;
30233 0 : int err;
30234 0 : self->header_off = (uint)( (ulong)ctx->data - (ulong)data );
30235 0 : err = fd_repair_request_header_decode_preflight( ctx );
30236 0 : if( FD_UNLIKELY( err ) ) return err;
30237 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
30238 0 : err = fd_bincode_uint64_decode_preflight( ctx );
30239 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30240 0 : return FD_BINCODE_SUCCESS;
30241 0 : }
30242 0 : void fd_repair_orphan_new(fd_repair_orphan_t * self) {
30243 0 : fd_memset( self, 0, sizeof(fd_repair_orphan_t) );
30244 0 : fd_repair_request_header_new( &self->header );
30245 0 : }
30246 0 : void fd_repair_orphan_destroy( fd_repair_orphan_t * self, fd_bincode_destroy_ctx_t * ctx ) {
30247 0 : fd_repair_request_header_destroy( &self->header, ctx );
30248 0 : }
30249 :
30250 0 : ulong fd_repair_orphan_footprint( void ){ return FD_REPAIR_ORPHAN_FOOTPRINT; }
30251 0 : ulong fd_repair_orphan_align( void ){ return FD_REPAIR_ORPHAN_ALIGN; }
30252 :
30253 0 : void fd_repair_orphan_walk( void * w, fd_repair_orphan_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30254 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_orphan", level++ );
30255 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level );
30256 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
30257 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_orphan", level-- );
30258 0 : }
30259 0 : ulong fd_repair_orphan_size( fd_repair_orphan_t const * self ) {
30260 0 : ulong size = 0;
30261 0 : size += fd_repair_request_header_size( &self->header );
30262 0 : size += sizeof(ulong);
30263 0 : return size;
30264 0 : }
30265 :
30266 0 : int fd_repair_ancestor_hashes_decode( fd_repair_ancestor_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
30267 0 : void const * data = ctx->data;
30268 0 : int err = fd_repair_ancestor_hashes_decode_preflight( ctx );
30269 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30270 0 : ctx->data = data;
30271 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
30272 0 : fd_repair_ancestor_hashes_new( self );
30273 0 : }
30274 0 : fd_repair_ancestor_hashes_decode_unsafe( self, ctx );
30275 0 : return FD_BINCODE_SUCCESS;
30276 0 : }
30277 0 : int fd_repair_ancestor_hashes_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
30278 0 : return fd_bincode_bytes_decode_preflight( 148, ctx );
30279 0 : }
30280 0 : void fd_repair_ancestor_hashes_decode_unsafe( fd_repair_ancestor_hashes_t * self, fd_bincode_decode_ctx_t * ctx ) {
30281 0 : fd_repair_request_header_decode_unsafe( &self->header, ctx );
30282 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
30283 0 : }
30284 0 : int fd_repair_ancestor_hashes_encode( fd_repair_ancestor_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30285 0 : int err;
30286 0 : err = fd_repair_request_header_encode( &self->header, ctx );
30287 0 : if( FD_UNLIKELY( err ) ) return err;
30288 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
30289 0 : if( FD_UNLIKELY( err ) ) return err;
30290 0 : return FD_BINCODE_SUCCESS;
30291 0 : }
30292 0 : int fd_repair_ancestor_hashes_decode_offsets( fd_repair_ancestor_hashes_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
30293 0 : uchar const * data = ctx->data;
30294 0 : int err;
30295 0 : self->header_off = (uint)( (ulong)ctx->data - (ulong)data );
30296 0 : err = fd_repair_request_header_decode_preflight( ctx );
30297 0 : if( FD_UNLIKELY( err ) ) return err;
30298 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
30299 0 : err = fd_bincode_uint64_decode_preflight( ctx );
30300 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30301 0 : return FD_BINCODE_SUCCESS;
30302 0 : }
30303 0 : void fd_repair_ancestor_hashes_new(fd_repair_ancestor_hashes_t * self) {
30304 0 : fd_memset( self, 0, sizeof(fd_repair_ancestor_hashes_t) );
30305 0 : fd_repair_request_header_new( &self->header );
30306 0 : }
30307 0 : void fd_repair_ancestor_hashes_destroy( fd_repair_ancestor_hashes_t * self, fd_bincode_destroy_ctx_t * ctx ) {
30308 0 : fd_repair_request_header_destroy( &self->header, ctx );
30309 0 : }
30310 :
30311 0 : ulong fd_repair_ancestor_hashes_footprint( void ){ return FD_REPAIR_ANCESTOR_HASHES_FOOTPRINT; }
30312 0 : ulong fd_repair_ancestor_hashes_align( void ){ return FD_REPAIR_ANCESTOR_HASHES_ALIGN; }
30313 :
30314 0 : void fd_repair_ancestor_hashes_walk( void * w, fd_repair_ancestor_hashes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30315 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_ancestor_hashes", level++ );
30316 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level );
30317 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
30318 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_ancestor_hashes", level-- );
30319 0 : }
30320 0 : ulong fd_repair_ancestor_hashes_size( fd_repair_ancestor_hashes_t const * self ) {
30321 0 : ulong size = 0;
30322 0 : size += fd_repair_request_header_size( &self->header );
30323 0 : size += sizeof(ulong);
30324 0 : return size;
30325 0 : }
30326 :
30327 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndex(fd_repair_protocol_t const * self) {
30328 0 : return self->discriminant == 0;
30329 0 : }
30330 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndex(fd_repair_protocol_t const * self) {
30331 0 : return self->discriminant == 1;
30332 0 : }
30333 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphan(fd_repair_protocol_t const * self) {
30334 0 : return self->discriminant == 2;
30335 0 : }
30336 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndexWithNonce(fd_repair_protocol_t const * self) {
30337 0 : return self->discriminant == 3;
30338 0 : }
30339 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndexWithNonce(fd_repair_protocol_t const * self) {
30340 0 : return self->discriminant == 4;
30341 0 : }
30342 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphanWithNonce(fd_repair_protocol_t const * self) {
30343 0 : return self->discriminant == 5;
30344 0 : }
30345 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyAncestorHashes(fd_repair_protocol_t const * self) {
30346 0 : return self->discriminant == 6;
30347 0 : }
30348 0 : FD_FN_PURE uchar fd_repair_protocol_is_pong(fd_repair_protocol_t const * self) {
30349 0 : return self->discriminant == 7;
30350 0 : }
30351 0 : FD_FN_PURE uchar fd_repair_protocol_is_window_index(fd_repair_protocol_t const * self) {
30352 0 : return self->discriminant == 8;
30353 0 : }
30354 0 : FD_FN_PURE uchar fd_repair_protocol_is_highest_window_index(fd_repair_protocol_t const * self) {
30355 0 : return self->discriminant == 9;
30356 0 : }
30357 0 : FD_FN_PURE uchar fd_repair_protocol_is_orphan(fd_repair_protocol_t const * self) {
30358 0 : return self->discriminant == 10;
30359 0 : }
30360 0 : FD_FN_PURE uchar fd_repair_protocol_is_ancestor_hashes(fd_repair_protocol_t const * self) {
30361 0 : return self->discriminant == 11;
30362 0 : }
30363 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant );
30364 0 : int fd_repair_protocol_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30365 0 : int err;
30366 0 : switch (discriminant) {
30367 0 : case 0: {
30368 0 : return FD_BINCODE_SUCCESS;
30369 0 : }
30370 0 : case 1: {
30371 0 : return FD_BINCODE_SUCCESS;
30372 0 : }
30373 0 : case 2: {
30374 0 : return FD_BINCODE_SUCCESS;
30375 0 : }
30376 0 : case 3: {
30377 0 : return FD_BINCODE_SUCCESS;
30378 0 : }
30379 0 : case 4: {
30380 0 : return FD_BINCODE_SUCCESS;
30381 0 : }
30382 0 : case 5: {
30383 0 : return FD_BINCODE_SUCCESS;
30384 0 : }
30385 0 : case 6: {
30386 0 : return FD_BINCODE_SUCCESS;
30387 0 : }
30388 0 : case 7: {
30389 0 : err = fd_gossip_ping_decode_preflight( ctx );
30390 0 : if( FD_UNLIKELY( err ) ) return err;
30391 0 : return FD_BINCODE_SUCCESS;
30392 0 : }
30393 0 : case 8: {
30394 0 : err = fd_repair_window_index_decode_preflight( ctx );
30395 0 : if( FD_UNLIKELY( err ) ) return err;
30396 0 : return FD_BINCODE_SUCCESS;
30397 0 : }
30398 0 : case 9: {
30399 0 : err = fd_repair_highest_window_index_decode_preflight( ctx );
30400 0 : if( FD_UNLIKELY( err ) ) return err;
30401 0 : return FD_BINCODE_SUCCESS;
30402 0 : }
30403 0 : case 10: {
30404 0 : err = fd_repair_orphan_decode_preflight( ctx );
30405 0 : if( FD_UNLIKELY( err ) ) return err;
30406 0 : return FD_BINCODE_SUCCESS;
30407 0 : }
30408 0 : case 11: {
30409 0 : err = fd_repair_ancestor_hashes_decode_preflight( ctx );
30410 0 : if( FD_UNLIKELY( err ) ) return err;
30411 0 : return FD_BINCODE_SUCCESS;
30412 0 : }
30413 0 : default: return FD_BINCODE_ERR_ENCODING;
30414 0 : }
30415 0 : }
30416 0 : void fd_repair_protocol_inner_decode_unsafe( fd_repair_protocol_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30417 0 : switch (discriminant) {
30418 0 : case 0: {
30419 0 : break;
30420 0 : }
30421 0 : case 1: {
30422 0 : break;
30423 0 : }
30424 0 : case 2: {
30425 0 : break;
30426 0 : }
30427 0 : case 3: {
30428 0 : break;
30429 0 : }
30430 0 : case 4: {
30431 0 : break;
30432 0 : }
30433 0 : case 5: {
30434 0 : break;
30435 0 : }
30436 0 : case 6: {
30437 0 : break;
30438 0 : }
30439 0 : case 7: {
30440 0 : fd_gossip_ping_decode_unsafe( &self->pong, ctx );
30441 0 : break;
30442 0 : }
30443 0 : case 8: {
30444 0 : fd_repair_window_index_decode_unsafe( &self->window_index, ctx );
30445 0 : break;
30446 0 : }
30447 0 : case 9: {
30448 0 : fd_repair_highest_window_index_decode_unsafe( &self->highest_window_index, ctx );
30449 0 : break;
30450 0 : }
30451 0 : case 10: {
30452 0 : fd_repair_orphan_decode_unsafe( &self->orphan, ctx );
30453 0 : break;
30454 0 : }
30455 0 : case 11: {
30456 0 : fd_repair_ancestor_hashes_decode_unsafe( &self->ancestor_hashes, ctx );
30457 0 : break;
30458 0 : }
30459 0 : }
30460 0 : }
30461 0 : int fd_repair_protocol_decode( fd_repair_protocol_t * self, fd_bincode_decode_ctx_t * ctx ) {
30462 0 : void const * data = ctx->data;
30463 0 : int err = fd_repair_protocol_decode_preflight( ctx );
30464 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30465 0 : ctx->data = data;
30466 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
30467 0 : fd_repair_protocol_new( self );
30468 0 : }
30469 0 : fd_repair_protocol_decode_unsafe( self, ctx );
30470 0 : return FD_BINCODE_SUCCESS;
30471 0 : }
30472 0 : int fd_repair_protocol_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
30473 0 : uint discriminant = 0;
30474 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
30475 0 : if( FD_UNLIKELY( err ) ) return err;
30476 0 : return fd_repair_protocol_inner_decode_preflight( discriminant, ctx );
30477 0 : }
30478 0 : void fd_repair_protocol_decode_unsafe( fd_repair_protocol_t * self, fd_bincode_decode_ctx_t * ctx ) {
30479 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
30480 0 : fd_repair_protocol_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
30481 0 : }
30482 0 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant ) {
30483 0 : switch( discriminant ) {
30484 0 : case 0: {
30485 0 : break;
30486 0 : }
30487 0 : case 1: {
30488 0 : break;
30489 0 : }
30490 0 : case 2: {
30491 0 : break;
30492 0 : }
30493 0 : case 3: {
30494 0 : break;
30495 0 : }
30496 0 : case 4: {
30497 0 : break;
30498 0 : }
30499 0 : case 5: {
30500 0 : break;
30501 0 : }
30502 0 : case 6: {
30503 0 : break;
30504 0 : }
30505 0 : case 7: {
30506 0 : fd_gossip_ping_new( &self->pong );
30507 0 : break;
30508 0 : }
30509 0 : case 8: {
30510 0 : fd_repair_window_index_new( &self->window_index );
30511 0 : break;
30512 0 : }
30513 0 : case 9: {
30514 0 : fd_repair_highest_window_index_new( &self->highest_window_index );
30515 0 : break;
30516 0 : }
30517 0 : case 10: {
30518 0 : fd_repair_orphan_new( &self->orphan );
30519 0 : break;
30520 0 : }
30521 0 : case 11: {
30522 0 : fd_repair_ancestor_hashes_new( &self->ancestor_hashes );
30523 0 : break;
30524 0 : }
30525 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
30526 0 : }
30527 0 : }
30528 0 : void fd_repair_protocol_new_disc( fd_repair_protocol_t * self, uint discriminant ) {
30529 0 : self->discriminant = discriminant;
30530 0 : fd_repair_protocol_inner_new( &self->inner, self->discriminant );
30531 0 : }
30532 0 : void fd_repair_protocol_new( fd_repair_protocol_t * self ) {
30533 0 : fd_memset( self, 0, sizeof(fd_repair_protocol_t) );
30534 0 : fd_repair_protocol_new_disc( self, UINT_MAX );
30535 0 : }
30536 0 : void fd_repair_protocol_inner_destroy( fd_repair_protocol_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
30537 0 : switch( discriminant ) {
30538 0 : case 7: {
30539 0 : fd_gossip_ping_destroy( &self->pong, ctx );
30540 0 : break;
30541 0 : }
30542 0 : case 8: {
30543 0 : fd_repair_window_index_destroy( &self->window_index, ctx );
30544 0 : break;
30545 0 : }
30546 0 : case 9: {
30547 0 : fd_repair_highest_window_index_destroy( &self->highest_window_index, ctx );
30548 0 : break;
30549 0 : }
30550 0 : case 10: {
30551 0 : fd_repair_orphan_destroy( &self->orphan, ctx );
30552 0 : break;
30553 0 : }
30554 0 : case 11: {
30555 0 : fd_repair_ancestor_hashes_destroy( &self->ancestor_hashes, ctx );
30556 0 : break;
30557 0 : }
30558 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
30559 0 : }
30560 0 : }
30561 0 : void fd_repair_protocol_destroy( fd_repair_protocol_t * self, fd_bincode_destroy_ctx_t * ctx ) {
30562 0 : fd_repair_protocol_inner_destroy( &self->inner, self->discriminant, ctx );
30563 0 : }
30564 :
30565 0 : ulong fd_repair_protocol_footprint( void ){ return FD_REPAIR_PROTOCOL_FOOTPRINT; }
30566 0 : ulong fd_repair_protocol_align( void ){ return FD_REPAIR_PROTOCOL_ALIGN; }
30567 :
30568 0 : void fd_repair_protocol_walk( void * w, fd_repair_protocol_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30569 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_protocol", level++);
30570 0 : switch( self->discriminant ) {
30571 0 : case 0: {
30572 0 : fun( w, self, "LegacyWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30573 0 : break;
30574 0 : }
30575 0 : case 1: {
30576 0 : fun( w, self, "LegacyHighestWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30577 0 : break;
30578 0 : }
30579 0 : case 2: {
30580 0 : fun( w, self, "LegacyOrphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30581 0 : break;
30582 0 : }
30583 0 : case 3: {
30584 0 : fun( w, self, "LegacyWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30585 0 : break;
30586 0 : }
30587 0 : case 4: {
30588 0 : fun( w, self, "LegacyHighestWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30589 0 : break;
30590 0 : }
30591 0 : case 5: {
30592 0 : fun( w, self, "LegacyOrphanWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30593 0 : break;
30594 0 : }
30595 0 : case 6: {
30596 0 : fun( w, self, "LegacyAncestorHashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30597 0 : break;
30598 0 : }
30599 0 : case 7: {
30600 0 : fun( w, self, "pong", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30601 0 : fd_gossip_ping_walk( w, &self->inner.pong, fun, "pong", level );
30602 0 : break;
30603 0 : }
30604 0 : case 8: {
30605 0 : fun( w, self, "window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30606 0 : fd_repair_window_index_walk( w, &self->inner.window_index, fun, "window_index", level );
30607 0 : break;
30608 0 : }
30609 0 : case 9: {
30610 0 : fun( w, self, "highest_window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30611 0 : fd_repair_highest_window_index_walk( w, &self->inner.highest_window_index, fun, "highest_window_index", level );
30612 0 : break;
30613 0 : }
30614 0 : case 10: {
30615 0 : fun( w, self, "orphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30616 0 : fd_repair_orphan_walk( w, &self->inner.orphan, fun, "orphan", level );
30617 0 : break;
30618 0 : }
30619 0 : case 11: {
30620 0 : fun( w, self, "ancestor_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30621 0 : fd_repair_ancestor_hashes_walk( w, &self->inner.ancestor_hashes, fun, "ancestor_hashes", level );
30622 0 : break;
30623 0 : }
30624 0 : }
30625 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_protocol", level-- );
30626 0 : }
30627 0 : ulong fd_repair_protocol_size( fd_repair_protocol_t const * self ) {
30628 0 : ulong size = 0;
30629 0 : size += sizeof(uint);
30630 0 : switch (self->discriminant) {
30631 0 : case 7: {
30632 0 : size += fd_gossip_ping_size( &self->inner.pong );
30633 0 : break;
30634 0 : }
30635 0 : case 8: {
30636 0 : size += fd_repair_window_index_size( &self->inner.window_index );
30637 0 : break;
30638 0 : }
30639 0 : case 9: {
30640 0 : size += fd_repair_highest_window_index_size( &self->inner.highest_window_index );
30641 0 : break;
30642 0 : }
30643 0 : case 10: {
30644 0 : size += fd_repair_orphan_size( &self->inner.orphan );
30645 0 : break;
30646 0 : }
30647 0 : case 11: {
30648 0 : size += fd_repair_ancestor_hashes_size( &self->inner.ancestor_hashes );
30649 0 : break;
30650 0 : }
30651 0 : }
30652 0 : return size;
30653 0 : }
30654 :
30655 0 : int fd_repair_protocol_inner_encode( fd_repair_protocol_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
30656 0 : int err;
30657 0 : switch (discriminant) {
30658 0 : case 7: {
30659 0 : err = fd_gossip_ping_encode( &self->pong, ctx );
30660 0 : if( FD_UNLIKELY( err ) ) return err;
30661 0 : break;
30662 0 : }
30663 0 : case 8: {
30664 0 : err = fd_repair_window_index_encode( &self->window_index, ctx );
30665 0 : if( FD_UNLIKELY( err ) ) return err;
30666 0 : break;
30667 0 : }
30668 0 : case 9: {
30669 0 : err = fd_repair_highest_window_index_encode( &self->highest_window_index, ctx );
30670 0 : if( FD_UNLIKELY( err ) ) return err;
30671 0 : break;
30672 0 : }
30673 0 : case 10: {
30674 0 : err = fd_repair_orphan_encode( &self->orphan, ctx );
30675 0 : if( FD_UNLIKELY( err ) ) return err;
30676 0 : break;
30677 0 : }
30678 0 : case 11: {
30679 0 : err = fd_repair_ancestor_hashes_encode( &self->ancestor_hashes, ctx );
30680 0 : if( FD_UNLIKELY( err ) ) return err;
30681 0 : break;
30682 0 : }
30683 0 : }
30684 0 : return FD_BINCODE_SUCCESS;
30685 0 : }
30686 0 : int fd_repair_protocol_encode( fd_repair_protocol_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30687 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
30688 0 : if( FD_UNLIKELY( err ) ) return err;
30689 0 : return fd_repair_protocol_inner_encode( &self->inner, self->discriminant, ctx );
30690 0 : }
30691 :
30692 0 : FD_FN_PURE uchar fd_repair_response_is_ping(fd_repair_response_t const * self) {
30693 0 : return self->discriminant == 0;
30694 0 : }
30695 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant );
30696 0 : int fd_repair_response_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30697 0 : int err;
30698 0 : switch (discriminant) {
30699 0 : case 0: {
30700 0 : err = fd_gossip_ping_decode_preflight( ctx );
30701 0 : if( FD_UNLIKELY( err ) ) return err;
30702 0 : return FD_BINCODE_SUCCESS;
30703 0 : }
30704 0 : default: return FD_BINCODE_ERR_ENCODING;
30705 0 : }
30706 0 : }
30707 0 : void fd_repair_response_inner_decode_unsafe( fd_repair_response_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30708 0 : switch (discriminant) {
30709 0 : case 0: {
30710 0 : fd_gossip_ping_decode_unsafe( &self->ping, ctx );
30711 0 : break;
30712 0 : }
30713 0 : }
30714 0 : }
30715 0 : int fd_repair_response_decode( fd_repair_response_t * self, fd_bincode_decode_ctx_t * ctx ) {
30716 0 : void const * data = ctx->data;
30717 0 : int err = fd_repair_response_decode_preflight( ctx );
30718 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
30719 0 : ctx->data = data;
30720 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
30721 0 : fd_repair_response_new( self );
30722 0 : }
30723 0 : fd_repair_response_decode_unsafe( self, ctx );
30724 0 : return FD_BINCODE_SUCCESS;
30725 0 : }
30726 0 : int fd_repair_response_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
30727 0 : uint discriminant = 0;
30728 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
30729 0 : if( FD_UNLIKELY( err ) ) return err;
30730 0 : return fd_repair_response_inner_decode_preflight( discriminant, ctx );
30731 0 : }
30732 0 : void fd_repair_response_decode_unsafe( fd_repair_response_t * self, fd_bincode_decode_ctx_t * ctx ) {
30733 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
30734 0 : fd_repair_response_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
30735 0 : }
30736 0 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant ) {
30737 0 : switch( discriminant ) {
30738 0 : case 0: {
30739 0 : fd_gossip_ping_new( &self->ping );
30740 0 : break;
30741 0 : }
30742 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
30743 0 : }
30744 0 : }
30745 0 : void fd_repair_response_new_disc( fd_repair_response_t * self, uint discriminant ) {
30746 0 : self->discriminant = discriminant;
30747 0 : fd_repair_response_inner_new( &self->inner, self->discriminant );
30748 0 : }
30749 0 : void fd_repair_response_new( fd_repair_response_t * self ) {
30750 0 : fd_memset( self, 0, sizeof(fd_repair_response_t) );
30751 0 : fd_repair_response_new_disc( self, UINT_MAX );
30752 0 : }
30753 0 : void fd_repair_response_inner_destroy( fd_repair_response_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
30754 0 : switch( discriminant ) {
30755 0 : case 0: {
30756 0 : fd_gossip_ping_destroy( &self->ping, ctx );
30757 0 : break;
30758 0 : }
30759 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
30760 0 : }
30761 0 : }
30762 0 : void fd_repair_response_destroy( fd_repair_response_t * self, fd_bincode_destroy_ctx_t * ctx ) {
30763 0 : fd_repair_response_inner_destroy( &self->inner, self->discriminant, ctx );
30764 0 : }
30765 :
30766 0 : ulong fd_repair_response_footprint( void ){ return FD_REPAIR_RESPONSE_FOOTPRINT; }
30767 0 : ulong fd_repair_response_align( void ){ return FD_REPAIR_RESPONSE_ALIGN; }
30768 :
30769 0 : void fd_repair_response_walk( void * w, fd_repair_response_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
30770 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_response", level++);
30771 0 : switch( self->discriminant ) {
30772 0 : case 0: {
30773 0 : fun( w, self, "ping", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
30774 0 : fd_gossip_ping_walk( w, &self->inner.ping, fun, "ping", level );
30775 0 : break;
30776 0 : }
30777 0 : }
30778 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_response", level-- );
30779 0 : }
30780 0 : ulong fd_repair_response_size( fd_repair_response_t const * self ) {
30781 0 : ulong size = 0;
30782 0 : size += sizeof(uint);
30783 0 : switch (self->discriminant) {
30784 0 : case 0: {
30785 0 : size += fd_gossip_ping_size( &self->inner.ping );
30786 0 : break;
30787 0 : }
30788 0 : }
30789 0 : return size;
30790 0 : }
30791 :
30792 0 : int fd_repair_response_inner_encode( fd_repair_response_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
30793 0 : int err;
30794 0 : switch (discriminant) {
30795 0 : case 0: {
30796 0 : err = fd_gossip_ping_encode( &self->ping, ctx );
30797 0 : if( FD_UNLIKELY( err ) ) return err;
30798 0 : break;
30799 0 : }
30800 0 : }
30801 0 : return FD_BINCODE_SUCCESS;
30802 0 : }
30803 0 : int fd_repair_response_encode( fd_repair_response_t const * self, fd_bincode_encode_ctx_t * ctx ) {
30804 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
30805 0 : if( FD_UNLIKELY( err ) ) return err;
30806 0 : return fd_repair_response_inner_encode( &self->inner, self->discriminant, ctx );
30807 0 : }
30808 :
30809 0 : FD_FN_PURE uchar fd_instr_error_enum_is_generic_error(fd_instr_error_enum_t const * self) {
30810 0 : return self->discriminant == 0;
30811 0 : }
30812 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_argument(fd_instr_error_enum_t const * self) {
30813 0 : return self->discriminant == 1;
30814 0 : }
30815 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_instruction_data(fd_instr_error_enum_t const * self) {
30816 0 : return self->discriminant == 2;
30817 0 : }
30818 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_data(fd_instr_error_enum_t const * self) {
30819 0 : return self->discriminant == 3;
30820 0 : }
30821 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_too_small(fd_instr_error_enum_t const * self) {
30822 0 : return self->discriminant == 4;
30823 0 : }
30824 0 : FD_FN_PURE uchar fd_instr_error_enum_is_insufficient_funds(fd_instr_error_enum_t const * self) {
30825 0 : return self->discriminant == 5;
30826 0 : }
30827 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_program_id(fd_instr_error_enum_t const * self) {
30828 0 : return self->discriminant == 6;
30829 0 : }
30830 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_required_signature(fd_instr_error_enum_t const * self) {
30831 0 : return self->discriminant == 7;
30832 0 : }
30833 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_already_initialized(fd_instr_error_enum_t const * self) {
30834 0 : return self->discriminant == 8;
30835 0 : }
30836 0 : FD_FN_PURE uchar fd_instr_error_enum_is_uninitialized_account(fd_instr_error_enum_t const * self) {
30837 0 : return self->discriminant == 9;
30838 0 : }
30839 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unbalanced_instruction(fd_instr_error_enum_t const * self) {
30840 0 : return self->discriminant == 10;
30841 0 : }
30842 0 : FD_FN_PURE uchar fd_instr_error_enum_is_modified_program_id(fd_instr_error_enum_t const * self) {
30843 0 : return self->discriminant == 11;
30844 0 : }
30845 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_lamport_spend(fd_instr_error_enum_t const * self) {
30846 0 : return self->discriminant == 12;
30847 0 : }
30848 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_data_modified(fd_instr_error_enum_t const * self) {
30849 0 : return self->discriminant == 13;
30850 0 : }
30851 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_lamport_change(fd_instr_error_enum_t const * self) {
30852 0 : return self->discriminant == 14;
30853 0 : }
30854 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_data_modified(fd_instr_error_enum_t const * self) {
30855 0 : return self->discriminant == 15;
30856 0 : }
30857 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_index(fd_instr_error_enum_t const * self) {
30858 0 : return self->discriminant == 16;
30859 0 : }
30860 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_modified(fd_instr_error_enum_t const * self) {
30861 0 : return self->discriminant == 17;
30862 0 : }
30863 0 : FD_FN_PURE uchar fd_instr_error_enum_is_rent_epoch_modified(fd_instr_error_enum_t const * self) {
30864 0 : return self->discriminant == 18;
30865 0 : }
30866 0 : FD_FN_PURE uchar fd_instr_error_enum_is_not_enough_account_keys(fd_instr_error_enum_t const * self) {
30867 0 : return self->discriminant == 19;
30868 0 : }
30869 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_size_changed(fd_instr_error_enum_t const * self) {
30870 0 : return self->discriminant == 20;
30871 0 : }
30872 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_executable(fd_instr_error_enum_t const * self) {
30873 0 : return self->discriminant == 21;
30874 0 : }
30875 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_failed(fd_instr_error_enum_t const * self) {
30876 0 : return self->discriminant == 22;
30877 0 : }
30878 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_outstanding(fd_instr_error_enum_t const * self) {
30879 0 : return self->discriminant == 23;
30880 0 : }
30881 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_out_of_sync(fd_instr_error_enum_t const * self) {
30882 0 : return self->discriminant == 24;
30883 0 : }
30884 0 : FD_FN_PURE uchar fd_instr_error_enum_is_custom(fd_instr_error_enum_t const * self) {
30885 0 : return self->discriminant == 25;
30886 0 : }
30887 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_error(fd_instr_error_enum_t const * self) {
30888 0 : return self->discriminant == 26;
30889 0 : }
30890 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_data_modified(fd_instr_error_enum_t const * self) {
30891 0 : return self->discriminant == 27;
30892 0 : }
30893 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_lamport_change(fd_instr_error_enum_t const * self) {
30894 0 : return self->discriminant == 28;
30895 0 : }
30896 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
30897 0 : return self->discriminant == 29;
30898 0 : }
30899 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_program_id(fd_instr_error_enum_t const * self) {
30900 0 : return self->discriminant == 30;
30901 0 : }
30902 0 : FD_FN_PURE uchar fd_instr_error_enum_is_call_depth(fd_instr_error_enum_t const * self) {
30903 0 : return self->discriminant == 31;
30904 0 : }
30905 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_account(fd_instr_error_enum_t const * self) {
30906 0 : return self->discriminant == 32;
30907 0 : }
30908 0 : FD_FN_PURE uchar fd_instr_error_enum_is_reentrancy_not_allowed(fd_instr_error_enum_t const * self) {
30909 0 : return self->discriminant == 33;
30910 0 : }
30911 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_seed_length_exceeded(fd_instr_error_enum_t const * self) {
30912 0 : return self->discriminant == 34;
30913 0 : }
30914 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_seeds(fd_instr_error_enum_t const * self) {
30915 0 : return self->discriminant == 35;
30916 0 : }
30917 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_realloc(fd_instr_error_enum_t const * self) {
30918 0 : return self->discriminant == 36;
30919 0 : }
30920 0 : FD_FN_PURE uchar fd_instr_error_enum_is_computational_budget_exceeded(fd_instr_error_enum_t const * self) {
30921 0 : return self->discriminant == 37;
30922 0 : }
30923 0 : FD_FN_PURE uchar fd_instr_error_enum_is_privilege_escalation(fd_instr_error_enum_t const * self) {
30924 0 : return self->discriminant == 38;
30925 0 : }
30926 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_environment_setup_failure(fd_instr_error_enum_t const * self) {
30927 0 : return self->discriminant == 39;
30928 0 : }
30929 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_complete(fd_instr_error_enum_t const * self) {
30930 0 : return self->discriminant == 40;
30931 0 : }
30932 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_compile(fd_instr_error_enum_t const * self) {
30933 0 : return self->discriminant == 41;
30934 0 : }
30935 0 : FD_FN_PURE uchar fd_instr_error_enum_is_immutable(fd_instr_error_enum_t const * self) {
30936 0 : return self->discriminant == 42;
30937 0 : }
30938 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_authority(fd_instr_error_enum_t const * self) {
30939 0 : return self->discriminant == 43;
30940 0 : }
30941 0 : FD_FN_PURE uchar fd_instr_error_enum_is_borsh_io_error(fd_instr_error_enum_t const * self) {
30942 0 : return self->discriminant == 44;
30943 0 : }
30944 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
30945 0 : return self->discriminant == 45;
30946 0 : }
30947 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_owner(fd_instr_error_enum_t const * self) {
30948 0 : return self->discriminant == 46;
30949 0 : }
30950 0 : FD_FN_PURE uchar fd_instr_error_enum_is_arithmetic_overflow(fd_instr_error_enum_t const * self) {
30951 0 : return self->discriminant == 47;
30952 0 : }
30953 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_sysvar(fd_instr_error_enum_t const * self) {
30954 0 : return self->discriminant == 48;
30955 0 : }
30956 0 : FD_FN_PURE uchar fd_instr_error_enum_is_illegal_owner(fd_instr_error_enum_t const * self) {
30957 0 : return self->discriminant == 49;
30958 0 : }
30959 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_data_allocations_exceeded(fd_instr_error_enum_t const * self) {
30960 0 : return self->discriminant == 50;
30961 0 : }
30962 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_exceeded(fd_instr_error_enum_t const * self) {
30963 0 : return self->discriminant == 51;
30964 0 : }
30965 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_instruction_trace_length_exceeded(fd_instr_error_enum_t const * self) {
30966 0 : return self->discriminant == 52;
30967 0 : }
30968 0 : FD_FN_PURE uchar fd_instr_error_enum_is_builtin_programs_must_consume_compute_units(fd_instr_error_enum_t const * self) {
30969 0 : return self->discriminant == 53;
30970 0 : }
30971 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant );
30972 0 : int fd_instr_error_enum_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
30973 0 : int err;
30974 0 : switch (discriminant) {
30975 0 : case 0: {
30976 0 : return FD_BINCODE_SUCCESS;
30977 0 : }
30978 0 : case 1: {
30979 0 : return FD_BINCODE_SUCCESS;
30980 0 : }
30981 0 : case 2: {
30982 0 : return FD_BINCODE_SUCCESS;
30983 0 : }
30984 0 : case 3: {
30985 0 : return FD_BINCODE_SUCCESS;
30986 0 : }
30987 0 : case 4: {
30988 0 : return FD_BINCODE_SUCCESS;
30989 0 : }
30990 0 : case 5: {
30991 0 : return FD_BINCODE_SUCCESS;
30992 0 : }
30993 0 : case 6: {
30994 0 : return FD_BINCODE_SUCCESS;
30995 0 : }
30996 0 : case 7: {
30997 0 : return FD_BINCODE_SUCCESS;
30998 0 : }
30999 0 : case 8: {
31000 0 : return FD_BINCODE_SUCCESS;
31001 0 : }
31002 0 : case 9: {
31003 0 : return FD_BINCODE_SUCCESS;
31004 0 : }
31005 0 : case 10: {
31006 0 : return FD_BINCODE_SUCCESS;
31007 0 : }
31008 0 : case 11: {
31009 0 : return FD_BINCODE_SUCCESS;
31010 0 : }
31011 0 : case 12: {
31012 0 : return FD_BINCODE_SUCCESS;
31013 0 : }
31014 0 : case 13: {
31015 0 : return FD_BINCODE_SUCCESS;
31016 0 : }
31017 0 : case 14: {
31018 0 : return FD_BINCODE_SUCCESS;
31019 0 : }
31020 0 : case 15: {
31021 0 : return FD_BINCODE_SUCCESS;
31022 0 : }
31023 0 : case 16: {
31024 0 : return FD_BINCODE_SUCCESS;
31025 0 : }
31026 0 : case 17: {
31027 0 : return FD_BINCODE_SUCCESS;
31028 0 : }
31029 0 : case 18: {
31030 0 : return FD_BINCODE_SUCCESS;
31031 0 : }
31032 0 : case 19: {
31033 0 : return FD_BINCODE_SUCCESS;
31034 0 : }
31035 0 : case 20: {
31036 0 : return FD_BINCODE_SUCCESS;
31037 0 : }
31038 0 : case 21: {
31039 0 : return FD_BINCODE_SUCCESS;
31040 0 : }
31041 0 : case 22: {
31042 0 : return FD_BINCODE_SUCCESS;
31043 0 : }
31044 0 : case 23: {
31045 0 : return FD_BINCODE_SUCCESS;
31046 0 : }
31047 0 : case 24: {
31048 0 : return FD_BINCODE_SUCCESS;
31049 0 : }
31050 0 : case 25: {
31051 0 : err = fd_bincode_uint32_decode_preflight( ctx );
31052 0 : if( FD_UNLIKELY( err ) ) return err;
31053 0 : return FD_BINCODE_SUCCESS;
31054 0 : }
31055 0 : case 26: {
31056 0 : return FD_BINCODE_SUCCESS;
31057 0 : }
31058 0 : case 27: {
31059 0 : return FD_BINCODE_SUCCESS;
31060 0 : }
31061 0 : case 28: {
31062 0 : return FD_BINCODE_SUCCESS;
31063 0 : }
31064 0 : case 29: {
31065 0 : return FD_BINCODE_SUCCESS;
31066 0 : }
31067 0 : case 30: {
31068 0 : return FD_BINCODE_SUCCESS;
31069 0 : }
31070 0 : case 31: {
31071 0 : return FD_BINCODE_SUCCESS;
31072 0 : }
31073 0 : case 32: {
31074 0 : return FD_BINCODE_SUCCESS;
31075 0 : }
31076 0 : case 33: {
31077 0 : return FD_BINCODE_SUCCESS;
31078 0 : }
31079 0 : case 34: {
31080 0 : return FD_BINCODE_SUCCESS;
31081 0 : }
31082 0 : case 35: {
31083 0 : return FD_BINCODE_SUCCESS;
31084 0 : }
31085 0 : case 36: {
31086 0 : return FD_BINCODE_SUCCESS;
31087 0 : }
31088 0 : case 37: {
31089 0 : return FD_BINCODE_SUCCESS;
31090 0 : }
31091 0 : case 38: {
31092 0 : return FD_BINCODE_SUCCESS;
31093 0 : }
31094 0 : case 39: {
31095 0 : return FD_BINCODE_SUCCESS;
31096 0 : }
31097 0 : case 40: {
31098 0 : return FD_BINCODE_SUCCESS;
31099 0 : }
31100 0 : case 41: {
31101 0 : return FD_BINCODE_SUCCESS;
31102 0 : }
31103 0 : case 42: {
31104 0 : return FD_BINCODE_SUCCESS;
31105 0 : }
31106 0 : case 43: {
31107 0 : return FD_BINCODE_SUCCESS;
31108 0 : }
31109 0 : case 44: {
31110 0 : ulong slen;
31111 0 : err = fd_bincode_uint64_decode( &slen, ctx );
31112 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31113 0 : err = fd_bincode_bytes_decode_preflight( slen, ctx );
31114 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31115 0 : return FD_BINCODE_SUCCESS;
31116 0 : }
31117 0 : case 45: {
31118 0 : return FD_BINCODE_SUCCESS;
31119 0 : }
31120 0 : case 46: {
31121 0 : return FD_BINCODE_SUCCESS;
31122 0 : }
31123 0 : case 47: {
31124 0 : return FD_BINCODE_SUCCESS;
31125 0 : }
31126 0 : case 48: {
31127 0 : return FD_BINCODE_SUCCESS;
31128 0 : }
31129 0 : case 49: {
31130 0 : return FD_BINCODE_SUCCESS;
31131 0 : }
31132 0 : case 50: {
31133 0 : return FD_BINCODE_SUCCESS;
31134 0 : }
31135 0 : case 51: {
31136 0 : return FD_BINCODE_SUCCESS;
31137 0 : }
31138 0 : case 52: {
31139 0 : return FD_BINCODE_SUCCESS;
31140 0 : }
31141 0 : case 53: {
31142 0 : return FD_BINCODE_SUCCESS;
31143 0 : }
31144 0 : default: return FD_BINCODE_ERR_ENCODING;
31145 0 : }
31146 0 : }
31147 0 : void fd_instr_error_enum_inner_decode_unsafe( fd_instr_error_enum_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
31148 0 : switch (discriminant) {
31149 0 : case 0: {
31150 0 : break;
31151 0 : }
31152 0 : case 1: {
31153 0 : break;
31154 0 : }
31155 0 : case 2: {
31156 0 : break;
31157 0 : }
31158 0 : case 3: {
31159 0 : break;
31160 0 : }
31161 0 : case 4: {
31162 0 : break;
31163 0 : }
31164 0 : case 5: {
31165 0 : break;
31166 0 : }
31167 0 : case 6: {
31168 0 : break;
31169 0 : }
31170 0 : case 7: {
31171 0 : break;
31172 0 : }
31173 0 : case 8: {
31174 0 : break;
31175 0 : }
31176 0 : case 9: {
31177 0 : break;
31178 0 : }
31179 0 : case 10: {
31180 0 : break;
31181 0 : }
31182 0 : case 11: {
31183 0 : break;
31184 0 : }
31185 0 : case 12: {
31186 0 : break;
31187 0 : }
31188 0 : case 13: {
31189 0 : break;
31190 0 : }
31191 0 : case 14: {
31192 0 : break;
31193 0 : }
31194 0 : case 15: {
31195 0 : break;
31196 0 : }
31197 0 : case 16: {
31198 0 : break;
31199 0 : }
31200 0 : case 17: {
31201 0 : break;
31202 0 : }
31203 0 : case 18: {
31204 0 : break;
31205 0 : }
31206 0 : case 19: {
31207 0 : break;
31208 0 : }
31209 0 : case 20: {
31210 0 : break;
31211 0 : }
31212 0 : case 21: {
31213 0 : break;
31214 0 : }
31215 0 : case 22: {
31216 0 : break;
31217 0 : }
31218 0 : case 23: {
31219 0 : break;
31220 0 : }
31221 0 : case 24: {
31222 0 : break;
31223 0 : }
31224 0 : case 25: {
31225 0 : fd_bincode_uint32_decode_unsafe( &self->custom, ctx );
31226 0 : break;
31227 0 : }
31228 0 : case 26: {
31229 0 : break;
31230 0 : }
31231 0 : case 27: {
31232 0 : break;
31233 0 : }
31234 0 : case 28: {
31235 0 : break;
31236 0 : }
31237 0 : case 29: {
31238 0 : break;
31239 0 : }
31240 0 : case 30: {
31241 0 : break;
31242 0 : }
31243 0 : case 31: {
31244 0 : break;
31245 0 : }
31246 0 : case 32: {
31247 0 : break;
31248 0 : }
31249 0 : case 33: {
31250 0 : break;
31251 0 : }
31252 0 : case 34: {
31253 0 : break;
31254 0 : }
31255 0 : case 35: {
31256 0 : break;
31257 0 : }
31258 0 : case 36: {
31259 0 : break;
31260 0 : }
31261 0 : case 37: {
31262 0 : break;
31263 0 : }
31264 0 : case 38: {
31265 0 : break;
31266 0 : }
31267 0 : case 39: {
31268 0 : break;
31269 0 : }
31270 0 : case 40: {
31271 0 : break;
31272 0 : }
31273 0 : case 41: {
31274 0 : break;
31275 0 : }
31276 0 : case 42: {
31277 0 : break;
31278 0 : }
31279 0 : case 43: {
31280 0 : break;
31281 0 : }
31282 0 : case 44: {
31283 0 : ulong slen;
31284 0 : fd_bincode_uint64_decode_unsafe( &slen, ctx );
31285 0 : self->borsh_io_error = fd_valloc_malloc( ctx->valloc, 1, slen + 1 );
31286 0 : fd_bincode_bytes_decode_unsafe( (uchar *)self->borsh_io_error, slen, ctx );
31287 0 : self->borsh_io_error[slen] = '\0';
31288 0 : break;
31289 0 : }
31290 0 : case 45: {
31291 0 : break;
31292 0 : }
31293 0 : case 46: {
31294 0 : break;
31295 0 : }
31296 0 : case 47: {
31297 0 : break;
31298 0 : }
31299 0 : case 48: {
31300 0 : break;
31301 0 : }
31302 0 : case 49: {
31303 0 : break;
31304 0 : }
31305 0 : case 50: {
31306 0 : break;
31307 0 : }
31308 0 : case 51: {
31309 0 : break;
31310 0 : }
31311 0 : case 52: {
31312 0 : break;
31313 0 : }
31314 0 : case 53: {
31315 0 : break;
31316 0 : }
31317 0 : }
31318 0 : }
31319 0 : int fd_instr_error_enum_decode( fd_instr_error_enum_t * self, fd_bincode_decode_ctx_t * ctx ) {
31320 0 : void const * data = ctx->data;
31321 0 : int err = fd_instr_error_enum_decode_preflight( ctx );
31322 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31323 0 : ctx->data = data;
31324 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
31325 0 : fd_instr_error_enum_new( self );
31326 0 : }
31327 0 : fd_instr_error_enum_decode_unsafe( self, ctx );
31328 0 : return FD_BINCODE_SUCCESS;
31329 0 : }
31330 0 : int fd_instr_error_enum_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
31331 0 : uint discriminant = 0;
31332 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
31333 0 : if( FD_UNLIKELY( err ) ) return err;
31334 0 : return fd_instr_error_enum_inner_decode_preflight( discriminant, ctx );
31335 0 : }
31336 0 : void fd_instr_error_enum_decode_unsafe( fd_instr_error_enum_t * self, fd_bincode_decode_ctx_t * ctx ) {
31337 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
31338 0 : fd_instr_error_enum_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
31339 0 : }
31340 0 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant ) {
31341 0 : switch( discriminant ) {
31342 0 : case 0: {
31343 0 : break;
31344 0 : }
31345 0 : case 1: {
31346 0 : break;
31347 0 : }
31348 0 : case 2: {
31349 0 : break;
31350 0 : }
31351 0 : case 3: {
31352 0 : break;
31353 0 : }
31354 0 : case 4: {
31355 0 : break;
31356 0 : }
31357 0 : case 5: {
31358 0 : break;
31359 0 : }
31360 0 : case 6: {
31361 0 : break;
31362 0 : }
31363 0 : case 7: {
31364 0 : break;
31365 0 : }
31366 0 : case 8: {
31367 0 : break;
31368 0 : }
31369 0 : case 9: {
31370 0 : break;
31371 0 : }
31372 0 : case 10: {
31373 0 : break;
31374 0 : }
31375 0 : case 11: {
31376 0 : break;
31377 0 : }
31378 0 : case 12: {
31379 0 : break;
31380 0 : }
31381 0 : case 13: {
31382 0 : break;
31383 0 : }
31384 0 : case 14: {
31385 0 : break;
31386 0 : }
31387 0 : case 15: {
31388 0 : break;
31389 0 : }
31390 0 : case 16: {
31391 0 : break;
31392 0 : }
31393 0 : case 17: {
31394 0 : break;
31395 0 : }
31396 0 : case 18: {
31397 0 : break;
31398 0 : }
31399 0 : case 19: {
31400 0 : break;
31401 0 : }
31402 0 : case 20: {
31403 0 : break;
31404 0 : }
31405 0 : case 21: {
31406 0 : break;
31407 0 : }
31408 0 : case 22: {
31409 0 : break;
31410 0 : }
31411 0 : case 23: {
31412 0 : break;
31413 0 : }
31414 0 : case 24: {
31415 0 : break;
31416 0 : }
31417 0 : case 25: {
31418 0 : break;
31419 0 : }
31420 0 : case 26: {
31421 0 : break;
31422 0 : }
31423 0 : case 27: {
31424 0 : break;
31425 0 : }
31426 0 : case 28: {
31427 0 : break;
31428 0 : }
31429 0 : case 29: {
31430 0 : break;
31431 0 : }
31432 0 : case 30: {
31433 0 : break;
31434 0 : }
31435 0 : case 31: {
31436 0 : break;
31437 0 : }
31438 0 : case 32: {
31439 0 : break;
31440 0 : }
31441 0 : case 33: {
31442 0 : break;
31443 0 : }
31444 0 : case 34: {
31445 0 : break;
31446 0 : }
31447 0 : case 35: {
31448 0 : break;
31449 0 : }
31450 0 : case 36: {
31451 0 : break;
31452 0 : }
31453 0 : case 37: {
31454 0 : break;
31455 0 : }
31456 0 : case 38: {
31457 0 : break;
31458 0 : }
31459 0 : case 39: {
31460 0 : break;
31461 0 : }
31462 0 : case 40: {
31463 0 : break;
31464 0 : }
31465 0 : case 41: {
31466 0 : break;
31467 0 : }
31468 0 : case 42: {
31469 0 : break;
31470 0 : }
31471 0 : case 43: {
31472 0 : break;
31473 0 : }
31474 0 : case 44: {
31475 0 : break;
31476 0 : }
31477 0 : case 45: {
31478 0 : break;
31479 0 : }
31480 0 : case 46: {
31481 0 : break;
31482 0 : }
31483 0 : case 47: {
31484 0 : break;
31485 0 : }
31486 0 : case 48: {
31487 0 : break;
31488 0 : }
31489 0 : case 49: {
31490 0 : break;
31491 0 : }
31492 0 : case 50: {
31493 0 : break;
31494 0 : }
31495 0 : case 51: {
31496 0 : break;
31497 0 : }
31498 0 : case 52: {
31499 0 : break;
31500 0 : }
31501 0 : case 53: {
31502 0 : break;
31503 0 : }
31504 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
31505 0 : }
31506 0 : }
31507 0 : void fd_instr_error_enum_new_disc( fd_instr_error_enum_t * self, uint discriminant ) {
31508 0 : self->discriminant = discriminant;
31509 0 : fd_instr_error_enum_inner_new( &self->inner, self->discriminant );
31510 0 : }
31511 0 : void fd_instr_error_enum_new( fd_instr_error_enum_t * self ) {
31512 0 : fd_memset( self, 0, sizeof(fd_instr_error_enum_t) );
31513 0 : fd_instr_error_enum_new_disc( self, UINT_MAX );
31514 0 : }
31515 0 : void fd_instr_error_enum_inner_destroy( fd_instr_error_enum_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
31516 0 : switch( discriminant ) {
31517 0 : case 25: {
31518 0 : break;
31519 0 : }
31520 0 : case 44: {
31521 0 : if( self->borsh_io_error ) {
31522 0 : fd_valloc_free( ctx->valloc, self->borsh_io_error );
31523 0 : self->borsh_io_error = NULL;
31524 0 : }
31525 0 : break;
31526 0 : }
31527 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
31528 0 : }
31529 0 : }
31530 0 : void fd_instr_error_enum_destroy( fd_instr_error_enum_t * self, fd_bincode_destroy_ctx_t * ctx ) {
31531 0 : fd_instr_error_enum_inner_destroy( &self->inner, self->discriminant, ctx );
31532 0 : }
31533 :
31534 0 : ulong fd_instr_error_enum_footprint( void ){ return FD_INSTR_ERROR_ENUM_FOOTPRINT; }
31535 0 : ulong fd_instr_error_enum_align( void ){ return FD_INSTR_ERROR_ENUM_ALIGN; }
31536 :
31537 0 : void fd_instr_error_enum_walk( void * w, fd_instr_error_enum_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31538 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_instr_error_enum", level++);
31539 0 : switch( self->discriminant ) {
31540 0 : case 0: {
31541 0 : fun( w, self, "generic_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31542 0 : break;
31543 0 : }
31544 0 : case 1: {
31545 0 : fun( w, self, "invalid_argument", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31546 0 : break;
31547 0 : }
31548 0 : case 2: {
31549 0 : fun( w, self, "invalid_instruction_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31550 0 : break;
31551 0 : }
31552 0 : case 3: {
31553 0 : fun( w, self, "invalid_account_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31554 0 : break;
31555 0 : }
31556 0 : case 4: {
31557 0 : fun( w, self, "account_data_too_small", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31558 0 : break;
31559 0 : }
31560 0 : case 5: {
31561 0 : fun( w, self, "insufficient_funds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31562 0 : break;
31563 0 : }
31564 0 : case 6: {
31565 0 : fun( w, self, "incorrect_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31566 0 : break;
31567 0 : }
31568 0 : case 7: {
31569 0 : fun( w, self, "missing_required_signature", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31570 0 : break;
31571 0 : }
31572 0 : case 8: {
31573 0 : fun( w, self, "account_already_initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31574 0 : break;
31575 0 : }
31576 0 : case 9: {
31577 0 : fun( w, self, "uninitialized_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31578 0 : break;
31579 0 : }
31580 0 : case 10: {
31581 0 : fun( w, self, "unbalanced_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31582 0 : break;
31583 0 : }
31584 0 : case 11: {
31585 0 : fun( w, self, "modified_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31586 0 : break;
31587 0 : }
31588 0 : case 12: {
31589 0 : fun( w, self, "external_account_lamport_spend", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31590 0 : break;
31591 0 : }
31592 0 : case 13: {
31593 0 : fun( w, self, "external_account_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31594 0 : break;
31595 0 : }
31596 0 : case 14: {
31597 0 : fun( w, self, "readonly_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31598 0 : break;
31599 0 : }
31600 0 : case 15: {
31601 0 : fun( w, self, "readonly_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31602 0 : break;
31603 0 : }
31604 0 : case 16: {
31605 0 : fun( w, self, "duplicate_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31606 0 : break;
31607 0 : }
31608 0 : case 17: {
31609 0 : fun( w, self, "executable_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31610 0 : break;
31611 0 : }
31612 0 : case 18: {
31613 0 : fun( w, self, "rent_epoch_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31614 0 : break;
31615 0 : }
31616 0 : case 19: {
31617 0 : fun( w, self, "not_enough_account_keys", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31618 0 : break;
31619 0 : }
31620 0 : case 20: {
31621 0 : fun( w, self, "account_data_size_changed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31622 0 : break;
31623 0 : }
31624 0 : case 21: {
31625 0 : fun( w, self, "account_not_executable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31626 0 : break;
31627 0 : }
31628 0 : case 22: {
31629 0 : fun( w, self, "account_borrow_failed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31630 0 : break;
31631 0 : }
31632 0 : case 23: {
31633 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31634 0 : break;
31635 0 : }
31636 0 : case 24: {
31637 0 : fun( w, self, "duplicate_account_out_of_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31638 0 : break;
31639 0 : }
31640 0 : case 25: {
31641 0 : fun( w, self, "custom", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31642 0 : fun( w, &self->inner.custom, "custom", FD_FLAMENCO_TYPE_UINT, "uint", level );
31643 0 : break;
31644 0 : }
31645 0 : case 26: {
31646 0 : fun( w, self, "invalid_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31647 0 : break;
31648 0 : }
31649 0 : case 27: {
31650 0 : fun( w, self, "executable_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31651 0 : break;
31652 0 : }
31653 0 : case 28: {
31654 0 : fun( w, self, "executable_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31655 0 : break;
31656 0 : }
31657 0 : case 29: {
31658 0 : fun( w, self, "executable_account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31659 0 : break;
31660 0 : }
31661 0 : case 30: {
31662 0 : fun( w, self, "unsupported_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31663 0 : break;
31664 0 : }
31665 0 : case 31: {
31666 0 : fun( w, self, "call_depth", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31667 0 : break;
31668 0 : }
31669 0 : case 32: {
31670 0 : fun( w, self, "missing_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31671 0 : break;
31672 0 : }
31673 0 : case 33: {
31674 0 : fun( w, self, "reentrancy_not_allowed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31675 0 : break;
31676 0 : }
31677 0 : case 34: {
31678 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31679 0 : break;
31680 0 : }
31681 0 : case 35: {
31682 0 : fun( w, self, "invalid_seeds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31683 0 : break;
31684 0 : }
31685 0 : case 36: {
31686 0 : fun( w, self, "invalid_realloc", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31687 0 : break;
31688 0 : }
31689 0 : case 37: {
31690 0 : fun( w, self, "computational_budget_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31691 0 : break;
31692 0 : }
31693 0 : case 38: {
31694 0 : fun( w, self, "privilege_escalation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31695 0 : break;
31696 0 : }
31697 0 : case 39: {
31698 0 : fun( w, self, "program_environment_setup_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31699 0 : break;
31700 0 : }
31701 0 : case 40: {
31702 0 : fun( w, self, "program_failed_to_complete", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31703 0 : break;
31704 0 : }
31705 0 : case 41: {
31706 0 : fun( w, self, "program_failed_to_compile", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31707 0 : break;
31708 0 : }
31709 0 : case 42: {
31710 0 : fun( w, self, "immutable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31711 0 : break;
31712 0 : }
31713 0 : case 43: {
31714 0 : fun( w, self, "incorrect_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31715 0 : break;
31716 0 : }
31717 0 : case 44: {
31718 0 : fun( w, self, "borsh_io_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31719 0 : fun( w, self->inner.borsh_io_error, "borsh_io_error", FD_FLAMENCO_TYPE_CSTR, "char*", level );
31720 0 : break;
31721 0 : }
31722 0 : case 45: {
31723 0 : fun( w, self, "account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31724 0 : break;
31725 0 : }
31726 0 : case 46: {
31727 0 : fun( w, self, "invalid_account_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31728 0 : break;
31729 0 : }
31730 0 : case 47: {
31731 0 : fun( w, self, "arithmetic_overflow", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31732 0 : break;
31733 0 : }
31734 0 : case 48: {
31735 0 : fun( w, self, "unsupported_sysvar", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31736 0 : break;
31737 0 : }
31738 0 : case 49: {
31739 0 : fun( w, self, "illegal_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31740 0 : break;
31741 0 : }
31742 0 : case 50: {
31743 0 : fun( w, self, "max_accounts_data_allocations_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31744 0 : break;
31745 0 : }
31746 0 : case 51: {
31747 0 : fun( w, self, "max_accounts_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31748 0 : break;
31749 0 : }
31750 0 : case 52: {
31751 0 : fun( w, self, "max_instruction_trace_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31752 0 : break;
31753 0 : }
31754 0 : case 53: {
31755 0 : fun( w, self, "builtin_programs_must_consume_compute_units", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
31756 0 : break;
31757 0 : }
31758 0 : }
31759 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_instr_error_enum", level-- );
31760 0 : }
31761 0 : ulong fd_instr_error_enum_size( fd_instr_error_enum_t const * self ) {
31762 0 : ulong size = 0;
31763 0 : size += sizeof(uint);
31764 0 : switch (self->discriminant) {
31765 0 : case 25: {
31766 0 : size += sizeof(uint);
31767 0 : break;
31768 0 : }
31769 0 : case 44: {
31770 0 : size += sizeof(ulong) + strlen(self->inner.borsh_io_error);
31771 0 : break;
31772 0 : }
31773 0 : }
31774 0 : return size;
31775 0 : }
31776 :
31777 0 : int fd_instr_error_enum_inner_encode( fd_instr_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
31778 0 : int err;
31779 0 : switch (discriminant) {
31780 0 : case 25: {
31781 0 : err = fd_bincode_uint32_encode( self->custom, ctx );
31782 0 : if( FD_UNLIKELY( err ) ) return err;
31783 0 : break;
31784 0 : }
31785 0 : case 44: {
31786 0 : ulong slen = strlen( (char *) self->borsh_io_error );
31787 0 : err = fd_bincode_uint64_encode( slen, ctx );
31788 0 : if( FD_UNLIKELY( err ) ) return err;
31789 0 : err = fd_bincode_bytes_encode( (uchar *) self->borsh_io_error, slen, ctx );
31790 0 : if( FD_UNLIKELY( err ) ) return err;
31791 0 : break;
31792 0 : }
31793 0 : }
31794 0 : return FD_BINCODE_SUCCESS;
31795 0 : }
31796 0 : int fd_instr_error_enum_encode( fd_instr_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
31797 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
31798 0 : if( FD_UNLIKELY( err ) ) return err;
31799 0 : return fd_instr_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
31800 0 : }
31801 :
31802 0 : int fd_txn_instr_error_decode( fd_txn_instr_error_t * self, fd_bincode_decode_ctx_t * ctx ) {
31803 0 : void const * data = ctx->data;
31804 0 : int err = fd_txn_instr_error_decode_preflight( ctx );
31805 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31806 0 : ctx->data = data;
31807 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
31808 0 : fd_txn_instr_error_new( self );
31809 0 : }
31810 0 : fd_txn_instr_error_decode_unsafe( self, ctx );
31811 0 : return FD_BINCODE_SUCCESS;
31812 0 : }
31813 0 : int fd_txn_instr_error_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
31814 0 : int err;
31815 0 : err = fd_bincode_uint8_decode_preflight( ctx );
31816 0 : if( FD_UNLIKELY( err ) ) return err;
31817 0 : err = fd_instr_error_enum_decode_preflight( ctx );
31818 0 : if( FD_UNLIKELY( err ) ) return err;
31819 0 : return FD_BINCODE_SUCCESS;
31820 0 : }
31821 0 : void fd_txn_instr_error_decode_unsafe( fd_txn_instr_error_t * self, fd_bincode_decode_ctx_t * ctx ) {
31822 0 : fd_bincode_uint8_decode_unsafe( &self->instr_idx, ctx );
31823 0 : fd_instr_error_enum_decode_unsafe( &self->error, ctx );
31824 0 : }
31825 0 : int fd_txn_instr_error_encode( fd_txn_instr_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
31826 0 : int err;
31827 0 : err = fd_bincode_uint8_encode( (uchar)(self->instr_idx), ctx );
31828 0 : if( FD_UNLIKELY( err ) ) return err;
31829 0 : err = fd_instr_error_enum_encode( &self->error, ctx );
31830 0 : if( FD_UNLIKELY( err ) ) return err;
31831 0 : return FD_BINCODE_SUCCESS;
31832 0 : }
31833 0 : int fd_txn_instr_error_decode_offsets( fd_txn_instr_error_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
31834 0 : uchar const * data = ctx->data;
31835 0 : int err;
31836 0 : self->instr_idx_off = (uint)( (ulong)ctx->data - (ulong)data );
31837 0 : err = fd_bincode_uint8_decode_preflight( ctx );
31838 0 : if( FD_UNLIKELY( err ) ) return err;
31839 0 : self->error_off = (uint)( (ulong)ctx->data - (ulong)data );
31840 0 : err = fd_instr_error_enum_decode_preflight( ctx );
31841 0 : if( FD_UNLIKELY( err ) ) return err;
31842 0 : return FD_BINCODE_SUCCESS;
31843 0 : }
31844 0 : void fd_txn_instr_error_new(fd_txn_instr_error_t * self) {
31845 0 : fd_memset( self, 0, sizeof(fd_txn_instr_error_t) );
31846 0 : fd_instr_error_enum_new( &self->error );
31847 0 : }
31848 0 : void fd_txn_instr_error_destroy( fd_txn_instr_error_t * self, fd_bincode_destroy_ctx_t * ctx ) {
31849 0 : fd_instr_error_enum_destroy( &self->error, ctx );
31850 0 : }
31851 :
31852 0 : ulong fd_txn_instr_error_footprint( void ){ return FD_TXN_INSTR_ERROR_FOOTPRINT; }
31853 0 : ulong fd_txn_instr_error_align( void ){ return FD_TXN_INSTR_ERROR_ALIGN; }
31854 :
31855 0 : void fd_txn_instr_error_walk( void * w, fd_txn_instr_error_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
31856 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_txn_instr_error", level++ );
31857 0 : fun( w, &self->instr_idx, "instr_idx", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
31858 0 : fd_instr_error_enum_walk( w, &self->error, fun, "error", level );
31859 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_txn_instr_error", level-- );
31860 0 : }
31861 0 : ulong fd_txn_instr_error_size( fd_txn_instr_error_t const * self ) {
31862 0 : ulong size = 0;
31863 0 : size += sizeof(char);
31864 0 : size += fd_instr_error_enum_size( &self->error );
31865 0 : return size;
31866 0 : }
31867 :
31868 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_in_use(fd_txn_error_enum_t const * self) {
31869 0 : return self->discriminant == 0;
31870 0 : }
31871 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_loaded_twice(fd_txn_error_enum_t const * self) {
31872 0 : return self->discriminant == 1;
31873 0 : }
31874 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_not_found(fd_txn_error_enum_t const * self) {
31875 0 : return self->discriminant == 2;
31876 0 : }
31877 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_account_not_found(fd_txn_error_enum_t const * self) {
31878 0 : return self->discriminant == 3;
31879 0 : }
31880 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_fee(fd_txn_error_enum_t const * self) {
31881 0 : return self->discriminant == 4;
31882 0 : }
31883 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_for_fee(fd_txn_error_enum_t const * self) {
31884 0 : return self->discriminant == 5;
31885 0 : }
31886 0 : FD_FN_PURE uchar fd_txn_error_enum_is_already_processed(fd_txn_error_enum_t const * self) {
31887 0 : return self->discriminant == 6;
31888 0 : }
31889 0 : FD_FN_PURE uchar fd_txn_error_enum_is_blockhash_not_found(fd_txn_error_enum_t const * self) {
31890 0 : return self->discriminant == 7;
31891 0 : }
31892 0 : FD_FN_PURE uchar fd_txn_error_enum_is_instruction_error(fd_txn_error_enum_t const * self) {
31893 0 : return self->discriminant == 8;
31894 0 : }
31895 0 : FD_FN_PURE uchar fd_txn_error_enum_is_call_chain_too_deep(fd_txn_error_enum_t const * self) {
31896 0 : return self->discriminant == 9;
31897 0 : }
31898 0 : FD_FN_PURE uchar fd_txn_error_enum_is_missing_signature_for_fee(fd_txn_error_enum_t const * self) {
31899 0 : return self->discriminant == 10;
31900 0 : }
31901 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_index(fd_txn_error_enum_t const * self) {
31902 0 : return self->discriminant == 11;
31903 0 : }
31904 0 : FD_FN_PURE uchar fd_txn_error_enum_is_signature_failure(fd_txn_error_enum_t const * self) {
31905 0 : return self->discriminant == 12;
31906 0 : }
31907 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_program_for_execution(fd_txn_error_enum_t const * self) {
31908 0 : return self->discriminant == 13;
31909 0 : }
31910 0 : FD_FN_PURE uchar fd_txn_error_enum_is_sanitize_failure(fd_txn_error_enum_t const * self) {
31911 0 : return self->discriminant == 14;
31912 0 : }
31913 0 : FD_FN_PURE uchar fd_txn_error_enum_is_cluster_maintenance(fd_txn_error_enum_t const * self) {
31914 0 : return self->discriminant == 15;
31915 0 : }
31916 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_borrow_outstanding(fd_txn_error_enum_t const * self) {
31917 0 : return self->discriminant == 16;
31918 0 : }
31919 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_block_cost_limit(fd_txn_error_enum_t const * self) {
31920 0 : return self->discriminant == 17;
31921 0 : }
31922 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unsupported_version(fd_txn_error_enum_t const * self) {
31923 0 : return self->discriminant == 18;
31924 0 : }
31925 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_writable_account(fd_txn_error_enum_t const * self) {
31926 0 : return self->discriminant == 19;
31927 0 : }
31928 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_account_cost_limit(fd_txn_error_enum_t const * self) {
31929 0 : return self->discriminant == 20;
31930 0 : }
31931 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_block_limit(fd_txn_error_enum_t const * self) {
31932 0 : return self->discriminant == 21;
31933 0 : }
31934 0 : FD_FN_PURE uchar fd_txn_error_enum_is_too_many_account_locks(fd_txn_error_enum_t const * self) {
31935 0 : return self->discriminant == 22;
31936 0 : }
31937 0 : FD_FN_PURE uchar fd_txn_error_enum_is_address_lookup_table_not_found(fd_txn_error_enum_t const * self) {
31938 0 : return self->discriminant == 23;
31939 0 : }
31940 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_owner(fd_txn_error_enum_t const * self) {
31941 0 : return self->discriminant == 24;
31942 0 : }
31943 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_data(fd_txn_error_enum_t const * self) {
31944 0 : return self->discriminant == 25;
31945 0 : }
31946 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_index(fd_txn_error_enum_t const * self) {
31947 0 : return self->discriminant == 26;
31948 0 : }
31949 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_rent_paying_account(fd_txn_error_enum_t const * self) {
31950 0 : return self->discriminant == 27;
31951 0 : }
31952 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_vote_cost_limit(fd_txn_error_enum_t const * self) {
31953 0 : return self->discriminant == 28;
31954 0 : }
31955 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_total_limit(fd_txn_error_enum_t const * self) {
31956 0 : return self->discriminant == 29;
31957 0 : }
31958 0 : FD_FN_PURE uchar fd_txn_error_enum_is_duplicate_instruction(fd_txn_error_enum_t const * self) {
31959 0 : return self->discriminant == 30;
31960 0 : }
31961 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_rent(fd_txn_error_enum_t const * self) {
31962 0 : return self->discriminant == 31;
31963 0 : }
31964 0 : FD_FN_PURE uchar fd_txn_error_enum_is_max_loaded_accounts_data_size_exceeded(fd_txn_error_enum_t const * self) {
31965 0 : return self->discriminant == 32;
31966 0 : }
31967 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_loaded_accounts_data_size_limit(fd_txn_error_enum_t const * self) {
31968 0 : return self->discriminant == 33;
31969 0 : }
31970 0 : FD_FN_PURE uchar fd_txn_error_enum_is_resanitization_needed(fd_txn_error_enum_t const * self) {
31971 0 : return self->discriminant == 34;
31972 0 : }
31973 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_execution_temporarily_restricted(fd_txn_error_enum_t const * self) {
31974 0 : return self->discriminant == 35;
31975 0 : }
31976 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unbalanced_transaction(fd_txn_error_enum_t const * self) {
31977 0 : return self->discriminant == 36;
31978 0 : }
31979 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant );
31980 0 : int fd_txn_error_enum_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
31981 0 : int err;
31982 0 : switch (discriminant) {
31983 0 : case 0: {
31984 0 : return FD_BINCODE_SUCCESS;
31985 0 : }
31986 0 : case 1: {
31987 0 : return FD_BINCODE_SUCCESS;
31988 0 : }
31989 0 : case 2: {
31990 0 : return FD_BINCODE_SUCCESS;
31991 0 : }
31992 0 : case 3: {
31993 0 : return FD_BINCODE_SUCCESS;
31994 0 : }
31995 0 : case 4: {
31996 0 : return FD_BINCODE_SUCCESS;
31997 0 : }
31998 0 : case 5: {
31999 0 : return FD_BINCODE_SUCCESS;
32000 0 : }
32001 0 : case 6: {
32002 0 : return FD_BINCODE_SUCCESS;
32003 0 : }
32004 0 : case 7: {
32005 0 : return FD_BINCODE_SUCCESS;
32006 0 : }
32007 0 : case 8: {
32008 0 : err = fd_txn_instr_error_decode_preflight( ctx );
32009 0 : if( FD_UNLIKELY( err ) ) return err;
32010 0 : return FD_BINCODE_SUCCESS;
32011 0 : }
32012 0 : case 9: {
32013 0 : return FD_BINCODE_SUCCESS;
32014 0 : }
32015 0 : case 10: {
32016 0 : return FD_BINCODE_SUCCESS;
32017 0 : }
32018 0 : case 11: {
32019 0 : return FD_BINCODE_SUCCESS;
32020 0 : }
32021 0 : case 12: {
32022 0 : return FD_BINCODE_SUCCESS;
32023 0 : }
32024 0 : case 13: {
32025 0 : return FD_BINCODE_SUCCESS;
32026 0 : }
32027 0 : case 14: {
32028 0 : return FD_BINCODE_SUCCESS;
32029 0 : }
32030 0 : case 15: {
32031 0 : return FD_BINCODE_SUCCESS;
32032 0 : }
32033 0 : case 16: {
32034 0 : return FD_BINCODE_SUCCESS;
32035 0 : }
32036 0 : case 17: {
32037 0 : return FD_BINCODE_SUCCESS;
32038 0 : }
32039 0 : case 18: {
32040 0 : return FD_BINCODE_SUCCESS;
32041 0 : }
32042 0 : case 19: {
32043 0 : return FD_BINCODE_SUCCESS;
32044 0 : }
32045 0 : case 20: {
32046 0 : return FD_BINCODE_SUCCESS;
32047 0 : }
32048 0 : case 21: {
32049 0 : return FD_BINCODE_SUCCESS;
32050 0 : }
32051 0 : case 22: {
32052 0 : return FD_BINCODE_SUCCESS;
32053 0 : }
32054 0 : case 23: {
32055 0 : return FD_BINCODE_SUCCESS;
32056 0 : }
32057 0 : case 24: {
32058 0 : return FD_BINCODE_SUCCESS;
32059 0 : }
32060 0 : case 25: {
32061 0 : return FD_BINCODE_SUCCESS;
32062 0 : }
32063 0 : case 26: {
32064 0 : return FD_BINCODE_SUCCESS;
32065 0 : }
32066 0 : case 27: {
32067 0 : return FD_BINCODE_SUCCESS;
32068 0 : }
32069 0 : case 28: {
32070 0 : return FD_BINCODE_SUCCESS;
32071 0 : }
32072 0 : case 29: {
32073 0 : return FD_BINCODE_SUCCESS;
32074 0 : }
32075 0 : case 30: {
32076 0 : err = fd_bincode_uint8_decode_preflight( ctx );
32077 0 : if( FD_UNLIKELY( err ) ) return err;
32078 0 : return FD_BINCODE_SUCCESS;
32079 0 : }
32080 0 : case 31: {
32081 0 : err = fd_bincode_uint8_decode_preflight( ctx );
32082 0 : if( FD_UNLIKELY( err ) ) return err;
32083 0 : return FD_BINCODE_SUCCESS;
32084 0 : }
32085 0 : case 32: {
32086 0 : return FD_BINCODE_SUCCESS;
32087 0 : }
32088 0 : case 33: {
32089 0 : return FD_BINCODE_SUCCESS;
32090 0 : }
32091 0 : case 34: {
32092 0 : return FD_BINCODE_SUCCESS;
32093 0 : }
32094 0 : case 35: {
32095 0 : err = fd_bincode_uint8_decode_preflight( ctx );
32096 0 : if( FD_UNLIKELY( err ) ) return err;
32097 0 : return FD_BINCODE_SUCCESS;
32098 0 : }
32099 0 : case 36: {
32100 0 : return FD_BINCODE_SUCCESS;
32101 0 : }
32102 0 : default: return FD_BINCODE_ERR_ENCODING;
32103 0 : }
32104 0 : }
32105 0 : void fd_txn_error_enum_inner_decode_unsafe( fd_txn_error_enum_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
32106 0 : switch (discriminant) {
32107 0 : case 0: {
32108 0 : break;
32109 0 : }
32110 0 : case 1: {
32111 0 : break;
32112 0 : }
32113 0 : case 2: {
32114 0 : break;
32115 0 : }
32116 0 : case 3: {
32117 0 : break;
32118 0 : }
32119 0 : case 4: {
32120 0 : break;
32121 0 : }
32122 0 : case 5: {
32123 0 : break;
32124 0 : }
32125 0 : case 6: {
32126 0 : break;
32127 0 : }
32128 0 : case 7: {
32129 0 : break;
32130 0 : }
32131 0 : case 8: {
32132 0 : fd_txn_instr_error_decode_unsafe( &self->instruction_error, ctx );
32133 0 : break;
32134 0 : }
32135 0 : case 9: {
32136 0 : break;
32137 0 : }
32138 0 : case 10: {
32139 0 : break;
32140 0 : }
32141 0 : case 11: {
32142 0 : break;
32143 0 : }
32144 0 : case 12: {
32145 0 : break;
32146 0 : }
32147 0 : case 13: {
32148 0 : break;
32149 0 : }
32150 0 : case 14: {
32151 0 : break;
32152 0 : }
32153 0 : case 15: {
32154 0 : break;
32155 0 : }
32156 0 : case 16: {
32157 0 : break;
32158 0 : }
32159 0 : case 17: {
32160 0 : break;
32161 0 : }
32162 0 : case 18: {
32163 0 : break;
32164 0 : }
32165 0 : case 19: {
32166 0 : break;
32167 0 : }
32168 0 : case 20: {
32169 0 : break;
32170 0 : }
32171 0 : case 21: {
32172 0 : break;
32173 0 : }
32174 0 : case 22: {
32175 0 : break;
32176 0 : }
32177 0 : case 23: {
32178 0 : break;
32179 0 : }
32180 0 : case 24: {
32181 0 : break;
32182 0 : }
32183 0 : case 25: {
32184 0 : break;
32185 0 : }
32186 0 : case 26: {
32187 0 : break;
32188 0 : }
32189 0 : case 27: {
32190 0 : break;
32191 0 : }
32192 0 : case 28: {
32193 0 : break;
32194 0 : }
32195 0 : case 29: {
32196 0 : break;
32197 0 : }
32198 0 : case 30: {
32199 0 : fd_bincode_uint8_decode_unsafe( &self->duplicate_instruction, ctx );
32200 0 : break;
32201 0 : }
32202 0 : case 31: {
32203 0 : fd_bincode_uint8_decode_unsafe( &self->insufficient_funds_for_rent, ctx );
32204 0 : break;
32205 0 : }
32206 0 : case 32: {
32207 0 : break;
32208 0 : }
32209 0 : case 33: {
32210 0 : break;
32211 0 : }
32212 0 : case 34: {
32213 0 : break;
32214 0 : }
32215 0 : case 35: {
32216 0 : fd_bincode_uint8_decode_unsafe( &self->program_execution_temporarily_restricted, ctx );
32217 0 : break;
32218 0 : }
32219 0 : case 36: {
32220 0 : break;
32221 0 : }
32222 0 : }
32223 0 : }
32224 0 : int fd_txn_error_enum_decode( fd_txn_error_enum_t * self, fd_bincode_decode_ctx_t * ctx ) {
32225 0 : void const * data = ctx->data;
32226 0 : int err = fd_txn_error_enum_decode_preflight( ctx );
32227 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32228 0 : ctx->data = data;
32229 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
32230 0 : fd_txn_error_enum_new( self );
32231 0 : }
32232 0 : fd_txn_error_enum_decode_unsafe( self, ctx );
32233 0 : return FD_BINCODE_SUCCESS;
32234 0 : }
32235 0 : int fd_txn_error_enum_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
32236 0 : uint discriminant = 0;
32237 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
32238 0 : if( FD_UNLIKELY( err ) ) return err;
32239 0 : return fd_txn_error_enum_inner_decode_preflight( discriminant, ctx );
32240 0 : }
32241 0 : void fd_txn_error_enum_decode_unsafe( fd_txn_error_enum_t * self, fd_bincode_decode_ctx_t * ctx ) {
32242 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
32243 0 : fd_txn_error_enum_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
32244 0 : }
32245 0 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant ) {
32246 0 : switch( discriminant ) {
32247 0 : case 0: {
32248 0 : break;
32249 0 : }
32250 0 : case 1: {
32251 0 : break;
32252 0 : }
32253 0 : case 2: {
32254 0 : break;
32255 0 : }
32256 0 : case 3: {
32257 0 : break;
32258 0 : }
32259 0 : case 4: {
32260 0 : break;
32261 0 : }
32262 0 : case 5: {
32263 0 : break;
32264 0 : }
32265 0 : case 6: {
32266 0 : break;
32267 0 : }
32268 0 : case 7: {
32269 0 : break;
32270 0 : }
32271 0 : case 8: {
32272 0 : fd_txn_instr_error_new( &self->instruction_error );
32273 0 : break;
32274 0 : }
32275 0 : case 9: {
32276 0 : break;
32277 0 : }
32278 0 : case 10: {
32279 0 : break;
32280 0 : }
32281 0 : case 11: {
32282 0 : break;
32283 0 : }
32284 0 : case 12: {
32285 0 : break;
32286 0 : }
32287 0 : case 13: {
32288 0 : break;
32289 0 : }
32290 0 : case 14: {
32291 0 : break;
32292 0 : }
32293 0 : case 15: {
32294 0 : break;
32295 0 : }
32296 0 : case 16: {
32297 0 : break;
32298 0 : }
32299 0 : case 17: {
32300 0 : break;
32301 0 : }
32302 0 : case 18: {
32303 0 : break;
32304 0 : }
32305 0 : case 19: {
32306 0 : break;
32307 0 : }
32308 0 : case 20: {
32309 0 : break;
32310 0 : }
32311 0 : case 21: {
32312 0 : break;
32313 0 : }
32314 0 : case 22: {
32315 0 : break;
32316 0 : }
32317 0 : case 23: {
32318 0 : break;
32319 0 : }
32320 0 : case 24: {
32321 0 : break;
32322 0 : }
32323 0 : case 25: {
32324 0 : break;
32325 0 : }
32326 0 : case 26: {
32327 0 : break;
32328 0 : }
32329 0 : case 27: {
32330 0 : break;
32331 0 : }
32332 0 : case 28: {
32333 0 : break;
32334 0 : }
32335 0 : case 29: {
32336 0 : break;
32337 0 : }
32338 0 : case 30: {
32339 0 : break;
32340 0 : }
32341 0 : case 31: {
32342 0 : break;
32343 0 : }
32344 0 : case 32: {
32345 0 : break;
32346 0 : }
32347 0 : case 33: {
32348 0 : break;
32349 0 : }
32350 0 : case 34: {
32351 0 : break;
32352 0 : }
32353 0 : case 35: {
32354 0 : break;
32355 0 : }
32356 0 : case 36: {
32357 0 : break;
32358 0 : }
32359 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
32360 0 : }
32361 0 : }
32362 0 : void fd_txn_error_enum_new_disc( fd_txn_error_enum_t * self, uint discriminant ) {
32363 0 : self->discriminant = discriminant;
32364 0 : fd_txn_error_enum_inner_new( &self->inner, self->discriminant );
32365 0 : }
32366 0 : void fd_txn_error_enum_new( fd_txn_error_enum_t * self ) {
32367 0 : fd_memset( self, 0, sizeof(fd_txn_error_enum_t) );
32368 0 : fd_txn_error_enum_new_disc( self, UINT_MAX );
32369 0 : }
32370 0 : void fd_txn_error_enum_inner_destroy( fd_txn_error_enum_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
32371 0 : switch( discriminant ) {
32372 0 : case 8: {
32373 0 : fd_txn_instr_error_destroy( &self->instruction_error, ctx );
32374 0 : break;
32375 0 : }
32376 0 : case 30: {
32377 0 : break;
32378 0 : }
32379 0 : case 31: {
32380 0 : break;
32381 0 : }
32382 0 : case 35: {
32383 0 : break;
32384 0 : }
32385 0 : default: break; // FD_LOG_ERR(( "unhandled type" ));
32386 0 : }
32387 0 : }
32388 0 : void fd_txn_error_enum_destroy( fd_txn_error_enum_t * self, fd_bincode_destroy_ctx_t * ctx ) {
32389 0 : fd_txn_error_enum_inner_destroy( &self->inner, self->discriminant, ctx );
32390 0 : }
32391 :
32392 0 : ulong fd_txn_error_enum_footprint( void ){ return FD_TXN_ERROR_ENUM_FOOTPRINT; }
32393 0 : ulong fd_txn_error_enum_align( void ){ return FD_TXN_ERROR_ENUM_ALIGN; }
32394 :
32395 0 : void fd_txn_error_enum_walk( void * w, fd_txn_error_enum_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
32396 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_error_enum", level++);
32397 0 : switch( self->discriminant ) {
32398 0 : case 0: {
32399 0 : fun( w, self, "account_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32400 0 : break;
32401 0 : }
32402 0 : case 1: {
32403 0 : fun( w, self, "account_loaded_twice", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32404 0 : break;
32405 0 : }
32406 0 : case 2: {
32407 0 : fun( w, self, "account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32408 0 : break;
32409 0 : }
32410 0 : case 3: {
32411 0 : fun( w, self, "program_account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32412 0 : break;
32413 0 : }
32414 0 : case 4: {
32415 0 : fun( w, self, "insufficient_funds_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32416 0 : break;
32417 0 : }
32418 0 : case 5: {
32419 0 : fun( w, self, "invalid_account_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32420 0 : break;
32421 0 : }
32422 0 : case 6: {
32423 0 : fun( w, self, "already_processed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32424 0 : break;
32425 0 : }
32426 0 : case 7: {
32427 0 : fun( w, self, "blockhash_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32428 0 : break;
32429 0 : }
32430 0 : case 8: {
32431 0 : fun( w, self, "instruction_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32432 0 : fd_txn_instr_error_walk( w, &self->inner.instruction_error, fun, "instruction_error", level );
32433 0 : break;
32434 0 : }
32435 0 : case 9: {
32436 0 : fun( w, self, "call_chain_too_deep", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32437 0 : break;
32438 0 : }
32439 0 : case 10: {
32440 0 : fun( w, self, "missing_signature_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32441 0 : break;
32442 0 : }
32443 0 : case 11: {
32444 0 : fun( w, self, "invalid_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32445 0 : break;
32446 0 : }
32447 0 : case 12: {
32448 0 : fun( w, self, "signature_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32449 0 : break;
32450 0 : }
32451 0 : case 13: {
32452 0 : fun( w, self, "invalid_program_for_execution", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32453 0 : break;
32454 0 : }
32455 0 : case 14: {
32456 0 : fun( w, self, "sanitize_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32457 0 : break;
32458 0 : }
32459 0 : case 15: {
32460 0 : fun( w, self, "cluster_maintenance", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32461 0 : break;
32462 0 : }
32463 0 : case 16: {
32464 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32465 0 : break;
32466 0 : }
32467 0 : case 17: {
32468 0 : fun( w, self, "would_exceed_max_block_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32469 0 : break;
32470 0 : }
32471 0 : case 18: {
32472 0 : fun( w, self, "unsupported_version", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32473 0 : break;
32474 0 : }
32475 0 : case 19: {
32476 0 : fun( w, self, "invalid_writable_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32477 0 : break;
32478 0 : }
32479 0 : case 20: {
32480 0 : fun( w, self, "would_exceed_max_account_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32481 0 : break;
32482 0 : }
32483 0 : case 21: {
32484 0 : fun( w, self, "would_exceed_account_data_block_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32485 0 : break;
32486 0 : }
32487 0 : case 22: {
32488 0 : fun( w, self, "too_many_account_locks", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32489 0 : break;
32490 0 : }
32491 0 : case 23: {
32492 0 : fun( w, self, "address_lookup_table_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32493 0 : break;
32494 0 : }
32495 0 : case 24: {
32496 0 : fun( w, self, "invalid_address_lookup_table_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32497 0 : break;
32498 0 : }
32499 0 : case 25: {
32500 0 : fun( w, self, "invalid_address_lookup_table_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32501 0 : break;
32502 0 : }
32503 0 : case 26: {
32504 0 : fun( w, self, "invalid_address_lookup_table_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32505 0 : break;
32506 0 : }
32507 0 : case 27: {
32508 0 : fun( w, self, "invalid_rent_paying_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32509 0 : break;
32510 0 : }
32511 0 : case 28: {
32512 0 : fun( w, self, "would_exceed_max_vote_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32513 0 : break;
32514 0 : }
32515 0 : case 29: {
32516 0 : fun( w, self, "would_exceed_account_data_total_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32517 0 : break;
32518 0 : }
32519 0 : case 30: {
32520 0 : fun( w, self, "duplicate_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32521 0 : fun( w, &self->inner.duplicate_instruction, "duplicate_instruction", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
32522 0 : break;
32523 0 : }
32524 0 : case 31: {
32525 0 : fun( w, self, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32526 0 : fun( w, &self->inner.insufficient_funds_for_rent, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
32527 0 : break;
32528 0 : }
32529 0 : case 32: {
32530 0 : fun( w, self, "max_loaded_accounts_data_size_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32531 0 : break;
32532 0 : }
32533 0 : case 33: {
32534 0 : fun( w, self, "invalid_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32535 0 : break;
32536 0 : }
32537 0 : case 34: {
32538 0 : fun( w, self, "resanitization_needed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32539 0 : break;
32540 0 : }
32541 0 : case 35: {
32542 0 : fun( w, self, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32543 0 : fun( w, &self->inner.program_execution_temporarily_restricted, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
32544 0 : break;
32545 0 : }
32546 0 : case 36: {
32547 0 : fun( w, self, "unbalanced_transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32548 0 : break;
32549 0 : }
32550 0 : }
32551 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_error_enum", level-- );
32552 0 : }
32553 0 : ulong fd_txn_error_enum_size( fd_txn_error_enum_t const * self ) {
32554 0 : ulong size = 0;
32555 0 : size += sizeof(uint);
32556 0 : switch (self->discriminant) {
32557 0 : case 8: {
32558 0 : size += fd_txn_instr_error_size( &self->inner.instruction_error );
32559 0 : break;
32560 0 : }
32561 0 : case 30: {
32562 0 : size += sizeof(char);
32563 0 : break;
32564 0 : }
32565 0 : case 31: {
32566 0 : size += sizeof(char);
32567 0 : break;
32568 0 : }
32569 0 : case 35: {
32570 0 : size += sizeof(char);
32571 0 : break;
32572 0 : }
32573 0 : }
32574 0 : return size;
32575 0 : }
32576 :
32577 0 : int fd_txn_error_enum_inner_encode( fd_txn_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
32578 0 : int err;
32579 0 : switch (discriminant) {
32580 0 : case 8: {
32581 0 : err = fd_txn_instr_error_encode( &self->instruction_error, ctx );
32582 0 : if( FD_UNLIKELY( err ) ) return err;
32583 0 : break;
32584 0 : }
32585 0 : case 30: {
32586 0 : err = fd_bincode_uint8_encode( (uchar)(self->duplicate_instruction), ctx );
32587 0 : if( FD_UNLIKELY( err ) ) return err;
32588 0 : break;
32589 0 : }
32590 0 : case 31: {
32591 0 : err = fd_bincode_uint8_encode( (uchar)(self->insufficient_funds_for_rent), ctx );
32592 0 : if( FD_UNLIKELY( err ) ) return err;
32593 0 : break;
32594 0 : }
32595 0 : case 35: {
32596 0 : err = fd_bincode_uint8_encode( (uchar)(self->program_execution_temporarily_restricted), ctx );
32597 0 : if( FD_UNLIKELY( err ) ) return err;
32598 0 : break;
32599 0 : }
32600 0 : }
32601 0 : return FD_BINCODE_SUCCESS;
32602 0 : }
32603 0 : int fd_txn_error_enum_encode( fd_txn_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
32604 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
32605 0 : if( FD_UNLIKELY( err ) ) return err;
32606 0 : return fd_txn_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
32607 0 : }
32608 :
32609 0 : FD_FN_PURE uchar fd_txn_result_is_ok(fd_txn_result_t const * self) {
32610 0 : return self->discriminant == 0;
32611 0 : }
32612 0 : FD_FN_PURE uchar fd_txn_result_is_error(fd_txn_result_t const * self) {
32613 0 : return self->discriminant == 1;
32614 0 : }
32615 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant );
32616 3 : int fd_txn_result_inner_decode_preflight( uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
32617 3 : int err;
32618 3 : switch (discriminant) {
32619 3 : case 0: {
32620 3 : return FD_BINCODE_SUCCESS;
32621 0 : }
32622 0 : case 1: {
32623 0 : err = fd_txn_error_enum_decode_preflight( ctx );
32624 0 : if( FD_UNLIKELY( err ) ) return err;
32625 0 : return FD_BINCODE_SUCCESS;
32626 0 : }
32627 0 : default: return FD_BINCODE_ERR_ENCODING;
32628 3 : }
32629 3 : }
32630 3 : void fd_txn_result_inner_decode_unsafe( fd_txn_result_inner_t * self, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
32631 3 : switch (discriminant) {
32632 3 : case 0: {
32633 3 : break;
32634 0 : }
32635 0 : case 1: {
32636 0 : fd_txn_error_enum_decode_unsafe( &self->error, ctx );
32637 0 : break;
32638 0 : }
32639 3 : }
32640 3 : }
32641 0 : int fd_txn_result_decode( fd_txn_result_t * self, fd_bincode_decode_ctx_t * ctx ) {
32642 0 : void const * data = ctx->data;
32643 0 : int err = fd_txn_result_decode_preflight( ctx );
32644 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32645 0 : ctx->data = data;
32646 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
32647 0 : fd_txn_result_new( self );
32648 0 : }
32649 0 : fd_txn_result_decode_unsafe( self, ctx );
32650 0 : return FD_BINCODE_SUCCESS;
32651 0 : }
32652 3 : int fd_txn_result_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
32653 3 : uint discriminant = 0;
32654 3 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
32655 3 : if( FD_UNLIKELY( err ) ) return err;
32656 3 : return fd_txn_result_inner_decode_preflight( discriminant, ctx );
32657 3 : }
32658 3 : void fd_txn_result_decode_unsafe( fd_txn_result_t * self, fd_bincode_decode_ctx_t * ctx ) {
32659 3 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
32660 3 : fd_txn_result_inner_decode_unsafe( &self->inner, self->discriminant, ctx );
32661 3 : }
32662 3 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant ) {
32663 3 : switch( discriminant ) {
32664 0 : case 0: {
32665 0 : break;
32666 0 : }
32667 0 : case 1: {
32668 0 : fd_txn_error_enum_new( &self->error );
32669 0 : break;
32670 0 : }
32671 3 : default: break; // FD_LOG_ERR(( "unhandled type"));
32672 3 : }
32673 3 : }
32674 3 : void fd_txn_result_new_disc( fd_txn_result_t * self, uint discriminant ) {
32675 3 : self->discriminant = discriminant;
32676 3 : fd_txn_result_inner_new( &self->inner, self->discriminant );
32677 3 : }
32678 3 : void fd_txn_result_new( fd_txn_result_t * self ) {
32679 3 : fd_memset( self, 0, sizeof(fd_txn_result_t) );
32680 3 : fd_txn_result_new_disc( self, UINT_MAX );
32681 3 : }
32682 3 : void fd_txn_result_inner_destroy( fd_txn_result_inner_t * self, uint discriminant, fd_bincode_destroy_ctx_t * ctx ) {
32683 3 : switch( discriminant ) {
32684 0 : case 1: {
32685 0 : fd_txn_error_enum_destroy( &self->error, ctx );
32686 0 : break;
32687 0 : }
32688 3 : default: break; // FD_LOG_ERR(( "unhandled type" ));
32689 3 : }
32690 3 : }
32691 3 : void fd_txn_result_destroy( fd_txn_result_t * self, fd_bincode_destroy_ctx_t * ctx ) {
32692 3 : fd_txn_result_inner_destroy( &self->inner, self->discriminant, ctx );
32693 3 : }
32694 :
32695 0 : ulong fd_txn_result_footprint( void ){ return FD_TXN_RESULT_FOOTPRINT; }
32696 0 : ulong fd_txn_result_align( void ){ return FD_TXN_RESULT_ALIGN; }
32697 :
32698 0 : void fd_txn_result_walk( void * w, fd_txn_result_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
32699 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_result", level++);
32700 0 : switch( self->discriminant ) {
32701 0 : case 0: {
32702 0 : fun( w, self, "ok", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32703 0 : break;
32704 0 : }
32705 0 : case 1: {
32706 0 : fun( w, self, "error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level );
32707 0 : fd_txn_error_enum_walk( w, &self->inner.error, fun, "error", level );
32708 0 : break;
32709 0 : }
32710 0 : }
32711 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_result", level-- );
32712 0 : }
32713 3 : ulong fd_txn_result_size( fd_txn_result_t const * self ) {
32714 3 : ulong size = 0;
32715 3 : size += sizeof(uint);
32716 3 : switch (self->discriminant) {
32717 0 : case 1: {
32718 0 : size += fd_txn_error_enum_size( &self->inner.error );
32719 0 : break;
32720 0 : }
32721 3 : }
32722 3 : return size;
32723 3 : }
32724 :
32725 3 : int fd_txn_result_inner_encode( fd_txn_result_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
32726 3 : int err;
32727 3 : switch (discriminant) {
32728 0 : case 1: {
32729 0 : err = fd_txn_error_enum_encode( &self->error, ctx );
32730 0 : if( FD_UNLIKELY( err ) ) return err;
32731 0 : break;
32732 0 : }
32733 3 : }
32734 3 : return FD_BINCODE_SUCCESS;
32735 3 : }
32736 3 : int fd_txn_result_encode( fd_txn_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
32737 3 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
32738 3 : if( FD_UNLIKELY( err ) ) return err;
32739 3 : return fd_txn_result_inner_encode( &self->inner, self->discriminant, ctx );
32740 3 : }
32741 :
32742 0 : int fd_cache_status_decode( fd_cache_status_t * self, fd_bincode_decode_ctx_t * ctx ) {
32743 0 : void const * data = ctx->data;
32744 0 : int err = fd_cache_status_decode_preflight( ctx );
32745 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32746 0 : ctx->data = data;
32747 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
32748 0 : fd_cache_status_new( self );
32749 0 : }
32750 0 : fd_cache_status_decode_unsafe( self, ctx );
32751 0 : return FD_BINCODE_SUCCESS;
32752 0 : }
32753 3 : int fd_cache_status_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
32754 3 : int err;
32755 3 : err = fd_bincode_bytes_decode_preflight( 20, ctx );
32756 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32757 3 : err = fd_txn_result_decode_preflight( ctx );
32758 3 : if( FD_UNLIKELY( err ) ) return err;
32759 3 : return FD_BINCODE_SUCCESS;
32760 3 : }
32761 3 : void fd_cache_status_decode_unsafe( fd_cache_status_t * self, fd_bincode_decode_ctx_t * ctx ) {
32762 3 : fd_bincode_bytes_decode_unsafe( self->key_slice, 20, ctx );
32763 3 : fd_txn_result_decode_unsafe( &self->result, ctx );
32764 3 : }
32765 3 : int fd_cache_status_encode( fd_cache_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
32766 3 : int err;
32767 3 : err = fd_bincode_bytes_encode( self->key_slice, 20, ctx );
32768 3 : if( FD_UNLIKELY( err ) ) return err;
32769 3 : err = fd_txn_result_encode( &self->result, ctx );
32770 3 : if( FD_UNLIKELY( err ) ) return err;
32771 3 : return FD_BINCODE_SUCCESS;
32772 3 : }
32773 0 : int fd_cache_status_decode_offsets( fd_cache_status_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
32774 0 : uchar const * data = ctx->data;
32775 0 : int err;
32776 0 : self->key_slice_off = (uint)( (ulong)ctx->data - (ulong)data );
32777 0 : err = fd_bincode_bytes_decode_preflight( 20, ctx );
32778 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32779 0 : self->result_off = (uint)( (ulong)ctx->data - (ulong)data );
32780 0 : err = fd_txn_result_decode_preflight( ctx );
32781 0 : if( FD_UNLIKELY( err ) ) return err;
32782 0 : return FD_BINCODE_SUCCESS;
32783 0 : }
32784 3 : void fd_cache_status_new(fd_cache_status_t * self) {
32785 3 : fd_memset( self, 0, sizeof(fd_cache_status_t) );
32786 3 : fd_txn_result_new( &self->result );
32787 3 : }
32788 3 : void fd_cache_status_destroy( fd_cache_status_t * self, fd_bincode_destroy_ctx_t * ctx ) {
32789 3 : fd_txn_result_destroy( &self->result, ctx );
32790 3 : }
32791 :
32792 3 : ulong fd_cache_status_footprint( void ){ return FD_CACHE_STATUS_FOOTPRINT; }
32793 3 : ulong fd_cache_status_align( void ){ return FD_CACHE_STATUS_ALIGN; }
32794 :
32795 0 : void fd_cache_status_walk( void * w, fd_cache_status_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
32796 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cache_status", level++ );
32797 0 : fun(w, self->key_slice, "key_slice", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
32798 0 : fd_txn_result_walk( w, &self->result, fun, "result", level );
32799 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cache_status", level-- );
32800 0 : }
32801 3 : ulong fd_cache_status_size( fd_cache_status_t const * self ) {
32802 3 : ulong size = 0;
32803 3 : size += 20;
32804 3 : size += fd_txn_result_size( &self->result );
32805 3 : return size;
32806 3 : }
32807 :
32808 0 : int fd_status_value_decode( fd_status_value_t * self, fd_bincode_decode_ctx_t * ctx ) {
32809 0 : void const * data = ctx->data;
32810 0 : int err = fd_status_value_decode_preflight( ctx );
32811 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32812 0 : ctx->data = data;
32813 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
32814 0 : fd_status_value_new( self );
32815 0 : }
32816 0 : fd_status_value_decode_unsafe( self, ctx );
32817 0 : return FD_BINCODE_SUCCESS;
32818 0 : }
32819 3 : int fd_status_value_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
32820 3 : int err;
32821 3 : err = fd_bincode_uint64_decode_preflight( ctx );
32822 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32823 3 : ulong statuses_len;
32824 3 : err = fd_bincode_uint64_decode( &statuses_len, ctx );
32825 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32826 3 : if( statuses_len ) {
32827 6 : for( ulong i=0; i < statuses_len; i++ ) {
32828 3 : err = fd_cache_status_decode_preflight( ctx );
32829 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32830 3 : }
32831 3 : }
32832 3 : return FD_BINCODE_SUCCESS;
32833 3 : }
32834 3 : void fd_status_value_decode_unsafe( fd_status_value_t * self, fd_bincode_decode_ctx_t * ctx ) {
32835 3 : fd_bincode_uint64_decode_unsafe( &self->txn_idx, ctx );
32836 3 : fd_bincode_uint64_decode_unsafe( &self->statuses_len, ctx );
32837 3 : if( self->statuses_len ) {
32838 3 : self->statuses = (fd_cache_status_t *)fd_valloc_malloc( ctx->valloc, FD_CACHE_STATUS_ALIGN, FD_CACHE_STATUS_FOOTPRINT*self->statuses_len );
32839 6 : for( ulong i=0; i < self->statuses_len; i++ ) {
32840 3 : fd_cache_status_new( self->statuses + i );
32841 3 : fd_cache_status_decode_unsafe( self->statuses + i, ctx );
32842 3 : }
32843 3 : } else
32844 0 : self->statuses = NULL;
32845 3 : }
32846 3 : int fd_status_value_encode( fd_status_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
32847 3 : int err;
32848 3 : err = fd_bincode_uint64_encode( self->txn_idx, ctx );
32849 3 : if( FD_UNLIKELY( err ) ) return err;
32850 3 : err = fd_bincode_uint64_encode( self->statuses_len, ctx );
32851 3 : if( FD_UNLIKELY(err) ) return err;
32852 3 : if( self->statuses_len ) {
32853 6 : for( ulong i=0; i < self->statuses_len; i++ ) {
32854 3 : err = fd_cache_status_encode( self->statuses + i, ctx );
32855 3 : if( FD_UNLIKELY( err ) ) return err;
32856 3 : }
32857 3 : }
32858 3 : return FD_BINCODE_SUCCESS;
32859 3 : }
32860 0 : int fd_status_value_decode_offsets( fd_status_value_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
32861 0 : uchar const * data = ctx->data;
32862 0 : int err;
32863 0 : self->txn_idx_off = (uint)( (ulong)ctx->data - (ulong)data );
32864 0 : err = fd_bincode_uint64_decode_preflight( ctx );
32865 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32866 0 : self->statuses_off = (uint)( (ulong)ctx->data - (ulong)data );
32867 0 : ulong statuses_len;
32868 0 : err = fd_bincode_uint64_decode( &statuses_len, ctx );
32869 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32870 0 : if( statuses_len ) {
32871 0 : for( ulong i=0; i < statuses_len; i++ ) {
32872 0 : err = fd_cache_status_decode_preflight( ctx );
32873 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32874 0 : }
32875 0 : }
32876 0 : return FD_BINCODE_SUCCESS;
32877 0 : }
32878 3 : void fd_status_value_new(fd_status_value_t * self) {
32879 3 : fd_memset( self, 0, sizeof(fd_status_value_t) );
32880 3 : }
32881 3 : void fd_status_value_destroy( fd_status_value_t * self, fd_bincode_destroy_ctx_t * ctx ) {
32882 3 : if( self->statuses ) {
32883 6 : for( ulong i=0; i < self->statuses_len; i++ )
32884 3 : fd_cache_status_destroy( self->statuses + i, ctx );
32885 3 : fd_valloc_free( ctx->valloc, self->statuses );
32886 3 : self->statuses = NULL;
32887 3 : }
32888 3 : }
32889 :
32890 0 : ulong fd_status_value_footprint( void ){ return FD_STATUS_VALUE_FOOTPRINT; }
32891 0 : ulong fd_status_value_align( void ){ return FD_STATUS_VALUE_ALIGN; }
32892 :
32893 0 : void fd_status_value_walk( void * w, fd_status_value_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
32894 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_status_value", level++ );
32895 0 : fun( w, &self->txn_idx, "txn_idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
32896 0 : if( self->statuses_len ) {
32897 0 : fun( w, NULL, "statuses", FD_FLAMENCO_TYPE_ARR, "array", level++ );
32898 0 : for( ulong i=0; i < self->statuses_len; i++ )
32899 0 : fd_cache_status_walk(w, self->statuses + i, fun, "cache_status", level );
32900 0 : fun( w, NULL, "statuses", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
32901 0 : }
32902 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_status_value", level-- );
32903 0 : }
32904 3 : ulong fd_status_value_size( fd_status_value_t const * self ) {
32905 3 : ulong size = 0;
32906 3 : size += sizeof(ulong);
32907 3 : do {
32908 3 : size += sizeof(ulong);
32909 6 : for( ulong i=0; i < self->statuses_len; i++ )
32910 3 : size += fd_cache_status_size( self->statuses + i );
32911 3 : } while(0);
32912 3 : return size;
32913 3 : }
32914 :
32915 0 : int fd_status_pair_decode( fd_status_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
32916 0 : void const * data = ctx->data;
32917 0 : int err = fd_status_pair_decode_preflight( ctx );
32918 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32919 0 : ctx->data = data;
32920 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
32921 0 : fd_status_pair_new( self );
32922 0 : }
32923 0 : fd_status_pair_decode_unsafe( self, ctx );
32924 0 : return FD_BINCODE_SUCCESS;
32925 0 : }
32926 3 : int fd_status_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
32927 3 : int err;
32928 3 : err = fd_hash_decode_preflight( ctx );
32929 3 : if( FD_UNLIKELY( err ) ) return err;
32930 3 : err = fd_status_value_decode_preflight( ctx );
32931 3 : if( FD_UNLIKELY( err ) ) return err;
32932 3 : return FD_BINCODE_SUCCESS;
32933 3 : }
32934 3 : void fd_status_pair_decode_unsafe( fd_status_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
32935 3 : fd_hash_decode_unsafe( &self->hash, ctx );
32936 3 : fd_status_value_decode_unsafe( &self->value, ctx );
32937 3 : }
32938 3 : int fd_status_pair_encode( fd_status_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
32939 3 : int err;
32940 3 : err = fd_hash_encode( &self->hash, ctx );
32941 3 : if( FD_UNLIKELY( err ) ) return err;
32942 3 : err = fd_status_value_encode( &self->value, ctx );
32943 3 : if( FD_UNLIKELY( err ) ) return err;
32944 3 : return FD_BINCODE_SUCCESS;
32945 3 : }
32946 0 : int fd_status_pair_decode_offsets( fd_status_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
32947 0 : uchar const * data = ctx->data;
32948 0 : int err;
32949 0 : self->hash_off = (uint)( (ulong)ctx->data - (ulong)data );
32950 0 : err = fd_hash_decode_preflight( ctx );
32951 0 : if( FD_UNLIKELY( err ) ) return err;
32952 0 : self->value_off = (uint)( (ulong)ctx->data - (ulong)data );
32953 0 : err = fd_status_value_decode_preflight( ctx );
32954 0 : if( FD_UNLIKELY( err ) ) return err;
32955 0 : return FD_BINCODE_SUCCESS;
32956 0 : }
32957 3 : void fd_status_pair_new(fd_status_pair_t * self) {
32958 3 : fd_memset( self, 0, sizeof(fd_status_pair_t) );
32959 3 : fd_hash_new( &self->hash );
32960 3 : fd_status_value_new( &self->value );
32961 3 : }
32962 3 : void fd_status_pair_destroy( fd_status_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
32963 3 : fd_hash_destroy( &self->hash, ctx );
32964 3 : fd_status_value_destroy( &self->value, ctx );
32965 3 : }
32966 :
32967 3 : ulong fd_status_pair_footprint( void ){ return FD_STATUS_PAIR_FOOTPRINT; }
32968 3 : ulong fd_status_pair_align( void ){ return FD_STATUS_PAIR_ALIGN; }
32969 :
32970 0 : void fd_status_pair_walk( void * w, fd_status_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
32971 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_status_pair", level++ );
32972 0 : fd_hash_walk( w, &self->hash, fun, "hash", level );
32973 0 : fd_status_value_walk( w, &self->value, fun, "value", level );
32974 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_status_pair", level-- );
32975 0 : }
32976 3 : ulong fd_status_pair_size( fd_status_pair_t const * self ) {
32977 3 : ulong size = 0;
32978 3 : size += fd_hash_size( &self->hash );
32979 3 : size += fd_status_value_size( &self->value );
32980 3 : return size;
32981 3 : }
32982 :
32983 0 : int fd_slot_delta_decode( fd_slot_delta_t * self, fd_bincode_decode_ctx_t * ctx ) {
32984 0 : void const * data = ctx->data;
32985 0 : int err = fd_slot_delta_decode_preflight( ctx );
32986 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32987 0 : ctx->data = data;
32988 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
32989 0 : fd_slot_delta_new( self );
32990 0 : }
32991 0 : fd_slot_delta_decode_unsafe( self, ctx );
32992 0 : return FD_BINCODE_SUCCESS;
32993 0 : }
32994 6 : int fd_slot_delta_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
32995 6 : int err;
32996 6 : err = fd_bincode_uint64_decode_preflight( ctx );
32997 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
32998 6 : err = fd_bincode_bool_decode_preflight( ctx );
32999 6 : if( FD_UNLIKELY( err ) ) return err;
33000 3 : ulong slot_delta_vec_len;
33001 3 : err = fd_bincode_uint64_decode( &slot_delta_vec_len, ctx );
33002 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33003 3 : if( slot_delta_vec_len ) {
33004 6 : for( ulong i=0; i < slot_delta_vec_len; i++ ) {
33005 3 : err = fd_status_pair_decode_preflight( ctx );
33006 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33007 3 : }
33008 3 : }
33009 3 : return FD_BINCODE_SUCCESS;
33010 3 : }
33011 3 : void fd_slot_delta_decode_unsafe( fd_slot_delta_t * self, fd_bincode_decode_ctx_t * ctx ) {
33012 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
33013 3 : fd_bincode_bool_decode_unsafe( &self->is_root, ctx );
33014 3 : fd_bincode_uint64_decode_unsafe( &self->slot_delta_vec_len, ctx );
33015 3 : if( self->slot_delta_vec_len ) {
33016 3 : self->slot_delta_vec = (fd_status_pair_t *)fd_valloc_malloc( ctx->valloc, FD_STATUS_PAIR_ALIGN, FD_STATUS_PAIR_FOOTPRINT*self->slot_delta_vec_len );
33017 6 : for( ulong i=0; i < self->slot_delta_vec_len; i++ ) {
33018 3 : fd_status_pair_new( self->slot_delta_vec + i );
33019 3 : fd_status_pair_decode_unsafe( self->slot_delta_vec + i, ctx );
33020 3 : }
33021 3 : } else
33022 0 : self->slot_delta_vec = NULL;
33023 3 : }
33024 3 : int fd_slot_delta_encode( fd_slot_delta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
33025 3 : int err;
33026 3 : err = fd_bincode_uint64_encode( self->slot, ctx );
33027 3 : if( FD_UNLIKELY( err ) ) return err;
33028 3 : err = fd_bincode_bool_encode( (uchar)(self->is_root), ctx );
33029 3 : if( FD_UNLIKELY( err ) ) return err;
33030 3 : err = fd_bincode_uint64_encode( self->slot_delta_vec_len, ctx );
33031 3 : if( FD_UNLIKELY(err) ) return err;
33032 3 : if( self->slot_delta_vec_len ) {
33033 6 : for( ulong i=0; i < self->slot_delta_vec_len; i++ ) {
33034 3 : err = fd_status_pair_encode( self->slot_delta_vec + i, ctx );
33035 3 : if( FD_UNLIKELY( err ) ) return err;
33036 3 : }
33037 3 : }
33038 3 : return FD_BINCODE_SUCCESS;
33039 3 : }
33040 0 : int fd_slot_delta_decode_offsets( fd_slot_delta_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
33041 0 : uchar const * data = ctx->data;
33042 0 : int err;
33043 0 : self->slot_off = (uint)( (ulong)ctx->data - (ulong)data );
33044 0 : err = fd_bincode_uint64_decode_preflight( ctx );
33045 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33046 0 : self->is_root_off = (uint)( (ulong)ctx->data - (ulong)data );
33047 0 : err = fd_bincode_bool_decode_preflight( ctx );
33048 0 : if( FD_UNLIKELY( err ) ) return err;
33049 0 : self->slot_delta_vec_off = (uint)( (ulong)ctx->data - (ulong)data );
33050 0 : ulong slot_delta_vec_len;
33051 0 : err = fd_bincode_uint64_decode( &slot_delta_vec_len, ctx );
33052 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33053 0 : if( slot_delta_vec_len ) {
33054 0 : for( ulong i=0; i < slot_delta_vec_len; i++ ) {
33055 0 : err = fd_status_pair_decode_preflight( ctx );
33056 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33057 0 : }
33058 0 : }
33059 0 : return FD_BINCODE_SUCCESS;
33060 0 : }
33061 3 : void fd_slot_delta_new(fd_slot_delta_t * self) {
33062 3 : fd_memset( self, 0, sizeof(fd_slot_delta_t) );
33063 3 : }
33064 3 : void fd_slot_delta_destroy( fd_slot_delta_t * self, fd_bincode_destroy_ctx_t * ctx ) {
33065 3 : if( self->slot_delta_vec ) {
33066 6 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
33067 3 : fd_status_pair_destroy( self->slot_delta_vec + i, ctx );
33068 3 : fd_valloc_free( ctx->valloc, self->slot_delta_vec );
33069 3 : self->slot_delta_vec = NULL;
33070 3 : }
33071 3 : }
33072 :
33073 3 : ulong fd_slot_delta_footprint( void ){ return FD_SLOT_DELTA_FOOTPRINT; }
33074 3 : ulong fd_slot_delta_align( void ){ return FD_SLOT_DELTA_ALIGN; }
33075 :
33076 0 : void fd_slot_delta_walk( void * w, fd_slot_delta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
33077 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_delta", level++ );
33078 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
33079 0 : fun( w, &self->is_root, "is_root", FD_FLAMENCO_TYPE_BOOL, "bool", level );
33080 0 : if( self->slot_delta_vec_len ) {
33081 0 : fun( w, NULL, "slot_delta_vec", FD_FLAMENCO_TYPE_ARR, "array", level++ );
33082 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
33083 0 : fd_status_pair_walk(w, self->slot_delta_vec + i, fun, "status_pair", level );
33084 0 : fun( w, NULL, "slot_delta_vec", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
33085 0 : }
33086 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_delta", level-- );
33087 0 : }
33088 3 : ulong fd_slot_delta_size( fd_slot_delta_t const * self ) {
33089 3 : ulong size = 0;
33090 3 : size += sizeof(ulong);
33091 3 : size += sizeof(char);
33092 3 : do {
33093 3 : size += sizeof(ulong);
33094 6 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
33095 3 : size += fd_status_pair_size( self->slot_delta_vec + i );
33096 3 : } while(0);
33097 3 : return size;
33098 3 : }
33099 :
33100 6 : int fd_bank_slot_deltas_decode( fd_bank_slot_deltas_t * self, fd_bincode_decode_ctx_t * ctx ) {
33101 6 : void const * data = ctx->data;
33102 6 : int err = fd_bank_slot_deltas_decode_preflight( ctx );
33103 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33104 3 : ctx->data = data;
33105 3 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
33106 3 : fd_bank_slot_deltas_new( self );
33107 3 : }
33108 3 : fd_bank_slot_deltas_decode_unsafe( self, ctx );
33109 3 : return FD_BINCODE_SUCCESS;
33110 6 : }
33111 6 : int fd_bank_slot_deltas_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
33112 6 : int err;
33113 6 : ulong slot_deltas_len;
33114 6 : err = fd_bincode_uint64_decode( &slot_deltas_len, ctx );
33115 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33116 6 : if( slot_deltas_len ) {
33117 9 : for( ulong i=0; i < slot_deltas_len; i++ ) {
33118 6 : err = fd_slot_delta_decode_preflight( ctx );
33119 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33120 6 : }
33121 6 : }
33122 3 : return FD_BINCODE_SUCCESS;
33123 6 : }
33124 3 : void fd_bank_slot_deltas_decode_unsafe( fd_bank_slot_deltas_t * self, fd_bincode_decode_ctx_t * ctx ) {
33125 3 : fd_bincode_uint64_decode_unsafe( &self->slot_deltas_len, ctx );
33126 3 : if( self->slot_deltas_len ) {
33127 3 : self->slot_deltas = (fd_slot_delta_t *)fd_valloc_malloc( ctx->valloc, FD_SLOT_DELTA_ALIGN, FD_SLOT_DELTA_FOOTPRINT*self->slot_deltas_len );
33128 6 : for( ulong i=0; i < self->slot_deltas_len; i++ ) {
33129 3 : fd_slot_delta_new( self->slot_deltas + i );
33130 3 : fd_slot_delta_decode_unsafe( self->slot_deltas + i, ctx );
33131 3 : }
33132 3 : } else
33133 0 : self->slot_deltas = NULL;
33134 3 : }
33135 3 : int fd_bank_slot_deltas_encode( fd_bank_slot_deltas_t const * self, fd_bincode_encode_ctx_t * ctx ) {
33136 3 : int err;
33137 3 : err = fd_bincode_uint64_encode( self->slot_deltas_len, ctx );
33138 3 : if( FD_UNLIKELY(err) ) return err;
33139 3 : if( self->slot_deltas_len ) {
33140 6 : for( ulong i=0; i < self->slot_deltas_len; i++ ) {
33141 3 : err = fd_slot_delta_encode( self->slot_deltas + i, ctx );
33142 3 : if( FD_UNLIKELY( err ) ) return err;
33143 3 : }
33144 3 : }
33145 3 : return FD_BINCODE_SUCCESS;
33146 3 : }
33147 0 : int fd_bank_slot_deltas_decode_offsets( fd_bank_slot_deltas_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
33148 0 : uchar const * data = ctx->data;
33149 0 : int err;
33150 0 : self->slot_deltas_off = (uint)( (ulong)ctx->data - (ulong)data );
33151 0 : ulong slot_deltas_len;
33152 0 : err = fd_bincode_uint64_decode( &slot_deltas_len, ctx );
33153 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33154 0 : if( slot_deltas_len ) {
33155 0 : for( ulong i=0; i < slot_deltas_len; i++ ) {
33156 0 : err = fd_slot_delta_decode_preflight( ctx );
33157 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33158 0 : }
33159 0 : }
33160 0 : return FD_BINCODE_SUCCESS;
33161 0 : }
33162 3 : void fd_bank_slot_deltas_new(fd_bank_slot_deltas_t * self) {
33163 3 : fd_memset( self, 0, sizeof(fd_bank_slot_deltas_t) );
33164 3 : }
33165 3 : void fd_bank_slot_deltas_destroy( fd_bank_slot_deltas_t * self, fd_bincode_destroy_ctx_t * ctx ) {
33166 3 : if( self->slot_deltas ) {
33167 6 : for( ulong i=0; i < self->slot_deltas_len; i++ )
33168 3 : fd_slot_delta_destroy( self->slot_deltas + i, ctx );
33169 3 : fd_valloc_free( ctx->valloc, self->slot_deltas );
33170 3 : self->slot_deltas = NULL;
33171 3 : }
33172 3 : }
33173 :
33174 0 : ulong fd_bank_slot_deltas_footprint( void ){ return FD_BANK_SLOT_DELTAS_FOOTPRINT; }
33175 0 : ulong fd_bank_slot_deltas_align( void ){ return FD_BANK_SLOT_DELTAS_ALIGN; }
33176 :
33177 0 : void fd_bank_slot_deltas_walk( void * w, fd_bank_slot_deltas_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
33178 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_slot_deltas", level++ );
33179 0 : if( self->slot_deltas_len ) {
33180 0 : fun( w, NULL, "slot_deltas", FD_FLAMENCO_TYPE_ARR, "array", level++ );
33181 0 : for( ulong i=0; i < self->slot_deltas_len; i++ )
33182 0 : fd_slot_delta_walk(w, self->slot_deltas + i, fun, "slot_delta", level );
33183 0 : fun( w, NULL, "slot_deltas", FD_FLAMENCO_TYPE_ARR_END, "array", level-- );
33184 0 : }
33185 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_slot_deltas", level-- );
33186 0 : }
33187 3 : ulong fd_bank_slot_deltas_size( fd_bank_slot_deltas_t const * self ) {
33188 3 : ulong size = 0;
33189 3 : do {
33190 3 : size += sizeof(ulong);
33191 6 : for( ulong i=0; i < self->slot_deltas_len; i++ )
33192 3 : size += fd_slot_delta_size( self->slot_deltas + i );
33193 3 : } while(0);
33194 3 : return size;
33195 3 : }
33196 :
33197 0 : int fd_pubkey_rewardinfo_pair_decode( fd_pubkey_rewardinfo_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
33198 0 : void const * data = ctx->data;
33199 0 : int err = fd_pubkey_rewardinfo_pair_decode_preflight( ctx );
33200 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33201 0 : ctx->data = data;
33202 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
33203 0 : fd_pubkey_rewardinfo_pair_new( self );
33204 0 : }
33205 0 : fd_pubkey_rewardinfo_pair_decode_unsafe( self, ctx );
33206 0 : return FD_BINCODE_SUCCESS;
33207 0 : }
33208 0 : int fd_pubkey_rewardinfo_pair_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
33209 0 : int err;
33210 0 : err = fd_pubkey_decode_preflight( ctx );
33211 0 : if( FD_UNLIKELY( err ) ) return err;
33212 0 : err = fd_reward_info_decode_preflight( ctx );
33213 0 : if( FD_UNLIKELY( err ) ) return err;
33214 0 : return FD_BINCODE_SUCCESS;
33215 0 : }
33216 0 : void fd_pubkey_rewardinfo_pair_decode_unsafe( fd_pubkey_rewardinfo_pair_t * self, fd_bincode_decode_ctx_t * ctx ) {
33217 0 : fd_pubkey_decode_unsafe( &self->pubkey, ctx );
33218 0 : fd_reward_info_decode_unsafe( &self->reward_info, ctx );
33219 0 : }
33220 0 : int fd_pubkey_rewardinfo_pair_encode( fd_pubkey_rewardinfo_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
33221 0 : int err;
33222 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
33223 0 : if( FD_UNLIKELY( err ) ) return err;
33224 0 : err = fd_reward_info_encode( &self->reward_info, ctx );
33225 0 : if( FD_UNLIKELY( err ) ) return err;
33226 0 : return FD_BINCODE_SUCCESS;
33227 0 : }
33228 0 : int fd_pubkey_rewardinfo_pair_decode_offsets( fd_pubkey_rewardinfo_pair_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
33229 0 : uchar const * data = ctx->data;
33230 0 : int err;
33231 0 : self->pubkey_off = (uint)( (ulong)ctx->data - (ulong)data );
33232 0 : err = fd_pubkey_decode_preflight( ctx );
33233 0 : if( FD_UNLIKELY( err ) ) return err;
33234 0 : self->reward_info_off = (uint)( (ulong)ctx->data - (ulong)data );
33235 0 : err = fd_reward_info_decode_preflight( ctx );
33236 0 : if( FD_UNLIKELY( err ) ) return err;
33237 0 : return FD_BINCODE_SUCCESS;
33238 0 : }
33239 0 : void fd_pubkey_rewardinfo_pair_new(fd_pubkey_rewardinfo_pair_t * self) {
33240 0 : fd_memset( self, 0, sizeof(fd_pubkey_rewardinfo_pair_t) );
33241 0 : fd_pubkey_new( &self->pubkey );
33242 0 : fd_reward_info_new( &self->reward_info );
33243 0 : }
33244 0 : void fd_pubkey_rewardinfo_pair_destroy( fd_pubkey_rewardinfo_pair_t * self, fd_bincode_destroy_ctx_t * ctx ) {
33245 0 : fd_pubkey_destroy( &self->pubkey, ctx );
33246 0 : fd_reward_info_destroy( &self->reward_info, ctx );
33247 0 : }
33248 :
33249 0 : ulong fd_pubkey_rewardinfo_pair_footprint( void ){ return FD_PUBKEY_REWARDINFO_PAIR_FOOTPRINT; }
33250 0 : ulong fd_pubkey_rewardinfo_pair_align( void ){ return FD_PUBKEY_REWARDINFO_PAIR_ALIGN; }
33251 :
33252 0 : void fd_pubkey_rewardinfo_pair_walk( void * w, fd_pubkey_rewardinfo_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
33253 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_rewardinfo_pair", level++ );
33254 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level );
33255 0 : fd_reward_info_walk( w, &self->reward_info, fun, "reward_info", level );
33256 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_rewardinfo_pair", level-- );
33257 0 : }
33258 0 : ulong fd_pubkey_rewardinfo_pair_size( fd_pubkey_rewardinfo_pair_t const * self ) {
33259 0 : ulong size = 0;
33260 0 : size += fd_pubkey_size( &self->pubkey );
33261 0 : size += fd_reward_info_size( &self->reward_info );
33262 0 : return size;
33263 0 : }
33264 :
33265 0 : int fd_optional_account_decode( fd_optional_account_t * self, fd_bincode_decode_ctx_t * ctx ) {
33266 0 : void const * data = ctx->data;
33267 0 : int err = fd_optional_account_decode_preflight( ctx );
33268 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33269 0 : ctx->data = data;
33270 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
33271 0 : fd_optional_account_new( self );
33272 0 : }
33273 0 : fd_optional_account_decode_unsafe( self, ctx );
33274 0 : return FD_BINCODE_SUCCESS;
33275 0 : }
33276 0 : int fd_optional_account_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
33277 0 : int err;
33278 0 : {
33279 0 : uchar o;
33280 0 : err = fd_bincode_bool_decode( &o, ctx );
33281 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33282 0 : if( o ) {
33283 0 : err = fd_solana_account_decode_preflight( ctx );
33284 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33285 0 : }
33286 0 : }
33287 0 : return FD_BINCODE_SUCCESS;
33288 0 : }
33289 0 : void fd_optional_account_decode_unsafe( fd_optional_account_t * self, fd_bincode_decode_ctx_t * ctx ) {
33290 0 : {
33291 0 : uchar o;
33292 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
33293 0 : if( o ) {
33294 0 : self->account = (fd_solana_account_t *)fd_valloc_malloc( ctx->valloc, FD_SOLANA_ACCOUNT_ALIGN, FD_SOLANA_ACCOUNT_FOOTPRINT );
33295 0 : fd_solana_account_new( self->account );
33296 0 : fd_solana_account_decode_unsafe( self->account, ctx );
33297 0 : } else
33298 0 : self->account = NULL;
33299 0 : }
33300 0 : }
33301 0 : int fd_optional_account_encode( fd_optional_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
33302 0 : int err;
33303 0 : if( self->account != NULL ) {
33304 0 : err = fd_bincode_bool_encode( 1, ctx );
33305 0 : if( FD_UNLIKELY( err ) ) return err;
33306 0 : err = fd_solana_account_encode( self->account, ctx );
33307 0 : if( FD_UNLIKELY( err ) ) return err;
33308 0 : } else {
33309 0 : err = fd_bincode_bool_encode( 0, ctx );
33310 0 : if( FD_UNLIKELY( err ) ) return err;
33311 0 : }
33312 0 : return FD_BINCODE_SUCCESS;
33313 0 : }
33314 0 : int fd_optional_account_decode_offsets( fd_optional_account_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
33315 0 : uchar const * data = ctx->data;
33316 0 : int err;
33317 0 : self->account_off = (uint)( (ulong)ctx->data - (ulong)data );
33318 0 : {
33319 0 : uchar o;
33320 0 : err = fd_bincode_bool_decode( &o, ctx );
33321 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33322 0 : if( o ) {
33323 0 : err = fd_solana_account_decode_preflight( ctx );
33324 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33325 0 : }
33326 0 : }
33327 0 : return FD_BINCODE_SUCCESS;
33328 0 : }
33329 0 : void fd_optional_account_new(fd_optional_account_t * self) {
33330 0 : fd_memset( self, 0, sizeof(fd_optional_account_t) );
33331 0 : }
33332 0 : void fd_optional_account_destroy( fd_optional_account_t * self, fd_bincode_destroy_ctx_t * ctx ) {
33333 0 : if( self->account ) {
33334 0 : fd_solana_account_destroy( self->account, ctx );
33335 0 : fd_valloc_free( ctx->valloc, self->account );
33336 0 : self->account = NULL;
33337 0 : }
33338 0 : }
33339 :
33340 0 : ulong fd_optional_account_footprint( void ){ return FD_OPTIONAL_ACCOUNT_FOOTPRINT; }
33341 0 : ulong fd_optional_account_align( void ){ return FD_OPTIONAL_ACCOUNT_ALIGN; }
33342 :
33343 0 : void fd_optional_account_walk( void * w, fd_optional_account_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
33344 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_optional_account", level++ );
33345 0 : if( !self->account ) {
33346 0 : fun( w, NULL, "account", FD_FLAMENCO_TYPE_NULL, "solana_account", level );
33347 0 : } else {
33348 0 : fd_solana_account_walk( w, self->account, fun, "account", level );
33349 0 : }
33350 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_optional_account", level-- );
33351 0 : }
33352 0 : ulong fd_optional_account_size( fd_optional_account_t const * self ) {
33353 0 : ulong size = 0;
33354 0 : size += sizeof(char);
33355 0 : if( NULL != self->account ) {
33356 0 : size += fd_solana_account_size( self->account );
33357 0 : }
33358 0 : return size;
33359 0 : }
33360 :
33361 0 : int fd_calculated_stake_points_decode( fd_calculated_stake_points_t * self, fd_bincode_decode_ctx_t * ctx ) {
33362 0 : void const * data = ctx->data;
33363 0 : int err = fd_calculated_stake_points_decode_preflight( ctx );
33364 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33365 0 : ctx->data = data;
33366 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
33367 0 : fd_calculated_stake_points_new( self );
33368 0 : }
33369 0 : fd_calculated_stake_points_decode_unsafe( self, ctx );
33370 0 : return FD_BINCODE_SUCCESS;
33371 0 : }
33372 0 : int fd_calculated_stake_points_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
33373 0 : return fd_bincode_bytes_decode_preflight( 25, ctx );
33374 0 : }
33375 0 : void fd_calculated_stake_points_decode_unsafe( fd_calculated_stake_points_t * self, fd_bincode_decode_ctx_t * ctx ) {
33376 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
33377 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
33378 0 : fd_bincode_uint8_decode_unsafe( &self->force_credits_update_with_skipped_reward, ctx );
33379 0 : }
33380 0 : int fd_calculated_stake_points_encode( fd_calculated_stake_points_t const * self, fd_bincode_encode_ctx_t * ctx ) {
33381 0 : int err;
33382 0 : err = fd_bincode_uint128_encode( self->points, ctx );
33383 0 : if( FD_UNLIKELY( err ) ) return err;
33384 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
33385 0 : if( FD_UNLIKELY( err ) ) return err;
33386 0 : err = fd_bincode_uint8_encode( (uchar)(self->force_credits_update_with_skipped_reward), ctx );
33387 0 : if( FD_UNLIKELY( err ) ) return err;
33388 0 : return FD_BINCODE_SUCCESS;
33389 0 : }
33390 0 : int fd_calculated_stake_points_decode_offsets( fd_calculated_stake_points_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
33391 0 : uchar const * data = ctx->data;
33392 0 : int err;
33393 0 : self->points_off = (uint)( (ulong)ctx->data - (ulong)data );
33394 0 : err = fd_bincode_uint128_decode_preflight( ctx );
33395 0 : if( FD_UNLIKELY( err ) ) return err;
33396 0 : self->new_credits_observed_off = (uint)( (ulong)ctx->data - (ulong)data );
33397 0 : err = fd_bincode_uint64_decode_preflight( ctx );
33398 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33399 0 : self->force_credits_update_with_skipped_reward_off = (uint)( (ulong)ctx->data - (ulong)data );
33400 0 : err = fd_bincode_uint8_decode_preflight( ctx );
33401 0 : if( FD_UNLIKELY( err ) ) return err;
33402 0 : return FD_BINCODE_SUCCESS;
33403 0 : }
33404 0 : void fd_calculated_stake_points_new(fd_calculated_stake_points_t * self) {
33405 0 : fd_memset( self, 0, sizeof(fd_calculated_stake_points_t) );
33406 0 : }
33407 0 : void fd_calculated_stake_points_destroy( fd_calculated_stake_points_t * self, fd_bincode_destroy_ctx_t * ctx ) {
33408 0 : }
33409 :
33410 0 : ulong fd_calculated_stake_points_footprint( void ){ return FD_CALCULATED_STAKE_POINTS_FOOTPRINT; }
33411 0 : ulong fd_calculated_stake_points_align( void ){ return FD_CALCULATED_STAKE_POINTS_ALIGN; }
33412 :
33413 0 : void fd_calculated_stake_points_walk( void * w, fd_calculated_stake_points_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
33414 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_points", level++ );
33415 0 : fun( w, &self->points, "points", FD_FLAMENCO_TYPE_UINT128, "uint128", level );
33416 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
33417 0 : fun( w, &self->force_credits_update_with_skipped_reward, "force_credits_update_with_skipped_reward", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
33418 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_points", level-- );
33419 0 : }
33420 0 : ulong fd_calculated_stake_points_size( fd_calculated_stake_points_t const * self ) {
33421 0 : ulong size = 0;
33422 0 : size += sizeof(uint128);
33423 0 : size += sizeof(ulong);
33424 0 : size += sizeof(char);
33425 0 : return size;
33426 0 : }
33427 :
33428 0 : int fd_calculated_stake_rewards_decode( fd_calculated_stake_rewards_t * self, fd_bincode_decode_ctx_t * ctx ) {
33429 0 : void const * data = ctx->data;
33430 0 : int err = fd_calculated_stake_rewards_decode_preflight( ctx );
33431 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33432 0 : ctx->data = data;
33433 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
33434 0 : fd_calculated_stake_rewards_new( self );
33435 0 : }
33436 0 : fd_calculated_stake_rewards_decode_unsafe( self, ctx );
33437 0 : return FD_BINCODE_SUCCESS;
33438 0 : }
33439 0 : int fd_calculated_stake_rewards_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
33440 0 : return fd_bincode_bytes_decode_preflight( 24, ctx );
33441 0 : }
33442 0 : void fd_calculated_stake_rewards_decode_unsafe( fd_calculated_stake_rewards_t * self, fd_bincode_decode_ctx_t * ctx ) {
33443 0 : fd_bincode_uint64_decode_unsafe( &self->staker_rewards, ctx );
33444 0 : fd_bincode_uint64_decode_unsafe( &self->voter_rewards, ctx );
33445 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
33446 0 : }
33447 0 : int fd_calculated_stake_rewards_encode( fd_calculated_stake_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
33448 0 : int err;
33449 0 : err = fd_bincode_uint64_encode( self->staker_rewards, ctx );
33450 0 : if( FD_UNLIKELY( err ) ) return err;
33451 0 : err = fd_bincode_uint64_encode( self->voter_rewards, ctx );
33452 0 : if( FD_UNLIKELY( err ) ) return err;
33453 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
33454 0 : if( FD_UNLIKELY( err ) ) return err;
33455 0 : return FD_BINCODE_SUCCESS;
33456 0 : }
33457 0 : int fd_calculated_stake_rewards_decode_offsets( fd_calculated_stake_rewards_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
33458 0 : uchar const * data = ctx->data;
33459 0 : int err;
33460 0 : self->staker_rewards_off = (uint)( (ulong)ctx->data - (ulong)data );
33461 0 : err = fd_bincode_uint64_decode_preflight( ctx );
33462 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33463 0 : self->voter_rewards_off = (uint)( (ulong)ctx->data - (ulong)data );
33464 0 : err = fd_bincode_uint64_decode_preflight( ctx );
33465 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33466 0 : self->new_credits_observed_off = (uint)( (ulong)ctx->data - (ulong)data );
33467 0 : err = fd_bincode_uint64_decode_preflight( ctx );
33468 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33469 0 : return FD_BINCODE_SUCCESS;
33470 0 : }
33471 0 : void fd_calculated_stake_rewards_new(fd_calculated_stake_rewards_t * self) {
33472 0 : fd_memset( self, 0, sizeof(fd_calculated_stake_rewards_t) );
33473 0 : }
33474 0 : void fd_calculated_stake_rewards_destroy( fd_calculated_stake_rewards_t * self, fd_bincode_destroy_ctx_t * ctx ) {
33475 0 : }
33476 :
33477 0 : ulong fd_calculated_stake_rewards_footprint( void ){ return FD_CALCULATED_STAKE_REWARDS_FOOTPRINT; }
33478 0 : ulong fd_calculated_stake_rewards_align( void ){ return FD_CALCULATED_STAKE_REWARDS_ALIGN; }
33479 :
33480 0 : void fd_calculated_stake_rewards_walk( void * w, fd_calculated_stake_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
33481 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_rewards", level++ );
33482 0 : fun( w, &self->staker_rewards, "staker_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
33483 0 : fun( w, &self->voter_rewards, "voter_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
33484 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level );
33485 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_rewards", level-- );
33486 0 : }
33487 0 : ulong fd_calculated_stake_rewards_size( fd_calculated_stake_rewards_t const * self ) {
33488 0 : ulong size = 0;
33489 0 : size += sizeof(ulong);
33490 0 : size += sizeof(ulong);
33491 0 : size += sizeof(ulong);
33492 0 : return size;
33493 0 : }
33494 :
33495 0 : int fd_duplicate_slot_proof_decode( fd_duplicate_slot_proof_t * self, fd_bincode_decode_ctx_t * ctx ) {
33496 0 : void const * data = ctx->data;
33497 0 : int err = fd_duplicate_slot_proof_decode_preflight( ctx );
33498 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33499 0 : ctx->data = data;
33500 0 : if( !fd_is_null_alloc_virtual( ctx->valloc ) ) {
33501 0 : fd_duplicate_slot_proof_new( self );
33502 0 : }
33503 0 : fd_duplicate_slot_proof_decode_unsafe( self, ctx );
33504 0 : return FD_BINCODE_SUCCESS;
33505 0 : }
33506 0 : int fd_duplicate_slot_proof_decode_preflight( fd_bincode_decode_ctx_t * ctx ) {
33507 0 : int err;
33508 0 : ulong shred1_len;
33509 0 : err = fd_bincode_uint64_decode( &shred1_len, ctx );
33510 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33511 0 : if( shred1_len ) {
33512 0 : err = fd_bincode_bytes_decode_preflight( shred1_len, ctx );
33513 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33514 0 : }
33515 0 : ulong shred2_len;
33516 0 : err = fd_bincode_uint64_decode( &shred2_len, ctx );
33517 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33518 0 : if( shred2_len ) {
33519 0 : err = fd_bincode_bytes_decode_preflight( shred2_len, ctx );
33520 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33521 0 : }
33522 0 : return FD_BINCODE_SUCCESS;
33523 0 : }
33524 0 : void fd_duplicate_slot_proof_decode_unsafe( fd_duplicate_slot_proof_t * self, fd_bincode_decode_ctx_t * ctx ) {
33525 0 : fd_bincode_uint64_decode_unsafe( &self->shred1_len, ctx );
33526 0 : if( self->shred1_len ) {
33527 0 : self->shred1 = fd_valloc_malloc( ctx->valloc, 8UL, self->shred1_len );
33528 0 : fd_bincode_bytes_decode_unsafe( self->shred1, self->shred1_len, ctx );
33529 0 : } else
33530 0 : self->shred1 = NULL;
33531 0 : fd_bincode_uint64_decode_unsafe( &self->shred2_len, ctx );
33532 0 : if( self->shred2_len ) {
33533 0 : self->shred2 = fd_valloc_malloc( ctx->valloc, 8UL, self->shred2_len );
33534 0 : fd_bincode_bytes_decode_unsafe( self->shred2, self->shred2_len, ctx );
33535 0 : } else
33536 0 : self->shred2 = NULL;
33537 0 : }
33538 0 : int fd_duplicate_slot_proof_encode( fd_duplicate_slot_proof_t const * self, fd_bincode_encode_ctx_t * ctx ) {
33539 0 : int err;
33540 0 : err = fd_bincode_uint64_encode( self->shred1_len, ctx );
33541 0 : if( FD_UNLIKELY(err) ) return err;
33542 0 : if( self->shred1_len ) {
33543 0 : err = fd_bincode_bytes_encode( self->shred1, self->shred1_len, ctx );
33544 0 : if( FD_UNLIKELY( err ) ) return err;
33545 0 : }
33546 0 : err = fd_bincode_uint64_encode( self->shred2_len, ctx );
33547 0 : if( FD_UNLIKELY(err) ) return err;
33548 0 : if( self->shred2_len ) {
33549 0 : err = fd_bincode_bytes_encode( self->shred2, self->shred2_len, ctx );
33550 0 : if( FD_UNLIKELY( err ) ) return err;
33551 0 : }
33552 0 : return FD_BINCODE_SUCCESS;
33553 0 : }
33554 0 : int fd_duplicate_slot_proof_decode_offsets( fd_duplicate_slot_proof_off_t * self, fd_bincode_decode_ctx_t * ctx ) {
33555 0 : uchar const * data = ctx->data;
33556 0 : int err;
33557 0 : self->shred1_off = (uint)( (ulong)ctx->data - (ulong)data );
33558 0 : ulong shred1_len;
33559 0 : err = fd_bincode_uint64_decode( &shred1_len, ctx );
33560 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33561 0 : if( shred1_len ) {
33562 0 : err = fd_bincode_bytes_decode_preflight( shred1_len, ctx );
33563 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33564 0 : }
33565 0 : self->shred2_off = (uint)( (ulong)ctx->data - (ulong)data );
33566 0 : ulong shred2_len;
33567 0 : err = fd_bincode_uint64_decode( &shred2_len, ctx );
33568 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33569 0 : if( shred2_len ) {
33570 0 : err = fd_bincode_bytes_decode_preflight( shred2_len, ctx );
33571 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
33572 0 : }
33573 0 : return FD_BINCODE_SUCCESS;
33574 0 : }
33575 0 : void fd_duplicate_slot_proof_new(fd_duplicate_slot_proof_t * self) {
33576 0 : fd_memset( self, 0, sizeof(fd_duplicate_slot_proof_t) );
33577 0 : }
33578 0 : void fd_duplicate_slot_proof_destroy( fd_duplicate_slot_proof_t * self, fd_bincode_destroy_ctx_t * ctx ) {
33579 0 : if( self->shred1 ) {
33580 0 : fd_valloc_free( ctx->valloc, self->shred1 );
33581 0 : self->shred1 = NULL;
33582 0 : }
33583 0 : if( self->shred2 ) {
33584 0 : fd_valloc_free( ctx->valloc, self->shred2 );
33585 0 : self->shred2 = NULL;
33586 0 : }
33587 0 : }
33588 :
33589 0 : ulong fd_duplicate_slot_proof_footprint( void ){ return FD_DUPLICATE_SLOT_PROOF_FOOTPRINT; }
33590 0 : ulong fd_duplicate_slot_proof_align( void ){ return FD_DUPLICATE_SLOT_PROOF_ALIGN; }
33591 :
33592 0 : void fd_duplicate_slot_proof_walk( void * w, fd_duplicate_slot_proof_t const * self, fd_types_walk_fn_t fun, const char *name, uint level ) {
33593 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_duplicate_slot_proof", level++ );
33594 0 : fun(w, self->shred1, "shred1", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
33595 0 : fun(w, self->shred2, "shred2", FD_FLAMENCO_TYPE_UCHAR, "uchar", level );
33596 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_duplicate_slot_proof", level-- );
33597 0 : }
33598 0 : ulong fd_duplicate_slot_proof_size( fd_duplicate_slot_proof_t const * self ) {
33599 0 : ulong size = 0;
33600 0 : do {
33601 0 : size += sizeof(ulong);
33602 0 : size += self->shred1_len;
33603 0 : } while(0);
33604 0 : do {
33605 0 : size += sizeof(ulong);
33606 0 : size += self->shred2_len;
33607 0 : } while(0);
33608 0 : return size;
33609 0 : }
33610 :
33611 6899421 : #define REDBLK_T fd_hash_hash_age_pair_t_mapnode_t
33612 : #define REDBLK_NAME fd_hash_hash_age_pair_t_map
33613 : #define REDBLK_IMPL_STYLE 2
33614 : #include "../../util/tmpl/fd_redblack.c"
33615 6277389 : long fd_hash_hash_age_pair_t_map_compare( fd_hash_hash_age_pair_t_mapnode_t * left, fd_hash_hash_age_pair_t_mapnode_t * right ) {
33616 6277389 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
33617 6277389 : }
33618 0 : #define REDBLK_T fd_vote_accounts_pair_serializable_t_mapnode_t
33619 : #define REDBLK_NAME fd_vote_accounts_pair_serializable_t_map
33620 : #define REDBLK_IMPL_STYLE 2
33621 : #include "../../util/tmpl/fd_redblack.c"
33622 0 : long fd_vote_accounts_pair_serializable_t_map_compare( fd_vote_accounts_pair_serializable_t_mapnode_t * left, fd_vote_accounts_pair_serializable_t_mapnode_t * right ) {
33623 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
33624 0 : }
33625 4078620 : #define REDBLK_T fd_vote_accounts_pair_t_mapnode_t
33626 : #define REDBLK_NAME fd_vote_accounts_pair_t_map
33627 : #define REDBLK_IMPL_STYLE 2
33628 : #include "../../util/tmpl/fd_redblack.c"
33629 0 : long fd_vote_accounts_pair_t_map_compare( fd_vote_accounts_pair_t_mapnode_t * left, fd_vote_accounts_pair_t_mapnode_t * right ) {
33630 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
33631 0 : }
33632 0 : #define REDBLK_T fd_stake_accounts_pair_t_mapnode_t
33633 : #define REDBLK_NAME fd_stake_accounts_pair_t_map
33634 : #define REDBLK_IMPL_STYLE 2
33635 : #include "../../util/tmpl/fd_redblack.c"
33636 0 : long fd_stake_accounts_pair_t_map_compare( fd_stake_accounts_pair_t_mapnode_t * left, fd_stake_accounts_pair_t_mapnode_t * right ) {
33637 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
33638 0 : }
33639 0 : #define REDBLK_T fd_stake_weight_t_mapnode_t
33640 : #define REDBLK_NAME fd_stake_weight_t_map
33641 : #define REDBLK_IMPL_STYLE 2
33642 : #include "../../util/tmpl/fd_redblack.c"
33643 0 : long fd_stake_weight_t_map_compare( fd_stake_weight_t_mapnode_t * left, fd_stake_weight_t_mapnode_t * right ) {
33644 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
33645 0 : }
33646 2039325 : #define REDBLK_T fd_delegation_pair_t_mapnode_t
33647 : #define REDBLK_NAME fd_delegation_pair_t_map
33648 : #define REDBLK_IMPL_STYLE 2
33649 : #include "../../util/tmpl/fd_redblack.c"
33650 0 : long fd_delegation_pair_t_map_compare( fd_delegation_pair_t_mapnode_t * left, fd_delegation_pair_t_mapnode_t * right ) {
33651 0 : return memcmp( left->elem.account.uc, right->elem.account.uc, sizeof(right->elem.account) );
33652 0 : }
33653 0 : #define REDBLK_T fd_stake_pair_t_mapnode_t
33654 : #define REDBLK_NAME fd_stake_pair_t_map
33655 : #define REDBLK_IMPL_STYLE 2
33656 : #include "../../util/tmpl/fd_redblack.c"
33657 0 : long fd_stake_pair_t_map_compare( fd_stake_pair_t_mapnode_t * left, fd_stake_pair_t_mapnode_t * right ) {
33658 0 : return memcmp( left->elem.account.uc, right->elem.account.uc, sizeof(right->elem.account) );
33659 0 : }
33660 0 : #define REDBLK_T fd_clock_timestamp_vote_t_mapnode_t
33661 : #define REDBLK_NAME fd_clock_timestamp_vote_t_map
33662 : #define REDBLK_IMPL_STYLE 2
33663 : #include "../../util/tmpl/fd_redblack.c"
33664 0 : long fd_clock_timestamp_vote_t_map_compare( fd_clock_timestamp_vote_t_mapnode_t * left, fd_clock_timestamp_vote_t_mapnode_t * right ) {
33665 0 : return memcmp( left->elem.pubkey.uc, right->elem.pubkey.uc, sizeof(right->elem.pubkey) );
33666 0 : }
|