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 : #pragma GCC diagnostic ignored "-Wunused-function"
6 : #if defined(__GNUC__) && (__GNUC__ >= 9)
7 : #pragma GCC diagnostic ignored "-Waddress-of-packed-member"
8 : #endif
9 : #define SOURCE_fd_src_flamenco_types_fd_types_c
10 : #include "fd_types_custom.h"
11 966 : int fd_hash_encode( fd_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12 966 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_hash_t), ctx );
13 966 : }
14 279 : void fd_hash_walk( void * w, fd_hash_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
15 279 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_HASH256, name, level, varint );
16 279 : }
17 69 : static int fd_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18 69 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19 69 : return fd_bincode_bytes_decode_footprint( sizeof(fd_hash_t), ctx );
20 69 : }
21 0 : int fd_hash_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22 0 : *total_sz += sizeof(fd_hash_t);
23 0 : void const * start_data = ctx->data;
24 0 : int err = fd_hash_decode_footprint_inner( ctx, total_sz );
25 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
26 0 : ctx->data = start_data;
27 0 : return err;
28 0 : }
29 489 : static void fd_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30 489 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_hash_t), ctx );
31 489 : return;
32 489 : }
33 0 : void * fd_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
34 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_hash_t), ctx );
35 0 : return mem;
36 0 : }
37 :
38 0 : int fd_signature_encode( fd_signature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
39 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_signature_t), ctx );
40 0 : }
41 39 : void fd_signature_walk( void * w, fd_signature_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
42 39 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_SIG512, name, level, varint );
43 39 : }
44 30 : static int fd_signature_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
45 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
46 30 : return fd_bincode_bytes_decode_footprint( sizeof(fd_signature_t), ctx );
47 30 : }
48 0 : int fd_signature_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
49 0 : *total_sz += sizeof(fd_signature_t);
50 0 : void const * start_data = ctx->data;
51 0 : int err = fd_signature_decode_footprint_inner( ctx, total_sz );
52 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
53 0 : ctx->data = start_data;
54 0 : return err;
55 0 : }
56 39 : static void fd_signature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
57 39 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_signature_t), ctx );
58 39 : return;
59 39 : }
60 0 : void * fd_signature_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
61 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_signature_t), ctx );
62 0 : return mem;
63 0 : }
64 :
65 0 : int fd_gossip_ip4_addr_encode( fd_gossip_ip4_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
66 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_gossip_ip4_addr_t), ctx );
67 0 : }
68 93 : static int fd_gossip_ip4_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
69 93 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
70 93 : return fd_bincode_bytes_decode_footprint( sizeof(fd_gossip_ip4_addr_t), ctx );
71 93 : }
72 0 : int fd_gossip_ip4_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
73 0 : *total_sz += sizeof(fd_gossip_ip4_addr_t);
74 0 : void const * start_data = ctx->data;
75 0 : int err = fd_gossip_ip4_addr_decode_footprint_inner( ctx, total_sz );
76 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
77 0 : ctx->data = start_data;
78 0 : return err;
79 0 : }
80 93 : static void fd_gossip_ip4_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
81 93 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_gossip_ip4_addr_t), ctx );
82 93 : return;
83 93 : }
84 0 : void * fd_gossip_ip4_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
85 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_gossip_ip4_addr_t), ctx );
86 0 : return mem;
87 0 : }
88 :
89 0 : int fd_gossip_ip6_addr_encode( fd_gossip_ip6_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
90 0 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_gossip_ip6_addr_t), ctx );
91 0 : }
92 0 : static int fd_gossip_ip6_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
93 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
94 0 : return fd_bincode_bytes_decode_footprint( sizeof(fd_gossip_ip6_addr_t), ctx );
95 0 : }
96 0 : int fd_gossip_ip6_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
97 0 : *total_sz += sizeof(fd_gossip_ip6_addr_t);
98 0 : void const * start_data = ctx->data;
99 0 : int err = fd_gossip_ip6_addr_decode_footprint_inner( ctx, total_sz );
100 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
101 0 : ctx->data = start_data;
102 0 : return err;
103 0 : }
104 0 : static void fd_gossip_ip6_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
105 0 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_gossip_ip6_addr_t), ctx );
106 0 : return;
107 0 : }
108 0 : void * fd_gossip_ip6_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
109 0 : fd_bincode_bytes_decode_unsafe( mem, sizeof(fd_gossip_ip6_addr_t), ctx );
110 0 : return mem;
111 0 : }
112 :
113 0 : int fd_feature_encode( fd_feature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
114 0 : int err;
115 0 : err = fd_bincode_bool_encode( self->has_activated_at, ctx );
116 0 : if( FD_UNLIKELY( err ) ) return err;
117 0 : if( self->has_activated_at ) {
118 0 : err = fd_bincode_uint64_encode( self->activated_at, ctx );
119 0 : if( FD_UNLIKELY( err ) ) return err;
120 0 : }
121 0 : return FD_BINCODE_SUCCESS;
122 0 : }
123 0 : static int fd_feature_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
124 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
125 0 : int err = 0;
126 0 : {
127 0 : uchar o;
128 0 : err = fd_bincode_bool_decode( &o, ctx );
129 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
130 0 : if( o ) {
131 0 : err = fd_bincode_uint64_decode_footprint( ctx );
132 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
133 0 : }
134 0 : }
135 0 : return 0;
136 0 : }
137 0 : int fd_feature_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
138 0 : *total_sz += sizeof(fd_feature_t);
139 0 : void const * start_data = ctx->data;
140 0 : int err = fd_feature_decode_footprint_inner( ctx, total_sz );
141 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
142 0 : ctx->data = start_data;
143 0 : return err;
144 0 : }
145 0 : static void fd_feature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
146 0 : fd_feature_t * self = (fd_feature_t *)struct_mem;
147 0 : {
148 0 : uchar o;
149 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
150 0 : self->has_activated_at = !!o;
151 0 : if( o ) {
152 0 : fd_bincode_uint64_decode_unsafe( &self->activated_at, ctx );
153 0 : }
154 0 : }
155 0 : }
156 0 : void * fd_feature_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
157 0 : fd_feature_t * self = (fd_feature_t *)mem;
158 0 : fd_feature_new( self );
159 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_t);
160 0 : void * * alloc_mem = &alloc_region;
161 0 : fd_feature_decode_inner( mem, alloc_mem, ctx );
162 0 : return self;
163 0 : }
164 0 : void fd_feature_new(fd_feature_t * self) {
165 0 : fd_memset( self, 0, sizeof(fd_feature_t) );
166 0 : }
167 0 : void fd_feature_walk( void * w, fd_feature_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
168 0 : (void) varint;
169 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature", level++, 0 );
170 0 : if( !self->has_activated_at ) {
171 0 : fun( w, NULL, "activated_at", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
172 0 : } else {
173 0 : fun( w, &self->activated_at, "activated_at", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
174 0 : }
175 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature", level--, 0 );
176 0 : }
177 0 : ulong fd_feature_size( fd_feature_t const * self ) {
178 0 : ulong size = 0;
179 0 : size += sizeof(char);
180 0 : if( self->has_activated_at ) {
181 0 : size += sizeof(ulong);
182 0 : }
183 0 : return size;
184 0 : }
185 :
186 0 : int fd_fee_calculator_encode( fd_fee_calculator_t const * self, fd_bincode_encode_ctx_t * ctx ) {
187 0 : int err;
188 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
189 0 : if( FD_UNLIKELY( err ) ) return err;
190 0 : return FD_BINCODE_SUCCESS;
191 0 : }
192 0 : static inline int fd_fee_calculator_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
193 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
194 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
195 0 : return 0;
196 0 : }
197 0 : static void fd_fee_calculator_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
198 0 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)struct_mem;
199 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
200 0 : }
201 0 : void * fd_fee_calculator_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
202 0 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)mem;
203 0 : fd_fee_calculator_new( self );
204 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_calculator_t);
205 0 : void * * alloc_mem = &alloc_region;
206 0 : fd_fee_calculator_decode_inner( mem, alloc_mem, ctx );
207 0 : return self;
208 0 : }
209 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, uint varint ) {
210 0 : (void) varint;
211 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_calculator", level++, 0 );
212 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
213 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_calculator", level--, 0 );
214 0 : }
215 0 : int fd_hash_age_encode( fd_hash_age_t const * self, fd_bincode_encode_ctx_t * ctx ) {
216 0 : int err;
217 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
218 0 : if( FD_UNLIKELY( err ) ) return err;
219 0 : err = fd_bincode_uint64_encode( self->hash_index, ctx );
220 0 : if( FD_UNLIKELY( err ) ) return err;
221 0 : err = fd_bincode_uint64_encode( self->timestamp, ctx );
222 0 : if( FD_UNLIKELY( err ) ) return err;
223 0 : return FD_BINCODE_SUCCESS;
224 0 : }
225 0 : static inline int fd_hash_age_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
226 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
227 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
228 0 : return 0;
229 0 : }
230 0 : static void fd_hash_age_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
231 0 : fd_hash_age_t * self = (fd_hash_age_t *)struct_mem;
232 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
233 0 : fd_bincode_uint64_decode_unsafe( &self->hash_index, ctx );
234 0 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
235 0 : }
236 0 : void * fd_hash_age_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
237 0 : fd_hash_age_t * self = (fd_hash_age_t *)mem;
238 0 : fd_hash_age_new( self );
239 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hash_age_t);
240 0 : void * * alloc_mem = &alloc_region;
241 0 : fd_hash_age_decode_inner( mem, alloc_mem, ctx );
242 0 : return self;
243 0 : }
244 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, uint varint ) {
245 0 : (void) varint;
246 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hash_age", level++, 0 );
247 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
248 0 : fun( w, &self->hash_index, "hash_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
249 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
250 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hash_age", level--, 0 );
251 0 : }
252 0 : int fd_hash_hash_age_pair_encode( fd_hash_hash_age_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
253 0 : int err;
254 0 : err = fd_hash_encode( &self->key, ctx );
255 0 : if( FD_UNLIKELY( err ) ) return err;
256 0 : err = fd_hash_age_encode( &self->val, ctx );
257 0 : if( FD_UNLIKELY( err ) ) return err;
258 0 : return FD_BINCODE_SUCCESS;
259 0 : }
260 0 : static inline int fd_hash_hash_age_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
261 0 : if( (ulong)ctx->data + 56UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
262 0 : ctx->data = (void *)( (ulong)ctx->data + 56UL );
263 0 : return 0;
264 0 : }
265 0 : static void fd_hash_hash_age_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
266 0 : fd_hash_hash_age_pair_t * self = (fd_hash_hash_age_pair_t *)struct_mem;
267 0 : fd_hash_decode_inner( &self->key, alloc_mem, ctx );
268 0 : fd_hash_age_decode_inner( &self->val, alloc_mem, ctx );
269 0 : }
270 0 : void * fd_hash_hash_age_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
271 0 : fd_hash_hash_age_pair_t * self = (fd_hash_hash_age_pair_t *)mem;
272 0 : fd_hash_hash_age_pair_new( self );
273 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hash_hash_age_pair_t);
274 0 : void * * alloc_mem = &alloc_region;
275 0 : fd_hash_hash_age_pair_decode_inner( mem, alloc_mem, ctx );
276 0 : return self;
277 0 : }
278 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, uint varint ) {
279 0 : (void) varint;
280 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hash_hash_age_pair", level++, 0 );
281 0 : fd_hash_walk( w, &self->key, fun, "key", level, 0 );
282 0 : fd_hash_age_walk( w, &self->val, fun, "val", level, 0 );
283 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hash_hash_age_pair", level--, 0 );
284 0 : }
285 0 : int fd_block_hash_vec_encode( fd_block_hash_vec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
286 0 : int err;
287 0 : err = fd_bincode_uint64_encode( self->last_hash_index, ctx );
288 0 : if( FD_UNLIKELY( err ) ) return err;
289 0 : if( self->last_hash != NULL ) {
290 0 : err = fd_bincode_bool_encode( 1, ctx );
291 0 : if( FD_UNLIKELY( err ) ) return err;
292 0 : err = fd_hash_encode( self->last_hash, ctx );
293 0 : if( FD_UNLIKELY( err ) ) return err;
294 0 : } else {
295 0 : err = fd_bincode_bool_encode( 0, ctx );
296 0 : if( FD_UNLIKELY( err ) ) return err;
297 0 : }
298 0 : err = fd_bincode_uint64_encode( self->ages_len, ctx );
299 0 : if( FD_UNLIKELY(err) ) return err;
300 0 : if( self->ages_len ) {
301 0 : for( ulong i=0; i < self->ages_len; i++ ) {
302 0 : err = fd_hash_hash_age_pair_encode( self->ages + i, ctx );
303 0 : if( FD_UNLIKELY( err ) ) return err;
304 0 : }
305 0 : }
306 0 : err = fd_bincode_uint64_encode( self->max_age, ctx );
307 0 : if( FD_UNLIKELY( err ) ) return err;
308 0 : return FD_BINCODE_SUCCESS;
309 0 : }
310 0 : int fd_block_hash_vec_encode_global( fd_block_hash_vec_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
311 0 : int err;
312 0 : err = fd_bincode_uint64_encode( self->last_hash_index, ctx );
313 0 : if( FD_UNLIKELY( err ) ) return err;
314 0 : if( self->last_hash_offset ) {
315 0 : err = fd_bincode_bool_encode( 1, ctx );
316 0 : if( FD_UNLIKELY( err ) ) return err;
317 0 : fd_hash_t * last_hash = (void *)((uchar*)self + self->last_hash_offset);
318 0 : err = fd_hash_encode( last_hash, ctx );
319 0 : if( FD_UNLIKELY( err ) ) return err;
320 0 : } else {
321 0 : err = fd_bincode_bool_encode( 0, ctx );
322 0 : if( FD_UNLIKELY( err ) ) return err;
323 0 : }
324 0 : err = fd_bincode_uint64_encode( self->ages_len, ctx );
325 0 : if( FD_UNLIKELY( err ) ) return err;
326 0 : if( self->ages_len ) {
327 0 : uchar * ages_laddr = (uchar*)self + self->ages_offset;
328 0 : fd_hash_hash_age_pair_t * ages = (fd_hash_hash_age_pair_t *)ages_laddr;
329 0 : for( ulong i=0; i < self->ages_len; i++ ) {
330 0 : err = fd_hash_hash_age_pair_encode( &ages[i], ctx );
331 0 : if( FD_UNLIKELY( err ) ) return err;
332 0 : }
333 0 : }
334 0 : err = fd_bincode_uint64_encode( self->max_age, ctx );
335 0 : if( FD_UNLIKELY( err ) ) return err;
336 0 : return FD_BINCODE_SUCCESS;
337 0 : }
338 0 : static int fd_block_hash_vec_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
339 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
340 0 : int err = 0;
341 0 : err = fd_bincode_uint64_decode_footprint( ctx );
342 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
343 0 : {
344 0 : uchar o;
345 0 : err = fd_bincode_bool_decode( &o, ctx );
346 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
347 0 : if( o ) {
348 0 : *total_sz += FD_HASH_ALIGN + sizeof(fd_hash_t);
349 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
350 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
351 0 : }
352 0 : }
353 0 : ulong ages_len;
354 0 : err = fd_bincode_uint64_decode( &ages_len, ctx );
355 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
356 0 : if( ages_len ) {
357 0 : *total_sz += FD_HASH_HASH_AGE_PAIR_ALIGN + sizeof(fd_hash_hash_age_pair_t)*ages_len;
358 0 : for( ulong i=0; i < ages_len; i++ ) {
359 0 : err = fd_hash_hash_age_pair_decode_footprint_inner( ctx, total_sz );
360 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
361 0 : }
362 0 : }
363 0 : err = fd_bincode_uint64_decode_footprint( ctx );
364 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
365 0 : return 0;
366 0 : }
367 0 : int fd_block_hash_vec_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
368 0 : *total_sz += sizeof(fd_block_hash_vec_t);
369 0 : void const * start_data = ctx->data;
370 0 : int err = fd_block_hash_vec_decode_footprint_inner( ctx, total_sz );
371 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
372 0 : ctx->data = start_data;
373 0 : return err;
374 0 : }
375 0 : static void fd_block_hash_vec_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
376 0 : fd_block_hash_vec_t * self = (fd_block_hash_vec_t *)struct_mem;
377 0 : fd_bincode_uint64_decode_unsafe( &self->last_hash_index, ctx );
378 0 : {
379 0 : uchar o;
380 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
381 0 : if( o ) {
382 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
383 0 : self->last_hash = *alloc_mem;
384 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_hash_t);
385 0 : fd_hash_new( self->last_hash );
386 0 : fd_hash_decode_inner( self->last_hash, alloc_mem, ctx );
387 0 : } else {
388 0 : self->last_hash = NULL;
389 0 : }
390 0 : }
391 0 : fd_bincode_uint64_decode_unsafe( &self->ages_len, ctx );
392 0 : if( self->ages_len ) {
393 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_HASH_HASH_AGE_PAIR_ALIGN );
394 0 : self->ages = *alloc_mem;
395 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_hash_hash_age_pair_t)*self->ages_len;
396 0 : for( ulong i=0; i < self->ages_len; i++ ) {
397 0 : fd_hash_hash_age_pair_new( self->ages + i );
398 0 : fd_hash_hash_age_pair_decode_inner( self->ages + i, alloc_mem, ctx );
399 0 : }
400 0 : } else
401 0 : self->ages = NULL;
402 0 : fd_bincode_uint64_decode_unsafe( &self->max_age, ctx );
403 0 : }
404 0 : void * fd_block_hash_vec_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
405 0 : fd_block_hash_vec_t * self = (fd_block_hash_vec_t *)mem;
406 0 : fd_block_hash_vec_new( self );
407 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_hash_vec_t);
408 0 : void * * alloc_mem = &alloc_region;
409 0 : fd_block_hash_vec_decode_inner( mem, alloc_mem, ctx );
410 0 : return self;
411 0 : }
412 0 : static void fd_block_hash_vec_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
413 0 : fd_block_hash_vec_global_t * self = (fd_block_hash_vec_global_t *)struct_mem;
414 0 : fd_bincode_uint64_decode_unsafe( &self->last_hash_index, ctx );
415 0 : {
416 0 : uchar o;
417 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
418 0 : if( o ) {
419 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
420 0 : self->last_hash_offset = (ulong)*alloc_mem - (ulong)struct_mem;
421 0 : fd_hash_new( *alloc_mem );
422 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_hash_t);
423 0 : fd_hash_decode_inner( (uchar*)self + self->last_hash_offset, alloc_mem, ctx );
424 0 : } else {
425 0 : self->last_hash_offset = 0UL;
426 0 : }
427 0 : }
428 0 : fd_bincode_uint64_decode_unsafe( &self->ages_len, ctx );
429 0 : if( self->ages_len ) {
430 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_HASH_HASH_AGE_PAIR_ALIGN );
431 0 : self->ages_offset = (ulong)*alloc_mem - (ulong)struct_mem;
432 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
433 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_hash_hash_age_pair_t)*self->ages_len;
434 0 : for( ulong i=0; i < self->ages_len; i++ ) {
435 0 : fd_hash_hash_age_pair_new( (fd_hash_hash_age_pair_t *)fd_type_pun(cur_mem + sizeof(fd_hash_hash_age_pair_t) * i) );
436 0 : fd_hash_hash_age_pair_decode_inner( cur_mem + sizeof(fd_hash_hash_age_pair_t) * i, alloc_mem, ctx );
437 0 : }
438 0 : } else {
439 0 : self->ages_offset = 0UL;
440 0 : }
441 0 : fd_bincode_uint64_decode_unsafe( &self->max_age, ctx );
442 0 : }
443 0 : void * fd_block_hash_vec_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
444 0 : fd_block_hash_vec_global_t * self = (fd_block_hash_vec_global_t *)mem;
445 0 : fd_block_hash_vec_new( (fd_block_hash_vec_t *)self );
446 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_hash_vec_global_t);
447 0 : void * * alloc_mem = &alloc_region;
448 0 : fd_block_hash_vec_decode_inner_global( mem, alloc_mem, ctx );
449 0 : return self;
450 0 : }
451 0 : void fd_block_hash_vec_new(fd_block_hash_vec_t * self) {
452 0 : fd_memset( self, 0, sizeof(fd_block_hash_vec_t) );
453 0 : }
454 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, uint varint ) {
455 0 : (void) varint;
456 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_hash_vec", level++, 0 );
457 0 : fun( w, &self->last_hash_index, "last_hash_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
458 0 : if( !self->last_hash ) {
459 0 : fun( w, NULL, "last_hash", FD_FLAMENCO_TYPE_NULL, "hash", level, 0 );
460 0 : } else {
461 0 : fd_hash_walk( w, self->last_hash, fun, "last_hash", level, 0 );
462 0 : }
463 0 : if( self->ages_len ) {
464 0 : fun( w, NULL, "ages", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
465 0 : for( ulong i=0; i < self->ages_len; i++ )
466 0 : fd_hash_hash_age_pair_walk(w, self->ages + i, fun, "hash_hash_age_pair", level, 0 );
467 0 : fun( w, NULL, "ages", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
468 0 : }
469 0 : fun( w, &self->max_age, "max_age", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
470 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_hash_vec", level--, 0 );
471 0 : }
472 0 : ulong fd_block_hash_vec_size( fd_block_hash_vec_t const * self ) {
473 0 : ulong size = 0;
474 0 : size += sizeof(ulong);
475 0 : size += sizeof(char);
476 0 : if( NULL != self->last_hash ) {
477 0 : size += fd_hash_size( self->last_hash );
478 0 : }
479 0 : do {
480 0 : size += sizeof(ulong);
481 0 : for( ulong i=0; i < self->ages_len; i++ )
482 0 : size += fd_hash_hash_age_pair_size( self->ages + i );
483 0 : } while(0);
484 0 : size += sizeof(ulong);
485 0 : return size;
486 0 : }
487 :
488 0 : ulong fd_block_hash_vec_size_global( fd_block_hash_vec_global_t const * self ) {
489 0 : ulong size = 0;
490 0 : size += sizeof(ulong);
491 0 : size += sizeof(char);
492 0 : fd_hash_t * last_hash = (fd_hash_t *)fd_type_pun( (uchar *)self + self->last_hash_offset );
493 0 : if( NULL != last_hash ) {
494 0 : size += fd_hash_size( last_hash );
495 0 : }
496 0 : do {
497 0 : size += sizeof(ulong);
498 0 : fd_hash_hash_age_pair_t * ages = self->ages_offset ? (fd_hash_hash_age_pair_t *)fd_type_pun( (uchar *)self + self->ages_offset ) : NULL;
499 0 : for( ulong i=0; i < self->ages_len; i++ )
500 0 : size += fd_hash_hash_age_pair_size( ages + i );
501 0 : } while(0);
502 0 : size += sizeof(ulong);
503 0 : return size;
504 0 : }
505 :
506 9 : int fd_fee_rate_governor_encode( fd_fee_rate_governor_t const * self, fd_bincode_encode_ctx_t * ctx ) {
507 9 : int err;
508 9 : err = fd_bincode_uint64_encode( self->target_lamports_per_signature, ctx );
509 9 : if( FD_UNLIKELY( err ) ) return err;
510 9 : err = fd_bincode_uint64_encode( self->target_signatures_per_slot, ctx );
511 9 : if( FD_UNLIKELY( err ) ) return err;
512 9 : err = fd_bincode_uint64_encode( self->min_lamports_per_signature, ctx );
513 9 : if( FD_UNLIKELY( err ) ) return err;
514 9 : err = fd_bincode_uint64_encode( self->max_lamports_per_signature, ctx );
515 9 : if( FD_UNLIKELY( err ) ) return err;
516 9 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
517 9 : if( FD_UNLIKELY( err ) ) return err;
518 9 : return FD_BINCODE_SUCCESS;
519 9 : }
520 0 : static inline int fd_fee_rate_governor_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
521 0 : if( (ulong)ctx->data + 33UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
522 0 : ctx->data = (void *)( (ulong)ctx->data + 33UL );
523 0 : return 0;
524 0 : }
525 0 : static void fd_fee_rate_governor_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
526 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)struct_mem;
527 0 : fd_bincode_uint64_decode_unsafe( &self->target_lamports_per_signature, ctx );
528 0 : fd_bincode_uint64_decode_unsafe( &self->target_signatures_per_slot, ctx );
529 0 : fd_bincode_uint64_decode_unsafe( &self->min_lamports_per_signature, ctx );
530 0 : fd_bincode_uint64_decode_unsafe( &self->max_lamports_per_signature, ctx );
531 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
532 0 : }
533 0 : void * fd_fee_rate_governor_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
534 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)mem;
535 0 : fd_fee_rate_governor_new( self );
536 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_rate_governor_t);
537 0 : void * * alloc_mem = &alloc_region;
538 0 : fd_fee_rate_governor_decode_inner( mem, alloc_mem, ctx );
539 0 : return self;
540 0 : }
541 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, uint varint ) {
542 0 : (void) varint;
543 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_rate_governor", level++, 0 );
544 0 : fun( w, &self->target_lamports_per_signature, "target_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
545 0 : fun( w, &self->target_signatures_per_slot, "target_signatures_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
546 0 : fun( w, &self->min_lamports_per_signature, "min_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
547 0 : fun( w, &self->max_lamports_per_signature, "max_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
548 0 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
549 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_rate_governor", level--, 0 );
550 0 : }
551 0 : int fd_slot_pair_encode( fd_slot_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
552 0 : int err;
553 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
554 0 : if( FD_UNLIKELY( err ) ) return err;
555 0 : err = fd_bincode_uint64_encode( self->val, ctx );
556 0 : if( FD_UNLIKELY( err ) ) return err;
557 0 : return FD_BINCODE_SUCCESS;
558 0 : }
559 0 : static inline int fd_slot_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
560 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
561 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
562 0 : return 0;
563 0 : }
564 0 : static void fd_slot_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
565 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)struct_mem;
566 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
567 0 : fd_bincode_uint64_decode_unsafe( &self->val, ctx );
568 0 : }
569 0 : void * fd_slot_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
570 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)mem;
571 0 : fd_slot_pair_new( self );
572 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_pair_t);
573 0 : void * * alloc_mem = &alloc_region;
574 0 : fd_slot_pair_decode_inner( mem, alloc_mem, ctx );
575 0 : return self;
576 0 : }
577 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, uint varint ) {
578 0 : (void) varint;
579 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_pair", level++, 0 );
580 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
581 0 : fun( w, &self->val, "val", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
582 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_pair", level--, 0 );
583 0 : }
584 0 : int fd_hard_forks_encode( fd_hard_forks_t const * self, fd_bincode_encode_ctx_t * ctx ) {
585 0 : int err;
586 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
587 0 : if( FD_UNLIKELY(err) ) return err;
588 0 : if( self->hard_forks_len ) {
589 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
590 0 : err = fd_slot_pair_encode( self->hard_forks + i, ctx );
591 0 : if( FD_UNLIKELY( err ) ) return err;
592 0 : }
593 0 : }
594 0 : return FD_BINCODE_SUCCESS;
595 0 : }
596 0 : int fd_hard_forks_encode_global( fd_hard_forks_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
597 0 : int err;
598 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
599 0 : if( FD_UNLIKELY( err ) ) return err;
600 0 : if( self->hard_forks_len ) {
601 0 : uchar * hard_forks_laddr = (uchar*)self + self->hard_forks_offset;
602 0 : fd_slot_pair_t * hard_forks = (fd_slot_pair_t *)hard_forks_laddr;
603 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
604 0 : err = fd_slot_pair_encode( &hard_forks[i], ctx );
605 0 : if( FD_UNLIKELY( err ) ) return err;
606 0 : }
607 0 : }
608 0 : return FD_BINCODE_SUCCESS;
609 0 : }
610 0 : static int fd_hard_forks_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
611 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
612 0 : int err = 0;
613 0 : ulong hard_forks_len;
614 0 : err = fd_bincode_uint64_decode( &hard_forks_len, ctx );
615 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
616 0 : if( hard_forks_len ) {
617 0 : *total_sz += FD_SLOT_PAIR_ALIGN + sizeof(fd_slot_pair_t)*hard_forks_len;
618 0 : for( ulong i=0; i < hard_forks_len; i++ ) {
619 0 : err = fd_slot_pair_decode_footprint_inner( ctx, total_sz );
620 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
621 0 : }
622 0 : }
623 0 : return 0;
624 0 : }
625 0 : int fd_hard_forks_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
626 0 : *total_sz += sizeof(fd_hard_forks_t);
627 0 : void const * start_data = ctx->data;
628 0 : int err = fd_hard_forks_decode_footprint_inner( ctx, total_sz );
629 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
630 0 : ctx->data = start_data;
631 0 : return err;
632 0 : }
633 0 : static void fd_hard_forks_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
634 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)struct_mem;
635 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
636 0 : if( self->hard_forks_len ) {
637 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
638 0 : self->hard_forks = *alloc_mem;
639 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
640 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
641 0 : fd_slot_pair_new( self->hard_forks + i );
642 0 : fd_slot_pair_decode_inner( self->hard_forks + i, alloc_mem, ctx );
643 0 : }
644 0 : } else
645 0 : self->hard_forks = NULL;
646 0 : }
647 0 : void * fd_hard_forks_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
648 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)mem;
649 0 : fd_hard_forks_new( self );
650 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_t);
651 0 : void * * alloc_mem = &alloc_region;
652 0 : fd_hard_forks_decode_inner( mem, alloc_mem, ctx );
653 0 : return self;
654 0 : }
655 0 : static void fd_hard_forks_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
656 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)struct_mem;
657 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
658 0 : if( self->hard_forks_len ) {
659 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
660 0 : self->hard_forks_offset = (ulong)*alloc_mem - (ulong)struct_mem;
661 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
662 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
663 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
664 0 : fd_slot_pair_new( (fd_slot_pair_t *)fd_type_pun(cur_mem + sizeof(fd_slot_pair_t) * i) );
665 0 : fd_slot_pair_decode_inner( cur_mem + sizeof(fd_slot_pair_t) * i, alloc_mem, ctx );
666 0 : }
667 0 : } else {
668 0 : self->hard_forks_offset = 0UL;
669 0 : }
670 0 : }
671 0 : void * fd_hard_forks_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
672 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)mem;
673 0 : fd_hard_forks_new( (fd_hard_forks_t *)self );
674 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_global_t);
675 0 : void * * alloc_mem = &alloc_region;
676 0 : fd_hard_forks_decode_inner_global( mem, alloc_mem, ctx );
677 0 : return self;
678 0 : }
679 0 : void fd_hard_forks_new(fd_hard_forks_t * self) {
680 0 : fd_memset( self, 0, sizeof(fd_hard_forks_t) );
681 0 : }
682 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, uint varint ) {
683 0 : (void) varint;
684 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hard_forks", level++, 0 );
685 0 : if( self->hard_forks_len ) {
686 0 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
687 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
688 0 : fd_slot_pair_walk(w, self->hard_forks + i, fun, "slot_pair", level, 0 );
689 0 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
690 0 : }
691 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hard_forks", level--, 0 );
692 0 : }
693 0 : ulong fd_hard_forks_size( fd_hard_forks_t const * self ) {
694 0 : ulong size = 0;
695 0 : do {
696 0 : size += sizeof(ulong);
697 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
698 0 : size += fd_slot_pair_size( self->hard_forks + i );
699 0 : } while(0);
700 0 : return size;
701 0 : }
702 :
703 0 : ulong fd_hard_forks_size_global( fd_hard_forks_global_t const * self ) {
704 0 : ulong size = 0;
705 0 : do {
706 0 : size += sizeof(ulong);
707 0 : fd_slot_pair_t * hard_forks = self->hard_forks_offset ? (fd_slot_pair_t *)fd_type_pun( (uchar *)self + self->hard_forks_offset ) : NULL;
708 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
709 0 : size += fd_slot_pair_size( hard_forks + i );
710 0 : } while(0);
711 0 : return size;
712 0 : }
713 :
714 9 : int fd_inflation_encode( fd_inflation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
715 9 : int err;
716 9 : err = fd_bincode_double_encode( self->initial, ctx );
717 9 : if( FD_UNLIKELY( err ) ) return err;
718 9 : err = fd_bincode_double_encode( self->terminal, ctx );
719 9 : if( FD_UNLIKELY( err ) ) return err;
720 9 : err = fd_bincode_double_encode( self->taper, ctx );
721 9 : if( FD_UNLIKELY( err ) ) return err;
722 9 : err = fd_bincode_double_encode( self->foundation, ctx );
723 9 : if( FD_UNLIKELY( err ) ) return err;
724 9 : err = fd_bincode_double_encode( self->foundation_term, ctx );
725 9 : if( FD_UNLIKELY( err ) ) return err;
726 9 : err = fd_bincode_double_encode( self->unused, ctx );
727 9 : if( FD_UNLIKELY( err ) ) return err;
728 9 : return FD_BINCODE_SUCCESS;
729 9 : }
730 0 : static inline int fd_inflation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
731 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
732 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
733 0 : return 0;
734 0 : }
735 0 : static void fd_inflation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
736 0 : fd_inflation_t * self = (fd_inflation_t *)struct_mem;
737 0 : fd_bincode_double_decode_unsafe( &self->initial, ctx );
738 0 : fd_bincode_double_decode_unsafe( &self->terminal, ctx );
739 0 : fd_bincode_double_decode_unsafe( &self->taper, ctx );
740 0 : fd_bincode_double_decode_unsafe( &self->foundation, ctx );
741 0 : fd_bincode_double_decode_unsafe( &self->foundation_term, ctx );
742 0 : fd_bincode_double_decode_unsafe( &self->unused, ctx );
743 0 : }
744 0 : void * fd_inflation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
745 0 : fd_inflation_t * self = (fd_inflation_t *)mem;
746 0 : fd_inflation_new( self );
747 0 : void * alloc_region = (uchar *)mem + sizeof(fd_inflation_t);
748 0 : void * * alloc_mem = &alloc_region;
749 0 : fd_inflation_decode_inner( mem, alloc_mem, ctx );
750 0 : return self;
751 0 : }
752 0 : void fd_inflation_walk( void * w, fd_inflation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
753 0 : (void) varint;
754 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_inflation", level++, 0 );
755 0 : fun( w, &self->initial, "initial", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
756 0 : fun( w, &self->terminal, "terminal", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
757 0 : fun( w, &self->taper, "taper", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
758 0 : fun( w, &self->foundation, "foundation", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
759 0 : fun( w, &self->foundation_term, "foundation_term", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
760 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
761 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_inflation", level--, 0 );
762 0 : }
763 9 : int fd_rent_encode( fd_rent_t const * self, fd_bincode_encode_ctx_t * ctx ) {
764 9 : int err;
765 9 : err = fd_bincode_uint64_encode( self->lamports_per_uint8_year, ctx );
766 9 : if( FD_UNLIKELY( err ) ) return err;
767 9 : err = fd_bincode_double_encode( self->exemption_threshold, ctx );
768 9 : if( FD_UNLIKELY( err ) ) return err;
769 9 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
770 9 : if( FD_UNLIKELY( err ) ) return err;
771 9 : return FD_BINCODE_SUCCESS;
772 9 : }
773 0 : static inline int fd_rent_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
774 0 : if( (ulong)ctx->data + 17UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
775 0 : ctx->data = (void *)( (ulong)ctx->data + 17UL );
776 0 : return 0;
777 0 : }
778 0 : static void fd_rent_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
779 0 : fd_rent_t * self = (fd_rent_t *)struct_mem;
780 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
781 0 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
782 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
783 0 : }
784 0 : void * fd_rent_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
785 0 : fd_rent_t * self = (fd_rent_t *)mem;
786 0 : fd_rent_new( self );
787 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_t);
788 0 : void * * alloc_mem = &alloc_region;
789 0 : fd_rent_decode_inner( mem, alloc_mem, ctx );
790 0 : return self;
791 0 : }
792 0 : void fd_rent_walk( void * w, fd_rent_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
793 0 : (void) varint;
794 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent", level++, 0 );
795 0 : fun( w, &self->lamports_per_uint8_year, "lamports_per_uint8_year", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
796 0 : fun( w, &self->exemption_threshold, "exemption_threshold", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
797 0 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
798 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent", level--, 0 );
799 0 : }
800 9 : int fd_epoch_schedule_encode( fd_epoch_schedule_t const * self, fd_bincode_encode_ctx_t * ctx ) {
801 9 : int err;
802 9 : err = fd_bincode_uint64_encode( self->slots_per_epoch, ctx );
803 9 : if( FD_UNLIKELY( err ) ) return err;
804 9 : err = fd_bincode_uint64_encode( self->leader_schedule_slot_offset, ctx );
805 9 : if( FD_UNLIKELY( err ) ) return err;
806 9 : err = fd_bincode_bool_encode( (uchar)(self->warmup), ctx );
807 9 : if( FD_UNLIKELY( err ) ) return err;
808 9 : err = fd_bincode_uint64_encode( self->first_normal_epoch, ctx );
809 9 : if( FD_UNLIKELY( err ) ) return err;
810 9 : err = fd_bincode_uint64_encode( self->first_normal_slot, ctx );
811 9 : if( FD_UNLIKELY( err ) ) return err;
812 9 : return FD_BINCODE_SUCCESS;
813 9 : }
814 3 : static int fd_epoch_schedule_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
815 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
816 3 : int err = 0;
817 3 : err = fd_bincode_uint64_decode_footprint( ctx );
818 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
819 3 : err = fd_bincode_uint64_decode_footprint( ctx );
820 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
821 3 : err = fd_bincode_bool_decode_footprint( ctx );
822 3 : if( FD_UNLIKELY( err ) ) return err;
823 3 : err = fd_bincode_uint64_decode_footprint( ctx );
824 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
825 3 : err = fd_bincode_uint64_decode_footprint( ctx );
826 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
827 3 : return 0;
828 3 : }
829 3 : int fd_epoch_schedule_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
830 3 : *total_sz += sizeof(fd_epoch_schedule_t);
831 3 : void const * start_data = ctx->data;
832 3 : int err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
833 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
834 3 : ctx->data = start_data;
835 3 : return err;
836 3 : }
837 0 : static void fd_epoch_schedule_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
838 0 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)struct_mem;
839 0 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
840 0 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
841 0 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
842 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
843 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
844 0 : }
845 0 : void * fd_epoch_schedule_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
846 0 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)mem;
847 0 : fd_epoch_schedule_new( self );
848 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_schedule_t);
849 0 : void * * alloc_mem = &alloc_region;
850 0 : fd_epoch_schedule_decode_inner( mem, alloc_mem, ctx );
851 0 : return self;
852 0 : }
853 12 : void fd_epoch_schedule_new(fd_epoch_schedule_t * self) {
854 12 : fd_memset( self, 0, sizeof(fd_epoch_schedule_t) );
855 12 : }
856 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, uint varint ) {
857 0 : (void) varint;
858 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_schedule", level++, 0 );
859 0 : fun( w, &self->slots_per_epoch, "slots_per_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
860 0 : fun( w, &self->leader_schedule_slot_offset, "leader_schedule_slot_offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
861 0 : fun( w, &self->warmup, "warmup", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
862 0 : fun( w, &self->first_normal_epoch, "first_normal_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
863 0 : fun( w, &self->first_normal_slot, "first_normal_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
864 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_schedule", level--, 0 );
865 0 : }
866 0 : int fd_rent_collector_encode( fd_rent_collector_t const * self, fd_bincode_encode_ctx_t * ctx ) {
867 0 : int err;
868 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
869 0 : if( FD_UNLIKELY( err ) ) return err;
870 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
871 0 : if( FD_UNLIKELY( err ) ) return err;
872 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
873 0 : if( FD_UNLIKELY( err ) ) return err;
874 0 : err = fd_rent_encode( &self->rent, ctx );
875 0 : if( FD_UNLIKELY( err ) ) return err;
876 0 : return FD_BINCODE_SUCCESS;
877 0 : }
878 0 : static int fd_rent_collector_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
879 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
880 0 : int err = 0;
881 0 : err = fd_bincode_uint64_decode_footprint( ctx );
882 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
883 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
884 0 : if( FD_UNLIKELY( err ) ) return err;
885 0 : err = fd_bincode_double_decode_footprint( ctx );
886 0 : if( FD_UNLIKELY( err ) ) return err;
887 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
888 0 : if( FD_UNLIKELY( err ) ) return err;
889 0 : return 0;
890 0 : }
891 0 : int fd_rent_collector_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
892 0 : *total_sz += sizeof(fd_rent_collector_t);
893 0 : void const * start_data = ctx->data;
894 0 : int err = fd_rent_collector_decode_footprint_inner( ctx, total_sz );
895 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
896 0 : ctx->data = start_data;
897 0 : return err;
898 0 : }
899 0 : static void fd_rent_collector_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
900 0 : fd_rent_collector_t * self = (fd_rent_collector_t *)struct_mem;
901 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
902 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
903 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
904 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
905 0 : }
906 0 : void * fd_rent_collector_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
907 0 : fd_rent_collector_t * self = (fd_rent_collector_t *)mem;
908 0 : fd_rent_collector_new( self );
909 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_collector_t);
910 0 : void * * alloc_mem = &alloc_region;
911 0 : fd_rent_collector_decode_inner( mem, alloc_mem, ctx );
912 0 : return self;
913 0 : }
914 0 : void fd_rent_collector_new(fd_rent_collector_t * self) {
915 0 : fd_memset( self, 0, sizeof(fd_rent_collector_t) );
916 0 : fd_epoch_schedule_new( &self->epoch_schedule );
917 0 : fd_rent_new( &self->rent );
918 0 : }
919 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, uint varint ) {
920 0 : (void) varint;
921 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_collector", level++, 0 );
922 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
923 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level, 0 );
924 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
925 0 : fd_rent_walk( w, &self->rent, fun, "rent", level, 0 );
926 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_collector", level--, 0 );
927 0 : }
928 9 : int fd_stake_history_entry_encode( fd_stake_history_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
929 9 : int err;
930 9 : err = fd_bincode_uint64_encode( self->effective, ctx );
931 9 : if( FD_UNLIKELY( err ) ) return err;
932 9 : err = fd_bincode_uint64_encode( self->activating, ctx );
933 9 : if( FD_UNLIKELY( err ) ) return err;
934 9 : err = fd_bincode_uint64_encode( self->deactivating, ctx );
935 9 : if( FD_UNLIKELY( err ) ) return err;
936 9 : return FD_BINCODE_SUCCESS;
937 9 : }
938 0 : static inline int fd_stake_history_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
939 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
940 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
941 0 : return 0;
942 0 : }
943 12 : static void fd_stake_history_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
944 12 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)struct_mem;
945 12 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
946 12 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
947 12 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
948 12 : }
949 0 : void * fd_stake_history_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
950 0 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)mem;
951 0 : fd_stake_history_entry_new( self );
952 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_entry_t);
953 0 : void * * alloc_mem = &alloc_region;
954 0 : fd_stake_history_entry_decode_inner( mem, alloc_mem, ctx );
955 0 : return self;
956 0 : }
957 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, uint varint ) {
958 0 : (void) varint;
959 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history_entry", level++, 0 );
960 0 : fun( w, &self->effective, "effective", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
961 0 : fun( w, &self->activating, "activating", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
962 0 : fun( w, &self->deactivating, "deactivating", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
963 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history_entry", level--, 0 );
964 0 : }
965 9 : int fd_epoch_stake_history_entry_pair_encode( fd_epoch_stake_history_entry_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
966 9 : int err;
967 9 : err = fd_bincode_uint64_encode( self->epoch, ctx );
968 9 : if( FD_UNLIKELY( err ) ) return err;
969 9 : err = fd_stake_history_entry_encode( &self->entry, ctx );
970 9 : if( FD_UNLIKELY( err ) ) return err;
971 9 : return FD_BINCODE_SUCCESS;
972 9 : }
973 1548 : static inline int fd_epoch_stake_history_entry_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
974 1548 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
975 1548 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
976 1548 : return 0;
977 1548 : }
978 12 : static void fd_epoch_stake_history_entry_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
979 12 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)struct_mem;
980 12 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
981 12 : fd_stake_history_entry_decode_inner( &self->entry, alloc_mem, ctx );
982 12 : }
983 0 : void * fd_epoch_stake_history_entry_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
984 0 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)mem;
985 0 : fd_epoch_stake_history_entry_pair_new( self );
986 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_stake_history_entry_pair_t);
987 0 : void * * alloc_mem = &alloc_region;
988 0 : fd_epoch_stake_history_entry_pair_decode_inner( mem, alloc_mem, ctx );
989 0 : return self;
990 0 : }
991 0 : void fd_epoch_stake_history_entry_pair_walk( void * w, fd_epoch_stake_history_entry_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
992 0 : (void) varint;
993 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_stake_history_entry_pair", level++, 0 );
994 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
995 0 : fd_stake_history_entry_walk( w, &self->entry, fun, "entry", level, 0 );
996 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_stake_history_entry_pair", level--, 0 );
997 0 : }
998 9 : int fd_stake_history_encode( fd_stake_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
999 9 : int err;
1000 9 : err = fd_bincode_uint64_encode( self->fd_stake_history_len, ctx );
1001 9 : if( FD_UNLIKELY(err) ) return err;
1002 9 : if( FD_UNLIKELY( 0 == self->fd_stake_history_len ) ) return FD_BINCODE_SUCCESS;
1003 15 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
1004 9 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
1005 9 : err = fd_epoch_stake_history_entry_pair_encode( self->fd_stake_history + idx, ctx );
1006 9 : if( FD_UNLIKELY( err ) ) return err;
1007 9 : }
1008 6 : return FD_BINCODE_SUCCESS;
1009 6 : }
1010 15 : static int fd_stake_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1011 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1012 15 : int err = 0;
1013 15 : ulong fd_stake_history_len;
1014 15 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
1015 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1016 15 : if( fd_stake_history_len ) {
1017 1560 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
1018 1548 : err = fd_epoch_stake_history_entry_pair_decode_footprint_inner( ctx, total_sz );
1019 1548 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1020 1548 : }
1021 12 : }
1022 15 : return 0;
1023 15 : }
1024 15 : int fd_stake_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1025 15 : *total_sz += sizeof(fd_stake_history_t);
1026 15 : void const * start_data = ctx->data;
1027 15 : int err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
1028 15 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1029 15 : ctx->data = start_data;
1030 15 : return err;
1031 15 : }
1032 12 : static void fd_stake_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1033 12 : fd_stake_history_t * self = (fd_stake_history_t *)struct_mem;
1034 12 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
1035 12 : self->fd_stake_history_size = 512;
1036 12 : self->fd_stake_history_offset = 0;
1037 24 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
1038 12 : fd_epoch_stake_history_entry_pair_decode_inner( self->fd_stake_history + i, alloc_mem, ctx );
1039 12 : }
1040 12 : }
1041 12 : void * fd_stake_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1042 12 : fd_stake_history_t * self = (fd_stake_history_t *)mem;
1043 12 : fd_stake_history_new( self );
1044 12 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_t);
1045 12 : void * * alloc_mem = &alloc_region;
1046 12 : fd_stake_history_decode_inner( mem, alloc_mem, ctx );
1047 12 : return self;
1048 12 : }
1049 15 : void fd_stake_history_new(fd_stake_history_t * self) {
1050 15 : fd_memset( self, 0, sizeof(fd_stake_history_t) );
1051 15 : self->fd_stake_history_size = 512;
1052 7695 : for( ulong i=0; i<512; i++ )
1053 7680 : fd_epoch_stake_history_entry_pair_new( self->fd_stake_history + i );
1054 15 : }
1055 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, uint varint ) {
1056 0 : (void) varint;
1057 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history", level++, 0 );
1058 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR, "epoch_stake_history_entry_pair[]", level++, 0 );
1059 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
1060 0 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
1061 0 : fd_epoch_stake_history_entry_pair_walk( w, self->fd_stake_history + idx, fun, "epoch_stake_history_entry_pair", level, 0 );
1062 0 : }
1063 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR_END, "epoch_stake_history_entry_pair[]", level--, 0 );
1064 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history", level--, 0 );
1065 0 : }
1066 144 : int fd_solana_account_encode( fd_solana_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1067 144 : int err;
1068 144 : err = fd_bincode_uint64_encode( self->lamports, ctx );
1069 144 : if( FD_UNLIKELY( err ) ) return err;
1070 144 : err = fd_bincode_uint64_encode( self->data_len, ctx );
1071 144 : if( FD_UNLIKELY(err) ) return err;
1072 144 : if( self->data_len ) {
1073 30 : err = fd_bincode_bytes_encode( self->data, self->data_len, ctx );
1074 30 : if( FD_UNLIKELY( err ) ) return err;
1075 30 : }
1076 144 : err = fd_pubkey_encode( &self->owner, ctx );
1077 144 : if( FD_UNLIKELY( err ) ) return err;
1078 144 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
1079 144 : if( FD_UNLIKELY( err ) ) return err;
1080 144 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
1081 144 : if( FD_UNLIKELY( err ) ) return err;
1082 144 : return FD_BINCODE_SUCCESS;
1083 144 : }
1084 0 : int fd_solana_account_encode_global( fd_solana_account_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1085 0 : int err;
1086 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
1087 0 : if( FD_UNLIKELY( err ) ) return err;
1088 0 : err = fd_bincode_uint64_encode( self->data_len, ctx );
1089 0 : if( FD_UNLIKELY( err ) ) return err;
1090 0 : if( self->data_len ) {
1091 0 : uchar * data_laddr = (uchar*)self + self->data_offset;
1092 0 : err = fd_bincode_bytes_encode( data_laddr, self->data_len, ctx );
1093 0 : if( FD_UNLIKELY( err ) ) return err;
1094 0 : }
1095 0 : err = fd_pubkey_encode( &self->owner, ctx );
1096 0 : if( FD_UNLIKELY( err ) ) return err;
1097 0 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
1098 0 : if( FD_UNLIKELY( err ) ) return err;
1099 0 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
1100 0 : if( FD_UNLIKELY( err ) ) return err;
1101 0 : return FD_BINCODE_SUCCESS;
1102 0 : }
1103 0 : static int fd_solana_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1104 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1105 0 : int err = 0;
1106 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1107 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1108 0 : ulong data_len;
1109 0 : err = fd_bincode_uint64_decode( &data_len, ctx );
1110 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1111 0 : if( data_len ) {
1112 0 : *total_sz += 8UL + data_len;
1113 0 : err = fd_bincode_bytes_decode_footprint( data_len, ctx );
1114 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1115 0 : }
1116 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1117 0 : if( FD_UNLIKELY( err ) ) return err;
1118 0 : err = fd_bincode_bool_decode_footprint( ctx );
1119 0 : if( FD_UNLIKELY( err ) ) return err;
1120 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1121 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1122 0 : return 0;
1123 0 : }
1124 0 : int fd_solana_account_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1125 0 : *total_sz += sizeof(fd_solana_account_t);
1126 0 : void const * start_data = ctx->data;
1127 0 : int err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
1128 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1129 0 : ctx->data = start_data;
1130 0 : return err;
1131 0 : }
1132 0 : static void fd_solana_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1133 0 : fd_solana_account_t * self = (fd_solana_account_t *)struct_mem;
1134 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
1135 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
1136 0 : if( self->data_len ) {
1137 0 : self->data = *alloc_mem;
1138 0 : fd_bincode_bytes_decode_unsafe( self->data, self->data_len, ctx );
1139 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
1140 0 : } else
1141 0 : self->data = NULL;
1142 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
1143 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
1144 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
1145 0 : }
1146 0 : void * fd_solana_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1147 0 : fd_solana_account_t * self = (fd_solana_account_t *)mem;
1148 0 : fd_solana_account_new( self );
1149 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_t);
1150 0 : void * * alloc_mem = &alloc_region;
1151 0 : fd_solana_account_decode_inner( mem, alloc_mem, ctx );
1152 0 : return self;
1153 0 : }
1154 0 : static void fd_solana_account_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1155 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)struct_mem;
1156 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
1157 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
1158 0 : if( self->data_len ) {
1159 0 : self->data_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1160 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->data_len, ctx );
1161 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
1162 0 : } else {
1163 0 : self->data_offset = 0UL;
1164 0 : }
1165 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
1166 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
1167 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
1168 0 : }
1169 0 : void * fd_solana_account_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1170 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)mem;
1171 0 : fd_solana_account_new( (fd_solana_account_t *)self );
1172 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_global_t);
1173 0 : void * * alloc_mem = &alloc_region;
1174 0 : fd_solana_account_decode_inner_global( mem, alloc_mem, ctx );
1175 0 : return self;
1176 0 : }
1177 0 : void fd_solana_account_new(fd_solana_account_t * self) {
1178 0 : fd_memset( self, 0, sizeof(fd_solana_account_t) );
1179 0 : fd_pubkey_new( &self->owner );
1180 0 : }
1181 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, uint varint ) {
1182 0 : (void) varint;
1183 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account", level++, 0 );
1184 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1185 0 : if( self->data_len ) {
1186 0 : fun( w, NULL, "data", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
1187 0 : for( ulong i=0; i < self->data_len; i++ )
1188 0 : fun( w, self->data + i, "data", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1189 0 : fun( w, NULL, "data", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
1190 0 : }
1191 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
1192 0 : fun( w, &self->executable, "executable", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
1193 0 : fun( w, &self->rent_epoch, "rent_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1194 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account", level--, 0 );
1195 0 : }
1196 0 : ulong fd_solana_account_size( fd_solana_account_t const * self ) {
1197 0 : ulong size = 0;
1198 0 : size += sizeof(ulong);
1199 0 : do {
1200 0 : size += sizeof(ulong);
1201 0 : size += self->data_len;
1202 0 : } while(0);
1203 0 : size += fd_pubkey_size( &self->owner );
1204 0 : size += sizeof(char);
1205 0 : size += sizeof(ulong);
1206 0 : return size;
1207 0 : }
1208 :
1209 0 : ulong fd_solana_account_size_global( fd_solana_account_global_t const * self ) {
1210 0 : ulong size = 0;
1211 0 : size += sizeof(ulong);
1212 0 : do {
1213 0 : size += sizeof(ulong);
1214 0 : uchar * data = self->data_offset ? (uchar *)fd_type_pun( (uchar *)self + self->data_offset ) : NULL;
1215 0 : size += self->data_len;
1216 0 : } while(0);
1217 0 : size += fd_pubkey_size( &self->owner );
1218 0 : size += sizeof(char);
1219 0 : size += sizeof(ulong);
1220 0 : return size;
1221 0 : }
1222 :
1223 0 : int fd_solana_account_stored_meta_encode( fd_solana_account_stored_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1224 0 : int err;
1225 0 : err = fd_bincode_uint64_encode( self->write_version_obsolete, ctx );
1226 0 : if( FD_UNLIKELY( err ) ) return err;
1227 0 : err = fd_bincode_uint64_encode( self->data_len, ctx );
1228 0 : if( FD_UNLIKELY( err ) ) return err;
1229 0 : err = fd_bincode_bytes_encode( self->pubkey, sizeof(self->pubkey), ctx );
1230 0 : if( FD_UNLIKELY( err ) ) return err;
1231 0 : return FD_BINCODE_SUCCESS;
1232 0 : }
1233 0 : static inline int fd_solana_account_stored_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1234 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1235 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
1236 0 : return 0;
1237 0 : }
1238 0 : static void fd_solana_account_stored_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1239 0 : fd_solana_account_stored_meta_t * self = (fd_solana_account_stored_meta_t *)struct_mem;
1240 0 : fd_bincode_uint64_decode_unsafe( &self->write_version_obsolete, ctx );
1241 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
1242 0 : fd_bincode_bytes_decode_unsafe( &self->pubkey[0], sizeof(self->pubkey), ctx );
1243 0 : }
1244 0 : void * fd_solana_account_stored_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1245 0 : fd_solana_account_stored_meta_t * self = (fd_solana_account_stored_meta_t *)mem;
1246 0 : fd_solana_account_stored_meta_new( self );
1247 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_stored_meta_t);
1248 0 : void * * alloc_mem = &alloc_region;
1249 0 : fd_solana_account_stored_meta_decode_inner( mem, alloc_mem, ctx );
1250 0 : return self;
1251 0 : }
1252 0 : void fd_solana_account_stored_meta_walk( void * w, fd_solana_account_stored_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1253 0 : (void) varint;
1254 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account_stored_meta", level++, 0 );
1255 0 : fun( w, &self->write_version_obsolete, "write_version_obsolete", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1256 0 : fun( w, &self->data_len, "data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1257 0 : fun( w, self->pubkey, "pubkey", FD_FLAMENCO_TYPE_HASH256, "uchar[32]", level, 0 );
1258 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account_stored_meta", level--, 0 );
1259 0 : }
1260 0 : int fd_solana_account_meta_encode( fd_solana_account_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1261 0 : int err;
1262 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
1263 0 : if( FD_UNLIKELY( err ) ) return err;
1264 0 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
1265 0 : if( FD_UNLIKELY( err ) ) return err;
1266 0 : err = fd_bincode_bytes_encode( self->owner, sizeof(self->owner), ctx );
1267 0 : if( FD_UNLIKELY( err ) ) return err;
1268 0 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
1269 0 : if( FD_UNLIKELY( err ) ) return err;
1270 0 : err = fd_bincode_bytes_encode( self->padding, 3, ctx );
1271 0 : if( FD_UNLIKELY( err ) ) return err;
1272 0 : return FD_BINCODE_SUCCESS;
1273 0 : }
1274 0 : static int fd_solana_account_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1275 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1276 0 : int err = 0;
1277 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1278 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1279 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1280 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1281 0 : err = fd_bincode_bytes_decode_footprint( 32, ctx );
1282 0 : if( FD_UNLIKELY( err ) ) return err;
1283 0 : err = fd_bincode_bool_decode_footprint( ctx );
1284 0 : if( FD_UNLIKELY( err ) ) return err;
1285 0 : err = fd_bincode_bytes_decode_footprint( 3, ctx );
1286 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1287 0 : return 0;
1288 0 : }
1289 0 : int fd_solana_account_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1290 0 : *total_sz += sizeof(fd_solana_account_meta_t);
1291 0 : void const * start_data = ctx->data;
1292 0 : int err = fd_solana_account_meta_decode_footprint_inner( ctx, total_sz );
1293 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1294 0 : ctx->data = start_data;
1295 0 : return err;
1296 0 : }
1297 0 : static void fd_solana_account_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1298 0 : fd_solana_account_meta_t * self = (fd_solana_account_meta_t *)struct_mem;
1299 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
1300 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
1301 0 : fd_bincode_bytes_decode_unsafe( &self->owner[0], sizeof(self->owner), ctx );
1302 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
1303 0 : fd_bincode_bytes_decode_unsafe( self->padding, 3, ctx );
1304 0 : }
1305 0 : void * fd_solana_account_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1306 0 : fd_solana_account_meta_t * self = (fd_solana_account_meta_t *)mem;
1307 0 : fd_solana_account_meta_new( self );
1308 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_meta_t);
1309 0 : void * * alloc_mem = &alloc_region;
1310 0 : fd_solana_account_meta_decode_inner( mem, alloc_mem, ctx );
1311 0 : return self;
1312 0 : }
1313 0 : void fd_solana_account_meta_new(fd_solana_account_meta_t * self) {
1314 0 : fd_memset( self, 0, sizeof(fd_solana_account_meta_t) );
1315 0 : }
1316 0 : void fd_solana_account_meta_walk( void * w, fd_solana_account_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1317 0 : (void) varint;
1318 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account_meta", level++, 0 );
1319 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1320 0 : fun( w, &self->rent_epoch, "rent_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1321 0 : fun( w, self->owner, "owner", FD_FLAMENCO_TYPE_HASH256, "uchar[32]", level, 0 );
1322 0 : fun( w, &self->executable, "executable", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
1323 0 : fun(w, self->padding, "padding", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1324 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account_meta", level--, 0 );
1325 0 : }
1326 0 : int fd_solana_account_hdr_encode( fd_solana_account_hdr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1327 0 : int err;
1328 0 : err = fd_solana_account_stored_meta_encode( &self->meta, ctx );
1329 0 : if( FD_UNLIKELY( err ) ) return err;
1330 0 : err = fd_solana_account_meta_encode( &self->info, ctx );
1331 0 : if( FD_UNLIKELY( err ) ) return err;
1332 0 : err = fd_bincode_bytes_encode( self->padding, 4, ctx );
1333 0 : if( FD_UNLIKELY( err ) ) return err;
1334 0 : err = fd_hash_encode( &self->hash, ctx );
1335 0 : if( FD_UNLIKELY( err ) ) return err;
1336 0 : return FD_BINCODE_SUCCESS;
1337 0 : }
1338 0 : static int fd_solana_account_hdr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1339 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1340 0 : int err = 0;
1341 0 : err = fd_solana_account_stored_meta_decode_footprint_inner( ctx, total_sz );
1342 0 : if( FD_UNLIKELY( err ) ) return err;
1343 0 : err = fd_solana_account_meta_decode_footprint_inner( ctx, total_sz );
1344 0 : if( FD_UNLIKELY( err ) ) return err;
1345 0 : err = fd_bincode_bytes_decode_footprint( 4, ctx );
1346 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1347 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
1348 0 : if( FD_UNLIKELY( err ) ) return err;
1349 0 : return 0;
1350 0 : }
1351 0 : int fd_solana_account_hdr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1352 0 : *total_sz += sizeof(fd_solana_account_hdr_t);
1353 0 : void const * start_data = ctx->data;
1354 0 : int err = fd_solana_account_hdr_decode_footprint_inner( ctx, total_sz );
1355 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1356 0 : ctx->data = start_data;
1357 0 : return err;
1358 0 : }
1359 0 : static void fd_solana_account_hdr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1360 0 : fd_solana_account_hdr_t * self = (fd_solana_account_hdr_t *)struct_mem;
1361 0 : fd_solana_account_stored_meta_decode_inner( &self->meta, alloc_mem, ctx );
1362 0 : fd_solana_account_meta_decode_inner( &self->info, alloc_mem, ctx );
1363 0 : fd_bincode_bytes_decode_unsafe( self->padding, 4, ctx );
1364 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
1365 0 : }
1366 0 : void * fd_solana_account_hdr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1367 0 : fd_solana_account_hdr_t * self = (fd_solana_account_hdr_t *)mem;
1368 0 : fd_solana_account_hdr_new( self );
1369 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_hdr_t);
1370 0 : void * * alloc_mem = &alloc_region;
1371 0 : fd_solana_account_hdr_decode_inner( mem, alloc_mem, ctx );
1372 0 : return self;
1373 0 : }
1374 0 : void fd_solana_account_hdr_new(fd_solana_account_hdr_t * self) {
1375 0 : fd_memset( self, 0, sizeof(fd_solana_account_hdr_t) );
1376 0 : fd_solana_account_stored_meta_new( &self->meta );
1377 0 : fd_solana_account_meta_new( &self->info );
1378 0 : fd_hash_new( &self->hash );
1379 0 : }
1380 0 : void fd_solana_account_hdr_walk( void * w, fd_solana_account_hdr_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1381 0 : (void) varint;
1382 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account_hdr", level++, 0 );
1383 0 : fd_solana_account_stored_meta_walk( w, &self->meta, fun, "meta", level, 0 );
1384 0 : fd_solana_account_meta_walk( w, &self->info, fun, "info", level, 0 );
1385 0 : fun(w, self->padding, "padding", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1386 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
1387 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account_hdr", level--, 0 );
1388 0 : }
1389 0 : int fd_account_meta_encode( fd_account_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1390 0 : int err;
1391 0 : err = fd_bincode_uint16_encode( self->magic, ctx );
1392 0 : if( FD_UNLIKELY( err ) ) return err;
1393 0 : err = fd_bincode_uint16_encode( self->hlen, ctx );
1394 0 : if( FD_UNLIKELY( err ) ) return err;
1395 0 : err = fd_bincode_uint64_encode( self->dlen, ctx );
1396 0 : if( FD_UNLIKELY( err ) ) return err;
1397 0 : err = fd_bincode_bytes_encode( self->hash, sizeof(self->hash), ctx );
1398 0 : if( FD_UNLIKELY( err ) ) return err;
1399 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1400 0 : if( FD_UNLIKELY( err ) ) return err;
1401 0 : err = fd_solana_account_meta_encode( &self->info, ctx );
1402 0 : if( FD_UNLIKELY( err ) ) return err;
1403 0 : return FD_BINCODE_SUCCESS;
1404 0 : }
1405 0 : static int fd_account_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1406 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1407 0 : int err = 0;
1408 0 : err = fd_bincode_uint16_decode_footprint( ctx );
1409 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1410 0 : err = fd_bincode_uint16_decode_footprint( ctx );
1411 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1412 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1413 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1414 0 : err = fd_bincode_bytes_decode_footprint( 32, ctx );
1415 0 : if( FD_UNLIKELY( err ) ) return err;
1416 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1417 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1418 0 : err = fd_solana_account_meta_decode_footprint_inner( ctx, total_sz );
1419 0 : if( FD_UNLIKELY( err ) ) return err;
1420 0 : return 0;
1421 0 : }
1422 0 : int fd_account_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1423 0 : *total_sz += sizeof(fd_account_meta_t);
1424 0 : void const * start_data = ctx->data;
1425 0 : int err = fd_account_meta_decode_footprint_inner( ctx, total_sz );
1426 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1427 0 : ctx->data = start_data;
1428 0 : return err;
1429 0 : }
1430 0 : static void fd_account_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1431 0 : fd_account_meta_t * self = (fd_account_meta_t *)struct_mem;
1432 0 : fd_bincode_uint16_decode_unsafe( &self->magic, ctx );
1433 0 : fd_bincode_uint16_decode_unsafe( &self->hlen, ctx );
1434 0 : fd_bincode_uint64_decode_unsafe( &self->dlen, ctx );
1435 0 : fd_bincode_bytes_decode_unsafe( &self->hash[0], sizeof(self->hash), ctx );
1436 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1437 0 : fd_solana_account_meta_decode_inner( &self->info, alloc_mem, ctx );
1438 0 : }
1439 0 : void * fd_account_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1440 0 : fd_account_meta_t * self = (fd_account_meta_t *)mem;
1441 0 : fd_account_meta_new( self );
1442 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_meta_t);
1443 0 : void * * alloc_mem = &alloc_region;
1444 0 : fd_account_meta_decode_inner( mem, alloc_mem, ctx );
1445 0 : return self;
1446 0 : }
1447 0 : void fd_account_meta_new(fd_account_meta_t * self) {
1448 0 : fd_memset( self, 0, sizeof(fd_account_meta_t) );
1449 0 : fd_solana_account_meta_new( &self->info );
1450 0 : }
1451 0 : void fd_account_meta_walk( void * w, fd_account_meta_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1452 0 : (void) varint;
1453 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_account_meta", level++, 0 );
1454 0 : fun( w, &self->magic, "magic", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
1455 0 : fun( w, &self->hlen, "hlen", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
1456 0 : fun( w, &self->dlen, "dlen", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1457 0 : fun( w, self->hash, "hash", FD_FLAMENCO_TYPE_HASH256, "uchar[32]", level, 0 );
1458 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1459 0 : fd_solana_account_meta_walk( w, &self->info, fun, "info", level, 0 );
1460 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_account_meta", level--, 0 );
1461 0 : }
1462 0 : int fd_vote_accounts_pair_encode( fd_vote_accounts_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1463 0 : int err;
1464 0 : err = fd_pubkey_encode( &self->key, ctx );
1465 0 : if( FD_UNLIKELY( err ) ) return err;
1466 0 : err = fd_bincode_uint64_encode( self->stake, ctx );
1467 0 : if( FD_UNLIKELY( err ) ) return err;
1468 0 : err = fd_solana_account_encode( &self->value, ctx );
1469 0 : if( FD_UNLIKELY( err ) ) return err;
1470 0 : return FD_BINCODE_SUCCESS;
1471 0 : }
1472 0 : int fd_vote_accounts_pair_encode_global( fd_vote_accounts_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1473 0 : int err;
1474 0 : err = fd_pubkey_encode( &self->key, ctx );
1475 0 : if( FD_UNLIKELY( err ) ) return err;
1476 0 : err = fd_bincode_uint64_encode( self->stake, ctx );
1477 0 : if( FD_UNLIKELY( err ) ) return err;
1478 0 : err = fd_solana_account_encode_global( &self->value, ctx );
1479 0 : if( FD_UNLIKELY( err ) ) return err;
1480 0 : return FD_BINCODE_SUCCESS;
1481 0 : }
1482 0 : static int fd_vote_accounts_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1483 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1484 0 : int err = 0;
1485 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1486 0 : if( FD_UNLIKELY( err ) ) return err;
1487 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1488 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1489 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
1490 0 : if( FD_UNLIKELY( err ) ) return err;
1491 0 : return 0;
1492 0 : }
1493 0 : int fd_vote_accounts_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1494 0 : *total_sz += sizeof(fd_vote_accounts_pair_t);
1495 0 : void const * start_data = ctx->data;
1496 0 : int err = fd_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
1497 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1498 0 : ctx->data = start_data;
1499 0 : return err;
1500 0 : }
1501 0 : static void fd_vote_accounts_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1502 0 : fd_vote_accounts_pair_t * self = (fd_vote_accounts_pair_t *)struct_mem;
1503 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1504 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
1505 0 : fd_solana_account_decode_inner( &self->value, alloc_mem, ctx );
1506 0 : }
1507 0 : void * fd_vote_accounts_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1508 0 : fd_vote_accounts_pair_t * self = (fd_vote_accounts_pair_t *)mem;
1509 0 : fd_vote_accounts_pair_new( self );
1510 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_accounts_pair_t);
1511 0 : void * * alloc_mem = &alloc_region;
1512 0 : fd_vote_accounts_pair_decode_inner( mem, alloc_mem, ctx );
1513 0 : return self;
1514 0 : }
1515 0 : static void fd_vote_accounts_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1516 0 : fd_vote_accounts_pair_global_t * self = (fd_vote_accounts_pair_global_t *)struct_mem;
1517 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1518 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
1519 0 : fd_solana_account_decode_inner_global( &self->value, alloc_mem, ctx );
1520 0 : }
1521 0 : void * fd_vote_accounts_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1522 0 : fd_vote_accounts_pair_global_t * self = (fd_vote_accounts_pair_global_t *)mem;
1523 0 : fd_vote_accounts_pair_new( (fd_vote_accounts_pair_t *)self );
1524 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_accounts_pair_global_t);
1525 0 : void * * alloc_mem = &alloc_region;
1526 0 : fd_vote_accounts_pair_decode_inner_global( mem, alloc_mem, ctx );
1527 0 : return self;
1528 0 : }
1529 0 : void fd_vote_accounts_pair_new(fd_vote_accounts_pair_t * self) {
1530 0 : fd_memset( self, 0, sizeof(fd_vote_accounts_pair_t) );
1531 0 : fd_pubkey_new( &self->key );
1532 0 : fd_solana_account_new( &self->value );
1533 0 : }
1534 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, uint varint ) {
1535 0 : (void) varint;
1536 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_accounts_pair", level++, 0 );
1537 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
1538 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1539 0 : fd_solana_account_walk( w, &self->value, fun, "value", level, 0 );
1540 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_accounts_pair", level--, 0 );
1541 0 : }
1542 0 : ulong fd_vote_accounts_pair_size( fd_vote_accounts_pair_t const * self ) {
1543 0 : ulong size = 0;
1544 0 : size += fd_pubkey_size( &self->key );
1545 0 : size += sizeof(ulong);
1546 0 : size += fd_solana_account_size( &self->value );
1547 0 : return size;
1548 0 : }
1549 :
1550 0 : ulong fd_vote_accounts_pair_size_global( fd_vote_accounts_pair_global_t const * self ) {
1551 0 : ulong size = 0;
1552 0 : size += fd_pubkey_size( &self->key );
1553 0 : size += sizeof(ulong);
1554 0 : size += fd_solana_account_size_global( &self->value );
1555 0 : return size;
1556 0 : }
1557 :
1558 0 : int fd_vote_accounts_encode( fd_vote_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1559 0 : int err;
1560 0 : if( self->vote_accounts_root ) {
1561 0 : ulong vote_accounts_len = fd_vote_accounts_pair_t_map_size( self->vote_accounts_pool, self->vote_accounts_root );
1562 0 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
1563 0 : if( FD_UNLIKELY( err ) ) return err;
1564 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 ) ) {
1565 0 : err = fd_vote_accounts_pair_encode( &n->elem, ctx );
1566 0 : if( FD_UNLIKELY( err ) ) return err;
1567 0 : }
1568 0 : } else {
1569 0 : ulong vote_accounts_len = 0;
1570 0 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
1571 0 : if( FD_UNLIKELY( err ) ) return err;
1572 0 : }
1573 0 : return FD_BINCODE_SUCCESS;
1574 0 : }
1575 0 : int fd_vote_accounts_encode_global( fd_vote_accounts_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1576 0 : int err;
1577 0 : fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_root = fd_vote_accounts_pair_global_t_map_join( (uchar *)self + self->vote_accounts_root_offset );
1578 0 : fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_pool = fd_vote_accounts_pair_global_t_map_join( (uchar *)self + self->vote_accounts_pool_offset );
1579 0 : if( vote_accounts_root ) {
1580 0 : ulong vote_accounts_len = fd_vote_accounts_pair_global_t_map_size( vote_accounts_pool, vote_accounts_root );
1581 0 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
1582 0 : if( FD_UNLIKELY( err ) ) return err;
1583 0 : for( fd_vote_accounts_pair_global_t_mapnode_t * n = fd_vote_accounts_pair_global_t_map_minimum( vote_accounts_pool, vote_accounts_root ); n; n = fd_vote_accounts_pair_global_t_map_successor( vote_accounts_pool, n ) ) {
1584 0 : err = fd_vote_accounts_pair_encode_global( &n->elem, ctx );
1585 0 : if( FD_UNLIKELY( err ) ) return err;
1586 0 : }
1587 0 : } else {
1588 0 : ulong vote_accounts_len = 0;
1589 0 : err = fd_bincode_uint64_encode( vote_accounts_len, ctx );
1590 0 : if( FD_UNLIKELY( err ) ) return err;
1591 0 : }
1592 0 : return FD_BINCODE_SUCCESS;
1593 0 : }
1594 0 : static int fd_vote_accounts_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1595 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1596 0 : int err = 0;
1597 0 : ulong vote_accounts_len = 0UL;
1598 0 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
1599 0 : ulong vote_accounts_cnt = fd_ulong_max( vote_accounts_len, 50000 );
1600 0 : *total_sz += fd_vote_accounts_pair_t_map_align() + fd_vote_accounts_pair_t_map_footprint( vote_accounts_cnt );
1601 0 : if( FD_UNLIKELY( err ) ) return err;
1602 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
1603 0 : err = fd_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
1604 0 : if( FD_UNLIKELY( err ) ) return err;
1605 0 : }
1606 0 : return 0;
1607 0 : }
1608 0 : int fd_vote_accounts_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1609 0 : *total_sz += sizeof(fd_vote_accounts_t);
1610 0 : void const * start_data = ctx->data;
1611 0 : int err = fd_vote_accounts_decode_footprint_inner( ctx, total_sz );
1612 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1613 0 : ctx->data = start_data;
1614 0 : return err;
1615 0 : }
1616 0 : void * fd_vote_accounts_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1617 0 : fd_vote_accounts_t * self = (fd_vote_accounts_t *)mem;
1618 0 : fd_vote_accounts_new( self );
1619 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_accounts_t);
1620 0 : void * * alloc_mem = &alloc_region;
1621 0 : fd_vote_accounts_decode_inner( mem, alloc_mem, ctx );
1622 0 : return self;
1623 0 : }
1624 0 : void * fd_vote_accounts_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1625 0 : fd_vote_accounts_global_t * self = (fd_vote_accounts_global_t *)mem;
1626 0 : fd_vote_accounts_new( (fd_vote_accounts_t *)self );
1627 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_accounts_global_t);
1628 0 : void * * alloc_mem = &alloc_region;
1629 0 : fd_vote_accounts_decode_inner_global( mem, alloc_mem, ctx );
1630 0 : return self;
1631 0 : }
1632 0 : void fd_vote_accounts_new(fd_vote_accounts_t * self) {
1633 0 : fd_memset( self, 0, sizeof(fd_vote_accounts_t) );
1634 0 : }
1635 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, uint varint ) {
1636 0 : (void) varint;
1637 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_accounts", level++, 0 );
1638 0 : if( self->vote_accounts_root ) {
1639 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 ) ) {
1640 0 : fd_vote_accounts_pair_walk(w, &n->elem, fun, "vote_accounts", level, 0 );
1641 0 : }
1642 0 : }
1643 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_accounts", level--, 0 );
1644 0 : }
1645 0 : ulong fd_vote_accounts_size( fd_vote_accounts_t const * self ) {
1646 0 : ulong size = 0;
1647 0 : if( self->vote_accounts_root ) {
1648 0 : size += sizeof(ulong);
1649 0 : ulong max = fd_vote_accounts_pair_t_map_max( self->vote_accounts_pool );
1650 0 : size += fd_vote_accounts_pair_t_map_footprint( max );
1651 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 ) ) {
1652 0 : size += fd_vote_accounts_pair_size( &n->elem ) - sizeof(fd_vote_accounts_pair_t);
1653 0 : }
1654 0 : } else {
1655 0 : size += sizeof(ulong);
1656 0 : }
1657 0 : return size;
1658 0 : }
1659 :
1660 0 : ulong fd_vote_accounts_size_global( fd_vote_accounts_global_t const * self ) {
1661 0 : ulong size = 0;
1662 0 : fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_pool = !!self->vote_accounts_pool_offset ? (fd_vote_accounts_pair_global_t_mapnode_t *)fd_vote_accounts_pair_global_t_map_join( fd_type_pun( (uchar *)self + self->vote_accounts_pool_offset ) ) : NULL;
1663 0 : fd_vote_accounts_pair_global_t_mapnode_t * vote_accounts_root = !!self->vote_accounts_root_offset ? (fd_vote_accounts_pair_global_t_mapnode_t *)fd_type_pun( (uchar *)self + self->vote_accounts_root_offset ) : NULL;
1664 0 : if( vote_accounts_root ) {
1665 0 : size += sizeof(ulong);
1666 0 : ulong max = fd_vote_accounts_pair_global_t_map_max( vote_accounts_pool );
1667 0 : size += fd_vote_accounts_pair_global_t_map_footprint( max );
1668 0 : for( fd_vote_accounts_pair_global_t_mapnode_t * n = fd_vote_accounts_pair_global_t_map_minimum( vote_accounts_pool, vote_accounts_root ); n; n = fd_vote_accounts_pair_global_t_map_successor( vote_accounts_pool, n ) ) {
1669 0 : size += fd_vote_accounts_pair_size_global( &n->elem ) - sizeof(fd_vote_accounts_pair_t);
1670 0 : }
1671 0 : } else {
1672 0 : size += sizeof(ulong);
1673 0 : }
1674 0 : return size;
1675 0 : }
1676 :
1677 0 : int fd_account_keys_pair_encode( fd_account_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1678 0 : int err;
1679 0 : err = fd_pubkey_encode( &self->key, ctx );
1680 0 : if( FD_UNLIKELY( err ) ) return err;
1681 0 : err = fd_bincode_uint8_encode( (uchar)(self->exists), ctx );
1682 0 : if( FD_UNLIKELY( err ) ) return err;
1683 0 : return FD_BINCODE_SUCCESS;
1684 0 : }
1685 0 : static inline int fd_account_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1686 0 : if( (ulong)ctx->data + 33UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1687 0 : ctx->data = (void *)( (ulong)ctx->data + 33UL );
1688 0 : return 0;
1689 0 : }
1690 0 : static void fd_account_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1691 0 : fd_account_keys_pair_t * self = (fd_account_keys_pair_t *)struct_mem;
1692 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1693 0 : fd_bincode_uint8_decode_unsafe( &self->exists, ctx );
1694 0 : }
1695 0 : void * fd_account_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1696 0 : fd_account_keys_pair_t * self = (fd_account_keys_pair_t *)mem;
1697 0 : fd_account_keys_pair_new( self );
1698 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_keys_pair_t);
1699 0 : void * * alloc_mem = &alloc_region;
1700 0 : fd_account_keys_pair_decode_inner( mem, alloc_mem, ctx );
1701 0 : return self;
1702 0 : }
1703 0 : void fd_account_keys_pair_walk( void * w, fd_account_keys_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1704 0 : (void) varint;
1705 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_account_keys_pair", level++, 0 );
1706 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
1707 0 : fun( w, &self->exists, "exists", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1708 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_account_keys_pair", level--, 0 );
1709 0 : }
1710 0 : int fd_account_keys_encode( fd_account_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1711 0 : int err;
1712 0 : if( self->account_keys_root ) {
1713 0 : ulong account_keys_len = fd_account_keys_pair_t_map_size( self->account_keys_pool, self->account_keys_root );
1714 0 : err = fd_bincode_uint64_encode( account_keys_len, ctx );
1715 0 : if( FD_UNLIKELY( err ) ) return err;
1716 0 : for( fd_account_keys_pair_t_mapnode_t * n = fd_account_keys_pair_t_map_minimum( self->account_keys_pool, self->account_keys_root ); n; n = fd_account_keys_pair_t_map_successor( self->account_keys_pool, n ) ) {
1717 0 : err = fd_account_keys_pair_encode( &n->elem, ctx );
1718 0 : if( FD_UNLIKELY( err ) ) return err;
1719 0 : }
1720 0 : } else {
1721 0 : ulong account_keys_len = 0;
1722 0 : err = fd_bincode_uint64_encode( account_keys_len, ctx );
1723 0 : if( FD_UNLIKELY( err ) ) return err;
1724 0 : }
1725 0 : return FD_BINCODE_SUCCESS;
1726 0 : }
1727 0 : int fd_account_keys_encode_global( fd_account_keys_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1728 0 : int err;
1729 0 : fd_account_keys_pair_t_mapnode_t * account_keys_root = fd_account_keys_pair_t_map_join( (uchar *)self + self->account_keys_root_offset );
1730 0 : fd_account_keys_pair_t_mapnode_t * account_keys_pool = fd_account_keys_pair_t_map_join( (uchar *)self + self->account_keys_pool_offset );
1731 0 : if( account_keys_root ) {
1732 0 : ulong account_keys_len = fd_account_keys_pair_t_map_size( account_keys_pool, account_keys_root );
1733 0 : err = fd_bincode_uint64_encode( account_keys_len, ctx );
1734 0 : if( FD_UNLIKELY( err ) ) return err;
1735 0 : for( fd_account_keys_pair_t_mapnode_t * n = fd_account_keys_pair_t_map_minimum( account_keys_pool, account_keys_root ); n; n = fd_account_keys_pair_t_map_successor( account_keys_pool, n ) ) {
1736 0 : err = fd_account_keys_pair_encode( &n->elem, ctx );
1737 0 : if( FD_UNLIKELY( err ) ) return err;
1738 0 : }
1739 0 : } else {
1740 0 : ulong account_keys_len = 0;
1741 0 : err = fd_bincode_uint64_encode( account_keys_len, ctx );
1742 0 : if( FD_UNLIKELY( err ) ) return err;
1743 0 : }
1744 0 : return FD_BINCODE_SUCCESS;
1745 0 : }
1746 0 : static int fd_account_keys_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1747 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1748 0 : int err = 0;
1749 0 : ulong account_keys_len = 0UL;
1750 0 : err = fd_bincode_uint64_decode( &account_keys_len, ctx );
1751 0 : ulong account_keys_cnt = fd_ulong_max( account_keys_len, 100000 );
1752 0 : *total_sz += fd_account_keys_pair_t_map_align() + fd_account_keys_pair_t_map_footprint( account_keys_cnt );
1753 0 : if( FD_UNLIKELY( err ) ) return err;
1754 0 : for( ulong i=0; i < account_keys_len; i++ ) {
1755 0 : err = fd_account_keys_pair_decode_footprint_inner( ctx, total_sz );
1756 0 : if( FD_UNLIKELY( err ) ) return err;
1757 0 : }
1758 0 : return 0;
1759 0 : }
1760 0 : int fd_account_keys_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1761 0 : *total_sz += sizeof(fd_account_keys_t);
1762 0 : void const * start_data = ctx->data;
1763 0 : int err = fd_account_keys_decode_footprint_inner( ctx, total_sz );
1764 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1765 0 : ctx->data = start_data;
1766 0 : return err;
1767 0 : }
1768 0 : static void fd_account_keys_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1769 0 : fd_account_keys_t * self = (fd_account_keys_t *)struct_mem;
1770 0 : ulong account_keys_len;
1771 0 : fd_bincode_uint64_decode_unsafe( &account_keys_len, ctx );
1772 0 : self->account_keys_pool = fd_account_keys_pair_t_map_join_new( alloc_mem, fd_ulong_max( account_keys_len, 100000 ) );
1773 0 : self->account_keys_root = NULL;
1774 0 : for( ulong i=0; i < account_keys_len; i++ ) {
1775 0 : fd_account_keys_pair_t_mapnode_t * node = fd_account_keys_pair_t_map_acquire( self->account_keys_pool );
1776 0 : fd_account_keys_pair_new( &node->elem );
1777 0 : fd_account_keys_pair_decode_inner( &node->elem, alloc_mem, ctx );
1778 0 : fd_account_keys_pair_t_mapnode_t * out = NULL;;
1779 0 : fd_account_keys_pair_t_map_insert_or_replace( self->account_keys_pool, &self->account_keys_root, node, &out );
1780 0 : if( out != NULL ) {
1781 0 : fd_account_keys_pair_t_map_release( self->account_keys_pool, out );
1782 0 : }
1783 0 : }
1784 0 : }
1785 0 : void * fd_account_keys_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1786 0 : fd_account_keys_t * self = (fd_account_keys_t *)mem;
1787 0 : fd_account_keys_new( self );
1788 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_keys_t);
1789 0 : void * * alloc_mem = &alloc_region;
1790 0 : fd_account_keys_decode_inner( mem, alloc_mem, ctx );
1791 0 : return self;
1792 0 : }
1793 0 : static void fd_account_keys_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1794 0 : fd_account_keys_global_t * self = (fd_account_keys_global_t *)struct_mem;
1795 0 : ulong account_keys_len;
1796 0 : fd_bincode_uint64_decode_unsafe( &account_keys_len, ctx );
1797 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_account_keys_pair_t_map_align() );
1798 0 : fd_account_keys_pair_t_mapnode_t * account_keys_pool = fd_account_keys_pair_t_map_join_new( alloc_mem, fd_ulong_max( account_keys_len, 100000 ) );
1799 0 : fd_account_keys_pair_t_mapnode_t * account_keys_root = NULL;
1800 0 : for( ulong i=0; i < account_keys_len; i++ ) {
1801 0 : fd_account_keys_pair_t_mapnode_t * node = fd_account_keys_pair_t_map_acquire( account_keys_pool );
1802 0 : fd_account_keys_pair_new( (fd_account_keys_pair_t *)fd_type_pun(&node->elem) );
1803 0 : fd_account_keys_pair_decode_inner( &node->elem, alloc_mem, ctx );
1804 0 : fd_account_keys_pair_t_map_insert( account_keys_pool, &account_keys_root, node );
1805 0 : }
1806 0 : self->account_keys_pool_offset = (ulong)fd_account_keys_pair_t_map_leave( account_keys_pool ) - (ulong)struct_mem;
1807 0 : self->account_keys_root_offset = (ulong)account_keys_root - (ulong)struct_mem;
1808 0 : }
1809 0 : void * fd_account_keys_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1810 0 : fd_account_keys_global_t * self = (fd_account_keys_global_t *)mem;
1811 0 : fd_account_keys_new( (fd_account_keys_t *)self );
1812 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_keys_global_t);
1813 0 : void * * alloc_mem = &alloc_region;
1814 0 : fd_account_keys_decode_inner_global( mem, alloc_mem, ctx );
1815 0 : return self;
1816 0 : }
1817 0 : void fd_account_keys_new(fd_account_keys_t * self) {
1818 0 : fd_memset( self, 0, sizeof(fd_account_keys_t) );
1819 0 : }
1820 0 : void fd_account_keys_walk( void * w, fd_account_keys_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1821 0 : (void) varint;
1822 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_account_keys", level++, 0 );
1823 0 : if( self->account_keys_root ) {
1824 0 : for( fd_account_keys_pair_t_mapnode_t * n = fd_account_keys_pair_t_map_minimum(self->account_keys_pool, self->account_keys_root ); n; n = fd_account_keys_pair_t_map_successor( self->account_keys_pool, n ) ) {
1825 0 : fd_account_keys_pair_walk(w, &n->elem, fun, "account_keys", level, 0 );
1826 0 : }
1827 0 : }
1828 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_account_keys", level--, 0 );
1829 0 : }
1830 0 : ulong fd_account_keys_size( fd_account_keys_t const * self ) {
1831 0 : ulong size = 0;
1832 0 : if( self->account_keys_root ) {
1833 0 : size += sizeof(ulong);
1834 0 : ulong max = fd_account_keys_pair_t_map_max( self->account_keys_pool );
1835 0 : size += fd_account_keys_pair_t_map_footprint( max );
1836 0 : for( fd_account_keys_pair_t_mapnode_t * n = fd_account_keys_pair_t_map_minimum( self->account_keys_pool, self->account_keys_root ); n; n = fd_account_keys_pair_t_map_successor( self->account_keys_pool, n ) ) {
1837 0 : size += fd_account_keys_pair_size( &n->elem ) - sizeof(fd_account_keys_pair_t);
1838 0 : }
1839 0 : } else {
1840 0 : size += sizeof(ulong);
1841 0 : }
1842 0 : return size;
1843 0 : }
1844 :
1845 0 : ulong fd_account_keys_size_global( fd_account_keys_global_t const * self ) {
1846 0 : ulong size = 0;
1847 0 : fd_account_keys_pair_t_mapnode_t * account_keys_pool = !!self->account_keys_pool_offset ? (fd_account_keys_pair_t_mapnode_t *)fd_account_keys_pair_t_map_join( fd_type_pun( (uchar *)self + self->account_keys_pool_offset ) ) : NULL;
1848 0 : fd_account_keys_pair_t_mapnode_t * account_keys_root = !!self->account_keys_root_offset ? (fd_account_keys_pair_t_mapnode_t *)fd_type_pun( (uchar *)self + self->account_keys_root_offset ) : NULL;
1849 0 : if( account_keys_root ) {
1850 0 : size += sizeof(ulong);
1851 0 : ulong max = fd_account_keys_pair_t_map_max( account_keys_pool );
1852 0 : size += fd_account_keys_pair_t_map_footprint( max );
1853 0 : for( fd_account_keys_pair_t_mapnode_t * n = fd_account_keys_pair_t_map_minimum( account_keys_pool, account_keys_root ); n; n = fd_account_keys_pair_t_map_successor( account_keys_pool, n ) ) {
1854 0 : size += fd_account_keys_pair_size( &n->elem ) - sizeof(fd_account_keys_pair_t);
1855 0 : }
1856 0 : } else {
1857 0 : size += sizeof(ulong);
1858 0 : }
1859 0 : return size;
1860 0 : }
1861 :
1862 12 : int fd_delegation_encode( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1863 12 : int err;
1864 12 : err = fd_pubkey_encode( &self->voter_pubkey, ctx );
1865 12 : if( FD_UNLIKELY( err ) ) return err;
1866 12 : err = fd_bincode_uint64_encode( self->stake, ctx );
1867 12 : if( FD_UNLIKELY( err ) ) return err;
1868 12 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
1869 12 : if( FD_UNLIKELY( err ) ) return err;
1870 12 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
1871 12 : if( FD_UNLIKELY( err ) ) return err;
1872 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
1873 12 : if( FD_UNLIKELY( err ) ) return err;
1874 12 : return FD_BINCODE_SUCCESS;
1875 12 : }
1876 0 : static inline int fd_delegation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1877 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1878 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
1879 0 : return 0;
1880 0 : }
1881 0 : static void fd_delegation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1882 0 : fd_delegation_t * self = (fd_delegation_t *)struct_mem;
1883 0 : fd_pubkey_decode_inner( &self->voter_pubkey, alloc_mem, ctx );
1884 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
1885 0 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
1886 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
1887 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
1888 0 : }
1889 0 : void * fd_delegation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1890 0 : fd_delegation_t * self = (fd_delegation_t *)mem;
1891 0 : fd_delegation_new( self );
1892 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_t);
1893 0 : void * * alloc_mem = &alloc_region;
1894 0 : fd_delegation_decode_inner( mem, alloc_mem, ctx );
1895 0 : return self;
1896 0 : }
1897 0 : void fd_delegation_walk( void * w, fd_delegation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1898 0 : (void) varint;
1899 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_delegation", level++, 0 );
1900 0 : fd_pubkey_walk( w, &self->voter_pubkey, fun, "voter_pubkey", level, 0 );
1901 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1902 0 : fun( w, &self->activation_epoch, "activation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1903 0 : fun( w, &self->deactivation_epoch, "deactivation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1904 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
1905 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_delegation", level--, 0 );
1906 0 : }
1907 0 : int fd_delegation_pair_encode( fd_delegation_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1908 0 : int err;
1909 0 : err = fd_pubkey_encode( &self->account, ctx );
1910 0 : if( FD_UNLIKELY( err ) ) return err;
1911 0 : err = fd_delegation_encode( &self->delegation, ctx );
1912 0 : if( FD_UNLIKELY( err ) ) return err;
1913 0 : return FD_BINCODE_SUCCESS;
1914 0 : }
1915 0 : static inline int fd_delegation_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1916 0 : if( (ulong)ctx->data + 96UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1917 0 : ctx->data = (void *)( (ulong)ctx->data + 96UL );
1918 0 : return 0;
1919 0 : }
1920 0 : static void fd_delegation_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1921 0 : fd_delegation_pair_t * self = (fd_delegation_pair_t *)struct_mem;
1922 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
1923 0 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
1924 0 : }
1925 0 : void * fd_delegation_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1926 0 : fd_delegation_pair_t * self = (fd_delegation_pair_t *)mem;
1927 0 : fd_delegation_pair_new( self );
1928 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_pair_t);
1929 0 : void * * alloc_mem = &alloc_region;
1930 0 : fd_delegation_pair_decode_inner( mem, alloc_mem, ctx );
1931 0 : return self;
1932 0 : }
1933 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, uint varint ) {
1934 0 : (void) varint;
1935 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_delegation_pair", level++, 0 );
1936 0 : fd_pubkey_walk( w, &self->account, fun, "account", level, 0 );
1937 0 : fd_delegation_walk( w, &self->delegation, fun, "delegation", level, 0 );
1938 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_delegation_pair", level--, 0 );
1939 0 : }
1940 12 : int fd_stake_encode( fd_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1941 12 : int err;
1942 12 : err = fd_delegation_encode( &self->delegation, ctx );
1943 12 : if( FD_UNLIKELY( err ) ) return err;
1944 12 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
1945 12 : if( FD_UNLIKELY( err ) ) return err;
1946 12 : return FD_BINCODE_SUCCESS;
1947 12 : }
1948 0 : static inline int fd_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1949 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1950 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
1951 0 : return 0;
1952 0 : }
1953 0 : static void fd_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1954 0 : fd_stake_t * self = (fd_stake_t *)struct_mem;
1955 0 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
1956 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
1957 0 : }
1958 0 : void * fd_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1959 0 : fd_stake_t * self = (fd_stake_t *)mem;
1960 0 : fd_stake_new( self );
1961 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_t);
1962 0 : void * * alloc_mem = &alloc_region;
1963 0 : fd_stake_decode_inner( mem, alloc_mem, ctx );
1964 0 : return self;
1965 0 : }
1966 0 : void fd_stake_walk( void * w, fd_stake_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
1967 0 : (void) varint;
1968 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake", level++, 0 );
1969 0 : fd_delegation_walk( w, &self->delegation, fun, "delegation", level, 0 );
1970 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1971 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake", level--, 0 );
1972 0 : }
1973 0 : int fd_stake_pair_encode( fd_stake_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1974 0 : int err;
1975 0 : err = fd_pubkey_encode( &self->account, ctx );
1976 0 : if( FD_UNLIKELY( err ) ) return err;
1977 0 : err = fd_stake_encode( &self->stake, ctx );
1978 0 : if( FD_UNLIKELY( err ) ) return err;
1979 0 : return FD_BINCODE_SUCCESS;
1980 0 : }
1981 0 : static inline int fd_stake_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1982 0 : if( (ulong)ctx->data + 104UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1983 0 : ctx->data = (void *)( (ulong)ctx->data + 104UL );
1984 0 : return 0;
1985 0 : }
1986 0 : static void fd_stake_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1987 0 : fd_stake_pair_t * self = (fd_stake_pair_t *)struct_mem;
1988 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
1989 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
1990 0 : }
1991 0 : void * fd_stake_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1992 0 : fd_stake_pair_t * self = (fd_stake_pair_t *)mem;
1993 0 : fd_stake_pair_new( self );
1994 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_pair_t);
1995 0 : void * * alloc_mem = &alloc_region;
1996 0 : fd_stake_pair_decode_inner( mem, alloc_mem, ctx );
1997 0 : return self;
1998 0 : }
1999 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, uint varint ) {
2000 0 : (void) varint;
2001 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_pair", level++, 0 );
2002 0 : fd_pubkey_walk( w, &self->account, fun, "account", level, 0 );
2003 0 : fd_stake_walk( w, &self->stake, fun, "stake", level, 0 );
2004 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_pair", level--, 0 );
2005 0 : }
2006 0 : int fd_stakes_encode( fd_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2007 0 : int err;
2008 0 : err = fd_vote_accounts_encode( &self->vote_accounts, ctx );
2009 0 : if( FD_UNLIKELY( err ) ) return err;
2010 0 : if( self->stake_delegations_root ) {
2011 0 : ulong stake_delegations_len = fd_delegation_pair_t_map_size( self->stake_delegations_pool, self->stake_delegations_root );
2012 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
2013 0 : if( FD_UNLIKELY( err ) ) return err;
2014 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 ) ) {
2015 0 : err = fd_delegation_pair_encode( &n->elem, ctx );
2016 0 : if( FD_UNLIKELY( err ) ) return err;
2017 0 : }
2018 0 : } else {
2019 0 : ulong stake_delegations_len = 0;
2020 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
2021 0 : if( FD_UNLIKELY( err ) ) return err;
2022 0 : }
2023 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
2024 0 : if( FD_UNLIKELY( err ) ) return err;
2025 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2026 0 : if( FD_UNLIKELY( err ) ) return err;
2027 0 : err = fd_stake_history_encode( &self->stake_history, ctx );
2028 0 : if( FD_UNLIKELY( err ) ) return err;
2029 0 : return FD_BINCODE_SUCCESS;
2030 0 : }
2031 0 : int fd_stakes_encode_global( fd_stakes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2032 0 : int err;
2033 0 : err = fd_vote_accounts_encode_global( &self->vote_accounts, ctx );
2034 0 : if( FD_UNLIKELY( err ) ) return err;
2035 0 : fd_delegation_pair_t_mapnode_t * stake_delegations_root = fd_delegation_pair_t_map_join( (uchar *)self + self->stake_delegations_root_offset );
2036 0 : fd_delegation_pair_t_mapnode_t * stake_delegations_pool = fd_delegation_pair_t_map_join( (uchar *)self + self->stake_delegations_pool_offset );
2037 0 : if( stake_delegations_root ) {
2038 0 : ulong stake_delegations_len = fd_delegation_pair_t_map_size( stake_delegations_pool, stake_delegations_root );
2039 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
2040 0 : if( FD_UNLIKELY( err ) ) return err;
2041 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum( stake_delegations_pool, stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( stake_delegations_pool, n ) ) {
2042 0 : err = fd_delegation_pair_encode( &n->elem, ctx );
2043 0 : if( FD_UNLIKELY( err ) ) return err;
2044 0 : }
2045 0 : } else {
2046 0 : ulong stake_delegations_len = 0;
2047 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
2048 0 : if( FD_UNLIKELY( err ) ) return err;
2049 0 : }
2050 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
2051 0 : if( FD_UNLIKELY( err ) ) return err;
2052 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2053 0 : if( FD_UNLIKELY( err ) ) return err;
2054 0 : err = fd_stake_history_encode( &self->stake_history, ctx );
2055 0 : if( FD_UNLIKELY( err ) ) return err;
2056 0 : return FD_BINCODE_SUCCESS;
2057 0 : }
2058 0 : static int fd_stakes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2059 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2060 0 : int err = 0;
2061 0 : err = fd_vote_accounts_decode_footprint_inner( ctx, total_sz );
2062 0 : if( FD_UNLIKELY( err ) ) return err;
2063 0 : ulong stake_delegations_len = 0UL;
2064 0 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
2065 0 : ulong stake_delegations_cnt = fd_ulong_max( stake_delegations_len, 2000000 );
2066 0 : *total_sz += fd_delegation_pair_t_map_align() + fd_delegation_pair_t_map_footprint( stake_delegations_cnt );
2067 0 : if( FD_UNLIKELY( err ) ) return err;
2068 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
2069 0 : err = fd_delegation_pair_decode_footprint_inner( ctx, total_sz );
2070 0 : if( FD_UNLIKELY( err ) ) return err;
2071 0 : }
2072 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2073 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2074 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2075 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2076 0 : err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
2077 0 : if( FD_UNLIKELY( err ) ) return err;
2078 0 : return 0;
2079 0 : }
2080 0 : int fd_stakes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2081 0 : *total_sz += sizeof(fd_stakes_t);
2082 0 : void const * start_data = ctx->data;
2083 0 : int err = fd_stakes_decode_footprint_inner( ctx, total_sz );
2084 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2085 0 : ctx->data = start_data;
2086 0 : return err;
2087 0 : }
2088 0 : static void fd_stakes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2089 0 : fd_stakes_t * self = (fd_stakes_t *)struct_mem;
2090 0 : fd_vote_accounts_decode_inner( &self->vote_accounts, alloc_mem, ctx );
2091 0 : ulong stake_delegations_len;
2092 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
2093 0 : self->stake_delegations_pool = fd_delegation_pair_t_map_join_new( alloc_mem, fd_ulong_max( stake_delegations_len, 2000000 ) );
2094 0 : self->stake_delegations_root = NULL;
2095 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
2096 0 : fd_delegation_pair_t_mapnode_t * node = fd_delegation_pair_t_map_acquire( self->stake_delegations_pool );
2097 0 : fd_delegation_pair_new( &node->elem );
2098 0 : fd_delegation_pair_decode_inner( &node->elem, alloc_mem, ctx );
2099 0 : fd_delegation_pair_t_mapnode_t * out = NULL;;
2100 0 : fd_delegation_pair_t_map_insert_or_replace( self->stake_delegations_pool, &self->stake_delegations_root, node, &out );
2101 0 : if( out != NULL ) {
2102 0 : fd_delegation_pair_t_map_release( self->stake_delegations_pool, out );
2103 0 : }
2104 0 : }
2105 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
2106 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2107 0 : fd_stake_history_decode_inner( &self->stake_history, alloc_mem, ctx );
2108 0 : }
2109 0 : void * fd_stakes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2110 0 : fd_stakes_t * self = (fd_stakes_t *)mem;
2111 0 : fd_stakes_new( self );
2112 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stakes_t);
2113 0 : void * * alloc_mem = &alloc_region;
2114 0 : fd_stakes_decode_inner( mem, alloc_mem, ctx );
2115 0 : return self;
2116 0 : }
2117 0 : static void fd_stakes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2118 0 : fd_stakes_global_t * self = (fd_stakes_global_t *)struct_mem;
2119 0 : fd_vote_accounts_decode_inner_global( &self->vote_accounts, alloc_mem, ctx );
2120 0 : ulong stake_delegations_len;
2121 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
2122 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_delegation_pair_t_map_align() );
2123 0 : fd_delegation_pair_t_mapnode_t * stake_delegations_pool = fd_delegation_pair_t_map_join_new( alloc_mem, fd_ulong_max( stake_delegations_len, 2000000 ) );
2124 0 : fd_delegation_pair_t_mapnode_t * stake_delegations_root = NULL;
2125 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
2126 0 : fd_delegation_pair_t_mapnode_t * node = fd_delegation_pair_t_map_acquire( stake_delegations_pool );
2127 0 : fd_delegation_pair_new( (fd_delegation_pair_t *)fd_type_pun(&node->elem) );
2128 0 : fd_delegation_pair_decode_inner( &node->elem, alloc_mem, ctx );
2129 0 : fd_delegation_pair_t_map_insert( stake_delegations_pool, &stake_delegations_root, node );
2130 0 : }
2131 0 : self->stake_delegations_pool_offset = (ulong)fd_delegation_pair_t_map_leave( stake_delegations_pool ) - (ulong)struct_mem;
2132 0 : self->stake_delegations_root_offset = (ulong)stake_delegations_root - (ulong)struct_mem;
2133 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
2134 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2135 0 : fd_stake_history_decode_inner( &self->stake_history, alloc_mem, ctx );
2136 0 : }
2137 0 : void * fd_stakes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2138 0 : fd_stakes_global_t * self = (fd_stakes_global_t *)mem;
2139 0 : fd_stakes_new( (fd_stakes_t *)self );
2140 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stakes_global_t);
2141 0 : void * * alloc_mem = &alloc_region;
2142 0 : fd_stakes_decode_inner_global( mem, alloc_mem, ctx );
2143 0 : return self;
2144 0 : }
2145 0 : void fd_stakes_new(fd_stakes_t * self) {
2146 0 : fd_memset( self, 0, sizeof(fd_stakes_t) );
2147 0 : fd_vote_accounts_new( &self->vote_accounts );
2148 0 : fd_stake_history_new( &self->stake_history );
2149 0 : }
2150 0 : void fd_stakes_walk( void * w, fd_stakes_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
2151 0 : (void) varint;
2152 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stakes", level++, 0 );
2153 0 : fd_vote_accounts_walk( w, &self->vote_accounts, fun, "vote_accounts", level, 0 );
2154 0 : if( self->stake_delegations_root ) {
2155 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 ) ) {
2156 0 : fd_delegation_pair_walk(w, &n->elem, fun, "stake_delegations", level, 0 );
2157 0 : }
2158 0 : }
2159 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2160 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2161 0 : fd_stake_history_walk( w, &self->stake_history, fun, "stake_history", level, 0 );
2162 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stakes", level--, 0 );
2163 0 : }
2164 0 : ulong fd_stakes_size( fd_stakes_t const * self ) {
2165 0 : ulong size = 0;
2166 0 : size += fd_vote_accounts_size( &self->vote_accounts );
2167 0 : if( self->stake_delegations_root ) {
2168 0 : size += sizeof(ulong);
2169 0 : ulong max = fd_delegation_pair_t_map_max( self->stake_delegations_pool );
2170 0 : size += fd_delegation_pair_t_map_footprint( max );
2171 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 ) ) {
2172 0 : size += fd_delegation_pair_size( &n->elem ) - sizeof(fd_delegation_pair_t);
2173 0 : }
2174 0 : } else {
2175 0 : size += sizeof(ulong);
2176 0 : }
2177 0 : size += sizeof(ulong);
2178 0 : size += sizeof(ulong);
2179 0 : size += fd_stake_history_size( &self->stake_history );
2180 0 : return size;
2181 0 : }
2182 :
2183 0 : ulong fd_stakes_size_global( fd_stakes_global_t const * self ) {
2184 0 : ulong size = 0;
2185 0 : size += fd_vote_accounts_size_global( &self->vote_accounts );
2186 0 : fd_delegation_pair_t_mapnode_t * stake_delegations_pool = !!self->stake_delegations_pool_offset ? (fd_delegation_pair_t_mapnode_t *)fd_delegation_pair_t_map_join( fd_type_pun( (uchar *)self + self->stake_delegations_pool_offset ) ) : NULL;
2187 0 : fd_delegation_pair_t_mapnode_t * stake_delegations_root = !!self->stake_delegations_root_offset ? (fd_delegation_pair_t_mapnode_t *)fd_type_pun( (uchar *)self + self->stake_delegations_root_offset ) : NULL;
2188 0 : if( stake_delegations_root ) {
2189 0 : size += sizeof(ulong);
2190 0 : ulong max = fd_delegation_pair_t_map_max( stake_delegations_pool );
2191 0 : size += fd_delegation_pair_t_map_footprint( max );
2192 0 : for( fd_delegation_pair_t_mapnode_t * n = fd_delegation_pair_t_map_minimum( stake_delegations_pool, stake_delegations_root ); n; n = fd_delegation_pair_t_map_successor( stake_delegations_pool, n ) ) {
2193 0 : size += fd_delegation_pair_size( &n->elem ) - sizeof(fd_delegation_pair_t);
2194 0 : }
2195 0 : } else {
2196 0 : size += sizeof(ulong);
2197 0 : }
2198 0 : size += sizeof(ulong);
2199 0 : size += sizeof(ulong);
2200 0 : size += fd_stake_history_size( &self->stake_history );
2201 0 : return size;
2202 0 : }
2203 :
2204 0 : int fd_stakes_stake_encode( fd_stakes_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2205 0 : int err;
2206 0 : err = fd_vote_accounts_encode( &self->vote_accounts, ctx );
2207 0 : if( FD_UNLIKELY( err ) ) return err;
2208 0 : if( self->stake_delegations_root ) {
2209 0 : ulong stake_delegations_len = fd_stake_pair_t_map_size( self->stake_delegations_pool, self->stake_delegations_root );
2210 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
2211 0 : if( FD_UNLIKELY( err ) ) return err;
2212 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 ) ) {
2213 0 : err = fd_stake_pair_encode( &n->elem, ctx );
2214 0 : if( FD_UNLIKELY( err ) ) return err;
2215 0 : }
2216 0 : } else {
2217 0 : ulong stake_delegations_len = 0;
2218 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
2219 0 : if( FD_UNLIKELY( err ) ) return err;
2220 0 : }
2221 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
2222 0 : if( FD_UNLIKELY( err ) ) return err;
2223 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2224 0 : if( FD_UNLIKELY( err ) ) return err;
2225 0 : err = fd_stake_history_encode( &self->stake_history, ctx );
2226 0 : if( FD_UNLIKELY( err ) ) return err;
2227 0 : return FD_BINCODE_SUCCESS;
2228 0 : }
2229 0 : int fd_stakes_stake_encode_global( fd_stakes_stake_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2230 0 : int err;
2231 0 : err = fd_vote_accounts_encode_global( &self->vote_accounts, ctx );
2232 0 : if( FD_UNLIKELY( err ) ) return err;
2233 0 : fd_stake_pair_t_mapnode_t * stake_delegations_root = fd_stake_pair_t_map_join( (uchar *)self + self->stake_delegations_root_offset );
2234 0 : fd_stake_pair_t_mapnode_t * stake_delegations_pool = fd_stake_pair_t_map_join( (uchar *)self + self->stake_delegations_pool_offset );
2235 0 : if( stake_delegations_root ) {
2236 0 : ulong stake_delegations_len = fd_stake_pair_t_map_size( stake_delegations_pool, stake_delegations_root );
2237 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
2238 0 : if( FD_UNLIKELY( err ) ) return err;
2239 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum( stake_delegations_pool, stake_delegations_root ); n; n = fd_stake_pair_t_map_successor( stake_delegations_pool, n ) ) {
2240 0 : err = fd_stake_pair_encode( &n->elem, ctx );
2241 0 : if( FD_UNLIKELY( err ) ) return err;
2242 0 : }
2243 0 : } else {
2244 0 : ulong stake_delegations_len = 0;
2245 0 : err = fd_bincode_uint64_encode( stake_delegations_len, ctx );
2246 0 : if( FD_UNLIKELY( err ) ) return err;
2247 0 : }
2248 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
2249 0 : if( FD_UNLIKELY( err ) ) return err;
2250 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2251 0 : if( FD_UNLIKELY( err ) ) return err;
2252 0 : err = fd_stake_history_encode( &self->stake_history, ctx );
2253 0 : if( FD_UNLIKELY( err ) ) return err;
2254 0 : return FD_BINCODE_SUCCESS;
2255 0 : }
2256 0 : static int fd_stakes_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2257 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2258 0 : int err = 0;
2259 0 : err = fd_vote_accounts_decode_footprint_inner( ctx, total_sz );
2260 0 : if( FD_UNLIKELY( err ) ) return err;
2261 0 : ulong stake_delegations_len = 0UL;
2262 0 : err = fd_bincode_uint64_decode( &stake_delegations_len, ctx );
2263 0 : ulong stake_delegations_cnt = !!stake_delegations_len ? stake_delegations_len : 1;
2264 0 : *total_sz += fd_stake_pair_t_map_align() + fd_stake_pair_t_map_footprint( stake_delegations_cnt );
2265 0 : if( FD_UNLIKELY( err ) ) return err;
2266 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
2267 0 : err = fd_stake_pair_decode_footprint_inner( ctx, total_sz );
2268 0 : if( FD_UNLIKELY( err ) ) return err;
2269 0 : }
2270 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2271 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2272 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2273 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2274 0 : err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
2275 0 : if( FD_UNLIKELY( err ) ) return err;
2276 0 : return 0;
2277 0 : }
2278 0 : int fd_stakes_stake_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2279 0 : *total_sz += sizeof(fd_stakes_stake_t);
2280 0 : void const * start_data = ctx->data;
2281 0 : int err = fd_stakes_stake_decode_footprint_inner( ctx, total_sz );
2282 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2283 0 : ctx->data = start_data;
2284 0 : return err;
2285 0 : }
2286 0 : static void fd_stakes_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2287 0 : fd_stakes_stake_t * self = (fd_stakes_stake_t *)struct_mem;
2288 0 : fd_vote_accounts_decode_inner( &self->vote_accounts, alloc_mem, ctx );
2289 0 : ulong stake_delegations_len;
2290 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
2291 0 : self->stake_delegations_pool = fd_stake_pair_t_map_join_new( alloc_mem, stake_delegations_len );
2292 0 : self->stake_delegations_root = NULL;
2293 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
2294 0 : fd_stake_pair_t_mapnode_t * node = fd_stake_pair_t_map_acquire( self->stake_delegations_pool );
2295 0 : fd_stake_pair_new( &node->elem );
2296 0 : fd_stake_pair_decode_inner( &node->elem, alloc_mem, ctx );
2297 0 : fd_stake_pair_t_mapnode_t * out = NULL;;
2298 0 : fd_stake_pair_t_map_insert_or_replace( self->stake_delegations_pool, &self->stake_delegations_root, node, &out );
2299 0 : if( out != NULL ) {
2300 0 : fd_stake_pair_t_map_release( self->stake_delegations_pool, out );
2301 0 : }
2302 0 : }
2303 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
2304 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2305 0 : fd_stake_history_decode_inner( &self->stake_history, alloc_mem, ctx );
2306 0 : }
2307 0 : void * fd_stakes_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2308 0 : fd_stakes_stake_t * self = (fd_stakes_stake_t *)mem;
2309 0 : fd_stakes_stake_new( self );
2310 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stakes_stake_t);
2311 0 : void * * alloc_mem = &alloc_region;
2312 0 : fd_stakes_stake_decode_inner( mem, alloc_mem, ctx );
2313 0 : return self;
2314 0 : }
2315 0 : static void fd_stakes_stake_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2316 0 : fd_stakes_stake_global_t * self = (fd_stakes_stake_global_t *)struct_mem;
2317 0 : fd_vote_accounts_decode_inner_global( &self->vote_accounts, alloc_mem, ctx );
2318 0 : ulong stake_delegations_len;
2319 0 : fd_bincode_uint64_decode_unsafe( &stake_delegations_len, ctx );
2320 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_stake_pair_t_map_align() );
2321 0 : fd_stake_pair_t_mapnode_t * stake_delegations_pool = fd_stake_pair_t_map_join_new( alloc_mem, stake_delegations_len );
2322 0 : fd_stake_pair_t_mapnode_t * stake_delegations_root = NULL;
2323 0 : for( ulong i=0; i < stake_delegations_len; i++ ) {
2324 0 : fd_stake_pair_t_mapnode_t * node = fd_stake_pair_t_map_acquire( stake_delegations_pool );
2325 0 : fd_stake_pair_new( (fd_stake_pair_t *)fd_type_pun(&node->elem) );
2326 0 : fd_stake_pair_decode_inner( &node->elem, alloc_mem, ctx );
2327 0 : fd_stake_pair_t_map_insert( stake_delegations_pool, &stake_delegations_root, node );
2328 0 : }
2329 0 : self->stake_delegations_pool_offset = (ulong)fd_stake_pair_t_map_leave( stake_delegations_pool ) - (ulong)struct_mem;
2330 0 : self->stake_delegations_root_offset = (ulong)stake_delegations_root - (ulong)struct_mem;
2331 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
2332 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2333 0 : fd_stake_history_decode_inner( &self->stake_history, alloc_mem, ctx );
2334 0 : }
2335 0 : void * fd_stakes_stake_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2336 0 : fd_stakes_stake_global_t * self = (fd_stakes_stake_global_t *)mem;
2337 0 : fd_stakes_stake_new( (fd_stakes_stake_t *)self );
2338 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stakes_stake_global_t);
2339 0 : void * * alloc_mem = &alloc_region;
2340 0 : fd_stakes_stake_decode_inner_global( mem, alloc_mem, ctx );
2341 0 : return self;
2342 0 : }
2343 0 : void fd_stakes_stake_new(fd_stakes_stake_t * self) {
2344 0 : fd_memset( self, 0, sizeof(fd_stakes_stake_t) );
2345 0 : fd_vote_accounts_new( &self->vote_accounts );
2346 0 : fd_stake_history_new( &self->stake_history );
2347 0 : }
2348 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, uint varint ) {
2349 0 : (void) varint;
2350 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stakes_stake", level++, 0 );
2351 0 : fd_vote_accounts_walk( w, &self->vote_accounts, fun, "vote_accounts", level, 0 );
2352 0 : if( self->stake_delegations_root ) {
2353 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 ) ) {
2354 0 : fd_stake_pair_walk(w, &n->elem, fun, "stake_delegations", level, 0 );
2355 0 : }
2356 0 : }
2357 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2358 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2359 0 : fd_stake_history_walk( w, &self->stake_history, fun, "stake_history", level, 0 );
2360 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stakes_stake", level--, 0 );
2361 0 : }
2362 0 : ulong fd_stakes_stake_size( fd_stakes_stake_t const * self ) {
2363 0 : ulong size = 0;
2364 0 : size += fd_vote_accounts_size( &self->vote_accounts );
2365 0 : if( self->stake_delegations_root ) {
2366 0 : size += sizeof(ulong);
2367 0 : ulong max = fd_stake_pair_t_map_max( self->stake_delegations_pool );
2368 0 : size += fd_stake_pair_t_map_footprint( max );
2369 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 ) ) {
2370 0 : size += fd_stake_pair_size( &n->elem ) - sizeof(fd_stake_pair_t);
2371 0 : }
2372 0 : } else {
2373 0 : size += sizeof(ulong);
2374 0 : }
2375 0 : size += sizeof(ulong);
2376 0 : size += sizeof(ulong);
2377 0 : size += fd_stake_history_size( &self->stake_history );
2378 0 : return size;
2379 0 : }
2380 :
2381 0 : ulong fd_stakes_stake_size_global( fd_stakes_stake_global_t const * self ) {
2382 0 : ulong size = 0;
2383 0 : size += fd_vote_accounts_size_global( &self->vote_accounts );
2384 0 : fd_stake_pair_t_mapnode_t * stake_delegations_pool = !!self->stake_delegations_pool_offset ? (fd_stake_pair_t_mapnode_t *)fd_stake_pair_t_map_join( fd_type_pun( (uchar *)self + self->stake_delegations_pool_offset ) ) : NULL;
2385 0 : fd_stake_pair_t_mapnode_t * stake_delegations_root = !!self->stake_delegations_root_offset ? (fd_stake_pair_t_mapnode_t *)fd_type_pun( (uchar *)self + self->stake_delegations_root_offset ) : NULL;
2386 0 : if( stake_delegations_root ) {
2387 0 : size += sizeof(ulong);
2388 0 : ulong max = fd_stake_pair_t_map_max( stake_delegations_pool );
2389 0 : size += fd_stake_pair_t_map_footprint( max );
2390 0 : for( fd_stake_pair_t_mapnode_t * n = fd_stake_pair_t_map_minimum( stake_delegations_pool, stake_delegations_root ); n; n = fd_stake_pair_t_map_successor( stake_delegations_pool, n ) ) {
2391 0 : size += fd_stake_pair_size( &n->elem ) - sizeof(fd_stake_pair_t);
2392 0 : }
2393 0 : } else {
2394 0 : size += sizeof(ulong);
2395 0 : }
2396 0 : size += sizeof(ulong);
2397 0 : size += sizeof(ulong);
2398 0 : size += fd_stake_history_size( &self->stake_history );
2399 0 : return size;
2400 0 : }
2401 :
2402 0 : int fd_bank_incremental_snapshot_persistence_encode( fd_bank_incremental_snapshot_persistence_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2403 0 : int err;
2404 0 : err = fd_bincode_uint64_encode( self->full_slot, ctx );
2405 0 : if( FD_UNLIKELY( err ) ) return err;
2406 0 : err = fd_hash_encode( &self->full_hash, ctx );
2407 0 : if( FD_UNLIKELY( err ) ) return err;
2408 0 : err = fd_bincode_uint64_encode( self->full_capitalization, ctx );
2409 0 : if( FD_UNLIKELY( err ) ) return err;
2410 0 : err = fd_hash_encode( &self->incremental_hash, ctx );
2411 0 : if( FD_UNLIKELY( err ) ) return err;
2412 0 : err = fd_bincode_uint64_encode( self->incremental_capitalization, ctx );
2413 0 : if( FD_UNLIKELY( err ) ) return err;
2414 0 : return FD_BINCODE_SUCCESS;
2415 0 : }
2416 0 : static inline int fd_bank_incremental_snapshot_persistence_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2417 0 : if( (ulong)ctx->data + 88UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2418 0 : ctx->data = (void *)( (ulong)ctx->data + 88UL );
2419 0 : return 0;
2420 0 : }
2421 0 : static void fd_bank_incremental_snapshot_persistence_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2422 0 : fd_bank_incremental_snapshot_persistence_t * self = (fd_bank_incremental_snapshot_persistence_t *)struct_mem;
2423 0 : fd_bincode_uint64_decode_unsafe( &self->full_slot, ctx );
2424 0 : fd_hash_decode_inner( &self->full_hash, alloc_mem, ctx );
2425 0 : fd_bincode_uint64_decode_unsafe( &self->full_capitalization, ctx );
2426 0 : fd_hash_decode_inner( &self->incremental_hash, alloc_mem, ctx );
2427 0 : fd_bincode_uint64_decode_unsafe( &self->incremental_capitalization, ctx );
2428 0 : }
2429 0 : void * fd_bank_incremental_snapshot_persistence_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2430 0 : fd_bank_incremental_snapshot_persistence_t * self = (fd_bank_incremental_snapshot_persistence_t *)mem;
2431 0 : fd_bank_incremental_snapshot_persistence_new( self );
2432 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_incremental_snapshot_persistence_t);
2433 0 : void * * alloc_mem = &alloc_region;
2434 0 : fd_bank_incremental_snapshot_persistence_decode_inner( mem, alloc_mem, ctx );
2435 0 : return self;
2436 0 : }
2437 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, uint varint ) {
2438 0 : (void) varint;
2439 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_incremental_snapshot_persistence", level++, 0 );
2440 0 : fun( w, &self->full_slot, "full_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2441 0 : fd_hash_walk( w, &self->full_hash, fun, "full_hash", level, 0 );
2442 0 : fun( w, &self->full_capitalization, "full_capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2443 0 : fd_hash_walk( w, &self->incremental_hash, fun, "incremental_hash", level, 0 );
2444 0 : fun( w, &self->incremental_capitalization, "incremental_capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2445 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_incremental_snapshot_persistence", level--, 0 );
2446 0 : }
2447 0 : int fd_node_vote_accounts_encode( fd_node_vote_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2448 0 : int err;
2449 0 : err = fd_bincode_uint64_encode( self->vote_accounts_len, ctx );
2450 0 : if( FD_UNLIKELY(err) ) return err;
2451 0 : if( self->vote_accounts_len ) {
2452 0 : for( ulong i=0; i < self->vote_accounts_len; i++ ) {
2453 0 : err = fd_pubkey_encode( self->vote_accounts + i, ctx );
2454 0 : if( FD_UNLIKELY( err ) ) return err;
2455 0 : }
2456 0 : }
2457 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
2458 0 : if( FD_UNLIKELY( err ) ) return err;
2459 0 : return FD_BINCODE_SUCCESS;
2460 0 : }
2461 0 : int fd_node_vote_accounts_encode_global( fd_node_vote_accounts_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2462 0 : int err;
2463 0 : err = fd_bincode_uint64_encode( self->vote_accounts_len, ctx );
2464 0 : if( FD_UNLIKELY( err ) ) return err;
2465 0 : if( self->vote_accounts_len ) {
2466 0 : uchar * vote_accounts_laddr = (uchar*)self + self->vote_accounts_offset;
2467 0 : fd_pubkey_t * vote_accounts = (fd_pubkey_t *)vote_accounts_laddr;
2468 0 : for( ulong i=0; i < self->vote_accounts_len; i++ ) {
2469 0 : err = fd_pubkey_encode( &vote_accounts[i], ctx );
2470 0 : if( FD_UNLIKELY( err ) ) return err;
2471 0 : }
2472 0 : }
2473 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
2474 0 : if( FD_UNLIKELY( err ) ) return err;
2475 0 : return FD_BINCODE_SUCCESS;
2476 0 : }
2477 0 : static int fd_node_vote_accounts_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2478 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2479 0 : int err = 0;
2480 0 : ulong vote_accounts_len;
2481 0 : err = fd_bincode_uint64_decode( &vote_accounts_len, ctx );
2482 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2483 0 : if( vote_accounts_len ) {
2484 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*vote_accounts_len;
2485 0 : for( ulong i=0; i < vote_accounts_len; i++ ) {
2486 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2487 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2488 0 : }
2489 0 : }
2490 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2491 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2492 0 : return 0;
2493 0 : }
2494 0 : int fd_node_vote_accounts_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2495 0 : *total_sz += sizeof(fd_node_vote_accounts_t);
2496 0 : void const * start_data = ctx->data;
2497 0 : int err = fd_node_vote_accounts_decode_footprint_inner( ctx, total_sz );
2498 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2499 0 : ctx->data = start_data;
2500 0 : return err;
2501 0 : }
2502 0 : static void fd_node_vote_accounts_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2503 0 : fd_node_vote_accounts_t * self = (fd_node_vote_accounts_t *)struct_mem;
2504 0 : fd_bincode_uint64_decode_unsafe( &self->vote_accounts_len, ctx );
2505 0 : if( self->vote_accounts_len ) {
2506 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
2507 0 : self->vote_accounts = *alloc_mem;
2508 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->vote_accounts_len;
2509 0 : for( ulong i=0; i < self->vote_accounts_len; i++ ) {
2510 0 : fd_pubkey_new( self->vote_accounts + i );
2511 0 : fd_pubkey_decode_inner( self->vote_accounts + i, alloc_mem, ctx );
2512 0 : }
2513 0 : } else
2514 0 : self->vote_accounts = NULL;
2515 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
2516 0 : }
2517 0 : void * fd_node_vote_accounts_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2518 0 : fd_node_vote_accounts_t * self = (fd_node_vote_accounts_t *)mem;
2519 0 : fd_node_vote_accounts_new( self );
2520 0 : void * alloc_region = (uchar *)mem + sizeof(fd_node_vote_accounts_t);
2521 0 : void * * alloc_mem = &alloc_region;
2522 0 : fd_node_vote_accounts_decode_inner( mem, alloc_mem, ctx );
2523 0 : return self;
2524 0 : }
2525 0 : static void fd_node_vote_accounts_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2526 0 : fd_node_vote_accounts_global_t * self = (fd_node_vote_accounts_global_t *)struct_mem;
2527 0 : fd_bincode_uint64_decode_unsafe( &self->vote_accounts_len, ctx );
2528 0 : if( self->vote_accounts_len ) {
2529 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
2530 0 : self->vote_accounts_offset = (ulong)*alloc_mem - (ulong)struct_mem;
2531 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
2532 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->vote_accounts_len;
2533 0 : for( ulong i=0; i < self->vote_accounts_len; i++ ) {
2534 0 : fd_pubkey_new( (fd_pubkey_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_t) * i) );
2535 0 : fd_pubkey_decode_inner( cur_mem + sizeof(fd_pubkey_t) * i, alloc_mem, ctx );
2536 0 : }
2537 0 : } else {
2538 0 : self->vote_accounts_offset = 0UL;
2539 0 : }
2540 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
2541 0 : }
2542 0 : void * fd_node_vote_accounts_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2543 0 : fd_node_vote_accounts_global_t * self = (fd_node_vote_accounts_global_t *)mem;
2544 0 : fd_node_vote_accounts_new( (fd_node_vote_accounts_t *)self );
2545 0 : void * alloc_region = (uchar *)mem + sizeof(fd_node_vote_accounts_global_t);
2546 0 : void * * alloc_mem = &alloc_region;
2547 0 : fd_node_vote_accounts_decode_inner_global( mem, alloc_mem, ctx );
2548 0 : return self;
2549 0 : }
2550 0 : void fd_node_vote_accounts_new(fd_node_vote_accounts_t * self) {
2551 0 : fd_memset( self, 0, sizeof(fd_node_vote_accounts_t) );
2552 0 : }
2553 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, uint varint ) {
2554 0 : (void) varint;
2555 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_node_vote_accounts", level++, 0 );
2556 0 : if( self->vote_accounts_len ) {
2557 0 : fun( w, NULL, "vote_accounts", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
2558 0 : for( ulong i=0; i < self->vote_accounts_len; i++ )
2559 0 : fd_pubkey_walk(w, self->vote_accounts + i, fun, "pubkey", level, 0 );
2560 0 : fun( w, NULL, "vote_accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
2561 0 : }
2562 0 : fun( w, &self->total_stake, "total_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2563 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_node_vote_accounts", level--, 0 );
2564 0 : }
2565 0 : ulong fd_node_vote_accounts_size( fd_node_vote_accounts_t const * self ) {
2566 0 : ulong size = 0;
2567 0 : do {
2568 0 : size += sizeof(ulong);
2569 0 : for( ulong i=0; i < self->vote_accounts_len; i++ )
2570 0 : size += fd_pubkey_size( self->vote_accounts + i );
2571 0 : } while(0);
2572 0 : size += sizeof(ulong);
2573 0 : return size;
2574 0 : }
2575 :
2576 0 : ulong fd_node_vote_accounts_size_global( fd_node_vote_accounts_global_t const * self ) {
2577 0 : ulong size = 0;
2578 0 : do {
2579 0 : size += sizeof(ulong);
2580 0 : fd_pubkey_t * vote_accounts = self->vote_accounts_offset ? (fd_pubkey_t *)fd_type_pun( (uchar *)self + self->vote_accounts_offset ) : NULL;
2581 0 : for( ulong i=0; i < self->vote_accounts_len; i++ )
2582 0 : size += fd_pubkey_size( vote_accounts + i );
2583 0 : } while(0);
2584 0 : size += sizeof(ulong);
2585 0 : return size;
2586 0 : }
2587 :
2588 0 : int fd_pubkey_node_vote_accounts_pair_encode( fd_pubkey_node_vote_accounts_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2589 0 : int err;
2590 0 : err = fd_pubkey_encode( &self->key, ctx );
2591 0 : if( FD_UNLIKELY( err ) ) return err;
2592 0 : err = fd_node_vote_accounts_encode( &self->value, ctx );
2593 0 : if( FD_UNLIKELY( err ) ) return err;
2594 0 : return FD_BINCODE_SUCCESS;
2595 0 : }
2596 0 : int fd_pubkey_node_vote_accounts_pair_encode_global( fd_pubkey_node_vote_accounts_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2597 0 : int err;
2598 0 : err = fd_pubkey_encode( &self->key, ctx );
2599 0 : if( FD_UNLIKELY( err ) ) return err;
2600 0 : err = fd_node_vote_accounts_encode_global( &self->value, ctx );
2601 0 : if( FD_UNLIKELY( err ) ) return err;
2602 0 : return FD_BINCODE_SUCCESS;
2603 0 : }
2604 0 : static int fd_pubkey_node_vote_accounts_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2605 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2606 0 : int err = 0;
2607 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2608 0 : if( FD_UNLIKELY( err ) ) return err;
2609 0 : err = fd_node_vote_accounts_decode_footprint_inner( ctx, total_sz );
2610 0 : if( FD_UNLIKELY( err ) ) return err;
2611 0 : return 0;
2612 0 : }
2613 0 : int fd_pubkey_node_vote_accounts_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2614 0 : *total_sz += sizeof(fd_pubkey_node_vote_accounts_pair_t);
2615 0 : void const * start_data = ctx->data;
2616 0 : int err = fd_pubkey_node_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
2617 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2618 0 : ctx->data = start_data;
2619 0 : return err;
2620 0 : }
2621 0 : static void fd_pubkey_node_vote_accounts_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2622 0 : fd_pubkey_node_vote_accounts_pair_t * self = (fd_pubkey_node_vote_accounts_pair_t *)struct_mem;
2623 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
2624 0 : fd_node_vote_accounts_decode_inner( &self->value, alloc_mem, ctx );
2625 0 : }
2626 0 : void * fd_pubkey_node_vote_accounts_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2627 0 : fd_pubkey_node_vote_accounts_pair_t * self = (fd_pubkey_node_vote_accounts_pair_t *)mem;
2628 0 : fd_pubkey_node_vote_accounts_pair_new( self );
2629 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_node_vote_accounts_pair_t);
2630 0 : void * * alloc_mem = &alloc_region;
2631 0 : fd_pubkey_node_vote_accounts_pair_decode_inner( mem, alloc_mem, ctx );
2632 0 : return self;
2633 0 : }
2634 0 : static void fd_pubkey_node_vote_accounts_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2635 0 : fd_pubkey_node_vote_accounts_pair_global_t * self = (fd_pubkey_node_vote_accounts_pair_global_t *)struct_mem;
2636 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
2637 0 : fd_node_vote_accounts_decode_inner_global( &self->value, alloc_mem, ctx );
2638 0 : }
2639 0 : void * fd_pubkey_node_vote_accounts_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2640 0 : fd_pubkey_node_vote_accounts_pair_global_t * self = (fd_pubkey_node_vote_accounts_pair_global_t *)mem;
2641 0 : fd_pubkey_node_vote_accounts_pair_new( (fd_pubkey_node_vote_accounts_pair_t *)self );
2642 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_node_vote_accounts_pair_global_t);
2643 0 : void * * alloc_mem = &alloc_region;
2644 0 : fd_pubkey_node_vote_accounts_pair_decode_inner_global( mem, alloc_mem, ctx );
2645 0 : return self;
2646 0 : }
2647 0 : void fd_pubkey_node_vote_accounts_pair_new(fd_pubkey_node_vote_accounts_pair_t * self) {
2648 0 : fd_memset( self, 0, sizeof(fd_pubkey_node_vote_accounts_pair_t) );
2649 0 : fd_pubkey_new( &self->key );
2650 0 : fd_node_vote_accounts_new( &self->value );
2651 0 : }
2652 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, uint varint ) {
2653 0 : (void) varint;
2654 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_node_vote_accounts_pair", level++, 0 );
2655 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
2656 0 : fd_node_vote_accounts_walk( w, &self->value, fun, "value", level, 0 );
2657 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_node_vote_accounts_pair", level--, 0 );
2658 0 : }
2659 0 : ulong fd_pubkey_node_vote_accounts_pair_size( fd_pubkey_node_vote_accounts_pair_t const * self ) {
2660 0 : ulong size = 0;
2661 0 : size += fd_pubkey_size( &self->key );
2662 0 : size += fd_node_vote_accounts_size( &self->value );
2663 0 : return size;
2664 0 : }
2665 :
2666 0 : ulong fd_pubkey_node_vote_accounts_pair_size_global( fd_pubkey_node_vote_accounts_pair_global_t const * self ) {
2667 0 : ulong size = 0;
2668 0 : size += fd_pubkey_size( &self->key );
2669 0 : size += fd_node_vote_accounts_size_global( &self->value );
2670 0 : return size;
2671 0 : }
2672 :
2673 0 : int fd_pubkey_pubkey_pair_encode( fd_pubkey_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2674 0 : int err;
2675 0 : err = fd_pubkey_encode( &self->key, ctx );
2676 0 : if( FD_UNLIKELY( err ) ) return err;
2677 0 : err = fd_pubkey_encode( &self->value, ctx );
2678 0 : if( FD_UNLIKELY( err ) ) return err;
2679 0 : return FD_BINCODE_SUCCESS;
2680 0 : }
2681 0 : static inline int fd_pubkey_pubkey_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2682 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2683 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
2684 0 : return 0;
2685 0 : }
2686 0 : static void fd_pubkey_pubkey_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2687 0 : fd_pubkey_pubkey_pair_t * self = (fd_pubkey_pubkey_pair_t *)struct_mem;
2688 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
2689 0 : fd_pubkey_decode_inner( &self->value, alloc_mem, ctx );
2690 0 : }
2691 0 : void * fd_pubkey_pubkey_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2692 0 : fd_pubkey_pubkey_pair_t * self = (fd_pubkey_pubkey_pair_t *)mem;
2693 0 : fd_pubkey_pubkey_pair_new( self );
2694 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_pubkey_pair_t);
2695 0 : void * * alloc_mem = &alloc_region;
2696 0 : fd_pubkey_pubkey_pair_decode_inner( mem, alloc_mem, ctx );
2697 0 : return self;
2698 0 : }
2699 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, uint varint ) {
2700 0 : (void) varint;
2701 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_pubkey_pair", level++, 0 );
2702 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
2703 0 : fd_pubkey_walk( w, &self->value, fun, "value", level, 0 );
2704 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_pubkey_pair", level--, 0 );
2705 0 : }
2706 0 : int fd_epoch_stakes_encode( fd_epoch_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2707 0 : int err;
2708 0 : err = fd_stakes_encode( &self->stakes, ctx );
2709 0 : if( FD_UNLIKELY( err ) ) return err;
2710 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
2711 0 : if( FD_UNLIKELY( err ) ) return err;
2712 0 : if( self->node_id_to_vote_accounts_root ) {
2713 0 : ulong node_id_to_vote_accounts_len = fd_pubkey_node_vote_accounts_pair_t_map_size( self->node_id_to_vote_accounts_pool, self->node_id_to_vote_accounts_root );
2714 0 : err = fd_bincode_uint64_encode( node_id_to_vote_accounts_len, ctx );
2715 0 : if( FD_UNLIKELY( err ) ) return err;
2716 0 : for( fd_pubkey_node_vote_accounts_pair_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_t_map_minimum( self->node_id_to_vote_accounts_pool, self->node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_t_map_successor( self->node_id_to_vote_accounts_pool, n ) ) {
2717 0 : err = fd_pubkey_node_vote_accounts_pair_encode( &n->elem, ctx );
2718 0 : if( FD_UNLIKELY( err ) ) return err;
2719 0 : }
2720 0 : } else {
2721 0 : ulong node_id_to_vote_accounts_len = 0;
2722 0 : err = fd_bincode_uint64_encode( node_id_to_vote_accounts_len, ctx );
2723 0 : if( FD_UNLIKELY( err ) ) return err;
2724 0 : }
2725 0 : if( self->epoch_authorized_voters_root ) {
2726 0 : ulong epoch_authorized_voters_len = fd_pubkey_pubkey_pair_t_map_size( self->epoch_authorized_voters_pool, self->epoch_authorized_voters_root );
2727 0 : err = fd_bincode_uint64_encode( epoch_authorized_voters_len, ctx );
2728 0 : if( FD_UNLIKELY( err ) ) return err;
2729 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum( self->epoch_authorized_voters_pool, self->epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( self->epoch_authorized_voters_pool, n ) ) {
2730 0 : err = fd_pubkey_pubkey_pair_encode( &n->elem, ctx );
2731 0 : if( FD_UNLIKELY( err ) ) return err;
2732 0 : }
2733 0 : } else {
2734 0 : ulong epoch_authorized_voters_len = 0;
2735 0 : err = fd_bincode_uint64_encode( epoch_authorized_voters_len, ctx );
2736 0 : if( FD_UNLIKELY( err ) ) return err;
2737 0 : }
2738 0 : return FD_BINCODE_SUCCESS;
2739 0 : }
2740 0 : int fd_epoch_stakes_encode_global( fd_epoch_stakes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2741 0 : int err;
2742 0 : err = fd_stakes_encode_global( &self->stakes, ctx );
2743 0 : if( FD_UNLIKELY( err ) ) return err;
2744 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
2745 0 : if( FD_UNLIKELY( err ) ) return err;
2746 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_root = fd_pubkey_node_vote_accounts_pair_global_t_map_join( (uchar *)self + self->node_id_to_vote_accounts_root_offset );
2747 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_pool = fd_pubkey_node_vote_accounts_pair_global_t_map_join( (uchar *)self + self->node_id_to_vote_accounts_pool_offset );
2748 0 : if( node_id_to_vote_accounts_root ) {
2749 0 : ulong node_id_to_vote_accounts_len = fd_pubkey_node_vote_accounts_pair_global_t_map_size( node_id_to_vote_accounts_pool, node_id_to_vote_accounts_root );
2750 0 : err = fd_bincode_uint64_encode( node_id_to_vote_accounts_len, ctx );
2751 0 : if( FD_UNLIKELY( err ) ) return err;
2752 0 : for( fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_global_t_map_minimum( node_id_to_vote_accounts_pool, node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_global_t_map_successor( node_id_to_vote_accounts_pool, n ) ) {
2753 0 : err = fd_pubkey_node_vote_accounts_pair_encode_global( &n->elem, ctx );
2754 0 : if( FD_UNLIKELY( err ) ) return err;
2755 0 : }
2756 0 : } else {
2757 0 : ulong node_id_to_vote_accounts_len = 0;
2758 0 : err = fd_bincode_uint64_encode( node_id_to_vote_accounts_len, ctx );
2759 0 : if( FD_UNLIKELY( err ) ) return err;
2760 0 : }
2761 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_root = fd_pubkey_pubkey_pair_t_map_join( (uchar *)self + self->epoch_authorized_voters_root_offset );
2762 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_pool = fd_pubkey_pubkey_pair_t_map_join( (uchar *)self + self->epoch_authorized_voters_pool_offset );
2763 0 : if( epoch_authorized_voters_root ) {
2764 0 : ulong epoch_authorized_voters_len = fd_pubkey_pubkey_pair_t_map_size( epoch_authorized_voters_pool, epoch_authorized_voters_root );
2765 0 : err = fd_bincode_uint64_encode( epoch_authorized_voters_len, ctx );
2766 0 : if( FD_UNLIKELY( err ) ) return err;
2767 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum( epoch_authorized_voters_pool, epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( epoch_authorized_voters_pool, n ) ) {
2768 0 : err = fd_pubkey_pubkey_pair_encode( &n->elem, ctx );
2769 0 : if( FD_UNLIKELY( err ) ) return err;
2770 0 : }
2771 0 : } else {
2772 0 : ulong epoch_authorized_voters_len = 0;
2773 0 : err = fd_bincode_uint64_encode( epoch_authorized_voters_len, ctx );
2774 0 : if( FD_UNLIKELY( err ) ) return err;
2775 0 : }
2776 0 : return FD_BINCODE_SUCCESS;
2777 0 : }
2778 0 : static int fd_epoch_stakes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2779 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2780 0 : int err = 0;
2781 0 : err = fd_stakes_decode_footprint_inner( ctx, total_sz );
2782 0 : if( FD_UNLIKELY( err ) ) return err;
2783 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2784 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2785 0 : ulong node_id_to_vote_accounts_len = 0UL;
2786 0 : err = fd_bincode_uint64_decode( &node_id_to_vote_accounts_len, ctx );
2787 0 : ulong node_id_to_vote_accounts_cnt = !!node_id_to_vote_accounts_len ? node_id_to_vote_accounts_len : 1;
2788 0 : *total_sz += fd_pubkey_node_vote_accounts_pair_t_map_align() + fd_pubkey_node_vote_accounts_pair_t_map_footprint( node_id_to_vote_accounts_cnt );
2789 0 : if( FD_UNLIKELY( err ) ) return err;
2790 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
2791 0 : err = fd_pubkey_node_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
2792 0 : if( FD_UNLIKELY( err ) ) return err;
2793 0 : }
2794 0 : ulong epoch_authorized_voters_len = 0UL;
2795 0 : err = fd_bincode_uint64_decode( &epoch_authorized_voters_len, ctx );
2796 0 : ulong epoch_authorized_voters_cnt = !!epoch_authorized_voters_len ? epoch_authorized_voters_len : 1;
2797 0 : *total_sz += fd_pubkey_pubkey_pair_t_map_align() + fd_pubkey_pubkey_pair_t_map_footprint( epoch_authorized_voters_cnt );
2798 0 : if( FD_UNLIKELY( err ) ) return err;
2799 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
2800 0 : err = fd_pubkey_pubkey_pair_decode_footprint_inner( ctx, total_sz );
2801 0 : if( FD_UNLIKELY( err ) ) return err;
2802 0 : }
2803 0 : return 0;
2804 0 : }
2805 0 : int fd_epoch_stakes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2806 0 : *total_sz += sizeof(fd_epoch_stakes_t);
2807 0 : void const * start_data = ctx->data;
2808 0 : int err = fd_epoch_stakes_decode_footprint_inner( ctx, total_sz );
2809 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2810 0 : ctx->data = start_data;
2811 0 : return err;
2812 0 : }
2813 0 : static void fd_epoch_stakes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2814 0 : fd_epoch_stakes_t * self = (fd_epoch_stakes_t *)struct_mem;
2815 0 : fd_stakes_decode_inner( &self->stakes, alloc_mem, ctx );
2816 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
2817 0 : ulong node_id_to_vote_accounts_len;
2818 0 : fd_bincode_uint64_decode_unsafe( &node_id_to_vote_accounts_len, ctx );
2819 0 : self->node_id_to_vote_accounts_pool = fd_pubkey_node_vote_accounts_pair_t_map_join_new( alloc_mem, node_id_to_vote_accounts_len );
2820 0 : self->node_id_to_vote_accounts_root = NULL;
2821 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
2822 0 : fd_pubkey_node_vote_accounts_pair_t_mapnode_t * node = fd_pubkey_node_vote_accounts_pair_t_map_acquire( self->node_id_to_vote_accounts_pool );
2823 0 : fd_pubkey_node_vote_accounts_pair_new( &node->elem );
2824 0 : fd_pubkey_node_vote_accounts_pair_decode_inner( &node->elem, alloc_mem, ctx );
2825 0 : fd_pubkey_node_vote_accounts_pair_t_mapnode_t * out = NULL;;
2826 0 : fd_pubkey_node_vote_accounts_pair_t_map_insert_or_replace( self->node_id_to_vote_accounts_pool, &self->node_id_to_vote_accounts_root, node, &out );
2827 0 : if( out != NULL ) {
2828 0 : fd_pubkey_node_vote_accounts_pair_t_map_release( self->node_id_to_vote_accounts_pool, out );
2829 0 : }
2830 0 : }
2831 0 : ulong epoch_authorized_voters_len;
2832 0 : fd_bincode_uint64_decode_unsafe( &epoch_authorized_voters_len, ctx );
2833 0 : self->epoch_authorized_voters_pool = fd_pubkey_pubkey_pair_t_map_join_new( alloc_mem, epoch_authorized_voters_len );
2834 0 : self->epoch_authorized_voters_root = NULL;
2835 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
2836 0 : fd_pubkey_pubkey_pair_t_mapnode_t * node = fd_pubkey_pubkey_pair_t_map_acquire( self->epoch_authorized_voters_pool );
2837 0 : fd_pubkey_pubkey_pair_new( &node->elem );
2838 0 : fd_pubkey_pubkey_pair_decode_inner( &node->elem, alloc_mem, ctx );
2839 0 : fd_pubkey_pubkey_pair_t_mapnode_t * out = NULL;;
2840 0 : fd_pubkey_pubkey_pair_t_map_insert_or_replace( self->epoch_authorized_voters_pool, &self->epoch_authorized_voters_root, node, &out );
2841 0 : if( out != NULL ) {
2842 0 : fd_pubkey_pubkey_pair_t_map_release( self->epoch_authorized_voters_pool, out );
2843 0 : }
2844 0 : }
2845 0 : }
2846 0 : void * fd_epoch_stakes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2847 0 : fd_epoch_stakes_t * self = (fd_epoch_stakes_t *)mem;
2848 0 : fd_epoch_stakes_new( self );
2849 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_stakes_t);
2850 0 : void * * alloc_mem = &alloc_region;
2851 0 : fd_epoch_stakes_decode_inner( mem, alloc_mem, ctx );
2852 0 : return self;
2853 0 : }
2854 0 : static void fd_epoch_stakes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2855 0 : fd_epoch_stakes_global_t * self = (fd_epoch_stakes_global_t *)struct_mem;
2856 0 : fd_stakes_decode_inner_global( &self->stakes, alloc_mem, ctx );
2857 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
2858 0 : ulong node_id_to_vote_accounts_len;
2859 0 : fd_bincode_uint64_decode_unsafe( &node_id_to_vote_accounts_len, ctx );
2860 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_pubkey_node_vote_accounts_pair_global_t_map_align() );
2861 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_pool = fd_pubkey_node_vote_accounts_pair_global_t_map_join_new( alloc_mem, node_id_to_vote_accounts_len );
2862 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_root = NULL;
2863 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
2864 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node = fd_pubkey_node_vote_accounts_pair_global_t_map_acquire( node_id_to_vote_accounts_pool );
2865 0 : fd_pubkey_node_vote_accounts_pair_new( (fd_pubkey_node_vote_accounts_pair_t *)fd_type_pun(&node->elem) );
2866 0 : fd_pubkey_node_vote_accounts_pair_decode_inner_global( &node->elem, alloc_mem, ctx );
2867 0 : fd_pubkey_node_vote_accounts_pair_global_t_map_insert( node_id_to_vote_accounts_pool, &node_id_to_vote_accounts_root, node );
2868 0 : }
2869 0 : self->node_id_to_vote_accounts_pool_offset = (ulong)fd_pubkey_node_vote_accounts_pair_global_t_map_leave( node_id_to_vote_accounts_pool ) - (ulong)struct_mem;
2870 0 : self->node_id_to_vote_accounts_root_offset = (ulong)node_id_to_vote_accounts_root - (ulong)struct_mem;
2871 0 : ulong epoch_authorized_voters_len;
2872 0 : fd_bincode_uint64_decode_unsafe( &epoch_authorized_voters_len, ctx );
2873 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_pubkey_pubkey_pair_t_map_align() );
2874 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_pool = fd_pubkey_pubkey_pair_t_map_join_new( alloc_mem, epoch_authorized_voters_len );
2875 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_root = NULL;
2876 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
2877 0 : fd_pubkey_pubkey_pair_t_mapnode_t * node = fd_pubkey_pubkey_pair_t_map_acquire( epoch_authorized_voters_pool );
2878 0 : fd_pubkey_pubkey_pair_new( (fd_pubkey_pubkey_pair_t *)fd_type_pun(&node->elem) );
2879 0 : fd_pubkey_pubkey_pair_decode_inner( &node->elem, alloc_mem, ctx );
2880 0 : fd_pubkey_pubkey_pair_t_map_insert( epoch_authorized_voters_pool, &epoch_authorized_voters_root, node );
2881 0 : }
2882 0 : self->epoch_authorized_voters_pool_offset = (ulong)fd_pubkey_pubkey_pair_t_map_leave( epoch_authorized_voters_pool ) - (ulong)struct_mem;
2883 0 : self->epoch_authorized_voters_root_offset = (ulong)epoch_authorized_voters_root - (ulong)struct_mem;
2884 0 : }
2885 0 : void * fd_epoch_stakes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2886 0 : fd_epoch_stakes_global_t * self = (fd_epoch_stakes_global_t *)mem;
2887 0 : fd_epoch_stakes_new( (fd_epoch_stakes_t *)self );
2888 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_stakes_global_t);
2889 0 : void * * alloc_mem = &alloc_region;
2890 0 : fd_epoch_stakes_decode_inner_global( mem, alloc_mem, ctx );
2891 0 : return self;
2892 0 : }
2893 0 : void fd_epoch_stakes_new(fd_epoch_stakes_t * self) {
2894 0 : fd_memset( self, 0, sizeof(fd_epoch_stakes_t) );
2895 0 : fd_stakes_new( &self->stakes );
2896 0 : }
2897 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, uint varint ) {
2898 0 : (void) varint;
2899 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_stakes", level++, 0 );
2900 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level, 0 );
2901 0 : fun( w, &self->total_stake, "total_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2902 0 : if( self->node_id_to_vote_accounts_root ) {
2903 0 : for( fd_pubkey_node_vote_accounts_pair_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_t_map_minimum(self->node_id_to_vote_accounts_pool, self->node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_t_map_successor( self->node_id_to_vote_accounts_pool, n ) ) {
2904 0 : fd_pubkey_node_vote_accounts_pair_walk(w, &n->elem, fun, "node_id_to_vote_accounts", level, 0 );
2905 0 : }
2906 0 : }
2907 0 : if( self->epoch_authorized_voters_root ) {
2908 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum(self->epoch_authorized_voters_pool, self->epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( self->epoch_authorized_voters_pool, n ) ) {
2909 0 : fd_pubkey_pubkey_pair_walk(w, &n->elem, fun, "epoch_authorized_voters", level, 0 );
2910 0 : }
2911 0 : }
2912 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_stakes", level--, 0 );
2913 0 : }
2914 0 : ulong fd_epoch_stakes_size( fd_epoch_stakes_t const * self ) {
2915 0 : ulong size = 0;
2916 0 : size += fd_stakes_size( &self->stakes );
2917 0 : size += sizeof(ulong);
2918 0 : if( self->node_id_to_vote_accounts_root ) {
2919 0 : size += sizeof(ulong);
2920 0 : ulong max = fd_pubkey_node_vote_accounts_pair_t_map_max( self->node_id_to_vote_accounts_pool );
2921 0 : size += fd_pubkey_node_vote_accounts_pair_t_map_footprint( max );
2922 0 : for( fd_pubkey_node_vote_accounts_pair_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_t_map_minimum( self->node_id_to_vote_accounts_pool, self->node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_t_map_successor( self->node_id_to_vote_accounts_pool, n ) ) {
2923 0 : size += fd_pubkey_node_vote_accounts_pair_size( &n->elem ) - sizeof(fd_pubkey_node_vote_accounts_pair_t);
2924 0 : }
2925 0 : } else {
2926 0 : size += sizeof(ulong);
2927 0 : }
2928 0 : if( self->epoch_authorized_voters_root ) {
2929 0 : size += sizeof(ulong);
2930 0 : ulong max = fd_pubkey_pubkey_pair_t_map_max( self->epoch_authorized_voters_pool );
2931 0 : size += fd_pubkey_pubkey_pair_t_map_footprint( max );
2932 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum( self->epoch_authorized_voters_pool, self->epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( self->epoch_authorized_voters_pool, n ) ) {
2933 0 : size += fd_pubkey_pubkey_pair_size( &n->elem ) - sizeof(fd_pubkey_pubkey_pair_t);
2934 0 : }
2935 0 : } else {
2936 0 : size += sizeof(ulong);
2937 0 : }
2938 0 : return size;
2939 0 : }
2940 :
2941 0 : ulong fd_epoch_stakes_size_global( fd_epoch_stakes_global_t const * self ) {
2942 0 : ulong size = 0;
2943 0 : size += fd_stakes_size_global( &self->stakes );
2944 0 : size += sizeof(ulong);
2945 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_pool = !!self->node_id_to_vote_accounts_pool_offset ? (fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t *)fd_pubkey_node_vote_accounts_pair_global_t_map_join( fd_type_pun( (uchar *)self + self->node_id_to_vote_accounts_pool_offset ) ) : NULL;
2946 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_root = !!self->node_id_to_vote_accounts_root_offset ? (fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t *)fd_type_pun( (uchar *)self + self->node_id_to_vote_accounts_root_offset ) : NULL;
2947 0 : if( node_id_to_vote_accounts_root ) {
2948 0 : size += sizeof(ulong);
2949 0 : ulong max = fd_pubkey_node_vote_accounts_pair_global_t_map_max( node_id_to_vote_accounts_pool );
2950 0 : size += fd_pubkey_node_vote_accounts_pair_global_t_map_footprint( max );
2951 0 : for( fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_global_t_map_minimum( node_id_to_vote_accounts_pool, node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_global_t_map_successor( node_id_to_vote_accounts_pool, n ) ) {
2952 0 : size += fd_pubkey_node_vote_accounts_pair_size_global( &n->elem ) - sizeof(fd_pubkey_node_vote_accounts_pair_t);
2953 0 : }
2954 0 : } else {
2955 0 : size += sizeof(ulong);
2956 0 : }
2957 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_pool = !!self->epoch_authorized_voters_pool_offset ? (fd_pubkey_pubkey_pair_t_mapnode_t *)fd_pubkey_pubkey_pair_t_map_join( fd_type_pun( (uchar *)self + self->epoch_authorized_voters_pool_offset ) ) : NULL;
2958 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_root = !!self->epoch_authorized_voters_root_offset ? (fd_pubkey_pubkey_pair_t_mapnode_t *)fd_type_pun( (uchar *)self + self->epoch_authorized_voters_root_offset ) : NULL;
2959 0 : if( epoch_authorized_voters_root ) {
2960 0 : size += sizeof(ulong);
2961 0 : ulong max = fd_pubkey_pubkey_pair_t_map_max( epoch_authorized_voters_pool );
2962 0 : size += fd_pubkey_pubkey_pair_t_map_footprint( max );
2963 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum( epoch_authorized_voters_pool, epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( epoch_authorized_voters_pool, n ) ) {
2964 0 : size += fd_pubkey_pubkey_pair_size( &n->elem ) - sizeof(fd_pubkey_pubkey_pair_t);
2965 0 : }
2966 0 : } else {
2967 0 : size += sizeof(ulong);
2968 0 : }
2969 0 : return size;
2970 0 : }
2971 :
2972 0 : int fd_epoch_epoch_stakes_pair_encode( fd_epoch_epoch_stakes_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2973 0 : int err;
2974 0 : err = fd_bincode_uint64_encode( self->key, ctx );
2975 0 : if( FD_UNLIKELY( err ) ) return err;
2976 0 : err = fd_epoch_stakes_encode( &self->value, ctx );
2977 0 : if( FD_UNLIKELY( err ) ) return err;
2978 0 : return FD_BINCODE_SUCCESS;
2979 0 : }
2980 0 : int fd_epoch_epoch_stakes_pair_encode_global( fd_epoch_epoch_stakes_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2981 0 : int err;
2982 0 : err = fd_bincode_uint64_encode( self->key, ctx );
2983 0 : if( FD_UNLIKELY( err ) ) return err;
2984 0 : err = fd_epoch_stakes_encode_global( &self->value, ctx );
2985 0 : if( FD_UNLIKELY( err ) ) return err;
2986 0 : return FD_BINCODE_SUCCESS;
2987 0 : }
2988 0 : static int fd_epoch_epoch_stakes_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2989 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2990 0 : int err = 0;
2991 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2992 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2993 0 : err = fd_epoch_stakes_decode_footprint_inner( ctx, total_sz );
2994 0 : if( FD_UNLIKELY( err ) ) return err;
2995 0 : return 0;
2996 0 : }
2997 0 : int fd_epoch_epoch_stakes_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2998 0 : *total_sz += sizeof(fd_epoch_epoch_stakes_pair_t);
2999 0 : void const * start_data = ctx->data;
3000 0 : int err = fd_epoch_epoch_stakes_pair_decode_footprint_inner( ctx, total_sz );
3001 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3002 0 : ctx->data = start_data;
3003 0 : return err;
3004 0 : }
3005 0 : static void fd_epoch_epoch_stakes_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3006 0 : fd_epoch_epoch_stakes_pair_t * self = (fd_epoch_epoch_stakes_pair_t *)struct_mem;
3007 0 : fd_bincode_uint64_decode_unsafe( &self->key, ctx );
3008 0 : fd_epoch_stakes_decode_inner( &self->value, alloc_mem, ctx );
3009 0 : }
3010 0 : void * fd_epoch_epoch_stakes_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3011 0 : fd_epoch_epoch_stakes_pair_t * self = (fd_epoch_epoch_stakes_pair_t *)mem;
3012 0 : fd_epoch_epoch_stakes_pair_new( self );
3013 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_epoch_stakes_pair_t);
3014 0 : void * * alloc_mem = &alloc_region;
3015 0 : fd_epoch_epoch_stakes_pair_decode_inner( mem, alloc_mem, ctx );
3016 0 : return self;
3017 0 : }
3018 0 : static void fd_epoch_epoch_stakes_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3019 0 : fd_epoch_epoch_stakes_pair_global_t * self = (fd_epoch_epoch_stakes_pair_global_t *)struct_mem;
3020 0 : fd_bincode_uint64_decode_unsafe( &self->key, ctx );
3021 0 : fd_epoch_stakes_decode_inner_global( &self->value, alloc_mem, ctx );
3022 0 : }
3023 0 : void * fd_epoch_epoch_stakes_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3024 0 : fd_epoch_epoch_stakes_pair_global_t * self = (fd_epoch_epoch_stakes_pair_global_t *)mem;
3025 0 : fd_epoch_epoch_stakes_pair_new( (fd_epoch_epoch_stakes_pair_t *)self );
3026 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_epoch_stakes_pair_global_t);
3027 0 : void * * alloc_mem = &alloc_region;
3028 0 : fd_epoch_epoch_stakes_pair_decode_inner_global( mem, alloc_mem, ctx );
3029 0 : return self;
3030 0 : }
3031 0 : void fd_epoch_epoch_stakes_pair_new(fd_epoch_epoch_stakes_pair_t * self) {
3032 0 : fd_memset( self, 0, sizeof(fd_epoch_epoch_stakes_pair_t) );
3033 0 : fd_epoch_stakes_new( &self->value );
3034 0 : }
3035 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, uint varint ) {
3036 0 : (void) varint;
3037 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_epoch_stakes_pair", level++, 0 );
3038 0 : fun( w, &self->key, "key", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3039 0 : fd_epoch_stakes_walk( w, &self->value, fun, "value", level, 0 );
3040 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_epoch_stakes_pair", level--, 0 );
3041 0 : }
3042 0 : ulong fd_epoch_epoch_stakes_pair_size( fd_epoch_epoch_stakes_pair_t const * self ) {
3043 0 : ulong size = 0;
3044 0 : size += sizeof(ulong);
3045 0 : size += fd_epoch_stakes_size( &self->value );
3046 0 : return size;
3047 0 : }
3048 :
3049 0 : ulong fd_epoch_epoch_stakes_pair_size_global( fd_epoch_epoch_stakes_pair_global_t const * self ) {
3050 0 : ulong size = 0;
3051 0 : size += sizeof(ulong);
3052 0 : size += fd_epoch_stakes_size_global( &self->value );
3053 0 : return size;
3054 0 : }
3055 :
3056 0 : int fd_pubkey_u64_pair_encode( fd_pubkey_u64_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3057 0 : int err;
3058 0 : err = fd_pubkey_encode( &self->_0, ctx );
3059 0 : if( FD_UNLIKELY( err ) ) return err;
3060 0 : err = fd_bincode_uint64_encode( self->_1, ctx );
3061 0 : if( FD_UNLIKELY( err ) ) return err;
3062 0 : return FD_BINCODE_SUCCESS;
3063 0 : }
3064 0 : static inline int fd_pubkey_u64_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3065 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3066 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
3067 0 : return 0;
3068 0 : }
3069 0 : static void fd_pubkey_u64_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3070 0 : fd_pubkey_u64_pair_t * self = (fd_pubkey_u64_pair_t *)struct_mem;
3071 0 : fd_pubkey_decode_inner( &self->_0, alloc_mem, ctx );
3072 0 : fd_bincode_uint64_decode_unsafe( &self->_1, ctx );
3073 0 : }
3074 0 : void * fd_pubkey_u64_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3075 0 : fd_pubkey_u64_pair_t * self = (fd_pubkey_u64_pair_t *)mem;
3076 0 : fd_pubkey_u64_pair_new( self );
3077 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_u64_pair_t);
3078 0 : void * * alloc_mem = &alloc_region;
3079 0 : fd_pubkey_u64_pair_decode_inner( mem, alloc_mem, ctx );
3080 0 : return self;
3081 0 : }
3082 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, uint varint ) {
3083 0 : (void) varint;
3084 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_u64_pair", level++, 0 );
3085 0 : fd_pubkey_walk( w, &self->_0, fun, "_0", level, 0 );
3086 0 : fun( w, &self->_1, "_1", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3087 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_u64_pair", level--, 0 );
3088 0 : }
3089 0 : int fd_unused_accounts_encode( fd_unused_accounts_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3090 0 : int err;
3091 0 : err = fd_bincode_uint64_encode( self->unused1_len, ctx );
3092 0 : if( FD_UNLIKELY(err) ) return err;
3093 0 : if( self->unused1_len ) {
3094 0 : for( ulong i=0; i < self->unused1_len; i++ ) {
3095 0 : err = fd_pubkey_encode( self->unused1 + i, ctx );
3096 0 : if( FD_UNLIKELY( err ) ) return err;
3097 0 : }
3098 0 : }
3099 0 : err = fd_bincode_uint64_encode( self->unused2_len, ctx );
3100 0 : if( FD_UNLIKELY(err) ) return err;
3101 0 : if( self->unused2_len ) {
3102 0 : for( ulong i=0; i < self->unused2_len; i++ ) {
3103 0 : err = fd_pubkey_encode( self->unused2 + i, ctx );
3104 0 : if( FD_UNLIKELY( err ) ) return err;
3105 0 : }
3106 0 : }
3107 0 : err = fd_bincode_uint64_encode( self->unused3_len, ctx );
3108 0 : if( FD_UNLIKELY(err) ) return err;
3109 0 : if( self->unused3_len ) {
3110 0 : for( ulong i=0; i < self->unused3_len; i++ ) {
3111 0 : err = fd_pubkey_u64_pair_encode( self->unused3 + i, ctx );
3112 0 : if( FD_UNLIKELY( err ) ) return err;
3113 0 : }
3114 0 : }
3115 0 : return FD_BINCODE_SUCCESS;
3116 0 : }
3117 0 : int fd_unused_accounts_encode_global( fd_unused_accounts_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3118 0 : int err;
3119 0 : err = fd_bincode_uint64_encode( self->unused1_len, ctx );
3120 0 : if( FD_UNLIKELY( err ) ) return err;
3121 0 : if( self->unused1_len ) {
3122 0 : uchar * unused1_laddr = (uchar*)self + self->unused1_offset;
3123 0 : fd_pubkey_t * unused1 = (fd_pubkey_t *)unused1_laddr;
3124 0 : for( ulong i=0; i < self->unused1_len; i++ ) {
3125 0 : err = fd_pubkey_encode( &unused1[i], ctx );
3126 0 : if( FD_UNLIKELY( err ) ) return err;
3127 0 : }
3128 0 : }
3129 0 : err = fd_bincode_uint64_encode( self->unused2_len, ctx );
3130 0 : if( FD_UNLIKELY( err ) ) return err;
3131 0 : if( self->unused2_len ) {
3132 0 : uchar * unused2_laddr = (uchar*)self + self->unused2_offset;
3133 0 : fd_pubkey_t * unused2 = (fd_pubkey_t *)unused2_laddr;
3134 0 : for( ulong i=0; i < self->unused2_len; i++ ) {
3135 0 : err = fd_pubkey_encode( &unused2[i], ctx );
3136 0 : if( FD_UNLIKELY( err ) ) return err;
3137 0 : }
3138 0 : }
3139 0 : err = fd_bincode_uint64_encode( self->unused3_len, ctx );
3140 0 : if( FD_UNLIKELY( err ) ) return err;
3141 0 : if( self->unused3_len ) {
3142 0 : uchar * unused3_laddr = (uchar*)self + self->unused3_offset;
3143 0 : fd_pubkey_u64_pair_t * unused3 = (fd_pubkey_u64_pair_t *)unused3_laddr;
3144 0 : for( ulong i=0; i < self->unused3_len; i++ ) {
3145 0 : err = fd_pubkey_u64_pair_encode( &unused3[i], ctx );
3146 0 : if( FD_UNLIKELY( err ) ) return err;
3147 0 : }
3148 0 : }
3149 0 : return FD_BINCODE_SUCCESS;
3150 0 : }
3151 0 : static int fd_unused_accounts_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3152 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3153 0 : int err = 0;
3154 0 : ulong unused1_len;
3155 0 : err = fd_bincode_uint64_decode( &unused1_len, ctx );
3156 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3157 0 : if( unused1_len ) {
3158 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*unused1_len;
3159 0 : for( ulong i=0; i < unused1_len; i++ ) {
3160 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3161 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3162 0 : }
3163 0 : }
3164 0 : ulong unused2_len;
3165 0 : err = fd_bincode_uint64_decode( &unused2_len, ctx );
3166 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3167 0 : if( unused2_len ) {
3168 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*unused2_len;
3169 0 : for( ulong i=0; i < unused2_len; i++ ) {
3170 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3171 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3172 0 : }
3173 0 : }
3174 0 : ulong unused3_len;
3175 0 : err = fd_bincode_uint64_decode( &unused3_len, ctx );
3176 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3177 0 : if( unused3_len ) {
3178 0 : *total_sz += FD_PUBKEY_U64_PAIR_ALIGN + sizeof(fd_pubkey_u64_pair_t)*unused3_len;
3179 0 : for( ulong i=0; i < unused3_len; i++ ) {
3180 0 : err = fd_pubkey_u64_pair_decode_footprint_inner( ctx, total_sz );
3181 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3182 0 : }
3183 0 : }
3184 0 : return 0;
3185 0 : }
3186 0 : int fd_unused_accounts_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3187 0 : *total_sz += sizeof(fd_unused_accounts_t);
3188 0 : void const * start_data = ctx->data;
3189 0 : int err = fd_unused_accounts_decode_footprint_inner( ctx, total_sz );
3190 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3191 0 : ctx->data = start_data;
3192 0 : return err;
3193 0 : }
3194 0 : static void fd_unused_accounts_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3195 0 : fd_unused_accounts_t * self = (fd_unused_accounts_t *)struct_mem;
3196 0 : fd_bincode_uint64_decode_unsafe( &self->unused1_len, ctx );
3197 0 : if( self->unused1_len ) {
3198 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
3199 0 : self->unused1 = *alloc_mem;
3200 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->unused1_len;
3201 0 : for( ulong i=0; i < self->unused1_len; i++ ) {
3202 0 : fd_pubkey_new( self->unused1 + i );
3203 0 : fd_pubkey_decode_inner( self->unused1 + i, alloc_mem, ctx );
3204 0 : }
3205 0 : } else
3206 0 : self->unused1 = NULL;
3207 0 : fd_bincode_uint64_decode_unsafe( &self->unused2_len, ctx );
3208 0 : if( self->unused2_len ) {
3209 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
3210 0 : self->unused2 = *alloc_mem;
3211 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->unused2_len;
3212 0 : for( ulong i=0; i < self->unused2_len; i++ ) {
3213 0 : fd_pubkey_new( self->unused2 + i );
3214 0 : fd_pubkey_decode_inner( self->unused2 + i, alloc_mem, ctx );
3215 0 : }
3216 0 : } else
3217 0 : self->unused2 = NULL;
3218 0 : fd_bincode_uint64_decode_unsafe( &self->unused3_len, ctx );
3219 0 : if( self->unused3_len ) {
3220 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_U64_PAIR_ALIGN );
3221 0 : self->unused3 = *alloc_mem;
3222 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_u64_pair_t)*self->unused3_len;
3223 0 : for( ulong i=0; i < self->unused3_len; i++ ) {
3224 0 : fd_pubkey_u64_pair_new( self->unused3 + i );
3225 0 : fd_pubkey_u64_pair_decode_inner( self->unused3 + i, alloc_mem, ctx );
3226 0 : }
3227 0 : } else
3228 0 : self->unused3 = NULL;
3229 0 : }
3230 0 : void * fd_unused_accounts_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3231 0 : fd_unused_accounts_t * self = (fd_unused_accounts_t *)mem;
3232 0 : fd_unused_accounts_new( self );
3233 0 : void * alloc_region = (uchar *)mem + sizeof(fd_unused_accounts_t);
3234 0 : void * * alloc_mem = &alloc_region;
3235 0 : fd_unused_accounts_decode_inner( mem, alloc_mem, ctx );
3236 0 : return self;
3237 0 : }
3238 0 : static void fd_unused_accounts_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3239 0 : fd_unused_accounts_global_t * self = (fd_unused_accounts_global_t *)struct_mem;
3240 0 : fd_bincode_uint64_decode_unsafe( &self->unused1_len, ctx );
3241 0 : if( self->unused1_len ) {
3242 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
3243 0 : self->unused1_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3244 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3245 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->unused1_len;
3246 0 : for( ulong i=0; i < self->unused1_len; i++ ) {
3247 0 : fd_pubkey_new( (fd_pubkey_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_t) * i) );
3248 0 : fd_pubkey_decode_inner( cur_mem + sizeof(fd_pubkey_t) * i, alloc_mem, ctx );
3249 0 : }
3250 0 : } else {
3251 0 : self->unused1_offset = 0UL;
3252 0 : }
3253 0 : fd_bincode_uint64_decode_unsafe( &self->unused2_len, ctx );
3254 0 : if( self->unused2_len ) {
3255 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
3256 0 : self->unused2_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3257 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3258 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->unused2_len;
3259 0 : for( ulong i=0; i < self->unused2_len; i++ ) {
3260 0 : fd_pubkey_new( (fd_pubkey_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_t) * i) );
3261 0 : fd_pubkey_decode_inner( cur_mem + sizeof(fd_pubkey_t) * i, alloc_mem, ctx );
3262 0 : }
3263 0 : } else {
3264 0 : self->unused2_offset = 0UL;
3265 0 : }
3266 0 : fd_bincode_uint64_decode_unsafe( &self->unused3_len, ctx );
3267 0 : if( self->unused3_len ) {
3268 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_U64_PAIR_ALIGN );
3269 0 : self->unused3_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3270 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3271 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_u64_pair_t)*self->unused3_len;
3272 0 : for( ulong i=0; i < self->unused3_len; i++ ) {
3273 0 : fd_pubkey_u64_pair_new( (fd_pubkey_u64_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_u64_pair_t) * i) );
3274 0 : fd_pubkey_u64_pair_decode_inner( cur_mem + sizeof(fd_pubkey_u64_pair_t) * i, alloc_mem, ctx );
3275 0 : }
3276 0 : } else {
3277 0 : self->unused3_offset = 0UL;
3278 0 : }
3279 0 : }
3280 0 : void * fd_unused_accounts_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3281 0 : fd_unused_accounts_global_t * self = (fd_unused_accounts_global_t *)mem;
3282 0 : fd_unused_accounts_new( (fd_unused_accounts_t *)self );
3283 0 : void * alloc_region = (uchar *)mem + sizeof(fd_unused_accounts_global_t);
3284 0 : void * * alloc_mem = &alloc_region;
3285 0 : fd_unused_accounts_decode_inner_global( mem, alloc_mem, ctx );
3286 0 : return self;
3287 0 : }
3288 0 : void fd_unused_accounts_new(fd_unused_accounts_t * self) {
3289 0 : fd_memset( self, 0, sizeof(fd_unused_accounts_t) );
3290 0 : }
3291 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, uint varint ) {
3292 0 : (void) varint;
3293 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_unused_accounts", level++, 0 );
3294 0 : if( self->unused1_len ) {
3295 0 : fun( w, NULL, "unused1", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
3296 0 : for( ulong i=0; i < self->unused1_len; i++ )
3297 0 : fd_pubkey_walk(w, self->unused1 + i, fun, "pubkey", level, 0 );
3298 0 : fun( w, NULL, "unused1", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
3299 0 : }
3300 0 : if( self->unused2_len ) {
3301 0 : fun( w, NULL, "unused2", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
3302 0 : for( ulong i=0; i < self->unused2_len; i++ )
3303 0 : fd_pubkey_walk(w, self->unused2 + i, fun, "pubkey", level, 0 );
3304 0 : fun( w, NULL, "unused2", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
3305 0 : }
3306 0 : if( self->unused3_len ) {
3307 0 : fun( w, NULL, "unused3", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
3308 0 : for( ulong i=0; i < self->unused3_len; i++ )
3309 0 : fd_pubkey_u64_pair_walk(w, self->unused3 + i, fun, "pubkey_u64_pair", level, 0 );
3310 0 : fun( w, NULL, "unused3", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
3311 0 : }
3312 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_unused_accounts", level--, 0 );
3313 0 : }
3314 0 : ulong fd_unused_accounts_size( fd_unused_accounts_t const * self ) {
3315 0 : ulong size = 0;
3316 0 : do {
3317 0 : size += sizeof(ulong);
3318 0 : for( ulong i=0; i < self->unused1_len; i++ )
3319 0 : size += fd_pubkey_size( self->unused1 + i );
3320 0 : } while(0);
3321 0 : do {
3322 0 : size += sizeof(ulong);
3323 0 : for( ulong i=0; i < self->unused2_len; i++ )
3324 0 : size += fd_pubkey_size( self->unused2 + i );
3325 0 : } while(0);
3326 0 : do {
3327 0 : size += sizeof(ulong);
3328 0 : for( ulong i=0; i < self->unused3_len; i++ )
3329 0 : size += fd_pubkey_u64_pair_size( self->unused3 + i );
3330 0 : } while(0);
3331 0 : return size;
3332 0 : }
3333 :
3334 0 : ulong fd_unused_accounts_size_global( fd_unused_accounts_global_t const * self ) {
3335 0 : ulong size = 0;
3336 0 : do {
3337 0 : size += sizeof(ulong);
3338 0 : fd_pubkey_t * unused1 = self->unused1_offset ? (fd_pubkey_t *)fd_type_pun( (uchar *)self + self->unused1_offset ) : NULL;
3339 0 : for( ulong i=0; i < self->unused1_len; i++ )
3340 0 : size += fd_pubkey_size( unused1 + i );
3341 0 : } while(0);
3342 0 : do {
3343 0 : size += sizeof(ulong);
3344 0 : fd_pubkey_t * unused2 = self->unused2_offset ? (fd_pubkey_t *)fd_type_pun( (uchar *)self + self->unused2_offset ) : NULL;
3345 0 : for( ulong i=0; i < self->unused2_len; i++ )
3346 0 : size += fd_pubkey_size( unused2 + i );
3347 0 : } while(0);
3348 0 : do {
3349 0 : size += sizeof(ulong);
3350 0 : fd_pubkey_u64_pair_t * unused3 = self->unused3_offset ? (fd_pubkey_u64_pair_t *)fd_type_pun( (uchar *)self + self->unused3_offset ) : NULL;
3351 0 : for( ulong i=0; i < self->unused3_len; i++ )
3352 0 : size += fd_pubkey_u64_pair_size( unused3 + i );
3353 0 : } while(0);
3354 0 : return size;
3355 0 : }
3356 :
3357 0 : int fd_versioned_bank_encode( fd_versioned_bank_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3358 0 : int err;
3359 0 : err = fd_block_hash_vec_encode( &self->blockhash_queue, ctx );
3360 0 : if( FD_UNLIKELY( err ) ) return err;
3361 0 : err = fd_bincode_uint64_encode( self->ancestors_len, ctx );
3362 0 : if( FD_UNLIKELY(err) ) return err;
3363 0 : if( self->ancestors_len ) {
3364 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
3365 0 : err = fd_slot_pair_encode( self->ancestors + i, ctx );
3366 0 : if( FD_UNLIKELY( err ) ) return err;
3367 0 : }
3368 0 : }
3369 0 : err = fd_hash_encode( &self->hash, ctx );
3370 0 : if( FD_UNLIKELY( err ) ) return err;
3371 0 : err = fd_hash_encode( &self->parent_hash, ctx );
3372 0 : if( FD_UNLIKELY( err ) ) return err;
3373 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
3374 0 : if( FD_UNLIKELY( err ) ) return err;
3375 0 : err = fd_hard_forks_encode( &self->hard_forks, ctx );
3376 0 : if( FD_UNLIKELY( err ) ) return err;
3377 0 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
3378 0 : if( FD_UNLIKELY( err ) ) return err;
3379 0 : err = fd_bincode_uint64_encode( self->tick_height, ctx );
3380 0 : if( FD_UNLIKELY( err ) ) return err;
3381 0 : err = fd_bincode_uint64_encode( self->signature_count, ctx );
3382 0 : if( FD_UNLIKELY( err ) ) return err;
3383 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
3384 0 : if( FD_UNLIKELY( err ) ) return err;
3385 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
3386 0 : if( FD_UNLIKELY( err ) ) return err;
3387 0 : if( self->hashes_per_tick != NULL ) {
3388 0 : err = fd_bincode_bool_encode( 1, ctx );
3389 0 : if( FD_UNLIKELY( err ) ) return err;
3390 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick[0], ctx );
3391 0 : if( FD_UNLIKELY( err ) ) return err;
3392 0 : } else {
3393 0 : err = fd_bincode_bool_encode( 0, ctx );
3394 0 : if( FD_UNLIKELY( err ) ) return err;
3395 0 : }
3396 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
3397 0 : if( FD_UNLIKELY( err ) ) return err;
3398 0 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
3399 0 : if( FD_UNLIKELY( err ) ) return err;
3400 0 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
3401 0 : if( FD_UNLIKELY( err ) ) return err;
3402 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
3403 0 : if( FD_UNLIKELY( err ) ) return err;
3404 0 : err = fd_bincode_uint64_encode( self->accounts_data_len, ctx );
3405 0 : if( FD_UNLIKELY( err ) ) return err;
3406 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
3407 0 : if( FD_UNLIKELY( err ) ) return err;
3408 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
3409 0 : if( FD_UNLIKELY( err ) ) return err;
3410 0 : err = fd_bincode_uint64_encode( self->block_height, ctx );
3411 0 : if( FD_UNLIKELY( err ) ) return err;
3412 0 : err = fd_pubkey_encode( &self->collector_id, ctx );
3413 0 : if( FD_UNLIKELY( err ) ) return err;
3414 0 : err = fd_bincode_uint64_encode( self->collector_fees, ctx );
3415 0 : if( FD_UNLIKELY( err ) ) return err;
3416 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
3417 0 : if( FD_UNLIKELY( err ) ) return err;
3418 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
3419 0 : if( FD_UNLIKELY( err ) ) return err;
3420 0 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
3421 0 : if( FD_UNLIKELY( err ) ) return err;
3422 0 : err = fd_rent_collector_encode( &self->rent_collector, ctx );
3423 0 : if( FD_UNLIKELY( err ) ) return err;
3424 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
3425 0 : if( FD_UNLIKELY( err ) ) return err;
3426 0 : err = fd_inflation_encode( &self->inflation, ctx );
3427 0 : if( FD_UNLIKELY( err ) ) return err;
3428 0 : err = fd_stakes_encode( &self->stakes, ctx );
3429 0 : if( FD_UNLIKELY( err ) ) return err;
3430 0 : err = fd_unused_accounts_encode( &self->unused_accounts, ctx );
3431 0 : if( FD_UNLIKELY( err ) ) return err;
3432 0 : err = fd_bincode_uint64_encode( self->epoch_stakes_len, ctx );
3433 0 : if( FD_UNLIKELY(err) ) return err;
3434 0 : if( self->epoch_stakes_len ) {
3435 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
3436 0 : err = fd_epoch_epoch_stakes_pair_encode( self->epoch_stakes + i, ctx );
3437 0 : if( FD_UNLIKELY( err ) ) return err;
3438 0 : }
3439 0 : }
3440 0 : err = fd_bincode_bool_encode( (uchar)(self->is_delta), ctx );
3441 0 : if( FD_UNLIKELY( err ) ) return err;
3442 0 : return FD_BINCODE_SUCCESS;
3443 0 : }
3444 0 : int fd_versioned_bank_encode_global( fd_versioned_bank_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3445 0 : int err;
3446 0 : err = fd_block_hash_vec_encode_global( &self->blockhash_queue, ctx );
3447 0 : if( FD_UNLIKELY( err ) ) return err;
3448 0 : err = fd_bincode_uint64_encode( self->ancestors_len, ctx );
3449 0 : if( FD_UNLIKELY( err ) ) return err;
3450 0 : if( self->ancestors_len ) {
3451 0 : uchar * ancestors_laddr = (uchar*)self + self->ancestors_offset;
3452 0 : fd_slot_pair_t * ancestors = (fd_slot_pair_t *)ancestors_laddr;
3453 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
3454 0 : err = fd_slot_pair_encode( &ancestors[i], ctx );
3455 0 : if( FD_UNLIKELY( err ) ) return err;
3456 0 : }
3457 0 : }
3458 0 : err = fd_hash_encode( &self->hash, ctx );
3459 0 : if( FD_UNLIKELY( err ) ) return err;
3460 0 : err = fd_hash_encode( &self->parent_hash, ctx );
3461 0 : if( FD_UNLIKELY( err ) ) return err;
3462 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
3463 0 : if( FD_UNLIKELY( err ) ) return err;
3464 0 : err = fd_hard_forks_encode_global( &self->hard_forks, ctx );
3465 0 : if( FD_UNLIKELY( err ) ) return err;
3466 0 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
3467 0 : if( FD_UNLIKELY( err ) ) return err;
3468 0 : err = fd_bincode_uint64_encode( self->tick_height, ctx );
3469 0 : if( FD_UNLIKELY( err ) ) return err;
3470 0 : err = fd_bincode_uint64_encode( self->signature_count, ctx );
3471 0 : if( FD_UNLIKELY( err ) ) return err;
3472 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
3473 0 : if( FD_UNLIKELY( err ) ) return err;
3474 0 : err = fd_bincode_uint64_encode( self->max_tick_height, ctx );
3475 0 : if( FD_UNLIKELY( err ) ) return err;
3476 0 : if( self->hashes_per_tick_offset ) {
3477 0 : err = fd_bincode_bool_encode( 1, ctx );
3478 0 : if( FD_UNLIKELY( err ) ) return err;
3479 0 : ulong * hashes_per_tick = (void *)((uchar*)self + self->hashes_per_tick_offset);
3480 0 : err = fd_bincode_uint64_encode( hashes_per_tick[0], ctx );
3481 0 : if( FD_UNLIKELY( err ) ) return err;
3482 0 : } else {
3483 0 : err = fd_bincode_bool_encode( 0, ctx );
3484 0 : if( FD_UNLIKELY( err ) ) return err;
3485 0 : }
3486 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
3487 0 : if( FD_UNLIKELY( err ) ) return err;
3488 0 : err = fd_bincode_uint128_encode( self->ns_per_slot, ctx );
3489 0 : if( FD_UNLIKELY( err ) ) return err;
3490 0 : err = fd_bincode_uint64_encode( self->genesis_creation_time, ctx );
3491 0 : if( FD_UNLIKELY( err ) ) return err;
3492 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
3493 0 : if( FD_UNLIKELY( err ) ) return err;
3494 0 : err = fd_bincode_uint64_encode( self->accounts_data_len, ctx );
3495 0 : if( FD_UNLIKELY( err ) ) return err;
3496 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
3497 0 : if( FD_UNLIKELY( err ) ) return err;
3498 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
3499 0 : if( FD_UNLIKELY( err ) ) return err;
3500 0 : err = fd_bincode_uint64_encode( self->block_height, ctx );
3501 0 : if( FD_UNLIKELY( err ) ) return err;
3502 0 : err = fd_pubkey_encode( &self->collector_id, ctx );
3503 0 : if( FD_UNLIKELY( err ) ) return err;
3504 0 : err = fd_bincode_uint64_encode( self->collector_fees, ctx );
3505 0 : if( FD_UNLIKELY( err ) ) return err;
3506 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
3507 0 : if( FD_UNLIKELY( err ) ) return err;
3508 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
3509 0 : if( FD_UNLIKELY( err ) ) return err;
3510 0 : err = fd_bincode_uint64_encode( self->collected_rent, ctx );
3511 0 : if( FD_UNLIKELY( err ) ) return err;
3512 0 : err = fd_rent_collector_encode( &self->rent_collector, ctx );
3513 0 : if( FD_UNLIKELY( err ) ) return err;
3514 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
3515 0 : if( FD_UNLIKELY( err ) ) return err;
3516 0 : err = fd_inflation_encode( &self->inflation, ctx );
3517 0 : if( FD_UNLIKELY( err ) ) return err;
3518 0 : err = fd_stakes_encode_global( &self->stakes, ctx );
3519 0 : if( FD_UNLIKELY( err ) ) return err;
3520 0 : err = fd_unused_accounts_encode_global( &self->unused_accounts, ctx );
3521 0 : if( FD_UNLIKELY( err ) ) return err;
3522 0 : err = fd_bincode_uint64_encode( self->epoch_stakes_len, ctx );
3523 0 : if( FD_UNLIKELY( err ) ) return err;
3524 0 : if( self->epoch_stakes_len ) {
3525 0 : uchar * epoch_stakes_laddr = (uchar*)self + self->epoch_stakes_offset;
3526 0 : fd_epoch_epoch_stakes_pair_global_t * epoch_stakes = (fd_epoch_epoch_stakes_pair_global_t *)epoch_stakes_laddr;
3527 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
3528 0 : err = fd_epoch_epoch_stakes_pair_encode_global( &epoch_stakes[i], ctx );
3529 0 : if( FD_UNLIKELY( err ) ) return err;
3530 0 : }
3531 0 : }
3532 0 : err = fd_bincode_bool_encode( (uchar)(self->is_delta), ctx );
3533 0 : if( FD_UNLIKELY( err ) ) return err;
3534 0 : return FD_BINCODE_SUCCESS;
3535 0 : }
3536 0 : static int fd_versioned_bank_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3537 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3538 0 : int err = 0;
3539 0 : err = fd_block_hash_vec_decode_footprint_inner( ctx, total_sz );
3540 0 : if( FD_UNLIKELY( err ) ) return err;
3541 0 : ulong ancestors_len;
3542 0 : err = fd_bincode_uint64_decode( &ancestors_len, ctx );
3543 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3544 0 : if( ancestors_len ) {
3545 0 : *total_sz += FD_SLOT_PAIR_ALIGN + sizeof(fd_slot_pair_t)*ancestors_len;
3546 0 : for( ulong i=0; i < ancestors_len; i++ ) {
3547 0 : err = fd_slot_pair_decode_footprint_inner( ctx, total_sz );
3548 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3549 0 : }
3550 0 : }
3551 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3552 0 : if( FD_UNLIKELY( err ) ) return err;
3553 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3554 0 : if( FD_UNLIKELY( err ) ) return err;
3555 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3556 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3557 0 : err = fd_hard_forks_decode_footprint_inner( ctx, total_sz );
3558 0 : if( FD_UNLIKELY( err ) ) return err;
3559 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3560 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3561 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3562 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3563 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3564 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3565 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3566 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3567 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3568 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3569 0 : {
3570 0 : uchar o;
3571 0 : err = fd_bincode_bool_decode( &o, ctx );
3572 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3573 0 : if( o ) {
3574 0 : *total_sz += 8UL + sizeof(ulong);
3575 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3576 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3577 0 : }
3578 0 : }
3579 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3580 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3581 0 : err = fd_bincode_uint128_decode_footprint( ctx );
3582 0 : if( FD_UNLIKELY( err ) ) return err;
3583 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3584 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3585 0 : err = fd_bincode_double_decode_footprint( ctx );
3586 0 : if( FD_UNLIKELY( err ) ) return err;
3587 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3588 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3589 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3590 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3591 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3592 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3593 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3594 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3595 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3596 0 : if( FD_UNLIKELY( err ) ) return err;
3597 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3598 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3599 0 : err = fd_fee_calculator_decode_footprint_inner( ctx, total_sz );
3600 0 : if( FD_UNLIKELY( err ) ) return err;
3601 0 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
3602 0 : if( FD_UNLIKELY( err ) ) return err;
3603 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3604 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3605 0 : err = fd_rent_collector_decode_footprint_inner( ctx, total_sz );
3606 0 : if( FD_UNLIKELY( err ) ) return err;
3607 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
3608 0 : if( FD_UNLIKELY( err ) ) return err;
3609 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
3610 0 : if( FD_UNLIKELY( err ) ) return err;
3611 0 : err = fd_stakes_decode_footprint_inner( ctx, total_sz );
3612 0 : if( FD_UNLIKELY( err ) ) return err;
3613 0 : err = fd_unused_accounts_decode_footprint_inner( ctx, total_sz );
3614 0 : if( FD_UNLIKELY( err ) ) return err;
3615 0 : ulong epoch_stakes_len;
3616 0 : err = fd_bincode_uint64_decode( &epoch_stakes_len, ctx );
3617 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3618 0 : if( epoch_stakes_len ) {
3619 0 : *total_sz += FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN + sizeof(fd_epoch_epoch_stakes_pair_t)*epoch_stakes_len;
3620 0 : for( ulong i=0; i < epoch_stakes_len; i++ ) {
3621 0 : err = fd_epoch_epoch_stakes_pair_decode_footprint_inner( ctx, total_sz );
3622 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3623 0 : }
3624 0 : }
3625 0 : err = fd_bincode_bool_decode_footprint( ctx );
3626 0 : if( FD_UNLIKELY( err ) ) return err;
3627 0 : return 0;
3628 0 : }
3629 0 : int fd_versioned_bank_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3630 0 : *total_sz += sizeof(fd_versioned_bank_t);
3631 0 : void const * start_data = ctx->data;
3632 0 : int err = fd_versioned_bank_decode_footprint_inner( ctx, total_sz );
3633 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3634 0 : ctx->data = start_data;
3635 0 : return err;
3636 0 : }
3637 0 : static void fd_versioned_bank_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3638 0 : fd_versioned_bank_t * self = (fd_versioned_bank_t *)struct_mem;
3639 0 : fd_block_hash_vec_decode_inner( &self->blockhash_queue, alloc_mem, ctx );
3640 0 : fd_bincode_uint64_decode_unsafe( &self->ancestors_len, ctx );
3641 0 : if( self->ancestors_len ) {
3642 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
3643 0 : self->ancestors = *alloc_mem;
3644 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->ancestors_len;
3645 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
3646 0 : fd_slot_pair_new( self->ancestors + i );
3647 0 : fd_slot_pair_decode_inner( self->ancestors + i, alloc_mem, ctx );
3648 0 : }
3649 0 : } else
3650 0 : self->ancestors = NULL;
3651 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3652 0 : fd_hash_decode_inner( &self->parent_hash, alloc_mem, ctx );
3653 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
3654 0 : fd_hard_forks_decode_inner( &self->hard_forks, alloc_mem, ctx );
3655 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
3656 0 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
3657 0 : fd_bincode_uint64_decode_unsafe( &self->signature_count, ctx );
3658 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
3659 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
3660 0 : {
3661 0 : uchar o;
3662 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3663 0 : if( o ) {
3664 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
3665 0 : self->hashes_per_tick = *alloc_mem;
3666 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
3667 0 : fd_bincode_uint64_decode_unsafe( self->hashes_per_tick, ctx );
3668 0 : } else {
3669 0 : self->hashes_per_tick = NULL;
3670 0 : }
3671 0 : }
3672 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
3673 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
3674 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
3675 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
3676 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_data_len, ctx );
3677 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
3678 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
3679 0 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
3680 0 : fd_pubkey_decode_inner( &self->collector_id, alloc_mem, ctx );
3681 0 : fd_bincode_uint64_decode_unsafe( &self->collector_fees, ctx );
3682 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
3683 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
3684 0 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
3685 0 : fd_rent_collector_decode_inner( &self->rent_collector, alloc_mem, ctx );
3686 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
3687 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
3688 0 : fd_stakes_decode_inner( &self->stakes, alloc_mem, ctx );
3689 0 : fd_unused_accounts_decode_inner( &self->unused_accounts, alloc_mem, ctx );
3690 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_stakes_len, ctx );
3691 0 : if( self->epoch_stakes_len ) {
3692 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN );
3693 0 : self->epoch_stakes = *alloc_mem;
3694 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_epoch_epoch_stakes_pair_t)*self->epoch_stakes_len;
3695 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
3696 0 : fd_epoch_epoch_stakes_pair_new( self->epoch_stakes + i );
3697 0 : fd_epoch_epoch_stakes_pair_decode_inner( self->epoch_stakes + i, alloc_mem, ctx );
3698 0 : }
3699 0 : } else
3700 0 : self->epoch_stakes = NULL;
3701 0 : fd_bincode_bool_decode_unsafe( &self->is_delta, ctx );
3702 0 : }
3703 0 : void * fd_versioned_bank_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3704 0 : fd_versioned_bank_t * self = (fd_versioned_bank_t *)mem;
3705 0 : fd_versioned_bank_new( self );
3706 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_bank_t);
3707 0 : void * * alloc_mem = &alloc_region;
3708 0 : fd_versioned_bank_decode_inner( mem, alloc_mem, ctx );
3709 0 : return self;
3710 0 : }
3711 0 : static void fd_versioned_bank_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3712 0 : fd_versioned_bank_global_t * self = (fd_versioned_bank_global_t *)struct_mem;
3713 0 : fd_block_hash_vec_decode_inner_global( &self->blockhash_queue, alloc_mem, ctx );
3714 0 : fd_bincode_uint64_decode_unsafe( &self->ancestors_len, ctx );
3715 0 : if( self->ancestors_len ) {
3716 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
3717 0 : self->ancestors_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3718 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3719 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->ancestors_len;
3720 0 : for( ulong i=0; i < self->ancestors_len; i++ ) {
3721 0 : fd_slot_pair_new( (fd_slot_pair_t *)fd_type_pun(cur_mem + sizeof(fd_slot_pair_t) * i) );
3722 0 : fd_slot_pair_decode_inner( cur_mem + sizeof(fd_slot_pair_t) * i, alloc_mem, ctx );
3723 0 : }
3724 0 : } else {
3725 0 : self->ancestors_offset = 0UL;
3726 0 : }
3727 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3728 0 : fd_hash_decode_inner( &self->parent_hash, alloc_mem, ctx );
3729 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
3730 0 : fd_hard_forks_decode_inner_global( &self->hard_forks, alloc_mem, ctx );
3731 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
3732 0 : fd_bincode_uint64_decode_unsafe( &self->tick_height, ctx );
3733 0 : fd_bincode_uint64_decode_unsafe( &self->signature_count, ctx );
3734 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
3735 0 : fd_bincode_uint64_decode_unsafe( &self->max_tick_height, ctx );
3736 0 : {
3737 0 : uchar o;
3738 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3739 0 : if( o ) {
3740 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
3741 0 : self->hashes_per_tick_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3742 0 : fd_bincode_uint64_decode_unsafe( *alloc_mem, ctx );
3743 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
3744 0 : } else {
3745 0 : self->hashes_per_tick_offset = 0UL;
3746 0 : }
3747 0 : }
3748 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
3749 0 : fd_bincode_uint128_decode_unsafe( &self->ns_per_slot, ctx );
3750 0 : fd_bincode_uint64_decode_unsafe( &self->genesis_creation_time, ctx );
3751 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
3752 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_data_len, ctx );
3753 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
3754 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
3755 0 : fd_bincode_uint64_decode_unsafe( &self->block_height, ctx );
3756 0 : fd_pubkey_decode_inner( &self->collector_id, alloc_mem, ctx );
3757 0 : fd_bincode_uint64_decode_unsafe( &self->collector_fees, ctx );
3758 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
3759 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
3760 0 : fd_bincode_uint64_decode_unsafe( &self->collected_rent, ctx );
3761 0 : fd_rent_collector_decode_inner( &self->rent_collector, alloc_mem, ctx );
3762 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
3763 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
3764 0 : fd_stakes_decode_inner_global( &self->stakes, alloc_mem, ctx );
3765 0 : fd_unused_accounts_decode_inner_global( &self->unused_accounts, alloc_mem, ctx );
3766 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_stakes_len, ctx );
3767 0 : if( self->epoch_stakes_len ) {
3768 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_EPOCH_EPOCH_STAKES_PAIR_ALIGN );
3769 0 : self->epoch_stakes_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3770 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3771 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_epoch_epoch_stakes_pair_t)*self->epoch_stakes_len;
3772 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ ) {
3773 0 : fd_epoch_epoch_stakes_pair_new( (fd_epoch_epoch_stakes_pair_t *)fd_type_pun(cur_mem + sizeof(fd_epoch_epoch_stakes_pair_t) * i) );
3774 0 : fd_epoch_epoch_stakes_pair_decode_inner_global( cur_mem + sizeof(fd_epoch_epoch_stakes_pair_t) * i, alloc_mem, ctx );
3775 0 : }
3776 0 : } else {
3777 0 : self->epoch_stakes_offset = 0UL;
3778 0 : }
3779 0 : fd_bincode_bool_decode_unsafe( &self->is_delta, ctx );
3780 0 : }
3781 0 : void * fd_versioned_bank_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3782 0 : fd_versioned_bank_global_t * self = (fd_versioned_bank_global_t *)mem;
3783 0 : fd_versioned_bank_new( (fd_versioned_bank_t *)self );
3784 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_bank_global_t);
3785 0 : void * * alloc_mem = &alloc_region;
3786 0 : fd_versioned_bank_decode_inner_global( mem, alloc_mem, ctx );
3787 0 : return self;
3788 0 : }
3789 0 : void fd_versioned_bank_new(fd_versioned_bank_t * self) {
3790 0 : fd_memset( self, 0, sizeof(fd_versioned_bank_t) );
3791 0 : fd_block_hash_vec_new( &self->blockhash_queue );
3792 0 : fd_hash_new( &self->hash );
3793 0 : fd_hash_new( &self->parent_hash );
3794 0 : fd_hard_forks_new( &self->hard_forks );
3795 0 : fd_pubkey_new( &self->collector_id );
3796 0 : fd_fee_calculator_new( &self->fee_calculator );
3797 0 : fd_fee_rate_governor_new( &self->fee_rate_governor );
3798 0 : fd_rent_collector_new( &self->rent_collector );
3799 0 : fd_epoch_schedule_new( &self->epoch_schedule );
3800 0 : fd_inflation_new( &self->inflation );
3801 0 : fd_stakes_new( &self->stakes );
3802 0 : fd_unused_accounts_new( &self->unused_accounts );
3803 0 : }
3804 0 : void fd_versioned_bank_walk( void * w, fd_versioned_bank_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
3805 0 : (void) varint;
3806 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_versioned_bank", level++, 0 );
3807 0 : fd_block_hash_vec_walk( w, &self->blockhash_queue, fun, "blockhash_queue", level, 0 );
3808 0 : if( self->ancestors_len ) {
3809 0 : fun( w, NULL, "ancestors", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
3810 0 : for( ulong i=0; i < self->ancestors_len; i++ )
3811 0 : fd_slot_pair_walk(w, self->ancestors + i, fun, "slot_pair", level, 0 );
3812 0 : fun( w, NULL, "ancestors", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
3813 0 : }
3814 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3815 0 : fd_hash_walk( w, &self->parent_hash, fun, "parent_hash", level, 0 );
3816 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3817 0 : fd_hard_forks_walk( w, &self->hard_forks, fun, "hard_forks", level, 0 );
3818 0 : fun( w, &self->transaction_count, "transaction_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3819 0 : fun( w, &self->tick_height, "tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3820 0 : fun( w, &self->signature_count, "signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3821 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3822 0 : fun( w, &self->max_tick_height, "max_tick_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3823 0 : if( !self->hashes_per_tick ) {
3824 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3825 0 : } else {
3826 0 : fun( w, self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3827 0 : }
3828 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3829 0 : fun( w, &self->ns_per_slot, "ns_per_slot", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
3830 0 : fun( w, &self->genesis_creation_time, "genesis_creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3831 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
3832 0 : fun( w, &self->accounts_data_len, "accounts_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3833 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3834 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3835 0 : fun( w, &self->block_height, "block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3836 0 : fd_pubkey_walk( w, &self->collector_id, fun, "collector_id", level, 0 );
3837 0 : fun( w, &self->collector_fees, "collector_fees", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3838 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
3839 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level, 0 );
3840 0 : fun( w, &self->collected_rent, "collected_rent", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3841 0 : fd_rent_collector_walk( w, &self->rent_collector, fun, "rent_collector", level, 0 );
3842 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level, 0 );
3843 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level, 0 );
3844 0 : fd_stakes_walk( w, &self->stakes, fun, "stakes", level, 0 );
3845 0 : fd_unused_accounts_walk( w, &self->unused_accounts, fun, "unused_accounts", level, 0 );
3846 0 : if( self->epoch_stakes_len ) {
3847 0 : fun( w, NULL, "epoch_stakes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
3848 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
3849 0 : fd_epoch_epoch_stakes_pair_walk(w, self->epoch_stakes + i, fun, "epoch_epoch_stakes_pair", level, 0 );
3850 0 : fun( w, NULL, "epoch_stakes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
3851 0 : }
3852 0 : fun( w, &self->is_delta, "is_delta", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
3853 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_versioned_bank", level--, 0 );
3854 0 : }
3855 0 : ulong fd_versioned_bank_size( fd_versioned_bank_t const * self ) {
3856 0 : ulong size = 0;
3857 0 : size += fd_block_hash_vec_size( &self->blockhash_queue );
3858 0 : do {
3859 0 : size += sizeof(ulong);
3860 0 : for( ulong i=0; i < self->ancestors_len; i++ )
3861 0 : size += fd_slot_pair_size( self->ancestors + i );
3862 0 : } while(0);
3863 0 : size += fd_hash_size( &self->hash );
3864 0 : size += fd_hash_size( &self->parent_hash );
3865 0 : size += sizeof(ulong);
3866 0 : size += fd_hard_forks_size( &self->hard_forks );
3867 0 : size += sizeof(ulong);
3868 0 : size += sizeof(ulong);
3869 0 : size += sizeof(ulong);
3870 0 : size += sizeof(ulong);
3871 0 : size += sizeof(ulong);
3872 0 : size += sizeof(char);
3873 0 : if( NULL != self->hashes_per_tick ) {
3874 0 : size += sizeof(ulong);
3875 0 : }
3876 0 : size += sizeof(ulong);
3877 0 : size += sizeof(uint128);
3878 0 : size += sizeof(ulong);
3879 0 : size += sizeof(double);
3880 0 : size += sizeof(ulong);
3881 0 : size += sizeof(ulong);
3882 0 : size += sizeof(ulong);
3883 0 : size += sizeof(ulong);
3884 0 : size += fd_pubkey_size( &self->collector_id );
3885 0 : size += sizeof(ulong);
3886 0 : size += fd_fee_calculator_size( &self->fee_calculator );
3887 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
3888 0 : size += sizeof(ulong);
3889 0 : size += fd_rent_collector_size( &self->rent_collector );
3890 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
3891 0 : size += fd_inflation_size( &self->inflation );
3892 0 : size += fd_stakes_size( &self->stakes );
3893 0 : size += fd_unused_accounts_size( &self->unused_accounts );
3894 0 : do {
3895 0 : size += sizeof(ulong);
3896 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
3897 0 : size += fd_epoch_epoch_stakes_pair_size( self->epoch_stakes + i );
3898 0 : } while(0);
3899 0 : size += sizeof(char);
3900 0 : return size;
3901 0 : }
3902 :
3903 0 : ulong fd_versioned_bank_size_global( fd_versioned_bank_global_t const * self ) {
3904 0 : ulong size = 0;
3905 0 : size += fd_block_hash_vec_size_global( &self->blockhash_queue );
3906 0 : do {
3907 0 : size += sizeof(ulong);
3908 0 : fd_slot_pair_t * ancestors = self->ancestors_offset ? (fd_slot_pair_t *)fd_type_pun( (uchar *)self + self->ancestors_offset ) : NULL;
3909 0 : for( ulong i=0; i < self->ancestors_len; i++ )
3910 0 : size += fd_slot_pair_size( ancestors + i );
3911 0 : } while(0);
3912 0 : size += fd_hash_size( &self->hash );
3913 0 : size += fd_hash_size( &self->parent_hash );
3914 0 : size += sizeof(ulong);
3915 0 : size += fd_hard_forks_size_global( &self->hard_forks );
3916 0 : size += sizeof(ulong);
3917 0 : size += sizeof(ulong);
3918 0 : size += sizeof(ulong);
3919 0 : size += sizeof(ulong);
3920 0 : size += sizeof(ulong);
3921 0 : size += sizeof(char);
3922 0 : ulong * hashes_per_tick = (ulong *)fd_type_pun( (uchar *)self + self->hashes_per_tick_offset );
3923 0 : if( NULL != hashes_per_tick ) {
3924 0 : size += sizeof(ulong);
3925 0 : }
3926 0 : size += sizeof(ulong);
3927 0 : size += sizeof(uint128);
3928 0 : size += sizeof(ulong);
3929 0 : size += sizeof(double);
3930 0 : size += sizeof(ulong);
3931 0 : size += sizeof(ulong);
3932 0 : size += sizeof(ulong);
3933 0 : size += sizeof(ulong);
3934 0 : size += fd_pubkey_size( &self->collector_id );
3935 0 : size += sizeof(ulong);
3936 0 : size += fd_fee_calculator_size( &self->fee_calculator );
3937 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
3938 0 : size += sizeof(ulong);
3939 0 : size += fd_rent_collector_size( &self->rent_collector );
3940 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
3941 0 : size += fd_inflation_size( &self->inflation );
3942 0 : size += fd_stakes_size_global( &self->stakes );
3943 0 : size += fd_unused_accounts_size_global( &self->unused_accounts );
3944 0 : do {
3945 0 : size += sizeof(ulong);
3946 0 : fd_epoch_epoch_stakes_pair_global_t * epoch_stakes = self->epoch_stakes_offset ? (fd_epoch_epoch_stakes_pair_global_t *)fd_type_pun( (uchar *)self + self->epoch_stakes_offset ) : NULL;
3947 0 : for( ulong i=0; i < self->epoch_stakes_len; i++ )
3948 0 : size += fd_epoch_epoch_stakes_pair_size_global( epoch_stakes + i );
3949 0 : } while(0);
3950 0 : size += sizeof(char);
3951 0 : return size;
3952 0 : }
3953 :
3954 0 : int fd_bank_hash_stats_encode( fd_bank_hash_stats_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3955 0 : int err;
3956 0 : err = fd_bincode_uint64_encode( self->num_updated_accounts, ctx );
3957 0 : if( FD_UNLIKELY( err ) ) return err;
3958 0 : err = fd_bincode_uint64_encode( self->num_removed_accounts, ctx );
3959 0 : if( FD_UNLIKELY( err ) ) return err;
3960 0 : err = fd_bincode_uint64_encode( self->num_lamports_stored, ctx );
3961 0 : if( FD_UNLIKELY( err ) ) return err;
3962 0 : err = fd_bincode_uint64_encode( self->total_data_len, ctx );
3963 0 : if( FD_UNLIKELY( err ) ) return err;
3964 0 : err = fd_bincode_uint64_encode( self->num_executable_accounts, ctx );
3965 0 : if( FD_UNLIKELY( err ) ) return err;
3966 0 : return FD_BINCODE_SUCCESS;
3967 0 : }
3968 0 : static inline int fd_bank_hash_stats_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3969 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3970 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
3971 0 : return 0;
3972 0 : }
3973 0 : static void fd_bank_hash_stats_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3974 0 : fd_bank_hash_stats_t * self = (fd_bank_hash_stats_t *)struct_mem;
3975 0 : fd_bincode_uint64_decode_unsafe( &self->num_updated_accounts, ctx );
3976 0 : fd_bincode_uint64_decode_unsafe( &self->num_removed_accounts, ctx );
3977 0 : fd_bincode_uint64_decode_unsafe( &self->num_lamports_stored, ctx );
3978 0 : fd_bincode_uint64_decode_unsafe( &self->total_data_len, ctx );
3979 0 : fd_bincode_uint64_decode_unsafe( &self->num_executable_accounts, ctx );
3980 0 : }
3981 0 : void * fd_bank_hash_stats_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3982 0 : fd_bank_hash_stats_t * self = (fd_bank_hash_stats_t *)mem;
3983 0 : fd_bank_hash_stats_new( self );
3984 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_hash_stats_t);
3985 0 : void * * alloc_mem = &alloc_region;
3986 0 : fd_bank_hash_stats_decode_inner( mem, alloc_mem, ctx );
3987 0 : return self;
3988 0 : }
3989 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, uint varint ) {
3990 0 : (void) varint;
3991 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_hash_stats", level++, 0 );
3992 0 : fun( w, &self->num_updated_accounts, "num_updated_accounts", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3993 0 : fun( w, &self->num_removed_accounts, "num_removed_accounts", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3994 0 : fun( w, &self->num_lamports_stored, "num_lamports_stored", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3995 0 : fun( w, &self->total_data_len, "total_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3996 0 : fun( w, &self->num_executable_accounts, "num_executable_accounts", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3997 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_hash_stats", level--, 0 );
3998 0 : }
3999 0 : int fd_bank_hash_info_encode( fd_bank_hash_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4000 0 : int err;
4001 0 : err = fd_hash_encode( &self->accounts_delta_hash, ctx );
4002 0 : if( FD_UNLIKELY( err ) ) return err;
4003 0 : err = fd_hash_encode( &self->accounts_hash, ctx );
4004 0 : if( FD_UNLIKELY( err ) ) return err;
4005 0 : err = fd_bank_hash_stats_encode( &self->stats, ctx );
4006 0 : if( FD_UNLIKELY( err ) ) return err;
4007 0 : return FD_BINCODE_SUCCESS;
4008 0 : }
4009 0 : static inline int fd_bank_hash_info_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4010 0 : if( (ulong)ctx->data + 104UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4011 0 : ctx->data = (void *)( (ulong)ctx->data + 104UL );
4012 0 : return 0;
4013 0 : }
4014 0 : static void fd_bank_hash_info_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4015 0 : fd_bank_hash_info_t * self = (fd_bank_hash_info_t *)struct_mem;
4016 0 : fd_hash_decode_inner( &self->accounts_delta_hash, alloc_mem, ctx );
4017 0 : fd_hash_decode_inner( &self->accounts_hash, alloc_mem, ctx );
4018 0 : fd_bank_hash_stats_decode_inner( &self->stats, alloc_mem, ctx );
4019 0 : }
4020 0 : void * fd_bank_hash_info_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4021 0 : fd_bank_hash_info_t * self = (fd_bank_hash_info_t *)mem;
4022 0 : fd_bank_hash_info_new( self );
4023 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_hash_info_t);
4024 0 : void * * alloc_mem = &alloc_region;
4025 0 : fd_bank_hash_info_decode_inner( mem, alloc_mem, ctx );
4026 0 : return self;
4027 0 : }
4028 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, uint varint ) {
4029 0 : (void) varint;
4030 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_hash_info", level++, 0 );
4031 0 : fd_hash_walk( w, &self->accounts_delta_hash, fun, "accounts_delta_hash", level, 0 );
4032 0 : fd_hash_walk( w, &self->accounts_hash, fun, "accounts_hash", level, 0 );
4033 0 : fd_bank_hash_stats_walk( w, &self->stats, fun, "stats", level, 0 );
4034 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_hash_info", level--, 0 );
4035 0 : }
4036 0 : int fd_slot_map_pair_encode( fd_slot_map_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4037 0 : int err;
4038 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4039 0 : if( FD_UNLIKELY( err ) ) return err;
4040 0 : err = fd_hash_encode( &self->hash, ctx );
4041 0 : if( FD_UNLIKELY( err ) ) return err;
4042 0 : return FD_BINCODE_SUCCESS;
4043 0 : }
4044 0 : static inline int fd_slot_map_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4045 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4046 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
4047 0 : return 0;
4048 0 : }
4049 0 : static void fd_slot_map_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4050 0 : fd_slot_map_pair_t * self = (fd_slot_map_pair_t *)struct_mem;
4051 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4052 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4053 0 : }
4054 0 : void * fd_slot_map_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4055 0 : fd_slot_map_pair_t * self = (fd_slot_map_pair_t *)mem;
4056 0 : fd_slot_map_pair_new( self );
4057 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_map_pair_t);
4058 0 : void * * alloc_mem = &alloc_region;
4059 0 : fd_slot_map_pair_decode_inner( mem, alloc_mem, ctx );
4060 0 : return self;
4061 0 : }
4062 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, uint varint ) {
4063 0 : (void) varint;
4064 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_map_pair", level++, 0 );
4065 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4066 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4067 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_map_pair", level--, 0 );
4068 0 : }
4069 0 : int fd_snapshot_acc_vec_encode( fd_snapshot_acc_vec_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4070 0 : int err;
4071 0 : err = fd_bincode_uint64_encode( self->id, ctx );
4072 0 : if( FD_UNLIKELY( err ) ) return err;
4073 0 : err = fd_bincode_uint64_encode( self->file_sz, ctx );
4074 0 : if( FD_UNLIKELY( err ) ) return err;
4075 0 : return FD_BINCODE_SUCCESS;
4076 0 : }
4077 0 : static inline int fd_snapshot_acc_vec_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4078 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4079 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
4080 0 : return 0;
4081 0 : }
4082 0 : static void fd_snapshot_acc_vec_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4083 0 : fd_snapshot_acc_vec_t * self = (fd_snapshot_acc_vec_t *)struct_mem;
4084 0 : fd_bincode_uint64_decode_unsafe( &self->id, ctx );
4085 0 : fd_bincode_uint64_decode_unsafe( &self->file_sz, ctx );
4086 0 : }
4087 0 : void * fd_snapshot_acc_vec_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4088 0 : fd_snapshot_acc_vec_t * self = (fd_snapshot_acc_vec_t *)mem;
4089 0 : fd_snapshot_acc_vec_new( self );
4090 0 : void * alloc_region = (uchar *)mem + sizeof(fd_snapshot_acc_vec_t);
4091 0 : void * * alloc_mem = &alloc_region;
4092 0 : fd_snapshot_acc_vec_decode_inner( mem, alloc_mem, ctx );
4093 0 : return self;
4094 0 : }
4095 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, uint varint ) {
4096 0 : (void) varint;
4097 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_snapshot_acc_vec", level++, 0 );
4098 0 : fun( w, &self->id, "id", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4099 0 : fun( w, &self->file_sz, "file_sz", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4100 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_snapshot_acc_vec", level--, 0 );
4101 0 : }
4102 0 : int fd_snapshot_slot_acc_vecs_encode( fd_snapshot_slot_acc_vecs_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4103 0 : int err;
4104 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4105 0 : if( FD_UNLIKELY( err ) ) return err;
4106 0 : err = fd_bincode_uint64_encode( self->account_vecs_len, ctx );
4107 0 : if( FD_UNLIKELY(err) ) return err;
4108 0 : if( self->account_vecs_len ) {
4109 0 : for( ulong i=0; i < self->account_vecs_len; i++ ) {
4110 0 : err = fd_snapshot_acc_vec_encode( self->account_vecs + i, ctx );
4111 0 : if( FD_UNLIKELY( err ) ) return err;
4112 0 : }
4113 0 : }
4114 0 : return FD_BINCODE_SUCCESS;
4115 0 : }
4116 0 : int fd_snapshot_slot_acc_vecs_encode_global( fd_snapshot_slot_acc_vecs_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4117 0 : int err;
4118 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4119 0 : if( FD_UNLIKELY( err ) ) return err;
4120 0 : err = fd_bincode_uint64_encode( self->account_vecs_len, ctx );
4121 0 : if( FD_UNLIKELY( err ) ) return err;
4122 0 : if( self->account_vecs_len ) {
4123 0 : uchar * account_vecs_laddr = (uchar*)self + self->account_vecs_offset;
4124 0 : fd_snapshot_acc_vec_t * account_vecs = (fd_snapshot_acc_vec_t *)account_vecs_laddr;
4125 0 : for( ulong i=0; i < self->account_vecs_len; i++ ) {
4126 0 : err = fd_snapshot_acc_vec_encode( &account_vecs[i], ctx );
4127 0 : if( FD_UNLIKELY( err ) ) return err;
4128 0 : }
4129 0 : }
4130 0 : return FD_BINCODE_SUCCESS;
4131 0 : }
4132 0 : static int fd_snapshot_slot_acc_vecs_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4133 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4134 0 : int err = 0;
4135 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4136 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4137 0 : ulong account_vecs_len;
4138 0 : err = fd_bincode_uint64_decode( &account_vecs_len, ctx );
4139 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4140 0 : if( account_vecs_len ) {
4141 0 : *total_sz += FD_SNAPSHOT_ACC_VEC_ALIGN + sizeof(fd_snapshot_acc_vec_t)*account_vecs_len;
4142 0 : for( ulong i=0; i < account_vecs_len; i++ ) {
4143 0 : err = fd_snapshot_acc_vec_decode_footprint_inner( ctx, total_sz );
4144 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4145 0 : }
4146 0 : }
4147 0 : return 0;
4148 0 : }
4149 0 : int fd_snapshot_slot_acc_vecs_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4150 0 : *total_sz += sizeof(fd_snapshot_slot_acc_vecs_t);
4151 0 : void const * start_data = ctx->data;
4152 0 : int err = fd_snapshot_slot_acc_vecs_decode_footprint_inner( ctx, total_sz );
4153 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4154 0 : ctx->data = start_data;
4155 0 : return err;
4156 0 : }
4157 0 : static void fd_snapshot_slot_acc_vecs_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4158 0 : fd_snapshot_slot_acc_vecs_t * self = (fd_snapshot_slot_acc_vecs_t *)struct_mem;
4159 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4160 0 : fd_bincode_uint64_decode_unsafe( &self->account_vecs_len, ctx );
4161 0 : if( self->account_vecs_len ) {
4162 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SNAPSHOT_ACC_VEC_ALIGN );
4163 0 : self->account_vecs = *alloc_mem;
4164 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_snapshot_acc_vec_t)*self->account_vecs_len;
4165 0 : for( ulong i=0; i < self->account_vecs_len; i++ ) {
4166 0 : fd_snapshot_acc_vec_new( self->account_vecs + i );
4167 0 : fd_snapshot_acc_vec_decode_inner( self->account_vecs + i, alloc_mem, ctx );
4168 0 : }
4169 0 : } else
4170 0 : self->account_vecs = NULL;
4171 0 : }
4172 0 : void * fd_snapshot_slot_acc_vecs_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4173 0 : fd_snapshot_slot_acc_vecs_t * self = (fd_snapshot_slot_acc_vecs_t *)mem;
4174 0 : fd_snapshot_slot_acc_vecs_new( self );
4175 0 : void * alloc_region = (uchar *)mem + sizeof(fd_snapshot_slot_acc_vecs_t);
4176 0 : void * * alloc_mem = &alloc_region;
4177 0 : fd_snapshot_slot_acc_vecs_decode_inner( mem, alloc_mem, ctx );
4178 0 : return self;
4179 0 : }
4180 0 : static void fd_snapshot_slot_acc_vecs_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4181 0 : fd_snapshot_slot_acc_vecs_global_t * self = (fd_snapshot_slot_acc_vecs_global_t *)struct_mem;
4182 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4183 0 : fd_bincode_uint64_decode_unsafe( &self->account_vecs_len, ctx );
4184 0 : if( self->account_vecs_len ) {
4185 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SNAPSHOT_ACC_VEC_ALIGN );
4186 0 : self->account_vecs_offset = (ulong)*alloc_mem - (ulong)struct_mem;
4187 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4188 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_snapshot_acc_vec_t)*self->account_vecs_len;
4189 0 : for( ulong i=0; i < self->account_vecs_len; i++ ) {
4190 0 : fd_snapshot_acc_vec_new( (fd_snapshot_acc_vec_t *)fd_type_pun(cur_mem + sizeof(fd_snapshot_acc_vec_t) * i) );
4191 0 : fd_snapshot_acc_vec_decode_inner( cur_mem + sizeof(fd_snapshot_acc_vec_t) * i, alloc_mem, ctx );
4192 0 : }
4193 0 : } else {
4194 0 : self->account_vecs_offset = 0UL;
4195 0 : }
4196 0 : }
4197 0 : void * fd_snapshot_slot_acc_vecs_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4198 0 : fd_snapshot_slot_acc_vecs_global_t * self = (fd_snapshot_slot_acc_vecs_global_t *)mem;
4199 0 : fd_snapshot_slot_acc_vecs_new( (fd_snapshot_slot_acc_vecs_t *)self );
4200 0 : void * alloc_region = (uchar *)mem + sizeof(fd_snapshot_slot_acc_vecs_global_t);
4201 0 : void * * alloc_mem = &alloc_region;
4202 0 : fd_snapshot_slot_acc_vecs_decode_inner_global( mem, alloc_mem, ctx );
4203 0 : return self;
4204 0 : }
4205 0 : void fd_snapshot_slot_acc_vecs_new(fd_snapshot_slot_acc_vecs_t * self) {
4206 0 : fd_memset( self, 0, sizeof(fd_snapshot_slot_acc_vecs_t) );
4207 0 : }
4208 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, uint varint ) {
4209 0 : (void) varint;
4210 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_snapshot_slot_acc_vecs", level++, 0 );
4211 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4212 0 : if( self->account_vecs_len ) {
4213 0 : fun( w, NULL, "account_vecs", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4214 0 : for( ulong i=0; i < self->account_vecs_len; i++ )
4215 0 : fd_snapshot_acc_vec_walk(w, self->account_vecs + i, fun, "snapshot_acc_vec", level, 0 );
4216 0 : fun( w, NULL, "account_vecs", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4217 0 : }
4218 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_snapshot_slot_acc_vecs", level--, 0 );
4219 0 : }
4220 0 : ulong fd_snapshot_slot_acc_vecs_size( fd_snapshot_slot_acc_vecs_t const * self ) {
4221 0 : ulong size = 0;
4222 0 : size += sizeof(ulong);
4223 0 : do {
4224 0 : size += sizeof(ulong);
4225 0 : for( ulong i=0; i < self->account_vecs_len; i++ )
4226 0 : size += fd_snapshot_acc_vec_size( self->account_vecs + i );
4227 0 : } while(0);
4228 0 : return size;
4229 0 : }
4230 :
4231 0 : ulong fd_snapshot_slot_acc_vecs_size_global( fd_snapshot_slot_acc_vecs_global_t const * self ) {
4232 0 : ulong size = 0;
4233 0 : size += sizeof(ulong);
4234 0 : do {
4235 0 : size += sizeof(ulong);
4236 0 : fd_snapshot_acc_vec_t * account_vecs = self->account_vecs_offset ? (fd_snapshot_acc_vec_t *)fd_type_pun( (uchar *)self + self->account_vecs_offset ) : NULL;
4237 0 : for( ulong i=0; i < self->account_vecs_len; i++ )
4238 0 : size += fd_snapshot_acc_vec_size( account_vecs + i );
4239 0 : } while(0);
4240 0 : return size;
4241 0 : }
4242 :
4243 0 : FD_FN_PURE uchar fd_reward_type_is_fee(fd_reward_type_t const * self) {
4244 0 : return self->discriminant == 0;
4245 0 : }
4246 0 : FD_FN_PURE uchar fd_reward_type_is_rent(fd_reward_type_t const * self) {
4247 0 : return self->discriminant == 1;
4248 0 : }
4249 0 : FD_FN_PURE uchar fd_reward_type_is_staking(fd_reward_type_t const * self) {
4250 0 : return self->discriminant == 2;
4251 0 : }
4252 0 : FD_FN_PURE uchar fd_reward_type_is_voting(fd_reward_type_t const * self) {
4253 0 : return self->discriminant == 3;
4254 0 : }
4255 0 : int fd_reward_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4256 0 : int err;
4257 0 : switch (discriminant) {
4258 0 : case 0: {
4259 0 : return FD_BINCODE_SUCCESS;
4260 0 : }
4261 0 : case 1: {
4262 0 : return FD_BINCODE_SUCCESS;
4263 0 : }
4264 0 : case 2: {
4265 0 : return FD_BINCODE_SUCCESS;
4266 0 : }
4267 0 : case 3: {
4268 0 : return FD_BINCODE_SUCCESS;
4269 0 : }
4270 0 : default: return FD_BINCODE_ERR_ENCODING;
4271 0 : }
4272 0 : }
4273 0 : static int fd_reward_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4274 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4275 0 : uint discriminant = 0;
4276 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4277 0 : if( FD_UNLIKELY( err ) ) return err;
4278 0 : return fd_reward_type_inner_decode_footprint( discriminant, ctx, total_sz );
4279 0 : }
4280 0 : int fd_reward_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4281 0 : *total_sz += sizeof(fd_reward_type_t);
4282 0 : void const * start_data = ctx->data;
4283 0 : int err = fd_reward_type_decode_footprint_inner( ctx, total_sz );
4284 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4285 0 : ctx->data = start_data;
4286 0 : return err;
4287 0 : }
4288 0 : static void fd_reward_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4289 0 : fd_reward_type_t * self = (fd_reward_type_t *)struct_mem;
4290 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4291 0 : }
4292 0 : void * fd_reward_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4293 0 : fd_reward_type_t * self = (fd_reward_type_t *)mem;
4294 0 : fd_reward_type_new( self );
4295 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_type_t);
4296 0 : void * * alloc_mem = &alloc_region;
4297 0 : fd_reward_type_decode_inner( mem, alloc_mem, ctx );
4298 0 : return self;
4299 0 : }
4300 :
4301 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, uint varint ) {
4302 0 : (void) varint;
4303 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_reward_type", level++, 0);
4304 0 : switch( self->discriminant ) {
4305 0 : case 0: {
4306 0 : fun( w, self, "fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
4307 0 : break;
4308 0 : }
4309 0 : case 1: {
4310 0 : fun( w, self, "rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
4311 0 : break;
4312 0 : }
4313 0 : case 2: {
4314 0 : fun( w, self, "staking", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
4315 0 : break;
4316 0 : }
4317 0 : case 3: {
4318 0 : fun( w, self, "voting", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
4319 0 : break;
4320 0 : }
4321 0 : }
4322 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_reward_type", level--, 0 );
4323 0 : }
4324 0 : ulong fd_reward_type_size( fd_reward_type_t const * self ) {
4325 0 : ulong size = 0;
4326 0 : size += sizeof(uint);
4327 0 : switch (self->discriminant) {
4328 0 : }
4329 0 : return size;
4330 0 : }
4331 :
4332 0 : int fd_reward_type_encode( fd_reward_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4333 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4334 0 : if( FD_UNLIKELY( err ) ) return err;
4335 0 : return err;
4336 0 : }
4337 :
4338 0 : int fd_solana_accounts_db_fields_encode( fd_solana_accounts_db_fields_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4339 0 : int err;
4340 0 : err = fd_bincode_uint64_encode( self->storages_len, ctx );
4341 0 : if( FD_UNLIKELY(err) ) return err;
4342 0 : if( self->storages_len ) {
4343 0 : for( ulong i=0; i < self->storages_len; i++ ) {
4344 0 : err = fd_snapshot_slot_acc_vecs_encode( self->storages + i, ctx );
4345 0 : if( FD_UNLIKELY( err ) ) return err;
4346 0 : }
4347 0 : }
4348 0 : err = fd_bincode_uint64_encode( self->version, ctx );
4349 0 : if( FD_UNLIKELY( err ) ) return err;
4350 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4351 0 : if( FD_UNLIKELY( err ) ) return err;
4352 0 : err = fd_bank_hash_info_encode( &self->bank_hash_info, ctx );
4353 0 : if( FD_UNLIKELY( err ) ) return err;
4354 0 : err = fd_bincode_uint64_encode( self->historical_roots_len, ctx );
4355 0 : if( FD_UNLIKELY(err) ) return err;
4356 0 : if( self->historical_roots_len ) {
4357 0 : for( ulong i=0; i < self->historical_roots_len; i++ ) {
4358 0 : err = fd_bincode_uint64_encode( self->historical_roots[i], ctx );
4359 0 : }
4360 0 : }
4361 0 : err = fd_bincode_uint64_encode( self->historical_roots_with_hash_len, ctx );
4362 0 : if( FD_UNLIKELY(err) ) return err;
4363 0 : if( self->historical_roots_with_hash_len ) {
4364 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ ) {
4365 0 : err = fd_slot_map_pair_encode( self->historical_roots_with_hash + i, ctx );
4366 0 : if( FD_UNLIKELY( err ) ) return err;
4367 0 : }
4368 0 : }
4369 0 : return FD_BINCODE_SUCCESS;
4370 0 : }
4371 0 : int fd_solana_accounts_db_fields_encode_global( fd_solana_accounts_db_fields_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4372 0 : int err;
4373 0 : err = fd_bincode_uint64_encode( self->storages_len, ctx );
4374 0 : if( FD_UNLIKELY( err ) ) return err;
4375 0 : if( self->storages_len ) {
4376 0 : uchar * storages_laddr = (uchar*)self + self->storages_offset;
4377 0 : fd_snapshot_slot_acc_vecs_global_t * storages = (fd_snapshot_slot_acc_vecs_global_t *)storages_laddr;
4378 0 : for( ulong i=0; i < self->storages_len; i++ ) {
4379 0 : err = fd_snapshot_slot_acc_vecs_encode_global( &storages[i], ctx );
4380 0 : if( FD_UNLIKELY( err ) ) return err;
4381 0 : }
4382 0 : }
4383 0 : err = fd_bincode_uint64_encode( self->version, ctx );
4384 0 : if( FD_UNLIKELY( err ) ) return err;
4385 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4386 0 : if( FD_UNLIKELY( err ) ) return err;
4387 0 : err = fd_bank_hash_info_encode( &self->bank_hash_info, ctx );
4388 0 : if( FD_UNLIKELY( err ) ) return err;
4389 0 : err = fd_bincode_uint64_encode( self->historical_roots_len, ctx );
4390 0 : if( FD_UNLIKELY( err ) ) return err;
4391 0 : if( self->historical_roots_len ) {
4392 0 : uchar * historical_roots_laddr = (uchar*)self + self->historical_roots_offset;
4393 0 : ulong * historical_roots = (ulong *)historical_roots_laddr;
4394 0 : for( ulong i=0; i < self->historical_roots_len; i++ ) {
4395 0 : err = fd_bincode_uint64_encode( historical_roots[i], ctx );
4396 0 : if( FD_UNLIKELY( err ) ) return err;
4397 0 : }
4398 0 : }
4399 0 : err = fd_bincode_uint64_encode( self->historical_roots_with_hash_len, ctx );
4400 0 : if( FD_UNLIKELY( err ) ) return err;
4401 0 : if( self->historical_roots_with_hash_len ) {
4402 0 : uchar * historical_roots_with_hash_laddr = (uchar*)self + self->historical_roots_with_hash_offset;
4403 0 : fd_slot_map_pair_t * historical_roots_with_hash = (fd_slot_map_pair_t *)historical_roots_with_hash_laddr;
4404 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ ) {
4405 0 : err = fd_slot_map_pair_encode( &historical_roots_with_hash[i], ctx );
4406 0 : if( FD_UNLIKELY( err ) ) return err;
4407 0 : }
4408 0 : }
4409 0 : return FD_BINCODE_SUCCESS;
4410 0 : }
4411 0 : static int fd_solana_accounts_db_fields_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4412 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4413 0 : int err = 0;
4414 0 : ulong storages_len;
4415 0 : err = fd_bincode_uint64_decode( &storages_len, ctx );
4416 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4417 0 : if( storages_len ) {
4418 0 : *total_sz += FD_SNAPSHOT_SLOT_ACC_VECS_ALIGN + sizeof(fd_snapshot_slot_acc_vecs_t)*storages_len;
4419 0 : for( ulong i=0; i < storages_len; i++ ) {
4420 0 : err = fd_snapshot_slot_acc_vecs_decode_footprint_inner( ctx, total_sz );
4421 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4422 0 : }
4423 0 : }
4424 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4425 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4426 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4427 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4428 0 : err = fd_bank_hash_info_decode_footprint_inner( ctx, total_sz );
4429 0 : if( FD_UNLIKELY( err ) ) return err;
4430 0 : ulong historical_roots_len;
4431 0 : err = fd_bincode_uint64_decode( &historical_roots_len, ctx );
4432 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4433 0 : if( historical_roots_len ) {
4434 0 : *total_sz += 8UL + sizeof(ulong)*historical_roots_len;
4435 0 : for( ulong i=0; i < historical_roots_len; i++ ) {
4436 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4437 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4438 0 : }
4439 0 : }
4440 0 : ulong historical_roots_with_hash_len;
4441 0 : err = fd_bincode_uint64_decode( &historical_roots_with_hash_len, ctx );
4442 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4443 0 : if( historical_roots_with_hash_len ) {
4444 0 : *total_sz += FD_SLOT_MAP_PAIR_ALIGN + sizeof(fd_slot_map_pair_t)*historical_roots_with_hash_len;
4445 0 : for( ulong i=0; i < historical_roots_with_hash_len; i++ ) {
4446 0 : err = fd_slot_map_pair_decode_footprint_inner( ctx, total_sz );
4447 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4448 0 : }
4449 0 : }
4450 0 : return 0;
4451 0 : }
4452 0 : int fd_solana_accounts_db_fields_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4453 0 : *total_sz += sizeof(fd_solana_accounts_db_fields_t);
4454 0 : void const * start_data = ctx->data;
4455 0 : int err = fd_solana_accounts_db_fields_decode_footprint_inner( ctx, total_sz );
4456 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4457 0 : ctx->data = start_data;
4458 0 : return err;
4459 0 : }
4460 0 : static void fd_solana_accounts_db_fields_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4461 0 : fd_solana_accounts_db_fields_t * self = (fd_solana_accounts_db_fields_t *)struct_mem;
4462 0 : fd_bincode_uint64_decode_unsafe( &self->storages_len, ctx );
4463 0 : if( self->storages_len ) {
4464 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SNAPSHOT_SLOT_ACC_VECS_ALIGN );
4465 0 : self->storages = *alloc_mem;
4466 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_snapshot_slot_acc_vecs_t)*self->storages_len;
4467 0 : for( ulong i=0; i < self->storages_len; i++ ) {
4468 0 : fd_snapshot_slot_acc_vecs_new( self->storages + i );
4469 0 : fd_snapshot_slot_acc_vecs_decode_inner( self->storages + i, alloc_mem, ctx );
4470 0 : }
4471 0 : } else
4472 0 : self->storages = NULL;
4473 0 : fd_bincode_uint64_decode_unsafe( &self->version, ctx );
4474 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4475 0 : fd_bank_hash_info_decode_inner( &self->bank_hash_info, alloc_mem, ctx );
4476 0 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_len, ctx );
4477 0 : if( self->historical_roots_len ) {
4478 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4479 0 : self->historical_roots = *alloc_mem;
4480 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->historical_roots_len;
4481 0 : for( ulong i=0; i < self->historical_roots_len; i++ ) {
4482 0 : fd_bincode_uint64_decode_unsafe( self->historical_roots + i, ctx );
4483 0 : }
4484 0 : } else
4485 0 : self->historical_roots = NULL;
4486 0 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_with_hash_len, ctx );
4487 0 : if( self->historical_roots_with_hash_len ) {
4488 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_MAP_PAIR_ALIGN );
4489 0 : self->historical_roots_with_hash = *alloc_mem;
4490 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_map_pair_t)*self->historical_roots_with_hash_len;
4491 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ ) {
4492 0 : fd_slot_map_pair_new( self->historical_roots_with_hash + i );
4493 0 : fd_slot_map_pair_decode_inner( self->historical_roots_with_hash + i, alloc_mem, ctx );
4494 0 : }
4495 0 : } else
4496 0 : self->historical_roots_with_hash = NULL;
4497 0 : }
4498 0 : void * fd_solana_accounts_db_fields_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4499 0 : fd_solana_accounts_db_fields_t * self = (fd_solana_accounts_db_fields_t *)mem;
4500 0 : fd_solana_accounts_db_fields_new( self );
4501 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_accounts_db_fields_t);
4502 0 : void * * alloc_mem = &alloc_region;
4503 0 : fd_solana_accounts_db_fields_decode_inner( mem, alloc_mem, ctx );
4504 0 : return self;
4505 0 : }
4506 0 : static void fd_solana_accounts_db_fields_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4507 0 : fd_solana_accounts_db_fields_global_t * self = (fd_solana_accounts_db_fields_global_t *)struct_mem;
4508 0 : fd_bincode_uint64_decode_unsafe( &self->storages_len, ctx );
4509 0 : if( self->storages_len ) {
4510 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SNAPSHOT_SLOT_ACC_VECS_ALIGN );
4511 0 : self->storages_offset = (ulong)*alloc_mem - (ulong)struct_mem;
4512 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4513 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_snapshot_slot_acc_vecs_t)*self->storages_len;
4514 0 : for( ulong i=0; i < self->storages_len; i++ ) {
4515 0 : fd_snapshot_slot_acc_vecs_new( (fd_snapshot_slot_acc_vecs_t *)fd_type_pun(cur_mem + sizeof(fd_snapshot_slot_acc_vecs_t) * i) );
4516 0 : fd_snapshot_slot_acc_vecs_decode_inner_global( cur_mem + sizeof(fd_snapshot_slot_acc_vecs_t) * i, alloc_mem, ctx );
4517 0 : }
4518 0 : } else {
4519 0 : self->storages_offset = 0UL;
4520 0 : }
4521 0 : fd_bincode_uint64_decode_unsafe( &self->version, ctx );
4522 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4523 0 : fd_bank_hash_info_decode_inner( &self->bank_hash_info, alloc_mem, ctx );
4524 0 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_len, ctx );
4525 0 : if( self->historical_roots_len ) {
4526 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4527 0 : self->historical_roots_offset = (ulong)*alloc_mem - (ulong)struct_mem;
4528 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4529 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->historical_roots_len;
4530 0 : for( ulong i=0; i < self->historical_roots_len; i++ ) {
4531 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
4532 0 : }
4533 0 : } else {
4534 0 : self->historical_roots_offset = 0UL;
4535 0 : }
4536 0 : fd_bincode_uint64_decode_unsafe( &self->historical_roots_with_hash_len, ctx );
4537 0 : if( self->historical_roots_with_hash_len ) {
4538 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_MAP_PAIR_ALIGN );
4539 0 : self->historical_roots_with_hash_offset = (ulong)*alloc_mem - (ulong)struct_mem;
4540 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4541 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_map_pair_t)*self->historical_roots_with_hash_len;
4542 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ ) {
4543 0 : fd_slot_map_pair_new( (fd_slot_map_pair_t *)fd_type_pun(cur_mem + sizeof(fd_slot_map_pair_t) * i) );
4544 0 : fd_slot_map_pair_decode_inner( cur_mem + sizeof(fd_slot_map_pair_t) * i, alloc_mem, ctx );
4545 0 : }
4546 0 : } else {
4547 0 : self->historical_roots_with_hash_offset = 0UL;
4548 0 : }
4549 0 : }
4550 0 : void * fd_solana_accounts_db_fields_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4551 0 : fd_solana_accounts_db_fields_global_t * self = (fd_solana_accounts_db_fields_global_t *)mem;
4552 0 : fd_solana_accounts_db_fields_new( (fd_solana_accounts_db_fields_t *)self );
4553 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_accounts_db_fields_global_t);
4554 0 : void * * alloc_mem = &alloc_region;
4555 0 : fd_solana_accounts_db_fields_decode_inner_global( mem, alloc_mem, ctx );
4556 0 : return self;
4557 0 : }
4558 0 : void fd_solana_accounts_db_fields_new(fd_solana_accounts_db_fields_t * self) {
4559 0 : fd_memset( self, 0, sizeof(fd_solana_accounts_db_fields_t) );
4560 0 : fd_bank_hash_info_new( &self->bank_hash_info );
4561 0 : }
4562 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, uint varint ) {
4563 0 : (void) varint;
4564 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_accounts_db_fields", level++, 0 );
4565 0 : if( self->storages_len ) {
4566 0 : fun( w, NULL, "storages", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4567 0 : for( ulong i=0; i < self->storages_len; i++ )
4568 0 : fd_snapshot_slot_acc_vecs_walk(w, self->storages + i, fun, "snapshot_slot_acc_vecs", level, 0 );
4569 0 : fun( w, NULL, "storages", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4570 0 : }
4571 0 : fun( w, &self->version, "version", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4572 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4573 0 : fd_bank_hash_info_walk( w, &self->bank_hash_info, fun, "bank_hash_info", level, 0 );
4574 0 : if( self->historical_roots_len ) {
4575 0 : fun( w, NULL, "historical_roots", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4576 0 : for( ulong i=0; i < self->historical_roots_len; i++ )
4577 0 : fun( w, self->historical_roots + i, "historical_roots", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4578 0 : fun( w, NULL, "historical_roots", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4579 0 : }
4580 0 : if( self->historical_roots_with_hash_len ) {
4581 0 : fun( w, NULL, "historical_roots_with_hash", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4582 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ )
4583 0 : fd_slot_map_pair_walk(w, self->historical_roots_with_hash + i, fun, "slot_map_pair", level, 0 );
4584 0 : fun( w, NULL, "historical_roots_with_hash", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4585 0 : }
4586 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_accounts_db_fields", level--, 0 );
4587 0 : }
4588 0 : ulong fd_solana_accounts_db_fields_size( fd_solana_accounts_db_fields_t const * self ) {
4589 0 : ulong size = 0;
4590 0 : do {
4591 0 : size += sizeof(ulong);
4592 0 : for( ulong i=0; i < self->storages_len; i++ )
4593 0 : size += fd_snapshot_slot_acc_vecs_size( self->storages + i );
4594 0 : } while(0);
4595 0 : size += sizeof(ulong);
4596 0 : size += sizeof(ulong);
4597 0 : size += fd_bank_hash_info_size( &self->bank_hash_info );
4598 0 : do {
4599 0 : size += sizeof(ulong);
4600 0 : size += self->historical_roots_len * sizeof(ulong);
4601 0 : } while(0);
4602 0 : do {
4603 0 : size += sizeof(ulong);
4604 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ )
4605 0 : size += fd_slot_map_pair_size( self->historical_roots_with_hash + i );
4606 0 : } while(0);
4607 0 : return size;
4608 0 : }
4609 :
4610 0 : ulong fd_solana_accounts_db_fields_size_global( fd_solana_accounts_db_fields_global_t const * self ) {
4611 0 : ulong size = 0;
4612 0 : do {
4613 0 : size += sizeof(ulong);
4614 0 : fd_snapshot_slot_acc_vecs_global_t * storages = self->storages_offset ? (fd_snapshot_slot_acc_vecs_global_t *)fd_type_pun( (uchar *)self + self->storages_offset ) : NULL;
4615 0 : for( ulong i=0; i < self->storages_len; i++ )
4616 0 : size += fd_snapshot_slot_acc_vecs_size_global( storages + i );
4617 0 : } while(0);
4618 0 : size += sizeof(ulong);
4619 0 : size += sizeof(ulong);
4620 0 : size += fd_bank_hash_info_size( &self->bank_hash_info );
4621 0 : do {
4622 0 : size += sizeof(ulong);
4623 0 : ulong * historical_roots = self->historical_roots_offset ? (ulong *)fd_type_pun( (uchar *)self + self->historical_roots_offset ) : NULL;
4624 0 : size += self->historical_roots_len * sizeof(ulong);
4625 0 : } while(0);
4626 0 : do {
4627 0 : size += sizeof(ulong);
4628 0 : fd_slot_map_pair_t * historical_roots_with_hash = self->historical_roots_with_hash_offset ? (fd_slot_map_pair_t *)fd_type_pun( (uchar *)self + self->historical_roots_with_hash_offset ) : NULL;
4629 0 : for( ulong i=0; i < self->historical_roots_with_hash_len; i++ )
4630 0 : size += fd_slot_map_pair_size( historical_roots_with_hash + i );
4631 0 : } while(0);
4632 0 : return size;
4633 0 : }
4634 :
4635 0 : int fd_versioned_epoch_stakes_current_encode( fd_versioned_epoch_stakes_current_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4636 0 : int err;
4637 0 : err = fd_stakes_stake_encode( &self->stakes, ctx );
4638 0 : if( FD_UNLIKELY( err ) ) return err;
4639 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
4640 0 : if( FD_UNLIKELY( err ) ) return err;
4641 0 : if( self->node_id_to_vote_accounts_root ) {
4642 0 : ulong node_id_to_vote_accounts_len = fd_pubkey_node_vote_accounts_pair_t_map_size( self->node_id_to_vote_accounts_pool, self->node_id_to_vote_accounts_root );
4643 0 : err = fd_bincode_uint64_encode( node_id_to_vote_accounts_len, ctx );
4644 0 : if( FD_UNLIKELY( err ) ) return err;
4645 0 : for( fd_pubkey_node_vote_accounts_pair_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_t_map_minimum( self->node_id_to_vote_accounts_pool, self->node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_t_map_successor( self->node_id_to_vote_accounts_pool, n ) ) {
4646 0 : err = fd_pubkey_node_vote_accounts_pair_encode( &n->elem, ctx );
4647 0 : if( FD_UNLIKELY( err ) ) return err;
4648 0 : }
4649 0 : } else {
4650 0 : ulong node_id_to_vote_accounts_len = 0;
4651 0 : err = fd_bincode_uint64_encode( node_id_to_vote_accounts_len, ctx );
4652 0 : if( FD_UNLIKELY( err ) ) return err;
4653 0 : }
4654 0 : if( self->epoch_authorized_voters_root ) {
4655 0 : ulong epoch_authorized_voters_len = fd_pubkey_pubkey_pair_t_map_size( self->epoch_authorized_voters_pool, self->epoch_authorized_voters_root );
4656 0 : err = fd_bincode_uint64_encode( epoch_authorized_voters_len, ctx );
4657 0 : if( FD_UNLIKELY( err ) ) return err;
4658 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum( self->epoch_authorized_voters_pool, self->epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( self->epoch_authorized_voters_pool, n ) ) {
4659 0 : err = fd_pubkey_pubkey_pair_encode( &n->elem, ctx );
4660 0 : if( FD_UNLIKELY( err ) ) return err;
4661 0 : }
4662 0 : } else {
4663 0 : ulong epoch_authorized_voters_len = 0;
4664 0 : err = fd_bincode_uint64_encode( epoch_authorized_voters_len, ctx );
4665 0 : if( FD_UNLIKELY( err ) ) return err;
4666 0 : }
4667 0 : return FD_BINCODE_SUCCESS;
4668 0 : }
4669 0 : int fd_versioned_epoch_stakes_current_encode_global( fd_versioned_epoch_stakes_current_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4670 0 : int err;
4671 0 : err = fd_stakes_stake_encode_global( &self->stakes, ctx );
4672 0 : if( FD_UNLIKELY( err ) ) return err;
4673 0 : err = fd_bincode_uint64_encode( self->total_stake, ctx );
4674 0 : if( FD_UNLIKELY( err ) ) return err;
4675 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_root = fd_pubkey_node_vote_accounts_pair_global_t_map_join( (uchar *)self + self->node_id_to_vote_accounts_root_offset );
4676 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_pool = fd_pubkey_node_vote_accounts_pair_global_t_map_join( (uchar *)self + self->node_id_to_vote_accounts_pool_offset );
4677 0 : if( node_id_to_vote_accounts_root ) {
4678 0 : ulong node_id_to_vote_accounts_len = fd_pubkey_node_vote_accounts_pair_global_t_map_size( node_id_to_vote_accounts_pool, node_id_to_vote_accounts_root );
4679 0 : err = fd_bincode_uint64_encode( node_id_to_vote_accounts_len, ctx );
4680 0 : if( FD_UNLIKELY( err ) ) return err;
4681 0 : for( fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_global_t_map_minimum( node_id_to_vote_accounts_pool, node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_global_t_map_successor( node_id_to_vote_accounts_pool, n ) ) {
4682 0 : err = fd_pubkey_node_vote_accounts_pair_encode_global( &n->elem, ctx );
4683 0 : if( FD_UNLIKELY( err ) ) return err;
4684 0 : }
4685 0 : } else {
4686 0 : ulong node_id_to_vote_accounts_len = 0;
4687 0 : err = fd_bincode_uint64_encode( node_id_to_vote_accounts_len, ctx );
4688 0 : if( FD_UNLIKELY( err ) ) return err;
4689 0 : }
4690 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_root = fd_pubkey_pubkey_pair_t_map_join( (uchar *)self + self->epoch_authorized_voters_root_offset );
4691 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_pool = fd_pubkey_pubkey_pair_t_map_join( (uchar *)self + self->epoch_authorized_voters_pool_offset );
4692 0 : if( epoch_authorized_voters_root ) {
4693 0 : ulong epoch_authorized_voters_len = fd_pubkey_pubkey_pair_t_map_size( epoch_authorized_voters_pool, epoch_authorized_voters_root );
4694 0 : err = fd_bincode_uint64_encode( epoch_authorized_voters_len, ctx );
4695 0 : if( FD_UNLIKELY( err ) ) return err;
4696 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum( epoch_authorized_voters_pool, epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( epoch_authorized_voters_pool, n ) ) {
4697 0 : err = fd_pubkey_pubkey_pair_encode( &n->elem, ctx );
4698 0 : if( FD_UNLIKELY( err ) ) return err;
4699 0 : }
4700 0 : } else {
4701 0 : ulong epoch_authorized_voters_len = 0;
4702 0 : err = fd_bincode_uint64_encode( epoch_authorized_voters_len, ctx );
4703 0 : if( FD_UNLIKELY( err ) ) return err;
4704 0 : }
4705 0 : return FD_BINCODE_SUCCESS;
4706 0 : }
4707 0 : static int fd_versioned_epoch_stakes_current_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4708 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4709 0 : int err = 0;
4710 0 : err = fd_stakes_stake_decode_footprint_inner( ctx, total_sz );
4711 0 : if( FD_UNLIKELY( err ) ) return err;
4712 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4713 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4714 0 : ulong node_id_to_vote_accounts_len = 0UL;
4715 0 : err = fd_bincode_uint64_decode( &node_id_to_vote_accounts_len, ctx );
4716 0 : ulong node_id_to_vote_accounts_cnt = !!node_id_to_vote_accounts_len ? node_id_to_vote_accounts_len : 1;
4717 0 : *total_sz += fd_pubkey_node_vote_accounts_pair_t_map_align() + fd_pubkey_node_vote_accounts_pair_t_map_footprint( node_id_to_vote_accounts_cnt );
4718 0 : if( FD_UNLIKELY( err ) ) return err;
4719 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
4720 0 : err = fd_pubkey_node_vote_accounts_pair_decode_footprint_inner( ctx, total_sz );
4721 0 : if( FD_UNLIKELY( err ) ) return err;
4722 0 : }
4723 0 : ulong epoch_authorized_voters_len = 0UL;
4724 0 : err = fd_bincode_uint64_decode( &epoch_authorized_voters_len, ctx );
4725 0 : ulong epoch_authorized_voters_cnt = !!epoch_authorized_voters_len ? epoch_authorized_voters_len : 1;
4726 0 : *total_sz += fd_pubkey_pubkey_pair_t_map_align() + fd_pubkey_pubkey_pair_t_map_footprint( epoch_authorized_voters_cnt );
4727 0 : if( FD_UNLIKELY( err ) ) return err;
4728 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
4729 0 : err = fd_pubkey_pubkey_pair_decode_footprint_inner( ctx, total_sz );
4730 0 : if( FD_UNLIKELY( err ) ) return err;
4731 0 : }
4732 0 : return 0;
4733 0 : }
4734 0 : int fd_versioned_epoch_stakes_current_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4735 0 : *total_sz += sizeof(fd_versioned_epoch_stakes_current_t);
4736 0 : void const * start_data = ctx->data;
4737 0 : int err = fd_versioned_epoch_stakes_current_decode_footprint_inner( ctx, total_sz );
4738 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4739 0 : ctx->data = start_data;
4740 0 : return err;
4741 0 : }
4742 0 : static void fd_versioned_epoch_stakes_current_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4743 0 : fd_versioned_epoch_stakes_current_t * self = (fd_versioned_epoch_stakes_current_t *)struct_mem;
4744 0 : fd_stakes_stake_decode_inner( &self->stakes, alloc_mem, ctx );
4745 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
4746 0 : ulong node_id_to_vote_accounts_len;
4747 0 : fd_bincode_uint64_decode_unsafe( &node_id_to_vote_accounts_len, ctx );
4748 0 : self->node_id_to_vote_accounts_pool = fd_pubkey_node_vote_accounts_pair_t_map_join_new( alloc_mem, node_id_to_vote_accounts_len );
4749 0 : self->node_id_to_vote_accounts_root = NULL;
4750 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
4751 0 : fd_pubkey_node_vote_accounts_pair_t_mapnode_t * node = fd_pubkey_node_vote_accounts_pair_t_map_acquire( self->node_id_to_vote_accounts_pool );
4752 0 : fd_pubkey_node_vote_accounts_pair_new( &node->elem );
4753 0 : fd_pubkey_node_vote_accounts_pair_decode_inner( &node->elem, alloc_mem, ctx );
4754 0 : fd_pubkey_node_vote_accounts_pair_t_mapnode_t * out = NULL;;
4755 0 : fd_pubkey_node_vote_accounts_pair_t_map_insert_or_replace( self->node_id_to_vote_accounts_pool, &self->node_id_to_vote_accounts_root, node, &out );
4756 0 : if( out != NULL ) {
4757 0 : fd_pubkey_node_vote_accounts_pair_t_map_release( self->node_id_to_vote_accounts_pool, out );
4758 0 : }
4759 0 : }
4760 0 : ulong epoch_authorized_voters_len;
4761 0 : fd_bincode_uint64_decode_unsafe( &epoch_authorized_voters_len, ctx );
4762 0 : self->epoch_authorized_voters_pool = fd_pubkey_pubkey_pair_t_map_join_new( alloc_mem, epoch_authorized_voters_len );
4763 0 : self->epoch_authorized_voters_root = NULL;
4764 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
4765 0 : fd_pubkey_pubkey_pair_t_mapnode_t * node = fd_pubkey_pubkey_pair_t_map_acquire( self->epoch_authorized_voters_pool );
4766 0 : fd_pubkey_pubkey_pair_new( &node->elem );
4767 0 : fd_pubkey_pubkey_pair_decode_inner( &node->elem, alloc_mem, ctx );
4768 0 : fd_pubkey_pubkey_pair_t_mapnode_t * out = NULL;;
4769 0 : fd_pubkey_pubkey_pair_t_map_insert_or_replace( self->epoch_authorized_voters_pool, &self->epoch_authorized_voters_root, node, &out );
4770 0 : if( out != NULL ) {
4771 0 : fd_pubkey_pubkey_pair_t_map_release( self->epoch_authorized_voters_pool, out );
4772 0 : }
4773 0 : }
4774 0 : }
4775 0 : void * fd_versioned_epoch_stakes_current_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4776 0 : fd_versioned_epoch_stakes_current_t * self = (fd_versioned_epoch_stakes_current_t *)mem;
4777 0 : fd_versioned_epoch_stakes_current_new( self );
4778 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_current_t);
4779 0 : void * * alloc_mem = &alloc_region;
4780 0 : fd_versioned_epoch_stakes_current_decode_inner( mem, alloc_mem, ctx );
4781 0 : return self;
4782 0 : }
4783 0 : static void fd_versioned_epoch_stakes_current_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4784 0 : fd_versioned_epoch_stakes_current_global_t * self = (fd_versioned_epoch_stakes_current_global_t *)struct_mem;
4785 0 : fd_stakes_stake_decode_inner_global( &self->stakes, alloc_mem, ctx );
4786 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake, ctx );
4787 0 : ulong node_id_to_vote_accounts_len;
4788 0 : fd_bincode_uint64_decode_unsafe( &node_id_to_vote_accounts_len, ctx );
4789 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_pubkey_node_vote_accounts_pair_global_t_map_align() );
4790 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_pool = fd_pubkey_node_vote_accounts_pair_global_t_map_join_new( alloc_mem, node_id_to_vote_accounts_len );
4791 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_root = NULL;
4792 0 : for( ulong i=0; i < node_id_to_vote_accounts_len; i++ ) {
4793 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node = fd_pubkey_node_vote_accounts_pair_global_t_map_acquire( node_id_to_vote_accounts_pool );
4794 0 : fd_pubkey_node_vote_accounts_pair_new( (fd_pubkey_node_vote_accounts_pair_t *)fd_type_pun(&node->elem) );
4795 0 : fd_pubkey_node_vote_accounts_pair_decode_inner_global( &node->elem, alloc_mem, ctx );
4796 0 : fd_pubkey_node_vote_accounts_pair_global_t_map_insert( node_id_to_vote_accounts_pool, &node_id_to_vote_accounts_root, node );
4797 0 : }
4798 0 : self->node_id_to_vote_accounts_pool_offset = (ulong)fd_pubkey_node_vote_accounts_pair_global_t_map_leave( node_id_to_vote_accounts_pool ) - (ulong)struct_mem;
4799 0 : self->node_id_to_vote_accounts_root_offset = (ulong)node_id_to_vote_accounts_root - (ulong)struct_mem;
4800 0 : ulong epoch_authorized_voters_len;
4801 0 : fd_bincode_uint64_decode_unsafe( &epoch_authorized_voters_len, ctx );
4802 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_pubkey_pubkey_pair_t_map_align() );
4803 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_pool = fd_pubkey_pubkey_pair_t_map_join_new( alloc_mem, epoch_authorized_voters_len );
4804 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_root = NULL;
4805 0 : for( ulong i=0; i < epoch_authorized_voters_len; i++ ) {
4806 0 : fd_pubkey_pubkey_pair_t_mapnode_t * node = fd_pubkey_pubkey_pair_t_map_acquire( epoch_authorized_voters_pool );
4807 0 : fd_pubkey_pubkey_pair_new( (fd_pubkey_pubkey_pair_t *)fd_type_pun(&node->elem) );
4808 0 : fd_pubkey_pubkey_pair_decode_inner( &node->elem, alloc_mem, ctx );
4809 0 : fd_pubkey_pubkey_pair_t_map_insert( epoch_authorized_voters_pool, &epoch_authorized_voters_root, node );
4810 0 : }
4811 0 : self->epoch_authorized_voters_pool_offset = (ulong)fd_pubkey_pubkey_pair_t_map_leave( epoch_authorized_voters_pool ) - (ulong)struct_mem;
4812 0 : self->epoch_authorized_voters_root_offset = (ulong)epoch_authorized_voters_root - (ulong)struct_mem;
4813 0 : }
4814 0 : void * fd_versioned_epoch_stakes_current_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4815 0 : fd_versioned_epoch_stakes_current_global_t * self = (fd_versioned_epoch_stakes_current_global_t *)mem;
4816 0 : fd_versioned_epoch_stakes_current_new( (fd_versioned_epoch_stakes_current_t *)self );
4817 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_current_global_t);
4818 0 : void * * alloc_mem = &alloc_region;
4819 0 : fd_versioned_epoch_stakes_current_decode_inner_global( mem, alloc_mem, ctx );
4820 0 : return self;
4821 0 : }
4822 0 : void fd_versioned_epoch_stakes_current_new(fd_versioned_epoch_stakes_current_t * self) {
4823 0 : fd_memset( self, 0, sizeof(fd_versioned_epoch_stakes_current_t) );
4824 0 : fd_stakes_stake_new( &self->stakes );
4825 0 : }
4826 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, uint varint ) {
4827 0 : (void) varint;
4828 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_versioned_epoch_stakes_current", level++, 0 );
4829 0 : fd_stakes_stake_walk( w, &self->stakes, fun, "stakes", level, 0 );
4830 0 : fun( w, &self->total_stake, "total_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4831 0 : if( self->node_id_to_vote_accounts_root ) {
4832 0 : for( fd_pubkey_node_vote_accounts_pair_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_t_map_minimum(self->node_id_to_vote_accounts_pool, self->node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_t_map_successor( self->node_id_to_vote_accounts_pool, n ) ) {
4833 0 : fd_pubkey_node_vote_accounts_pair_walk(w, &n->elem, fun, "node_id_to_vote_accounts", level, 0 );
4834 0 : }
4835 0 : }
4836 0 : if( self->epoch_authorized_voters_root ) {
4837 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum(self->epoch_authorized_voters_pool, self->epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( self->epoch_authorized_voters_pool, n ) ) {
4838 0 : fd_pubkey_pubkey_pair_walk(w, &n->elem, fun, "epoch_authorized_voters", level, 0 );
4839 0 : }
4840 0 : }
4841 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_versioned_epoch_stakes_current", level--, 0 );
4842 0 : }
4843 0 : ulong fd_versioned_epoch_stakes_current_size( fd_versioned_epoch_stakes_current_t const * self ) {
4844 0 : ulong size = 0;
4845 0 : size += fd_stakes_stake_size( &self->stakes );
4846 0 : size += sizeof(ulong);
4847 0 : if( self->node_id_to_vote_accounts_root ) {
4848 0 : size += sizeof(ulong);
4849 0 : ulong max = fd_pubkey_node_vote_accounts_pair_t_map_max( self->node_id_to_vote_accounts_pool );
4850 0 : size += fd_pubkey_node_vote_accounts_pair_t_map_footprint( max );
4851 0 : for( fd_pubkey_node_vote_accounts_pair_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_t_map_minimum( self->node_id_to_vote_accounts_pool, self->node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_t_map_successor( self->node_id_to_vote_accounts_pool, n ) ) {
4852 0 : size += fd_pubkey_node_vote_accounts_pair_size( &n->elem ) - sizeof(fd_pubkey_node_vote_accounts_pair_t);
4853 0 : }
4854 0 : } else {
4855 0 : size += sizeof(ulong);
4856 0 : }
4857 0 : if( self->epoch_authorized_voters_root ) {
4858 0 : size += sizeof(ulong);
4859 0 : ulong max = fd_pubkey_pubkey_pair_t_map_max( self->epoch_authorized_voters_pool );
4860 0 : size += fd_pubkey_pubkey_pair_t_map_footprint( max );
4861 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum( self->epoch_authorized_voters_pool, self->epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( self->epoch_authorized_voters_pool, n ) ) {
4862 0 : size += fd_pubkey_pubkey_pair_size( &n->elem ) - sizeof(fd_pubkey_pubkey_pair_t);
4863 0 : }
4864 0 : } else {
4865 0 : size += sizeof(ulong);
4866 0 : }
4867 0 : return size;
4868 0 : }
4869 :
4870 0 : ulong fd_versioned_epoch_stakes_current_size_global( fd_versioned_epoch_stakes_current_global_t const * self ) {
4871 0 : ulong size = 0;
4872 0 : size += fd_stakes_stake_size_global( &self->stakes );
4873 0 : size += sizeof(ulong);
4874 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_pool = !!self->node_id_to_vote_accounts_pool_offset ? (fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t *)fd_pubkey_node_vote_accounts_pair_global_t_map_join( fd_type_pun( (uchar *)self + self->node_id_to_vote_accounts_pool_offset ) ) : NULL;
4875 0 : fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * node_id_to_vote_accounts_root = !!self->node_id_to_vote_accounts_root_offset ? (fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t *)fd_type_pun( (uchar *)self + self->node_id_to_vote_accounts_root_offset ) : NULL;
4876 0 : if( node_id_to_vote_accounts_root ) {
4877 0 : size += sizeof(ulong);
4878 0 : ulong max = fd_pubkey_node_vote_accounts_pair_global_t_map_max( node_id_to_vote_accounts_pool );
4879 0 : size += fd_pubkey_node_vote_accounts_pair_global_t_map_footprint( max );
4880 0 : for( fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * n = fd_pubkey_node_vote_accounts_pair_global_t_map_minimum( node_id_to_vote_accounts_pool, node_id_to_vote_accounts_root ); n; n = fd_pubkey_node_vote_accounts_pair_global_t_map_successor( node_id_to_vote_accounts_pool, n ) ) {
4881 0 : size += fd_pubkey_node_vote_accounts_pair_size_global( &n->elem ) - sizeof(fd_pubkey_node_vote_accounts_pair_t);
4882 0 : }
4883 0 : } else {
4884 0 : size += sizeof(ulong);
4885 0 : }
4886 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_pool = !!self->epoch_authorized_voters_pool_offset ? (fd_pubkey_pubkey_pair_t_mapnode_t *)fd_pubkey_pubkey_pair_t_map_join( fd_type_pun( (uchar *)self + self->epoch_authorized_voters_pool_offset ) ) : NULL;
4887 0 : fd_pubkey_pubkey_pair_t_mapnode_t * epoch_authorized_voters_root = !!self->epoch_authorized_voters_root_offset ? (fd_pubkey_pubkey_pair_t_mapnode_t *)fd_type_pun( (uchar *)self + self->epoch_authorized_voters_root_offset ) : NULL;
4888 0 : if( epoch_authorized_voters_root ) {
4889 0 : size += sizeof(ulong);
4890 0 : ulong max = fd_pubkey_pubkey_pair_t_map_max( epoch_authorized_voters_pool );
4891 0 : size += fd_pubkey_pubkey_pair_t_map_footprint( max );
4892 0 : for( fd_pubkey_pubkey_pair_t_mapnode_t * n = fd_pubkey_pubkey_pair_t_map_minimum( epoch_authorized_voters_pool, epoch_authorized_voters_root ); n; n = fd_pubkey_pubkey_pair_t_map_successor( epoch_authorized_voters_pool, n ) ) {
4893 0 : size += fd_pubkey_pubkey_pair_size( &n->elem ) - sizeof(fd_pubkey_pubkey_pair_t);
4894 0 : }
4895 0 : } else {
4896 0 : size += sizeof(ulong);
4897 0 : }
4898 0 : return size;
4899 0 : }
4900 :
4901 0 : FD_FN_PURE uchar fd_versioned_epoch_stakes_is_Current(fd_versioned_epoch_stakes_t const * self) {
4902 0 : return self->discriminant == 0;
4903 0 : }
4904 : void fd_versioned_epoch_stakes_inner_new( fd_versioned_epoch_stakes_inner_t * self, uint discriminant );
4905 0 : int fd_versioned_epoch_stakes_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4906 0 : int err;
4907 0 : switch (discriminant) {
4908 0 : case 0: {
4909 0 : err = fd_versioned_epoch_stakes_current_decode_footprint_inner( ctx, total_sz );
4910 0 : if( FD_UNLIKELY( err ) ) return err;
4911 0 : return FD_BINCODE_SUCCESS;
4912 0 : }
4913 0 : default: return FD_BINCODE_ERR_ENCODING;
4914 0 : }
4915 0 : }
4916 0 : static int fd_versioned_epoch_stakes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4917 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4918 0 : uint discriminant = 0;
4919 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4920 0 : if( FD_UNLIKELY( err ) ) return err;
4921 0 : return fd_versioned_epoch_stakes_inner_decode_footprint( discriminant, ctx, total_sz );
4922 0 : }
4923 0 : int fd_versioned_epoch_stakes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4924 0 : *total_sz += sizeof(fd_versioned_epoch_stakes_t);
4925 0 : void const * start_data = ctx->data;
4926 0 : int err = fd_versioned_epoch_stakes_decode_footprint_inner( ctx, total_sz );
4927 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4928 0 : ctx->data = start_data;
4929 0 : return err;
4930 0 : }
4931 0 : static void fd_versioned_epoch_stakes_inner_decode_inner( fd_versioned_epoch_stakes_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
4932 0 : switch (discriminant) {
4933 0 : case 0: {
4934 0 : fd_versioned_epoch_stakes_current_decode_inner( &self->Current, alloc_mem, ctx );
4935 0 : break;
4936 0 : }
4937 0 : }
4938 0 : }
4939 0 : static void fd_versioned_epoch_stakes_inner_decode_inner_global( fd_versioned_epoch_stakes_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
4940 0 : switch (discriminant) {
4941 0 : case 0: {
4942 0 : fd_versioned_epoch_stakes_current_decode_inner_global( &self->Current, alloc_mem, ctx );
4943 0 : break;
4944 0 : }
4945 0 : }
4946 0 : }
4947 0 : static void fd_versioned_epoch_stakes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4948 0 : fd_versioned_epoch_stakes_t * self = (fd_versioned_epoch_stakes_t *)struct_mem;
4949 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4950 0 : fd_versioned_epoch_stakes_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
4951 0 : }
4952 0 : void * fd_versioned_epoch_stakes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4953 0 : fd_versioned_epoch_stakes_t * self = (fd_versioned_epoch_stakes_t *)mem;
4954 0 : fd_versioned_epoch_stakes_new( self );
4955 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_t);
4956 0 : void * * alloc_mem = &alloc_region;
4957 0 : fd_versioned_epoch_stakes_decode_inner( mem, alloc_mem, ctx );
4958 0 : return self;
4959 0 : }
4960 0 : static int fd_versioned_epoch_stakes_inner_encode_global( fd_versioned_epoch_stakes_inner_global_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
4961 0 : int err;
4962 0 : switch (discriminant) {
4963 0 : case 0: {
4964 0 : err = fd_versioned_epoch_stakes_current_encode_global( &self->Current, ctx );
4965 0 : if( FD_UNLIKELY( err ) ) return err;
4966 0 : break;
4967 0 : }
4968 0 : }
4969 0 : return FD_BINCODE_SUCCESS;
4970 0 : }
4971 0 : int fd_versioned_epoch_stakes_encode_global( fd_versioned_epoch_stakes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4972 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4973 0 : if( FD_UNLIKELY( err ) ) return err;
4974 0 : return fd_versioned_epoch_stakes_inner_encode_global( &self->inner, self->discriminant, ctx );
4975 0 : }
4976 :
4977 0 : static void fd_versioned_epoch_stakes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4978 0 : fd_versioned_epoch_stakes_global_t * self = (fd_versioned_epoch_stakes_global_t *)struct_mem;
4979 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4980 0 : fd_versioned_epoch_stakes_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
4981 0 : }
4982 0 : void * fd_versioned_epoch_stakes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4983 0 : fd_versioned_epoch_stakes_t * self = (fd_versioned_epoch_stakes_t *)mem;
4984 0 : fd_versioned_epoch_stakes_new( self );
4985 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_t);
4986 0 : void * * alloc_mem = &alloc_region;
4987 0 : fd_versioned_epoch_stakes_decode_inner_global( mem, alloc_mem, ctx );
4988 0 : return self;
4989 0 : }
4990 0 : void fd_versioned_epoch_stakes_inner_new( fd_versioned_epoch_stakes_inner_t * self, uint discriminant ) {
4991 0 : switch( discriminant ) {
4992 0 : case 0: {
4993 0 : fd_versioned_epoch_stakes_current_new( &self->Current );
4994 0 : break;
4995 0 : }
4996 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
4997 0 : }
4998 0 : }
4999 0 : void fd_versioned_epoch_stakes_new_disc( fd_versioned_epoch_stakes_t * self, uint discriminant ) {
5000 0 : self->discriminant = discriminant;
5001 0 : fd_versioned_epoch_stakes_inner_new( &self->inner, self->discriminant );
5002 0 : }
5003 0 : void fd_versioned_epoch_stakes_new( fd_versioned_epoch_stakes_t * self ) {
5004 0 : fd_memset( self, 0, sizeof(fd_versioned_epoch_stakes_t) );
5005 0 : fd_versioned_epoch_stakes_new_disc( self, UINT_MAX );
5006 0 : }
5007 :
5008 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, uint varint ) {
5009 0 : (void) varint;
5010 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_versioned_epoch_stakes", level++, 0);
5011 0 : switch( self->discriminant ) {
5012 0 : case 0: {
5013 0 : fun( w, self, "Current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5014 0 : fd_versioned_epoch_stakes_current_walk( w, &self->inner.Current, fun, "Current", level, 0 );
5015 0 : break;
5016 0 : }
5017 0 : }
5018 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_versioned_epoch_stakes", level--, 0 );
5019 0 : }
5020 0 : ulong fd_versioned_epoch_stakes_size( fd_versioned_epoch_stakes_t const * self ) {
5021 0 : ulong size = 0;
5022 0 : size += sizeof(uint);
5023 0 : switch (self->discriminant) {
5024 0 : case 0: {
5025 0 : size += fd_versioned_epoch_stakes_current_size( &self->inner.Current );
5026 0 : break;
5027 0 : }
5028 0 : }
5029 0 : return size;
5030 0 : }
5031 :
5032 0 : ulong fd_versioned_epoch_stakes_size_global( fd_versioned_epoch_stakes_global_t const * self ) {
5033 0 : ulong size = 0;
5034 0 : size += sizeof(uint);
5035 0 : switch (self->discriminant) {
5036 0 : case 0: {
5037 0 : size += fd_versioned_epoch_stakes_current_size_global( &self->inner.Current );
5038 0 : break;
5039 0 : }
5040 0 : }
5041 0 : return size;
5042 0 : }
5043 :
5044 0 : int fd_versioned_epoch_stakes_inner_encode( fd_versioned_epoch_stakes_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
5045 0 : int err;
5046 0 : switch (discriminant) {
5047 0 : case 0: {
5048 0 : err = fd_versioned_epoch_stakes_current_encode( &self->Current, ctx );
5049 0 : if( FD_UNLIKELY( err ) ) return err;
5050 0 : break;
5051 0 : }
5052 0 : }
5053 0 : return FD_BINCODE_SUCCESS;
5054 0 : }
5055 0 : int fd_versioned_epoch_stakes_encode( fd_versioned_epoch_stakes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5056 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
5057 0 : if( FD_UNLIKELY( err ) ) return err;
5058 0 : return fd_versioned_epoch_stakes_inner_encode( &self->inner, self->discriminant, ctx );
5059 0 : }
5060 :
5061 0 : int fd_versioned_epoch_stakes_pair_encode( fd_versioned_epoch_stakes_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5062 0 : int err;
5063 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
5064 0 : if( FD_UNLIKELY( err ) ) return err;
5065 0 : err = fd_versioned_epoch_stakes_encode( &self->val, ctx );
5066 0 : if( FD_UNLIKELY( err ) ) return err;
5067 0 : return FD_BINCODE_SUCCESS;
5068 0 : }
5069 0 : int fd_versioned_epoch_stakes_pair_encode_global( fd_versioned_epoch_stakes_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5070 0 : int err;
5071 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
5072 0 : if( FD_UNLIKELY( err ) ) return err;
5073 0 : err = fd_versioned_epoch_stakes_encode_global( &self->val, ctx );
5074 0 : if( FD_UNLIKELY( err ) ) return err;
5075 0 : return FD_BINCODE_SUCCESS;
5076 0 : }
5077 0 : static int fd_versioned_epoch_stakes_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5078 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5079 0 : int err = 0;
5080 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5081 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5082 0 : err = fd_versioned_epoch_stakes_decode_footprint_inner( ctx, total_sz );
5083 0 : if( FD_UNLIKELY( err ) ) return err;
5084 0 : return 0;
5085 0 : }
5086 0 : int fd_versioned_epoch_stakes_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5087 0 : *total_sz += sizeof(fd_versioned_epoch_stakes_pair_t);
5088 0 : void const * start_data = ctx->data;
5089 0 : int err = fd_versioned_epoch_stakes_pair_decode_footprint_inner( ctx, total_sz );
5090 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5091 0 : ctx->data = start_data;
5092 0 : return err;
5093 0 : }
5094 0 : static void fd_versioned_epoch_stakes_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5095 0 : fd_versioned_epoch_stakes_pair_t * self = (fd_versioned_epoch_stakes_pair_t *)struct_mem;
5096 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
5097 0 : fd_versioned_epoch_stakes_decode_inner( &self->val, alloc_mem, ctx );
5098 0 : }
5099 0 : void * fd_versioned_epoch_stakes_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5100 0 : fd_versioned_epoch_stakes_pair_t * self = (fd_versioned_epoch_stakes_pair_t *)mem;
5101 0 : fd_versioned_epoch_stakes_pair_new( self );
5102 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_pair_t);
5103 0 : void * * alloc_mem = &alloc_region;
5104 0 : fd_versioned_epoch_stakes_pair_decode_inner( mem, alloc_mem, ctx );
5105 0 : return self;
5106 0 : }
5107 0 : static void fd_versioned_epoch_stakes_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5108 0 : fd_versioned_epoch_stakes_pair_global_t * self = (fd_versioned_epoch_stakes_pair_global_t *)struct_mem;
5109 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
5110 0 : fd_versioned_epoch_stakes_decode_inner_global( &self->val, alloc_mem, ctx );
5111 0 : }
5112 0 : void * fd_versioned_epoch_stakes_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5113 0 : fd_versioned_epoch_stakes_pair_global_t * self = (fd_versioned_epoch_stakes_pair_global_t *)mem;
5114 0 : fd_versioned_epoch_stakes_pair_new( (fd_versioned_epoch_stakes_pair_t *)self );
5115 0 : void * alloc_region = (uchar *)mem + sizeof(fd_versioned_epoch_stakes_pair_global_t);
5116 0 : void * * alloc_mem = &alloc_region;
5117 0 : fd_versioned_epoch_stakes_pair_decode_inner_global( mem, alloc_mem, ctx );
5118 0 : return self;
5119 0 : }
5120 0 : void fd_versioned_epoch_stakes_pair_new(fd_versioned_epoch_stakes_pair_t * self) {
5121 0 : fd_memset( self, 0, sizeof(fd_versioned_epoch_stakes_pair_t) );
5122 0 : fd_versioned_epoch_stakes_new( &self->val );
5123 0 : }
5124 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, uint varint ) {
5125 0 : (void) varint;
5126 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_versioned_epoch_stakes_pair", level++, 0 );
5127 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5128 0 : fd_versioned_epoch_stakes_walk( w, &self->val, fun, "val", level, 0 );
5129 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_versioned_epoch_stakes_pair", level--, 0 );
5130 0 : }
5131 0 : ulong fd_versioned_epoch_stakes_pair_size( fd_versioned_epoch_stakes_pair_t const * self ) {
5132 0 : ulong size = 0;
5133 0 : size += sizeof(ulong);
5134 0 : size += fd_versioned_epoch_stakes_size( &self->val );
5135 0 : return size;
5136 0 : }
5137 :
5138 0 : ulong fd_versioned_epoch_stakes_pair_size_global( fd_versioned_epoch_stakes_pair_global_t const * self ) {
5139 0 : ulong size = 0;
5140 0 : size += sizeof(ulong);
5141 0 : size += fd_versioned_epoch_stakes_size_global( &self->val );
5142 0 : return size;
5143 0 : }
5144 :
5145 0 : int fd_reward_info_encode( fd_reward_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5146 0 : int err;
5147 0 : err = fd_reward_type_encode( &self->reward_type, ctx );
5148 0 : if( FD_UNLIKELY( err ) ) return err;
5149 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5150 0 : if( FD_UNLIKELY( err ) ) return err;
5151 0 : err = fd_bincode_uint64_encode( self->post_balance, ctx );
5152 0 : if( FD_UNLIKELY( err ) ) return err;
5153 0 : err = fd_bincode_uint64_encode( self->commission, ctx );
5154 0 : if( FD_UNLIKELY( err ) ) return err;
5155 0 : return FD_BINCODE_SUCCESS;
5156 0 : }
5157 0 : static int fd_reward_info_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5158 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5159 0 : int err = 0;
5160 0 : err = fd_reward_type_decode_footprint_inner( ctx, total_sz );
5161 0 : if( FD_UNLIKELY( err ) ) return err;
5162 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5163 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5164 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5165 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5166 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5167 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5168 0 : return 0;
5169 0 : }
5170 0 : int fd_reward_info_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5171 0 : *total_sz += sizeof(fd_reward_info_t);
5172 0 : void const * start_data = ctx->data;
5173 0 : int err = fd_reward_info_decode_footprint_inner( ctx, total_sz );
5174 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5175 0 : ctx->data = start_data;
5176 0 : return err;
5177 0 : }
5178 0 : static void fd_reward_info_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5179 0 : fd_reward_info_t * self = (fd_reward_info_t *)struct_mem;
5180 0 : fd_reward_type_decode_inner( &self->reward_type, alloc_mem, ctx );
5181 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5182 0 : fd_bincode_uint64_decode_unsafe( &self->post_balance, ctx );
5183 0 : fd_bincode_uint64_decode_unsafe( &self->commission, ctx );
5184 0 : }
5185 0 : void * fd_reward_info_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5186 0 : fd_reward_info_t * self = (fd_reward_info_t *)mem;
5187 0 : fd_reward_info_new( self );
5188 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_info_t);
5189 0 : void * * alloc_mem = &alloc_region;
5190 0 : fd_reward_info_decode_inner( mem, alloc_mem, ctx );
5191 0 : return self;
5192 0 : }
5193 0 : void fd_reward_info_new(fd_reward_info_t * self) {
5194 0 : fd_memset( self, 0, sizeof(fd_reward_info_t) );
5195 0 : fd_reward_type_new( &self->reward_type );
5196 0 : }
5197 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, uint varint ) {
5198 0 : (void) varint;
5199 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_reward_info", level++, 0 );
5200 0 : fd_reward_type_walk( w, &self->reward_type, fun, "reward_type", level, 0 );
5201 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5202 0 : fun( w, &self->post_balance, "post_balance", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5203 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5204 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_reward_info", level--, 0 );
5205 0 : }
5206 0 : int fd_slot_lthash_encode( fd_slot_lthash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5207 0 : int err;
5208 0 : err = fd_bincode_bytes_encode( self->lthash, sizeof(self->lthash), ctx );
5209 0 : if( FD_UNLIKELY( err ) ) return err;
5210 0 : return FD_BINCODE_SUCCESS;
5211 0 : }
5212 0 : static inline int fd_slot_lthash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5213 0 : if( (ulong)ctx->data + 2048UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5214 0 : ctx->data = (void *)( (ulong)ctx->data + 2048UL );
5215 0 : return 0;
5216 0 : }
5217 0 : static void fd_slot_lthash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5218 0 : fd_slot_lthash_t * self = (fd_slot_lthash_t *)struct_mem;
5219 0 : fd_bincode_bytes_decode_unsafe( &self->lthash[0], sizeof(self->lthash), ctx );
5220 0 : }
5221 0 : void * fd_slot_lthash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5222 0 : fd_slot_lthash_t * self = (fd_slot_lthash_t *)mem;
5223 0 : fd_slot_lthash_new( self );
5224 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_lthash_t);
5225 0 : void * * alloc_mem = &alloc_region;
5226 0 : fd_slot_lthash_decode_inner( mem, alloc_mem, ctx );
5227 0 : return self;
5228 0 : }
5229 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, uint varint ) {
5230 0 : (void) varint;
5231 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_lthash", level++, 0 );
5232 0 : fun( w, self->lthash, "lthash", FD_FLAMENCO_TYPE_HASH16384, "uchar[2048]", level, 0 );
5233 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_lthash", level--, 0 );
5234 0 : }
5235 0 : int fd_solana_manifest_encode( fd_solana_manifest_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5236 0 : int err;
5237 0 : err = fd_versioned_bank_encode( &self->bank, ctx );
5238 0 : if( FD_UNLIKELY( err ) ) return err;
5239 0 : err = fd_solana_accounts_db_fields_encode( &self->accounts_db, ctx );
5240 0 : if( FD_UNLIKELY( err ) ) return err;
5241 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
5242 0 : if( FD_UNLIKELY( err ) ) return err;
5243 0 : if( self->bank_incremental_snapshot_persistence != NULL ) {
5244 0 : err = fd_bincode_bool_encode( 1, ctx );
5245 0 : if( FD_UNLIKELY( err ) ) return err;
5246 0 : err = fd_bank_incremental_snapshot_persistence_encode( self->bank_incremental_snapshot_persistence, ctx );
5247 0 : if( FD_UNLIKELY( err ) ) return err;
5248 0 : } else {
5249 0 : err = fd_bincode_bool_encode( 0, ctx );
5250 0 : if( FD_UNLIKELY( err ) ) return err;
5251 0 : }
5252 0 : if( self->epoch_account_hash != NULL ) {
5253 0 : err = fd_bincode_bool_encode( 1, ctx );
5254 0 : if( FD_UNLIKELY( err ) ) return err;
5255 0 : err = fd_hash_encode( self->epoch_account_hash, ctx );
5256 0 : if( FD_UNLIKELY( err ) ) return err;
5257 0 : } else {
5258 0 : err = fd_bincode_bool_encode( 0, ctx );
5259 0 : if( FD_UNLIKELY( err ) ) return err;
5260 0 : }
5261 0 : err = fd_bincode_uint64_encode( self->versioned_epoch_stakes_len, ctx );
5262 0 : if( FD_UNLIKELY(err) ) return err;
5263 0 : if( self->versioned_epoch_stakes_len ) {
5264 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
5265 0 : err = fd_versioned_epoch_stakes_pair_encode( self->versioned_epoch_stakes + i, ctx );
5266 0 : if( FD_UNLIKELY( err ) ) return err;
5267 0 : }
5268 0 : }
5269 0 : if( self->lthash != NULL ) {
5270 0 : err = fd_bincode_bool_encode( 1, ctx );
5271 0 : if( FD_UNLIKELY( err ) ) return err;
5272 0 : err = fd_slot_lthash_encode( self->lthash, ctx );
5273 0 : if( FD_UNLIKELY( err ) ) return err;
5274 0 : } else {
5275 0 : err = fd_bincode_bool_encode( 0, ctx );
5276 0 : if( FD_UNLIKELY( err ) ) return err;
5277 0 : }
5278 0 : return FD_BINCODE_SUCCESS;
5279 0 : }
5280 0 : int fd_solana_manifest_encode_global( fd_solana_manifest_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5281 0 : int err;
5282 0 : err = fd_versioned_bank_encode_global( &self->bank, ctx );
5283 0 : if( FD_UNLIKELY( err ) ) return err;
5284 0 : err = fd_solana_accounts_db_fields_encode_global( &self->accounts_db, ctx );
5285 0 : if( FD_UNLIKELY( err ) ) return err;
5286 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
5287 0 : if( FD_UNLIKELY( err ) ) return err;
5288 0 : if( self->bank_incremental_snapshot_persistence_offset ) {
5289 0 : err = fd_bincode_bool_encode( 1, ctx );
5290 0 : if( FD_UNLIKELY( err ) ) return err;
5291 0 : fd_bank_incremental_snapshot_persistence_t * bank_incremental_snapshot_persistence = (void *)((uchar*)self + self->bank_incremental_snapshot_persistence_offset);
5292 0 : err = fd_bank_incremental_snapshot_persistence_encode( bank_incremental_snapshot_persistence, ctx );
5293 0 : if( FD_UNLIKELY( err ) ) return err;
5294 0 : } else {
5295 0 : err = fd_bincode_bool_encode( 0, ctx );
5296 0 : if( FD_UNLIKELY( err ) ) return err;
5297 0 : }
5298 0 : if( self->epoch_account_hash_offset ) {
5299 0 : err = fd_bincode_bool_encode( 1, ctx );
5300 0 : if( FD_UNLIKELY( err ) ) return err;
5301 0 : fd_hash_t * epoch_account_hash = (void *)((uchar*)self + self->epoch_account_hash_offset);
5302 0 : err = fd_hash_encode( epoch_account_hash, ctx );
5303 0 : if( FD_UNLIKELY( err ) ) return err;
5304 0 : } else {
5305 0 : err = fd_bincode_bool_encode( 0, ctx );
5306 0 : if( FD_UNLIKELY( err ) ) return err;
5307 0 : }
5308 0 : err = fd_bincode_uint64_encode( self->versioned_epoch_stakes_len, ctx );
5309 0 : if( FD_UNLIKELY( err ) ) return err;
5310 0 : if( self->versioned_epoch_stakes_len ) {
5311 0 : uchar * versioned_epoch_stakes_laddr = (uchar*)self + self->versioned_epoch_stakes_offset;
5312 0 : fd_versioned_epoch_stakes_pair_global_t * versioned_epoch_stakes = (fd_versioned_epoch_stakes_pair_global_t *)versioned_epoch_stakes_laddr;
5313 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
5314 0 : err = fd_versioned_epoch_stakes_pair_encode_global( &versioned_epoch_stakes[i], ctx );
5315 0 : if( FD_UNLIKELY( err ) ) return err;
5316 0 : }
5317 0 : }
5318 0 : if( self->lthash_offset ) {
5319 0 : err = fd_bincode_bool_encode( 1, ctx );
5320 0 : if( FD_UNLIKELY( err ) ) return err;
5321 0 : fd_slot_lthash_t * lthash = (void *)((uchar*)self + self->lthash_offset);
5322 0 : err = fd_slot_lthash_encode( lthash, ctx );
5323 0 : if( FD_UNLIKELY( err ) ) return err;
5324 0 : } else {
5325 0 : err = fd_bincode_bool_encode( 0, ctx );
5326 0 : if( FD_UNLIKELY( err ) ) return err;
5327 0 : }
5328 0 : return FD_BINCODE_SUCCESS;
5329 0 : }
5330 0 : static int fd_solana_manifest_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5331 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5332 0 : int err = 0;
5333 0 : err = fd_versioned_bank_decode_footprint_inner( ctx, total_sz );
5334 0 : if( FD_UNLIKELY( err ) ) return err;
5335 0 : err = fd_solana_accounts_db_fields_decode_footprint_inner( ctx, total_sz );
5336 0 : if( FD_UNLIKELY( err ) ) return err;
5337 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5338 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5339 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
5340 0 : {
5341 0 : uchar o;
5342 0 : err = fd_bincode_bool_decode( &o, ctx );
5343 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5344 0 : if( o ) {
5345 0 : *total_sz += FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN + sizeof(fd_bank_incremental_snapshot_persistence_t);
5346 0 : err = fd_bank_incremental_snapshot_persistence_decode_footprint_inner( ctx, total_sz );
5347 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5348 0 : }
5349 0 : }
5350 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
5351 0 : {
5352 0 : uchar o;
5353 0 : err = fd_bincode_bool_decode( &o, ctx );
5354 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5355 0 : if( o ) {
5356 0 : *total_sz += FD_HASH_ALIGN + sizeof(fd_hash_t);
5357 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
5358 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5359 0 : }
5360 0 : }
5361 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
5362 0 : ulong versioned_epoch_stakes_len;
5363 0 : err = fd_bincode_uint64_decode( &versioned_epoch_stakes_len, ctx );
5364 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5365 0 : if( versioned_epoch_stakes_len ) {
5366 0 : *total_sz += FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN + sizeof(fd_versioned_epoch_stakes_pair_t)*versioned_epoch_stakes_len;
5367 0 : for( ulong i=0; i < versioned_epoch_stakes_len; i++ ) {
5368 0 : err = fd_versioned_epoch_stakes_pair_decode_footprint_inner( ctx, total_sz );
5369 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5370 0 : }
5371 0 : }
5372 0 : if( ctx->data == ctx->dataend ) return FD_BINCODE_SUCCESS;
5373 0 : {
5374 0 : uchar o;
5375 0 : err = fd_bincode_bool_decode( &o, ctx );
5376 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5377 0 : if( o ) {
5378 0 : *total_sz += FD_SLOT_LTHASH_ALIGN + sizeof(fd_slot_lthash_t);
5379 0 : err = fd_slot_lthash_decode_footprint_inner( ctx, total_sz );
5380 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5381 0 : }
5382 0 : }
5383 0 : return 0;
5384 0 : }
5385 0 : int fd_solana_manifest_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5386 0 : *total_sz += sizeof(fd_solana_manifest_t);
5387 0 : void const * start_data = ctx->data;
5388 0 : int err = fd_solana_manifest_decode_footprint_inner( ctx, total_sz );
5389 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5390 0 : ctx->data = start_data;
5391 0 : return err;
5392 0 : }
5393 0 : static void fd_solana_manifest_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5394 0 : fd_solana_manifest_t * self = (fd_solana_manifest_t *)struct_mem;
5395 0 : fd_versioned_bank_decode_inner( &self->bank, alloc_mem, ctx );
5396 0 : fd_solana_accounts_db_fields_decode_inner( &self->accounts_db, alloc_mem, ctx );
5397 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
5398 0 : if( ctx->data == ctx->dataend ) return;
5399 0 : {
5400 0 : uchar o;
5401 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
5402 0 : if( o ) {
5403 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN );
5404 0 : self->bank_incremental_snapshot_persistence = *alloc_mem;
5405 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_bank_incremental_snapshot_persistence_t);
5406 0 : fd_bank_incremental_snapshot_persistence_new( self->bank_incremental_snapshot_persistence );
5407 0 : fd_bank_incremental_snapshot_persistence_decode_inner( self->bank_incremental_snapshot_persistence, alloc_mem, ctx );
5408 0 : } else {
5409 0 : self->bank_incremental_snapshot_persistence = NULL;
5410 0 : }
5411 0 : }
5412 0 : if( ctx->data == ctx->dataend ) return;
5413 0 : {
5414 0 : uchar o;
5415 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
5416 0 : if( o ) {
5417 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
5418 0 : self->epoch_account_hash = *alloc_mem;
5419 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_hash_t);
5420 0 : fd_hash_new( self->epoch_account_hash );
5421 0 : fd_hash_decode_inner( self->epoch_account_hash, alloc_mem, ctx );
5422 0 : } else {
5423 0 : self->epoch_account_hash = NULL;
5424 0 : }
5425 0 : }
5426 0 : if( ctx->data == ctx->dataend ) return;
5427 0 : fd_bincode_uint64_decode_unsafe( &self->versioned_epoch_stakes_len, ctx );
5428 0 : if( self->versioned_epoch_stakes_len ) {
5429 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN );
5430 0 : self->versioned_epoch_stakes = *alloc_mem;
5431 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_versioned_epoch_stakes_pair_t)*self->versioned_epoch_stakes_len;
5432 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
5433 0 : fd_versioned_epoch_stakes_pair_new( self->versioned_epoch_stakes + i );
5434 0 : fd_versioned_epoch_stakes_pair_decode_inner( self->versioned_epoch_stakes + i, alloc_mem, ctx );
5435 0 : }
5436 0 : } else
5437 0 : self->versioned_epoch_stakes = NULL;
5438 0 : if( ctx->data == ctx->dataend ) return;
5439 0 : {
5440 0 : uchar o;
5441 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
5442 0 : if( o ) {
5443 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_SLOT_LTHASH_ALIGN );
5444 0 : self->lthash = *alloc_mem;
5445 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_slot_lthash_t);
5446 0 : fd_slot_lthash_new( self->lthash );
5447 0 : fd_slot_lthash_decode_inner( self->lthash, alloc_mem, ctx );
5448 0 : } else {
5449 0 : self->lthash = NULL;
5450 0 : }
5451 0 : }
5452 0 : }
5453 0 : void * fd_solana_manifest_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5454 0 : fd_solana_manifest_t * self = (fd_solana_manifest_t *)mem;
5455 0 : fd_solana_manifest_new( self );
5456 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_manifest_t);
5457 0 : void * * alloc_mem = &alloc_region;
5458 0 : fd_solana_manifest_decode_inner( mem, alloc_mem, ctx );
5459 0 : return self;
5460 0 : }
5461 0 : static void fd_solana_manifest_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5462 0 : fd_solana_manifest_global_t * self = (fd_solana_manifest_global_t *)struct_mem;
5463 0 : fd_versioned_bank_decode_inner_global( &self->bank, alloc_mem, ctx );
5464 0 : fd_solana_accounts_db_fields_decode_inner_global( &self->accounts_db, alloc_mem, ctx );
5465 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
5466 0 : if( ctx->data == ctx->dataend ) return;
5467 0 : {
5468 0 : uchar o;
5469 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
5470 0 : if( o ) {
5471 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_BANK_INCREMENTAL_SNAPSHOT_PERSISTENCE_ALIGN );
5472 0 : self->bank_incremental_snapshot_persistence_offset = (ulong)*alloc_mem - (ulong)struct_mem;
5473 0 : fd_bank_incremental_snapshot_persistence_new( *alloc_mem );
5474 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_bank_incremental_snapshot_persistence_t);
5475 0 : fd_bank_incremental_snapshot_persistence_decode_inner( (uchar*)self + self->bank_incremental_snapshot_persistence_offset, alloc_mem, ctx );
5476 0 : } else {
5477 0 : self->bank_incremental_snapshot_persistence_offset = 0UL;
5478 0 : }
5479 0 : }
5480 0 : if( ctx->data == ctx->dataend ) return;
5481 0 : {
5482 0 : uchar o;
5483 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
5484 0 : if( o ) {
5485 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_HASH_ALIGN );
5486 0 : self->epoch_account_hash_offset = (ulong)*alloc_mem - (ulong)struct_mem;
5487 0 : fd_hash_new( *alloc_mem );
5488 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_hash_t);
5489 0 : fd_hash_decode_inner( (uchar*)self + self->epoch_account_hash_offset, alloc_mem, ctx );
5490 0 : } else {
5491 0 : self->epoch_account_hash_offset = 0UL;
5492 0 : }
5493 0 : }
5494 0 : if( ctx->data == ctx->dataend ) return;
5495 0 : fd_bincode_uint64_decode_unsafe( &self->versioned_epoch_stakes_len, ctx );
5496 0 : if( self->versioned_epoch_stakes_len ) {
5497 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_VERSIONED_EPOCH_STAKES_PAIR_ALIGN );
5498 0 : self->versioned_epoch_stakes_offset = (ulong)*alloc_mem - (ulong)struct_mem;
5499 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
5500 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_versioned_epoch_stakes_pair_t)*self->versioned_epoch_stakes_len;
5501 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ ) {
5502 0 : fd_versioned_epoch_stakes_pair_new( (fd_versioned_epoch_stakes_pair_t *)fd_type_pun(cur_mem + sizeof(fd_versioned_epoch_stakes_pair_t) * i) );
5503 0 : fd_versioned_epoch_stakes_pair_decode_inner_global( cur_mem + sizeof(fd_versioned_epoch_stakes_pair_t) * i, alloc_mem, ctx );
5504 0 : }
5505 0 : } else {
5506 0 : self->versioned_epoch_stakes_offset = 0UL;
5507 0 : }
5508 0 : if( ctx->data == ctx->dataend ) return;
5509 0 : {
5510 0 : uchar o;
5511 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
5512 0 : if( o ) {
5513 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_SLOT_LTHASH_ALIGN );
5514 0 : self->lthash_offset = (ulong)*alloc_mem - (ulong)struct_mem;
5515 0 : fd_slot_lthash_new( *alloc_mem );
5516 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_slot_lthash_t);
5517 0 : fd_slot_lthash_decode_inner( (uchar*)self + self->lthash_offset, alloc_mem, ctx );
5518 0 : } else {
5519 0 : self->lthash_offset = 0UL;
5520 0 : }
5521 0 : }
5522 0 : }
5523 0 : void * fd_solana_manifest_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5524 0 : fd_solana_manifest_global_t * self = (fd_solana_manifest_global_t *)mem;
5525 0 : fd_solana_manifest_new( (fd_solana_manifest_t *)self );
5526 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_manifest_global_t);
5527 0 : void * * alloc_mem = &alloc_region;
5528 0 : fd_solana_manifest_decode_inner_global( mem, alloc_mem, ctx );
5529 0 : return self;
5530 0 : }
5531 0 : void fd_solana_manifest_new(fd_solana_manifest_t * self) {
5532 0 : fd_memset( self, 0, sizeof(fd_solana_manifest_t) );
5533 0 : fd_versioned_bank_new( &self->bank );
5534 0 : fd_solana_accounts_db_fields_new( &self->accounts_db );
5535 0 : }
5536 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, uint varint ) {
5537 0 : (void) varint;
5538 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_manifest", level++, 0 );
5539 0 : fd_versioned_bank_walk( w, &self->bank, fun, "bank", level, 0 );
5540 0 : fd_solana_accounts_db_fields_walk( w, &self->accounts_db, fun, "accounts_db", level, 0 );
5541 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5542 0 : if( !self->bank_incremental_snapshot_persistence ) {
5543 0 : fun( w, NULL, "bank_incremental_snapshot_persistence", FD_FLAMENCO_TYPE_NULL, "bank_incremental_snapshot_persistence", level, 0 );
5544 0 : } else {
5545 0 : fd_bank_incremental_snapshot_persistence_walk( w, self->bank_incremental_snapshot_persistence, fun, "bank_incremental_snapshot_persistence", level, 0 );
5546 0 : }
5547 0 : if( !self->epoch_account_hash ) {
5548 0 : fun( w, NULL, "epoch_account_hash", FD_FLAMENCO_TYPE_NULL, "hash", level, 0 );
5549 0 : } else {
5550 0 : fd_hash_walk( w, self->epoch_account_hash, fun, "epoch_account_hash", level, 0 );
5551 0 : }
5552 0 : if( self->versioned_epoch_stakes_len ) {
5553 0 : fun( w, NULL, "versioned_epoch_stakes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
5554 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
5555 0 : fd_versioned_epoch_stakes_pair_walk(w, self->versioned_epoch_stakes + i, fun, "versioned_epoch_stakes_pair", level, 0 );
5556 0 : fun( w, NULL, "versioned_epoch_stakes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
5557 0 : }
5558 0 : if( !self->lthash ) {
5559 0 : fun( w, NULL, "lthash", FD_FLAMENCO_TYPE_NULL, "slot_lthash", level, 0 );
5560 0 : } else {
5561 0 : fd_slot_lthash_walk( w, self->lthash, fun, "lthash", level, 0 );
5562 0 : }
5563 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_manifest", level--, 0 );
5564 0 : }
5565 0 : ulong fd_solana_manifest_size( fd_solana_manifest_t const * self ) {
5566 0 : ulong size = 0;
5567 0 : size += fd_versioned_bank_size( &self->bank );
5568 0 : size += fd_solana_accounts_db_fields_size( &self->accounts_db );
5569 0 : size += sizeof(ulong);
5570 0 : size += sizeof(char);
5571 0 : if( NULL != self->bank_incremental_snapshot_persistence ) {
5572 0 : size += fd_bank_incremental_snapshot_persistence_size( self->bank_incremental_snapshot_persistence );
5573 0 : }
5574 0 : size += sizeof(char);
5575 0 : if( NULL != self->epoch_account_hash ) {
5576 0 : size += fd_hash_size( self->epoch_account_hash );
5577 0 : }
5578 0 : do {
5579 0 : size += sizeof(ulong);
5580 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
5581 0 : size += fd_versioned_epoch_stakes_pair_size( self->versioned_epoch_stakes + i );
5582 0 : } while(0);
5583 0 : size += sizeof(char);
5584 0 : if( NULL != self->lthash ) {
5585 0 : size += fd_slot_lthash_size( self->lthash );
5586 0 : }
5587 0 : return size;
5588 0 : }
5589 :
5590 0 : ulong fd_solana_manifest_size_global( fd_solana_manifest_global_t const * self ) {
5591 0 : ulong size = 0;
5592 0 : size += fd_versioned_bank_size_global( &self->bank );
5593 0 : size += fd_solana_accounts_db_fields_size_global( &self->accounts_db );
5594 0 : size += sizeof(ulong);
5595 0 : size += sizeof(char);
5596 0 : fd_bank_incremental_snapshot_persistence_t * bank_incremental_snapshot_persistence = (fd_bank_incremental_snapshot_persistence_t *)fd_type_pun( (uchar *)self + self->bank_incremental_snapshot_persistence_offset );
5597 0 : if( NULL != bank_incremental_snapshot_persistence ) {
5598 0 : size += fd_bank_incremental_snapshot_persistence_size( bank_incremental_snapshot_persistence );
5599 0 : }
5600 0 : size += sizeof(char);
5601 0 : fd_hash_t * epoch_account_hash = (fd_hash_t *)fd_type_pun( (uchar *)self + self->epoch_account_hash_offset );
5602 0 : if( NULL != epoch_account_hash ) {
5603 0 : size += fd_hash_size( epoch_account_hash );
5604 0 : }
5605 0 : do {
5606 0 : size += sizeof(ulong);
5607 0 : fd_versioned_epoch_stakes_pair_global_t * versioned_epoch_stakes = self->versioned_epoch_stakes_offset ? (fd_versioned_epoch_stakes_pair_global_t *)fd_type_pun( (uchar *)self + self->versioned_epoch_stakes_offset ) : NULL;
5608 0 : for( ulong i=0; i < self->versioned_epoch_stakes_len; i++ )
5609 0 : size += fd_versioned_epoch_stakes_pair_size_global( versioned_epoch_stakes + i );
5610 0 : } while(0);
5611 0 : size += sizeof(char);
5612 0 : fd_slot_lthash_t * lthash = (fd_slot_lthash_t *)fd_type_pun( (uchar *)self + self->lthash_offset );
5613 0 : if( NULL != lthash ) {
5614 0 : size += fd_slot_lthash_size( lthash );
5615 0 : }
5616 0 : return size;
5617 0 : }
5618 :
5619 9 : int fd_rust_duration_encode( fd_rust_duration_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5620 9 : int err;
5621 9 : err = fd_bincode_uint64_encode( self->seconds, ctx );
5622 9 : if( FD_UNLIKELY( err ) ) return err;
5623 9 : err = fd_bincode_uint32_encode( self->nanoseconds, ctx );
5624 9 : if( FD_UNLIKELY( err ) ) return err;
5625 9 : return FD_BINCODE_SUCCESS;
5626 9 : }
5627 0 : static inline int fd_rust_duration_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5628 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5629 0 : int err = fd_rust_duration_footprint_validator( ctx );
5630 0 : if( FD_UNLIKELY( err != FD_BINCODE_SUCCESS ) )
5631 0 : return err;
5632 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
5633 0 : return 0;
5634 0 : }
5635 0 : static void fd_rust_duration_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5636 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)struct_mem;
5637 0 : fd_bincode_uint64_decode_unsafe( &self->seconds, ctx );
5638 0 : fd_bincode_uint32_decode_unsafe( &self->nanoseconds, ctx );
5639 0 : fd_rust_duration_normalize( self );
5640 0 : }
5641 0 : void * fd_rust_duration_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5642 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)mem;
5643 0 : fd_rust_duration_new( self );
5644 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rust_duration_t);
5645 0 : void * * alloc_mem = &alloc_region;
5646 0 : fd_rust_duration_decode_inner( mem, alloc_mem, ctx );
5647 0 : return self;
5648 0 : }
5649 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, uint varint ) {
5650 0 : (void) varint;
5651 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rust_duration", level++, 0 );
5652 0 : fun( w, &self->seconds, "seconds", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5653 0 : fun( w, &self->nanoseconds, "nanoseconds", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
5654 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rust_duration", level--, 0 );
5655 0 : }
5656 9 : int fd_poh_config_encode( fd_poh_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5657 9 : int err;
5658 9 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
5659 9 : if( FD_UNLIKELY( err ) ) return err;
5660 9 : if( self->target_tick_count != NULL ) {
5661 0 : err = fd_bincode_bool_encode( 1, ctx );
5662 0 : if( FD_UNLIKELY( err ) ) return err;
5663 0 : err = fd_bincode_uint64_encode( self->target_tick_count[0], ctx );
5664 0 : if( FD_UNLIKELY( err ) ) return err;
5665 9 : } else {
5666 9 : err = fd_bincode_bool_encode( 0, ctx );
5667 9 : if( FD_UNLIKELY( err ) ) return err;
5668 9 : }
5669 9 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
5670 9 : if( FD_UNLIKELY( err ) ) return err;
5671 9 : if( self->has_hashes_per_tick ) {
5672 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
5673 0 : if( FD_UNLIKELY( err ) ) return err;
5674 0 : }
5675 9 : return FD_BINCODE_SUCCESS;
5676 9 : }
5677 0 : static int fd_poh_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5678 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5679 0 : int err = 0;
5680 0 : err = fd_rust_duration_decode_footprint_inner( ctx, total_sz );
5681 0 : if( FD_UNLIKELY( err ) ) return err;
5682 0 : {
5683 0 : uchar o;
5684 0 : err = fd_bincode_bool_decode( &o, ctx );
5685 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5686 0 : if( o ) {
5687 0 : *total_sz += 8UL + sizeof(ulong);
5688 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5689 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5690 0 : }
5691 0 : }
5692 0 : {
5693 0 : uchar o;
5694 0 : err = fd_bincode_bool_decode( &o, ctx );
5695 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5696 0 : if( o ) {
5697 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5698 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5699 0 : }
5700 0 : }
5701 0 : return 0;
5702 0 : }
5703 0 : int fd_poh_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5704 0 : *total_sz += sizeof(fd_poh_config_t);
5705 0 : void const * start_data = ctx->data;
5706 0 : int err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
5707 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5708 0 : ctx->data = start_data;
5709 0 : return err;
5710 0 : }
5711 0 : static void fd_poh_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5712 0 : fd_poh_config_t * self = (fd_poh_config_t *)struct_mem;
5713 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
5714 0 : {
5715 0 : uchar o;
5716 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
5717 0 : if( o ) {
5718 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
5719 0 : self->target_tick_count = *alloc_mem;
5720 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
5721 0 : fd_bincode_uint64_decode_unsafe( self->target_tick_count, ctx );
5722 0 : } else {
5723 0 : self->target_tick_count = NULL;
5724 0 : }
5725 0 : }
5726 0 : {
5727 0 : uchar o;
5728 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
5729 0 : self->has_hashes_per_tick = !!o;
5730 0 : if( o ) {
5731 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
5732 0 : }
5733 0 : }
5734 0 : }
5735 0 : void * fd_poh_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5736 0 : fd_poh_config_t * self = (fd_poh_config_t *)mem;
5737 0 : fd_poh_config_new( self );
5738 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_t);
5739 0 : void * * alloc_mem = &alloc_region;
5740 0 : fd_poh_config_decode_inner( mem, alloc_mem, ctx );
5741 0 : return self;
5742 0 : }
5743 12 : void fd_poh_config_new(fd_poh_config_t * self) {
5744 12 : fd_memset( self, 0, sizeof(fd_poh_config_t) );
5745 12 : fd_rust_duration_new( &self->target_tick_duration );
5746 12 : }
5747 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, uint varint ) {
5748 0 : (void) varint;
5749 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_poh_config", level++, 0 );
5750 0 : fd_rust_duration_walk( w, &self->target_tick_duration, fun, "target_tick_duration", level, 0 );
5751 0 : if( !self->target_tick_count ) {
5752 0 : fun( w, NULL, "target_tick_count", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
5753 0 : } else {
5754 0 : fun( w, self->target_tick_count, "target_tick_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5755 0 : }
5756 0 : if( !self->has_hashes_per_tick ) {
5757 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
5758 0 : } else {
5759 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5760 0 : }
5761 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_poh_config", level--, 0 );
5762 0 : }
5763 0 : ulong fd_poh_config_size( fd_poh_config_t const * self ) {
5764 0 : ulong size = 0;
5765 0 : size += fd_rust_duration_size( &self->target_tick_duration );
5766 0 : size += sizeof(char);
5767 0 : if( NULL != self->target_tick_count ) {
5768 0 : size += sizeof(ulong);
5769 0 : }
5770 0 : size += sizeof(char);
5771 0 : if( self->has_hashes_per_tick ) {
5772 0 : size += sizeof(ulong);
5773 0 : }
5774 0 : return size;
5775 0 : }
5776 :
5777 0 : int fd_string_pubkey_pair_encode( fd_string_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5778 0 : int err;
5779 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
5780 0 : if( FD_UNLIKELY(err) ) return err;
5781 0 : if( self->string_len ) {
5782 0 : err = fd_bincode_bytes_encode( self->string, self->string_len, ctx );
5783 0 : if( FD_UNLIKELY( err ) ) return err;
5784 0 : }
5785 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
5786 0 : if( FD_UNLIKELY( err ) ) return err;
5787 0 : return FD_BINCODE_SUCCESS;
5788 0 : }
5789 0 : static int fd_string_pubkey_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5790 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5791 0 : int err = 0;
5792 0 : ulong string_len;
5793 0 : err = fd_bincode_uint64_decode( &string_len, ctx );
5794 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5795 0 : *total_sz += string_len;
5796 0 : if( string_len ) {
5797 0 : err = fd_bincode_bytes_decode_footprint( string_len, ctx );
5798 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5799 0 : err = !fd_utf8_verify( (char const *) ctx->data - string_len, string_len );
5800 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5801 0 : }
5802 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5803 0 : if( FD_UNLIKELY( err ) ) return err;
5804 0 : return 0;
5805 0 : }
5806 0 : int fd_string_pubkey_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5807 0 : *total_sz += sizeof(fd_string_pubkey_pair_t);
5808 0 : void const * start_data = ctx->data;
5809 0 : int err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
5810 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5811 0 : ctx->data = start_data;
5812 0 : return err;
5813 0 : }
5814 0 : static void fd_string_pubkey_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5815 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)struct_mem;
5816 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
5817 0 : if( self->string_len ) {
5818 0 : self->string = *alloc_mem;
5819 0 : fd_bincode_bytes_decode_unsafe( self->string, self->string_len, ctx );
5820 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
5821 0 : } else
5822 0 : self->string = NULL;
5823 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
5824 0 : }
5825 0 : void * fd_string_pubkey_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5826 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)mem;
5827 0 : fd_string_pubkey_pair_new( self );
5828 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_t);
5829 0 : void * * alloc_mem = &alloc_region;
5830 0 : fd_string_pubkey_pair_decode_inner( mem, alloc_mem, ctx );
5831 0 : return self;
5832 0 : }
5833 0 : void fd_string_pubkey_pair_new(fd_string_pubkey_pair_t * self) {
5834 0 : fd_memset( self, 0, sizeof(fd_string_pubkey_pair_t) );
5835 0 : fd_pubkey_new( &self->pubkey );
5836 0 : }
5837 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, uint varint ) {
5838 0 : (void) varint;
5839 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_string_pubkey_pair", level++, 0 );
5840 0 : if( self->string_len ) {
5841 0 : fun( w, NULL, "string", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
5842 0 : for( ulong i=0; i < self->string_len; i++ )
5843 0 : fun( w, self->string + i, "string", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5844 0 : fun( w, NULL, "string", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
5845 0 : }
5846 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
5847 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_string_pubkey_pair", level--, 0 );
5848 0 : }
5849 0 : ulong fd_string_pubkey_pair_size( fd_string_pubkey_pair_t const * self ) {
5850 0 : ulong size = 0;
5851 0 : do {
5852 0 : size += sizeof(ulong);
5853 0 : size += self->string_len;
5854 0 : } while(0);
5855 0 : size += fd_pubkey_size( &self->pubkey );
5856 0 : return size;
5857 0 : }
5858 :
5859 144 : int fd_pubkey_account_pair_encode( fd_pubkey_account_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5860 144 : int err;
5861 144 : err = fd_pubkey_encode( &self->key, ctx );
5862 144 : if( FD_UNLIKELY( err ) ) return err;
5863 144 : err = fd_solana_account_encode( &self->account, ctx );
5864 144 : if( FD_UNLIKELY( err ) ) return err;
5865 144 : return FD_BINCODE_SUCCESS;
5866 144 : }
5867 0 : static int fd_pubkey_account_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5868 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5869 0 : int err = 0;
5870 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5871 0 : if( FD_UNLIKELY( err ) ) return err;
5872 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
5873 0 : if( FD_UNLIKELY( err ) ) return err;
5874 0 : return 0;
5875 0 : }
5876 0 : int fd_pubkey_account_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5877 0 : *total_sz += sizeof(fd_pubkey_account_pair_t);
5878 0 : void const * start_data = ctx->data;
5879 0 : int err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
5880 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5881 0 : ctx->data = start_data;
5882 0 : return err;
5883 0 : }
5884 0 : static void fd_pubkey_account_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5885 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)struct_mem;
5886 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
5887 0 : fd_solana_account_decode_inner( &self->account, alloc_mem, ctx );
5888 0 : }
5889 0 : void * fd_pubkey_account_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5890 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)mem;
5891 0 : fd_pubkey_account_pair_new( self );
5892 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_t);
5893 0 : void * * alloc_mem = &alloc_region;
5894 0 : fd_pubkey_account_pair_decode_inner( mem, alloc_mem, ctx );
5895 0 : return self;
5896 0 : }
5897 0 : void fd_pubkey_account_pair_new(fd_pubkey_account_pair_t * self) {
5898 0 : fd_memset( self, 0, sizeof(fd_pubkey_account_pair_t) );
5899 0 : fd_pubkey_new( &self->key );
5900 0 : fd_solana_account_new( &self->account );
5901 0 : }
5902 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, uint varint ) {
5903 0 : (void) varint;
5904 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_account_pair", level++, 0 );
5905 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
5906 0 : fd_solana_account_walk( w, &self->account, fun, "account", level, 0 );
5907 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_account_pair", level--, 0 );
5908 0 : }
5909 0 : ulong fd_pubkey_account_pair_size( fd_pubkey_account_pair_t const * self ) {
5910 0 : ulong size = 0;
5911 0 : size += fd_pubkey_size( &self->key );
5912 0 : size += fd_solana_account_size( &self->account );
5913 0 : return size;
5914 0 : }
5915 :
5916 12 : int fd_genesis_solana_encode( fd_genesis_solana_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5917 12 : int err;
5918 12 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
5919 12 : if( FD_UNLIKELY( err ) ) return err;
5920 9 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
5921 9 : if( FD_UNLIKELY(err) ) return err;
5922 9 : if( self->accounts_len ) {
5923 153 : for( ulong i=0; i < self->accounts_len; i++ ) {
5924 144 : err = fd_pubkey_account_pair_encode( self->accounts + i, ctx );
5925 144 : if( FD_UNLIKELY( err ) ) return err;
5926 144 : }
5927 9 : }
5928 9 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
5929 9 : if( FD_UNLIKELY(err) ) return err;
5930 9 : if( self->native_instruction_processors_len ) {
5931 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
5932 0 : err = fd_string_pubkey_pair_encode( self->native_instruction_processors + i, ctx );
5933 0 : if( FD_UNLIKELY( err ) ) return err;
5934 0 : }
5935 0 : }
5936 9 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
5937 9 : if( FD_UNLIKELY(err) ) return err;
5938 9 : if( self->rewards_pools_len ) {
5939 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
5940 0 : err = fd_pubkey_account_pair_encode( self->rewards_pools + i, ctx );
5941 0 : if( FD_UNLIKELY( err ) ) return err;
5942 0 : }
5943 0 : }
5944 9 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
5945 9 : if( FD_UNLIKELY( err ) ) return err;
5946 9 : err = fd_bincode_uint64_encode( self->unused, ctx );
5947 9 : if( FD_UNLIKELY( err ) ) return err;
5948 9 : err = fd_poh_config_encode( &self->poh_config, ctx );
5949 9 : if( FD_UNLIKELY( err ) ) return err;
5950 9 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
5951 9 : if( FD_UNLIKELY( err ) ) return err;
5952 9 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
5953 9 : if( FD_UNLIKELY( err ) ) return err;
5954 9 : err = fd_rent_encode( &self->rent, ctx );
5955 9 : if( FD_UNLIKELY( err ) ) return err;
5956 9 : err = fd_inflation_encode( &self->inflation, ctx );
5957 9 : if( FD_UNLIKELY( err ) ) return err;
5958 9 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
5959 9 : if( FD_UNLIKELY( err ) ) return err;
5960 9 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
5961 9 : if( FD_UNLIKELY( err ) ) return err;
5962 9 : return FD_BINCODE_SUCCESS;
5963 9 : }
5964 0 : static int fd_genesis_solana_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5965 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5966 0 : int err = 0;
5967 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5968 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5969 0 : ulong accounts_len;
5970 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
5971 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5972 0 : if( accounts_len ) {
5973 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*accounts_len;
5974 0 : for( ulong i=0; i < accounts_len; i++ ) {
5975 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
5976 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5977 0 : }
5978 0 : }
5979 0 : ulong native_instruction_processors_len;
5980 0 : err = fd_bincode_uint64_decode( &native_instruction_processors_len, ctx );
5981 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5982 0 : if( native_instruction_processors_len ) {
5983 0 : *total_sz += FD_STRING_PUBKEY_PAIR_ALIGN + sizeof(fd_string_pubkey_pair_t)*native_instruction_processors_len;
5984 0 : for( ulong i=0; i < native_instruction_processors_len; i++ ) {
5985 0 : err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
5986 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5987 0 : }
5988 0 : }
5989 0 : ulong rewards_pools_len;
5990 0 : err = fd_bincode_uint64_decode( &rewards_pools_len, ctx );
5991 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5992 0 : if( rewards_pools_len ) {
5993 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*rewards_pools_len;
5994 0 : for( ulong i=0; i < rewards_pools_len; i++ ) {
5995 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
5996 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5997 0 : }
5998 0 : }
5999 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6000 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6001 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6002 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6003 0 : err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
6004 0 : if( FD_UNLIKELY( err ) ) return err;
6005 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6006 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6007 0 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
6008 0 : if( FD_UNLIKELY( err ) ) return err;
6009 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
6010 0 : if( FD_UNLIKELY( err ) ) return err;
6011 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
6012 0 : if( FD_UNLIKELY( err ) ) return err;
6013 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
6014 0 : if( FD_UNLIKELY( err ) ) return err;
6015 0 : err = fd_bincode_uint32_decode_footprint( ctx );
6016 0 : if( FD_UNLIKELY( err ) ) return err;
6017 0 : return 0;
6018 0 : }
6019 0 : int fd_genesis_solana_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6020 0 : *total_sz += sizeof(fd_genesis_solana_t);
6021 0 : void const * start_data = ctx->data;
6022 0 : int err = fd_genesis_solana_decode_footprint_inner( ctx, total_sz );
6023 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6024 0 : ctx->data = start_data;
6025 0 : return err;
6026 0 : }
6027 0 : static void fd_genesis_solana_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6028 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)struct_mem;
6029 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
6030 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
6031 0 : if( self->accounts_len ) {
6032 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
6033 0 : self->accounts = *alloc_mem;
6034 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
6035 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
6036 0 : fd_pubkey_account_pair_new( self->accounts + i );
6037 0 : fd_pubkey_account_pair_decode_inner( self->accounts + i, alloc_mem, ctx );
6038 0 : }
6039 0 : } else
6040 0 : self->accounts = NULL;
6041 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
6042 0 : if( self->native_instruction_processors_len ) {
6043 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
6044 0 : self->native_instruction_processors = *alloc_mem;
6045 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
6046 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
6047 0 : fd_string_pubkey_pair_new( self->native_instruction_processors + i );
6048 0 : fd_string_pubkey_pair_decode_inner( self->native_instruction_processors + i, alloc_mem, ctx );
6049 0 : }
6050 0 : } else
6051 0 : self->native_instruction_processors = NULL;
6052 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
6053 0 : if( self->rewards_pools_len ) {
6054 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
6055 0 : self->rewards_pools = *alloc_mem;
6056 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
6057 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
6058 0 : fd_pubkey_account_pair_new( self->rewards_pools + i );
6059 0 : fd_pubkey_account_pair_decode_inner( self->rewards_pools + i, alloc_mem, ctx );
6060 0 : }
6061 0 : } else
6062 0 : self->rewards_pools = NULL;
6063 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
6064 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
6065 0 : fd_poh_config_decode_inner( &self->poh_config, alloc_mem, ctx );
6066 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
6067 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
6068 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
6069 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
6070 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
6071 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
6072 0 : }
6073 0 : void * fd_genesis_solana_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6074 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)mem;
6075 0 : fd_genesis_solana_new( self );
6076 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_t);
6077 0 : void * * alloc_mem = &alloc_region;
6078 0 : fd_genesis_solana_decode_inner( mem, alloc_mem, ctx );
6079 0 : return self;
6080 0 : }
6081 12 : void fd_genesis_solana_new(fd_genesis_solana_t * self) {
6082 12 : fd_memset( self, 0, sizeof(fd_genesis_solana_t) );
6083 12 : fd_poh_config_new( &self->poh_config );
6084 12 : fd_fee_rate_governor_new( &self->fee_rate_governor );
6085 12 : fd_rent_new( &self->rent );
6086 12 : fd_inflation_new( &self->inflation );
6087 12 : fd_epoch_schedule_new( &self->epoch_schedule );
6088 12 : }
6089 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, uint varint ) {
6090 0 : (void) varint;
6091 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_genesis_solana", level++, 0 );
6092 0 : fun( w, &self->creation_time, "creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6093 0 : if( self->accounts_len ) {
6094 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
6095 0 : for( ulong i=0; i < self->accounts_len; i++ )
6096 0 : fd_pubkey_account_pair_walk(w, self->accounts + i, fun, "pubkey_account_pair", level, 0 );
6097 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
6098 0 : }
6099 0 : if( self->native_instruction_processors_len ) {
6100 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
6101 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
6102 0 : fd_string_pubkey_pair_walk(w, self->native_instruction_processors + i, fun, "string_pubkey_pair", level, 0 );
6103 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
6104 0 : }
6105 0 : if( self->rewards_pools_len ) {
6106 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
6107 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
6108 0 : fd_pubkey_account_pair_walk(w, self->rewards_pools + i, fun, "pubkey_account_pair", level, 0 );
6109 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
6110 0 : }
6111 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6112 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6113 0 : fd_poh_config_walk( w, &self->poh_config, fun, "poh_config", level, 0 );
6114 0 : fun( w, &self->__backwards_compat_with_v0_23, "__backwards_compat_with_v0_23", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6115 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level, 0 );
6116 0 : fd_rent_walk( w, &self->rent, fun, "rent", level, 0 );
6117 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level, 0 );
6118 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level, 0 );
6119 0 : fun( w, &self->cluster_type, "cluster_type", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
6120 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_genesis_solana", level--, 0 );
6121 0 : }
6122 0 : ulong fd_genesis_solana_size( fd_genesis_solana_t const * self ) {
6123 0 : ulong size = 0;
6124 0 : size += sizeof(ulong);
6125 0 : do {
6126 0 : size += sizeof(ulong);
6127 0 : for( ulong i=0; i < self->accounts_len; i++ )
6128 0 : size += fd_pubkey_account_pair_size( self->accounts + i );
6129 0 : } while(0);
6130 0 : do {
6131 0 : size += sizeof(ulong);
6132 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
6133 0 : size += fd_string_pubkey_pair_size( self->native_instruction_processors + i );
6134 0 : } while(0);
6135 0 : do {
6136 0 : size += sizeof(ulong);
6137 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
6138 0 : size += fd_pubkey_account_pair_size( self->rewards_pools + i );
6139 0 : } while(0);
6140 0 : size += sizeof(ulong);
6141 0 : size += sizeof(ulong);
6142 0 : size += fd_poh_config_size( &self->poh_config );
6143 0 : size += sizeof(ulong);
6144 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
6145 0 : size += fd_rent_size( &self->rent );
6146 0 : size += fd_inflation_size( &self->inflation );
6147 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
6148 0 : size += sizeof(uint);
6149 0 : return size;
6150 0 : }
6151 :
6152 0 : int fd_sol_sysvar_clock_encode( fd_sol_sysvar_clock_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6153 0 : int err;
6154 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
6155 0 : if( FD_UNLIKELY( err ) ) return err;
6156 0 : err = fd_bincode_uint64_encode( (ulong)self->epoch_start_timestamp, ctx );
6157 0 : if( FD_UNLIKELY( err ) ) return err;
6158 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
6159 0 : if( FD_UNLIKELY( err ) ) return err;
6160 0 : err = fd_bincode_uint64_encode( self->leader_schedule_epoch, ctx );
6161 0 : if( FD_UNLIKELY( err ) ) return err;
6162 0 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
6163 0 : if( FD_UNLIKELY( err ) ) return err;
6164 0 : return FD_BINCODE_SUCCESS;
6165 0 : }
6166 0 : static inline int fd_sol_sysvar_clock_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6167 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6168 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
6169 0 : return 0;
6170 0 : }
6171 3 : static void fd_sol_sysvar_clock_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6172 3 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)struct_mem;
6173 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
6174 3 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
6175 3 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6176 3 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
6177 3 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
6178 3 : }
6179 3 : void * fd_sol_sysvar_clock_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6180 3 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)mem;
6181 3 : fd_sol_sysvar_clock_new( self );
6182 3 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_clock_t);
6183 3 : void * * alloc_mem = &alloc_region;
6184 3 : fd_sol_sysvar_clock_decode_inner( mem, alloc_mem, ctx );
6185 3 : return self;
6186 3 : }
6187 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, uint varint ) {
6188 0 : (void) varint;
6189 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_clock", level++, 0 );
6190 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6191 0 : fun( w, &self->epoch_start_timestamp, "epoch_start_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
6192 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6193 0 : fun( w, &self->leader_schedule_epoch, "leader_schedule_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6194 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
6195 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_clock", level--, 0 );
6196 0 : }
6197 0 : int fd_sol_sysvar_last_restart_slot_encode( fd_sol_sysvar_last_restart_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6198 0 : int err;
6199 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
6200 0 : if( FD_UNLIKELY( err ) ) return err;
6201 0 : return FD_BINCODE_SUCCESS;
6202 0 : }
6203 0 : static inline int fd_sol_sysvar_last_restart_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6204 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6205 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
6206 0 : return 0;
6207 0 : }
6208 0 : static void fd_sol_sysvar_last_restart_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6209 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)struct_mem;
6210 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
6211 0 : }
6212 0 : void * fd_sol_sysvar_last_restart_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6213 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)mem;
6214 0 : fd_sol_sysvar_last_restart_slot_new( self );
6215 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_last_restart_slot_t);
6216 0 : void * * alloc_mem = &alloc_region;
6217 0 : fd_sol_sysvar_last_restart_slot_decode_inner( mem, alloc_mem, ctx );
6218 0 : return self;
6219 0 : }
6220 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, uint varint ) {
6221 0 : (void) varint;
6222 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_last_restart_slot", level++, 0 );
6223 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6224 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_last_restart_slot", level--, 0 );
6225 0 : }
6226 96 : int fd_vote_lockout_encode( fd_vote_lockout_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6227 96 : int err;
6228 96 : err = fd_bincode_uint64_encode( self->slot, ctx );
6229 96 : if( FD_UNLIKELY( err ) ) return err;
6230 96 : err = fd_bincode_uint32_encode( self->confirmation_count, ctx );
6231 96 : if( FD_UNLIKELY( err ) ) return err;
6232 96 : return FD_BINCODE_SUCCESS;
6233 96 : }
6234 0 : static inline int fd_vote_lockout_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6235 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6236 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
6237 0 : return 0;
6238 0 : }
6239 192 : static void fd_vote_lockout_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6240 192 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)struct_mem;
6241 192 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
6242 192 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
6243 192 : }
6244 0 : void * fd_vote_lockout_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6245 0 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)mem;
6246 0 : fd_vote_lockout_new( self );
6247 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_lockout_t);
6248 0 : void * * alloc_mem = &alloc_region;
6249 0 : fd_vote_lockout_decode_inner( mem, alloc_mem, ctx );
6250 0 : return self;
6251 0 : }
6252 96 : void fd_vote_lockout_walk( void * w, fd_vote_lockout_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6253 96 : (void) varint;
6254 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_lockout", level++, 0 );
6255 96 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6256 96 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
6257 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_lockout", level--, 0 );
6258 96 : }
6259 0 : int fd_lockout_offset_encode( fd_lockout_offset_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6260 0 : int err;
6261 0 : err = fd_bincode_varint_encode( self->offset, ctx );
6262 0 : if( FD_UNLIKELY( err ) ) return err;
6263 0 : err = fd_bincode_uint8_encode( (uchar)(self->confirmation_count), ctx );
6264 0 : if( FD_UNLIKELY( err ) ) return err;
6265 0 : return FD_BINCODE_SUCCESS;
6266 0 : }
6267 0 : static int fd_lockout_offset_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6268 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6269 0 : int err = 0;
6270 0 : err = fd_bincode_varint_decode_footprint( ctx );
6271 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6272 0 : err = fd_bincode_uint8_decode_footprint( ctx );
6273 0 : if( FD_UNLIKELY( err ) ) return err;
6274 0 : return 0;
6275 0 : }
6276 0 : int fd_lockout_offset_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6277 0 : *total_sz += sizeof(fd_lockout_offset_t);
6278 0 : void const * start_data = ctx->data;
6279 0 : int err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
6280 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6281 0 : ctx->data = start_data;
6282 0 : return err;
6283 0 : }
6284 0 : static void fd_lockout_offset_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6285 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)struct_mem;
6286 0 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
6287 0 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
6288 0 : }
6289 0 : void * fd_lockout_offset_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6290 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)mem;
6291 0 : fd_lockout_offset_new( self );
6292 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockout_offset_t);
6293 0 : void * * alloc_mem = &alloc_region;
6294 0 : fd_lockout_offset_decode_inner( mem, alloc_mem, ctx );
6295 0 : return self;
6296 0 : }
6297 0 : void fd_lockout_offset_new(fd_lockout_offset_t * self) {
6298 0 : fd_memset( self, 0, sizeof(fd_lockout_offset_t) );
6299 0 : }
6300 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, uint varint ) {
6301 0 : (void) varint;
6302 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockout_offset", level++, 0 );
6303 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 1 );
6304 0 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
6305 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockout_offset", level--, 0 );
6306 0 : }
6307 0 : ulong fd_lockout_offset_size( fd_lockout_offset_t const * self ) {
6308 0 : ulong size = 0;
6309 0 : size += fd_bincode_varint_size( self->offset );
6310 0 : size += sizeof(char);
6311 0 : return size;
6312 0 : }
6313 :
6314 18 : int fd_vote_authorized_voter_encode( fd_vote_authorized_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6315 18 : int err;
6316 18 : err = fd_bincode_uint64_encode( self->epoch, ctx );
6317 18 : if( FD_UNLIKELY( err ) ) return err;
6318 18 : err = fd_pubkey_encode( &self->pubkey, ctx );
6319 18 : if( FD_UNLIKELY( err ) ) return err;
6320 18 : return FD_BINCODE_SUCCESS;
6321 18 : }
6322 12 : static inline int fd_vote_authorized_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6323 12 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6324 12 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
6325 12 : return 0;
6326 12 : }
6327 12 : static void fd_vote_authorized_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6328 12 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)struct_mem;
6329 12 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6330 12 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
6331 12 : }
6332 0 : void * fd_vote_authorized_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6333 0 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)mem;
6334 0 : fd_vote_authorized_voter_new( self );
6335 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voter_t);
6336 0 : void * * alloc_mem = &alloc_region;
6337 0 : fd_vote_authorized_voter_decode_inner( mem, alloc_mem, ctx );
6338 0 : return self;
6339 0 : }
6340 6 : 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, uint varint ) {
6341 6 : (void) varint;
6342 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voter", level++, 0 );
6343 6 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6344 6 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
6345 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voter", level--, 0 );
6346 6 : }
6347 576 : int fd_vote_prior_voter_encode( fd_vote_prior_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6348 576 : int err;
6349 576 : err = fd_pubkey_encode( &self->pubkey, ctx );
6350 576 : if( FD_UNLIKELY( err ) ) return err;
6351 576 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
6352 576 : if( FD_UNLIKELY( err ) ) return err;
6353 576 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
6354 576 : if( FD_UNLIKELY( err ) ) return err;
6355 576 : return FD_BINCODE_SUCCESS;
6356 576 : }
6357 384 : static inline int fd_vote_prior_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6358 384 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6359 384 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
6360 384 : return 0;
6361 384 : }
6362 384 : static void fd_vote_prior_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6363 384 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)struct_mem;
6364 384 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
6365 384 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
6366 384 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
6367 384 : }
6368 0 : void * fd_vote_prior_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6369 0 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)mem;
6370 0 : fd_vote_prior_voter_new( self );
6371 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_t);
6372 0 : void * * alloc_mem = &alloc_region;
6373 0 : fd_vote_prior_voter_decode_inner( mem, alloc_mem, ctx );
6374 0 : return self;
6375 0 : }
6376 192 : 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, uint varint ) {
6377 192 : (void) varint;
6378 192 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter", level++, 0 );
6379 192 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
6380 192 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6381 192 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6382 192 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter", level--, 0 );
6383 192 : }
6384 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 ) {
6385 0 : int err;
6386 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
6387 0 : if( FD_UNLIKELY( err ) ) return err;
6388 0 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
6389 0 : if( FD_UNLIKELY( err ) ) return err;
6390 0 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
6391 0 : if( FD_UNLIKELY( err ) ) return err;
6392 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
6393 0 : if( FD_UNLIKELY( err ) ) return err;
6394 0 : return FD_BINCODE_SUCCESS;
6395 0 : }
6396 0 : static inline int fd_vote_prior_voter_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6397 0 : if( (ulong)ctx->data + 56UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6398 0 : ctx->data = (void *)( (ulong)ctx->data + 56UL );
6399 0 : return 0;
6400 0 : }
6401 0 : static void fd_vote_prior_voter_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6402 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)struct_mem;
6403 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
6404 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
6405 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
6406 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
6407 0 : }
6408 0 : void * fd_vote_prior_voter_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6409 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)mem;
6410 0 : fd_vote_prior_voter_0_23_5_new( self );
6411 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_0_23_5_t);
6412 0 : void * * alloc_mem = &alloc_region;
6413 0 : fd_vote_prior_voter_0_23_5_decode_inner( mem, alloc_mem, ctx );
6414 0 : return self;
6415 0 : }
6416 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, uint varint ) {
6417 0 : (void) varint;
6418 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter_0_23_5", level++, 0 );
6419 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
6420 0 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6421 0 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6422 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6423 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter_0_23_5", level--, 0 );
6424 0 : }
6425 195 : int fd_vote_epoch_credits_encode( fd_vote_epoch_credits_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6426 195 : int err;
6427 195 : err = fd_bincode_uint64_encode( self->epoch, ctx );
6428 195 : if( FD_UNLIKELY( err ) ) return err;
6429 195 : err = fd_bincode_uint64_encode( self->credits, ctx );
6430 195 : if( FD_UNLIKELY( err ) ) return err;
6431 195 : err = fd_bincode_uint64_encode( self->prev_credits, ctx );
6432 195 : if( FD_UNLIKELY( err ) ) return err;
6433 195 : return FD_BINCODE_SUCCESS;
6434 195 : }
6435 0 : static inline int fd_vote_epoch_credits_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6436 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6437 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
6438 0 : return 0;
6439 0 : }
6440 390 : static void fd_vote_epoch_credits_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6441 390 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)struct_mem;
6442 390 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6443 390 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
6444 390 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
6445 390 : }
6446 0 : void * fd_vote_epoch_credits_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6447 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)mem;
6448 0 : fd_vote_epoch_credits_new( self );
6449 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_epoch_credits_t);
6450 0 : void * * alloc_mem = &alloc_region;
6451 0 : fd_vote_epoch_credits_decode_inner( mem, alloc_mem, ctx );
6452 0 : return self;
6453 0 : }
6454 195 : 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, uint varint ) {
6455 195 : (void) varint;
6456 195 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_epoch_credits", level++, 0 );
6457 195 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6458 195 : fun( w, &self->credits, "credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6459 195 : fun( w, &self->prev_credits, "prev_credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6460 195 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_epoch_credits", level--, 0 );
6461 195 : }
6462 18 : int fd_vote_block_timestamp_encode( fd_vote_block_timestamp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6463 18 : int err;
6464 18 : err = fd_bincode_uint64_encode( self->slot, ctx );
6465 18 : if( FD_UNLIKELY( err ) ) return err;
6466 18 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
6467 18 : if( FD_UNLIKELY( err ) ) return err;
6468 18 : return FD_BINCODE_SUCCESS;
6469 18 : }
6470 12 : static inline int fd_vote_block_timestamp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6471 12 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6472 12 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
6473 12 : return 0;
6474 12 : }
6475 12 : static void fd_vote_block_timestamp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6476 12 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)struct_mem;
6477 12 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
6478 12 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
6479 12 : }
6480 0 : void * fd_vote_block_timestamp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6481 0 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)mem;
6482 0 : fd_vote_block_timestamp_new( self );
6483 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_block_timestamp_t);
6484 0 : void * * alloc_mem = &alloc_region;
6485 0 : fd_vote_block_timestamp_decode_inner( mem, alloc_mem, ctx );
6486 0 : return self;
6487 0 : }
6488 6 : 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, uint varint ) {
6489 6 : (void) varint;
6490 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_block_timestamp", level++, 0 );
6491 6 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6492 6 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
6493 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_block_timestamp", level--, 0 );
6494 6 : }
6495 18 : int fd_vote_prior_voters_encode( fd_vote_prior_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6496 18 : int err;
6497 594 : for( ulong i=0; i<32; i++ ) {
6498 576 : err = fd_vote_prior_voter_encode( self->buf + i, ctx );
6499 576 : if( FD_UNLIKELY( err ) ) return err;
6500 576 : }
6501 18 : err = fd_bincode_uint64_encode( self->idx, ctx );
6502 18 : if( FD_UNLIKELY( err ) ) return err;
6503 18 : err = fd_bincode_bool_encode( (uchar)(self->is_empty), ctx );
6504 18 : if( FD_UNLIKELY( err ) ) return err;
6505 18 : return FD_BINCODE_SUCCESS;
6506 18 : }
6507 12 : static int fd_vote_prior_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6508 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6509 12 : int err = 0;
6510 396 : for( ulong i=0; i<32; i++ ) {
6511 384 : err = fd_vote_prior_voter_decode_footprint_inner( ctx, total_sz );
6512 384 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6513 384 : }
6514 12 : err = fd_bincode_uint64_decode_footprint( ctx );
6515 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6516 12 : err = fd_bincode_bool_decode_footprint( ctx );
6517 12 : if( FD_UNLIKELY( err ) ) return err;
6518 12 : return 0;
6519 12 : }
6520 0 : int fd_vote_prior_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6521 0 : *total_sz += sizeof(fd_vote_prior_voters_t);
6522 0 : void const * start_data = ctx->data;
6523 0 : int err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
6524 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6525 0 : ctx->data = start_data;
6526 0 : return err;
6527 0 : }
6528 12 : static void fd_vote_prior_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6529 12 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)struct_mem;
6530 396 : for( ulong i=0; i<32; i++ ) {
6531 384 : fd_vote_prior_voter_decode_inner( self->buf + i, alloc_mem, ctx );
6532 384 : }
6533 12 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
6534 12 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
6535 12 : }
6536 0 : void * fd_vote_prior_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6537 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)mem;
6538 0 : fd_vote_prior_voters_new( self );
6539 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_t);
6540 0 : void * * alloc_mem = &alloc_region;
6541 0 : fd_vote_prior_voters_decode_inner( mem, alloc_mem, ctx );
6542 0 : return self;
6543 0 : }
6544 12 : void fd_vote_prior_voters_new(fd_vote_prior_voters_t * self) {
6545 12 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_t) );
6546 396 : for( ulong i=0; i<32; i++ )
6547 384 : fd_vote_prior_voter_new( self->buf + i );
6548 12 : }
6549 6 : 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, uint varint ) {
6550 6 : (void) varint;
6551 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters", level++, 0 );
6552 6 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter[]", level++, 0 );
6553 198 : for( ulong i=0; i<32; i++ )
6554 192 : fd_vote_prior_voter_walk( w, self->buf + i, fun, "vote_prior_voter", level, 0 );
6555 6 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter[]", level--, 0 );
6556 6 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6557 6 : fun( w, &self->is_empty, "is_empty", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
6558 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters", level--, 0 );
6559 6 : }
6560 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 ) {
6561 0 : int err;
6562 0 : for( ulong i=0; i<32; i++ ) {
6563 0 : err = fd_vote_prior_voter_0_23_5_encode( self->buf + i, ctx );
6564 0 : if( FD_UNLIKELY( err ) ) return err;
6565 0 : }
6566 0 : err = fd_bincode_uint64_encode( self->idx, ctx );
6567 0 : if( FD_UNLIKELY( err ) ) return err;
6568 0 : return FD_BINCODE_SUCCESS;
6569 0 : }
6570 0 : static inline int fd_vote_prior_voters_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6571 0 : if( (ulong)ctx->data + 1800UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6572 0 : ctx->data = (void *)( (ulong)ctx->data + 1800UL );
6573 0 : return 0;
6574 0 : }
6575 0 : static void fd_vote_prior_voters_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6576 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)struct_mem;
6577 0 : for( ulong i=0; i<32; i++ ) {
6578 0 : fd_vote_prior_voter_0_23_5_decode_inner( self->buf + i, alloc_mem, ctx );
6579 0 : }
6580 0 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
6581 0 : }
6582 0 : void * fd_vote_prior_voters_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6583 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)mem;
6584 0 : fd_vote_prior_voters_0_23_5_new( self );
6585 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_0_23_5_t);
6586 0 : void * * alloc_mem = &alloc_region;
6587 0 : fd_vote_prior_voters_0_23_5_decode_inner( mem, alloc_mem, ctx );
6588 0 : return self;
6589 0 : }
6590 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, uint varint ) {
6591 0 : (void) varint;
6592 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters_0_23_5", level++, 0 );
6593 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter_0_23_5[]", level++, 0 );
6594 0 : for( ulong i=0; i<32; i++ )
6595 0 : fd_vote_prior_voter_0_23_5_walk( w, self->buf + i, fun, "vote_prior_voter_0_23_5", level, 0 );
6596 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter_0_23_5[]", level--, 0 );
6597 0 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6598 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters_0_23_5", level--, 0 );
6599 0 : }
6600 96 : int fd_landed_vote_encode( fd_landed_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6601 96 : int err;
6602 96 : err = fd_bincode_uint8_encode( (uchar)(self->latency), ctx );
6603 96 : if( FD_UNLIKELY( err ) ) return err;
6604 96 : err = fd_vote_lockout_encode( &self->lockout, ctx );
6605 96 : if( FD_UNLIKELY( err ) ) return err;
6606 96 : return FD_BINCODE_SUCCESS;
6607 96 : }
6608 0 : static inline int fd_landed_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6609 0 : if( (ulong)ctx->data + 13UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6610 0 : ctx->data = (void *)( (ulong)ctx->data + 13UL );
6611 0 : return 0;
6612 0 : }
6613 192 : static void fd_landed_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6614 192 : fd_landed_vote_t * self = (fd_landed_vote_t *)struct_mem;
6615 192 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
6616 192 : fd_vote_lockout_decode_inner( &self->lockout, alloc_mem, ctx );
6617 192 : }
6618 0 : void * fd_landed_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6619 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)mem;
6620 0 : fd_landed_vote_new( self );
6621 0 : void * alloc_region = (uchar *)mem + sizeof(fd_landed_vote_t);
6622 0 : void * * alloc_mem = &alloc_region;
6623 0 : fd_landed_vote_decode_inner( mem, alloc_mem, ctx );
6624 0 : return self;
6625 0 : }
6626 96 : void fd_landed_vote_walk( void * w, fd_landed_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
6627 96 : (void) varint;
6628 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_landed_vote", level++, 0 );
6629 96 : fun( w, &self->latency, "latency", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
6630 96 : fd_vote_lockout_walk( w, &self->lockout, fun, "lockout", level, 0 );
6631 96 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_landed_vote", level--, 0 );
6632 96 : }
6633 0 : int fd_vote_state_0_23_5_encode( fd_vote_state_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6634 0 : int err;
6635 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
6636 0 : if( FD_UNLIKELY( err ) ) return err;
6637 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
6638 0 : if( FD_UNLIKELY( err ) ) return err;
6639 0 : err = fd_bincode_uint64_encode( self->authorized_voter_epoch, ctx );
6640 0 : if( FD_UNLIKELY( err ) ) return err;
6641 0 : err = fd_vote_prior_voters_0_23_5_encode( &self->prior_voters, ctx );
6642 0 : if( FD_UNLIKELY( err ) ) return err;
6643 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
6644 0 : if( FD_UNLIKELY( err ) ) return err;
6645 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
6646 0 : if( FD_UNLIKELY( err ) ) return err;
6647 0 : if( self->votes ) {
6648 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
6649 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
6650 0 : if( FD_UNLIKELY( err ) ) return err;
6651 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 ) ) {
6652 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
6653 0 : err = fd_vote_lockout_encode( ele, ctx );
6654 0 : if( FD_UNLIKELY( err ) ) return err;
6655 0 : }
6656 0 : } else {
6657 0 : ulong votes_len = 0;
6658 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
6659 0 : if( FD_UNLIKELY( err ) ) return err;
6660 0 : }
6661 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
6662 0 : if( FD_UNLIKELY( err ) ) return err;
6663 0 : if( self->has_root_slot ) {
6664 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
6665 0 : if( FD_UNLIKELY( err ) ) return err;
6666 0 : }
6667 0 : if( self->epoch_credits ) {
6668 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
6669 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
6670 0 : if( FD_UNLIKELY( err ) ) return err;
6671 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 ) ) {
6672 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
6673 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
6674 0 : if( FD_UNLIKELY( err ) ) return err;
6675 0 : }
6676 0 : } else {
6677 0 : ulong epoch_credits_len = 0;
6678 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
6679 0 : if( FD_UNLIKELY( err ) ) return err;
6680 0 : }
6681 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
6682 0 : if( FD_UNLIKELY( err ) ) return err;
6683 0 : return FD_BINCODE_SUCCESS;
6684 0 : }
6685 0 : static int fd_vote_state_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6686 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6687 0 : int err = 0;
6688 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6689 0 : if( FD_UNLIKELY( err ) ) return err;
6690 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6691 0 : if( FD_UNLIKELY( err ) ) return err;
6692 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6693 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6694 0 : err = fd_vote_prior_voters_0_23_5_decode_footprint_inner( ctx, total_sz );
6695 0 : if( FD_UNLIKELY( err ) ) return err;
6696 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6697 0 : if( FD_UNLIKELY( err ) ) return err;
6698 0 : err = fd_bincode_uint8_decode_footprint( ctx );
6699 0 : if( FD_UNLIKELY( err ) ) return err;
6700 0 : ulong votes_len;
6701 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
6702 0 : if( FD_UNLIKELY( err ) ) return err;
6703 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
6704 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
6705 0 : ulong votes_sz;
6706 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
6707 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
6708 0 : if( FD_UNLIKELY( err ) ) return err;
6709 0 : {
6710 0 : uchar o;
6711 0 : err = fd_bincode_bool_decode( &o, ctx );
6712 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6713 0 : if( o ) {
6714 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6715 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6716 0 : }
6717 0 : }
6718 0 : ulong epoch_credits_len;
6719 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
6720 0 : if( FD_UNLIKELY( err ) ) return err;
6721 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
6722 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
6723 0 : ulong epoch_credits_sz;
6724 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
6725 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
6726 0 : if( FD_UNLIKELY( err ) ) return err;
6727 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
6728 0 : if( FD_UNLIKELY( err ) ) return err;
6729 0 : return 0;
6730 0 : }
6731 0 : int fd_vote_state_0_23_5_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6732 0 : *total_sz += sizeof(fd_vote_state_0_23_5_t);
6733 0 : void const * start_data = ctx->data;
6734 0 : int err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
6735 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6736 0 : ctx->data = start_data;
6737 0 : return err;
6738 0 : }
6739 0 : static void fd_vote_state_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6740 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)struct_mem;
6741 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
6742 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
6743 0 : fd_bincode_uint64_decode_unsafe( &self->authorized_voter_epoch, ctx );
6744 0 : fd_vote_prior_voters_0_23_5_decode_inner( &self->prior_voters, alloc_mem, ctx );
6745 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
6746 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
6747 0 : ulong votes_len;
6748 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
6749 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
6750 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
6751 0 : for( ulong i=0; i < votes_len; i++ ) {
6752 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
6753 0 : fd_vote_lockout_new( elem );
6754 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
6755 0 : }
6756 0 : {
6757 0 : uchar o;
6758 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6759 0 : self->has_root_slot = !!o;
6760 0 : if( o ) {
6761 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
6762 0 : }
6763 0 : }
6764 0 : ulong epoch_credits_len;
6765 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
6766 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
6767 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
6768 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
6769 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
6770 0 : fd_vote_epoch_credits_new( elem );
6771 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
6772 0 : }
6773 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
6774 0 : }
6775 0 : void * fd_vote_state_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6776 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)mem;
6777 0 : fd_vote_state_0_23_5_new( self );
6778 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_0_23_5_t);
6779 0 : void * * alloc_mem = &alloc_region;
6780 0 : fd_vote_state_0_23_5_decode_inner( mem, alloc_mem, ctx );
6781 0 : return self;
6782 0 : }
6783 0 : void fd_vote_state_0_23_5_new(fd_vote_state_0_23_5_t * self) {
6784 0 : fd_memset( self, 0, sizeof(fd_vote_state_0_23_5_t) );
6785 0 : fd_pubkey_new( &self->node_pubkey );
6786 0 : fd_pubkey_new( &self->authorized_voter );
6787 0 : fd_vote_prior_voters_0_23_5_new( &self->prior_voters );
6788 0 : fd_pubkey_new( &self->authorized_withdrawer );
6789 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
6790 0 : }
6791 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, uint varint ) {
6792 0 : (void) varint;
6793 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_0_23_5", level++, 0 );
6794 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
6795 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level, 0 );
6796 0 : fun( w, &self->authorized_voter_epoch, "authorized_voter_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6797 0 : fd_vote_prior_voters_0_23_5_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
6798 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
6799 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
6800 :
6801 : /* Walk deque */
6802 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
6803 0 : if( self->votes ) {
6804 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
6805 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
6806 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
6807 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
6808 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level, 0 );
6809 0 : }
6810 0 : }
6811 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
6812 : /* Done walking deque */
6813 :
6814 0 : if( !self->has_root_slot ) {
6815 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
6816 0 : } else {
6817 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6818 0 : }
6819 :
6820 : /* Walk deque */
6821 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
6822 0 : if( self->epoch_credits ) {
6823 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
6824 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
6825 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
6826 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
6827 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
6828 0 : }
6829 0 : }
6830 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
6831 : /* Done walking deque */
6832 :
6833 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
6834 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_0_23_5", level--, 0 );
6835 0 : }
6836 0 : ulong fd_vote_state_0_23_5_size( fd_vote_state_0_23_5_t const * self ) {
6837 0 : ulong size = 0;
6838 0 : size += fd_pubkey_size( &self->node_pubkey );
6839 0 : size += fd_pubkey_size( &self->authorized_voter );
6840 0 : size += sizeof(ulong);
6841 0 : size += fd_vote_prior_voters_0_23_5_size( &self->prior_voters );
6842 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
6843 0 : size += sizeof(char);
6844 0 : if( self->votes ) {
6845 0 : size += sizeof(ulong);
6846 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 ) ) {
6847 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
6848 0 : size += fd_vote_lockout_size( ele );
6849 0 : }
6850 0 : } else {
6851 0 : size += sizeof(ulong);
6852 0 : }
6853 0 : size += sizeof(char);
6854 0 : if( self->has_root_slot ) {
6855 0 : size += sizeof(ulong);
6856 0 : }
6857 0 : if( self->epoch_credits ) {
6858 0 : size += sizeof(ulong);
6859 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 ) ) {
6860 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
6861 0 : size += fd_vote_epoch_credits_size( ele );
6862 0 : }
6863 0 : } else {
6864 0 : size += sizeof(ulong);
6865 0 : }
6866 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
6867 0 : return size;
6868 0 : }
6869 :
6870 18 : int fd_vote_authorized_voters_encode( fd_vote_authorized_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6871 18 : int err;
6872 18 : if( self->treap ) {
6873 18 : ulong fd_vote_authorized_voters_len = fd_vote_authorized_voters_treap_ele_cnt( self->treap );
6874 18 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
6875 18 : if( FD_UNLIKELY( err ) ) return err;
6876 18 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
6877 36 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
6878 18 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
6879 18 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
6880 18 : err = fd_vote_authorized_voter_encode( ele, ctx );
6881 18 : if( FD_UNLIKELY( err ) ) return err;
6882 18 : }
6883 18 : } else {
6884 0 : ulong fd_vote_authorized_voters_len = 0;
6885 0 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
6886 0 : if( FD_UNLIKELY( err ) ) return err;
6887 0 : }
6888 18 : return FD_BINCODE_SUCCESS;
6889 18 : }
6890 12 : static int fd_vote_authorized_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6891 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6892 12 : int err = 0;
6893 12 : ulong fd_vote_authorized_voters_treap_len;
6894 12 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
6895 12 : if( FD_UNLIKELY( err ) ) return err;
6896 12 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN ), 1UL );
6897 12 : *total_sz += fd_vote_authorized_voters_pool_align() + fd_vote_authorized_voters_pool_footprint( fd_vote_authorized_voters_treap_max );
6898 12 : *total_sz += fd_vote_authorized_voters_treap_align() + fd_vote_authorized_voters_treap_footprint( fd_vote_authorized_voters_treap_max );
6899 24 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
6900 12 : err = fd_vote_authorized_voter_decode_footprint_inner( ctx, total_sz );
6901 12 : if( FD_UNLIKELY ( err ) ) return err;
6902 12 : }
6903 12 : return 0;
6904 12 : }
6905 0 : int fd_vote_authorized_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6906 0 : *total_sz += sizeof(fd_vote_authorized_voters_t);
6907 0 : void const * start_data = ctx->data;
6908 0 : int err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
6909 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6910 0 : ctx->data = start_data;
6911 0 : return err;
6912 0 : }
6913 12 : static void fd_vote_authorized_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6914 12 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)struct_mem;
6915 12 : ulong fd_vote_authorized_voters_treap_len;
6916 12 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
6917 12 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
6918 12 : self->pool = fd_vote_authorized_voters_pool_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
6919 12 : self->treap = fd_vote_authorized_voters_treap_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
6920 24 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
6921 12 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( self->pool );
6922 12 : fd_vote_authorized_voter_new( ele );
6923 12 : fd_vote_authorized_voter_decode_inner( ele, alloc_mem, ctx );
6924 12 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( self->treap, ele->epoch, self->pool );
6925 12 : if( repeated_entry ) {
6926 0 : fd_vote_authorized_voters_treap_ele_remove( self->treap, repeated_entry, self->pool ); // Remove the element before inserting it back to avoid duplication
6927 0 : fd_vote_authorized_voters_pool_ele_release( self->pool, repeated_entry );
6928 0 : }
6929 12 : fd_vote_authorized_voters_treap_ele_insert( self->treap, ele, self->pool ); /* this cannot fail */
6930 12 : }
6931 12 : }
6932 0 : void * fd_vote_authorized_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6933 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)mem;
6934 0 : fd_vote_authorized_voters_new( self );
6935 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voters_t);
6936 0 : void * * alloc_mem = &alloc_region;
6937 0 : fd_vote_authorized_voters_decode_inner( mem, alloc_mem, ctx );
6938 0 : return self;
6939 0 : }
6940 12 : void fd_vote_authorized_voters_new(fd_vote_authorized_voters_t * self) {
6941 12 : fd_memset( self, 0, sizeof(fd_vote_authorized_voters_t) );
6942 12 : }
6943 6 : 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, uint varint ) {
6944 6 : (void) varint;
6945 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voters", level++, 0 );
6946 6 : if( self->treap ) {
6947 6 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
6948 12 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
6949 6 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
6950 6 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
6951 6 : fd_vote_authorized_voter_walk( w, ele, fun, "fd_vote_authorized_voter_t", level, 0 );
6952 6 : }
6953 6 : }
6954 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voters", level--, 0 );
6955 6 : }
6956 0 : ulong fd_vote_authorized_voters_size( fd_vote_authorized_voters_t const * self ) {
6957 0 : ulong size = 0;
6958 0 : size += sizeof(ulong);
6959 0 : if( self->treap ) {
6960 0 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
6961 0 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
6962 0 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
6963 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
6964 0 : size += fd_vote_authorized_voter_size( ele );
6965 0 : }
6966 0 : }
6967 0 : return size;
6968 0 : }
6969 :
6970 0 : int fd_vote_state_1_14_11_encode( fd_vote_state_1_14_11_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6971 0 : int err;
6972 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
6973 0 : if( FD_UNLIKELY( err ) ) return err;
6974 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
6975 0 : if( FD_UNLIKELY( err ) ) return err;
6976 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
6977 0 : if( FD_UNLIKELY( err ) ) return err;
6978 0 : if( self->votes ) {
6979 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
6980 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
6981 0 : if( FD_UNLIKELY( err ) ) return err;
6982 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 ) ) {
6983 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
6984 0 : err = fd_vote_lockout_encode( ele, ctx );
6985 0 : if( FD_UNLIKELY( err ) ) return err;
6986 0 : }
6987 0 : } else {
6988 0 : ulong votes_len = 0;
6989 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
6990 0 : if( FD_UNLIKELY( err ) ) return err;
6991 0 : }
6992 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
6993 0 : if( FD_UNLIKELY( err ) ) return err;
6994 0 : if( self->has_root_slot ) {
6995 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
6996 0 : if( FD_UNLIKELY( err ) ) return err;
6997 0 : }
6998 0 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
6999 0 : if( FD_UNLIKELY( err ) ) return err;
7000 0 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
7001 0 : if( FD_UNLIKELY( err ) ) return err;
7002 0 : if( self->epoch_credits ) {
7003 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
7004 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
7005 0 : if( FD_UNLIKELY( err ) ) return err;
7006 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 ) ) {
7007 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
7008 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
7009 0 : if( FD_UNLIKELY( err ) ) return err;
7010 0 : }
7011 0 : } else {
7012 0 : ulong epoch_credits_len = 0;
7013 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
7014 0 : if( FD_UNLIKELY( err ) ) return err;
7015 0 : }
7016 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
7017 0 : if( FD_UNLIKELY( err ) ) return err;
7018 0 : return FD_BINCODE_SUCCESS;
7019 0 : }
7020 0 : static int fd_vote_state_1_14_11_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7021 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7022 0 : int err = 0;
7023 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7024 0 : if( FD_UNLIKELY( err ) ) return err;
7025 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7026 0 : if( FD_UNLIKELY( err ) ) return err;
7027 0 : err = fd_bincode_uint8_decode_footprint( ctx );
7028 0 : if( FD_UNLIKELY( err ) ) return err;
7029 0 : ulong votes_len;
7030 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
7031 0 : if( FD_UNLIKELY( err ) ) return err;
7032 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
7033 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
7034 0 : ulong votes_sz;
7035 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
7036 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
7037 0 : if( FD_UNLIKELY( err ) ) return err;
7038 0 : {
7039 0 : uchar o;
7040 0 : err = fd_bincode_bool_decode( &o, ctx );
7041 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7042 0 : if( o ) {
7043 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7044 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7045 0 : }
7046 0 : }
7047 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
7048 0 : if( FD_UNLIKELY( err ) ) return err;
7049 0 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
7050 0 : if( FD_UNLIKELY( err ) ) return err;
7051 0 : ulong epoch_credits_len;
7052 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
7053 0 : if( FD_UNLIKELY( err ) ) return err;
7054 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
7055 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
7056 0 : ulong epoch_credits_sz;
7057 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
7058 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
7059 0 : if( FD_UNLIKELY( err ) ) return err;
7060 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
7061 0 : if( FD_UNLIKELY( err ) ) return err;
7062 0 : return 0;
7063 0 : }
7064 0 : int fd_vote_state_1_14_11_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7065 0 : *total_sz += sizeof(fd_vote_state_1_14_11_t);
7066 0 : void const * start_data = ctx->data;
7067 0 : int err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
7068 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7069 0 : ctx->data = start_data;
7070 0 : return err;
7071 0 : }
7072 0 : static void fd_vote_state_1_14_11_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7073 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)struct_mem;
7074 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
7075 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
7076 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
7077 0 : ulong votes_len;
7078 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
7079 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
7080 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
7081 0 : for( ulong i=0; i < votes_len; i++ ) {
7082 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
7083 0 : fd_vote_lockout_new( elem );
7084 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
7085 0 : }
7086 0 : {
7087 0 : uchar o;
7088 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7089 0 : self->has_root_slot = !!o;
7090 0 : if( o ) {
7091 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
7092 0 : }
7093 0 : }
7094 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
7095 0 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
7096 0 : ulong epoch_credits_len;
7097 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
7098 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
7099 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
7100 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
7101 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
7102 0 : fd_vote_epoch_credits_new( elem );
7103 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
7104 0 : }
7105 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
7106 0 : }
7107 0 : void * fd_vote_state_1_14_11_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7108 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)mem;
7109 0 : fd_vote_state_1_14_11_new( self );
7110 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_1_14_11_t);
7111 0 : void * * alloc_mem = &alloc_region;
7112 0 : fd_vote_state_1_14_11_decode_inner( mem, alloc_mem, ctx );
7113 0 : return self;
7114 0 : }
7115 0 : void fd_vote_state_1_14_11_new(fd_vote_state_1_14_11_t * self) {
7116 0 : fd_memset( self, 0, sizeof(fd_vote_state_1_14_11_t) );
7117 0 : fd_pubkey_new( &self->node_pubkey );
7118 0 : fd_pubkey_new( &self->authorized_withdrawer );
7119 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
7120 0 : fd_vote_prior_voters_new( &self->prior_voters );
7121 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
7122 0 : }
7123 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, uint varint ) {
7124 0 : (void) varint;
7125 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_1_14_11", level++, 0 );
7126 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
7127 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
7128 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7129 :
7130 : /* Walk deque */
7131 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
7132 0 : if( self->votes ) {
7133 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
7134 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
7135 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
7136 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
7137 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level, 0 );
7138 0 : }
7139 0 : }
7140 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
7141 : /* Done walking deque */
7142 :
7143 0 : if( !self->has_root_slot ) {
7144 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
7145 0 : } else {
7146 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7147 0 : }
7148 0 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level, 0 );
7149 0 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
7150 :
7151 : /* Walk deque */
7152 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
7153 0 : if( self->epoch_credits ) {
7154 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
7155 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
7156 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
7157 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
7158 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
7159 0 : }
7160 0 : }
7161 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
7162 : /* Done walking deque */
7163 :
7164 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
7165 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_1_14_11", level--, 0 );
7166 0 : }
7167 0 : ulong fd_vote_state_1_14_11_size( fd_vote_state_1_14_11_t const * self ) {
7168 0 : ulong size = 0;
7169 0 : size += fd_pubkey_size( &self->node_pubkey );
7170 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
7171 0 : size += sizeof(char);
7172 0 : if( self->votes ) {
7173 0 : size += sizeof(ulong);
7174 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 ) ) {
7175 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
7176 0 : size += fd_vote_lockout_size( ele );
7177 0 : }
7178 0 : } else {
7179 0 : size += sizeof(ulong);
7180 0 : }
7181 0 : size += sizeof(char);
7182 0 : if( self->has_root_slot ) {
7183 0 : size += sizeof(ulong);
7184 0 : }
7185 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
7186 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
7187 0 : if( self->epoch_credits ) {
7188 0 : size += sizeof(ulong);
7189 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 ) ) {
7190 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
7191 0 : size += fd_vote_epoch_credits_size( ele );
7192 0 : }
7193 0 : } else {
7194 0 : size += sizeof(ulong);
7195 0 : }
7196 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
7197 0 : return size;
7198 0 : }
7199 :
7200 18 : int fd_vote_state_encode( fd_vote_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7201 18 : int err;
7202 18 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
7203 18 : if( FD_UNLIKELY( err ) ) return err;
7204 18 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
7205 18 : if( FD_UNLIKELY( err ) ) return err;
7206 18 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
7207 18 : if( FD_UNLIKELY( err ) ) return err;
7208 18 : if( self->votes ) {
7209 6 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
7210 6 : err = fd_bincode_uint64_encode( votes_len, ctx );
7211 6 : if( FD_UNLIKELY( err ) ) return err;
7212 102 : 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 ) ) {
7213 96 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
7214 96 : err = fd_landed_vote_encode( ele, ctx );
7215 96 : if( FD_UNLIKELY( err ) ) return err;
7216 96 : }
7217 12 : } else {
7218 12 : ulong votes_len = 0;
7219 12 : err = fd_bincode_uint64_encode( votes_len, ctx );
7220 12 : if( FD_UNLIKELY( err ) ) return err;
7221 12 : }
7222 18 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
7223 18 : if( FD_UNLIKELY( err ) ) return err;
7224 18 : if( self->has_root_slot ) {
7225 6 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
7226 6 : if( FD_UNLIKELY( err ) ) return err;
7227 6 : }
7228 18 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
7229 18 : if( FD_UNLIKELY( err ) ) return err;
7230 18 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
7231 18 : if( FD_UNLIKELY( err ) ) return err;
7232 18 : if( self->epoch_credits ) {
7233 6 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
7234 6 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
7235 6 : if( FD_UNLIKELY( err ) ) return err;
7236 201 : 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 ) ) {
7237 195 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
7238 195 : err = fd_vote_epoch_credits_encode( ele, ctx );
7239 195 : if( FD_UNLIKELY( err ) ) return err;
7240 195 : }
7241 12 : } else {
7242 12 : ulong epoch_credits_len = 0;
7243 12 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
7244 12 : if( FD_UNLIKELY( err ) ) return err;
7245 12 : }
7246 18 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
7247 18 : if( FD_UNLIKELY( err ) ) return err;
7248 18 : return FD_BINCODE_SUCCESS;
7249 18 : }
7250 12 : static int fd_vote_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7251 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7252 12 : int err = 0;
7253 12 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7254 12 : if( FD_UNLIKELY( err ) ) return err;
7255 12 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7256 12 : if( FD_UNLIKELY( err ) ) return err;
7257 12 : err = fd_bincode_uint8_decode_footprint( ctx );
7258 12 : if( FD_UNLIKELY( err ) ) return err;
7259 12 : ulong votes_len;
7260 12 : err = fd_bincode_uint64_decode( &votes_len, ctx );
7261 12 : if( FD_UNLIKELY( err ) ) return err;
7262 12 : ulong votes_max = fd_ulong_max( votes_len, 32 );
7263 12 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
7264 12 : ulong votes_sz;
7265 12 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
7266 12 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
7267 12 : if( FD_UNLIKELY( err ) ) return err;
7268 12 : {
7269 12 : uchar o;
7270 12 : err = fd_bincode_bool_decode( &o, ctx );
7271 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7272 12 : if( o ) {
7273 12 : err = fd_bincode_uint64_decode_footprint( ctx );
7274 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7275 12 : }
7276 12 : }
7277 12 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
7278 12 : if( FD_UNLIKELY( err ) ) return err;
7279 12 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
7280 12 : if( FD_UNLIKELY( err ) ) return err;
7281 12 : ulong epoch_credits_len;
7282 12 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
7283 12 : if( FD_UNLIKELY( err ) ) return err;
7284 12 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
7285 12 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
7286 12 : ulong epoch_credits_sz;
7287 12 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
7288 12 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
7289 12 : if( FD_UNLIKELY( err ) ) return err;
7290 12 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
7291 12 : if( FD_UNLIKELY( err ) ) return err;
7292 12 : return 0;
7293 12 : }
7294 0 : int fd_vote_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7295 0 : *total_sz += sizeof(fd_vote_state_t);
7296 0 : void const * start_data = ctx->data;
7297 0 : int err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
7298 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7299 0 : ctx->data = start_data;
7300 0 : return err;
7301 0 : }
7302 12 : static void fd_vote_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7303 12 : fd_vote_state_t * self = (fd_vote_state_t *)struct_mem;
7304 12 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
7305 12 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
7306 12 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
7307 12 : ulong votes_len;
7308 12 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
7309 12 : ulong votes_max = fd_ulong_max( votes_len, 32 );
7310 12 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
7311 204 : for( ulong i=0; i < votes_len; i++ ) {
7312 192 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
7313 192 : fd_landed_vote_new( elem );
7314 192 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
7315 192 : }
7316 12 : {
7317 12 : uchar o;
7318 12 : fd_bincode_bool_decode_unsafe( &o, ctx );
7319 12 : self->has_root_slot = !!o;
7320 12 : if( o ) {
7321 12 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
7322 12 : }
7323 12 : }
7324 12 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
7325 12 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
7326 12 : ulong epoch_credits_len;
7327 12 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
7328 12 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
7329 12 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
7330 402 : for( ulong i=0; i < epoch_credits_len; i++ ) {
7331 390 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
7332 390 : fd_vote_epoch_credits_new( elem );
7333 390 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
7334 390 : }
7335 12 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
7336 12 : }
7337 0 : void * fd_vote_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7338 0 : fd_vote_state_t * self = (fd_vote_state_t *)mem;
7339 0 : fd_vote_state_new( self );
7340 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_t);
7341 0 : void * * alloc_mem = &alloc_region;
7342 0 : fd_vote_state_decode_inner( mem, alloc_mem, ctx );
7343 0 : return self;
7344 0 : }
7345 12 : void fd_vote_state_new(fd_vote_state_t * self) {
7346 12 : fd_memset( self, 0, sizeof(fd_vote_state_t) );
7347 12 : fd_pubkey_new( &self->node_pubkey );
7348 12 : fd_pubkey_new( &self->authorized_withdrawer );
7349 12 : fd_vote_authorized_voters_new( &self->authorized_voters );
7350 12 : fd_vote_prior_voters_new( &self->prior_voters );
7351 12 : fd_vote_block_timestamp_new( &self->last_timestamp );
7352 12 : }
7353 6 : void fd_vote_state_walk( void * w, fd_vote_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
7354 6 : (void) varint;
7355 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state", level++, 0 );
7356 6 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
7357 6 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
7358 6 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7359 :
7360 : /* Walk deque */
7361 6 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
7362 6 : if( self->votes ) {
7363 6 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes );
7364 102 : !deq_fd_landed_vote_t_iter_done( self->votes, iter );
7365 96 : iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
7366 96 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
7367 96 : fd_landed_vote_walk(w, ele, fun, "votes", level, 0 );
7368 96 : }
7369 6 : }
7370 6 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
7371 : /* Done walking deque */
7372 :
7373 6 : if( !self->has_root_slot ) {
7374 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
7375 6 : } else {
7376 6 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7377 6 : }
7378 6 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level, 0 );
7379 6 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
7380 :
7381 : /* Walk deque */
7382 6 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
7383 6 : if( self->epoch_credits ) {
7384 6 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
7385 201 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
7386 195 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
7387 195 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
7388 195 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
7389 195 : }
7390 6 : }
7391 6 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
7392 : /* Done walking deque */
7393 :
7394 6 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
7395 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state", level--, 0 );
7396 6 : }
7397 0 : ulong fd_vote_state_size( fd_vote_state_t const * self ) {
7398 0 : ulong size = 0;
7399 0 : size += fd_pubkey_size( &self->node_pubkey );
7400 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
7401 0 : size += sizeof(char);
7402 0 : if( self->votes ) {
7403 0 : size += sizeof(ulong);
7404 0 : 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 ) ) {
7405 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
7406 0 : size += fd_landed_vote_size( ele );
7407 0 : }
7408 0 : } else {
7409 0 : size += sizeof(ulong);
7410 0 : }
7411 0 : size += sizeof(char);
7412 0 : if( self->has_root_slot ) {
7413 0 : size += sizeof(ulong);
7414 0 : }
7415 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
7416 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
7417 0 : if( self->epoch_credits ) {
7418 0 : size += sizeof(ulong);
7419 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 ) ) {
7420 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
7421 0 : size += fd_vote_epoch_credits_size( ele );
7422 0 : }
7423 0 : } else {
7424 0 : size += sizeof(ulong);
7425 0 : }
7426 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
7427 0 : return size;
7428 0 : }
7429 :
7430 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v0_23_5(fd_vote_state_versioned_t const * self) {
7431 0 : return self->discriminant == 0;
7432 0 : }
7433 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v1_14_11(fd_vote_state_versioned_t const * self) {
7434 0 : return self->discriminant == 1;
7435 0 : }
7436 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_current(fd_vote_state_versioned_t const * self) {
7437 0 : return self->discriminant == 2;
7438 0 : }
7439 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant );
7440 12 : int fd_vote_state_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7441 12 : int err;
7442 12 : switch (discriminant) {
7443 0 : case 0: {
7444 0 : err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
7445 0 : if( FD_UNLIKELY( err ) ) return err;
7446 0 : return FD_BINCODE_SUCCESS;
7447 0 : }
7448 0 : case 1: {
7449 0 : err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
7450 0 : if( FD_UNLIKELY( err ) ) return err;
7451 0 : return FD_BINCODE_SUCCESS;
7452 0 : }
7453 12 : case 2: {
7454 12 : err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
7455 12 : if( FD_UNLIKELY( err ) ) return err;
7456 12 : return FD_BINCODE_SUCCESS;
7457 12 : }
7458 0 : default: return FD_BINCODE_ERR_ENCODING;
7459 12 : }
7460 12 : }
7461 12 : static int fd_vote_state_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7462 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7463 12 : uint discriminant = 0;
7464 12 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7465 12 : if( FD_UNLIKELY( err ) ) return err;
7466 12 : return fd_vote_state_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
7467 12 : }
7468 12 : int fd_vote_state_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7469 12 : *total_sz += sizeof(fd_vote_state_versioned_t);
7470 12 : void const * start_data = ctx->data;
7471 12 : int err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
7472 12 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7473 12 : ctx->data = start_data;
7474 12 : return err;
7475 12 : }
7476 12 : static void fd_vote_state_versioned_inner_decode_inner( fd_vote_state_versioned_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
7477 12 : switch (discriminant) {
7478 0 : case 0: {
7479 0 : fd_vote_state_0_23_5_decode_inner( &self->v0_23_5, alloc_mem, ctx );
7480 0 : break;
7481 0 : }
7482 0 : case 1: {
7483 0 : fd_vote_state_1_14_11_decode_inner( &self->v1_14_11, alloc_mem, ctx );
7484 0 : break;
7485 0 : }
7486 12 : case 2: {
7487 12 : fd_vote_state_decode_inner( &self->current, alloc_mem, ctx );
7488 12 : break;
7489 0 : }
7490 12 : }
7491 12 : }
7492 12 : static void fd_vote_state_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7493 12 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)struct_mem;
7494 12 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7495 12 : fd_vote_state_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7496 12 : }
7497 12 : void * fd_vote_state_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7498 12 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)mem;
7499 12 : fd_vote_state_versioned_new( self );
7500 12 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_versioned_t);
7501 12 : void * * alloc_mem = &alloc_region;
7502 12 : fd_vote_state_versioned_decode_inner( mem, alloc_mem, ctx );
7503 12 : return self;
7504 12 : }
7505 24 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
7506 24 : switch( discriminant ) {
7507 0 : case 0: {
7508 0 : fd_vote_state_0_23_5_new( &self->v0_23_5 );
7509 0 : break;
7510 0 : }
7511 0 : case 1: {
7512 0 : fd_vote_state_1_14_11_new( &self->v1_14_11 );
7513 0 : break;
7514 0 : }
7515 12 : case 2: {
7516 12 : fd_vote_state_new( &self->current );
7517 12 : break;
7518 0 : }
7519 12 : default: break; // FD_LOG_ERR(( "unhandled type"));
7520 24 : }
7521 24 : }
7522 24 : void fd_vote_state_versioned_new_disc( fd_vote_state_versioned_t * self, uint discriminant ) {
7523 24 : self->discriminant = discriminant;
7524 24 : fd_vote_state_versioned_inner_new( &self->inner, self->discriminant );
7525 24 : }
7526 12 : void fd_vote_state_versioned_new( fd_vote_state_versioned_t * self ) {
7527 12 : fd_memset( self, 0, sizeof(fd_vote_state_versioned_t) );
7528 12 : fd_vote_state_versioned_new_disc( self, UINT_MAX );
7529 12 : }
7530 :
7531 6 : 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, uint varint ) {
7532 6 : (void) varint;
7533 6 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_state_versioned", level++, 0);
7534 6 : switch( self->discriminant ) {
7535 0 : case 0: {
7536 0 : fun( w, self, "v0_23_5", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7537 0 : fd_vote_state_0_23_5_walk( w, &self->inner.v0_23_5, fun, "v0_23_5", level, 0 );
7538 0 : break;
7539 0 : }
7540 0 : case 1: {
7541 0 : fun( w, self, "v1_14_11", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7542 0 : fd_vote_state_1_14_11_walk( w, &self->inner.v1_14_11, fun, "v1_14_11", level, 0 );
7543 0 : break;
7544 0 : }
7545 6 : case 2: {
7546 6 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7547 6 : fd_vote_state_walk( w, &self->inner.current, fun, "current", level, 0 );
7548 6 : break;
7549 0 : }
7550 6 : }
7551 6 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_state_versioned", level--, 0 );
7552 6 : }
7553 0 : ulong fd_vote_state_versioned_size( fd_vote_state_versioned_t const * self ) {
7554 0 : ulong size = 0;
7555 0 : size += sizeof(uint);
7556 0 : switch (self->discriminant) {
7557 0 : case 0: {
7558 0 : size += fd_vote_state_0_23_5_size( &self->inner.v0_23_5 );
7559 0 : break;
7560 0 : }
7561 0 : case 1: {
7562 0 : size += fd_vote_state_1_14_11_size( &self->inner.v1_14_11 );
7563 0 : break;
7564 0 : }
7565 0 : case 2: {
7566 0 : size += fd_vote_state_size( &self->inner.current );
7567 0 : break;
7568 0 : }
7569 0 : }
7570 0 : return size;
7571 0 : }
7572 :
7573 18 : int fd_vote_state_versioned_inner_encode( fd_vote_state_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7574 18 : int err;
7575 18 : switch (discriminant) {
7576 0 : case 0: {
7577 0 : err = fd_vote_state_0_23_5_encode( &self->v0_23_5, ctx );
7578 0 : if( FD_UNLIKELY( err ) ) return err;
7579 0 : break;
7580 0 : }
7581 0 : case 1: {
7582 0 : err = fd_vote_state_1_14_11_encode( &self->v1_14_11, ctx );
7583 0 : if( FD_UNLIKELY( err ) ) return err;
7584 0 : break;
7585 0 : }
7586 18 : case 2: {
7587 18 : err = fd_vote_state_encode( &self->current, ctx );
7588 18 : if( FD_UNLIKELY( err ) ) return err;
7589 18 : break;
7590 18 : }
7591 18 : }
7592 18 : return FD_BINCODE_SUCCESS;
7593 18 : }
7594 18 : int fd_vote_state_versioned_encode( fd_vote_state_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7595 18 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7596 18 : if( FD_UNLIKELY( err ) ) return err;
7597 18 : return fd_vote_state_versioned_inner_encode( &self->inner, self->discriminant, ctx );
7598 18 : }
7599 :
7600 0 : int fd_vote_state_update_encode( fd_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7601 0 : int err;
7602 0 : if( self->lockouts ) {
7603 0 : ulong lockouts_len = deq_fd_vote_lockout_t_cnt( self->lockouts );
7604 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
7605 0 : if( FD_UNLIKELY( err ) ) return err;
7606 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 ) ) {
7607 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->lockouts, iter );
7608 0 : err = fd_vote_lockout_encode( ele, ctx );
7609 0 : if( FD_UNLIKELY( err ) ) return err;
7610 0 : }
7611 0 : } else {
7612 0 : ulong lockouts_len = 0;
7613 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
7614 0 : if( FD_UNLIKELY( err ) ) return err;
7615 0 : }
7616 0 : err = fd_bincode_bool_encode( self->has_root, ctx );
7617 0 : if( FD_UNLIKELY( err ) ) return err;
7618 0 : if( self->has_root ) {
7619 0 : err = fd_bincode_uint64_encode( self->root, ctx );
7620 0 : if( FD_UNLIKELY( err ) ) return err;
7621 0 : }
7622 0 : err = fd_hash_encode( &self->hash, ctx );
7623 0 : if( FD_UNLIKELY( err ) ) return err;
7624 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
7625 0 : if( FD_UNLIKELY( err ) ) return err;
7626 0 : if( self->has_timestamp ) {
7627 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
7628 0 : if( FD_UNLIKELY( err ) ) return err;
7629 0 : }
7630 0 : return FD_BINCODE_SUCCESS;
7631 0 : }
7632 0 : static int fd_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7633 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7634 0 : int err = 0;
7635 0 : ulong lockouts_len;
7636 0 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
7637 0 : if( FD_UNLIKELY( err ) ) return err;
7638 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
7639 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( lockouts_max );
7640 0 : ulong lockouts_sz;
7641 0 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
7642 0 : err = fd_bincode_bytes_decode_footprint( lockouts_sz, ctx );
7643 0 : if( FD_UNLIKELY( err ) ) return err;
7644 0 : {
7645 0 : uchar o;
7646 0 : err = fd_bincode_bool_decode( &o, ctx );
7647 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7648 0 : if( o ) {
7649 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7650 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7651 0 : }
7652 0 : }
7653 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
7654 0 : if( FD_UNLIKELY( err ) ) return err;
7655 0 : {
7656 0 : uchar o;
7657 0 : err = fd_bincode_bool_decode( &o, ctx );
7658 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7659 0 : if( o ) {
7660 0 : err = fd_bincode_int64_decode_footprint( ctx );
7661 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7662 0 : }
7663 0 : }
7664 0 : return 0;
7665 0 : }
7666 0 : int fd_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7667 0 : *total_sz += sizeof(fd_vote_state_update_t);
7668 0 : void const * start_data = ctx->data;
7669 0 : int err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
7670 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7671 0 : ctx->data = start_data;
7672 0 : return err;
7673 0 : }
7674 0 : static void fd_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7675 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)struct_mem;
7676 0 : ulong lockouts_len;
7677 0 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
7678 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
7679 0 : self->lockouts = deq_fd_vote_lockout_t_join_new( alloc_mem, lockouts_max );
7680 0 : for( ulong i=0; i < lockouts_len; i++ ) {
7681 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->lockouts );
7682 0 : fd_vote_lockout_new( elem );
7683 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
7684 0 : }
7685 0 : {
7686 0 : uchar o;
7687 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7688 0 : self->has_root = !!o;
7689 0 : if( o ) {
7690 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
7691 0 : }
7692 0 : }
7693 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
7694 0 : {
7695 0 : uchar o;
7696 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7697 0 : self->has_timestamp = !!o;
7698 0 : if( o ) {
7699 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
7700 0 : }
7701 0 : }
7702 0 : }
7703 0 : void * fd_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7704 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)mem;
7705 0 : fd_vote_state_update_new( self );
7706 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_update_t);
7707 0 : void * * alloc_mem = &alloc_region;
7708 0 : fd_vote_state_update_decode_inner( mem, alloc_mem, ctx );
7709 0 : return self;
7710 0 : }
7711 0 : void fd_vote_state_update_new(fd_vote_state_update_t * self) {
7712 0 : fd_memset( self, 0, sizeof(fd_vote_state_update_t) );
7713 0 : fd_hash_new( &self->hash );
7714 0 : }
7715 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, uint varint ) {
7716 0 : (void) varint;
7717 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_update", level++, 0 );
7718 :
7719 : /* Walk deque */
7720 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++, 0 );
7721 0 : if( self->lockouts ) {
7722 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
7723 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
7724 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
7725 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
7726 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level, 0 );
7727 0 : }
7728 0 : }
7729 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level--, 0 );
7730 : /* Done walking deque */
7731 :
7732 0 : if( !self->has_root ) {
7733 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
7734 0 : } else {
7735 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7736 0 : }
7737 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
7738 0 : if( !self->has_timestamp ) {
7739 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
7740 0 : } else {
7741 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
7742 0 : }
7743 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_update", level--, 0 );
7744 0 : }
7745 0 : ulong fd_vote_state_update_size( fd_vote_state_update_t const * self ) {
7746 0 : ulong size = 0;
7747 0 : if( self->lockouts ) {
7748 0 : size += sizeof(ulong);
7749 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 ) ) {
7750 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
7751 0 : size += fd_vote_lockout_size( ele );
7752 0 : }
7753 0 : } else {
7754 0 : size += sizeof(ulong);
7755 0 : }
7756 0 : size += sizeof(char);
7757 0 : if( self->has_root ) {
7758 0 : size += sizeof(ulong);
7759 0 : }
7760 0 : size += fd_hash_size( &self->hash );
7761 0 : size += sizeof(char);
7762 0 : if( self->has_timestamp ) {
7763 0 : size += sizeof(long);
7764 0 : }
7765 0 : return size;
7766 0 : }
7767 :
7768 0 : int fd_compact_vote_state_update_encode( fd_compact_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7769 0 : int err;
7770 0 : err = fd_bincode_uint64_encode( self->root, ctx );
7771 0 : if( FD_UNLIKELY( err ) ) return err;
7772 0 : err = fd_bincode_compact_u16_encode( &self->lockouts_len, ctx );
7773 0 : if( FD_UNLIKELY(err) ) return err;
7774 0 : if( self->lockouts_len ) {
7775 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
7776 0 : err = fd_lockout_offset_encode( self->lockouts + i, ctx );
7777 0 : if( FD_UNLIKELY( err ) ) return err;
7778 0 : }
7779 0 : }
7780 0 : err = fd_hash_encode( &self->hash, ctx );
7781 0 : if( FD_UNLIKELY( err ) ) return err;
7782 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
7783 0 : if( FD_UNLIKELY( err ) ) return err;
7784 0 : if( self->has_timestamp ) {
7785 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
7786 0 : if( FD_UNLIKELY( err ) ) return err;
7787 0 : }
7788 0 : return FD_BINCODE_SUCCESS;
7789 0 : }
7790 0 : static int fd_compact_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7791 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7792 0 : int err = 0;
7793 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7794 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7795 0 : ushort lockouts_len;
7796 0 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
7797 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7798 0 : if( lockouts_len ) {
7799 0 : *total_sz += FD_LOCKOUT_OFFSET_ALIGN + sizeof(fd_lockout_offset_t)*lockouts_len;
7800 0 : for( ulong i=0; i < lockouts_len; i++ ) {
7801 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
7802 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7803 0 : }
7804 0 : }
7805 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
7806 0 : if( FD_UNLIKELY( err ) ) return err;
7807 0 : {
7808 0 : uchar o;
7809 0 : err = fd_bincode_bool_decode( &o, ctx );
7810 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7811 0 : if( o ) {
7812 0 : err = fd_bincode_int64_decode_footprint( ctx );
7813 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7814 0 : }
7815 0 : }
7816 0 : return 0;
7817 0 : }
7818 0 : int fd_compact_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7819 0 : *total_sz += sizeof(fd_compact_vote_state_update_t);
7820 0 : void const * start_data = ctx->data;
7821 0 : int err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
7822 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7823 0 : ctx->data = start_data;
7824 0 : return err;
7825 0 : }
7826 0 : static void fd_compact_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7827 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)struct_mem;
7828 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
7829 0 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
7830 0 : if( self->lockouts_len ) {
7831 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_LOCKOUT_OFFSET_ALIGN );
7832 0 : self->lockouts = *alloc_mem;
7833 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_lockout_offset_t)*self->lockouts_len;
7834 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
7835 0 : fd_lockout_offset_new( self->lockouts + i );
7836 0 : fd_lockout_offset_decode_inner( self->lockouts + i, alloc_mem, ctx );
7837 0 : }
7838 0 : } else
7839 0 : self->lockouts = NULL;
7840 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
7841 0 : {
7842 0 : uchar o;
7843 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7844 0 : self->has_timestamp = !!o;
7845 0 : if( o ) {
7846 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
7847 0 : }
7848 0 : }
7849 0 : }
7850 0 : void * fd_compact_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7851 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)mem;
7852 0 : fd_compact_vote_state_update_new( self );
7853 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_t);
7854 0 : void * * alloc_mem = &alloc_region;
7855 0 : fd_compact_vote_state_update_decode_inner( mem, alloc_mem, ctx );
7856 0 : return self;
7857 0 : }
7858 0 : void fd_compact_vote_state_update_new(fd_compact_vote_state_update_t * self) {
7859 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_t) );
7860 0 : fd_hash_new( &self->hash );
7861 0 : }
7862 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, uint varint ) {
7863 0 : (void) varint;
7864 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update", level++, 0 );
7865 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7866 0 : fun( w, &self->lockouts_len, "lockouts_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
7867 0 : if( self->lockouts_len ) {
7868 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
7869 0 : for( ulong i=0; i < self->lockouts_len; i++ )
7870 0 : fd_lockout_offset_walk(w, self->lockouts + i, fun, "lockout_offset", level, 0 );
7871 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
7872 0 : }
7873 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
7874 0 : if( !self->has_timestamp ) {
7875 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
7876 0 : } else {
7877 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
7878 0 : }
7879 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update", level--, 0 );
7880 0 : }
7881 0 : ulong fd_compact_vote_state_update_size( fd_compact_vote_state_update_t const * self ) {
7882 0 : ulong size = 0;
7883 0 : size += sizeof(ulong);
7884 0 : do {
7885 0 : ushort tmp = (ushort)self->lockouts_len;
7886 0 : size += fd_bincode_compact_u16_size( &tmp );
7887 0 : for( ulong i=0; i < self->lockouts_len; i++ )
7888 0 : size += fd_lockout_offset_size( self->lockouts + i );
7889 0 : } while(0);
7890 0 : size += fd_hash_size( &self->hash );
7891 0 : size += sizeof(char);
7892 0 : if( self->has_timestamp ) {
7893 0 : size += sizeof(long);
7894 0 : }
7895 0 : return size;
7896 0 : }
7897 :
7898 0 : int fd_compact_vote_state_update_switch_encode( fd_compact_vote_state_update_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7899 0 : int err;
7900 0 : err = fd_compact_vote_state_update_encode( &self->compact_vote_state_update, ctx );
7901 0 : if( FD_UNLIKELY( err ) ) return err;
7902 0 : err = fd_hash_encode( &self->hash, ctx );
7903 0 : if( FD_UNLIKELY( err ) ) return err;
7904 0 : return FD_BINCODE_SUCCESS;
7905 0 : }
7906 0 : static int fd_compact_vote_state_update_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7907 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7908 0 : int err = 0;
7909 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
7910 0 : if( FD_UNLIKELY( err ) ) return err;
7911 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
7912 0 : if( FD_UNLIKELY( err ) ) return err;
7913 0 : return 0;
7914 0 : }
7915 0 : int fd_compact_vote_state_update_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7916 0 : *total_sz += sizeof(fd_compact_vote_state_update_switch_t);
7917 0 : void const * start_data = ctx->data;
7918 0 : int err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
7919 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7920 0 : ctx->data = start_data;
7921 0 : return err;
7922 0 : }
7923 0 : static void fd_compact_vote_state_update_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7924 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)struct_mem;
7925 0 : fd_compact_vote_state_update_decode_inner( &self->compact_vote_state_update, alloc_mem, ctx );
7926 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
7927 0 : }
7928 0 : void * fd_compact_vote_state_update_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7929 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)mem;
7930 0 : fd_compact_vote_state_update_switch_new( self );
7931 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_switch_t);
7932 0 : void * * alloc_mem = &alloc_region;
7933 0 : fd_compact_vote_state_update_switch_decode_inner( mem, alloc_mem, ctx );
7934 0 : return self;
7935 0 : }
7936 0 : void fd_compact_vote_state_update_switch_new(fd_compact_vote_state_update_switch_t * self) {
7937 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_switch_t) );
7938 0 : fd_compact_vote_state_update_new( &self->compact_vote_state_update );
7939 0 : fd_hash_new( &self->hash );
7940 0 : }
7941 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, uint varint ) {
7942 0 : (void) varint;
7943 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update_switch", level++, 0 );
7944 0 : fd_compact_vote_state_update_walk( w, &self->compact_vote_state_update, fun, "compact_vote_state_update", level, 0 );
7945 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
7946 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update_switch", level--, 0 );
7947 0 : }
7948 0 : ulong fd_compact_vote_state_update_switch_size( fd_compact_vote_state_update_switch_t const * self ) {
7949 0 : ulong size = 0;
7950 0 : size += fd_compact_vote_state_update_size( &self->compact_vote_state_update );
7951 0 : size += fd_hash_size( &self->hash );
7952 0 : return size;
7953 0 : }
7954 :
7955 0 : int fd_compact_tower_sync_encode( fd_compact_tower_sync_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7956 0 : int err;
7957 0 : err = fd_bincode_uint64_encode( self->root, ctx );
7958 0 : if( FD_UNLIKELY( err ) ) return err;
7959 0 : if( self->lockout_offsets ) {
7960 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
7961 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
7962 0 : if( FD_UNLIKELY( err ) ) return err;
7963 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 ) ) {
7964 0 : fd_lockout_offset_t const * ele = deq_fd_lockout_offset_t_iter_ele_const( self->lockout_offsets, iter );
7965 0 : err = fd_lockout_offset_encode( ele, ctx );
7966 0 : if( FD_UNLIKELY( err ) ) return err;
7967 0 : }
7968 0 : } else {
7969 0 : ushort lockout_offsets_len = 0;
7970 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
7971 0 : if( FD_UNLIKELY( err ) ) return err;
7972 0 : }
7973 0 : err = fd_hash_encode( &self->hash, ctx );
7974 0 : if( FD_UNLIKELY( err ) ) return err;
7975 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
7976 0 : if( FD_UNLIKELY( err ) ) return err;
7977 0 : if( self->has_timestamp ) {
7978 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
7979 0 : if( FD_UNLIKELY( err ) ) return err;
7980 0 : }
7981 0 : err = fd_hash_encode( &self->block_id, ctx );
7982 0 : if( FD_UNLIKELY( err ) ) return err;
7983 0 : return FD_BINCODE_SUCCESS;
7984 0 : }
7985 0 : static int fd_compact_tower_sync_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7986 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7987 0 : int err = 0;
7988 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7989 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7990 0 : ushort lockout_offsets_len;
7991 0 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
7992 0 : if( FD_UNLIKELY( err ) ) return err;
7993 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
7994 0 : *total_sz += deq_fd_lockout_offset_t_align() + deq_fd_lockout_offset_t_footprint( lockout_offsets_max );
7995 0 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
7996 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
7997 0 : if( FD_UNLIKELY( err ) ) return err;
7998 0 : }
7999 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
8000 0 : if( FD_UNLIKELY( err ) ) return err;
8001 0 : {
8002 0 : uchar o;
8003 0 : err = fd_bincode_bool_decode( &o, ctx );
8004 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8005 0 : if( o ) {
8006 0 : err = fd_bincode_int64_decode_footprint( ctx );
8007 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8008 0 : }
8009 0 : }
8010 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
8011 0 : if( FD_UNLIKELY( err ) ) return err;
8012 0 : return 0;
8013 0 : }
8014 0 : int fd_compact_tower_sync_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8015 0 : *total_sz += sizeof(fd_compact_tower_sync_t);
8016 0 : void const * start_data = ctx->data;
8017 0 : int err = fd_compact_tower_sync_decode_footprint_inner( ctx, total_sz );
8018 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8019 0 : ctx->data = start_data;
8020 0 : return err;
8021 0 : }
8022 0 : static void fd_compact_tower_sync_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8023 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)struct_mem;
8024 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
8025 0 : ushort lockout_offsets_len;
8026 0 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
8027 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
8028 0 : self->lockout_offsets = deq_fd_lockout_offset_t_join_new( alloc_mem, lockout_offsets_max );
8029 0 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
8030 0 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( self->lockout_offsets );
8031 0 : fd_lockout_offset_new( elem );
8032 0 : fd_lockout_offset_decode_inner( elem, alloc_mem, ctx );
8033 0 : }
8034 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
8035 0 : {
8036 0 : uchar o;
8037 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8038 0 : self->has_timestamp = !!o;
8039 0 : if( o ) {
8040 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
8041 0 : }
8042 0 : }
8043 0 : fd_hash_decode_inner( &self->block_id, alloc_mem, ctx );
8044 0 : }
8045 0 : void * fd_compact_tower_sync_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8046 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)mem;
8047 0 : fd_compact_tower_sync_new( self );
8048 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_tower_sync_t);
8049 0 : void * * alloc_mem = &alloc_region;
8050 0 : fd_compact_tower_sync_decode_inner( mem, alloc_mem, ctx );
8051 0 : return self;
8052 0 : }
8053 0 : void fd_compact_tower_sync_new(fd_compact_tower_sync_t * self) {
8054 0 : fd_memset( self, 0, sizeof(fd_compact_tower_sync_t) );
8055 0 : fd_hash_new( &self->hash );
8056 0 : fd_hash_new( &self->block_id );
8057 0 : }
8058 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, uint varint ) {
8059 0 : (void) varint;
8060 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_tower_sync", level++, 0 );
8061 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8062 :
8063 : /* Walk deque */
8064 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR, "lockout_offsets", level++, 0 );
8065 0 : if( self->lockout_offsets ) {
8066 0 : for( deq_fd_lockout_offset_t_iter_t iter = deq_fd_lockout_offset_t_iter_init( self->lockout_offsets );
8067 0 : !deq_fd_lockout_offset_t_iter_done( self->lockout_offsets, iter );
8068 0 : iter = deq_fd_lockout_offset_t_iter_next( self->lockout_offsets, iter ) ) {
8069 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
8070 0 : fd_lockout_offset_walk(w, ele, fun, "lockout_offsets", level, 0 );
8071 0 : }
8072 0 : }
8073 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR_END, "lockout_offsets", level--, 0 );
8074 : /* Done walking deque */
8075 :
8076 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
8077 0 : if( !self->has_timestamp ) {
8078 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
8079 0 : } else {
8080 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
8081 0 : }
8082 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level, 0 );
8083 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_tower_sync", level--, 0 );
8084 0 : }
8085 0 : ulong fd_compact_tower_sync_size( fd_compact_tower_sync_t const * self ) {
8086 0 : ulong size = 0;
8087 0 : size += sizeof(ulong);
8088 0 : if( self->lockout_offsets ) {
8089 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
8090 0 : size += fd_bincode_compact_u16_size( &lockout_offsets_len );
8091 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 ) ) {
8092 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
8093 0 : size += fd_lockout_offset_size( ele );
8094 0 : }
8095 0 : } else {
8096 0 : size += 1;
8097 0 : }
8098 0 : size += fd_hash_size( &self->hash );
8099 0 : size += sizeof(char);
8100 0 : if( self->has_timestamp ) {
8101 0 : size += sizeof(long);
8102 0 : }
8103 0 : size += fd_hash_size( &self->block_id );
8104 0 : return size;
8105 0 : }
8106 :
8107 0 : void fd_tower_sync_new(fd_tower_sync_t * self) {
8108 0 : fd_memset( self, 0, sizeof(fd_tower_sync_t) );
8109 0 : fd_hash_new( &self->hash );
8110 0 : fd_hash_new( &self->block_id );
8111 0 : }
8112 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, uint varint ) {
8113 0 : (void) varint;
8114 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync", level++, 0 );
8115 :
8116 : /* Walk deque */
8117 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++, 0 );
8118 0 : if( self->lockouts ) {
8119 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
8120 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
8121 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
8122 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
8123 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level, 0 );
8124 0 : }
8125 0 : }
8126 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level--, 0 );
8127 : /* Done walking deque */
8128 :
8129 0 : fun( w, &self->lockouts_cnt, "lockouts_cnt", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8130 0 : if( !self->has_root ) {
8131 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
8132 0 : } else {
8133 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8134 0 : }
8135 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
8136 0 : if( !self->has_timestamp ) {
8137 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
8138 0 : } else {
8139 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
8140 0 : }
8141 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level, 0 );
8142 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync", level--, 0 );
8143 0 : }
8144 0 : ulong fd_tower_sync_size( fd_tower_sync_t const * self ) {
8145 0 : ulong size = 0;
8146 0 : if( self->lockouts ) {
8147 0 : size += sizeof(ulong);
8148 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 ) ) {
8149 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
8150 0 : size += fd_vote_lockout_size( ele );
8151 0 : }
8152 0 : } else {
8153 0 : size += sizeof(ulong);
8154 0 : }
8155 0 : size += sizeof(ulong);
8156 0 : size += sizeof(char);
8157 0 : if( self->has_root ) {
8158 0 : size += sizeof(ulong);
8159 0 : }
8160 0 : size += fd_hash_size( &self->hash );
8161 0 : size += sizeof(char);
8162 0 : if( self->has_timestamp ) {
8163 0 : size += sizeof(long);
8164 0 : }
8165 0 : size += fd_hash_size( &self->block_id );
8166 0 : return size;
8167 0 : }
8168 :
8169 0 : int fd_tower_sync_switch_encode( fd_tower_sync_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8170 0 : int err;
8171 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
8172 0 : if( FD_UNLIKELY( err ) ) return err;
8173 0 : err = fd_hash_encode( &self->hash, ctx );
8174 0 : if( FD_UNLIKELY( err ) ) return err;
8175 0 : return FD_BINCODE_SUCCESS;
8176 0 : }
8177 0 : static int fd_tower_sync_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8178 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8179 0 : int err = 0;
8180 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
8181 0 : if( FD_UNLIKELY( err ) ) return err;
8182 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
8183 0 : if( FD_UNLIKELY( err ) ) return err;
8184 0 : return 0;
8185 0 : }
8186 0 : int fd_tower_sync_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8187 0 : *total_sz += sizeof(fd_tower_sync_switch_t);
8188 0 : void const * start_data = ctx->data;
8189 0 : int err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
8190 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8191 0 : ctx->data = start_data;
8192 0 : return err;
8193 0 : }
8194 0 : static void fd_tower_sync_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8195 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)struct_mem;
8196 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
8197 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
8198 0 : }
8199 0 : void * fd_tower_sync_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8200 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)mem;
8201 0 : fd_tower_sync_switch_new( self );
8202 0 : void * alloc_region = (uchar *)mem + sizeof(fd_tower_sync_switch_t);
8203 0 : void * * alloc_mem = &alloc_region;
8204 0 : fd_tower_sync_switch_decode_inner( mem, alloc_mem, ctx );
8205 0 : return self;
8206 0 : }
8207 0 : void fd_tower_sync_switch_new(fd_tower_sync_switch_t * self) {
8208 0 : fd_memset( self, 0, sizeof(fd_tower_sync_switch_t) );
8209 0 : fd_tower_sync_new( &self->tower_sync );
8210 0 : fd_hash_new( &self->hash );
8211 0 : }
8212 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, uint varint ) {
8213 0 : (void) varint;
8214 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync_switch", level++, 0 );
8215 0 : fd_tower_sync_walk( w, &self->tower_sync, fun, "tower_sync", level, 0 );
8216 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
8217 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync_switch", level--, 0 );
8218 0 : }
8219 0 : ulong fd_tower_sync_switch_size( fd_tower_sync_switch_t const * self ) {
8220 0 : ulong size = 0;
8221 0 : size += fd_tower_sync_size( &self->tower_sync );
8222 0 : size += fd_hash_size( &self->hash );
8223 0 : return size;
8224 0 : }
8225 :
8226 0 : int fd_slot_history_encode( fd_slot_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8227 0 : int err;
8228 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
8229 0 : if( FD_UNLIKELY( err ) ) return err;
8230 0 : if( self->has_bits ) {
8231 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
8232 0 : if( FD_UNLIKELY(err) ) return err;
8233 0 : if( self->bits_bitvec_len ) {
8234 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
8235 0 : err = fd_bincode_uint64_encode( self->bits_bitvec[i], ctx );
8236 0 : }
8237 0 : }
8238 0 : if( FD_UNLIKELY( err ) ) return err;
8239 0 : }
8240 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
8241 0 : if( FD_UNLIKELY( err ) ) return err;
8242 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
8243 0 : if( FD_UNLIKELY( err ) ) return err;
8244 0 : return FD_BINCODE_SUCCESS;
8245 0 : }
8246 0 : int fd_slot_history_encode_global( fd_slot_history_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8247 0 : int err;
8248 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
8249 0 : if( FD_UNLIKELY( err ) ) return err;
8250 0 : if( self->has_bits ) {
8251 0 : if( FD_UNLIKELY( err ) ) return err;
8252 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
8253 0 : if( FD_UNLIKELY( err ) ) return err;
8254 0 : if( self->bits_bitvec_len ) {
8255 0 : uchar * bits_bitvec_laddr = (uchar*)self + self->bits_bitvec_offset;
8256 0 : ulong * bits_bitvec = (ulong *)bits_bitvec_laddr;
8257 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
8258 0 : err = fd_bincode_uint64_encode( bits_bitvec[i], ctx );
8259 0 : if( FD_UNLIKELY( err ) ) return err;
8260 0 : }
8261 0 : }
8262 0 : if( FD_UNLIKELY( err ) ) return err;
8263 0 : }
8264 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
8265 0 : if( FD_UNLIKELY( err ) ) return err;
8266 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
8267 0 : if( FD_UNLIKELY( err ) ) return err;
8268 0 : return FD_BINCODE_SUCCESS;
8269 0 : }
8270 3 : static int fd_slot_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8271 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8272 3 : int err = 0;
8273 3 : {
8274 3 : uchar o;
8275 3 : ulong inner_len = 0UL;
8276 3 : err = fd_bincode_bool_decode( &o, ctx );
8277 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8278 3 : if( o ) {
8279 3 : ulong bits_bitvec_len;
8280 3 : err = fd_bincode_uint64_decode( &bits_bitvec_len, ctx );
8281 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8282 3 : if( bits_bitvec_len ) {
8283 3 : *total_sz += 8UL + sizeof(ulong)*bits_bitvec_len;
8284 49155 : for( ulong i=0; i < bits_bitvec_len; i++ ) {
8285 49152 : err = fd_bincode_uint64_decode_footprint( ctx );
8286 49152 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8287 49152 : }
8288 3 : }
8289 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8290 3 : inner_len = bits_bitvec_len;
8291 3 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
8292 3 : }
8293 3 : ulong len;
8294 3 : err = fd_bincode_uint64_decode( &len, ctx );
8295 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8296 3 : if( len > inner_len * sizeof(ulong) * 8UL ) return FD_BINCODE_ERR_ENCODING;
8297 3 : }
8298 3 : err = fd_bincode_uint64_decode_footprint( ctx );
8299 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8300 3 : return 0;
8301 3 : }
8302 3 : int fd_slot_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8303 3 : *total_sz += sizeof(fd_slot_history_t);
8304 3 : void const * start_data = ctx->data;
8305 3 : int err = fd_slot_history_decode_footprint_inner( ctx, total_sz );
8306 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8307 3 : ctx->data = start_data;
8308 3 : return err;
8309 3 : }
8310 0 : static void fd_slot_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8311 0 : fd_slot_history_t * self = (fd_slot_history_t *)struct_mem;
8312 0 : {
8313 0 : uchar o;
8314 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8315 0 : self->has_bits = !!o;
8316 0 : if( o ) {
8317 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
8318 0 : if( self->bits_bitvec_len ) {
8319 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
8320 0 : self->bits_bitvec = *alloc_mem;
8321 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
8322 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
8323 0 : fd_bincode_uint64_decode_unsafe( self->bits_bitvec + i, ctx );
8324 0 : }
8325 0 : } else
8326 0 : self->bits_bitvec = NULL;
8327 0 : } else {
8328 0 : self->bits_bitvec = NULL;
8329 0 : }
8330 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
8331 0 : }
8332 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
8333 0 : }
8334 0 : void * fd_slot_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8335 0 : fd_slot_history_t * self = (fd_slot_history_t *)mem;
8336 0 : fd_slot_history_new( self );
8337 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_t);
8338 0 : void * * alloc_mem = &alloc_region;
8339 0 : fd_slot_history_decode_inner( mem, alloc_mem, ctx );
8340 0 : return self;
8341 0 : }
8342 0 : static void fd_slot_history_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8343 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)struct_mem;
8344 0 : {
8345 0 : uchar o;
8346 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8347 0 : self->has_bits = !!o;
8348 0 : if( o ) {
8349 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
8350 0 : if( self->bits_bitvec_len ) {
8351 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
8352 0 : self->bits_bitvec_offset = (ulong)*alloc_mem - (ulong)struct_mem;
8353 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
8354 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
8355 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
8356 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
8357 0 : }
8358 0 : } else {
8359 0 : self->bits_bitvec_offset = 0UL;
8360 0 : }
8361 0 : }
8362 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
8363 0 : }
8364 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
8365 0 : }
8366 0 : void * fd_slot_history_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8367 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)mem;
8368 0 : fd_slot_history_new( (fd_slot_history_t *)self );
8369 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_global_t);
8370 0 : void * * alloc_mem = &alloc_region;
8371 0 : fd_slot_history_decode_inner_global( mem, alloc_mem, ctx );
8372 0 : return self;
8373 0 : }
8374 0 : void fd_slot_history_new(fd_slot_history_t * self) {
8375 0 : fd_memset( self, 0, sizeof(fd_slot_history_t) );
8376 0 : }
8377 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, uint varint ) {
8378 0 : (void) varint;
8379 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history", level++, 0 );
8380 0 : if( !self->has_bits ) {
8381 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
8382 0 : } else {
8383 0 : if( self->bits_bitvec_len ) {
8384 0 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
8385 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ )
8386 0 : fun( w, self->bits_bitvec + i, "bits_bitvec", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8387 0 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
8388 0 : }
8389 0 : }
8390 0 : fun( w, &self->bits_len, "bits_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8391 0 : fun( w, &self->next_slot, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8392 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history", level--, 0 );
8393 0 : }
8394 0 : ulong fd_slot_history_size( fd_slot_history_t const * self ) {
8395 0 : ulong size = 0;
8396 0 : size += sizeof(char);
8397 0 : if( self->has_bits ) {
8398 0 : do {
8399 0 : size += sizeof(ulong);
8400 0 : size += self->bits_bitvec_len * sizeof(ulong);
8401 0 : } while(0);
8402 0 : }
8403 0 : size += sizeof(ulong);
8404 0 : size += sizeof(ulong);
8405 0 : return size;
8406 0 : }
8407 :
8408 0 : ulong fd_slot_history_size_global( fd_slot_history_global_t const * self ) {
8409 0 : ulong size = 0;
8410 0 : do {
8411 0 : size += sizeof(char);
8412 0 : if( self->has_bits ) {
8413 0 : do {
8414 0 : size += sizeof(ulong);
8415 0 : ulong * bits_bitvec = self->bits_bitvec_offset ? (ulong *)fd_type_pun( (uchar *)self + self->bits_bitvec_offset ) : NULL;
8416 0 : size += self->bits_bitvec_len * sizeof(ulong);
8417 0 : } while(0);
8418 0 : }
8419 0 : } while(0);
8420 0 : size += sizeof(ulong);
8421 0 : return size;
8422 0 : }
8423 :
8424 0 : int fd_slot_hash_encode( fd_slot_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8425 0 : int err;
8426 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
8427 0 : if( FD_UNLIKELY( err ) ) return err;
8428 0 : err = fd_hash_encode( &self->hash, ctx );
8429 0 : if( FD_UNLIKELY( err ) ) return err;
8430 0 : return FD_BINCODE_SUCCESS;
8431 0 : }
8432 3 : static inline int fd_slot_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8433 3 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8434 3 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
8435 3 : return 0;
8436 3 : }
8437 3 : static void fd_slot_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8438 3 : fd_slot_hash_t * self = (fd_slot_hash_t *)struct_mem;
8439 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
8440 3 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
8441 3 : }
8442 0 : void * fd_slot_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8443 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)mem;
8444 0 : fd_slot_hash_new( self );
8445 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hash_t);
8446 0 : void * * alloc_mem = &alloc_region;
8447 0 : fd_slot_hash_decode_inner( mem, alloc_mem, ctx );
8448 0 : return self;
8449 0 : }
8450 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, uint varint ) {
8451 3 : (void) varint;
8452 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hash", level++, 0 );
8453 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8454 3 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
8455 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hash", level--, 0 );
8456 3 : }
8457 0 : int fd_slot_hashes_encode( fd_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8458 0 : int err;
8459 0 : if( self->hashes ) {
8460 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( self->hashes );
8461 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
8462 0 : if( FD_UNLIKELY( err ) ) return err;
8463 0 : 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 ) ) {
8464 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( self->hashes, iter );
8465 0 : err = fd_slot_hash_encode( ele, ctx );
8466 0 : if( FD_UNLIKELY( err ) ) return err;
8467 0 : }
8468 0 : } else {
8469 0 : ulong hashes_len = 0;
8470 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
8471 0 : if( FD_UNLIKELY( err ) ) return err;
8472 0 : }
8473 0 : return FD_BINCODE_SUCCESS;
8474 0 : }
8475 0 : int fd_slot_hashes_encode_global( fd_slot_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8476 0 : int err;
8477 0 : if( self->hashes_offset ) {
8478 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
8479 0 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join( hashes_laddr );
8480 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( hashes );
8481 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
8482 0 : if( FD_UNLIKELY( err ) ) return err;
8483 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( hashes ); !deq_fd_slot_hash_t_iter_done( hashes, iter ); iter = deq_fd_slot_hash_t_iter_next( hashes, iter ) ) {
8484 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( hashes, iter );
8485 0 : err = fd_slot_hash_encode( ele, ctx );
8486 0 : if( FD_UNLIKELY( err ) ) return err;
8487 0 : }
8488 0 : } else {
8489 0 : ulong hashes_len = 0;
8490 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
8491 0 : if( FD_UNLIKELY( err ) ) return err;
8492 0 : }
8493 0 : return FD_BINCODE_SUCCESS;
8494 0 : }
8495 3 : static int fd_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8496 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8497 3 : int err = 0;
8498 3 : ulong hashes_len;
8499 3 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
8500 3 : if( FD_UNLIKELY( err ) ) return err;
8501 3 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
8502 3 : *total_sz += deq_fd_slot_hash_t_align() + deq_fd_slot_hash_t_footprint( hashes_max );
8503 3 : ulong hashes_sz;
8504 3 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
8505 3 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
8506 3 : if( FD_UNLIKELY( err ) ) return err;
8507 3 : return 0;
8508 3 : }
8509 3 : int fd_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8510 3 : *total_sz += sizeof(fd_slot_hashes_t);
8511 3 : void const * start_data = ctx->data;
8512 3 : int err = fd_slot_hashes_decode_footprint_inner( ctx, total_sz );
8513 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8514 3 : ctx->data = start_data;
8515 3 : return err;
8516 3 : }
8517 0 : static void fd_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8518 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)struct_mem;
8519 0 : ulong hashes_len;
8520 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
8521 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
8522 0 : self->hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
8523 0 : for( ulong i=0; i < hashes_len; i++ ) {
8524 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( self->hashes );
8525 0 : fd_slot_hash_new( elem );
8526 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
8527 0 : }
8528 0 : }
8529 0 : void * fd_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8530 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)mem;
8531 0 : fd_slot_hashes_new( self );
8532 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_t);
8533 0 : void * * alloc_mem = &alloc_region;
8534 0 : fd_slot_hashes_decode_inner( mem, alloc_mem, ctx );
8535 0 : return self;
8536 0 : }
8537 0 : static void fd_slot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8538 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)struct_mem;
8539 0 : ulong hashes_len;
8540 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
8541 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_slot_hash_t_align() );
8542 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
8543 0 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
8544 0 : for( ulong i=0; i < hashes_len; i++ ) {
8545 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( hashes );
8546 0 : fd_slot_hash_new( (fd_slot_hash_t*)fd_type_pun( elem ) );
8547 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
8548 0 : }
8549 0 : self->hashes_offset = (ulong)deq_fd_slot_hash_t_leave( hashes ) - (ulong)struct_mem;
8550 0 : }
8551 0 : void * fd_slot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8552 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)mem;
8553 0 : fd_slot_hashes_new( (fd_slot_hashes_t *)self );
8554 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_global_t);
8555 0 : void * * alloc_mem = &alloc_region;
8556 0 : fd_slot_hashes_decode_inner_global( mem, alloc_mem, ctx );
8557 0 : return self;
8558 0 : }
8559 0 : void fd_slot_hashes_new(fd_slot_hashes_t * self) {
8560 0 : fd_memset( self, 0, sizeof(fd_slot_hashes_t) );
8561 0 : }
8562 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, uint varint ) {
8563 0 : (void) varint;
8564 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hashes", level++, 0 );
8565 :
8566 : /* Walk deque */
8567 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++, 0 );
8568 0 : if( self->hashes ) {
8569 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( self->hashes );
8570 0 : !deq_fd_slot_hash_t_iter_done( self->hashes, iter );
8571 0 : iter = deq_fd_slot_hash_t_iter_next( self->hashes, iter ) ) {
8572 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
8573 0 : fd_slot_hash_walk(w, ele, fun, "hashes", level, 0 );
8574 0 : }
8575 0 : }
8576 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level--, 0 );
8577 : /* Done walking deque */
8578 :
8579 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hashes", level--, 0 );
8580 0 : }
8581 0 : ulong fd_slot_hashes_size( fd_slot_hashes_t const * self ) {
8582 0 : ulong size = 0;
8583 0 : if( self->hashes ) {
8584 0 : size += sizeof(ulong);
8585 0 : 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 ) ) {
8586 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
8587 0 : size += fd_slot_hash_size( ele );
8588 0 : }
8589 0 : } else {
8590 0 : size += sizeof(ulong);
8591 0 : }
8592 0 : return size;
8593 0 : }
8594 :
8595 0 : ulong fd_slot_hashes_size_global( fd_slot_hashes_global_t const * self ) {
8596 0 : ulong size = 0;
8597 0 : if( self->hashes_offset!=0 ) {
8598 0 : fd_slot_hash_t * hashes = (fd_slot_hash_t *)deq_fd_slot_hash_t_join( fd_type_pun( (uchar *)self + self->hashes_offset ) );
8599 0 : size += sizeof(ulong);
8600 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( hashes ); !deq_fd_slot_hash_t_iter_done( hashes, iter ); iter = deq_fd_slot_hash_t_iter_next( hashes, iter ) ) {
8601 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( hashes, iter );
8602 0 : size += fd_slot_hash_size( ele );
8603 0 : }
8604 0 : } else {
8605 0 : size += sizeof(ulong);
8606 0 : }
8607 0 : return size;
8608 0 : }
8609 :
8610 0 : int fd_block_block_hash_entry_encode( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8611 0 : int err;
8612 0 : err = fd_hash_encode( &self->blockhash, ctx );
8613 0 : if( FD_UNLIKELY( err ) ) return err;
8614 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
8615 0 : if( FD_UNLIKELY( err ) ) return err;
8616 0 : return FD_BINCODE_SUCCESS;
8617 0 : }
8618 0 : static inline int fd_block_block_hash_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8619 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8620 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
8621 0 : return 0;
8622 0 : }
8623 0 : static void fd_block_block_hash_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8624 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)struct_mem;
8625 0 : fd_hash_decode_inner( &self->blockhash, alloc_mem, ctx );
8626 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
8627 0 : }
8628 0 : void * fd_block_block_hash_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8629 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)mem;
8630 0 : fd_block_block_hash_entry_new( self );
8631 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_block_hash_entry_t);
8632 0 : void * * alloc_mem = &alloc_region;
8633 0 : fd_block_block_hash_entry_decode_inner( mem, alloc_mem, ctx );
8634 0 : return self;
8635 0 : }
8636 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, uint varint ) {
8637 0 : (void) varint;
8638 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_block_hash_entry", level++, 0 );
8639 0 : fd_hash_walk( w, &self->blockhash, fun, "blockhash", level, 0 );
8640 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
8641 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_block_hash_entry", level--, 0 );
8642 0 : }
8643 0 : int fd_recent_block_hashes_encode( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8644 0 : int err;
8645 0 : if( self->hashes ) {
8646 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
8647 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
8648 0 : if( FD_UNLIKELY( err ) ) return err;
8649 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 ) ) {
8650 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
8651 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
8652 0 : if( FD_UNLIKELY( err ) ) return err;
8653 0 : }
8654 0 : } else {
8655 0 : ulong hashes_len = 0;
8656 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
8657 0 : if( FD_UNLIKELY( err ) ) return err;
8658 0 : }
8659 0 : return FD_BINCODE_SUCCESS;
8660 0 : }
8661 0 : int fd_recent_block_hashes_encode_global( fd_recent_block_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8662 0 : int err;
8663 0 : if( self->hashes_offset ) {
8664 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
8665 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join( hashes_laddr );
8666 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( hashes );
8667 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
8668 0 : if( FD_UNLIKELY( err ) ) return err;
8669 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( hashes ); !deq_fd_block_block_hash_entry_t_iter_done( hashes, iter ); iter = deq_fd_block_block_hash_entry_t_iter_next( hashes, iter ) ) {
8670 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( hashes, iter );
8671 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
8672 0 : if( FD_UNLIKELY( err ) ) return err;
8673 0 : }
8674 0 : } else {
8675 0 : ulong hashes_len = 0;
8676 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
8677 0 : if( FD_UNLIKELY( err ) ) return err;
8678 0 : }
8679 0 : return FD_BINCODE_SUCCESS;
8680 0 : }
8681 0 : static int fd_recent_block_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8682 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8683 0 : int err = 0;
8684 0 : ulong hashes_len;
8685 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
8686 0 : if( FD_UNLIKELY( err ) ) return err;
8687 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
8688 0 : *total_sz += deq_fd_block_block_hash_entry_t_align() + deq_fd_block_block_hash_entry_t_footprint( hashes_max );
8689 0 : ulong hashes_sz;
8690 0 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
8691 0 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
8692 0 : if( FD_UNLIKELY( err ) ) return err;
8693 0 : return 0;
8694 0 : }
8695 0 : int fd_recent_block_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8696 0 : *total_sz += sizeof(fd_recent_block_hashes_t);
8697 0 : void const * start_data = ctx->data;
8698 0 : int err = fd_recent_block_hashes_decode_footprint_inner( ctx, total_sz );
8699 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8700 0 : ctx->data = start_data;
8701 0 : return err;
8702 0 : }
8703 0 : static void fd_recent_block_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8704 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)struct_mem;
8705 0 : ulong hashes_len;
8706 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
8707 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
8708 0 : self->hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
8709 0 : for( ulong i=0; i < hashes_len; i++ ) {
8710 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
8711 0 : fd_block_block_hash_entry_new( elem );
8712 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
8713 0 : }
8714 0 : }
8715 0 : void * fd_recent_block_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8716 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)mem;
8717 0 : fd_recent_block_hashes_new( self );
8718 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_t);
8719 0 : void * * alloc_mem = &alloc_region;
8720 0 : fd_recent_block_hashes_decode_inner( mem, alloc_mem, ctx );
8721 0 : return self;
8722 0 : }
8723 0 : static void fd_recent_block_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8724 0 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)struct_mem;
8725 0 : ulong hashes_len;
8726 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
8727 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_block_block_hash_entry_t_align() );
8728 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
8729 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
8730 0 : for( ulong i=0; i < hashes_len; i++ ) {
8731 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( hashes );
8732 0 : fd_block_block_hash_entry_new( (fd_block_block_hash_entry_t*)fd_type_pun( elem ) );
8733 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
8734 0 : }
8735 0 : self->hashes_offset = (ulong)deq_fd_block_block_hash_entry_t_leave( hashes ) - (ulong)struct_mem;
8736 0 : }
8737 0 : void * fd_recent_block_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8738 0 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)mem;
8739 0 : fd_recent_block_hashes_new( (fd_recent_block_hashes_t *)self );
8740 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_global_t);
8741 0 : void * * alloc_mem = &alloc_region;
8742 0 : fd_recent_block_hashes_decode_inner_global( mem, alloc_mem, ctx );
8743 0 : return self;
8744 0 : }
8745 0 : void fd_recent_block_hashes_new(fd_recent_block_hashes_t * self) {
8746 0 : fd_memset( self, 0, sizeof(fd_recent_block_hashes_t) );
8747 0 : }
8748 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, uint varint ) {
8749 0 : (void) varint;
8750 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_recent_block_hashes", level++, 0 );
8751 :
8752 : /* Walk deque */
8753 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++, 0 );
8754 0 : if( self->hashes ) {
8755 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes );
8756 0 : !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter );
8757 0 : iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
8758 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
8759 0 : fd_block_block_hash_entry_walk(w, ele, fun, "hashes", level, 0 );
8760 0 : }
8761 0 : }
8762 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level--, 0 );
8763 : /* Done walking deque */
8764 :
8765 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_recent_block_hashes", level--, 0 );
8766 0 : }
8767 0 : ulong fd_recent_block_hashes_size( fd_recent_block_hashes_t const * self ) {
8768 0 : ulong size = 0;
8769 0 : if( self->hashes ) {
8770 0 : size += sizeof(ulong);
8771 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 ) ) {
8772 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
8773 0 : size += fd_block_block_hash_entry_size( ele );
8774 0 : }
8775 0 : } else {
8776 0 : size += sizeof(ulong);
8777 0 : }
8778 0 : return size;
8779 0 : }
8780 :
8781 0 : ulong fd_recent_block_hashes_size_global( fd_recent_block_hashes_global_t const * self ) {
8782 0 : ulong size = 0;
8783 0 : if( self->hashes_offset!=0 ) {
8784 0 : fd_block_block_hash_entry_t * hashes = (fd_block_block_hash_entry_t *)deq_fd_block_block_hash_entry_t_join( fd_type_pun( (uchar *)self + self->hashes_offset ) );
8785 0 : size += sizeof(ulong);
8786 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( hashes ); !deq_fd_block_block_hash_entry_t_iter_done( hashes, iter ); iter = deq_fd_block_block_hash_entry_t_iter_next( hashes, iter ) ) {
8787 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( hashes, iter );
8788 0 : size += fd_block_block_hash_entry_size( ele );
8789 0 : }
8790 0 : } else {
8791 0 : size += sizeof(ulong);
8792 0 : }
8793 0 : return size;
8794 0 : }
8795 :
8796 0 : int fd_slot_meta_encode( fd_slot_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8797 0 : int err;
8798 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
8799 0 : if( FD_UNLIKELY( err ) ) return err;
8800 0 : err = fd_bincode_uint64_encode( self->consumed, ctx );
8801 0 : if( FD_UNLIKELY( err ) ) return err;
8802 0 : err = fd_bincode_uint64_encode( self->received, ctx );
8803 0 : if( FD_UNLIKELY( err ) ) return err;
8804 0 : err = fd_bincode_uint64_encode( (ulong)self->first_shred_timestamp, ctx );
8805 0 : if( FD_UNLIKELY( err ) ) return err;
8806 0 : err = fd_bincode_uint64_encode( self->last_index, ctx );
8807 0 : if( FD_UNLIKELY( err ) ) return err;
8808 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
8809 0 : if( FD_UNLIKELY( err ) ) return err;
8810 0 : err = fd_bincode_uint64_encode( self->next_slot_len, ctx );
8811 0 : if( FD_UNLIKELY(err) ) return err;
8812 0 : if( self->next_slot_len ) {
8813 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
8814 0 : err = fd_bincode_uint64_encode( self->next_slot[i], ctx );
8815 0 : }
8816 0 : }
8817 0 : err = fd_bincode_uint8_encode( (uchar)(self->is_connected), ctx );
8818 0 : if( FD_UNLIKELY( err ) ) return err;
8819 0 : err = fd_bincode_uint64_encode( self->entry_end_indexes_len, ctx );
8820 0 : if( FD_UNLIKELY(err) ) return err;
8821 0 : if( self->entry_end_indexes_len ) {
8822 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
8823 0 : err = fd_bincode_uint32_encode( self->entry_end_indexes[i], ctx );
8824 0 : }
8825 0 : }
8826 0 : return FD_BINCODE_SUCCESS;
8827 0 : }
8828 0 : static int fd_slot_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8829 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8830 0 : int err = 0;
8831 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8832 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8833 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8834 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8835 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8836 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8837 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8838 0 : if( FD_UNLIKELY( err ) ) return err;
8839 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8840 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8841 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8842 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8843 0 : ulong next_slot_len;
8844 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
8845 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8846 0 : if( next_slot_len ) {
8847 0 : *total_sz += 8UL + sizeof(ulong)*next_slot_len;
8848 0 : for( ulong i=0; i < next_slot_len; i++ ) {
8849 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8850 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8851 0 : }
8852 0 : }
8853 0 : err = fd_bincode_uint8_decode_footprint( ctx );
8854 0 : if( FD_UNLIKELY( err ) ) return err;
8855 0 : ulong entry_end_indexes_len;
8856 0 : err = fd_bincode_uint64_decode( &entry_end_indexes_len, ctx );
8857 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8858 0 : if( entry_end_indexes_len ) {
8859 0 : *total_sz += 8UL + sizeof(uint)*entry_end_indexes_len;
8860 0 : for( ulong i=0; i < entry_end_indexes_len; i++ ) {
8861 0 : err = fd_bincode_uint32_decode_footprint( ctx );
8862 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8863 0 : }
8864 0 : }
8865 0 : return 0;
8866 0 : }
8867 0 : int fd_slot_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8868 0 : *total_sz += sizeof(fd_slot_meta_t);
8869 0 : void const * start_data = ctx->data;
8870 0 : int err = fd_slot_meta_decode_footprint_inner( ctx, total_sz );
8871 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8872 0 : ctx->data = start_data;
8873 0 : return err;
8874 0 : }
8875 0 : static void fd_slot_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8876 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)struct_mem;
8877 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
8878 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
8879 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
8880 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
8881 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
8882 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
8883 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
8884 0 : if( self->next_slot_len ) {
8885 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
8886 0 : self->next_slot = *alloc_mem;
8887 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->next_slot_len;
8888 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
8889 0 : fd_bincode_uint64_decode_unsafe( self->next_slot + i, ctx );
8890 0 : }
8891 0 : } else
8892 0 : self->next_slot = NULL;
8893 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
8894 0 : fd_bincode_uint64_decode_unsafe( &self->entry_end_indexes_len, ctx );
8895 0 : if( self->entry_end_indexes_len ) {
8896 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
8897 0 : self->entry_end_indexes = *alloc_mem;
8898 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(uint)*self->entry_end_indexes_len;
8899 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
8900 0 : fd_bincode_uint32_decode_unsafe( self->entry_end_indexes + i, ctx );
8901 0 : }
8902 0 : } else
8903 0 : self->entry_end_indexes = NULL;
8904 0 : }
8905 0 : void * fd_slot_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8906 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)mem;
8907 0 : fd_slot_meta_new( self );
8908 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_meta_t);
8909 0 : void * * alloc_mem = &alloc_region;
8910 0 : fd_slot_meta_decode_inner( mem, alloc_mem, ctx );
8911 0 : return self;
8912 0 : }
8913 0 : void fd_slot_meta_new(fd_slot_meta_t * self) {
8914 0 : fd_memset( self, 0, sizeof(fd_slot_meta_t) );
8915 0 : }
8916 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, uint varint ) {
8917 0 : (void) varint;
8918 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_meta", level++, 0 );
8919 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8920 0 : fun( w, &self->consumed, "consumed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8921 0 : fun( w, &self->received, "received", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8922 0 : fun( w, &self->first_shred_timestamp, "first_shred_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
8923 0 : fun( w, &self->last_index, "last_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8924 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8925 0 : if( self->next_slot_len ) {
8926 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
8927 0 : for( ulong i=0; i < self->next_slot_len; i++ )
8928 0 : fun( w, self->next_slot + i, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8929 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
8930 0 : }
8931 0 : fun( w, &self->is_connected, "is_connected", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
8932 0 : if( self->entry_end_indexes_len ) {
8933 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
8934 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ )
8935 0 : fun( w, self->entry_end_indexes + i, "entry_end_indexes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
8936 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
8937 0 : }
8938 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_meta", level--, 0 );
8939 0 : }
8940 0 : ulong fd_slot_meta_size( fd_slot_meta_t const * self ) {
8941 0 : ulong size = 0;
8942 0 : size += sizeof(ulong);
8943 0 : size += sizeof(ulong);
8944 0 : size += sizeof(ulong);
8945 0 : size += sizeof(long);
8946 0 : size += sizeof(ulong);
8947 0 : size += sizeof(ulong);
8948 0 : do {
8949 0 : size += sizeof(ulong);
8950 0 : size += self->next_slot_len * sizeof(ulong);
8951 0 : } while(0);
8952 0 : size += sizeof(char);
8953 0 : do {
8954 0 : size += sizeof(ulong);
8955 0 : size += self->entry_end_indexes_len * sizeof(uint);
8956 0 : } while(0);
8957 0 : return size;
8958 0 : }
8959 :
8960 0 : int fd_clock_timestamp_vote_encode( fd_clock_timestamp_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8961 0 : int err;
8962 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
8963 0 : if( FD_UNLIKELY( err ) ) return err;
8964 0 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
8965 0 : if( FD_UNLIKELY( err ) ) return err;
8966 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
8967 0 : if( FD_UNLIKELY( err ) ) return err;
8968 0 : return FD_BINCODE_SUCCESS;
8969 0 : }
8970 0 : static inline int fd_clock_timestamp_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8971 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8972 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
8973 0 : return 0;
8974 0 : }
8975 0 : static void fd_clock_timestamp_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8976 0 : fd_clock_timestamp_vote_t * self = (fd_clock_timestamp_vote_t *)struct_mem;
8977 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
8978 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
8979 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
8980 0 : }
8981 0 : void * fd_clock_timestamp_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8982 0 : fd_clock_timestamp_vote_t * self = (fd_clock_timestamp_vote_t *)mem;
8983 0 : fd_clock_timestamp_vote_new( self );
8984 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_vote_t);
8985 0 : void * * alloc_mem = &alloc_region;
8986 0 : fd_clock_timestamp_vote_decode_inner( mem, alloc_mem, ctx );
8987 0 : return self;
8988 0 : }
8989 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, uint varint ) {
8990 0 : (void) varint;
8991 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_vote", level++, 0 );
8992 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
8993 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
8994 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8995 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_vote", level--, 0 );
8996 0 : }
8997 0 : int fd_clock_timestamp_votes_encode( fd_clock_timestamp_votes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8998 0 : int err;
8999 0 : if( self->votes_root ) {
9000 0 : ulong votes_len = fd_clock_timestamp_vote_t_map_size( self->votes_pool, self->votes_root );
9001 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
9002 0 : if( FD_UNLIKELY( err ) ) return err;
9003 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 ) ) {
9004 0 : err = fd_clock_timestamp_vote_encode( &n->elem, ctx );
9005 0 : if( FD_UNLIKELY( err ) ) return err;
9006 0 : }
9007 0 : } else {
9008 0 : ulong votes_len = 0;
9009 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
9010 0 : if( FD_UNLIKELY( err ) ) return err;
9011 0 : }
9012 0 : return FD_BINCODE_SUCCESS;
9013 0 : }
9014 0 : int fd_clock_timestamp_votes_encode_global( fd_clock_timestamp_votes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9015 0 : int err;
9016 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_root = fd_clock_timestamp_vote_t_map_join( (uchar *)self + self->votes_root_offset );
9017 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_pool = fd_clock_timestamp_vote_t_map_join( (uchar *)self + self->votes_pool_offset );
9018 0 : if( votes_root ) {
9019 0 : ulong votes_len = fd_clock_timestamp_vote_t_map_size( votes_pool, votes_root );
9020 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
9021 0 : if( FD_UNLIKELY( err ) ) return err;
9022 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum( votes_pool, votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( votes_pool, n ) ) {
9023 0 : err = fd_clock_timestamp_vote_encode( &n->elem, ctx );
9024 0 : if( FD_UNLIKELY( err ) ) return err;
9025 0 : }
9026 0 : } else {
9027 0 : ulong votes_len = 0;
9028 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
9029 0 : if( FD_UNLIKELY( err ) ) return err;
9030 0 : }
9031 0 : return FD_BINCODE_SUCCESS;
9032 0 : }
9033 0 : static int fd_clock_timestamp_votes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9034 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9035 0 : int err = 0;
9036 0 : ulong votes_len = 0UL;
9037 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
9038 0 : ulong votes_cnt = fd_ulong_max( votes_len, 15000 );
9039 0 : *total_sz += fd_clock_timestamp_vote_t_map_align() + fd_clock_timestamp_vote_t_map_footprint( votes_cnt );
9040 0 : if( FD_UNLIKELY( err ) ) return err;
9041 0 : for( ulong i=0; i < votes_len; i++ ) {
9042 0 : err = fd_clock_timestamp_vote_decode_footprint_inner( ctx, total_sz );
9043 0 : if( FD_UNLIKELY( err ) ) return err;
9044 0 : }
9045 0 : return 0;
9046 0 : }
9047 0 : int fd_clock_timestamp_votes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9048 0 : *total_sz += sizeof(fd_clock_timestamp_votes_t);
9049 0 : void const * start_data = ctx->data;
9050 0 : int err = fd_clock_timestamp_votes_decode_footprint_inner( ctx, total_sz );
9051 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9052 0 : ctx->data = start_data;
9053 0 : return err;
9054 0 : }
9055 0 : static void fd_clock_timestamp_votes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9056 0 : fd_clock_timestamp_votes_t * self = (fd_clock_timestamp_votes_t *)struct_mem;
9057 0 : ulong votes_len;
9058 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
9059 0 : self->votes_pool = fd_clock_timestamp_vote_t_map_join_new( alloc_mem, fd_ulong_max( votes_len, 15000 ) );
9060 0 : self->votes_root = NULL;
9061 0 : for( ulong i=0; i < votes_len; i++ ) {
9062 0 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( self->votes_pool );
9063 0 : fd_clock_timestamp_vote_new( &node->elem );
9064 0 : fd_clock_timestamp_vote_decode_inner( &node->elem, alloc_mem, ctx );
9065 0 : fd_clock_timestamp_vote_t_mapnode_t * out = NULL;;
9066 0 : fd_clock_timestamp_vote_t_map_insert_or_replace( self->votes_pool, &self->votes_root, node, &out );
9067 0 : if( out != NULL ) {
9068 0 : fd_clock_timestamp_vote_t_map_release( self->votes_pool, out );
9069 0 : }
9070 0 : }
9071 0 : }
9072 0 : void * fd_clock_timestamp_votes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9073 0 : fd_clock_timestamp_votes_t * self = (fd_clock_timestamp_votes_t *)mem;
9074 0 : fd_clock_timestamp_votes_new( self );
9075 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_votes_t);
9076 0 : void * * alloc_mem = &alloc_region;
9077 0 : fd_clock_timestamp_votes_decode_inner( mem, alloc_mem, ctx );
9078 0 : return self;
9079 0 : }
9080 0 : static void fd_clock_timestamp_votes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9081 0 : fd_clock_timestamp_votes_global_t * self = (fd_clock_timestamp_votes_global_t *)struct_mem;
9082 0 : ulong votes_len;
9083 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
9084 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_clock_timestamp_vote_t_map_align() );
9085 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_pool = fd_clock_timestamp_vote_t_map_join_new( alloc_mem, fd_ulong_max( votes_len, 15000 ) );
9086 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_root = NULL;
9087 0 : for( ulong i=0; i < votes_len; i++ ) {
9088 0 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( votes_pool );
9089 0 : fd_clock_timestamp_vote_new( (fd_clock_timestamp_vote_t *)fd_type_pun(&node->elem) );
9090 0 : fd_clock_timestamp_vote_decode_inner( &node->elem, alloc_mem, ctx );
9091 0 : fd_clock_timestamp_vote_t_map_insert( votes_pool, &votes_root, node );
9092 0 : }
9093 0 : self->votes_pool_offset = (ulong)fd_clock_timestamp_vote_t_map_leave( votes_pool ) - (ulong)struct_mem;
9094 0 : self->votes_root_offset = (ulong)votes_root - (ulong)struct_mem;
9095 0 : }
9096 0 : void * fd_clock_timestamp_votes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9097 0 : fd_clock_timestamp_votes_global_t * self = (fd_clock_timestamp_votes_global_t *)mem;
9098 0 : fd_clock_timestamp_votes_new( (fd_clock_timestamp_votes_t *)self );
9099 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_votes_global_t);
9100 0 : void * * alloc_mem = &alloc_region;
9101 0 : fd_clock_timestamp_votes_decode_inner_global( mem, alloc_mem, ctx );
9102 0 : return self;
9103 0 : }
9104 0 : void fd_clock_timestamp_votes_new(fd_clock_timestamp_votes_t * self) {
9105 0 : fd_memset( self, 0, sizeof(fd_clock_timestamp_votes_t) );
9106 0 : }
9107 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, uint varint ) {
9108 0 : (void) varint;
9109 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_votes", level++, 0 );
9110 0 : if( self->votes_root ) {
9111 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 ) ) {
9112 0 : fd_clock_timestamp_vote_walk(w, &n->elem, fun, "votes", level, 0 );
9113 0 : }
9114 0 : }
9115 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_votes", level--, 0 );
9116 0 : }
9117 0 : ulong fd_clock_timestamp_votes_size( fd_clock_timestamp_votes_t const * self ) {
9118 0 : ulong size = 0;
9119 0 : if( self->votes_root ) {
9120 0 : size += sizeof(ulong);
9121 0 : ulong max = fd_clock_timestamp_vote_t_map_max( self->votes_pool );
9122 0 : size += fd_clock_timestamp_vote_t_map_footprint( max );
9123 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 ) ) {
9124 0 : size += fd_clock_timestamp_vote_size( &n->elem ) - sizeof(fd_clock_timestamp_vote_t);
9125 0 : }
9126 0 : } else {
9127 0 : size += sizeof(ulong);
9128 0 : }
9129 0 : return size;
9130 0 : }
9131 :
9132 0 : ulong fd_clock_timestamp_votes_size_global( fd_clock_timestamp_votes_global_t const * self ) {
9133 0 : ulong size = 0;
9134 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_pool = !!self->votes_pool_offset ? (fd_clock_timestamp_vote_t_mapnode_t *)fd_clock_timestamp_vote_t_map_join( fd_type_pun( (uchar *)self + self->votes_pool_offset ) ) : NULL;
9135 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_root = !!self->votes_root_offset ? (fd_clock_timestamp_vote_t_mapnode_t *)fd_type_pun( (uchar *)self + self->votes_root_offset ) : NULL;
9136 0 : if( votes_root ) {
9137 0 : size += sizeof(ulong);
9138 0 : ulong max = fd_clock_timestamp_vote_t_map_max( votes_pool );
9139 0 : size += fd_clock_timestamp_vote_t_map_footprint( max );
9140 0 : for( fd_clock_timestamp_vote_t_mapnode_t * n = fd_clock_timestamp_vote_t_map_minimum( votes_pool, votes_root ); n; n = fd_clock_timestamp_vote_t_map_successor( votes_pool, n ) ) {
9141 0 : size += fd_clock_timestamp_vote_size( &n->elem ) - sizeof(fd_clock_timestamp_vote_t);
9142 0 : }
9143 0 : } else {
9144 0 : size += sizeof(ulong);
9145 0 : }
9146 0 : return size;
9147 0 : }
9148 :
9149 0 : int fd_sysvar_fees_encode( fd_sysvar_fees_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9150 0 : int err;
9151 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
9152 0 : if( FD_UNLIKELY( err ) ) return err;
9153 0 : return FD_BINCODE_SUCCESS;
9154 0 : }
9155 0 : static inline int fd_sysvar_fees_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9156 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9157 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
9158 0 : return 0;
9159 0 : }
9160 0 : static void fd_sysvar_fees_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9161 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)struct_mem;
9162 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
9163 0 : }
9164 0 : void * fd_sysvar_fees_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9165 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)mem;
9166 0 : fd_sysvar_fees_new( self );
9167 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_fees_t);
9168 0 : void * * alloc_mem = &alloc_region;
9169 0 : fd_sysvar_fees_decode_inner( mem, alloc_mem, ctx );
9170 0 : return self;
9171 0 : }
9172 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, uint varint ) {
9173 0 : (void) varint;
9174 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_fees", level++, 0 );
9175 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
9176 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_fees", level--, 0 );
9177 0 : }
9178 0 : int fd_sysvar_epoch_rewards_encode( fd_sysvar_epoch_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9179 0 : int err;
9180 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
9181 0 : if( FD_UNLIKELY( err ) ) return err;
9182 0 : err = fd_bincode_uint64_encode( self->num_partitions, ctx );
9183 0 : if( FD_UNLIKELY( err ) ) return err;
9184 0 : err = fd_hash_encode( &self->parent_blockhash, ctx );
9185 0 : if( FD_UNLIKELY( err ) ) return err;
9186 0 : err = fd_bincode_uint128_encode( self->total_points, ctx );
9187 0 : if( FD_UNLIKELY( err ) ) return err;
9188 0 : err = fd_bincode_uint64_encode( self->total_rewards, ctx );
9189 0 : if( FD_UNLIKELY( err ) ) return err;
9190 0 : err = fd_bincode_uint64_encode( self->distributed_rewards, ctx );
9191 0 : if( FD_UNLIKELY( err ) ) return err;
9192 0 : err = fd_bincode_bool_encode( (uchar)(self->active), ctx );
9193 0 : if( FD_UNLIKELY( err ) ) return err;
9194 0 : return FD_BINCODE_SUCCESS;
9195 0 : }
9196 3 : static int fd_sysvar_epoch_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9197 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9198 3 : int err = 0;
9199 3 : err = fd_bincode_uint64_decode_footprint( ctx );
9200 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9201 3 : err = fd_bincode_uint64_decode_footprint( ctx );
9202 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9203 3 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
9204 3 : if( FD_UNLIKELY( err ) ) return err;
9205 3 : err = fd_bincode_uint128_decode_footprint( ctx );
9206 3 : if( FD_UNLIKELY( err ) ) return err;
9207 3 : err = fd_bincode_uint64_decode_footprint( ctx );
9208 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9209 3 : err = fd_bincode_uint64_decode_footprint( ctx );
9210 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9211 3 : err = fd_bincode_bool_decode_footprint( ctx );
9212 3 : if( FD_UNLIKELY( err ) ) return err;
9213 3 : return 0;
9214 3 : }
9215 3 : int fd_sysvar_epoch_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9216 3 : *total_sz += sizeof(fd_sysvar_epoch_rewards_t);
9217 3 : void const * start_data = ctx->data;
9218 3 : int err = fd_sysvar_epoch_rewards_decode_footprint_inner( ctx, total_sz );
9219 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9220 3 : ctx->data = start_data;
9221 3 : return err;
9222 3 : }
9223 0 : static void fd_sysvar_epoch_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9224 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)struct_mem;
9225 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
9226 0 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
9227 0 : fd_hash_decode_inner( &self->parent_blockhash, alloc_mem, ctx );
9228 0 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
9229 0 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
9230 0 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
9231 0 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
9232 0 : }
9233 0 : void * fd_sysvar_epoch_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9234 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)mem;
9235 0 : fd_sysvar_epoch_rewards_new( self );
9236 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_epoch_rewards_t);
9237 0 : void * * alloc_mem = &alloc_region;
9238 0 : fd_sysvar_epoch_rewards_decode_inner( mem, alloc_mem, ctx );
9239 0 : return self;
9240 0 : }
9241 0 : void fd_sysvar_epoch_rewards_new(fd_sysvar_epoch_rewards_t * self) {
9242 0 : fd_memset( self, 0, sizeof(fd_sysvar_epoch_rewards_t) );
9243 0 : fd_hash_new( &self->parent_blockhash );
9244 0 : }
9245 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, uint varint ) {
9246 0 : (void) varint;
9247 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_epoch_rewards", level++, 0 );
9248 0 : fun( w, &self->distribution_starting_block_height, "distribution_starting_block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9249 0 : fun( w, &self->num_partitions, "num_partitions", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9250 0 : fd_hash_walk( w, &self->parent_blockhash, fun, "parent_blockhash", level, 0 );
9251 0 : fun( w, &self->total_points, "total_points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
9252 0 : fun( w, &self->total_rewards, "total_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9253 0 : fun( w, &self->distributed_rewards, "distributed_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9254 0 : fun( w, &self->active, "active", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
9255 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_epoch_rewards", level--, 0 );
9256 0 : }
9257 0 : int fd_config_keys_pair_encode( fd_config_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9258 0 : int err;
9259 0 : err = fd_pubkey_encode( &self->key, ctx );
9260 0 : if( FD_UNLIKELY( err ) ) return err;
9261 0 : err = fd_bincode_bool_encode( (uchar)(self->signer), ctx );
9262 0 : if( FD_UNLIKELY( err ) ) return err;
9263 0 : return FD_BINCODE_SUCCESS;
9264 0 : }
9265 0 : static int fd_config_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9266 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9267 0 : int err = 0;
9268 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9269 0 : if( FD_UNLIKELY( err ) ) return err;
9270 0 : err = fd_bincode_bool_decode_footprint( ctx );
9271 0 : if( FD_UNLIKELY( err ) ) return err;
9272 0 : return 0;
9273 0 : }
9274 0 : int fd_config_keys_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9275 0 : *total_sz += sizeof(fd_config_keys_pair_t);
9276 0 : void const * start_data = ctx->data;
9277 0 : int err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
9278 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9279 0 : ctx->data = start_data;
9280 0 : return err;
9281 0 : }
9282 0 : static void fd_config_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9283 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)struct_mem;
9284 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
9285 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
9286 0 : }
9287 0 : void * fd_config_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9288 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)mem;
9289 0 : fd_config_keys_pair_new( self );
9290 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_pair_t);
9291 0 : void * * alloc_mem = &alloc_region;
9292 0 : fd_config_keys_pair_decode_inner( mem, alloc_mem, ctx );
9293 0 : return self;
9294 0 : }
9295 0 : void fd_config_keys_pair_new(fd_config_keys_pair_t * self) {
9296 0 : fd_memset( self, 0, sizeof(fd_config_keys_pair_t) );
9297 0 : fd_pubkey_new( &self->key );
9298 0 : }
9299 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, uint varint ) {
9300 0 : (void) varint;
9301 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys_pair", level++, 0 );
9302 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
9303 0 : fun( w, &self->signer, "signer", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
9304 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys_pair", level--, 0 );
9305 0 : }
9306 12 : int fd_stake_config_encode( fd_stake_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9307 12 : int err;
9308 12 : err = fd_bincode_compact_u16_encode( &self->config_keys_len, ctx );
9309 12 : if( FD_UNLIKELY(err) ) return err;
9310 12 : if( self->config_keys_len ) {
9311 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
9312 0 : err = fd_config_keys_pair_encode( self->config_keys + i, ctx );
9313 0 : if( FD_UNLIKELY( err ) ) return err;
9314 0 : }
9315 0 : }
9316 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
9317 12 : if( FD_UNLIKELY( err ) ) return err;
9318 12 : err = fd_bincode_uint8_encode( (uchar)(self->slash_penalty), ctx );
9319 12 : if( FD_UNLIKELY( err ) ) return err;
9320 12 : return FD_BINCODE_SUCCESS;
9321 12 : }
9322 0 : static int fd_stake_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9323 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9324 0 : int err = 0;
9325 0 : ushort config_keys_len;
9326 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
9327 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9328 0 : if( config_keys_len ) {
9329 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*config_keys_len;
9330 0 : for( ulong i=0; i < config_keys_len; i++ ) {
9331 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
9332 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9333 0 : }
9334 0 : }
9335 0 : err = fd_bincode_double_decode_footprint( ctx );
9336 0 : if( FD_UNLIKELY( err ) ) return err;
9337 0 : err = fd_bincode_uint8_decode_footprint( ctx );
9338 0 : if( FD_UNLIKELY( err ) ) return err;
9339 0 : return 0;
9340 0 : }
9341 0 : int fd_stake_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9342 0 : *total_sz += sizeof(fd_stake_config_t);
9343 0 : void const * start_data = ctx->data;
9344 0 : int err = fd_stake_config_decode_footprint_inner( ctx, total_sz );
9345 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9346 0 : ctx->data = start_data;
9347 0 : return err;
9348 0 : }
9349 0 : static void fd_stake_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9350 0 : fd_stake_config_t * self = (fd_stake_config_t *)struct_mem;
9351 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
9352 0 : if( self->config_keys_len ) {
9353 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
9354 0 : self->config_keys = *alloc_mem;
9355 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->config_keys_len;
9356 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
9357 0 : fd_config_keys_pair_new( self->config_keys + i );
9358 0 : fd_config_keys_pair_decode_inner( self->config_keys + i, alloc_mem, ctx );
9359 0 : }
9360 0 : } else
9361 0 : self->config_keys = NULL;
9362 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
9363 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
9364 0 : }
9365 0 : void * fd_stake_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9366 0 : fd_stake_config_t * self = (fd_stake_config_t *)mem;
9367 0 : fd_stake_config_new( self );
9368 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_config_t);
9369 0 : void * * alloc_mem = &alloc_region;
9370 0 : fd_stake_config_decode_inner( mem, alloc_mem, ctx );
9371 0 : return self;
9372 0 : }
9373 0 : void fd_stake_config_new(fd_stake_config_t * self) {
9374 0 : fd_memset( self, 0, sizeof(fd_stake_config_t) );
9375 0 : }
9376 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, uint varint ) {
9377 0 : (void) varint;
9378 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_config", level++, 0 );
9379 0 : fun( w, &self->config_keys_len, "config_keys_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
9380 0 : if( self->config_keys_len ) {
9381 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9382 0 : for( ulong i=0; i < self->config_keys_len; i++ )
9383 0 : fd_config_keys_pair_walk(w, self->config_keys + i, fun, "config_keys_pair", level, 0 );
9384 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9385 0 : }
9386 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
9387 0 : fun( w, &self->slash_penalty, "slash_penalty", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9388 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_config", level--, 0 );
9389 0 : }
9390 0 : ulong fd_stake_config_size( fd_stake_config_t const * self ) {
9391 0 : ulong size = 0;
9392 0 : do {
9393 0 : ushort tmp = (ushort)self->config_keys_len;
9394 0 : size += fd_bincode_compact_u16_size( &tmp );
9395 0 : for( ulong i=0; i < self->config_keys_len; i++ )
9396 0 : size += fd_config_keys_pair_size( self->config_keys + i );
9397 0 : } while(0);
9398 0 : size += sizeof(double);
9399 0 : size += sizeof(char);
9400 0 : return size;
9401 0 : }
9402 :
9403 0 : int fd_feature_entry_encode( fd_feature_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9404 0 : int err;
9405 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
9406 0 : if( FD_UNLIKELY( err ) ) return err;
9407 0 : err = fd_bincode_uint64_encode( self->description_len, ctx );
9408 0 : if( FD_UNLIKELY(err) ) return err;
9409 0 : if( self->description_len ) {
9410 0 : err = fd_bincode_bytes_encode( self->description, self->description_len, ctx );
9411 0 : if( FD_UNLIKELY( err ) ) return err;
9412 0 : }
9413 0 : err = fd_bincode_uint64_encode( self->since_slot, ctx );
9414 0 : if( FD_UNLIKELY( err ) ) return err;
9415 0 : return FD_BINCODE_SUCCESS;
9416 0 : }
9417 0 : static int fd_feature_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9418 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9419 0 : int err = 0;
9420 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9421 0 : if( FD_UNLIKELY( err ) ) return err;
9422 0 : ulong description_len;
9423 0 : err = fd_bincode_uint64_decode( &description_len, ctx );
9424 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9425 0 : *total_sz += description_len;
9426 0 : if( description_len ) {
9427 0 : err = fd_bincode_bytes_decode_footprint( description_len, ctx );
9428 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9429 0 : err = !fd_utf8_verify( (char const *) ctx->data - description_len, description_len );
9430 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9431 0 : }
9432 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9433 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9434 0 : return 0;
9435 0 : }
9436 0 : int fd_feature_entry_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9437 0 : *total_sz += sizeof(fd_feature_entry_t);
9438 0 : void const * start_data = ctx->data;
9439 0 : int err = fd_feature_entry_decode_footprint_inner( ctx, total_sz );
9440 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9441 0 : ctx->data = start_data;
9442 0 : return err;
9443 0 : }
9444 0 : static void fd_feature_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9445 0 : fd_feature_entry_t * self = (fd_feature_entry_t *)struct_mem;
9446 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
9447 0 : fd_bincode_uint64_decode_unsafe( &self->description_len, ctx );
9448 0 : if( self->description_len ) {
9449 0 : self->description = *alloc_mem;
9450 0 : fd_bincode_bytes_decode_unsafe( self->description, self->description_len, ctx );
9451 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->description_len;
9452 0 : } else
9453 0 : self->description = NULL;
9454 0 : fd_bincode_uint64_decode_unsafe( &self->since_slot, ctx );
9455 0 : }
9456 0 : void * fd_feature_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9457 0 : fd_feature_entry_t * self = (fd_feature_entry_t *)mem;
9458 0 : fd_feature_entry_new( self );
9459 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_entry_t);
9460 0 : void * * alloc_mem = &alloc_region;
9461 0 : fd_feature_entry_decode_inner( mem, alloc_mem, ctx );
9462 0 : return self;
9463 0 : }
9464 0 : void fd_feature_entry_new(fd_feature_entry_t * self) {
9465 0 : fd_memset( self, 0, sizeof(fd_feature_entry_t) );
9466 0 : fd_pubkey_new( &self->pubkey );
9467 0 : }
9468 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, uint varint ) {
9469 0 : (void) varint;
9470 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature_entry", level++, 0 );
9471 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
9472 0 : if( self->description_len ) {
9473 0 : fun( w, NULL, "description", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9474 0 : for( ulong i=0; i < self->description_len; i++ )
9475 0 : fun( w, self->description + i, "description", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9476 0 : fun( w, NULL, "description", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9477 0 : }
9478 0 : fun( w, &self->since_slot, "since_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9479 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature_entry", level--, 0 );
9480 0 : }
9481 0 : ulong fd_feature_entry_size( fd_feature_entry_t const * self ) {
9482 0 : ulong size = 0;
9483 0 : size += fd_pubkey_size( &self->pubkey );
9484 0 : do {
9485 0 : size += sizeof(ulong);
9486 0 : size += self->description_len;
9487 0 : } while(0);
9488 0 : size += sizeof(ulong);
9489 0 : return size;
9490 0 : }
9491 :
9492 0 : FD_FN_PURE uchar fd_cluster_type_is_Testnet(fd_cluster_type_t const * self) {
9493 0 : return self->discriminant == 0;
9494 0 : }
9495 0 : FD_FN_PURE uchar fd_cluster_type_is_MainnetBeta(fd_cluster_type_t const * self) {
9496 0 : return self->discriminant == 1;
9497 0 : }
9498 0 : FD_FN_PURE uchar fd_cluster_type_is_Devnet(fd_cluster_type_t const * self) {
9499 0 : return self->discriminant == 2;
9500 0 : }
9501 0 : FD_FN_PURE uchar fd_cluster_type_is_Development(fd_cluster_type_t const * self) {
9502 0 : return self->discriminant == 3;
9503 0 : }
9504 0 : int fd_cluster_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9505 0 : int err;
9506 0 : switch (discriminant) {
9507 0 : case 0: {
9508 0 : return FD_BINCODE_SUCCESS;
9509 0 : }
9510 0 : case 1: {
9511 0 : return FD_BINCODE_SUCCESS;
9512 0 : }
9513 0 : case 2: {
9514 0 : return FD_BINCODE_SUCCESS;
9515 0 : }
9516 0 : case 3: {
9517 0 : return FD_BINCODE_SUCCESS;
9518 0 : }
9519 0 : default: return FD_BINCODE_ERR_ENCODING;
9520 0 : }
9521 0 : }
9522 0 : static int fd_cluster_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9523 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9524 0 : uint discriminant = 0;
9525 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9526 0 : if( FD_UNLIKELY( err ) ) return err;
9527 0 : return fd_cluster_type_inner_decode_footprint( discriminant, ctx, total_sz );
9528 0 : }
9529 0 : int fd_cluster_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9530 0 : *total_sz += sizeof(fd_cluster_type_t);
9531 0 : void const * start_data = ctx->data;
9532 0 : int err = fd_cluster_type_decode_footprint_inner( ctx, total_sz );
9533 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9534 0 : ctx->data = start_data;
9535 0 : return err;
9536 0 : }
9537 0 : static void fd_cluster_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9538 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)struct_mem;
9539 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9540 0 : }
9541 0 : void * fd_cluster_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9542 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)mem;
9543 0 : fd_cluster_type_new( self );
9544 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_type_t);
9545 0 : void * * alloc_mem = &alloc_region;
9546 0 : fd_cluster_type_decode_inner( mem, alloc_mem, ctx );
9547 0 : return self;
9548 0 : }
9549 :
9550 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, uint varint ) {
9551 0 : (void) varint;
9552 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_cluster_type", level++, 0);
9553 0 : switch( self->discriminant ) {
9554 0 : case 0: {
9555 0 : fun( w, self, "Testnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9556 0 : break;
9557 0 : }
9558 0 : case 1: {
9559 0 : fun( w, self, "MainnetBeta", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9560 0 : break;
9561 0 : }
9562 0 : case 2: {
9563 0 : fun( w, self, "Devnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9564 0 : break;
9565 0 : }
9566 0 : case 3: {
9567 0 : fun( w, self, "Development", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9568 0 : break;
9569 0 : }
9570 0 : }
9571 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_cluster_type", level--, 0 );
9572 0 : }
9573 0 : ulong fd_cluster_type_size( fd_cluster_type_t const * self ) {
9574 0 : ulong size = 0;
9575 0 : size += sizeof(uint);
9576 0 : switch (self->discriminant) {
9577 0 : }
9578 0 : return size;
9579 0 : }
9580 :
9581 0 : int fd_cluster_type_encode( fd_cluster_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9582 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9583 0 : if( FD_UNLIKELY( err ) ) return err;
9584 0 : return err;
9585 0 : }
9586 :
9587 0 : int fd_cluster_version_encode( fd_cluster_version_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9588 0 : int err;
9589 0 : err = fd_bincode_uint32_encode( self->major, ctx );
9590 0 : if( FD_UNLIKELY( err ) ) return err;
9591 0 : err = fd_bincode_uint32_encode( self->minor, ctx );
9592 0 : if( FD_UNLIKELY( err ) ) return err;
9593 0 : err = fd_bincode_uint32_encode( self->patch, ctx );
9594 0 : if( FD_UNLIKELY( err ) ) return err;
9595 0 : return FD_BINCODE_SUCCESS;
9596 0 : }
9597 0 : static inline int fd_cluster_version_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9598 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9599 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
9600 0 : return 0;
9601 0 : }
9602 0 : static void fd_cluster_version_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9603 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)struct_mem;
9604 0 : fd_bincode_uint32_decode_unsafe( &self->major, ctx );
9605 0 : fd_bincode_uint32_decode_unsafe( &self->minor, ctx );
9606 0 : fd_bincode_uint32_decode_unsafe( &self->patch, ctx );
9607 0 : }
9608 0 : void * fd_cluster_version_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9609 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)mem;
9610 0 : fd_cluster_version_new( self );
9611 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_version_t);
9612 0 : void * * alloc_mem = &alloc_region;
9613 0 : fd_cluster_version_decode_inner( mem, alloc_mem, ctx );
9614 0 : return self;
9615 0 : }
9616 0 : void fd_cluster_version_walk( void * w, fd_cluster_version_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9617 0 : (void) varint;
9618 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cluster_version", level++, 0 );
9619 0 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9620 0 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9621 0 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9622 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cluster_version", level--, 0 );
9623 0 : }
9624 0 : int fd_stake_reward_encode( fd_stake_reward_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9625 0 : int err;
9626 0 : err = fd_pubkey_encode( &self->stake_pubkey, ctx );
9627 0 : if( FD_UNLIKELY( err ) ) return err;
9628 0 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
9629 0 : if( FD_UNLIKELY( err ) ) return err;
9630 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
9631 0 : if( FD_UNLIKELY( err ) ) return err;
9632 0 : err = fd_bincode_uint8_encode( (uchar)(self->valid), ctx );
9633 0 : if( FD_UNLIKELY( err ) ) return err;
9634 0 : return FD_BINCODE_SUCCESS;
9635 0 : }
9636 0 : static inline int fd_stake_reward_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9637 0 : if( (ulong)ctx->data + 49UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9638 0 : ctx->data = (void *)( (ulong)ctx->data + 49UL );
9639 0 : return 0;
9640 0 : }
9641 0 : static void fd_stake_reward_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9642 0 : fd_stake_reward_t * self = (fd_stake_reward_t *)struct_mem;
9643 0 : fd_pubkey_decode_inner( &self->stake_pubkey, alloc_mem, ctx );
9644 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
9645 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
9646 0 : fd_bincode_uint8_decode_unsafe( &self->valid, ctx );
9647 0 : }
9648 0 : void * fd_stake_reward_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9649 0 : fd_stake_reward_t * self = (fd_stake_reward_t *)mem;
9650 0 : fd_stake_reward_new( self );
9651 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_t);
9652 0 : void * * alloc_mem = &alloc_region;
9653 0 : fd_stake_reward_decode_inner( mem, alloc_mem, ctx );
9654 0 : return self;
9655 0 : }
9656 0 : void fd_stake_reward_walk( void * w, fd_stake_reward_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9657 0 : (void) varint;
9658 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward", level++, 0 );
9659 0 : fd_pubkey_walk( w, &self->stake_pubkey, fun, "stake_pubkey", level, 0 );
9660 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9661 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9662 0 : fun( w, &self->valid, "valid", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9663 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward", level--, 0 );
9664 0 : }
9665 0 : int fd_vote_reward_encode( fd_vote_reward_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9666 0 : int err;
9667 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
9668 0 : if( FD_UNLIKELY( err ) ) return err;
9669 0 : err = fd_bincode_uint64_encode( self->vote_rewards, ctx );
9670 0 : if( FD_UNLIKELY( err ) ) return err;
9671 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
9672 0 : if( FD_UNLIKELY( err ) ) return err;
9673 0 : err = fd_bincode_uint8_encode( (uchar)(self->needs_store), ctx );
9674 0 : if( FD_UNLIKELY( err ) ) return err;
9675 0 : return FD_BINCODE_SUCCESS;
9676 0 : }
9677 0 : static inline int fd_vote_reward_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9678 0 : if( (ulong)ctx->data + 42UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9679 0 : ctx->data = (void *)( (ulong)ctx->data + 42UL );
9680 0 : return 0;
9681 0 : }
9682 0 : static void fd_vote_reward_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9683 0 : fd_vote_reward_t * self = (fd_vote_reward_t *)struct_mem;
9684 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
9685 0 : fd_bincode_uint64_decode_unsafe( &self->vote_rewards, ctx );
9686 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
9687 0 : fd_bincode_uint8_decode_unsafe( &self->needs_store, ctx );
9688 0 : }
9689 0 : void * fd_vote_reward_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9690 0 : fd_vote_reward_t * self = (fd_vote_reward_t *)mem;
9691 0 : fd_vote_reward_new( self );
9692 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_reward_t);
9693 0 : void * * alloc_mem = &alloc_region;
9694 0 : fd_vote_reward_decode_inner( mem, alloc_mem, ctx );
9695 0 : return self;
9696 0 : }
9697 0 : void fd_vote_reward_walk( void * w, fd_vote_reward_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9698 0 : (void) varint;
9699 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_reward", level++, 0 );
9700 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
9701 0 : fun( w, &self->vote_rewards, "vote_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9702 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9703 0 : fun( w, &self->needs_store, "needs_store", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9704 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_reward", level--, 0 );
9705 0 : }
9706 0 : int fd_point_value_encode( fd_point_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9707 0 : int err;
9708 0 : err = fd_bincode_uint64_encode( self->rewards, ctx );
9709 0 : if( FD_UNLIKELY( err ) ) return err;
9710 0 : err = fd_bincode_uint128_encode( self->points, ctx );
9711 0 : if( FD_UNLIKELY( err ) ) return err;
9712 0 : return FD_BINCODE_SUCCESS;
9713 0 : }
9714 0 : static inline int fd_point_value_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9715 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9716 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
9717 0 : return 0;
9718 0 : }
9719 0 : static void fd_point_value_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9720 0 : fd_point_value_t * self = (fd_point_value_t *)struct_mem;
9721 0 : fd_bincode_uint64_decode_unsafe( &self->rewards, ctx );
9722 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
9723 0 : }
9724 0 : void * fd_point_value_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9725 0 : fd_point_value_t * self = (fd_point_value_t *)mem;
9726 0 : fd_point_value_new( self );
9727 0 : void * alloc_region = (uchar *)mem + sizeof(fd_point_value_t);
9728 0 : void * * alloc_mem = &alloc_region;
9729 0 : fd_point_value_decode_inner( mem, alloc_mem, ctx );
9730 0 : return self;
9731 0 : }
9732 0 : void fd_point_value_walk( void * w, fd_point_value_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9733 0 : (void) varint;
9734 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_point_value", level++, 0 );
9735 0 : fun( w, &self->rewards, "rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9736 0 : fun( w, &self->points, "points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
9737 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_point_value", level--, 0 );
9738 0 : }
9739 0 : int fd_partitioned_stake_rewards_encode( fd_partitioned_stake_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9740 0 : int err;
9741 0 : if( self->partitions ) {
9742 0 : err = fd_bincode_uint64_encode( self->partitions_len, ctx );
9743 0 : if( FD_UNLIKELY( err ) ) return err;
9744 0 : for( ulong i=0; i < 4096; i++ ) {
9745 0 : err = fd_bincode_uint64_encode( self->partitions_lengths[ i ], ctx );
9746 0 : if( FD_UNLIKELY( err ) ) return err;
9747 0 : }
9748 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
9749 0 : for( fd_partitioned_stake_rewards_dlist_iter_t iter = fd_partitioned_stake_rewards_dlist_iter_fwd_init( &self->partitions[ i ], self->pool );
9750 0 : !fd_partitioned_stake_rewards_dlist_iter_done( iter, &self->partitions[ i ], self->pool );
9751 0 : iter = fd_partitioned_stake_rewards_dlist_iter_fwd_next( iter, &self->partitions[ i ], self->pool ) ) {
9752 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_dlist_iter_ele( iter, &self->partitions[ i ], self->pool );
9753 0 : err = fd_stake_reward_encode( ele, ctx );
9754 0 : if( FD_UNLIKELY( err ) ) return err;
9755 0 : }
9756 0 : }
9757 0 : } else {
9758 0 : err = fd_bincode_uint64_encode( self->partitions_len, ctx );
9759 0 : if( FD_UNLIKELY( err ) ) return err;
9760 0 : }
9761 0 : return FD_BINCODE_SUCCESS;
9762 0 : }
9763 0 : int fd_partitioned_stake_rewards_encode_global( fd_partitioned_stake_rewards_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9764 0 : int err;
9765 0 : return FD_BINCODE_SUCCESS;
9766 0 : }
9767 0 : static int fd_partitioned_stake_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9768 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9769 0 : int err = 0;
9770 0 : ulong partitions_len;
9771 0 : err = fd_bincode_uint64_decode( &partitions_len, ctx );
9772 0 : if( FD_UNLIKELY( err ) ) return err;
9773 0 : ulong total_count = 0UL;
9774 0 : ulong partitions_lengths[4096];
9775 0 : for( ulong i=0; i<4096; i++ ) {
9776 0 : err = fd_bincode_uint64_decode( partitions_lengths + i, ctx );
9777 0 : total_count+=partitions_lengths[ i ];
9778 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9779 0 : }
9780 0 : *total_sz += fd_partitioned_stake_rewards_pool_align() + fd_partitioned_stake_rewards_pool_footprint( total_count );
9781 0 : *total_sz += fd_partitioned_stake_rewards_dlist_align() + fd_partitioned_stake_rewards_dlist_footprint()*partitions_len;
9782 0 : for( ulong i=0; i < partitions_len; i++ ) {
9783 0 : err = fd_stake_reward_decode_footprint_inner( ctx, total_sz );
9784 0 : if( FD_UNLIKELY ( err ) ) return err;
9785 0 : }
9786 0 : return 0;
9787 0 : }
9788 0 : int fd_partitioned_stake_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9789 0 : *total_sz += sizeof(fd_partitioned_stake_rewards_t);
9790 0 : void const * start_data = ctx->data;
9791 0 : int err = fd_partitioned_stake_rewards_decode_footprint_inner( ctx, total_sz );
9792 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9793 0 : ctx->data = start_data;
9794 0 : return err;
9795 0 : }
9796 0 : static void fd_partitioned_stake_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9797 0 : fd_partitioned_stake_rewards_t * self = (fd_partitioned_stake_rewards_t *)struct_mem;
9798 0 : fd_bincode_uint64_decode_unsafe( &self->partitions_len, ctx );
9799 0 : ulong total_count = 0UL;
9800 0 : for( ulong i=0; i < 4096; i++ ) {
9801 0 : fd_bincode_uint64_decode_unsafe( self->partitions_lengths + i, ctx );
9802 0 : total_count += self->partitions_lengths[ i ];
9803 0 : }
9804 0 : self->pool = fd_partitioned_stake_rewards_pool_join_new( alloc_mem, total_count );
9805 0 : self->partitions = fd_partitioned_stake_rewards_dlist_join_new( alloc_mem, self->partitions_len );
9806 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
9807 0 : fd_partitioned_stake_rewards_dlist_new( &self->partitions[ i ] );
9808 0 : for( ulong j=0; j < self->partitions_lengths[ i ]; j++ ) {
9809 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_pool_ele_acquire( self->pool );
9810 0 : fd_stake_reward_new( ele );
9811 0 : fd_stake_reward_decode_inner( ele, alloc_mem, ctx );
9812 0 : fd_partitioned_stake_rewards_dlist_ele_push_tail( &self->partitions[ i ], ele, self->pool );
9813 0 : }
9814 0 : }
9815 0 : }
9816 0 : void * fd_partitioned_stake_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9817 0 : fd_partitioned_stake_rewards_t * self = (fd_partitioned_stake_rewards_t *)mem;
9818 0 : fd_partitioned_stake_rewards_new( self );
9819 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_stake_rewards_t);
9820 0 : void * * alloc_mem = &alloc_region;
9821 0 : fd_partitioned_stake_rewards_decode_inner( mem, alloc_mem, ctx );
9822 0 : return self;
9823 0 : }
9824 0 : static void fd_partitioned_stake_rewards_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9825 0 : fd_partitioned_stake_rewards_global_t * self = (fd_partitioned_stake_rewards_global_t *)struct_mem;
9826 0 : fd_bincode_uint64_decode_unsafe( &self->partitions_len, ctx );
9827 0 : ulong total_count = 0UL;
9828 0 : for( ulong i=0; i < 4096; i++ ) {
9829 0 : fd_bincode_uint64_decode_unsafe( self->partitions_lengths + i, ctx );
9830 0 : total_count += self->partitions_lengths[ i ];
9831 0 : }
9832 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_partitioned_stake_rewards_pool_align() );
9833 0 : fd_stake_reward_t * pool = fd_partitioned_stake_rewards_pool_join_new( alloc_mem, total_count );
9834 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_partitioned_stake_rewards_dlist_align() );
9835 0 : fd_partitioned_stake_rewards_dlist_t * partitions = fd_partitioned_stake_rewards_dlist_join_new( alloc_mem, self->partitions_len );
9836 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
9837 0 : fd_partitioned_stake_rewards_dlist_new( &partitions[ i ] );
9838 0 : for( ulong j=0; j < self->partitions_lengths[ i ]; j++ ) {
9839 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_pool_ele_acquire( pool );
9840 0 : fd_stake_reward_new( ele );
9841 0 : fd_stake_reward_decode_inner( ele, alloc_mem, ctx );
9842 0 : fd_partitioned_stake_rewards_dlist_ele_push_tail( &partitions[ i ], ele, pool );
9843 0 : }
9844 0 : }
9845 0 : self->pool_offset = (ulong)fd_partitioned_stake_rewards_pool_leave( pool ) - (ulong)struct_mem;
9846 0 : self->partitions_offset = (ulong)fd_partitioned_stake_rewards_dlist_leave( partitions ) - (ulong)struct_mem;
9847 0 : }
9848 0 : void * fd_partitioned_stake_rewards_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9849 0 : fd_partitioned_stake_rewards_global_t * self = (fd_partitioned_stake_rewards_global_t *)mem;
9850 0 : fd_partitioned_stake_rewards_new( (fd_partitioned_stake_rewards_t *)self );
9851 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_stake_rewards_global_t);
9852 0 : void * * alloc_mem = &alloc_region;
9853 0 : fd_partitioned_stake_rewards_decode_inner_global( mem, alloc_mem, ctx );
9854 0 : return self;
9855 0 : }
9856 0 : void fd_partitioned_stake_rewards_new(fd_partitioned_stake_rewards_t * self) {
9857 0 : fd_memset( self, 0, sizeof(fd_partitioned_stake_rewards_t) );
9858 0 : }
9859 0 : void fd_partitioned_stake_rewards_walk( void * w, fd_partitioned_stake_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9860 0 : (void) varint;
9861 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_partitioned_stake_rewards", level++, 0 );
9862 0 : if( self->partitions ) {
9863 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
9864 0 : for( fd_partitioned_stake_rewards_dlist_iter_t iter = fd_partitioned_stake_rewards_dlist_iter_fwd_init( &self->partitions[ i ], self->pool );
9865 0 : !fd_partitioned_stake_rewards_dlist_iter_done( iter, &self->partitions[ i ], self->pool );
9866 0 : iter = fd_partitioned_stake_rewards_dlist_iter_fwd_next( iter, &self->partitions[ i ], self->pool ) ) {
9867 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_dlist_iter_ele( iter, &self->partitions[ i ], self->pool );
9868 0 : fd_stake_reward_walk( w, ele, fun, "fd_stake_reward_t", level, 0 );
9869 0 : }
9870 0 : }
9871 0 : }
9872 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_partitioned_stake_rewards", level--, 0 );
9873 0 : }
9874 0 : ulong fd_partitioned_stake_rewards_size( fd_partitioned_stake_rewards_t const * self ) {
9875 0 : ulong size = 0;
9876 0 : size += sizeof(ulong);
9877 0 : size += 4096 * sizeof(ulong);
9878 0 : if( self->partitions ) {
9879 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
9880 0 : for( fd_partitioned_stake_rewards_dlist_iter_t iter = fd_partitioned_stake_rewards_dlist_iter_fwd_init( &self->partitions[ i ], self->pool );
9881 0 : !fd_partitioned_stake_rewards_dlist_iter_done( iter, &self->partitions[ i ], self->pool );
9882 0 : iter = fd_partitioned_stake_rewards_dlist_iter_fwd_next( iter, &self->partitions[ i ], self->pool ) ) {
9883 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_dlist_iter_ele( iter, &self->partitions[ i ], self->pool );
9884 0 : size += fd_stake_reward_size( ele );
9885 0 : }
9886 0 : }
9887 0 : }
9888 0 : return size;
9889 0 : }
9890 :
9891 0 : ulong fd_partitioned_stake_rewards_size_global( fd_partitioned_stake_rewards_global_t const * self ) {
9892 0 : ulong size = 0;
9893 0 : FD_LOG_CRIT(( "FIXME: not implemented" ));
9894 0 : return size;
9895 0 : }
9896 :
9897 0 : int fd_stake_reward_calculation_partitioned_encode( fd_stake_reward_calculation_partitioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9898 0 : int err;
9899 0 : err = fd_partitioned_stake_rewards_encode( &self->partitioned_stake_rewards, ctx );
9900 0 : if( FD_UNLIKELY( err ) ) return err;
9901 0 : err = fd_bincode_uint64_encode( self->total_stake_rewards_lamports, ctx );
9902 0 : if( FD_UNLIKELY( err ) ) return err;
9903 0 : return FD_BINCODE_SUCCESS;
9904 0 : }
9905 0 : static int fd_stake_reward_calculation_partitioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9906 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9907 0 : int err = 0;
9908 0 : err = fd_partitioned_stake_rewards_decode_footprint_inner( ctx, total_sz );
9909 0 : if( FD_UNLIKELY( err ) ) return err;
9910 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9911 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9912 0 : return 0;
9913 0 : }
9914 0 : int fd_stake_reward_calculation_partitioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9915 0 : *total_sz += sizeof(fd_stake_reward_calculation_partitioned_t);
9916 0 : void const * start_data = ctx->data;
9917 0 : int err = fd_stake_reward_calculation_partitioned_decode_footprint_inner( ctx, total_sz );
9918 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9919 0 : ctx->data = start_data;
9920 0 : return err;
9921 0 : }
9922 0 : static void fd_stake_reward_calculation_partitioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9923 0 : fd_stake_reward_calculation_partitioned_t * self = (fd_stake_reward_calculation_partitioned_t *)struct_mem;
9924 0 : fd_partitioned_stake_rewards_decode_inner( &self->partitioned_stake_rewards, alloc_mem, ctx );
9925 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake_rewards_lamports, ctx );
9926 0 : }
9927 0 : void * fd_stake_reward_calculation_partitioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9928 0 : fd_stake_reward_calculation_partitioned_t * self = (fd_stake_reward_calculation_partitioned_t *)mem;
9929 0 : fd_stake_reward_calculation_partitioned_new( self );
9930 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_calculation_partitioned_t);
9931 0 : void * * alloc_mem = &alloc_region;
9932 0 : fd_stake_reward_calculation_partitioned_decode_inner( mem, alloc_mem, ctx );
9933 0 : return self;
9934 0 : }
9935 0 : void fd_stake_reward_calculation_partitioned_new(fd_stake_reward_calculation_partitioned_t * self) {
9936 0 : fd_memset( self, 0, sizeof(fd_stake_reward_calculation_partitioned_t) );
9937 0 : fd_partitioned_stake_rewards_new( &self->partitioned_stake_rewards );
9938 0 : }
9939 0 : void fd_stake_reward_calculation_partitioned_walk( void * w, fd_stake_reward_calculation_partitioned_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
9940 0 : (void) varint;
9941 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward_calculation_partitioned", level++, 0 );
9942 0 : fd_partitioned_stake_rewards_walk( w, &self->partitioned_stake_rewards, fun, "partitioned_stake_rewards", level, 0 );
9943 0 : fun( w, &self->total_stake_rewards_lamports, "total_stake_rewards_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9944 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward_calculation_partitioned", level--, 0 );
9945 0 : }
9946 0 : ulong fd_stake_reward_calculation_partitioned_size( fd_stake_reward_calculation_partitioned_t const * self ) {
9947 0 : ulong size = 0;
9948 0 : size += fd_partitioned_stake_rewards_size( &self->partitioned_stake_rewards );
9949 0 : size += sizeof(ulong);
9950 0 : return size;
9951 0 : }
9952 :
9953 0 : int fd_stake_reward_calculation_encode( fd_stake_reward_calculation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9954 0 : int err;
9955 0 : if( self->stake_rewards ) {
9956 0 : err = fd_bincode_uint64_encode( self->stake_rewards_len, ctx );
9957 0 : if( FD_UNLIKELY( err ) ) return err;
9958 0 : for( fd_stake_reward_calculation_dlist_iter_t iter = fd_stake_reward_calculation_dlist_iter_fwd_init( self->stake_rewards, self->pool );
9959 0 : !fd_stake_reward_calculation_dlist_iter_done( iter, self->stake_rewards, self->pool );
9960 0 : iter = fd_stake_reward_calculation_dlist_iter_fwd_next( iter, self->stake_rewards, self->pool ) ) {
9961 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_dlist_iter_ele( iter, self->stake_rewards, self->pool );
9962 0 : err = fd_stake_reward_encode( ele, ctx );
9963 0 : if( FD_UNLIKELY( err ) ) return err;
9964 0 : }
9965 0 : } else {
9966 0 : err = fd_bincode_uint64_encode( self->stake_rewards_len, ctx );
9967 0 : if( FD_UNLIKELY( err ) ) return err;
9968 0 : }
9969 0 : err = fd_bincode_uint64_encode( self->total_stake_rewards_lamports, ctx );
9970 0 : if( FD_UNLIKELY( err ) ) return err;
9971 0 : return FD_BINCODE_SUCCESS;
9972 0 : }
9973 0 : static int fd_stake_reward_calculation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9974 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9975 0 : int err = 0;
9976 0 : ulong stake_rewards_len;
9977 0 : err = fd_bincode_uint64_decode( &stake_rewards_len, ctx );
9978 0 : if( FD_UNLIKELY( err ) ) return err;
9979 0 : *total_sz += fd_stake_reward_calculation_pool_align() + fd_stake_reward_calculation_pool_footprint( stake_rewards_len );
9980 0 : *total_sz += fd_stake_reward_calculation_dlist_align() + fd_stake_reward_calculation_dlist_footprint()*stake_rewards_len;
9981 0 : for( ulong i=0; i < stake_rewards_len; i++ ) {
9982 0 : err = fd_stake_reward_decode_footprint_inner( ctx, total_sz );
9983 0 : if( FD_UNLIKELY ( err ) ) return err;
9984 0 : }
9985 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9986 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9987 0 : return 0;
9988 0 : }
9989 0 : int fd_stake_reward_calculation_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9990 0 : *total_sz += sizeof(fd_stake_reward_calculation_t);
9991 0 : void const * start_data = ctx->data;
9992 0 : int err = fd_stake_reward_calculation_decode_footprint_inner( ctx, total_sz );
9993 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9994 0 : ctx->data = start_data;
9995 0 : return err;
9996 0 : }
9997 0 : static void fd_stake_reward_calculation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9998 0 : fd_stake_reward_calculation_t * self = (fd_stake_reward_calculation_t *)struct_mem;
9999 0 : fd_bincode_uint64_decode_unsafe( &self->stake_rewards_len, ctx );
10000 0 : self->pool = fd_stake_reward_calculation_pool_join_new( alloc_mem, self->stake_rewards_len );
10001 0 : self->stake_rewards = fd_stake_reward_calculation_dlist_join_new( alloc_mem, self->stake_rewards_len );
10002 0 : fd_stake_reward_calculation_dlist_new( self->stake_rewards );
10003 0 : for( ulong i=0; i < self->stake_rewards_len; i++ ) {
10004 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_pool_ele_acquire( self->pool );
10005 0 : fd_stake_reward_new( ele );
10006 0 : fd_stake_reward_decode_inner( ele, alloc_mem, ctx );
10007 0 : fd_stake_reward_calculation_dlist_ele_push_tail( self->stake_rewards, ele, self->pool );
10008 0 : }
10009 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake_rewards_lamports, ctx );
10010 0 : }
10011 0 : void * fd_stake_reward_calculation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10012 0 : fd_stake_reward_calculation_t * self = (fd_stake_reward_calculation_t *)mem;
10013 0 : fd_stake_reward_calculation_new( self );
10014 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_calculation_t);
10015 0 : void * * alloc_mem = &alloc_region;
10016 0 : fd_stake_reward_calculation_decode_inner( mem, alloc_mem, ctx );
10017 0 : return self;
10018 0 : }
10019 0 : void fd_stake_reward_calculation_new(fd_stake_reward_calculation_t * self) {
10020 0 : fd_memset( self, 0, sizeof(fd_stake_reward_calculation_t) );
10021 0 : }
10022 0 : void fd_stake_reward_calculation_walk( void * w, fd_stake_reward_calculation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10023 0 : (void) varint;
10024 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward_calculation", level++, 0 );
10025 0 : if( self->stake_rewards ) {
10026 0 : for( fd_stake_reward_calculation_dlist_iter_t iter = fd_stake_reward_calculation_dlist_iter_fwd_init( self->stake_rewards, self->pool );
10027 0 : !fd_stake_reward_calculation_dlist_iter_done( iter, self->stake_rewards, self->pool );
10028 0 : iter = fd_stake_reward_calculation_dlist_iter_fwd_next( iter, self->stake_rewards, self->pool ) ) {
10029 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_dlist_iter_ele( iter, self->stake_rewards, self->pool );
10030 0 : fd_stake_reward_walk( w, ele, fun, "fd_stake_reward_t", level, 0 );
10031 0 : }
10032 0 : }
10033 0 : fun( w, &self->total_stake_rewards_lamports, "total_stake_rewards_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10034 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward_calculation", level--, 0 );
10035 0 : }
10036 0 : ulong fd_stake_reward_calculation_size( fd_stake_reward_calculation_t const * self ) {
10037 0 : ulong size = 0;
10038 0 : size += sizeof(ulong);
10039 0 : if( self->stake_rewards ) {
10040 0 : for( fd_stake_reward_calculation_dlist_iter_t iter = fd_stake_reward_calculation_dlist_iter_fwd_init( self->stake_rewards, self->pool );
10041 0 : !fd_stake_reward_calculation_dlist_iter_done( iter, self->stake_rewards, self->pool );
10042 0 : iter = fd_stake_reward_calculation_dlist_iter_fwd_next( iter, self->stake_rewards, self->pool ) ) {
10043 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_dlist_iter_ele( iter, self->stake_rewards, self->pool );
10044 0 : size += fd_stake_reward_size( ele );
10045 0 : }
10046 0 : }
10047 0 : size += sizeof(ulong);
10048 0 : return size;
10049 0 : }
10050 :
10051 0 : int fd_calculate_stake_vote_rewards_result_encode( fd_calculate_stake_vote_rewards_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10052 0 : int err;
10053 0 : err = fd_stake_reward_calculation_encode( &self->stake_reward_calculation, ctx );
10054 0 : if( FD_UNLIKELY( err ) ) return err;
10055 0 : if( self->vote_reward_map_root ) {
10056 0 : ulong vote_reward_map_len = fd_vote_reward_t_map_size( self->vote_reward_map_pool, self->vote_reward_map_root );
10057 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
10058 0 : if( FD_UNLIKELY( err ) ) return err;
10059 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum( self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
10060 0 : err = fd_vote_reward_encode( &n->elem, ctx );
10061 0 : if( FD_UNLIKELY( err ) ) return err;
10062 0 : }
10063 0 : } else {
10064 0 : ulong vote_reward_map_len = 0;
10065 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
10066 0 : if( FD_UNLIKELY( err ) ) return err;
10067 0 : }
10068 0 : return FD_BINCODE_SUCCESS;
10069 0 : }
10070 0 : static int fd_calculate_stake_vote_rewards_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10071 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10072 0 : int err = 0;
10073 0 : err = fd_stake_reward_calculation_decode_footprint_inner( ctx, total_sz );
10074 0 : if( FD_UNLIKELY( err ) ) return err;
10075 0 : ulong vote_reward_map_len = 0UL;
10076 0 : err = fd_bincode_uint64_decode( &vote_reward_map_len, ctx );
10077 0 : ulong vote_reward_map_cnt = fd_ulong_max( vote_reward_map_len, 15000 );
10078 0 : *total_sz += fd_vote_reward_t_map_align() + fd_vote_reward_t_map_footprint( vote_reward_map_cnt );
10079 0 : if( FD_UNLIKELY( err ) ) return err;
10080 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
10081 0 : err = fd_vote_reward_decode_footprint_inner( ctx, total_sz );
10082 0 : if( FD_UNLIKELY( err ) ) return err;
10083 0 : }
10084 0 : return 0;
10085 0 : }
10086 0 : int fd_calculate_stake_vote_rewards_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10087 0 : *total_sz += sizeof(fd_calculate_stake_vote_rewards_result_t);
10088 0 : void const * start_data = ctx->data;
10089 0 : int err = fd_calculate_stake_vote_rewards_result_decode_footprint_inner( ctx, total_sz );
10090 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10091 0 : ctx->data = start_data;
10092 0 : return err;
10093 0 : }
10094 0 : static void fd_calculate_stake_vote_rewards_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10095 0 : fd_calculate_stake_vote_rewards_result_t * self = (fd_calculate_stake_vote_rewards_result_t *)struct_mem;
10096 0 : fd_stake_reward_calculation_decode_inner( &self->stake_reward_calculation, alloc_mem, ctx );
10097 0 : ulong vote_reward_map_len;
10098 0 : fd_bincode_uint64_decode_unsafe( &vote_reward_map_len, ctx );
10099 0 : self->vote_reward_map_pool = fd_vote_reward_t_map_join_new( alloc_mem, fd_ulong_max( vote_reward_map_len, 15000 ) );
10100 0 : self->vote_reward_map_root = NULL;
10101 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
10102 0 : fd_vote_reward_t_mapnode_t * node = fd_vote_reward_t_map_acquire( self->vote_reward_map_pool );
10103 0 : fd_vote_reward_new( &node->elem );
10104 0 : fd_vote_reward_decode_inner( &node->elem, alloc_mem, ctx );
10105 0 : fd_vote_reward_t_mapnode_t * out = NULL;;
10106 0 : fd_vote_reward_t_map_insert_or_replace( self->vote_reward_map_pool, &self->vote_reward_map_root, node, &out );
10107 0 : if( out != NULL ) {
10108 0 : fd_vote_reward_t_map_release( self->vote_reward_map_pool, out );
10109 0 : }
10110 0 : }
10111 0 : }
10112 0 : void * fd_calculate_stake_vote_rewards_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10113 0 : fd_calculate_stake_vote_rewards_result_t * self = (fd_calculate_stake_vote_rewards_result_t *)mem;
10114 0 : fd_calculate_stake_vote_rewards_result_new( self );
10115 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculate_stake_vote_rewards_result_t);
10116 0 : void * * alloc_mem = &alloc_region;
10117 0 : fd_calculate_stake_vote_rewards_result_decode_inner( mem, alloc_mem, ctx );
10118 0 : return self;
10119 0 : }
10120 0 : void fd_calculate_stake_vote_rewards_result_new(fd_calculate_stake_vote_rewards_result_t * self) {
10121 0 : fd_memset( self, 0, sizeof(fd_calculate_stake_vote_rewards_result_t) );
10122 0 : fd_stake_reward_calculation_new( &self->stake_reward_calculation );
10123 0 : }
10124 0 : void fd_calculate_stake_vote_rewards_result_walk( void * w, fd_calculate_stake_vote_rewards_result_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10125 0 : (void) varint;
10126 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculate_stake_vote_rewards_result", level++, 0 );
10127 0 : fd_stake_reward_calculation_walk( w, &self->stake_reward_calculation, fun, "stake_reward_calculation", level, 0 );
10128 0 : if( self->vote_reward_map_root ) {
10129 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum(self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
10130 0 : fd_vote_reward_walk(w, &n->elem, fun, "vote_reward_map", level, 0 );
10131 0 : }
10132 0 : }
10133 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculate_stake_vote_rewards_result", level--, 0 );
10134 0 : }
10135 0 : ulong fd_calculate_stake_vote_rewards_result_size( fd_calculate_stake_vote_rewards_result_t const * self ) {
10136 0 : ulong size = 0;
10137 0 : size += fd_stake_reward_calculation_size( &self->stake_reward_calculation );
10138 0 : if( self->vote_reward_map_root ) {
10139 0 : size += sizeof(ulong);
10140 0 : ulong max = fd_vote_reward_t_map_max( self->vote_reward_map_pool );
10141 0 : size += fd_vote_reward_t_map_footprint( max );
10142 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum( self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
10143 0 : size += fd_vote_reward_size( &n->elem ) - sizeof(fd_vote_reward_t);
10144 0 : }
10145 0 : } else {
10146 0 : size += sizeof(ulong);
10147 0 : }
10148 0 : return size;
10149 0 : }
10150 :
10151 0 : int fd_calculate_validator_rewards_result_encode( fd_calculate_validator_rewards_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10152 0 : int err;
10153 0 : err = fd_calculate_stake_vote_rewards_result_encode( &self->calculate_stake_vote_rewards_result, ctx );
10154 0 : if( FD_UNLIKELY( err ) ) return err;
10155 0 : err = fd_point_value_encode( &self->point_value, ctx );
10156 0 : if( FD_UNLIKELY( err ) ) return err;
10157 0 : return FD_BINCODE_SUCCESS;
10158 0 : }
10159 0 : static int fd_calculate_validator_rewards_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10160 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10161 0 : int err = 0;
10162 0 : err = fd_calculate_stake_vote_rewards_result_decode_footprint_inner( ctx, total_sz );
10163 0 : if( FD_UNLIKELY( err ) ) return err;
10164 0 : err = fd_point_value_decode_footprint_inner( ctx, total_sz );
10165 0 : if( FD_UNLIKELY( err ) ) return err;
10166 0 : return 0;
10167 0 : }
10168 0 : int fd_calculate_validator_rewards_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10169 0 : *total_sz += sizeof(fd_calculate_validator_rewards_result_t);
10170 0 : void const * start_data = ctx->data;
10171 0 : int err = fd_calculate_validator_rewards_result_decode_footprint_inner( ctx, total_sz );
10172 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10173 0 : ctx->data = start_data;
10174 0 : return err;
10175 0 : }
10176 0 : static void fd_calculate_validator_rewards_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10177 0 : fd_calculate_validator_rewards_result_t * self = (fd_calculate_validator_rewards_result_t *)struct_mem;
10178 0 : fd_calculate_stake_vote_rewards_result_decode_inner( &self->calculate_stake_vote_rewards_result, alloc_mem, ctx );
10179 0 : fd_point_value_decode_inner( &self->point_value, alloc_mem, ctx );
10180 0 : }
10181 0 : void * fd_calculate_validator_rewards_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10182 0 : fd_calculate_validator_rewards_result_t * self = (fd_calculate_validator_rewards_result_t *)mem;
10183 0 : fd_calculate_validator_rewards_result_new( self );
10184 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculate_validator_rewards_result_t);
10185 0 : void * * alloc_mem = &alloc_region;
10186 0 : fd_calculate_validator_rewards_result_decode_inner( mem, alloc_mem, ctx );
10187 0 : return self;
10188 0 : }
10189 0 : void fd_calculate_validator_rewards_result_new(fd_calculate_validator_rewards_result_t * self) {
10190 0 : fd_memset( self, 0, sizeof(fd_calculate_validator_rewards_result_t) );
10191 0 : fd_calculate_stake_vote_rewards_result_new( &self->calculate_stake_vote_rewards_result );
10192 0 : fd_point_value_new( &self->point_value );
10193 0 : }
10194 0 : void fd_calculate_validator_rewards_result_walk( void * w, fd_calculate_validator_rewards_result_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10195 0 : (void) varint;
10196 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculate_validator_rewards_result", level++, 0 );
10197 0 : fd_calculate_stake_vote_rewards_result_walk( w, &self->calculate_stake_vote_rewards_result, fun, "calculate_stake_vote_rewards_result", level, 0 );
10198 0 : fd_point_value_walk( w, &self->point_value, fun, "point_value", level, 0 );
10199 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculate_validator_rewards_result", level--, 0 );
10200 0 : }
10201 0 : ulong fd_calculate_validator_rewards_result_size( fd_calculate_validator_rewards_result_t const * self ) {
10202 0 : ulong size = 0;
10203 0 : size += fd_calculate_stake_vote_rewards_result_size( &self->calculate_stake_vote_rewards_result );
10204 0 : size += fd_point_value_size( &self->point_value );
10205 0 : return size;
10206 0 : }
10207 :
10208 0 : int fd_partitioned_rewards_calculation_encode( fd_partitioned_rewards_calculation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10209 0 : int err;
10210 0 : if( self->vote_reward_map_root ) {
10211 0 : ulong vote_reward_map_len = fd_vote_reward_t_map_size( self->vote_reward_map_pool, self->vote_reward_map_root );
10212 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
10213 0 : if( FD_UNLIKELY( err ) ) return err;
10214 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum( self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
10215 0 : err = fd_vote_reward_encode( &n->elem, ctx );
10216 0 : if( FD_UNLIKELY( err ) ) return err;
10217 0 : }
10218 0 : } else {
10219 0 : ulong vote_reward_map_len = 0;
10220 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
10221 0 : if( FD_UNLIKELY( err ) ) return err;
10222 0 : }
10223 0 : err = fd_stake_reward_calculation_partitioned_encode( &self->stake_rewards_by_partition, ctx );
10224 0 : if( FD_UNLIKELY( err ) ) return err;
10225 0 : err = fd_bincode_uint64_encode( self->old_vote_balance_and_staked, ctx );
10226 0 : if( FD_UNLIKELY( err ) ) return err;
10227 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
10228 0 : if( FD_UNLIKELY( err ) ) return err;
10229 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
10230 0 : if( FD_UNLIKELY( err ) ) return err;
10231 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
10232 0 : if( FD_UNLIKELY( err ) ) return err;
10233 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
10234 0 : if( FD_UNLIKELY( err ) ) return err;
10235 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
10236 0 : if( FD_UNLIKELY( err ) ) return err;
10237 0 : err = fd_point_value_encode( &self->point_value, ctx );
10238 0 : if( FD_UNLIKELY( err ) ) return err;
10239 0 : return FD_BINCODE_SUCCESS;
10240 0 : }
10241 0 : static int fd_partitioned_rewards_calculation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10242 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10243 0 : int err = 0;
10244 0 : ulong vote_reward_map_len = 0UL;
10245 0 : err = fd_bincode_uint64_decode( &vote_reward_map_len, ctx );
10246 0 : ulong vote_reward_map_cnt = fd_ulong_max( vote_reward_map_len, 15000 );
10247 0 : *total_sz += fd_vote_reward_t_map_align() + fd_vote_reward_t_map_footprint( vote_reward_map_cnt );
10248 0 : if( FD_UNLIKELY( err ) ) return err;
10249 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
10250 0 : err = fd_vote_reward_decode_footprint_inner( ctx, total_sz );
10251 0 : if( FD_UNLIKELY( err ) ) return err;
10252 0 : }
10253 0 : err = fd_stake_reward_calculation_partitioned_decode_footprint_inner( ctx, total_sz );
10254 0 : if( FD_UNLIKELY( err ) ) return err;
10255 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10256 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10257 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10258 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10259 0 : err = fd_bincode_double_decode_footprint( ctx );
10260 0 : if( FD_UNLIKELY( err ) ) return err;
10261 0 : err = fd_bincode_double_decode_footprint( ctx );
10262 0 : if( FD_UNLIKELY( err ) ) return err;
10263 0 : err = fd_bincode_double_decode_footprint( ctx );
10264 0 : if( FD_UNLIKELY( err ) ) return err;
10265 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10266 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10267 0 : err = fd_point_value_decode_footprint_inner( ctx, total_sz );
10268 0 : if( FD_UNLIKELY( err ) ) return err;
10269 0 : return 0;
10270 0 : }
10271 0 : int fd_partitioned_rewards_calculation_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10272 0 : *total_sz += sizeof(fd_partitioned_rewards_calculation_t);
10273 0 : void const * start_data = ctx->data;
10274 0 : int err = fd_partitioned_rewards_calculation_decode_footprint_inner( ctx, total_sz );
10275 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10276 0 : ctx->data = start_data;
10277 0 : return err;
10278 0 : }
10279 0 : static void fd_partitioned_rewards_calculation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10280 0 : fd_partitioned_rewards_calculation_t * self = (fd_partitioned_rewards_calculation_t *)struct_mem;
10281 0 : ulong vote_reward_map_len;
10282 0 : fd_bincode_uint64_decode_unsafe( &vote_reward_map_len, ctx );
10283 0 : self->vote_reward_map_pool = fd_vote_reward_t_map_join_new( alloc_mem, fd_ulong_max( vote_reward_map_len, 15000 ) );
10284 0 : self->vote_reward_map_root = NULL;
10285 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
10286 0 : fd_vote_reward_t_mapnode_t * node = fd_vote_reward_t_map_acquire( self->vote_reward_map_pool );
10287 0 : fd_vote_reward_new( &node->elem );
10288 0 : fd_vote_reward_decode_inner( &node->elem, alloc_mem, ctx );
10289 0 : fd_vote_reward_t_mapnode_t * out = NULL;;
10290 0 : fd_vote_reward_t_map_insert_or_replace( self->vote_reward_map_pool, &self->vote_reward_map_root, node, &out );
10291 0 : if( out != NULL ) {
10292 0 : fd_vote_reward_t_map_release( self->vote_reward_map_pool, out );
10293 0 : }
10294 0 : }
10295 0 : fd_stake_reward_calculation_partitioned_decode_inner( &self->stake_rewards_by_partition, alloc_mem, ctx );
10296 0 : fd_bincode_uint64_decode_unsafe( &self->old_vote_balance_and_staked, ctx );
10297 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
10298 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
10299 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
10300 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
10301 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
10302 0 : fd_point_value_decode_inner( &self->point_value, alloc_mem, ctx );
10303 0 : }
10304 0 : void * fd_partitioned_rewards_calculation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10305 0 : fd_partitioned_rewards_calculation_t * self = (fd_partitioned_rewards_calculation_t *)mem;
10306 0 : fd_partitioned_rewards_calculation_new( self );
10307 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_rewards_calculation_t);
10308 0 : void * * alloc_mem = &alloc_region;
10309 0 : fd_partitioned_rewards_calculation_decode_inner( mem, alloc_mem, ctx );
10310 0 : return self;
10311 0 : }
10312 0 : void fd_partitioned_rewards_calculation_new(fd_partitioned_rewards_calculation_t * self) {
10313 0 : fd_memset( self, 0, sizeof(fd_partitioned_rewards_calculation_t) );
10314 0 : fd_stake_reward_calculation_partitioned_new( &self->stake_rewards_by_partition );
10315 0 : fd_point_value_new( &self->point_value );
10316 0 : }
10317 0 : void fd_partitioned_rewards_calculation_walk( void * w, fd_partitioned_rewards_calculation_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10318 0 : (void) varint;
10319 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_partitioned_rewards_calculation", level++, 0 );
10320 0 : if( self->vote_reward_map_root ) {
10321 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum(self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
10322 0 : fd_vote_reward_walk(w, &n->elem, fun, "vote_reward_map", level, 0 );
10323 0 : }
10324 0 : }
10325 0 : fd_stake_reward_calculation_partitioned_walk( w, &self->stake_rewards_by_partition, fun, "stake_rewards_by_partition", level, 0 );
10326 0 : fun( w, &self->old_vote_balance_and_staked, "old_vote_balance_and_staked", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10327 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10328 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
10329 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
10330 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
10331 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10332 0 : fd_point_value_walk( w, &self->point_value, fun, "point_value", level, 0 );
10333 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_partitioned_rewards_calculation", level--, 0 );
10334 0 : }
10335 0 : ulong fd_partitioned_rewards_calculation_size( fd_partitioned_rewards_calculation_t const * self ) {
10336 0 : ulong size = 0;
10337 0 : if( self->vote_reward_map_root ) {
10338 0 : size += sizeof(ulong);
10339 0 : ulong max = fd_vote_reward_t_map_max( self->vote_reward_map_pool );
10340 0 : size += fd_vote_reward_t_map_footprint( max );
10341 0 : for( fd_vote_reward_t_mapnode_t * n = fd_vote_reward_t_map_minimum( self->vote_reward_map_pool, self->vote_reward_map_root ); n; n = fd_vote_reward_t_map_successor( self->vote_reward_map_pool, n ) ) {
10342 0 : size += fd_vote_reward_size( &n->elem ) - sizeof(fd_vote_reward_t);
10343 0 : }
10344 0 : } else {
10345 0 : size += sizeof(ulong);
10346 0 : }
10347 0 : size += fd_stake_reward_calculation_partitioned_size( &self->stake_rewards_by_partition );
10348 0 : size += sizeof(ulong);
10349 0 : size += sizeof(ulong);
10350 0 : size += sizeof(double);
10351 0 : size += sizeof(double);
10352 0 : size += sizeof(double);
10353 0 : size += sizeof(ulong);
10354 0 : size += fd_point_value_size( &self->point_value );
10355 0 : return size;
10356 0 : }
10357 :
10358 0 : int fd_start_block_height_and_rewards_encode( fd_start_block_height_and_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10359 0 : int err;
10360 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
10361 0 : if( FD_UNLIKELY( err ) ) return err;
10362 0 : err = fd_partitioned_stake_rewards_encode( &self->partitioned_stake_rewards, ctx );
10363 0 : if( FD_UNLIKELY( err ) ) return err;
10364 0 : return FD_BINCODE_SUCCESS;
10365 0 : }
10366 0 : int fd_start_block_height_and_rewards_encode_global( fd_start_block_height_and_rewards_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10367 0 : int err;
10368 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
10369 0 : if( FD_UNLIKELY( err ) ) return err;
10370 0 : err = fd_partitioned_stake_rewards_encode_global( &self->partitioned_stake_rewards, ctx );
10371 0 : if( FD_UNLIKELY( err ) ) return err;
10372 0 : return FD_BINCODE_SUCCESS;
10373 0 : }
10374 0 : static int fd_start_block_height_and_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10375 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10376 0 : int err = 0;
10377 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10378 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10379 0 : err = fd_partitioned_stake_rewards_decode_footprint_inner( ctx, total_sz );
10380 0 : if( FD_UNLIKELY( err ) ) return err;
10381 0 : return 0;
10382 0 : }
10383 0 : int fd_start_block_height_and_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10384 0 : *total_sz += sizeof(fd_start_block_height_and_rewards_t);
10385 0 : void const * start_data = ctx->data;
10386 0 : int err = fd_start_block_height_and_rewards_decode_footprint_inner( ctx, total_sz );
10387 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10388 0 : ctx->data = start_data;
10389 0 : return err;
10390 0 : }
10391 0 : static void fd_start_block_height_and_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10392 0 : fd_start_block_height_and_rewards_t * self = (fd_start_block_height_and_rewards_t *)struct_mem;
10393 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
10394 0 : fd_partitioned_stake_rewards_decode_inner( &self->partitioned_stake_rewards, alloc_mem, ctx );
10395 0 : }
10396 0 : void * fd_start_block_height_and_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10397 0 : fd_start_block_height_and_rewards_t * self = (fd_start_block_height_and_rewards_t *)mem;
10398 0 : fd_start_block_height_and_rewards_new( self );
10399 0 : void * alloc_region = (uchar *)mem + sizeof(fd_start_block_height_and_rewards_t);
10400 0 : void * * alloc_mem = &alloc_region;
10401 0 : fd_start_block_height_and_rewards_decode_inner( mem, alloc_mem, ctx );
10402 0 : return self;
10403 0 : }
10404 0 : static void fd_start_block_height_and_rewards_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10405 0 : fd_start_block_height_and_rewards_global_t * self = (fd_start_block_height_and_rewards_global_t *)struct_mem;
10406 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
10407 0 : fd_partitioned_stake_rewards_decode_inner_global( &self->partitioned_stake_rewards, alloc_mem, ctx );
10408 0 : }
10409 0 : void * fd_start_block_height_and_rewards_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10410 0 : fd_start_block_height_and_rewards_global_t * self = (fd_start_block_height_and_rewards_global_t *)mem;
10411 0 : fd_start_block_height_and_rewards_new( (fd_start_block_height_and_rewards_t *)self );
10412 0 : void * alloc_region = (uchar *)mem + sizeof(fd_start_block_height_and_rewards_global_t);
10413 0 : void * * alloc_mem = &alloc_region;
10414 0 : fd_start_block_height_and_rewards_decode_inner_global( mem, alloc_mem, ctx );
10415 0 : return self;
10416 0 : }
10417 0 : void fd_start_block_height_and_rewards_new(fd_start_block_height_and_rewards_t * self) {
10418 0 : fd_memset( self, 0, sizeof(fd_start_block_height_and_rewards_t) );
10419 0 : fd_partitioned_stake_rewards_new( &self->partitioned_stake_rewards );
10420 0 : }
10421 0 : void fd_start_block_height_and_rewards_walk( void * w, fd_start_block_height_and_rewards_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10422 0 : (void) varint;
10423 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_start_block_height_and_rewards", level++, 0 );
10424 0 : fun( w, &self->distribution_starting_block_height, "distribution_starting_block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10425 0 : fd_partitioned_stake_rewards_walk( w, &self->partitioned_stake_rewards, fun, "partitioned_stake_rewards", level, 0 );
10426 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_start_block_height_and_rewards", level--, 0 );
10427 0 : }
10428 0 : ulong fd_start_block_height_and_rewards_size( fd_start_block_height_and_rewards_t const * self ) {
10429 0 : ulong size = 0;
10430 0 : size += sizeof(ulong);
10431 0 : size += fd_partitioned_stake_rewards_size( &self->partitioned_stake_rewards );
10432 0 : return size;
10433 0 : }
10434 :
10435 0 : ulong fd_start_block_height_and_rewards_size_global( fd_start_block_height_and_rewards_global_t const * self ) {
10436 0 : ulong size = 0;
10437 0 : size += sizeof(ulong);
10438 0 : size += fd_partitioned_stake_rewards_size_global( &self->partitioned_stake_rewards );
10439 0 : return size;
10440 0 : }
10441 :
10442 0 : int fd_fd_epoch_reward_status_inner_encode( fd_fd_epoch_reward_status_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10443 0 : int err;
10444 0 : err = fd_start_block_height_and_rewards_encode( &self->Active, ctx );
10445 0 : if( FD_UNLIKELY( err ) ) return err;
10446 0 : return FD_BINCODE_SUCCESS;
10447 0 : }
10448 0 : static int fd_fd_epoch_reward_status_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10449 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10450 0 : int err = 0;
10451 0 : err = fd_start_block_height_and_rewards_decode_footprint_inner( ctx, total_sz );
10452 0 : if( FD_UNLIKELY( err ) ) return err;
10453 0 : return 0;
10454 0 : }
10455 0 : int fd_fd_epoch_reward_status_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10456 0 : *total_sz += sizeof(fd_fd_epoch_reward_status_inner_t);
10457 0 : void const * start_data = ctx->data;
10458 0 : int err = fd_fd_epoch_reward_status_inner_decode_footprint_inner( ctx, total_sz );
10459 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10460 0 : ctx->data = start_data;
10461 0 : return err;
10462 0 : }
10463 0 : static void fd_fd_epoch_reward_status_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10464 0 : fd_fd_epoch_reward_status_inner_t * self = (fd_fd_epoch_reward_status_inner_t *)struct_mem;
10465 0 : fd_start_block_height_and_rewards_decode_inner( &self->Active, alloc_mem, ctx );
10466 0 : }
10467 0 : void * fd_fd_epoch_reward_status_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10468 0 : fd_fd_epoch_reward_status_inner_t * self = (fd_fd_epoch_reward_status_inner_t *)mem;
10469 0 : fd_fd_epoch_reward_status_inner_new( self );
10470 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fd_epoch_reward_status_inner_t);
10471 0 : void * * alloc_mem = &alloc_region;
10472 0 : fd_fd_epoch_reward_status_inner_decode_inner( mem, alloc_mem, ctx );
10473 0 : return self;
10474 0 : }
10475 0 : void fd_fd_epoch_reward_status_inner_new(fd_fd_epoch_reward_status_inner_t * self) {
10476 0 : fd_memset( self, 0, sizeof(fd_fd_epoch_reward_status_inner_t) );
10477 0 : fd_start_block_height_and_rewards_new( &self->Active );
10478 0 : }
10479 0 : void fd_fd_epoch_reward_status_inner_walk( void * w, fd_fd_epoch_reward_status_inner_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10480 0 : (void) varint;
10481 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fd_epoch_reward_status_inner", level++, 0 );
10482 0 : fd_start_block_height_and_rewards_walk( w, &self->Active, fun, "Active", level, 0 );
10483 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fd_epoch_reward_status_inner", level--, 0 );
10484 0 : }
10485 0 : ulong fd_fd_epoch_reward_status_inner_size( fd_fd_epoch_reward_status_inner_t const * self ) {
10486 0 : ulong size = 0;
10487 0 : size += fd_start_block_height_and_rewards_size( &self->Active );
10488 0 : return size;
10489 0 : }
10490 :
10491 0 : FD_FN_PURE uchar fd_epoch_reward_status_is_Active(fd_epoch_reward_status_t const * self) {
10492 0 : return self->discriminant == 0;
10493 0 : }
10494 0 : FD_FN_PURE uchar fd_epoch_reward_status_is_Inactive(fd_epoch_reward_status_t const * self) {
10495 0 : return self->discriminant == 1;
10496 0 : }
10497 : void fd_epoch_reward_status_inner_new( fd_epoch_reward_status_inner_t * self, uint discriminant );
10498 0 : int fd_epoch_reward_status_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10499 0 : int err;
10500 0 : switch (discriminant) {
10501 0 : case 0: {
10502 0 : err = fd_start_block_height_and_rewards_decode_footprint_inner( ctx, total_sz );
10503 0 : if( FD_UNLIKELY( err ) ) return err;
10504 0 : return FD_BINCODE_SUCCESS;
10505 0 : }
10506 0 : case 1: {
10507 0 : return FD_BINCODE_SUCCESS;
10508 0 : }
10509 0 : default: return FD_BINCODE_ERR_ENCODING;
10510 0 : }
10511 0 : }
10512 0 : static int fd_epoch_reward_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10513 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10514 0 : uint discriminant = 0;
10515 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10516 0 : if( FD_UNLIKELY( err ) ) return err;
10517 0 : return fd_epoch_reward_status_inner_decode_footprint( discriminant, ctx, total_sz );
10518 0 : }
10519 0 : int fd_epoch_reward_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10520 0 : *total_sz += sizeof(fd_epoch_reward_status_t);
10521 0 : void const * start_data = ctx->data;
10522 0 : int err = fd_epoch_reward_status_decode_footprint_inner( ctx, total_sz );
10523 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10524 0 : ctx->data = start_data;
10525 0 : return err;
10526 0 : }
10527 0 : static void fd_epoch_reward_status_inner_decode_inner( fd_epoch_reward_status_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
10528 0 : switch (discriminant) {
10529 0 : case 0: {
10530 0 : fd_start_block_height_and_rewards_decode_inner( &self->Active, alloc_mem, ctx );
10531 0 : break;
10532 0 : }
10533 0 : case 1: {
10534 0 : break;
10535 0 : }
10536 0 : }
10537 0 : }
10538 0 : static void fd_epoch_reward_status_inner_decode_inner_global( fd_epoch_reward_status_inner_global_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
10539 0 : switch (discriminant) {
10540 0 : case 0: {
10541 0 : fd_start_block_height_and_rewards_decode_inner_global( &self->Active, alloc_mem, ctx );
10542 0 : break;
10543 0 : }
10544 0 : case 1: {
10545 0 : break;
10546 0 : }
10547 0 : }
10548 0 : }
10549 0 : static void fd_epoch_reward_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10550 0 : fd_epoch_reward_status_t * self = (fd_epoch_reward_status_t *)struct_mem;
10551 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10552 0 : fd_epoch_reward_status_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10553 0 : }
10554 0 : void * fd_epoch_reward_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10555 0 : fd_epoch_reward_status_t * self = (fd_epoch_reward_status_t *)mem;
10556 0 : fd_epoch_reward_status_new( self );
10557 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_reward_status_t);
10558 0 : void * * alloc_mem = &alloc_region;
10559 0 : fd_epoch_reward_status_decode_inner( mem, alloc_mem, ctx );
10560 0 : return self;
10561 0 : }
10562 0 : static int fd_epoch_reward_status_inner_encode_global( fd_epoch_reward_status_inner_global_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10563 0 : int err;
10564 0 : switch (discriminant) {
10565 0 : case 0: {
10566 0 : err = fd_start_block_height_and_rewards_encode_global( &self->Active, ctx );
10567 0 : if( FD_UNLIKELY( err ) ) return err;
10568 0 : break;
10569 0 : }
10570 0 : }
10571 0 : return FD_BINCODE_SUCCESS;
10572 0 : }
10573 0 : int fd_epoch_reward_status_encode_global( fd_epoch_reward_status_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10574 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10575 0 : if( FD_UNLIKELY( err ) ) return err;
10576 0 : return fd_epoch_reward_status_inner_encode_global( &self->inner, self->discriminant, ctx );
10577 0 : }
10578 :
10579 0 : static void fd_epoch_reward_status_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10580 0 : fd_epoch_reward_status_global_t * self = (fd_epoch_reward_status_global_t *)struct_mem;
10581 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10582 0 : fd_epoch_reward_status_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
10583 0 : }
10584 0 : void * fd_epoch_reward_status_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10585 0 : fd_epoch_reward_status_t * self = (fd_epoch_reward_status_t *)mem;
10586 0 : fd_epoch_reward_status_new( self );
10587 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_reward_status_t);
10588 0 : void * * alloc_mem = &alloc_region;
10589 0 : fd_epoch_reward_status_decode_inner_global( mem, alloc_mem, ctx );
10590 0 : return self;
10591 0 : }
10592 0 : void fd_epoch_reward_status_inner_new( fd_epoch_reward_status_inner_t * self, uint discriminant ) {
10593 0 : switch( discriminant ) {
10594 0 : case 0: {
10595 0 : fd_start_block_height_and_rewards_new( &self->Active );
10596 0 : break;
10597 0 : }
10598 0 : case 1: {
10599 0 : break;
10600 0 : }
10601 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10602 0 : }
10603 0 : }
10604 0 : void fd_epoch_reward_status_new_disc( fd_epoch_reward_status_t * self, uint discriminant ) {
10605 0 : self->discriminant = discriminant;
10606 0 : fd_epoch_reward_status_inner_new( &self->inner, self->discriminant );
10607 0 : }
10608 0 : void fd_epoch_reward_status_new( fd_epoch_reward_status_t * self ) {
10609 0 : fd_memset( self, 0, sizeof(fd_epoch_reward_status_t) );
10610 0 : fd_epoch_reward_status_new_disc( self, UINT_MAX );
10611 0 : }
10612 :
10613 0 : void fd_epoch_reward_status_walk( void * w, fd_epoch_reward_status_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10614 0 : (void) varint;
10615 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_epoch_reward_status", level++, 0);
10616 0 : switch( self->discriminant ) {
10617 0 : case 0: {
10618 0 : fun( w, self, "Active", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10619 0 : fd_start_block_height_and_rewards_walk( w, &self->inner.Active, fun, "Active", level, 0 );
10620 0 : break;
10621 0 : }
10622 0 : case 1: {
10623 0 : fun( w, self, "Inactive", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10624 0 : break;
10625 0 : }
10626 0 : }
10627 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_epoch_reward_status", level--, 0 );
10628 0 : }
10629 0 : ulong fd_epoch_reward_status_size( fd_epoch_reward_status_t const * self ) {
10630 0 : ulong size = 0;
10631 0 : size += sizeof(uint);
10632 0 : switch (self->discriminant) {
10633 0 : case 0: {
10634 0 : size += fd_start_block_height_and_rewards_size( &self->inner.Active );
10635 0 : break;
10636 0 : }
10637 0 : }
10638 0 : return size;
10639 0 : }
10640 :
10641 0 : ulong fd_epoch_reward_status_size_global( fd_epoch_reward_status_global_t const * self ) {
10642 0 : ulong size = 0;
10643 0 : size += sizeof(uint);
10644 0 : switch (self->discriminant) {
10645 0 : case 0: {
10646 0 : size += fd_start_block_height_and_rewards_size_global( &self->inner.Active );
10647 0 : break;
10648 0 : }
10649 0 : }
10650 0 : return size;
10651 0 : }
10652 :
10653 0 : int fd_epoch_reward_status_inner_encode( fd_epoch_reward_status_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10654 0 : int err;
10655 0 : switch (discriminant) {
10656 0 : case 0: {
10657 0 : err = fd_start_block_height_and_rewards_encode( &self->Active, ctx );
10658 0 : if( FD_UNLIKELY( err ) ) return err;
10659 0 : break;
10660 0 : }
10661 0 : }
10662 0 : return FD_BINCODE_SUCCESS;
10663 0 : }
10664 0 : int fd_epoch_reward_status_encode( fd_epoch_reward_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10665 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10666 0 : if( FD_UNLIKELY( err ) ) return err;
10667 0 : return fd_epoch_reward_status_inner_encode( &self->inner, self->discriminant, ctx );
10668 0 : }
10669 :
10670 0 : int fd_prev_epoch_inflation_rewards_encode( fd_prev_epoch_inflation_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10671 0 : int err;
10672 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
10673 0 : if( FD_UNLIKELY( err ) ) return err;
10674 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
10675 0 : if( FD_UNLIKELY( err ) ) return err;
10676 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
10677 0 : if( FD_UNLIKELY( err ) ) return err;
10678 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
10679 0 : if( FD_UNLIKELY( err ) ) return err;
10680 0 : return FD_BINCODE_SUCCESS;
10681 0 : }
10682 0 : static inline int fd_prev_epoch_inflation_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10683 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10684 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
10685 0 : return 0;
10686 0 : }
10687 0 : static void fd_prev_epoch_inflation_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10688 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)struct_mem;
10689 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
10690 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
10691 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
10692 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
10693 0 : }
10694 0 : void * fd_prev_epoch_inflation_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10695 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)mem;
10696 0 : fd_prev_epoch_inflation_rewards_new( self );
10697 0 : void * alloc_region = (uchar *)mem + sizeof(fd_prev_epoch_inflation_rewards_t);
10698 0 : void * * alloc_mem = &alloc_region;
10699 0 : fd_prev_epoch_inflation_rewards_decode_inner( mem, alloc_mem, ctx );
10700 0 : return self;
10701 0 : }
10702 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, uint varint ) {
10703 0 : (void) varint;
10704 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_prev_epoch_inflation_rewards", level++, 0 );
10705 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10706 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
10707 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
10708 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
10709 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_prev_epoch_inflation_rewards", level--, 0 );
10710 0 : }
10711 0 : int fd_vote_encode( fd_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10712 0 : int err;
10713 0 : if( self->slots ) {
10714 0 : ulong slots_len = deq_ulong_cnt( self->slots );
10715 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
10716 0 : if( FD_UNLIKELY( err ) ) return err;
10717 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 ) ) {
10718 0 : ulong const * ele = deq_ulong_iter_ele_const( self->slots, iter );
10719 0 : err = fd_bincode_uint64_encode( ele[0], ctx );
10720 0 : }
10721 0 : } else {
10722 0 : ulong slots_len = 0;
10723 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
10724 0 : if( FD_UNLIKELY( err ) ) return err;
10725 0 : }
10726 0 : err = fd_hash_encode( &self->hash, ctx );
10727 0 : if( FD_UNLIKELY( err ) ) return err;
10728 0 : if( self->timestamp != NULL ) {
10729 0 : err = fd_bincode_bool_encode( 1, ctx );
10730 0 : if( FD_UNLIKELY( err ) ) return err;
10731 0 : err = fd_bincode_int64_encode( self->timestamp[0], ctx );
10732 0 : if( FD_UNLIKELY( err ) ) return err;
10733 0 : } else {
10734 0 : err = fd_bincode_bool_encode( 0, ctx );
10735 0 : if( FD_UNLIKELY( err ) ) return err;
10736 0 : }
10737 0 : return FD_BINCODE_SUCCESS;
10738 0 : }
10739 0 : static int fd_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10740 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10741 0 : int err = 0;
10742 0 : ulong slots_len;
10743 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
10744 0 : if( FD_UNLIKELY( err ) ) return err;
10745 0 : ulong slots_max = slots_len == 0 ? 1 : slots_len;
10746 0 : *total_sz += deq_ulong_align() + deq_ulong_footprint( slots_max ) ;
10747 0 : ulong slots_sz;
10748 0 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
10749 0 : err = fd_bincode_bytes_decode_footprint( slots_sz, ctx );
10750 0 : if( FD_UNLIKELY( err ) ) return err;
10751 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
10752 0 : if( FD_UNLIKELY( err ) ) return err;
10753 0 : {
10754 0 : uchar o;
10755 0 : err = fd_bincode_bool_decode( &o, ctx );
10756 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10757 0 : if( o ) {
10758 0 : *total_sz += 8UL + sizeof(long);
10759 0 : err = fd_bincode_int64_decode_footprint( ctx );
10760 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10761 0 : }
10762 0 : }
10763 0 : return 0;
10764 0 : }
10765 0 : int fd_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10766 0 : *total_sz += sizeof(fd_vote_t);
10767 0 : void const * start_data = ctx->data;
10768 0 : int err = fd_vote_decode_footprint_inner( ctx, total_sz );
10769 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10770 0 : ctx->data = start_data;
10771 0 : return err;
10772 0 : }
10773 0 : static void fd_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10774 0 : fd_vote_t * self = (fd_vote_t *)struct_mem;
10775 0 : ulong slots_len;
10776 0 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
10777 0 : self->slots = deq_ulong_join_new( alloc_mem, slots_len );
10778 0 : for( ulong i=0; i < slots_len; i++ ) {
10779 0 : ulong * elem = deq_ulong_push_tail_nocopy( self->slots );
10780 0 : fd_bincode_uint64_decode_unsafe( elem, ctx );
10781 0 : }
10782 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
10783 0 : {
10784 0 : uchar o;
10785 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10786 0 : if( o ) {
10787 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
10788 0 : self->timestamp = *alloc_mem;
10789 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
10790 0 : fd_bincode_int64_decode_unsafe( self->timestamp, ctx );
10791 0 : } else {
10792 0 : self->timestamp = NULL;
10793 0 : }
10794 0 : }
10795 0 : }
10796 0 : void * fd_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10797 0 : fd_vote_t * self = (fd_vote_t *)mem;
10798 0 : fd_vote_new( self );
10799 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_t);
10800 0 : void * * alloc_mem = &alloc_region;
10801 0 : fd_vote_decode_inner( mem, alloc_mem, ctx );
10802 0 : return self;
10803 0 : }
10804 0 : void fd_vote_new(fd_vote_t * self) {
10805 0 : fd_memset( self, 0, sizeof(fd_vote_t) );
10806 0 : fd_hash_new( &self->hash );
10807 0 : }
10808 0 : void fd_vote_walk( void * w, fd_vote_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
10809 0 : (void) varint;
10810 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote", level++, 0 );
10811 :
10812 : /* Walk deque */
10813 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR, "slots", level++, 0 );
10814 0 : if( self->slots ) {
10815 0 : for( deq_ulong_iter_t iter = deq_ulong_iter_init( self->slots );
10816 0 : !deq_ulong_iter_done( self->slots, iter );
10817 0 : iter = deq_ulong_iter_next( self->slots, iter ) ) {
10818 0 : ulong * ele = deq_ulong_iter_ele( self->slots, iter );
10819 0 : fun(w, ele, "ele", FD_FLAMENCO_TYPE_ULONG, "long", level, 0 );
10820 0 : }
10821 0 : }
10822 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR_END, "slots", level--, 0 );
10823 : /* Done walking deque */
10824 :
10825 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
10826 0 : if( !self->timestamp ) {
10827 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
10828 0 : } else {
10829 0 : fun( w, self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
10830 0 : }
10831 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote", level--, 0 );
10832 0 : }
10833 0 : ulong fd_vote_size( fd_vote_t const * self ) {
10834 0 : ulong size = 0;
10835 0 : if( self->slots ) {
10836 0 : size += sizeof(ulong);
10837 0 : ulong slots_len = deq_ulong_cnt(self->slots);
10838 0 : size += slots_len * sizeof(ulong);
10839 0 : } else {
10840 0 : size += sizeof(ulong);
10841 0 : }
10842 0 : size += fd_hash_size( &self->hash );
10843 0 : size += sizeof(char);
10844 0 : if( NULL != self->timestamp ) {
10845 0 : size += sizeof(long);
10846 0 : }
10847 0 : return size;
10848 0 : }
10849 :
10850 0 : int fd_vote_init_encode( fd_vote_init_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10851 0 : int err;
10852 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
10853 0 : if( FD_UNLIKELY( err ) ) return err;
10854 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
10855 0 : if( FD_UNLIKELY( err ) ) return err;
10856 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
10857 0 : if( FD_UNLIKELY( err ) ) return err;
10858 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
10859 0 : if( FD_UNLIKELY( err ) ) return err;
10860 0 : return FD_BINCODE_SUCCESS;
10861 0 : }
10862 0 : static inline int fd_vote_init_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10863 0 : if( (ulong)ctx->data + 97UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10864 0 : ctx->data = (void *)( (ulong)ctx->data + 97UL );
10865 0 : return 0;
10866 0 : }
10867 0 : static void fd_vote_init_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10868 0 : fd_vote_init_t * self = (fd_vote_init_t *)struct_mem;
10869 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
10870 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
10871 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
10872 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
10873 0 : }
10874 0 : void * fd_vote_init_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10875 0 : fd_vote_init_t * self = (fd_vote_init_t *)mem;
10876 0 : fd_vote_init_new( self );
10877 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_t);
10878 0 : void * * alloc_mem = &alloc_region;
10879 0 : fd_vote_init_decode_inner( mem, alloc_mem, ctx );
10880 0 : return self;
10881 0 : }
10882 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, uint varint ) {
10883 0 : (void) varint;
10884 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_init", level++, 0 );
10885 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
10886 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level, 0 );
10887 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
10888 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
10889 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_init", level--, 0 );
10890 0 : }
10891 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter(fd_vote_authorize_t const * self) {
10892 0 : return self->discriminant == 0;
10893 0 : }
10894 0 : FD_FN_PURE uchar fd_vote_authorize_is_withdrawer(fd_vote_authorize_t const * self) {
10895 0 : return self->discriminant == 1;
10896 0 : }
10897 0 : int fd_vote_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10898 0 : int err;
10899 0 : switch (discriminant) {
10900 0 : case 0: {
10901 0 : return FD_BINCODE_SUCCESS;
10902 0 : }
10903 0 : case 1: {
10904 0 : return FD_BINCODE_SUCCESS;
10905 0 : }
10906 0 : default: return FD_BINCODE_ERR_ENCODING;
10907 0 : }
10908 0 : }
10909 0 : static int fd_vote_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10910 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10911 0 : uint discriminant = 0;
10912 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10913 0 : if( FD_UNLIKELY( err ) ) return err;
10914 0 : return fd_vote_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
10915 0 : }
10916 0 : int fd_vote_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10917 0 : *total_sz += sizeof(fd_vote_authorize_t);
10918 0 : void const * start_data = ctx->data;
10919 0 : int err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
10920 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10921 0 : ctx->data = start_data;
10922 0 : return err;
10923 0 : }
10924 0 : static void fd_vote_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10925 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)struct_mem;
10926 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10927 0 : }
10928 0 : void * fd_vote_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10929 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)mem;
10930 0 : fd_vote_authorize_new( self );
10931 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_t);
10932 0 : void * * alloc_mem = &alloc_region;
10933 0 : fd_vote_authorize_decode_inner( mem, alloc_mem, ctx );
10934 0 : return self;
10935 0 : }
10936 :
10937 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, uint varint ) {
10938 0 : (void) varint;
10939 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_authorize", level++, 0);
10940 0 : switch( self->discriminant ) {
10941 0 : case 0: {
10942 0 : fun( w, self, "voter", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10943 0 : break;
10944 0 : }
10945 0 : case 1: {
10946 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10947 0 : break;
10948 0 : }
10949 0 : }
10950 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_authorize", level--, 0 );
10951 0 : }
10952 0 : ulong fd_vote_authorize_size( fd_vote_authorize_t const * self ) {
10953 0 : ulong size = 0;
10954 0 : size += sizeof(uint);
10955 0 : switch (self->discriminant) {
10956 0 : }
10957 0 : return size;
10958 0 : }
10959 :
10960 0 : int fd_vote_authorize_encode( fd_vote_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10961 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10962 0 : if( FD_UNLIKELY( err ) ) return err;
10963 0 : return err;
10964 0 : }
10965 :
10966 0 : int fd_vote_authorize_pubkey_encode( fd_vote_authorize_pubkey_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10967 0 : int err;
10968 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
10969 0 : if( FD_UNLIKELY( err ) ) return err;
10970 0 : err = fd_vote_authorize_encode( &self->vote_authorize, ctx );
10971 0 : if( FD_UNLIKELY( err ) ) return err;
10972 0 : return FD_BINCODE_SUCCESS;
10973 0 : }
10974 0 : static int fd_vote_authorize_pubkey_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10975 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10976 0 : int err = 0;
10977 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
10978 0 : if( FD_UNLIKELY( err ) ) return err;
10979 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
10980 0 : if( FD_UNLIKELY( err ) ) return err;
10981 0 : return 0;
10982 0 : }
10983 0 : int fd_vote_authorize_pubkey_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10984 0 : *total_sz += sizeof(fd_vote_authorize_pubkey_t);
10985 0 : void const * start_data = ctx->data;
10986 0 : int err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
10987 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10988 0 : ctx->data = start_data;
10989 0 : return err;
10990 0 : }
10991 0 : static void fd_vote_authorize_pubkey_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10992 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)struct_mem;
10993 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
10994 0 : fd_vote_authorize_decode_inner( &self->vote_authorize, alloc_mem, ctx );
10995 0 : }
10996 0 : void * fd_vote_authorize_pubkey_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10997 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)mem;
10998 0 : fd_vote_authorize_pubkey_new( self );
10999 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_pubkey_t);
11000 0 : void * * alloc_mem = &alloc_region;
11001 0 : fd_vote_authorize_pubkey_decode_inner( mem, alloc_mem, ctx );
11002 0 : return self;
11003 0 : }
11004 0 : void fd_vote_authorize_pubkey_new(fd_vote_authorize_pubkey_t * self) {
11005 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_pubkey_t) );
11006 0 : fd_pubkey_new( &self->pubkey );
11007 0 : fd_vote_authorize_new( &self->vote_authorize );
11008 0 : }
11009 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, uint varint ) {
11010 0 : (void) varint;
11011 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_pubkey", level++, 0 );
11012 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
11013 0 : fd_vote_authorize_walk( w, &self->vote_authorize, fun, "vote_authorize", level, 0 );
11014 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_pubkey", level--, 0 );
11015 0 : }
11016 0 : int fd_vote_switch_encode( fd_vote_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11017 0 : int err;
11018 0 : err = fd_vote_encode( &self->vote, ctx );
11019 0 : if( FD_UNLIKELY( err ) ) return err;
11020 0 : err = fd_hash_encode( &self->hash, ctx );
11021 0 : if( FD_UNLIKELY( err ) ) return err;
11022 0 : return FD_BINCODE_SUCCESS;
11023 0 : }
11024 0 : static int fd_vote_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11025 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11026 0 : int err = 0;
11027 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
11028 0 : if( FD_UNLIKELY( err ) ) return err;
11029 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
11030 0 : if( FD_UNLIKELY( err ) ) return err;
11031 0 : return 0;
11032 0 : }
11033 0 : int fd_vote_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11034 0 : *total_sz += sizeof(fd_vote_switch_t);
11035 0 : void const * start_data = ctx->data;
11036 0 : int err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
11037 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11038 0 : ctx->data = start_data;
11039 0 : return err;
11040 0 : }
11041 0 : static void fd_vote_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11042 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)struct_mem;
11043 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
11044 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
11045 0 : }
11046 0 : void * fd_vote_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11047 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)mem;
11048 0 : fd_vote_switch_new( self );
11049 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_switch_t);
11050 0 : void * * alloc_mem = &alloc_region;
11051 0 : fd_vote_switch_decode_inner( mem, alloc_mem, ctx );
11052 0 : return self;
11053 0 : }
11054 0 : void fd_vote_switch_new(fd_vote_switch_t * self) {
11055 0 : fd_memset( self, 0, sizeof(fd_vote_switch_t) );
11056 0 : fd_vote_new( &self->vote );
11057 0 : fd_hash_new( &self->hash );
11058 0 : }
11059 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, uint varint ) {
11060 0 : (void) varint;
11061 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_switch", level++, 0 );
11062 0 : fd_vote_walk( w, &self->vote, fun, "vote", level, 0 );
11063 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
11064 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_switch", level--, 0 );
11065 0 : }
11066 0 : ulong fd_vote_switch_size( fd_vote_switch_t const * self ) {
11067 0 : ulong size = 0;
11068 0 : size += fd_vote_size( &self->vote );
11069 0 : size += fd_hash_size( &self->hash );
11070 0 : return size;
11071 0 : }
11072 :
11073 0 : int fd_update_vote_state_switch_encode( fd_update_vote_state_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11074 0 : int err;
11075 0 : err = fd_vote_state_update_encode( &self->vote_state_update, ctx );
11076 0 : if( FD_UNLIKELY( err ) ) return err;
11077 0 : err = fd_hash_encode( &self->hash, ctx );
11078 0 : if( FD_UNLIKELY( err ) ) return err;
11079 0 : return FD_BINCODE_SUCCESS;
11080 0 : }
11081 0 : static int fd_update_vote_state_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11082 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11083 0 : int err = 0;
11084 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
11085 0 : if( FD_UNLIKELY( err ) ) return err;
11086 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
11087 0 : if( FD_UNLIKELY( err ) ) return err;
11088 0 : return 0;
11089 0 : }
11090 0 : int fd_update_vote_state_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11091 0 : *total_sz += sizeof(fd_update_vote_state_switch_t);
11092 0 : void const * start_data = ctx->data;
11093 0 : int err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
11094 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11095 0 : ctx->data = start_data;
11096 0 : return err;
11097 0 : }
11098 0 : static void fd_update_vote_state_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11099 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)struct_mem;
11100 0 : fd_vote_state_update_decode_inner( &self->vote_state_update, alloc_mem, ctx );
11101 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
11102 0 : }
11103 0 : void * fd_update_vote_state_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11104 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)mem;
11105 0 : fd_update_vote_state_switch_new( self );
11106 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_vote_state_switch_t);
11107 0 : void * * alloc_mem = &alloc_region;
11108 0 : fd_update_vote_state_switch_decode_inner( mem, alloc_mem, ctx );
11109 0 : return self;
11110 0 : }
11111 0 : void fd_update_vote_state_switch_new(fd_update_vote_state_switch_t * self) {
11112 0 : fd_memset( self, 0, sizeof(fd_update_vote_state_switch_t) );
11113 0 : fd_vote_state_update_new( &self->vote_state_update );
11114 0 : fd_hash_new( &self->hash );
11115 0 : }
11116 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, uint varint ) {
11117 0 : (void) varint;
11118 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_update_vote_state_switch", level++, 0 );
11119 0 : fd_vote_state_update_walk( w, &self->vote_state_update, fun, "vote_state_update", level, 0 );
11120 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
11121 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_update_vote_state_switch", level--, 0 );
11122 0 : }
11123 0 : ulong fd_update_vote_state_switch_size( fd_update_vote_state_switch_t const * self ) {
11124 0 : ulong size = 0;
11125 0 : size += fd_vote_state_update_size( &self->vote_state_update );
11126 0 : size += fd_hash_size( &self->hash );
11127 0 : return size;
11128 0 : }
11129 :
11130 0 : int fd_vote_authorize_with_seed_args_encode( fd_vote_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11131 0 : int err;
11132 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
11133 0 : if( FD_UNLIKELY( err ) ) return err;
11134 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
11135 0 : if( FD_UNLIKELY( err ) ) return err;
11136 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
11137 0 : if( FD_UNLIKELY(err) ) return err;
11138 0 : if( self->current_authority_derived_key_seed_len ) {
11139 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
11140 0 : if( FD_UNLIKELY( err ) ) return err;
11141 0 : }
11142 0 : err = fd_pubkey_encode( &self->new_authority, ctx );
11143 0 : if( FD_UNLIKELY( err ) ) return err;
11144 0 : return FD_BINCODE_SUCCESS;
11145 0 : }
11146 0 : static int fd_vote_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11147 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11148 0 : int err = 0;
11149 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
11150 0 : if( FD_UNLIKELY( err ) ) return err;
11151 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
11152 0 : if( FD_UNLIKELY( err ) ) return err;
11153 0 : ulong current_authority_derived_key_seed_len;
11154 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
11155 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11156 0 : *total_sz += current_authority_derived_key_seed_len;
11157 0 : if( current_authority_derived_key_seed_len ) {
11158 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
11159 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11160 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
11161 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11162 0 : }
11163 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
11164 0 : if( FD_UNLIKELY( err ) ) return err;
11165 0 : return 0;
11166 0 : }
11167 0 : int fd_vote_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11168 0 : *total_sz += sizeof(fd_vote_authorize_with_seed_args_t);
11169 0 : void const * start_data = ctx->data;
11170 0 : int err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
11171 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11172 0 : ctx->data = start_data;
11173 0 : return err;
11174 0 : }
11175 0 : static void fd_vote_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11176 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)struct_mem;
11177 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
11178 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
11179 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
11180 0 : if( self->current_authority_derived_key_seed_len ) {
11181 0 : self->current_authority_derived_key_seed = *alloc_mem;
11182 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
11183 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
11184 0 : } else
11185 0 : self->current_authority_derived_key_seed = NULL;
11186 0 : fd_pubkey_decode_inner( &self->new_authority, alloc_mem, ctx );
11187 0 : }
11188 0 : void * fd_vote_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11189 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)mem;
11190 0 : fd_vote_authorize_with_seed_args_new( self );
11191 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_with_seed_args_t);
11192 0 : void * * alloc_mem = &alloc_region;
11193 0 : fd_vote_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
11194 0 : return self;
11195 0 : }
11196 0 : void fd_vote_authorize_with_seed_args_new(fd_vote_authorize_with_seed_args_t * self) {
11197 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_with_seed_args_t) );
11198 0 : fd_vote_authorize_new( &self->authorization_type );
11199 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
11200 0 : fd_pubkey_new( &self->new_authority );
11201 0 : }
11202 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, uint varint ) {
11203 0 : (void) varint;
11204 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_with_seed_args", level++, 0 );
11205 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level, 0 );
11206 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level, 0 );
11207 0 : if( self->current_authority_derived_key_seed_len ) {
11208 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11209 0 : for( ulong i=0; i < self->current_authority_derived_key_seed_len; i++ )
11210 0 : fun( w, self->current_authority_derived_key_seed + i, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11211 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11212 0 : }
11213 0 : fd_pubkey_walk( w, &self->new_authority, fun, "new_authority", level, 0 );
11214 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_with_seed_args", level--, 0 );
11215 0 : }
11216 0 : ulong fd_vote_authorize_with_seed_args_size( fd_vote_authorize_with_seed_args_t const * self ) {
11217 0 : ulong size = 0;
11218 0 : size += fd_vote_authorize_size( &self->authorization_type );
11219 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
11220 0 : do {
11221 0 : size += sizeof(ulong);
11222 0 : size += self->current_authority_derived_key_seed_len;
11223 0 : } while(0);
11224 0 : size += fd_pubkey_size( &self->new_authority );
11225 0 : return size;
11226 0 : }
11227 :
11228 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 ) {
11229 0 : int err;
11230 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
11231 0 : if( FD_UNLIKELY( err ) ) return err;
11232 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
11233 0 : if( FD_UNLIKELY( err ) ) return err;
11234 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
11235 0 : if( FD_UNLIKELY(err) ) return err;
11236 0 : if( self->current_authority_derived_key_seed_len ) {
11237 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
11238 0 : if( FD_UNLIKELY( err ) ) return err;
11239 0 : }
11240 0 : return FD_BINCODE_SUCCESS;
11241 0 : }
11242 0 : static int fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11243 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11244 0 : int err = 0;
11245 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
11246 0 : if( FD_UNLIKELY( err ) ) return err;
11247 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
11248 0 : if( FD_UNLIKELY( err ) ) return err;
11249 0 : ulong current_authority_derived_key_seed_len;
11250 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
11251 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11252 0 : *total_sz += current_authority_derived_key_seed_len;
11253 0 : if( current_authority_derived_key_seed_len ) {
11254 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
11255 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11256 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
11257 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11258 0 : }
11259 0 : return 0;
11260 0 : }
11261 0 : int fd_vote_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11262 0 : *total_sz += sizeof(fd_vote_authorize_checked_with_seed_args_t);
11263 0 : void const * start_data = ctx->data;
11264 0 : int err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
11265 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11266 0 : ctx->data = start_data;
11267 0 : return err;
11268 0 : }
11269 0 : static void fd_vote_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11270 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)struct_mem;
11271 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
11272 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
11273 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
11274 0 : if( self->current_authority_derived_key_seed_len ) {
11275 0 : self->current_authority_derived_key_seed = *alloc_mem;
11276 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
11277 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
11278 0 : } else
11279 0 : self->current_authority_derived_key_seed = NULL;
11280 0 : }
11281 0 : void * fd_vote_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11282 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)mem;
11283 0 : fd_vote_authorize_checked_with_seed_args_new( self );
11284 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_checked_with_seed_args_t);
11285 0 : void * * alloc_mem = &alloc_region;
11286 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
11287 0 : return self;
11288 0 : }
11289 0 : void fd_vote_authorize_checked_with_seed_args_new(fd_vote_authorize_checked_with_seed_args_t * self) {
11290 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_checked_with_seed_args_t) );
11291 0 : fd_vote_authorize_new( &self->authorization_type );
11292 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
11293 0 : }
11294 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, uint varint ) {
11295 0 : (void) varint;
11296 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_checked_with_seed_args", level++, 0 );
11297 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level, 0 );
11298 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level, 0 );
11299 0 : if( self->current_authority_derived_key_seed_len ) {
11300 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11301 0 : for( ulong i=0; i < self->current_authority_derived_key_seed_len; i++ )
11302 0 : fun( w, self->current_authority_derived_key_seed + i, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11303 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11304 0 : }
11305 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_checked_with_seed_args", level--, 0 );
11306 0 : }
11307 0 : ulong fd_vote_authorize_checked_with_seed_args_size( fd_vote_authorize_checked_with_seed_args_t const * self ) {
11308 0 : ulong size = 0;
11309 0 : size += fd_vote_authorize_size( &self->authorization_type );
11310 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
11311 0 : do {
11312 0 : size += sizeof(ulong);
11313 0 : size += self->current_authority_derived_key_seed_len;
11314 0 : } while(0);
11315 0 : return size;
11316 0 : }
11317 :
11318 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account(fd_vote_instruction_t const * self) {
11319 0 : return self->discriminant == 0;
11320 0 : }
11321 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize(fd_vote_instruction_t const * self) {
11322 0 : return self->discriminant == 1;
11323 0 : }
11324 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote(fd_vote_instruction_t const * self) {
11325 0 : return self->discriminant == 2;
11326 0 : }
11327 0 : FD_FN_PURE uchar fd_vote_instruction_is_withdraw(fd_vote_instruction_t const * self) {
11328 0 : return self->discriminant == 3;
11329 0 : }
11330 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_validator_identity(fd_vote_instruction_t const * self) {
11331 0 : return self->discriminant == 4;
11332 0 : }
11333 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission(fd_vote_instruction_t const * self) {
11334 0 : return self->discriminant == 5;
11335 0 : }
11336 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote_switch(fd_vote_instruction_t const * self) {
11337 0 : return self->discriminant == 6;
11338 0 : }
11339 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked(fd_vote_instruction_t const * self) {
11340 0 : return self->discriminant == 7;
11341 0 : }
11342 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state(fd_vote_instruction_t const * self) {
11343 0 : return self->discriminant == 8;
11344 0 : }
11345 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state_switch(fd_vote_instruction_t const * self) {
11346 0 : return self->discriminant == 9;
11347 0 : }
11348 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_with_seed(fd_vote_instruction_t const * self) {
11349 0 : return self->discriminant == 10;
11350 0 : }
11351 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked_with_seed(fd_vote_instruction_t const * self) {
11352 0 : return self->discriminant == 11;
11353 0 : }
11354 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state(fd_vote_instruction_t const * self) {
11355 0 : return self->discriminant == 12;
11356 0 : }
11357 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state_switch(fd_vote_instruction_t const * self) {
11358 0 : return self->discriminant == 13;
11359 0 : }
11360 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync(fd_vote_instruction_t const * self) {
11361 0 : return self->discriminant == 14;
11362 0 : }
11363 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync_switch(fd_vote_instruction_t const * self) {
11364 0 : return self->discriminant == 15;
11365 0 : }
11366 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant );
11367 0 : int fd_vote_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11368 0 : int err;
11369 0 : switch (discriminant) {
11370 0 : case 0: {
11371 0 : err = fd_vote_init_decode_footprint_inner( ctx, total_sz );
11372 0 : if( FD_UNLIKELY( err ) ) return err;
11373 0 : return FD_BINCODE_SUCCESS;
11374 0 : }
11375 0 : case 1: {
11376 0 : err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
11377 0 : if( FD_UNLIKELY( err ) ) return err;
11378 0 : return FD_BINCODE_SUCCESS;
11379 0 : }
11380 0 : case 2: {
11381 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
11382 0 : if( FD_UNLIKELY( err ) ) return err;
11383 0 : return FD_BINCODE_SUCCESS;
11384 0 : }
11385 0 : case 3: {
11386 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11387 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11388 0 : return FD_BINCODE_SUCCESS;
11389 0 : }
11390 0 : case 4: {
11391 0 : return FD_BINCODE_SUCCESS;
11392 0 : }
11393 0 : case 5: {
11394 0 : err = fd_bincode_uint8_decode_footprint( ctx );
11395 0 : if( FD_UNLIKELY( err ) ) return err;
11396 0 : return FD_BINCODE_SUCCESS;
11397 0 : }
11398 0 : case 6: {
11399 0 : err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
11400 0 : if( FD_UNLIKELY( err ) ) return err;
11401 0 : return FD_BINCODE_SUCCESS;
11402 0 : }
11403 0 : case 7: {
11404 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
11405 0 : if( FD_UNLIKELY( err ) ) return err;
11406 0 : return FD_BINCODE_SUCCESS;
11407 0 : }
11408 0 : case 8: {
11409 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
11410 0 : if( FD_UNLIKELY( err ) ) return err;
11411 0 : return FD_BINCODE_SUCCESS;
11412 0 : }
11413 0 : case 9: {
11414 0 : err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
11415 0 : if( FD_UNLIKELY( err ) ) return err;
11416 0 : return FD_BINCODE_SUCCESS;
11417 0 : }
11418 0 : case 10: {
11419 0 : err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
11420 0 : if( FD_UNLIKELY( err ) ) return err;
11421 0 : return FD_BINCODE_SUCCESS;
11422 0 : }
11423 0 : case 11: {
11424 0 : err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
11425 0 : if( FD_UNLIKELY( err ) ) return err;
11426 0 : return FD_BINCODE_SUCCESS;
11427 0 : }
11428 0 : case 12: {
11429 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
11430 0 : if( FD_UNLIKELY( err ) ) return err;
11431 0 : return FD_BINCODE_SUCCESS;
11432 0 : }
11433 0 : case 13: {
11434 0 : err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
11435 0 : if( FD_UNLIKELY( err ) ) return err;
11436 0 : return FD_BINCODE_SUCCESS;
11437 0 : }
11438 0 : case 14: {
11439 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
11440 0 : if( FD_UNLIKELY( err ) ) return err;
11441 0 : return FD_BINCODE_SUCCESS;
11442 0 : }
11443 0 : case 15: {
11444 0 : err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
11445 0 : if( FD_UNLIKELY( err ) ) return err;
11446 0 : return FD_BINCODE_SUCCESS;
11447 0 : }
11448 0 : default: return FD_BINCODE_ERR_ENCODING;
11449 0 : }
11450 0 : }
11451 0 : static int fd_vote_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11452 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11453 0 : uint discriminant = 0;
11454 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11455 0 : if( FD_UNLIKELY( err ) ) return err;
11456 0 : return fd_vote_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
11457 0 : }
11458 0 : int fd_vote_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11459 0 : *total_sz += sizeof(fd_vote_instruction_t);
11460 0 : void const * start_data = ctx->data;
11461 0 : int err = fd_vote_instruction_decode_footprint_inner( ctx, total_sz );
11462 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11463 0 : ctx->data = start_data;
11464 0 : return err;
11465 0 : }
11466 0 : static void fd_vote_instruction_inner_decode_inner( fd_vote_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
11467 0 : switch (discriminant) {
11468 0 : case 0: {
11469 0 : fd_vote_init_decode_inner( &self->initialize_account, alloc_mem, ctx );
11470 0 : break;
11471 0 : }
11472 0 : case 1: {
11473 0 : fd_vote_authorize_pubkey_decode_inner( &self->authorize, alloc_mem, ctx );
11474 0 : break;
11475 0 : }
11476 0 : case 2: {
11477 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
11478 0 : break;
11479 0 : }
11480 0 : case 3: {
11481 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
11482 0 : break;
11483 0 : }
11484 0 : case 4: {
11485 0 : break;
11486 0 : }
11487 0 : case 5: {
11488 0 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
11489 0 : break;
11490 0 : }
11491 0 : case 6: {
11492 0 : fd_vote_switch_decode_inner( &self->vote_switch, alloc_mem, ctx );
11493 0 : break;
11494 0 : }
11495 0 : case 7: {
11496 0 : fd_vote_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
11497 0 : break;
11498 0 : }
11499 0 : case 8: {
11500 0 : fd_vote_state_update_decode_inner( &self->update_vote_state, alloc_mem, ctx );
11501 0 : break;
11502 0 : }
11503 0 : case 9: {
11504 0 : fd_update_vote_state_switch_decode_inner( &self->update_vote_state_switch, alloc_mem, ctx );
11505 0 : break;
11506 0 : }
11507 0 : case 10: {
11508 0 : fd_vote_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
11509 0 : break;
11510 0 : }
11511 0 : case 11: {
11512 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
11513 0 : break;
11514 0 : }
11515 0 : case 12: {
11516 0 : fd_compact_vote_state_update_decode_inner( &self->compact_update_vote_state, alloc_mem, ctx );
11517 0 : break;
11518 0 : }
11519 0 : case 13: {
11520 0 : fd_compact_vote_state_update_switch_decode_inner( &self->compact_update_vote_state_switch, alloc_mem, ctx );
11521 0 : break;
11522 0 : }
11523 0 : case 14: {
11524 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
11525 0 : break;
11526 0 : }
11527 0 : case 15: {
11528 0 : fd_tower_sync_switch_decode_inner( &self->tower_sync_switch, alloc_mem, ctx );
11529 0 : break;
11530 0 : }
11531 0 : }
11532 0 : }
11533 0 : static void fd_vote_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11534 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)struct_mem;
11535 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11536 0 : fd_vote_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11537 0 : }
11538 0 : void * fd_vote_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11539 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)mem;
11540 0 : fd_vote_instruction_new( self );
11541 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_instruction_t);
11542 0 : void * * alloc_mem = &alloc_region;
11543 0 : fd_vote_instruction_decode_inner( mem, alloc_mem, ctx );
11544 0 : return self;
11545 0 : }
11546 0 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant ) {
11547 0 : switch( discriminant ) {
11548 0 : case 0: {
11549 0 : fd_vote_init_new( &self->initialize_account );
11550 0 : break;
11551 0 : }
11552 0 : case 1: {
11553 0 : fd_vote_authorize_pubkey_new( &self->authorize );
11554 0 : break;
11555 0 : }
11556 0 : case 2: {
11557 0 : fd_vote_new( &self->vote );
11558 0 : break;
11559 0 : }
11560 0 : case 3: {
11561 0 : break;
11562 0 : }
11563 0 : case 4: {
11564 0 : break;
11565 0 : }
11566 0 : case 5: {
11567 0 : break;
11568 0 : }
11569 0 : case 6: {
11570 0 : fd_vote_switch_new( &self->vote_switch );
11571 0 : break;
11572 0 : }
11573 0 : case 7: {
11574 0 : fd_vote_authorize_new( &self->authorize_checked );
11575 0 : break;
11576 0 : }
11577 0 : case 8: {
11578 0 : fd_vote_state_update_new( &self->update_vote_state );
11579 0 : break;
11580 0 : }
11581 0 : case 9: {
11582 0 : fd_update_vote_state_switch_new( &self->update_vote_state_switch );
11583 0 : break;
11584 0 : }
11585 0 : case 10: {
11586 0 : fd_vote_authorize_with_seed_args_new( &self->authorize_with_seed );
11587 0 : break;
11588 0 : }
11589 0 : case 11: {
11590 0 : fd_vote_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
11591 0 : break;
11592 0 : }
11593 0 : case 12: {
11594 0 : fd_compact_vote_state_update_new( &self->compact_update_vote_state );
11595 0 : break;
11596 0 : }
11597 0 : case 13: {
11598 0 : fd_compact_vote_state_update_switch_new( &self->compact_update_vote_state_switch );
11599 0 : break;
11600 0 : }
11601 0 : case 14: {
11602 0 : fd_tower_sync_new( &self->tower_sync );
11603 0 : break;
11604 0 : }
11605 0 : case 15: {
11606 0 : fd_tower_sync_switch_new( &self->tower_sync_switch );
11607 0 : break;
11608 0 : }
11609 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11610 0 : }
11611 0 : }
11612 0 : void fd_vote_instruction_new_disc( fd_vote_instruction_t * self, uint discriminant ) {
11613 0 : self->discriminant = discriminant;
11614 0 : fd_vote_instruction_inner_new( &self->inner, self->discriminant );
11615 0 : }
11616 0 : void fd_vote_instruction_new( fd_vote_instruction_t * self ) {
11617 0 : fd_memset( self, 0, sizeof(fd_vote_instruction_t) );
11618 0 : fd_vote_instruction_new_disc( self, UINT_MAX );
11619 0 : }
11620 :
11621 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, uint varint ) {
11622 0 : (void) varint;
11623 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_instruction", level++, 0);
11624 0 : switch( self->discriminant ) {
11625 0 : case 0: {
11626 0 : fun( w, self, "initialize_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11627 0 : fd_vote_init_walk( w, &self->inner.initialize_account, fun, "initialize_account", level, 0 );
11628 0 : break;
11629 0 : }
11630 0 : case 1: {
11631 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11632 0 : fd_vote_authorize_pubkey_walk( w, &self->inner.authorize, fun, "authorize", level, 0 );
11633 0 : break;
11634 0 : }
11635 0 : case 2: {
11636 0 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11637 0 : fd_vote_walk( w, &self->inner.vote, fun, "vote", level, 0 );
11638 0 : break;
11639 0 : }
11640 0 : case 3: {
11641 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11642 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11643 0 : break;
11644 0 : }
11645 0 : case 4: {
11646 0 : fun( w, self, "update_validator_identity", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11647 0 : break;
11648 0 : }
11649 0 : case 5: {
11650 0 : fun( w, self, "update_commission", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11651 0 : fun( w, &self->inner.update_commission, "update_commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11652 0 : break;
11653 0 : }
11654 0 : case 6: {
11655 0 : fun( w, self, "vote_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11656 0 : fd_vote_switch_walk( w, &self->inner.vote_switch, fun, "vote_switch", level, 0 );
11657 0 : break;
11658 0 : }
11659 0 : case 7: {
11660 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11661 0 : fd_vote_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level, 0 );
11662 0 : break;
11663 0 : }
11664 0 : case 8: {
11665 0 : fun( w, self, "update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11666 0 : fd_vote_state_update_walk( w, &self->inner.update_vote_state, fun, "update_vote_state", level, 0 );
11667 0 : break;
11668 0 : }
11669 0 : case 9: {
11670 0 : fun( w, self, "update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11671 0 : fd_update_vote_state_switch_walk( w, &self->inner.update_vote_state_switch, fun, "update_vote_state_switch", level, 0 );
11672 0 : break;
11673 0 : }
11674 0 : case 10: {
11675 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11676 0 : fd_vote_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level, 0 );
11677 0 : break;
11678 0 : }
11679 0 : case 11: {
11680 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11681 0 : fd_vote_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level, 0 );
11682 0 : break;
11683 0 : }
11684 0 : case 12: {
11685 0 : fun( w, self, "compact_update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11686 0 : fd_compact_vote_state_update_walk( w, &self->inner.compact_update_vote_state, fun, "compact_update_vote_state", level, 0 );
11687 0 : break;
11688 0 : }
11689 0 : case 13: {
11690 0 : fun( w, self, "compact_update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11691 0 : fd_compact_vote_state_update_switch_walk( w, &self->inner.compact_update_vote_state_switch, fun, "compact_update_vote_state_switch", level, 0 );
11692 0 : break;
11693 0 : }
11694 0 : case 14: {
11695 0 : fun( w, self, "tower_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11696 0 : fd_tower_sync_walk( w, &self->inner.tower_sync, fun, "tower_sync", level, 0 );
11697 0 : break;
11698 0 : }
11699 0 : case 15: {
11700 0 : fun( w, self, "tower_sync_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11701 0 : fd_tower_sync_switch_walk( w, &self->inner.tower_sync_switch, fun, "tower_sync_switch", level, 0 );
11702 0 : break;
11703 0 : }
11704 0 : }
11705 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_instruction", level--, 0 );
11706 0 : }
11707 0 : ulong fd_vote_instruction_size( fd_vote_instruction_t const * self ) {
11708 0 : ulong size = 0;
11709 0 : size += sizeof(uint);
11710 0 : switch (self->discriminant) {
11711 0 : case 0: {
11712 0 : size += fd_vote_init_size( &self->inner.initialize_account );
11713 0 : break;
11714 0 : }
11715 0 : case 1: {
11716 0 : size += fd_vote_authorize_pubkey_size( &self->inner.authorize );
11717 0 : break;
11718 0 : }
11719 0 : case 2: {
11720 0 : size += fd_vote_size( &self->inner.vote );
11721 0 : break;
11722 0 : }
11723 0 : case 3: {
11724 0 : size += sizeof(ulong);
11725 0 : break;
11726 0 : }
11727 0 : case 5: {
11728 0 : size += sizeof(char);
11729 0 : break;
11730 0 : }
11731 0 : case 6: {
11732 0 : size += fd_vote_switch_size( &self->inner.vote_switch );
11733 0 : break;
11734 0 : }
11735 0 : case 7: {
11736 0 : size += fd_vote_authorize_size( &self->inner.authorize_checked );
11737 0 : break;
11738 0 : }
11739 0 : case 8: {
11740 0 : size += fd_vote_state_update_size( &self->inner.update_vote_state );
11741 0 : break;
11742 0 : }
11743 0 : case 9: {
11744 0 : size += fd_update_vote_state_switch_size( &self->inner.update_vote_state_switch );
11745 0 : break;
11746 0 : }
11747 0 : case 10: {
11748 0 : size += fd_vote_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
11749 0 : break;
11750 0 : }
11751 0 : case 11: {
11752 0 : size += fd_vote_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
11753 0 : break;
11754 0 : }
11755 0 : case 12: {
11756 0 : size += fd_compact_vote_state_update_size( &self->inner.compact_update_vote_state );
11757 0 : break;
11758 0 : }
11759 0 : case 13: {
11760 0 : size += fd_compact_vote_state_update_switch_size( &self->inner.compact_update_vote_state_switch );
11761 0 : break;
11762 0 : }
11763 0 : case 14: {
11764 0 : size += fd_tower_sync_size( &self->inner.tower_sync );
11765 0 : break;
11766 0 : }
11767 0 : case 15: {
11768 0 : size += fd_tower_sync_switch_size( &self->inner.tower_sync_switch );
11769 0 : break;
11770 0 : }
11771 0 : }
11772 0 : return size;
11773 0 : }
11774 :
11775 0 : int fd_vote_instruction_inner_encode( fd_vote_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
11776 0 : int err;
11777 0 : switch (discriminant) {
11778 0 : case 0: {
11779 0 : err = fd_vote_init_encode( &self->initialize_account, ctx );
11780 0 : if( FD_UNLIKELY( err ) ) return err;
11781 0 : break;
11782 0 : }
11783 0 : case 1: {
11784 0 : err = fd_vote_authorize_pubkey_encode( &self->authorize, ctx );
11785 0 : if( FD_UNLIKELY( err ) ) return err;
11786 0 : break;
11787 0 : }
11788 0 : case 2: {
11789 0 : err = fd_vote_encode( &self->vote, ctx );
11790 0 : if( FD_UNLIKELY( err ) ) return err;
11791 0 : break;
11792 0 : }
11793 0 : case 3: {
11794 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
11795 0 : if( FD_UNLIKELY( err ) ) return err;
11796 0 : break;
11797 0 : }
11798 0 : case 5: {
11799 0 : err = fd_bincode_uint8_encode( (uchar)(self->update_commission), ctx );
11800 0 : if( FD_UNLIKELY( err ) ) return err;
11801 0 : break;
11802 0 : }
11803 0 : case 6: {
11804 0 : err = fd_vote_switch_encode( &self->vote_switch, ctx );
11805 0 : if( FD_UNLIKELY( err ) ) return err;
11806 0 : break;
11807 0 : }
11808 0 : case 7: {
11809 0 : err = fd_vote_authorize_encode( &self->authorize_checked, ctx );
11810 0 : if( FD_UNLIKELY( err ) ) return err;
11811 0 : break;
11812 0 : }
11813 0 : case 8: {
11814 0 : err = fd_vote_state_update_encode( &self->update_vote_state, ctx );
11815 0 : if( FD_UNLIKELY( err ) ) return err;
11816 0 : break;
11817 0 : }
11818 0 : case 9: {
11819 0 : err = fd_update_vote_state_switch_encode( &self->update_vote_state_switch, ctx );
11820 0 : if( FD_UNLIKELY( err ) ) return err;
11821 0 : break;
11822 0 : }
11823 0 : case 10: {
11824 0 : err = fd_vote_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
11825 0 : if( FD_UNLIKELY( err ) ) return err;
11826 0 : break;
11827 0 : }
11828 0 : case 11: {
11829 0 : err = fd_vote_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
11830 0 : if( FD_UNLIKELY( err ) ) return err;
11831 0 : break;
11832 0 : }
11833 0 : case 12: {
11834 0 : err = fd_compact_vote_state_update_encode( &self->compact_update_vote_state, ctx );
11835 0 : if( FD_UNLIKELY( err ) ) return err;
11836 0 : break;
11837 0 : }
11838 0 : case 13: {
11839 0 : err = fd_compact_vote_state_update_switch_encode( &self->compact_update_vote_state_switch, ctx );
11840 0 : if( FD_UNLIKELY( err ) ) return err;
11841 0 : break;
11842 0 : }
11843 0 : case 14: {
11844 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
11845 0 : if( FD_UNLIKELY( err ) ) return err;
11846 0 : break;
11847 0 : }
11848 0 : case 15: {
11849 0 : err = fd_tower_sync_switch_encode( &self->tower_sync_switch, ctx );
11850 0 : if( FD_UNLIKELY( err ) ) return err;
11851 0 : break;
11852 0 : }
11853 0 : }
11854 0 : return FD_BINCODE_SUCCESS;
11855 0 : }
11856 0 : int fd_vote_instruction_encode( fd_vote_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11857 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11858 0 : if( FD_UNLIKELY( err ) ) return err;
11859 0 : return fd_vote_instruction_inner_encode( &self->inner, self->discriminant, ctx );
11860 0 : }
11861 :
11862 0 : int fd_system_program_instruction_create_account_encode( fd_system_program_instruction_create_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11863 0 : int err;
11864 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
11865 0 : if( FD_UNLIKELY( err ) ) return err;
11866 0 : err = fd_bincode_uint64_encode( self->space, ctx );
11867 0 : if( FD_UNLIKELY( err ) ) return err;
11868 0 : err = fd_pubkey_encode( &self->owner, ctx );
11869 0 : if( FD_UNLIKELY( err ) ) return err;
11870 0 : return FD_BINCODE_SUCCESS;
11871 0 : }
11872 0 : static inline int fd_system_program_instruction_create_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11873 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11874 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
11875 0 : return 0;
11876 0 : }
11877 0 : static void fd_system_program_instruction_create_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11878 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)struct_mem;
11879 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
11880 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
11881 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
11882 0 : }
11883 0 : void * fd_system_program_instruction_create_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11884 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)mem;
11885 0 : fd_system_program_instruction_create_account_new( self );
11886 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_t);
11887 0 : void * * alloc_mem = &alloc_region;
11888 0 : fd_system_program_instruction_create_account_decode_inner( mem, alloc_mem, ctx );
11889 0 : return self;
11890 0 : }
11891 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, uint varint ) {
11892 0 : (void) varint;
11893 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account", level++, 0 );
11894 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11895 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11896 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
11897 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account", level--, 0 );
11898 0 : }
11899 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 ) {
11900 0 : int err;
11901 0 : err = fd_pubkey_encode( &self->base, ctx );
11902 0 : if( FD_UNLIKELY( err ) ) return err;
11903 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
11904 0 : if( FD_UNLIKELY(err) ) return err;
11905 0 : if( self->seed_len ) {
11906 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
11907 0 : if( FD_UNLIKELY( err ) ) return err;
11908 0 : }
11909 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
11910 0 : if( FD_UNLIKELY( err ) ) return err;
11911 0 : err = fd_bincode_uint64_encode( self->space, ctx );
11912 0 : if( FD_UNLIKELY( err ) ) return err;
11913 0 : err = fd_pubkey_encode( &self->owner, ctx );
11914 0 : if( FD_UNLIKELY( err ) ) return err;
11915 0 : return FD_BINCODE_SUCCESS;
11916 0 : }
11917 0 : static int fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11918 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11919 0 : int err = 0;
11920 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
11921 0 : if( FD_UNLIKELY( err ) ) return err;
11922 0 : ulong seed_len;
11923 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
11924 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11925 0 : *total_sz += seed_len;
11926 0 : if( seed_len ) {
11927 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
11928 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11929 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
11930 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11931 0 : }
11932 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11933 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11934 0 : err = fd_bincode_uint64_decode_footprint( ctx );
11935 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11936 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
11937 0 : if( FD_UNLIKELY( err ) ) return err;
11938 0 : return 0;
11939 0 : }
11940 0 : int fd_system_program_instruction_create_account_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11941 0 : *total_sz += sizeof(fd_system_program_instruction_create_account_with_seed_t);
11942 0 : void const * start_data = ctx->data;
11943 0 : int err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
11944 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11945 0 : ctx->data = start_data;
11946 0 : return err;
11947 0 : }
11948 0 : static void fd_system_program_instruction_create_account_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11949 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)struct_mem;
11950 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
11951 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
11952 0 : if( self->seed_len ) {
11953 0 : self->seed = *alloc_mem;
11954 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
11955 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
11956 0 : } else
11957 0 : self->seed = NULL;
11958 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
11959 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
11960 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
11961 0 : }
11962 0 : void * fd_system_program_instruction_create_account_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11963 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)mem;
11964 0 : fd_system_program_instruction_create_account_with_seed_new( self );
11965 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_with_seed_t);
11966 0 : void * * alloc_mem = &alloc_region;
11967 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( mem, alloc_mem, ctx );
11968 0 : return self;
11969 0 : }
11970 0 : void fd_system_program_instruction_create_account_with_seed_new(fd_system_program_instruction_create_account_with_seed_t * self) {
11971 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_with_seed_t) );
11972 0 : fd_pubkey_new( &self->base );
11973 0 : fd_pubkey_new( &self->owner );
11974 0 : }
11975 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, uint varint ) {
11976 0 : (void) varint;
11977 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account_with_seed", level++, 0 );
11978 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
11979 0 : if( self->seed_len ) {
11980 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11981 0 : for( ulong i=0; i < self->seed_len; i++ )
11982 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11983 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11984 0 : }
11985 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11986 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11987 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
11988 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account_with_seed", level--, 0 );
11989 0 : }
11990 0 : ulong fd_system_program_instruction_create_account_with_seed_size( fd_system_program_instruction_create_account_with_seed_t const * self ) {
11991 0 : ulong size = 0;
11992 0 : size += fd_pubkey_size( &self->base );
11993 0 : do {
11994 0 : size += sizeof(ulong);
11995 0 : size += self->seed_len;
11996 0 : } while(0);
11997 0 : size += sizeof(ulong);
11998 0 : size += sizeof(ulong);
11999 0 : size += fd_pubkey_size( &self->owner );
12000 0 : return size;
12001 0 : }
12002 :
12003 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 ) {
12004 0 : int err;
12005 0 : err = fd_pubkey_encode( &self->base, ctx );
12006 0 : if( FD_UNLIKELY( err ) ) return err;
12007 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
12008 0 : if( FD_UNLIKELY(err) ) return err;
12009 0 : if( self->seed_len ) {
12010 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
12011 0 : if( FD_UNLIKELY( err ) ) return err;
12012 0 : }
12013 0 : err = fd_bincode_uint64_encode( self->space, ctx );
12014 0 : if( FD_UNLIKELY( err ) ) return err;
12015 0 : err = fd_pubkey_encode( &self->owner, ctx );
12016 0 : if( FD_UNLIKELY( err ) ) return err;
12017 0 : return FD_BINCODE_SUCCESS;
12018 0 : }
12019 0 : static int fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12020 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12021 0 : int err = 0;
12022 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12023 0 : if( FD_UNLIKELY( err ) ) return err;
12024 0 : ulong seed_len;
12025 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
12026 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12027 0 : *total_sz += seed_len;
12028 0 : if( seed_len ) {
12029 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
12030 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12031 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
12032 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12033 0 : }
12034 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12035 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12036 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12037 0 : if( FD_UNLIKELY( err ) ) return err;
12038 0 : return 0;
12039 0 : }
12040 0 : int fd_system_program_instruction_allocate_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12041 0 : *total_sz += sizeof(fd_system_program_instruction_allocate_with_seed_t);
12042 0 : void const * start_data = ctx->data;
12043 0 : int err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
12044 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12045 0 : ctx->data = start_data;
12046 0 : return err;
12047 0 : }
12048 0 : static void fd_system_program_instruction_allocate_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12049 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)struct_mem;
12050 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
12051 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
12052 0 : if( self->seed_len ) {
12053 0 : self->seed = *alloc_mem;
12054 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
12055 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
12056 0 : } else
12057 0 : self->seed = NULL;
12058 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
12059 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
12060 0 : }
12061 0 : void * fd_system_program_instruction_allocate_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12062 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)mem;
12063 0 : fd_system_program_instruction_allocate_with_seed_new( self );
12064 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_allocate_with_seed_t);
12065 0 : void * * alloc_mem = &alloc_region;
12066 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( mem, alloc_mem, ctx );
12067 0 : return self;
12068 0 : }
12069 0 : void fd_system_program_instruction_allocate_with_seed_new(fd_system_program_instruction_allocate_with_seed_t * self) {
12070 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_allocate_with_seed_t) );
12071 0 : fd_pubkey_new( &self->base );
12072 0 : fd_pubkey_new( &self->owner );
12073 0 : }
12074 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, uint varint ) {
12075 0 : (void) varint;
12076 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_allocate_with_seed", level++, 0 );
12077 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
12078 0 : if( self->seed_len ) {
12079 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
12080 0 : for( ulong i=0; i < self->seed_len; i++ )
12081 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
12082 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
12083 0 : }
12084 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12085 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
12086 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_allocate_with_seed", level--, 0 );
12087 0 : }
12088 0 : ulong fd_system_program_instruction_allocate_with_seed_size( fd_system_program_instruction_allocate_with_seed_t const * self ) {
12089 0 : ulong size = 0;
12090 0 : size += fd_pubkey_size( &self->base );
12091 0 : do {
12092 0 : size += sizeof(ulong);
12093 0 : size += self->seed_len;
12094 0 : } while(0);
12095 0 : size += sizeof(ulong);
12096 0 : size += fd_pubkey_size( &self->owner );
12097 0 : return size;
12098 0 : }
12099 :
12100 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 ) {
12101 0 : int err;
12102 0 : err = fd_pubkey_encode( &self->base, ctx );
12103 0 : if( FD_UNLIKELY( err ) ) return err;
12104 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
12105 0 : if( FD_UNLIKELY(err) ) return err;
12106 0 : if( self->seed_len ) {
12107 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
12108 0 : if( FD_UNLIKELY( err ) ) return err;
12109 0 : }
12110 0 : err = fd_pubkey_encode( &self->owner, ctx );
12111 0 : if( FD_UNLIKELY( err ) ) return err;
12112 0 : return FD_BINCODE_SUCCESS;
12113 0 : }
12114 0 : static int fd_system_program_instruction_assign_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12115 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12116 0 : int err = 0;
12117 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12118 0 : if( FD_UNLIKELY( err ) ) return err;
12119 0 : ulong seed_len;
12120 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
12121 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12122 0 : *total_sz += seed_len;
12123 0 : if( seed_len ) {
12124 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
12125 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12126 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
12127 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12128 0 : }
12129 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12130 0 : if( FD_UNLIKELY( err ) ) return err;
12131 0 : return 0;
12132 0 : }
12133 0 : int fd_system_program_instruction_assign_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12134 0 : *total_sz += sizeof(fd_system_program_instruction_assign_with_seed_t);
12135 0 : void const * start_data = ctx->data;
12136 0 : int err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
12137 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12138 0 : ctx->data = start_data;
12139 0 : return err;
12140 0 : }
12141 0 : static void fd_system_program_instruction_assign_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12142 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)struct_mem;
12143 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
12144 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
12145 0 : if( self->seed_len ) {
12146 0 : self->seed = *alloc_mem;
12147 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
12148 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
12149 0 : } else
12150 0 : self->seed = NULL;
12151 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
12152 0 : }
12153 0 : void * fd_system_program_instruction_assign_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12154 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)mem;
12155 0 : fd_system_program_instruction_assign_with_seed_new( self );
12156 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_assign_with_seed_t);
12157 0 : void * * alloc_mem = &alloc_region;
12158 0 : fd_system_program_instruction_assign_with_seed_decode_inner( mem, alloc_mem, ctx );
12159 0 : return self;
12160 0 : }
12161 0 : void fd_system_program_instruction_assign_with_seed_new(fd_system_program_instruction_assign_with_seed_t * self) {
12162 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_assign_with_seed_t) );
12163 0 : fd_pubkey_new( &self->base );
12164 0 : fd_pubkey_new( &self->owner );
12165 0 : }
12166 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, uint varint ) {
12167 0 : (void) varint;
12168 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_assign_with_seed", level++, 0 );
12169 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
12170 0 : if( self->seed_len ) {
12171 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
12172 0 : for( ulong i=0; i < self->seed_len; i++ )
12173 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
12174 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
12175 0 : }
12176 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
12177 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_assign_with_seed", level--, 0 );
12178 0 : }
12179 0 : ulong fd_system_program_instruction_assign_with_seed_size( fd_system_program_instruction_assign_with_seed_t const * self ) {
12180 0 : ulong size = 0;
12181 0 : size += fd_pubkey_size( &self->base );
12182 0 : do {
12183 0 : size += sizeof(ulong);
12184 0 : size += self->seed_len;
12185 0 : } while(0);
12186 0 : size += fd_pubkey_size( &self->owner );
12187 0 : return size;
12188 0 : }
12189 :
12190 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 ) {
12191 0 : int err;
12192 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
12193 0 : if( FD_UNLIKELY( err ) ) return err;
12194 0 : err = fd_bincode_uint64_encode( self->from_seed_len, ctx );
12195 0 : if( FD_UNLIKELY(err) ) return err;
12196 0 : if( self->from_seed_len ) {
12197 0 : err = fd_bincode_bytes_encode( self->from_seed, self->from_seed_len, ctx );
12198 0 : if( FD_UNLIKELY( err ) ) return err;
12199 0 : }
12200 0 : err = fd_pubkey_encode( &self->from_owner, ctx );
12201 0 : if( FD_UNLIKELY( err ) ) return err;
12202 0 : return FD_BINCODE_SUCCESS;
12203 0 : }
12204 0 : static int fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12205 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12206 0 : int err = 0;
12207 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12208 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12209 0 : ulong from_seed_len;
12210 0 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
12211 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12212 0 : *total_sz += from_seed_len;
12213 0 : if( from_seed_len ) {
12214 0 : err = fd_bincode_bytes_decode_footprint( from_seed_len, ctx );
12215 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12216 0 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
12217 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12218 0 : }
12219 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12220 0 : if( FD_UNLIKELY( err ) ) return err;
12221 0 : return 0;
12222 0 : }
12223 0 : int fd_system_program_instruction_transfer_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12224 0 : *total_sz += sizeof(fd_system_program_instruction_transfer_with_seed_t);
12225 0 : void const * start_data = ctx->data;
12226 0 : int err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
12227 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12228 0 : ctx->data = start_data;
12229 0 : return err;
12230 0 : }
12231 0 : static void fd_system_program_instruction_transfer_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12232 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)struct_mem;
12233 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
12234 0 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
12235 0 : if( self->from_seed_len ) {
12236 0 : self->from_seed = *alloc_mem;
12237 0 : fd_bincode_bytes_decode_unsafe( self->from_seed, self->from_seed_len, ctx );
12238 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->from_seed_len;
12239 0 : } else
12240 0 : self->from_seed = NULL;
12241 0 : fd_pubkey_decode_inner( &self->from_owner, alloc_mem, ctx );
12242 0 : }
12243 0 : void * fd_system_program_instruction_transfer_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12244 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)mem;
12245 0 : fd_system_program_instruction_transfer_with_seed_new( self );
12246 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_transfer_with_seed_t);
12247 0 : void * * alloc_mem = &alloc_region;
12248 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( mem, alloc_mem, ctx );
12249 0 : return self;
12250 0 : }
12251 0 : void fd_system_program_instruction_transfer_with_seed_new(fd_system_program_instruction_transfer_with_seed_t * self) {
12252 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_transfer_with_seed_t) );
12253 0 : fd_pubkey_new( &self->from_owner );
12254 0 : }
12255 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, uint varint ) {
12256 0 : (void) varint;
12257 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_transfer_with_seed", level++, 0 );
12258 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12259 0 : if( self->from_seed_len ) {
12260 0 : fun( w, NULL, "from_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
12261 0 : for( ulong i=0; i < self->from_seed_len; i++ )
12262 0 : fun( w, self->from_seed + i, "from_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
12263 0 : fun( w, NULL, "from_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
12264 0 : }
12265 0 : fd_pubkey_walk( w, &self->from_owner, fun, "from_owner", level, 0 );
12266 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_transfer_with_seed", level--, 0 );
12267 0 : }
12268 0 : ulong fd_system_program_instruction_transfer_with_seed_size( fd_system_program_instruction_transfer_with_seed_t const * self ) {
12269 0 : ulong size = 0;
12270 0 : size += sizeof(ulong);
12271 0 : do {
12272 0 : size += sizeof(ulong);
12273 0 : size += self->from_seed_len;
12274 0 : } while(0);
12275 0 : size += fd_pubkey_size( &self->from_owner );
12276 0 : return size;
12277 0 : }
12278 :
12279 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account(fd_system_program_instruction_t const * self) {
12280 0 : return self->discriminant == 0;
12281 0 : }
12282 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign(fd_system_program_instruction_t const * self) {
12283 0 : return self->discriminant == 1;
12284 0 : }
12285 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer(fd_system_program_instruction_t const * self) {
12286 0 : return self->discriminant == 2;
12287 0 : }
12288 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_with_seed(fd_system_program_instruction_t const * self) {
12289 0 : return self->discriminant == 3;
12290 0 : }
12291 0 : FD_FN_PURE uchar fd_system_program_instruction_is_advance_nonce_account(fd_system_program_instruction_t const * self) {
12292 0 : return self->discriminant == 4;
12293 0 : }
12294 0 : FD_FN_PURE uchar fd_system_program_instruction_is_withdraw_nonce_account(fd_system_program_instruction_t const * self) {
12295 0 : return self->discriminant == 5;
12296 0 : }
12297 0 : FD_FN_PURE uchar fd_system_program_instruction_is_initialize_nonce_account(fd_system_program_instruction_t const * self) {
12298 0 : return self->discriminant == 6;
12299 0 : }
12300 0 : FD_FN_PURE uchar fd_system_program_instruction_is_authorize_nonce_account(fd_system_program_instruction_t const * self) {
12301 0 : return self->discriminant == 7;
12302 0 : }
12303 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate(fd_system_program_instruction_t const * self) {
12304 0 : return self->discriminant == 8;
12305 0 : }
12306 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate_with_seed(fd_system_program_instruction_t const * self) {
12307 0 : return self->discriminant == 9;
12308 0 : }
12309 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign_with_seed(fd_system_program_instruction_t const * self) {
12310 0 : return self->discriminant == 10;
12311 0 : }
12312 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer_with_seed(fd_system_program_instruction_t const * self) {
12313 0 : return self->discriminant == 11;
12314 0 : }
12315 0 : FD_FN_PURE uchar fd_system_program_instruction_is_upgrade_nonce_account(fd_system_program_instruction_t const * self) {
12316 0 : return self->discriminant == 12;
12317 0 : }
12318 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant );
12319 0 : int fd_system_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12320 0 : int err;
12321 0 : switch (discriminant) {
12322 0 : case 0: {
12323 0 : err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
12324 0 : if( FD_UNLIKELY( err ) ) return err;
12325 0 : return FD_BINCODE_SUCCESS;
12326 0 : }
12327 0 : case 1: {
12328 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12329 0 : if( FD_UNLIKELY( err ) ) return err;
12330 0 : return FD_BINCODE_SUCCESS;
12331 0 : }
12332 0 : case 2: {
12333 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12334 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12335 0 : return FD_BINCODE_SUCCESS;
12336 0 : }
12337 0 : case 3: {
12338 0 : err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
12339 0 : if( FD_UNLIKELY( err ) ) return err;
12340 0 : return FD_BINCODE_SUCCESS;
12341 0 : }
12342 0 : case 4: {
12343 0 : return FD_BINCODE_SUCCESS;
12344 0 : }
12345 0 : case 5: {
12346 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12347 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12348 0 : return FD_BINCODE_SUCCESS;
12349 0 : }
12350 0 : case 6: {
12351 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12352 0 : if( FD_UNLIKELY( err ) ) return err;
12353 0 : return FD_BINCODE_SUCCESS;
12354 0 : }
12355 0 : case 7: {
12356 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12357 0 : if( FD_UNLIKELY( err ) ) return err;
12358 0 : return FD_BINCODE_SUCCESS;
12359 0 : }
12360 0 : case 8: {
12361 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12362 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12363 0 : return FD_BINCODE_SUCCESS;
12364 0 : }
12365 0 : case 9: {
12366 0 : err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
12367 0 : if( FD_UNLIKELY( err ) ) return err;
12368 0 : return FD_BINCODE_SUCCESS;
12369 0 : }
12370 0 : case 10: {
12371 0 : err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
12372 0 : if( FD_UNLIKELY( err ) ) return err;
12373 0 : return FD_BINCODE_SUCCESS;
12374 0 : }
12375 0 : case 11: {
12376 0 : err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
12377 0 : if( FD_UNLIKELY( err ) ) return err;
12378 0 : return FD_BINCODE_SUCCESS;
12379 0 : }
12380 0 : case 12: {
12381 0 : return FD_BINCODE_SUCCESS;
12382 0 : }
12383 0 : default: return FD_BINCODE_ERR_ENCODING;
12384 0 : }
12385 0 : }
12386 0 : static int fd_system_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12387 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12388 0 : uint discriminant = 0;
12389 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
12390 0 : if( FD_UNLIKELY( err ) ) return err;
12391 0 : return fd_system_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
12392 0 : }
12393 0 : int fd_system_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12394 0 : *total_sz += sizeof(fd_system_program_instruction_t);
12395 0 : void const * start_data = ctx->data;
12396 0 : int err = fd_system_program_instruction_decode_footprint_inner( ctx, total_sz );
12397 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12398 0 : ctx->data = start_data;
12399 0 : return err;
12400 0 : }
12401 0 : static void fd_system_program_instruction_inner_decode_inner( fd_system_program_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
12402 0 : switch (discriminant) {
12403 0 : case 0: {
12404 0 : fd_system_program_instruction_create_account_decode_inner( &self->create_account, alloc_mem, ctx );
12405 0 : break;
12406 0 : }
12407 0 : case 1: {
12408 0 : fd_pubkey_decode_inner( &self->assign, alloc_mem, ctx );
12409 0 : break;
12410 0 : }
12411 0 : case 2: {
12412 0 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
12413 0 : break;
12414 0 : }
12415 0 : case 3: {
12416 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( &self->create_account_with_seed, alloc_mem, ctx );
12417 0 : break;
12418 0 : }
12419 0 : case 4: {
12420 0 : break;
12421 0 : }
12422 0 : case 5: {
12423 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
12424 0 : break;
12425 0 : }
12426 0 : case 6: {
12427 0 : fd_pubkey_decode_inner( &self->initialize_nonce_account, alloc_mem, ctx );
12428 0 : break;
12429 0 : }
12430 0 : case 7: {
12431 0 : fd_pubkey_decode_inner( &self->authorize_nonce_account, alloc_mem, ctx );
12432 0 : break;
12433 0 : }
12434 0 : case 8: {
12435 0 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
12436 0 : break;
12437 0 : }
12438 0 : case 9: {
12439 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( &self->allocate_with_seed, alloc_mem, ctx );
12440 0 : break;
12441 0 : }
12442 0 : case 10: {
12443 0 : fd_system_program_instruction_assign_with_seed_decode_inner( &self->assign_with_seed, alloc_mem, ctx );
12444 0 : break;
12445 0 : }
12446 0 : case 11: {
12447 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( &self->transfer_with_seed, alloc_mem, ctx );
12448 0 : break;
12449 0 : }
12450 0 : case 12: {
12451 0 : break;
12452 0 : }
12453 0 : }
12454 0 : }
12455 0 : static void fd_system_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12456 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)struct_mem;
12457 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
12458 0 : fd_system_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
12459 0 : }
12460 0 : void * fd_system_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12461 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)mem;
12462 0 : fd_system_program_instruction_new( self );
12463 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_t);
12464 0 : void * * alloc_mem = &alloc_region;
12465 0 : fd_system_program_instruction_decode_inner( mem, alloc_mem, ctx );
12466 0 : return self;
12467 0 : }
12468 0 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant ) {
12469 0 : switch( discriminant ) {
12470 0 : case 0: {
12471 0 : fd_system_program_instruction_create_account_new( &self->create_account );
12472 0 : break;
12473 0 : }
12474 0 : case 1: {
12475 0 : fd_pubkey_new( &self->assign );
12476 0 : break;
12477 0 : }
12478 0 : case 2: {
12479 0 : break;
12480 0 : }
12481 0 : case 3: {
12482 0 : fd_system_program_instruction_create_account_with_seed_new( &self->create_account_with_seed );
12483 0 : break;
12484 0 : }
12485 0 : case 4: {
12486 0 : break;
12487 0 : }
12488 0 : case 5: {
12489 0 : break;
12490 0 : }
12491 0 : case 6: {
12492 0 : fd_pubkey_new( &self->initialize_nonce_account );
12493 0 : break;
12494 0 : }
12495 0 : case 7: {
12496 0 : fd_pubkey_new( &self->authorize_nonce_account );
12497 0 : break;
12498 0 : }
12499 0 : case 8: {
12500 0 : break;
12501 0 : }
12502 0 : case 9: {
12503 0 : fd_system_program_instruction_allocate_with_seed_new( &self->allocate_with_seed );
12504 0 : break;
12505 0 : }
12506 0 : case 10: {
12507 0 : fd_system_program_instruction_assign_with_seed_new( &self->assign_with_seed );
12508 0 : break;
12509 0 : }
12510 0 : case 11: {
12511 0 : fd_system_program_instruction_transfer_with_seed_new( &self->transfer_with_seed );
12512 0 : break;
12513 0 : }
12514 0 : case 12: {
12515 0 : break;
12516 0 : }
12517 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
12518 0 : }
12519 0 : }
12520 0 : void fd_system_program_instruction_new_disc( fd_system_program_instruction_t * self, uint discriminant ) {
12521 0 : self->discriminant = discriminant;
12522 0 : fd_system_program_instruction_inner_new( &self->inner, self->discriminant );
12523 0 : }
12524 0 : void fd_system_program_instruction_new( fd_system_program_instruction_t * self ) {
12525 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_t) );
12526 0 : fd_system_program_instruction_new_disc( self, UINT_MAX );
12527 0 : }
12528 :
12529 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, uint varint ) {
12530 0 : (void) varint;
12531 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_program_instruction", level++, 0);
12532 0 : switch( self->discriminant ) {
12533 0 : case 0: {
12534 0 : fun( w, self, "create_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12535 0 : fd_system_program_instruction_create_account_walk( w, &self->inner.create_account, fun, "create_account", level, 0 );
12536 0 : break;
12537 0 : }
12538 0 : case 1: {
12539 0 : fun( w, self, "assign", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12540 0 : fd_pubkey_walk( w, &self->inner.assign, fun, "assign", level, 0 );
12541 0 : break;
12542 0 : }
12543 0 : case 2: {
12544 0 : fun( w, self, "transfer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12545 0 : fun( w, &self->inner.transfer, "transfer", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12546 0 : break;
12547 0 : }
12548 0 : case 3: {
12549 0 : fun( w, self, "create_account_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12550 0 : fd_system_program_instruction_create_account_with_seed_walk( w, &self->inner.create_account_with_seed, fun, "create_account_with_seed", level, 0 );
12551 0 : break;
12552 0 : }
12553 0 : case 4: {
12554 0 : fun( w, self, "advance_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12555 0 : break;
12556 0 : }
12557 0 : case 5: {
12558 0 : fun( w, self, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12559 0 : fun( w, &self->inner.withdraw_nonce_account, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12560 0 : break;
12561 0 : }
12562 0 : case 6: {
12563 0 : fun( w, self, "initialize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12564 0 : fd_pubkey_walk( w, &self->inner.initialize_nonce_account, fun, "initialize_nonce_account", level, 0 );
12565 0 : break;
12566 0 : }
12567 0 : case 7: {
12568 0 : fun( w, self, "authorize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12569 0 : fd_pubkey_walk( w, &self->inner.authorize_nonce_account, fun, "authorize_nonce_account", level, 0 );
12570 0 : break;
12571 0 : }
12572 0 : case 8: {
12573 0 : fun( w, self, "allocate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12574 0 : fun( w, &self->inner.allocate, "allocate", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12575 0 : break;
12576 0 : }
12577 0 : case 9: {
12578 0 : fun( w, self, "allocate_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12579 0 : fd_system_program_instruction_allocate_with_seed_walk( w, &self->inner.allocate_with_seed, fun, "allocate_with_seed", level, 0 );
12580 0 : break;
12581 0 : }
12582 0 : case 10: {
12583 0 : fun( w, self, "assign_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12584 0 : fd_system_program_instruction_assign_with_seed_walk( w, &self->inner.assign_with_seed, fun, "assign_with_seed", level, 0 );
12585 0 : break;
12586 0 : }
12587 0 : case 11: {
12588 0 : fun( w, self, "transfer_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12589 0 : fd_system_program_instruction_transfer_with_seed_walk( w, &self->inner.transfer_with_seed, fun, "transfer_with_seed", level, 0 );
12590 0 : break;
12591 0 : }
12592 0 : case 12: {
12593 0 : fun( w, self, "upgrade_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12594 0 : break;
12595 0 : }
12596 0 : }
12597 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_program_instruction", level--, 0 );
12598 0 : }
12599 0 : ulong fd_system_program_instruction_size( fd_system_program_instruction_t const * self ) {
12600 0 : ulong size = 0;
12601 0 : size += sizeof(uint);
12602 0 : switch (self->discriminant) {
12603 0 : case 0: {
12604 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account );
12605 0 : break;
12606 0 : }
12607 0 : case 1: {
12608 0 : size += fd_pubkey_size( &self->inner.assign );
12609 0 : break;
12610 0 : }
12611 0 : case 2: {
12612 0 : size += sizeof(ulong);
12613 0 : break;
12614 0 : }
12615 0 : case 3: {
12616 0 : size += fd_system_program_instruction_create_account_with_seed_size( &self->inner.create_account_with_seed );
12617 0 : break;
12618 0 : }
12619 0 : case 5: {
12620 0 : size += sizeof(ulong);
12621 0 : break;
12622 0 : }
12623 0 : case 6: {
12624 0 : size += fd_pubkey_size( &self->inner.initialize_nonce_account );
12625 0 : break;
12626 0 : }
12627 0 : case 7: {
12628 0 : size += fd_pubkey_size( &self->inner.authorize_nonce_account );
12629 0 : break;
12630 0 : }
12631 0 : case 8: {
12632 0 : size += sizeof(ulong);
12633 0 : break;
12634 0 : }
12635 0 : case 9: {
12636 0 : size += fd_system_program_instruction_allocate_with_seed_size( &self->inner.allocate_with_seed );
12637 0 : break;
12638 0 : }
12639 0 : case 10: {
12640 0 : size += fd_system_program_instruction_assign_with_seed_size( &self->inner.assign_with_seed );
12641 0 : break;
12642 0 : }
12643 0 : case 11: {
12644 0 : size += fd_system_program_instruction_transfer_with_seed_size( &self->inner.transfer_with_seed );
12645 0 : break;
12646 0 : }
12647 0 : }
12648 0 : return size;
12649 0 : }
12650 :
12651 0 : int fd_system_program_instruction_inner_encode( fd_system_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
12652 0 : int err;
12653 0 : switch (discriminant) {
12654 0 : case 0: {
12655 0 : err = fd_system_program_instruction_create_account_encode( &self->create_account, ctx );
12656 0 : if( FD_UNLIKELY( err ) ) return err;
12657 0 : break;
12658 0 : }
12659 0 : case 1: {
12660 0 : err = fd_pubkey_encode( &self->assign, ctx );
12661 0 : if( FD_UNLIKELY( err ) ) return err;
12662 0 : break;
12663 0 : }
12664 0 : case 2: {
12665 0 : err = fd_bincode_uint64_encode( self->transfer, ctx );
12666 0 : if( FD_UNLIKELY( err ) ) return err;
12667 0 : break;
12668 0 : }
12669 0 : case 3: {
12670 0 : err = fd_system_program_instruction_create_account_with_seed_encode( &self->create_account_with_seed, ctx );
12671 0 : if( FD_UNLIKELY( err ) ) return err;
12672 0 : break;
12673 0 : }
12674 0 : case 5: {
12675 0 : err = fd_bincode_uint64_encode( self->withdraw_nonce_account, ctx );
12676 0 : if( FD_UNLIKELY( err ) ) return err;
12677 0 : break;
12678 0 : }
12679 0 : case 6: {
12680 0 : err = fd_pubkey_encode( &self->initialize_nonce_account, ctx );
12681 0 : if( FD_UNLIKELY( err ) ) return err;
12682 0 : break;
12683 0 : }
12684 0 : case 7: {
12685 0 : err = fd_pubkey_encode( &self->authorize_nonce_account, ctx );
12686 0 : if( FD_UNLIKELY( err ) ) return err;
12687 0 : break;
12688 0 : }
12689 0 : case 8: {
12690 0 : err = fd_bincode_uint64_encode( self->allocate, ctx );
12691 0 : if( FD_UNLIKELY( err ) ) return err;
12692 0 : break;
12693 0 : }
12694 0 : case 9: {
12695 0 : err = fd_system_program_instruction_allocate_with_seed_encode( &self->allocate_with_seed, ctx );
12696 0 : if( FD_UNLIKELY( err ) ) return err;
12697 0 : break;
12698 0 : }
12699 0 : case 10: {
12700 0 : err = fd_system_program_instruction_assign_with_seed_encode( &self->assign_with_seed, ctx );
12701 0 : if( FD_UNLIKELY( err ) ) return err;
12702 0 : break;
12703 0 : }
12704 0 : case 11: {
12705 0 : err = fd_system_program_instruction_transfer_with_seed_encode( &self->transfer_with_seed, ctx );
12706 0 : if( FD_UNLIKELY( err ) ) return err;
12707 0 : break;
12708 0 : }
12709 0 : }
12710 0 : return FD_BINCODE_SUCCESS;
12711 0 : }
12712 0 : int fd_system_program_instruction_encode( fd_system_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12713 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12714 0 : if( FD_UNLIKELY( err ) ) return err;
12715 0 : return fd_system_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
12716 0 : }
12717 :
12718 0 : FD_FN_PURE uchar fd_system_error_is_account_already_in_use(fd_system_error_t const * self) {
12719 0 : return self->discriminant == 0;
12720 0 : }
12721 0 : FD_FN_PURE uchar fd_system_error_is_result_with_negative_lamports(fd_system_error_t const * self) {
12722 0 : return self->discriminant == 1;
12723 0 : }
12724 0 : FD_FN_PURE uchar fd_system_error_is_invalid_program_id(fd_system_error_t const * self) {
12725 0 : return self->discriminant == 2;
12726 0 : }
12727 0 : FD_FN_PURE uchar fd_system_error_is_invalid_account_data_length(fd_system_error_t const * self) {
12728 0 : return self->discriminant == 3;
12729 0 : }
12730 0 : FD_FN_PURE uchar fd_system_error_is_max_seed_length_exceeded(fd_system_error_t const * self) {
12731 0 : return self->discriminant == 4;
12732 0 : }
12733 0 : FD_FN_PURE uchar fd_system_error_is_address_with_seed_mismatch(fd_system_error_t const * self) {
12734 0 : return self->discriminant == 5;
12735 0 : }
12736 0 : FD_FN_PURE uchar fd_system_error_is_nonce_no_recent_blockhashes(fd_system_error_t const * self) {
12737 0 : return self->discriminant == 6;
12738 0 : }
12739 0 : FD_FN_PURE uchar fd_system_error_is_nonce_blockhash_not_expired(fd_system_error_t const * self) {
12740 0 : return self->discriminant == 7;
12741 0 : }
12742 0 : FD_FN_PURE uchar fd_system_error_is_nonce_unexpected_blockhash_value(fd_system_error_t const * self) {
12743 0 : return self->discriminant == 8;
12744 0 : }
12745 0 : int fd_system_error_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12746 0 : int err;
12747 0 : switch (discriminant) {
12748 0 : case 0: {
12749 0 : return FD_BINCODE_SUCCESS;
12750 0 : }
12751 0 : case 1: {
12752 0 : return FD_BINCODE_SUCCESS;
12753 0 : }
12754 0 : case 2: {
12755 0 : return FD_BINCODE_SUCCESS;
12756 0 : }
12757 0 : case 3: {
12758 0 : return FD_BINCODE_SUCCESS;
12759 0 : }
12760 0 : case 4: {
12761 0 : return FD_BINCODE_SUCCESS;
12762 0 : }
12763 0 : case 5: {
12764 0 : return FD_BINCODE_SUCCESS;
12765 0 : }
12766 0 : case 6: {
12767 0 : return FD_BINCODE_SUCCESS;
12768 0 : }
12769 0 : case 7: {
12770 0 : return FD_BINCODE_SUCCESS;
12771 0 : }
12772 0 : case 8: {
12773 0 : return FD_BINCODE_SUCCESS;
12774 0 : }
12775 0 : default: return FD_BINCODE_ERR_ENCODING;
12776 0 : }
12777 0 : }
12778 0 : static int fd_system_error_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12779 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12780 0 : uint discriminant = 0;
12781 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
12782 0 : if( FD_UNLIKELY( err ) ) return err;
12783 0 : return fd_system_error_inner_decode_footprint( discriminant, ctx, total_sz );
12784 0 : }
12785 0 : int fd_system_error_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12786 0 : *total_sz += sizeof(fd_system_error_t);
12787 0 : void const * start_data = ctx->data;
12788 0 : int err = fd_system_error_decode_footprint_inner( ctx, total_sz );
12789 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12790 0 : ctx->data = start_data;
12791 0 : return err;
12792 0 : }
12793 0 : static void fd_system_error_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12794 0 : fd_system_error_t * self = (fd_system_error_t *)struct_mem;
12795 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
12796 0 : }
12797 0 : void * fd_system_error_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12798 0 : fd_system_error_t * self = (fd_system_error_t *)mem;
12799 0 : fd_system_error_new( self );
12800 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_error_t);
12801 0 : void * * alloc_mem = &alloc_region;
12802 0 : fd_system_error_decode_inner( mem, alloc_mem, ctx );
12803 0 : return self;
12804 0 : }
12805 :
12806 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, uint varint ) {
12807 0 : (void) varint;
12808 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_error", level++, 0);
12809 0 : switch( self->discriminant ) {
12810 0 : case 0: {
12811 0 : fun( w, self, "account_already_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12812 0 : break;
12813 0 : }
12814 0 : case 1: {
12815 0 : fun( w, self, "result_with_negative_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12816 0 : break;
12817 0 : }
12818 0 : case 2: {
12819 0 : fun( w, self, "invalid_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12820 0 : break;
12821 0 : }
12822 0 : case 3: {
12823 0 : fun( w, self, "invalid_account_data_length", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12824 0 : break;
12825 0 : }
12826 0 : case 4: {
12827 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12828 0 : break;
12829 0 : }
12830 0 : case 5: {
12831 0 : fun( w, self, "address_with_seed_mismatch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12832 0 : break;
12833 0 : }
12834 0 : case 6: {
12835 0 : fun( w, self, "nonce_no_recent_blockhashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12836 0 : break;
12837 0 : }
12838 0 : case 7: {
12839 0 : fun( w, self, "nonce_blockhash_not_expired", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12840 0 : break;
12841 0 : }
12842 0 : case 8: {
12843 0 : fun( w, self, "nonce_unexpected_blockhash_value", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12844 0 : break;
12845 0 : }
12846 0 : }
12847 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_error", level--, 0 );
12848 0 : }
12849 0 : ulong fd_system_error_size( fd_system_error_t const * self ) {
12850 0 : ulong size = 0;
12851 0 : size += sizeof(uint);
12852 0 : switch (self->discriminant) {
12853 0 : }
12854 0 : return size;
12855 0 : }
12856 :
12857 0 : int fd_system_error_encode( fd_system_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12858 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12859 0 : if( FD_UNLIKELY( err ) ) return err;
12860 0 : return err;
12861 0 : }
12862 :
12863 12 : int fd_stake_authorized_encode( fd_stake_authorized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12864 12 : int err;
12865 12 : err = fd_pubkey_encode( &self->staker, ctx );
12866 12 : if( FD_UNLIKELY( err ) ) return err;
12867 12 : err = fd_pubkey_encode( &self->withdrawer, ctx );
12868 12 : if( FD_UNLIKELY( err ) ) return err;
12869 12 : return FD_BINCODE_SUCCESS;
12870 12 : }
12871 0 : static inline int fd_stake_authorized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12872 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12873 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
12874 0 : return 0;
12875 0 : }
12876 0 : static void fd_stake_authorized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12877 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)struct_mem;
12878 0 : fd_pubkey_decode_inner( &self->staker, alloc_mem, ctx );
12879 0 : fd_pubkey_decode_inner( &self->withdrawer, alloc_mem, ctx );
12880 0 : }
12881 0 : void * fd_stake_authorized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12882 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)mem;
12883 0 : fd_stake_authorized_new( self );
12884 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorized_t);
12885 0 : void * * alloc_mem = &alloc_region;
12886 0 : fd_stake_authorized_decode_inner( mem, alloc_mem, ctx );
12887 0 : return self;
12888 0 : }
12889 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, uint varint ) {
12890 0 : (void) varint;
12891 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_authorized", level++, 0 );
12892 0 : fd_pubkey_walk( w, &self->staker, fun, "staker", level, 0 );
12893 0 : fd_pubkey_walk( w, &self->withdrawer, fun, "withdrawer", level, 0 );
12894 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_authorized", level--, 0 );
12895 0 : }
12896 12 : int fd_stake_lockup_encode( fd_stake_lockup_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12897 12 : int err;
12898 12 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
12899 12 : if( FD_UNLIKELY( err ) ) return err;
12900 12 : err = fd_bincode_uint64_encode( self->epoch, ctx );
12901 12 : if( FD_UNLIKELY( err ) ) return err;
12902 12 : err = fd_pubkey_encode( &self->custodian, ctx );
12903 12 : if( FD_UNLIKELY( err ) ) return err;
12904 12 : return FD_BINCODE_SUCCESS;
12905 12 : }
12906 0 : static inline int fd_stake_lockup_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12907 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12908 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
12909 0 : return 0;
12910 0 : }
12911 0 : static void fd_stake_lockup_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12912 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)struct_mem;
12913 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
12914 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
12915 0 : fd_pubkey_decode_inner( &self->custodian, alloc_mem, ctx );
12916 0 : }
12917 0 : void * fd_stake_lockup_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12918 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)mem;
12919 0 : fd_stake_lockup_new( self );
12920 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_t);
12921 0 : void * * alloc_mem = &alloc_region;
12922 0 : fd_stake_lockup_decode_inner( mem, alloc_mem, ctx );
12923 0 : return self;
12924 0 : }
12925 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, uint varint ) {
12926 0 : (void) varint;
12927 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup", level++, 0 );
12928 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
12929 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12930 0 : fd_pubkey_walk( w, &self->custodian, fun, "custodian", level, 0 );
12931 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup", level--, 0 );
12932 0 : }
12933 0 : int fd_stake_instruction_initialize_encode( fd_stake_instruction_initialize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12934 0 : int err;
12935 0 : err = fd_stake_authorized_encode( &self->authorized, ctx );
12936 0 : if( FD_UNLIKELY( err ) ) return err;
12937 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
12938 0 : if( FD_UNLIKELY( err ) ) return err;
12939 0 : return FD_BINCODE_SUCCESS;
12940 0 : }
12941 0 : static inline int fd_stake_instruction_initialize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12942 0 : if( (ulong)ctx->data + 112UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12943 0 : ctx->data = (void *)( (ulong)ctx->data + 112UL );
12944 0 : return 0;
12945 0 : }
12946 0 : static void fd_stake_instruction_initialize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12947 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)struct_mem;
12948 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
12949 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
12950 0 : }
12951 0 : void * fd_stake_instruction_initialize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12952 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)mem;
12953 0 : fd_stake_instruction_initialize_new( self );
12954 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_initialize_t);
12955 0 : void * * alloc_mem = &alloc_region;
12956 0 : fd_stake_instruction_initialize_decode_inner( mem, alloc_mem, ctx );
12957 0 : return self;
12958 0 : }
12959 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, uint varint ) {
12960 0 : (void) varint;
12961 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_initialize", level++, 0 );
12962 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level, 0 );
12963 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
12964 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_initialize", level--, 0 );
12965 0 : }
12966 0 : int fd_stake_lockup_custodian_args_encode( fd_stake_lockup_custodian_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12967 0 : int err;
12968 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
12969 0 : if( FD_UNLIKELY( err ) ) return err;
12970 0 : err = fd_sol_sysvar_clock_encode( &self->clock, ctx );
12971 0 : if( FD_UNLIKELY( err ) ) return err;
12972 0 : if( self->custodian != NULL ) {
12973 0 : err = fd_bincode_bool_encode( 1, ctx );
12974 0 : if( FD_UNLIKELY( err ) ) return err;
12975 0 : err = fd_pubkey_encode( self->custodian, ctx );
12976 0 : if( FD_UNLIKELY( err ) ) return err;
12977 0 : } else {
12978 0 : err = fd_bincode_bool_encode( 0, ctx );
12979 0 : if( FD_UNLIKELY( err ) ) return err;
12980 0 : }
12981 0 : return FD_BINCODE_SUCCESS;
12982 0 : }
12983 0 : static int fd_stake_lockup_custodian_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12984 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12985 0 : int err = 0;
12986 0 : err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
12987 0 : if( FD_UNLIKELY( err ) ) return err;
12988 0 : err = fd_sol_sysvar_clock_decode_footprint_inner( ctx, total_sz );
12989 0 : if( FD_UNLIKELY( err ) ) return err;
12990 0 : {
12991 0 : uchar o;
12992 0 : err = fd_bincode_bool_decode( &o, ctx );
12993 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12994 0 : if( o ) {
12995 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
12996 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12997 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12998 0 : }
12999 0 : }
13000 0 : return 0;
13001 0 : }
13002 0 : int fd_stake_lockup_custodian_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13003 0 : *total_sz += sizeof(fd_stake_lockup_custodian_args_t);
13004 0 : void const * start_data = ctx->data;
13005 0 : int err = fd_stake_lockup_custodian_args_decode_footprint_inner( ctx, total_sz );
13006 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13007 0 : ctx->data = start_data;
13008 0 : return err;
13009 0 : }
13010 0 : static void fd_stake_lockup_custodian_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13011 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)struct_mem;
13012 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
13013 0 : fd_sol_sysvar_clock_decode_inner( &self->clock, alloc_mem, ctx );
13014 0 : {
13015 0 : uchar o;
13016 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
13017 0 : if( o ) {
13018 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
13019 0 : self->custodian = *alloc_mem;
13020 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
13021 0 : fd_pubkey_new( self->custodian );
13022 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
13023 0 : } else {
13024 0 : self->custodian = NULL;
13025 0 : }
13026 0 : }
13027 0 : }
13028 0 : void * fd_stake_lockup_custodian_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13029 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)mem;
13030 0 : fd_stake_lockup_custodian_args_new( self );
13031 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_custodian_args_t);
13032 0 : void * * alloc_mem = &alloc_region;
13033 0 : fd_stake_lockup_custodian_args_decode_inner( mem, alloc_mem, ctx );
13034 0 : return self;
13035 0 : }
13036 0 : void fd_stake_lockup_custodian_args_new(fd_stake_lockup_custodian_args_t * self) {
13037 0 : fd_memset( self, 0, sizeof(fd_stake_lockup_custodian_args_t) );
13038 0 : fd_stake_lockup_new( &self->lockup );
13039 0 : fd_sol_sysvar_clock_new( &self->clock );
13040 0 : }
13041 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, uint varint ) {
13042 0 : (void) varint;
13043 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup_custodian_args", level++, 0 );
13044 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
13045 0 : fd_sol_sysvar_clock_walk( w, &self->clock, fun, "clock", level, 0 );
13046 0 : if( !self->custodian ) {
13047 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
13048 0 : } else {
13049 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level, 0 );
13050 0 : }
13051 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup_custodian_args", level--, 0 );
13052 0 : }
13053 0 : ulong fd_stake_lockup_custodian_args_size( fd_stake_lockup_custodian_args_t const * self ) {
13054 0 : ulong size = 0;
13055 0 : size += fd_stake_lockup_size( &self->lockup );
13056 0 : size += fd_sol_sysvar_clock_size( &self->clock );
13057 0 : size += sizeof(char);
13058 0 : if( NULL != self->custodian ) {
13059 0 : size += fd_pubkey_size( self->custodian );
13060 0 : }
13061 0 : return size;
13062 0 : }
13063 :
13064 0 : FD_FN_PURE uchar fd_stake_authorize_is_staker(fd_stake_authorize_t const * self) {
13065 0 : return self->discriminant == 0;
13066 0 : }
13067 0 : FD_FN_PURE uchar fd_stake_authorize_is_withdrawer(fd_stake_authorize_t const * self) {
13068 0 : return self->discriminant == 1;
13069 0 : }
13070 0 : int fd_stake_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13071 0 : int err;
13072 0 : switch (discriminant) {
13073 0 : case 0: {
13074 0 : return FD_BINCODE_SUCCESS;
13075 0 : }
13076 0 : case 1: {
13077 0 : return FD_BINCODE_SUCCESS;
13078 0 : }
13079 0 : default: return FD_BINCODE_ERR_ENCODING;
13080 0 : }
13081 0 : }
13082 0 : static int fd_stake_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13083 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13084 0 : uint discriminant = 0;
13085 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
13086 0 : if( FD_UNLIKELY( err ) ) return err;
13087 0 : return fd_stake_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
13088 0 : }
13089 0 : int fd_stake_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13090 0 : *total_sz += sizeof(fd_stake_authorize_t);
13091 0 : void const * start_data = ctx->data;
13092 0 : int err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
13093 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13094 0 : ctx->data = start_data;
13095 0 : return err;
13096 0 : }
13097 0 : static void fd_stake_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13098 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)struct_mem;
13099 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
13100 0 : }
13101 0 : void * fd_stake_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13102 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)mem;
13103 0 : fd_stake_authorize_new( self );
13104 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorize_t);
13105 0 : void * * alloc_mem = &alloc_region;
13106 0 : fd_stake_authorize_decode_inner( mem, alloc_mem, ctx );
13107 0 : return self;
13108 0 : }
13109 :
13110 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, uint varint ) {
13111 0 : (void) varint;
13112 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_authorize", level++, 0);
13113 0 : switch( self->discriminant ) {
13114 0 : case 0: {
13115 0 : fun( w, self, "staker", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13116 0 : break;
13117 0 : }
13118 0 : case 1: {
13119 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13120 0 : break;
13121 0 : }
13122 0 : }
13123 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_authorize", level--, 0 );
13124 0 : }
13125 0 : ulong fd_stake_authorize_size( fd_stake_authorize_t const * self ) {
13126 0 : ulong size = 0;
13127 0 : size += sizeof(uint);
13128 0 : switch (self->discriminant) {
13129 0 : }
13130 0 : return size;
13131 0 : }
13132 :
13133 0 : int fd_stake_authorize_encode( fd_stake_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13134 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
13135 0 : if( FD_UNLIKELY( err ) ) return err;
13136 0 : return err;
13137 0 : }
13138 :
13139 0 : int fd_stake_instruction_authorize_encode( fd_stake_instruction_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13140 0 : int err;
13141 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
13142 0 : if( FD_UNLIKELY( err ) ) return err;
13143 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
13144 0 : if( FD_UNLIKELY( err ) ) return err;
13145 0 : return FD_BINCODE_SUCCESS;
13146 0 : }
13147 0 : static int fd_stake_instruction_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13148 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13149 0 : int err = 0;
13150 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13151 0 : if( FD_UNLIKELY( err ) ) return err;
13152 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
13153 0 : if( FD_UNLIKELY( err ) ) return err;
13154 0 : return 0;
13155 0 : }
13156 0 : int fd_stake_instruction_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13157 0 : *total_sz += sizeof(fd_stake_instruction_authorize_t);
13158 0 : void const * start_data = ctx->data;
13159 0 : int err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
13160 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13161 0 : ctx->data = start_data;
13162 0 : return err;
13163 0 : }
13164 0 : static void fd_stake_instruction_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13165 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)struct_mem;
13166 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
13167 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
13168 0 : }
13169 0 : void * fd_stake_instruction_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13170 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)mem;
13171 0 : fd_stake_instruction_authorize_new( self );
13172 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_authorize_t);
13173 0 : void * * alloc_mem = &alloc_region;
13174 0 : fd_stake_instruction_authorize_decode_inner( mem, alloc_mem, ctx );
13175 0 : return self;
13176 0 : }
13177 0 : void fd_stake_instruction_authorize_new(fd_stake_instruction_authorize_t * self) {
13178 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_authorize_t) );
13179 0 : fd_pubkey_new( &self->pubkey );
13180 0 : fd_stake_authorize_new( &self->stake_authorize );
13181 0 : }
13182 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, uint varint ) {
13183 0 : (void) varint;
13184 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_authorize", level++, 0 );
13185 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
13186 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
13187 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_authorize", level--, 0 );
13188 0 : }
13189 0 : int fd_authorize_with_seed_args_encode( fd_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13190 0 : int err;
13191 0 : err = fd_pubkey_encode( &self->new_authorized_pubkey, ctx );
13192 0 : if( FD_UNLIKELY( err ) ) return err;
13193 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
13194 0 : if( FD_UNLIKELY( err ) ) return err;
13195 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
13196 0 : if( FD_UNLIKELY(err) ) return err;
13197 0 : if( self->authority_seed_len ) {
13198 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
13199 0 : if( FD_UNLIKELY( err ) ) return err;
13200 0 : }
13201 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
13202 0 : if( FD_UNLIKELY( err ) ) return err;
13203 0 : return FD_BINCODE_SUCCESS;
13204 0 : }
13205 0 : static int fd_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13206 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13207 0 : int err = 0;
13208 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13209 0 : if( FD_UNLIKELY( err ) ) return err;
13210 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
13211 0 : if( FD_UNLIKELY( err ) ) return err;
13212 0 : ulong authority_seed_len;
13213 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
13214 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13215 0 : *total_sz += authority_seed_len;
13216 0 : if( authority_seed_len ) {
13217 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
13218 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13219 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
13220 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13221 0 : }
13222 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13223 0 : if( FD_UNLIKELY( err ) ) return err;
13224 0 : return 0;
13225 0 : }
13226 0 : int fd_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13227 0 : *total_sz += sizeof(fd_authorize_with_seed_args_t);
13228 0 : void const * start_data = ctx->data;
13229 0 : int err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
13230 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13231 0 : ctx->data = start_data;
13232 0 : return err;
13233 0 : }
13234 0 : static void fd_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13235 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)struct_mem;
13236 0 : fd_pubkey_decode_inner( &self->new_authorized_pubkey, alloc_mem, ctx );
13237 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
13238 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
13239 0 : if( self->authority_seed_len ) {
13240 0 : self->authority_seed = *alloc_mem;
13241 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
13242 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
13243 0 : } else
13244 0 : self->authority_seed = NULL;
13245 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
13246 0 : }
13247 0 : void * fd_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13248 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)mem;
13249 0 : fd_authorize_with_seed_args_new( self );
13250 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_with_seed_args_t);
13251 0 : void * * alloc_mem = &alloc_region;
13252 0 : fd_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
13253 0 : return self;
13254 0 : }
13255 0 : void fd_authorize_with_seed_args_new(fd_authorize_with_seed_args_t * self) {
13256 0 : fd_memset( self, 0, sizeof(fd_authorize_with_seed_args_t) );
13257 0 : fd_pubkey_new( &self->new_authorized_pubkey );
13258 0 : fd_stake_authorize_new( &self->stake_authorize );
13259 0 : fd_pubkey_new( &self->authority_owner );
13260 0 : }
13261 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, uint varint ) {
13262 0 : (void) varint;
13263 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_with_seed_args", level++, 0 );
13264 0 : fd_pubkey_walk( w, &self->new_authorized_pubkey, fun, "new_authorized_pubkey", level, 0 );
13265 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
13266 0 : if( self->authority_seed_len ) {
13267 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
13268 0 : for( ulong i=0; i < self->authority_seed_len; i++ )
13269 0 : fun( w, self->authority_seed + i, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
13270 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
13271 0 : }
13272 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level, 0 );
13273 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_with_seed_args", level--, 0 );
13274 0 : }
13275 0 : ulong fd_authorize_with_seed_args_size( fd_authorize_with_seed_args_t const * self ) {
13276 0 : ulong size = 0;
13277 0 : size += fd_pubkey_size( &self->new_authorized_pubkey );
13278 0 : size += fd_stake_authorize_size( &self->stake_authorize );
13279 0 : do {
13280 0 : size += sizeof(ulong);
13281 0 : size += self->authority_seed_len;
13282 0 : } while(0);
13283 0 : size += fd_pubkey_size( &self->authority_owner );
13284 0 : return size;
13285 0 : }
13286 :
13287 0 : int fd_authorize_checked_with_seed_args_encode( fd_authorize_checked_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13288 0 : int err;
13289 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
13290 0 : if( FD_UNLIKELY( err ) ) return err;
13291 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
13292 0 : if( FD_UNLIKELY(err) ) return err;
13293 0 : if( self->authority_seed_len ) {
13294 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
13295 0 : if( FD_UNLIKELY( err ) ) return err;
13296 0 : }
13297 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
13298 0 : if( FD_UNLIKELY( err ) ) return err;
13299 0 : return FD_BINCODE_SUCCESS;
13300 0 : }
13301 0 : static int fd_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13302 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13303 0 : int err = 0;
13304 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
13305 0 : if( FD_UNLIKELY( err ) ) return err;
13306 0 : ulong authority_seed_len;
13307 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
13308 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13309 0 : *total_sz += authority_seed_len;
13310 0 : if( authority_seed_len ) {
13311 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
13312 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13313 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
13314 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13315 0 : }
13316 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13317 0 : if( FD_UNLIKELY( err ) ) return err;
13318 0 : return 0;
13319 0 : }
13320 0 : int fd_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13321 0 : *total_sz += sizeof(fd_authorize_checked_with_seed_args_t);
13322 0 : void const * start_data = ctx->data;
13323 0 : int err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
13324 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13325 0 : ctx->data = start_data;
13326 0 : return err;
13327 0 : }
13328 0 : static void fd_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13329 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)struct_mem;
13330 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
13331 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
13332 0 : if( self->authority_seed_len ) {
13333 0 : self->authority_seed = *alloc_mem;
13334 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
13335 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
13336 0 : } else
13337 0 : self->authority_seed = NULL;
13338 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
13339 0 : }
13340 0 : void * fd_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13341 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)mem;
13342 0 : fd_authorize_checked_with_seed_args_new( self );
13343 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_checked_with_seed_args_t);
13344 0 : void * * alloc_mem = &alloc_region;
13345 0 : fd_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
13346 0 : return self;
13347 0 : }
13348 0 : void fd_authorize_checked_with_seed_args_new(fd_authorize_checked_with_seed_args_t * self) {
13349 0 : fd_memset( self, 0, sizeof(fd_authorize_checked_with_seed_args_t) );
13350 0 : fd_stake_authorize_new( &self->stake_authorize );
13351 0 : fd_pubkey_new( &self->authority_owner );
13352 0 : }
13353 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, uint varint ) {
13354 0 : (void) varint;
13355 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_checked_with_seed_args", level++, 0 );
13356 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
13357 0 : if( self->authority_seed_len ) {
13358 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
13359 0 : for( ulong i=0; i < self->authority_seed_len; i++ )
13360 0 : fun( w, self->authority_seed + i, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
13361 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
13362 0 : }
13363 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level, 0 );
13364 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_checked_with_seed_args", level--, 0 );
13365 0 : }
13366 0 : ulong fd_authorize_checked_with_seed_args_size( fd_authorize_checked_with_seed_args_t const * self ) {
13367 0 : ulong size = 0;
13368 0 : size += fd_stake_authorize_size( &self->stake_authorize );
13369 0 : do {
13370 0 : size += sizeof(ulong);
13371 0 : size += self->authority_seed_len;
13372 0 : } while(0);
13373 0 : size += fd_pubkey_size( &self->authority_owner );
13374 0 : return size;
13375 0 : }
13376 :
13377 0 : int fd_lockup_checked_args_encode( fd_lockup_checked_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13378 0 : int err;
13379 0 : if( self->unix_timestamp != NULL ) {
13380 0 : err = fd_bincode_bool_encode( 1, ctx );
13381 0 : if( FD_UNLIKELY( err ) ) return err;
13382 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
13383 0 : if( FD_UNLIKELY( err ) ) return err;
13384 0 : } else {
13385 0 : err = fd_bincode_bool_encode( 0, ctx );
13386 0 : if( FD_UNLIKELY( err ) ) return err;
13387 0 : }
13388 0 : if( self->epoch != NULL ) {
13389 0 : err = fd_bincode_bool_encode( 1, ctx );
13390 0 : if( FD_UNLIKELY( err ) ) return err;
13391 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
13392 0 : if( FD_UNLIKELY( err ) ) return err;
13393 0 : } else {
13394 0 : err = fd_bincode_bool_encode( 0, ctx );
13395 0 : if( FD_UNLIKELY( err ) ) return err;
13396 0 : }
13397 0 : return FD_BINCODE_SUCCESS;
13398 0 : }
13399 0 : static int fd_lockup_checked_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13400 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13401 0 : int err = 0;
13402 0 : {
13403 0 : uchar o;
13404 0 : err = fd_bincode_bool_decode( &o, ctx );
13405 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13406 0 : if( o ) {
13407 0 : *total_sz += 8UL + sizeof(long);
13408 0 : err = fd_bincode_int64_decode_footprint( ctx );
13409 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13410 0 : }
13411 0 : }
13412 0 : {
13413 0 : uchar o;
13414 0 : err = fd_bincode_bool_decode( &o, ctx );
13415 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13416 0 : if( o ) {
13417 0 : *total_sz += 8UL + sizeof(ulong);
13418 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13419 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13420 0 : }
13421 0 : }
13422 0 : return 0;
13423 0 : }
13424 0 : int fd_lockup_checked_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13425 0 : *total_sz += sizeof(fd_lockup_checked_args_t);
13426 0 : void const * start_data = ctx->data;
13427 0 : int err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
13428 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13429 0 : ctx->data = start_data;
13430 0 : return err;
13431 0 : }
13432 0 : static void fd_lockup_checked_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13433 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)struct_mem;
13434 0 : {
13435 0 : uchar o;
13436 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
13437 0 : if( o ) {
13438 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
13439 0 : self->unix_timestamp = *alloc_mem;
13440 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
13441 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
13442 0 : } else {
13443 0 : self->unix_timestamp = NULL;
13444 0 : }
13445 0 : }
13446 0 : {
13447 0 : uchar o;
13448 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
13449 0 : if( o ) {
13450 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
13451 0 : self->epoch = *alloc_mem;
13452 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
13453 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
13454 0 : } else {
13455 0 : self->epoch = NULL;
13456 0 : }
13457 0 : }
13458 0 : }
13459 0 : void * fd_lockup_checked_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13460 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)mem;
13461 0 : fd_lockup_checked_args_new( self );
13462 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_checked_args_t);
13463 0 : void * * alloc_mem = &alloc_region;
13464 0 : fd_lockup_checked_args_decode_inner( mem, alloc_mem, ctx );
13465 0 : return self;
13466 0 : }
13467 0 : void fd_lockup_checked_args_new(fd_lockup_checked_args_t * self) {
13468 0 : fd_memset( self, 0, sizeof(fd_lockup_checked_args_t) );
13469 0 : }
13470 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, uint varint ) {
13471 0 : (void) varint;
13472 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_checked_args", level++, 0 );
13473 0 : if( !self->unix_timestamp ) {
13474 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
13475 0 : } else {
13476 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
13477 0 : }
13478 0 : if( !self->epoch ) {
13479 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
13480 0 : } else {
13481 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13482 0 : }
13483 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_checked_args", level--, 0 );
13484 0 : }
13485 0 : ulong fd_lockup_checked_args_size( fd_lockup_checked_args_t const * self ) {
13486 0 : ulong size = 0;
13487 0 : size += sizeof(char);
13488 0 : if( NULL != self->unix_timestamp ) {
13489 0 : size += sizeof(long);
13490 0 : }
13491 0 : size += sizeof(char);
13492 0 : if( NULL != self->epoch ) {
13493 0 : size += sizeof(ulong);
13494 0 : }
13495 0 : return size;
13496 0 : }
13497 :
13498 0 : int fd_lockup_args_encode( fd_lockup_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13499 0 : int err;
13500 0 : if( self->unix_timestamp != NULL ) {
13501 0 : err = fd_bincode_bool_encode( 1, ctx );
13502 0 : if( FD_UNLIKELY( err ) ) return err;
13503 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
13504 0 : if( FD_UNLIKELY( err ) ) return err;
13505 0 : } else {
13506 0 : err = fd_bincode_bool_encode( 0, ctx );
13507 0 : if( FD_UNLIKELY( err ) ) return err;
13508 0 : }
13509 0 : if( self->epoch != NULL ) {
13510 0 : err = fd_bincode_bool_encode( 1, ctx );
13511 0 : if( FD_UNLIKELY( err ) ) return err;
13512 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
13513 0 : if( FD_UNLIKELY( err ) ) return err;
13514 0 : } else {
13515 0 : err = fd_bincode_bool_encode( 0, ctx );
13516 0 : if( FD_UNLIKELY( err ) ) return err;
13517 0 : }
13518 0 : if( self->custodian != NULL ) {
13519 0 : err = fd_bincode_bool_encode( 1, ctx );
13520 0 : if( FD_UNLIKELY( err ) ) return err;
13521 0 : err = fd_pubkey_encode( self->custodian, ctx );
13522 0 : if( FD_UNLIKELY( err ) ) return err;
13523 0 : } else {
13524 0 : err = fd_bincode_bool_encode( 0, ctx );
13525 0 : if( FD_UNLIKELY( err ) ) return err;
13526 0 : }
13527 0 : return FD_BINCODE_SUCCESS;
13528 0 : }
13529 0 : static int fd_lockup_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13530 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13531 0 : int err = 0;
13532 0 : {
13533 0 : uchar o;
13534 0 : err = fd_bincode_bool_decode( &o, ctx );
13535 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13536 0 : if( o ) {
13537 0 : *total_sz += 8UL + sizeof(long);
13538 0 : err = fd_bincode_int64_decode_footprint( ctx );
13539 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13540 0 : }
13541 0 : }
13542 0 : {
13543 0 : uchar o;
13544 0 : err = fd_bincode_bool_decode( &o, ctx );
13545 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13546 0 : if( o ) {
13547 0 : *total_sz += 8UL + sizeof(ulong);
13548 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13549 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13550 0 : }
13551 0 : }
13552 0 : {
13553 0 : uchar o;
13554 0 : err = fd_bincode_bool_decode( &o, ctx );
13555 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13556 0 : if( o ) {
13557 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
13558 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13559 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13560 0 : }
13561 0 : }
13562 0 : return 0;
13563 0 : }
13564 0 : int fd_lockup_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13565 0 : *total_sz += sizeof(fd_lockup_args_t);
13566 0 : void const * start_data = ctx->data;
13567 0 : int err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
13568 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13569 0 : ctx->data = start_data;
13570 0 : return err;
13571 0 : }
13572 0 : static void fd_lockup_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13573 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)struct_mem;
13574 0 : {
13575 0 : uchar o;
13576 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
13577 0 : if( o ) {
13578 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
13579 0 : self->unix_timestamp = *alloc_mem;
13580 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
13581 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
13582 0 : } else {
13583 0 : self->unix_timestamp = NULL;
13584 0 : }
13585 0 : }
13586 0 : {
13587 0 : uchar o;
13588 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
13589 0 : if( o ) {
13590 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
13591 0 : self->epoch = *alloc_mem;
13592 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
13593 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
13594 0 : } else {
13595 0 : self->epoch = NULL;
13596 0 : }
13597 0 : }
13598 0 : {
13599 0 : uchar o;
13600 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
13601 0 : if( o ) {
13602 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
13603 0 : self->custodian = *alloc_mem;
13604 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
13605 0 : fd_pubkey_new( self->custodian );
13606 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
13607 0 : } else {
13608 0 : self->custodian = NULL;
13609 0 : }
13610 0 : }
13611 0 : }
13612 0 : void * fd_lockup_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13613 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)mem;
13614 0 : fd_lockup_args_new( self );
13615 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_args_t);
13616 0 : void * * alloc_mem = &alloc_region;
13617 0 : fd_lockup_args_decode_inner( mem, alloc_mem, ctx );
13618 0 : return self;
13619 0 : }
13620 0 : void fd_lockup_args_new(fd_lockup_args_t * self) {
13621 0 : fd_memset( self, 0, sizeof(fd_lockup_args_t) );
13622 0 : }
13623 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, uint varint ) {
13624 0 : (void) varint;
13625 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_args", level++, 0 );
13626 0 : if( !self->unix_timestamp ) {
13627 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
13628 0 : } else {
13629 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
13630 0 : }
13631 0 : if( !self->epoch ) {
13632 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
13633 0 : } else {
13634 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13635 0 : }
13636 0 : if( !self->custodian ) {
13637 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
13638 0 : } else {
13639 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level, 0 );
13640 0 : }
13641 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_args", level--, 0 );
13642 0 : }
13643 0 : ulong fd_lockup_args_size( fd_lockup_args_t const * self ) {
13644 0 : ulong size = 0;
13645 0 : size += sizeof(char);
13646 0 : if( NULL != self->unix_timestamp ) {
13647 0 : size += sizeof(long);
13648 0 : }
13649 0 : size += sizeof(char);
13650 0 : if( NULL != self->epoch ) {
13651 0 : size += sizeof(ulong);
13652 0 : }
13653 0 : size += sizeof(char);
13654 0 : if( NULL != self->custodian ) {
13655 0 : size += fd_pubkey_size( self->custodian );
13656 0 : }
13657 0 : return size;
13658 0 : }
13659 :
13660 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize(fd_stake_instruction_t const * self) {
13661 0 : return self->discriminant == 0;
13662 0 : }
13663 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize(fd_stake_instruction_t const * self) {
13664 0 : return self->discriminant == 1;
13665 0 : }
13666 0 : FD_FN_PURE uchar fd_stake_instruction_is_delegate_stake(fd_stake_instruction_t const * self) {
13667 0 : return self->discriminant == 2;
13668 0 : }
13669 0 : FD_FN_PURE uchar fd_stake_instruction_is_split(fd_stake_instruction_t const * self) {
13670 0 : return self->discriminant == 3;
13671 0 : }
13672 0 : FD_FN_PURE uchar fd_stake_instruction_is_withdraw(fd_stake_instruction_t const * self) {
13673 0 : return self->discriminant == 4;
13674 0 : }
13675 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate(fd_stake_instruction_t const * self) {
13676 0 : return self->discriminant == 5;
13677 0 : }
13678 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup(fd_stake_instruction_t const * self) {
13679 0 : return self->discriminant == 6;
13680 0 : }
13681 0 : FD_FN_PURE uchar fd_stake_instruction_is_merge(fd_stake_instruction_t const * self) {
13682 0 : return self->discriminant == 7;
13683 0 : }
13684 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_with_seed(fd_stake_instruction_t const * self) {
13685 0 : return self->discriminant == 8;
13686 0 : }
13687 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize_checked(fd_stake_instruction_t const * self) {
13688 0 : return self->discriminant == 9;
13689 0 : }
13690 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked(fd_stake_instruction_t const * self) {
13691 0 : return self->discriminant == 10;
13692 0 : }
13693 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked_with_seed(fd_stake_instruction_t const * self) {
13694 0 : return self->discriminant == 11;
13695 0 : }
13696 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup_checked(fd_stake_instruction_t const * self) {
13697 0 : return self->discriminant == 12;
13698 0 : }
13699 0 : FD_FN_PURE uchar fd_stake_instruction_is_get_minimum_delegation(fd_stake_instruction_t const * self) {
13700 0 : return self->discriminant == 13;
13701 0 : }
13702 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate_delinquent(fd_stake_instruction_t const * self) {
13703 0 : return self->discriminant == 14;
13704 0 : }
13705 0 : FD_FN_PURE uchar fd_stake_instruction_is_redelegate(fd_stake_instruction_t const * self) {
13706 0 : return self->discriminant == 15;
13707 0 : }
13708 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_stake(fd_stake_instruction_t const * self) {
13709 0 : return self->discriminant == 16;
13710 0 : }
13711 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_lamports(fd_stake_instruction_t const * self) {
13712 0 : return self->discriminant == 17;
13713 0 : }
13714 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant );
13715 0 : int fd_stake_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13716 0 : int err;
13717 0 : switch (discriminant) {
13718 0 : case 0: {
13719 0 : err = fd_stake_instruction_initialize_decode_footprint_inner( ctx, total_sz );
13720 0 : if( FD_UNLIKELY( err ) ) return err;
13721 0 : return FD_BINCODE_SUCCESS;
13722 0 : }
13723 0 : case 1: {
13724 0 : err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
13725 0 : if( FD_UNLIKELY( err ) ) return err;
13726 0 : return FD_BINCODE_SUCCESS;
13727 0 : }
13728 0 : case 2: {
13729 0 : return FD_BINCODE_SUCCESS;
13730 0 : }
13731 0 : case 3: {
13732 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13733 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13734 0 : return FD_BINCODE_SUCCESS;
13735 0 : }
13736 0 : case 4: {
13737 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13738 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13739 0 : return FD_BINCODE_SUCCESS;
13740 0 : }
13741 0 : case 5: {
13742 0 : return FD_BINCODE_SUCCESS;
13743 0 : }
13744 0 : case 6: {
13745 0 : err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
13746 0 : if( FD_UNLIKELY( err ) ) return err;
13747 0 : return FD_BINCODE_SUCCESS;
13748 0 : }
13749 0 : case 7: {
13750 0 : return FD_BINCODE_SUCCESS;
13751 0 : }
13752 0 : case 8: {
13753 0 : err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
13754 0 : if( FD_UNLIKELY( err ) ) return err;
13755 0 : return FD_BINCODE_SUCCESS;
13756 0 : }
13757 0 : case 9: {
13758 0 : return FD_BINCODE_SUCCESS;
13759 0 : }
13760 0 : case 10: {
13761 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
13762 0 : if( FD_UNLIKELY( err ) ) return err;
13763 0 : return FD_BINCODE_SUCCESS;
13764 0 : }
13765 0 : case 11: {
13766 0 : err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
13767 0 : if( FD_UNLIKELY( err ) ) return err;
13768 0 : return FD_BINCODE_SUCCESS;
13769 0 : }
13770 0 : case 12: {
13771 0 : err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
13772 0 : if( FD_UNLIKELY( err ) ) return err;
13773 0 : return FD_BINCODE_SUCCESS;
13774 0 : }
13775 0 : case 13: {
13776 0 : return FD_BINCODE_SUCCESS;
13777 0 : }
13778 0 : case 14: {
13779 0 : return FD_BINCODE_SUCCESS;
13780 0 : }
13781 0 : case 15: {
13782 0 : return FD_BINCODE_SUCCESS;
13783 0 : }
13784 0 : case 16: {
13785 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13786 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13787 0 : return FD_BINCODE_SUCCESS;
13788 0 : }
13789 0 : case 17: {
13790 0 : err = fd_bincode_uint64_decode_footprint( ctx );
13791 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13792 0 : return FD_BINCODE_SUCCESS;
13793 0 : }
13794 0 : default: return FD_BINCODE_ERR_ENCODING;
13795 0 : }
13796 0 : }
13797 0 : static int fd_stake_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13798 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13799 0 : uint discriminant = 0;
13800 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
13801 0 : if( FD_UNLIKELY( err ) ) return err;
13802 0 : return fd_stake_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
13803 0 : }
13804 0 : int fd_stake_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13805 0 : *total_sz += sizeof(fd_stake_instruction_t);
13806 0 : void const * start_data = ctx->data;
13807 0 : int err = fd_stake_instruction_decode_footprint_inner( ctx, total_sz );
13808 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13809 0 : ctx->data = start_data;
13810 0 : return err;
13811 0 : }
13812 0 : static void fd_stake_instruction_inner_decode_inner( fd_stake_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
13813 0 : switch (discriminant) {
13814 0 : case 0: {
13815 0 : fd_stake_instruction_initialize_decode_inner( &self->initialize, alloc_mem, ctx );
13816 0 : break;
13817 0 : }
13818 0 : case 1: {
13819 0 : fd_stake_instruction_authorize_decode_inner( &self->authorize, alloc_mem, ctx );
13820 0 : break;
13821 0 : }
13822 0 : case 2: {
13823 0 : break;
13824 0 : }
13825 0 : case 3: {
13826 0 : fd_bincode_uint64_decode_unsafe( &self->split, ctx );
13827 0 : break;
13828 0 : }
13829 0 : case 4: {
13830 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
13831 0 : break;
13832 0 : }
13833 0 : case 5: {
13834 0 : break;
13835 0 : }
13836 0 : case 6: {
13837 0 : fd_lockup_args_decode_inner( &self->set_lockup, alloc_mem, ctx );
13838 0 : break;
13839 0 : }
13840 0 : case 7: {
13841 0 : break;
13842 0 : }
13843 0 : case 8: {
13844 0 : fd_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
13845 0 : break;
13846 0 : }
13847 0 : case 9: {
13848 0 : break;
13849 0 : }
13850 0 : case 10: {
13851 0 : fd_stake_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
13852 0 : break;
13853 0 : }
13854 0 : case 11: {
13855 0 : fd_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
13856 0 : break;
13857 0 : }
13858 0 : case 12: {
13859 0 : fd_lockup_checked_args_decode_inner( &self->set_lockup_checked, alloc_mem, ctx );
13860 0 : break;
13861 0 : }
13862 0 : case 13: {
13863 0 : break;
13864 0 : }
13865 0 : case 14: {
13866 0 : break;
13867 0 : }
13868 0 : case 15: {
13869 0 : break;
13870 0 : }
13871 0 : case 16: {
13872 0 : fd_bincode_uint64_decode_unsafe( &self->move_stake, ctx );
13873 0 : break;
13874 0 : }
13875 0 : case 17: {
13876 0 : fd_bincode_uint64_decode_unsafe( &self->move_lamports, ctx );
13877 0 : break;
13878 0 : }
13879 0 : }
13880 0 : }
13881 0 : static void fd_stake_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13882 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)struct_mem;
13883 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
13884 0 : fd_stake_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
13885 0 : }
13886 0 : void * fd_stake_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13887 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)mem;
13888 0 : fd_stake_instruction_new( self );
13889 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_t);
13890 0 : void * * alloc_mem = &alloc_region;
13891 0 : fd_stake_instruction_decode_inner( mem, alloc_mem, ctx );
13892 0 : return self;
13893 0 : }
13894 0 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant ) {
13895 0 : switch( discriminant ) {
13896 0 : case 0: {
13897 0 : fd_stake_instruction_initialize_new( &self->initialize );
13898 0 : break;
13899 0 : }
13900 0 : case 1: {
13901 0 : fd_stake_instruction_authorize_new( &self->authorize );
13902 0 : break;
13903 0 : }
13904 0 : case 2: {
13905 0 : break;
13906 0 : }
13907 0 : case 3: {
13908 0 : break;
13909 0 : }
13910 0 : case 4: {
13911 0 : break;
13912 0 : }
13913 0 : case 5: {
13914 0 : break;
13915 0 : }
13916 0 : case 6: {
13917 0 : fd_lockup_args_new( &self->set_lockup );
13918 0 : break;
13919 0 : }
13920 0 : case 7: {
13921 0 : break;
13922 0 : }
13923 0 : case 8: {
13924 0 : fd_authorize_with_seed_args_new( &self->authorize_with_seed );
13925 0 : break;
13926 0 : }
13927 0 : case 9: {
13928 0 : break;
13929 0 : }
13930 0 : case 10: {
13931 0 : fd_stake_authorize_new( &self->authorize_checked );
13932 0 : break;
13933 0 : }
13934 0 : case 11: {
13935 0 : fd_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
13936 0 : break;
13937 0 : }
13938 0 : case 12: {
13939 0 : fd_lockup_checked_args_new( &self->set_lockup_checked );
13940 0 : break;
13941 0 : }
13942 0 : case 13: {
13943 0 : break;
13944 0 : }
13945 0 : case 14: {
13946 0 : break;
13947 0 : }
13948 0 : case 15: {
13949 0 : break;
13950 0 : }
13951 0 : case 16: {
13952 0 : break;
13953 0 : }
13954 0 : case 17: {
13955 0 : break;
13956 0 : }
13957 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
13958 0 : }
13959 0 : }
13960 0 : void fd_stake_instruction_new_disc( fd_stake_instruction_t * self, uint discriminant ) {
13961 0 : self->discriminant = discriminant;
13962 0 : fd_stake_instruction_inner_new( &self->inner, self->discriminant );
13963 0 : }
13964 0 : void fd_stake_instruction_new( fd_stake_instruction_t * self ) {
13965 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_t) );
13966 0 : fd_stake_instruction_new_disc( self, UINT_MAX );
13967 0 : }
13968 :
13969 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, uint varint ) {
13970 0 : (void) varint;
13971 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_instruction", level++, 0);
13972 0 : switch( self->discriminant ) {
13973 0 : case 0: {
13974 0 : fun( w, self, "initialize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13975 0 : fd_stake_instruction_initialize_walk( w, &self->inner.initialize, fun, "initialize", level, 0 );
13976 0 : break;
13977 0 : }
13978 0 : case 1: {
13979 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13980 0 : fd_stake_instruction_authorize_walk( w, &self->inner.authorize, fun, "authorize", level, 0 );
13981 0 : break;
13982 0 : }
13983 0 : case 2: {
13984 0 : fun( w, self, "delegate_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13985 0 : break;
13986 0 : }
13987 0 : case 3: {
13988 0 : fun( w, self, "split", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13989 0 : fun( w, &self->inner.split, "split", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13990 0 : break;
13991 0 : }
13992 0 : case 4: {
13993 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13994 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13995 0 : break;
13996 0 : }
13997 0 : case 5: {
13998 0 : fun( w, self, "deactivate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13999 0 : break;
14000 0 : }
14001 0 : case 6: {
14002 0 : fun( w, self, "set_lockup", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14003 0 : fd_lockup_args_walk( w, &self->inner.set_lockup, fun, "set_lockup", level, 0 );
14004 0 : break;
14005 0 : }
14006 0 : case 7: {
14007 0 : fun( w, self, "merge", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14008 0 : break;
14009 0 : }
14010 0 : case 8: {
14011 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14012 0 : fd_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level, 0 );
14013 0 : break;
14014 0 : }
14015 0 : case 9: {
14016 0 : fun( w, self, "initialize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14017 0 : break;
14018 0 : }
14019 0 : case 10: {
14020 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14021 0 : fd_stake_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level, 0 );
14022 0 : break;
14023 0 : }
14024 0 : case 11: {
14025 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14026 0 : fd_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level, 0 );
14027 0 : break;
14028 0 : }
14029 0 : case 12: {
14030 0 : fun( w, self, "set_lockup_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14031 0 : fd_lockup_checked_args_walk( w, &self->inner.set_lockup_checked, fun, "set_lockup_checked", level, 0 );
14032 0 : break;
14033 0 : }
14034 0 : case 13: {
14035 0 : fun( w, self, "get_minimum_delegation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14036 0 : break;
14037 0 : }
14038 0 : case 14: {
14039 0 : fun( w, self, "deactivate_delinquent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14040 0 : break;
14041 0 : }
14042 0 : case 15: {
14043 0 : fun( w, self, "redelegate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14044 0 : break;
14045 0 : }
14046 0 : case 16: {
14047 0 : fun( w, self, "move_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14048 0 : fun( w, &self->inner.move_stake, "move_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14049 0 : break;
14050 0 : }
14051 0 : case 17: {
14052 0 : fun( w, self, "move_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14053 0 : fun( w, &self->inner.move_lamports, "move_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14054 0 : break;
14055 0 : }
14056 0 : }
14057 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_instruction", level--, 0 );
14058 0 : }
14059 0 : ulong fd_stake_instruction_size( fd_stake_instruction_t const * self ) {
14060 0 : ulong size = 0;
14061 0 : size += sizeof(uint);
14062 0 : switch (self->discriminant) {
14063 0 : case 0: {
14064 0 : size += fd_stake_instruction_initialize_size( &self->inner.initialize );
14065 0 : break;
14066 0 : }
14067 0 : case 1: {
14068 0 : size += fd_stake_instruction_authorize_size( &self->inner.authorize );
14069 0 : break;
14070 0 : }
14071 0 : case 3: {
14072 0 : size += sizeof(ulong);
14073 0 : break;
14074 0 : }
14075 0 : case 4: {
14076 0 : size += sizeof(ulong);
14077 0 : break;
14078 0 : }
14079 0 : case 6: {
14080 0 : size += fd_lockup_args_size( &self->inner.set_lockup );
14081 0 : break;
14082 0 : }
14083 0 : case 8: {
14084 0 : size += fd_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
14085 0 : break;
14086 0 : }
14087 0 : case 10: {
14088 0 : size += fd_stake_authorize_size( &self->inner.authorize_checked );
14089 0 : break;
14090 0 : }
14091 0 : case 11: {
14092 0 : size += fd_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
14093 0 : break;
14094 0 : }
14095 0 : case 12: {
14096 0 : size += fd_lockup_checked_args_size( &self->inner.set_lockup_checked );
14097 0 : break;
14098 0 : }
14099 0 : case 16: {
14100 0 : size += sizeof(ulong);
14101 0 : break;
14102 0 : }
14103 0 : case 17: {
14104 0 : size += sizeof(ulong);
14105 0 : break;
14106 0 : }
14107 0 : }
14108 0 : return size;
14109 0 : }
14110 :
14111 0 : int fd_stake_instruction_inner_encode( fd_stake_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
14112 0 : int err;
14113 0 : switch (discriminant) {
14114 0 : case 0: {
14115 0 : err = fd_stake_instruction_initialize_encode( &self->initialize, ctx );
14116 0 : if( FD_UNLIKELY( err ) ) return err;
14117 0 : break;
14118 0 : }
14119 0 : case 1: {
14120 0 : err = fd_stake_instruction_authorize_encode( &self->authorize, ctx );
14121 0 : if( FD_UNLIKELY( err ) ) return err;
14122 0 : break;
14123 0 : }
14124 0 : case 3: {
14125 0 : err = fd_bincode_uint64_encode( self->split, ctx );
14126 0 : if( FD_UNLIKELY( err ) ) return err;
14127 0 : break;
14128 0 : }
14129 0 : case 4: {
14130 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
14131 0 : if( FD_UNLIKELY( err ) ) return err;
14132 0 : break;
14133 0 : }
14134 0 : case 6: {
14135 0 : err = fd_lockup_args_encode( &self->set_lockup, ctx );
14136 0 : if( FD_UNLIKELY( err ) ) return err;
14137 0 : break;
14138 0 : }
14139 0 : case 8: {
14140 0 : err = fd_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
14141 0 : if( FD_UNLIKELY( err ) ) return err;
14142 0 : break;
14143 0 : }
14144 0 : case 10: {
14145 0 : err = fd_stake_authorize_encode( &self->authorize_checked, ctx );
14146 0 : if( FD_UNLIKELY( err ) ) return err;
14147 0 : break;
14148 0 : }
14149 0 : case 11: {
14150 0 : err = fd_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
14151 0 : if( FD_UNLIKELY( err ) ) return err;
14152 0 : break;
14153 0 : }
14154 0 : case 12: {
14155 0 : err = fd_lockup_checked_args_encode( &self->set_lockup_checked, ctx );
14156 0 : if( FD_UNLIKELY( err ) ) return err;
14157 0 : break;
14158 0 : }
14159 0 : case 16: {
14160 0 : err = fd_bincode_uint64_encode( self->move_stake, ctx );
14161 0 : if( FD_UNLIKELY( err ) ) return err;
14162 0 : break;
14163 0 : }
14164 0 : case 17: {
14165 0 : err = fd_bincode_uint64_encode( self->move_lamports, ctx );
14166 0 : if( FD_UNLIKELY( err ) ) return err;
14167 0 : break;
14168 0 : }
14169 0 : }
14170 0 : return FD_BINCODE_SUCCESS;
14171 0 : }
14172 0 : int fd_stake_instruction_encode( fd_stake_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14173 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
14174 0 : if( FD_UNLIKELY( err ) ) return err;
14175 0 : return fd_stake_instruction_inner_encode( &self->inner, self->discriminant, ctx );
14176 0 : }
14177 :
14178 12 : int fd_stake_meta_encode( fd_stake_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14179 12 : int err;
14180 12 : err = fd_bincode_uint64_encode( self->rent_exempt_reserve, ctx );
14181 12 : if( FD_UNLIKELY( err ) ) return err;
14182 12 : err = fd_stake_authorized_encode( &self->authorized, ctx );
14183 12 : if( FD_UNLIKELY( err ) ) return err;
14184 12 : err = fd_stake_lockup_encode( &self->lockup, ctx );
14185 12 : if( FD_UNLIKELY( err ) ) return err;
14186 12 : return FD_BINCODE_SUCCESS;
14187 12 : }
14188 0 : static inline int fd_stake_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14189 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14190 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
14191 0 : return 0;
14192 0 : }
14193 0 : static void fd_stake_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14194 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)struct_mem;
14195 0 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
14196 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
14197 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
14198 0 : }
14199 0 : void * fd_stake_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14200 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)mem;
14201 0 : fd_stake_meta_new( self );
14202 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_meta_t);
14203 0 : void * * alloc_mem = &alloc_region;
14204 0 : fd_stake_meta_decode_inner( mem, alloc_mem, ctx );
14205 0 : return self;
14206 0 : }
14207 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, uint varint ) {
14208 0 : (void) varint;
14209 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_meta", level++, 0 );
14210 0 : fun( w, &self->rent_exempt_reserve, "rent_exempt_reserve", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14211 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level, 0 );
14212 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
14213 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_meta", level--, 0 );
14214 0 : }
14215 12 : int fd_stake_flags_encode( fd_stake_flags_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14216 12 : int err;
14217 12 : err = fd_bincode_uint8_encode( (uchar)(self->bits), ctx );
14218 12 : if( FD_UNLIKELY( err ) ) return err;
14219 12 : return FD_BINCODE_SUCCESS;
14220 12 : }
14221 0 : static inline int fd_stake_flags_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14222 0 : if( (ulong)ctx->data + 1UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14223 0 : ctx->data = (void *)( (ulong)ctx->data + 1UL );
14224 0 : return 0;
14225 0 : }
14226 0 : static void fd_stake_flags_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14227 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)struct_mem;
14228 0 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
14229 0 : }
14230 0 : void * fd_stake_flags_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14231 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)mem;
14232 0 : fd_stake_flags_new( self );
14233 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_flags_t);
14234 0 : void * * alloc_mem = &alloc_region;
14235 0 : fd_stake_flags_decode_inner( mem, alloc_mem, ctx );
14236 0 : return self;
14237 0 : }
14238 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, uint varint ) {
14239 0 : (void) varint;
14240 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_flags", level++, 0 );
14241 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
14242 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_flags", level--, 0 );
14243 0 : }
14244 0 : int fd_stake_state_v2_initialized_encode( fd_stake_state_v2_initialized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14245 0 : int err;
14246 0 : err = fd_stake_meta_encode( &self->meta, ctx );
14247 0 : if( FD_UNLIKELY( err ) ) return err;
14248 0 : return FD_BINCODE_SUCCESS;
14249 0 : }
14250 0 : static inline int fd_stake_state_v2_initialized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14251 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14252 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
14253 0 : return 0;
14254 0 : }
14255 0 : static void fd_stake_state_v2_initialized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14256 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)struct_mem;
14257 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
14258 0 : }
14259 0 : void * fd_stake_state_v2_initialized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14260 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)mem;
14261 0 : fd_stake_state_v2_initialized_new( self );
14262 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_initialized_t);
14263 0 : void * * alloc_mem = &alloc_region;
14264 0 : fd_stake_state_v2_initialized_decode_inner( mem, alloc_mem, ctx );
14265 0 : return self;
14266 0 : }
14267 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, uint varint ) {
14268 0 : (void) varint;
14269 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_initialized", level++, 0 );
14270 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level, 0 );
14271 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_initialized", level--, 0 );
14272 0 : }
14273 12 : int fd_stake_state_v2_stake_encode( fd_stake_state_v2_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14274 12 : int err;
14275 12 : err = fd_stake_meta_encode( &self->meta, ctx );
14276 12 : if( FD_UNLIKELY( err ) ) return err;
14277 12 : err = fd_stake_encode( &self->stake, ctx );
14278 12 : if( FD_UNLIKELY( err ) ) return err;
14279 12 : err = fd_stake_flags_encode( &self->stake_flags, ctx );
14280 12 : if( FD_UNLIKELY( err ) ) return err;
14281 12 : return FD_BINCODE_SUCCESS;
14282 12 : }
14283 0 : static inline int fd_stake_state_v2_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14284 0 : if( (ulong)ctx->data + 193UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14285 0 : ctx->data = (void *)( (ulong)ctx->data + 193UL );
14286 0 : return 0;
14287 0 : }
14288 0 : static void fd_stake_state_v2_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14289 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)struct_mem;
14290 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
14291 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
14292 0 : fd_stake_flags_decode_inner( &self->stake_flags, alloc_mem, ctx );
14293 0 : }
14294 0 : void * fd_stake_state_v2_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14295 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)mem;
14296 0 : fd_stake_state_v2_stake_new( self );
14297 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_stake_t);
14298 0 : void * * alloc_mem = &alloc_region;
14299 0 : fd_stake_state_v2_stake_decode_inner( mem, alloc_mem, ctx );
14300 0 : return self;
14301 0 : }
14302 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, uint varint ) {
14303 0 : (void) varint;
14304 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_stake", level++, 0 );
14305 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level, 0 );
14306 0 : fd_stake_walk( w, &self->stake, fun, "stake", level, 0 );
14307 0 : fd_stake_flags_walk( w, &self->stake_flags, fun, "stake_flags", level, 0 );
14308 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_stake", level--, 0 );
14309 0 : }
14310 0 : FD_FN_PURE uchar fd_stake_state_v2_is_uninitialized(fd_stake_state_v2_t const * self) {
14311 0 : return self->discriminant == 0;
14312 0 : }
14313 0 : FD_FN_PURE uchar fd_stake_state_v2_is_initialized(fd_stake_state_v2_t const * self) {
14314 0 : return self->discriminant == 1;
14315 0 : }
14316 0 : FD_FN_PURE uchar fd_stake_state_v2_is_stake(fd_stake_state_v2_t const * self) {
14317 0 : return self->discriminant == 2;
14318 0 : }
14319 0 : FD_FN_PURE uchar fd_stake_state_v2_is_rewards_pool(fd_stake_state_v2_t const * self) {
14320 0 : return self->discriminant == 3;
14321 0 : }
14322 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant );
14323 0 : int fd_stake_state_v2_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14324 0 : int err;
14325 0 : switch (discriminant) {
14326 0 : case 0: {
14327 0 : return FD_BINCODE_SUCCESS;
14328 0 : }
14329 0 : case 1: {
14330 0 : err = fd_stake_state_v2_initialized_decode_footprint_inner( ctx, total_sz );
14331 0 : if( FD_UNLIKELY( err ) ) return err;
14332 0 : return FD_BINCODE_SUCCESS;
14333 0 : }
14334 0 : case 2: {
14335 0 : err = fd_stake_state_v2_stake_decode_footprint_inner( ctx, total_sz );
14336 0 : if( FD_UNLIKELY( err ) ) return err;
14337 0 : return FD_BINCODE_SUCCESS;
14338 0 : }
14339 0 : case 3: {
14340 0 : return FD_BINCODE_SUCCESS;
14341 0 : }
14342 0 : default: return FD_BINCODE_ERR_ENCODING;
14343 0 : }
14344 0 : }
14345 0 : static int fd_stake_state_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14346 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14347 0 : uint discriminant = 0;
14348 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
14349 0 : if( FD_UNLIKELY( err ) ) return err;
14350 0 : return fd_stake_state_v2_inner_decode_footprint( discriminant, ctx, total_sz );
14351 0 : }
14352 0 : int fd_stake_state_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14353 0 : *total_sz += sizeof(fd_stake_state_v2_t);
14354 0 : void const * start_data = ctx->data;
14355 0 : int err = fd_stake_state_v2_decode_footprint_inner( ctx, total_sz );
14356 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14357 0 : ctx->data = start_data;
14358 0 : return err;
14359 0 : }
14360 0 : static void fd_stake_state_v2_inner_decode_inner( fd_stake_state_v2_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
14361 0 : switch (discriminant) {
14362 0 : case 0: {
14363 0 : break;
14364 0 : }
14365 0 : case 1: {
14366 0 : fd_stake_state_v2_initialized_decode_inner( &self->initialized, alloc_mem, ctx );
14367 0 : break;
14368 0 : }
14369 0 : case 2: {
14370 0 : fd_stake_state_v2_stake_decode_inner( &self->stake, alloc_mem, ctx );
14371 0 : break;
14372 0 : }
14373 0 : case 3: {
14374 0 : break;
14375 0 : }
14376 0 : }
14377 0 : }
14378 0 : static void fd_stake_state_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14379 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)struct_mem;
14380 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
14381 0 : fd_stake_state_v2_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
14382 0 : }
14383 0 : void * fd_stake_state_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14384 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)mem;
14385 0 : fd_stake_state_v2_new( self );
14386 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_t);
14387 0 : void * * alloc_mem = &alloc_region;
14388 0 : fd_stake_state_v2_decode_inner( mem, alloc_mem, ctx );
14389 0 : return self;
14390 0 : }
14391 12 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant ) {
14392 12 : switch( discriminant ) {
14393 0 : case 0: {
14394 0 : break;
14395 0 : }
14396 0 : case 1: {
14397 0 : fd_stake_state_v2_initialized_new( &self->initialized );
14398 0 : break;
14399 0 : }
14400 12 : case 2: {
14401 12 : fd_stake_state_v2_stake_new( &self->stake );
14402 12 : break;
14403 0 : }
14404 0 : case 3: {
14405 0 : break;
14406 0 : }
14407 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
14408 12 : }
14409 12 : }
14410 12 : void fd_stake_state_v2_new_disc( fd_stake_state_v2_t * self, uint discriminant ) {
14411 12 : self->discriminant = discriminant;
14412 12 : fd_stake_state_v2_inner_new( &self->inner, self->discriminant );
14413 12 : }
14414 0 : void fd_stake_state_v2_new( fd_stake_state_v2_t * self ) {
14415 0 : fd_memset( self, 0, sizeof(fd_stake_state_v2_t) );
14416 0 : fd_stake_state_v2_new_disc( self, UINT_MAX );
14417 0 : }
14418 :
14419 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, uint varint ) {
14420 0 : (void) varint;
14421 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_state_v2", level++, 0);
14422 0 : switch( self->discriminant ) {
14423 0 : case 0: {
14424 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14425 0 : break;
14426 0 : }
14427 0 : case 1: {
14428 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14429 0 : fd_stake_state_v2_initialized_walk( w, &self->inner.initialized, fun, "initialized", level, 0 );
14430 0 : break;
14431 0 : }
14432 0 : case 2: {
14433 0 : fun( w, self, "stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14434 0 : fd_stake_state_v2_stake_walk( w, &self->inner.stake, fun, "stake", level, 0 );
14435 0 : break;
14436 0 : }
14437 0 : case 3: {
14438 0 : fun( w, self, "rewards_pool", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14439 0 : break;
14440 0 : }
14441 0 : }
14442 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_state_v2", level--, 0 );
14443 0 : }
14444 0 : ulong fd_stake_state_v2_size( fd_stake_state_v2_t const * self ) {
14445 0 : ulong size = 0;
14446 0 : size += sizeof(uint);
14447 0 : switch (self->discriminant) {
14448 0 : case 1: {
14449 0 : size += fd_stake_state_v2_initialized_size( &self->inner.initialized );
14450 0 : break;
14451 0 : }
14452 0 : case 2: {
14453 0 : size += fd_stake_state_v2_stake_size( &self->inner.stake );
14454 0 : break;
14455 0 : }
14456 0 : }
14457 0 : return size;
14458 0 : }
14459 :
14460 12 : int fd_stake_state_v2_inner_encode( fd_stake_state_v2_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
14461 12 : int err;
14462 12 : switch (discriminant) {
14463 0 : case 1: {
14464 0 : err = fd_stake_state_v2_initialized_encode( &self->initialized, ctx );
14465 0 : if( FD_UNLIKELY( err ) ) return err;
14466 0 : break;
14467 0 : }
14468 12 : case 2: {
14469 12 : err = fd_stake_state_v2_stake_encode( &self->stake, ctx );
14470 12 : if( FD_UNLIKELY( err ) ) return err;
14471 12 : break;
14472 12 : }
14473 12 : }
14474 12 : return FD_BINCODE_SUCCESS;
14475 12 : }
14476 12 : int fd_stake_state_v2_encode( fd_stake_state_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14477 12 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
14478 12 : if( FD_UNLIKELY( err ) ) return err;
14479 12 : return fd_stake_state_v2_inner_encode( &self->inner, self->discriminant, ctx );
14480 12 : }
14481 :
14482 0 : int fd_nonce_data_encode( fd_nonce_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14483 0 : int err;
14484 0 : err = fd_pubkey_encode( &self->authority, ctx );
14485 0 : if( FD_UNLIKELY( err ) ) return err;
14486 0 : err = fd_hash_encode( &self->durable_nonce, ctx );
14487 0 : if( FD_UNLIKELY( err ) ) return err;
14488 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
14489 0 : if( FD_UNLIKELY( err ) ) return err;
14490 0 : return FD_BINCODE_SUCCESS;
14491 0 : }
14492 0 : static inline int fd_nonce_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14493 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14494 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
14495 0 : return 0;
14496 0 : }
14497 0 : static void fd_nonce_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14498 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)struct_mem;
14499 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
14500 0 : fd_hash_decode_inner( &self->durable_nonce, alloc_mem, ctx );
14501 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
14502 0 : }
14503 0 : void * fd_nonce_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14504 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)mem;
14505 0 : fd_nonce_data_new( self );
14506 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_data_t);
14507 0 : void * * alloc_mem = &alloc_region;
14508 0 : fd_nonce_data_decode_inner( mem, alloc_mem, ctx );
14509 0 : return self;
14510 0 : }
14511 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, uint varint ) {
14512 0 : (void) varint;
14513 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_nonce_data", level++, 0 );
14514 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level, 0 );
14515 0 : fd_hash_walk( w, &self->durable_nonce, fun, "durable_nonce", level, 0 );
14516 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
14517 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_nonce_data", level--, 0 );
14518 0 : }
14519 0 : FD_FN_PURE uchar fd_nonce_state_is_uninitialized(fd_nonce_state_t const * self) {
14520 0 : return self->discriminant == 0;
14521 0 : }
14522 0 : FD_FN_PURE uchar fd_nonce_state_is_initialized(fd_nonce_state_t const * self) {
14523 0 : return self->discriminant == 1;
14524 0 : }
14525 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant );
14526 0 : int fd_nonce_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14527 0 : int err;
14528 0 : switch (discriminant) {
14529 0 : case 0: {
14530 0 : return FD_BINCODE_SUCCESS;
14531 0 : }
14532 0 : case 1: {
14533 0 : err = fd_nonce_data_decode_footprint_inner( ctx, total_sz );
14534 0 : if( FD_UNLIKELY( err ) ) return err;
14535 0 : return FD_BINCODE_SUCCESS;
14536 0 : }
14537 0 : default: return FD_BINCODE_ERR_ENCODING;
14538 0 : }
14539 0 : }
14540 0 : static int fd_nonce_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14541 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14542 0 : uint discriminant = 0;
14543 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
14544 0 : if( FD_UNLIKELY( err ) ) return err;
14545 0 : return fd_nonce_state_inner_decode_footprint( discriminant, ctx, total_sz );
14546 0 : }
14547 0 : int fd_nonce_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14548 0 : *total_sz += sizeof(fd_nonce_state_t);
14549 0 : void const * start_data = ctx->data;
14550 0 : int err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
14551 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14552 0 : ctx->data = start_data;
14553 0 : return err;
14554 0 : }
14555 0 : static void fd_nonce_state_inner_decode_inner( fd_nonce_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
14556 0 : switch (discriminant) {
14557 0 : case 0: {
14558 0 : break;
14559 0 : }
14560 0 : case 1: {
14561 0 : fd_nonce_data_decode_inner( &self->initialized, alloc_mem, ctx );
14562 0 : break;
14563 0 : }
14564 0 : }
14565 0 : }
14566 0 : static void fd_nonce_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14567 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)struct_mem;
14568 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
14569 0 : fd_nonce_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
14570 0 : }
14571 0 : void * fd_nonce_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14572 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)mem;
14573 0 : fd_nonce_state_new( self );
14574 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_t);
14575 0 : void * * alloc_mem = &alloc_region;
14576 0 : fd_nonce_state_decode_inner( mem, alloc_mem, ctx );
14577 0 : return self;
14578 0 : }
14579 0 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant ) {
14580 0 : switch( discriminant ) {
14581 0 : case 0: {
14582 0 : break;
14583 0 : }
14584 0 : case 1: {
14585 0 : fd_nonce_data_new( &self->initialized );
14586 0 : break;
14587 0 : }
14588 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
14589 0 : }
14590 0 : }
14591 0 : void fd_nonce_state_new_disc( fd_nonce_state_t * self, uint discriminant ) {
14592 0 : self->discriminant = discriminant;
14593 0 : fd_nonce_state_inner_new( &self->inner, self->discriminant );
14594 0 : }
14595 0 : void fd_nonce_state_new( fd_nonce_state_t * self ) {
14596 0 : fd_memset( self, 0, sizeof(fd_nonce_state_t) );
14597 0 : fd_nonce_state_new_disc( self, UINT_MAX );
14598 0 : }
14599 :
14600 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, uint varint ) {
14601 0 : (void) varint;
14602 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state", level++, 0);
14603 0 : switch( self->discriminant ) {
14604 0 : case 0: {
14605 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14606 0 : break;
14607 0 : }
14608 0 : case 1: {
14609 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14610 0 : fd_nonce_data_walk( w, &self->inner.initialized, fun, "initialized", level, 0 );
14611 0 : break;
14612 0 : }
14613 0 : }
14614 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state", level--, 0 );
14615 0 : }
14616 0 : ulong fd_nonce_state_size( fd_nonce_state_t const * self ) {
14617 0 : ulong size = 0;
14618 0 : size += sizeof(uint);
14619 0 : switch (self->discriminant) {
14620 0 : case 1: {
14621 0 : size += fd_nonce_data_size( &self->inner.initialized );
14622 0 : break;
14623 0 : }
14624 0 : }
14625 0 : return size;
14626 0 : }
14627 :
14628 0 : int fd_nonce_state_inner_encode( fd_nonce_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
14629 0 : int err;
14630 0 : switch (discriminant) {
14631 0 : case 1: {
14632 0 : err = fd_nonce_data_encode( &self->initialized, ctx );
14633 0 : if( FD_UNLIKELY( err ) ) return err;
14634 0 : break;
14635 0 : }
14636 0 : }
14637 0 : return FD_BINCODE_SUCCESS;
14638 0 : }
14639 0 : int fd_nonce_state_encode( fd_nonce_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14640 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
14641 0 : if( FD_UNLIKELY( err ) ) return err;
14642 0 : return fd_nonce_state_inner_encode( &self->inner, self->discriminant, ctx );
14643 0 : }
14644 :
14645 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_legacy(fd_nonce_state_versions_t const * self) {
14646 0 : return self->discriminant == 0;
14647 0 : }
14648 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_current(fd_nonce_state_versions_t const * self) {
14649 0 : return self->discriminant == 1;
14650 0 : }
14651 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant );
14652 0 : int fd_nonce_state_versions_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14653 0 : int err;
14654 0 : switch (discriminant) {
14655 0 : case 0: {
14656 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
14657 0 : if( FD_UNLIKELY( err ) ) return err;
14658 0 : return FD_BINCODE_SUCCESS;
14659 0 : }
14660 0 : case 1: {
14661 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
14662 0 : if( FD_UNLIKELY( err ) ) return err;
14663 0 : return FD_BINCODE_SUCCESS;
14664 0 : }
14665 0 : default: return FD_BINCODE_ERR_ENCODING;
14666 0 : }
14667 0 : }
14668 0 : static int fd_nonce_state_versions_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14669 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14670 0 : uint discriminant = 0;
14671 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
14672 0 : if( FD_UNLIKELY( err ) ) return err;
14673 0 : return fd_nonce_state_versions_inner_decode_footprint( discriminant, ctx, total_sz );
14674 0 : }
14675 0 : int fd_nonce_state_versions_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14676 0 : *total_sz += sizeof(fd_nonce_state_versions_t);
14677 0 : void const * start_data = ctx->data;
14678 0 : int err = fd_nonce_state_versions_decode_footprint_inner( ctx, total_sz );
14679 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14680 0 : ctx->data = start_data;
14681 0 : return err;
14682 0 : }
14683 0 : static void fd_nonce_state_versions_inner_decode_inner( fd_nonce_state_versions_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
14684 0 : switch (discriminant) {
14685 0 : case 0: {
14686 0 : fd_nonce_state_decode_inner( &self->legacy, alloc_mem, ctx );
14687 0 : break;
14688 0 : }
14689 0 : case 1: {
14690 0 : fd_nonce_state_decode_inner( &self->current, alloc_mem, ctx );
14691 0 : break;
14692 0 : }
14693 0 : }
14694 0 : }
14695 0 : static void fd_nonce_state_versions_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14696 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)struct_mem;
14697 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
14698 0 : fd_nonce_state_versions_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
14699 0 : }
14700 0 : void * fd_nonce_state_versions_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14701 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)mem;
14702 0 : fd_nonce_state_versions_new( self );
14703 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_versions_t);
14704 0 : void * * alloc_mem = &alloc_region;
14705 0 : fd_nonce_state_versions_decode_inner( mem, alloc_mem, ctx );
14706 0 : return self;
14707 0 : }
14708 0 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
14709 0 : switch( discriminant ) {
14710 0 : case 0: {
14711 0 : fd_nonce_state_new( &self->legacy );
14712 0 : break;
14713 0 : }
14714 0 : case 1: {
14715 0 : fd_nonce_state_new( &self->current );
14716 0 : break;
14717 0 : }
14718 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
14719 0 : }
14720 0 : }
14721 0 : void fd_nonce_state_versions_new_disc( fd_nonce_state_versions_t * self, uint discriminant ) {
14722 0 : self->discriminant = discriminant;
14723 0 : fd_nonce_state_versions_inner_new( &self->inner, self->discriminant );
14724 0 : }
14725 0 : void fd_nonce_state_versions_new( fd_nonce_state_versions_t * self ) {
14726 0 : fd_memset( self, 0, sizeof(fd_nonce_state_versions_t) );
14727 0 : fd_nonce_state_versions_new_disc( self, UINT_MAX );
14728 0 : }
14729 :
14730 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, uint varint ) {
14731 0 : (void) varint;
14732 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state_versions", level++, 0);
14733 0 : switch( self->discriminant ) {
14734 0 : case 0: {
14735 0 : fun( w, self, "legacy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14736 0 : fd_nonce_state_walk( w, &self->inner.legacy, fun, "legacy", level, 0 );
14737 0 : break;
14738 0 : }
14739 0 : case 1: {
14740 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14741 0 : fd_nonce_state_walk( w, &self->inner.current, fun, "current", level, 0 );
14742 0 : break;
14743 0 : }
14744 0 : }
14745 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state_versions", level--, 0 );
14746 0 : }
14747 0 : ulong fd_nonce_state_versions_size( fd_nonce_state_versions_t const * self ) {
14748 0 : ulong size = 0;
14749 0 : size += sizeof(uint);
14750 0 : switch (self->discriminant) {
14751 0 : case 0: {
14752 0 : size += fd_nonce_state_size( &self->inner.legacy );
14753 0 : break;
14754 0 : }
14755 0 : case 1: {
14756 0 : size += fd_nonce_state_size( &self->inner.current );
14757 0 : break;
14758 0 : }
14759 0 : }
14760 0 : return size;
14761 0 : }
14762 :
14763 0 : int fd_nonce_state_versions_inner_encode( fd_nonce_state_versions_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
14764 0 : int err;
14765 0 : switch (discriminant) {
14766 0 : case 0: {
14767 0 : err = fd_nonce_state_encode( &self->legacy, ctx );
14768 0 : if( FD_UNLIKELY( err ) ) return err;
14769 0 : break;
14770 0 : }
14771 0 : case 1: {
14772 0 : err = fd_nonce_state_encode( &self->current, ctx );
14773 0 : if( FD_UNLIKELY( err ) ) return err;
14774 0 : break;
14775 0 : }
14776 0 : }
14777 0 : return FD_BINCODE_SUCCESS;
14778 0 : }
14779 0 : int fd_nonce_state_versions_encode( fd_nonce_state_versions_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14780 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
14781 0 : if( FD_UNLIKELY( err ) ) return err;
14782 0 : return fd_nonce_state_versions_inner_encode( &self->inner, self->discriminant, ctx );
14783 0 : }
14784 :
14785 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 ) {
14786 0 : int err;
14787 0 : err = fd_bincode_uint32_encode( self->units, ctx );
14788 0 : if( FD_UNLIKELY( err ) ) return err;
14789 0 : err = fd_bincode_uint32_encode( self->additional_fee, ctx );
14790 0 : if( FD_UNLIKELY( err ) ) return err;
14791 0 : return FD_BINCODE_SUCCESS;
14792 0 : }
14793 0 : static inline int fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14794 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14795 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
14796 0 : return 0;
14797 0 : }
14798 0 : static void fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14799 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)struct_mem;
14800 0 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
14801 0 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
14802 0 : }
14803 0 : void * fd_compute_budget_program_instruction_request_units_deprecated_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14804 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)mem;
14805 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( self );
14806 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t);
14807 0 : void * * alloc_mem = &alloc_region;
14808 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( mem, alloc_mem, ctx );
14809 0 : return self;
14810 0 : }
14811 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, uint varint ) {
14812 0 : (void) varint;
14813 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compute_budget_program_instruction_request_units_deprecated", level++, 0 );
14814 0 : fun( w, &self->units, "units", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
14815 0 : fun( w, &self->additional_fee, "additional_fee", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
14816 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compute_budget_program_instruction_request_units_deprecated", level--, 0 );
14817 0 : }
14818 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_units_deprecated(fd_compute_budget_program_instruction_t const * self) {
14819 0 : return self->discriminant == 0;
14820 0 : }
14821 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_heap_frame(fd_compute_budget_program_instruction_t const * self) {
14822 0 : return self->discriminant == 1;
14823 0 : }
14824 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_limit(fd_compute_budget_program_instruction_t const * self) {
14825 0 : return self->discriminant == 2;
14826 0 : }
14827 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_price(fd_compute_budget_program_instruction_t const * self) {
14828 0 : return self->discriminant == 3;
14829 0 : }
14830 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) {
14831 0 : return self->discriminant == 4;
14832 0 : }
14833 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant );
14834 0 : int fd_compute_budget_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14835 0 : int err;
14836 0 : switch (discriminant) {
14837 0 : case 0: {
14838 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( ctx, total_sz );
14839 0 : if( FD_UNLIKELY( err ) ) return err;
14840 0 : return FD_BINCODE_SUCCESS;
14841 0 : }
14842 0 : case 1: {
14843 0 : err = fd_bincode_uint32_decode_footprint( ctx );
14844 0 : if( FD_UNLIKELY( err ) ) return err;
14845 0 : return FD_BINCODE_SUCCESS;
14846 0 : }
14847 0 : case 2: {
14848 0 : err = fd_bincode_uint32_decode_footprint( ctx );
14849 0 : if( FD_UNLIKELY( err ) ) return err;
14850 0 : return FD_BINCODE_SUCCESS;
14851 0 : }
14852 0 : case 3: {
14853 0 : err = fd_bincode_uint64_decode_footprint( ctx );
14854 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14855 0 : return FD_BINCODE_SUCCESS;
14856 0 : }
14857 0 : case 4: {
14858 0 : err = fd_bincode_uint32_decode_footprint( ctx );
14859 0 : if( FD_UNLIKELY( err ) ) return err;
14860 0 : return FD_BINCODE_SUCCESS;
14861 0 : }
14862 0 : default: return FD_BINCODE_ERR_ENCODING;
14863 0 : }
14864 0 : }
14865 0 : static int fd_compute_budget_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14866 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14867 0 : ushort discriminant = 0;
14868 0 : int err = fd_bincode_compact_u16_decode( &discriminant, ctx );
14869 0 : if( FD_UNLIKELY( err ) ) return err;
14870 0 : return fd_compute_budget_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
14871 0 : }
14872 0 : int fd_compute_budget_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14873 0 : *total_sz += sizeof(fd_compute_budget_program_instruction_t);
14874 0 : void const * start_data = ctx->data;
14875 0 : int err = fd_compute_budget_program_instruction_decode_footprint_inner( ctx, total_sz );
14876 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14877 0 : ctx->data = start_data;
14878 0 : return err;
14879 0 : }
14880 0 : static void fd_compute_budget_program_instruction_inner_decode_inner( fd_compute_budget_program_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
14881 0 : switch (discriminant) {
14882 0 : case 0: {
14883 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( &self->request_units_deprecated, alloc_mem, ctx );
14884 0 : break;
14885 0 : }
14886 0 : case 1: {
14887 0 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
14888 0 : break;
14889 0 : }
14890 0 : case 2: {
14891 0 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
14892 0 : break;
14893 0 : }
14894 0 : case 3: {
14895 0 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
14896 0 : break;
14897 0 : }
14898 0 : case 4: {
14899 0 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
14900 0 : break;
14901 0 : }
14902 0 : }
14903 0 : }
14904 0 : static void fd_compute_budget_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14905 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)struct_mem;
14906 0 : ushort tmp = 0;
14907 0 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
14908 0 : self->discriminant = tmp;
14909 0 : fd_compute_budget_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
14910 0 : }
14911 0 : void * fd_compute_budget_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14912 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)mem;
14913 0 : fd_compute_budget_program_instruction_new( self );
14914 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_t);
14915 0 : void * * alloc_mem = &alloc_region;
14916 0 : fd_compute_budget_program_instruction_decode_inner( mem, alloc_mem, ctx );
14917 0 : return self;
14918 0 : }
14919 0 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
14920 0 : switch( discriminant ) {
14921 0 : case 0: {
14922 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( &self->request_units_deprecated );
14923 0 : break;
14924 0 : }
14925 0 : case 1: {
14926 0 : break;
14927 0 : }
14928 0 : case 2: {
14929 0 : break;
14930 0 : }
14931 0 : case 3: {
14932 0 : break;
14933 0 : }
14934 0 : case 4: {
14935 0 : break;
14936 0 : }
14937 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
14938 0 : }
14939 0 : }
14940 0 : void fd_compute_budget_program_instruction_new_disc( fd_compute_budget_program_instruction_t * self, uint discriminant ) {
14941 0 : self->discriminant = discriminant;
14942 0 : fd_compute_budget_program_instruction_inner_new( &self->inner, self->discriminant );
14943 0 : }
14944 0 : void fd_compute_budget_program_instruction_new( fd_compute_budget_program_instruction_t * self ) {
14945 0 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_t) );
14946 0 : fd_compute_budget_program_instruction_new_disc( self, UINT_MAX );
14947 0 : }
14948 :
14949 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, uint varint ) {
14950 0 : (void) varint;
14951 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_compute_budget_program_instruction", level++, 0);
14952 0 : switch( self->discriminant ) {
14953 0 : case 0: {
14954 0 : fun( w, self, "request_units_deprecated", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14955 0 : fd_compute_budget_program_instruction_request_units_deprecated_walk( w, &self->inner.request_units_deprecated, fun, "request_units_deprecated", level, 0 );
14956 0 : break;
14957 0 : }
14958 0 : case 1: {
14959 0 : fun( w, self, "request_heap_frame", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14960 0 : fun( w, &self->inner.request_heap_frame, "request_heap_frame", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
14961 0 : break;
14962 0 : }
14963 0 : case 2: {
14964 0 : fun( w, self, "set_compute_unit_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14965 0 : fun( w, &self->inner.set_compute_unit_limit, "set_compute_unit_limit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
14966 0 : break;
14967 0 : }
14968 0 : case 3: {
14969 0 : fun( w, self, "set_compute_unit_price", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14970 0 : fun( w, &self->inner.set_compute_unit_price, "set_compute_unit_price", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
14971 0 : break;
14972 0 : }
14973 0 : case 4: {
14974 0 : fun( w, self, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14975 0 : fun( w, &self->inner.set_loaded_accounts_data_size_limit, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
14976 0 : break;
14977 0 : }
14978 0 : }
14979 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_compute_budget_program_instruction", level--, 0 );
14980 0 : }
14981 0 : ulong fd_compute_budget_program_instruction_size( fd_compute_budget_program_instruction_t const * self ) {
14982 0 : ulong size = 0;
14983 0 : size += sizeof(uint);
14984 0 : switch (self->discriminant) {
14985 0 : case 0: {
14986 0 : size += fd_compute_budget_program_instruction_request_units_deprecated_size( &self->inner.request_units_deprecated );
14987 0 : break;
14988 0 : }
14989 0 : case 1: {
14990 0 : size += sizeof(uint);
14991 0 : break;
14992 0 : }
14993 0 : case 2: {
14994 0 : size += sizeof(uint);
14995 0 : break;
14996 0 : }
14997 0 : case 3: {
14998 0 : size += sizeof(ulong);
14999 0 : break;
15000 0 : }
15001 0 : case 4: {
15002 0 : size += sizeof(uint);
15003 0 : break;
15004 0 : }
15005 0 : }
15006 0 : return size;
15007 0 : }
15008 :
15009 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 ) {
15010 0 : int err;
15011 0 : switch (discriminant) {
15012 0 : case 0: {
15013 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_encode( &self->request_units_deprecated, ctx );
15014 0 : if( FD_UNLIKELY( err ) ) return err;
15015 0 : break;
15016 0 : }
15017 0 : case 1: {
15018 0 : err = fd_bincode_uint32_encode( self->request_heap_frame, ctx );
15019 0 : if( FD_UNLIKELY( err ) ) return err;
15020 0 : break;
15021 0 : }
15022 0 : case 2: {
15023 0 : err = fd_bincode_uint32_encode( self->set_compute_unit_limit, ctx );
15024 0 : if( FD_UNLIKELY( err ) ) return err;
15025 0 : break;
15026 0 : }
15027 0 : case 3: {
15028 0 : err = fd_bincode_uint64_encode( self->set_compute_unit_price, ctx );
15029 0 : if( FD_UNLIKELY( err ) ) return err;
15030 0 : break;
15031 0 : }
15032 0 : case 4: {
15033 0 : err = fd_bincode_uint32_encode( self->set_loaded_accounts_data_size_limit, ctx );
15034 0 : if( FD_UNLIKELY( err ) ) return err;
15035 0 : break;
15036 0 : }
15037 0 : }
15038 0 : return FD_BINCODE_SUCCESS;
15039 0 : }
15040 0 : int fd_compute_budget_program_instruction_encode( fd_compute_budget_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15041 0 : ushort discriminant = (ushort) self->discriminant;
15042 0 : int err = fd_bincode_compact_u16_encode( &discriminant, ctx );
15043 0 : if( FD_UNLIKELY( err ) ) return err;
15044 0 : return fd_compute_budget_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
15045 0 : }
15046 :
15047 0 : int fd_config_keys_encode( fd_config_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15048 0 : int err;
15049 0 : err = fd_bincode_compact_u16_encode( &self->keys_len, ctx );
15050 0 : if( FD_UNLIKELY(err) ) return err;
15051 0 : if( self->keys_len ) {
15052 0 : for( ulong i=0; i < self->keys_len; i++ ) {
15053 0 : err = fd_config_keys_pair_encode( self->keys + i, ctx );
15054 0 : if( FD_UNLIKELY( err ) ) return err;
15055 0 : }
15056 0 : }
15057 0 : return FD_BINCODE_SUCCESS;
15058 0 : }
15059 0 : static int fd_config_keys_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15060 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15061 0 : int err = 0;
15062 0 : ushort keys_len;
15063 0 : err = fd_bincode_compact_u16_decode( &keys_len, ctx );
15064 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15065 0 : if( keys_len ) {
15066 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*keys_len;
15067 0 : for( ulong i=0; i < keys_len; i++ ) {
15068 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
15069 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15070 0 : }
15071 0 : }
15072 0 : return 0;
15073 0 : }
15074 0 : int fd_config_keys_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15075 0 : *total_sz += sizeof(fd_config_keys_t);
15076 0 : void const * start_data = ctx->data;
15077 0 : int err = fd_config_keys_decode_footprint_inner( ctx, total_sz );
15078 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15079 0 : ctx->data = start_data;
15080 0 : return err;
15081 0 : }
15082 0 : static void fd_config_keys_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15083 0 : fd_config_keys_t * self = (fd_config_keys_t *)struct_mem;
15084 0 : fd_bincode_compact_u16_decode_unsafe( &self->keys_len, ctx );
15085 0 : if( self->keys_len ) {
15086 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
15087 0 : self->keys = *alloc_mem;
15088 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->keys_len;
15089 0 : for( ulong i=0; i < self->keys_len; i++ ) {
15090 0 : fd_config_keys_pair_new( self->keys + i );
15091 0 : fd_config_keys_pair_decode_inner( self->keys + i, alloc_mem, ctx );
15092 0 : }
15093 0 : } else
15094 0 : self->keys = NULL;
15095 0 : }
15096 0 : void * fd_config_keys_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15097 0 : fd_config_keys_t * self = (fd_config_keys_t *)mem;
15098 0 : fd_config_keys_new( self );
15099 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_t);
15100 0 : void * * alloc_mem = &alloc_region;
15101 0 : fd_config_keys_decode_inner( mem, alloc_mem, ctx );
15102 0 : return self;
15103 0 : }
15104 0 : void fd_config_keys_new(fd_config_keys_t * self) {
15105 0 : fd_memset( self, 0, sizeof(fd_config_keys_t) );
15106 0 : }
15107 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, uint varint ) {
15108 0 : (void) varint;
15109 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys", level++, 0 );
15110 0 : fun( w, &self->keys_len, "keys_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
15111 0 : if( self->keys_len ) {
15112 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15113 0 : for( ulong i=0; i < self->keys_len; i++ )
15114 0 : fd_config_keys_pair_walk(w, self->keys + i, fun, "config_keys_pair", level, 0 );
15115 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15116 0 : }
15117 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys", level--, 0 );
15118 0 : }
15119 0 : ulong fd_config_keys_size( fd_config_keys_t const * self ) {
15120 0 : ulong size = 0;
15121 0 : do {
15122 0 : ushort tmp = (ushort)self->keys_len;
15123 0 : size += fd_bincode_compact_u16_size( &tmp );
15124 0 : for( ulong i=0; i < self->keys_len; i++ )
15125 0 : size += fd_config_keys_pair_size( self->keys + i );
15126 0 : } while(0);
15127 0 : return size;
15128 0 : }
15129 :
15130 0 : int fd_bpf_loader_program_instruction_write_encode( fd_bpf_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15131 0 : int err;
15132 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
15133 0 : if( FD_UNLIKELY( err ) ) return err;
15134 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
15135 0 : if( FD_UNLIKELY(err) ) return err;
15136 0 : if( self->bytes_len ) {
15137 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
15138 0 : if( FD_UNLIKELY( err ) ) return err;
15139 0 : }
15140 0 : return FD_BINCODE_SUCCESS;
15141 0 : }
15142 0 : static int fd_bpf_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15143 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15144 0 : int err = 0;
15145 0 : err = fd_bincode_uint32_decode_footprint( ctx );
15146 0 : if( FD_UNLIKELY( err ) ) return err;
15147 0 : ulong bytes_len;
15148 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
15149 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15150 0 : if( bytes_len ) {
15151 0 : *total_sz += 8UL + bytes_len;
15152 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
15153 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15154 0 : }
15155 0 : return 0;
15156 0 : }
15157 0 : int fd_bpf_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15158 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_write_t);
15159 0 : void const * start_data = ctx->data;
15160 0 : int err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
15161 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15162 0 : ctx->data = start_data;
15163 0 : return err;
15164 0 : }
15165 0 : static void fd_bpf_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15166 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)struct_mem;
15167 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
15168 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
15169 0 : if( self->bytes_len ) {
15170 0 : self->bytes = *alloc_mem;
15171 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
15172 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
15173 0 : } else
15174 0 : self->bytes = NULL;
15175 0 : }
15176 0 : void * fd_bpf_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15177 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)mem;
15178 0 : fd_bpf_loader_program_instruction_write_new( self );
15179 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_write_t);
15180 0 : void * * alloc_mem = &alloc_region;
15181 0 : fd_bpf_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
15182 0 : return self;
15183 0 : }
15184 0 : void fd_bpf_loader_program_instruction_write_new(fd_bpf_loader_program_instruction_write_t * self) {
15185 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_write_t) );
15186 0 : }
15187 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, uint varint ) {
15188 0 : (void) varint;
15189 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_loader_program_instruction_write", level++, 0 );
15190 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15191 0 : if( self->bytes_len ) {
15192 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15193 0 : for( ulong i=0; i < self->bytes_len; i++ )
15194 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15195 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15196 0 : }
15197 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_loader_program_instruction_write", level--, 0 );
15198 0 : }
15199 0 : ulong fd_bpf_loader_program_instruction_write_size( fd_bpf_loader_program_instruction_write_t const * self ) {
15200 0 : ulong size = 0;
15201 0 : size += sizeof(uint);
15202 0 : do {
15203 0 : size += sizeof(ulong);
15204 0 : size += self->bytes_len;
15205 0 : } while(0);
15206 0 : return size;
15207 0 : }
15208 :
15209 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_write(fd_bpf_loader_program_instruction_t const * self) {
15210 0 : return self->discriminant == 0;
15211 0 : }
15212 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_finalize(fd_bpf_loader_program_instruction_t const * self) {
15213 0 : return self->discriminant == 1;
15214 0 : }
15215 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant );
15216 0 : int fd_bpf_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15217 0 : int err;
15218 0 : switch (discriminant) {
15219 0 : case 0: {
15220 0 : err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
15221 0 : if( FD_UNLIKELY( err ) ) return err;
15222 0 : return FD_BINCODE_SUCCESS;
15223 0 : }
15224 0 : case 1: {
15225 0 : return FD_BINCODE_SUCCESS;
15226 0 : }
15227 0 : default: return FD_BINCODE_ERR_ENCODING;
15228 0 : }
15229 0 : }
15230 0 : static int fd_bpf_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15231 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15232 0 : uint discriminant = 0;
15233 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
15234 0 : if( FD_UNLIKELY( err ) ) return err;
15235 0 : return fd_bpf_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
15236 0 : }
15237 0 : int fd_bpf_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15238 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_t);
15239 0 : void const * start_data = ctx->data;
15240 0 : int err = fd_bpf_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
15241 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15242 0 : ctx->data = start_data;
15243 0 : return err;
15244 0 : }
15245 0 : static void fd_bpf_loader_program_instruction_inner_decode_inner( fd_bpf_loader_program_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
15246 0 : switch (discriminant) {
15247 0 : case 0: {
15248 0 : fd_bpf_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
15249 0 : break;
15250 0 : }
15251 0 : case 1: {
15252 0 : break;
15253 0 : }
15254 0 : }
15255 0 : }
15256 0 : static void fd_bpf_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15257 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)struct_mem;
15258 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
15259 0 : fd_bpf_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
15260 0 : }
15261 0 : void * fd_bpf_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15262 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)mem;
15263 0 : fd_bpf_loader_program_instruction_new( self );
15264 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_t);
15265 0 : void * * alloc_mem = &alloc_region;
15266 0 : fd_bpf_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
15267 0 : return self;
15268 0 : }
15269 0 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
15270 0 : switch( discriminant ) {
15271 0 : case 0: {
15272 0 : fd_bpf_loader_program_instruction_write_new( &self->write );
15273 0 : break;
15274 0 : }
15275 0 : case 1: {
15276 0 : break;
15277 0 : }
15278 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
15279 0 : }
15280 0 : }
15281 0 : void fd_bpf_loader_program_instruction_new_disc( fd_bpf_loader_program_instruction_t * self, uint discriminant ) {
15282 0 : self->discriminant = discriminant;
15283 0 : fd_bpf_loader_program_instruction_inner_new( &self->inner, self->discriminant );
15284 0 : }
15285 0 : void fd_bpf_loader_program_instruction_new( fd_bpf_loader_program_instruction_t * self ) {
15286 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_t) );
15287 0 : fd_bpf_loader_program_instruction_new_disc( self, UINT_MAX );
15288 0 : }
15289 :
15290 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, uint varint ) {
15291 0 : (void) varint;
15292 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_loader_program_instruction", level++, 0);
15293 0 : switch( self->discriminant ) {
15294 0 : case 0: {
15295 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15296 0 : fd_bpf_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
15297 0 : break;
15298 0 : }
15299 0 : case 1: {
15300 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15301 0 : break;
15302 0 : }
15303 0 : }
15304 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_loader_program_instruction", level--, 0 );
15305 0 : }
15306 0 : ulong fd_bpf_loader_program_instruction_size( fd_bpf_loader_program_instruction_t const * self ) {
15307 0 : ulong size = 0;
15308 0 : size += sizeof(uint);
15309 0 : switch (self->discriminant) {
15310 0 : case 0: {
15311 0 : size += fd_bpf_loader_program_instruction_write_size( &self->inner.write );
15312 0 : break;
15313 0 : }
15314 0 : }
15315 0 : return size;
15316 0 : }
15317 :
15318 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 ) {
15319 0 : int err;
15320 0 : switch (discriminant) {
15321 0 : case 0: {
15322 0 : err = fd_bpf_loader_program_instruction_write_encode( &self->write, ctx );
15323 0 : if( FD_UNLIKELY( err ) ) return err;
15324 0 : break;
15325 0 : }
15326 0 : }
15327 0 : return FD_BINCODE_SUCCESS;
15328 0 : }
15329 0 : int fd_bpf_loader_program_instruction_encode( fd_bpf_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15330 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
15331 0 : if( FD_UNLIKELY( err ) ) return err;
15332 0 : return fd_bpf_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
15333 0 : }
15334 :
15335 0 : int fd_loader_v4_program_instruction_write_encode( fd_loader_v4_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15336 0 : int err;
15337 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
15338 0 : if( FD_UNLIKELY( err ) ) return err;
15339 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
15340 0 : if( FD_UNLIKELY(err) ) return err;
15341 0 : if( self->bytes_len ) {
15342 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
15343 0 : if( FD_UNLIKELY( err ) ) return err;
15344 0 : }
15345 0 : return FD_BINCODE_SUCCESS;
15346 0 : }
15347 0 : static int fd_loader_v4_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15348 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15349 0 : int err = 0;
15350 0 : err = fd_bincode_uint32_decode_footprint( ctx );
15351 0 : if( FD_UNLIKELY( err ) ) return err;
15352 0 : ulong bytes_len;
15353 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
15354 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15355 0 : if( bytes_len ) {
15356 0 : *total_sz += 8UL + bytes_len;
15357 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
15358 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15359 0 : }
15360 0 : return 0;
15361 0 : }
15362 0 : int fd_loader_v4_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15363 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_write_t);
15364 0 : void const * start_data = ctx->data;
15365 0 : int err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
15366 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15367 0 : ctx->data = start_data;
15368 0 : return err;
15369 0 : }
15370 0 : static void fd_loader_v4_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15371 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)struct_mem;
15372 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
15373 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
15374 0 : if( self->bytes_len ) {
15375 0 : self->bytes = *alloc_mem;
15376 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
15377 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
15378 0 : } else
15379 0 : self->bytes = NULL;
15380 0 : }
15381 0 : void * fd_loader_v4_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15382 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)mem;
15383 0 : fd_loader_v4_program_instruction_write_new( self );
15384 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_write_t);
15385 0 : void * * alloc_mem = &alloc_region;
15386 0 : fd_loader_v4_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
15387 0 : return self;
15388 0 : }
15389 0 : void fd_loader_v4_program_instruction_write_new(fd_loader_v4_program_instruction_write_t * self) {
15390 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_write_t) );
15391 0 : }
15392 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, uint varint ) {
15393 0 : (void) varint;
15394 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_write", level++, 0 );
15395 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15396 0 : if( self->bytes_len ) {
15397 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15398 0 : for( ulong i=0; i < self->bytes_len; i++ )
15399 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15400 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15401 0 : }
15402 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_write", level--, 0 );
15403 0 : }
15404 0 : ulong fd_loader_v4_program_instruction_write_size( fd_loader_v4_program_instruction_write_t const * self ) {
15405 0 : ulong size = 0;
15406 0 : size += sizeof(uint);
15407 0 : do {
15408 0 : size += sizeof(ulong);
15409 0 : size += self->bytes_len;
15410 0 : } while(0);
15411 0 : return size;
15412 0 : }
15413 :
15414 0 : int fd_loader_v4_program_instruction_copy_encode( fd_loader_v4_program_instruction_copy_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15415 0 : int err;
15416 0 : err = fd_bincode_uint32_encode( self->destination_offset, ctx );
15417 0 : if( FD_UNLIKELY( err ) ) return err;
15418 0 : err = fd_bincode_uint32_encode( self->source_offset, ctx );
15419 0 : if( FD_UNLIKELY( err ) ) return err;
15420 0 : err = fd_bincode_uint32_encode( self->length, ctx );
15421 0 : if( FD_UNLIKELY( err ) ) return err;
15422 0 : return FD_BINCODE_SUCCESS;
15423 0 : }
15424 0 : static inline int fd_loader_v4_program_instruction_copy_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15425 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15426 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
15427 0 : return 0;
15428 0 : }
15429 0 : static void fd_loader_v4_program_instruction_copy_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15430 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)struct_mem;
15431 0 : fd_bincode_uint32_decode_unsafe( &self->destination_offset, ctx );
15432 0 : fd_bincode_uint32_decode_unsafe( &self->source_offset, ctx );
15433 0 : fd_bincode_uint32_decode_unsafe( &self->length, ctx );
15434 0 : }
15435 0 : void * fd_loader_v4_program_instruction_copy_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15436 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)mem;
15437 0 : fd_loader_v4_program_instruction_copy_new( self );
15438 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_copy_t);
15439 0 : void * * alloc_mem = &alloc_region;
15440 0 : fd_loader_v4_program_instruction_copy_decode_inner( mem, alloc_mem, ctx );
15441 0 : return self;
15442 0 : }
15443 0 : void fd_loader_v4_program_instruction_copy_walk( void * w, fd_loader_v4_program_instruction_copy_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
15444 0 : (void) varint;
15445 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_copy", level++, 0 );
15446 0 : fun( w, &self->destination_offset, "destination_offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15447 0 : fun( w, &self->source_offset, "source_offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15448 0 : fun( w, &self->length, "length", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15449 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_copy", level--, 0 );
15450 0 : }
15451 0 : int fd_loader_v4_program_instruction_set_program_length_encode( fd_loader_v4_program_instruction_set_program_length_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15452 0 : int err;
15453 0 : err = fd_bincode_uint32_encode( self->new_size, ctx );
15454 0 : if( FD_UNLIKELY( err ) ) return err;
15455 0 : return FD_BINCODE_SUCCESS;
15456 0 : }
15457 0 : static inline int fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15458 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15459 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
15460 0 : return 0;
15461 0 : }
15462 0 : static void fd_loader_v4_program_instruction_set_program_length_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15463 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)struct_mem;
15464 0 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
15465 0 : }
15466 0 : void * fd_loader_v4_program_instruction_set_program_length_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15467 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)mem;
15468 0 : fd_loader_v4_program_instruction_set_program_length_new( self );
15469 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_set_program_length_t);
15470 0 : void * * alloc_mem = &alloc_region;
15471 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( mem, alloc_mem, ctx );
15472 0 : return self;
15473 0 : }
15474 0 : void fd_loader_v4_program_instruction_set_program_length_walk( void * w, fd_loader_v4_program_instruction_set_program_length_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
15475 0 : (void) varint;
15476 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_set_program_length", level++, 0 );
15477 0 : fun( w, &self->new_size, "new_size", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15478 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_set_program_length", level--, 0 );
15479 0 : }
15480 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_write(fd_loader_v4_program_instruction_t const * self) {
15481 0 : return self->discriminant == 0;
15482 0 : }
15483 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_copy(fd_loader_v4_program_instruction_t const * self) {
15484 0 : return self->discriminant == 1;
15485 0 : }
15486 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_set_program_length(fd_loader_v4_program_instruction_t const * self) {
15487 0 : return self->discriminant == 2;
15488 0 : }
15489 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_deploy(fd_loader_v4_program_instruction_t const * self) {
15490 0 : return self->discriminant == 3;
15491 0 : }
15492 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_retract(fd_loader_v4_program_instruction_t const * self) {
15493 0 : return self->discriminant == 4;
15494 0 : }
15495 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_transfer_authority(fd_loader_v4_program_instruction_t const * self) {
15496 0 : return self->discriminant == 5;
15497 0 : }
15498 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_finalize(fd_loader_v4_program_instruction_t const * self) {
15499 0 : return self->discriminant == 6;
15500 0 : }
15501 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant );
15502 0 : int fd_loader_v4_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15503 0 : int err;
15504 0 : switch (discriminant) {
15505 0 : case 0: {
15506 0 : err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
15507 0 : if( FD_UNLIKELY( err ) ) return err;
15508 0 : return FD_BINCODE_SUCCESS;
15509 0 : }
15510 0 : case 1: {
15511 0 : err = fd_loader_v4_program_instruction_copy_decode_footprint_inner( ctx, total_sz );
15512 0 : if( FD_UNLIKELY( err ) ) return err;
15513 0 : return FD_BINCODE_SUCCESS;
15514 0 : }
15515 0 : case 2: {
15516 0 : err = fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( ctx, total_sz );
15517 0 : if( FD_UNLIKELY( err ) ) return err;
15518 0 : return FD_BINCODE_SUCCESS;
15519 0 : }
15520 0 : case 3: {
15521 0 : return FD_BINCODE_SUCCESS;
15522 0 : }
15523 0 : case 4: {
15524 0 : return FD_BINCODE_SUCCESS;
15525 0 : }
15526 0 : case 5: {
15527 0 : return FD_BINCODE_SUCCESS;
15528 0 : }
15529 0 : case 6: {
15530 0 : return FD_BINCODE_SUCCESS;
15531 0 : }
15532 0 : default: return FD_BINCODE_ERR_ENCODING;
15533 0 : }
15534 0 : }
15535 0 : static int fd_loader_v4_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15536 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15537 0 : uint discriminant = 0;
15538 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
15539 0 : if( FD_UNLIKELY( err ) ) return err;
15540 0 : return fd_loader_v4_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
15541 0 : }
15542 0 : int fd_loader_v4_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15543 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_t);
15544 0 : void const * start_data = ctx->data;
15545 0 : int err = fd_loader_v4_program_instruction_decode_footprint_inner( ctx, total_sz );
15546 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15547 0 : ctx->data = start_data;
15548 0 : return err;
15549 0 : }
15550 0 : static void fd_loader_v4_program_instruction_inner_decode_inner( fd_loader_v4_program_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
15551 0 : switch (discriminant) {
15552 0 : case 0: {
15553 0 : fd_loader_v4_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
15554 0 : break;
15555 0 : }
15556 0 : case 1: {
15557 0 : fd_loader_v4_program_instruction_copy_decode_inner( &self->copy, alloc_mem, ctx );
15558 0 : break;
15559 0 : }
15560 0 : case 2: {
15561 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( &self->set_program_length, alloc_mem, ctx );
15562 0 : break;
15563 0 : }
15564 0 : case 3: {
15565 0 : break;
15566 0 : }
15567 0 : case 4: {
15568 0 : break;
15569 0 : }
15570 0 : case 5: {
15571 0 : break;
15572 0 : }
15573 0 : case 6: {
15574 0 : break;
15575 0 : }
15576 0 : }
15577 0 : }
15578 0 : static void fd_loader_v4_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15579 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)struct_mem;
15580 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
15581 0 : fd_loader_v4_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
15582 0 : }
15583 0 : void * fd_loader_v4_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15584 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)mem;
15585 0 : fd_loader_v4_program_instruction_new( self );
15586 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_t);
15587 0 : void * * alloc_mem = &alloc_region;
15588 0 : fd_loader_v4_program_instruction_decode_inner( mem, alloc_mem, ctx );
15589 0 : return self;
15590 0 : }
15591 0 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
15592 0 : switch( discriminant ) {
15593 0 : case 0: {
15594 0 : fd_loader_v4_program_instruction_write_new( &self->write );
15595 0 : break;
15596 0 : }
15597 0 : case 1: {
15598 0 : fd_loader_v4_program_instruction_copy_new( &self->copy );
15599 0 : break;
15600 0 : }
15601 0 : case 2: {
15602 0 : fd_loader_v4_program_instruction_set_program_length_new( &self->set_program_length );
15603 0 : break;
15604 0 : }
15605 0 : case 3: {
15606 0 : break;
15607 0 : }
15608 0 : case 4: {
15609 0 : break;
15610 0 : }
15611 0 : case 5: {
15612 0 : break;
15613 0 : }
15614 0 : case 6: {
15615 0 : break;
15616 0 : }
15617 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
15618 0 : }
15619 0 : }
15620 0 : void fd_loader_v4_program_instruction_new_disc( fd_loader_v4_program_instruction_t * self, uint discriminant ) {
15621 0 : self->discriminant = discriminant;
15622 0 : fd_loader_v4_program_instruction_inner_new( &self->inner, self->discriminant );
15623 0 : }
15624 0 : void fd_loader_v4_program_instruction_new( fd_loader_v4_program_instruction_t * self ) {
15625 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_t) );
15626 0 : fd_loader_v4_program_instruction_new_disc( self, UINT_MAX );
15627 0 : }
15628 :
15629 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, uint varint ) {
15630 0 : (void) varint;
15631 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_loader_v4_program_instruction", level++, 0);
15632 0 : switch( self->discriminant ) {
15633 0 : case 0: {
15634 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15635 0 : fd_loader_v4_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
15636 0 : break;
15637 0 : }
15638 0 : case 1: {
15639 0 : fun( w, self, "copy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15640 0 : fd_loader_v4_program_instruction_copy_walk( w, &self->inner.copy, fun, "copy", level, 0 );
15641 0 : break;
15642 0 : }
15643 0 : case 2: {
15644 0 : fun( w, self, "set_program_length", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15645 0 : fd_loader_v4_program_instruction_set_program_length_walk( w, &self->inner.set_program_length, fun, "set_program_length", level, 0 );
15646 0 : break;
15647 0 : }
15648 0 : case 3: {
15649 0 : fun( w, self, "deploy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15650 0 : break;
15651 0 : }
15652 0 : case 4: {
15653 0 : fun( w, self, "retract", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15654 0 : break;
15655 0 : }
15656 0 : case 5: {
15657 0 : fun( w, self, "transfer_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15658 0 : break;
15659 0 : }
15660 0 : case 6: {
15661 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15662 0 : break;
15663 0 : }
15664 0 : }
15665 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_loader_v4_program_instruction", level--, 0 );
15666 0 : }
15667 0 : ulong fd_loader_v4_program_instruction_size( fd_loader_v4_program_instruction_t const * self ) {
15668 0 : ulong size = 0;
15669 0 : size += sizeof(uint);
15670 0 : switch (self->discriminant) {
15671 0 : case 0: {
15672 0 : size += fd_loader_v4_program_instruction_write_size( &self->inner.write );
15673 0 : break;
15674 0 : }
15675 0 : case 1: {
15676 0 : size += fd_loader_v4_program_instruction_copy_size( &self->inner.copy );
15677 0 : break;
15678 0 : }
15679 0 : case 2: {
15680 0 : size += fd_loader_v4_program_instruction_set_program_length_size( &self->inner.set_program_length );
15681 0 : break;
15682 0 : }
15683 0 : }
15684 0 : return size;
15685 0 : }
15686 :
15687 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 ) {
15688 0 : int err;
15689 0 : switch (discriminant) {
15690 0 : case 0: {
15691 0 : err = fd_loader_v4_program_instruction_write_encode( &self->write, ctx );
15692 0 : if( FD_UNLIKELY( err ) ) return err;
15693 0 : break;
15694 0 : }
15695 0 : case 1: {
15696 0 : err = fd_loader_v4_program_instruction_copy_encode( &self->copy, ctx );
15697 0 : if( FD_UNLIKELY( err ) ) return err;
15698 0 : break;
15699 0 : }
15700 0 : case 2: {
15701 0 : err = fd_loader_v4_program_instruction_set_program_length_encode( &self->set_program_length, ctx );
15702 0 : if( FD_UNLIKELY( err ) ) return err;
15703 0 : break;
15704 0 : }
15705 0 : }
15706 0 : return FD_BINCODE_SUCCESS;
15707 0 : }
15708 0 : int fd_loader_v4_program_instruction_encode( fd_loader_v4_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15709 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
15710 0 : if( FD_UNLIKELY( err ) ) return err;
15711 0 : return fd_loader_v4_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
15712 0 : }
15713 :
15714 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 ) {
15715 0 : int err;
15716 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
15717 0 : if( FD_UNLIKELY( err ) ) return err;
15718 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
15719 0 : if( FD_UNLIKELY(err) ) return err;
15720 0 : if( self->bytes_len ) {
15721 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
15722 0 : if( FD_UNLIKELY( err ) ) return err;
15723 0 : }
15724 0 : return FD_BINCODE_SUCCESS;
15725 0 : }
15726 0 : static int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15727 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15728 0 : int err = 0;
15729 0 : err = fd_bincode_uint32_decode_footprint( ctx );
15730 0 : if( FD_UNLIKELY( err ) ) return err;
15731 0 : ulong bytes_len;
15732 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
15733 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15734 0 : if( bytes_len ) {
15735 0 : *total_sz += 8UL + bytes_len;
15736 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
15737 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15738 0 : }
15739 0 : return 0;
15740 0 : }
15741 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15742 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
15743 0 : void const * start_data = ctx->data;
15744 0 : int err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
15745 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15746 0 : ctx->data = start_data;
15747 0 : return err;
15748 0 : }
15749 0 : static void fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15750 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)struct_mem;
15751 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
15752 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
15753 0 : if( self->bytes_len ) {
15754 0 : self->bytes = *alloc_mem;
15755 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
15756 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
15757 0 : } else
15758 0 : self->bytes = NULL;
15759 0 : }
15760 0 : void * fd_bpf_upgradeable_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15761 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)mem;
15762 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( self );
15763 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
15764 0 : void * * alloc_mem = &alloc_region;
15765 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
15766 0 : return self;
15767 0 : }
15768 0 : void fd_bpf_upgradeable_loader_program_instruction_write_new(fd_bpf_upgradeable_loader_program_instruction_write_t * self) {
15769 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t) );
15770 0 : }
15771 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, uint varint ) {
15772 0 : (void) varint;
15773 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_write", level++, 0 );
15774 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15775 0 : if( self->bytes_len ) {
15776 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
15777 0 : for( ulong i=0; i < self->bytes_len; i++ )
15778 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15779 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
15780 0 : }
15781 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_write", level--, 0 );
15782 0 : }
15783 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_size( fd_bpf_upgradeable_loader_program_instruction_write_t const * self ) {
15784 0 : ulong size = 0;
15785 0 : size += sizeof(uint);
15786 0 : do {
15787 0 : size += sizeof(ulong);
15788 0 : size += self->bytes_len;
15789 0 : } while(0);
15790 0 : return size;
15791 0 : }
15792 :
15793 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 ) {
15794 0 : int err;
15795 0 : err = fd_bincode_uint64_encode( self->max_data_len, ctx );
15796 0 : if( FD_UNLIKELY( err ) ) return err;
15797 0 : return FD_BINCODE_SUCCESS;
15798 0 : }
15799 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15800 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15801 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
15802 0 : return 0;
15803 0 : }
15804 0 : static void fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15805 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self = (fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t *)struct_mem;
15806 0 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
15807 0 : }
15808 0 : void * fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15809 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t * self = (fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t *)mem;
15810 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( self );
15811 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t);
15812 0 : void * * alloc_mem = &alloc_region;
15813 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( mem, alloc_mem, ctx );
15814 0 : return self;
15815 0 : }
15816 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, uint varint ) {
15817 0 : (void) varint;
15818 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level++, 0 );
15819 0 : fun( w, &self->max_data_len, "max_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15820 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level--, 0 );
15821 0 : }
15822 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 ) {
15823 0 : int err;
15824 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
15825 0 : if( FD_UNLIKELY( err ) ) return err;
15826 0 : return FD_BINCODE_SUCCESS;
15827 0 : }
15828 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15829 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15830 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
15831 0 : return 0;
15832 0 : }
15833 0 : static void fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15834 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)struct_mem;
15835 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
15836 0 : }
15837 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15838 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)mem;
15839 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( self );
15840 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t);
15841 0 : void * * alloc_mem = &alloc_region;
15842 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( mem, alloc_mem, ctx );
15843 0 : return self;
15844 0 : }
15845 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, uint varint ) {
15846 0 : (void) varint;
15847 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level++, 0 );
15848 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15849 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level--, 0 );
15850 0 : }
15851 0 : int fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_encode( fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15852 0 : int err;
15853 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
15854 0 : if( FD_UNLIKELY( err ) ) return err;
15855 0 : return FD_BINCODE_SUCCESS;
15856 0 : }
15857 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15858 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15859 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
15860 0 : return 0;
15861 0 : }
15862 0 : static void fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15863 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)struct_mem;
15864 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
15865 0 : }
15866 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15867 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)mem;
15868 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( self );
15869 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t);
15870 0 : void * * alloc_mem = &alloc_region;
15871 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( mem, alloc_mem, ctx );
15872 0 : return self;
15873 0 : }
15874 0 : void fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_walk( void * w, fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
15875 0 : (void) varint;
15876 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program_checked", level++, 0 );
15877 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
15878 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program_checked", level--, 0 );
15879 0 : }
15880 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_initialize_buffer(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
15881 0 : return self->discriminant == 0;
15882 0 : }
15883 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_write(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
15884 0 : return self->discriminant == 1;
15885 0 : }
15886 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) {
15887 0 : return self->discriminant == 2;
15888 0 : }
15889 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_upgrade(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
15890 0 : return self->discriminant == 3;
15891 0 : }
15892 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
15893 0 : return self->discriminant == 4;
15894 0 : }
15895 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_close(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
15896 0 : return self->discriminant == 5;
15897 0 : }
15898 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
15899 0 : return self->discriminant == 6;
15900 0 : }
15901 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
15902 0 : return self->discriminant == 7;
15903 0 : }
15904 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_migrate(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
15905 0 : return self->discriminant == 8;
15906 0 : }
15907 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
15908 0 : return self->discriminant == 9;
15909 0 : }
15910 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant );
15911 0 : int fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15912 0 : int err;
15913 0 : switch (discriminant) {
15914 0 : case 0: {
15915 0 : return FD_BINCODE_SUCCESS;
15916 0 : }
15917 0 : case 1: {
15918 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
15919 0 : if( FD_UNLIKELY( err ) ) return err;
15920 0 : return FD_BINCODE_SUCCESS;
15921 0 : }
15922 0 : case 2: {
15923 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( ctx, total_sz );
15924 0 : if( FD_UNLIKELY( err ) ) return err;
15925 0 : return FD_BINCODE_SUCCESS;
15926 0 : }
15927 0 : case 3: {
15928 0 : return FD_BINCODE_SUCCESS;
15929 0 : }
15930 0 : case 4: {
15931 0 : return FD_BINCODE_SUCCESS;
15932 0 : }
15933 0 : case 5: {
15934 0 : return FD_BINCODE_SUCCESS;
15935 0 : }
15936 0 : case 6: {
15937 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( ctx, total_sz );
15938 0 : if( FD_UNLIKELY( err ) ) return err;
15939 0 : return FD_BINCODE_SUCCESS;
15940 0 : }
15941 0 : case 7: {
15942 0 : return FD_BINCODE_SUCCESS;
15943 0 : }
15944 0 : case 8: {
15945 0 : return FD_BINCODE_SUCCESS;
15946 0 : }
15947 0 : case 9: {
15948 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_footprint_inner( ctx, total_sz );
15949 0 : if( FD_UNLIKELY( err ) ) return err;
15950 0 : return FD_BINCODE_SUCCESS;
15951 0 : }
15952 0 : default: return FD_BINCODE_ERR_ENCODING;
15953 0 : }
15954 0 : }
15955 0 : static int fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15956 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15957 0 : uint discriminant = 0;
15958 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
15959 0 : if( FD_UNLIKELY( err ) ) return err;
15960 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
15961 0 : }
15962 0 : int fd_bpf_upgradeable_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15963 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
15964 0 : void const * start_data = ctx->data;
15965 0 : int err = fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
15966 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15967 0 : ctx->data = start_data;
15968 0 : return err;
15969 0 : }
15970 0 : static void fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
15971 0 : switch (discriminant) {
15972 0 : case 0: {
15973 0 : break;
15974 0 : }
15975 0 : case 1: {
15976 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
15977 0 : break;
15978 0 : }
15979 0 : case 2: {
15980 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( &self->deploy_with_max_data_len, alloc_mem, ctx );
15981 0 : break;
15982 0 : }
15983 0 : case 3: {
15984 0 : break;
15985 0 : }
15986 0 : case 4: {
15987 0 : break;
15988 0 : }
15989 0 : case 5: {
15990 0 : break;
15991 0 : }
15992 0 : case 6: {
15993 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( &self->extend_program, alloc_mem, ctx );
15994 0 : break;
15995 0 : }
15996 0 : case 7: {
15997 0 : break;
15998 0 : }
15999 0 : case 8: {
16000 0 : break;
16001 0 : }
16002 0 : case 9: {
16003 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( &self->extend_program_checked, alloc_mem, ctx );
16004 0 : break;
16005 0 : }
16006 0 : }
16007 0 : }
16008 0 : static void fd_bpf_upgradeable_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16009 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)struct_mem;
16010 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16011 0 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
16012 0 : }
16013 0 : void * fd_bpf_upgradeable_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16014 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)mem;
16015 0 : fd_bpf_upgradeable_loader_program_instruction_new( self );
16016 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
16017 0 : void * * alloc_mem = &alloc_region;
16018 0 : fd_bpf_upgradeable_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
16019 0 : return self;
16020 0 : }
16021 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
16022 0 : switch( discriminant ) {
16023 0 : case 0: {
16024 0 : break;
16025 0 : }
16026 0 : case 1: {
16027 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( &self->write );
16028 0 : break;
16029 0 : }
16030 0 : case 2: {
16031 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( &self->deploy_with_max_data_len );
16032 0 : break;
16033 0 : }
16034 0 : case 3: {
16035 0 : break;
16036 0 : }
16037 0 : case 4: {
16038 0 : break;
16039 0 : }
16040 0 : case 5: {
16041 0 : break;
16042 0 : }
16043 0 : case 6: {
16044 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( &self->extend_program );
16045 0 : break;
16046 0 : }
16047 0 : case 7: {
16048 0 : break;
16049 0 : }
16050 0 : case 8: {
16051 0 : break;
16052 0 : }
16053 0 : case 9: {
16054 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( &self->extend_program_checked );
16055 0 : break;
16056 0 : }
16057 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
16058 0 : }
16059 0 : }
16060 0 : void fd_bpf_upgradeable_loader_program_instruction_new_disc( fd_bpf_upgradeable_loader_program_instruction_t * self, uint discriminant ) {
16061 0 : self->discriminant = discriminant;
16062 0 : fd_bpf_upgradeable_loader_program_instruction_inner_new( &self->inner, self->discriminant );
16063 0 : }
16064 0 : void fd_bpf_upgradeable_loader_program_instruction_new( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
16065 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_t) );
16066 0 : fd_bpf_upgradeable_loader_program_instruction_new_disc( self, UINT_MAX );
16067 0 : }
16068 :
16069 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, uint varint ) {
16070 0 : (void) varint;
16071 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_program_instruction", level++, 0);
16072 0 : switch( self->discriminant ) {
16073 0 : case 0: {
16074 0 : fun( w, self, "initialize_buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16075 0 : break;
16076 0 : }
16077 0 : case 1: {
16078 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16079 0 : fd_bpf_upgradeable_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
16080 0 : break;
16081 0 : }
16082 0 : case 2: {
16083 0 : fun( w, self, "deploy_with_max_data_len", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16084 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, 0 );
16085 0 : break;
16086 0 : }
16087 0 : case 3: {
16088 0 : fun( w, self, "upgrade", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16089 0 : break;
16090 0 : }
16091 0 : case 4: {
16092 0 : fun( w, self, "set_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16093 0 : break;
16094 0 : }
16095 0 : case 5: {
16096 0 : fun( w, self, "close", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16097 0 : break;
16098 0 : }
16099 0 : case 6: {
16100 0 : fun( w, self, "extend_program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16101 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_walk( w, &self->inner.extend_program, fun, "extend_program", level, 0 );
16102 0 : break;
16103 0 : }
16104 0 : case 7: {
16105 0 : fun( w, self, "set_authority_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16106 0 : break;
16107 0 : }
16108 0 : case 8: {
16109 0 : fun( w, self, "migrate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16110 0 : break;
16111 0 : }
16112 0 : case 9: {
16113 0 : fun( w, self, "extend_program_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16114 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_walk( w, &self->inner.extend_program_checked, fun, "extend_program_checked", level, 0 );
16115 0 : break;
16116 0 : }
16117 0 : }
16118 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_program_instruction", level--, 0 );
16119 0 : }
16120 0 : ulong fd_bpf_upgradeable_loader_program_instruction_size( fd_bpf_upgradeable_loader_program_instruction_t const * self ) {
16121 0 : ulong size = 0;
16122 0 : size += sizeof(uint);
16123 0 : switch (self->discriminant) {
16124 0 : case 1: {
16125 0 : size += fd_bpf_upgradeable_loader_program_instruction_write_size( &self->inner.write );
16126 0 : break;
16127 0 : }
16128 0 : case 2: {
16129 0 : size += fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( &self->inner.deploy_with_max_data_len );
16130 0 : break;
16131 0 : }
16132 0 : case 6: {
16133 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_size( &self->inner.extend_program );
16134 0 : break;
16135 0 : }
16136 0 : case 9: {
16137 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_size( &self->inner.extend_program_checked );
16138 0 : break;
16139 0 : }
16140 0 : }
16141 0 : return size;
16142 0 : }
16143 :
16144 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 ) {
16145 0 : int err;
16146 0 : switch (discriminant) {
16147 0 : case 1: {
16148 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_encode( &self->write, ctx );
16149 0 : if( FD_UNLIKELY( err ) ) return err;
16150 0 : break;
16151 0 : }
16152 0 : case 2: {
16153 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( &self->deploy_with_max_data_len, ctx );
16154 0 : if( FD_UNLIKELY( err ) ) return err;
16155 0 : break;
16156 0 : }
16157 0 : case 6: {
16158 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( &self->extend_program, ctx );
16159 0 : if( FD_UNLIKELY( err ) ) return err;
16160 0 : break;
16161 0 : }
16162 0 : case 9: {
16163 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_encode( &self->extend_program_checked, ctx );
16164 0 : if( FD_UNLIKELY( err ) ) return err;
16165 0 : break;
16166 0 : }
16167 0 : }
16168 0 : return FD_BINCODE_SUCCESS;
16169 0 : }
16170 0 : int fd_bpf_upgradeable_loader_program_instruction_encode( fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16171 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
16172 0 : if( FD_UNLIKELY( err ) ) return err;
16173 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
16174 0 : }
16175 :
16176 0 : int fd_bpf_upgradeable_loader_state_buffer_encode( fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16177 0 : int err;
16178 0 : if( self->authority_address != NULL ) {
16179 0 : err = fd_bincode_bool_encode( 1, ctx );
16180 0 : if( FD_UNLIKELY( err ) ) return err;
16181 0 : err = fd_pubkey_encode( self->authority_address, ctx );
16182 0 : if( FD_UNLIKELY( err ) ) return err;
16183 0 : } else {
16184 0 : err = fd_bincode_bool_encode( 0, ctx );
16185 0 : if( FD_UNLIKELY( err ) ) return err;
16186 0 : }
16187 0 : return FD_BINCODE_SUCCESS;
16188 0 : }
16189 0 : static int fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16190 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16191 0 : int err = 0;
16192 0 : {
16193 0 : uchar o;
16194 0 : err = fd_bincode_bool_decode( &o, ctx );
16195 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16196 0 : if( o ) {
16197 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
16198 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16199 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16200 0 : }
16201 0 : }
16202 0 : return 0;
16203 0 : }
16204 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16205 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
16206 0 : void const * start_data = ctx->data;
16207 0 : int err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
16208 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16209 0 : ctx->data = start_data;
16210 0 : return err;
16211 0 : }
16212 0 : static void fd_bpf_upgradeable_loader_state_buffer_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16213 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)struct_mem;
16214 0 : {
16215 0 : uchar o;
16216 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
16217 0 : if( o ) {
16218 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
16219 0 : self->authority_address = *alloc_mem;
16220 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
16221 0 : fd_pubkey_new( self->authority_address );
16222 0 : fd_pubkey_decode_inner( self->authority_address, alloc_mem, ctx );
16223 0 : } else {
16224 0 : self->authority_address = NULL;
16225 0 : }
16226 0 : }
16227 0 : }
16228 0 : void * fd_bpf_upgradeable_loader_state_buffer_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16229 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)mem;
16230 0 : fd_bpf_upgradeable_loader_state_buffer_new( self );
16231 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
16232 0 : void * * alloc_mem = &alloc_region;
16233 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( mem, alloc_mem, ctx );
16234 0 : return self;
16235 0 : }
16236 0 : void fd_bpf_upgradeable_loader_state_buffer_new(fd_bpf_upgradeable_loader_state_buffer_t * self) {
16237 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_buffer_t) );
16238 0 : }
16239 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, uint varint ) {
16240 0 : (void) varint;
16241 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_buffer", level++, 0 );
16242 0 : if( !self->authority_address ) {
16243 0 : fun( w, NULL, "authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
16244 0 : } else {
16245 0 : fd_pubkey_walk( w, self->authority_address, fun, "authority_address", level, 0 );
16246 0 : }
16247 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_buffer", level--, 0 );
16248 0 : }
16249 0 : ulong fd_bpf_upgradeable_loader_state_buffer_size( fd_bpf_upgradeable_loader_state_buffer_t const * self ) {
16250 0 : ulong size = 0;
16251 0 : size += sizeof(char);
16252 0 : if( NULL != self->authority_address ) {
16253 0 : size += fd_pubkey_size( self->authority_address );
16254 0 : }
16255 0 : return size;
16256 0 : }
16257 :
16258 0 : int fd_bpf_upgradeable_loader_state_program_encode( fd_bpf_upgradeable_loader_state_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16259 0 : int err;
16260 0 : err = fd_pubkey_encode( &self->programdata_address, ctx );
16261 0 : if( FD_UNLIKELY( err ) ) return err;
16262 0 : return FD_BINCODE_SUCCESS;
16263 0 : }
16264 0 : static inline int fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16265 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16266 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
16267 0 : return 0;
16268 0 : }
16269 0 : static void fd_bpf_upgradeable_loader_state_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16270 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)struct_mem;
16271 0 : fd_pubkey_decode_inner( &self->programdata_address, alloc_mem, ctx );
16272 0 : }
16273 0 : void * fd_bpf_upgradeable_loader_state_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16274 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)mem;
16275 0 : fd_bpf_upgradeable_loader_state_program_new( self );
16276 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_t);
16277 0 : void * * alloc_mem = &alloc_region;
16278 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( mem, alloc_mem, ctx );
16279 0 : return self;
16280 0 : }
16281 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, uint varint ) {
16282 0 : (void) varint;
16283 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program", level++, 0 );
16284 0 : fd_pubkey_walk( w, &self->programdata_address, fun, "programdata_address", level, 0 );
16285 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program", level--, 0 );
16286 0 : }
16287 0 : 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 ) {
16288 0 : int err;
16289 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
16290 0 : if( FD_UNLIKELY( err ) ) return err;
16291 0 : if( self->upgrade_authority_address != NULL ) {
16292 0 : err = fd_bincode_bool_encode( 1, ctx );
16293 0 : if( FD_UNLIKELY( err ) ) return err;
16294 0 : err = fd_pubkey_encode( self->upgrade_authority_address, ctx );
16295 0 : if( FD_UNLIKELY( err ) ) return err;
16296 0 : } else {
16297 0 : err = fd_bincode_bool_encode( 0, ctx );
16298 0 : if( FD_UNLIKELY( err ) ) return err;
16299 0 : }
16300 0 : return FD_BINCODE_SUCCESS;
16301 0 : }
16302 0 : static int fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16303 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16304 0 : int err = 0;
16305 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16306 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16307 0 : {
16308 0 : uchar o;
16309 0 : err = fd_bincode_bool_decode( &o, ctx );
16310 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16311 0 : if( o ) {
16312 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
16313 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16314 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16315 0 : }
16316 0 : }
16317 0 : return 0;
16318 0 : }
16319 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16320 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
16321 0 : void const * start_data = ctx->data;
16322 0 : int err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
16323 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16324 0 : ctx->data = start_data;
16325 0 : return err;
16326 0 : }
16327 0 : static void fd_bpf_upgradeable_loader_state_program_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16328 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)struct_mem;
16329 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
16330 0 : {
16331 0 : uchar o;
16332 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
16333 0 : if( o ) {
16334 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
16335 0 : self->upgrade_authority_address = *alloc_mem;
16336 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
16337 0 : fd_pubkey_new( self->upgrade_authority_address );
16338 0 : fd_pubkey_decode_inner( self->upgrade_authority_address, alloc_mem, ctx );
16339 0 : } else {
16340 0 : self->upgrade_authority_address = NULL;
16341 0 : }
16342 0 : }
16343 0 : }
16344 0 : void * fd_bpf_upgradeable_loader_state_program_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16345 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)mem;
16346 0 : fd_bpf_upgradeable_loader_state_program_data_new( self );
16347 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
16348 0 : void * * alloc_mem = &alloc_region;
16349 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( mem, alloc_mem, ctx );
16350 0 : return self;
16351 0 : }
16352 0 : void fd_bpf_upgradeable_loader_state_program_data_new(fd_bpf_upgradeable_loader_state_program_data_t * self) {
16353 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_data_t) );
16354 0 : }
16355 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, uint varint ) {
16356 0 : (void) varint;
16357 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program_data", level++, 0 );
16358 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16359 0 : if( !self->upgrade_authority_address ) {
16360 0 : fun( w, NULL, "upgrade_authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
16361 0 : } else {
16362 0 : fd_pubkey_walk( w, self->upgrade_authority_address, fun, "upgrade_authority_address", level, 0 );
16363 0 : }
16364 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program_data", level--, 0 );
16365 0 : }
16366 0 : ulong fd_bpf_upgradeable_loader_state_program_data_size( fd_bpf_upgradeable_loader_state_program_data_t const * self ) {
16367 0 : ulong size = 0;
16368 0 : size += sizeof(ulong);
16369 0 : size += sizeof(char);
16370 0 : if( NULL != self->upgrade_authority_address ) {
16371 0 : size += fd_pubkey_size( self->upgrade_authority_address );
16372 0 : }
16373 0 : return size;
16374 0 : }
16375 :
16376 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_uninitialized(fd_bpf_upgradeable_loader_state_t const * self) {
16377 0 : return self->discriminant == 0;
16378 0 : }
16379 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_buffer(fd_bpf_upgradeable_loader_state_t const * self) {
16380 0 : return self->discriminant == 1;
16381 0 : }
16382 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program(fd_bpf_upgradeable_loader_state_t const * self) {
16383 0 : return self->discriminant == 2;
16384 0 : }
16385 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program_data(fd_bpf_upgradeable_loader_state_t const * self) {
16386 0 : return self->discriminant == 3;
16387 0 : }
16388 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant );
16389 0 : int fd_bpf_upgradeable_loader_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16390 0 : int err;
16391 0 : switch (discriminant) {
16392 0 : case 0: {
16393 0 : return FD_BINCODE_SUCCESS;
16394 0 : }
16395 0 : case 1: {
16396 0 : err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
16397 0 : if( FD_UNLIKELY( err ) ) return err;
16398 0 : return FD_BINCODE_SUCCESS;
16399 0 : }
16400 0 : case 2: {
16401 0 : err = fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( ctx, total_sz );
16402 0 : if( FD_UNLIKELY( err ) ) return err;
16403 0 : return FD_BINCODE_SUCCESS;
16404 0 : }
16405 0 : case 3: {
16406 0 : err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
16407 0 : if( FD_UNLIKELY( err ) ) return err;
16408 0 : return FD_BINCODE_SUCCESS;
16409 0 : }
16410 0 : default: return FD_BINCODE_ERR_ENCODING;
16411 0 : }
16412 0 : }
16413 0 : static int fd_bpf_upgradeable_loader_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16414 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16415 0 : uint discriminant = 0;
16416 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
16417 0 : if( FD_UNLIKELY( err ) ) return err;
16418 0 : return fd_bpf_upgradeable_loader_state_inner_decode_footprint( discriminant, ctx, total_sz );
16419 0 : }
16420 0 : int fd_bpf_upgradeable_loader_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16421 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_t);
16422 0 : void const * start_data = ctx->data;
16423 0 : int err = fd_bpf_upgradeable_loader_state_decode_footprint_inner( ctx, total_sz );
16424 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16425 0 : ctx->data = start_data;
16426 0 : return err;
16427 0 : }
16428 0 : static void fd_bpf_upgradeable_loader_state_inner_decode_inner( fd_bpf_upgradeable_loader_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
16429 0 : switch (discriminant) {
16430 0 : case 0: {
16431 0 : break;
16432 0 : }
16433 0 : case 1: {
16434 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( &self->buffer, alloc_mem, ctx );
16435 0 : break;
16436 0 : }
16437 0 : case 2: {
16438 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( &self->program, alloc_mem, ctx );
16439 0 : break;
16440 0 : }
16441 0 : case 3: {
16442 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( &self->program_data, alloc_mem, ctx );
16443 0 : break;
16444 0 : }
16445 0 : }
16446 0 : }
16447 0 : static void fd_bpf_upgradeable_loader_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16448 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)struct_mem;
16449 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16450 0 : fd_bpf_upgradeable_loader_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
16451 0 : }
16452 0 : void * fd_bpf_upgradeable_loader_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16453 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)mem;
16454 0 : fd_bpf_upgradeable_loader_state_new( self );
16455 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_t);
16456 0 : void * * alloc_mem = &alloc_region;
16457 0 : fd_bpf_upgradeable_loader_state_decode_inner( mem, alloc_mem, ctx );
16458 0 : return self;
16459 0 : }
16460 0 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
16461 0 : switch( discriminant ) {
16462 0 : case 0: {
16463 0 : break;
16464 0 : }
16465 0 : case 1: {
16466 0 : fd_bpf_upgradeable_loader_state_buffer_new( &self->buffer );
16467 0 : break;
16468 0 : }
16469 0 : case 2: {
16470 0 : fd_bpf_upgradeable_loader_state_program_new( &self->program );
16471 0 : break;
16472 0 : }
16473 0 : case 3: {
16474 0 : fd_bpf_upgradeable_loader_state_program_data_new( &self->program_data );
16475 0 : break;
16476 0 : }
16477 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
16478 0 : }
16479 0 : }
16480 0 : void fd_bpf_upgradeable_loader_state_new_disc( fd_bpf_upgradeable_loader_state_t * self, uint discriminant ) {
16481 0 : self->discriminant = discriminant;
16482 0 : fd_bpf_upgradeable_loader_state_inner_new( &self->inner, self->discriminant );
16483 0 : }
16484 0 : void fd_bpf_upgradeable_loader_state_new( fd_bpf_upgradeable_loader_state_t * self ) {
16485 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_t) );
16486 0 : fd_bpf_upgradeable_loader_state_new_disc( self, UINT_MAX );
16487 0 : }
16488 :
16489 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, uint varint ) {
16490 0 : (void) varint;
16491 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_state", level++, 0);
16492 0 : switch( self->discriminant ) {
16493 0 : case 0: {
16494 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16495 0 : break;
16496 0 : }
16497 0 : case 1: {
16498 0 : fun( w, self, "buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16499 0 : fd_bpf_upgradeable_loader_state_buffer_walk( w, &self->inner.buffer, fun, "buffer", level, 0 );
16500 0 : break;
16501 0 : }
16502 0 : case 2: {
16503 0 : fun( w, self, "program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16504 0 : fd_bpf_upgradeable_loader_state_program_walk( w, &self->inner.program, fun, "program", level, 0 );
16505 0 : break;
16506 0 : }
16507 0 : case 3: {
16508 0 : fun( w, self, "program_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16509 0 : fd_bpf_upgradeable_loader_state_program_data_walk( w, &self->inner.program_data, fun, "program_data", level, 0 );
16510 0 : break;
16511 0 : }
16512 0 : }
16513 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_state", level--, 0 );
16514 0 : }
16515 0 : ulong fd_bpf_upgradeable_loader_state_size( fd_bpf_upgradeable_loader_state_t const * self ) {
16516 0 : ulong size = 0;
16517 0 : size += sizeof(uint);
16518 0 : switch (self->discriminant) {
16519 0 : case 1: {
16520 0 : size += fd_bpf_upgradeable_loader_state_buffer_size( &self->inner.buffer );
16521 0 : break;
16522 0 : }
16523 0 : case 2: {
16524 0 : size += fd_bpf_upgradeable_loader_state_program_size( &self->inner.program );
16525 0 : break;
16526 0 : }
16527 0 : case 3: {
16528 0 : size += fd_bpf_upgradeable_loader_state_program_data_size( &self->inner.program_data );
16529 0 : break;
16530 0 : }
16531 0 : }
16532 0 : return size;
16533 0 : }
16534 :
16535 0 : 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 ) {
16536 0 : int err;
16537 0 : switch (discriminant) {
16538 0 : case 1: {
16539 0 : err = fd_bpf_upgradeable_loader_state_buffer_encode( &self->buffer, ctx );
16540 0 : if( FD_UNLIKELY( err ) ) return err;
16541 0 : break;
16542 0 : }
16543 0 : case 2: {
16544 0 : err = fd_bpf_upgradeable_loader_state_program_encode( &self->program, ctx );
16545 0 : if( FD_UNLIKELY( err ) ) return err;
16546 0 : break;
16547 0 : }
16548 0 : case 3: {
16549 0 : err = fd_bpf_upgradeable_loader_state_program_data_encode( &self->program_data, ctx );
16550 0 : if( FD_UNLIKELY( err ) ) return err;
16551 0 : break;
16552 0 : }
16553 0 : }
16554 0 : return FD_BINCODE_SUCCESS;
16555 0 : }
16556 0 : int fd_bpf_upgradeable_loader_state_encode( fd_bpf_upgradeable_loader_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16557 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
16558 0 : if( FD_UNLIKELY( err ) ) return err;
16559 0 : return fd_bpf_upgradeable_loader_state_inner_encode( &self->inner, self->discriminant, ctx );
16560 0 : }
16561 :
16562 0 : int fd_loader_v4_state_encode( fd_loader_v4_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16563 0 : int err;
16564 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
16565 0 : if( FD_UNLIKELY( err ) ) return err;
16566 0 : err = fd_pubkey_encode( &self->authority_address_or_next_version, ctx );
16567 0 : if( FD_UNLIKELY( err ) ) return err;
16568 0 : err = fd_bincode_uint64_encode( self->status, ctx );
16569 0 : if( FD_UNLIKELY( err ) ) return err;
16570 0 : return FD_BINCODE_SUCCESS;
16571 0 : }
16572 0 : static inline int fd_loader_v4_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16573 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16574 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
16575 0 : return 0;
16576 0 : }
16577 0 : static void fd_loader_v4_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16578 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)struct_mem;
16579 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
16580 0 : fd_pubkey_decode_inner( &self->authority_address_or_next_version, alloc_mem, ctx );
16581 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
16582 0 : }
16583 0 : void * fd_loader_v4_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16584 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)mem;
16585 0 : fd_loader_v4_state_new( self );
16586 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_state_t);
16587 0 : void * * alloc_mem = &alloc_region;
16588 0 : fd_loader_v4_state_decode_inner( mem, alloc_mem, ctx );
16589 0 : return self;
16590 0 : }
16591 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, uint varint ) {
16592 0 : (void) varint;
16593 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_state", level++, 0 );
16594 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16595 0 : fd_pubkey_walk( w, &self->authority_address_or_next_version, fun, "authority_address_or_next_version", level, 0 );
16596 0 : fun( w, &self->status, "status", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16597 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_state", level--, 0 );
16598 0 : }
16599 0 : int fd_frozen_hash_status_encode( fd_frozen_hash_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16600 0 : int err;
16601 0 : err = fd_hash_encode( &self->frozen_hash, ctx );
16602 0 : if( FD_UNLIKELY( err ) ) return err;
16603 0 : err = fd_bincode_bool_encode( (uchar)(self->is_duplicate_confirmed), ctx );
16604 0 : if( FD_UNLIKELY( err ) ) return err;
16605 0 : return FD_BINCODE_SUCCESS;
16606 0 : }
16607 0 : static int fd_frozen_hash_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16608 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16609 0 : int err = 0;
16610 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
16611 0 : if( FD_UNLIKELY( err ) ) return err;
16612 0 : err = fd_bincode_bool_decode_footprint( ctx );
16613 0 : if( FD_UNLIKELY( err ) ) return err;
16614 0 : return 0;
16615 0 : }
16616 0 : int fd_frozen_hash_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16617 0 : *total_sz += sizeof(fd_frozen_hash_status_t);
16618 0 : void const * start_data = ctx->data;
16619 0 : int err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
16620 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16621 0 : ctx->data = start_data;
16622 0 : return err;
16623 0 : }
16624 0 : static void fd_frozen_hash_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16625 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)struct_mem;
16626 0 : fd_hash_decode_inner( &self->frozen_hash, alloc_mem, ctx );
16627 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
16628 0 : }
16629 0 : void * fd_frozen_hash_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16630 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)mem;
16631 0 : fd_frozen_hash_status_new( self );
16632 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_status_t);
16633 0 : void * * alloc_mem = &alloc_region;
16634 0 : fd_frozen_hash_status_decode_inner( mem, alloc_mem, ctx );
16635 0 : return self;
16636 0 : }
16637 0 : void fd_frozen_hash_status_new(fd_frozen_hash_status_t * self) {
16638 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_status_t) );
16639 0 : fd_hash_new( &self->frozen_hash );
16640 0 : }
16641 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, uint varint ) {
16642 0 : (void) varint;
16643 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_frozen_hash_status", level++, 0 );
16644 0 : fd_hash_walk( w, &self->frozen_hash, fun, "frozen_hash", level, 0 );
16645 0 : fun( w, &self->is_duplicate_confirmed, "is_duplicate_confirmed", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
16646 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_frozen_hash_status", level--, 0 );
16647 0 : }
16648 0 : FD_FN_PURE uchar fd_frozen_hash_versioned_is_current(fd_frozen_hash_versioned_t const * self) {
16649 0 : return self->discriminant == 0;
16650 0 : }
16651 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant );
16652 0 : int fd_frozen_hash_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16653 0 : int err;
16654 0 : switch (discriminant) {
16655 0 : case 0: {
16656 0 : err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
16657 0 : if( FD_UNLIKELY( err ) ) return err;
16658 0 : return FD_BINCODE_SUCCESS;
16659 0 : }
16660 0 : default: return FD_BINCODE_ERR_ENCODING;
16661 0 : }
16662 0 : }
16663 0 : static int fd_frozen_hash_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16664 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16665 0 : uint discriminant = 0;
16666 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
16667 0 : if( FD_UNLIKELY( err ) ) return err;
16668 0 : return fd_frozen_hash_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
16669 0 : }
16670 0 : int fd_frozen_hash_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16671 0 : *total_sz += sizeof(fd_frozen_hash_versioned_t);
16672 0 : void const * start_data = ctx->data;
16673 0 : int err = fd_frozen_hash_versioned_decode_footprint_inner( ctx, total_sz );
16674 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16675 0 : ctx->data = start_data;
16676 0 : return err;
16677 0 : }
16678 0 : static void fd_frozen_hash_versioned_inner_decode_inner( fd_frozen_hash_versioned_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
16679 0 : switch (discriminant) {
16680 0 : case 0: {
16681 0 : fd_frozen_hash_status_decode_inner( &self->current, alloc_mem, ctx );
16682 0 : break;
16683 0 : }
16684 0 : }
16685 0 : }
16686 0 : static void fd_frozen_hash_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16687 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)struct_mem;
16688 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16689 0 : fd_frozen_hash_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
16690 0 : }
16691 0 : void * fd_frozen_hash_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16692 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)mem;
16693 0 : fd_frozen_hash_versioned_new( self );
16694 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_versioned_t);
16695 0 : void * * alloc_mem = &alloc_region;
16696 0 : fd_frozen_hash_versioned_decode_inner( mem, alloc_mem, ctx );
16697 0 : return self;
16698 0 : }
16699 0 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
16700 0 : switch( discriminant ) {
16701 0 : case 0: {
16702 0 : fd_frozen_hash_status_new( &self->current );
16703 0 : break;
16704 0 : }
16705 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
16706 0 : }
16707 0 : }
16708 0 : void fd_frozen_hash_versioned_new_disc( fd_frozen_hash_versioned_t * self, uint discriminant ) {
16709 0 : self->discriminant = discriminant;
16710 0 : fd_frozen_hash_versioned_inner_new( &self->inner, self->discriminant );
16711 0 : }
16712 0 : void fd_frozen_hash_versioned_new( fd_frozen_hash_versioned_t * self ) {
16713 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_versioned_t) );
16714 0 : fd_frozen_hash_versioned_new_disc( self, UINT_MAX );
16715 0 : }
16716 :
16717 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, uint varint ) {
16718 0 : (void) varint;
16719 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_frozen_hash_versioned", level++, 0);
16720 0 : switch( self->discriminant ) {
16721 0 : case 0: {
16722 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16723 0 : fd_frozen_hash_status_walk( w, &self->inner.current, fun, "current", level, 0 );
16724 0 : break;
16725 0 : }
16726 0 : }
16727 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_frozen_hash_versioned", level--, 0 );
16728 0 : }
16729 0 : ulong fd_frozen_hash_versioned_size( fd_frozen_hash_versioned_t const * self ) {
16730 0 : ulong size = 0;
16731 0 : size += sizeof(uint);
16732 0 : switch (self->discriminant) {
16733 0 : case 0: {
16734 0 : size += fd_frozen_hash_status_size( &self->inner.current );
16735 0 : break;
16736 0 : }
16737 0 : }
16738 0 : return size;
16739 0 : }
16740 :
16741 0 : int fd_frozen_hash_versioned_inner_encode( fd_frozen_hash_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
16742 0 : int err;
16743 0 : switch (discriminant) {
16744 0 : case 0: {
16745 0 : err = fd_frozen_hash_status_encode( &self->current, ctx );
16746 0 : if( FD_UNLIKELY( err ) ) return err;
16747 0 : break;
16748 0 : }
16749 0 : }
16750 0 : return FD_BINCODE_SUCCESS;
16751 0 : }
16752 0 : int fd_frozen_hash_versioned_encode( fd_frozen_hash_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16753 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
16754 0 : if( FD_UNLIKELY( err ) ) return err;
16755 0 : return fd_frozen_hash_versioned_inner_encode( &self->inner, self->discriminant, ctx );
16756 0 : }
16757 :
16758 0 : int fd_lookup_table_meta_encode( fd_lookup_table_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16759 0 : int err;
16760 0 : err = fd_bincode_uint64_encode( self->deactivation_slot, ctx );
16761 0 : if( FD_UNLIKELY( err ) ) return err;
16762 0 : err = fd_bincode_uint64_encode( self->last_extended_slot, ctx );
16763 0 : if( FD_UNLIKELY( err ) ) return err;
16764 0 : err = fd_bincode_uint8_encode( (uchar)(self->last_extended_slot_start_index), ctx );
16765 0 : if( FD_UNLIKELY( err ) ) return err;
16766 0 : err = fd_bincode_bool_encode( self->has_authority, ctx );
16767 0 : if( FD_UNLIKELY( err ) ) return err;
16768 0 : if( self->has_authority ) {
16769 0 : err = fd_pubkey_encode( &self->authority, ctx );
16770 0 : if( FD_UNLIKELY( err ) ) return err;
16771 0 : }
16772 0 : err = fd_bincode_uint16_encode( self->_padding, ctx );
16773 0 : if( FD_UNLIKELY( err ) ) return err;
16774 0 : return FD_BINCODE_SUCCESS;
16775 0 : }
16776 0 : static int fd_lookup_table_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16777 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16778 0 : int err = 0;
16779 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16780 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16781 0 : err = fd_bincode_uint64_decode_footprint( ctx );
16782 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16783 0 : err = fd_bincode_uint8_decode_footprint( ctx );
16784 0 : if( FD_UNLIKELY( err ) ) return err;
16785 0 : {
16786 0 : uchar o;
16787 0 : err = fd_bincode_bool_decode( &o, ctx );
16788 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16789 0 : if( o ) {
16790 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
16791 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16792 0 : }
16793 0 : }
16794 0 : err = fd_bincode_uint16_decode_footprint( ctx );
16795 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
16796 0 : return 0;
16797 0 : }
16798 0 : int fd_lookup_table_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16799 0 : *total_sz += sizeof(fd_lookup_table_meta_t);
16800 0 : void const * start_data = ctx->data;
16801 0 : int err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
16802 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16803 0 : ctx->data = start_data;
16804 0 : return err;
16805 0 : }
16806 0 : static void fd_lookup_table_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16807 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)struct_mem;
16808 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
16809 0 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
16810 0 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
16811 0 : {
16812 0 : uchar o;
16813 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
16814 0 : self->has_authority = !!o;
16815 0 : if( o ) {
16816 0 : fd_pubkey_new( &self->authority );
16817 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
16818 0 : }
16819 0 : }
16820 0 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
16821 0 : }
16822 0 : void * fd_lookup_table_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16823 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)mem;
16824 0 : fd_lookup_table_meta_new( self );
16825 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lookup_table_meta_t);
16826 0 : void * * alloc_mem = &alloc_region;
16827 0 : fd_lookup_table_meta_decode_inner( mem, alloc_mem, ctx );
16828 0 : return self;
16829 0 : }
16830 0 : void fd_lookup_table_meta_new(fd_lookup_table_meta_t * self) {
16831 0 : fd_memset( self, 0, sizeof(fd_lookup_table_meta_t) );
16832 0 : }
16833 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, uint varint ) {
16834 0 : (void) varint;
16835 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lookup_table_meta", level++, 0 );
16836 0 : fun( w, &self->deactivation_slot, "deactivation_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16837 0 : fun( w, &self->last_extended_slot, "last_extended_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16838 0 : fun( w, &self->last_extended_slot_start_index, "last_extended_slot_start_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
16839 0 : if( !self->has_authority ) {
16840 0 : fun( w, NULL, "authority", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
16841 0 : } else {
16842 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level, 0 );
16843 0 : }
16844 0 : fun( w, &self->_padding, "_padding", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
16845 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lookup_table_meta", level--, 0 );
16846 0 : }
16847 0 : ulong fd_lookup_table_meta_size( fd_lookup_table_meta_t const * self ) {
16848 0 : ulong size = 0;
16849 0 : size += sizeof(ulong);
16850 0 : size += sizeof(ulong);
16851 0 : size += sizeof(char);
16852 0 : size += sizeof(char);
16853 0 : if( self->has_authority ) {
16854 0 : size += fd_pubkey_size( &self->authority );
16855 0 : }
16856 0 : size += sizeof(ushort);
16857 0 : return size;
16858 0 : }
16859 :
16860 0 : int fd_address_lookup_table_encode( fd_address_lookup_table_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16861 0 : int err;
16862 0 : err = fd_lookup_table_meta_encode( &self->meta, ctx );
16863 0 : if( FD_UNLIKELY( err ) ) return err;
16864 0 : return FD_BINCODE_SUCCESS;
16865 0 : }
16866 0 : static int fd_address_lookup_table_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16867 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16868 0 : int err = 0;
16869 0 : err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
16870 0 : if( FD_UNLIKELY( err ) ) return err;
16871 0 : return 0;
16872 0 : }
16873 0 : int fd_address_lookup_table_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16874 0 : *total_sz += sizeof(fd_address_lookup_table_t);
16875 0 : void const * start_data = ctx->data;
16876 0 : int err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
16877 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16878 0 : ctx->data = start_data;
16879 0 : return err;
16880 0 : }
16881 0 : static void fd_address_lookup_table_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16882 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)struct_mem;
16883 0 : fd_lookup_table_meta_decode_inner( &self->meta, alloc_mem, ctx );
16884 0 : }
16885 0 : void * fd_address_lookup_table_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16886 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)mem;
16887 0 : fd_address_lookup_table_new( self );
16888 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_t);
16889 0 : void * * alloc_mem = &alloc_region;
16890 0 : fd_address_lookup_table_decode_inner( mem, alloc_mem, ctx );
16891 0 : return self;
16892 0 : }
16893 0 : void fd_address_lookup_table_new(fd_address_lookup_table_t * self) {
16894 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_t) );
16895 0 : fd_lookup_table_meta_new( &self->meta );
16896 0 : }
16897 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, uint varint ) {
16898 0 : (void) varint;
16899 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_address_lookup_table", level++, 0 );
16900 0 : fd_lookup_table_meta_walk( w, &self->meta, fun, "meta", level, 0 );
16901 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_address_lookup_table", level--, 0 );
16902 0 : }
16903 0 : ulong fd_address_lookup_table_size( fd_address_lookup_table_t const * self ) {
16904 0 : ulong size = 0;
16905 0 : size += fd_lookup_table_meta_size( &self->meta );
16906 0 : return size;
16907 0 : }
16908 :
16909 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_uninitialized(fd_address_lookup_table_state_t const * self) {
16910 0 : return self->discriminant == 0;
16911 0 : }
16912 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_lookup_table(fd_address_lookup_table_state_t const * self) {
16913 0 : return self->discriminant == 1;
16914 0 : }
16915 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant );
16916 0 : int fd_address_lookup_table_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16917 0 : int err;
16918 0 : switch (discriminant) {
16919 0 : case 0: {
16920 0 : return FD_BINCODE_SUCCESS;
16921 0 : }
16922 0 : case 1: {
16923 0 : err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
16924 0 : if( FD_UNLIKELY( err ) ) return err;
16925 0 : return FD_BINCODE_SUCCESS;
16926 0 : }
16927 0 : default: return FD_BINCODE_ERR_ENCODING;
16928 0 : }
16929 0 : }
16930 0 : static int fd_address_lookup_table_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16931 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16932 0 : uint discriminant = 0;
16933 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
16934 0 : if( FD_UNLIKELY( err ) ) return err;
16935 0 : return fd_address_lookup_table_state_inner_decode_footprint( discriminant, ctx, total_sz );
16936 0 : }
16937 0 : int fd_address_lookup_table_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16938 0 : *total_sz += sizeof(fd_address_lookup_table_state_t);
16939 0 : void const * start_data = ctx->data;
16940 0 : int err = fd_address_lookup_table_state_decode_footprint_inner( ctx, total_sz );
16941 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16942 0 : ctx->data = start_data;
16943 0 : return err;
16944 0 : }
16945 0 : static void fd_address_lookup_table_state_inner_decode_inner( fd_address_lookup_table_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
16946 0 : switch (discriminant) {
16947 0 : case 0: {
16948 0 : break;
16949 0 : }
16950 0 : case 1: {
16951 0 : fd_address_lookup_table_decode_inner( &self->lookup_table, alloc_mem, ctx );
16952 0 : break;
16953 0 : }
16954 0 : }
16955 0 : }
16956 0 : static void fd_address_lookup_table_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16957 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)struct_mem;
16958 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16959 0 : fd_address_lookup_table_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
16960 0 : }
16961 0 : void * fd_address_lookup_table_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16962 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)mem;
16963 0 : fd_address_lookup_table_state_new( self );
16964 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_state_t);
16965 0 : void * * alloc_mem = &alloc_region;
16966 0 : fd_address_lookup_table_state_decode_inner( mem, alloc_mem, ctx );
16967 0 : return self;
16968 0 : }
16969 0 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
16970 0 : switch( discriminant ) {
16971 0 : case 0: {
16972 0 : break;
16973 0 : }
16974 0 : case 1: {
16975 0 : fd_address_lookup_table_new( &self->lookup_table );
16976 0 : break;
16977 0 : }
16978 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
16979 0 : }
16980 0 : }
16981 0 : void fd_address_lookup_table_state_new_disc( fd_address_lookup_table_state_t * self, uint discriminant ) {
16982 0 : self->discriminant = discriminant;
16983 0 : fd_address_lookup_table_state_inner_new( &self->inner, self->discriminant );
16984 0 : }
16985 0 : void fd_address_lookup_table_state_new( fd_address_lookup_table_state_t * self ) {
16986 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_state_t) );
16987 0 : fd_address_lookup_table_state_new_disc( self, UINT_MAX );
16988 0 : }
16989 :
16990 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, uint varint ) {
16991 0 : (void) varint;
16992 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_address_lookup_table_state", level++, 0);
16993 0 : switch( self->discriminant ) {
16994 0 : case 0: {
16995 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16996 0 : break;
16997 0 : }
16998 0 : case 1: {
16999 0 : fun( w, self, "lookup_table", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17000 0 : fd_address_lookup_table_walk( w, &self->inner.lookup_table, fun, "lookup_table", level, 0 );
17001 0 : break;
17002 0 : }
17003 0 : }
17004 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_address_lookup_table_state", level--, 0 );
17005 0 : }
17006 0 : ulong fd_address_lookup_table_state_size( fd_address_lookup_table_state_t const * self ) {
17007 0 : ulong size = 0;
17008 0 : size += sizeof(uint);
17009 0 : switch (self->discriminant) {
17010 0 : case 1: {
17011 0 : size += fd_address_lookup_table_size( &self->inner.lookup_table );
17012 0 : break;
17013 0 : }
17014 0 : }
17015 0 : return size;
17016 0 : }
17017 :
17018 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 ) {
17019 0 : int err;
17020 0 : switch (discriminant) {
17021 0 : case 1: {
17022 0 : err = fd_address_lookup_table_encode( &self->lookup_table, ctx );
17023 0 : if( FD_UNLIKELY( err ) ) return err;
17024 0 : break;
17025 0 : }
17026 0 : }
17027 0 : return FD_BINCODE_SUCCESS;
17028 0 : }
17029 0 : int fd_address_lookup_table_state_encode( fd_address_lookup_table_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17030 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
17031 0 : if( FD_UNLIKELY( err ) ) return err;
17032 0 : return fd_address_lookup_table_state_inner_encode( &self->inner, self->discriminant, ctx );
17033 0 : }
17034 :
17035 0 : int fd_gossip_ping_encode( fd_gossip_ping_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17036 0 : int err;
17037 0 : err = fd_pubkey_encode( &self->from, ctx );
17038 0 : if( FD_UNLIKELY( err ) ) return err;
17039 0 : err = fd_hash_encode( &self->token, ctx );
17040 0 : if( FD_UNLIKELY( err ) ) return err;
17041 0 : err = fd_signature_encode( &self->signature, ctx );
17042 0 : if( FD_UNLIKELY( err ) ) return err;
17043 0 : return FD_BINCODE_SUCCESS;
17044 0 : }
17045 3 : static inline int fd_gossip_ping_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17046 3 : if( (ulong)ctx->data + 128UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17047 3 : ctx->data = (void *)( (ulong)ctx->data + 128UL );
17048 3 : return 0;
17049 3 : }
17050 3 : static void fd_gossip_ping_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17051 3 : fd_gossip_ping_t * self = (fd_gossip_ping_t *)struct_mem;
17052 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
17053 3 : fd_hash_decode_inner( &self->token, alloc_mem, ctx );
17054 3 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
17055 3 : }
17056 0 : void * fd_gossip_ping_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17057 0 : fd_gossip_ping_t * self = (fd_gossip_ping_t *)mem;
17058 0 : fd_gossip_ping_new( self );
17059 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_ping_t);
17060 0 : void * * alloc_mem = &alloc_region;
17061 0 : fd_gossip_ping_decode_inner( mem, alloc_mem, ctx );
17062 0 : return self;
17063 0 : }
17064 3 : void fd_gossip_ping_walk( void * w, fd_gossip_ping_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
17065 3 : (void) varint;
17066 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_ping", level++, 0 );
17067 3 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
17068 3 : fd_hash_walk( w, &self->token, fun, "token", level, 0 );
17069 3 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
17070 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_ping", level--, 0 );
17071 3 : }
17072 0 : FD_FN_PURE uchar fd_gossip_ip_addr_is_ip4(fd_gossip_ip_addr_t const * self) {
17073 0 : return self->discriminant == 0;
17074 0 : }
17075 0 : FD_FN_PURE uchar fd_gossip_ip_addr_is_ip6(fd_gossip_ip_addr_t const * self) {
17076 0 : return self->discriminant == 1;
17077 0 : }
17078 : void fd_gossip_ip_addr_inner_new( fd_gossip_ip_addr_inner_t * self, uint discriminant );
17079 3 : int fd_gossip_ip_addr_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17080 3 : int err;
17081 3 : switch (discriminant) {
17082 3 : case 0: {
17083 3 : err = fd_gossip_ip4_addr_decode_footprint_inner( ctx, total_sz );
17084 3 : if( FD_UNLIKELY( err ) ) return err;
17085 3 : return FD_BINCODE_SUCCESS;
17086 3 : }
17087 0 : case 1: {
17088 0 : err = fd_gossip_ip6_addr_decode_footprint_inner( ctx, total_sz );
17089 0 : if( FD_UNLIKELY( err ) ) return err;
17090 0 : return FD_BINCODE_SUCCESS;
17091 0 : }
17092 0 : default: return FD_BINCODE_ERR_ENCODING;
17093 3 : }
17094 3 : }
17095 3 : static int fd_gossip_ip_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17096 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17097 3 : uint discriminant = 0;
17098 3 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
17099 3 : if( FD_UNLIKELY( err ) ) return err;
17100 3 : return fd_gossip_ip_addr_inner_decode_footprint( discriminant, ctx, total_sz );
17101 3 : }
17102 0 : int fd_gossip_ip_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17103 0 : *total_sz += sizeof(fd_gossip_ip_addr_t);
17104 0 : void const * start_data = ctx->data;
17105 0 : int err = fd_gossip_ip_addr_decode_footprint_inner( ctx, total_sz );
17106 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17107 0 : ctx->data = start_data;
17108 0 : return err;
17109 0 : }
17110 3 : static void fd_gossip_ip_addr_inner_decode_inner( fd_gossip_ip_addr_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17111 3 : switch (discriminant) {
17112 3 : case 0: {
17113 3 : fd_gossip_ip4_addr_decode_inner( &self->ip4, alloc_mem, ctx );
17114 3 : break;
17115 0 : }
17116 0 : case 1: {
17117 0 : fd_gossip_ip6_addr_decode_inner( &self->ip6, alloc_mem, ctx );
17118 0 : break;
17119 0 : }
17120 3 : }
17121 3 : }
17122 3 : static void fd_gossip_ip_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17123 3 : fd_gossip_ip_addr_t * self = (fd_gossip_ip_addr_t *)struct_mem;
17124 3 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
17125 3 : fd_gossip_ip_addr_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
17126 3 : }
17127 0 : void * fd_gossip_ip_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17128 0 : fd_gossip_ip_addr_t * self = (fd_gossip_ip_addr_t *)mem;
17129 0 : fd_gossip_ip_addr_new( self );
17130 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_ip_addr_t);
17131 0 : void * * alloc_mem = &alloc_region;
17132 0 : fd_gossip_ip_addr_decode_inner( mem, alloc_mem, ctx );
17133 0 : return self;
17134 0 : }
17135 3 : void fd_gossip_ip_addr_inner_new( fd_gossip_ip_addr_inner_t * self, uint discriminant ) {
17136 3 : switch( discriminant ) {
17137 0 : case 0: {
17138 0 : fd_gossip_ip4_addr_new( &self->ip4 );
17139 0 : break;
17140 0 : }
17141 0 : case 1: {
17142 0 : fd_gossip_ip6_addr_new( &self->ip6 );
17143 0 : break;
17144 0 : }
17145 3 : default: break; // FD_LOG_ERR(( "unhandled type"));
17146 3 : }
17147 3 : }
17148 3 : void fd_gossip_ip_addr_new_disc( fd_gossip_ip_addr_t * self, uint discriminant ) {
17149 3 : self->discriminant = discriminant;
17150 3 : fd_gossip_ip_addr_inner_new( &self->inner, self->discriminant );
17151 3 : }
17152 3 : void fd_gossip_ip_addr_new( fd_gossip_ip_addr_t * self ) {
17153 3 : fd_memset( self, 0, sizeof(fd_gossip_ip_addr_t) );
17154 3 : fd_gossip_ip_addr_new_disc( self, UINT_MAX );
17155 3 : }
17156 :
17157 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, uint varint ) {
17158 3 : (void) varint;
17159 3 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_ip_addr", level++, 0);
17160 3 : switch( self->discriminant ) {
17161 3 : case 0: {
17162 3 : fun( w, self, "ip4", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17163 3 : fd_gossip_ip4_addr_walk( w, &self->inner.ip4, fun, "ip4", level, 0 );
17164 3 : break;
17165 0 : }
17166 0 : case 1: {
17167 0 : fun( w, self, "ip6", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17168 0 : fd_gossip_ip6_addr_walk( w, &self->inner.ip6, fun, "ip6", level, 0 );
17169 0 : break;
17170 0 : }
17171 3 : }
17172 3 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_ip_addr", level--, 0 );
17173 3 : }
17174 0 : ulong fd_gossip_ip_addr_size( fd_gossip_ip_addr_t const * self ) {
17175 0 : ulong size = 0;
17176 0 : size += sizeof(uint);
17177 0 : switch (self->discriminant) {
17178 0 : case 0: {
17179 0 : size += fd_gossip_ip4_addr_size( &self->inner.ip4 );
17180 0 : break;
17181 0 : }
17182 0 : case 1: {
17183 0 : size += fd_gossip_ip6_addr_size( &self->inner.ip6 );
17184 0 : break;
17185 0 : }
17186 0 : }
17187 0 : return size;
17188 0 : }
17189 :
17190 0 : int fd_gossip_ip_addr_inner_encode( fd_gossip_ip_addr_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
17191 0 : int err;
17192 0 : switch (discriminant) {
17193 0 : case 0: {
17194 0 : err = fd_gossip_ip4_addr_encode( &self->ip4, ctx );
17195 0 : if( FD_UNLIKELY( err ) ) return err;
17196 0 : break;
17197 0 : }
17198 0 : case 1: {
17199 0 : err = fd_gossip_ip6_addr_encode( &self->ip6, ctx );
17200 0 : if( FD_UNLIKELY( err ) ) return err;
17201 0 : break;
17202 0 : }
17203 0 : }
17204 0 : return FD_BINCODE_SUCCESS;
17205 0 : }
17206 0 : int fd_gossip_ip_addr_encode( fd_gossip_ip_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17207 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
17208 0 : if( FD_UNLIKELY( err ) ) return err;
17209 0 : return fd_gossip_ip_addr_inner_encode( &self->inner, self->discriminant, ctx );
17210 0 : }
17211 :
17212 0 : int fd_gossip_prune_data_encode( fd_gossip_prune_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17213 0 : int err;
17214 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
17215 0 : if( FD_UNLIKELY( err ) ) return err;
17216 0 : err = fd_bincode_uint64_encode( self->prunes_len, ctx );
17217 0 : if( FD_UNLIKELY(err) ) return err;
17218 0 : if( self->prunes_len ) {
17219 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
17220 0 : err = fd_pubkey_encode( self->prunes + i, ctx );
17221 0 : if( FD_UNLIKELY( err ) ) return err;
17222 0 : }
17223 0 : }
17224 0 : err = fd_signature_encode( &self->signature, ctx );
17225 0 : if( FD_UNLIKELY( err ) ) return err;
17226 0 : err = fd_pubkey_encode( &self->destination, ctx );
17227 0 : if( FD_UNLIKELY( err ) ) return err;
17228 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
17229 0 : if( FD_UNLIKELY( err ) ) return err;
17230 0 : return FD_BINCODE_SUCCESS;
17231 0 : }
17232 0 : static int fd_gossip_prune_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17233 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17234 0 : int err = 0;
17235 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17236 0 : if( FD_UNLIKELY( err ) ) return err;
17237 0 : ulong prunes_len;
17238 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
17239 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17240 0 : if( prunes_len ) {
17241 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*prunes_len;
17242 0 : for( ulong i=0; i < prunes_len; i++ ) {
17243 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17244 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17245 0 : }
17246 0 : }
17247 0 : err = fd_signature_decode_footprint_inner( ctx, total_sz );
17248 0 : if( FD_UNLIKELY( err ) ) return err;
17249 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17250 0 : if( FD_UNLIKELY( err ) ) return err;
17251 0 : err = fd_bincode_uint64_decode_footprint( ctx );
17252 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17253 0 : return 0;
17254 0 : }
17255 0 : int fd_gossip_prune_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17256 0 : *total_sz += sizeof(fd_gossip_prune_data_t);
17257 0 : void const * start_data = ctx->data;
17258 0 : int err = fd_gossip_prune_data_decode_footprint_inner( ctx, total_sz );
17259 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17260 0 : ctx->data = start_data;
17261 0 : return err;
17262 0 : }
17263 0 : static void fd_gossip_prune_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17264 0 : fd_gossip_prune_data_t * self = (fd_gossip_prune_data_t *)struct_mem;
17265 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
17266 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
17267 0 : if( self->prunes_len ) {
17268 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
17269 0 : self->prunes = *alloc_mem;
17270 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->prunes_len;
17271 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
17272 0 : fd_pubkey_new( self->prunes + i );
17273 0 : fd_pubkey_decode_inner( self->prunes + i, alloc_mem, ctx );
17274 0 : }
17275 0 : } else
17276 0 : self->prunes = NULL;
17277 0 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
17278 0 : fd_pubkey_decode_inner( &self->destination, alloc_mem, ctx );
17279 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
17280 0 : }
17281 0 : void * fd_gossip_prune_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17282 0 : fd_gossip_prune_data_t * self = (fd_gossip_prune_data_t *)mem;
17283 0 : fd_gossip_prune_data_new( self );
17284 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_data_t);
17285 0 : void * * alloc_mem = &alloc_region;
17286 0 : fd_gossip_prune_data_decode_inner( mem, alloc_mem, ctx );
17287 0 : return self;
17288 0 : }
17289 0 : void fd_gossip_prune_data_new(fd_gossip_prune_data_t * self) {
17290 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_data_t) );
17291 0 : fd_pubkey_new( &self->pubkey );
17292 0 : fd_signature_new( &self->signature );
17293 0 : fd_pubkey_new( &self->destination );
17294 0 : }
17295 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, uint varint ) {
17296 0 : (void) varint;
17297 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_data", level++, 0 );
17298 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
17299 0 : if( self->prunes_len ) {
17300 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
17301 0 : for( ulong i=0; i < self->prunes_len; i++ )
17302 0 : fd_pubkey_walk(w, self->prunes + i, fun, "pubkey", level, 0 );
17303 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
17304 0 : }
17305 0 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
17306 0 : fd_pubkey_walk( w, &self->destination, fun, "destination", level, 0 );
17307 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
17308 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_data", level--, 0 );
17309 0 : }
17310 0 : ulong fd_gossip_prune_data_size( fd_gossip_prune_data_t const * self ) {
17311 0 : ulong size = 0;
17312 0 : size += fd_pubkey_size( &self->pubkey );
17313 0 : do {
17314 0 : size += sizeof(ulong);
17315 0 : for( ulong i=0; i < self->prunes_len; i++ )
17316 0 : size += fd_pubkey_size( self->prunes + i );
17317 0 : } while(0);
17318 0 : size += fd_signature_size( &self->signature );
17319 0 : size += fd_pubkey_size( &self->destination );
17320 0 : size += sizeof(ulong);
17321 0 : return size;
17322 0 : }
17323 :
17324 0 : int fd_gossip_prune_sign_data_encode( fd_gossip_prune_sign_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17325 0 : int err;
17326 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
17327 0 : if( FD_UNLIKELY( err ) ) return err;
17328 0 : err = fd_bincode_uint64_encode( self->prunes_len, ctx );
17329 0 : if( FD_UNLIKELY(err) ) return err;
17330 0 : if( self->prunes_len ) {
17331 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
17332 0 : err = fd_pubkey_encode( self->prunes + i, ctx );
17333 0 : if( FD_UNLIKELY( err ) ) return err;
17334 0 : }
17335 0 : }
17336 0 : err = fd_pubkey_encode( &self->destination, ctx );
17337 0 : if( FD_UNLIKELY( err ) ) return err;
17338 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
17339 0 : if( FD_UNLIKELY( err ) ) return err;
17340 0 : return FD_BINCODE_SUCCESS;
17341 0 : }
17342 0 : static int fd_gossip_prune_sign_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17343 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17344 0 : int err = 0;
17345 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17346 0 : if( FD_UNLIKELY( err ) ) return err;
17347 0 : ulong prunes_len;
17348 0 : err = fd_bincode_uint64_decode( &prunes_len, ctx );
17349 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17350 0 : if( prunes_len ) {
17351 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*prunes_len;
17352 0 : for( ulong i=0; i < prunes_len; i++ ) {
17353 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17354 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17355 0 : }
17356 0 : }
17357 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17358 0 : if( FD_UNLIKELY( err ) ) return err;
17359 0 : err = fd_bincode_uint64_decode_footprint( ctx );
17360 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17361 0 : return 0;
17362 0 : }
17363 0 : int fd_gossip_prune_sign_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17364 0 : *total_sz += sizeof(fd_gossip_prune_sign_data_t);
17365 0 : void const * start_data = ctx->data;
17366 0 : int err = fd_gossip_prune_sign_data_decode_footprint_inner( ctx, total_sz );
17367 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17368 0 : ctx->data = start_data;
17369 0 : return err;
17370 0 : }
17371 0 : static void fd_gossip_prune_sign_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17372 0 : fd_gossip_prune_sign_data_t * self = (fd_gossip_prune_sign_data_t *)struct_mem;
17373 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
17374 0 : fd_bincode_uint64_decode_unsafe( &self->prunes_len, ctx );
17375 0 : if( self->prunes_len ) {
17376 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
17377 0 : self->prunes = *alloc_mem;
17378 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->prunes_len;
17379 0 : for( ulong i=0; i < self->prunes_len; i++ ) {
17380 0 : fd_pubkey_new( self->prunes + i );
17381 0 : fd_pubkey_decode_inner( self->prunes + i, alloc_mem, ctx );
17382 0 : }
17383 0 : } else
17384 0 : self->prunes = NULL;
17385 0 : fd_pubkey_decode_inner( &self->destination, alloc_mem, ctx );
17386 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
17387 0 : }
17388 0 : void * fd_gossip_prune_sign_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17389 0 : fd_gossip_prune_sign_data_t * self = (fd_gossip_prune_sign_data_t *)mem;
17390 0 : fd_gossip_prune_sign_data_new( self );
17391 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_sign_data_t);
17392 0 : void * * alloc_mem = &alloc_region;
17393 0 : fd_gossip_prune_sign_data_decode_inner( mem, alloc_mem, ctx );
17394 0 : return self;
17395 0 : }
17396 0 : void fd_gossip_prune_sign_data_new(fd_gossip_prune_sign_data_t * self) {
17397 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_sign_data_t) );
17398 0 : fd_pubkey_new( &self->pubkey );
17399 0 : fd_pubkey_new( &self->destination );
17400 0 : }
17401 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, uint varint ) {
17402 0 : (void) varint;
17403 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_sign_data", level++, 0 );
17404 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
17405 0 : if( self->prunes_len ) {
17406 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
17407 0 : for( ulong i=0; i < self->prunes_len; i++ )
17408 0 : fd_pubkey_walk(w, self->prunes + i, fun, "pubkey", level, 0 );
17409 0 : fun( w, NULL, "prunes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
17410 0 : }
17411 0 : fd_pubkey_walk( w, &self->destination, fun, "destination", level, 0 );
17412 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
17413 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_sign_data", level--, 0 );
17414 0 : }
17415 0 : ulong fd_gossip_prune_sign_data_size( fd_gossip_prune_sign_data_t const * self ) {
17416 0 : ulong size = 0;
17417 0 : size += fd_pubkey_size( &self->pubkey );
17418 0 : do {
17419 0 : size += sizeof(ulong);
17420 0 : for( ulong i=0; i < self->prunes_len; i++ )
17421 0 : size += fd_pubkey_size( self->prunes + i );
17422 0 : } while(0);
17423 0 : size += fd_pubkey_size( &self->destination );
17424 0 : size += sizeof(ulong);
17425 0 : return size;
17426 0 : }
17427 :
17428 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 ) {
17429 0 : int err;
17430 0 : err = fd_bincode_uint64_encode( self->prefix_len, ctx );
17431 0 : if( FD_UNLIKELY(err) ) return err;
17432 0 : if( self->prefix_len ) {
17433 0 : err = fd_bincode_bytes_encode( self->prefix, self->prefix_len, ctx );
17434 0 : if( FD_UNLIKELY( err ) ) return err;
17435 0 : }
17436 0 : err = fd_gossip_prune_sign_data_encode( &self->data, ctx );
17437 0 : if( FD_UNLIKELY( err ) ) return err;
17438 0 : return FD_BINCODE_SUCCESS;
17439 0 : }
17440 0 : static int fd_gossip_prune_sign_data_with_prefix_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17441 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17442 0 : int err = 0;
17443 0 : ulong prefix_len;
17444 0 : err = fd_bincode_uint64_decode( &prefix_len, ctx );
17445 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17446 0 : *total_sz += prefix_len;
17447 0 : if( prefix_len ) {
17448 0 : err = fd_bincode_bytes_decode_footprint( prefix_len, ctx );
17449 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17450 0 : err = !fd_utf8_verify( (char const *) ctx->data - prefix_len, prefix_len );
17451 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17452 0 : }
17453 0 : err = fd_gossip_prune_sign_data_decode_footprint_inner( ctx, total_sz );
17454 0 : if( FD_UNLIKELY( err ) ) return err;
17455 0 : return 0;
17456 0 : }
17457 0 : int fd_gossip_prune_sign_data_with_prefix_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17458 0 : *total_sz += sizeof(fd_gossip_prune_sign_data_with_prefix_t);
17459 0 : void const * start_data = ctx->data;
17460 0 : int err = fd_gossip_prune_sign_data_with_prefix_decode_footprint_inner( ctx, total_sz );
17461 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17462 0 : ctx->data = start_data;
17463 0 : return err;
17464 0 : }
17465 0 : static void fd_gossip_prune_sign_data_with_prefix_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17466 0 : fd_gossip_prune_sign_data_with_prefix_t * self = (fd_gossip_prune_sign_data_with_prefix_t *)struct_mem;
17467 0 : fd_bincode_uint64_decode_unsafe( &self->prefix_len, ctx );
17468 0 : if( self->prefix_len ) {
17469 0 : self->prefix = *alloc_mem;
17470 0 : fd_bincode_bytes_decode_unsafe( self->prefix, self->prefix_len, ctx );
17471 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->prefix_len;
17472 0 : } else
17473 0 : self->prefix = NULL;
17474 0 : fd_gossip_prune_sign_data_decode_inner( &self->data, alloc_mem, ctx );
17475 0 : }
17476 0 : void * fd_gossip_prune_sign_data_with_prefix_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17477 0 : fd_gossip_prune_sign_data_with_prefix_t * self = (fd_gossip_prune_sign_data_with_prefix_t *)mem;
17478 0 : fd_gossip_prune_sign_data_with_prefix_new( self );
17479 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_sign_data_with_prefix_t);
17480 0 : void * * alloc_mem = &alloc_region;
17481 0 : fd_gossip_prune_sign_data_with_prefix_decode_inner( mem, alloc_mem, ctx );
17482 0 : return self;
17483 0 : }
17484 0 : void fd_gossip_prune_sign_data_with_prefix_new(fd_gossip_prune_sign_data_with_prefix_t * self) {
17485 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_sign_data_with_prefix_t) );
17486 0 : fd_gossip_prune_sign_data_new( &self->data );
17487 0 : }
17488 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, uint varint ) {
17489 0 : (void) varint;
17490 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_sign_data_with_prefix", level++, 0 );
17491 0 : if( self->prefix_len ) {
17492 0 : fun( w, NULL, "prefix", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
17493 0 : for( ulong i=0; i < self->prefix_len; i++ )
17494 0 : fun( w, self->prefix + i, "prefix", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
17495 0 : fun( w, NULL, "prefix", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
17496 0 : }
17497 0 : fd_gossip_prune_sign_data_walk( w, &self->data, fun, "data", level, 0 );
17498 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_sign_data_with_prefix", level--, 0 );
17499 0 : }
17500 0 : ulong fd_gossip_prune_sign_data_with_prefix_size( fd_gossip_prune_sign_data_with_prefix_t const * self ) {
17501 0 : ulong size = 0;
17502 0 : do {
17503 0 : size += sizeof(ulong);
17504 0 : size += self->prefix_len;
17505 0 : } while(0);
17506 0 : size += fd_gossip_prune_sign_data_size( &self->data );
17507 0 : return size;
17508 0 : }
17509 :
17510 0 : int fd_gossip_socket_addr_old_encode( fd_gossip_socket_addr_old_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17511 0 : int err;
17512 0 : err = fd_gossip_ip_addr_encode( &self->addr, ctx );
17513 0 : if( FD_UNLIKELY( err ) ) return err;
17514 0 : err = fd_bincode_uint16_encode( self->port, ctx );
17515 0 : if( FD_UNLIKELY( err ) ) return err;
17516 0 : return FD_BINCODE_SUCCESS;
17517 0 : }
17518 0 : static int fd_gossip_socket_addr_old_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17519 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17520 0 : int err = 0;
17521 0 : err = fd_gossip_ip_addr_decode_footprint_inner( ctx, total_sz );
17522 0 : if( FD_UNLIKELY( err ) ) return err;
17523 0 : err = fd_bincode_uint16_decode_footprint( ctx );
17524 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17525 0 : return 0;
17526 0 : }
17527 0 : int fd_gossip_socket_addr_old_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17528 0 : *total_sz += sizeof(fd_gossip_socket_addr_old_t);
17529 0 : void const * start_data = ctx->data;
17530 0 : int err = fd_gossip_socket_addr_old_decode_footprint_inner( ctx, total_sz );
17531 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17532 0 : ctx->data = start_data;
17533 0 : return err;
17534 0 : }
17535 0 : static void fd_gossip_socket_addr_old_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17536 0 : fd_gossip_socket_addr_old_t * self = (fd_gossip_socket_addr_old_t *)struct_mem;
17537 0 : fd_gossip_ip_addr_decode_inner( &self->addr, alloc_mem, ctx );
17538 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
17539 0 : }
17540 0 : void * fd_gossip_socket_addr_old_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17541 0 : fd_gossip_socket_addr_old_t * self = (fd_gossip_socket_addr_old_t *)mem;
17542 0 : fd_gossip_socket_addr_old_new( self );
17543 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_old_t);
17544 0 : void * * alloc_mem = &alloc_region;
17545 0 : fd_gossip_socket_addr_old_decode_inner( mem, alloc_mem, ctx );
17546 0 : return self;
17547 0 : }
17548 0 : void fd_gossip_socket_addr_old_new(fd_gossip_socket_addr_old_t * self) {
17549 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_old_t) );
17550 0 : fd_gossip_ip_addr_new( &self->addr );
17551 0 : }
17552 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, uint varint ) {
17553 0 : (void) varint;
17554 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_old", level++, 0 );
17555 0 : fd_gossip_ip_addr_walk( w, &self->addr, fun, "addr", level, 0 );
17556 0 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
17557 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_old", level--, 0 );
17558 0 : }
17559 0 : ulong fd_gossip_socket_addr_old_size( fd_gossip_socket_addr_old_t const * self ) {
17560 0 : ulong size = 0;
17561 0 : size += fd_gossip_ip_addr_size( &self->addr );
17562 0 : size += sizeof(ushort);
17563 0 : return size;
17564 0 : }
17565 :
17566 0 : int fd_gossip_socket_addr_ip4_encode( fd_gossip_socket_addr_ip4_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17567 0 : int err;
17568 0 : err = fd_gossip_ip4_addr_encode( &self->addr, ctx );
17569 0 : if( FD_UNLIKELY( err ) ) return err;
17570 0 : err = fd_bincode_uint16_encode( self->port, ctx );
17571 0 : if( FD_UNLIKELY( err ) ) return err;
17572 0 : return FD_BINCODE_SUCCESS;
17573 0 : }
17574 90 : static int fd_gossip_socket_addr_ip4_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17575 90 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17576 90 : int err = 0;
17577 90 : err = fd_gossip_ip4_addr_decode_footprint_inner( ctx, total_sz );
17578 90 : if( FD_UNLIKELY( err ) ) return err;
17579 90 : err = fd_bincode_uint16_decode_footprint( ctx );
17580 90 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17581 90 : return 0;
17582 90 : }
17583 0 : int fd_gossip_socket_addr_ip4_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17584 0 : *total_sz += sizeof(fd_gossip_socket_addr_ip4_t);
17585 0 : void const * start_data = ctx->data;
17586 0 : int err = fd_gossip_socket_addr_ip4_decode_footprint_inner( ctx, total_sz );
17587 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17588 0 : ctx->data = start_data;
17589 0 : return err;
17590 0 : }
17591 90 : static void fd_gossip_socket_addr_ip4_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17592 90 : fd_gossip_socket_addr_ip4_t * self = (fd_gossip_socket_addr_ip4_t *)struct_mem;
17593 90 : fd_gossip_ip4_addr_decode_inner( &self->addr, alloc_mem, ctx );
17594 90 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
17595 90 : }
17596 0 : void * fd_gossip_socket_addr_ip4_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17597 0 : fd_gossip_socket_addr_ip4_t * self = (fd_gossip_socket_addr_ip4_t *)mem;
17598 0 : fd_gossip_socket_addr_ip4_new( self );
17599 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_ip4_t);
17600 0 : void * * alloc_mem = &alloc_region;
17601 0 : fd_gossip_socket_addr_ip4_decode_inner( mem, alloc_mem, ctx );
17602 0 : return self;
17603 0 : }
17604 0 : void fd_gossip_socket_addr_ip4_new(fd_gossip_socket_addr_ip4_t * self) {
17605 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_ip4_t) );
17606 0 : fd_gossip_ip4_addr_new( &self->addr );
17607 0 : }
17608 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, uint varint ) {
17609 90 : (void) varint;
17610 90 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_ip4", level++, 0 );
17611 90 : fd_gossip_ip4_addr_walk( w, &self->addr, fun, "addr", level, 0 );
17612 90 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
17613 90 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_ip4", level--, 0 );
17614 90 : }
17615 0 : ulong fd_gossip_socket_addr_ip4_size( fd_gossip_socket_addr_ip4_t const * self ) {
17616 0 : ulong size = 0;
17617 0 : size += fd_gossip_ip4_addr_size( &self->addr );
17618 0 : size += sizeof(ushort);
17619 0 : return size;
17620 0 : }
17621 :
17622 0 : int fd_gossip_socket_addr_ip6_encode( fd_gossip_socket_addr_ip6_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17623 0 : int err;
17624 0 : err = fd_gossip_ip6_addr_encode( &self->addr, ctx );
17625 0 : if( FD_UNLIKELY( err ) ) return err;
17626 0 : err = fd_bincode_uint16_encode( self->port, ctx );
17627 0 : if( FD_UNLIKELY( err ) ) return err;
17628 0 : return FD_BINCODE_SUCCESS;
17629 0 : }
17630 0 : static int fd_gossip_socket_addr_ip6_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17631 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17632 0 : int err = 0;
17633 0 : err = fd_gossip_ip6_addr_decode_footprint_inner( ctx, total_sz );
17634 0 : if( FD_UNLIKELY( err ) ) return err;
17635 0 : err = fd_bincode_uint16_decode_footprint( ctx );
17636 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17637 0 : return 0;
17638 0 : }
17639 0 : int fd_gossip_socket_addr_ip6_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17640 0 : *total_sz += sizeof(fd_gossip_socket_addr_ip6_t);
17641 0 : void const * start_data = ctx->data;
17642 0 : int err = fd_gossip_socket_addr_ip6_decode_footprint_inner( ctx, total_sz );
17643 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17644 0 : ctx->data = start_data;
17645 0 : return err;
17646 0 : }
17647 0 : static void fd_gossip_socket_addr_ip6_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17648 0 : fd_gossip_socket_addr_ip6_t * self = (fd_gossip_socket_addr_ip6_t *)struct_mem;
17649 0 : fd_gossip_ip6_addr_decode_inner( &self->addr, alloc_mem, ctx );
17650 0 : fd_bincode_uint16_decode_unsafe( &self->port, ctx );
17651 0 : }
17652 0 : void * fd_gossip_socket_addr_ip6_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17653 0 : fd_gossip_socket_addr_ip6_t * self = (fd_gossip_socket_addr_ip6_t *)mem;
17654 0 : fd_gossip_socket_addr_ip6_new( self );
17655 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_ip6_t);
17656 0 : void * * alloc_mem = &alloc_region;
17657 0 : fd_gossip_socket_addr_ip6_decode_inner( mem, alloc_mem, ctx );
17658 0 : return self;
17659 0 : }
17660 0 : void fd_gossip_socket_addr_ip6_new(fd_gossip_socket_addr_ip6_t * self) {
17661 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_ip6_t) );
17662 0 : fd_gossip_ip6_addr_new( &self->addr );
17663 0 : }
17664 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, uint varint ) {
17665 0 : (void) varint;
17666 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_addr_ip6", level++, 0 );
17667 0 : fd_gossip_ip6_addr_walk( w, &self->addr, fun, "addr", level, 0 );
17668 0 : fun( w, &self->port, "port", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
17669 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_addr_ip6", level--, 0 );
17670 0 : }
17671 0 : FD_FN_PURE uchar fd_gossip_socket_addr_is_ip4(fd_gossip_socket_addr_t const * self) {
17672 0 : return self->discriminant == 0;
17673 0 : }
17674 0 : FD_FN_PURE uchar fd_gossip_socket_addr_is_ip6(fd_gossip_socket_addr_t const * self) {
17675 0 : return self->discriminant == 1;
17676 0 : }
17677 : void fd_gossip_socket_addr_inner_new( fd_gossip_socket_addr_inner_t * self, uint discriminant );
17678 90 : int fd_gossip_socket_addr_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17679 90 : int err;
17680 90 : switch (discriminant) {
17681 90 : case 0: {
17682 90 : err = fd_gossip_socket_addr_ip4_decode_footprint_inner( ctx, total_sz );
17683 90 : if( FD_UNLIKELY( err ) ) return err;
17684 90 : return FD_BINCODE_SUCCESS;
17685 90 : }
17686 0 : case 1: {
17687 0 : err = fd_gossip_socket_addr_ip6_decode_footprint_inner( ctx, total_sz );
17688 0 : if( FD_UNLIKELY( err ) ) return err;
17689 0 : return FD_BINCODE_SUCCESS;
17690 0 : }
17691 0 : default: return FD_BINCODE_ERR_ENCODING;
17692 90 : }
17693 90 : }
17694 90 : static int fd_gossip_socket_addr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17695 90 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17696 90 : uint discriminant = 0;
17697 90 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
17698 90 : if( FD_UNLIKELY( err ) ) return err;
17699 90 : return fd_gossip_socket_addr_inner_decode_footprint( discriminant, ctx, total_sz );
17700 90 : }
17701 0 : int fd_gossip_socket_addr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17702 0 : *total_sz += sizeof(fd_gossip_socket_addr_t);
17703 0 : void const * start_data = ctx->data;
17704 0 : int err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17705 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17706 0 : ctx->data = start_data;
17707 0 : return err;
17708 0 : }
17709 90 : static void fd_gossip_socket_addr_inner_decode_inner( fd_gossip_socket_addr_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
17710 90 : switch (discriminant) {
17711 90 : case 0: {
17712 90 : fd_gossip_socket_addr_ip4_decode_inner( &self->ip4, alloc_mem, ctx );
17713 90 : break;
17714 0 : }
17715 0 : case 1: {
17716 0 : fd_gossip_socket_addr_ip6_decode_inner( &self->ip6, alloc_mem, ctx );
17717 0 : break;
17718 0 : }
17719 90 : }
17720 90 : }
17721 90 : static void fd_gossip_socket_addr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17722 90 : fd_gossip_socket_addr_t * self = (fd_gossip_socket_addr_t *)struct_mem;
17723 90 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
17724 90 : fd_gossip_socket_addr_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
17725 90 : }
17726 0 : void * fd_gossip_socket_addr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17727 0 : fd_gossip_socket_addr_t * self = (fd_gossip_socket_addr_t *)mem;
17728 0 : fd_gossip_socket_addr_new( self );
17729 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_addr_t);
17730 0 : void * * alloc_mem = &alloc_region;
17731 0 : fd_gossip_socket_addr_decode_inner( mem, alloc_mem, ctx );
17732 0 : return self;
17733 0 : }
17734 0 : void fd_gossip_socket_addr_inner_new( fd_gossip_socket_addr_inner_t * self, uint discriminant ) {
17735 0 : switch( discriminant ) {
17736 0 : case 0: {
17737 0 : fd_gossip_socket_addr_ip4_new( &self->ip4 );
17738 0 : break;
17739 0 : }
17740 0 : case 1: {
17741 0 : fd_gossip_socket_addr_ip6_new( &self->ip6 );
17742 0 : break;
17743 0 : }
17744 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
17745 0 : }
17746 0 : }
17747 0 : void fd_gossip_socket_addr_new_disc( fd_gossip_socket_addr_t * self, uint discriminant ) {
17748 0 : self->discriminant = discriminant;
17749 0 : fd_gossip_socket_addr_inner_new( &self->inner, self->discriminant );
17750 0 : }
17751 0 : void fd_gossip_socket_addr_new( fd_gossip_socket_addr_t * self ) {
17752 0 : fd_memset( self, 0, sizeof(fd_gossip_socket_addr_t) );
17753 0 : fd_gossip_socket_addr_new_disc( self, UINT_MAX );
17754 0 : }
17755 :
17756 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, uint varint ) {
17757 90 : (void) varint;
17758 90 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_socket_addr", level++, 0);
17759 90 : switch( self->discriminant ) {
17760 90 : case 0: {
17761 90 : fun( w, self, "ip4", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17762 90 : fd_gossip_socket_addr_ip4_walk( w, &self->inner.ip4, fun, "ip4", level, 0 );
17763 90 : break;
17764 0 : }
17765 0 : case 1: {
17766 0 : fun( w, self, "ip6", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
17767 0 : fd_gossip_socket_addr_ip6_walk( w, &self->inner.ip6, fun, "ip6", level, 0 );
17768 0 : break;
17769 0 : }
17770 90 : }
17771 90 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_socket_addr", level--, 0 );
17772 90 : }
17773 0 : ulong fd_gossip_socket_addr_size( fd_gossip_socket_addr_t const * self ) {
17774 0 : ulong size = 0;
17775 0 : size += sizeof(uint);
17776 0 : switch (self->discriminant) {
17777 0 : case 0: {
17778 0 : size += fd_gossip_socket_addr_ip4_size( &self->inner.ip4 );
17779 0 : break;
17780 0 : }
17781 0 : case 1: {
17782 0 : size += fd_gossip_socket_addr_ip6_size( &self->inner.ip6 );
17783 0 : break;
17784 0 : }
17785 0 : }
17786 0 : return size;
17787 0 : }
17788 :
17789 0 : int fd_gossip_socket_addr_inner_encode( fd_gossip_socket_addr_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
17790 0 : int err;
17791 0 : switch (discriminant) {
17792 0 : case 0: {
17793 0 : err = fd_gossip_socket_addr_ip4_encode( &self->ip4, ctx );
17794 0 : if( FD_UNLIKELY( err ) ) return err;
17795 0 : break;
17796 0 : }
17797 0 : case 1: {
17798 0 : err = fd_gossip_socket_addr_ip6_encode( &self->ip6, ctx );
17799 0 : if( FD_UNLIKELY( err ) ) return err;
17800 0 : break;
17801 0 : }
17802 0 : }
17803 0 : return FD_BINCODE_SUCCESS;
17804 0 : }
17805 0 : int fd_gossip_socket_addr_encode( fd_gossip_socket_addr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17806 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
17807 0 : if( FD_UNLIKELY( err ) ) return err;
17808 0 : return fd_gossip_socket_addr_inner_encode( &self->inner, self->discriminant, ctx );
17809 0 : }
17810 :
17811 0 : int fd_gossip_contact_info_v1_encode( fd_gossip_contact_info_v1_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17812 0 : int err;
17813 0 : err = fd_pubkey_encode( &self->id, ctx );
17814 0 : if( FD_UNLIKELY( err ) ) return err;
17815 0 : err = fd_gossip_socket_addr_encode( &self->gossip, ctx );
17816 0 : if( FD_UNLIKELY( err ) ) return err;
17817 0 : err = fd_gossip_socket_addr_encode( &self->tvu, ctx );
17818 0 : if( FD_UNLIKELY( err ) ) return err;
17819 0 : err = fd_gossip_socket_addr_encode( &self->tvu_fwd, ctx );
17820 0 : if( FD_UNLIKELY( err ) ) return err;
17821 0 : err = fd_gossip_socket_addr_encode( &self->repair, ctx );
17822 0 : if( FD_UNLIKELY( err ) ) return err;
17823 0 : err = fd_gossip_socket_addr_encode( &self->tpu, ctx );
17824 0 : if( FD_UNLIKELY( err ) ) return err;
17825 0 : err = fd_gossip_socket_addr_encode( &self->tpu_fwd, ctx );
17826 0 : if( FD_UNLIKELY( err ) ) return err;
17827 0 : err = fd_gossip_socket_addr_encode( &self->tpu_vote, ctx );
17828 0 : if( FD_UNLIKELY( err ) ) return err;
17829 0 : err = fd_gossip_socket_addr_encode( &self->rpc, ctx );
17830 0 : if( FD_UNLIKELY( err ) ) return err;
17831 0 : err = fd_gossip_socket_addr_encode( &self->rpc_pubsub, ctx );
17832 0 : if( FD_UNLIKELY( err ) ) return err;
17833 0 : err = fd_gossip_socket_addr_encode( &self->serve_repair, ctx );
17834 0 : if( FD_UNLIKELY( err ) ) return err;
17835 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
17836 0 : if( FD_UNLIKELY( err ) ) return err;
17837 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
17838 0 : if( FD_UNLIKELY( err ) ) return err;
17839 0 : return FD_BINCODE_SUCCESS;
17840 0 : }
17841 9 : static int fd_gossip_contact_info_v1_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17842 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17843 9 : int err = 0;
17844 9 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17845 9 : if( FD_UNLIKELY( err ) ) return err;
17846 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17847 9 : if( FD_UNLIKELY( err ) ) return err;
17848 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17849 9 : if( FD_UNLIKELY( err ) ) return err;
17850 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17851 9 : if( FD_UNLIKELY( err ) ) return err;
17852 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17853 9 : if( FD_UNLIKELY( err ) ) return err;
17854 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17855 9 : if( FD_UNLIKELY( err ) ) return err;
17856 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17857 9 : if( FD_UNLIKELY( err ) ) return err;
17858 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17859 9 : if( FD_UNLIKELY( err ) ) return err;
17860 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17861 9 : if( FD_UNLIKELY( err ) ) return err;
17862 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17863 9 : if( FD_UNLIKELY( err ) ) return err;
17864 9 : err = fd_gossip_socket_addr_decode_footprint_inner( ctx, total_sz );
17865 9 : if( FD_UNLIKELY( err ) ) return err;
17866 9 : err = fd_bincode_uint64_decode_footprint( ctx );
17867 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17868 9 : err = fd_bincode_uint16_decode_footprint( ctx );
17869 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17870 9 : return 0;
17871 9 : }
17872 0 : int fd_gossip_contact_info_v1_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17873 0 : *total_sz += sizeof(fd_gossip_contact_info_v1_t);
17874 0 : void const * start_data = ctx->data;
17875 0 : int err = fd_gossip_contact_info_v1_decode_footprint_inner( ctx, total_sz );
17876 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17877 0 : ctx->data = start_data;
17878 0 : return err;
17879 0 : }
17880 9 : static void fd_gossip_contact_info_v1_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17881 9 : fd_gossip_contact_info_v1_t * self = (fd_gossip_contact_info_v1_t *)struct_mem;
17882 9 : fd_pubkey_decode_inner( &self->id, alloc_mem, ctx );
17883 9 : fd_gossip_socket_addr_decode_inner( &self->gossip, alloc_mem, ctx );
17884 9 : fd_gossip_socket_addr_decode_inner( &self->tvu, alloc_mem, ctx );
17885 9 : fd_gossip_socket_addr_decode_inner( &self->tvu_fwd, alloc_mem, ctx );
17886 9 : fd_gossip_socket_addr_decode_inner( &self->repair, alloc_mem, ctx );
17887 9 : fd_gossip_socket_addr_decode_inner( &self->tpu, alloc_mem, ctx );
17888 9 : fd_gossip_socket_addr_decode_inner( &self->tpu_fwd, alloc_mem, ctx );
17889 9 : fd_gossip_socket_addr_decode_inner( &self->tpu_vote, alloc_mem, ctx );
17890 9 : fd_gossip_socket_addr_decode_inner( &self->rpc, alloc_mem, ctx );
17891 9 : fd_gossip_socket_addr_decode_inner( &self->rpc_pubsub, alloc_mem, ctx );
17892 9 : fd_gossip_socket_addr_decode_inner( &self->serve_repair, alloc_mem, ctx );
17893 9 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
17894 9 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
17895 9 : }
17896 0 : void * fd_gossip_contact_info_v1_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17897 0 : fd_gossip_contact_info_v1_t * self = (fd_gossip_contact_info_v1_t *)mem;
17898 0 : fd_gossip_contact_info_v1_new( self );
17899 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_contact_info_v1_t);
17900 0 : void * * alloc_mem = &alloc_region;
17901 0 : fd_gossip_contact_info_v1_decode_inner( mem, alloc_mem, ctx );
17902 0 : return self;
17903 0 : }
17904 0 : void fd_gossip_contact_info_v1_new(fd_gossip_contact_info_v1_t * self) {
17905 0 : fd_memset( self, 0, sizeof(fd_gossip_contact_info_v1_t) );
17906 0 : fd_pubkey_new( &self->id );
17907 0 : fd_gossip_socket_addr_new( &self->gossip );
17908 0 : fd_gossip_socket_addr_new( &self->tvu );
17909 0 : fd_gossip_socket_addr_new( &self->tvu_fwd );
17910 0 : fd_gossip_socket_addr_new( &self->repair );
17911 0 : fd_gossip_socket_addr_new( &self->tpu );
17912 0 : fd_gossip_socket_addr_new( &self->tpu_fwd );
17913 0 : fd_gossip_socket_addr_new( &self->tpu_vote );
17914 0 : fd_gossip_socket_addr_new( &self->rpc );
17915 0 : fd_gossip_socket_addr_new( &self->rpc_pubsub );
17916 0 : fd_gossip_socket_addr_new( &self->serve_repair );
17917 0 : }
17918 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, uint varint ) {
17919 9 : (void) varint;
17920 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_contact_info_v1", level++, 0 );
17921 9 : fd_pubkey_walk( w, &self->id, fun, "id", level, 0 );
17922 9 : fd_gossip_socket_addr_walk( w, &self->gossip, fun, "gossip", level, 0 );
17923 9 : fd_gossip_socket_addr_walk( w, &self->tvu, fun, "tvu", level, 0 );
17924 9 : fd_gossip_socket_addr_walk( w, &self->tvu_fwd, fun, "tvu_fwd", level, 0 );
17925 9 : fd_gossip_socket_addr_walk( w, &self->repair, fun, "repair", level, 0 );
17926 9 : fd_gossip_socket_addr_walk( w, &self->tpu, fun, "tpu", level, 0 );
17927 9 : fd_gossip_socket_addr_walk( w, &self->tpu_fwd, fun, "tpu_fwd", level, 0 );
17928 9 : fd_gossip_socket_addr_walk( w, &self->tpu_vote, fun, "tpu_vote", level, 0 );
17929 9 : fd_gossip_socket_addr_walk( w, &self->rpc, fun, "rpc", level, 0 );
17930 9 : fd_gossip_socket_addr_walk( w, &self->rpc_pubsub, fun, "rpc_pubsub", level, 0 );
17931 9 : fd_gossip_socket_addr_walk( w, &self->serve_repair, fun, "serve_repair", level, 0 );
17932 9 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
17933 9 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
17934 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_contact_info_v1", level--, 0 );
17935 9 : }
17936 0 : ulong fd_gossip_contact_info_v1_size( fd_gossip_contact_info_v1_t const * self ) {
17937 0 : ulong size = 0;
17938 0 : size += fd_pubkey_size( &self->id );
17939 0 : size += fd_gossip_socket_addr_size( &self->gossip );
17940 0 : size += fd_gossip_socket_addr_size( &self->tvu );
17941 0 : size += fd_gossip_socket_addr_size( &self->tvu_fwd );
17942 0 : size += fd_gossip_socket_addr_size( &self->repair );
17943 0 : size += fd_gossip_socket_addr_size( &self->tpu );
17944 0 : size += fd_gossip_socket_addr_size( &self->tpu_fwd );
17945 0 : size += fd_gossip_socket_addr_size( &self->tpu_vote );
17946 0 : size += fd_gossip_socket_addr_size( &self->rpc );
17947 0 : size += fd_gossip_socket_addr_size( &self->rpc_pubsub );
17948 0 : size += fd_gossip_socket_addr_size( &self->serve_repair );
17949 0 : size += sizeof(ulong);
17950 0 : size += sizeof(ushort);
17951 0 : return size;
17952 0 : }
17953 :
17954 0 : int fd_gossip_vote_encode( fd_gossip_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
17955 0 : int err;
17956 0 : err = fd_bincode_uint8_encode( (uchar)(self->index), ctx );
17957 0 : if( FD_UNLIKELY( err ) ) return err;
17958 0 : err = fd_pubkey_encode( &self->from, ctx );
17959 0 : if( FD_UNLIKELY( err ) ) return err;
17960 0 : err = fd_flamenco_txn_encode( &self->txn, ctx );
17961 0 : if( FD_UNLIKELY( err ) ) return err;
17962 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
17963 0 : if( FD_UNLIKELY( err ) ) return err;
17964 0 : return FD_BINCODE_SUCCESS;
17965 0 : }
17966 6 : static int fd_gossip_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17967 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17968 6 : int err = 0;
17969 6 : err = fd_bincode_uint8_decode_footprint( ctx );
17970 6 : if( FD_UNLIKELY( err ) ) return err;
17971 6 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
17972 6 : if( FD_UNLIKELY( err ) ) return err;
17973 6 : err = fd_flamenco_txn_decode_footprint_inner( ctx, total_sz );
17974 6 : if( FD_UNLIKELY( err ) ) return err;
17975 6 : err = fd_bincode_uint64_decode_footprint( ctx );
17976 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
17977 6 : return 0;
17978 6 : }
17979 0 : int fd_gossip_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
17980 0 : *total_sz += sizeof(fd_gossip_vote_t);
17981 0 : void const * start_data = ctx->data;
17982 0 : int err = fd_gossip_vote_decode_footprint_inner( ctx, total_sz );
17983 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
17984 0 : ctx->data = start_data;
17985 0 : return err;
17986 0 : }
17987 6 : static void fd_gossip_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
17988 6 : fd_gossip_vote_t * self = (fd_gossip_vote_t *)struct_mem;
17989 6 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
17990 6 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
17991 6 : fd_flamenco_txn_decode_inner( &self->txn, alloc_mem, ctx );
17992 6 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
17993 6 : }
17994 0 : void * fd_gossip_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
17995 0 : fd_gossip_vote_t * self = (fd_gossip_vote_t *)mem;
17996 0 : fd_gossip_vote_new( self );
17997 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_vote_t);
17998 0 : void * * alloc_mem = &alloc_region;
17999 0 : fd_gossip_vote_decode_inner( mem, alloc_mem, ctx );
18000 0 : return self;
18001 0 : }
18002 0 : void fd_gossip_vote_new(fd_gossip_vote_t * self) {
18003 0 : fd_memset( self, 0, sizeof(fd_gossip_vote_t) );
18004 0 : fd_pubkey_new( &self->from );
18005 0 : fd_flamenco_txn_new( &self->txn );
18006 0 : }
18007 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, uint varint ) {
18008 6 : (void) varint;
18009 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_vote", level++, 0 );
18010 6 : fun( w, &self->index, "index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
18011 6 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
18012 6 : fd_flamenco_txn_walk( w, &self->txn, fun, "txn", level, 0 );
18013 6 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18014 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_vote", level--, 0 );
18015 6 : }
18016 0 : ulong fd_gossip_vote_size( fd_gossip_vote_t const * self ) {
18017 0 : ulong size = 0;
18018 0 : size += sizeof(char);
18019 0 : size += fd_pubkey_size( &self->from );
18020 0 : size += fd_flamenco_txn_size( &self->txn );
18021 0 : size += sizeof(ulong);
18022 0 : return size;
18023 0 : }
18024 :
18025 0 : FD_FN_PURE uchar fd_gossip_deprecated_compression_type_is_Uncompressed(fd_gossip_deprecated_compression_type_t const * self) {
18026 0 : return self->discriminant == 0;
18027 0 : }
18028 0 : FD_FN_PURE uchar fd_gossip_deprecated_compression_type_is_GZip(fd_gossip_deprecated_compression_type_t const * self) {
18029 0 : return self->discriminant == 1;
18030 0 : }
18031 0 : FD_FN_PURE uchar fd_gossip_deprecated_compression_type_is_BZip2(fd_gossip_deprecated_compression_type_t const * self) {
18032 0 : return self->discriminant == 2;
18033 0 : }
18034 0 : int fd_gossip_deprecated_compression_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18035 0 : int err;
18036 0 : switch (discriminant) {
18037 0 : case 0: {
18038 0 : return FD_BINCODE_SUCCESS;
18039 0 : }
18040 0 : case 1: {
18041 0 : return FD_BINCODE_SUCCESS;
18042 0 : }
18043 0 : case 2: {
18044 0 : return FD_BINCODE_SUCCESS;
18045 0 : }
18046 0 : default: return FD_BINCODE_ERR_ENCODING;
18047 0 : }
18048 0 : }
18049 0 : static int fd_gossip_deprecated_compression_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18050 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18051 0 : uint discriminant = 0;
18052 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
18053 0 : if( FD_UNLIKELY( err ) ) return err;
18054 0 : return fd_gossip_deprecated_compression_type_inner_decode_footprint( discriminant, ctx, total_sz );
18055 0 : }
18056 0 : int fd_gossip_deprecated_compression_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18057 0 : *total_sz += sizeof(fd_gossip_deprecated_compression_type_t);
18058 0 : void const * start_data = ctx->data;
18059 0 : int err = fd_gossip_deprecated_compression_type_decode_footprint_inner( ctx, total_sz );
18060 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18061 0 : ctx->data = start_data;
18062 0 : return err;
18063 0 : }
18064 0 : static void fd_gossip_deprecated_compression_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18065 0 : fd_gossip_deprecated_compression_type_t * self = (fd_gossip_deprecated_compression_type_t *)struct_mem;
18066 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
18067 0 : }
18068 0 : void * fd_gossip_deprecated_compression_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18069 0 : fd_gossip_deprecated_compression_type_t * self = (fd_gossip_deprecated_compression_type_t *)mem;
18070 0 : fd_gossip_deprecated_compression_type_new( self );
18071 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_deprecated_compression_type_t);
18072 0 : void * * alloc_mem = &alloc_region;
18073 0 : fd_gossip_deprecated_compression_type_decode_inner( mem, alloc_mem, ctx );
18074 0 : return self;
18075 0 : }
18076 :
18077 0 : void fd_gossip_deprecated_compression_type_walk( void * w, fd_gossip_deprecated_compression_type_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
18078 0 : (void) varint;
18079 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_deprecated_compression_type", level++, 0);
18080 0 : switch( self->discriminant ) {
18081 0 : case 0: {
18082 0 : fun( w, self, "Uncompressed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18083 0 : break;
18084 0 : }
18085 0 : case 1: {
18086 0 : fun( w, self, "GZip", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18087 0 : break;
18088 0 : }
18089 0 : case 2: {
18090 0 : fun( w, self, "BZip2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18091 0 : break;
18092 0 : }
18093 0 : }
18094 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_deprecated_compression_type", level--, 0 );
18095 0 : }
18096 0 : ulong fd_gossip_deprecated_compression_type_size( fd_gossip_deprecated_compression_type_t const * self ) {
18097 0 : ulong size = 0;
18098 0 : size += sizeof(uint);
18099 0 : switch (self->discriminant) {
18100 0 : }
18101 0 : return size;
18102 0 : }
18103 :
18104 0 : int fd_gossip_deprecated_compression_type_encode( fd_gossip_deprecated_compression_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18105 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
18106 0 : if( FD_UNLIKELY( err ) ) return err;
18107 0 : return err;
18108 0 : }
18109 :
18110 0 : int fd_gossip_deprecated_epoch_incomplete_slots_encode( fd_gossip_deprecated_epoch_incomplete_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18111 0 : int err;
18112 0 : err = fd_bincode_uint64_encode( self->first, ctx );
18113 0 : if( FD_UNLIKELY( err ) ) return err;
18114 0 : err = fd_gossip_deprecated_compression_type_encode( &self->compression, ctx );
18115 0 : if( FD_UNLIKELY( err ) ) return err;
18116 0 : err = fd_bincode_uint64_encode( self->compressed_list_len, ctx );
18117 0 : if( FD_UNLIKELY(err) ) return err;
18118 0 : if( self->compressed_list_len ) {
18119 0 : err = fd_bincode_bytes_encode( self->compressed_list, self->compressed_list_len, ctx );
18120 0 : if( FD_UNLIKELY( err ) ) return err;
18121 0 : }
18122 0 : return FD_BINCODE_SUCCESS;
18123 0 : }
18124 0 : static int fd_gossip_deprecated_epoch_incomplete_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18125 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18126 0 : int err = 0;
18127 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18128 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18129 0 : err = fd_gossip_deprecated_compression_type_decode_footprint_inner( ctx, total_sz );
18130 0 : if( FD_UNLIKELY( err ) ) return err;
18131 0 : ulong compressed_list_len;
18132 0 : err = fd_bincode_uint64_decode( &compressed_list_len, ctx );
18133 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18134 0 : if( compressed_list_len ) {
18135 0 : *total_sz += 8UL + compressed_list_len;
18136 0 : err = fd_bincode_bytes_decode_footprint( compressed_list_len, ctx );
18137 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18138 0 : }
18139 0 : return 0;
18140 0 : }
18141 0 : int fd_gossip_deprecated_epoch_incomplete_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18142 0 : *total_sz += sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t);
18143 0 : void const * start_data = ctx->data;
18144 0 : int err = fd_gossip_deprecated_epoch_incomplete_slots_decode_footprint_inner( ctx, total_sz );
18145 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18146 0 : ctx->data = start_data;
18147 0 : return err;
18148 0 : }
18149 0 : static void fd_gossip_deprecated_epoch_incomplete_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18150 0 : fd_gossip_deprecated_epoch_incomplete_slots_t * self = (fd_gossip_deprecated_epoch_incomplete_slots_t *)struct_mem;
18151 0 : fd_bincode_uint64_decode_unsafe( &self->first, ctx );
18152 0 : fd_gossip_deprecated_compression_type_decode_inner( &self->compression, alloc_mem, ctx );
18153 0 : fd_bincode_uint64_decode_unsafe( &self->compressed_list_len, ctx );
18154 0 : if( self->compressed_list_len ) {
18155 0 : self->compressed_list = *alloc_mem;
18156 0 : fd_bincode_bytes_decode_unsafe( self->compressed_list, self->compressed_list_len, ctx );
18157 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->compressed_list_len;
18158 0 : } else
18159 0 : self->compressed_list = NULL;
18160 0 : }
18161 0 : void * fd_gossip_deprecated_epoch_incomplete_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18162 0 : fd_gossip_deprecated_epoch_incomplete_slots_t * self = (fd_gossip_deprecated_epoch_incomplete_slots_t *)mem;
18163 0 : fd_gossip_deprecated_epoch_incomplete_slots_new( self );
18164 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t);
18165 0 : void * * alloc_mem = &alloc_region;
18166 0 : fd_gossip_deprecated_epoch_incomplete_slots_decode_inner( mem, alloc_mem, ctx );
18167 0 : return self;
18168 0 : }
18169 0 : void fd_gossip_deprecated_epoch_incomplete_slots_new(fd_gossip_deprecated_epoch_incomplete_slots_t * self) {
18170 0 : fd_memset( self, 0, sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t) );
18171 0 : fd_gossip_deprecated_compression_type_new( &self->compression );
18172 0 : }
18173 0 : void fd_gossip_deprecated_epoch_incomplete_slots_walk( void * w, fd_gossip_deprecated_epoch_incomplete_slots_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
18174 0 : (void) varint;
18175 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_deprecated_epoch_incomplete_slots", level++, 0 );
18176 0 : fun( w, &self->first, "first", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18177 0 : fd_gossip_deprecated_compression_type_walk( w, &self->compression, fun, "compression", level, 0 );
18178 0 : if( self->compressed_list_len ) {
18179 0 : fun( w, NULL, "compressed_list", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
18180 0 : for( ulong i=0; i < self->compressed_list_len; i++ )
18181 0 : fun( w, self->compressed_list + i, "compressed_list", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
18182 0 : fun( w, NULL, "compressed_list", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
18183 0 : }
18184 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_deprecated_epoch_incomplete_slots", level--, 0 );
18185 0 : }
18186 0 : ulong fd_gossip_deprecated_epoch_incomplete_slots_size( fd_gossip_deprecated_epoch_incomplete_slots_t const * self ) {
18187 0 : ulong size = 0;
18188 0 : size += sizeof(ulong);
18189 0 : size += fd_gossip_deprecated_compression_type_size( &self->compression );
18190 0 : do {
18191 0 : size += sizeof(ulong);
18192 0 : size += self->compressed_list_len;
18193 0 : } while(0);
18194 0 : return size;
18195 0 : }
18196 :
18197 0 : int fd_gossip_lowest_slot_encode( fd_gossip_lowest_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18198 0 : int err;
18199 0 : err = fd_bincode_uint8_encode( (uchar)(self->u8), ctx );
18200 0 : if( FD_UNLIKELY( err ) ) return err;
18201 0 : err = fd_pubkey_encode( &self->from, ctx );
18202 0 : if( FD_UNLIKELY( err ) ) return err;
18203 0 : err = fd_bincode_uint64_encode( self->root, ctx );
18204 0 : if( FD_UNLIKELY( err ) ) return err;
18205 0 : err = fd_bincode_uint64_encode( self->lowest, ctx );
18206 0 : if( FD_UNLIKELY( err ) ) return err;
18207 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
18208 0 : if( FD_UNLIKELY(err) ) return err;
18209 0 : if( self->slots_len ) {
18210 0 : for( ulong i=0; i < self->slots_len; i++ ) {
18211 0 : err = fd_bincode_uint64_encode( self->slots[i], ctx );
18212 0 : }
18213 0 : }
18214 0 : err = fd_bincode_uint64_encode( self->stash_len, ctx );
18215 0 : if( FD_UNLIKELY(err) ) return err;
18216 0 : if( self->stash_len ) {
18217 0 : for( ulong i=0; i < self->stash_len; i++ ) {
18218 0 : err = fd_gossip_deprecated_epoch_incomplete_slots_encode( self->stash + i, ctx );
18219 0 : if( FD_UNLIKELY( err ) ) return err;
18220 0 : }
18221 0 : }
18222 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
18223 0 : if( FD_UNLIKELY( err ) ) return err;
18224 0 : return FD_BINCODE_SUCCESS;
18225 0 : }
18226 0 : static int fd_gossip_lowest_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18227 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18228 0 : int err = 0;
18229 0 : err = fd_bincode_uint8_decode_footprint( ctx );
18230 0 : if( FD_UNLIKELY( err ) ) return err;
18231 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
18232 0 : if( FD_UNLIKELY( err ) ) return err;
18233 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18234 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18235 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18236 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18237 0 : ulong slots_len;
18238 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
18239 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18240 0 : if( slots_len ) {
18241 0 : *total_sz += 8UL + sizeof(ulong)*slots_len;
18242 0 : for( ulong i=0; i < slots_len; i++ ) {
18243 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18244 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18245 0 : }
18246 0 : }
18247 0 : ulong stash_len;
18248 0 : err = fd_bincode_uint64_decode( &stash_len, ctx );
18249 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18250 0 : if( stash_len ) {
18251 0 : *total_sz += FD_GOSSIP_DEPRECATED_EPOCH_INCOMPLETE_SLOTS_ALIGN + sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t)*stash_len;
18252 0 : for( ulong i=0; i < stash_len; i++ ) {
18253 0 : err = fd_gossip_deprecated_epoch_incomplete_slots_decode_footprint_inner( ctx, total_sz );
18254 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18255 0 : }
18256 0 : }
18257 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18258 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18259 0 : return 0;
18260 0 : }
18261 0 : int fd_gossip_lowest_slot_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18262 0 : *total_sz += sizeof(fd_gossip_lowest_slot_t);
18263 0 : void const * start_data = ctx->data;
18264 0 : int err = fd_gossip_lowest_slot_decode_footprint_inner( ctx, total_sz );
18265 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18266 0 : ctx->data = start_data;
18267 0 : return err;
18268 0 : }
18269 0 : static void fd_gossip_lowest_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18270 0 : fd_gossip_lowest_slot_t * self = (fd_gossip_lowest_slot_t *)struct_mem;
18271 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
18272 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
18273 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
18274 0 : fd_bincode_uint64_decode_unsafe( &self->lowest, ctx );
18275 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
18276 0 : if( self->slots_len ) {
18277 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
18278 0 : self->slots = *alloc_mem;
18279 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->slots_len;
18280 0 : for( ulong i=0; i < self->slots_len; i++ ) {
18281 0 : fd_bincode_uint64_decode_unsafe( self->slots + i, ctx );
18282 0 : }
18283 0 : } else
18284 0 : self->slots = NULL;
18285 0 : fd_bincode_uint64_decode_unsafe( &self->stash_len, ctx );
18286 0 : if( self->stash_len ) {
18287 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_DEPRECATED_EPOCH_INCOMPLETE_SLOTS_ALIGN );
18288 0 : self->stash = *alloc_mem;
18289 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_gossip_deprecated_epoch_incomplete_slots_t)*self->stash_len;
18290 0 : for( ulong i=0; i < self->stash_len; i++ ) {
18291 0 : fd_gossip_deprecated_epoch_incomplete_slots_new( self->stash + i );
18292 0 : fd_gossip_deprecated_epoch_incomplete_slots_decode_inner( self->stash + i, alloc_mem, ctx );
18293 0 : }
18294 0 : } else
18295 0 : self->stash = NULL;
18296 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
18297 0 : }
18298 0 : void * fd_gossip_lowest_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18299 0 : fd_gossip_lowest_slot_t * self = (fd_gossip_lowest_slot_t *)mem;
18300 0 : fd_gossip_lowest_slot_new( self );
18301 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_lowest_slot_t);
18302 0 : void * * alloc_mem = &alloc_region;
18303 0 : fd_gossip_lowest_slot_decode_inner( mem, alloc_mem, ctx );
18304 0 : return self;
18305 0 : }
18306 0 : void fd_gossip_lowest_slot_new(fd_gossip_lowest_slot_t * self) {
18307 0 : fd_memset( self, 0, sizeof(fd_gossip_lowest_slot_t) );
18308 0 : fd_pubkey_new( &self->from );
18309 0 : }
18310 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, uint varint ) {
18311 0 : (void) varint;
18312 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_lowest_slot", level++, 0 );
18313 0 : fun( w, &self->u8, "u8", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
18314 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
18315 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18316 0 : fun( w, &self->lowest, "lowest", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18317 0 : if( self->slots_len ) {
18318 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
18319 0 : for( ulong i=0; i < self->slots_len; i++ )
18320 0 : fun( w, self->slots + i, "slots", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18321 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
18322 0 : }
18323 0 : if( self->stash_len ) {
18324 0 : fun( w, NULL, "stash", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
18325 0 : for( ulong i=0; i < self->stash_len; i++ )
18326 0 : fd_gossip_deprecated_epoch_incomplete_slots_walk(w, self->stash + i, fun, "gossip_deprecated_epoch_incomplete_slots", level, 0 );
18327 0 : fun( w, NULL, "stash", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
18328 0 : }
18329 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18330 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_lowest_slot", level--, 0 );
18331 0 : }
18332 0 : ulong fd_gossip_lowest_slot_size( fd_gossip_lowest_slot_t const * self ) {
18333 0 : ulong size = 0;
18334 0 : size += sizeof(char);
18335 0 : size += fd_pubkey_size( &self->from );
18336 0 : size += sizeof(ulong);
18337 0 : size += sizeof(ulong);
18338 0 : do {
18339 0 : size += sizeof(ulong);
18340 0 : size += self->slots_len * sizeof(ulong);
18341 0 : } while(0);
18342 0 : do {
18343 0 : size += sizeof(ulong);
18344 0 : for( ulong i=0; i < self->stash_len; i++ )
18345 0 : size += fd_gossip_deprecated_epoch_incomplete_slots_size( self->stash + i );
18346 0 : } while(0);
18347 0 : size += sizeof(ulong);
18348 0 : return size;
18349 0 : }
18350 :
18351 0 : int fd_gossip_slot_hashes_encode( fd_gossip_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18352 0 : int err;
18353 0 : err = fd_pubkey_encode( &self->from, ctx );
18354 0 : if( FD_UNLIKELY( err ) ) return err;
18355 0 : err = fd_bincode_uint64_encode( self->hashes_len, ctx );
18356 0 : if( FD_UNLIKELY(err) ) return err;
18357 0 : if( self->hashes_len ) {
18358 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
18359 0 : err = fd_slot_hash_encode( self->hashes + i, ctx );
18360 0 : if( FD_UNLIKELY( err ) ) return err;
18361 0 : }
18362 0 : }
18363 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
18364 0 : if( FD_UNLIKELY( err ) ) return err;
18365 0 : return FD_BINCODE_SUCCESS;
18366 0 : }
18367 3 : static int fd_gossip_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18368 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18369 3 : int err = 0;
18370 3 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
18371 3 : if( FD_UNLIKELY( err ) ) return err;
18372 3 : ulong hashes_len;
18373 3 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
18374 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18375 3 : if( hashes_len ) {
18376 3 : *total_sz += FD_SLOT_HASH_ALIGN + sizeof(fd_slot_hash_t)*hashes_len;
18377 6 : for( ulong i=0; i < hashes_len; i++ ) {
18378 3 : err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
18379 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18380 3 : }
18381 3 : }
18382 3 : err = fd_bincode_uint64_decode_footprint( ctx );
18383 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18384 3 : return 0;
18385 3 : }
18386 0 : int fd_gossip_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18387 0 : *total_sz += sizeof(fd_gossip_slot_hashes_t);
18388 0 : void const * start_data = ctx->data;
18389 0 : int err = fd_gossip_slot_hashes_decode_footprint_inner( ctx, total_sz );
18390 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18391 0 : ctx->data = start_data;
18392 0 : return err;
18393 0 : }
18394 3 : static void fd_gossip_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18395 3 : fd_gossip_slot_hashes_t * self = (fd_gossip_slot_hashes_t *)struct_mem;
18396 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
18397 3 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
18398 3 : if( self->hashes_len ) {
18399 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_HASH_ALIGN );
18400 3 : self->hashes = *alloc_mem;
18401 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_hash_t)*self->hashes_len;
18402 6 : for( ulong i=0; i < self->hashes_len; i++ ) {
18403 3 : fd_slot_hash_new( self->hashes + i );
18404 3 : fd_slot_hash_decode_inner( self->hashes + i, alloc_mem, ctx );
18405 3 : }
18406 3 : } else
18407 0 : self->hashes = NULL;
18408 3 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
18409 3 : }
18410 0 : void * fd_gossip_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18411 0 : fd_gossip_slot_hashes_t * self = (fd_gossip_slot_hashes_t *)mem;
18412 0 : fd_gossip_slot_hashes_new( self );
18413 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slot_hashes_t);
18414 0 : void * * alloc_mem = &alloc_region;
18415 0 : fd_gossip_slot_hashes_decode_inner( mem, alloc_mem, ctx );
18416 0 : return self;
18417 0 : }
18418 0 : void fd_gossip_slot_hashes_new(fd_gossip_slot_hashes_t * self) {
18419 0 : fd_memset( self, 0, sizeof(fd_gossip_slot_hashes_t) );
18420 0 : fd_pubkey_new( &self->from );
18421 0 : }
18422 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, uint varint ) {
18423 3 : (void) varint;
18424 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_slot_hashes", level++, 0 );
18425 3 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
18426 3 : if( self->hashes_len ) {
18427 3 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
18428 6 : for( ulong i=0; i < self->hashes_len; i++ )
18429 3 : fd_slot_hash_walk(w, self->hashes + i, fun, "slot_hash", level, 0 );
18430 3 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
18431 3 : }
18432 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18433 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_slot_hashes", level--, 0 );
18434 3 : }
18435 0 : ulong fd_gossip_slot_hashes_size( fd_gossip_slot_hashes_t const * self ) {
18436 0 : ulong size = 0;
18437 0 : size += fd_pubkey_size( &self->from );
18438 0 : do {
18439 0 : size += sizeof(ulong);
18440 0 : for( ulong i=0; i < self->hashes_len; i++ )
18441 0 : size += fd_slot_hash_size( self->hashes + i );
18442 0 : } while(0);
18443 0 : size += sizeof(ulong);
18444 0 : return size;
18445 0 : }
18446 :
18447 0 : int fd_gossip_slots_encode( fd_gossip_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18448 0 : int err;
18449 0 : err = fd_bincode_uint64_encode( self->first_slot, ctx );
18450 0 : if( FD_UNLIKELY( err ) ) return err;
18451 0 : err = fd_bincode_uint64_encode( self->num, ctx );
18452 0 : if( FD_UNLIKELY( err ) ) return err;
18453 0 : err = fd_bincode_bool_encode( self->has_slots, ctx );
18454 0 : if( FD_UNLIKELY( err ) ) return err;
18455 0 : if( self->has_slots ) {
18456 0 : err = fd_bincode_uint64_encode( self->slots_bitvec_len, ctx );
18457 0 : if( FD_UNLIKELY(err) ) return err;
18458 0 : if( self->slots_bitvec_len ) {
18459 0 : err = fd_bincode_bytes_encode( self->slots_bitvec, self->slots_bitvec_len, ctx );
18460 0 : if( FD_UNLIKELY( err ) ) return err;
18461 0 : }
18462 0 : if( FD_UNLIKELY( err ) ) return err;
18463 0 : }
18464 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
18465 0 : if( FD_UNLIKELY( err ) ) return err;
18466 0 : return FD_BINCODE_SUCCESS;
18467 0 : }
18468 0 : static int fd_gossip_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18469 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18470 0 : int err = 0;
18471 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18472 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18473 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18474 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18475 0 : {
18476 0 : uchar o;
18477 0 : ulong inner_len = 0UL;
18478 0 : err = fd_bincode_bool_decode( &o, ctx );
18479 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18480 0 : if( o ) {
18481 0 : ulong slots_bitvec_len;
18482 0 : err = fd_bincode_uint64_decode( &slots_bitvec_len, ctx );
18483 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18484 0 : if( slots_bitvec_len ) {
18485 0 : *total_sz += 8UL + slots_bitvec_len;
18486 0 : err = fd_bincode_bytes_decode_footprint( slots_bitvec_len, ctx );
18487 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18488 0 : }
18489 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18490 0 : inner_len = slots_bitvec_len;
18491 0 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
18492 0 : }
18493 0 : ulong len;
18494 0 : err = fd_bincode_uint64_decode( &len, ctx );
18495 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18496 0 : if( len > inner_len * sizeof(uchar) * 8UL ) return FD_BINCODE_ERR_ENCODING;
18497 0 : }
18498 0 : return 0;
18499 0 : }
18500 0 : int fd_gossip_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18501 0 : *total_sz += sizeof(fd_gossip_slots_t);
18502 0 : void const * start_data = ctx->data;
18503 0 : int err = fd_gossip_slots_decode_footprint_inner( ctx, total_sz );
18504 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18505 0 : ctx->data = start_data;
18506 0 : return err;
18507 0 : }
18508 0 : static void fd_gossip_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18509 0 : fd_gossip_slots_t * self = (fd_gossip_slots_t *)struct_mem;
18510 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
18511 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
18512 0 : {
18513 0 : uchar o;
18514 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18515 0 : self->has_slots = !!o;
18516 0 : if( o ) {
18517 0 : fd_bincode_uint64_decode_unsafe( &self->slots_bitvec_len, ctx );
18518 0 : if( self->slots_bitvec_len ) {
18519 0 : self->slots_bitvec = *alloc_mem;
18520 0 : fd_bincode_bytes_decode_unsafe( self->slots_bitvec, self->slots_bitvec_len, ctx );
18521 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->slots_bitvec_len;
18522 0 : } else
18523 0 : self->slots_bitvec = NULL;
18524 0 : } else {
18525 0 : self->slots_bitvec = NULL;
18526 0 : }
18527 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
18528 0 : }
18529 0 : }
18530 0 : void * fd_gossip_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18531 0 : fd_gossip_slots_t * self = (fd_gossip_slots_t *)mem;
18532 0 : fd_gossip_slots_new( self );
18533 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slots_t);
18534 0 : void * * alloc_mem = &alloc_region;
18535 0 : fd_gossip_slots_decode_inner( mem, alloc_mem, ctx );
18536 0 : return self;
18537 0 : }
18538 0 : void fd_gossip_slots_new(fd_gossip_slots_t * self) {
18539 0 : fd_memset( self, 0, sizeof(fd_gossip_slots_t) );
18540 0 : }
18541 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, uint varint ) {
18542 0 : (void) varint;
18543 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_slots", level++, 0 );
18544 0 : fun( w, &self->first_slot, "first_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18545 0 : fun( w, &self->num, "num", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18546 0 : if( !self->has_slots ) {
18547 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_NULL, "uchar", level, 0 );
18548 0 : } else {
18549 0 : if( self->slots_bitvec_len ) {
18550 0 : fun( w, NULL, "slots_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
18551 0 : for( ulong i=0; i < self->slots_bitvec_len; i++ )
18552 0 : fun( w, self->slots_bitvec + i, "slots_bitvec", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
18553 0 : fun( w, NULL, "slots_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
18554 0 : }
18555 0 : }
18556 0 : fun( w, &self->slots_len, "slots_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18557 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_slots", level--, 0 );
18558 0 : }
18559 0 : ulong fd_gossip_slots_size( fd_gossip_slots_t const * self ) {
18560 0 : ulong size = 0;
18561 0 : size += sizeof(ulong);
18562 0 : size += sizeof(ulong);
18563 0 : size += sizeof(char);
18564 0 : if( self->has_slots ) {
18565 0 : do {
18566 0 : size += sizeof(ulong);
18567 0 : size += self->slots_bitvec_len;
18568 0 : } while(0);
18569 0 : }
18570 0 : size += sizeof(ulong);
18571 0 : return size;
18572 0 : }
18573 :
18574 0 : int fd_gossip_flate2_slots_encode( fd_gossip_flate2_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18575 0 : int err;
18576 0 : err = fd_bincode_uint64_encode( self->first_slot, ctx );
18577 0 : if( FD_UNLIKELY( err ) ) return err;
18578 0 : err = fd_bincode_uint64_encode( self->num, ctx );
18579 0 : if( FD_UNLIKELY( err ) ) return err;
18580 0 : err = fd_bincode_uint64_encode( self->compressed_len, ctx );
18581 0 : if( FD_UNLIKELY(err) ) return err;
18582 0 : if( self->compressed_len ) {
18583 0 : err = fd_bincode_bytes_encode( self->compressed, self->compressed_len, ctx );
18584 0 : if( FD_UNLIKELY( err ) ) return err;
18585 0 : }
18586 0 : return FD_BINCODE_SUCCESS;
18587 0 : }
18588 0 : static int fd_gossip_flate2_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18589 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18590 0 : int err = 0;
18591 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18592 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18593 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18594 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18595 0 : ulong compressed_len;
18596 0 : err = fd_bincode_uint64_decode( &compressed_len, ctx );
18597 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18598 0 : if( compressed_len ) {
18599 0 : *total_sz += 8UL + compressed_len;
18600 0 : err = fd_bincode_bytes_decode_footprint( compressed_len, ctx );
18601 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18602 0 : }
18603 0 : return 0;
18604 0 : }
18605 0 : int fd_gossip_flate2_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18606 0 : *total_sz += sizeof(fd_gossip_flate2_slots_t);
18607 0 : void const * start_data = ctx->data;
18608 0 : int err = fd_gossip_flate2_slots_decode_footprint_inner( ctx, total_sz );
18609 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18610 0 : ctx->data = start_data;
18611 0 : return err;
18612 0 : }
18613 0 : static void fd_gossip_flate2_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18614 0 : fd_gossip_flate2_slots_t * self = (fd_gossip_flate2_slots_t *)struct_mem;
18615 0 : fd_bincode_uint64_decode_unsafe( &self->first_slot, ctx );
18616 0 : fd_bincode_uint64_decode_unsafe( &self->num, ctx );
18617 0 : fd_bincode_uint64_decode_unsafe( &self->compressed_len, ctx );
18618 0 : if( self->compressed_len ) {
18619 0 : self->compressed = *alloc_mem;
18620 0 : fd_bincode_bytes_decode_unsafe( self->compressed, self->compressed_len, ctx );
18621 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->compressed_len;
18622 0 : } else
18623 0 : self->compressed = NULL;
18624 0 : }
18625 0 : void * fd_gossip_flate2_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18626 0 : fd_gossip_flate2_slots_t * self = (fd_gossip_flate2_slots_t *)mem;
18627 0 : fd_gossip_flate2_slots_new( self );
18628 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_flate2_slots_t);
18629 0 : void * * alloc_mem = &alloc_region;
18630 0 : fd_gossip_flate2_slots_decode_inner( mem, alloc_mem, ctx );
18631 0 : return self;
18632 0 : }
18633 0 : void fd_gossip_flate2_slots_new(fd_gossip_flate2_slots_t * self) {
18634 0 : fd_memset( self, 0, sizeof(fd_gossip_flate2_slots_t) );
18635 0 : }
18636 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, uint varint ) {
18637 0 : (void) varint;
18638 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_flate2_slots", level++, 0 );
18639 0 : fun( w, &self->first_slot, "first_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18640 0 : fun( w, &self->num, "num", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18641 0 : if( self->compressed_len ) {
18642 0 : fun( w, NULL, "compressed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
18643 0 : for( ulong i=0; i < self->compressed_len; i++ )
18644 0 : fun( w, self->compressed + i, "compressed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
18645 0 : fun( w, NULL, "compressed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
18646 0 : }
18647 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_flate2_slots", level--, 0 );
18648 0 : }
18649 0 : ulong fd_gossip_flate2_slots_size( fd_gossip_flate2_slots_t const * self ) {
18650 0 : ulong size = 0;
18651 0 : size += sizeof(ulong);
18652 0 : size += sizeof(ulong);
18653 0 : do {
18654 0 : size += sizeof(ulong);
18655 0 : size += self->compressed_len;
18656 0 : } while(0);
18657 0 : return size;
18658 0 : }
18659 :
18660 0 : FD_FN_PURE uchar fd_gossip_slots_enum_is_flate2(fd_gossip_slots_enum_t const * self) {
18661 0 : return self->discriminant == 0;
18662 0 : }
18663 0 : FD_FN_PURE uchar fd_gossip_slots_enum_is_uncompressed(fd_gossip_slots_enum_t const * self) {
18664 0 : return self->discriminant == 1;
18665 0 : }
18666 : void fd_gossip_slots_enum_inner_new( fd_gossip_slots_enum_inner_t * self, uint discriminant );
18667 0 : int fd_gossip_slots_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18668 0 : int err;
18669 0 : switch (discriminant) {
18670 0 : case 0: {
18671 0 : err = fd_gossip_flate2_slots_decode_footprint_inner( ctx, total_sz );
18672 0 : if( FD_UNLIKELY( err ) ) return err;
18673 0 : return FD_BINCODE_SUCCESS;
18674 0 : }
18675 0 : case 1: {
18676 0 : err = fd_gossip_slots_decode_footprint_inner( ctx, total_sz );
18677 0 : if( FD_UNLIKELY( err ) ) return err;
18678 0 : return FD_BINCODE_SUCCESS;
18679 0 : }
18680 0 : default: return FD_BINCODE_ERR_ENCODING;
18681 0 : }
18682 0 : }
18683 0 : static int fd_gossip_slots_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18684 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18685 0 : uint discriminant = 0;
18686 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
18687 0 : if( FD_UNLIKELY( err ) ) return err;
18688 0 : return fd_gossip_slots_enum_inner_decode_footprint( discriminant, ctx, total_sz );
18689 0 : }
18690 0 : int fd_gossip_slots_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18691 0 : *total_sz += sizeof(fd_gossip_slots_enum_t);
18692 0 : void const * start_data = ctx->data;
18693 0 : int err = fd_gossip_slots_enum_decode_footprint_inner( ctx, total_sz );
18694 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18695 0 : ctx->data = start_data;
18696 0 : return err;
18697 0 : }
18698 0 : static void fd_gossip_slots_enum_inner_decode_inner( fd_gossip_slots_enum_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
18699 0 : switch (discriminant) {
18700 0 : case 0: {
18701 0 : fd_gossip_flate2_slots_decode_inner( &self->flate2, alloc_mem, ctx );
18702 0 : break;
18703 0 : }
18704 0 : case 1: {
18705 0 : fd_gossip_slots_decode_inner( &self->uncompressed, alloc_mem, ctx );
18706 0 : break;
18707 0 : }
18708 0 : }
18709 0 : }
18710 0 : static void fd_gossip_slots_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18711 0 : fd_gossip_slots_enum_t * self = (fd_gossip_slots_enum_t *)struct_mem;
18712 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
18713 0 : fd_gossip_slots_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
18714 0 : }
18715 0 : void * fd_gossip_slots_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18716 0 : fd_gossip_slots_enum_t * self = (fd_gossip_slots_enum_t *)mem;
18717 0 : fd_gossip_slots_enum_new( self );
18718 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_slots_enum_t);
18719 0 : void * * alloc_mem = &alloc_region;
18720 0 : fd_gossip_slots_enum_decode_inner( mem, alloc_mem, ctx );
18721 0 : return self;
18722 0 : }
18723 0 : void fd_gossip_slots_enum_inner_new( fd_gossip_slots_enum_inner_t * self, uint discriminant ) {
18724 0 : switch( discriminant ) {
18725 0 : case 0: {
18726 0 : fd_gossip_flate2_slots_new( &self->flate2 );
18727 0 : break;
18728 0 : }
18729 0 : case 1: {
18730 0 : fd_gossip_slots_new( &self->uncompressed );
18731 0 : break;
18732 0 : }
18733 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
18734 0 : }
18735 0 : }
18736 0 : void fd_gossip_slots_enum_new_disc( fd_gossip_slots_enum_t * self, uint discriminant ) {
18737 0 : self->discriminant = discriminant;
18738 0 : fd_gossip_slots_enum_inner_new( &self->inner, self->discriminant );
18739 0 : }
18740 0 : void fd_gossip_slots_enum_new( fd_gossip_slots_enum_t * self ) {
18741 0 : fd_memset( self, 0, sizeof(fd_gossip_slots_enum_t) );
18742 0 : fd_gossip_slots_enum_new_disc( self, UINT_MAX );
18743 0 : }
18744 :
18745 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, uint varint ) {
18746 0 : (void) varint;
18747 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_slots_enum", level++, 0);
18748 0 : switch( self->discriminant ) {
18749 0 : case 0: {
18750 0 : fun( w, self, "flate2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18751 0 : fd_gossip_flate2_slots_walk( w, &self->inner.flate2, fun, "flate2", level, 0 );
18752 0 : break;
18753 0 : }
18754 0 : case 1: {
18755 0 : fun( w, self, "uncompressed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
18756 0 : fd_gossip_slots_walk( w, &self->inner.uncompressed, fun, "uncompressed", level, 0 );
18757 0 : break;
18758 0 : }
18759 0 : }
18760 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_slots_enum", level--, 0 );
18761 0 : }
18762 0 : ulong fd_gossip_slots_enum_size( fd_gossip_slots_enum_t const * self ) {
18763 0 : ulong size = 0;
18764 0 : size += sizeof(uint);
18765 0 : switch (self->discriminant) {
18766 0 : case 0: {
18767 0 : size += fd_gossip_flate2_slots_size( &self->inner.flate2 );
18768 0 : break;
18769 0 : }
18770 0 : case 1: {
18771 0 : size += fd_gossip_slots_size( &self->inner.uncompressed );
18772 0 : break;
18773 0 : }
18774 0 : }
18775 0 : return size;
18776 0 : }
18777 :
18778 0 : int fd_gossip_slots_enum_inner_encode( fd_gossip_slots_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
18779 0 : int err;
18780 0 : switch (discriminant) {
18781 0 : case 0: {
18782 0 : err = fd_gossip_flate2_slots_encode( &self->flate2, ctx );
18783 0 : if( FD_UNLIKELY( err ) ) return err;
18784 0 : break;
18785 0 : }
18786 0 : case 1: {
18787 0 : err = fd_gossip_slots_encode( &self->uncompressed, ctx );
18788 0 : if( FD_UNLIKELY( err ) ) return err;
18789 0 : break;
18790 0 : }
18791 0 : }
18792 0 : return FD_BINCODE_SUCCESS;
18793 0 : }
18794 0 : int fd_gossip_slots_enum_encode( fd_gossip_slots_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18795 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
18796 0 : if( FD_UNLIKELY( err ) ) return err;
18797 0 : return fd_gossip_slots_enum_inner_encode( &self->inner, self->discriminant, ctx );
18798 0 : }
18799 :
18800 0 : int fd_gossip_epoch_slots_encode( fd_gossip_epoch_slots_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18801 0 : int err;
18802 0 : err = fd_bincode_uint8_encode( (uchar)(self->u8), ctx );
18803 0 : if( FD_UNLIKELY( err ) ) return err;
18804 0 : err = fd_pubkey_encode( &self->from, ctx );
18805 0 : if( FD_UNLIKELY( err ) ) return err;
18806 0 : err = fd_bincode_uint64_encode( self->slots_len, ctx );
18807 0 : if( FD_UNLIKELY(err) ) return err;
18808 0 : if( self->slots_len ) {
18809 0 : for( ulong i=0; i < self->slots_len; i++ ) {
18810 0 : err = fd_gossip_slots_enum_encode( self->slots + i, ctx );
18811 0 : if( FD_UNLIKELY( err ) ) return err;
18812 0 : }
18813 0 : }
18814 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
18815 0 : if( FD_UNLIKELY( err ) ) return err;
18816 0 : return FD_BINCODE_SUCCESS;
18817 0 : }
18818 0 : static int fd_gossip_epoch_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18819 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18820 0 : int err = 0;
18821 0 : err = fd_bincode_uint8_decode_footprint( ctx );
18822 0 : if( FD_UNLIKELY( err ) ) return err;
18823 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
18824 0 : if( FD_UNLIKELY( err ) ) return err;
18825 0 : ulong slots_len;
18826 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
18827 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18828 0 : if( slots_len ) {
18829 0 : *total_sz += FD_GOSSIP_SLOTS_ENUM_ALIGN + sizeof(fd_gossip_slots_enum_t)*slots_len;
18830 0 : for( ulong i=0; i < slots_len; i++ ) {
18831 0 : err = fd_gossip_slots_enum_decode_footprint_inner( ctx, total_sz );
18832 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18833 0 : }
18834 0 : }
18835 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18836 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18837 0 : return 0;
18838 0 : }
18839 0 : int fd_gossip_epoch_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18840 0 : *total_sz += sizeof(fd_gossip_epoch_slots_t);
18841 0 : void const * start_data = ctx->data;
18842 0 : int err = fd_gossip_epoch_slots_decode_footprint_inner( ctx, total_sz );
18843 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18844 0 : ctx->data = start_data;
18845 0 : return err;
18846 0 : }
18847 0 : static void fd_gossip_epoch_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18848 0 : fd_gossip_epoch_slots_t * self = (fd_gossip_epoch_slots_t *)struct_mem;
18849 0 : fd_bincode_uint8_decode_unsafe( &self->u8, ctx );
18850 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
18851 0 : fd_bincode_uint64_decode_unsafe( &self->slots_len, ctx );
18852 0 : if( self->slots_len ) {
18853 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_SLOTS_ENUM_ALIGN );
18854 0 : self->slots = *alloc_mem;
18855 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_gossip_slots_enum_t)*self->slots_len;
18856 0 : for( ulong i=0; i < self->slots_len; i++ ) {
18857 0 : fd_gossip_slots_enum_new( self->slots + i );
18858 0 : fd_gossip_slots_enum_decode_inner( self->slots + i, alloc_mem, ctx );
18859 0 : }
18860 0 : } else
18861 0 : self->slots = NULL;
18862 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
18863 0 : }
18864 0 : void * fd_gossip_epoch_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18865 0 : fd_gossip_epoch_slots_t * self = (fd_gossip_epoch_slots_t *)mem;
18866 0 : fd_gossip_epoch_slots_new( self );
18867 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_epoch_slots_t);
18868 0 : void * * alloc_mem = &alloc_region;
18869 0 : fd_gossip_epoch_slots_decode_inner( mem, alloc_mem, ctx );
18870 0 : return self;
18871 0 : }
18872 0 : void fd_gossip_epoch_slots_new(fd_gossip_epoch_slots_t * self) {
18873 0 : fd_memset( self, 0, sizeof(fd_gossip_epoch_slots_t) );
18874 0 : fd_pubkey_new( &self->from );
18875 0 : }
18876 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, uint varint ) {
18877 0 : (void) varint;
18878 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_epoch_slots", level++, 0 );
18879 0 : fun( w, &self->u8, "u8", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
18880 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
18881 0 : if( self->slots_len ) {
18882 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
18883 0 : for( ulong i=0; i < self->slots_len; i++ )
18884 0 : fd_gossip_slots_enum_walk(w, self->slots + i, fun, "gossip_slots_enum", level, 0 );
18885 0 : fun( w, NULL, "slots", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
18886 0 : }
18887 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18888 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_epoch_slots", level--, 0 );
18889 0 : }
18890 0 : ulong fd_gossip_epoch_slots_size( fd_gossip_epoch_slots_t const * self ) {
18891 0 : ulong size = 0;
18892 0 : size += sizeof(char);
18893 0 : size += fd_pubkey_size( &self->from );
18894 0 : do {
18895 0 : size += sizeof(ulong);
18896 0 : for( ulong i=0; i < self->slots_len; i++ )
18897 0 : size += fd_gossip_slots_enum_size( self->slots + i );
18898 0 : } while(0);
18899 0 : size += sizeof(ulong);
18900 0 : return size;
18901 0 : }
18902 :
18903 0 : int fd_gossip_version_v1_encode( fd_gossip_version_v1_t const * self, fd_bincode_encode_ctx_t * ctx ) {
18904 0 : int err;
18905 0 : err = fd_pubkey_encode( &self->from, ctx );
18906 0 : if( FD_UNLIKELY( err ) ) return err;
18907 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
18908 0 : if( FD_UNLIKELY( err ) ) return err;
18909 0 : err = fd_bincode_uint16_encode( self->major, ctx );
18910 0 : if( FD_UNLIKELY( err ) ) return err;
18911 0 : err = fd_bincode_uint16_encode( self->minor, ctx );
18912 0 : if( FD_UNLIKELY( err ) ) return err;
18913 0 : err = fd_bincode_uint16_encode( self->patch, ctx );
18914 0 : if( FD_UNLIKELY( err ) ) return err;
18915 0 : err = fd_bincode_bool_encode( self->has_commit, ctx );
18916 0 : if( FD_UNLIKELY( err ) ) return err;
18917 0 : if( self->has_commit ) {
18918 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
18919 0 : if( FD_UNLIKELY( err ) ) return err;
18920 0 : }
18921 0 : return FD_BINCODE_SUCCESS;
18922 0 : }
18923 0 : static int fd_gossip_version_v1_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18924 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18925 0 : int err = 0;
18926 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
18927 0 : if( FD_UNLIKELY( err ) ) return err;
18928 0 : err = fd_bincode_uint64_decode_footprint( ctx );
18929 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18930 0 : err = fd_bincode_uint16_decode_footprint( ctx );
18931 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18932 0 : err = fd_bincode_uint16_decode_footprint( ctx );
18933 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18934 0 : err = fd_bincode_uint16_decode_footprint( ctx );
18935 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18936 0 : {
18937 0 : uchar o;
18938 0 : err = fd_bincode_bool_decode( &o, ctx );
18939 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18940 0 : if( o ) {
18941 0 : err = fd_bincode_uint32_decode_footprint( ctx );
18942 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
18943 0 : }
18944 0 : }
18945 0 : return 0;
18946 0 : }
18947 0 : int fd_gossip_version_v1_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18948 0 : *total_sz += sizeof(fd_gossip_version_v1_t);
18949 0 : void const * start_data = ctx->data;
18950 0 : int err = fd_gossip_version_v1_decode_footprint_inner( ctx, total_sz );
18951 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
18952 0 : ctx->data = start_data;
18953 0 : return err;
18954 0 : }
18955 0 : static void fd_gossip_version_v1_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
18956 0 : fd_gossip_version_v1_t * self = (fd_gossip_version_v1_t *)struct_mem;
18957 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
18958 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
18959 0 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
18960 0 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
18961 0 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
18962 0 : {
18963 0 : uchar o;
18964 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
18965 0 : self->has_commit = !!o;
18966 0 : if( o ) {
18967 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
18968 0 : }
18969 0 : }
18970 0 : }
18971 0 : void * fd_gossip_version_v1_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
18972 0 : fd_gossip_version_v1_t * self = (fd_gossip_version_v1_t *)mem;
18973 0 : fd_gossip_version_v1_new( self );
18974 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v1_t);
18975 0 : void * * alloc_mem = &alloc_region;
18976 0 : fd_gossip_version_v1_decode_inner( mem, alloc_mem, ctx );
18977 0 : return self;
18978 0 : }
18979 0 : void fd_gossip_version_v1_new(fd_gossip_version_v1_t * self) {
18980 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v1_t) );
18981 0 : fd_pubkey_new( &self->from );
18982 0 : }
18983 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, uint varint ) {
18984 0 : (void) varint;
18985 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v1", level++, 0 );
18986 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
18987 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
18988 0 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
18989 0 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
18990 0 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
18991 0 : if( !self->has_commit ) {
18992 0 : fun( w, NULL, "commit", FD_FLAMENCO_TYPE_NULL, "uint", level, 0 );
18993 0 : } else {
18994 0 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
18995 0 : }
18996 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v1", level--, 0 );
18997 0 : }
18998 0 : ulong fd_gossip_version_v1_size( fd_gossip_version_v1_t const * self ) {
18999 0 : ulong size = 0;
19000 0 : size += fd_pubkey_size( &self->from );
19001 0 : size += sizeof(ulong);
19002 0 : size += sizeof(ushort);
19003 0 : size += sizeof(ushort);
19004 0 : size += sizeof(ushort);
19005 0 : size += sizeof(char);
19006 0 : if( self->has_commit ) {
19007 0 : size += sizeof(uint);
19008 0 : }
19009 0 : return size;
19010 0 : }
19011 :
19012 0 : int fd_gossip_version_v2_encode( fd_gossip_version_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19013 0 : int err;
19014 0 : err = fd_pubkey_encode( &self->from, ctx );
19015 0 : if( FD_UNLIKELY( err ) ) return err;
19016 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
19017 0 : if( FD_UNLIKELY( err ) ) return err;
19018 0 : err = fd_bincode_uint16_encode( self->major, ctx );
19019 0 : if( FD_UNLIKELY( err ) ) return err;
19020 0 : err = fd_bincode_uint16_encode( self->minor, ctx );
19021 0 : if( FD_UNLIKELY( err ) ) return err;
19022 0 : err = fd_bincode_uint16_encode( self->patch, ctx );
19023 0 : if( FD_UNLIKELY( err ) ) return err;
19024 0 : err = fd_bincode_bool_encode( self->has_commit, ctx );
19025 0 : if( FD_UNLIKELY( err ) ) return err;
19026 0 : if( self->has_commit ) {
19027 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
19028 0 : if( FD_UNLIKELY( err ) ) return err;
19029 0 : }
19030 0 : err = fd_bincode_uint32_encode( self->feature_set, ctx );
19031 0 : if( FD_UNLIKELY( err ) ) return err;
19032 0 : return FD_BINCODE_SUCCESS;
19033 0 : }
19034 3 : static int fd_gossip_version_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19035 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19036 3 : int err = 0;
19037 3 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
19038 3 : if( FD_UNLIKELY( err ) ) return err;
19039 3 : err = fd_bincode_uint64_decode_footprint( ctx );
19040 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19041 3 : err = fd_bincode_uint16_decode_footprint( ctx );
19042 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19043 3 : err = fd_bincode_uint16_decode_footprint( ctx );
19044 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19045 3 : err = fd_bincode_uint16_decode_footprint( ctx );
19046 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19047 3 : {
19048 3 : uchar o;
19049 3 : err = fd_bincode_bool_decode( &o, ctx );
19050 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19051 3 : if( o ) {
19052 0 : err = fd_bincode_uint32_decode_footprint( ctx );
19053 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19054 0 : }
19055 3 : }
19056 3 : err = fd_bincode_uint32_decode_footprint( ctx );
19057 3 : if( FD_UNLIKELY( err ) ) return err;
19058 3 : return 0;
19059 3 : }
19060 0 : int fd_gossip_version_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19061 0 : *total_sz += sizeof(fd_gossip_version_v2_t);
19062 0 : void const * start_data = ctx->data;
19063 0 : int err = fd_gossip_version_v2_decode_footprint_inner( ctx, total_sz );
19064 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19065 0 : ctx->data = start_data;
19066 0 : return err;
19067 0 : }
19068 3 : static void fd_gossip_version_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19069 3 : fd_gossip_version_v2_t * self = (fd_gossip_version_v2_t *)struct_mem;
19070 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
19071 3 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
19072 3 : fd_bincode_uint16_decode_unsafe( &self->major, ctx );
19073 3 : fd_bincode_uint16_decode_unsafe( &self->minor, ctx );
19074 3 : fd_bincode_uint16_decode_unsafe( &self->patch, ctx );
19075 3 : {
19076 3 : uchar o;
19077 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
19078 3 : self->has_commit = !!o;
19079 3 : if( o ) {
19080 0 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
19081 0 : }
19082 3 : }
19083 3 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
19084 3 : }
19085 0 : void * fd_gossip_version_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19086 0 : fd_gossip_version_v2_t * self = (fd_gossip_version_v2_t *)mem;
19087 0 : fd_gossip_version_v2_new( self );
19088 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v2_t);
19089 0 : void * * alloc_mem = &alloc_region;
19090 0 : fd_gossip_version_v2_decode_inner( mem, alloc_mem, ctx );
19091 0 : return self;
19092 0 : }
19093 0 : void fd_gossip_version_v2_new(fd_gossip_version_v2_t * self) {
19094 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v2_t) );
19095 0 : fd_pubkey_new( &self->from );
19096 0 : }
19097 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, uint varint ) {
19098 3 : (void) varint;
19099 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v2", level++, 0 );
19100 3 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
19101 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
19102 3 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
19103 3 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
19104 3 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
19105 3 : if( !self->has_commit ) {
19106 3 : fun( w, NULL, "commit", FD_FLAMENCO_TYPE_NULL, "uint", level, 0 );
19107 3 : } else {
19108 0 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
19109 0 : }
19110 3 : fun( w, &self->feature_set, "feature_set", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
19111 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v2", level--, 0 );
19112 3 : }
19113 0 : ulong fd_gossip_version_v2_size( fd_gossip_version_v2_t const * self ) {
19114 0 : ulong size = 0;
19115 0 : size += fd_pubkey_size( &self->from );
19116 0 : size += sizeof(ulong);
19117 0 : size += sizeof(ushort);
19118 0 : size += sizeof(ushort);
19119 0 : size += sizeof(ushort);
19120 0 : size += sizeof(char);
19121 0 : if( self->has_commit ) {
19122 0 : size += sizeof(uint);
19123 0 : }
19124 0 : size += sizeof(uint);
19125 0 : return size;
19126 0 : }
19127 :
19128 0 : int fd_gossip_version_v3_encode( fd_gossip_version_v3_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19129 0 : int err;
19130 0 : err = fd_bincode_compact_u16_encode( &self->major, ctx );
19131 0 : if( FD_UNLIKELY( err ) ) return err;
19132 0 : err = fd_bincode_compact_u16_encode( &self->minor, ctx );
19133 0 : if( FD_UNLIKELY( err ) ) return err;
19134 0 : err = fd_bincode_compact_u16_encode( &self->patch, ctx );
19135 0 : if( FD_UNLIKELY( err ) ) return err;
19136 0 : err = fd_bincode_uint32_encode( self->commit, ctx );
19137 0 : if( FD_UNLIKELY( err ) ) return err;
19138 0 : err = fd_bincode_uint32_encode( self->feature_set, ctx );
19139 0 : if( FD_UNLIKELY( err ) ) return err;
19140 0 : err = fd_bincode_compact_u16_encode( &self->client, ctx );
19141 0 : if( FD_UNLIKELY( err ) ) return err;
19142 0 : return FD_BINCODE_SUCCESS;
19143 0 : }
19144 3 : static int fd_gossip_version_v3_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19145 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19146 3 : int err = 0;
19147 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
19148 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19149 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
19150 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19151 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
19152 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19153 3 : err = fd_bincode_uint32_decode_footprint( ctx );
19154 3 : if( FD_UNLIKELY( err ) ) return err;
19155 3 : err = fd_bincode_uint32_decode_footprint( ctx );
19156 3 : if( FD_UNLIKELY( err ) ) return err;
19157 3 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
19158 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19159 3 : return 0;
19160 3 : }
19161 0 : int fd_gossip_version_v3_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19162 0 : *total_sz += sizeof(fd_gossip_version_v3_t);
19163 0 : void const * start_data = ctx->data;
19164 0 : int err = fd_gossip_version_v3_decode_footprint_inner( ctx, total_sz );
19165 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19166 0 : ctx->data = start_data;
19167 0 : return err;
19168 0 : }
19169 3 : static void fd_gossip_version_v3_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19170 3 : fd_gossip_version_v3_t * self = (fd_gossip_version_v3_t *)struct_mem;
19171 3 : fd_bincode_compact_u16_decode_unsafe( &self->major, ctx );
19172 3 : fd_bincode_compact_u16_decode_unsafe( &self->minor, ctx );
19173 3 : fd_bincode_compact_u16_decode_unsafe( &self->patch, ctx );
19174 3 : fd_bincode_uint32_decode_unsafe( &self->commit, ctx );
19175 3 : fd_bincode_uint32_decode_unsafe( &self->feature_set, ctx );
19176 3 : fd_bincode_compact_u16_decode_unsafe( &self->client, ctx );
19177 3 : }
19178 0 : void * fd_gossip_version_v3_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19179 0 : fd_gossip_version_v3_t * self = (fd_gossip_version_v3_t *)mem;
19180 0 : fd_gossip_version_v3_new( self );
19181 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_version_v3_t);
19182 0 : void * * alloc_mem = &alloc_region;
19183 0 : fd_gossip_version_v3_decode_inner( mem, alloc_mem, ctx );
19184 0 : return self;
19185 0 : }
19186 0 : void fd_gossip_version_v3_new(fd_gossip_version_v3_t * self) {
19187 0 : fd_memset( self, 0, sizeof(fd_gossip_version_v3_t) );
19188 0 : }
19189 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, uint varint ) {
19190 3 : (void) varint;
19191 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_version_v3", level++, 0 );
19192 3 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
19193 3 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
19194 3 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
19195 3 : fun( w, &self->commit, "commit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
19196 3 : fun( w, &self->feature_set, "feature_set", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
19197 3 : fun( w, &self->client, "client", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
19198 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_version_v3", level--, 0 );
19199 3 : }
19200 0 : ulong fd_gossip_version_v3_size( fd_gossip_version_v3_t const * self ) {
19201 0 : ulong size = 0;
19202 0 : size += fd_bincode_compact_u16_size( &self->major );
19203 0 : size += fd_bincode_compact_u16_size( &self->minor );
19204 0 : size += fd_bincode_compact_u16_size( &self->patch );
19205 0 : size += sizeof(uint);
19206 0 : size += sizeof(uint);
19207 0 : size += fd_bincode_compact_u16_size( &self->client );
19208 0 : return size;
19209 0 : }
19210 :
19211 0 : int fd_gossip_node_instance_encode( fd_gossip_node_instance_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19212 0 : int err;
19213 0 : err = fd_pubkey_encode( &self->from, ctx );
19214 0 : if( FD_UNLIKELY( err ) ) return err;
19215 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
19216 0 : if( FD_UNLIKELY( err ) ) return err;
19217 0 : err = fd_bincode_uint64_encode( self->timestamp, ctx );
19218 0 : if( FD_UNLIKELY( err ) ) return err;
19219 0 : err = fd_bincode_uint64_encode( self->token, ctx );
19220 0 : if( FD_UNLIKELY( err ) ) return err;
19221 0 : return FD_BINCODE_SUCCESS;
19222 0 : }
19223 6 : static inline int fd_gossip_node_instance_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19224 6 : if( (ulong)ctx->data + 56UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19225 6 : ctx->data = (void *)( (ulong)ctx->data + 56UL );
19226 6 : return 0;
19227 6 : }
19228 6 : static void fd_gossip_node_instance_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19229 6 : fd_gossip_node_instance_t * self = (fd_gossip_node_instance_t *)struct_mem;
19230 6 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
19231 6 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
19232 6 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
19233 6 : fd_bincode_uint64_decode_unsafe( &self->token, ctx );
19234 6 : }
19235 0 : void * fd_gossip_node_instance_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19236 0 : fd_gossip_node_instance_t * self = (fd_gossip_node_instance_t *)mem;
19237 0 : fd_gossip_node_instance_new( self );
19238 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_node_instance_t);
19239 0 : void * * alloc_mem = &alloc_region;
19240 0 : fd_gossip_node_instance_decode_inner( mem, alloc_mem, ctx );
19241 0 : return self;
19242 0 : }
19243 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, uint varint ) {
19244 6 : (void) varint;
19245 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_node_instance", level++, 0 );
19246 6 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
19247 6 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
19248 6 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
19249 6 : fun( w, &self->token, "token", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
19250 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_node_instance", level--, 0 );
19251 6 : }
19252 0 : int fd_gossip_duplicate_shred_encode( fd_gossip_duplicate_shred_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19253 0 : int err;
19254 0 : err = fd_bincode_uint16_encode( self->duplicate_shred_index, ctx );
19255 0 : if( FD_UNLIKELY( err ) ) return err;
19256 0 : err = fd_pubkey_encode( &self->from, ctx );
19257 0 : if( FD_UNLIKELY( err ) ) return err;
19258 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
19259 0 : if( FD_UNLIKELY( err ) ) return err;
19260 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
19261 0 : if( FD_UNLIKELY( err ) ) return err;
19262 0 : err = fd_bincode_uint32_encode( self->_unused, ctx );
19263 0 : if( FD_UNLIKELY( err ) ) return err;
19264 0 : err = fd_bincode_uint8_encode( (uchar)(self->_unused_shred_type), ctx );
19265 0 : if( FD_UNLIKELY( err ) ) return err;
19266 0 : err = fd_bincode_uint8_encode( (uchar)(self->num_chunks), ctx );
19267 0 : if( FD_UNLIKELY( err ) ) return err;
19268 0 : err = fd_bincode_uint8_encode( (uchar)(self->chunk_index), ctx );
19269 0 : if( FD_UNLIKELY( err ) ) return err;
19270 0 : err = fd_bincode_uint64_encode( self->chunk_len, ctx );
19271 0 : if( FD_UNLIKELY(err) ) return err;
19272 0 : if( self->chunk_len ) {
19273 0 : err = fd_bincode_bytes_encode( self->chunk, self->chunk_len, ctx );
19274 0 : if( FD_UNLIKELY( err ) ) return err;
19275 0 : }
19276 0 : return FD_BINCODE_SUCCESS;
19277 0 : }
19278 0 : static int fd_gossip_duplicate_shred_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19279 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19280 0 : int err = 0;
19281 0 : err = fd_bincode_uint16_decode_footprint( ctx );
19282 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19283 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
19284 0 : if( FD_UNLIKELY( err ) ) return err;
19285 0 : err = fd_bincode_uint64_decode_footprint( ctx );
19286 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19287 0 : err = fd_bincode_uint64_decode_footprint( ctx );
19288 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19289 0 : err = fd_bincode_uint32_decode_footprint( ctx );
19290 0 : if( FD_UNLIKELY( err ) ) return err;
19291 0 : err = fd_bincode_uint8_decode_footprint( ctx );
19292 0 : if( FD_UNLIKELY( err ) ) return err;
19293 0 : err = fd_bincode_uint8_decode_footprint( ctx );
19294 0 : if( FD_UNLIKELY( err ) ) return err;
19295 0 : err = fd_bincode_uint8_decode_footprint( ctx );
19296 0 : if( FD_UNLIKELY( err ) ) return err;
19297 0 : ulong chunk_len;
19298 0 : err = fd_bincode_uint64_decode( &chunk_len, ctx );
19299 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19300 0 : if( chunk_len ) {
19301 0 : *total_sz += 8UL + chunk_len;
19302 0 : err = fd_bincode_bytes_decode_footprint( chunk_len, ctx );
19303 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19304 0 : }
19305 0 : return 0;
19306 0 : }
19307 0 : int fd_gossip_duplicate_shred_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19308 0 : *total_sz += sizeof(fd_gossip_duplicate_shred_t);
19309 0 : void const * start_data = ctx->data;
19310 0 : int err = fd_gossip_duplicate_shred_decode_footprint_inner( ctx, total_sz );
19311 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19312 0 : ctx->data = start_data;
19313 0 : return err;
19314 0 : }
19315 0 : static void fd_gossip_duplicate_shred_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19316 0 : fd_gossip_duplicate_shred_t * self = (fd_gossip_duplicate_shred_t *)struct_mem;
19317 0 : fd_bincode_uint16_decode_unsafe( &self->duplicate_shred_index, ctx );
19318 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
19319 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
19320 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
19321 0 : fd_bincode_uint32_decode_unsafe( &self->_unused, ctx );
19322 0 : fd_bincode_uint8_decode_unsafe( &self->_unused_shred_type, ctx );
19323 0 : fd_bincode_uint8_decode_unsafe( &self->num_chunks, ctx );
19324 0 : fd_bincode_uint8_decode_unsafe( &self->chunk_index, ctx );
19325 0 : fd_bincode_uint64_decode_unsafe( &self->chunk_len, ctx );
19326 0 : if( self->chunk_len ) {
19327 0 : self->chunk = *alloc_mem;
19328 0 : fd_bincode_bytes_decode_unsafe( self->chunk, self->chunk_len, ctx );
19329 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->chunk_len;
19330 0 : } else
19331 0 : self->chunk = NULL;
19332 0 : }
19333 0 : void * fd_gossip_duplicate_shred_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19334 0 : fd_gossip_duplicate_shred_t * self = (fd_gossip_duplicate_shred_t *)mem;
19335 0 : fd_gossip_duplicate_shred_new( self );
19336 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_duplicate_shred_t);
19337 0 : void * * alloc_mem = &alloc_region;
19338 0 : fd_gossip_duplicate_shred_decode_inner( mem, alloc_mem, ctx );
19339 0 : return self;
19340 0 : }
19341 0 : void fd_gossip_duplicate_shred_new(fd_gossip_duplicate_shred_t * self) {
19342 0 : fd_memset( self, 0, sizeof(fd_gossip_duplicate_shred_t) );
19343 0 : fd_pubkey_new( &self->from );
19344 0 : }
19345 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, uint varint ) {
19346 0 : (void) varint;
19347 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_duplicate_shred", level++, 0 );
19348 0 : fun( w, &self->duplicate_shred_index, "duplicate_shred_index", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
19349 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
19350 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
19351 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
19352 0 : fun( w, &self->_unused, "_unused", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
19353 0 : fun( w, &self->_unused_shred_type, "_unused_shred_type", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
19354 0 : fun( w, &self->num_chunks, "num_chunks", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
19355 0 : fun( w, &self->chunk_index, "chunk_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
19356 0 : if( self->chunk_len ) {
19357 0 : fun( w, NULL, "chunk", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
19358 0 : for( ulong i=0; i < self->chunk_len; i++ )
19359 0 : fun( w, self->chunk + i, "chunk", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
19360 0 : fun( w, NULL, "chunk", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
19361 0 : }
19362 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_duplicate_shred", level--, 0 );
19363 0 : }
19364 0 : ulong fd_gossip_duplicate_shred_size( fd_gossip_duplicate_shred_t const * self ) {
19365 0 : ulong size = 0;
19366 0 : size += sizeof(ushort);
19367 0 : size += fd_pubkey_size( &self->from );
19368 0 : size += sizeof(ulong);
19369 0 : size += sizeof(ulong);
19370 0 : size += sizeof(uint);
19371 0 : size += sizeof(char);
19372 0 : size += sizeof(char);
19373 0 : size += sizeof(char);
19374 0 : do {
19375 0 : size += sizeof(ulong);
19376 0 : size += self->chunk_len;
19377 0 : } while(0);
19378 0 : return size;
19379 0 : }
19380 :
19381 0 : int fd_gossip_incremental_snapshot_hashes_encode( fd_gossip_incremental_snapshot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19382 0 : int err;
19383 0 : err = fd_pubkey_encode( &self->from, ctx );
19384 0 : if( FD_UNLIKELY( err ) ) return err;
19385 0 : err = fd_slot_hash_encode( &self->base_hash, ctx );
19386 0 : if( FD_UNLIKELY( err ) ) return err;
19387 0 : err = fd_bincode_uint64_encode( self->hashes_len, ctx );
19388 0 : if( FD_UNLIKELY(err) ) return err;
19389 0 : if( self->hashes_len ) {
19390 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
19391 0 : err = fd_slot_hash_encode( self->hashes + i, ctx );
19392 0 : if( FD_UNLIKELY( err ) ) return err;
19393 0 : }
19394 0 : }
19395 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
19396 0 : if( FD_UNLIKELY( err ) ) return err;
19397 0 : return FD_BINCODE_SUCCESS;
19398 0 : }
19399 0 : static int fd_gossip_incremental_snapshot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19400 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19401 0 : int err = 0;
19402 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
19403 0 : if( FD_UNLIKELY( err ) ) return err;
19404 0 : err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
19405 0 : if( FD_UNLIKELY( err ) ) return err;
19406 0 : ulong hashes_len;
19407 0 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
19408 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19409 0 : if( hashes_len ) {
19410 0 : *total_sz += FD_SLOT_HASH_ALIGN + sizeof(fd_slot_hash_t)*hashes_len;
19411 0 : for( ulong i=0; i < hashes_len; i++ ) {
19412 0 : err = fd_slot_hash_decode_footprint_inner( ctx, total_sz );
19413 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19414 0 : }
19415 0 : }
19416 0 : err = fd_bincode_uint64_decode_footprint( ctx );
19417 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19418 0 : return 0;
19419 0 : }
19420 0 : int fd_gossip_incremental_snapshot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19421 0 : *total_sz += sizeof(fd_gossip_incremental_snapshot_hashes_t);
19422 0 : void const * start_data = ctx->data;
19423 0 : int err = fd_gossip_incremental_snapshot_hashes_decode_footprint_inner( ctx, total_sz );
19424 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19425 0 : ctx->data = start_data;
19426 0 : return err;
19427 0 : }
19428 0 : static void fd_gossip_incremental_snapshot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19429 0 : fd_gossip_incremental_snapshot_hashes_t * self = (fd_gossip_incremental_snapshot_hashes_t *)struct_mem;
19430 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
19431 0 : fd_slot_hash_decode_inner( &self->base_hash, alloc_mem, ctx );
19432 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_len, ctx );
19433 0 : if( self->hashes_len ) {
19434 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_HASH_ALIGN );
19435 0 : self->hashes = *alloc_mem;
19436 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_hash_t)*self->hashes_len;
19437 0 : for( ulong i=0; i < self->hashes_len; i++ ) {
19438 0 : fd_slot_hash_new( self->hashes + i );
19439 0 : fd_slot_hash_decode_inner( self->hashes + i, alloc_mem, ctx );
19440 0 : }
19441 0 : } else
19442 0 : self->hashes = NULL;
19443 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
19444 0 : }
19445 0 : void * fd_gossip_incremental_snapshot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19446 0 : fd_gossip_incremental_snapshot_hashes_t * self = (fd_gossip_incremental_snapshot_hashes_t *)mem;
19447 0 : fd_gossip_incremental_snapshot_hashes_new( self );
19448 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_incremental_snapshot_hashes_t);
19449 0 : void * * alloc_mem = &alloc_region;
19450 0 : fd_gossip_incremental_snapshot_hashes_decode_inner( mem, alloc_mem, ctx );
19451 0 : return self;
19452 0 : }
19453 0 : void fd_gossip_incremental_snapshot_hashes_new(fd_gossip_incremental_snapshot_hashes_t * self) {
19454 0 : fd_memset( self, 0, sizeof(fd_gossip_incremental_snapshot_hashes_t) );
19455 0 : fd_pubkey_new( &self->from );
19456 0 : fd_slot_hash_new( &self->base_hash );
19457 0 : }
19458 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, uint varint ) {
19459 0 : (void) varint;
19460 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_incremental_snapshot_hashes", level++, 0 );
19461 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
19462 0 : fd_slot_hash_walk( w, &self->base_hash, fun, "base_hash", level, 0 );
19463 0 : if( self->hashes_len ) {
19464 0 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
19465 0 : for( ulong i=0; i < self->hashes_len; i++ )
19466 0 : fd_slot_hash_walk(w, self->hashes + i, fun, "slot_hash", level, 0 );
19467 0 : fun( w, NULL, "hashes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
19468 0 : }
19469 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
19470 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_incremental_snapshot_hashes", level--, 0 );
19471 0 : }
19472 0 : ulong fd_gossip_incremental_snapshot_hashes_size( fd_gossip_incremental_snapshot_hashes_t const * self ) {
19473 0 : ulong size = 0;
19474 0 : size += fd_pubkey_size( &self->from );
19475 0 : size += fd_slot_hash_size( &self->base_hash );
19476 0 : do {
19477 0 : size += sizeof(ulong);
19478 0 : for( ulong i=0; i < self->hashes_len; i++ )
19479 0 : size += fd_slot_hash_size( self->hashes + i );
19480 0 : } while(0);
19481 0 : size += sizeof(ulong);
19482 0 : return size;
19483 0 : }
19484 :
19485 0 : int fd_gossip_socket_entry_encode( fd_gossip_socket_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19486 0 : int err;
19487 0 : err = fd_bincode_uint8_encode( (uchar)(self->key), ctx );
19488 0 : if( FD_UNLIKELY( err ) ) return err;
19489 0 : err = fd_bincode_uint8_encode( (uchar)(self->index), ctx );
19490 0 : if( FD_UNLIKELY( err ) ) return err;
19491 0 : err = fd_bincode_compact_u16_encode( &self->offset, ctx );
19492 0 : if( FD_UNLIKELY( err ) ) return err;
19493 0 : return FD_BINCODE_SUCCESS;
19494 0 : }
19495 36 : static int fd_gossip_socket_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19496 36 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19497 36 : int err = 0;
19498 36 : err = fd_bincode_uint8_decode_footprint( ctx );
19499 36 : if( FD_UNLIKELY( err ) ) return err;
19500 36 : err = fd_bincode_uint8_decode_footprint( ctx );
19501 36 : if( FD_UNLIKELY( err ) ) return err;
19502 36 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
19503 36 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19504 36 : return 0;
19505 36 : }
19506 0 : int fd_gossip_socket_entry_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19507 0 : *total_sz += sizeof(fd_gossip_socket_entry_t);
19508 0 : void const * start_data = ctx->data;
19509 0 : int err = fd_gossip_socket_entry_decode_footprint_inner( ctx, total_sz );
19510 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19511 0 : ctx->data = start_data;
19512 0 : return err;
19513 0 : }
19514 36 : static void fd_gossip_socket_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19515 36 : fd_gossip_socket_entry_t * self = (fd_gossip_socket_entry_t *)struct_mem;
19516 36 : fd_bincode_uint8_decode_unsafe( &self->key, ctx );
19517 36 : fd_bincode_uint8_decode_unsafe( &self->index, ctx );
19518 36 : fd_bincode_compact_u16_decode_unsafe( &self->offset, ctx );
19519 36 : }
19520 0 : void * fd_gossip_socket_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19521 0 : fd_gossip_socket_entry_t * self = (fd_gossip_socket_entry_t *)mem;
19522 0 : fd_gossip_socket_entry_new( self );
19523 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_socket_entry_t);
19524 0 : void * * alloc_mem = &alloc_region;
19525 0 : fd_gossip_socket_entry_decode_inner( mem, alloc_mem, ctx );
19526 0 : return self;
19527 0 : }
19528 36 : void fd_gossip_socket_entry_new(fd_gossip_socket_entry_t * self) {
19529 36 : fd_memset( self, 0, sizeof(fd_gossip_socket_entry_t) );
19530 36 : }
19531 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, uint varint ) {
19532 36 : (void) varint;
19533 36 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_socket_entry", level++, 0 );
19534 36 : fun( w, &self->key, "key", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
19535 36 : fun( w, &self->index, "index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
19536 36 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
19537 36 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_socket_entry", level--, 0 );
19538 36 : }
19539 0 : ulong fd_gossip_socket_entry_size( fd_gossip_socket_entry_t const * self ) {
19540 0 : ulong size = 0;
19541 0 : size += sizeof(char);
19542 0 : size += sizeof(char);
19543 0 : size += fd_bincode_compact_u16_size( &self->offset );
19544 0 : return size;
19545 0 : }
19546 :
19547 0 : int fd_gossip_contact_info_v2_encode( fd_gossip_contact_info_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19548 0 : int err;
19549 0 : err = fd_pubkey_encode( &self->from, ctx );
19550 0 : if( FD_UNLIKELY( err ) ) return err;
19551 0 : err = fd_bincode_varint_encode( self->wallclock, ctx );
19552 0 : if( FD_UNLIKELY( err ) ) return err;
19553 0 : err = fd_bincode_uint64_encode( self->outset, ctx );
19554 0 : if( FD_UNLIKELY( err ) ) return err;
19555 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
19556 0 : if( FD_UNLIKELY( err ) ) return err;
19557 0 : err = fd_gossip_version_v3_encode( &self->version, ctx );
19558 0 : if( FD_UNLIKELY( err ) ) return err;
19559 0 : err = fd_bincode_compact_u16_encode( &self->addrs_len, ctx );
19560 0 : if( FD_UNLIKELY(err) ) return err;
19561 0 : if( self->addrs_len ) {
19562 0 : for( ulong i=0; i < self->addrs_len; i++ ) {
19563 0 : err = fd_gossip_ip_addr_encode( self->addrs + i, ctx );
19564 0 : if( FD_UNLIKELY( err ) ) return err;
19565 0 : }
19566 0 : }
19567 0 : err = fd_bincode_compact_u16_encode( &self->sockets_len, ctx );
19568 0 : if( FD_UNLIKELY(err) ) return err;
19569 0 : if( self->sockets_len ) {
19570 0 : for( ulong i=0; i < self->sockets_len; i++ ) {
19571 0 : err = fd_gossip_socket_entry_encode( self->sockets + i, ctx );
19572 0 : if( FD_UNLIKELY( err ) ) return err;
19573 0 : }
19574 0 : }
19575 0 : err = fd_bincode_compact_u16_encode( &self->extensions_len, ctx );
19576 0 : if( FD_UNLIKELY(err) ) return err;
19577 0 : if( self->extensions_len ) {
19578 0 : for( ulong i=0; i < self->extensions_len; i++ ) {
19579 0 : err = fd_bincode_uint32_encode( self->extensions[i], ctx );
19580 0 : }
19581 0 : }
19582 0 : return FD_BINCODE_SUCCESS;
19583 0 : }
19584 3 : static int fd_gossip_contact_info_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19585 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19586 3 : int err = 0;
19587 3 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
19588 3 : if( FD_UNLIKELY( err ) ) return err;
19589 3 : err = fd_bincode_varint_decode_footprint( ctx );
19590 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19591 3 : err = fd_bincode_uint64_decode_footprint( ctx );
19592 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19593 3 : err = fd_bincode_uint16_decode_footprint( ctx );
19594 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19595 3 : err = fd_gossip_version_v3_decode_footprint_inner( ctx, total_sz );
19596 3 : if( FD_UNLIKELY( err ) ) return err;
19597 3 : ushort addrs_len;
19598 3 : err = fd_bincode_compact_u16_decode( &addrs_len, ctx );
19599 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19600 3 : if( addrs_len ) {
19601 3 : *total_sz += FD_GOSSIP_IP_ADDR_ALIGN + sizeof(fd_gossip_ip_addr_t)*addrs_len;
19602 6 : for( ulong i=0; i < addrs_len; i++ ) {
19603 3 : err = fd_gossip_ip_addr_decode_footprint_inner( ctx, total_sz );
19604 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19605 3 : }
19606 3 : }
19607 3 : ushort sockets_len;
19608 3 : err = fd_bincode_compact_u16_decode( &sockets_len, ctx );
19609 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19610 3 : if( sockets_len ) {
19611 3 : *total_sz += FD_GOSSIP_SOCKET_ENTRY_ALIGN + sizeof(fd_gossip_socket_entry_t)*sockets_len;
19612 39 : for( ulong i=0; i < sockets_len; i++ ) {
19613 36 : err = fd_gossip_socket_entry_decode_footprint_inner( ctx, total_sz );
19614 36 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19615 36 : }
19616 3 : }
19617 3 : ushort extensions_len;
19618 3 : err = fd_bincode_compact_u16_decode( &extensions_len, ctx );
19619 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19620 3 : if( extensions_len ) {
19621 0 : *total_sz += 8UL + sizeof(uint)*extensions_len;
19622 0 : for( ulong i=0; i < extensions_len; i++ ) {
19623 0 : err = fd_bincode_uint32_decode_footprint( ctx );
19624 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19625 0 : }
19626 0 : }
19627 3 : return 0;
19628 3 : }
19629 0 : int fd_gossip_contact_info_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19630 0 : *total_sz += sizeof(fd_gossip_contact_info_v2_t);
19631 0 : void const * start_data = ctx->data;
19632 0 : int err = fd_gossip_contact_info_v2_decode_footprint_inner( ctx, total_sz );
19633 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19634 0 : ctx->data = start_data;
19635 0 : return err;
19636 0 : }
19637 3 : static void fd_gossip_contact_info_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19638 3 : fd_gossip_contact_info_v2_t * self = (fd_gossip_contact_info_v2_t *)struct_mem;
19639 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
19640 3 : fd_bincode_varint_decode_unsafe( &self->wallclock, ctx );
19641 3 : fd_bincode_uint64_decode_unsafe( &self->outset, ctx );
19642 3 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
19643 3 : fd_gossip_version_v3_decode_inner( &self->version, alloc_mem, ctx );
19644 3 : fd_bincode_compact_u16_decode_unsafe( &self->addrs_len, ctx );
19645 3 : if( self->addrs_len ) {
19646 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_IP_ADDR_ALIGN );
19647 3 : self->addrs = *alloc_mem;
19648 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_gossip_ip_addr_t)*self->addrs_len;
19649 6 : for( ulong i=0; i < self->addrs_len; i++ ) {
19650 3 : fd_gossip_ip_addr_new( self->addrs + i );
19651 3 : fd_gossip_ip_addr_decode_inner( self->addrs + i, alloc_mem, ctx );
19652 3 : }
19653 3 : } else
19654 0 : self->addrs = NULL;
19655 3 : fd_bincode_compact_u16_decode_unsafe( &self->sockets_len, ctx );
19656 3 : if( self->sockets_len ) {
19657 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_GOSSIP_SOCKET_ENTRY_ALIGN );
19658 3 : self->sockets = *alloc_mem;
19659 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_gossip_socket_entry_t)*self->sockets_len;
19660 39 : for( ulong i=0; i < self->sockets_len; i++ ) {
19661 36 : fd_gossip_socket_entry_new( self->sockets + i );
19662 36 : fd_gossip_socket_entry_decode_inner( self->sockets + i, alloc_mem, ctx );
19663 36 : }
19664 3 : } else
19665 0 : self->sockets = NULL;
19666 3 : fd_bincode_compact_u16_decode_unsafe( &self->extensions_len, ctx );
19667 3 : if( self->extensions_len ) {
19668 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
19669 0 : self->extensions = *alloc_mem;
19670 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(uint)*self->extensions_len;
19671 0 : for( ulong i=0; i < self->extensions_len; i++ ) {
19672 0 : fd_bincode_uint32_decode_unsafe( self->extensions + i, ctx );
19673 0 : }
19674 0 : } else
19675 3 : self->extensions = NULL;
19676 3 : }
19677 0 : void * fd_gossip_contact_info_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19678 0 : fd_gossip_contact_info_v2_t * self = (fd_gossip_contact_info_v2_t *)mem;
19679 0 : fd_gossip_contact_info_v2_new( self );
19680 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_contact_info_v2_t);
19681 0 : void * * alloc_mem = &alloc_region;
19682 0 : fd_gossip_contact_info_v2_decode_inner( mem, alloc_mem, ctx );
19683 0 : return self;
19684 0 : }
19685 0 : void fd_gossip_contact_info_v2_new(fd_gossip_contact_info_v2_t * self) {
19686 0 : fd_memset( self, 0, sizeof(fd_gossip_contact_info_v2_t) );
19687 0 : fd_pubkey_new( &self->from );
19688 0 : fd_gossip_version_v3_new( &self->version );
19689 0 : }
19690 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, uint varint ) {
19691 3 : (void) varint;
19692 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_contact_info_v2", level++, 0 );
19693 3 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
19694 3 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 1 );
19695 3 : fun( w, &self->outset, "outset", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
19696 3 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
19697 3 : fd_gossip_version_v3_walk( w, &self->version, fun, "version", level, 0 );
19698 3 : fun( w, &self->addrs_len, "addrs_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
19699 3 : if( self->addrs_len ) {
19700 3 : fun( w, NULL, "addrs", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
19701 6 : for( ulong i=0; i < self->addrs_len; i++ )
19702 3 : fd_gossip_ip_addr_walk(w, self->addrs + i, fun, "gossip_ip_addr", level, 0 );
19703 3 : fun( w, NULL, "addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
19704 3 : }
19705 3 : fun( w, &self->sockets_len, "sockets_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
19706 3 : if( self->sockets_len ) {
19707 3 : fun( w, NULL, "sockets", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
19708 39 : for( ulong i=0; i < self->sockets_len; i++ )
19709 36 : fd_gossip_socket_entry_walk(w, self->sockets + i, fun, "gossip_socket_entry", level, 0 );
19710 3 : fun( w, NULL, "sockets", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
19711 3 : }
19712 3 : fun( w, &self->extensions_len, "extensions_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
19713 3 : if( self->extensions_len ) {
19714 0 : fun( w, NULL, "extensions", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
19715 0 : for( ulong i=0; i < self->extensions_len; i++ )
19716 0 : fun( w, self->extensions + i, "extensions", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
19717 0 : fun( w, NULL, "extensions", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
19718 0 : }
19719 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_contact_info_v2", level--, 0 );
19720 3 : }
19721 0 : ulong fd_gossip_contact_info_v2_size( fd_gossip_contact_info_v2_t const * self ) {
19722 0 : ulong size = 0;
19723 0 : size += fd_pubkey_size( &self->from );
19724 0 : size += fd_bincode_varint_size( self->wallclock );
19725 0 : size += sizeof(ulong);
19726 0 : size += sizeof(ushort);
19727 0 : size += fd_gossip_version_v3_size( &self->version );
19728 0 : do {
19729 0 : ushort tmp = (ushort)self->addrs_len;
19730 0 : size += fd_bincode_compact_u16_size( &tmp );
19731 0 : for( ulong i=0; i < self->addrs_len; i++ )
19732 0 : size += fd_gossip_ip_addr_size( self->addrs + i );
19733 0 : } while(0);
19734 0 : do {
19735 0 : ushort tmp = (ushort)self->sockets_len;
19736 0 : size += fd_bincode_compact_u16_size( &tmp );
19737 0 : for( ulong i=0; i < self->sockets_len; i++ )
19738 0 : size += fd_gossip_socket_entry_size( self->sockets + i );
19739 0 : } while(0);
19740 0 : do {
19741 0 : ushort tmp = (ushort)self->extensions_len;
19742 0 : size += fd_bincode_compact_u16_size( &tmp );
19743 0 : size += self->extensions_len * sizeof(uint);
19744 0 : } while(0);
19745 0 : return size;
19746 0 : }
19747 :
19748 0 : int fd_restart_run_length_encoding_inner_encode( fd_restart_run_length_encoding_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19749 0 : int err;
19750 0 : err = fd_bincode_compact_u16_encode( &self->bits, ctx );
19751 0 : if( FD_UNLIKELY( err ) ) return err;
19752 0 : return FD_BINCODE_SUCCESS;
19753 0 : }
19754 0 : static int fd_restart_run_length_encoding_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19755 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19756 0 : int err = 0;
19757 0 : do { ushort _tmp; err = fd_bincode_compact_u16_decode( &_tmp, ctx ); } while(0);
19758 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19759 0 : return 0;
19760 0 : }
19761 0 : int fd_restart_run_length_encoding_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19762 0 : *total_sz += sizeof(fd_restart_run_length_encoding_inner_t);
19763 0 : void const * start_data = ctx->data;
19764 0 : int err = fd_restart_run_length_encoding_inner_decode_footprint_inner( ctx, total_sz );
19765 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19766 0 : ctx->data = start_data;
19767 0 : return err;
19768 0 : }
19769 0 : static void fd_restart_run_length_encoding_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19770 0 : fd_restart_run_length_encoding_inner_t * self = (fd_restart_run_length_encoding_inner_t *)struct_mem;
19771 0 : fd_bincode_compact_u16_decode_unsafe( &self->bits, ctx );
19772 0 : }
19773 0 : void * fd_restart_run_length_encoding_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19774 0 : fd_restart_run_length_encoding_inner_t * self = (fd_restart_run_length_encoding_inner_t *)mem;
19775 0 : fd_restart_run_length_encoding_inner_new( self );
19776 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_run_length_encoding_inner_t);
19777 0 : void * * alloc_mem = &alloc_region;
19778 0 : fd_restart_run_length_encoding_inner_decode_inner( mem, alloc_mem, ctx );
19779 0 : return self;
19780 0 : }
19781 0 : void fd_restart_run_length_encoding_inner_new(fd_restart_run_length_encoding_inner_t * self) {
19782 0 : fd_memset( self, 0, sizeof(fd_restart_run_length_encoding_inner_t) );
19783 0 : }
19784 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, uint varint ) {
19785 0 : (void) varint;
19786 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_run_length_encoding_inner", level++, 0 );
19787 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
19788 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_run_length_encoding_inner", level--, 0 );
19789 0 : }
19790 0 : ulong fd_restart_run_length_encoding_inner_size( fd_restart_run_length_encoding_inner_t const * self ) {
19791 0 : ulong size = 0;
19792 0 : size += fd_bincode_compact_u16_size( &self->bits );
19793 0 : return size;
19794 0 : }
19795 :
19796 0 : int fd_restart_run_length_encoding_encode( fd_restart_run_length_encoding_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19797 0 : int err;
19798 0 : err = fd_bincode_uint64_encode( self->offsets_len, ctx );
19799 0 : if( FD_UNLIKELY(err) ) return err;
19800 0 : if( self->offsets_len ) {
19801 0 : for( ulong i=0; i < self->offsets_len; i++ ) {
19802 0 : err = fd_restart_run_length_encoding_inner_encode( self->offsets + i, ctx );
19803 0 : if( FD_UNLIKELY( err ) ) return err;
19804 0 : }
19805 0 : }
19806 0 : return FD_BINCODE_SUCCESS;
19807 0 : }
19808 0 : static int fd_restart_run_length_encoding_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19809 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19810 0 : int err = 0;
19811 0 : ulong offsets_len;
19812 0 : err = fd_bincode_uint64_decode( &offsets_len, ctx );
19813 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19814 0 : if( offsets_len ) {
19815 0 : *total_sz += FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN + sizeof(fd_restart_run_length_encoding_inner_t)*offsets_len;
19816 0 : for( ulong i=0; i < offsets_len; i++ ) {
19817 0 : err = fd_restart_run_length_encoding_inner_decode_footprint_inner( ctx, total_sz );
19818 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19819 0 : }
19820 0 : }
19821 0 : return 0;
19822 0 : }
19823 0 : int fd_restart_run_length_encoding_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19824 0 : *total_sz += sizeof(fd_restart_run_length_encoding_t);
19825 0 : void const * start_data = ctx->data;
19826 0 : int err = fd_restart_run_length_encoding_decode_footprint_inner( ctx, total_sz );
19827 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19828 0 : ctx->data = start_data;
19829 0 : return err;
19830 0 : }
19831 0 : static void fd_restart_run_length_encoding_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19832 0 : fd_restart_run_length_encoding_t * self = (fd_restart_run_length_encoding_t *)struct_mem;
19833 0 : fd_bincode_uint64_decode_unsafe( &self->offsets_len, ctx );
19834 0 : if( self->offsets_len ) {
19835 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_RESTART_RUN_LENGTH_ENCODING_INNER_ALIGN );
19836 0 : self->offsets = *alloc_mem;
19837 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_restart_run_length_encoding_inner_t)*self->offsets_len;
19838 0 : for( ulong i=0; i < self->offsets_len; i++ ) {
19839 0 : fd_restart_run_length_encoding_inner_new( self->offsets + i );
19840 0 : fd_restart_run_length_encoding_inner_decode_inner( self->offsets + i, alloc_mem, ctx );
19841 0 : }
19842 0 : } else
19843 0 : self->offsets = NULL;
19844 0 : }
19845 0 : void * fd_restart_run_length_encoding_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19846 0 : fd_restart_run_length_encoding_t * self = (fd_restart_run_length_encoding_t *)mem;
19847 0 : fd_restart_run_length_encoding_new( self );
19848 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_run_length_encoding_t);
19849 0 : void * * alloc_mem = &alloc_region;
19850 0 : fd_restart_run_length_encoding_decode_inner( mem, alloc_mem, ctx );
19851 0 : return self;
19852 0 : }
19853 0 : void fd_restart_run_length_encoding_new(fd_restart_run_length_encoding_t * self) {
19854 0 : fd_memset( self, 0, sizeof(fd_restart_run_length_encoding_t) );
19855 0 : }
19856 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, uint varint ) {
19857 0 : (void) varint;
19858 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_run_length_encoding", level++, 0 );
19859 0 : if( self->offsets_len ) {
19860 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
19861 0 : for( ulong i=0; i < self->offsets_len; i++ )
19862 0 : fd_restart_run_length_encoding_inner_walk(w, self->offsets + i, fun, "restart_run_length_encoding_inner", level, 0 );
19863 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
19864 0 : }
19865 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_run_length_encoding", level--, 0 );
19866 0 : }
19867 0 : ulong fd_restart_run_length_encoding_size( fd_restart_run_length_encoding_t const * self ) {
19868 0 : ulong size = 0;
19869 0 : do {
19870 0 : size += sizeof(ulong);
19871 0 : for( ulong i=0; i < self->offsets_len; i++ )
19872 0 : size += fd_restart_run_length_encoding_inner_size( self->offsets + i );
19873 0 : } while(0);
19874 0 : return size;
19875 0 : }
19876 :
19877 0 : int fd_restart_raw_offsets_encode( fd_restart_raw_offsets_t const * self, fd_bincode_encode_ctx_t * ctx ) {
19878 0 : int err;
19879 0 : err = fd_bincode_bool_encode( self->has_offsets, ctx );
19880 0 : if( FD_UNLIKELY( err ) ) return err;
19881 0 : if( self->has_offsets ) {
19882 0 : err = fd_bincode_uint64_encode( self->offsets_bitvec_len, ctx );
19883 0 : if( FD_UNLIKELY(err) ) return err;
19884 0 : if( self->offsets_bitvec_len ) {
19885 0 : err = fd_bincode_bytes_encode( self->offsets_bitvec, self->offsets_bitvec_len, ctx );
19886 0 : if( FD_UNLIKELY( err ) ) return err;
19887 0 : }
19888 0 : if( FD_UNLIKELY( err ) ) return err;
19889 0 : }
19890 0 : err = fd_bincode_uint64_encode( self->offsets_len, ctx );
19891 0 : if( FD_UNLIKELY( err ) ) return err;
19892 0 : return FD_BINCODE_SUCCESS;
19893 0 : }
19894 0 : static int fd_restart_raw_offsets_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19895 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19896 0 : int err = 0;
19897 0 : {
19898 0 : uchar o;
19899 0 : ulong inner_len = 0UL;
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 : ulong offsets_bitvec_len;
19904 0 : err = fd_bincode_uint64_decode( &offsets_bitvec_len, ctx );
19905 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19906 0 : if( offsets_bitvec_len ) {
19907 0 : *total_sz += 8UL + offsets_bitvec_len;
19908 0 : err = fd_bincode_bytes_decode_footprint( offsets_bitvec_len, ctx );
19909 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19910 0 : }
19911 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19912 0 : inner_len = offsets_bitvec_len;
19913 0 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
19914 0 : }
19915 0 : ulong len;
19916 0 : err = fd_bincode_uint64_decode( &len, ctx );
19917 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
19918 0 : if( len > inner_len * sizeof(uchar) * 8UL ) return FD_BINCODE_ERR_ENCODING;
19919 0 : }
19920 0 : return 0;
19921 0 : }
19922 0 : int fd_restart_raw_offsets_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19923 0 : *total_sz += sizeof(fd_restart_raw_offsets_t);
19924 0 : void const * start_data = ctx->data;
19925 0 : int err = fd_restart_raw_offsets_decode_footprint_inner( ctx, total_sz );
19926 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19927 0 : ctx->data = start_data;
19928 0 : return err;
19929 0 : }
19930 0 : static void fd_restart_raw_offsets_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
19931 0 : fd_restart_raw_offsets_t * self = (fd_restart_raw_offsets_t *)struct_mem;
19932 0 : {
19933 0 : uchar o;
19934 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
19935 0 : self->has_offsets = !!o;
19936 0 : if( o ) {
19937 0 : fd_bincode_uint64_decode_unsafe( &self->offsets_bitvec_len, ctx );
19938 0 : if( self->offsets_bitvec_len ) {
19939 0 : self->offsets_bitvec = *alloc_mem;
19940 0 : fd_bincode_bytes_decode_unsafe( self->offsets_bitvec, self->offsets_bitvec_len, ctx );
19941 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->offsets_bitvec_len;
19942 0 : } else
19943 0 : self->offsets_bitvec = NULL;
19944 0 : } else {
19945 0 : self->offsets_bitvec = NULL;
19946 0 : }
19947 0 : fd_bincode_uint64_decode_unsafe( &self->offsets_len, ctx );
19948 0 : }
19949 0 : }
19950 0 : void * fd_restart_raw_offsets_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
19951 0 : fd_restart_raw_offsets_t * self = (fd_restart_raw_offsets_t *)mem;
19952 0 : fd_restart_raw_offsets_new( self );
19953 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_raw_offsets_t);
19954 0 : void * * alloc_mem = &alloc_region;
19955 0 : fd_restart_raw_offsets_decode_inner( mem, alloc_mem, ctx );
19956 0 : return self;
19957 0 : }
19958 0 : void fd_restart_raw_offsets_new(fd_restart_raw_offsets_t * self) {
19959 0 : fd_memset( self, 0, sizeof(fd_restart_raw_offsets_t) );
19960 0 : }
19961 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, uint varint ) {
19962 0 : (void) varint;
19963 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_restart_raw_offsets", level++, 0 );
19964 0 : if( !self->has_offsets ) {
19965 0 : fun( w, NULL, "offsets", FD_FLAMENCO_TYPE_NULL, "uchar", level, 0 );
19966 0 : } else {
19967 0 : if( self->offsets_bitvec_len ) {
19968 0 : fun( w, NULL, "offsets_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
19969 0 : for( ulong i=0; i < self->offsets_bitvec_len; i++ )
19970 0 : fun( w, self->offsets_bitvec + i, "offsets_bitvec", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
19971 0 : fun( w, NULL, "offsets_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
19972 0 : }
19973 0 : }
19974 0 : fun( w, &self->offsets_len, "offsets_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
19975 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_restart_raw_offsets", level--, 0 );
19976 0 : }
19977 0 : ulong fd_restart_raw_offsets_size( fd_restart_raw_offsets_t const * self ) {
19978 0 : ulong size = 0;
19979 0 : size += sizeof(char);
19980 0 : if( self->has_offsets ) {
19981 0 : do {
19982 0 : size += sizeof(ulong);
19983 0 : size += self->offsets_bitvec_len;
19984 0 : } while(0);
19985 0 : }
19986 0 : size += sizeof(ulong);
19987 0 : return size;
19988 0 : }
19989 :
19990 0 : FD_FN_PURE uchar fd_restart_slots_offsets_is_run_length_encoding(fd_restart_slots_offsets_t const * self) {
19991 0 : return self->discriminant == 0;
19992 0 : }
19993 0 : FD_FN_PURE uchar fd_restart_slots_offsets_is_raw_offsets(fd_restart_slots_offsets_t const * self) {
19994 0 : return self->discriminant == 1;
19995 0 : }
19996 : void fd_restart_slots_offsets_inner_new( fd_restart_slots_offsets_inner_t * self, uint discriminant );
19997 0 : int fd_restart_slots_offsets_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
19998 0 : int err;
19999 0 : switch (discriminant) {
20000 0 : case 0: {
20001 0 : err = fd_restart_run_length_encoding_decode_footprint_inner( ctx, total_sz );
20002 0 : if( FD_UNLIKELY( err ) ) return err;
20003 0 : return FD_BINCODE_SUCCESS;
20004 0 : }
20005 0 : case 1: {
20006 0 : err = fd_restart_raw_offsets_decode_footprint_inner( ctx, total_sz );
20007 0 : if( FD_UNLIKELY( err ) ) return err;
20008 0 : return FD_BINCODE_SUCCESS;
20009 0 : }
20010 0 : default: return FD_BINCODE_ERR_ENCODING;
20011 0 : }
20012 0 : }
20013 0 : static int fd_restart_slots_offsets_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20014 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20015 0 : uint discriminant = 0;
20016 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
20017 0 : if( FD_UNLIKELY( err ) ) return err;
20018 0 : return fd_restart_slots_offsets_inner_decode_footprint( discriminant, ctx, total_sz );
20019 0 : }
20020 0 : int fd_restart_slots_offsets_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20021 0 : *total_sz += sizeof(fd_restart_slots_offsets_t);
20022 0 : void const * start_data = ctx->data;
20023 0 : int err = fd_restart_slots_offsets_decode_footprint_inner( ctx, total_sz );
20024 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20025 0 : ctx->data = start_data;
20026 0 : return err;
20027 0 : }
20028 0 : static void fd_restart_slots_offsets_inner_decode_inner( fd_restart_slots_offsets_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20029 0 : switch (discriminant) {
20030 0 : case 0: {
20031 0 : fd_restart_run_length_encoding_decode_inner( &self->run_length_encoding, alloc_mem, ctx );
20032 0 : break;
20033 0 : }
20034 0 : case 1: {
20035 0 : fd_restart_raw_offsets_decode_inner( &self->raw_offsets, alloc_mem, ctx );
20036 0 : break;
20037 0 : }
20038 0 : }
20039 0 : }
20040 0 : static void fd_restart_slots_offsets_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20041 0 : fd_restart_slots_offsets_t * self = (fd_restart_slots_offsets_t *)struct_mem;
20042 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
20043 0 : fd_restart_slots_offsets_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
20044 0 : }
20045 0 : void * fd_restart_slots_offsets_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20046 0 : fd_restart_slots_offsets_t * self = (fd_restart_slots_offsets_t *)mem;
20047 0 : fd_restart_slots_offsets_new( self );
20048 0 : void * alloc_region = (uchar *)mem + sizeof(fd_restart_slots_offsets_t);
20049 0 : void * * alloc_mem = &alloc_region;
20050 0 : fd_restart_slots_offsets_decode_inner( mem, alloc_mem, ctx );
20051 0 : return self;
20052 0 : }
20053 0 : void fd_restart_slots_offsets_inner_new( fd_restart_slots_offsets_inner_t * self, uint discriminant ) {
20054 0 : switch( discriminant ) {
20055 0 : case 0: {
20056 0 : fd_restart_run_length_encoding_new( &self->run_length_encoding );
20057 0 : break;
20058 0 : }
20059 0 : case 1: {
20060 0 : fd_restart_raw_offsets_new( &self->raw_offsets );
20061 0 : break;
20062 0 : }
20063 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
20064 0 : }
20065 0 : }
20066 0 : void fd_restart_slots_offsets_new_disc( fd_restart_slots_offsets_t * self, uint discriminant ) {
20067 0 : self->discriminant = discriminant;
20068 0 : fd_restart_slots_offsets_inner_new( &self->inner, self->discriminant );
20069 0 : }
20070 0 : void fd_restart_slots_offsets_new( fd_restart_slots_offsets_t * self ) {
20071 0 : fd_memset( self, 0, sizeof(fd_restart_slots_offsets_t) );
20072 0 : fd_restart_slots_offsets_new_disc( self, UINT_MAX );
20073 0 : }
20074 :
20075 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, uint varint ) {
20076 0 : (void) varint;
20077 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_restart_slots_offsets", level++, 0);
20078 0 : switch( self->discriminant ) {
20079 0 : case 0: {
20080 0 : fun( w, self, "run_length_encoding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20081 0 : fd_restart_run_length_encoding_walk( w, &self->inner.run_length_encoding, fun, "run_length_encoding", level, 0 );
20082 0 : break;
20083 0 : }
20084 0 : case 1: {
20085 0 : fun( w, self, "raw_offsets", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20086 0 : fd_restart_raw_offsets_walk( w, &self->inner.raw_offsets, fun, "raw_offsets", level, 0 );
20087 0 : break;
20088 0 : }
20089 0 : }
20090 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_restart_slots_offsets", level--, 0 );
20091 0 : }
20092 0 : ulong fd_restart_slots_offsets_size( fd_restart_slots_offsets_t const * self ) {
20093 0 : ulong size = 0;
20094 0 : size += sizeof(uint);
20095 0 : switch (self->discriminant) {
20096 0 : case 0: {
20097 0 : size += fd_restart_run_length_encoding_size( &self->inner.run_length_encoding );
20098 0 : break;
20099 0 : }
20100 0 : case 1: {
20101 0 : size += fd_restart_raw_offsets_size( &self->inner.raw_offsets );
20102 0 : break;
20103 0 : }
20104 0 : }
20105 0 : return size;
20106 0 : }
20107 :
20108 0 : int fd_restart_slots_offsets_inner_encode( fd_restart_slots_offsets_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
20109 0 : int err;
20110 0 : switch (discriminant) {
20111 0 : case 0: {
20112 0 : err = fd_restart_run_length_encoding_encode( &self->run_length_encoding, ctx );
20113 0 : if( FD_UNLIKELY( err ) ) return err;
20114 0 : break;
20115 0 : }
20116 0 : case 1: {
20117 0 : err = fd_restart_raw_offsets_encode( &self->raw_offsets, ctx );
20118 0 : if( FD_UNLIKELY( err ) ) return err;
20119 0 : break;
20120 0 : }
20121 0 : }
20122 0 : return FD_BINCODE_SUCCESS;
20123 0 : }
20124 0 : int fd_restart_slots_offsets_encode( fd_restart_slots_offsets_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20125 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
20126 0 : if( FD_UNLIKELY( err ) ) return err;
20127 0 : return fd_restart_slots_offsets_inner_encode( &self->inner, self->discriminant, ctx );
20128 0 : }
20129 :
20130 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 ) {
20131 0 : int err;
20132 0 : err = fd_pubkey_encode( &self->from, ctx );
20133 0 : if( FD_UNLIKELY( err ) ) return err;
20134 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
20135 0 : if( FD_UNLIKELY( err ) ) return err;
20136 0 : err = fd_restart_slots_offsets_encode( &self->offsets, ctx );
20137 0 : if( FD_UNLIKELY( err ) ) return err;
20138 0 : err = fd_bincode_uint64_encode( self->last_voted_slot, ctx );
20139 0 : if( FD_UNLIKELY( err ) ) return err;
20140 0 : err = fd_hash_encode( &self->last_voted_hash, ctx );
20141 0 : if( FD_UNLIKELY( err ) ) return err;
20142 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
20143 0 : if( FD_UNLIKELY( err ) ) return err;
20144 0 : return FD_BINCODE_SUCCESS;
20145 0 : }
20146 0 : static int fd_gossip_restart_last_voted_fork_slots_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20147 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20148 0 : int err = 0;
20149 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
20150 0 : if( FD_UNLIKELY( err ) ) return err;
20151 0 : err = fd_bincode_uint64_decode_footprint( ctx );
20152 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20153 0 : err = fd_restart_slots_offsets_decode_footprint_inner( ctx, total_sz );
20154 0 : if( FD_UNLIKELY( err ) ) return err;
20155 0 : err = fd_bincode_uint64_decode_footprint( ctx );
20156 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20157 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
20158 0 : if( FD_UNLIKELY( err ) ) return err;
20159 0 : err = fd_bincode_uint16_decode_footprint( ctx );
20160 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20161 0 : return 0;
20162 0 : }
20163 0 : int fd_gossip_restart_last_voted_fork_slots_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20164 0 : *total_sz += sizeof(fd_gossip_restart_last_voted_fork_slots_t);
20165 0 : void const * start_data = ctx->data;
20166 0 : int err = fd_gossip_restart_last_voted_fork_slots_decode_footprint_inner( ctx, total_sz );
20167 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20168 0 : ctx->data = start_data;
20169 0 : return err;
20170 0 : }
20171 0 : static void fd_gossip_restart_last_voted_fork_slots_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20172 0 : fd_gossip_restart_last_voted_fork_slots_t * self = (fd_gossip_restart_last_voted_fork_slots_t *)struct_mem;
20173 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
20174 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
20175 0 : fd_restart_slots_offsets_decode_inner( &self->offsets, alloc_mem, ctx );
20176 0 : fd_bincode_uint64_decode_unsafe( &self->last_voted_slot, ctx );
20177 0 : fd_hash_decode_inner( &self->last_voted_hash, alloc_mem, ctx );
20178 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
20179 0 : }
20180 0 : void * fd_gossip_restart_last_voted_fork_slots_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20181 0 : fd_gossip_restart_last_voted_fork_slots_t * self = (fd_gossip_restart_last_voted_fork_slots_t *)mem;
20182 0 : fd_gossip_restart_last_voted_fork_slots_new( self );
20183 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_restart_last_voted_fork_slots_t);
20184 0 : void * * alloc_mem = &alloc_region;
20185 0 : fd_gossip_restart_last_voted_fork_slots_decode_inner( mem, alloc_mem, ctx );
20186 0 : return self;
20187 0 : }
20188 0 : void fd_gossip_restart_last_voted_fork_slots_new(fd_gossip_restart_last_voted_fork_slots_t * self) {
20189 0 : fd_memset( self, 0, sizeof(fd_gossip_restart_last_voted_fork_slots_t) );
20190 0 : fd_pubkey_new( &self->from );
20191 0 : fd_restart_slots_offsets_new( &self->offsets );
20192 0 : fd_hash_new( &self->last_voted_hash );
20193 0 : }
20194 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, uint varint ) {
20195 0 : (void) varint;
20196 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_restart_last_voted_fork_slots", level++, 0 );
20197 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
20198 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20199 0 : fd_restart_slots_offsets_walk( w, &self->offsets, fun, "offsets", level, 0 );
20200 0 : fun( w, &self->last_voted_slot, "last_voted_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20201 0 : fd_hash_walk( w, &self->last_voted_hash, fun, "last_voted_hash", level, 0 );
20202 0 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
20203 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_restart_last_voted_fork_slots", level--, 0 );
20204 0 : }
20205 0 : ulong fd_gossip_restart_last_voted_fork_slots_size( fd_gossip_restart_last_voted_fork_slots_t const * self ) {
20206 0 : ulong size = 0;
20207 0 : size += fd_pubkey_size( &self->from );
20208 0 : size += sizeof(ulong);
20209 0 : size += fd_restart_slots_offsets_size( &self->offsets );
20210 0 : size += sizeof(ulong);
20211 0 : size += fd_hash_size( &self->last_voted_hash );
20212 0 : size += sizeof(ushort);
20213 0 : return size;
20214 0 : }
20215 :
20216 0 : int fd_gossip_restart_heaviest_fork_encode( fd_gossip_restart_heaviest_fork_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20217 0 : int err;
20218 0 : err = fd_pubkey_encode( &self->from, ctx );
20219 0 : if( FD_UNLIKELY( err ) ) return err;
20220 0 : err = fd_bincode_uint64_encode( self->wallclock, ctx );
20221 0 : if( FD_UNLIKELY( err ) ) return err;
20222 0 : err = fd_bincode_uint64_encode( self->last_slot, ctx );
20223 0 : if( FD_UNLIKELY( err ) ) return err;
20224 0 : err = fd_hash_encode( &self->last_slot_hash, ctx );
20225 0 : if( FD_UNLIKELY( err ) ) return err;
20226 0 : err = fd_bincode_uint64_encode( self->observed_stake, ctx );
20227 0 : if( FD_UNLIKELY( err ) ) return err;
20228 0 : err = fd_bincode_uint16_encode( self->shred_version, ctx );
20229 0 : if( FD_UNLIKELY( err ) ) return err;
20230 0 : return FD_BINCODE_SUCCESS;
20231 0 : }
20232 0 : static inline int fd_gossip_restart_heaviest_fork_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20233 0 : if( (ulong)ctx->data + 90UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20234 0 : ctx->data = (void *)( (ulong)ctx->data + 90UL );
20235 0 : return 0;
20236 0 : }
20237 0 : static void fd_gossip_restart_heaviest_fork_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20238 0 : fd_gossip_restart_heaviest_fork_t * self = (fd_gossip_restart_heaviest_fork_t *)struct_mem;
20239 0 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
20240 0 : fd_bincode_uint64_decode_unsafe( &self->wallclock, ctx );
20241 0 : fd_bincode_uint64_decode_unsafe( &self->last_slot, ctx );
20242 0 : fd_hash_decode_inner( &self->last_slot_hash, alloc_mem, ctx );
20243 0 : fd_bincode_uint64_decode_unsafe( &self->observed_stake, ctx );
20244 0 : fd_bincode_uint16_decode_unsafe( &self->shred_version, ctx );
20245 0 : }
20246 0 : void * fd_gossip_restart_heaviest_fork_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20247 0 : fd_gossip_restart_heaviest_fork_t * self = (fd_gossip_restart_heaviest_fork_t *)mem;
20248 0 : fd_gossip_restart_heaviest_fork_new( self );
20249 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_restart_heaviest_fork_t);
20250 0 : void * * alloc_mem = &alloc_region;
20251 0 : fd_gossip_restart_heaviest_fork_decode_inner( mem, alloc_mem, ctx );
20252 0 : return self;
20253 0 : }
20254 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, uint varint ) {
20255 0 : (void) varint;
20256 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_restart_heaviest_fork", level++, 0 );
20257 0 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
20258 0 : fun( w, &self->wallclock, "wallclock", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20259 0 : fun( w, &self->last_slot, "last_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20260 0 : fd_hash_walk( w, &self->last_slot_hash, fun, "last_slot_hash", level, 0 );
20261 0 : fun( w, &self->observed_stake, "observed_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20262 0 : fun( w, &self->shred_version, "shred_version", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
20263 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_restart_heaviest_fork", level--, 0 );
20264 0 : }
20265 0 : FD_FN_PURE uchar fd_crds_data_is_contact_info_v1(fd_crds_data_t const * self) {
20266 0 : return self->discriminant == 0;
20267 0 : }
20268 0 : FD_FN_PURE uchar fd_crds_data_is_vote(fd_crds_data_t const * self) {
20269 0 : return self->discriminant == 1;
20270 0 : }
20271 0 : FD_FN_PURE uchar fd_crds_data_is_lowest_slot(fd_crds_data_t const * self) {
20272 0 : return self->discriminant == 2;
20273 0 : }
20274 0 : FD_FN_PURE uchar fd_crds_data_is_snapshot_hashes(fd_crds_data_t const * self) {
20275 0 : return self->discriminant == 3;
20276 0 : }
20277 0 : FD_FN_PURE uchar fd_crds_data_is_accounts_hashes(fd_crds_data_t const * self) {
20278 0 : return self->discriminant == 4;
20279 0 : }
20280 0 : FD_FN_PURE uchar fd_crds_data_is_epoch_slots(fd_crds_data_t const * self) {
20281 0 : return self->discriminant == 5;
20282 0 : }
20283 0 : FD_FN_PURE uchar fd_crds_data_is_version_v1(fd_crds_data_t const * self) {
20284 0 : return self->discriminant == 6;
20285 0 : }
20286 0 : FD_FN_PURE uchar fd_crds_data_is_version_v2(fd_crds_data_t const * self) {
20287 0 : return self->discriminant == 7;
20288 0 : }
20289 0 : FD_FN_PURE uchar fd_crds_data_is_node_instance(fd_crds_data_t const * self) {
20290 0 : return self->discriminant == 8;
20291 0 : }
20292 0 : FD_FN_PURE uchar fd_crds_data_is_duplicate_shred(fd_crds_data_t const * self) {
20293 0 : return self->discriminant == 9;
20294 0 : }
20295 0 : FD_FN_PURE uchar fd_crds_data_is_incremental_snapshot_hashes(fd_crds_data_t const * self) {
20296 0 : return self->discriminant == 10;
20297 0 : }
20298 0 : FD_FN_PURE uchar fd_crds_data_is_contact_info_v2(fd_crds_data_t const * self) {
20299 0 : return self->discriminant == 11;
20300 0 : }
20301 0 : FD_FN_PURE uchar fd_crds_data_is_restart_last_voted_fork_slots(fd_crds_data_t const * self) {
20302 0 : return self->discriminant == 12;
20303 0 : }
20304 0 : FD_FN_PURE uchar fd_crds_data_is_restart_heaviest_fork(fd_crds_data_t const * self) {
20305 0 : return self->discriminant == 13;
20306 0 : }
20307 : void fd_crds_data_inner_new( fd_crds_data_inner_t * self, uint discriminant );
20308 30 : int fd_crds_data_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20309 30 : int err;
20310 30 : switch (discriminant) {
20311 9 : case 0: {
20312 9 : err = fd_gossip_contact_info_v1_decode_footprint_inner( ctx, total_sz );
20313 9 : if( FD_UNLIKELY( err ) ) return err;
20314 9 : return FD_BINCODE_SUCCESS;
20315 9 : }
20316 6 : case 1: {
20317 6 : err = fd_gossip_vote_decode_footprint_inner( ctx, total_sz );
20318 6 : if( FD_UNLIKELY( err ) ) return err;
20319 6 : return FD_BINCODE_SUCCESS;
20320 6 : }
20321 0 : case 2: {
20322 0 : err = fd_gossip_lowest_slot_decode_footprint_inner( ctx, total_sz );
20323 0 : if( FD_UNLIKELY( err ) ) return err;
20324 0 : return FD_BINCODE_SUCCESS;
20325 0 : }
20326 3 : case 3: {
20327 3 : err = fd_gossip_slot_hashes_decode_footprint_inner( ctx, total_sz );
20328 3 : if( FD_UNLIKELY( err ) ) return err;
20329 3 : return FD_BINCODE_SUCCESS;
20330 3 : }
20331 0 : case 4: {
20332 0 : err = fd_gossip_slot_hashes_decode_footprint_inner( ctx, total_sz );
20333 0 : if( FD_UNLIKELY( err ) ) return err;
20334 0 : return FD_BINCODE_SUCCESS;
20335 0 : }
20336 0 : case 5: {
20337 0 : err = fd_gossip_epoch_slots_decode_footprint_inner( ctx, total_sz );
20338 0 : if( FD_UNLIKELY( err ) ) return err;
20339 0 : return FD_BINCODE_SUCCESS;
20340 0 : }
20341 0 : case 6: {
20342 0 : err = fd_gossip_version_v1_decode_footprint_inner( ctx, total_sz );
20343 0 : if( FD_UNLIKELY( err ) ) return err;
20344 0 : return FD_BINCODE_SUCCESS;
20345 0 : }
20346 3 : case 7: {
20347 3 : err = fd_gossip_version_v2_decode_footprint_inner( ctx, total_sz );
20348 3 : if( FD_UNLIKELY( err ) ) return err;
20349 3 : return FD_BINCODE_SUCCESS;
20350 3 : }
20351 6 : case 8: {
20352 6 : err = fd_gossip_node_instance_decode_footprint_inner( ctx, total_sz );
20353 6 : if( FD_UNLIKELY( err ) ) return err;
20354 6 : return FD_BINCODE_SUCCESS;
20355 6 : }
20356 0 : case 9: {
20357 0 : err = fd_gossip_duplicate_shred_decode_footprint_inner( ctx, total_sz );
20358 0 : if( FD_UNLIKELY( err ) ) return err;
20359 0 : return FD_BINCODE_SUCCESS;
20360 0 : }
20361 0 : case 10: {
20362 0 : err = fd_gossip_incremental_snapshot_hashes_decode_footprint_inner( ctx, total_sz );
20363 0 : if( FD_UNLIKELY( err ) ) return err;
20364 0 : return FD_BINCODE_SUCCESS;
20365 0 : }
20366 3 : case 11: {
20367 3 : err = fd_gossip_contact_info_v2_decode_footprint_inner( ctx, total_sz );
20368 3 : if( FD_UNLIKELY( err ) ) return err;
20369 3 : return FD_BINCODE_SUCCESS;
20370 3 : }
20371 0 : case 12: {
20372 0 : err = fd_gossip_restart_last_voted_fork_slots_decode_footprint_inner( ctx, total_sz );
20373 0 : if( FD_UNLIKELY( err ) ) return err;
20374 0 : return FD_BINCODE_SUCCESS;
20375 0 : }
20376 0 : case 13: {
20377 0 : err = fd_gossip_restart_heaviest_fork_decode_footprint_inner( ctx, total_sz );
20378 0 : if( FD_UNLIKELY( err ) ) return err;
20379 0 : return FD_BINCODE_SUCCESS;
20380 0 : }
20381 0 : default: return FD_BINCODE_ERR_ENCODING;
20382 30 : }
20383 30 : }
20384 30 : static int fd_crds_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20385 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20386 30 : uint discriminant = 0;
20387 30 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
20388 30 : if( FD_UNLIKELY( err ) ) return err;
20389 30 : return fd_crds_data_inner_decode_footprint( discriminant, ctx, total_sz );
20390 30 : }
20391 0 : int fd_crds_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20392 0 : *total_sz += sizeof(fd_crds_data_t);
20393 0 : void const * start_data = ctx->data;
20394 0 : int err = fd_crds_data_decode_footprint_inner( ctx, total_sz );
20395 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20396 0 : ctx->data = start_data;
20397 0 : return err;
20398 0 : }
20399 30 : static void fd_crds_data_inner_decode_inner( fd_crds_data_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
20400 30 : switch (discriminant) {
20401 9 : case 0: {
20402 9 : fd_gossip_contact_info_v1_decode_inner( &self->contact_info_v1, alloc_mem, ctx );
20403 9 : break;
20404 0 : }
20405 6 : case 1: {
20406 6 : fd_gossip_vote_decode_inner( &self->vote, alloc_mem, ctx );
20407 6 : break;
20408 0 : }
20409 0 : case 2: {
20410 0 : fd_gossip_lowest_slot_decode_inner( &self->lowest_slot, alloc_mem, ctx );
20411 0 : break;
20412 0 : }
20413 3 : case 3: {
20414 3 : fd_gossip_slot_hashes_decode_inner( &self->snapshot_hashes, alloc_mem, ctx );
20415 3 : break;
20416 0 : }
20417 0 : case 4: {
20418 0 : fd_gossip_slot_hashes_decode_inner( &self->accounts_hashes, alloc_mem, ctx );
20419 0 : break;
20420 0 : }
20421 0 : case 5: {
20422 0 : fd_gossip_epoch_slots_decode_inner( &self->epoch_slots, alloc_mem, ctx );
20423 0 : break;
20424 0 : }
20425 0 : case 6: {
20426 0 : fd_gossip_version_v1_decode_inner( &self->version_v1, alloc_mem, ctx );
20427 0 : break;
20428 0 : }
20429 3 : case 7: {
20430 3 : fd_gossip_version_v2_decode_inner( &self->version_v2, alloc_mem, ctx );
20431 3 : break;
20432 0 : }
20433 6 : case 8: {
20434 6 : fd_gossip_node_instance_decode_inner( &self->node_instance, alloc_mem, ctx );
20435 6 : break;
20436 0 : }
20437 0 : case 9: {
20438 0 : fd_gossip_duplicate_shred_decode_inner( &self->duplicate_shred, alloc_mem, ctx );
20439 0 : break;
20440 0 : }
20441 0 : case 10: {
20442 0 : fd_gossip_incremental_snapshot_hashes_decode_inner( &self->incremental_snapshot_hashes, alloc_mem, ctx );
20443 0 : break;
20444 0 : }
20445 3 : case 11: {
20446 3 : fd_gossip_contact_info_v2_decode_inner( &self->contact_info_v2, alloc_mem, ctx );
20447 3 : break;
20448 0 : }
20449 0 : case 12: {
20450 0 : fd_gossip_restart_last_voted_fork_slots_decode_inner( &self->restart_last_voted_fork_slots, alloc_mem, ctx );
20451 0 : break;
20452 0 : }
20453 0 : case 13: {
20454 0 : fd_gossip_restart_heaviest_fork_decode_inner( &self->restart_heaviest_fork, alloc_mem, ctx );
20455 0 : break;
20456 0 : }
20457 30 : }
20458 30 : }
20459 30 : static void fd_crds_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20460 30 : fd_crds_data_t * self = (fd_crds_data_t *)struct_mem;
20461 30 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
20462 30 : fd_crds_data_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
20463 30 : }
20464 0 : void * fd_crds_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20465 0 : fd_crds_data_t * self = (fd_crds_data_t *)mem;
20466 0 : fd_crds_data_new( self );
20467 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_data_t);
20468 0 : void * * alloc_mem = &alloc_region;
20469 0 : fd_crds_data_decode_inner( mem, alloc_mem, ctx );
20470 0 : return self;
20471 0 : }
20472 27 : void fd_crds_data_inner_new( fd_crds_data_inner_t * self, uint discriminant ) {
20473 27 : switch( discriminant ) {
20474 0 : case 0: {
20475 0 : fd_gossip_contact_info_v1_new( &self->contact_info_v1 );
20476 0 : break;
20477 0 : }
20478 0 : case 1: {
20479 0 : fd_gossip_vote_new( &self->vote );
20480 0 : break;
20481 0 : }
20482 0 : case 2: {
20483 0 : fd_gossip_lowest_slot_new( &self->lowest_slot );
20484 0 : break;
20485 0 : }
20486 0 : case 3: {
20487 0 : fd_gossip_slot_hashes_new( &self->snapshot_hashes );
20488 0 : break;
20489 0 : }
20490 0 : case 4: {
20491 0 : fd_gossip_slot_hashes_new( &self->accounts_hashes );
20492 0 : break;
20493 0 : }
20494 0 : case 5: {
20495 0 : fd_gossip_epoch_slots_new( &self->epoch_slots );
20496 0 : break;
20497 0 : }
20498 0 : case 6: {
20499 0 : fd_gossip_version_v1_new( &self->version_v1 );
20500 0 : break;
20501 0 : }
20502 0 : case 7: {
20503 0 : fd_gossip_version_v2_new( &self->version_v2 );
20504 0 : break;
20505 0 : }
20506 0 : case 8: {
20507 0 : fd_gossip_node_instance_new( &self->node_instance );
20508 0 : break;
20509 0 : }
20510 0 : case 9: {
20511 0 : fd_gossip_duplicate_shred_new( &self->duplicate_shred );
20512 0 : break;
20513 0 : }
20514 0 : case 10: {
20515 0 : fd_gossip_incremental_snapshot_hashes_new( &self->incremental_snapshot_hashes );
20516 0 : break;
20517 0 : }
20518 0 : case 11: {
20519 0 : fd_gossip_contact_info_v2_new( &self->contact_info_v2 );
20520 0 : break;
20521 0 : }
20522 0 : case 12: {
20523 0 : fd_gossip_restart_last_voted_fork_slots_new( &self->restart_last_voted_fork_slots );
20524 0 : break;
20525 0 : }
20526 0 : case 13: {
20527 0 : fd_gossip_restart_heaviest_fork_new( &self->restart_heaviest_fork );
20528 0 : break;
20529 0 : }
20530 27 : default: break; // FD_LOG_ERR(( "unhandled type"));
20531 27 : }
20532 27 : }
20533 27 : void fd_crds_data_new_disc( fd_crds_data_t * self, uint discriminant ) {
20534 27 : self->discriminant = discriminant;
20535 27 : fd_crds_data_inner_new( &self->inner, self->discriminant );
20536 27 : }
20537 27 : void fd_crds_data_new( fd_crds_data_t * self ) {
20538 27 : fd_memset( self, 0, sizeof(fd_crds_data_t) );
20539 27 : fd_crds_data_new_disc( self, UINT_MAX );
20540 27 : }
20541 :
20542 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, uint varint ) {
20543 30 : (void) varint;
20544 30 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_crds_data", level++, 0);
20545 30 : switch( self->discriminant ) {
20546 9 : case 0: {
20547 9 : fun( w, self, "contact_info_v1", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20548 9 : fd_gossip_contact_info_v1_walk( w, &self->inner.contact_info_v1, fun, "contact_info_v1", level, 0 );
20549 9 : break;
20550 0 : }
20551 6 : case 1: {
20552 6 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20553 6 : fd_gossip_vote_walk( w, &self->inner.vote, fun, "vote", level, 0 );
20554 6 : break;
20555 0 : }
20556 0 : case 2: {
20557 0 : fun( w, self, "lowest_slot", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20558 0 : fd_gossip_lowest_slot_walk( w, &self->inner.lowest_slot, fun, "lowest_slot", level, 0 );
20559 0 : break;
20560 0 : }
20561 3 : case 3: {
20562 3 : fun( w, self, "snapshot_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20563 3 : fd_gossip_slot_hashes_walk( w, &self->inner.snapshot_hashes, fun, "snapshot_hashes", level, 0 );
20564 3 : break;
20565 0 : }
20566 0 : case 4: {
20567 0 : fun( w, self, "accounts_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20568 0 : fd_gossip_slot_hashes_walk( w, &self->inner.accounts_hashes, fun, "accounts_hashes", level, 0 );
20569 0 : break;
20570 0 : }
20571 0 : case 5: {
20572 0 : fun( w, self, "epoch_slots", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20573 0 : fd_gossip_epoch_slots_walk( w, &self->inner.epoch_slots, fun, "epoch_slots", level, 0 );
20574 0 : break;
20575 0 : }
20576 0 : case 6: {
20577 0 : fun( w, self, "version_v1", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20578 0 : fd_gossip_version_v1_walk( w, &self->inner.version_v1, fun, "version_v1", level, 0 );
20579 0 : break;
20580 0 : }
20581 3 : case 7: {
20582 3 : fun( w, self, "version_v2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20583 3 : fd_gossip_version_v2_walk( w, &self->inner.version_v2, fun, "version_v2", level, 0 );
20584 3 : break;
20585 0 : }
20586 6 : case 8: {
20587 6 : fun( w, self, "node_instance", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20588 6 : fd_gossip_node_instance_walk( w, &self->inner.node_instance, fun, "node_instance", level, 0 );
20589 6 : break;
20590 0 : }
20591 0 : case 9: {
20592 0 : fun( w, self, "duplicate_shred", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20593 0 : fd_gossip_duplicate_shred_walk( w, &self->inner.duplicate_shred, fun, "duplicate_shred", level, 0 );
20594 0 : break;
20595 0 : }
20596 0 : case 10: {
20597 0 : fun( w, self, "incremental_snapshot_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20598 0 : fd_gossip_incremental_snapshot_hashes_walk( w, &self->inner.incremental_snapshot_hashes, fun, "incremental_snapshot_hashes", level, 0 );
20599 0 : break;
20600 0 : }
20601 3 : case 11: {
20602 3 : fun( w, self, "contact_info_v2", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20603 3 : fd_gossip_contact_info_v2_walk( w, &self->inner.contact_info_v2, fun, "contact_info_v2", level, 0 );
20604 3 : break;
20605 0 : }
20606 0 : case 12: {
20607 0 : fun( w, self, "restart_last_voted_fork_slots", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20608 0 : fd_gossip_restart_last_voted_fork_slots_walk( w, &self->inner.restart_last_voted_fork_slots, fun, "restart_last_voted_fork_slots", level, 0 );
20609 0 : break;
20610 0 : }
20611 0 : case 13: {
20612 0 : fun( w, self, "restart_heaviest_fork", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
20613 0 : fd_gossip_restart_heaviest_fork_walk( w, &self->inner.restart_heaviest_fork, fun, "restart_heaviest_fork", level, 0 );
20614 0 : break;
20615 0 : }
20616 30 : }
20617 30 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_crds_data", level--, 0 );
20618 30 : }
20619 0 : ulong fd_crds_data_size( fd_crds_data_t const * self ) {
20620 0 : ulong size = 0;
20621 0 : size += sizeof(uint);
20622 0 : switch (self->discriminant) {
20623 0 : case 0: {
20624 0 : size += fd_gossip_contact_info_v1_size( &self->inner.contact_info_v1 );
20625 0 : break;
20626 0 : }
20627 0 : case 1: {
20628 0 : size += fd_gossip_vote_size( &self->inner.vote );
20629 0 : break;
20630 0 : }
20631 0 : case 2: {
20632 0 : size += fd_gossip_lowest_slot_size( &self->inner.lowest_slot );
20633 0 : break;
20634 0 : }
20635 0 : case 3: {
20636 0 : size += fd_gossip_slot_hashes_size( &self->inner.snapshot_hashes );
20637 0 : break;
20638 0 : }
20639 0 : case 4: {
20640 0 : size += fd_gossip_slot_hashes_size( &self->inner.accounts_hashes );
20641 0 : break;
20642 0 : }
20643 0 : case 5: {
20644 0 : size += fd_gossip_epoch_slots_size( &self->inner.epoch_slots );
20645 0 : break;
20646 0 : }
20647 0 : case 6: {
20648 0 : size += fd_gossip_version_v1_size( &self->inner.version_v1 );
20649 0 : break;
20650 0 : }
20651 0 : case 7: {
20652 0 : size += fd_gossip_version_v2_size( &self->inner.version_v2 );
20653 0 : break;
20654 0 : }
20655 0 : case 8: {
20656 0 : size += fd_gossip_node_instance_size( &self->inner.node_instance );
20657 0 : break;
20658 0 : }
20659 0 : case 9: {
20660 0 : size += fd_gossip_duplicate_shred_size( &self->inner.duplicate_shred );
20661 0 : break;
20662 0 : }
20663 0 : case 10: {
20664 0 : size += fd_gossip_incremental_snapshot_hashes_size( &self->inner.incremental_snapshot_hashes );
20665 0 : break;
20666 0 : }
20667 0 : case 11: {
20668 0 : size += fd_gossip_contact_info_v2_size( &self->inner.contact_info_v2 );
20669 0 : break;
20670 0 : }
20671 0 : case 12: {
20672 0 : size += fd_gossip_restart_last_voted_fork_slots_size( &self->inner.restart_last_voted_fork_slots );
20673 0 : break;
20674 0 : }
20675 0 : case 13: {
20676 0 : size += fd_gossip_restart_heaviest_fork_size( &self->inner.restart_heaviest_fork );
20677 0 : break;
20678 0 : }
20679 0 : }
20680 0 : return size;
20681 0 : }
20682 :
20683 0 : int fd_crds_data_inner_encode( fd_crds_data_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
20684 0 : int err;
20685 0 : switch (discriminant) {
20686 0 : case 0: {
20687 0 : err = fd_gossip_contact_info_v1_encode( &self->contact_info_v1, ctx );
20688 0 : if( FD_UNLIKELY( err ) ) return err;
20689 0 : break;
20690 0 : }
20691 0 : case 1: {
20692 0 : err = fd_gossip_vote_encode( &self->vote, ctx );
20693 0 : if( FD_UNLIKELY( err ) ) return err;
20694 0 : break;
20695 0 : }
20696 0 : case 2: {
20697 0 : err = fd_gossip_lowest_slot_encode( &self->lowest_slot, ctx );
20698 0 : if( FD_UNLIKELY( err ) ) return err;
20699 0 : break;
20700 0 : }
20701 0 : case 3: {
20702 0 : err = fd_gossip_slot_hashes_encode( &self->snapshot_hashes, ctx );
20703 0 : if( FD_UNLIKELY( err ) ) return err;
20704 0 : break;
20705 0 : }
20706 0 : case 4: {
20707 0 : err = fd_gossip_slot_hashes_encode( &self->accounts_hashes, ctx );
20708 0 : if( FD_UNLIKELY( err ) ) return err;
20709 0 : break;
20710 0 : }
20711 0 : case 5: {
20712 0 : err = fd_gossip_epoch_slots_encode( &self->epoch_slots, ctx );
20713 0 : if( FD_UNLIKELY( err ) ) return err;
20714 0 : break;
20715 0 : }
20716 0 : case 6: {
20717 0 : err = fd_gossip_version_v1_encode( &self->version_v1, ctx );
20718 0 : if( FD_UNLIKELY( err ) ) return err;
20719 0 : break;
20720 0 : }
20721 0 : case 7: {
20722 0 : err = fd_gossip_version_v2_encode( &self->version_v2, ctx );
20723 0 : if( FD_UNLIKELY( err ) ) return err;
20724 0 : break;
20725 0 : }
20726 0 : case 8: {
20727 0 : err = fd_gossip_node_instance_encode( &self->node_instance, ctx );
20728 0 : if( FD_UNLIKELY( err ) ) return err;
20729 0 : break;
20730 0 : }
20731 0 : case 9: {
20732 0 : err = fd_gossip_duplicate_shred_encode( &self->duplicate_shred, ctx );
20733 0 : if( FD_UNLIKELY( err ) ) return err;
20734 0 : break;
20735 0 : }
20736 0 : case 10: {
20737 0 : err = fd_gossip_incremental_snapshot_hashes_encode( &self->incremental_snapshot_hashes, ctx );
20738 0 : if( FD_UNLIKELY( err ) ) return err;
20739 0 : break;
20740 0 : }
20741 0 : case 11: {
20742 0 : err = fd_gossip_contact_info_v2_encode( &self->contact_info_v2, ctx );
20743 0 : if( FD_UNLIKELY( err ) ) return err;
20744 0 : break;
20745 0 : }
20746 0 : case 12: {
20747 0 : err = fd_gossip_restart_last_voted_fork_slots_encode( &self->restart_last_voted_fork_slots, ctx );
20748 0 : if( FD_UNLIKELY( err ) ) return err;
20749 0 : break;
20750 0 : }
20751 0 : case 13: {
20752 0 : err = fd_gossip_restart_heaviest_fork_encode( &self->restart_heaviest_fork, ctx );
20753 0 : if( FD_UNLIKELY( err ) ) return err;
20754 0 : break;
20755 0 : }
20756 0 : }
20757 0 : return FD_BINCODE_SUCCESS;
20758 0 : }
20759 0 : int fd_crds_data_encode( fd_crds_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20760 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
20761 0 : if( FD_UNLIKELY( err ) ) return err;
20762 0 : return fd_crds_data_inner_encode( &self->inner, self->discriminant, ctx );
20763 0 : }
20764 :
20765 0 : int fd_crds_bloom_encode( fd_crds_bloom_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20766 0 : int err;
20767 0 : err = fd_bincode_uint64_encode( self->keys_len, ctx );
20768 0 : if( FD_UNLIKELY(err) ) return err;
20769 0 : if( self->keys_len ) {
20770 0 : for( ulong i=0; i < self->keys_len; i++ ) {
20771 0 : err = fd_bincode_uint64_encode( self->keys[i], ctx );
20772 0 : }
20773 0 : }
20774 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
20775 0 : if( FD_UNLIKELY( err ) ) return err;
20776 0 : if( self->has_bits ) {
20777 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
20778 0 : if( FD_UNLIKELY(err) ) return err;
20779 0 : if( self->bits_bitvec_len ) {
20780 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
20781 0 : err = fd_bincode_uint64_encode( self->bits_bitvec[i], ctx );
20782 0 : }
20783 0 : }
20784 0 : if( FD_UNLIKELY( err ) ) return err;
20785 0 : }
20786 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
20787 0 : if( FD_UNLIKELY( err ) ) return err;
20788 0 : err = fd_bincode_uint64_encode( self->num_bits_set, ctx );
20789 0 : if( FD_UNLIKELY( err ) ) return err;
20790 0 : return FD_BINCODE_SUCCESS;
20791 0 : }
20792 3 : static int fd_crds_bloom_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20793 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20794 3 : int err = 0;
20795 3 : ulong keys_len;
20796 3 : err = fd_bincode_uint64_decode( &keys_len, ctx );
20797 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20798 3 : if( keys_len ) {
20799 3 : *total_sz += 8UL + sizeof(ulong)*keys_len;
20800 12 : for( ulong i=0; i < keys_len; i++ ) {
20801 9 : err = fd_bincode_uint64_decode_footprint( ctx );
20802 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20803 9 : }
20804 3 : }
20805 3 : {
20806 3 : uchar o;
20807 3 : ulong inner_len = 0UL;
20808 3 : err = fd_bincode_bool_decode( &o, ctx );
20809 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20810 3 : if( o ) {
20811 3 : ulong bits_bitvec_len;
20812 3 : err = fd_bincode_uint64_decode( &bits_bitvec_len, ctx );
20813 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20814 3 : if( bits_bitvec_len ) {
20815 3 : *total_sz += 8UL + sizeof(ulong)*bits_bitvec_len;
20816 294 : for( ulong i=0; i < bits_bitvec_len; i++ ) {
20817 291 : err = fd_bincode_uint64_decode_footprint( ctx );
20818 291 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20819 291 : }
20820 3 : }
20821 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20822 3 : inner_len = bits_bitvec_len;
20823 3 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
20824 3 : }
20825 3 : ulong len;
20826 3 : err = fd_bincode_uint64_decode( &len, ctx );
20827 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20828 3 : if( len > inner_len * sizeof(ulong) * 8UL ) return FD_BINCODE_ERR_ENCODING;
20829 3 : }
20830 3 : err = fd_bincode_uint64_decode_footprint( ctx );
20831 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20832 3 : return 0;
20833 3 : }
20834 0 : int fd_crds_bloom_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20835 0 : *total_sz += sizeof(fd_crds_bloom_t);
20836 0 : void const * start_data = ctx->data;
20837 0 : int err = fd_crds_bloom_decode_footprint_inner( ctx, total_sz );
20838 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20839 0 : ctx->data = start_data;
20840 0 : return err;
20841 0 : }
20842 3 : static void fd_crds_bloom_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20843 3 : fd_crds_bloom_t * self = (fd_crds_bloom_t *)struct_mem;
20844 3 : fd_bincode_uint64_decode_unsafe( &self->keys_len, ctx );
20845 3 : if( self->keys_len ) {
20846 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
20847 3 : self->keys = *alloc_mem;
20848 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->keys_len;
20849 12 : for( ulong i=0; i < self->keys_len; i++ ) {
20850 9 : fd_bincode_uint64_decode_unsafe( self->keys + i, ctx );
20851 9 : }
20852 3 : } else
20853 0 : self->keys = NULL;
20854 3 : {
20855 3 : uchar o;
20856 3 : fd_bincode_bool_decode_unsafe( &o, ctx );
20857 3 : self->has_bits = !!o;
20858 3 : if( o ) {
20859 3 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
20860 3 : if( self->bits_bitvec_len ) {
20861 3 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
20862 3 : self->bits_bitvec = *alloc_mem;
20863 3 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
20864 294 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
20865 291 : fd_bincode_uint64_decode_unsafe( self->bits_bitvec + i, ctx );
20866 291 : }
20867 3 : } else
20868 0 : self->bits_bitvec = NULL;
20869 3 : } else {
20870 0 : self->bits_bitvec = NULL;
20871 0 : }
20872 3 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
20873 3 : }
20874 3 : fd_bincode_uint64_decode_unsafe( &self->num_bits_set, ctx );
20875 3 : }
20876 0 : void * fd_crds_bloom_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20877 0 : fd_crds_bloom_t * self = (fd_crds_bloom_t *)mem;
20878 0 : fd_crds_bloom_new( self );
20879 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_bloom_t);
20880 0 : void * * alloc_mem = &alloc_region;
20881 0 : fd_crds_bloom_decode_inner( mem, alloc_mem, ctx );
20882 0 : return self;
20883 0 : }
20884 0 : void fd_crds_bloom_new(fd_crds_bloom_t * self) {
20885 0 : fd_memset( self, 0, sizeof(fd_crds_bloom_t) );
20886 0 : }
20887 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, uint varint ) {
20888 3 : (void) varint;
20889 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_bloom", level++, 0 );
20890 3 : if( self->keys_len ) {
20891 3 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
20892 12 : for( ulong i=0; i < self->keys_len; i++ )
20893 9 : fun( w, self->keys + i, "keys", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20894 3 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
20895 3 : }
20896 3 : if( !self->has_bits ) {
20897 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
20898 3 : } else {
20899 3 : if( self->bits_bitvec_len ) {
20900 3 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
20901 294 : for( ulong i=0; i < self->bits_bitvec_len; i++ )
20902 291 : fun( w, self->bits_bitvec + i, "bits_bitvec", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20903 3 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
20904 3 : }
20905 3 : }
20906 3 : fun( w, &self->bits_len, "bits_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20907 3 : fun( w, &self->num_bits_set, "num_bits_set", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20908 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_bloom", level--, 0 );
20909 3 : }
20910 0 : ulong fd_crds_bloom_size( fd_crds_bloom_t const * self ) {
20911 0 : ulong size = 0;
20912 0 : do {
20913 0 : size += sizeof(ulong);
20914 0 : size += self->keys_len * sizeof(ulong);
20915 0 : } while(0);
20916 0 : size += sizeof(char);
20917 0 : if( self->has_bits ) {
20918 0 : do {
20919 0 : size += sizeof(ulong);
20920 0 : size += self->bits_bitvec_len * sizeof(ulong);
20921 0 : } while(0);
20922 0 : }
20923 0 : size += sizeof(ulong);
20924 0 : size += sizeof(ulong);
20925 0 : return size;
20926 0 : }
20927 :
20928 0 : int fd_crds_filter_encode( fd_crds_filter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20929 0 : int err;
20930 0 : err = fd_crds_bloom_encode( &self->filter, ctx );
20931 0 : if( FD_UNLIKELY( err ) ) return err;
20932 0 : err = fd_bincode_uint64_encode( self->mask, ctx );
20933 0 : if( FD_UNLIKELY( err ) ) return err;
20934 0 : err = fd_bincode_uint32_encode( self->mask_bits, ctx );
20935 0 : if( FD_UNLIKELY( err ) ) return err;
20936 0 : return FD_BINCODE_SUCCESS;
20937 0 : }
20938 3 : static int fd_crds_filter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20939 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20940 3 : int err = 0;
20941 3 : err = fd_crds_bloom_decode_footprint_inner( ctx, total_sz );
20942 3 : if( FD_UNLIKELY( err ) ) return err;
20943 3 : err = fd_bincode_uint64_decode_footprint( ctx );
20944 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
20945 3 : err = fd_bincode_uint32_decode_footprint( ctx );
20946 3 : if( FD_UNLIKELY( err ) ) return err;
20947 3 : return 0;
20948 3 : }
20949 0 : int fd_crds_filter_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
20950 0 : *total_sz += sizeof(fd_crds_filter_t);
20951 0 : void const * start_data = ctx->data;
20952 0 : int err = fd_crds_filter_decode_footprint_inner( ctx, total_sz );
20953 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
20954 0 : ctx->data = start_data;
20955 0 : return err;
20956 0 : }
20957 3 : static void fd_crds_filter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
20958 3 : fd_crds_filter_t * self = (fd_crds_filter_t *)struct_mem;
20959 3 : fd_crds_bloom_decode_inner( &self->filter, alloc_mem, ctx );
20960 3 : fd_bincode_uint64_decode_unsafe( &self->mask, ctx );
20961 3 : fd_bincode_uint32_decode_unsafe( &self->mask_bits, ctx );
20962 3 : }
20963 0 : void * fd_crds_filter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
20964 0 : fd_crds_filter_t * self = (fd_crds_filter_t *)mem;
20965 0 : fd_crds_filter_new( self );
20966 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_filter_t);
20967 0 : void * * alloc_mem = &alloc_region;
20968 0 : fd_crds_filter_decode_inner( mem, alloc_mem, ctx );
20969 0 : return self;
20970 0 : }
20971 0 : void fd_crds_filter_new(fd_crds_filter_t * self) {
20972 0 : fd_memset( self, 0, sizeof(fd_crds_filter_t) );
20973 0 : fd_crds_bloom_new( &self->filter );
20974 0 : }
20975 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, uint varint ) {
20976 3 : (void) varint;
20977 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_filter", level++, 0 );
20978 3 : fd_crds_bloom_walk( w, &self->filter, fun, "filter", level, 0 );
20979 3 : fun( w, &self->mask, "mask", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
20980 3 : fun( w, &self->mask_bits, "mask_bits", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
20981 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_filter", level--, 0 );
20982 3 : }
20983 0 : ulong fd_crds_filter_size( fd_crds_filter_t const * self ) {
20984 0 : ulong size = 0;
20985 0 : size += fd_crds_bloom_size( &self->filter );
20986 0 : size += sizeof(ulong);
20987 0 : size += sizeof(uint);
20988 0 : return size;
20989 0 : }
20990 :
20991 0 : int fd_crds_value_encode( fd_crds_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
20992 0 : int err;
20993 0 : err = fd_signature_encode( &self->signature, ctx );
20994 0 : if( FD_UNLIKELY( err ) ) return err;
20995 0 : err = fd_crds_data_encode( &self->data, ctx );
20996 0 : if( FD_UNLIKELY( err ) ) return err;
20997 0 : return FD_BINCODE_SUCCESS;
20998 0 : }
20999 30 : static int fd_crds_value_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21000 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21001 30 : int err = 0;
21002 30 : err = fd_signature_decode_footprint_inner( ctx, total_sz );
21003 30 : if( FD_UNLIKELY( err ) ) return err;
21004 30 : err = fd_crds_data_decode_footprint_inner( ctx, total_sz );
21005 30 : if( FD_UNLIKELY( err ) ) return err;
21006 30 : return 0;
21007 30 : }
21008 0 : int fd_crds_value_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21009 0 : *total_sz += sizeof(fd_crds_value_t);
21010 0 : void const * start_data = ctx->data;
21011 0 : int err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
21012 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21013 0 : ctx->data = start_data;
21014 0 : return err;
21015 0 : }
21016 30 : static void fd_crds_value_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21017 30 : fd_crds_value_t * self = (fd_crds_value_t *)struct_mem;
21018 30 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
21019 30 : fd_crds_data_decode_inner( &self->data, alloc_mem, ctx );
21020 30 : }
21021 0 : void * fd_crds_value_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21022 0 : fd_crds_value_t * self = (fd_crds_value_t *)mem;
21023 0 : fd_crds_value_new( self );
21024 0 : void * alloc_region = (uchar *)mem + sizeof(fd_crds_value_t);
21025 0 : void * * alloc_mem = &alloc_region;
21026 0 : fd_crds_value_decode_inner( mem, alloc_mem, ctx );
21027 0 : return self;
21028 0 : }
21029 27 : void fd_crds_value_new(fd_crds_value_t * self) {
21030 27 : fd_memset( self, 0, sizeof(fd_crds_value_t) );
21031 27 : fd_signature_new( &self->signature );
21032 27 : fd_crds_data_new( &self->data );
21033 27 : }
21034 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, uint varint ) {
21035 30 : (void) varint;
21036 30 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_crds_value", level++, 0 );
21037 30 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
21038 30 : fd_crds_data_walk( w, &self->data, fun, "data", level, 0 );
21039 30 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_crds_value", level--, 0 );
21040 30 : }
21041 0 : ulong fd_crds_value_size( fd_crds_value_t const * self ) {
21042 0 : ulong size = 0;
21043 0 : size += fd_signature_size( &self->signature );
21044 0 : size += fd_crds_data_size( &self->data );
21045 0 : return size;
21046 0 : }
21047 :
21048 0 : int fd_gossip_pull_req_encode( fd_gossip_pull_req_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21049 0 : int err;
21050 0 : err = fd_crds_filter_encode( &self->filter, ctx );
21051 0 : if( FD_UNLIKELY( err ) ) return err;
21052 0 : err = fd_crds_value_encode( &self->value, ctx );
21053 0 : if( FD_UNLIKELY( err ) ) return err;
21054 0 : return FD_BINCODE_SUCCESS;
21055 0 : }
21056 3 : static int fd_gossip_pull_req_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21057 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21058 3 : int err = 0;
21059 3 : err = fd_crds_filter_decode_footprint_inner( ctx, total_sz );
21060 3 : if( FD_UNLIKELY( err ) ) return err;
21061 3 : err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
21062 3 : if( FD_UNLIKELY( err ) ) return err;
21063 3 : return 0;
21064 3 : }
21065 0 : int fd_gossip_pull_req_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21066 0 : *total_sz += sizeof(fd_gossip_pull_req_t);
21067 0 : void const * start_data = ctx->data;
21068 0 : int err = fd_gossip_pull_req_decode_footprint_inner( ctx, total_sz );
21069 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21070 0 : ctx->data = start_data;
21071 0 : return err;
21072 0 : }
21073 3 : static void fd_gossip_pull_req_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21074 3 : fd_gossip_pull_req_t * self = (fd_gossip_pull_req_t *)struct_mem;
21075 3 : fd_crds_filter_decode_inner( &self->filter, alloc_mem, ctx );
21076 3 : fd_crds_value_decode_inner( &self->value, alloc_mem, ctx );
21077 3 : }
21078 0 : void * fd_gossip_pull_req_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21079 0 : fd_gossip_pull_req_t * self = (fd_gossip_pull_req_t *)mem;
21080 0 : fd_gossip_pull_req_new( self );
21081 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_pull_req_t);
21082 0 : void * * alloc_mem = &alloc_region;
21083 0 : fd_gossip_pull_req_decode_inner( mem, alloc_mem, ctx );
21084 0 : return self;
21085 0 : }
21086 0 : void fd_gossip_pull_req_new(fd_gossip_pull_req_t * self) {
21087 0 : fd_memset( self, 0, sizeof(fd_gossip_pull_req_t) );
21088 0 : fd_crds_filter_new( &self->filter );
21089 0 : fd_crds_value_new( &self->value );
21090 0 : }
21091 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, uint varint ) {
21092 3 : (void) varint;
21093 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_pull_req", level++, 0 );
21094 3 : fd_crds_filter_walk( w, &self->filter, fun, "filter", level, 0 );
21095 3 : fd_crds_value_walk( w, &self->value, fun, "value", level, 0 );
21096 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_pull_req", level--, 0 );
21097 3 : }
21098 0 : ulong fd_gossip_pull_req_size( fd_gossip_pull_req_t const * self ) {
21099 0 : ulong size = 0;
21100 0 : size += fd_crds_filter_size( &self->filter );
21101 0 : size += fd_crds_value_size( &self->value );
21102 0 : return size;
21103 0 : }
21104 :
21105 0 : int fd_gossip_pull_resp_encode( fd_gossip_pull_resp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21106 0 : int err;
21107 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
21108 0 : if( FD_UNLIKELY( err ) ) return err;
21109 0 : err = fd_bincode_uint64_encode( self->crds_len, ctx );
21110 0 : if( FD_UNLIKELY(err) ) return err;
21111 0 : if( self->crds_len ) {
21112 0 : for( ulong i=0; i < self->crds_len; i++ ) {
21113 0 : err = fd_crds_value_encode( self->crds + i, ctx );
21114 0 : if( FD_UNLIKELY( err ) ) return err;
21115 0 : }
21116 0 : }
21117 0 : return FD_BINCODE_SUCCESS;
21118 0 : }
21119 12 : static int fd_gossip_pull_resp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21120 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21121 12 : int err = 0;
21122 12 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
21123 12 : if( FD_UNLIKELY( err ) ) return err;
21124 12 : ulong crds_len;
21125 12 : err = fd_bincode_uint64_decode( &crds_len, ctx );
21126 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21127 12 : if( crds_len ) {
21128 12 : *total_sz += FD_CRDS_VALUE_ALIGN + sizeof(fd_crds_value_t)*crds_len;
21129 24 : for( ulong i=0; i < crds_len; i++ ) {
21130 12 : err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
21131 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21132 12 : }
21133 12 : }
21134 12 : return 0;
21135 12 : }
21136 0 : int fd_gossip_pull_resp_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21137 0 : *total_sz += sizeof(fd_gossip_pull_resp_t);
21138 0 : void const * start_data = ctx->data;
21139 0 : int err = fd_gossip_pull_resp_decode_footprint_inner( ctx, total_sz );
21140 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21141 0 : ctx->data = start_data;
21142 0 : return err;
21143 0 : }
21144 12 : static void fd_gossip_pull_resp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21145 12 : fd_gossip_pull_resp_t * self = (fd_gossip_pull_resp_t *)struct_mem;
21146 12 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
21147 12 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
21148 12 : if( self->crds_len ) {
21149 12 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CRDS_VALUE_ALIGN );
21150 12 : self->crds = *alloc_mem;
21151 12 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_crds_value_t)*self->crds_len;
21152 24 : for( ulong i=0; i < self->crds_len; i++ ) {
21153 12 : fd_crds_value_new( self->crds + i );
21154 12 : fd_crds_value_decode_inner( self->crds + i, alloc_mem, ctx );
21155 12 : }
21156 12 : } else
21157 0 : self->crds = NULL;
21158 12 : }
21159 0 : void * fd_gossip_pull_resp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21160 0 : fd_gossip_pull_resp_t * self = (fd_gossip_pull_resp_t *)mem;
21161 0 : fd_gossip_pull_resp_new( self );
21162 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_pull_resp_t);
21163 0 : void * * alloc_mem = &alloc_region;
21164 0 : fd_gossip_pull_resp_decode_inner( mem, alloc_mem, ctx );
21165 0 : return self;
21166 0 : }
21167 0 : void fd_gossip_pull_resp_new(fd_gossip_pull_resp_t * self) {
21168 0 : fd_memset( self, 0, sizeof(fd_gossip_pull_resp_t) );
21169 0 : fd_pubkey_new( &self->pubkey );
21170 0 : }
21171 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, uint varint ) {
21172 12 : (void) varint;
21173 12 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_pull_resp", level++, 0 );
21174 12 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
21175 12 : if( self->crds_len ) {
21176 12 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
21177 24 : for( ulong i=0; i < self->crds_len; i++ )
21178 12 : fd_crds_value_walk(w, self->crds + i, fun, "crds_value", level, 0 );
21179 12 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
21180 12 : }
21181 12 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_pull_resp", level--, 0 );
21182 12 : }
21183 0 : ulong fd_gossip_pull_resp_size( fd_gossip_pull_resp_t const * self ) {
21184 0 : ulong size = 0;
21185 0 : size += fd_pubkey_size( &self->pubkey );
21186 0 : do {
21187 0 : size += sizeof(ulong);
21188 0 : for( ulong i=0; i < self->crds_len; i++ )
21189 0 : size += fd_crds_value_size( self->crds + i );
21190 0 : } while(0);
21191 0 : return size;
21192 0 : }
21193 :
21194 0 : int fd_gossip_push_msg_encode( fd_gossip_push_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21195 0 : int err;
21196 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
21197 0 : if( FD_UNLIKELY( err ) ) return err;
21198 0 : err = fd_bincode_uint64_encode( self->crds_len, ctx );
21199 0 : if( FD_UNLIKELY(err) ) return err;
21200 0 : if( self->crds_len ) {
21201 0 : for( ulong i=0; i < self->crds_len; i++ ) {
21202 0 : err = fd_crds_value_encode( self->crds + i, ctx );
21203 0 : if( FD_UNLIKELY( err ) ) return err;
21204 0 : }
21205 0 : }
21206 0 : return FD_BINCODE_SUCCESS;
21207 0 : }
21208 6 : static int fd_gossip_push_msg_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21209 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21210 6 : int err = 0;
21211 6 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
21212 6 : if( FD_UNLIKELY( err ) ) return err;
21213 6 : ulong crds_len;
21214 6 : err = fd_bincode_uint64_decode( &crds_len, ctx );
21215 6 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21216 6 : if( crds_len ) {
21217 6 : *total_sz += FD_CRDS_VALUE_ALIGN + sizeof(fd_crds_value_t)*crds_len;
21218 21 : for( ulong i=0; i < crds_len; i++ ) {
21219 15 : err = fd_crds_value_decode_footprint_inner( ctx, total_sz );
21220 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21221 15 : }
21222 6 : }
21223 6 : return 0;
21224 6 : }
21225 0 : int fd_gossip_push_msg_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21226 0 : *total_sz += sizeof(fd_gossip_push_msg_t);
21227 0 : void const * start_data = ctx->data;
21228 0 : int err = fd_gossip_push_msg_decode_footprint_inner( ctx, total_sz );
21229 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21230 0 : ctx->data = start_data;
21231 0 : return err;
21232 0 : }
21233 6 : static void fd_gossip_push_msg_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21234 6 : fd_gossip_push_msg_t * self = (fd_gossip_push_msg_t *)struct_mem;
21235 6 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
21236 6 : fd_bincode_uint64_decode_unsafe( &self->crds_len, ctx );
21237 6 : if( self->crds_len ) {
21238 6 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CRDS_VALUE_ALIGN );
21239 6 : self->crds = *alloc_mem;
21240 6 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_crds_value_t)*self->crds_len;
21241 21 : for( ulong i=0; i < self->crds_len; i++ ) {
21242 15 : fd_crds_value_new( self->crds + i );
21243 15 : fd_crds_value_decode_inner( self->crds + i, alloc_mem, ctx );
21244 15 : }
21245 6 : } else
21246 0 : self->crds = NULL;
21247 6 : }
21248 0 : void * fd_gossip_push_msg_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21249 0 : fd_gossip_push_msg_t * self = (fd_gossip_push_msg_t *)mem;
21250 0 : fd_gossip_push_msg_new( self );
21251 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_push_msg_t);
21252 0 : void * * alloc_mem = &alloc_region;
21253 0 : fd_gossip_push_msg_decode_inner( mem, alloc_mem, ctx );
21254 0 : return self;
21255 0 : }
21256 0 : void fd_gossip_push_msg_new(fd_gossip_push_msg_t * self) {
21257 0 : fd_memset( self, 0, sizeof(fd_gossip_push_msg_t) );
21258 0 : fd_pubkey_new( &self->pubkey );
21259 0 : }
21260 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, uint varint ) {
21261 6 : (void) varint;
21262 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_push_msg", level++, 0 );
21263 6 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
21264 6 : if( self->crds_len ) {
21265 6 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
21266 21 : for( ulong i=0; i < self->crds_len; i++ )
21267 15 : fd_crds_value_walk(w, self->crds + i, fun, "crds_value", level, 0 );
21268 6 : fun( w, NULL, "crds", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
21269 6 : }
21270 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_push_msg", level--, 0 );
21271 6 : }
21272 0 : ulong fd_gossip_push_msg_size( fd_gossip_push_msg_t const * self ) {
21273 0 : ulong size = 0;
21274 0 : size += fd_pubkey_size( &self->pubkey );
21275 0 : do {
21276 0 : size += sizeof(ulong);
21277 0 : for( ulong i=0; i < self->crds_len; i++ )
21278 0 : size += fd_crds_value_size( self->crds + i );
21279 0 : } while(0);
21280 0 : return size;
21281 0 : }
21282 :
21283 0 : int fd_gossip_prune_msg_encode( fd_gossip_prune_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21284 0 : int err;
21285 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
21286 0 : if( FD_UNLIKELY( err ) ) return err;
21287 0 : err = fd_gossip_prune_data_encode( &self->data, ctx );
21288 0 : if( FD_UNLIKELY( err ) ) return err;
21289 0 : return FD_BINCODE_SUCCESS;
21290 0 : }
21291 0 : static int fd_gossip_prune_msg_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21292 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21293 0 : int err = 0;
21294 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
21295 0 : if( FD_UNLIKELY( err ) ) return err;
21296 0 : err = fd_gossip_prune_data_decode_footprint_inner( ctx, total_sz );
21297 0 : if( FD_UNLIKELY( err ) ) return err;
21298 0 : return 0;
21299 0 : }
21300 0 : int fd_gossip_prune_msg_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21301 0 : *total_sz += sizeof(fd_gossip_prune_msg_t);
21302 0 : void const * start_data = ctx->data;
21303 0 : int err = fd_gossip_prune_msg_decode_footprint_inner( ctx, total_sz );
21304 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21305 0 : ctx->data = start_data;
21306 0 : return err;
21307 0 : }
21308 0 : static void fd_gossip_prune_msg_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21309 0 : fd_gossip_prune_msg_t * self = (fd_gossip_prune_msg_t *)struct_mem;
21310 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
21311 0 : fd_gossip_prune_data_decode_inner( &self->data, alloc_mem, ctx );
21312 0 : }
21313 0 : void * fd_gossip_prune_msg_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21314 0 : fd_gossip_prune_msg_t * self = (fd_gossip_prune_msg_t *)mem;
21315 0 : fd_gossip_prune_msg_new( self );
21316 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_prune_msg_t);
21317 0 : void * * alloc_mem = &alloc_region;
21318 0 : fd_gossip_prune_msg_decode_inner( mem, alloc_mem, ctx );
21319 0 : return self;
21320 0 : }
21321 0 : void fd_gossip_prune_msg_new(fd_gossip_prune_msg_t * self) {
21322 0 : fd_memset( self, 0, sizeof(fd_gossip_prune_msg_t) );
21323 0 : fd_pubkey_new( &self->pubkey );
21324 0 : fd_gossip_prune_data_new( &self->data );
21325 0 : }
21326 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, uint varint ) {
21327 0 : (void) varint;
21328 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_prune_msg", level++, 0 );
21329 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
21330 0 : fd_gossip_prune_data_walk( w, &self->data, fun, "data", level, 0 );
21331 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_prune_msg", level--, 0 );
21332 0 : }
21333 0 : ulong fd_gossip_prune_msg_size( fd_gossip_prune_msg_t const * self ) {
21334 0 : ulong size = 0;
21335 0 : size += fd_pubkey_size( &self->pubkey );
21336 0 : size += fd_gossip_prune_data_size( &self->data );
21337 0 : return size;
21338 0 : }
21339 :
21340 0 : FD_FN_PURE uchar fd_gossip_msg_is_pull_req(fd_gossip_msg_t const * self) {
21341 0 : return self->discriminant == 0;
21342 0 : }
21343 0 : FD_FN_PURE uchar fd_gossip_msg_is_pull_resp(fd_gossip_msg_t const * self) {
21344 0 : return self->discriminant == 1;
21345 0 : }
21346 0 : FD_FN_PURE uchar fd_gossip_msg_is_push_msg(fd_gossip_msg_t const * self) {
21347 0 : return self->discriminant == 2;
21348 0 : }
21349 0 : FD_FN_PURE uchar fd_gossip_msg_is_prune_msg(fd_gossip_msg_t const * self) {
21350 0 : return self->discriminant == 3;
21351 0 : }
21352 0 : FD_FN_PURE uchar fd_gossip_msg_is_ping(fd_gossip_msg_t const * self) {
21353 0 : return self->discriminant == 4;
21354 0 : }
21355 0 : FD_FN_PURE uchar fd_gossip_msg_is_pong(fd_gossip_msg_t const * self) {
21356 0 : return self->discriminant == 5;
21357 0 : }
21358 : void fd_gossip_msg_inner_new( fd_gossip_msg_inner_t * self, uint discriminant );
21359 21 : int fd_gossip_msg_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21360 21 : int err;
21361 21 : switch (discriminant) {
21362 3 : case 0: {
21363 3 : err = fd_gossip_pull_req_decode_footprint_inner( ctx, total_sz );
21364 3 : if( FD_UNLIKELY( err ) ) return err;
21365 3 : return FD_BINCODE_SUCCESS;
21366 3 : }
21367 12 : case 1: {
21368 12 : err = fd_gossip_pull_resp_decode_footprint_inner( ctx, total_sz );
21369 12 : if( FD_UNLIKELY( err ) ) return err;
21370 12 : return FD_BINCODE_SUCCESS;
21371 12 : }
21372 6 : case 2: {
21373 6 : err = fd_gossip_push_msg_decode_footprint_inner( ctx, total_sz );
21374 6 : if( FD_UNLIKELY( err ) ) return err;
21375 6 : return FD_BINCODE_SUCCESS;
21376 6 : }
21377 0 : case 3: {
21378 0 : err = fd_gossip_prune_msg_decode_footprint_inner( ctx, total_sz );
21379 0 : if( FD_UNLIKELY( err ) ) return err;
21380 0 : return FD_BINCODE_SUCCESS;
21381 0 : }
21382 0 : case 4: {
21383 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
21384 0 : if( FD_UNLIKELY( err ) ) return err;
21385 0 : return FD_BINCODE_SUCCESS;
21386 0 : }
21387 0 : case 5: {
21388 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
21389 0 : if( FD_UNLIKELY( err ) ) return err;
21390 0 : return FD_BINCODE_SUCCESS;
21391 0 : }
21392 0 : default: return FD_BINCODE_ERR_ENCODING;
21393 21 : }
21394 21 : }
21395 21 : static int fd_gossip_msg_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21396 21 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21397 21 : uint discriminant = 0;
21398 21 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
21399 21 : if( FD_UNLIKELY( err ) ) return err;
21400 21 : return fd_gossip_msg_inner_decode_footprint( discriminant, ctx, total_sz );
21401 21 : }
21402 21 : int fd_gossip_msg_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21403 21 : *total_sz += sizeof(fd_gossip_msg_t);
21404 21 : void const * start_data = ctx->data;
21405 21 : int err = fd_gossip_msg_decode_footprint_inner( ctx, total_sz );
21406 21 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21407 21 : ctx->data = start_data;
21408 21 : return err;
21409 21 : }
21410 21 : static void fd_gossip_msg_inner_decode_inner( fd_gossip_msg_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21411 21 : switch (discriminant) {
21412 3 : case 0: {
21413 3 : fd_gossip_pull_req_decode_inner( &self->pull_req, alloc_mem, ctx );
21414 3 : break;
21415 0 : }
21416 12 : case 1: {
21417 12 : fd_gossip_pull_resp_decode_inner( &self->pull_resp, alloc_mem, ctx );
21418 12 : break;
21419 0 : }
21420 6 : case 2: {
21421 6 : fd_gossip_push_msg_decode_inner( &self->push_msg, alloc_mem, ctx );
21422 6 : break;
21423 0 : }
21424 0 : case 3: {
21425 0 : fd_gossip_prune_msg_decode_inner( &self->prune_msg, alloc_mem, ctx );
21426 0 : break;
21427 0 : }
21428 0 : case 4: {
21429 0 : fd_gossip_ping_decode_inner( &self->ping, alloc_mem, ctx );
21430 0 : break;
21431 0 : }
21432 0 : case 5: {
21433 0 : fd_gossip_ping_decode_inner( &self->pong, alloc_mem, ctx );
21434 0 : break;
21435 0 : }
21436 21 : }
21437 21 : }
21438 21 : static void fd_gossip_msg_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21439 21 : fd_gossip_msg_t * self = (fd_gossip_msg_t *)struct_mem;
21440 21 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21441 21 : fd_gossip_msg_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
21442 21 : }
21443 21 : void * fd_gossip_msg_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21444 21 : fd_gossip_msg_t * self = (fd_gossip_msg_t *)mem;
21445 21 : fd_gossip_msg_new( self );
21446 21 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_msg_t);
21447 21 : void * * alloc_mem = &alloc_region;
21448 21 : fd_gossip_msg_decode_inner( mem, alloc_mem, ctx );
21449 21 : return self;
21450 21 : }
21451 21 : void fd_gossip_msg_inner_new( fd_gossip_msg_inner_t * self, uint discriminant ) {
21452 21 : switch( discriminant ) {
21453 0 : case 0: {
21454 0 : fd_gossip_pull_req_new( &self->pull_req );
21455 0 : break;
21456 0 : }
21457 0 : case 1: {
21458 0 : fd_gossip_pull_resp_new( &self->pull_resp );
21459 0 : break;
21460 0 : }
21461 0 : case 2: {
21462 0 : fd_gossip_push_msg_new( &self->push_msg );
21463 0 : break;
21464 0 : }
21465 0 : case 3: {
21466 0 : fd_gossip_prune_msg_new( &self->prune_msg );
21467 0 : break;
21468 0 : }
21469 0 : case 4: {
21470 0 : fd_gossip_ping_new( &self->ping );
21471 0 : break;
21472 0 : }
21473 0 : case 5: {
21474 0 : fd_gossip_ping_new( &self->pong );
21475 0 : break;
21476 0 : }
21477 21 : default: break; // FD_LOG_ERR(( "unhandled type"));
21478 21 : }
21479 21 : }
21480 21 : void fd_gossip_msg_new_disc( fd_gossip_msg_t * self, uint discriminant ) {
21481 21 : self->discriminant = discriminant;
21482 21 : fd_gossip_msg_inner_new( &self->inner, self->discriminant );
21483 21 : }
21484 21 : void fd_gossip_msg_new( fd_gossip_msg_t * self ) {
21485 21 : fd_memset( self, 0, sizeof(fd_gossip_msg_t) );
21486 21 : fd_gossip_msg_new_disc( self, UINT_MAX );
21487 21 : }
21488 :
21489 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, uint varint ) {
21490 21 : (void) varint;
21491 21 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_gossip_msg", level++, 0);
21492 21 : switch( self->discriminant ) {
21493 3 : case 0: {
21494 3 : fun( w, self, "pull_req", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21495 3 : fd_gossip_pull_req_walk( w, &self->inner.pull_req, fun, "pull_req", level, 0 );
21496 3 : break;
21497 0 : }
21498 12 : case 1: {
21499 12 : fun( w, self, "pull_resp", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21500 12 : fd_gossip_pull_resp_walk( w, &self->inner.pull_resp, fun, "pull_resp", level, 0 );
21501 12 : break;
21502 0 : }
21503 6 : case 2: {
21504 6 : fun( w, self, "push_msg", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21505 6 : fd_gossip_push_msg_walk( w, &self->inner.push_msg, fun, "push_msg", level, 0 );
21506 6 : break;
21507 0 : }
21508 0 : case 3: {
21509 0 : fun( w, self, "prune_msg", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21510 0 : fd_gossip_prune_msg_walk( w, &self->inner.prune_msg, fun, "prune_msg", level, 0 );
21511 0 : break;
21512 0 : }
21513 0 : case 4: {
21514 0 : fun( w, self, "ping", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21515 0 : fd_gossip_ping_walk( w, &self->inner.ping, fun, "ping", level, 0 );
21516 0 : break;
21517 0 : }
21518 0 : case 5: {
21519 0 : fun( w, self, "pong", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21520 0 : fd_gossip_ping_walk( w, &self->inner.pong, fun, "pong", level, 0 );
21521 0 : break;
21522 0 : }
21523 21 : }
21524 21 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_gossip_msg", level--, 0 );
21525 21 : }
21526 0 : ulong fd_gossip_msg_size( fd_gossip_msg_t const * self ) {
21527 0 : ulong size = 0;
21528 0 : size += sizeof(uint);
21529 0 : switch (self->discriminant) {
21530 0 : case 0: {
21531 0 : size += fd_gossip_pull_req_size( &self->inner.pull_req );
21532 0 : break;
21533 0 : }
21534 0 : case 1: {
21535 0 : size += fd_gossip_pull_resp_size( &self->inner.pull_resp );
21536 0 : break;
21537 0 : }
21538 0 : case 2: {
21539 0 : size += fd_gossip_push_msg_size( &self->inner.push_msg );
21540 0 : break;
21541 0 : }
21542 0 : case 3: {
21543 0 : size += fd_gossip_prune_msg_size( &self->inner.prune_msg );
21544 0 : break;
21545 0 : }
21546 0 : case 4: {
21547 0 : size += fd_gossip_ping_size( &self->inner.ping );
21548 0 : break;
21549 0 : }
21550 0 : case 5: {
21551 0 : size += fd_gossip_ping_size( &self->inner.pong );
21552 0 : break;
21553 0 : }
21554 0 : }
21555 0 : return size;
21556 0 : }
21557 :
21558 0 : int fd_gossip_msg_inner_encode( fd_gossip_msg_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
21559 0 : int err;
21560 0 : switch (discriminant) {
21561 0 : case 0: {
21562 0 : err = fd_gossip_pull_req_encode( &self->pull_req, ctx );
21563 0 : if( FD_UNLIKELY( err ) ) return err;
21564 0 : break;
21565 0 : }
21566 0 : case 1: {
21567 0 : err = fd_gossip_pull_resp_encode( &self->pull_resp, ctx );
21568 0 : if( FD_UNLIKELY( err ) ) return err;
21569 0 : break;
21570 0 : }
21571 0 : case 2: {
21572 0 : err = fd_gossip_push_msg_encode( &self->push_msg, ctx );
21573 0 : if( FD_UNLIKELY( err ) ) return err;
21574 0 : break;
21575 0 : }
21576 0 : case 3: {
21577 0 : err = fd_gossip_prune_msg_encode( &self->prune_msg, ctx );
21578 0 : if( FD_UNLIKELY( err ) ) return err;
21579 0 : break;
21580 0 : }
21581 0 : case 4: {
21582 0 : err = fd_gossip_ping_encode( &self->ping, ctx );
21583 0 : if( FD_UNLIKELY( err ) ) return err;
21584 0 : break;
21585 0 : }
21586 0 : case 5: {
21587 0 : err = fd_gossip_ping_encode( &self->pong, ctx );
21588 0 : if( FD_UNLIKELY( err ) ) return err;
21589 0 : break;
21590 0 : }
21591 0 : }
21592 0 : return FD_BINCODE_SUCCESS;
21593 0 : }
21594 0 : int fd_gossip_msg_encode( fd_gossip_msg_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21595 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21596 0 : if( FD_UNLIKELY( err ) ) return err;
21597 0 : return fd_gossip_msg_inner_encode( &self->inner, self->discriminant, ctx );
21598 0 : }
21599 :
21600 0 : int fd_addrlut_create_encode( fd_addrlut_create_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21601 0 : int err;
21602 0 : err = fd_bincode_uint64_encode( self->recent_slot, ctx );
21603 0 : if( FD_UNLIKELY( err ) ) return err;
21604 0 : err = fd_bincode_uint8_encode( (uchar)(self->bump_seed), ctx );
21605 0 : if( FD_UNLIKELY( err ) ) return err;
21606 0 : return FD_BINCODE_SUCCESS;
21607 0 : }
21608 0 : static inline int fd_addrlut_create_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21609 0 : if( (ulong)ctx->data + 9UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21610 0 : ctx->data = (void *)( (ulong)ctx->data + 9UL );
21611 0 : return 0;
21612 0 : }
21613 0 : static void fd_addrlut_create_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21614 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)struct_mem;
21615 0 : fd_bincode_uint64_decode_unsafe( &self->recent_slot, ctx );
21616 0 : fd_bincode_uint8_decode_unsafe( &self->bump_seed, ctx );
21617 0 : }
21618 0 : void * fd_addrlut_create_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21619 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)mem;
21620 0 : fd_addrlut_create_new( self );
21621 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_create_t);
21622 0 : void * * alloc_mem = &alloc_region;
21623 0 : fd_addrlut_create_decode_inner( mem, alloc_mem, ctx );
21624 0 : return self;
21625 0 : }
21626 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, uint varint ) {
21627 0 : (void) varint;
21628 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_create", level++, 0 );
21629 0 : fun( w, &self->recent_slot, "recent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21630 0 : fun( w, &self->bump_seed, "bump_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
21631 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_create", level--, 0 );
21632 0 : }
21633 0 : int fd_addrlut_extend_encode( fd_addrlut_extend_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21634 0 : int err;
21635 0 : err = fd_bincode_uint64_encode( self->new_addrs_len, ctx );
21636 0 : if( FD_UNLIKELY(err) ) return err;
21637 0 : if( self->new_addrs_len ) {
21638 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
21639 0 : err = fd_pubkey_encode( self->new_addrs + i, ctx );
21640 0 : if( FD_UNLIKELY( err ) ) return err;
21641 0 : }
21642 0 : }
21643 0 : return FD_BINCODE_SUCCESS;
21644 0 : }
21645 0 : static int fd_addrlut_extend_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21646 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21647 0 : int err = 0;
21648 0 : ulong new_addrs_len;
21649 0 : err = fd_bincode_uint64_decode( &new_addrs_len, ctx );
21650 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21651 0 : if( new_addrs_len ) {
21652 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*new_addrs_len;
21653 0 : for( ulong i=0; i < new_addrs_len; i++ ) {
21654 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
21655 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
21656 0 : }
21657 0 : }
21658 0 : return 0;
21659 0 : }
21660 0 : int fd_addrlut_extend_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21661 0 : *total_sz += sizeof(fd_addrlut_extend_t);
21662 0 : void const * start_data = ctx->data;
21663 0 : int err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
21664 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21665 0 : ctx->data = start_data;
21666 0 : return err;
21667 0 : }
21668 0 : static void fd_addrlut_extend_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21669 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)struct_mem;
21670 0 : fd_bincode_uint64_decode_unsafe( &self->new_addrs_len, ctx );
21671 0 : if( self->new_addrs_len ) {
21672 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
21673 0 : self->new_addrs = *alloc_mem;
21674 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->new_addrs_len;
21675 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
21676 0 : fd_pubkey_new( self->new_addrs + i );
21677 0 : fd_pubkey_decode_inner( self->new_addrs + i, alloc_mem, ctx );
21678 0 : }
21679 0 : } else
21680 0 : self->new_addrs = NULL;
21681 0 : }
21682 0 : void * fd_addrlut_extend_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21683 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)mem;
21684 0 : fd_addrlut_extend_new( self );
21685 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_extend_t);
21686 0 : void * * alloc_mem = &alloc_region;
21687 0 : fd_addrlut_extend_decode_inner( mem, alloc_mem, ctx );
21688 0 : return self;
21689 0 : }
21690 0 : void fd_addrlut_extend_new(fd_addrlut_extend_t * self) {
21691 0 : fd_memset( self, 0, sizeof(fd_addrlut_extend_t) );
21692 0 : }
21693 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, uint varint ) {
21694 0 : (void) varint;
21695 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_extend", level++, 0 );
21696 0 : if( self->new_addrs_len ) {
21697 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
21698 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
21699 0 : fd_pubkey_walk(w, self->new_addrs + i, fun, "pubkey", level, 0 );
21700 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
21701 0 : }
21702 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_extend", level--, 0 );
21703 0 : }
21704 0 : ulong fd_addrlut_extend_size( fd_addrlut_extend_t const * self ) {
21705 0 : ulong size = 0;
21706 0 : do {
21707 0 : size += sizeof(ulong);
21708 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
21709 0 : size += fd_pubkey_size( self->new_addrs + i );
21710 0 : } while(0);
21711 0 : return size;
21712 0 : }
21713 :
21714 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_create_lut(fd_addrlut_instruction_t const * self) {
21715 0 : return self->discriminant == 0;
21716 0 : }
21717 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_freeze_lut(fd_addrlut_instruction_t const * self) {
21718 0 : return self->discriminant == 1;
21719 0 : }
21720 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_extend_lut(fd_addrlut_instruction_t const * self) {
21721 0 : return self->discriminant == 2;
21722 0 : }
21723 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_deactivate_lut(fd_addrlut_instruction_t const * self) {
21724 0 : return self->discriminant == 3;
21725 0 : }
21726 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_close_lut(fd_addrlut_instruction_t const * self) {
21727 0 : return self->discriminant == 4;
21728 0 : }
21729 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant );
21730 0 : int fd_addrlut_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21731 0 : int err;
21732 0 : switch (discriminant) {
21733 0 : case 0: {
21734 0 : err = fd_addrlut_create_decode_footprint_inner( ctx, total_sz );
21735 0 : if( FD_UNLIKELY( err ) ) return err;
21736 0 : return FD_BINCODE_SUCCESS;
21737 0 : }
21738 0 : case 1: {
21739 0 : return FD_BINCODE_SUCCESS;
21740 0 : }
21741 0 : case 2: {
21742 0 : err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
21743 0 : if( FD_UNLIKELY( err ) ) return err;
21744 0 : return FD_BINCODE_SUCCESS;
21745 0 : }
21746 0 : case 3: {
21747 0 : return FD_BINCODE_SUCCESS;
21748 0 : }
21749 0 : case 4: {
21750 0 : return FD_BINCODE_SUCCESS;
21751 0 : }
21752 0 : default: return FD_BINCODE_ERR_ENCODING;
21753 0 : }
21754 0 : }
21755 0 : static int fd_addrlut_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21756 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21757 0 : uint discriminant = 0;
21758 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
21759 0 : if( FD_UNLIKELY( err ) ) return err;
21760 0 : return fd_addrlut_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
21761 0 : }
21762 0 : int fd_addrlut_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21763 0 : *total_sz += sizeof(fd_addrlut_instruction_t);
21764 0 : void const * start_data = ctx->data;
21765 0 : int err = fd_addrlut_instruction_decode_footprint_inner( ctx, total_sz );
21766 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21767 0 : ctx->data = start_data;
21768 0 : return err;
21769 0 : }
21770 0 : static void fd_addrlut_instruction_inner_decode_inner( fd_addrlut_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
21771 0 : switch (discriminant) {
21772 0 : case 0: {
21773 0 : fd_addrlut_create_decode_inner( &self->create_lut, alloc_mem, ctx );
21774 0 : break;
21775 0 : }
21776 0 : case 1: {
21777 0 : break;
21778 0 : }
21779 0 : case 2: {
21780 0 : fd_addrlut_extend_decode_inner( &self->extend_lut, alloc_mem, ctx );
21781 0 : break;
21782 0 : }
21783 0 : case 3: {
21784 0 : break;
21785 0 : }
21786 0 : case 4: {
21787 0 : break;
21788 0 : }
21789 0 : }
21790 0 : }
21791 0 : static void fd_addrlut_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21792 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)struct_mem;
21793 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
21794 0 : fd_addrlut_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
21795 0 : }
21796 0 : void * fd_addrlut_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21797 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)mem;
21798 0 : fd_addrlut_instruction_new( self );
21799 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_instruction_t);
21800 0 : void * * alloc_mem = &alloc_region;
21801 0 : fd_addrlut_instruction_decode_inner( mem, alloc_mem, ctx );
21802 0 : return self;
21803 0 : }
21804 0 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant ) {
21805 0 : switch( discriminant ) {
21806 0 : case 0: {
21807 0 : fd_addrlut_create_new( &self->create_lut );
21808 0 : break;
21809 0 : }
21810 0 : case 1: {
21811 0 : break;
21812 0 : }
21813 0 : case 2: {
21814 0 : fd_addrlut_extend_new( &self->extend_lut );
21815 0 : break;
21816 0 : }
21817 0 : case 3: {
21818 0 : break;
21819 0 : }
21820 0 : case 4: {
21821 0 : break;
21822 0 : }
21823 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
21824 0 : }
21825 0 : }
21826 0 : void fd_addrlut_instruction_new_disc( fd_addrlut_instruction_t * self, uint discriminant ) {
21827 0 : self->discriminant = discriminant;
21828 0 : fd_addrlut_instruction_inner_new( &self->inner, self->discriminant );
21829 0 : }
21830 0 : void fd_addrlut_instruction_new( fd_addrlut_instruction_t * self ) {
21831 0 : fd_memset( self, 0, sizeof(fd_addrlut_instruction_t) );
21832 0 : fd_addrlut_instruction_new_disc( self, UINT_MAX );
21833 0 : }
21834 :
21835 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, uint varint ) {
21836 0 : (void) varint;
21837 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_addrlut_instruction", level++, 0);
21838 0 : switch( self->discriminant ) {
21839 0 : case 0: {
21840 0 : fun( w, self, "create_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21841 0 : fd_addrlut_create_walk( w, &self->inner.create_lut, fun, "create_lut", level, 0 );
21842 0 : break;
21843 0 : }
21844 0 : case 1: {
21845 0 : fun( w, self, "freeze_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21846 0 : break;
21847 0 : }
21848 0 : case 2: {
21849 0 : fun( w, self, "extend_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21850 0 : fd_addrlut_extend_walk( w, &self->inner.extend_lut, fun, "extend_lut", level, 0 );
21851 0 : break;
21852 0 : }
21853 0 : case 3: {
21854 0 : fun( w, self, "deactivate_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21855 0 : break;
21856 0 : }
21857 0 : case 4: {
21858 0 : fun( w, self, "close_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
21859 0 : break;
21860 0 : }
21861 0 : }
21862 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_addrlut_instruction", level--, 0 );
21863 0 : }
21864 0 : ulong fd_addrlut_instruction_size( fd_addrlut_instruction_t const * self ) {
21865 0 : ulong size = 0;
21866 0 : size += sizeof(uint);
21867 0 : switch (self->discriminant) {
21868 0 : case 0: {
21869 0 : size += fd_addrlut_create_size( &self->inner.create_lut );
21870 0 : break;
21871 0 : }
21872 0 : case 2: {
21873 0 : size += fd_addrlut_extend_size( &self->inner.extend_lut );
21874 0 : break;
21875 0 : }
21876 0 : }
21877 0 : return size;
21878 0 : }
21879 :
21880 0 : int fd_addrlut_instruction_inner_encode( fd_addrlut_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
21881 0 : int err;
21882 0 : switch (discriminant) {
21883 0 : case 0: {
21884 0 : err = fd_addrlut_create_encode( &self->create_lut, ctx );
21885 0 : if( FD_UNLIKELY( err ) ) return err;
21886 0 : break;
21887 0 : }
21888 0 : case 2: {
21889 0 : err = fd_addrlut_extend_encode( &self->extend_lut, ctx );
21890 0 : if( FD_UNLIKELY( err ) ) return err;
21891 0 : break;
21892 0 : }
21893 0 : }
21894 0 : return FD_BINCODE_SUCCESS;
21895 0 : }
21896 0 : int fd_addrlut_instruction_encode( fd_addrlut_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21897 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
21898 0 : if( FD_UNLIKELY( err ) ) return err;
21899 0 : return fd_addrlut_instruction_inner_encode( &self->inner, self->discriminant, ctx );
21900 0 : }
21901 :
21902 0 : int fd_repair_request_header_encode( fd_repair_request_header_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21903 0 : int err;
21904 0 : err = fd_signature_encode( &self->signature, ctx );
21905 0 : if( FD_UNLIKELY( err ) ) return err;
21906 0 : err = fd_pubkey_encode( &self->sender, ctx );
21907 0 : if( FD_UNLIKELY( err ) ) return err;
21908 0 : err = fd_pubkey_encode( &self->recipient, ctx );
21909 0 : if( FD_UNLIKELY( err ) ) return err;
21910 0 : err = fd_bincode_uint64_encode( self->timestamp, ctx );
21911 0 : if( FD_UNLIKELY( err ) ) return err;
21912 0 : err = fd_bincode_uint32_encode( self->nonce, ctx );
21913 0 : if( FD_UNLIKELY( err ) ) return err;
21914 0 : return FD_BINCODE_SUCCESS;
21915 0 : }
21916 0 : static inline int fd_repair_request_header_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21917 0 : if( (ulong)ctx->data + 140UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21918 0 : ctx->data = (void *)( (ulong)ctx->data + 140UL );
21919 0 : return 0;
21920 0 : }
21921 6 : static void fd_repair_request_header_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21922 6 : fd_repair_request_header_t * self = (fd_repair_request_header_t *)struct_mem;
21923 6 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
21924 6 : fd_pubkey_decode_inner( &self->sender, alloc_mem, ctx );
21925 6 : fd_pubkey_decode_inner( &self->recipient, alloc_mem, ctx );
21926 6 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
21927 6 : fd_bincode_uint32_decode_unsafe( &self->nonce, ctx );
21928 6 : }
21929 0 : void * fd_repair_request_header_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21930 0 : fd_repair_request_header_t * self = (fd_repair_request_header_t *)mem;
21931 0 : fd_repair_request_header_new( self );
21932 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_request_header_t);
21933 0 : void * * alloc_mem = &alloc_region;
21934 0 : fd_repair_request_header_decode_inner( mem, alloc_mem, ctx );
21935 0 : return self;
21936 0 : }
21937 6 : 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, uint varint ) {
21938 6 : (void) varint;
21939 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_request_header", level++, 0 );
21940 6 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
21941 6 : fd_pubkey_walk( w, &self->sender, fun, "sender", level, 0 );
21942 6 : fd_pubkey_walk( w, &self->recipient, fun, "recipient", level, 0 );
21943 6 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21944 6 : fun( w, &self->nonce, "nonce", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
21945 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_request_header", level--, 0 );
21946 6 : }
21947 0 : int fd_repair_window_index_encode( fd_repair_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21948 0 : int err;
21949 0 : err = fd_repair_request_header_encode( &self->header, ctx );
21950 0 : if( FD_UNLIKELY( err ) ) return err;
21951 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
21952 0 : if( FD_UNLIKELY( err ) ) return err;
21953 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
21954 0 : if( FD_UNLIKELY( err ) ) return err;
21955 0 : return FD_BINCODE_SUCCESS;
21956 0 : }
21957 3 : static inline int fd_repair_window_index_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21958 3 : if( (ulong)ctx->data + 156UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21959 3 : ctx->data = (void *)( (ulong)ctx->data + 156UL );
21960 3 : return 0;
21961 3 : }
21962 3 : static void fd_repair_window_index_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
21963 3 : fd_repair_window_index_t * self = (fd_repair_window_index_t *)struct_mem;
21964 3 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
21965 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
21966 3 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
21967 3 : }
21968 0 : void * fd_repair_window_index_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
21969 0 : fd_repair_window_index_t * self = (fd_repair_window_index_t *)mem;
21970 0 : fd_repair_window_index_new( self );
21971 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_window_index_t);
21972 0 : void * * alloc_mem = &alloc_region;
21973 0 : fd_repair_window_index_decode_inner( mem, alloc_mem, ctx );
21974 0 : return self;
21975 0 : }
21976 3 : 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, uint varint ) {
21977 3 : (void) varint;
21978 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_window_index", level++, 0 );
21979 3 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
21980 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21981 3 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
21982 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_window_index", level--, 0 );
21983 3 : }
21984 0 : int fd_repair_highest_window_index_encode( fd_repair_highest_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
21985 0 : int err;
21986 0 : err = fd_repair_request_header_encode( &self->header, ctx );
21987 0 : if( FD_UNLIKELY( err ) ) return err;
21988 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
21989 0 : if( FD_UNLIKELY( err ) ) return err;
21990 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
21991 0 : if( FD_UNLIKELY( err ) ) return err;
21992 0 : return FD_BINCODE_SUCCESS;
21993 0 : }
21994 3 : static inline int fd_repair_highest_window_index_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
21995 3 : if( (ulong)ctx->data + 156UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
21996 3 : ctx->data = (void *)( (ulong)ctx->data + 156UL );
21997 3 : return 0;
21998 3 : }
21999 3 : static void fd_repair_highest_window_index_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22000 3 : fd_repair_highest_window_index_t * self = (fd_repair_highest_window_index_t *)struct_mem;
22001 3 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
22002 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
22003 3 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
22004 3 : }
22005 0 : void * fd_repair_highest_window_index_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22006 0 : fd_repair_highest_window_index_t * self = (fd_repair_highest_window_index_t *)mem;
22007 0 : fd_repair_highest_window_index_new( self );
22008 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_highest_window_index_t);
22009 0 : void * * alloc_mem = &alloc_region;
22010 0 : fd_repair_highest_window_index_decode_inner( mem, alloc_mem, ctx );
22011 0 : return self;
22012 0 : }
22013 3 : 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, uint varint ) {
22014 3 : (void) varint;
22015 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_highest_window_index", level++, 0 );
22016 3 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
22017 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
22018 3 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
22019 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_highest_window_index", level--, 0 );
22020 3 : }
22021 0 : int fd_repair_orphan_encode( fd_repair_orphan_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22022 0 : int err;
22023 0 : err = fd_repair_request_header_encode( &self->header, ctx );
22024 0 : if( FD_UNLIKELY( err ) ) return err;
22025 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
22026 0 : if( FD_UNLIKELY( err ) ) return err;
22027 0 : return FD_BINCODE_SUCCESS;
22028 0 : }
22029 0 : static inline int fd_repair_orphan_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22030 0 : if( (ulong)ctx->data + 148UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22031 0 : ctx->data = (void *)( (ulong)ctx->data + 148UL );
22032 0 : return 0;
22033 0 : }
22034 0 : static void fd_repair_orphan_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22035 0 : fd_repair_orphan_t * self = (fd_repair_orphan_t *)struct_mem;
22036 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
22037 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
22038 0 : }
22039 0 : void * fd_repair_orphan_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22040 0 : fd_repair_orphan_t * self = (fd_repair_orphan_t *)mem;
22041 0 : fd_repair_orphan_new( self );
22042 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_orphan_t);
22043 0 : void * * alloc_mem = &alloc_region;
22044 0 : fd_repair_orphan_decode_inner( mem, alloc_mem, ctx );
22045 0 : return self;
22046 0 : }
22047 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, uint varint ) {
22048 0 : (void) varint;
22049 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_orphan", level++, 0 );
22050 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
22051 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
22052 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_orphan", level--, 0 );
22053 0 : }
22054 0 : int fd_repair_ancestor_hashes_encode( fd_repair_ancestor_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22055 0 : int err;
22056 0 : err = fd_repair_request_header_encode( &self->header, ctx );
22057 0 : if( FD_UNLIKELY( err ) ) return err;
22058 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
22059 0 : if( FD_UNLIKELY( err ) ) return err;
22060 0 : return FD_BINCODE_SUCCESS;
22061 0 : }
22062 0 : static inline int fd_repair_ancestor_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22063 0 : if( (ulong)ctx->data + 148UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22064 0 : ctx->data = (void *)( (ulong)ctx->data + 148UL );
22065 0 : return 0;
22066 0 : }
22067 0 : static void fd_repair_ancestor_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22068 0 : fd_repair_ancestor_hashes_t * self = (fd_repair_ancestor_hashes_t *)struct_mem;
22069 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
22070 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
22071 0 : }
22072 0 : void * fd_repair_ancestor_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22073 0 : fd_repair_ancestor_hashes_t * self = (fd_repair_ancestor_hashes_t *)mem;
22074 0 : fd_repair_ancestor_hashes_new( self );
22075 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_ancestor_hashes_t);
22076 0 : void * * alloc_mem = &alloc_region;
22077 0 : fd_repair_ancestor_hashes_decode_inner( mem, alloc_mem, ctx );
22078 0 : return self;
22079 0 : }
22080 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, uint varint ) {
22081 0 : (void) varint;
22082 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_ancestor_hashes", level++, 0 );
22083 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
22084 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
22085 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_ancestor_hashes", level--, 0 );
22086 0 : }
22087 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndex(fd_repair_protocol_t const * self) {
22088 0 : return self->discriminant == 0;
22089 0 : }
22090 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndex(fd_repair_protocol_t const * self) {
22091 0 : return self->discriminant == 1;
22092 0 : }
22093 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphan(fd_repair_protocol_t const * self) {
22094 0 : return self->discriminant == 2;
22095 0 : }
22096 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndexWithNonce(fd_repair_protocol_t const * self) {
22097 0 : return self->discriminant == 3;
22098 0 : }
22099 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndexWithNonce(fd_repair_protocol_t const * self) {
22100 0 : return self->discriminant == 4;
22101 0 : }
22102 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphanWithNonce(fd_repair_protocol_t const * self) {
22103 0 : return self->discriminant == 5;
22104 0 : }
22105 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyAncestorHashes(fd_repair_protocol_t const * self) {
22106 0 : return self->discriminant == 6;
22107 0 : }
22108 0 : FD_FN_PURE uchar fd_repair_protocol_is_pong(fd_repair_protocol_t const * self) {
22109 0 : return self->discriminant == 7;
22110 0 : }
22111 0 : FD_FN_PURE uchar fd_repair_protocol_is_window_index(fd_repair_protocol_t const * self) {
22112 0 : return self->discriminant == 8;
22113 0 : }
22114 0 : FD_FN_PURE uchar fd_repair_protocol_is_highest_window_index(fd_repair_protocol_t const * self) {
22115 0 : return self->discriminant == 9;
22116 0 : }
22117 0 : FD_FN_PURE uchar fd_repair_protocol_is_orphan(fd_repair_protocol_t const * self) {
22118 0 : return self->discriminant == 10;
22119 0 : }
22120 0 : FD_FN_PURE uchar fd_repair_protocol_is_ancestor_hashes(fd_repair_protocol_t const * self) {
22121 0 : return self->discriminant == 11;
22122 0 : }
22123 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant );
22124 9 : int fd_repair_protocol_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22125 9 : int err;
22126 9 : switch (discriminant) {
22127 0 : case 0: {
22128 0 : return FD_BINCODE_SUCCESS;
22129 0 : }
22130 0 : case 1: {
22131 0 : return FD_BINCODE_SUCCESS;
22132 0 : }
22133 0 : case 2: {
22134 0 : return FD_BINCODE_SUCCESS;
22135 0 : }
22136 0 : case 3: {
22137 0 : return FD_BINCODE_SUCCESS;
22138 0 : }
22139 0 : case 4: {
22140 0 : return FD_BINCODE_SUCCESS;
22141 0 : }
22142 0 : case 5: {
22143 0 : return FD_BINCODE_SUCCESS;
22144 0 : }
22145 0 : case 6: {
22146 0 : return FD_BINCODE_SUCCESS;
22147 0 : }
22148 3 : case 7: {
22149 3 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
22150 3 : if( FD_UNLIKELY( err ) ) return err;
22151 3 : return FD_BINCODE_SUCCESS;
22152 3 : }
22153 3 : case 8: {
22154 3 : err = fd_repair_window_index_decode_footprint_inner( ctx, total_sz );
22155 3 : if( FD_UNLIKELY( err ) ) return err;
22156 3 : return FD_BINCODE_SUCCESS;
22157 3 : }
22158 3 : case 9: {
22159 3 : err = fd_repair_highest_window_index_decode_footprint_inner( ctx, total_sz );
22160 3 : if( FD_UNLIKELY( err ) ) return err;
22161 3 : return FD_BINCODE_SUCCESS;
22162 3 : }
22163 0 : case 10: {
22164 0 : err = fd_repair_orphan_decode_footprint_inner( ctx, total_sz );
22165 0 : if( FD_UNLIKELY( err ) ) return err;
22166 0 : return FD_BINCODE_SUCCESS;
22167 0 : }
22168 0 : case 11: {
22169 0 : err = fd_repair_ancestor_hashes_decode_footprint_inner( ctx, total_sz );
22170 0 : if( FD_UNLIKELY( err ) ) return err;
22171 0 : return FD_BINCODE_SUCCESS;
22172 0 : }
22173 0 : default: return FD_BINCODE_ERR_ENCODING;
22174 9 : }
22175 9 : }
22176 9 : static int fd_repair_protocol_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22177 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22178 9 : uint discriminant = 0;
22179 9 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
22180 9 : if( FD_UNLIKELY( err ) ) return err;
22181 9 : return fd_repair_protocol_inner_decode_footprint( discriminant, ctx, total_sz );
22182 9 : }
22183 9 : int fd_repair_protocol_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22184 9 : *total_sz += sizeof(fd_repair_protocol_t);
22185 9 : void const * start_data = ctx->data;
22186 9 : int err = fd_repair_protocol_decode_footprint_inner( ctx, total_sz );
22187 9 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22188 9 : ctx->data = start_data;
22189 9 : return err;
22190 9 : }
22191 9 : static void fd_repair_protocol_inner_decode_inner( fd_repair_protocol_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22192 9 : switch (discriminant) {
22193 0 : case 0: {
22194 0 : break;
22195 0 : }
22196 0 : case 1: {
22197 0 : break;
22198 0 : }
22199 0 : case 2: {
22200 0 : break;
22201 0 : }
22202 0 : case 3: {
22203 0 : break;
22204 0 : }
22205 0 : case 4: {
22206 0 : break;
22207 0 : }
22208 0 : case 5: {
22209 0 : break;
22210 0 : }
22211 0 : case 6: {
22212 0 : break;
22213 0 : }
22214 3 : case 7: {
22215 3 : fd_gossip_ping_decode_inner( &self->pong, alloc_mem, ctx );
22216 3 : break;
22217 0 : }
22218 3 : case 8: {
22219 3 : fd_repair_window_index_decode_inner( &self->window_index, alloc_mem, ctx );
22220 3 : break;
22221 0 : }
22222 3 : case 9: {
22223 3 : fd_repair_highest_window_index_decode_inner( &self->highest_window_index, alloc_mem, ctx );
22224 3 : break;
22225 0 : }
22226 0 : case 10: {
22227 0 : fd_repair_orphan_decode_inner( &self->orphan, alloc_mem, ctx );
22228 0 : break;
22229 0 : }
22230 0 : case 11: {
22231 0 : fd_repair_ancestor_hashes_decode_inner( &self->ancestor_hashes, alloc_mem, ctx );
22232 0 : break;
22233 0 : }
22234 9 : }
22235 9 : }
22236 9 : static void fd_repair_protocol_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22237 9 : fd_repair_protocol_t * self = (fd_repair_protocol_t *)struct_mem;
22238 9 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
22239 9 : fd_repair_protocol_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
22240 9 : }
22241 9 : void * fd_repair_protocol_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22242 9 : fd_repair_protocol_t * self = (fd_repair_protocol_t *)mem;
22243 9 : fd_repair_protocol_new( self );
22244 9 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_protocol_t);
22245 9 : void * * alloc_mem = &alloc_region;
22246 9 : fd_repair_protocol_decode_inner( mem, alloc_mem, ctx );
22247 9 : return self;
22248 9 : }
22249 9 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant ) {
22250 9 : switch( discriminant ) {
22251 0 : case 0: {
22252 0 : break;
22253 0 : }
22254 0 : case 1: {
22255 0 : break;
22256 0 : }
22257 0 : case 2: {
22258 0 : break;
22259 0 : }
22260 0 : case 3: {
22261 0 : break;
22262 0 : }
22263 0 : case 4: {
22264 0 : break;
22265 0 : }
22266 0 : case 5: {
22267 0 : break;
22268 0 : }
22269 0 : case 6: {
22270 0 : break;
22271 0 : }
22272 0 : case 7: {
22273 0 : fd_gossip_ping_new( &self->pong );
22274 0 : break;
22275 0 : }
22276 0 : case 8: {
22277 0 : fd_repair_window_index_new( &self->window_index );
22278 0 : break;
22279 0 : }
22280 0 : case 9: {
22281 0 : fd_repair_highest_window_index_new( &self->highest_window_index );
22282 0 : break;
22283 0 : }
22284 0 : case 10: {
22285 0 : fd_repair_orphan_new( &self->orphan );
22286 0 : break;
22287 0 : }
22288 0 : case 11: {
22289 0 : fd_repair_ancestor_hashes_new( &self->ancestor_hashes );
22290 0 : break;
22291 0 : }
22292 9 : default: break; // FD_LOG_ERR(( "unhandled type"));
22293 9 : }
22294 9 : }
22295 9 : void fd_repair_protocol_new_disc( fd_repair_protocol_t * self, uint discriminant ) {
22296 9 : self->discriminant = discriminant;
22297 9 : fd_repair_protocol_inner_new( &self->inner, self->discriminant );
22298 9 : }
22299 9 : void fd_repair_protocol_new( fd_repair_protocol_t * self ) {
22300 9 : fd_memset( self, 0, sizeof(fd_repair_protocol_t) );
22301 9 : fd_repair_protocol_new_disc( self, UINT_MAX );
22302 9 : }
22303 :
22304 9 : void fd_repair_protocol_walk( void * w, fd_repair_protocol_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
22305 9 : (void) varint;
22306 9 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_protocol", level++, 0);
22307 9 : switch( self->discriminant ) {
22308 0 : case 0: {
22309 0 : fun( w, self, "LegacyWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22310 0 : break;
22311 0 : }
22312 0 : case 1: {
22313 0 : fun( w, self, "LegacyHighestWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22314 0 : break;
22315 0 : }
22316 0 : case 2: {
22317 0 : fun( w, self, "LegacyOrphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22318 0 : break;
22319 0 : }
22320 0 : case 3: {
22321 0 : fun( w, self, "LegacyWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22322 0 : break;
22323 0 : }
22324 0 : case 4: {
22325 0 : fun( w, self, "LegacyHighestWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22326 0 : break;
22327 0 : }
22328 0 : case 5: {
22329 0 : fun( w, self, "LegacyOrphanWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22330 0 : break;
22331 0 : }
22332 0 : case 6: {
22333 0 : fun( w, self, "LegacyAncestorHashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22334 0 : break;
22335 0 : }
22336 3 : case 7: {
22337 3 : fun( w, self, "pong", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22338 3 : fd_gossip_ping_walk( w, &self->inner.pong, fun, "pong", level, 0 );
22339 3 : break;
22340 0 : }
22341 3 : case 8: {
22342 3 : fun( w, self, "window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22343 3 : fd_repair_window_index_walk( w, &self->inner.window_index, fun, "window_index", level, 0 );
22344 3 : break;
22345 0 : }
22346 3 : case 9: {
22347 3 : fun( w, self, "highest_window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22348 3 : fd_repair_highest_window_index_walk( w, &self->inner.highest_window_index, fun, "highest_window_index", level, 0 );
22349 3 : break;
22350 0 : }
22351 0 : case 10: {
22352 0 : fun( w, self, "orphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22353 0 : fd_repair_orphan_walk( w, &self->inner.orphan, fun, "orphan", level, 0 );
22354 0 : break;
22355 0 : }
22356 0 : case 11: {
22357 0 : fun( w, self, "ancestor_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22358 0 : fd_repair_ancestor_hashes_walk( w, &self->inner.ancestor_hashes, fun, "ancestor_hashes", level, 0 );
22359 0 : break;
22360 0 : }
22361 9 : }
22362 9 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_protocol", level--, 0 );
22363 9 : }
22364 0 : ulong fd_repair_protocol_size( fd_repair_protocol_t const * self ) {
22365 0 : ulong size = 0;
22366 0 : size += sizeof(uint);
22367 0 : switch (self->discriminant) {
22368 0 : case 7: {
22369 0 : size += fd_gossip_ping_size( &self->inner.pong );
22370 0 : break;
22371 0 : }
22372 0 : case 8: {
22373 0 : size += fd_repair_window_index_size( &self->inner.window_index );
22374 0 : break;
22375 0 : }
22376 0 : case 9: {
22377 0 : size += fd_repair_highest_window_index_size( &self->inner.highest_window_index );
22378 0 : break;
22379 0 : }
22380 0 : case 10: {
22381 0 : size += fd_repair_orphan_size( &self->inner.orphan );
22382 0 : break;
22383 0 : }
22384 0 : case 11: {
22385 0 : size += fd_repair_ancestor_hashes_size( &self->inner.ancestor_hashes );
22386 0 : break;
22387 0 : }
22388 0 : }
22389 0 : return size;
22390 0 : }
22391 :
22392 0 : int fd_repair_protocol_inner_encode( fd_repair_protocol_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
22393 0 : int err;
22394 0 : switch (discriminant) {
22395 0 : case 7: {
22396 0 : err = fd_gossip_ping_encode( &self->pong, ctx );
22397 0 : if( FD_UNLIKELY( err ) ) return err;
22398 0 : break;
22399 0 : }
22400 0 : case 8: {
22401 0 : err = fd_repair_window_index_encode( &self->window_index, ctx );
22402 0 : if( FD_UNLIKELY( err ) ) return err;
22403 0 : break;
22404 0 : }
22405 0 : case 9: {
22406 0 : err = fd_repair_highest_window_index_encode( &self->highest_window_index, ctx );
22407 0 : if( FD_UNLIKELY( err ) ) return err;
22408 0 : break;
22409 0 : }
22410 0 : case 10: {
22411 0 : err = fd_repair_orphan_encode( &self->orphan, ctx );
22412 0 : if( FD_UNLIKELY( err ) ) return err;
22413 0 : break;
22414 0 : }
22415 0 : case 11: {
22416 0 : err = fd_repair_ancestor_hashes_encode( &self->ancestor_hashes, ctx );
22417 0 : if( FD_UNLIKELY( err ) ) return err;
22418 0 : break;
22419 0 : }
22420 0 : }
22421 0 : return FD_BINCODE_SUCCESS;
22422 0 : }
22423 0 : int fd_repair_protocol_encode( fd_repair_protocol_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22424 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
22425 0 : if( FD_UNLIKELY( err ) ) return err;
22426 0 : return fd_repair_protocol_inner_encode( &self->inner, self->discriminant, ctx );
22427 0 : }
22428 :
22429 0 : FD_FN_PURE uchar fd_repair_response_is_ping(fd_repair_response_t const * self) {
22430 0 : return self->discriminant == 0;
22431 0 : }
22432 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant );
22433 0 : int fd_repair_response_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22434 0 : int err;
22435 0 : switch (discriminant) {
22436 0 : case 0: {
22437 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
22438 0 : if( FD_UNLIKELY( err ) ) return err;
22439 0 : return FD_BINCODE_SUCCESS;
22440 0 : }
22441 0 : default: return FD_BINCODE_ERR_ENCODING;
22442 0 : }
22443 0 : }
22444 0 : static int fd_repair_response_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22445 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22446 0 : uint discriminant = 0;
22447 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
22448 0 : if( FD_UNLIKELY( err ) ) return err;
22449 0 : return fd_repair_response_inner_decode_footprint( discriminant, ctx, total_sz );
22450 0 : }
22451 0 : int fd_repair_response_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22452 0 : *total_sz += sizeof(fd_repair_response_t);
22453 0 : void const * start_data = ctx->data;
22454 0 : int err = fd_repair_response_decode_footprint_inner( ctx, total_sz );
22455 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22456 0 : ctx->data = start_data;
22457 0 : return err;
22458 0 : }
22459 0 : static void fd_repair_response_inner_decode_inner( fd_repair_response_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22460 0 : switch (discriminant) {
22461 0 : case 0: {
22462 0 : fd_gossip_ping_decode_inner( &self->ping, alloc_mem, ctx );
22463 0 : break;
22464 0 : }
22465 0 : }
22466 0 : }
22467 0 : static void fd_repair_response_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
22468 0 : fd_repair_response_t * self = (fd_repair_response_t *)struct_mem;
22469 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
22470 0 : fd_repair_response_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
22471 0 : }
22472 0 : void * fd_repair_response_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
22473 0 : fd_repair_response_t * self = (fd_repair_response_t *)mem;
22474 0 : fd_repair_response_new( self );
22475 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_response_t);
22476 0 : void * * alloc_mem = &alloc_region;
22477 0 : fd_repair_response_decode_inner( mem, alloc_mem, ctx );
22478 0 : return self;
22479 0 : }
22480 0 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant ) {
22481 0 : switch( discriminant ) {
22482 0 : case 0: {
22483 0 : fd_gossip_ping_new( &self->ping );
22484 0 : break;
22485 0 : }
22486 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
22487 0 : }
22488 0 : }
22489 0 : void fd_repair_response_new_disc( fd_repair_response_t * self, uint discriminant ) {
22490 0 : self->discriminant = discriminant;
22491 0 : fd_repair_response_inner_new( &self->inner, self->discriminant );
22492 0 : }
22493 0 : void fd_repair_response_new( fd_repair_response_t * self ) {
22494 0 : fd_memset( self, 0, sizeof(fd_repair_response_t) );
22495 0 : fd_repair_response_new_disc( self, UINT_MAX );
22496 0 : }
22497 :
22498 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, uint varint ) {
22499 0 : (void) varint;
22500 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_response", level++, 0);
22501 0 : switch( self->discriminant ) {
22502 0 : case 0: {
22503 0 : fun( w, self, "ping", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
22504 0 : fd_gossip_ping_walk( w, &self->inner.ping, fun, "ping", level, 0 );
22505 0 : break;
22506 0 : }
22507 0 : }
22508 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_response", level--, 0 );
22509 0 : }
22510 0 : ulong fd_repair_response_size( fd_repair_response_t const * self ) {
22511 0 : ulong size = 0;
22512 0 : size += sizeof(uint);
22513 0 : switch (self->discriminant) {
22514 0 : case 0: {
22515 0 : size += fd_gossip_ping_size( &self->inner.ping );
22516 0 : break;
22517 0 : }
22518 0 : }
22519 0 : return size;
22520 0 : }
22521 :
22522 0 : int fd_repair_response_inner_encode( fd_repair_response_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
22523 0 : int err;
22524 0 : switch (discriminant) {
22525 0 : case 0: {
22526 0 : err = fd_gossip_ping_encode( &self->ping, ctx );
22527 0 : if( FD_UNLIKELY( err ) ) return err;
22528 0 : break;
22529 0 : }
22530 0 : }
22531 0 : return FD_BINCODE_SUCCESS;
22532 0 : }
22533 0 : int fd_repair_response_encode( fd_repair_response_t const * self, fd_bincode_encode_ctx_t * ctx ) {
22534 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
22535 0 : if( FD_UNLIKELY( err ) ) return err;
22536 0 : return fd_repair_response_inner_encode( &self->inner, self->discriminant, ctx );
22537 0 : }
22538 :
22539 0 : FD_FN_PURE uchar fd_instr_error_enum_is_generic_error(fd_instr_error_enum_t const * self) {
22540 0 : return self->discriminant == 0;
22541 0 : }
22542 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_argument(fd_instr_error_enum_t const * self) {
22543 0 : return self->discriminant == 1;
22544 0 : }
22545 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_instruction_data(fd_instr_error_enum_t const * self) {
22546 0 : return self->discriminant == 2;
22547 0 : }
22548 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_data(fd_instr_error_enum_t const * self) {
22549 0 : return self->discriminant == 3;
22550 0 : }
22551 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_too_small(fd_instr_error_enum_t const * self) {
22552 0 : return self->discriminant == 4;
22553 0 : }
22554 0 : FD_FN_PURE uchar fd_instr_error_enum_is_insufficient_funds(fd_instr_error_enum_t const * self) {
22555 0 : return self->discriminant == 5;
22556 0 : }
22557 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_program_id(fd_instr_error_enum_t const * self) {
22558 0 : return self->discriminant == 6;
22559 0 : }
22560 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_required_signature(fd_instr_error_enum_t const * self) {
22561 0 : return self->discriminant == 7;
22562 0 : }
22563 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_already_initialized(fd_instr_error_enum_t const * self) {
22564 0 : return self->discriminant == 8;
22565 0 : }
22566 0 : FD_FN_PURE uchar fd_instr_error_enum_is_uninitialized_account(fd_instr_error_enum_t const * self) {
22567 0 : return self->discriminant == 9;
22568 0 : }
22569 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unbalanced_instruction(fd_instr_error_enum_t const * self) {
22570 0 : return self->discriminant == 10;
22571 0 : }
22572 0 : FD_FN_PURE uchar fd_instr_error_enum_is_modified_program_id(fd_instr_error_enum_t const * self) {
22573 0 : return self->discriminant == 11;
22574 0 : }
22575 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_lamport_spend(fd_instr_error_enum_t const * self) {
22576 0 : return self->discriminant == 12;
22577 0 : }
22578 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_data_modified(fd_instr_error_enum_t const * self) {
22579 0 : return self->discriminant == 13;
22580 0 : }
22581 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_lamport_change(fd_instr_error_enum_t const * self) {
22582 0 : return self->discriminant == 14;
22583 0 : }
22584 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_data_modified(fd_instr_error_enum_t const * self) {
22585 0 : return self->discriminant == 15;
22586 0 : }
22587 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_index(fd_instr_error_enum_t const * self) {
22588 0 : return self->discriminant == 16;
22589 0 : }
22590 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_modified(fd_instr_error_enum_t const * self) {
22591 0 : return self->discriminant == 17;
22592 0 : }
22593 0 : FD_FN_PURE uchar fd_instr_error_enum_is_rent_epoch_modified(fd_instr_error_enum_t const * self) {
22594 0 : return self->discriminant == 18;
22595 0 : }
22596 0 : FD_FN_PURE uchar fd_instr_error_enum_is_not_enough_account_keys(fd_instr_error_enum_t const * self) {
22597 0 : return self->discriminant == 19;
22598 0 : }
22599 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_size_changed(fd_instr_error_enum_t const * self) {
22600 0 : return self->discriminant == 20;
22601 0 : }
22602 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_executable(fd_instr_error_enum_t const * self) {
22603 0 : return self->discriminant == 21;
22604 0 : }
22605 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_failed(fd_instr_error_enum_t const * self) {
22606 0 : return self->discriminant == 22;
22607 0 : }
22608 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_outstanding(fd_instr_error_enum_t const * self) {
22609 0 : return self->discriminant == 23;
22610 0 : }
22611 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_out_of_sync(fd_instr_error_enum_t const * self) {
22612 0 : return self->discriminant == 24;
22613 0 : }
22614 0 : FD_FN_PURE uchar fd_instr_error_enum_is_custom(fd_instr_error_enum_t const * self) {
22615 0 : return self->discriminant == 25;
22616 0 : }
22617 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_error(fd_instr_error_enum_t const * self) {
22618 0 : return self->discriminant == 26;
22619 0 : }
22620 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_data_modified(fd_instr_error_enum_t const * self) {
22621 0 : return self->discriminant == 27;
22622 0 : }
22623 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_lamport_change(fd_instr_error_enum_t const * self) {
22624 0 : return self->discriminant == 28;
22625 0 : }
22626 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
22627 0 : return self->discriminant == 29;
22628 0 : }
22629 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_program_id(fd_instr_error_enum_t const * self) {
22630 0 : return self->discriminant == 30;
22631 0 : }
22632 0 : FD_FN_PURE uchar fd_instr_error_enum_is_call_depth(fd_instr_error_enum_t const * self) {
22633 0 : return self->discriminant == 31;
22634 0 : }
22635 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_account(fd_instr_error_enum_t const * self) {
22636 0 : return self->discriminant == 32;
22637 0 : }
22638 0 : FD_FN_PURE uchar fd_instr_error_enum_is_reentrancy_not_allowed(fd_instr_error_enum_t const * self) {
22639 0 : return self->discriminant == 33;
22640 0 : }
22641 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_seed_length_exceeded(fd_instr_error_enum_t const * self) {
22642 0 : return self->discriminant == 34;
22643 0 : }
22644 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_seeds(fd_instr_error_enum_t const * self) {
22645 0 : return self->discriminant == 35;
22646 0 : }
22647 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_realloc(fd_instr_error_enum_t const * self) {
22648 0 : return self->discriminant == 36;
22649 0 : }
22650 0 : FD_FN_PURE uchar fd_instr_error_enum_is_computational_budget_exceeded(fd_instr_error_enum_t const * self) {
22651 0 : return self->discriminant == 37;
22652 0 : }
22653 0 : FD_FN_PURE uchar fd_instr_error_enum_is_privilege_escalation(fd_instr_error_enum_t const * self) {
22654 0 : return self->discriminant == 38;
22655 0 : }
22656 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_environment_setup_failure(fd_instr_error_enum_t const * self) {
22657 0 : return self->discriminant == 39;
22658 0 : }
22659 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_complete(fd_instr_error_enum_t const * self) {
22660 0 : return self->discriminant == 40;
22661 0 : }
22662 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_compile(fd_instr_error_enum_t const * self) {
22663 0 : return self->discriminant == 41;
22664 0 : }
22665 0 : FD_FN_PURE uchar fd_instr_error_enum_is_immutable(fd_instr_error_enum_t const * self) {
22666 0 : return self->discriminant == 42;
22667 0 : }
22668 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_authority(fd_instr_error_enum_t const * self) {
22669 0 : return self->discriminant == 43;
22670 0 : }
22671 0 : FD_FN_PURE uchar fd_instr_error_enum_is_borsh_io_error(fd_instr_error_enum_t const * self) {
22672 0 : return self->discriminant == 44;
22673 0 : }
22674 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
22675 0 : return self->discriminant == 45;
22676 0 : }
22677 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_owner(fd_instr_error_enum_t const * self) {
22678 0 : return self->discriminant == 46;
22679 0 : }
22680 0 : FD_FN_PURE uchar fd_instr_error_enum_is_arithmetic_overflow(fd_instr_error_enum_t const * self) {
22681 0 : return self->discriminant == 47;
22682 0 : }
22683 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_sysvar(fd_instr_error_enum_t const * self) {
22684 0 : return self->discriminant == 48;
22685 0 : }
22686 0 : FD_FN_PURE uchar fd_instr_error_enum_is_illegal_owner(fd_instr_error_enum_t const * self) {
22687 0 : return self->discriminant == 49;
22688 0 : }
22689 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_data_allocations_exceeded(fd_instr_error_enum_t const * self) {
22690 0 : return self->discriminant == 50;
22691 0 : }
22692 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_exceeded(fd_instr_error_enum_t const * self) {
22693 0 : return self->discriminant == 51;
22694 0 : }
22695 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_instruction_trace_length_exceeded(fd_instr_error_enum_t const * self) {
22696 0 : return self->discriminant == 52;
22697 0 : }
22698 0 : FD_FN_PURE uchar fd_instr_error_enum_is_builtin_programs_must_consume_compute_units(fd_instr_error_enum_t const * self) {
22699 0 : return self->discriminant == 53;
22700 0 : }
22701 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant );
22702 0 : int fd_instr_error_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22703 0 : int err;
22704 0 : switch (discriminant) {
22705 0 : case 0: {
22706 0 : return FD_BINCODE_SUCCESS;
22707 0 : }
22708 0 : case 1: {
22709 0 : return FD_BINCODE_SUCCESS;
22710 0 : }
22711 0 : case 2: {
22712 0 : return FD_BINCODE_SUCCESS;
22713 0 : }
22714 0 : case 3: {
22715 0 : return FD_BINCODE_SUCCESS;
22716 0 : }
22717 0 : case 4: {
22718 0 : return FD_BINCODE_SUCCESS;
22719 0 : }
22720 0 : case 5: {
22721 0 : return FD_BINCODE_SUCCESS;
22722 0 : }
22723 0 : case 6: {
22724 0 : return FD_BINCODE_SUCCESS;
22725 0 : }
22726 0 : case 7: {
22727 0 : return FD_BINCODE_SUCCESS;
22728 0 : }
22729 0 : case 8: {
22730 0 : return FD_BINCODE_SUCCESS;
22731 0 : }
22732 0 : case 9: {
22733 0 : return FD_BINCODE_SUCCESS;
22734 0 : }
22735 0 : case 10: {
22736 0 : return FD_BINCODE_SUCCESS;
22737 0 : }
22738 0 : case 11: {
22739 0 : return FD_BINCODE_SUCCESS;
22740 0 : }
22741 0 : case 12: {
22742 0 : return FD_BINCODE_SUCCESS;
22743 0 : }
22744 0 : case 13: {
22745 0 : return FD_BINCODE_SUCCESS;
22746 0 : }
22747 0 : case 14: {
22748 0 : return FD_BINCODE_SUCCESS;
22749 0 : }
22750 0 : case 15: {
22751 0 : return FD_BINCODE_SUCCESS;
22752 0 : }
22753 0 : case 16: {
22754 0 : return FD_BINCODE_SUCCESS;
22755 0 : }
22756 0 : case 17: {
22757 0 : return FD_BINCODE_SUCCESS;
22758 0 : }
22759 0 : case 18: {
22760 0 : return FD_BINCODE_SUCCESS;
22761 0 : }
22762 0 : case 19: {
22763 0 : return FD_BINCODE_SUCCESS;
22764 0 : }
22765 0 : case 20: {
22766 0 : return FD_BINCODE_SUCCESS;
22767 0 : }
22768 0 : case 21: {
22769 0 : return FD_BINCODE_SUCCESS;
22770 0 : }
22771 0 : case 22: {
22772 0 : return FD_BINCODE_SUCCESS;
22773 0 : }
22774 0 : case 23: {
22775 0 : return FD_BINCODE_SUCCESS;
22776 0 : }
22777 0 : case 24: {
22778 0 : return FD_BINCODE_SUCCESS;
22779 0 : }
22780 0 : case 25: {
22781 0 : err = fd_bincode_uint32_decode_footprint( ctx );
22782 0 : if( FD_UNLIKELY( err ) ) return err;
22783 0 : return FD_BINCODE_SUCCESS;
22784 0 : }
22785 0 : case 26: {
22786 0 : return FD_BINCODE_SUCCESS;
22787 0 : }
22788 0 : case 27: {
22789 0 : return FD_BINCODE_SUCCESS;
22790 0 : }
22791 0 : case 28: {
22792 0 : return FD_BINCODE_SUCCESS;
22793 0 : }
22794 0 : case 29: {
22795 0 : return FD_BINCODE_SUCCESS;
22796 0 : }
22797 0 : case 30: {
22798 0 : return FD_BINCODE_SUCCESS;
22799 0 : }
22800 0 : case 31: {
22801 0 : return FD_BINCODE_SUCCESS;
22802 0 : }
22803 0 : case 32: {
22804 0 : return FD_BINCODE_SUCCESS;
22805 0 : }
22806 0 : case 33: {
22807 0 : return FD_BINCODE_SUCCESS;
22808 0 : }
22809 0 : case 34: {
22810 0 : return FD_BINCODE_SUCCESS;
22811 0 : }
22812 0 : case 35: {
22813 0 : return FD_BINCODE_SUCCESS;
22814 0 : }
22815 0 : case 36: {
22816 0 : return FD_BINCODE_SUCCESS;
22817 0 : }
22818 0 : case 37: {
22819 0 : return FD_BINCODE_SUCCESS;
22820 0 : }
22821 0 : case 38: {
22822 0 : return FD_BINCODE_SUCCESS;
22823 0 : }
22824 0 : case 39: {
22825 0 : return FD_BINCODE_SUCCESS;
22826 0 : }
22827 0 : case 40: {
22828 0 : return FD_BINCODE_SUCCESS;
22829 0 : }
22830 0 : case 41: {
22831 0 : return FD_BINCODE_SUCCESS;
22832 0 : }
22833 0 : case 42: {
22834 0 : return FD_BINCODE_SUCCESS;
22835 0 : }
22836 0 : case 43: {
22837 0 : return FD_BINCODE_SUCCESS;
22838 0 : }
22839 0 : case 44: {
22840 0 : ulong slen;
22841 0 : err = fd_bincode_uint64_decode( &slen, ctx );
22842 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22843 0 : err = fd_bincode_bytes_decode_footprint( slen, ctx );
22844 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
22845 0 : *total_sz += slen + 1; // Need an extra byte for null termination
22846 0 : return FD_BINCODE_SUCCESS;
22847 0 : }
22848 0 : case 45: {
22849 0 : return FD_BINCODE_SUCCESS;
22850 0 : }
22851 0 : case 46: {
22852 0 : return FD_BINCODE_SUCCESS;
22853 0 : }
22854 0 : case 47: {
22855 0 : return FD_BINCODE_SUCCESS;
22856 0 : }
22857 0 : case 48: {
22858 0 : return FD_BINCODE_SUCCESS;
22859 0 : }
22860 0 : case 49: {
22861 0 : return FD_BINCODE_SUCCESS;
22862 0 : }
22863 0 : case 50: {
22864 0 : return FD_BINCODE_SUCCESS;
22865 0 : }
22866 0 : case 51: {
22867 0 : return FD_BINCODE_SUCCESS;
22868 0 : }
22869 0 : case 52: {
22870 0 : return FD_BINCODE_SUCCESS;
22871 0 : }
22872 0 : case 53: {
22873 0 : return FD_BINCODE_SUCCESS;
22874 0 : }
22875 0 : default: return FD_BINCODE_ERR_ENCODING;
22876 0 : }
22877 0 : }
22878 0 : static int fd_instr_error_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22879 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22880 0 : uint discriminant = 0;
22881 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
22882 0 : if( FD_UNLIKELY( err ) ) return err;
22883 0 : return fd_instr_error_enum_inner_decode_footprint( discriminant, ctx, total_sz );
22884 0 : }
22885 0 : int fd_instr_error_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22886 0 : *total_sz += sizeof(fd_instr_error_enum_t);
22887 0 : void const * start_data = ctx->data;
22888 0 : int err = fd_instr_error_enum_decode_footprint_inner( ctx, total_sz );
22889 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
22890 0 : ctx->data = start_data;
22891 0 : return err;
22892 0 : }
22893 0 : static void fd_instr_error_enum_inner_decode_inner( fd_instr_error_enum_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
22894 0 : switch (discriminant) {
22895 0 : case 0: {
22896 0 : break;
22897 0 : }
22898 0 : case 1: {
22899 0 : break;
22900 0 : }
22901 0 : case 2: {
22902 0 : break;
22903 0 : }
22904 0 : case 3: {
22905 0 : break;
22906 0 : }
22907 0 : case 4: {
22908 0 : break;
22909 0 : }
22910 0 : case 5: {
22911 0 : break;
22912 0 : }
22913 0 : case 6: {
22914 0 : break;
22915 0 : }
22916 0 : case 7: {
22917 0 : break;
22918 0 : }
22919 0 : case 8: {
22920 0 : break;
22921 0 : }
22922 0 : case 9: {
22923 0 : break;
22924 0 : }
22925 0 : case 10: {
22926 0 : break;
22927 0 : }
22928 0 : case 11: {
22929 0 : break;
22930 0 : }
22931 0 : case 12: {
22932 0 : break;
22933 0 : }
22934 0 : case 13: {
22935 0 : break;
22936 0 : }
22937 0 : case 14: {
22938 0 : break;
22939 0 : }
22940 0 : case 15: {
22941 0 : break;
22942 0 : }
22943 0 : case 16: {
22944 0 : break;
22945 0 : }
22946 0 : case 17: {
22947 0 : break;
22948 0 : }
22949 0 : case 18: {
22950 0 : break;
22951 0 : }
22952 0 : case 19: {
22953 0 : break;
22954 0 : }
22955 0 : case 20: {
22956 0 : break;
22957 0 : }
22958 0 : case 21: {
22959 0 : break;
22960 0 : }
22961 0 : case 22: {
22962 0 : break;
22963 0 : }
22964 0 : case 23: {
22965 0 : break;
22966 0 : }
22967 0 : case 24: {
22968 0 : break;
22969 0 : }
22970 0 : case 25: {
22971 0 : fd_bincode_uint32_decode_unsafe( &self->custom, ctx );
22972 0 : break;
22973 0 : }
22974 0 : case 26: {
22975 0 : break;
22976 0 : }
22977 0 : case 27: {
22978 0 : break;
22979 0 : }
22980 0 : case 28: {
22981 0 : break;
22982 0 : }
22983 0 : case 29: {
22984 0 : break;
22985 0 : }
22986 0 : case 30: {
22987 0 : break;
22988 0 : }
22989 0 : case 31: {
22990 0 : break;
22991 0 : }
22992 0 : case 32: {
22993 0 : break;
22994 0 : }
22995 0 : case 33: {
22996 0 : break;
22997 0 : }
22998 0 : case 34: {
22999 0 : break;
23000 0 : }
23001 0 : case 35: {
23002 0 : break;
23003 0 : }
23004 0 : case 36: {
23005 0 : break;
23006 0 : }
23007 0 : case 37: {
23008 0 : break;
23009 0 : }
23010 0 : case 38: {
23011 0 : break;
23012 0 : }
23013 0 : case 39: {
23014 0 : break;
23015 0 : }
23016 0 : case 40: {
23017 0 : break;
23018 0 : }
23019 0 : case 41: {
23020 0 : break;
23021 0 : }
23022 0 : case 42: {
23023 0 : break;
23024 0 : }
23025 0 : case 43: {
23026 0 : break;
23027 0 : }
23028 0 : case 44: {
23029 0 : ulong slen;
23030 0 : fd_bincode_uint64_decode_unsafe( &slen, ctx );
23031 0 : self->borsh_io_error = *alloc_mem;
23032 0 : fd_bincode_bytes_decode_unsafe( (uchar *)self->borsh_io_error, slen, ctx );
23033 0 : self->borsh_io_error[slen] = '\0';
23034 0 : *alloc_mem = (uchar *)(*alloc_mem) + (slen + 1); // extra byte for null termination
23035 0 : break;
23036 0 : }
23037 0 : case 45: {
23038 0 : break;
23039 0 : }
23040 0 : case 46: {
23041 0 : break;
23042 0 : }
23043 0 : case 47: {
23044 0 : break;
23045 0 : }
23046 0 : case 48: {
23047 0 : break;
23048 0 : }
23049 0 : case 49: {
23050 0 : break;
23051 0 : }
23052 0 : case 50: {
23053 0 : break;
23054 0 : }
23055 0 : case 51: {
23056 0 : break;
23057 0 : }
23058 0 : case 52: {
23059 0 : break;
23060 0 : }
23061 0 : case 53: {
23062 0 : break;
23063 0 : }
23064 0 : }
23065 0 : }
23066 0 : static void fd_instr_error_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23067 0 : fd_instr_error_enum_t * self = (fd_instr_error_enum_t *)struct_mem;
23068 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
23069 0 : fd_instr_error_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
23070 0 : }
23071 0 : void * fd_instr_error_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23072 0 : fd_instr_error_enum_t * self = (fd_instr_error_enum_t *)mem;
23073 0 : fd_instr_error_enum_new( self );
23074 0 : void * alloc_region = (uchar *)mem + sizeof(fd_instr_error_enum_t);
23075 0 : void * * alloc_mem = &alloc_region;
23076 0 : fd_instr_error_enum_decode_inner( mem, alloc_mem, ctx );
23077 0 : return self;
23078 0 : }
23079 0 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant ) {
23080 0 : switch( discriminant ) {
23081 0 : case 0: {
23082 0 : break;
23083 0 : }
23084 0 : case 1: {
23085 0 : break;
23086 0 : }
23087 0 : case 2: {
23088 0 : break;
23089 0 : }
23090 0 : case 3: {
23091 0 : break;
23092 0 : }
23093 0 : case 4: {
23094 0 : break;
23095 0 : }
23096 0 : case 5: {
23097 0 : break;
23098 0 : }
23099 0 : case 6: {
23100 0 : break;
23101 0 : }
23102 0 : case 7: {
23103 0 : break;
23104 0 : }
23105 0 : case 8: {
23106 0 : break;
23107 0 : }
23108 0 : case 9: {
23109 0 : break;
23110 0 : }
23111 0 : case 10: {
23112 0 : break;
23113 0 : }
23114 0 : case 11: {
23115 0 : break;
23116 0 : }
23117 0 : case 12: {
23118 0 : break;
23119 0 : }
23120 0 : case 13: {
23121 0 : break;
23122 0 : }
23123 0 : case 14: {
23124 0 : break;
23125 0 : }
23126 0 : case 15: {
23127 0 : break;
23128 0 : }
23129 0 : case 16: {
23130 0 : break;
23131 0 : }
23132 0 : case 17: {
23133 0 : break;
23134 0 : }
23135 0 : case 18: {
23136 0 : break;
23137 0 : }
23138 0 : case 19: {
23139 0 : break;
23140 0 : }
23141 0 : case 20: {
23142 0 : break;
23143 0 : }
23144 0 : case 21: {
23145 0 : break;
23146 0 : }
23147 0 : case 22: {
23148 0 : break;
23149 0 : }
23150 0 : case 23: {
23151 0 : break;
23152 0 : }
23153 0 : case 24: {
23154 0 : break;
23155 0 : }
23156 0 : case 25: {
23157 0 : break;
23158 0 : }
23159 0 : case 26: {
23160 0 : break;
23161 0 : }
23162 0 : case 27: {
23163 0 : break;
23164 0 : }
23165 0 : case 28: {
23166 0 : break;
23167 0 : }
23168 0 : case 29: {
23169 0 : break;
23170 0 : }
23171 0 : case 30: {
23172 0 : break;
23173 0 : }
23174 0 : case 31: {
23175 0 : break;
23176 0 : }
23177 0 : case 32: {
23178 0 : break;
23179 0 : }
23180 0 : case 33: {
23181 0 : break;
23182 0 : }
23183 0 : case 34: {
23184 0 : break;
23185 0 : }
23186 0 : case 35: {
23187 0 : break;
23188 0 : }
23189 0 : case 36: {
23190 0 : break;
23191 0 : }
23192 0 : case 37: {
23193 0 : break;
23194 0 : }
23195 0 : case 38: {
23196 0 : break;
23197 0 : }
23198 0 : case 39: {
23199 0 : break;
23200 0 : }
23201 0 : case 40: {
23202 0 : break;
23203 0 : }
23204 0 : case 41: {
23205 0 : break;
23206 0 : }
23207 0 : case 42: {
23208 0 : break;
23209 0 : }
23210 0 : case 43: {
23211 0 : break;
23212 0 : }
23213 0 : case 44: {
23214 0 : break;
23215 0 : }
23216 0 : case 45: {
23217 0 : break;
23218 0 : }
23219 0 : case 46: {
23220 0 : break;
23221 0 : }
23222 0 : case 47: {
23223 0 : break;
23224 0 : }
23225 0 : case 48: {
23226 0 : break;
23227 0 : }
23228 0 : case 49: {
23229 0 : break;
23230 0 : }
23231 0 : case 50: {
23232 0 : break;
23233 0 : }
23234 0 : case 51: {
23235 0 : break;
23236 0 : }
23237 0 : case 52: {
23238 0 : break;
23239 0 : }
23240 0 : case 53: {
23241 0 : break;
23242 0 : }
23243 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
23244 0 : }
23245 0 : }
23246 0 : void fd_instr_error_enum_new_disc( fd_instr_error_enum_t * self, uint discriminant ) {
23247 0 : self->discriminant = discriminant;
23248 0 : fd_instr_error_enum_inner_new( &self->inner, self->discriminant );
23249 0 : }
23250 0 : void fd_instr_error_enum_new( fd_instr_error_enum_t * self ) {
23251 0 : fd_memset( self, 0, sizeof(fd_instr_error_enum_t) );
23252 0 : fd_instr_error_enum_new_disc( self, UINT_MAX );
23253 0 : }
23254 :
23255 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, uint varint ) {
23256 0 : (void) varint;
23257 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_instr_error_enum", level++, 0);
23258 0 : switch( self->discriminant ) {
23259 0 : case 0: {
23260 0 : fun( w, self, "generic_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23261 0 : break;
23262 0 : }
23263 0 : case 1: {
23264 0 : fun( w, self, "invalid_argument", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23265 0 : break;
23266 0 : }
23267 0 : case 2: {
23268 0 : fun( w, self, "invalid_instruction_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23269 0 : break;
23270 0 : }
23271 0 : case 3: {
23272 0 : fun( w, self, "invalid_account_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23273 0 : break;
23274 0 : }
23275 0 : case 4: {
23276 0 : fun( w, self, "account_data_too_small", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23277 0 : break;
23278 0 : }
23279 0 : case 5: {
23280 0 : fun( w, self, "insufficient_funds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23281 0 : break;
23282 0 : }
23283 0 : case 6: {
23284 0 : fun( w, self, "incorrect_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23285 0 : break;
23286 0 : }
23287 0 : case 7: {
23288 0 : fun( w, self, "missing_required_signature", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23289 0 : break;
23290 0 : }
23291 0 : case 8: {
23292 0 : fun( w, self, "account_already_initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23293 0 : break;
23294 0 : }
23295 0 : case 9: {
23296 0 : fun( w, self, "uninitialized_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23297 0 : break;
23298 0 : }
23299 0 : case 10: {
23300 0 : fun( w, self, "unbalanced_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23301 0 : break;
23302 0 : }
23303 0 : case 11: {
23304 0 : fun( w, self, "modified_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23305 0 : break;
23306 0 : }
23307 0 : case 12: {
23308 0 : fun( w, self, "external_account_lamport_spend", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23309 0 : break;
23310 0 : }
23311 0 : case 13: {
23312 0 : fun( w, self, "external_account_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23313 0 : break;
23314 0 : }
23315 0 : case 14: {
23316 0 : fun( w, self, "readonly_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23317 0 : break;
23318 0 : }
23319 0 : case 15: {
23320 0 : fun( w, self, "readonly_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23321 0 : break;
23322 0 : }
23323 0 : case 16: {
23324 0 : fun( w, self, "duplicate_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23325 0 : break;
23326 0 : }
23327 0 : case 17: {
23328 0 : fun( w, self, "executable_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23329 0 : break;
23330 0 : }
23331 0 : case 18: {
23332 0 : fun( w, self, "rent_epoch_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23333 0 : break;
23334 0 : }
23335 0 : case 19: {
23336 0 : fun( w, self, "not_enough_account_keys", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23337 0 : break;
23338 0 : }
23339 0 : case 20: {
23340 0 : fun( w, self, "account_data_size_changed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23341 0 : break;
23342 0 : }
23343 0 : case 21: {
23344 0 : fun( w, self, "account_not_executable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23345 0 : break;
23346 0 : }
23347 0 : case 22: {
23348 0 : fun( w, self, "account_borrow_failed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23349 0 : break;
23350 0 : }
23351 0 : case 23: {
23352 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23353 0 : break;
23354 0 : }
23355 0 : case 24: {
23356 0 : fun( w, self, "duplicate_account_out_of_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23357 0 : break;
23358 0 : }
23359 0 : case 25: {
23360 0 : fun( w, self, "custom", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23361 0 : fun( w, &self->inner.custom, "custom", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
23362 0 : break;
23363 0 : }
23364 0 : case 26: {
23365 0 : fun( w, self, "invalid_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23366 0 : break;
23367 0 : }
23368 0 : case 27: {
23369 0 : fun( w, self, "executable_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23370 0 : break;
23371 0 : }
23372 0 : case 28: {
23373 0 : fun( w, self, "executable_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23374 0 : break;
23375 0 : }
23376 0 : case 29: {
23377 0 : fun( w, self, "executable_account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23378 0 : break;
23379 0 : }
23380 0 : case 30: {
23381 0 : fun( w, self, "unsupported_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23382 0 : break;
23383 0 : }
23384 0 : case 31: {
23385 0 : fun( w, self, "call_depth", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23386 0 : break;
23387 0 : }
23388 0 : case 32: {
23389 0 : fun( w, self, "missing_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23390 0 : break;
23391 0 : }
23392 0 : case 33: {
23393 0 : fun( w, self, "reentrancy_not_allowed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23394 0 : break;
23395 0 : }
23396 0 : case 34: {
23397 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23398 0 : break;
23399 0 : }
23400 0 : case 35: {
23401 0 : fun( w, self, "invalid_seeds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23402 0 : break;
23403 0 : }
23404 0 : case 36: {
23405 0 : fun( w, self, "invalid_realloc", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23406 0 : break;
23407 0 : }
23408 0 : case 37: {
23409 0 : fun( w, self, "computational_budget_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23410 0 : break;
23411 0 : }
23412 0 : case 38: {
23413 0 : fun( w, self, "privilege_escalation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23414 0 : break;
23415 0 : }
23416 0 : case 39: {
23417 0 : fun( w, self, "program_environment_setup_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23418 0 : break;
23419 0 : }
23420 0 : case 40: {
23421 0 : fun( w, self, "program_failed_to_complete", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23422 0 : break;
23423 0 : }
23424 0 : case 41: {
23425 0 : fun( w, self, "program_failed_to_compile", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23426 0 : break;
23427 0 : }
23428 0 : case 42: {
23429 0 : fun( w, self, "immutable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23430 0 : break;
23431 0 : }
23432 0 : case 43: {
23433 0 : fun( w, self, "incorrect_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23434 0 : break;
23435 0 : }
23436 0 : case 44: {
23437 0 : fun( w, self, "borsh_io_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23438 0 : fun( w, self->inner.borsh_io_error, "borsh_io_error", FD_FLAMENCO_TYPE_CSTR, "char*", level, 0 );
23439 0 : break;
23440 0 : }
23441 0 : case 45: {
23442 0 : fun( w, self, "account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23443 0 : break;
23444 0 : }
23445 0 : case 46: {
23446 0 : fun( w, self, "invalid_account_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23447 0 : break;
23448 0 : }
23449 0 : case 47: {
23450 0 : fun( w, self, "arithmetic_overflow", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23451 0 : break;
23452 0 : }
23453 0 : case 48: {
23454 0 : fun( w, self, "unsupported_sysvar", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23455 0 : break;
23456 0 : }
23457 0 : case 49: {
23458 0 : fun( w, self, "illegal_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23459 0 : break;
23460 0 : }
23461 0 : case 50: {
23462 0 : fun( w, self, "max_accounts_data_allocations_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23463 0 : break;
23464 0 : }
23465 0 : case 51: {
23466 0 : fun( w, self, "max_accounts_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23467 0 : break;
23468 0 : }
23469 0 : case 52: {
23470 0 : fun( w, self, "max_instruction_trace_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23471 0 : break;
23472 0 : }
23473 0 : case 53: {
23474 0 : fun( w, self, "builtin_programs_must_consume_compute_units", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
23475 0 : break;
23476 0 : }
23477 0 : }
23478 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_instr_error_enum", level--, 0 );
23479 0 : }
23480 0 : ulong fd_instr_error_enum_size( fd_instr_error_enum_t const * self ) {
23481 0 : ulong size = 0;
23482 0 : size += sizeof(uint);
23483 0 : switch (self->discriminant) {
23484 0 : case 25: {
23485 0 : size += sizeof(uint);
23486 0 : break;
23487 0 : }
23488 0 : case 44: {
23489 0 : size += sizeof(ulong) + strlen(self->inner.borsh_io_error);
23490 0 : break;
23491 0 : }
23492 0 : }
23493 0 : return size;
23494 0 : }
23495 :
23496 0 : int fd_instr_error_enum_inner_encode( fd_instr_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
23497 0 : int err;
23498 0 : switch (discriminant) {
23499 0 : case 25: {
23500 0 : err = fd_bincode_uint32_encode( self->custom, ctx );
23501 0 : if( FD_UNLIKELY( err ) ) return err;
23502 0 : break;
23503 0 : }
23504 0 : case 44: {
23505 0 : ulong slen = strlen( (char *) self->borsh_io_error );
23506 0 : err = fd_bincode_uint64_encode( slen, ctx );
23507 0 : if( FD_UNLIKELY( err ) ) return err;
23508 0 : err = fd_bincode_bytes_encode( (uchar *) self->borsh_io_error, slen, ctx );
23509 0 : if( FD_UNLIKELY( err ) ) return err;
23510 0 : break;
23511 0 : }
23512 0 : }
23513 0 : return FD_BINCODE_SUCCESS;
23514 0 : }
23515 0 : int fd_instr_error_enum_encode( fd_instr_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23516 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
23517 0 : if( FD_UNLIKELY( err ) ) return err;
23518 0 : return fd_instr_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
23519 0 : }
23520 :
23521 0 : int fd_txn_instr_error_encode( fd_txn_instr_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
23522 0 : int err;
23523 0 : err = fd_bincode_uint8_encode( (uchar)(self->instr_idx), ctx );
23524 0 : if( FD_UNLIKELY( err ) ) return err;
23525 0 : err = fd_instr_error_enum_encode( &self->error, ctx );
23526 0 : if( FD_UNLIKELY( err ) ) return err;
23527 0 : return FD_BINCODE_SUCCESS;
23528 0 : }
23529 0 : static int fd_txn_instr_error_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23530 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23531 0 : int err = 0;
23532 0 : err = fd_bincode_uint8_decode_footprint( ctx );
23533 0 : if( FD_UNLIKELY( err ) ) return err;
23534 0 : err = fd_instr_error_enum_decode_footprint_inner( ctx, total_sz );
23535 0 : if( FD_UNLIKELY( err ) ) return err;
23536 0 : return 0;
23537 0 : }
23538 0 : int fd_txn_instr_error_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23539 0 : *total_sz += sizeof(fd_txn_instr_error_t);
23540 0 : void const * start_data = ctx->data;
23541 0 : int err = fd_txn_instr_error_decode_footprint_inner( ctx, total_sz );
23542 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23543 0 : ctx->data = start_data;
23544 0 : return err;
23545 0 : }
23546 0 : static void fd_txn_instr_error_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23547 0 : fd_txn_instr_error_t * self = (fd_txn_instr_error_t *)struct_mem;
23548 0 : fd_bincode_uint8_decode_unsafe( &self->instr_idx, ctx );
23549 0 : fd_instr_error_enum_decode_inner( &self->error, alloc_mem, ctx );
23550 0 : }
23551 0 : void * fd_txn_instr_error_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23552 0 : fd_txn_instr_error_t * self = (fd_txn_instr_error_t *)mem;
23553 0 : fd_txn_instr_error_new( self );
23554 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_instr_error_t);
23555 0 : void * * alloc_mem = &alloc_region;
23556 0 : fd_txn_instr_error_decode_inner( mem, alloc_mem, ctx );
23557 0 : return self;
23558 0 : }
23559 0 : void fd_txn_instr_error_new(fd_txn_instr_error_t * self) {
23560 0 : fd_memset( self, 0, sizeof(fd_txn_instr_error_t) );
23561 0 : fd_instr_error_enum_new( &self->error );
23562 0 : }
23563 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, uint varint ) {
23564 0 : (void) varint;
23565 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_txn_instr_error", level++, 0 );
23566 0 : fun( w, &self->instr_idx, "instr_idx", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
23567 0 : fd_instr_error_enum_walk( w, &self->error, fun, "error", level, 0 );
23568 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_txn_instr_error", level--, 0 );
23569 0 : }
23570 0 : ulong fd_txn_instr_error_size( fd_txn_instr_error_t const * self ) {
23571 0 : ulong size = 0;
23572 0 : size += sizeof(char);
23573 0 : size += fd_instr_error_enum_size( &self->error );
23574 0 : return size;
23575 0 : }
23576 :
23577 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_in_use(fd_txn_error_enum_t const * self) {
23578 0 : return self->discriminant == 0;
23579 0 : }
23580 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_loaded_twice(fd_txn_error_enum_t const * self) {
23581 0 : return self->discriminant == 1;
23582 0 : }
23583 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_not_found(fd_txn_error_enum_t const * self) {
23584 0 : return self->discriminant == 2;
23585 0 : }
23586 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_account_not_found(fd_txn_error_enum_t const * self) {
23587 0 : return self->discriminant == 3;
23588 0 : }
23589 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_fee(fd_txn_error_enum_t const * self) {
23590 0 : return self->discriminant == 4;
23591 0 : }
23592 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_for_fee(fd_txn_error_enum_t const * self) {
23593 0 : return self->discriminant == 5;
23594 0 : }
23595 0 : FD_FN_PURE uchar fd_txn_error_enum_is_already_processed(fd_txn_error_enum_t const * self) {
23596 0 : return self->discriminant == 6;
23597 0 : }
23598 0 : FD_FN_PURE uchar fd_txn_error_enum_is_blockhash_not_found(fd_txn_error_enum_t const * self) {
23599 0 : return self->discriminant == 7;
23600 0 : }
23601 0 : FD_FN_PURE uchar fd_txn_error_enum_is_instruction_error(fd_txn_error_enum_t const * self) {
23602 0 : return self->discriminant == 8;
23603 0 : }
23604 0 : FD_FN_PURE uchar fd_txn_error_enum_is_call_chain_too_deep(fd_txn_error_enum_t const * self) {
23605 0 : return self->discriminant == 9;
23606 0 : }
23607 0 : FD_FN_PURE uchar fd_txn_error_enum_is_missing_signature_for_fee(fd_txn_error_enum_t const * self) {
23608 0 : return self->discriminant == 10;
23609 0 : }
23610 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_index(fd_txn_error_enum_t const * self) {
23611 0 : return self->discriminant == 11;
23612 0 : }
23613 0 : FD_FN_PURE uchar fd_txn_error_enum_is_signature_failure(fd_txn_error_enum_t const * self) {
23614 0 : return self->discriminant == 12;
23615 0 : }
23616 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_program_for_execution(fd_txn_error_enum_t const * self) {
23617 0 : return self->discriminant == 13;
23618 0 : }
23619 0 : FD_FN_PURE uchar fd_txn_error_enum_is_sanitize_failure(fd_txn_error_enum_t const * self) {
23620 0 : return self->discriminant == 14;
23621 0 : }
23622 0 : FD_FN_PURE uchar fd_txn_error_enum_is_cluster_maintenance(fd_txn_error_enum_t const * self) {
23623 0 : return self->discriminant == 15;
23624 0 : }
23625 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_borrow_outstanding(fd_txn_error_enum_t const * self) {
23626 0 : return self->discriminant == 16;
23627 0 : }
23628 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_block_cost_limit(fd_txn_error_enum_t const * self) {
23629 0 : return self->discriminant == 17;
23630 0 : }
23631 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unsupported_version(fd_txn_error_enum_t const * self) {
23632 0 : return self->discriminant == 18;
23633 0 : }
23634 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_writable_account(fd_txn_error_enum_t const * self) {
23635 0 : return self->discriminant == 19;
23636 0 : }
23637 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_account_cost_limit(fd_txn_error_enum_t const * self) {
23638 0 : return self->discriminant == 20;
23639 0 : }
23640 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_block_limit(fd_txn_error_enum_t const * self) {
23641 0 : return self->discriminant == 21;
23642 0 : }
23643 0 : FD_FN_PURE uchar fd_txn_error_enum_is_too_many_account_locks(fd_txn_error_enum_t const * self) {
23644 0 : return self->discriminant == 22;
23645 0 : }
23646 0 : FD_FN_PURE uchar fd_txn_error_enum_is_address_lookup_table_not_found(fd_txn_error_enum_t const * self) {
23647 0 : return self->discriminant == 23;
23648 0 : }
23649 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_owner(fd_txn_error_enum_t const * self) {
23650 0 : return self->discriminant == 24;
23651 0 : }
23652 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_data(fd_txn_error_enum_t const * self) {
23653 0 : return self->discriminant == 25;
23654 0 : }
23655 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_index(fd_txn_error_enum_t const * self) {
23656 0 : return self->discriminant == 26;
23657 0 : }
23658 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_rent_paying_account(fd_txn_error_enum_t const * self) {
23659 0 : return self->discriminant == 27;
23660 0 : }
23661 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_vote_cost_limit(fd_txn_error_enum_t const * self) {
23662 0 : return self->discriminant == 28;
23663 0 : }
23664 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_total_limit(fd_txn_error_enum_t const * self) {
23665 0 : return self->discriminant == 29;
23666 0 : }
23667 0 : FD_FN_PURE uchar fd_txn_error_enum_is_duplicate_instruction(fd_txn_error_enum_t const * self) {
23668 0 : return self->discriminant == 30;
23669 0 : }
23670 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_rent(fd_txn_error_enum_t const * self) {
23671 0 : return self->discriminant == 31;
23672 0 : }
23673 0 : FD_FN_PURE uchar fd_txn_error_enum_is_max_loaded_accounts_data_size_exceeded(fd_txn_error_enum_t const * self) {
23674 0 : return self->discriminant == 32;
23675 0 : }
23676 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_loaded_accounts_data_size_limit(fd_txn_error_enum_t const * self) {
23677 0 : return self->discriminant == 33;
23678 0 : }
23679 0 : FD_FN_PURE uchar fd_txn_error_enum_is_resanitization_needed(fd_txn_error_enum_t const * self) {
23680 0 : return self->discriminant == 34;
23681 0 : }
23682 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_execution_temporarily_restricted(fd_txn_error_enum_t const * self) {
23683 0 : return self->discriminant == 35;
23684 0 : }
23685 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unbalanced_transaction(fd_txn_error_enum_t const * self) {
23686 0 : return self->discriminant == 36;
23687 0 : }
23688 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant );
23689 0 : int fd_txn_error_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23690 0 : int err;
23691 0 : switch (discriminant) {
23692 0 : case 0: {
23693 0 : return FD_BINCODE_SUCCESS;
23694 0 : }
23695 0 : case 1: {
23696 0 : return FD_BINCODE_SUCCESS;
23697 0 : }
23698 0 : case 2: {
23699 0 : return FD_BINCODE_SUCCESS;
23700 0 : }
23701 0 : case 3: {
23702 0 : return FD_BINCODE_SUCCESS;
23703 0 : }
23704 0 : case 4: {
23705 0 : return FD_BINCODE_SUCCESS;
23706 0 : }
23707 0 : case 5: {
23708 0 : return FD_BINCODE_SUCCESS;
23709 0 : }
23710 0 : case 6: {
23711 0 : return FD_BINCODE_SUCCESS;
23712 0 : }
23713 0 : case 7: {
23714 0 : return FD_BINCODE_SUCCESS;
23715 0 : }
23716 0 : case 8: {
23717 0 : err = fd_txn_instr_error_decode_footprint_inner( ctx, total_sz );
23718 0 : if( FD_UNLIKELY( err ) ) return err;
23719 0 : return FD_BINCODE_SUCCESS;
23720 0 : }
23721 0 : case 9: {
23722 0 : return FD_BINCODE_SUCCESS;
23723 0 : }
23724 0 : case 10: {
23725 0 : return FD_BINCODE_SUCCESS;
23726 0 : }
23727 0 : case 11: {
23728 0 : return FD_BINCODE_SUCCESS;
23729 0 : }
23730 0 : case 12: {
23731 0 : return FD_BINCODE_SUCCESS;
23732 0 : }
23733 0 : case 13: {
23734 0 : return FD_BINCODE_SUCCESS;
23735 0 : }
23736 0 : case 14: {
23737 0 : return FD_BINCODE_SUCCESS;
23738 0 : }
23739 0 : case 15: {
23740 0 : return FD_BINCODE_SUCCESS;
23741 0 : }
23742 0 : case 16: {
23743 0 : return FD_BINCODE_SUCCESS;
23744 0 : }
23745 0 : case 17: {
23746 0 : return FD_BINCODE_SUCCESS;
23747 0 : }
23748 0 : case 18: {
23749 0 : return FD_BINCODE_SUCCESS;
23750 0 : }
23751 0 : case 19: {
23752 0 : return FD_BINCODE_SUCCESS;
23753 0 : }
23754 0 : case 20: {
23755 0 : return FD_BINCODE_SUCCESS;
23756 0 : }
23757 0 : case 21: {
23758 0 : return FD_BINCODE_SUCCESS;
23759 0 : }
23760 0 : case 22: {
23761 0 : return FD_BINCODE_SUCCESS;
23762 0 : }
23763 0 : case 23: {
23764 0 : return FD_BINCODE_SUCCESS;
23765 0 : }
23766 0 : case 24: {
23767 0 : return FD_BINCODE_SUCCESS;
23768 0 : }
23769 0 : case 25: {
23770 0 : return FD_BINCODE_SUCCESS;
23771 0 : }
23772 0 : case 26: {
23773 0 : return FD_BINCODE_SUCCESS;
23774 0 : }
23775 0 : case 27: {
23776 0 : return FD_BINCODE_SUCCESS;
23777 0 : }
23778 0 : case 28: {
23779 0 : return FD_BINCODE_SUCCESS;
23780 0 : }
23781 0 : case 29: {
23782 0 : return FD_BINCODE_SUCCESS;
23783 0 : }
23784 0 : case 30: {
23785 0 : err = fd_bincode_uint8_decode_footprint( ctx );
23786 0 : if( FD_UNLIKELY( err ) ) return err;
23787 0 : return FD_BINCODE_SUCCESS;
23788 0 : }
23789 0 : case 31: {
23790 0 : err = fd_bincode_uint8_decode_footprint( ctx );
23791 0 : if( FD_UNLIKELY( err ) ) return err;
23792 0 : return FD_BINCODE_SUCCESS;
23793 0 : }
23794 0 : case 32: {
23795 0 : return FD_BINCODE_SUCCESS;
23796 0 : }
23797 0 : case 33: {
23798 0 : return FD_BINCODE_SUCCESS;
23799 0 : }
23800 0 : case 34: {
23801 0 : return FD_BINCODE_SUCCESS;
23802 0 : }
23803 0 : case 35: {
23804 0 : err = fd_bincode_uint8_decode_footprint( ctx );
23805 0 : if( FD_UNLIKELY( err ) ) return err;
23806 0 : return FD_BINCODE_SUCCESS;
23807 0 : }
23808 0 : case 36: {
23809 0 : return FD_BINCODE_SUCCESS;
23810 0 : }
23811 0 : default: return FD_BINCODE_ERR_ENCODING;
23812 0 : }
23813 0 : }
23814 0 : static int fd_txn_error_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23815 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23816 0 : uint discriminant = 0;
23817 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
23818 0 : if( FD_UNLIKELY( err ) ) return err;
23819 0 : return fd_txn_error_enum_inner_decode_footprint( discriminant, ctx, total_sz );
23820 0 : }
23821 0 : int fd_txn_error_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
23822 0 : *total_sz += sizeof(fd_txn_error_enum_t);
23823 0 : void const * start_data = ctx->data;
23824 0 : int err = fd_txn_error_enum_decode_footprint_inner( ctx, total_sz );
23825 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23826 0 : ctx->data = start_data;
23827 0 : return err;
23828 0 : }
23829 0 : static void fd_txn_error_enum_inner_decode_inner( fd_txn_error_enum_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
23830 0 : switch (discriminant) {
23831 0 : case 0: {
23832 0 : break;
23833 0 : }
23834 0 : case 1: {
23835 0 : break;
23836 0 : }
23837 0 : case 2: {
23838 0 : break;
23839 0 : }
23840 0 : case 3: {
23841 0 : break;
23842 0 : }
23843 0 : case 4: {
23844 0 : break;
23845 0 : }
23846 0 : case 5: {
23847 0 : break;
23848 0 : }
23849 0 : case 6: {
23850 0 : break;
23851 0 : }
23852 0 : case 7: {
23853 0 : break;
23854 0 : }
23855 0 : case 8: {
23856 0 : fd_txn_instr_error_decode_inner( &self->instruction_error, alloc_mem, ctx );
23857 0 : break;
23858 0 : }
23859 0 : case 9: {
23860 0 : break;
23861 0 : }
23862 0 : case 10: {
23863 0 : break;
23864 0 : }
23865 0 : case 11: {
23866 0 : break;
23867 0 : }
23868 0 : case 12: {
23869 0 : break;
23870 0 : }
23871 0 : case 13: {
23872 0 : break;
23873 0 : }
23874 0 : case 14: {
23875 0 : break;
23876 0 : }
23877 0 : case 15: {
23878 0 : break;
23879 0 : }
23880 0 : case 16: {
23881 0 : break;
23882 0 : }
23883 0 : case 17: {
23884 0 : break;
23885 0 : }
23886 0 : case 18: {
23887 0 : break;
23888 0 : }
23889 0 : case 19: {
23890 0 : break;
23891 0 : }
23892 0 : case 20: {
23893 0 : break;
23894 0 : }
23895 0 : case 21: {
23896 0 : break;
23897 0 : }
23898 0 : case 22: {
23899 0 : break;
23900 0 : }
23901 0 : case 23: {
23902 0 : break;
23903 0 : }
23904 0 : case 24: {
23905 0 : break;
23906 0 : }
23907 0 : case 25: {
23908 0 : break;
23909 0 : }
23910 0 : case 26: {
23911 0 : break;
23912 0 : }
23913 0 : case 27: {
23914 0 : break;
23915 0 : }
23916 0 : case 28: {
23917 0 : break;
23918 0 : }
23919 0 : case 29: {
23920 0 : break;
23921 0 : }
23922 0 : case 30: {
23923 0 : fd_bincode_uint8_decode_unsafe( &self->duplicate_instruction, ctx );
23924 0 : break;
23925 0 : }
23926 0 : case 31: {
23927 0 : fd_bincode_uint8_decode_unsafe( &self->insufficient_funds_for_rent, ctx );
23928 0 : break;
23929 0 : }
23930 0 : case 32: {
23931 0 : break;
23932 0 : }
23933 0 : case 33: {
23934 0 : break;
23935 0 : }
23936 0 : case 34: {
23937 0 : break;
23938 0 : }
23939 0 : case 35: {
23940 0 : fd_bincode_uint8_decode_unsafe( &self->program_execution_temporarily_restricted, ctx );
23941 0 : break;
23942 0 : }
23943 0 : case 36: {
23944 0 : break;
23945 0 : }
23946 0 : }
23947 0 : }
23948 0 : static void fd_txn_error_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23949 0 : fd_txn_error_enum_t * self = (fd_txn_error_enum_t *)struct_mem;
23950 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
23951 0 : fd_txn_error_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
23952 0 : }
23953 0 : void * fd_txn_error_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
23954 0 : fd_txn_error_enum_t * self = (fd_txn_error_enum_t *)mem;
23955 0 : fd_txn_error_enum_new( self );
23956 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_error_enum_t);
23957 0 : void * * alloc_mem = &alloc_region;
23958 0 : fd_txn_error_enum_decode_inner( mem, alloc_mem, ctx );
23959 0 : return self;
23960 0 : }
23961 0 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant ) {
23962 0 : switch( discriminant ) {
23963 0 : case 0: {
23964 0 : break;
23965 0 : }
23966 0 : case 1: {
23967 0 : break;
23968 0 : }
23969 0 : case 2: {
23970 0 : break;
23971 0 : }
23972 0 : case 3: {
23973 0 : break;
23974 0 : }
23975 0 : case 4: {
23976 0 : break;
23977 0 : }
23978 0 : case 5: {
23979 0 : break;
23980 0 : }
23981 0 : case 6: {
23982 0 : break;
23983 0 : }
23984 0 : case 7: {
23985 0 : break;
23986 0 : }
23987 0 : case 8: {
23988 0 : fd_txn_instr_error_new( &self->instruction_error );
23989 0 : break;
23990 0 : }
23991 0 : case 9: {
23992 0 : break;
23993 0 : }
23994 0 : case 10: {
23995 0 : break;
23996 0 : }
23997 0 : case 11: {
23998 0 : break;
23999 0 : }
24000 0 : case 12: {
24001 0 : break;
24002 0 : }
24003 0 : case 13: {
24004 0 : break;
24005 0 : }
24006 0 : case 14: {
24007 0 : break;
24008 0 : }
24009 0 : case 15: {
24010 0 : break;
24011 0 : }
24012 0 : case 16: {
24013 0 : break;
24014 0 : }
24015 0 : case 17: {
24016 0 : break;
24017 0 : }
24018 0 : case 18: {
24019 0 : break;
24020 0 : }
24021 0 : case 19: {
24022 0 : break;
24023 0 : }
24024 0 : case 20: {
24025 0 : break;
24026 0 : }
24027 0 : case 21: {
24028 0 : break;
24029 0 : }
24030 0 : case 22: {
24031 0 : break;
24032 0 : }
24033 0 : case 23: {
24034 0 : break;
24035 0 : }
24036 0 : case 24: {
24037 0 : break;
24038 0 : }
24039 0 : case 25: {
24040 0 : break;
24041 0 : }
24042 0 : case 26: {
24043 0 : break;
24044 0 : }
24045 0 : case 27: {
24046 0 : break;
24047 0 : }
24048 0 : case 28: {
24049 0 : break;
24050 0 : }
24051 0 : case 29: {
24052 0 : break;
24053 0 : }
24054 0 : case 30: {
24055 0 : break;
24056 0 : }
24057 0 : case 31: {
24058 0 : break;
24059 0 : }
24060 0 : case 32: {
24061 0 : break;
24062 0 : }
24063 0 : case 33: {
24064 0 : break;
24065 0 : }
24066 0 : case 34: {
24067 0 : break;
24068 0 : }
24069 0 : case 35: {
24070 0 : break;
24071 0 : }
24072 0 : case 36: {
24073 0 : break;
24074 0 : }
24075 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
24076 0 : }
24077 0 : }
24078 0 : void fd_txn_error_enum_new_disc( fd_txn_error_enum_t * self, uint discriminant ) {
24079 0 : self->discriminant = discriminant;
24080 0 : fd_txn_error_enum_inner_new( &self->inner, self->discriminant );
24081 0 : }
24082 0 : void fd_txn_error_enum_new( fd_txn_error_enum_t * self ) {
24083 0 : fd_memset( self, 0, sizeof(fd_txn_error_enum_t) );
24084 0 : fd_txn_error_enum_new_disc( self, UINT_MAX );
24085 0 : }
24086 :
24087 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, uint varint ) {
24088 0 : (void) varint;
24089 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_error_enum", level++, 0);
24090 0 : switch( self->discriminant ) {
24091 0 : case 0: {
24092 0 : fun( w, self, "account_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24093 0 : break;
24094 0 : }
24095 0 : case 1: {
24096 0 : fun( w, self, "account_loaded_twice", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24097 0 : break;
24098 0 : }
24099 0 : case 2: {
24100 0 : fun( w, self, "account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24101 0 : break;
24102 0 : }
24103 0 : case 3: {
24104 0 : fun( w, self, "program_account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24105 0 : break;
24106 0 : }
24107 0 : case 4: {
24108 0 : fun( w, self, "insufficient_funds_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24109 0 : break;
24110 0 : }
24111 0 : case 5: {
24112 0 : fun( w, self, "invalid_account_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24113 0 : break;
24114 0 : }
24115 0 : case 6: {
24116 0 : fun( w, self, "already_processed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24117 0 : break;
24118 0 : }
24119 0 : case 7: {
24120 0 : fun( w, self, "blockhash_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24121 0 : break;
24122 0 : }
24123 0 : case 8: {
24124 0 : fun( w, self, "instruction_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24125 0 : fd_txn_instr_error_walk( w, &self->inner.instruction_error, fun, "instruction_error", level, 0 );
24126 0 : break;
24127 0 : }
24128 0 : case 9: {
24129 0 : fun( w, self, "call_chain_too_deep", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24130 0 : break;
24131 0 : }
24132 0 : case 10: {
24133 0 : fun( w, self, "missing_signature_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24134 0 : break;
24135 0 : }
24136 0 : case 11: {
24137 0 : fun( w, self, "invalid_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24138 0 : break;
24139 0 : }
24140 0 : case 12: {
24141 0 : fun( w, self, "signature_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24142 0 : break;
24143 0 : }
24144 0 : case 13: {
24145 0 : fun( w, self, "invalid_program_for_execution", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24146 0 : break;
24147 0 : }
24148 0 : case 14: {
24149 0 : fun( w, self, "sanitize_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24150 0 : break;
24151 0 : }
24152 0 : case 15: {
24153 0 : fun( w, self, "cluster_maintenance", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24154 0 : break;
24155 0 : }
24156 0 : case 16: {
24157 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24158 0 : break;
24159 0 : }
24160 0 : case 17: {
24161 0 : fun( w, self, "would_exceed_max_block_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24162 0 : break;
24163 0 : }
24164 0 : case 18: {
24165 0 : fun( w, self, "unsupported_version", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24166 0 : break;
24167 0 : }
24168 0 : case 19: {
24169 0 : fun( w, self, "invalid_writable_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24170 0 : break;
24171 0 : }
24172 0 : case 20: {
24173 0 : fun( w, self, "would_exceed_max_account_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24174 0 : break;
24175 0 : }
24176 0 : case 21: {
24177 0 : fun( w, self, "would_exceed_account_data_block_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24178 0 : break;
24179 0 : }
24180 0 : case 22: {
24181 0 : fun( w, self, "too_many_account_locks", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24182 0 : break;
24183 0 : }
24184 0 : case 23: {
24185 0 : fun( w, self, "address_lookup_table_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24186 0 : break;
24187 0 : }
24188 0 : case 24: {
24189 0 : fun( w, self, "invalid_address_lookup_table_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24190 0 : break;
24191 0 : }
24192 0 : case 25: {
24193 0 : fun( w, self, "invalid_address_lookup_table_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24194 0 : break;
24195 0 : }
24196 0 : case 26: {
24197 0 : fun( w, self, "invalid_address_lookup_table_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24198 0 : break;
24199 0 : }
24200 0 : case 27: {
24201 0 : fun( w, self, "invalid_rent_paying_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24202 0 : break;
24203 0 : }
24204 0 : case 28: {
24205 0 : fun( w, self, "would_exceed_max_vote_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24206 0 : break;
24207 0 : }
24208 0 : case 29: {
24209 0 : fun( w, self, "would_exceed_account_data_total_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24210 0 : break;
24211 0 : }
24212 0 : case 30: {
24213 0 : fun( w, self, "duplicate_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24214 0 : fun( w, &self->inner.duplicate_instruction, "duplicate_instruction", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
24215 0 : break;
24216 0 : }
24217 0 : case 31: {
24218 0 : fun( w, self, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24219 0 : fun( w, &self->inner.insufficient_funds_for_rent, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
24220 0 : break;
24221 0 : }
24222 0 : case 32: {
24223 0 : fun( w, self, "max_loaded_accounts_data_size_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24224 0 : break;
24225 0 : }
24226 0 : case 33: {
24227 0 : fun( w, self, "invalid_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24228 0 : break;
24229 0 : }
24230 0 : case 34: {
24231 0 : fun( w, self, "resanitization_needed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24232 0 : break;
24233 0 : }
24234 0 : case 35: {
24235 0 : fun( w, self, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24236 0 : fun( w, &self->inner.program_execution_temporarily_restricted, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
24237 0 : break;
24238 0 : }
24239 0 : case 36: {
24240 0 : fun( w, self, "unbalanced_transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24241 0 : break;
24242 0 : }
24243 0 : }
24244 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_error_enum", level--, 0 );
24245 0 : }
24246 0 : ulong fd_txn_error_enum_size( fd_txn_error_enum_t const * self ) {
24247 0 : ulong size = 0;
24248 0 : size += sizeof(uint);
24249 0 : switch (self->discriminant) {
24250 0 : case 8: {
24251 0 : size += fd_txn_instr_error_size( &self->inner.instruction_error );
24252 0 : break;
24253 0 : }
24254 0 : case 30: {
24255 0 : size += sizeof(char);
24256 0 : break;
24257 0 : }
24258 0 : case 31: {
24259 0 : size += sizeof(char);
24260 0 : break;
24261 0 : }
24262 0 : case 35: {
24263 0 : size += sizeof(char);
24264 0 : break;
24265 0 : }
24266 0 : }
24267 0 : return size;
24268 0 : }
24269 :
24270 0 : int fd_txn_error_enum_inner_encode( fd_txn_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
24271 0 : int err;
24272 0 : switch (discriminant) {
24273 0 : case 8: {
24274 0 : err = fd_txn_instr_error_encode( &self->instruction_error, ctx );
24275 0 : if( FD_UNLIKELY( err ) ) return err;
24276 0 : break;
24277 0 : }
24278 0 : case 30: {
24279 0 : err = fd_bincode_uint8_encode( (uchar)(self->duplicate_instruction), ctx );
24280 0 : if( FD_UNLIKELY( err ) ) return err;
24281 0 : break;
24282 0 : }
24283 0 : case 31: {
24284 0 : err = fd_bincode_uint8_encode( (uchar)(self->insufficient_funds_for_rent), ctx );
24285 0 : if( FD_UNLIKELY( err ) ) return err;
24286 0 : break;
24287 0 : }
24288 0 : case 35: {
24289 0 : err = fd_bincode_uint8_encode( (uchar)(self->program_execution_temporarily_restricted), ctx );
24290 0 : if( FD_UNLIKELY( err ) ) return err;
24291 0 : break;
24292 0 : }
24293 0 : }
24294 0 : return FD_BINCODE_SUCCESS;
24295 0 : }
24296 0 : int fd_txn_error_enum_encode( fd_txn_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24297 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
24298 0 : if( FD_UNLIKELY( err ) ) return err;
24299 0 : return fd_txn_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
24300 0 : }
24301 :
24302 0 : FD_FN_PURE uchar fd_txn_result_is_ok(fd_txn_result_t const * self) {
24303 0 : return self->discriminant == 0;
24304 0 : }
24305 0 : FD_FN_PURE uchar fd_txn_result_is_error(fd_txn_result_t const * self) {
24306 0 : return self->discriminant == 1;
24307 0 : }
24308 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant );
24309 0 : int fd_txn_result_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24310 0 : int err;
24311 0 : switch (discriminant) {
24312 0 : case 0: {
24313 0 : return FD_BINCODE_SUCCESS;
24314 0 : }
24315 0 : case 1: {
24316 0 : err = fd_txn_error_enum_decode_footprint_inner( ctx, total_sz );
24317 0 : if( FD_UNLIKELY( err ) ) return err;
24318 0 : return FD_BINCODE_SUCCESS;
24319 0 : }
24320 0 : default: return FD_BINCODE_ERR_ENCODING;
24321 0 : }
24322 0 : }
24323 0 : static int fd_txn_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24324 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24325 0 : uint discriminant = 0;
24326 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
24327 0 : if( FD_UNLIKELY( err ) ) return err;
24328 0 : return fd_txn_result_inner_decode_footprint( discriminant, ctx, total_sz );
24329 0 : }
24330 0 : int fd_txn_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24331 0 : *total_sz += sizeof(fd_txn_result_t);
24332 0 : void const * start_data = ctx->data;
24333 0 : int err = fd_txn_result_decode_footprint_inner( ctx, total_sz );
24334 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24335 0 : ctx->data = start_data;
24336 0 : return err;
24337 0 : }
24338 0 : static void fd_txn_result_inner_decode_inner( fd_txn_result_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
24339 0 : switch (discriminant) {
24340 0 : case 0: {
24341 0 : break;
24342 0 : }
24343 0 : case 1: {
24344 0 : fd_txn_error_enum_decode_inner( &self->error, alloc_mem, ctx );
24345 0 : break;
24346 0 : }
24347 0 : }
24348 0 : }
24349 0 : static void fd_txn_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24350 0 : fd_txn_result_t * self = (fd_txn_result_t *)struct_mem;
24351 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
24352 0 : fd_txn_result_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
24353 0 : }
24354 0 : void * fd_txn_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24355 0 : fd_txn_result_t * self = (fd_txn_result_t *)mem;
24356 0 : fd_txn_result_new( self );
24357 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_result_t);
24358 0 : void * * alloc_mem = &alloc_region;
24359 0 : fd_txn_result_decode_inner( mem, alloc_mem, ctx );
24360 0 : return self;
24361 0 : }
24362 0 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant ) {
24363 0 : switch( discriminant ) {
24364 0 : case 0: {
24365 0 : break;
24366 0 : }
24367 0 : case 1: {
24368 0 : fd_txn_error_enum_new( &self->error );
24369 0 : break;
24370 0 : }
24371 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
24372 0 : }
24373 0 : }
24374 0 : void fd_txn_result_new_disc( fd_txn_result_t * self, uint discriminant ) {
24375 0 : self->discriminant = discriminant;
24376 0 : fd_txn_result_inner_new( &self->inner, self->discriminant );
24377 0 : }
24378 0 : void fd_txn_result_new( fd_txn_result_t * self ) {
24379 0 : fd_memset( self, 0, sizeof(fd_txn_result_t) );
24380 0 : fd_txn_result_new_disc( self, UINT_MAX );
24381 0 : }
24382 :
24383 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, uint varint ) {
24384 0 : (void) varint;
24385 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_result", level++, 0);
24386 0 : switch( self->discriminant ) {
24387 0 : case 0: {
24388 0 : fun( w, self, "ok", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24389 0 : break;
24390 0 : }
24391 0 : case 1: {
24392 0 : fun( w, self, "error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
24393 0 : fd_txn_error_enum_walk( w, &self->inner.error, fun, "error", level, 0 );
24394 0 : break;
24395 0 : }
24396 0 : }
24397 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_result", level--, 0 );
24398 0 : }
24399 0 : ulong fd_txn_result_size( fd_txn_result_t const * self ) {
24400 0 : ulong size = 0;
24401 0 : size += sizeof(uint);
24402 0 : switch (self->discriminant) {
24403 0 : case 1: {
24404 0 : size += fd_txn_error_enum_size( &self->inner.error );
24405 0 : break;
24406 0 : }
24407 0 : }
24408 0 : return size;
24409 0 : }
24410 :
24411 0 : int fd_txn_result_inner_encode( fd_txn_result_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
24412 0 : int err;
24413 0 : switch (discriminant) {
24414 0 : case 1: {
24415 0 : err = fd_txn_error_enum_encode( &self->error, ctx );
24416 0 : if( FD_UNLIKELY( err ) ) return err;
24417 0 : break;
24418 0 : }
24419 0 : }
24420 0 : return FD_BINCODE_SUCCESS;
24421 0 : }
24422 0 : int fd_txn_result_encode( fd_txn_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24423 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
24424 0 : if( FD_UNLIKELY( err ) ) return err;
24425 0 : return fd_txn_result_inner_encode( &self->inner, self->discriminant, ctx );
24426 0 : }
24427 :
24428 0 : int fd_cache_status_encode( fd_cache_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24429 0 : int err;
24430 0 : err = fd_bincode_bytes_encode( self->key_slice, 20, ctx );
24431 0 : if( FD_UNLIKELY( err ) ) return err;
24432 0 : err = fd_txn_result_encode( &self->result, ctx );
24433 0 : if( FD_UNLIKELY( err ) ) return err;
24434 0 : return FD_BINCODE_SUCCESS;
24435 0 : }
24436 0 : static int fd_cache_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24437 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24438 0 : int err = 0;
24439 0 : err = fd_bincode_bytes_decode_footprint( 20, ctx );
24440 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24441 0 : err = fd_txn_result_decode_footprint_inner( ctx, total_sz );
24442 0 : if( FD_UNLIKELY( err ) ) return err;
24443 0 : return 0;
24444 0 : }
24445 0 : int fd_cache_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24446 0 : *total_sz += sizeof(fd_cache_status_t);
24447 0 : void const * start_data = ctx->data;
24448 0 : int err = fd_cache_status_decode_footprint_inner( ctx, total_sz );
24449 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24450 0 : ctx->data = start_data;
24451 0 : return err;
24452 0 : }
24453 0 : static void fd_cache_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24454 0 : fd_cache_status_t * self = (fd_cache_status_t *)struct_mem;
24455 0 : fd_bincode_bytes_decode_unsafe( self->key_slice, 20, ctx );
24456 0 : fd_txn_result_decode_inner( &self->result, alloc_mem, ctx );
24457 0 : }
24458 0 : void * fd_cache_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24459 0 : fd_cache_status_t * self = (fd_cache_status_t *)mem;
24460 0 : fd_cache_status_new( self );
24461 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cache_status_t);
24462 0 : void * * alloc_mem = &alloc_region;
24463 0 : fd_cache_status_decode_inner( mem, alloc_mem, ctx );
24464 0 : return self;
24465 0 : }
24466 0 : void fd_cache_status_new(fd_cache_status_t * self) {
24467 0 : fd_memset( self, 0, sizeof(fd_cache_status_t) );
24468 0 : fd_txn_result_new( &self->result );
24469 0 : }
24470 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, uint varint ) {
24471 0 : (void) varint;
24472 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cache_status", level++, 0 );
24473 0 : fun(w, self->key_slice, "key_slice", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
24474 0 : fd_txn_result_walk( w, &self->result, fun, "result", level, 0 );
24475 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cache_status", level--, 0 );
24476 0 : }
24477 0 : ulong fd_cache_status_size( fd_cache_status_t const * self ) {
24478 0 : ulong size = 0;
24479 0 : size += 20;
24480 0 : size += fd_txn_result_size( &self->result );
24481 0 : return size;
24482 0 : }
24483 :
24484 0 : int fd_status_value_encode( fd_status_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24485 0 : int err;
24486 0 : err = fd_bincode_uint64_encode( self->txn_idx, ctx );
24487 0 : if( FD_UNLIKELY( err ) ) return err;
24488 0 : err = fd_bincode_uint64_encode( self->statuses_len, ctx );
24489 0 : if( FD_UNLIKELY(err) ) return err;
24490 0 : if( self->statuses_len ) {
24491 0 : for( ulong i=0; i < self->statuses_len; i++ ) {
24492 0 : err = fd_cache_status_encode( self->statuses + i, ctx );
24493 0 : if( FD_UNLIKELY( err ) ) return err;
24494 0 : }
24495 0 : }
24496 0 : return FD_BINCODE_SUCCESS;
24497 0 : }
24498 0 : static int fd_status_value_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24499 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24500 0 : int err = 0;
24501 0 : err = fd_bincode_uint64_decode_footprint( ctx );
24502 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24503 0 : ulong statuses_len;
24504 0 : err = fd_bincode_uint64_decode( &statuses_len, ctx );
24505 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24506 0 : if( statuses_len ) {
24507 0 : *total_sz += FD_CACHE_STATUS_ALIGN + sizeof(fd_cache_status_t)*statuses_len;
24508 0 : for( ulong i=0; i < statuses_len; i++ ) {
24509 0 : err = fd_cache_status_decode_footprint_inner( ctx, total_sz );
24510 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24511 0 : }
24512 0 : }
24513 0 : return 0;
24514 0 : }
24515 0 : int fd_status_value_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24516 0 : *total_sz += sizeof(fd_status_value_t);
24517 0 : void const * start_data = ctx->data;
24518 0 : int err = fd_status_value_decode_footprint_inner( ctx, total_sz );
24519 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24520 0 : ctx->data = start_data;
24521 0 : return err;
24522 0 : }
24523 0 : static void fd_status_value_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24524 0 : fd_status_value_t * self = (fd_status_value_t *)struct_mem;
24525 0 : fd_bincode_uint64_decode_unsafe( &self->txn_idx, ctx );
24526 0 : fd_bincode_uint64_decode_unsafe( &self->statuses_len, ctx );
24527 0 : if( self->statuses_len ) {
24528 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CACHE_STATUS_ALIGN );
24529 0 : self->statuses = *alloc_mem;
24530 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_cache_status_t)*self->statuses_len;
24531 0 : for( ulong i=0; i < self->statuses_len; i++ ) {
24532 0 : fd_cache_status_new( self->statuses + i );
24533 0 : fd_cache_status_decode_inner( self->statuses + i, alloc_mem, ctx );
24534 0 : }
24535 0 : } else
24536 0 : self->statuses = NULL;
24537 0 : }
24538 0 : void * fd_status_value_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24539 0 : fd_status_value_t * self = (fd_status_value_t *)mem;
24540 0 : fd_status_value_new( self );
24541 0 : void * alloc_region = (uchar *)mem + sizeof(fd_status_value_t);
24542 0 : void * * alloc_mem = &alloc_region;
24543 0 : fd_status_value_decode_inner( mem, alloc_mem, ctx );
24544 0 : return self;
24545 0 : }
24546 0 : void fd_status_value_new(fd_status_value_t * self) {
24547 0 : fd_memset( self, 0, sizeof(fd_status_value_t) );
24548 0 : }
24549 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, uint varint ) {
24550 0 : (void) varint;
24551 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_status_value", level++, 0 );
24552 0 : fun( w, &self->txn_idx, "txn_idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
24553 0 : if( self->statuses_len ) {
24554 0 : fun( w, NULL, "statuses", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
24555 0 : for( ulong i=0; i < self->statuses_len; i++ )
24556 0 : fd_cache_status_walk(w, self->statuses + i, fun, "cache_status", level, 0 );
24557 0 : fun( w, NULL, "statuses", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
24558 0 : }
24559 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_status_value", level--, 0 );
24560 0 : }
24561 0 : ulong fd_status_value_size( fd_status_value_t const * self ) {
24562 0 : ulong size = 0;
24563 0 : size += sizeof(ulong);
24564 0 : do {
24565 0 : size += sizeof(ulong);
24566 0 : for( ulong i=0; i < self->statuses_len; i++ )
24567 0 : size += fd_cache_status_size( self->statuses + i );
24568 0 : } while(0);
24569 0 : return size;
24570 0 : }
24571 :
24572 0 : int fd_status_pair_encode( fd_status_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24573 0 : int err;
24574 0 : err = fd_hash_encode( &self->hash, ctx );
24575 0 : if( FD_UNLIKELY( err ) ) return err;
24576 0 : err = fd_status_value_encode( &self->value, ctx );
24577 0 : if( FD_UNLIKELY( err ) ) return err;
24578 0 : return FD_BINCODE_SUCCESS;
24579 0 : }
24580 0 : static int fd_status_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24581 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24582 0 : int err = 0;
24583 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
24584 0 : if( FD_UNLIKELY( err ) ) return err;
24585 0 : err = fd_status_value_decode_footprint_inner( ctx, total_sz );
24586 0 : if( FD_UNLIKELY( err ) ) return err;
24587 0 : return 0;
24588 0 : }
24589 0 : int fd_status_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24590 0 : *total_sz += sizeof(fd_status_pair_t);
24591 0 : void const * start_data = ctx->data;
24592 0 : int err = fd_status_pair_decode_footprint_inner( ctx, total_sz );
24593 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24594 0 : ctx->data = start_data;
24595 0 : return err;
24596 0 : }
24597 0 : static void fd_status_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24598 0 : fd_status_pair_t * self = (fd_status_pair_t *)struct_mem;
24599 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
24600 0 : fd_status_value_decode_inner( &self->value, alloc_mem, ctx );
24601 0 : }
24602 0 : void * fd_status_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24603 0 : fd_status_pair_t * self = (fd_status_pair_t *)mem;
24604 0 : fd_status_pair_new( self );
24605 0 : void * alloc_region = (uchar *)mem + sizeof(fd_status_pair_t);
24606 0 : void * * alloc_mem = &alloc_region;
24607 0 : fd_status_pair_decode_inner( mem, alloc_mem, ctx );
24608 0 : return self;
24609 0 : }
24610 0 : void fd_status_pair_new(fd_status_pair_t * self) {
24611 0 : fd_memset( self, 0, sizeof(fd_status_pair_t) );
24612 0 : fd_hash_new( &self->hash );
24613 0 : fd_status_value_new( &self->value );
24614 0 : }
24615 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, uint varint ) {
24616 0 : (void) varint;
24617 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_status_pair", level++, 0 );
24618 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
24619 0 : fd_status_value_walk( w, &self->value, fun, "value", level, 0 );
24620 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_status_pair", level--, 0 );
24621 0 : }
24622 0 : ulong fd_status_pair_size( fd_status_pair_t const * self ) {
24623 0 : ulong size = 0;
24624 0 : size += fd_hash_size( &self->hash );
24625 0 : size += fd_status_value_size( &self->value );
24626 0 : return size;
24627 0 : }
24628 :
24629 0 : int fd_slot_delta_encode( fd_slot_delta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24630 0 : int err;
24631 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
24632 0 : if( FD_UNLIKELY( err ) ) return err;
24633 0 : err = fd_bincode_bool_encode( (uchar)(self->is_root), ctx );
24634 0 : if( FD_UNLIKELY( err ) ) return err;
24635 0 : err = fd_bincode_uint64_encode( self->slot_delta_vec_len, ctx );
24636 0 : if( FD_UNLIKELY(err) ) return err;
24637 0 : if( self->slot_delta_vec_len ) {
24638 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ ) {
24639 0 : err = fd_status_pair_encode( self->slot_delta_vec + i, ctx );
24640 0 : if( FD_UNLIKELY( err ) ) return err;
24641 0 : }
24642 0 : }
24643 0 : return FD_BINCODE_SUCCESS;
24644 0 : }
24645 0 : static int fd_slot_delta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24646 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24647 0 : int err = 0;
24648 0 : err = fd_bincode_uint64_decode_footprint( ctx );
24649 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24650 0 : err = fd_bincode_bool_decode_footprint( ctx );
24651 0 : if( FD_UNLIKELY( err ) ) return err;
24652 0 : ulong slot_delta_vec_len;
24653 0 : err = fd_bincode_uint64_decode( &slot_delta_vec_len, ctx );
24654 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24655 0 : if( slot_delta_vec_len ) {
24656 0 : *total_sz += FD_STATUS_PAIR_ALIGN + sizeof(fd_status_pair_t)*slot_delta_vec_len;
24657 0 : for( ulong i=0; i < slot_delta_vec_len; i++ ) {
24658 0 : err = fd_status_pair_decode_footprint_inner( ctx, total_sz );
24659 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24660 0 : }
24661 0 : }
24662 0 : return 0;
24663 0 : }
24664 0 : int fd_slot_delta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24665 0 : *total_sz += sizeof(fd_slot_delta_t);
24666 0 : void const * start_data = ctx->data;
24667 0 : int err = fd_slot_delta_decode_footprint_inner( ctx, total_sz );
24668 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24669 0 : ctx->data = start_data;
24670 0 : return err;
24671 0 : }
24672 0 : static void fd_slot_delta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24673 0 : fd_slot_delta_t * self = (fd_slot_delta_t *)struct_mem;
24674 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
24675 0 : fd_bincode_bool_decode_unsafe( &self->is_root, ctx );
24676 0 : fd_bincode_uint64_decode_unsafe( &self->slot_delta_vec_len, ctx );
24677 0 : if( self->slot_delta_vec_len ) {
24678 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STATUS_PAIR_ALIGN );
24679 0 : self->slot_delta_vec = *alloc_mem;
24680 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_status_pair_t)*self->slot_delta_vec_len;
24681 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ ) {
24682 0 : fd_status_pair_new( self->slot_delta_vec + i );
24683 0 : fd_status_pair_decode_inner( self->slot_delta_vec + i, alloc_mem, ctx );
24684 0 : }
24685 0 : } else
24686 0 : self->slot_delta_vec = NULL;
24687 0 : }
24688 0 : void * fd_slot_delta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24689 0 : fd_slot_delta_t * self = (fd_slot_delta_t *)mem;
24690 0 : fd_slot_delta_new( self );
24691 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_delta_t);
24692 0 : void * * alloc_mem = &alloc_region;
24693 0 : fd_slot_delta_decode_inner( mem, alloc_mem, ctx );
24694 0 : return self;
24695 0 : }
24696 0 : void fd_slot_delta_new(fd_slot_delta_t * self) {
24697 0 : fd_memset( self, 0, sizeof(fd_slot_delta_t) );
24698 0 : }
24699 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, uint varint ) {
24700 0 : (void) varint;
24701 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_delta", level++, 0 );
24702 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
24703 0 : fun( w, &self->is_root, "is_root", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
24704 0 : if( self->slot_delta_vec_len ) {
24705 0 : fun( w, NULL, "slot_delta_vec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
24706 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
24707 0 : fd_status_pair_walk(w, self->slot_delta_vec + i, fun, "status_pair", level, 0 );
24708 0 : fun( w, NULL, "slot_delta_vec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
24709 0 : }
24710 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_delta", level--, 0 );
24711 0 : }
24712 0 : ulong fd_slot_delta_size( fd_slot_delta_t const * self ) {
24713 0 : ulong size = 0;
24714 0 : size += sizeof(ulong);
24715 0 : size += sizeof(char);
24716 0 : do {
24717 0 : size += sizeof(ulong);
24718 0 : for( ulong i=0; i < self->slot_delta_vec_len; i++ )
24719 0 : size += fd_status_pair_size( self->slot_delta_vec + i );
24720 0 : } while(0);
24721 0 : return size;
24722 0 : }
24723 :
24724 0 : int fd_bank_slot_deltas_encode( fd_bank_slot_deltas_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24725 0 : int err;
24726 0 : err = fd_bincode_uint64_encode( self->slot_deltas_len, ctx );
24727 0 : if( FD_UNLIKELY(err) ) return err;
24728 0 : if( self->slot_deltas_len ) {
24729 0 : for( ulong i=0; i < self->slot_deltas_len; i++ ) {
24730 0 : err = fd_slot_delta_encode( self->slot_deltas + i, ctx );
24731 0 : if( FD_UNLIKELY( err ) ) return err;
24732 0 : }
24733 0 : }
24734 0 : return FD_BINCODE_SUCCESS;
24735 0 : }
24736 0 : static int fd_bank_slot_deltas_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24737 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24738 0 : int err = 0;
24739 0 : ulong slot_deltas_len;
24740 0 : err = fd_bincode_uint64_decode( &slot_deltas_len, ctx );
24741 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24742 0 : if( slot_deltas_len ) {
24743 0 : *total_sz += FD_SLOT_DELTA_ALIGN + sizeof(fd_slot_delta_t)*slot_deltas_len;
24744 0 : for( ulong i=0; i < slot_deltas_len; i++ ) {
24745 0 : err = fd_slot_delta_decode_footprint_inner( ctx, total_sz );
24746 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24747 0 : }
24748 0 : }
24749 0 : return 0;
24750 0 : }
24751 0 : int fd_bank_slot_deltas_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24752 0 : *total_sz += sizeof(fd_bank_slot_deltas_t);
24753 0 : void const * start_data = ctx->data;
24754 0 : int err = fd_bank_slot_deltas_decode_footprint_inner( ctx, total_sz );
24755 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24756 0 : ctx->data = start_data;
24757 0 : return err;
24758 0 : }
24759 0 : static void fd_bank_slot_deltas_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24760 0 : fd_bank_slot_deltas_t * self = (fd_bank_slot_deltas_t *)struct_mem;
24761 0 : fd_bincode_uint64_decode_unsafe( &self->slot_deltas_len, ctx );
24762 0 : if( self->slot_deltas_len ) {
24763 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_DELTA_ALIGN );
24764 0 : self->slot_deltas = *alloc_mem;
24765 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_delta_t)*self->slot_deltas_len;
24766 0 : for( ulong i=0; i < self->slot_deltas_len; i++ ) {
24767 0 : fd_slot_delta_new( self->slot_deltas + i );
24768 0 : fd_slot_delta_decode_inner( self->slot_deltas + i, alloc_mem, ctx );
24769 0 : }
24770 0 : } else
24771 0 : self->slot_deltas = NULL;
24772 0 : }
24773 0 : void * fd_bank_slot_deltas_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24774 0 : fd_bank_slot_deltas_t * self = (fd_bank_slot_deltas_t *)mem;
24775 0 : fd_bank_slot_deltas_new( self );
24776 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bank_slot_deltas_t);
24777 0 : void * * alloc_mem = &alloc_region;
24778 0 : fd_bank_slot_deltas_decode_inner( mem, alloc_mem, ctx );
24779 0 : return self;
24780 0 : }
24781 0 : void fd_bank_slot_deltas_new(fd_bank_slot_deltas_t * self) {
24782 0 : fd_memset( self, 0, sizeof(fd_bank_slot_deltas_t) );
24783 0 : }
24784 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, uint varint ) {
24785 0 : (void) varint;
24786 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bank_slot_deltas", level++, 0 );
24787 0 : if( self->slot_deltas_len ) {
24788 0 : fun( w, NULL, "slot_deltas", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
24789 0 : for( ulong i=0; i < self->slot_deltas_len; i++ )
24790 0 : fd_slot_delta_walk(w, self->slot_deltas + i, fun, "slot_delta", level, 0 );
24791 0 : fun( w, NULL, "slot_deltas", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
24792 0 : }
24793 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bank_slot_deltas", level--, 0 );
24794 0 : }
24795 0 : ulong fd_bank_slot_deltas_size( fd_bank_slot_deltas_t const * self ) {
24796 0 : ulong size = 0;
24797 0 : do {
24798 0 : size += sizeof(ulong);
24799 0 : for( ulong i=0; i < self->slot_deltas_len; i++ )
24800 0 : size += fd_slot_delta_size( self->slot_deltas + i );
24801 0 : } while(0);
24802 0 : return size;
24803 0 : }
24804 :
24805 0 : int fd_pubkey_rewardinfo_pair_encode( fd_pubkey_rewardinfo_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24806 0 : int err;
24807 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
24808 0 : if( FD_UNLIKELY( err ) ) return err;
24809 0 : err = fd_reward_info_encode( &self->reward_info, ctx );
24810 0 : if( FD_UNLIKELY( err ) ) return err;
24811 0 : return FD_BINCODE_SUCCESS;
24812 0 : }
24813 0 : static int fd_pubkey_rewardinfo_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24814 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24815 0 : int err = 0;
24816 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
24817 0 : if( FD_UNLIKELY( err ) ) return err;
24818 0 : err = fd_reward_info_decode_footprint_inner( ctx, total_sz );
24819 0 : if( FD_UNLIKELY( err ) ) return err;
24820 0 : return 0;
24821 0 : }
24822 0 : int fd_pubkey_rewardinfo_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24823 0 : *total_sz += sizeof(fd_pubkey_rewardinfo_pair_t);
24824 0 : void const * start_data = ctx->data;
24825 0 : int err = fd_pubkey_rewardinfo_pair_decode_footprint_inner( ctx, total_sz );
24826 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24827 0 : ctx->data = start_data;
24828 0 : return err;
24829 0 : }
24830 0 : static void fd_pubkey_rewardinfo_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24831 0 : fd_pubkey_rewardinfo_pair_t * self = (fd_pubkey_rewardinfo_pair_t *)struct_mem;
24832 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
24833 0 : fd_reward_info_decode_inner( &self->reward_info, alloc_mem, ctx );
24834 0 : }
24835 0 : void * fd_pubkey_rewardinfo_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24836 0 : fd_pubkey_rewardinfo_pair_t * self = (fd_pubkey_rewardinfo_pair_t *)mem;
24837 0 : fd_pubkey_rewardinfo_pair_new( self );
24838 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_rewardinfo_pair_t);
24839 0 : void * * alloc_mem = &alloc_region;
24840 0 : fd_pubkey_rewardinfo_pair_decode_inner( mem, alloc_mem, ctx );
24841 0 : return self;
24842 0 : }
24843 0 : void fd_pubkey_rewardinfo_pair_new(fd_pubkey_rewardinfo_pair_t * self) {
24844 0 : fd_memset( self, 0, sizeof(fd_pubkey_rewardinfo_pair_t) );
24845 0 : fd_pubkey_new( &self->pubkey );
24846 0 : fd_reward_info_new( &self->reward_info );
24847 0 : }
24848 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, uint varint ) {
24849 0 : (void) varint;
24850 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_rewardinfo_pair", level++, 0 );
24851 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
24852 0 : fd_reward_info_walk( w, &self->reward_info, fun, "reward_info", level, 0 );
24853 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_rewardinfo_pair", level--, 0 );
24854 0 : }
24855 0 : int fd_optional_account_encode( fd_optional_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24856 0 : int err;
24857 0 : if( self->account != NULL ) {
24858 0 : err = fd_bincode_bool_encode( 1, ctx );
24859 0 : if( FD_UNLIKELY( err ) ) return err;
24860 0 : err = fd_solana_account_encode( self->account, ctx );
24861 0 : if( FD_UNLIKELY( err ) ) return err;
24862 0 : } else {
24863 0 : err = fd_bincode_bool_encode( 0, ctx );
24864 0 : if( FD_UNLIKELY( err ) ) return err;
24865 0 : }
24866 0 : return FD_BINCODE_SUCCESS;
24867 0 : }
24868 0 : static int fd_optional_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24869 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24870 0 : int err = 0;
24871 0 : {
24872 0 : uchar o;
24873 0 : err = fd_bincode_bool_decode( &o, ctx );
24874 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24875 0 : if( o ) {
24876 0 : *total_sz += FD_SOLANA_ACCOUNT_ALIGN + sizeof(fd_solana_account_t);
24877 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
24878 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
24879 0 : }
24880 0 : }
24881 0 : return 0;
24882 0 : }
24883 0 : int fd_optional_account_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24884 0 : *total_sz += sizeof(fd_optional_account_t);
24885 0 : void const * start_data = ctx->data;
24886 0 : int err = fd_optional_account_decode_footprint_inner( ctx, total_sz );
24887 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24888 0 : ctx->data = start_data;
24889 0 : return err;
24890 0 : }
24891 0 : static void fd_optional_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24892 0 : fd_optional_account_t * self = (fd_optional_account_t *)struct_mem;
24893 0 : {
24894 0 : uchar o;
24895 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
24896 0 : if( o ) {
24897 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_SOLANA_ACCOUNT_ALIGN );
24898 0 : self->account = *alloc_mem;
24899 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_solana_account_t);
24900 0 : fd_solana_account_new( self->account );
24901 0 : fd_solana_account_decode_inner( self->account, alloc_mem, ctx );
24902 0 : } else {
24903 0 : self->account = NULL;
24904 0 : }
24905 0 : }
24906 0 : }
24907 0 : void * fd_optional_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24908 0 : fd_optional_account_t * self = (fd_optional_account_t *)mem;
24909 0 : fd_optional_account_new( self );
24910 0 : void * alloc_region = (uchar *)mem + sizeof(fd_optional_account_t);
24911 0 : void * * alloc_mem = &alloc_region;
24912 0 : fd_optional_account_decode_inner( mem, alloc_mem, ctx );
24913 0 : return self;
24914 0 : }
24915 0 : void fd_optional_account_new(fd_optional_account_t * self) {
24916 0 : fd_memset( self, 0, sizeof(fd_optional_account_t) );
24917 0 : }
24918 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, uint varint ) {
24919 0 : (void) varint;
24920 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_optional_account", level++, 0 );
24921 0 : if( !self->account ) {
24922 0 : fun( w, NULL, "account", FD_FLAMENCO_TYPE_NULL, "solana_account", level, 0 );
24923 0 : } else {
24924 0 : fd_solana_account_walk( w, self->account, fun, "account", level, 0 );
24925 0 : }
24926 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_optional_account", level--, 0 );
24927 0 : }
24928 0 : ulong fd_optional_account_size( fd_optional_account_t const * self ) {
24929 0 : ulong size = 0;
24930 0 : size += sizeof(char);
24931 0 : if( NULL != self->account ) {
24932 0 : size += fd_solana_account_size( self->account );
24933 0 : }
24934 0 : return size;
24935 0 : }
24936 :
24937 0 : int fd_calculated_stake_points_encode( fd_calculated_stake_points_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24938 0 : int err;
24939 0 : err = fd_bincode_uint128_encode( self->points, ctx );
24940 0 : if( FD_UNLIKELY( err ) ) return err;
24941 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
24942 0 : if( FD_UNLIKELY( err ) ) return err;
24943 0 : err = fd_bincode_uint8_encode( (uchar)(self->force_credits_update_with_skipped_reward), ctx );
24944 0 : if( FD_UNLIKELY( err ) ) return err;
24945 0 : return FD_BINCODE_SUCCESS;
24946 0 : }
24947 0 : static inline int fd_calculated_stake_points_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24948 0 : if( (ulong)ctx->data + 25UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24949 0 : ctx->data = (void *)( (ulong)ctx->data + 25UL );
24950 0 : return 0;
24951 0 : }
24952 0 : static void fd_calculated_stake_points_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24953 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)struct_mem;
24954 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
24955 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
24956 0 : fd_bincode_uint8_decode_unsafe( &self->force_credits_update_with_skipped_reward, ctx );
24957 0 : }
24958 0 : void * fd_calculated_stake_points_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24959 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)mem;
24960 0 : fd_calculated_stake_points_new( self );
24961 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_points_t);
24962 0 : void * * alloc_mem = &alloc_region;
24963 0 : fd_calculated_stake_points_decode_inner( mem, alloc_mem, ctx );
24964 0 : return self;
24965 0 : }
24966 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, uint varint ) {
24967 0 : (void) varint;
24968 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_points", level++, 0 );
24969 0 : fun( w, &self->points, "points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
24970 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
24971 0 : fun( w, &self->force_credits_update_with_skipped_reward, "force_credits_update_with_skipped_reward", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
24972 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_points", level--, 0 );
24973 0 : }
24974 0 : int fd_calculated_stake_rewards_encode( fd_calculated_stake_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
24975 0 : int err;
24976 0 : err = fd_bincode_uint64_encode( self->staker_rewards, ctx );
24977 0 : if( FD_UNLIKELY( err ) ) return err;
24978 0 : err = fd_bincode_uint64_encode( self->voter_rewards, ctx );
24979 0 : if( FD_UNLIKELY( err ) ) return err;
24980 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
24981 0 : if( FD_UNLIKELY( err ) ) return err;
24982 0 : return FD_BINCODE_SUCCESS;
24983 0 : }
24984 0 : static inline int fd_calculated_stake_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
24985 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
24986 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
24987 0 : return 0;
24988 0 : }
24989 0 : static void fd_calculated_stake_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
24990 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)struct_mem;
24991 0 : fd_bincode_uint64_decode_unsafe( &self->staker_rewards, ctx );
24992 0 : fd_bincode_uint64_decode_unsafe( &self->voter_rewards, ctx );
24993 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
24994 0 : }
24995 0 : void * fd_calculated_stake_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
24996 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)mem;
24997 0 : fd_calculated_stake_rewards_new( self );
24998 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_rewards_t);
24999 0 : void * * alloc_mem = &alloc_region;
25000 0 : fd_calculated_stake_rewards_decode_inner( mem, alloc_mem, ctx );
25001 0 : return self;
25002 0 : }
25003 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, uint varint ) {
25004 0 : (void) varint;
25005 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_rewards", level++, 0 );
25006 0 : fun( w, &self->staker_rewards, "staker_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25007 0 : fun( w, &self->voter_rewards, "voter_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25008 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25009 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_rewards", level--, 0 );
25010 0 : }
25011 0 : int fd_duplicate_slot_proof_encode( fd_duplicate_slot_proof_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25012 0 : int err;
25013 0 : err = fd_bincode_uint64_encode( self->shred1_len, ctx );
25014 0 : if( FD_UNLIKELY(err) ) return err;
25015 0 : if( self->shred1_len ) {
25016 0 : err = fd_bincode_bytes_encode( self->shred1, self->shred1_len, ctx );
25017 0 : if( FD_UNLIKELY( err ) ) return err;
25018 0 : }
25019 0 : err = fd_bincode_uint64_encode( self->shred2_len, ctx );
25020 0 : if( FD_UNLIKELY(err) ) return err;
25021 0 : if( self->shred2_len ) {
25022 0 : err = fd_bincode_bytes_encode( self->shred2, self->shred2_len, ctx );
25023 0 : if( FD_UNLIKELY( err ) ) return err;
25024 0 : }
25025 0 : return FD_BINCODE_SUCCESS;
25026 0 : }
25027 0 : static int fd_duplicate_slot_proof_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25028 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25029 0 : int err = 0;
25030 0 : ulong shred1_len;
25031 0 : err = fd_bincode_uint64_decode( &shred1_len, ctx );
25032 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25033 0 : if( shred1_len ) {
25034 0 : *total_sz += 8UL + shred1_len;
25035 0 : err = fd_bincode_bytes_decode_footprint( shred1_len, ctx );
25036 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25037 0 : }
25038 0 : ulong shred2_len;
25039 0 : err = fd_bincode_uint64_decode( &shred2_len, ctx );
25040 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25041 0 : if( shred2_len ) {
25042 0 : *total_sz += 8UL + shred2_len;
25043 0 : err = fd_bincode_bytes_decode_footprint( shred2_len, ctx );
25044 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25045 0 : }
25046 0 : return 0;
25047 0 : }
25048 0 : int fd_duplicate_slot_proof_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25049 0 : *total_sz += sizeof(fd_duplicate_slot_proof_t);
25050 0 : void const * start_data = ctx->data;
25051 0 : int err = fd_duplicate_slot_proof_decode_footprint_inner( ctx, total_sz );
25052 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25053 0 : ctx->data = start_data;
25054 0 : return err;
25055 0 : }
25056 0 : static void fd_duplicate_slot_proof_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25057 0 : fd_duplicate_slot_proof_t * self = (fd_duplicate_slot_proof_t *)struct_mem;
25058 0 : fd_bincode_uint64_decode_unsafe( &self->shred1_len, ctx );
25059 0 : if( self->shred1_len ) {
25060 0 : self->shred1 = *alloc_mem;
25061 0 : fd_bincode_bytes_decode_unsafe( self->shred1, self->shred1_len, ctx );
25062 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred1_len;
25063 0 : } else
25064 0 : self->shred1 = NULL;
25065 0 : fd_bincode_uint64_decode_unsafe( &self->shred2_len, ctx );
25066 0 : if( self->shred2_len ) {
25067 0 : self->shred2 = *alloc_mem;
25068 0 : fd_bincode_bytes_decode_unsafe( self->shred2, self->shred2_len, ctx );
25069 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred2_len;
25070 0 : } else
25071 0 : self->shred2 = NULL;
25072 0 : }
25073 0 : void * fd_duplicate_slot_proof_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25074 0 : fd_duplicate_slot_proof_t * self = (fd_duplicate_slot_proof_t *)mem;
25075 0 : fd_duplicate_slot_proof_new( self );
25076 0 : void * alloc_region = (uchar *)mem + sizeof(fd_duplicate_slot_proof_t);
25077 0 : void * * alloc_mem = &alloc_region;
25078 0 : fd_duplicate_slot_proof_decode_inner( mem, alloc_mem, ctx );
25079 0 : return self;
25080 0 : }
25081 0 : void fd_duplicate_slot_proof_new(fd_duplicate_slot_proof_t * self) {
25082 0 : fd_memset( self, 0, sizeof(fd_duplicate_slot_proof_t) );
25083 0 : }
25084 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, uint varint ) {
25085 0 : (void) varint;
25086 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_duplicate_slot_proof", level++, 0 );
25087 0 : if( self->shred1_len ) {
25088 0 : fun( w, NULL, "shred1", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
25089 0 : for( ulong i=0; i < self->shred1_len; i++ )
25090 0 : fun( w, self->shred1 + i, "shred1", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
25091 0 : fun( w, NULL, "shred1", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
25092 0 : }
25093 0 : if( self->shred2_len ) {
25094 0 : fun( w, NULL, "shred2", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
25095 0 : for( ulong i=0; i < self->shred2_len; i++ )
25096 0 : fun( w, self->shred2 + i, "shred2", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
25097 0 : fun( w, NULL, "shred2", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
25098 0 : }
25099 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_duplicate_slot_proof", level--, 0 );
25100 0 : }
25101 0 : ulong fd_duplicate_slot_proof_size( fd_duplicate_slot_proof_t const * self ) {
25102 0 : ulong size = 0;
25103 0 : do {
25104 0 : size += sizeof(ulong);
25105 0 : size += self->shred1_len;
25106 0 : } while(0);
25107 0 : do {
25108 0 : size += sizeof(ulong);
25109 0 : size += self->shred2_len;
25110 0 : } while(0);
25111 0 : return size;
25112 0 : }
25113 :
25114 0 : int fd_epoch_info_pair_encode( fd_epoch_info_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25115 0 : int err;
25116 0 : err = fd_pubkey_encode( &self->account, ctx );
25117 0 : if( FD_UNLIKELY( err ) ) return err;
25118 0 : err = fd_stake_encode( &self->stake, ctx );
25119 0 : if( FD_UNLIKELY( err ) ) return err;
25120 0 : return FD_BINCODE_SUCCESS;
25121 0 : }
25122 0 : static inline int fd_epoch_info_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25123 0 : if( (ulong)ctx->data + 104UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25124 0 : ctx->data = (void *)( (ulong)ctx->data + 104UL );
25125 0 : return 0;
25126 0 : }
25127 0 : static void fd_epoch_info_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25128 0 : fd_epoch_info_pair_t * self = (fd_epoch_info_pair_t *)struct_mem;
25129 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
25130 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
25131 0 : }
25132 0 : void * fd_epoch_info_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25133 0 : fd_epoch_info_pair_t * self = (fd_epoch_info_pair_t *)mem;
25134 0 : fd_epoch_info_pair_new( self );
25135 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_info_pair_t);
25136 0 : void * * alloc_mem = &alloc_region;
25137 0 : fd_epoch_info_pair_decode_inner( mem, alloc_mem, ctx );
25138 0 : return self;
25139 0 : }
25140 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, uint varint ) {
25141 0 : (void) varint;
25142 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_info_pair", level++, 0 );
25143 0 : fd_pubkey_walk( w, &self->account, fun, "account", level, 0 );
25144 0 : fd_stake_walk( w, &self->stake, fun, "stake", level, 0 );
25145 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_info_pair", level--, 0 );
25146 0 : }
25147 0 : int fd_vote_info_pair_encode( fd_vote_info_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25148 0 : int err;
25149 0 : err = fd_pubkey_encode( &self->account, ctx );
25150 0 : if( FD_UNLIKELY( err ) ) return err;
25151 0 : err = fd_vote_state_versioned_encode( &self->state, ctx );
25152 0 : if( FD_UNLIKELY( err ) ) return err;
25153 0 : return FD_BINCODE_SUCCESS;
25154 0 : }
25155 0 : static int fd_vote_info_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25156 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25157 0 : int err = 0;
25158 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
25159 0 : if( FD_UNLIKELY( err ) ) return err;
25160 0 : err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
25161 0 : if( FD_UNLIKELY( err ) ) return err;
25162 0 : return 0;
25163 0 : }
25164 0 : int fd_vote_info_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25165 0 : *total_sz += sizeof(fd_vote_info_pair_t);
25166 0 : void const * start_data = ctx->data;
25167 0 : int err = fd_vote_info_pair_decode_footprint_inner( ctx, total_sz );
25168 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25169 0 : ctx->data = start_data;
25170 0 : return err;
25171 0 : }
25172 0 : static void fd_vote_info_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25173 0 : fd_vote_info_pair_t * self = (fd_vote_info_pair_t *)struct_mem;
25174 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
25175 0 : fd_vote_state_versioned_decode_inner( &self->state, alloc_mem, ctx );
25176 0 : }
25177 0 : void * fd_vote_info_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25178 0 : fd_vote_info_pair_t * self = (fd_vote_info_pair_t *)mem;
25179 0 : fd_vote_info_pair_new( self );
25180 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_info_pair_t);
25181 0 : void * * alloc_mem = &alloc_region;
25182 0 : fd_vote_info_pair_decode_inner( mem, alloc_mem, ctx );
25183 0 : return self;
25184 0 : }
25185 0 : void fd_vote_info_pair_new(fd_vote_info_pair_t * self) {
25186 0 : fd_memset( self, 0, sizeof(fd_vote_info_pair_t) );
25187 0 : fd_pubkey_new( &self->account );
25188 0 : fd_vote_state_versioned_new( &self->state );
25189 0 : }
25190 0 : void fd_vote_info_pair_walk( void * w, fd_vote_info_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
25191 0 : (void) varint;
25192 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_info_pair", level++, 0 );
25193 0 : fd_pubkey_walk( w, &self->account, fun, "account", level, 0 );
25194 0 : fd_vote_state_versioned_walk( w, &self->state, fun, "state", level, 0 );
25195 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_info_pair", level--, 0 );
25196 0 : }
25197 0 : ulong fd_vote_info_pair_size( fd_vote_info_pair_t const * self ) {
25198 0 : ulong size = 0;
25199 0 : size += fd_pubkey_size( &self->account );
25200 0 : size += fd_vote_state_versioned_size( &self->state );
25201 0 : return size;
25202 0 : }
25203 :
25204 0 : int fd_epoch_info_encode( fd_epoch_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25205 0 : int err;
25206 0 : err = fd_bincode_uint64_encode( self->stake_infos_len, ctx );
25207 0 : if( FD_UNLIKELY(err) ) return err;
25208 0 : if( self->stake_infos_len ) {
25209 0 : for( ulong i=0; i < self->stake_infos_len; i++ ) {
25210 0 : err = fd_epoch_info_pair_encode( self->stake_infos + i, ctx );
25211 0 : if( FD_UNLIKELY( err ) ) return err;
25212 0 : }
25213 0 : }
25214 0 : if( self->vote_states_root ) {
25215 0 : ulong vote_states_len = fd_vote_info_pair_t_map_size( self->vote_states_pool, self->vote_states_root );
25216 0 : err = fd_bincode_uint64_encode( vote_states_len, ctx );
25217 0 : if( FD_UNLIKELY( err ) ) return err;
25218 0 : for( fd_vote_info_pair_t_mapnode_t * n = fd_vote_info_pair_t_map_minimum( self->vote_states_pool, self->vote_states_root ); n; n = fd_vote_info_pair_t_map_successor( self->vote_states_pool, n ) ) {
25219 0 : err = fd_vote_info_pair_encode( &n->elem, ctx );
25220 0 : if( FD_UNLIKELY( err ) ) return err;
25221 0 : }
25222 0 : } else {
25223 0 : ulong vote_states_len = 0;
25224 0 : err = fd_bincode_uint64_encode( vote_states_len, ctx );
25225 0 : if( FD_UNLIKELY( err ) ) return err;
25226 0 : }
25227 0 : err = fd_bincode_uint64_encode( self->stake_infos_new_keys_start_idx, ctx );
25228 0 : if( FD_UNLIKELY( err ) ) return err;
25229 0 : return FD_BINCODE_SUCCESS;
25230 0 : }
25231 0 : static int fd_epoch_info_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25232 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25233 0 : int err = 0;
25234 0 : ulong stake_infos_len;
25235 0 : err = fd_bincode_uint64_decode( &stake_infos_len, ctx );
25236 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25237 0 : if( stake_infos_len ) {
25238 0 : *total_sz += FD_EPOCH_INFO_PAIR_ALIGN + sizeof(fd_epoch_info_pair_t)*stake_infos_len;
25239 0 : for( ulong i=0; i < stake_infos_len; i++ ) {
25240 0 : err = fd_epoch_info_pair_decode_footprint_inner( ctx, total_sz );
25241 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25242 0 : }
25243 0 : }
25244 0 : ulong vote_states_len = 0UL;
25245 0 : err = fd_bincode_uint64_decode( &vote_states_len, ctx );
25246 0 : ulong vote_states_cnt = !!vote_states_len ? vote_states_len : 1;
25247 0 : *total_sz += fd_vote_info_pair_t_map_align() + fd_vote_info_pair_t_map_footprint( vote_states_cnt );
25248 0 : if( FD_UNLIKELY( err ) ) return err;
25249 0 : for( ulong i=0; i < vote_states_len; i++ ) {
25250 0 : err = fd_vote_info_pair_decode_footprint_inner( ctx, total_sz );
25251 0 : if( FD_UNLIKELY( err ) ) return err;
25252 0 : }
25253 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25254 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25255 0 : return 0;
25256 0 : }
25257 0 : int fd_epoch_info_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25258 0 : *total_sz += sizeof(fd_epoch_info_t);
25259 0 : void const * start_data = ctx->data;
25260 0 : int err = fd_epoch_info_decode_footprint_inner( ctx, total_sz );
25261 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25262 0 : ctx->data = start_data;
25263 0 : return err;
25264 0 : }
25265 0 : static void fd_epoch_info_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25266 0 : fd_epoch_info_t * self = (fd_epoch_info_t *)struct_mem;
25267 0 : fd_bincode_uint64_decode_unsafe( &self->stake_infos_len, ctx );
25268 0 : if( self->stake_infos_len ) {
25269 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_EPOCH_INFO_PAIR_ALIGN );
25270 0 : self->stake_infos = *alloc_mem;
25271 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_epoch_info_pair_t)*self->stake_infos_len;
25272 0 : for( ulong i=0; i < self->stake_infos_len; i++ ) {
25273 0 : fd_epoch_info_pair_new( self->stake_infos + i );
25274 0 : fd_epoch_info_pair_decode_inner( self->stake_infos + i, alloc_mem, ctx );
25275 0 : }
25276 0 : } else
25277 0 : self->stake_infos = NULL;
25278 0 : ulong vote_states_len;
25279 0 : fd_bincode_uint64_decode_unsafe( &vote_states_len, ctx );
25280 0 : self->vote_states_pool = fd_vote_info_pair_t_map_join_new( alloc_mem, vote_states_len );
25281 0 : self->vote_states_root = NULL;
25282 0 : for( ulong i=0; i < vote_states_len; i++ ) {
25283 0 : fd_vote_info_pair_t_mapnode_t * node = fd_vote_info_pair_t_map_acquire( self->vote_states_pool );
25284 0 : fd_vote_info_pair_new( &node->elem );
25285 0 : fd_vote_info_pair_decode_inner( &node->elem, alloc_mem, ctx );
25286 0 : fd_vote_info_pair_t_mapnode_t * out = NULL;;
25287 0 : fd_vote_info_pair_t_map_insert_or_replace( self->vote_states_pool, &self->vote_states_root, node, &out );
25288 0 : if( out != NULL ) {
25289 0 : fd_vote_info_pair_t_map_release( self->vote_states_pool, out );
25290 0 : }
25291 0 : }
25292 0 : fd_bincode_uint64_decode_unsafe( &self->stake_infos_new_keys_start_idx, ctx );
25293 0 : }
25294 0 : void * fd_epoch_info_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25295 0 : fd_epoch_info_t * self = (fd_epoch_info_t *)mem;
25296 0 : fd_epoch_info_new( self );
25297 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_info_t);
25298 0 : void * * alloc_mem = &alloc_region;
25299 0 : fd_epoch_info_decode_inner( mem, alloc_mem, ctx );
25300 0 : return self;
25301 0 : }
25302 0 : void fd_epoch_info_new(fd_epoch_info_t * self) {
25303 0 : fd_memset( self, 0, sizeof(fd_epoch_info_t) );
25304 0 : }
25305 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, uint varint ) {
25306 0 : (void) varint;
25307 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_info", level++, 0 );
25308 0 : if( self->stake_infos_len ) {
25309 0 : fun( w, NULL, "stake_infos", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
25310 0 : for( ulong i=0; i < self->stake_infos_len; i++ )
25311 0 : fd_epoch_info_pair_walk(w, self->stake_infos + i, fun, "epoch_info_pair", level, 0 );
25312 0 : fun( w, NULL, "stake_infos", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
25313 0 : }
25314 0 : if( self->vote_states_root ) {
25315 0 : for( fd_vote_info_pair_t_mapnode_t * n = fd_vote_info_pair_t_map_minimum(self->vote_states_pool, self->vote_states_root ); n; n = fd_vote_info_pair_t_map_successor( self->vote_states_pool, n ) ) {
25316 0 : fd_vote_info_pair_walk(w, &n->elem, fun, "vote_states", level, 0 );
25317 0 : }
25318 0 : }
25319 0 : fun( w, &self->stake_infos_new_keys_start_idx, "stake_infos_new_keys_start_idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25320 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_info", level--, 0 );
25321 0 : }
25322 0 : ulong fd_epoch_info_size( fd_epoch_info_t const * self ) {
25323 0 : ulong size = 0;
25324 0 : do {
25325 0 : size += sizeof(ulong);
25326 0 : for( ulong i=0; i < self->stake_infos_len; i++ )
25327 0 : size += fd_epoch_info_pair_size( self->stake_infos + i );
25328 0 : } while(0);
25329 0 : if( self->vote_states_root ) {
25330 0 : size += sizeof(ulong);
25331 0 : ulong max = fd_vote_info_pair_t_map_max( self->vote_states_pool );
25332 0 : size += fd_vote_info_pair_t_map_footprint( max );
25333 0 : for( fd_vote_info_pair_t_mapnode_t * n = fd_vote_info_pair_t_map_minimum( self->vote_states_pool, self->vote_states_root ); n; n = fd_vote_info_pair_t_map_successor( self->vote_states_pool, n ) ) {
25334 0 : size += fd_vote_info_pair_size( &n->elem ) - sizeof(fd_vote_info_pair_t);
25335 0 : }
25336 0 : } else {
25337 0 : size += sizeof(ulong);
25338 0 : }
25339 0 : size += sizeof(ulong);
25340 0 : return size;
25341 0 : }
25342 :
25343 0 : int fd_usage_cost_details_encode( fd_usage_cost_details_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25344 0 : int err;
25345 0 : err = fd_bincode_uint64_encode( self->signature_cost, ctx );
25346 0 : if( FD_UNLIKELY( err ) ) return err;
25347 0 : err = fd_bincode_uint64_encode( self->write_lock_cost, ctx );
25348 0 : if( FD_UNLIKELY( err ) ) return err;
25349 0 : err = fd_bincode_uint64_encode( self->data_bytes_cost, ctx );
25350 0 : if( FD_UNLIKELY( err ) ) return err;
25351 0 : err = fd_bincode_uint64_encode( self->programs_execution_cost, ctx );
25352 0 : if( FD_UNLIKELY( err ) ) return err;
25353 0 : err = fd_bincode_uint64_encode( self->loaded_accounts_data_size_cost, ctx );
25354 0 : if( FD_UNLIKELY( err ) ) return err;
25355 0 : err = fd_bincode_uint64_encode( self->allocated_accounts_data_size, ctx );
25356 0 : if( FD_UNLIKELY( err ) ) return err;
25357 0 : return FD_BINCODE_SUCCESS;
25358 0 : }
25359 0 : static inline int fd_usage_cost_details_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25360 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25361 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
25362 0 : return 0;
25363 0 : }
25364 0 : static void fd_usage_cost_details_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25365 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)struct_mem;
25366 0 : fd_bincode_uint64_decode_unsafe( &self->signature_cost, ctx );
25367 0 : fd_bincode_uint64_decode_unsafe( &self->write_lock_cost, ctx );
25368 0 : fd_bincode_uint64_decode_unsafe( &self->data_bytes_cost, ctx );
25369 0 : fd_bincode_uint64_decode_unsafe( &self->programs_execution_cost, ctx );
25370 0 : fd_bincode_uint64_decode_unsafe( &self->loaded_accounts_data_size_cost, ctx );
25371 0 : fd_bincode_uint64_decode_unsafe( &self->allocated_accounts_data_size, ctx );
25372 0 : }
25373 0 : void * fd_usage_cost_details_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25374 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)mem;
25375 0 : fd_usage_cost_details_new( self );
25376 0 : void * alloc_region = (uchar *)mem + sizeof(fd_usage_cost_details_t);
25377 0 : void * * alloc_mem = &alloc_region;
25378 0 : fd_usage_cost_details_decode_inner( mem, alloc_mem, ctx );
25379 0 : return self;
25380 0 : }
25381 0 : void fd_usage_cost_details_walk( void * w, fd_usage_cost_details_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
25382 0 : (void) varint;
25383 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_usage_cost_details", level++, 0 );
25384 0 : fun( w, &self->signature_cost, "signature_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25385 0 : fun( w, &self->write_lock_cost, "write_lock_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25386 0 : fun( w, &self->data_bytes_cost, "data_bytes_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25387 0 : fun( w, &self->programs_execution_cost, "programs_execution_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25388 0 : fun( w, &self->loaded_accounts_data_size_cost, "loaded_accounts_data_size_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25389 0 : fun( w, &self->allocated_accounts_data_size, "allocated_accounts_data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25390 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_usage_cost_details", level--, 0 );
25391 0 : }
25392 0 : FD_FN_PURE uchar fd_transaction_cost_is_simple_vote(fd_transaction_cost_t const * self) {
25393 0 : return self->discriminant == 0;
25394 0 : }
25395 0 : FD_FN_PURE uchar fd_transaction_cost_is_transaction(fd_transaction_cost_t const * self) {
25396 0 : return self->discriminant == 1;
25397 0 : }
25398 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant );
25399 0 : int fd_transaction_cost_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25400 0 : int err;
25401 0 : switch (discriminant) {
25402 0 : case 0: {
25403 0 : return FD_BINCODE_SUCCESS;
25404 0 : }
25405 0 : case 1: {
25406 0 : err = fd_usage_cost_details_decode_footprint_inner( ctx, total_sz );
25407 0 : if( FD_UNLIKELY( err ) ) return err;
25408 0 : return FD_BINCODE_SUCCESS;
25409 0 : }
25410 0 : default: return FD_BINCODE_ERR_ENCODING;
25411 0 : }
25412 0 : }
25413 0 : static int fd_transaction_cost_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25414 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25415 0 : uint discriminant = 0;
25416 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
25417 0 : if( FD_UNLIKELY( err ) ) return err;
25418 0 : return fd_transaction_cost_inner_decode_footprint( discriminant, ctx, total_sz );
25419 0 : }
25420 0 : int fd_transaction_cost_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25421 0 : *total_sz += sizeof(fd_transaction_cost_t);
25422 0 : void const * start_data = ctx->data;
25423 0 : int err = fd_transaction_cost_decode_footprint_inner( ctx, total_sz );
25424 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25425 0 : ctx->data = start_data;
25426 0 : return err;
25427 0 : }
25428 0 : static void fd_transaction_cost_inner_decode_inner( fd_transaction_cost_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
25429 0 : switch (discriminant) {
25430 0 : case 0: {
25431 0 : break;
25432 0 : }
25433 0 : case 1: {
25434 0 : fd_usage_cost_details_decode_inner( &self->transaction, alloc_mem, ctx );
25435 0 : break;
25436 0 : }
25437 0 : }
25438 0 : }
25439 0 : static void fd_transaction_cost_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25440 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)struct_mem;
25441 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
25442 0 : fd_transaction_cost_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
25443 0 : }
25444 0 : void * fd_transaction_cost_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25445 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)mem;
25446 0 : fd_transaction_cost_new( self );
25447 0 : void * alloc_region = (uchar *)mem + sizeof(fd_transaction_cost_t);
25448 0 : void * * alloc_mem = &alloc_region;
25449 0 : fd_transaction_cost_decode_inner( mem, alloc_mem, ctx );
25450 0 : return self;
25451 0 : }
25452 0 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant ) {
25453 0 : switch( discriminant ) {
25454 0 : case 0: {
25455 0 : break;
25456 0 : }
25457 0 : case 1: {
25458 0 : fd_usage_cost_details_new( &self->transaction );
25459 0 : break;
25460 0 : }
25461 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
25462 0 : }
25463 0 : }
25464 0 : void fd_transaction_cost_new_disc( fd_transaction_cost_t * self, uint discriminant ) {
25465 0 : self->discriminant = discriminant;
25466 0 : fd_transaction_cost_inner_new( &self->inner, self->discriminant );
25467 0 : }
25468 0 : void fd_transaction_cost_new( fd_transaction_cost_t * self ) {
25469 0 : fd_memset( self, 0, sizeof(fd_transaction_cost_t) );
25470 0 : fd_transaction_cost_new_disc( self, UINT_MAX );
25471 0 : }
25472 :
25473 0 : void fd_transaction_cost_walk( void * w, fd_transaction_cost_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
25474 0 : (void) varint;
25475 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_transaction_cost", level++, 0);
25476 0 : switch( self->discriminant ) {
25477 0 : case 0: {
25478 0 : fun( w, self, "simple_vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
25479 0 : break;
25480 0 : }
25481 0 : case 1: {
25482 0 : fun( w, self, "transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
25483 0 : fd_usage_cost_details_walk( w, &self->inner.transaction, fun, "transaction", level, 0 );
25484 0 : break;
25485 0 : }
25486 0 : }
25487 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_transaction_cost", level--, 0 );
25488 0 : }
25489 0 : ulong fd_transaction_cost_size( fd_transaction_cost_t const * self ) {
25490 0 : ulong size = 0;
25491 0 : size += sizeof(uint);
25492 0 : switch (self->discriminant) {
25493 0 : case 1: {
25494 0 : size += fd_usage_cost_details_size( &self->inner.transaction );
25495 0 : break;
25496 0 : }
25497 0 : }
25498 0 : return size;
25499 0 : }
25500 :
25501 0 : int fd_transaction_cost_inner_encode( fd_transaction_cost_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
25502 0 : int err;
25503 0 : switch (discriminant) {
25504 0 : case 1: {
25505 0 : err = fd_usage_cost_details_encode( &self->transaction, ctx );
25506 0 : if( FD_UNLIKELY( err ) ) return err;
25507 0 : break;
25508 0 : }
25509 0 : }
25510 0 : return FD_BINCODE_SUCCESS;
25511 0 : }
25512 0 : int fd_transaction_cost_encode( fd_transaction_cost_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25513 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
25514 0 : if( FD_UNLIKELY( err ) ) return err;
25515 0 : return fd_transaction_cost_inner_encode( &self->inner, self->discriminant, ctx );
25516 0 : }
25517 :
25518 0 : int fd_account_costs_pair_encode( fd_account_costs_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25519 0 : int err;
25520 0 : err = fd_pubkey_encode( &self->key, ctx );
25521 0 : if( FD_UNLIKELY( err ) ) return err;
25522 0 : err = fd_bincode_uint64_encode( self->cost, ctx );
25523 0 : if( FD_UNLIKELY( err ) ) return err;
25524 0 : return FD_BINCODE_SUCCESS;
25525 0 : }
25526 0 : static inline int fd_account_costs_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25527 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25528 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
25529 0 : return 0;
25530 0 : }
25531 0 : static void fd_account_costs_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25532 0 : fd_account_costs_pair_t * self = (fd_account_costs_pair_t *)struct_mem;
25533 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
25534 0 : fd_bincode_uint64_decode_unsafe( &self->cost, ctx );
25535 0 : }
25536 0 : void * fd_account_costs_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25537 0 : fd_account_costs_pair_t * self = (fd_account_costs_pair_t *)mem;
25538 0 : fd_account_costs_pair_new( self );
25539 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_costs_pair_t);
25540 0 : void * * alloc_mem = &alloc_region;
25541 0 : fd_account_costs_pair_decode_inner( mem, alloc_mem, ctx );
25542 0 : return self;
25543 0 : }
25544 0 : void fd_account_costs_pair_walk( void * w, fd_account_costs_pair_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
25545 0 : (void) varint;
25546 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_account_costs_pair", level++, 0 );
25547 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
25548 0 : fun( w, &self->cost, "cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25549 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_account_costs_pair", level--, 0 );
25550 0 : }
25551 0 : int fd_account_costs_encode( fd_account_costs_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25552 0 : int err;
25553 0 : if( self->account_costs_root ) {
25554 0 : ulong account_costs_len = fd_account_costs_pair_t_map_size( self->account_costs_pool, self->account_costs_root );
25555 0 : err = fd_bincode_uint64_encode( account_costs_len, ctx );
25556 0 : if( FD_UNLIKELY( err ) ) return err;
25557 0 : for( fd_account_costs_pair_t_mapnode_t * n = fd_account_costs_pair_t_map_minimum( self->account_costs_pool, self->account_costs_root ); n; n = fd_account_costs_pair_t_map_successor( self->account_costs_pool, n ) ) {
25558 0 : err = fd_account_costs_pair_encode( &n->elem, ctx );
25559 0 : if( FD_UNLIKELY( err ) ) return err;
25560 0 : }
25561 0 : } else {
25562 0 : ulong account_costs_len = 0;
25563 0 : err = fd_bincode_uint64_encode( account_costs_len, ctx );
25564 0 : if( FD_UNLIKELY( err ) ) return err;
25565 0 : }
25566 0 : return FD_BINCODE_SUCCESS;
25567 0 : }
25568 0 : static int fd_account_costs_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25569 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25570 0 : int err = 0;
25571 0 : ulong account_costs_len = 0UL;
25572 0 : err = fd_bincode_uint64_decode( &account_costs_len, ctx );
25573 0 : ulong account_costs_cnt = fd_ulong_max( account_costs_len, 4096 );
25574 0 : *total_sz += fd_account_costs_pair_t_map_align() + fd_account_costs_pair_t_map_footprint( account_costs_cnt );
25575 0 : if( FD_UNLIKELY( err ) ) return err;
25576 0 : for( ulong i=0; i < account_costs_len; i++ ) {
25577 0 : err = fd_account_costs_pair_decode_footprint_inner( ctx, total_sz );
25578 0 : if( FD_UNLIKELY( err ) ) return err;
25579 0 : }
25580 0 : return 0;
25581 0 : }
25582 0 : int fd_account_costs_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25583 0 : *total_sz += sizeof(fd_account_costs_t);
25584 0 : void const * start_data = ctx->data;
25585 0 : int err = fd_account_costs_decode_footprint_inner( ctx, total_sz );
25586 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25587 0 : ctx->data = start_data;
25588 0 : return err;
25589 0 : }
25590 0 : static void fd_account_costs_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25591 0 : fd_account_costs_t * self = (fd_account_costs_t *)struct_mem;
25592 0 : ulong account_costs_len;
25593 0 : fd_bincode_uint64_decode_unsafe( &account_costs_len, ctx );
25594 0 : self->account_costs_pool = fd_account_costs_pair_t_map_join_new( alloc_mem, fd_ulong_max( account_costs_len, 4096 ) );
25595 0 : self->account_costs_root = NULL;
25596 0 : for( ulong i=0; i < account_costs_len; i++ ) {
25597 0 : fd_account_costs_pair_t_mapnode_t * node = fd_account_costs_pair_t_map_acquire( self->account_costs_pool );
25598 0 : fd_account_costs_pair_new( &node->elem );
25599 0 : fd_account_costs_pair_decode_inner( &node->elem, alloc_mem, ctx );
25600 0 : fd_account_costs_pair_t_mapnode_t * out = NULL;;
25601 0 : fd_account_costs_pair_t_map_insert_or_replace( self->account_costs_pool, &self->account_costs_root, node, &out );
25602 0 : if( out != NULL ) {
25603 0 : fd_account_costs_pair_t_map_release( self->account_costs_pool, out );
25604 0 : }
25605 0 : }
25606 0 : }
25607 0 : void * fd_account_costs_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25608 0 : fd_account_costs_t * self = (fd_account_costs_t *)mem;
25609 0 : fd_account_costs_new( self );
25610 0 : void * alloc_region = (uchar *)mem + sizeof(fd_account_costs_t);
25611 0 : void * * alloc_mem = &alloc_region;
25612 0 : fd_account_costs_decode_inner( mem, alloc_mem, ctx );
25613 0 : return self;
25614 0 : }
25615 0 : void fd_account_costs_new(fd_account_costs_t * self) {
25616 0 : fd_memset( self, 0, sizeof(fd_account_costs_t) );
25617 0 : }
25618 0 : void fd_account_costs_walk( void * w, fd_account_costs_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
25619 0 : (void) varint;
25620 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_account_costs", level++, 0 );
25621 0 : if( self->account_costs_root ) {
25622 0 : for( fd_account_costs_pair_t_mapnode_t * n = fd_account_costs_pair_t_map_minimum(self->account_costs_pool, self->account_costs_root ); n; n = fd_account_costs_pair_t_map_successor( self->account_costs_pool, n ) ) {
25623 0 : fd_account_costs_pair_walk(w, &n->elem, fun, "account_costs", level, 0 );
25624 0 : }
25625 0 : }
25626 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_account_costs", level--, 0 );
25627 0 : }
25628 0 : ulong fd_account_costs_size( fd_account_costs_t const * self ) {
25629 0 : ulong size = 0;
25630 0 : if( self->account_costs_root ) {
25631 0 : size += sizeof(ulong);
25632 0 : ulong max = fd_account_costs_pair_t_map_max( self->account_costs_pool );
25633 0 : size += fd_account_costs_pair_t_map_footprint( max );
25634 0 : for( fd_account_costs_pair_t_mapnode_t * n = fd_account_costs_pair_t_map_minimum( self->account_costs_pool, self->account_costs_root ); n; n = fd_account_costs_pair_t_map_successor( self->account_costs_pool, n ) ) {
25635 0 : size += fd_account_costs_pair_size( &n->elem ) - sizeof(fd_account_costs_pair_t);
25636 0 : }
25637 0 : } else {
25638 0 : size += sizeof(ulong);
25639 0 : }
25640 0 : return size;
25641 0 : }
25642 :
25643 0 : int fd_cost_tracker_encode( fd_cost_tracker_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25644 0 : int err;
25645 0 : err = fd_bincode_uint64_encode( self->account_cost_limit, ctx );
25646 0 : if( FD_UNLIKELY( err ) ) return err;
25647 0 : err = fd_bincode_uint64_encode( self->block_cost_limit, ctx );
25648 0 : if( FD_UNLIKELY( err ) ) return err;
25649 0 : err = fd_bincode_uint64_encode( self->vote_cost_limit, ctx );
25650 0 : if( FD_UNLIKELY( err ) ) return err;
25651 0 : err = fd_account_costs_encode( &self->cost_by_writable_accounts, ctx );
25652 0 : if( FD_UNLIKELY( err ) ) return err;
25653 0 : err = fd_bincode_uint64_encode( self->block_cost, ctx );
25654 0 : if( FD_UNLIKELY( err ) ) return err;
25655 0 : err = fd_bincode_uint64_encode( self->vote_cost, ctx );
25656 0 : if( FD_UNLIKELY( err ) ) return err;
25657 0 : err = fd_bincode_uint64_encode( self->transaction_count, ctx );
25658 0 : if( FD_UNLIKELY( err ) ) return err;
25659 0 : err = fd_bincode_uint64_encode( self->allocated_accounts_data_size, ctx );
25660 0 : if( FD_UNLIKELY( err ) ) return err;
25661 0 : err = fd_bincode_uint64_encode( self->transaction_signature_count, ctx );
25662 0 : if( FD_UNLIKELY( err ) ) return err;
25663 0 : err = fd_bincode_uint64_encode( self->secp256k1_instruction_signature_count, ctx );
25664 0 : if( FD_UNLIKELY( err ) ) return err;
25665 0 : err = fd_bincode_uint64_encode( self->ed25519_instruction_signature_count, ctx );
25666 0 : if( FD_UNLIKELY( err ) ) return err;
25667 0 : err = fd_bincode_uint64_encode( self->secp256r1_instruction_signature_count, ctx );
25668 0 : if( FD_UNLIKELY( err ) ) return err;
25669 0 : return FD_BINCODE_SUCCESS;
25670 0 : }
25671 0 : static int fd_cost_tracker_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25672 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25673 0 : int err = 0;
25674 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25675 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25676 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25677 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25678 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25679 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25680 0 : err = fd_account_costs_decode_footprint_inner( ctx, total_sz );
25681 0 : if( FD_UNLIKELY( err ) ) return err;
25682 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25683 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25684 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25685 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25686 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25687 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25688 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25689 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25690 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25691 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25692 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25693 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25694 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25695 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25696 0 : err = fd_bincode_uint64_decode_footprint( ctx );
25697 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
25698 0 : return 0;
25699 0 : }
25700 0 : int fd_cost_tracker_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25701 0 : *total_sz += sizeof(fd_cost_tracker_t);
25702 0 : void const * start_data = ctx->data;
25703 0 : int err = fd_cost_tracker_decode_footprint_inner( ctx, total_sz );
25704 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25705 0 : ctx->data = start_data;
25706 0 : return err;
25707 0 : }
25708 0 : static void fd_cost_tracker_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25709 0 : fd_cost_tracker_t * self = (fd_cost_tracker_t *)struct_mem;
25710 0 : fd_bincode_uint64_decode_unsafe( &self->account_cost_limit, ctx );
25711 0 : fd_bincode_uint64_decode_unsafe( &self->block_cost_limit, ctx );
25712 0 : fd_bincode_uint64_decode_unsafe( &self->vote_cost_limit, ctx );
25713 0 : fd_account_costs_decode_inner( &self->cost_by_writable_accounts, alloc_mem, ctx );
25714 0 : fd_bincode_uint64_decode_unsafe( &self->block_cost, ctx );
25715 0 : fd_bincode_uint64_decode_unsafe( &self->vote_cost, ctx );
25716 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_count, ctx );
25717 0 : fd_bincode_uint64_decode_unsafe( &self->allocated_accounts_data_size, ctx );
25718 0 : fd_bincode_uint64_decode_unsafe( &self->transaction_signature_count, ctx );
25719 0 : fd_bincode_uint64_decode_unsafe( &self->secp256k1_instruction_signature_count, ctx );
25720 0 : fd_bincode_uint64_decode_unsafe( &self->ed25519_instruction_signature_count, ctx );
25721 0 : fd_bincode_uint64_decode_unsafe( &self->secp256r1_instruction_signature_count, ctx );
25722 0 : }
25723 0 : void * fd_cost_tracker_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25724 0 : fd_cost_tracker_t * self = (fd_cost_tracker_t *)mem;
25725 0 : fd_cost_tracker_new( self );
25726 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cost_tracker_t);
25727 0 : void * * alloc_mem = &alloc_region;
25728 0 : fd_cost_tracker_decode_inner( mem, alloc_mem, ctx );
25729 0 : return self;
25730 0 : }
25731 0 : void fd_cost_tracker_new(fd_cost_tracker_t * self) {
25732 0 : fd_memset( self, 0, sizeof(fd_cost_tracker_t) );
25733 0 : fd_account_costs_new( &self->cost_by_writable_accounts );
25734 0 : }
25735 0 : void fd_cost_tracker_walk( void * w, fd_cost_tracker_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
25736 0 : (void) varint;
25737 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cost_tracker", level++, 0 );
25738 0 : fun( w, &self->account_cost_limit, "account_cost_limit", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25739 0 : fun( w, &self->block_cost_limit, "block_cost_limit", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25740 0 : fun( w, &self->vote_cost_limit, "vote_cost_limit", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25741 0 : fd_account_costs_walk( w, &self->cost_by_writable_accounts, fun, "cost_by_writable_accounts", level, 0 );
25742 0 : fun( w, &self->block_cost, "block_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25743 0 : fun( w, &self->vote_cost, "vote_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25744 0 : fun( w, &self->transaction_count, "transaction_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25745 0 : fun( w, &self->allocated_accounts_data_size, "allocated_accounts_data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25746 0 : fun( w, &self->transaction_signature_count, "transaction_signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25747 0 : fun( w, &self->secp256k1_instruction_signature_count, "secp256k1_instruction_signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25748 0 : fun( w, &self->ed25519_instruction_signature_count, "ed25519_instruction_signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25749 0 : fun( w, &self->secp256r1_instruction_signature_count, "secp256r1_instruction_signature_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25750 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cost_tracker", level--, 0 );
25751 0 : }
25752 0 : ulong fd_cost_tracker_size( fd_cost_tracker_t const * self ) {
25753 0 : ulong size = 0;
25754 0 : size += sizeof(ulong);
25755 0 : size += sizeof(ulong);
25756 0 : size += sizeof(ulong);
25757 0 : size += fd_account_costs_size( &self->cost_by_writable_accounts );
25758 0 : size += sizeof(ulong);
25759 0 : size += sizeof(ulong);
25760 0 : size += sizeof(ulong);
25761 0 : size += sizeof(ulong);
25762 0 : size += sizeof(ulong);
25763 0 : size += sizeof(ulong);
25764 0 : size += sizeof(ulong);
25765 0 : size += sizeof(ulong);
25766 0 : return size;
25767 0 : }
25768 :
25769 0 : int fd_rent_paying_encode( fd_rent_paying_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25770 0 : int err;
25771 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
25772 0 : if( FD_UNLIKELY( err ) ) return err;
25773 0 : err = fd_bincode_uint64_encode( self->data_size, ctx );
25774 0 : if( FD_UNLIKELY( err ) ) return err;
25775 0 : return FD_BINCODE_SUCCESS;
25776 0 : }
25777 0 : static inline int fd_rent_paying_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25778 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25779 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
25780 0 : return 0;
25781 0 : }
25782 0 : static void fd_rent_paying_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25783 0 : fd_rent_paying_t * self = (fd_rent_paying_t *)struct_mem;
25784 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
25785 0 : fd_bincode_uint64_decode_unsafe( &self->data_size, ctx );
25786 0 : }
25787 0 : void * fd_rent_paying_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25788 0 : fd_rent_paying_t * self = (fd_rent_paying_t *)mem;
25789 0 : fd_rent_paying_new( self );
25790 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_paying_t);
25791 0 : void * * alloc_mem = &alloc_region;
25792 0 : fd_rent_paying_decode_inner( mem, alloc_mem, ctx );
25793 0 : return self;
25794 0 : }
25795 0 : void fd_rent_paying_walk( void * w, fd_rent_paying_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
25796 0 : (void) varint;
25797 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_paying", level++, 0 );
25798 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25799 0 : fun( w, &self->data_size, "data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
25800 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_paying", level--, 0 );
25801 0 : }
25802 0 : FD_FN_PURE uchar fd_rent_state_is_uninitialized(fd_rent_state_t const * self) {
25803 0 : return self->discriminant == 0;
25804 0 : }
25805 0 : FD_FN_PURE uchar fd_rent_state_is_rent_paying(fd_rent_state_t const * self) {
25806 0 : return self->discriminant == 1;
25807 0 : }
25808 0 : FD_FN_PURE uchar fd_rent_state_is_rent_exempt(fd_rent_state_t const * self) {
25809 0 : return self->discriminant == 2;
25810 0 : }
25811 : void fd_rent_state_inner_new( fd_rent_state_inner_t * self, uint discriminant );
25812 0 : int fd_rent_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25813 0 : int err;
25814 0 : switch (discriminant) {
25815 0 : case 0: {
25816 0 : return FD_BINCODE_SUCCESS;
25817 0 : }
25818 0 : case 1: {
25819 0 : err = fd_rent_paying_decode_footprint_inner( ctx, total_sz );
25820 0 : if( FD_UNLIKELY( err ) ) return err;
25821 0 : return FD_BINCODE_SUCCESS;
25822 0 : }
25823 0 : case 2: {
25824 0 : return FD_BINCODE_SUCCESS;
25825 0 : }
25826 0 : default: return FD_BINCODE_ERR_ENCODING;
25827 0 : }
25828 0 : }
25829 0 : static int fd_rent_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25830 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25831 0 : uint discriminant = 0;
25832 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
25833 0 : if( FD_UNLIKELY( err ) ) return err;
25834 0 : return fd_rent_state_inner_decode_footprint( discriminant, ctx, total_sz );
25835 0 : }
25836 0 : int fd_rent_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
25837 0 : *total_sz += sizeof(fd_rent_state_t);
25838 0 : void const * start_data = ctx->data;
25839 0 : int err = fd_rent_state_decode_footprint_inner( ctx, total_sz );
25840 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
25841 0 : ctx->data = start_data;
25842 0 : return err;
25843 0 : }
25844 0 : static void fd_rent_state_inner_decode_inner( fd_rent_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
25845 0 : switch (discriminant) {
25846 0 : case 0: {
25847 0 : break;
25848 0 : }
25849 0 : case 1: {
25850 0 : fd_rent_paying_decode_inner( &self->rent_paying, alloc_mem, ctx );
25851 0 : break;
25852 0 : }
25853 0 : case 2: {
25854 0 : break;
25855 0 : }
25856 0 : }
25857 0 : }
25858 0 : static void fd_rent_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
25859 0 : fd_rent_state_t * self = (fd_rent_state_t *)struct_mem;
25860 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
25861 0 : fd_rent_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
25862 0 : }
25863 0 : void * fd_rent_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
25864 0 : fd_rent_state_t * self = (fd_rent_state_t *)mem;
25865 0 : fd_rent_state_new( self );
25866 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_state_t);
25867 0 : void * * alloc_mem = &alloc_region;
25868 0 : fd_rent_state_decode_inner( mem, alloc_mem, ctx );
25869 0 : return self;
25870 0 : }
25871 0 : void fd_rent_state_inner_new( fd_rent_state_inner_t * self, uint discriminant ) {
25872 0 : switch( discriminant ) {
25873 0 : case 0: {
25874 0 : break;
25875 0 : }
25876 0 : case 1: {
25877 0 : fd_rent_paying_new( &self->rent_paying );
25878 0 : break;
25879 0 : }
25880 0 : case 2: {
25881 0 : break;
25882 0 : }
25883 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
25884 0 : }
25885 0 : }
25886 0 : void fd_rent_state_new_disc( fd_rent_state_t * self, uint discriminant ) {
25887 0 : self->discriminant = discriminant;
25888 0 : fd_rent_state_inner_new( &self->inner, self->discriminant );
25889 0 : }
25890 0 : void fd_rent_state_new( fd_rent_state_t * self ) {
25891 0 : fd_memset( self, 0, sizeof(fd_rent_state_t) );
25892 0 : fd_rent_state_new_disc( self, UINT_MAX );
25893 0 : }
25894 :
25895 0 : void fd_rent_state_walk( void * w, fd_rent_state_t const * self, fd_types_walk_fn_t fun, const char *name, uint level, uint varint ) {
25896 0 : (void) varint;
25897 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_rent_state", level++, 0);
25898 0 : switch( self->discriminant ) {
25899 0 : case 0: {
25900 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
25901 0 : break;
25902 0 : }
25903 0 : case 1: {
25904 0 : fun( w, self, "rent_paying", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
25905 0 : fd_rent_paying_walk( w, &self->inner.rent_paying, fun, "rent_paying", level, 0 );
25906 0 : break;
25907 0 : }
25908 0 : case 2: {
25909 0 : fun( w, self, "rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
25910 0 : break;
25911 0 : }
25912 0 : }
25913 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_rent_state", level--, 0 );
25914 0 : }
25915 0 : ulong fd_rent_state_size( fd_rent_state_t const * self ) {
25916 0 : ulong size = 0;
25917 0 : size += sizeof(uint);
25918 0 : switch (self->discriminant) {
25919 0 : case 1: {
25920 0 : size += fd_rent_paying_size( &self->inner.rent_paying );
25921 0 : break;
25922 0 : }
25923 0 : }
25924 0 : return size;
25925 0 : }
25926 :
25927 0 : int fd_rent_state_inner_encode( fd_rent_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
25928 0 : int err;
25929 0 : switch (discriminant) {
25930 0 : case 1: {
25931 0 : err = fd_rent_paying_encode( &self->rent_paying, ctx );
25932 0 : if( FD_UNLIKELY( err ) ) return err;
25933 0 : break;
25934 0 : }
25935 0 : }
25936 0 : return FD_BINCODE_SUCCESS;
25937 0 : }
25938 0 : int fd_rent_state_encode( fd_rent_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
25939 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
25940 0 : if( FD_UNLIKELY( err ) ) return err;
25941 0 : return fd_rent_state_inner_encode( &self->inner, self->discriminant, ctx );
25942 0 : }
25943 :
25944 0 : #define REDBLK_T fd_vote_accounts_pair_t_mapnode_t
25945 : #define REDBLK_NAME fd_vote_accounts_pair_t_map
25946 : #define REDBLK_IMPL_STYLE 2
25947 : #include "../../util/tmpl/fd_redblack.c"
25948 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 ) {
25949 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
25950 0 : }
25951 0 : #define REDBLK_T fd_vote_accounts_pair_global_t_mapnode_t
25952 : #define REDBLK_NAME fd_vote_accounts_pair_global_t_map
25953 : #define REDBLK_IMPL_STYLE 2
25954 : #include "../../util/tmpl/fd_redblack.c"
25955 0 : long fd_vote_accounts_pair_global_t_map_compare( fd_vote_accounts_pair_global_t_mapnode_t * left, fd_vote_accounts_pair_global_t_mapnode_t * right ) {
25956 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
25957 0 : }
25958 0 : #define REDBLK_T fd_account_keys_pair_t_mapnode_t
25959 : #define REDBLK_NAME fd_account_keys_pair_t_map
25960 : #define REDBLK_IMPL_STYLE 2
25961 : #include "../../util/tmpl/fd_redblack.c"
25962 0 : long fd_account_keys_pair_t_map_compare( fd_account_keys_pair_t_mapnode_t * left, fd_account_keys_pair_t_mapnode_t * right ) {
25963 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
25964 0 : }
25965 0 : #define REDBLK_T fd_delegation_pair_t_mapnode_t
25966 : #define REDBLK_NAME fd_delegation_pair_t_map
25967 : #define REDBLK_IMPL_STYLE 2
25968 : #include "../../util/tmpl/fd_redblack.c"
25969 0 : long fd_delegation_pair_t_map_compare( fd_delegation_pair_t_mapnode_t * left, fd_delegation_pair_t_mapnode_t * right ) {
25970 0 : return memcmp( left->elem.account.uc, right->elem.account.uc, sizeof(right->elem.account) );
25971 0 : }
25972 0 : #define REDBLK_T fd_stake_pair_t_mapnode_t
25973 : #define REDBLK_NAME fd_stake_pair_t_map
25974 : #define REDBLK_IMPL_STYLE 2
25975 : #include "../../util/tmpl/fd_redblack.c"
25976 0 : long fd_stake_pair_t_map_compare( fd_stake_pair_t_mapnode_t * left, fd_stake_pair_t_mapnode_t * right ) {
25977 0 : return memcmp( left->elem.account.uc, right->elem.account.uc, sizeof(right->elem.account) );
25978 0 : }
25979 0 : #define REDBLK_T fd_pubkey_node_vote_accounts_pair_t_mapnode_t
25980 : #define REDBLK_NAME fd_pubkey_node_vote_accounts_pair_t_map
25981 : #define REDBLK_IMPL_STYLE 2
25982 : #include "../../util/tmpl/fd_redblack.c"
25983 0 : long fd_pubkey_node_vote_accounts_pair_t_map_compare( fd_pubkey_node_vote_accounts_pair_t_mapnode_t * left, fd_pubkey_node_vote_accounts_pair_t_mapnode_t * right ) {
25984 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
25985 0 : }
25986 0 : #define REDBLK_T fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t
25987 : #define REDBLK_NAME fd_pubkey_node_vote_accounts_pair_global_t_map
25988 : #define REDBLK_IMPL_STYLE 2
25989 : #include "../../util/tmpl/fd_redblack.c"
25990 0 : long fd_pubkey_node_vote_accounts_pair_global_t_map_compare( fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * left, fd_pubkey_node_vote_accounts_pair_global_t_mapnode_t * right ) {
25991 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
25992 0 : }
25993 0 : #define REDBLK_T fd_pubkey_pubkey_pair_t_mapnode_t
25994 : #define REDBLK_NAME fd_pubkey_pubkey_pair_t_map
25995 : #define REDBLK_IMPL_STYLE 2
25996 : #include "../../util/tmpl/fd_redblack.c"
25997 0 : long fd_pubkey_pubkey_pair_t_map_compare( fd_pubkey_pubkey_pair_t_mapnode_t * left, fd_pubkey_pubkey_pair_t_mapnode_t * right ) {
25998 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
25999 0 : }
26000 0 : #define REDBLK_T fd_clock_timestamp_vote_t_mapnode_t
26001 : #define REDBLK_NAME fd_clock_timestamp_vote_t_map
26002 : #define REDBLK_IMPL_STYLE 2
26003 : #include "../../util/tmpl/fd_redblack.c"
26004 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 ) {
26005 0 : return memcmp( left->elem.pubkey.uc, right->elem.pubkey.uc, sizeof(right->elem.pubkey) );
26006 0 : }
26007 0 : #define REDBLK_T fd_vote_reward_t_mapnode_t
26008 : #define REDBLK_NAME fd_vote_reward_t_map
26009 : #define REDBLK_IMPL_STYLE 2
26010 : #include "../../util/tmpl/fd_redblack.c"
26011 0 : long fd_vote_reward_t_map_compare( fd_vote_reward_t_mapnode_t * left, fd_vote_reward_t_mapnode_t * right ) {
26012 0 : return memcmp( left->elem.pubkey.uc, right->elem.pubkey.uc, sizeof(right->elem.pubkey) );
26013 0 : }
26014 0 : #define REDBLK_T fd_vote_info_pair_t_mapnode_t
26015 : #define REDBLK_NAME fd_vote_info_pair_t_map
26016 : #define REDBLK_IMPL_STYLE 2
26017 : #include "../../util/tmpl/fd_redblack.c"
26018 0 : long fd_vote_info_pair_t_map_compare( fd_vote_info_pair_t_mapnode_t * left, fd_vote_info_pair_t_mapnode_t * right ) {
26019 0 : return memcmp( left->elem.account.uc, right->elem.account.uc, sizeof(right->elem.account) );
26020 0 : }
26021 0 : #define REDBLK_T fd_account_costs_pair_t_mapnode_t
26022 : #define REDBLK_NAME fd_account_costs_pair_t_map
26023 : #define REDBLK_IMPL_STYLE 2
26024 : #include "../../util/tmpl/fd_redblack.c"
26025 0 : long fd_account_costs_pair_t_map_compare( fd_account_costs_pair_t_mapnode_t * left, fd_account_costs_pair_t_mapnode_t * right ) {
26026 0 : return memcmp( left->elem.key.uc, right->elem.key.uc, sizeof(right->elem.key) );
26027 0 : }
26028 : #include "fd_types_custom.c"
|