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 978 : int fd_hash_encode( fd_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12 978 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_hash_t), ctx );
13 978 : }
14 333 : 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 333 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_HASH256, name, level, varint );
16 333 : }
17 45 : static int fd_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18 45 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19 45 : return fd_bincode_bytes_decode_footprint( sizeof(fd_hash_t), ctx );
20 45 : }
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 34530 : static void fd_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30 34530 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_hash_t), ctx );
31 34530 : return;
32 34530 : }
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 9 : 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 9 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_SIG512, name, level, varint );
43 9 : }
44 0 : static int fd_signature_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
45 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
46 0 : return fd_bincode_bytes_decode_footprint( sizeof(fd_signature_t), ctx );
47 0 : }
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 9 : static void fd_signature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
57 9 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_signature_t), ctx );
58 9 : return;
59 9 : }
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_feature_encode( fd_feature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
66 0 : int err;
67 0 : err = fd_bincode_bool_encode( self->has_activated_at, ctx );
68 0 : if( FD_UNLIKELY( err ) ) return err;
69 0 : if( self->has_activated_at ) {
70 0 : err = fd_bincode_uint64_encode( self->activated_at, ctx );
71 0 : if( FD_UNLIKELY( err ) ) return err;
72 0 : }
73 0 : return FD_BINCODE_SUCCESS;
74 0 : }
75 0 : static int fd_feature_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
76 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
77 0 : int err = 0;
78 0 : {
79 0 : uchar o;
80 0 : err = fd_bincode_bool_decode( &o, ctx );
81 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
82 0 : if( o ) {
83 0 : err = fd_bincode_uint64_decode_footprint( ctx );
84 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
85 0 : }
86 0 : }
87 0 : return 0;
88 0 : }
89 0 : int fd_feature_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
90 0 : *total_sz += sizeof(fd_feature_t);
91 0 : void const * start_data = ctx->data;
92 0 : int err = fd_feature_decode_footprint_inner( ctx, total_sz );
93 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
94 0 : ctx->data = start_data;
95 0 : return err;
96 0 : }
97 0 : static void fd_feature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
98 0 : fd_feature_t * self = (fd_feature_t *)struct_mem;
99 0 : {
100 0 : uchar o;
101 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
102 0 : self->has_activated_at = !!o;
103 0 : if( o ) {
104 0 : fd_bincode_uint64_decode_unsafe( &self->activated_at, ctx );
105 0 : }
106 0 : }
107 0 : }
108 0 : void * fd_feature_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
109 0 : fd_feature_t * self = (fd_feature_t *)mem;
110 0 : fd_feature_new( self );
111 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_t);
112 0 : void * * alloc_mem = &alloc_region;
113 0 : fd_feature_decode_inner( mem, alloc_mem, ctx );
114 0 : return self;
115 0 : }
116 0 : void fd_feature_new(fd_feature_t * self) {
117 0 : fd_memset( self, 0, sizeof(fd_feature_t) );
118 0 : }
119 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 ) {
120 0 : (void) varint;
121 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature", level++, 0 );
122 0 : if( !self->has_activated_at ) {
123 0 : fun( w, NULL, "activated_at", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
124 0 : } else {
125 0 : fun( w, &self->activated_at, "activated_at", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
126 0 : }
127 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature", level--, 0 );
128 0 : }
129 0 : ulong fd_feature_size( fd_feature_t const * self ) {
130 0 : ulong size = 0;
131 0 : size += sizeof(char);
132 0 : if( self->has_activated_at ) {
133 0 : size += sizeof(ulong);
134 0 : }
135 0 : return size;
136 0 : }
137 :
138 0 : int fd_fee_calculator_encode( fd_fee_calculator_t const * self, fd_bincode_encode_ctx_t * ctx ) {
139 0 : int err;
140 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
141 0 : if( FD_UNLIKELY( err ) ) return err;
142 0 : return FD_BINCODE_SUCCESS;
143 0 : }
144 0 : static inline int fd_fee_calculator_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
145 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
146 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
147 0 : return 0;
148 0 : }
149 33975 : static void fd_fee_calculator_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
150 33975 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)struct_mem;
151 33975 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
152 33975 : }
153 0 : void * fd_fee_calculator_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
154 0 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)mem;
155 0 : fd_fee_calculator_new( self );
156 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_calculator_t);
157 0 : void * * alloc_mem = &alloc_region;
158 0 : fd_fee_calculator_decode_inner( mem, alloc_mem, ctx );
159 0 : return self;
160 0 : }
161 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 ) {
162 0 : (void) varint;
163 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_calculator", level++, 0 );
164 0 : fun( w, &self->lamports_per_signature, "lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
165 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_calculator", level--, 0 );
166 0 : }
167 9 : int fd_fee_rate_governor_encode( fd_fee_rate_governor_t const * self, fd_bincode_encode_ctx_t * ctx ) {
168 9 : int err;
169 9 : err = fd_bincode_uint64_encode( self->target_lamports_per_signature, ctx );
170 9 : if( FD_UNLIKELY( err ) ) return err;
171 9 : err = fd_bincode_uint64_encode( self->target_signatures_per_slot, ctx );
172 9 : if( FD_UNLIKELY( err ) ) return err;
173 9 : err = fd_bincode_uint64_encode( self->min_lamports_per_signature, ctx );
174 9 : if( FD_UNLIKELY( err ) ) return err;
175 9 : err = fd_bincode_uint64_encode( self->max_lamports_per_signature, ctx );
176 9 : if( FD_UNLIKELY( err ) ) return err;
177 9 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
178 9 : if( FD_UNLIKELY( err ) ) return err;
179 9 : return FD_BINCODE_SUCCESS;
180 9 : }
181 0 : static inline int fd_fee_rate_governor_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
182 0 : if( (ulong)ctx->data + 33UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
183 0 : ctx->data = (void *)( (ulong)ctx->data + 33UL );
184 0 : return 0;
185 0 : }
186 0 : static void fd_fee_rate_governor_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
187 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)struct_mem;
188 0 : fd_bincode_uint64_decode_unsafe( &self->target_lamports_per_signature, ctx );
189 0 : fd_bincode_uint64_decode_unsafe( &self->target_signatures_per_slot, ctx );
190 0 : fd_bincode_uint64_decode_unsafe( &self->min_lamports_per_signature, ctx );
191 0 : fd_bincode_uint64_decode_unsafe( &self->max_lamports_per_signature, ctx );
192 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
193 0 : }
194 0 : void * fd_fee_rate_governor_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
195 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)mem;
196 0 : fd_fee_rate_governor_new( self );
197 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_rate_governor_t);
198 0 : void * * alloc_mem = &alloc_region;
199 0 : fd_fee_rate_governor_decode_inner( mem, alloc_mem, ctx );
200 0 : return self;
201 0 : }
202 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 ) {
203 0 : (void) varint;
204 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fee_rate_governor", level++, 0 );
205 0 : fun( w, &self->target_lamports_per_signature, "target_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
206 0 : fun( w, &self->target_signatures_per_slot, "target_signatures_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
207 0 : fun( w, &self->min_lamports_per_signature, "min_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
208 0 : fun( w, &self->max_lamports_per_signature, "max_lamports_per_signature", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
209 0 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
210 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fee_rate_governor", level--, 0 );
211 0 : }
212 0 : int fd_slot_pair_encode( fd_slot_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
213 0 : int err;
214 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
215 0 : if( FD_UNLIKELY( err ) ) return err;
216 0 : err = fd_bincode_uint64_encode( self->val, ctx );
217 0 : if( FD_UNLIKELY( err ) ) return err;
218 0 : return FD_BINCODE_SUCCESS;
219 0 : }
220 0 : static inline int fd_slot_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
221 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
222 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
223 0 : return 0;
224 0 : }
225 0 : static void fd_slot_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
226 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)struct_mem;
227 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
228 0 : fd_bincode_uint64_decode_unsafe( &self->val, ctx );
229 0 : }
230 0 : void * fd_slot_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
231 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)mem;
232 0 : fd_slot_pair_new( self );
233 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_pair_t);
234 0 : void * * alloc_mem = &alloc_region;
235 0 : fd_slot_pair_decode_inner( mem, alloc_mem, ctx );
236 0 : return self;
237 0 : }
238 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 ) {
239 0 : (void) varint;
240 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_pair", level++, 0 );
241 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
242 0 : fun( w, &self->val, "val", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
243 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_pair", level--, 0 );
244 0 : }
245 0 : int fd_hard_forks_encode( fd_hard_forks_t const * self, fd_bincode_encode_ctx_t * ctx ) {
246 0 : int err;
247 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
248 0 : if( FD_UNLIKELY(err) ) return err;
249 0 : if( self->hard_forks_len ) {
250 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
251 0 : err = fd_slot_pair_encode( self->hard_forks + i, ctx );
252 0 : if( FD_UNLIKELY( err ) ) return err;
253 0 : }
254 0 : }
255 0 : return FD_BINCODE_SUCCESS;
256 0 : }
257 0 : int fd_hard_forks_encode_global( fd_hard_forks_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
258 0 : int err;
259 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
260 0 : if( FD_UNLIKELY( err ) ) return err;
261 0 : if( self->hard_forks_len ) {
262 0 : uchar * hard_forks_laddr = (uchar*)self + self->hard_forks_offset;
263 0 : fd_slot_pair_t * hard_forks = (fd_slot_pair_t *)hard_forks_laddr;
264 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
265 0 : err = fd_slot_pair_encode( &hard_forks[i], ctx );
266 0 : if( FD_UNLIKELY( err ) ) return err;
267 0 : }
268 0 : }
269 0 : return FD_BINCODE_SUCCESS;
270 0 : }
271 0 : static int fd_hard_forks_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
272 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
273 0 : int err = 0;
274 0 : ulong hard_forks_len;
275 0 : err = fd_bincode_uint64_decode( &hard_forks_len, ctx );
276 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
277 0 : if( hard_forks_len ) {
278 0 : *total_sz += FD_SLOT_PAIR_ALIGN + sizeof(fd_slot_pair_t)*hard_forks_len;
279 0 : for( ulong i=0; i < hard_forks_len; i++ ) {
280 0 : err = fd_slot_pair_decode_footprint_inner( ctx, total_sz );
281 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
282 0 : }
283 0 : }
284 0 : return 0;
285 0 : }
286 0 : int fd_hard_forks_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
287 0 : *total_sz += sizeof(fd_hard_forks_t);
288 0 : void const * start_data = ctx->data;
289 0 : int err = fd_hard_forks_decode_footprint_inner( ctx, total_sz );
290 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
291 0 : ctx->data = start_data;
292 0 : return err;
293 0 : }
294 0 : static void fd_hard_forks_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
295 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)struct_mem;
296 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
297 0 : if( self->hard_forks_len ) {
298 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
299 0 : self->hard_forks = *alloc_mem;
300 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
301 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
302 0 : fd_slot_pair_new( self->hard_forks + i );
303 0 : fd_slot_pair_decode_inner( self->hard_forks + i, alloc_mem, ctx );
304 0 : }
305 0 : } else
306 0 : self->hard_forks = NULL;
307 0 : }
308 0 : void * fd_hard_forks_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
309 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)mem;
310 0 : fd_hard_forks_new( self );
311 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_t);
312 0 : void * * alloc_mem = &alloc_region;
313 0 : fd_hard_forks_decode_inner( mem, alloc_mem, ctx );
314 0 : return self;
315 0 : }
316 0 : static void fd_hard_forks_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
317 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)struct_mem;
318 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
319 0 : if( self->hard_forks_len ) {
320 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
321 0 : self->hard_forks_offset = (ulong)*alloc_mem - (ulong)struct_mem;
322 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
323 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
324 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
325 0 : fd_slot_pair_new( (fd_slot_pair_t *)fd_type_pun(cur_mem + sizeof(fd_slot_pair_t) * i) );
326 0 : fd_slot_pair_decode_inner( cur_mem + sizeof(fd_slot_pair_t) * i, alloc_mem, ctx );
327 0 : }
328 0 : } else {
329 0 : self->hard_forks_offset = 0UL;
330 0 : }
331 0 : }
332 0 : void * fd_hard_forks_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
333 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)mem;
334 0 : fd_hard_forks_new( (fd_hard_forks_t *)self );
335 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_global_t);
336 0 : void * * alloc_mem = &alloc_region;
337 0 : fd_hard_forks_decode_inner_global( mem, alloc_mem, ctx );
338 0 : return self;
339 0 : }
340 0 : void fd_hard_forks_new(fd_hard_forks_t * self) {
341 0 : fd_memset( self, 0, sizeof(fd_hard_forks_t) );
342 0 : }
343 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 ) {
344 0 : (void) varint;
345 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_hard_forks", level++, 0 );
346 0 : if( self->hard_forks_len ) {
347 0 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
348 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
349 0 : fd_slot_pair_walk(w, self->hard_forks + i, fun, "slot_pair", level, 0 );
350 0 : fun( w, NULL, "hard_forks", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
351 0 : }
352 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_hard_forks", level--, 0 );
353 0 : }
354 0 : ulong fd_hard_forks_size( fd_hard_forks_t const * self ) {
355 0 : ulong size = 0;
356 0 : do {
357 0 : size += sizeof(ulong);
358 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
359 0 : size += fd_slot_pair_size( self->hard_forks + i );
360 0 : } while(0);
361 0 : return size;
362 0 : }
363 :
364 0 : ulong fd_hard_forks_size_global( fd_hard_forks_global_t const * self ) {
365 0 : ulong size = 0;
366 0 : do {
367 0 : size += sizeof(ulong);
368 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;
369 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
370 0 : size += fd_slot_pair_size( hard_forks + i );
371 0 : } while(0);
372 0 : return size;
373 0 : }
374 :
375 9 : int fd_inflation_encode( fd_inflation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
376 9 : int err;
377 9 : err = fd_bincode_double_encode( self->initial, ctx );
378 9 : if( FD_UNLIKELY( err ) ) return err;
379 9 : err = fd_bincode_double_encode( self->terminal, ctx );
380 9 : if( FD_UNLIKELY( err ) ) return err;
381 9 : err = fd_bincode_double_encode( self->taper, ctx );
382 9 : if( FD_UNLIKELY( err ) ) return err;
383 9 : err = fd_bincode_double_encode( self->foundation, ctx );
384 9 : if( FD_UNLIKELY( err ) ) return err;
385 9 : err = fd_bincode_double_encode( self->foundation_term, ctx );
386 9 : if( FD_UNLIKELY( err ) ) return err;
387 9 : err = fd_bincode_double_encode( self->unused, ctx );
388 9 : if( FD_UNLIKELY( err ) ) return err;
389 9 : return FD_BINCODE_SUCCESS;
390 9 : }
391 0 : static inline int fd_inflation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
392 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
393 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
394 0 : return 0;
395 0 : }
396 0 : static void fd_inflation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
397 0 : fd_inflation_t * self = (fd_inflation_t *)struct_mem;
398 0 : fd_bincode_double_decode_unsafe( &self->initial, ctx );
399 0 : fd_bincode_double_decode_unsafe( &self->terminal, ctx );
400 0 : fd_bincode_double_decode_unsafe( &self->taper, ctx );
401 0 : fd_bincode_double_decode_unsafe( &self->foundation, ctx );
402 0 : fd_bincode_double_decode_unsafe( &self->foundation_term, ctx );
403 0 : fd_bincode_double_decode_unsafe( &self->unused, ctx );
404 0 : }
405 0 : void * fd_inflation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
406 0 : fd_inflation_t * self = (fd_inflation_t *)mem;
407 0 : fd_inflation_new( self );
408 0 : void * alloc_region = (uchar *)mem + sizeof(fd_inflation_t);
409 0 : void * * alloc_mem = &alloc_region;
410 0 : fd_inflation_decode_inner( mem, alloc_mem, ctx );
411 0 : return self;
412 0 : }
413 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 ) {
414 0 : (void) varint;
415 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_inflation", level++, 0 );
416 0 : fun( w, &self->initial, "initial", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
417 0 : fun( w, &self->terminal, "terminal", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
418 0 : fun( w, &self->taper, "taper", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
419 0 : fun( w, &self->foundation, "foundation", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
420 0 : fun( w, &self->foundation_term, "foundation_term", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
421 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
422 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_inflation", level--, 0 );
423 0 : }
424 9 : int fd_rent_encode( fd_rent_t const * self, fd_bincode_encode_ctx_t * ctx ) {
425 9 : int err;
426 9 : err = fd_bincode_uint64_encode( self->lamports_per_uint8_year, ctx );
427 9 : if( FD_UNLIKELY( err ) ) return err;
428 9 : err = fd_bincode_double_encode( self->exemption_threshold, ctx );
429 9 : if( FD_UNLIKELY( err ) ) return err;
430 9 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
431 9 : if( FD_UNLIKELY( err ) ) return err;
432 9 : return FD_BINCODE_SUCCESS;
433 9 : }
434 0 : static inline int fd_rent_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
435 0 : if( (ulong)ctx->data + 17UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
436 0 : ctx->data = (void *)( (ulong)ctx->data + 17UL );
437 0 : return 0;
438 0 : }
439 0 : static void fd_rent_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
440 0 : fd_rent_t * self = (fd_rent_t *)struct_mem;
441 0 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
442 0 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
443 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
444 0 : }
445 0 : void * fd_rent_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
446 0 : fd_rent_t * self = (fd_rent_t *)mem;
447 0 : fd_rent_new( self );
448 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_t);
449 0 : void * * alloc_mem = &alloc_region;
450 0 : fd_rent_decode_inner( mem, alloc_mem, ctx );
451 0 : return self;
452 0 : }
453 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 ) {
454 0 : (void) varint;
455 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent", level++, 0 );
456 0 : fun( w, &self->lamports_per_uint8_year, "lamports_per_uint8_year", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
457 0 : fun( w, &self->exemption_threshold, "exemption_threshold", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
458 0 : fun( w, &self->burn_percent, "burn_percent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
459 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent", level--, 0 );
460 0 : }
461 9 : int fd_epoch_schedule_encode( fd_epoch_schedule_t const * self, fd_bincode_encode_ctx_t * ctx ) {
462 9 : int err;
463 9 : err = fd_bincode_uint64_encode( self->slots_per_epoch, ctx );
464 9 : if( FD_UNLIKELY( err ) ) return err;
465 9 : err = fd_bincode_uint64_encode( self->leader_schedule_slot_offset, ctx );
466 9 : if( FD_UNLIKELY( err ) ) return err;
467 9 : err = fd_bincode_bool_encode( (uchar)(self->warmup), ctx );
468 9 : if( FD_UNLIKELY( err ) ) return err;
469 9 : err = fd_bincode_uint64_encode( self->first_normal_epoch, ctx );
470 9 : if( FD_UNLIKELY( err ) ) return err;
471 9 : err = fd_bincode_uint64_encode( self->first_normal_slot, ctx );
472 9 : if( FD_UNLIKELY( err ) ) return err;
473 9 : return FD_BINCODE_SUCCESS;
474 9 : }
475 3 : static int fd_epoch_schedule_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
476 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
477 3 : int err = 0;
478 3 : err = fd_bincode_uint64_decode_footprint( ctx );
479 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
480 3 : err = fd_bincode_uint64_decode_footprint( ctx );
481 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
482 3 : err = fd_bincode_bool_decode_footprint( ctx );
483 3 : if( FD_UNLIKELY( err ) ) return err;
484 3 : err = fd_bincode_uint64_decode_footprint( ctx );
485 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
486 3 : err = fd_bincode_uint64_decode_footprint( ctx );
487 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
488 3 : return 0;
489 3 : }
490 3 : int fd_epoch_schedule_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
491 3 : *total_sz += sizeof(fd_epoch_schedule_t);
492 3 : void const * start_data = ctx->data;
493 3 : int err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
494 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
495 3 : ctx->data = start_data;
496 3 : return err;
497 3 : }
498 0 : static void fd_epoch_schedule_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
499 0 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)struct_mem;
500 0 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
501 0 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
502 0 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
503 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
504 0 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
505 0 : }
506 0 : void * fd_epoch_schedule_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
507 0 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)mem;
508 0 : fd_epoch_schedule_new( self );
509 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_schedule_t);
510 0 : void * * alloc_mem = &alloc_region;
511 0 : fd_epoch_schedule_decode_inner( mem, alloc_mem, ctx );
512 0 : return self;
513 0 : }
514 12 : void fd_epoch_schedule_new(fd_epoch_schedule_t * self) {
515 12 : fd_memset( self, 0, sizeof(fd_epoch_schedule_t) );
516 12 : }
517 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 ) {
518 0 : (void) varint;
519 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_schedule", level++, 0 );
520 0 : fun( w, &self->slots_per_epoch, "slots_per_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
521 0 : fun( w, &self->leader_schedule_slot_offset, "leader_schedule_slot_offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
522 0 : fun( w, &self->warmup, "warmup", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
523 0 : fun( w, &self->first_normal_epoch, "first_normal_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
524 0 : fun( w, &self->first_normal_slot, "first_normal_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
525 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_schedule", level--, 0 );
526 0 : }
527 0 : int fd_rent_collector_encode( fd_rent_collector_t const * self, fd_bincode_encode_ctx_t * ctx ) {
528 0 : int err;
529 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
530 0 : if( FD_UNLIKELY( err ) ) return err;
531 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
532 0 : if( FD_UNLIKELY( err ) ) return err;
533 0 : err = fd_bincode_double_encode( self->slots_per_year, ctx );
534 0 : if( FD_UNLIKELY( err ) ) return err;
535 0 : err = fd_rent_encode( &self->rent, ctx );
536 0 : if( FD_UNLIKELY( err ) ) return err;
537 0 : return FD_BINCODE_SUCCESS;
538 0 : }
539 0 : static int fd_rent_collector_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
540 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
541 0 : int err = 0;
542 0 : err = fd_bincode_uint64_decode_footprint( ctx );
543 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
544 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
545 0 : if( FD_UNLIKELY( err ) ) return err;
546 0 : err = fd_bincode_double_decode_footprint( ctx );
547 0 : if( FD_UNLIKELY( err ) ) return err;
548 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
549 0 : if( FD_UNLIKELY( err ) ) return err;
550 0 : return 0;
551 0 : }
552 0 : int fd_rent_collector_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
553 0 : *total_sz += sizeof(fd_rent_collector_t);
554 0 : void const * start_data = ctx->data;
555 0 : int err = fd_rent_collector_decode_footprint_inner( ctx, total_sz );
556 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
557 0 : ctx->data = start_data;
558 0 : return err;
559 0 : }
560 0 : static void fd_rent_collector_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
561 0 : fd_rent_collector_t * self = (fd_rent_collector_t *)struct_mem;
562 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
563 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
564 0 : fd_bincode_double_decode_unsafe( &self->slots_per_year, ctx );
565 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
566 0 : }
567 0 : void * fd_rent_collector_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
568 0 : fd_rent_collector_t * self = (fd_rent_collector_t *)mem;
569 0 : fd_rent_collector_new( self );
570 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_collector_t);
571 0 : void * * alloc_mem = &alloc_region;
572 0 : fd_rent_collector_decode_inner( mem, alloc_mem, ctx );
573 0 : return self;
574 0 : }
575 0 : void fd_rent_collector_new(fd_rent_collector_t * self) {
576 0 : fd_memset( self, 0, sizeof(fd_rent_collector_t) );
577 0 : fd_epoch_schedule_new( &self->epoch_schedule );
578 0 : fd_rent_new( &self->rent );
579 0 : }
580 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 ) {
581 0 : (void) varint;
582 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_collector", level++, 0 );
583 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
584 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level, 0 );
585 0 : fun( w, &self->slots_per_year, "slots_per_year", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
586 0 : fd_rent_walk( w, &self->rent, fun, "rent", level, 0 );
587 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_collector", level--, 0 );
588 0 : }
589 9 : int fd_stake_history_entry_encode( fd_stake_history_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
590 9 : int err;
591 9 : err = fd_bincode_uint64_encode( self->effective, ctx );
592 9 : if( FD_UNLIKELY( err ) ) return err;
593 9 : err = fd_bincode_uint64_encode( self->activating, ctx );
594 9 : if( FD_UNLIKELY( err ) ) return err;
595 9 : err = fd_bincode_uint64_encode( self->deactivating, ctx );
596 9 : if( FD_UNLIKELY( err ) ) return err;
597 9 : return FD_BINCODE_SUCCESS;
598 9 : }
599 0 : static inline int fd_stake_history_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
600 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
601 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
602 0 : return 0;
603 0 : }
604 12 : static void fd_stake_history_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
605 12 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)struct_mem;
606 12 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
607 12 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
608 12 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
609 12 : }
610 0 : void * fd_stake_history_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
611 0 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)mem;
612 0 : fd_stake_history_entry_new( self );
613 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_entry_t);
614 0 : void * * alloc_mem = &alloc_region;
615 0 : fd_stake_history_entry_decode_inner( mem, alloc_mem, ctx );
616 0 : return self;
617 0 : }
618 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 ) {
619 0 : (void) varint;
620 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history_entry", level++, 0 );
621 0 : fun( w, &self->effective, "effective", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
622 0 : fun( w, &self->activating, "activating", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
623 0 : fun( w, &self->deactivating, "deactivating", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
624 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history_entry", level--, 0 );
625 0 : }
626 9 : int fd_epoch_stake_history_entry_pair_encode( fd_epoch_stake_history_entry_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
627 9 : int err;
628 9 : err = fd_bincode_uint64_encode( self->epoch, ctx );
629 9 : if( FD_UNLIKELY( err ) ) return err;
630 9 : err = fd_stake_history_entry_encode( &self->entry, ctx );
631 9 : if( FD_UNLIKELY( err ) ) return err;
632 9 : return FD_BINCODE_SUCCESS;
633 9 : }
634 1548 : static inline int fd_epoch_stake_history_entry_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
635 1548 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
636 1548 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
637 1548 : return 0;
638 1548 : }
639 12 : static void fd_epoch_stake_history_entry_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
640 12 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)struct_mem;
641 12 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
642 12 : fd_stake_history_entry_decode_inner( &self->entry, alloc_mem, ctx );
643 12 : }
644 0 : void * fd_epoch_stake_history_entry_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
645 0 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)mem;
646 0 : fd_epoch_stake_history_entry_pair_new( self );
647 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_stake_history_entry_pair_t);
648 0 : void * * alloc_mem = &alloc_region;
649 0 : fd_epoch_stake_history_entry_pair_decode_inner( mem, alloc_mem, ctx );
650 0 : return self;
651 0 : }
652 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 ) {
653 0 : (void) varint;
654 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_stake_history_entry_pair", level++, 0 );
655 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
656 0 : fd_stake_history_entry_walk( w, &self->entry, fun, "entry", level, 0 );
657 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_stake_history_entry_pair", level--, 0 );
658 0 : }
659 9 : int fd_stake_history_encode( fd_stake_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
660 9 : int err;
661 9 : err = fd_bincode_uint64_encode( self->fd_stake_history_len, ctx );
662 9 : if( FD_UNLIKELY(err) ) return err;
663 9 : if( FD_UNLIKELY( 0 == self->fd_stake_history_len ) ) return FD_BINCODE_SUCCESS;
664 15 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
665 9 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
666 9 : err = fd_epoch_stake_history_entry_pair_encode( self->fd_stake_history + idx, ctx );
667 9 : if( FD_UNLIKELY( err ) ) return err;
668 9 : }
669 6 : return FD_BINCODE_SUCCESS;
670 6 : }
671 15 : static int fd_stake_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
672 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
673 15 : int err = 0;
674 15 : ulong fd_stake_history_len;
675 15 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
676 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
677 15 : if( fd_stake_history_len ) {
678 1560 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
679 1548 : err = fd_epoch_stake_history_entry_pair_decode_footprint_inner( ctx, total_sz );
680 1548 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
681 1548 : }
682 12 : }
683 15 : return 0;
684 15 : }
685 15 : int fd_stake_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
686 15 : *total_sz += sizeof(fd_stake_history_t);
687 15 : void const * start_data = ctx->data;
688 15 : int err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
689 15 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
690 15 : ctx->data = start_data;
691 15 : return err;
692 15 : }
693 12 : static void fd_stake_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
694 12 : fd_stake_history_t * self = (fd_stake_history_t *)struct_mem;
695 12 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
696 12 : self->fd_stake_history_size = 512;
697 12 : self->fd_stake_history_offset = 0;
698 24 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
699 12 : fd_epoch_stake_history_entry_pair_decode_inner( self->fd_stake_history + i, alloc_mem, ctx );
700 12 : }
701 12 : }
702 12 : void * fd_stake_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
703 12 : fd_stake_history_t * self = (fd_stake_history_t *)mem;
704 12 : fd_stake_history_new( self );
705 12 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_t);
706 12 : void * * alloc_mem = &alloc_region;
707 12 : fd_stake_history_decode_inner( mem, alloc_mem, ctx );
708 12 : return self;
709 12 : }
710 15 : void fd_stake_history_new(fd_stake_history_t * self) {
711 15 : fd_memset( self, 0, sizeof(fd_stake_history_t) );
712 15 : self->fd_stake_history_size = 512;
713 7695 : for( ulong i=0; i<512; i++ )
714 7680 : fd_epoch_stake_history_entry_pair_new( self->fd_stake_history + i );
715 15 : }
716 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 ) {
717 0 : (void) varint;
718 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_history", level++, 0 );
719 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR, "epoch_stake_history_entry_pair[]", level++, 0 );
720 0 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
721 0 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
722 0 : fd_epoch_stake_history_entry_pair_walk( w, self->fd_stake_history + idx, fun, "epoch_stake_history_entry_pair", level, 0 );
723 0 : }
724 0 : fun( w, NULL, "fd_stake_history", FD_FLAMENCO_TYPE_ARR_END, "epoch_stake_history_entry_pair[]", level--, 0 );
725 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_history", level--, 0 );
726 0 : }
727 144 : int fd_solana_account_encode( fd_solana_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
728 144 : int err;
729 144 : err = fd_bincode_uint64_encode( self->lamports, ctx );
730 144 : if( FD_UNLIKELY( err ) ) return err;
731 144 : err = fd_bincode_uint64_encode( self->data_len, ctx );
732 144 : if( FD_UNLIKELY(err) ) return err;
733 144 : if( self->data_len ) {
734 30 : err = fd_bincode_bytes_encode( self->data, self->data_len, ctx );
735 30 : if( FD_UNLIKELY( err ) ) return err;
736 30 : }
737 144 : err = fd_pubkey_encode( &self->owner, ctx );
738 144 : if( FD_UNLIKELY( err ) ) return err;
739 144 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
740 144 : if( FD_UNLIKELY( err ) ) return err;
741 144 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
742 144 : if( FD_UNLIKELY( err ) ) return err;
743 144 : return FD_BINCODE_SUCCESS;
744 144 : }
745 0 : int fd_solana_account_encode_global( fd_solana_account_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
746 0 : int err;
747 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
748 0 : if( FD_UNLIKELY( err ) ) return err;
749 0 : err = fd_bincode_uint64_encode( self->data_len, ctx );
750 0 : if( FD_UNLIKELY( err ) ) return err;
751 0 : if( self->data_len ) {
752 0 : uchar * data_laddr = (uchar*)self + self->data_offset;
753 0 : err = fd_bincode_bytes_encode( data_laddr, self->data_len, ctx );
754 0 : if( FD_UNLIKELY( err ) ) return err;
755 0 : }
756 0 : err = fd_pubkey_encode( &self->owner, ctx );
757 0 : if( FD_UNLIKELY( err ) ) return err;
758 0 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
759 0 : if( FD_UNLIKELY( err ) ) return err;
760 0 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
761 0 : if( FD_UNLIKELY( err ) ) return err;
762 0 : return FD_BINCODE_SUCCESS;
763 0 : }
764 0 : static int fd_solana_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
765 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
766 0 : int err = 0;
767 0 : err = fd_bincode_uint64_decode_footprint( ctx );
768 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
769 0 : ulong data_len;
770 0 : err = fd_bincode_uint64_decode( &data_len, ctx );
771 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
772 0 : if( data_len ) {
773 0 : *total_sz += 8UL + data_len;
774 0 : err = fd_bincode_bytes_decode_footprint( data_len, ctx );
775 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
776 0 : }
777 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
778 0 : if( FD_UNLIKELY( err ) ) return err;
779 0 : err = fd_bincode_bool_decode_footprint( ctx );
780 0 : if( FD_UNLIKELY( err ) ) return err;
781 0 : err = fd_bincode_uint64_decode_footprint( ctx );
782 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
783 0 : return 0;
784 0 : }
785 0 : int fd_solana_account_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
786 0 : *total_sz += sizeof(fd_solana_account_t);
787 0 : void const * start_data = ctx->data;
788 0 : int err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
789 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
790 0 : ctx->data = start_data;
791 0 : return err;
792 0 : }
793 0 : static void fd_solana_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
794 0 : fd_solana_account_t * self = (fd_solana_account_t *)struct_mem;
795 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
796 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
797 0 : if( self->data_len ) {
798 0 : self->data = *alloc_mem;
799 0 : fd_bincode_bytes_decode_unsafe( self->data, self->data_len, ctx );
800 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
801 0 : } else
802 0 : self->data = NULL;
803 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
804 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
805 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
806 0 : }
807 0 : void * fd_solana_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
808 0 : fd_solana_account_t * self = (fd_solana_account_t *)mem;
809 0 : fd_solana_account_new( self );
810 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_t);
811 0 : void * * alloc_mem = &alloc_region;
812 0 : fd_solana_account_decode_inner( mem, alloc_mem, ctx );
813 0 : return self;
814 0 : }
815 0 : static void fd_solana_account_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
816 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)struct_mem;
817 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
818 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
819 0 : if( self->data_len ) {
820 0 : self->data_offset = (ulong)*alloc_mem - (ulong)struct_mem;
821 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->data_len, ctx );
822 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
823 0 : } else {
824 0 : self->data_offset = 0UL;
825 0 : }
826 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
827 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
828 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
829 0 : }
830 0 : void * fd_solana_account_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
831 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)mem;
832 0 : fd_solana_account_new( (fd_solana_account_t *)self );
833 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_global_t);
834 0 : void * * alloc_mem = &alloc_region;
835 0 : fd_solana_account_decode_inner_global( mem, alloc_mem, ctx );
836 0 : return self;
837 0 : }
838 0 : void fd_solana_account_new(fd_solana_account_t * self) {
839 0 : fd_memset( self, 0, sizeof(fd_solana_account_t) );
840 0 : fd_pubkey_new( &self->owner );
841 0 : }
842 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 ) {
843 0 : (void) varint;
844 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account", level++, 0 );
845 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
846 0 : if( self->data_len ) {
847 0 : fun( w, NULL, "data", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
848 0 : for( ulong i=0; i < self->data_len; i++ )
849 0 : fun( w, self->data + i, "data", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
850 0 : fun( w, NULL, "data", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
851 0 : }
852 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
853 0 : fun( w, &self->executable, "executable", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
854 0 : fun( w, &self->rent_epoch, "rent_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
855 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account", level--, 0 );
856 0 : }
857 0 : ulong fd_solana_account_size( fd_solana_account_t const * self ) {
858 0 : ulong size = 0;
859 0 : size += sizeof(ulong);
860 0 : do {
861 0 : size += sizeof(ulong);
862 0 : size += self->data_len;
863 0 : } while(0);
864 0 : size += fd_pubkey_size( &self->owner );
865 0 : size += sizeof(char);
866 0 : size += sizeof(ulong);
867 0 : return size;
868 0 : }
869 :
870 0 : ulong fd_solana_account_size_global( fd_solana_account_global_t const * self ) {
871 0 : ulong size = 0;
872 0 : size += sizeof(ulong);
873 0 : do {
874 0 : size += sizeof(ulong);
875 0 : uchar * data = self->data_offset ? (uchar *)fd_type_pun( (uchar *)self + self->data_offset ) : NULL;
876 0 : size += self->data_len;
877 0 : } while(0);
878 0 : size += fd_pubkey_size( &self->owner );
879 0 : size += sizeof(char);
880 0 : size += sizeof(ulong);
881 0 : return size;
882 0 : }
883 :
884 0 : int fd_solana_account_stored_meta_encode( fd_solana_account_stored_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
885 0 : int err;
886 0 : err = fd_bincode_uint64_encode( self->write_version_obsolete, ctx );
887 0 : if( FD_UNLIKELY( err ) ) return err;
888 0 : err = fd_bincode_uint64_encode( self->data_len, ctx );
889 0 : if( FD_UNLIKELY( err ) ) return err;
890 0 : err = fd_bincode_bytes_encode( self->pubkey, sizeof(self->pubkey), ctx );
891 0 : if( FD_UNLIKELY( err ) ) return err;
892 0 : return FD_BINCODE_SUCCESS;
893 0 : }
894 0 : static inline int fd_solana_account_stored_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
895 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
896 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
897 0 : return 0;
898 0 : }
899 0 : static void fd_solana_account_stored_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
900 0 : fd_solana_account_stored_meta_t * self = (fd_solana_account_stored_meta_t *)struct_mem;
901 0 : fd_bincode_uint64_decode_unsafe( &self->write_version_obsolete, ctx );
902 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
903 0 : fd_bincode_bytes_decode_unsafe( &self->pubkey[0], sizeof(self->pubkey), ctx );
904 0 : }
905 0 : void * fd_solana_account_stored_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
906 0 : fd_solana_account_stored_meta_t * self = (fd_solana_account_stored_meta_t *)mem;
907 0 : fd_solana_account_stored_meta_new( self );
908 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_stored_meta_t);
909 0 : void * * alloc_mem = &alloc_region;
910 0 : fd_solana_account_stored_meta_decode_inner( mem, alloc_mem, ctx );
911 0 : return self;
912 0 : }
913 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 ) {
914 0 : (void) varint;
915 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account_stored_meta", level++, 0 );
916 0 : fun( w, &self->write_version_obsolete, "write_version_obsolete", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
917 0 : fun( w, &self->data_len, "data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
918 0 : fun( w, self->pubkey, "pubkey", FD_FLAMENCO_TYPE_HASH256, "uchar[32]", level, 0 );
919 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account_stored_meta", level--, 0 );
920 0 : }
921 0 : int fd_solana_account_meta_encode( fd_solana_account_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
922 0 : int err;
923 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
924 0 : if( FD_UNLIKELY( err ) ) return err;
925 0 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
926 0 : if( FD_UNLIKELY( err ) ) return err;
927 0 : err = fd_bincode_bytes_encode( self->owner, sizeof(self->owner), ctx );
928 0 : if( FD_UNLIKELY( err ) ) return err;
929 0 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
930 0 : if( FD_UNLIKELY( err ) ) return err;
931 0 : err = fd_bincode_bytes_encode( self->padding, 3, ctx );
932 0 : if( FD_UNLIKELY( err ) ) return err;
933 0 : return FD_BINCODE_SUCCESS;
934 0 : }
935 0 : static int fd_solana_account_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
936 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
937 0 : int err = 0;
938 0 : err = fd_bincode_uint64_decode_footprint( ctx );
939 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
940 0 : err = fd_bincode_uint64_decode_footprint( ctx );
941 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
942 0 : err = fd_bincode_bytes_decode_footprint( 32, ctx );
943 0 : if( FD_UNLIKELY( err ) ) return err;
944 0 : err = fd_bincode_bool_decode_footprint( ctx );
945 0 : if( FD_UNLIKELY( err ) ) return err;
946 0 : err = fd_bincode_bytes_decode_footprint( 3, ctx );
947 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
948 0 : return 0;
949 0 : }
950 0 : int fd_solana_account_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
951 0 : *total_sz += sizeof(fd_solana_account_meta_t);
952 0 : void const * start_data = ctx->data;
953 0 : int err = fd_solana_account_meta_decode_footprint_inner( ctx, total_sz );
954 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
955 0 : ctx->data = start_data;
956 0 : return err;
957 0 : }
958 0 : static void fd_solana_account_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
959 0 : fd_solana_account_meta_t * self = (fd_solana_account_meta_t *)struct_mem;
960 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
961 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
962 0 : fd_bincode_bytes_decode_unsafe( &self->owner[0], sizeof(self->owner), ctx );
963 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
964 0 : fd_bincode_bytes_decode_unsafe( self->padding, 3, ctx );
965 0 : }
966 0 : void * fd_solana_account_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
967 0 : fd_solana_account_meta_t * self = (fd_solana_account_meta_t *)mem;
968 0 : fd_solana_account_meta_new( self );
969 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_meta_t);
970 0 : void * * alloc_mem = &alloc_region;
971 0 : fd_solana_account_meta_decode_inner( mem, alloc_mem, ctx );
972 0 : return self;
973 0 : }
974 0 : void fd_solana_account_meta_new(fd_solana_account_meta_t * self) {
975 0 : fd_memset( self, 0, sizeof(fd_solana_account_meta_t) );
976 0 : }
977 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 ) {
978 0 : (void) varint;
979 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account_meta", level++, 0 );
980 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
981 0 : fun( w, &self->rent_epoch, "rent_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
982 0 : fun( w, self->owner, "owner", FD_FLAMENCO_TYPE_HASH256, "uchar[32]", level, 0 );
983 0 : fun( w, &self->executable, "executable", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
984 0 : fun(w, self->padding, "padding", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
985 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account_meta", level--, 0 );
986 0 : }
987 0 : int fd_solana_account_hdr_encode( fd_solana_account_hdr_t const * self, fd_bincode_encode_ctx_t * ctx ) {
988 0 : int err;
989 0 : err = fd_solana_account_stored_meta_encode( &self->meta, ctx );
990 0 : if( FD_UNLIKELY( err ) ) return err;
991 0 : err = fd_solana_account_meta_encode( &self->info, ctx );
992 0 : if( FD_UNLIKELY( err ) ) return err;
993 0 : err = fd_bincode_bytes_encode( self->padding, 4, ctx );
994 0 : if( FD_UNLIKELY( err ) ) return err;
995 0 : err = fd_hash_encode( &self->hash, ctx );
996 0 : if( FD_UNLIKELY( err ) ) return err;
997 0 : return FD_BINCODE_SUCCESS;
998 0 : }
999 0 : static int fd_solana_account_hdr_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1000 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1001 0 : int err = 0;
1002 0 : err = fd_solana_account_stored_meta_decode_footprint_inner( ctx, total_sz );
1003 0 : if( FD_UNLIKELY( err ) ) return err;
1004 0 : err = fd_solana_account_meta_decode_footprint_inner( ctx, total_sz );
1005 0 : if( FD_UNLIKELY( err ) ) return err;
1006 0 : err = fd_bincode_bytes_decode_footprint( 4, ctx );
1007 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1008 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
1009 0 : if( FD_UNLIKELY( err ) ) return err;
1010 0 : return 0;
1011 0 : }
1012 0 : int fd_solana_account_hdr_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1013 0 : *total_sz += sizeof(fd_solana_account_hdr_t);
1014 0 : void const * start_data = ctx->data;
1015 0 : int err = fd_solana_account_hdr_decode_footprint_inner( ctx, total_sz );
1016 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1017 0 : ctx->data = start_data;
1018 0 : return err;
1019 0 : }
1020 0 : static void fd_solana_account_hdr_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1021 0 : fd_solana_account_hdr_t * self = (fd_solana_account_hdr_t *)struct_mem;
1022 0 : fd_solana_account_stored_meta_decode_inner( &self->meta, alloc_mem, ctx );
1023 0 : fd_solana_account_meta_decode_inner( &self->info, alloc_mem, ctx );
1024 0 : fd_bincode_bytes_decode_unsafe( self->padding, 4, ctx );
1025 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
1026 0 : }
1027 0 : void * fd_solana_account_hdr_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1028 0 : fd_solana_account_hdr_t * self = (fd_solana_account_hdr_t *)mem;
1029 0 : fd_solana_account_hdr_new( self );
1030 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_hdr_t);
1031 0 : void * * alloc_mem = &alloc_region;
1032 0 : fd_solana_account_hdr_decode_inner( mem, alloc_mem, ctx );
1033 0 : return self;
1034 0 : }
1035 0 : void fd_solana_account_hdr_new(fd_solana_account_hdr_t * self) {
1036 0 : fd_memset( self, 0, sizeof(fd_solana_account_hdr_t) );
1037 0 : fd_solana_account_stored_meta_new( &self->meta );
1038 0 : fd_solana_account_meta_new( &self->info );
1039 0 : fd_hash_new( &self->hash );
1040 0 : }
1041 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 ) {
1042 0 : (void) varint;
1043 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_solana_account_hdr", level++, 0 );
1044 0 : fd_solana_account_stored_meta_walk( w, &self->meta, fun, "meta", level, 0 );
1045 0 : fd_solana_account_meta_walk( w, &self->info, fun, "info", level, 0 );
1046 0 : fun(w, self->padding, "padding", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1047 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
1048 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_solana_account_hdr", level--, 0 );
1049 0 : }
1050 12 : int fd_delegation_encode( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1051 12 : int err;
1052 12 : err = fd_pubkey_encode( &self->voter_pubkey, ctx );
1053 12 : if( FD_UNLIKELY( err ) ) return err;
1054 12 : err = fd_bincode_uint64_encode( self->stake, ctx );
1055 12 : if( FD_UNLIKELY( err ) ) return err;
1056 12 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
1057 12 : if( FD_UNLIKELY( err ) ) return err;
1058 12 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
1059 12 : if( FD_UNLIKELY( err ) ) return err;
1060 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
1061 12 : if( FD_UNLIKELY( err ) ) return err;
1062 12 : return FD_BINCODE_SUCCESS;
1063 12 : }
1064 0 : static inline int fd_delegation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1065 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1066 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
1067 0 : return 0;
1068 0 : }
1069 0 : static void fd_delegation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1070 0 : fd_delegation_t * self = (fd_delegation_t *)struct_mem;
1071 0 : fd_pubkey_decode_inner( &self->voter_pubkey, alloc_mem, ctx );
1072 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
1073 0 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
1074 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
1075 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
1076 0 : }
1077 0 : void * fd_delegation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1078 0 : fd_delegation_t * self = (fd_delegation_t *)mem;
1079 0 : fd_delegation_new( self );
1080 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_t);
1081 0 : void * * alloc_mem = &alloc_region;
1082 0 : fd_delegation_decode_inner( mem, alloc_mem, ctx );
1083 0 : return self;
1084 0 : }
1085 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 ) {
1086 0 : (void) varint;
1087 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_delegation", level++, 0 );
1088 0 : fd_pubkey_walk( w, &self->voter_pubkey, fun, "voter_pubkey", level, 0 );
1089 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1090 0 : fun( w, &self->activation_epoch, "activation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1091 0 : fun( w, &self->deactivation_epoch, "deactivation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1092 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
1093 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_delegation", level--, 0 );
1094 0 : }
1095 12 : int fd_stake_encode( fd_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1096 12 : int err;
1097 12 : err = fd_delegation_encode( &self->delegation, ctx );
1098 12 : if( FD_UNLIKELY( err ) ) return err;
1099 12 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
1100 12 : if( FD_UNLIKELY( err ) ) return err;
1101 12 : return FD_BINCODE_SUCCESS;
1102 12 : }
1103 0 : static inline int fd_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1104 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1105 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
1106 0 : return 0;
1107 0 : }
1108 0 : static void fd_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1109 0 : fd_stake_t * self = (fd_stake_t *)struct_mem;
1110 0 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
1111 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
1112 0 : }
1113 0 : void * fd_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1114 0 : fd_stake_t * self = (fd_stake_t *)mem;
1115 0 : fd_stake_new( self );
1116 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_t);
1117 0 : void * * alloc_mem = &alloc_region;
1118 0 : fd_stake_decode_inner( mem, alloc_mem, ctx );
1119 0 : return self;
1120 0 : }
1121 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 ) {
1122 0 : (void) varint;
1123 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake", level++, 0 );
1124 0 : fd_delegation_walk( w, &self->delegation, fun, "delegation", level, 0 );
1125 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1126 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake", level--, 0 );
1127 0 : }
1128 0 : FD_FN_PURE uchar fd_reward_type_is_fee(fd_reward_type_t const * self) {
1129 0 : return self->discriminant == 0;
1130 0 : }
1131 0 : FD_FN_PURE uchar fd_reward_type_is_rent(fd_reward_type_t const * self) {
1132 0 : return self->discriminant == 1;
1133 0 : }
1134 0 : FD_FN_PURE uchar fd_reward_type_is_staking(fd_reward_type_t const * self) {
1135 0 : return self->discriminant == 2;
1136 0 : }
1137 0 : FD_FN_PURE uchar fd_reward_type_is_voting(fd_reward_type_t const * self) {
1138 0 : return self->discriminant == 3;
1139 0 : }
1140 0 : int fd_reward_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1141 0 : int err;
1142 0 : switch (discriminant) {
1143 0 : case 0: {
1144 0 : return FD_BINCODE_SUCCESS;
1145 0 : }
1146 0 : case 1: {
1147 0 : return FD_BINCODE_SUCCESS;
1148 0 : }
1149 0 : case 2: {
1150 0 : return FD_BINCODE_SUCCESS;
1151 0 : }
1152 0 : case 3: {
1153 0 : return FD_BINCODE_SUCCESS;
1154 0 : }
1155 0 : default: return FD_BINCODE_ERR_ENCODING;
1156 0 : }
1157 0 : }
1158 0 : static int fd_reward_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1159 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1160 0 : uint discriminant = 0;
1161 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
1162 0 : if( FD_UNLIKELY( err ) ) return err;
1163 0 : return fd_reward_type_inner_decode_footprint( discriminant, ctx, total_sz );
1164 0 : }
1165 0 : int fd_reward_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1166 0 : *total_sz += sizeof(fd_reward_type_t);
1167 0 : void const * start_data = ctx->data;
1168 0 : int err = fd_reward_type_decode_footprint_inner( ctx, total_sz );
1169 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1170 0 : ctx->data = start_data;
1171 0 : return err;
1172 0 : }
1173 0 : static void fd_reward_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1174 0 : fd_reward_type_t * self = (fd_reward_type_t *)struct_mem;
1175 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
1176 0 : }
1177 0 : void * fd_reward_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1178 0 : fd_reward_type_t * self = (fd_reward_type_t *)mem;
1179 0 : fd_reward_type_new( self );
1180 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_type_t);
1181 0 : void * * alloc_mem = &alloc_region;
1182 0 : fd_reward_type_decode_inner( mem, alloc_mem, ctx );
1183 0 : return self;
1184 0 : }
1185 :
1186 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 ) {
1187 0 : (void) varint;
1188 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_reward_type", level++, 0);
1189 0 : switch( self->discriminant ) {
1190 0 : case 0: {
1191 0 : fun( w, self, "fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
1192 0 : break;
1193 0 : }
1194 0 : case 1: {
1195 0 : fun( w, self, "rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
1196 0 : break;
1197 0 : }
1198 0 : case 2: {
1199 0 : fun( w, self, "staking", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
1200 0 : break;
1201 0 : }
1202 0 : case 3: {
1203 0 : fun( w, self, "voting", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
1204 0 : break;
1205 0 : }
1206 0 : }
1207 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_reward_type", level--, 0 );
1208 0 : }
1209 0 : ulong fd_reward_type_size( fd_reward_type_t const * self ) {
1210 0 : ulong size = 0;
1211 0 : size += sizeof(uint);
1212 0 : switch (self->discriminant) {
1213 0 : }
1214 0 : return size;
1215 0 : }
1216 :
1217 0 : int fd_reward_type_encode( fd_reward_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1218 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
1219 0 : if( FD_UNLIKELY( err ) ) return err;
1220 0 : return err;
1221 0 : }
1222 :
1223 0 : int fd_reward_info_encode( fd_reward_info_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1224 0 : int err;
1225 0 : err = fd_reward_type_encode( &self->reward_type, ctx );
1226 0 : if( FD_UNLIKELY( err ) ) return err;
1227 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
1228 0 : if( FD_UNLIKELY( err ) ) return err;
1229 0 : err = fd_bincode_uint64_encode( self->post_balance, ctx );
1230 0 : if( FD_UNLIKELY( err ) ) return err;
1231 0 : err = fd_bincode_uint64_encode( self->commission, ctx );
1232 0 : if( FD_UNLIKELY( err ) ) return err;
1233 0 : return FD_BINCODE_SUCCESS;
1234 0 : }
1235 0 : static int fd_reward_info_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1236 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1237 0 : int err = 0;
1238 0 : err = fd_reward_type_decode_footprint_inner( ctx, total_sz );
1239 0 : if( FD_UNLIKELY( err ) ) return err;
1240 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1241 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1242 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1243 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1244 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1245 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1246 0 : return 0;
1247 0 : }
1248 0 : int fd_reward_info_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1249 0 : *total_sz += sizeof(fd_reward_info_t);
1250 0 : void const * start_data = ctx->data;
1251 0 : int err = fd_reward_info_decode_footprint_inner( ctx, total_sz );
1252 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1253 0 : ctx->data = start_data;
1254 0 : return err;
1255 0 : }
1256 0 : static void fd_reward_info_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1257 0 : fd_reward_info_t * self = (fd_reward_info_t *)struct_mem;
1258 0 : fd_reward_type_decode_inner( &self->reward_type, alloc_mem, ctx );
1259 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
1260 0 : fd_bincode_uint64_decode_unsafe( &self->post_balance, ctx );
1261 0 : fd_bincode_uint64_decode_unsafe( &self->commission, ctx );
1262 0 : }
1263 0 : void * fd_reward_info_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1264 0 : fd_reward_info_t * self = (fd_reward_info_t *)mem;
1265 0 : fd_reward_info_new( self );
1266 0 : void * alloc_region = (uchar *)mem + sizeof(fd_reward_info_t);
1267 0 : void * * alloc_mem = &alloc_region;
1268 0 : fd_reward_info_decode_inner( mem, alloc_mem, ctx );
1269 0 : return self;
1270 0 : }
1271 0 : void fd_reward_info_new(fd_reward_info_t * self) {
1272 0 : fd_memset( self, 0, sizeof(fd_reward_info_t) );
1273 0 : fd_reward_type_new( &self->reward_type );
1274 0 : }
1275 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 ) {
1276 0 : (void) varint;
1277 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_reward_info", level++, 0 );
1278 0 : fd_reward_type_walk( w, &self->reward_type, fun, "reward_type", level, 0 );
1279 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1280 0 : fun( w, &self->post_balance, "post_balance", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1281 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1282 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_reward_info", level--, 0 );
1283 0 : }
1284 9 : int fd_rust_duration_encode( fd_rust_duration_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1285 9 : int err;
1286 9 : err = fd_bincode_uint64_encode( self->seconds, ctx );
1287 9 : if( FD_UNLIKELY( err ) ) return err;
1288 9 : err = fd_bincode_uint32_encode( self->nanoseconds, ctx );
1289 9 : if( FD_UNLIKELY( err ) ) return err;
1290 9 : return FD_BINCODE_SUCCESS;
1291 9 : }
1292 0 : static inline int fd_rust_duration_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1293 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1294 0 : int err = fd_rust_duration_footprint_validator( ctx );
1295 0 : if( FD_UNLIKELY( err != FD_BINCODE_SUCCESS ) )
1296 0 : return err;
1297 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
1298 0 : return 0;
1299 0 : }
1300 0 : static void fd_rust_duration_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1301 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)struct_mem;
1302 0 : fd_bincode_uint64_decode_unsafe( &self->seconds, ctx );
1303 0 : fd_bincode_uint32_decode_unsafe( &self->nanoseconds, ctx );
1304 0 : fd_rust_duration_normalize( self );
1305 0 : }
1306 0 : void * fd_rust_duration_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1307 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)mem;
1308 0 : fd_rust_duration_new( self );
1309 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rust_duration_t);
1310 0 : void * * alloc_mem = &alloc_region;
1311 0 : fd_rust_duration_decode_inner( mem, alloc_mem, ctx );
1312 0 : return self;
1313 0 : }
1314 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 ) {
1315 0 : (void) varint;
1316 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rust_duration", level++, 0 );
1317 0 : fun( w, &self->seconds, "seconds", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1318 0 : fun( w, &self->nanoseconds, "nanoseconds", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
1319 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rust_duration", level--, 0 );
1320 0 : }
1321 9 : int fd_poh_config_encode( fd_poh_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1322 9 : int err;
1323 9 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
1324 9 : if( FD_UNLIKELY( err ) ) return err;
1325 9 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
1326 9 : if( FD_UNLIKELY( err ) ) return err;
1327 9 : if( self->has_target_tick_count ) {
1328 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
1329 0 : if( FD_UNLIKELY( err ) ) return err;
1330 0 : }
1331 9 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
1332 9 : if( FD_UNLIKELY( err ) ) return err;
1333 9 : if( self->has_hashes_per_tick ) {
1334 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
1335 0 : if( FD_UNLIKELY( err ) ) return err;
1336 0 : }
1337 9 : return FD_BINCODE_SUCCESS;
1338 9 : }
1339 0 : int fd_poh_config_encode_global( fd_poh_config_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1340 0 : int err;
1341 0 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
1342 0 : if( FD_UNLIKELY( err ) ) return err;
1343 0 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
1344 0 : if( FD_UNLIKELY( err ) ) return err;
1345 0 : if( self->has_target_tick_count ) {
1346 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
1347 0 : if( FD_UNLIKELY( err ) ) return err;
1348 0 : }
1349 0 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
1350 0 : if( FD_UNLIKELY( err ) ) return err;
1351 0 : if( self->has_hashes_per_tick ) {
1352 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
1353 0 : if( FD_UNLIKELY( err ) ) return err;
1354 0 : }
1355 0 : return FD_BINCODE_SUCCESS;
1356 0 : }
1357 0 : static int fd_poh_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1358 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1359 0 : int err = 0;
1360 0 : err = fd_rust_duration_decode_footprint_inner( ctx, total_sz );
1361 0 : if( FD_UNLIKELY( err ) ) return err;
1362 0 : {
1363 0 : uchar o;
1364 0 : err = fd_bincode_bool_decode( &o, ctx );
1365 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1366 0 : if( o ) {
1367 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1368 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1369 0 : }
1370 0 : }
1371 0 : {
1372 0 : uchar o;
1373 0 : err = fd_bincode_bool_decode( &o, ctx );
1374 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1375 0 : if( o ) {
1376 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1377 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1378 0 : }
1379 0 : }
1380 0 : return 0;
1381 0 : }
1382 0 : int fd_poh_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1383 0 : *total_sz += sizeof(fd_poh_config_t);
1384 0 : void const * start_data = ctx->data;
1385 0 : int err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
1386 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1387 0 : ctx->data = start_data;
1388 0 : return err;
1389 0 : }
1390 0 : static void fd_poh_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1391 0 : fd_poh_config_t * self = (fd_poh_config_t *)struct_mem;
1392 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
1393 0 : {
1394 0 : uchar o;
1395 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1396 0 : self->has_target_tick_count = !!o;
1397 0 : if( o ) {
1398 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
1399 0 : }
1400 0 : }
1401 0 : {
1402 0 : uchar o;
1403 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1404 0 : self->has_hashes_per_tick = !!o;
1405 0 : if( o ) {
1406 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
1407 0 : }
1408 0 : }
1409 0 : }
1410 0 : void * fd_poh_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1411 0 : fd_poh_config_t * self = (fd_poh_config_t *)mem;
1412 0 : fd_poh_config_new( self );
1413 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_t);
1414 0 : void * * alloc_mem = &alloc_region;
1415 0 : fd_poh_config_decode_inner( mem, alloc_mem, ctx );
1416 0 : return self;
1417 0 : }
1418 0 : static void fd_poh_config_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1419 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)struct_mem;
1420 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
1421 0 : {
1422 0 : uchar o;
1423 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1424 0 : self->has_target_tick_count = !!o;
1425 0 : if( o ) {
1426 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
1427 0 : }
1428 0 : }
1429 0 : {
1430 0 : uchar o;
1431 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1432 0 : self->has_hashes_per_tick = !!o;
1433 0 : if( o ) {
1434 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
1435 0 : }
1436 0 : }
1437 0 : }
1438 0 : void * fd_poh_config_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1439 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)mem;
1440 0 : fd_poh_config_new( (fd_poh_config_t *)self );
1441 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_global_t);
1442 0 : void * * alloc_mem = &alloc_region;
1443 0 : fd_poh_config_decode_inner_global( mem, alloc_mem, ctx );
1444 0 : return self;
1445 0 : }
1446 12 : void fd_poh_config_new(fd_poh_config_t * self) {
1447 12 : fd_memset( self, 0, sizeof(fd_poh_config_t) );
1448 12 : fd_rust_duration_new( &self->target_tick_duration );
1449 12 : }
1450 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 ) {
1451 0 : (void) varint;
1452 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_poh_config", level++, 0 );
1453 0 : fd_rust_duration_walk( w, &self->target_tick_duration, fun, "target_tick_duration", level, 0 );
1454 0 : if( !self->has_target_tick_count ) {
1455 0 : fun( w, NULL, "target_tick_count", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
1456 0 : } else {
1457 0 : fun( w, &self->target_tick_count, "target_tick_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1458 0 : }
1459 0 : if( !self->has_hashes_per_tick ) {
1460 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
1461 0 : } else {
1462 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1463 0 : }
1464 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_poh_config", level--, 0 );
1465 0 : }
1466 0 : ulong fd_poh_config_size( fd_poh_config_t const * self ) {
1467 0 : ulong size = 0;
1468 0 : size += fd_rust_duration_size( &self->target_tick_duration );
1469 0 : size += sizeof(char);
1470 0 : if( self->has_target_tick_count ) {
1471 0 : size += sizeof(ulong);
1472 0 : }
1473 0 : size += sizeof(char);
1474 0 : if( self->has_hashes_per_tick ) {
1475 0 : size += sizeof(ulong);
1476 0 : }
1477 0 : return size;
1478 0 : }
1479 :
1480 0 : ulong fd_poh_config_size_global( fd_poh_config_global_t const * self ) {
1481 0 : ulong size = 0;
1482 0 : size += fd_rust_duration_size( &self->target_tick_duration );
1483 0 : size += sizeof(char);
1484 0 : if( self->has_target_tick_count ) {
1485 0 : size += sizeof(ulong);
1486 0 : }
1487 0 : size += sizeof(char);
1488 0 : if( self->has_hashes_per_tick ) {
1489 0 : size += sizeof(ulong);
1490 0 : }
1491 0 : return size;
1492 0 : }
1493 :
1494 0 : int fd_string_pubkey_pair_encode( fd_string_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1495 0 : int err;
1496 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
1497 0 : if( FD_UNLIKELY(err) ) return err;
1498 0 : if( self->string_len ) {
1499 0 : err = fd_bincode_bytes_encode( self->string, self->string_len, ctx );
1500 0 : if( FD_UNLIKELY( err ) ) return err;
1501 0 : }
1502 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
1503 0 : if( FD_UNLIKELY( err ) ) return err;
1504 0 : return FD_BINCODE_SUCCESS;
1505 0 : }
1506 0 : int fd_string_pubkey_pair_encode_global( fd_string_pubkey_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1507 0 : int err;
1508 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
1509 0 : if( FD_UNLIKELY( err ) ) return err;
1510 0 : if( self->string_len ) {
1511 0 : uchar * string_laddr = (uchar*)self + self->string_offset;
1512 0 : err = fd_bincode_bytes_encode( string_laddr, self->string_len, ctx );
1513 0 : if( FD_UNLIKELY( err ) ) return err;
1514 0 : }
1515 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
1516 0 : if( FD_UNLIKELY( err ) ) return err;
1517 0 : return FD_BINCODE_SUCCESS;
1518 0 : }
1519 0 : static int fd_string_pubkey_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1520 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1521 0 : int err = 0;
1522 0 : ulong string_len;
1523 0 : err = fd_bincode_uint64_decode( &string_len, ctx );
1524 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1525 0 : *total_sz += string_len;
1526 0 : if( string_len ) {
1527 0 : err = fd_bincode_bytes_decode_footprint( string_len, ctx );
1528 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1529 0 : err = !fd_utf8_verify( (char const *) ctx->data - string_len, string_len );
1530 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1531 0 : }
1532 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1533 0 : if( FD_UNLIKELY( err ) ) return err;
1534 0 : return 0;
1535 0 : }
1536 0 : int fd_string_pubkey_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1537 0 : *total_sz += sizeof(fd_string_pubkey_pair_t);
1538 0 : void const * start_data = ctx->data;
1539 0 : int err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
1540 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1541 0 : ctx->data = start_data;
1542 0 : return err;
1543 0 : }
1544 0 : static void fd_string_pubkey_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1545 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)struct_mem;
1546 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
1547 0 : if( self->string_len ) {
1548 0 : self->string = *alloc_mem;
1549 0 : fd_bincode_bytes_decode_unsafe( self->string, self->string_len, ctx );
1550 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
1551 0 : } else
1552 0 : self->string = NULL;
1553 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1554 0 : }
1555 0 : void * fd_string_pubkey_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1556 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)mem;
1557 0 : fd_string_pubkey_pair_new( self );
1558 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_t);
1559 0 : void * * alloc_mem = &alloc_region;
1560 0 : fd_string_pubkey_pair_decode_inner( mem, alloc_mem, ctx );
1561 0 : return self;
1562 0 : }
1563 0 : static void fd_string_pubkey_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1564 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)struct_mem;
1565 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
1566 0 : if( self->string_len ) {
1567 0 : self->string_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1568 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->string_len, ctx );
1569 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
1570 0 : } else {
1571 0 : self->string_offset = 0UL;
1572 0 : }
1573 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1574 0 : }
1575 0 : void * fd_string_pubkey_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1576 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)mem;
1577 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)self );
1578 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_global_t);
1579 0 : void * * alloc_mem = &alloc_region;
1580 0 : fd_string_pubkey_pair_decode_inner_global( mem, alloc_mem, ctx );
1581 0 : return self;
1582 0 : }
1583 0 : void fd_string_pubkey_pair_new(fd_string_pubkey_pair_t * self) {
1584 0 : fd_memset( self, 0, sizeof(fd_string_pubkey_pair_t) );
1585 0 : fd_pubkey_new( &self->pubkey );
1586 0 : }
1587 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 ) {
1588 0 : (void) varint;
1589 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_string_pubkey_pair", level++, 0 );
1590 0 : if( self->string_len ) {
1591 0 : fun( w, NULL, "string", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
1592 0 : for( ulong i=0; i < self->string_len; i++ )
1593 0 : fun( w, self->string + i, "string", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1594 0 : fun( w, NULL, "string", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
1595 0 : }
1596 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
1597 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_string_pubkey_pair", level--, 0 );
1598 0 : }
1599 0 : ulong fd_string_pubkey_pair_size( fd_string_pubkey_pair_t const * self ) {
1600 0 : ulong size = 0;
1601 0 : do {
1602 0 : size += sizeof(ulong);
1603 0 : size += self->string_len;
1604 0 : } while(0);
1605 0 : size += fd_pubkey_size( &self->pubkey );
1606 0 : return size;
1607 0 : }
1608 :
1609 0 : ulong fd_string_pubkey_pair_size_global( fd_string_pubkey_pair_global_t const * self ) {
1610 0 : ulong size = 0;
1611 0 : do {
1612 0 : size += sizeof(ulong);
1613 0 : uchar * string = self->string_offset ? (uchar *)fd_type_pun( (uchar *)self + self->string_offset ) : NULL;
1614 0 : size += self->string_len;
1615 0 : } while(0);
1616 0 : size += fd_pubkey_size( &self->pubkey );
1617 0 : return size;
1618 0 : }
1619 :
1620 144 : int fd_pubkey_account_pair_encode( fd_pubkey_account_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1621 144 : int err;
1622 144 : err = fd_pubkey_encode( &self->key, ctx );
1623 144 : if( FD_UNLIKELY( err ) ) return err;
1624 144 : err = fd_solana_account_encode( &self->account, ctx );
1625 144 : if( FD_UNLIKELY( err ) ) return err;
1626 144 : return FD_BINCODE_SUCCESS;
1627 144 : }
1628 0 : int fd_pubkey_account_pair_encode_global( fd_pubkey_account_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1629 0 : int err;
1630 0 : err = fd_pubkey_encode( &self->key, ctx );
1631 0 : if( FD_UNLIKELY( err ) ) return err;
1632 0 : err = fd_solana_account_encode_global( &self->account, ctx );
1633 0 : if( FD_UNLIKELY( err ) ) return err;
1634 0 : return FD_BINCODE_SUCCESS;
1635 0 : }
1636 0 : static int fd_pubkey_account_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1637 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1638 0 : int err = 0;
1639 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1640 0 : if( FD_UNLIKELY( err ) ) return err;
1641 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
1642 0 : if( FD_UNLIKELY( err ) ) return err;
1643 0 : return 0;
1644 0 : }
1645 0 : int fd_pubkey_account_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1646 0 : *total_sz += sizeof(fd_pubkey_account_pair_t);
1647 0 : void const * start_data = ctx->data;
1648 0 : int err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1649 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1650 0 : ctx->data = start_data;
1651 0 : return err;
1652 0 : }
1653 0 : static void fd_pubkey_account_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1654 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)struct_mem;
1655 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1656 0 : fd_solana_account_decode_inner( &self->account, alloc_mem, ctx );
1657 0 : }
1658 0 : void * fd_pubkey_account_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1659 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)mem;
1660 0 : fd_pubkey_account_pair_new( self );
1661 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_t);
1662 0 : void * * alloc_mem = &alloc_region;
1663 0 : fd_pubkey_account_pair_decode_inner( mem, alloc_mem, ctx );
1664 0 : return self;
1665 0 : }
1666 0 : static void fd_pubkey_account_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1667 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)struct_mem;
1668 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1669 0 : fd_solana_account_decode_inner_global( &self->account, alloc_mem, ctx );
1670 0 : }
1671 0 : void * fd_pubkey_account_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1672 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)mem;
1673 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)self );
1674 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_global_t);
1675 0 : void * * alloc_mem = &alloc_region;
1676 0 : fd_pubkey_account_pair_decode_inner_global( mem, alloc_mem, ctx );
1677 0 : return self;
1678 0 : }
1679 0 : void fd_pubkey_account_pair_new(fd_pubkey_account_pair_t * self) {
1680 0 : fd_memset( self, 0, sizeof(fd_pubkey_account_pair_t) );
1681 0 : fd_pubkey_new( &self->key );
1682 0 : fd_solana_account_new( &self->account );
1683 0 : }
1684 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 ) {
1685 0 : (void) varint;
1686 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_account_pair", level++, 0 );
1687 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
1688 0 : fd_solana_account_walk( w, &self->account, fun, "account", level, 0 );
1689 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_account_pair", level--, 0 );
1690 0 : }
1691 0 : ulong fd_pubkey_account_pair_size( fd_pubkey_account_pair_t const * self ) {
1692 0 : ulong size = 0;
1693 0 : size += fd_pubkey_size( &self->key );
1694 0 : size += fd_solana_account_size( &self->account );
1695 0 : return size;
1696 0 : }
1697 :
1698 0 : ulong fd_pubkey_account_pair_size_global( fd_pubkey_account_pair_global_t const * self ) {
1699 0 : ulong size = 0;
1700 0 : size += fd_pubkey_size( &self->key );
1701 0 : size += fd_solana_account_size_global( &self->account );
1702 0 : return size;
1703 0 : }
1704 :
1705 12 : int fd_genesis_solana_encode( fd_genesis_solana_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1706 12 : int err;
1707 12 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1708 12 : if( FD_UNLIKELY( err ) ) return err;
1709 9 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1710 9 : if( FD_UNLIKELY(err) ) return err;
1711 9 : if( self->accounts_len ) {
1712 153 : for( ulong i=0; i < self->accounts_len; i++ ) {
1713 144 : err = fd_pubkey_account_pair_encode( self->accounts + i, ctx );
1714 144 : if( FD_UNLIKELY( err ) ) return err;
1715 144 : }
1716 9 : }
1717 9 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1718 9 : if( FD_UNLIKELY(err) ) return err;
1719 9 : if( self->native_instruction_processors_len ) {
1720 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1721 0 : err = fd_string_pubkey_pair_encode( self->native_instruction_processors + i, ctx );
1722 0 : if( FD_UNLIKELY( err ) ) return err;
1723 0 : }
1724 0 : }
1725 9 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1726 9 : if( FD_UNLIKELY(err) ) return err;
1727 9 : if( self->rewards_pools_len ) {
1728 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1729 0 : err = fd_pubkey_account_pair_encode( self->rewards_pools + i, ctx );
1730 0 : if( FD_UNLIKELY( err ) ) return err;
1731 0 : }
1732 0 : }
1733 9 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1734 9 : if( FD_UNLIKELY( err ) ) return err;
1735 9 : err = fd_bincode_uint64_encode( self->unused, ctx );
1736 9 : if( FD_UNLIKELY( err ) ) return err;
1737 9 : err = fd_poh_config_encode( &self->poh_config, ctx );
1738 9 : if( FD_UNLIKELY( err ) ) return err;
1739 9 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1740 9 : if( FD_UNLIKELY( err ) ) return err;
1741 9 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1742 9 : if( FD_UNLIKELY( err ) ) return err;
1743 9 : err = fd_rent_encode( &self->rent, ctx );
1744 9 : if( FD_UNLIKELY( err ) ) return err;
1745 9 : err = fd_inflation_encode( &self->inflation, ctx );
1746 9 : if( FD_UNLIKELY( err ) ) return err;
1747 9 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1748 9 : if( FD_UNLIKELY( err ) ) return err;
1749 9 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1750 9 : if( FD_UNLIKELY( err ) ) return err;
1751 9 : return FD_BINCODE_SUCCESS;
1752 9 : }
1753 0 : int fd_genesis_solana_encode_global( fd_genesis_solana_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1754 0 : int err;
1755 0 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1756 0 : if( FD_UNLIKELY( err ) ) return err;
1757 0 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1758 0 : if( FD_UNLIKELY( err ) ) return err;
1759 0 : if( self->accounts_len ) {
1760 0 : uchar * accounts_laddr = (uchar*)self + self->accounts_offset;
1761 0 : fd_pubkey_account_pair_global_t * accounts = (fd_pubkey_account_pair_global_t *)accounts_laddr;
1762 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1763 0 : err = fd_pubkey_account_pair_encode_global( &accounts[i], ctx );
1764 0 : if( FD_UNLIKELY( err ) ) return err;
1765 0 : }
1766 0 : }
1767 0 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1768 0 : if( FD_UNLIKELY( err ) ) return err;
1769 0 : if( self->native_instruction_processors_len ) {
1770 0 : uchar * native_instruction_processors_laddr = (uchar*)self + self->native_instruction_processors_offset;
1771 0 : fd_string_pubkey_pair_global_t * native_instruction_processors = (fd_string_pubkey_pair_global_t *)native_instruction_processors_laddr;
1772 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1773 0 : err = fd_string_pubkey_pair_encode_global( &native_instruction_processors[i], ctx );
1774 0 : if( FD_UNLIKELY( err ) ) return err;
1775 0 : }
1776 0 : }
1777 0 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1778 0 : if( FD_UNLIKELY( err ) ) return err;
1779 0 : if( self->rewards_pools_len ) {
1780 0 : uchar * rewards_pools_laddr = (uchar*)self + self->rewards_pools_offset;
1781 0 : fd_pubkey_account_pair_global_t * rewards_pools = (fd_pubkey_account_pair_global_t *)rewards_pools_laddr;
1782 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1783 0 : err = fd_pubkey_account_pair_encode_global( &rewards_pools[i], ctx );
1784 0 : if( FD_UNLIKELY( err ) ) return err;
1785 0 : }
1786 0 : }
1787 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1788 0 : if( FD_UNLIKELY( err ) ) return err;
1789 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
1790 0 : if( FD_UNLIKELY( err ) ) return err;
1791 0 : err = fd_poh_config_encode_global( &self->poh_config, ctx );
1792 0 : if( FD_UNLIKELY( err ) ) return err;
1793 0 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1794 0 : if( FD_UNLIKELY( err ) ) return err;
1795 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1796 0 : if( FD_UNLIKELY( err ) ) return err;
1797 0 : err = fd_rent_encode( &self->rent, ctx );
1798 0 : if( FD_UNLIKELY( err ) ) return err;
1799 0 : err = fd_inflation_encode( &self->inflation, ctx );
1800 0 : if( FD_UNLIKELY( err ) ) return err;
1801 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1802 0 : if( FD_UNLIKELY( err ) ) return err;
1803 0 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1804 0 : if( FD_UNLIKELY( err ) ) return err;
1805 0 : return FD_BINCODE_SUCCESS;
1806 0 : }
1807 0 : static int fd_genesis_solana_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1808 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1809 0 : int err = 0;
1810 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1811 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1812 0 : ulong accounts_len;
1813 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
1814 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1815 0 : if( accounts_len ) {
1816 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*accounts_len;
1817 0 : for( ulong i=0; i < accounts_len; i++ ) {
1818 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1819 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1820 0 : }
1821 0 : }
1822 0 : ulong native_instruction_processors_len;
1823 0 : err = fd_bincode_uint64_decode( &native_instruction_processors_len, ctx );
1824 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1825 0 : if( native_instruction_processors_len ) {
1826 0 : *total_sz += FD_STRING_PUBKEY_PAIR_ALIGN + sizeof(fd_string_pubkey_pair_t)*native_instruction_processors_len;
1827 0 : for( ulong i=0; i < native_instruction_processors_len; i++ ) {
1828 0 : err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
1829 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1830 0 : }
1831 0 : }
1832 0 : ulong rewards_pools_len;
1833 0 : err = fd_bincode_uint64_decode( &rewards_pools_len, ctx );
1834 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1835 0 : if( rewards_pools_len ) {
1836 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*rewards_pools_len;
1837 0 : for( ulong i=0; i < rewards_pools_len; i++ ) {
1838 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1839 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1840 0 : }
1841 0 : }
1842 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1843 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1844 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1845 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1846 0 : err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
1847 0 : if( FD_UNLIKELY( err ) ) return err;
1848 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1849 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1850 0 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
1851 0 : if( FD_UNLIKELY( err ) ) return err;
1852 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
1853 0 : if( FD_UNLIKELY( err ) ) return err;
1854 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
1855 0 : if( FD_UNLIKELY( err ) ) return err;
1856 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
1857 0 : if( FD_UNLIKELY( err ) ) return err;
1858 0 : err = fd_bincode_uint32_decode_footprint( ctx );
1859 0 : if( FD_UNLIKELY( err ) ) return err;
1860 0 : return 0;
1861 0 : }
1862 0 : int fd_genesis_solana_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1863 0 : *total_sz += sizeof(fd_genesis_solana_t);
1864 0 : void const * start_data = ctx->data;
1865 0 : int err = fd_genesis_solana_decode_footprint_inner( ctx, total_sz );
1866 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1867 0 : ctx->data = start_data;
1868 0 : return err;
1869 0 : }
1870 0 : static void fd_genesis_solana_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1871 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)struct_mem;
1872 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1873 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1874 0 : if( self->accounts_len ) {
1875 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1876 0 : self->accounts = *alloc_mem;
1877 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1878 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1879 0 : fd_pubkey_account_pair_new( self->accounts + i );
1880 0 : fd_pubkey_account_pair_decode_inner( self->accounts + i, alloc_mem, ctx );
1881 0 : }
1882 0 : } else
1883 0 : self->accounts = NULL;
1884 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1885 0 : if( self->native_instruction_processors_len ) {
1886 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1887 0 : self->native_instruction_processors = *alloc_mem;
1888 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1889 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1890 0 : fd_string_pubkey_pair_new( self->native_instruction_processors + i );
1891 0 : fd_string_pubkey_pair_decode_inner( self->native_instruction_processors + i, alloc_mem, ctx );
1892 0 : }
1893 0 : } else
1894 0 : self->native_instruction_processors = NULL;
1895 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
1896 0 : if( self->rewards_pools_len ) {
1897 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1898 0 : self->rewards_pools = *alloc_mem;
1899 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
1900 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1901 0 : fd_pubkey_account_pair_new( self->rewards_pools + i );
1902 0 : fd_pubkey_account_pair_decode_inner( self->rewards_pools + i, alloc_mem, ctx );
1903 0 : }
1904 0 : } else
1905 0 : self->rewards_pools = NULL;
1906 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
1907 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
1908 0 : fd_poh_config_decode_inner( &self->poh_config, alloc_mem, ctx );
1909 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
1910 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
1911 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1912 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
1913 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1914 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
1915 0 : }
1916 0 : void * fd_genesis_solana_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1917 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)mem;
1918 0 : fd_genesis_solana_new( self );
1919 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_t);
1920 0 : void * * alloc_mem = &alloc_region;
1921 0 : fd_genesis_solana_decode_inner( mem, alloc_mem, ctx );
1922 0 : return self;
1923 0 : }
1924 0 : static void fd_genesis_solana_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1925 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)struct_mem;
1926 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1927 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1928 0 : if( self->accounts_len ) {
1929 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1930 0 : self->accounts_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1931 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1932 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1933 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1934 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
1935 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
1936 0 : }
1937 0 : } else {
1938 0 : self->accounts_offset = 0UL;
1939 0 : }
1940 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1941 0 : if( self->native_instruction_processors_len ) {
1942 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1943 0 : self->native_instruction_processors_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1944 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1945 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1946 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1947 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)fd_type_pun(cur_mem + sizeof(fd_string_pubkey_pair_t) * i) );
1948 0 : fd_string_pubkey_pair_decode_inner_global( cur_mem + sizeof(fd_string_pubkey_pair_t) * i, alloc_mem, ctx );
1949 0 : }
1950 0 : } else {
1951 0 : self->native_instruction_processors_offset = 0UL;
1952 0 : }
1953 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
1954 0 : if( self->rewards_pools_len ) {
1955 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1956 0 : self->rewards_pools_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1957 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1958 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
1959 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1960 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
1961 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
1962 0 : }
1963 0 : } else {
1964 0 : self->rewards_pools_offset = 0UL;
1965 0 : }
1966 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
1967 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
1968 0 : fd_poh_config_decode_inner_global( &self->poh_config, alloc_mem, ctx );
1969 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
1970 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
1971 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1972 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
1973 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1974 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
1975 0 : }
1976 0 : void * fd_genesis_solana_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1977 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)mem;
1978 0 : fd_genesis_solana_new( (fd_genesis_solana_t *)self );
1979 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_global_t);
1980 0 : void * * alloc_mem = &alloc_region;
1981 0 : fd_genesis_solana_decode_inner_global( mem, alloc_mem, ctx );
1982 0 : return self;
1983 0 : }
1984 12 : void fd_genesis_solana_new(fd_genesis_solana_t * self) {
1985 12 : fd_memset( self, 0, sizeof(fd_genesis_solana_t) );
1986 12 : fd_poh_config_new( &self->poh_config );
1987 12 : fd_fee_rate_governor_new( &self->fee_rate_governor );
1988 12 : fd_rent_new( &self->rent );
1989 12 : fd_inflation_new( &self->inflation );
1990 12 : fd_epoch_schedule_new( &self->epoch_schedule );
1991 12 : }
1992 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 ) {
1993 0 : (void) varint;
1994 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_genesis_solana", level++, 0 );
1995 0 : fun( w, &self->creation_time, "creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1996 0 : if( self->accounts_len ) {
1997 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
1998 0 : for( ulong i=0; i < self->accounts_len; i++ )
1999 0 : fd_pubkey_account_pair_walk(w, self->accounts + i, fun, "pubkey_account_pair", level, 0 );
2000 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
2001 0 : }
2002 0 : if( self->native_instruction_processors_len ) {
2003 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
2004 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
2005 0 : fd_string_pubkey_pair_walk(w, self->native_instruction_processors + i, fun, "string_pubkey_pair", level, 0 );
2006 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
2007 0 : }
2008 0 : if( self->rewards_pools_len ) {
2009 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
2010 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
2011 0 : fd_pubkey_account_pair_walk(w, self->rewards_pools + i, fun, "pubkey_account_pair", level, 0 );
2012 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
2013 0 : }
2014 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2015 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2016 0 : fd_poh_config_walk( w, &self->poh_config, fun, "poh_config", level, 0 );
2017 0 : fun( w, &self->__backwards_compat_with_v0_23, "__backwards_compat_with_v0_23", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2018 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level, 0 );
2019 0 : fd_rent_walk( w, &self->rent, fun, "rent", level, 0 );
2020 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level, 0 );
2021 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level, 0 );
2022 0 : fun( w, &self->cluster_type, "cluster_type", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
2023 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_genesis_solana", level--, 0 );
2024 0 : }
2025 0 : ulong fd_genesis_solana_size( fd_genesis_solana_t const * self ) {
2026 0 : ulong size = 0;
2027 0 : size += sizeof(ulong);
2028 0 : do {
2029 0 : size += sizeof(ulong);
2030 0 : for( ulong i=0; i < self->accounts_len; i++ )
2031 0 : size += fd_pubkey_account_pair_size( self->accounts + i );
2032 0 : } while(0);
2033 0 : do {
2034 0 : size += sizeof(ulong);
2035 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
2036 0 : size += fd_string_pubkey_pair_size( self->native_instruction_processors + i );
2037 0 : } while(0);
2038 0 : do {
2039 0 : size += sizeof(ulong);
2040 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
2041 0 : size += fd_pubkey_account_pair_size( self->rewards_pools + i );
2042 0 : } while(0);
2043 0 : size += sizeof(ulong);
2044 0 : size += sizeof(ulong);
2045 0 : size += fd_poh_config_size( &self->poh_config );
2046 0 : size += sizeof(ulong);
2047 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
2048 0 : size += fd_rent_size( &self->rent );
2049 0 : size += fd_inflation_size( &self->inflation );
2050 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
2051 0 : size += sizeof(uint);
2052 0 : return size;
2053 0 : }
2054 :
2055 0 : ulong fd_genesis_solana_size_global( fd_genesis_solana_global_t const * self ) {
2056 0 : ulong size = 0;
2057 0 : size += sizeof(ulong);
2058 0 : do {
2059 0 : size += sizeof(ulong);
2060 0 : fd_pubkey_account_pair_global_t * accounts = self->accounts_offset ? (fd_pubkey_account_pair_global_t *)fd_type_pun( (uchar *)self + self->accounts_offset ) : NULL;
2061 0 : for( ulong i=0; i < self->accounts_len; i++ )
2062 0 : size += fd_pubkey_account_pair_size_global( accounts + i );
2063 0 : } while(0);
2064 0 : do {
2065 0 : size += sizeof(ulong);
2066 0 : fd_string_pubkey_pair_global_t * native_instruction_processors = self->native_instruction_processors_offset ? (fd_string_pubkey_pair_global_t *)fd_type_pun( (uchar *)self + self->native_instruction_processors_offset ) : NULL;
2067 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
2068 0 : size += fd_string_pubkey_pair_size_global( native_instruction_processors + i );
2069 0 : } while(0);
2070 0 : do {
2071 0 : size += sizeof(ulong);
2072 0 : fd_pubkey_account_pair_global_t * rewards_pools = self->rewards_pools_offset ? (fd_pubkey_account_pair_global_t *)fd_type_pun( (uchar *)self + self->rewards_pools_offset ) : NULL;
2073 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
2074 0 : size += fd_pubkey_account_pair_size_global( rewards_pools + i );
2075 0 : } while(0);
2076 0 : size += sizeof(ulong);
2077 0 : size += sizeof(ulong);
2078 0 : size += fd_poh_config_size_global( &self->poh_config );
2079 0 : size += sizeof(ulong);
2080 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
2081 0 : size += fd_rent_size( &self->rent );
2082 0 : size += fd_inflation_size( &self->inflation );
2083 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
2084 0 : size += sizeof(uint);
2085 0 : return size;
2086 0 : }
2087 :
2088 0 : int fd_sol_sysvar_clock_encode( fd_sol_sysvar_clock_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2089 0 : int err;
2090 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
2091 0 : if( FD_UNLIKELY( err ) ) return err;
2092 0 : err = fd_bincode_uint64_encode( (ulong)self->epoch_start_timestamp, ctx );
2093 0 : if( FD_UNLIKELY( err ) ) return err;
2094 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2095 0 : if( FD_UNLIKELY( err ) ) return err;
2096 0 : err = fd_bincode_uint64_encode( self->leader_schedule_epoch, ctx );
2097 0 : if( FD_UNLIKELY( err ) ) return err;
2098 0 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
2099 0 : if( FD_UNLIKELY( err ) ) return err;
2100 0 : return FD_BINCODE_SUCCESS;
2101 0 : }
2102 0 : static inline int fd_sol_sysvar_clock_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2103 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2104 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
2105 0 : return 0;
2106 0 : }
2107 3 : static void fd_sol_sysvar_clock_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2108 3 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)struct_mem;
2109 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2110 3 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
2111 3 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2112 3 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
2113 3 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
2114 3 : }
2115 3 : void * fd_sol_sysvar_clock_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2116 3 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)mem;
2117 3 : fd_sol_sysvar_clock_new( self );
2118 3 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_clock_t);
2119 3 : void * * alloc_mem = &alloc_region;
2120 3 : fd_sol_sysvar_clock_decode_inner( mem, alloc_mem, ctx );
2121 3 : return self;
2122 3 : }
2123 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 ) {
2124 0 : (void) varint;
2125 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_clock", level++, 0 );
2126 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2127 0 : fun( w, &self->epoch_start_timestamp, "epoch_start_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
2128 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2129 0 : fun( w, &self->leader_schedule_epoch, "leader_schedule_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2130 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
2131 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_clock", level--, 0 );
2132 0 : }
2133 0 : int fd_sol_sysvar_last_restart_slot_encode( fd_sol_sysvar_last_restart_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2134 0 : int err;
2135 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
2136 0 : if( FD_UNLIKELY( err ) ) return err;
2137 0 : return FD_BINCODE_SUCCESS;
2138 0 : }
2139 0 : static inline int fd_sol_sysvar_last_restart_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2140 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2141 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
2142 0 : return 0;
2143 0 : }
2144 0 : static void fd_sol_sysvar_last_restart_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2145 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)struct_mem;
2146 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2147 0 : }
2148 0 : void * fd_sol_sysvar_last_restart_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2149 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)mem;
2150 0 : fd_sol_sysvar_last_restart_slot_new( self );
2151 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_last_restart_slot_t);
2152 0 : void * * alloc_mem = &alloc_region;
2153 0 : fd_sol_sysvar_last_restart_slot_decode_inner( mem, alloc_mem, ctx );
2154 0 : return self;
2155 0 : }
2156 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 ) {
2157 0 : (void) varint;
2158 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_last_restart_slot", level++, 0 );
2159 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2160 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_last_restart_slot", level--, 0 );
2161 0 : }
2162 96 : int fd_vote_lockout_encode( fd_vote_lockout_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2163 96 : int err;
2164 96 : err = fd_bincode_uint64_encode( self->slot, ctx );
2165 96 : if( FD_UNLIKELY( err ) ) return err;
2166 96 : err = fd_bincode_uint32_encode( self->confirmation_count, ctx );
2167 96 : if( FD_UNLIKELY( err ) ) return err;
2168 96 : return FD_BINCODE_SUCCESS;
2169 96 : }
2170 0 : static inline int fd_vote_lockout_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2171 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2172 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
2173 0 : return 0;
2174 0 : }
2175 195 : static void fd_vote_lockout_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2176 195 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)struct_mem;
2177 195 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2178 195 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
2179 195 : }
2180 0 : void * fd_vote_lockout_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2181 0 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)mem;
2182 0 : fd_vote_lockout_new( self );
2183 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_lockout_t);
2184 0 : void * * alloc_mem = &alloc_region;
2185 0 : fd_vote_lockout_decode_inner( mem, alloc_mem, ctx );
2186 0 : return self;
2187 0 : }
2188 99 : 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 ) {
2189 99 : (void) varint;
2190 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_lockout", level++, 0 );
2191 99 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2192 99 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
2193 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_lockout", level--, 0 );
2194 99 : }
2195 0 : int fd_lockout_offset_encode( fd_lockout_offset_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2196 0 : int err;
2197 0 : err = fd_bincode_varint_encode( self->offset, ctx );
2198 0 : if( FD_UNLIKELY( err ) ) return err;
2199 0 : err = fd_bincode_uint8_encode( (uchar)(self->confirmation_count), ctx );
2200 0 : if( FD_UNLIKELY( err ) ) return err;
2201 0 : return FD_BINCODE_SUCCESS;
2202 0 : }
2203 0 : static int fd_lockout_offset_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2204 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2205 0 : int err = 0;
2206 0 : err = fd_bincode_varint_decode_footprint( ctx );
2207 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2208 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2209 0 : if( FD_UNLIKELY( err ) ) return err;
2210 0 : return 0;
2211 0 : }
2212 0 : int fd_lockout_offset_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2213 0 : *total_sz += sizeof(fd_lockout_offset_t);
2214 0 : void const * start_data = ctx->data;
2215 0 : int err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
2216 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2217 0 : ctx->data = start_data;
2218 0 : return err;
2219 0 : }
2220 0 : static void fd_lockout_offset_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2221 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)struct_mem;
2222 0 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
2223 0 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
2224 0 : }
2225 0 : void * fd_lockout_offset_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2226 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)mem;
2227 0 : fd_lockout_offset_new( self );
2228 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockout_offset_t);
2229 0 : void * * alloc_mem = &alloc_region;
2230 0 : fd_lockout_offset_decode_inner( mem, alloc_mem, ctx );
2231 0 : return self;
2232 0 : }
2233 0 : void fd_lockout_offset_new(fd_lockout_offset_t * self) {
2234 0 : fd_memset( self, 0, sizeof(fd_lockout_offset_t) );
2235 0 : }
2236 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 ) {
2237 0 : (void) varint;
2238 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockout_offset", level++, 0 );
2239 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 1 );
2240 0 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2241 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockout_offset", level--, 0 );
2242 0 : }
2243 0 : ulong fd_lockout_offset_size( fd_lockout_offset_t const * self ) {
2244 0 : ulong size = 0;
2245 0 : size += fd_bincode_varint_size( self->offset );
2246 0 : size += sizeof(char);
2247 0 : return size;
2248 0 : }
2249 :
2250 18 : int fd_vote_authorized_voter_encode( fd_vote_authorized_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2251 18 : int err;
2252 18 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2253 18 : if( FD_UNLIKELY( err ) ) return err;
2254 18 : err = fd_pubkey_encode( &self->pubkey, ctx );
2255 18 : if( FD_UNLIKELY( err ) ) return err;
2256 18 : return FD_BINCODE_SUCCESS;
2257 18 : }
2258 15 : static inline int fd_vote_authorized_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2259 15 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2260 15 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
2261 15 : return 0;
2262 15 : }
2263 15 : static void fd_vote_authorized_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2264 15 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)struct_mem;
2265 15 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2266 15 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
2267 15 : }
2268 0 : void * fd_vote_authorized_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2269 0 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)mem;
2270 0 : fd_vote_authorized_voter_new( self );
2271 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voter_t);
2272 0 : void * * alloc_mem = &alloc_region;
2273 0 : fd_vote_authorized_voter_decode_inner( mem, alloc_mem, ctx );
2274 0 : return self;
2275 0 : }
2276 9 : 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 ) {
2277 9 : (void) varint;
2278 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voter", level++, 0 );
2279 9 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2280 9 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
2281 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voter", level--, 0 );
2282 9 : }
2283 576 : int fd_vote_prior_voter_encode( fd_vote_prior_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2284 576 : int err;
2285 576 : err = fd_pubkey_encode( &self->pubkey, ctx );
2286 576 : if( FD_UNLIKELY( err ) ) return err;
2287 576 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
2288 576 : if( FD_UNLIKELY( err ) ) return err;
2289 576 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
2290 576 : if( FD_UNLIKELY( err ) ) return err;
2291 576 : return FD_BINCODE_SUCCESS;
2292 576 : }
2293 480 : static inline int fd_vote_prior_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2294 480 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2295 480 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
2296 480 : return 0;
2297 480 : }
2298 480 : static void fd_vote_prior_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2299 480 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)struct_mem;
2300 480 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
2301 480 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
2302 480 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
2303 480 : }
2304 0 : void * fd_vote_prior_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2305 0 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)mem;
2306 0 : fd_vote_prior_voter_new( self );
2307 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_t);
2308 0 : void * * alloc_mem = &alloc_region;
2309 0 : fd_vote_prior_voter_decode_inner( mem, alloc_mem, ctx );
2310 0 : return self;
2311 0 : }
2312 288 : 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 ) {
2313 288 : (void) varint;
2314 288 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter", level++, 0 );
2315 288 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
2316 288 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2317 288 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2318 288 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter", level--, 0 );
2319 288 : }
2320 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 ) {
2321 0 : int err;
2322 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
2323 0 : if( FD_UNLIKELY( err ) ) return err;
2324 0 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
2325 0 : if( FD_UNLIKELY( err ) ) return err;
2326 0 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
2327 0 : if( FD_UNLIKELY( err ) ) return err;
2328 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
2329 0 : if( FD_UNLIKELY( err ) ) return err;
2330 0 : return FD_BINCODE_SUCCESS;
2331 0 : }
2332 0 : static inline int fd_vote_prior_voter_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2333 0 : if( (ulong)ctx->data + 56UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2334 0 : ctx->data = (void *)( (ulong)ctx->data + 56UL );
2335 0 : return 0;
2336 0 : }
2337 0 : static void fd_vote_prior_voter_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2338 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)struct_mem;
2339 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
2340 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
2341 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
2342 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2343 0 : }
2344 0 : void * fd_vote_prior_voter_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2345 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)mem;
2346 0 : fd_vote_prior_voter_0_23_5_new( self );
2347 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_0_23_5_t);
2348 0 : void * * alloc_mem = &alloc_region;
2349 0 : fd_vote_prior_voter_0_23_5_decode_inner( mem, alloc_mem, ctx );
2350 0 : return self;
2351 0 : }
2352 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 ) {
2353 0 : (void) varint;
2354 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter_0_23_5", level++, 0 );
2355 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
2356 0 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2357 0 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2358 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2359 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter_0_23_5", level--, 0 );
2360 0 : }
2361 195 : int fd_vote_epoch_credits_encode( fd_vote_epoch_credits_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2362 195 : int err;
2363 195 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2364 195 : if( FD_UNLIKELY( err ) ) return err;
2365 195 : err = fd_bincode_uint64_encode( self->credits, ctx );
2366 195 : if( FD_UNLIKELY( err ) ) return err;
2367 195 : err = fd_bincode_uint64_encode( self->prev_credits, ctx );
2368 195 : if( FD_UNLIKELY( err ) ) return err;
2369 195 : return FD_BINCODE_SUCCESS;
2370 195 : }
2371 0 : static inline int fd_vote_epoch_credits_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2372 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2373 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
2374 0 : return 0;
2375 0 : }
2376 393 : static void fd_vote_epoch_credits_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2377 393 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)struct_mem;
2378 393 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2379 393 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
2380 393 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
2381 393 : }
2382 0 : void * fd_vote_epoch_credits_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2383 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)mem;
2384 0 : fd_vote_epoch_credits_new( self );
2385 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_epoch_credits_t);
2386 0 : void * * alloc_mem = &alloc_region;
2387 0 : fd_vote_epoch_credits_decode_inner( mem, alloc_mem, ctx );
2388 0 : return self;
2389 0 : }
2390 198 : 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 ) {
2391 198 : (void) varint;
2392 198 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_epoch_credits", level++, 0 );
2393 198 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2394 198 : fun( w, &self->credits, "credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2395 198 : fun( w, &self->prev_credits, "prev_credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2396 198 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_epoch_credits", level--, 0 );
2397 198 : }
2398 18 : int fd_vote_block_timestamp_encode( fd_vote_block_timestamp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2399 18 : int err;
2400 18 : err = fd_bincode_uint64_encode( self->slot, ctx );
2401 18 : if( FD_UNLIKELY( err ) ) return err;
2402 18 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
2403 18 : if( FD_UNLIKELY( err ) ) return err;
2404 18 : return FD_BINCODE_SUCCESS;
2405 18 : }
2406 15 : static inline int fd_vote_block_timestamp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2407 15 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2408 15 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
2409 15 : return 0;
2410 15 : }
2411 15 : static void fd_vote_block_timestamp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2412 15 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)struct_mem;
2413 15 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2414 15 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
2415 15 : }
2416 0 : void * fd_vote_block_timestamp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2417 0 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)mem;
2418 0 : fd_vote_block_timestamp_new( self );
2419 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_block_timestamp_t);
2420 0 : void * * alloc_mem = &alloc_region;
2421 0 : fd_vote_block_timestamp_decode_inner( mem, alloc_mem, ctx );
2422 0 : return self;
2423 0 : }
2424 9 : 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 ) {
2425 9 : (void) varint;
2426 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_block_timestamp", level++, 0 );
2427 9 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2428 9 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
2429 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_block_timestamp", level--, 0 );
2430 9 : }
2431 18 : int fd_vote_prior_voters_encode( fd_vote_prior_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2432 18 : int err;
2433 594 : for( ulong i=0; i<32; i++ ) {
2434 576 : err = fd_vote_prior_voter_encode( self->buf + i, ctx );
2435 576 : if( FD_UNLIKELY( err ) ) return err;
2436 576 : }
2437 18 : err = fd_bincode_uint64_encode( self->idx, ctx );
2438 18 : if( FD_UNLIKELY( err ) ) return err;
2439 18 : err = fd_bincode_bool_encode( (uchar)(self->is_empty), ctx );
2440 18 : if( FD_UNLIKELY( err ) ) return err;
2441 18 : return FD_BINCODE_SUCCESS;
2442 18 : }
2443 15 : static int fd_vote_prior_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2444 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2445 15 : int err = 0;
2446 495 : for( ulong i=0; i<32; i++ ) {
2447 480 : err = fd_vote_prior_voter_decode_footprint_inner( ctx, total_sz );
2448 480 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2449 480 : }
2450 15 : err = fd_bincode_uint64_decode_footprint( ctx );
2451 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2452 15 : err = fd_bincode_bool_decode_footprint( ctx );
2453 15 : if( FD_UNLIKELY( err ) ) return err;
2454 15 : return 0;
2455 15 : }
2456 0 : int fd_vote_prior_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2457 0 : *total_sz += sizeof(fd_vote_prior_voters_t);
2458 0 : void const * start_data = ctx->data;
2459 0 : int err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2460 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2461 0 : ctx->data = start_data;
2462 0 : return err;
2463 0 : }
2464 15 : static void fd_vote_prior_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2465 15 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)struct_mem;
2466 495 : for( ulong i=0; i<32; i++ ) {
2467 480 : fd_vote_prior_voter_decode_inner( self->buf + i, alloc_mem, ctx );
2468 480 : }
2469 15 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
2470 15 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
2471 15 : }
2472 0 : void * fd_vote_prior_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2473 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)mem;
2474 0 : fd_vote_prior_voters_new( self );
2475 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_t);
2476 0 : void * * alloc_mem = &alloc_region;
2477 0 : fd_vote_prior_voters_decode_inner( mem, alloc_mem, ctx );
2478 0 : return self;
2479 0 : }
2480 12 : void fd_vote_prior_voters_new(fd_vote_prior_voters_t * self) {
2481 12 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_t) );
2482 396 : for( ulong i=0; i<32; i++ )
2483 384 : fd_vote_prior_voter_new( self->buf + i );
2484 12 : }
2485 9 : 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 ) {
2486 9 : (void) varint;
2487 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters", level++, 0 );
2488 9 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter[]", level++, 0 );
2489 297 : for( ulong i=0; i<32; i++ )
2490 288 : fd_vote_prior_voter_walk( w, self->buf + i, fun, "vote_prior_voter", level, 0 );
2491 9 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter[]", level--, 0 );
2492 9 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2493 9 : fun( w, &self->is_empty, "is_empty", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
2494 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters", level--, 0 );
2495 9 : }
2496 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 ) {
2497 0 : int err;
2498 0 : for( ulong i=0; i<32; i++ ) {
2499 0 : err = fd_vote_prior_voter_0_23_5_encode( self->buf + i, ctx );
2500 0 : if( FD_UNLIKELY( err ) ) return err;
2501 0 : }
2502 0 : err = fd_bincode_uint64_encode( self->idx, ctx );
2503 0 : if( FD_UNLIKELY( err ) ) return err;
2504 0 : return FD_BINCODE_SUCCESS;
2505 0 : }
2506 0 : static inline int fd_vote_prior_voters_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2507 0 : if( (ulong)ctx->data + 1800UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2508 0 : ctx->data = (void *)( (ulong)ctx->data + 1800UL );
2509 0 : return 0;
2510 0 : }
2511 0 : static void fd_vote_prior_voters_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2512 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)struct_mem;
2513 0 : for( ulong i=0; i<32; i++ ) {
2514 0 : fd_vote_prior_voter_0_23_5_decode_inner( self->buf + i, alloc_mem, ctx );
2515 0 : }
2516 0 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
2517 0 : }
2518 0 : void * fd_vote_prior_voters_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2519 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)mem;
2520 0 : fd_vote_prior_voters_0_23_5_new( self );
2521 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_0_23_5_t);
2522 0 : void * * alloc_mem = &alloc_region;
2523 0 : fd_vote_prior_voters_0_23_5_decode_inner( mem, alloc_mem, ctx );
2524 0 : return self;
2525 0 : }
2526 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 ) {
2527 0 : (void) varint;
2528 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters_0_23_5", level++, 0 );
2529 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter_0_23_5[]", level++, 0 );
2530 0 : for( ulong i=0; i<32; i++ )
2531 0 : fd_vote_prior_voter_0_23_5_walk( w, self->buf + i, fun, "vote_prior_voter_0_23_5", level, 0 );
2532 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter_0_23_5[]", level--, 0 );
2533 0 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2534 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters_0_23_5", level--, 0 );
2535 0 : }
2536 96 : int fd_landed_vote_encode( fd_landed_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2537 96 : int err;
2538 96 : err = fd_bincode_uint8_encode( (uchar)(self->latency), ctx );
2539 96 : if( FD_UNLIKELY( err ) ) return err;
2540 96 : err = fd_vote_lockout_encode( &self->lockout, ctx );
2541 96 : if( FD_UNLIKELY( err ) ) return err;
2542 96 : return FD_BINCODE_SUCCESS;
2543 96 : }
2544 0 : static inline int fd_landed_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2545 0 : if( (ulong)ctx->data + 13UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2546 0 : ctx->data = (void *)( (ulong)ctx->data + 13UL );
2547 0 : return 0;
2548 0 : }
2549 195 : static void fd_landed_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2550 195 : fd_landed_vote_t * self = (fd_landed_vote_t *)struct_mem;
2551 195 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
2552 195 : fd_vote_lockout_decode_inner( &self->lockout, alloc_mem, ctx );
2553 195 : }
2554 0 : void * fd_landed_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2555 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)mem;
2556 0 : fd_landed_vote_new( self );
2557 0 : void * alloc_region = (uchar *)mem + sizeof(fd_landed_vote_t);
2558 0 : void * * alloc_mem = &alloc_region;
2559 0 : fd_landed_vote_decode_inner( mem, alloc_mem, ctx );
2560 0 : return self;
2561 0 : }
2562 99 : 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 ) {
2563 99 : (void) varint;
2564 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_landed_vote", level++, 0 );
2565 99 : fun( w, &self->latency, "latency", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2566 99 : fd_vote_lockout_walk( w, &self->lockout, fun, "lockout", level, 0 );
2567 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_landed_vote", level--, 0 );
2568 99 : }
2569 0 : int fd_vote_state_0_23_5_encode( fd_vote_state_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2570 0 : int err;
2571 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2572 0 : if( FD_UNLIKELY( err ) ) return err;
2573 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
2574 0 : if( FD_UNLIKELY( err ) ) return err;
2575 0 : err = fd_bincode_uint64_encode( self->authorized_voter_epoch, ctx );
2576 0 : if( FD_UNLIKELY( err ) ) return err;
2577 0 : err = fd_vote_prior_voters_0_23_5_encode( &self->prior_voters, ctx );
2578 0 : if( FD_UNLIKELY( err ) ) return err;
2579 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2580 0 : if( FD_UNLIKELY( err ) ) return err;
2581 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2582 0 : if( FD_UNLIKELY( err ) ) return err;
2583 0 : if( self->votes ) {
2584 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
2585 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2586 0 : if( FD_UNLIKELY( err ) ) return err;
2587 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 ) ) {
2588 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
2589 0 : err = fd_vote_lockout_encode( ele, ctx );
2590 0 : if( FD_UNLIKELY( err ) ) return err;
2591 0 : }
2592 0 : } else {
2593 0 : ulong votes_len = 0;
2594 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2595 0 : if( FD_UNLIKELY( err ) ) return err;
2596 0 : }
2597 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2598 0 : if( FD_UNLIKELY( err ) ) return err;
2599 0 : if( self->has_root_slot ) {
2600 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2601 0 : if( FD_UNLIKELY( err ) ) return err;
2602 0 : }
2603 0 : if( self->epoch_credits ) {
2604 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2605 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2606 0 : if( FD_UNLIKELY( err ) ) return err;
2607 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 ) ) {
2608 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2609 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2610 0 : if( FD_UNLIKELY( err ) ) return err;
2611 0 : }
2612 0 : } else {
2613 0 : ulong epoch_credits_len = 0;
2614 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2615 0 : if( FD_UNLIKELY( err ) ) return err;
2616 0 : }
2617 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2618 0 : if( FD_UNLIKELY( err ) ) return err;
2619 0 : return FD_BINCODE_SUCCESS;
2620 0 : }
2621 0 : static int fd_vote_state_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2622 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2623 0 : int err = 0;
2624 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2625 0 : if( FD_UNLIKELY( err ) ) return err;
2626 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2627 0 : if( FD_UNLIKELY( err ) ) return err;
2628 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2629 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2630 0 : err = fd_vote_prior_voters_0_23_5_decode_footprint_inner( ctx, total_sz );
2631 0 : if( FD_UNLIKELY( err ) ) return err;
2632 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2633 0 : if( FD_UNLIKELY( err ) ) return err;
2634 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2635 0 : if( FD_UNLIKELY( err ) ) return err;
2636 0 : ulong votes_len;
2637 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2638 0 : if( FD_UNLIKELY( err ) ) return err;
2639 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2640 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
2641 0 : ulong votes_sz;
2642 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2643 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2644 0 : if( FD_UNLIKELY( err ) ) return err;
2645 0 : {
2646 0 : uchar o;
2647 0 : err = fd_bincode_bool_decode( &o, ctx );
2648 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2649 0 : if( o ) {
2650 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2651 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2652 0 : }
2653 0 : }
2654 0 : ulong epoch_credits_len;
2655 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2656 0 : if( FD_UNLIKELY( err ) ) return err;
2657 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2658 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2659 0 : ulong epoch_credits_sz;
2660 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2661 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2662 0 : if( FD_UNLIKELY( err ) ) return err;
2663 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2664 0 : if( FD_UNLIKELY( err ) ) return err;
2665 0 : return 0;
2666 0 : }
2667 0 : int fd_vote_state_0_23_5_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2668 0 : *total_sz += sizeof(fd_vote_state_0_23_5_t);
2669 0 : void const * start_data = ctx->data;
2670 0 : int err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
2671 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2672 0 : ctx->data = start_data;
2673 0 : return err;
2674 0 : }
2675 0 : static void fd_vote_state_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2676 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)struct_mem;
2677 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2678 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
2679 0 : fd_bincode_uint64_decode_unsafe( &self->authorized_voter_epoch, ctx );
2680 0 : fd_vote_prior_voters_0_23_5_decode_inner( &self->prior_voters, alloc_mem, ctx );
2681 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2682 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2683 0 : ulong votes_len;
2684 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2685 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2686 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
2687 0 : for( ulong i=0; i < votes_len; i++ ) {
2688 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
2689 0 : fd_vote_lockout_new( elem );
2690 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
2691 0 : }
2692 0 : {
2693 0 : uchar o;
2694 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2695 0 : self->has_root_slot = !!o;
2696 0 : if( o ) {
2697 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2698 0 : }
2699 0 : }
2700 0 : ulong epoch_credits_len;
2701 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2702 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2703 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2704 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2705 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2706 0 : fd_vote_epoch_credits_new( elem );
2707 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2708 0 : }
2709 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2710 0 : }
2711 0 : void * fd_vote_state_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2712 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)mem;
2713 0 : fd_vote_state_0_23_5_new( self );
2714 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_0_23_5_t);
2715 0 : void * * alloc_mem = &alloc_region;
2716 0 : fd_vote_state_0_23_5_decode_inner( mem, alloc_mem, ctx );
2717 0 : return self;
2718 0 : }
2719 0 : void fd_vote_state_0_23_5_new(fd_vote_state_0_23_5_t * self) {
2720 0 : fd_memset( self, 0, sizeof(fd_vote_state_0_23_5_t) );
2721 0 : fd_pubkey_new( &self->node_pubkey );
2722 0 : fd_pubkey_new( &self->authorized_voter );
2723 0 : fd_vote_prior_voters_0_23_5_new( &self->prior_voters );
2724 0 : fd_pubkey_new( &self->authorized_withdrawer );
2725 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2726 0 : }
2727 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 ) {
2728 0 : (void) varint;
2729 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_0_23_5", level++, 0 );
2730 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
2731 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level, 0 );
2732 0 : fun( w, &self->authorized_voter_epoch, "authorized_voter_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2733 0 : fd_vote_prior_voters_0_23_5_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
2734 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
2735 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2736 :
2737 : /* Walk deque */
2738 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
2739 0 : if( self->votes ) {
2740 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
2741 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
2742 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
2743 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2744 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level, 0 );
2745 0 : }
2746 0 : }
2747 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
2748 : /* Done walking deque */
2749 :
2750 0 : if( !self->has_root_slot ) {
2751 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
2752 0 : } else {
2753 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2754 0 : }
2755 :
2756 : /* Walk deque */
2757 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
2758 0 : if( self->epoch_credits ) {
2759 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
2760 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
2761 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
2762 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2763 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
2764 0 : }
2765 0 : }
2766 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
2767 : /* Done walking deque */
2768 :
2769 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
2770 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_0_23_5", level--, 0 );
2771 0 : }
2772 0 : ulong fd_vote_state_0_23_5_size( fd_vote_state_0_23_5_t const * self ) {
2773 0 : ulong size = 0;
2774 0 : size += fd_pubkey_size( &self->node_pubkey );
2775 0 : size += fd_pubkey_size( &self->authorized_voter );
2776 0 : size += sizeof(ulong);
2777 0 : size += fd_vote_prior_voters_0_23_5_size( &self->prior_voters );
2778 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
2779 0 : size += sizeof(char);
2780 0 : if( self->votes ) {
2781 0 : size += sizeof(ulong);
2782 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 ) ) {
2783 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2784 0 : size += fd_vote_lockout_size( ele );
2785 0 : }
2786 0 : } else {
2787 0 : size += sizeof(ulong);
2788 0 : }
2789 0 : size += sizeof(char);
2790 0 : if( self->has_root_slot ) {
2791 0 : size += sizeof(ulong);
2792 0 : }
2793 0 : if( self->epoch_credits ) {
2794 0 : size += sizeof(ulong);
2795 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 ) ) {
2796 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2797 0 : size += fd_vote_epoch_credits_size( ele );
2798 0 : }
2799 0 : } else {
2800 0 : size += sizeof(ulong);
2801 0 : }
2802 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2803 0 : return size;
2804 0 : }
2805 :
2806 18 : int fd_vote_authorized_voters_encode( fd_vote_authorized_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2807 18 : int err;
2808 18 : if( self->treap ) {
2809 18 : ulong fd_vote_authorized_voters_len = fd_vote_authorized_voters_treap_ele_cnt( self->treap );
2810 18 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2811 18 : if( FD_UNLIKELY( err ) ) return err;
2812 18 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2813 36 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2814 18 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2815 18 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2816 18 : err = fd_vote_authorized_voter_encode( ele, ctx );
2817 18 : if( FD_UNLIKELY( err ) ) return err;
2818 18 : }
2819 18 : } else {
2820 0 : ulong fd_vote_authorized_voters_len = 0;
2821 0 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2822 0 : if( FD_UNLIKELY( err ) ) return err;
2823 0 : }
2824 18 : return FD_BINCODE_SUCCESS;
2825 18 : }
2826 15 : static int fd_vote_authorized_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2827 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2828 15 : int err = 0;
2829 15 : ulong fd_vote_authorized_voters_treap_len;
2830 15 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
2831 15 : if( FD_UNLIKELY( err ) ) return err;
2832 15 : 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 );
2833 15 : *total_sz += fd_vote_authorized_voters_pool_align() + fd_vote_authorized_voters_pool_footprint( fd_vote_authorized_voters_treap_max );
2834 15 : *total_sz += fd_vote_authorized_voters_treap_align() + fd_vote_authorized_voters_treap_footprint( fd_vote_authorized_voters_treap_max );
2835 30 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2836 15 : err = fd_vote_authorized_voter_decode_footprint_inner( ctx, total_sz );
2837 15 : if( FD_UNLIKELY ( err ) ) return err;
2838 15 : }
2839 15 : return 0;
2840 15 : }
2841 0 : int fd_vote_authorized_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2842 0 : *total_sz += sizeof(fd_vote_authorized_voters_t);
2843 0 : void const * start_data = ctx->data;
2844 0 : int err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2845 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2846 0 : ctx->data = start_data;
2847 0 : return err;
2848 0 : }
2849 15 : static void fd_vote_authorized_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2850 15 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)struct_mem;
2851 15 : ulong fd_vote_authorized_voters_treap_len;
2852 15 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
2853 15 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
2854 15 : self->pool = fd_vote_authorized_voters_pool_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2855 15 : self->treap = fd_vote_authorized_voters_treap_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2856 30 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2857 15 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( self->pool );
2858 15 : fd_vote_authorized_voter_new( ele );
2859 15 : fd_vote_authorized_voter_decode_inner( ele, alloc_mem, ctx );
2860 15 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( self->treap, ele->epoch, self->pool );
2861 15 : if( repeated_entry ) {
2862 0 : fd_vote_authorized_voters_treap_ele_remove( self->treap, repeated_entry, self->pool ); // Remove the element before inserting it back to avoid duplication
2863 0 : fd_vote_authorized_voters_pool_ele_release( self->pool, repeated_entry );
2864 0 : }
2865 15 : fd_vote_authorized_voters_treap_ele_insert( self->treap, ele, self->pool ); /* this cannot fail */
2866 15 : }
2867 15 : }
2868 0 : void * fd_vote_authorized_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2869 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)mem;
2870 0 : fd_vote_authorized_voters_new( self );
2871 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voters_t);
2872 0 : void * * alloc_mem = &alloc_region;
2873 0 : fd_vote_authorized_voters_decode_inner( mem, alloc_mem, ctx );
2874 0 : return self;
2875 0 : }
2876 12 : void fd_vote_authorized_voters_new(fd_vote_authorized_voters_t * self) {
2877 12 : fd_memset( self, 0, sizeof(fd_vote_authorized_voters_t) );
2878 12 : }
2879 9 : 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 ) {
2880 9 : (void) varint;
2881 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voters", level++, 0 );
2882 9 : if( self->treap ) {
2883 9 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2884 18 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2885 9 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2886 9 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2887 9 : fd_vote_authorized_voter_walk( w, ele, fun, "fd_vote_authorized_voter_t", level, 0 );
2888 9 : }
2889 9 : }
2890 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voters", level--, 0 );
2891 9 : }
2892 0 : ulong fd_vote_authorized_voters_size( fd_vote_authorized_voters_t const * self ) {
2893 0 : ulong size = 0;
2894 0 : size += sizeof(ulong);
2895 0 : if( self->treap ) {
2896 0 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2897 0 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2898 0 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2899 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2900 0 : size += fd_vote_authorized_voter_size( ele );
2901 0 : }
2902 0 : }
2903 0 : return size;
2904 0 : }
2905 :
2906 0 : int fd_vote_state_1_14_11_encode( fd_vote_state_1_14_11_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2907 0 : int err;
2908 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2909 0 : if( FD_UNLIKELY( err ) ) return err;
2910 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2911 0 : if( FD_UNLIKELY( err ) ) return err;
2912 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2913 0 : if( FD_UNLIKELY( err ) ) return err;
2914 0 : if( self->votes ) {
2915 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
2916 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2917 0 : if( FD_UNLIKELY( err ) ) return err;
2918 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 ) ) {
2919 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
2920 0 : err = fd_vote_lockout_encode( ele, ctx );
2921 0 : if( FD_UNLIKELY( err ) ) return err;
2922 0 : }
2923 0 : } else {
2924 0 : ulong votes_len = 0;
2925 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2926 0 : if( FD_UNLIKELY( err ) ) return err;
2927 0 : }
2928 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2929 0 : if( FD_UNLIKELY( err ) ) return err;
2930 0 : if( self->has_root_slot ) {
2931 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2932 0 : if( FD_UNLIKELY( err ) ) return err;
2933 0 : }
2934 0 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2935 0 : if( FD_UNLIKELY( err ) ) return err;
2936 0 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
2937 0 : if( FD_UNLIKELY( err ) ) return err;
2938 0 : if( self->epoch_credits ) {
2939 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2940 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2941 0 : if( FD_UNLIKELY( err ) ) return err;
2942 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 ) ) {
2943 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2944 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2945 0 : if( FD_UNLIKELY( err ) ) return err;
2946 0 : }
2947 0 : } else {
2948 0 : ulong epoch_credits_len = 0;
2949 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2950 0 : if( FD_UNLIKELY( err ) ) return err;
2951 0 : }
2952 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2953 0 : if( FD_UNLIKELY( err ) ) return err;
2954 0 : return FD_BINCODE_SUCCESS;
2955 0 : }
2956 0 : static int fd_vote_state_1_14_11_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2957 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2958 0 : int err = 0;
2959 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2960 0 : if( FD_UNLIKELY( err ) ) return err;
2961 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2962 0 : if( FD_UNLIKELY( err ) ) return err;
2963 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2964 0 : if( FD_UNLIKELY( err ) ) return err;
2965 0 : ulong votes_len;
2966 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2967 0 : if( FD_UNLIKELY( err ) ) return err;
2968 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2969 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
2970 0 : ulong votes_sz;
2971 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2972 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2973 0 : if( FD_UNLIKELY( err ) ) return err;
2974 0 : {
2975 0 : uchar o;
2976 0 : err = fd_bincode_bool_decode( &o, ctx );
2977 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2978 0 : if( o ) {
2979 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2980 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2981 0 : }
2982 0 : }
2983 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2984 0 : if( FD_UNLIKELY( err ) ) return err;
2985 0 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2986 0 : if( FD_UNLIKELY( err ) ) return err;
2987 0 : ulong epoch_credits_len;
2988 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2989 0 : if( FD_UNLIKELY( err ) ) return err;
2990 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2991 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2992 0 : ulong epoch_credits_sz;
2993 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2994 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2995 0 : if( FD_UNLIKELY( err ) ) return err;
2996 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2997 0 : if( FD_UNLIKELY( err ) ) return err;
2998 0 : return 0;
2999 0 : }
3000 0 : int fd_vote_state_1_14_11_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3001 0 : *total_sz += sizeof(fd_vote_state_1_14_11_t);
3002 0 : void const * start_data = ctx->data;
3003 0 : int err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
3004 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3005 0 : ctx->data = start_data;
3006 0 : return err;
3007 0 : }
3008 0 : static void fd_vote_state_1_14_11_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3009 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)struct_mem;
3010 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
3011 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
3012 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
3013 0 : ulong votes_len;
3014 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
3015 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
3016 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
3017 0 : for( ulong i=0; i < votes_len; i++ ) {
3018 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
3019 0 : fd_vote_lockout_new( elem );
3020 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
3021 0 : }
3022 0 : {
3023 0 : uchar o;
3024 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3025 0 : self->has_root_slot = !!o;
3026 0 : if( o ) {
3027 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
3028 0 : }
3029 0 : }
3030 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
3031 0 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
3032 0 : ulong epoch_credits_len;
3033 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
3034 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
3035 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
3036 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
3037 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
3038 0 : fd_vote_epoch_credits_new( elem );
3039 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
3040 0 : }
3041 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
3042 0 : }
3043 0 : void * fd_vote_state_1_14_11_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3044 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)mem;
3045 0 : fd_vote_state_1_14_11_new( self );
3046 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_1_14_11_t);
3047 0 : void * * alloc_mem = &alloc_region;
3048 0 : fd_vote_state_1_14_11_decode_inner( mem, alloc_mem, ctx );
3049 0 : return self;
3050 0 : }
3051 0 : void fd_vote_state_1_14_11_new(fd_vote_state_1_14_11_t * self) {
3052 0 : fd_memset( self, 0, sizeof(fd_vote_state_1_14_11_t) );
3053 0 : fd_pubkey_new( &self->node_pubkey );
3054 0 : fd_pubkey_new( &self->authorized_withdrawer );
3055 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
3056 0 : fd_vote_prior_voters_new( &self->prior_voters );
3057 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
3058 0 : }
3059 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 ) {
3060 0 : (void) varint;
3061 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_1_14_11", level++, 0 );
3062 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
3063 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
3064 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
3065 :
3066 : /* Walk deque */
3067 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
3068 0 : if( self->votes ) {
3069 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
3070 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
3071 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
3072 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
3073 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level, 0 );
3074 0 : }
3075 0 : }
3076 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
3077 : /* Done walking deque */
3078 :
3079 0 : if( !self->has_root_slot ) {
3080 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3081 0 : } else {
3082 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3083 0 : }
3084 0 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level, 0 );
3085 0 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
3086 :
3087 : /* Walk deque */
3088 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
3089 0 : if( self->epoch_credits ) {
3090 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
3091 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
3092 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
3093 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3094 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
3095 0 : }
3096 0 : }
3097 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
3098 : /* Done walking deque */
3099 :
3100 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
3101 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_1_14_11", level--, 0 );
3102 0 : }
3103 0 : ulong fd_vote_state_1_14_11_size( fd_vote_state_1_14_11_t const * self ) {
3104 0 : ulong size = 0;
3105 0 : size += fd_pubkey_size( &self->node_pubkey );
3106 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
3107 0 : size += sizeof(char);
3108 0 : if( self->votes ) {
3109 0 : size += sizeof(ulong);
3110 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 ) ) {
3111 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
3112 0 : size += fd_vote_lockout_size( ele );
3113 0 : }
3114 0 : } else {
3115 0 : size += sizeof(ulong);
3116 0 : }
3117 0 : size += sizeof(char);
3118 0 : if( self->has_root_slot ) {
3119 0 : size += sizeof(ulong);
3120 0 : }
3121 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
3122 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
3123 0 : if( self->epoch_credits ) {
3124 0 : size += sizeof(ulong);
3125 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 ) ) {
3126 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3127 0 : size += fd_vote_epoch_credits_size( ele );
3128 0 : }
3129 0 : } else {
3130 0 : size += sizeof(ulong);
3131 0 : }
3132 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
3133 0 : return size;
3134 0 : }
3135 :
3136 18 : int fd_vote_state_encode( fd_vote_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3137 18 : int err;
3138 18 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
3139 18 : if( FD_UNLIKELY( err ) ) return err;
3140 18 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
3141 18 : if( FD_UNLIKELY( err ) ) return err;
3142 18 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
3143 18 : if( FD_UNLIKELY( err ) ) return err;
3144 18 : if( self->votes ) {
3145 6 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
3146 6 : err = fd_bincode_uint64_encode( votes_len, ctx );
3147 6 : if( FD_UNLIKELY( err ) ) return err;
3148 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 ) ) {
3149 96 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
3150 96 : err = fd_landed_vote_encode( ele, ctx );
3151 96 : if( FD_UNLIKELY( err ) ) return err;
3152 96 : }
3153 12 : } else {
3154 12 : ulong votes_len = 0;
3155 12 : err = fd_bincode_uint64_encode( votes_len, ctx );
3156 12 : if( FD_UNLIKELY( err ) ) return err;
3157 12 : }
3158 18 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
3159 18 : if( FD_UNLIKELY( err ) ) return err;
3160 18 : if( self->has_root_slot ) {
3161 6 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
3162 6 : if( FD_UNLIKELY( err ) ) return err;
3163 6 : }
3164 18 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
3165 18 : if( FD_UNLIKELY( err ) ) return err;
3166 18 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
3167 18 : if( FD_UNLIKELY( err ) ) return err;
3168 18 : if( self->epoch_credits ) {
3169 6 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
3170 6 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
3171 6 : if( FD_UNLIKELY( err ) ) return err;
3172 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 ) ) {
3173 195 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
3174 195 : err = fd_vote_epoch_credits_encode( ele, ctx );
3175 195 : if( FD_UNLIKELY( err ) ) return err;
3176 195 : }
3177 12 : } else {
3178 12 : ulong epoch_credits_len = 0;
3179 12 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
3180 12 : if( FD_UNLIKELY( err ) ) return err;
3181 12 : }
3182 18 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
3183 18 : if( FD_UNLIKELY( err ) ) return err;
3184 18 : return FD_BINCODE_SUCCESS;
3185 18 : }
3186 15 : static int fd_vote_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3187 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3188 15 : int err = 0;
3189 15 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3190 15 : if( FD_UNLIKELY( err ) ) return err;
3191 15 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3192 15 : if( FD_UNLIKELY( err ) ) return err;
3193 15 : err = fd_bincode_uint8_decode_footprint( ctx );
3194 15 : if( FD_UNLIKELY( err ) ) return err;
3195 15 : ulong votes_len;
3196 15 : err = fd_bincode_uint64_decode( &votes_len, ctx );
3197 15 : if( FD_UNLIKELY( err ) ) return err;
3198 15 : ulong votes_max = fd_ulong_max( votes_len, 32 );
3199 15 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
3200 15 : ulong votes_sz;
3201 15 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3202 15 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
3203 15 : if( FD_UNLIKELY( err ) ) return err;
3204 15 : {
3205 15 : uchar o;
3206 15 : err = fd_bincode_bool_decode( &o, ctx );
3207 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3208 15 : if( o ) {
3209 15 : err = fd_bincode_uint64_decode_footprint( ctx );
3210 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3211 15 : }
3212 15 : }
3213 15 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
3214 15 : if( FD_UNLIKELY( err ) ) return err;
3215 15 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
3216 15 : if( FD_UNLIKELY( err ) ) return err;
3217 15 : ulong epoch_credits_len;
3218 15 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
3219 15 : if( FD_UNLIKELY( err ) ) return err;
3220 15 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
3221 15 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
3222 15 : ulong epoch_credits_sz;
3223 15 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3224 15 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
3225 15 : if( FD_UNLIKELY( err ) ) return err;
3226 15 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
3227 15 : if( FD_UNLIKELY( err ) ) return err;
3228 15 : return 0;
3229 15 : }
3230 0 : int fd_vote_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3231 0 : *total_sz += sizeof(fd_vote_state_t);
3232 0 : void const * start_data = ctx->data;
3233 0 : int err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
3234 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3235 0 : ctx->data = start_data;
3236 0 : return err;
3237 0 : }
3238 15 : static void fd_vote_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3239 15 : fd_vote_state_t * self = (fd_vote_state_t *)struct_mem;
3240 15 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
3241 15 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
3242 15 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
3243 15 : ulong votes_len;
3244 15 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
3245 15 : ulong votes_max = fd_ulong_max( votes_len, 32 );
3246 15 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
3247 210 : for( ulong i=0; i < votes_len; i++ ) {
3248 195 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
3249 195 : fd_landed_vote_new( elem );
3250 195 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
3251 195 : }
3252 15 : {
3253 15 : uchar o;
3254 15 : fd_bincode_bool_decode_unsafe( &o, ctx );
3255 15 : self->has_root_slot = !!o;
3256 15 : if( o ) {
3257 15 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
3258 15 : }
3259 15 : }
3260 15 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
3261 15 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
3262 15 : ulong epoch_credits_len;
3263 15 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
3264 15 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
3265 15 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
3266 408 : for( ulong i=0; i < epoch_credits_len; i++ ) {
3267 393 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
3268 393 : fd_vote_epoch_credits_new( elem );
3269 393 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
3270 393 : }
3271 15 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
3272 15 : }
3273 0 : void * fd_vote_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3274 0 : fd_vote_state_t * self = (fd_vote_state_t *)mem;
3275 0 : fd_vote_state_new( self );
3276 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_t);
3277 0 : void * * alloc_mem = &alloc_region;
3278 0 : fd_vote_state_decode_inner( mem, alloc_mem, ctx );
3279 0 : return self;
3280 0 : }
3281 12 : void fd_vote_state_new(fd_vote_state_t * self) {
3282 12 : fd_memset( self, 0, sizeof(fd_vote_state_t) );
3283 12 : fd_pubkey_new( &self->node_pubkey );
3284 12 : fd_pubkey_new( &self->authorized_withdrawer );
3285 12 : fd_vote_authorized_voters_new( &self->authorized_voters );
3286 12 : fd_vote_prior_voters_new( &self->prior_voters );
3287 12 : fd_vote_block_timestamp_new( &self->last_timestamp );
3288 12 : }
3289 9 : 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 ) {
3290 9 : (void) varint;
3291 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state", level++, 0 );
3292 9 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
3293 9 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
3294 9 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
3295 :
3296 : /* Walk deque */
3297 9 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
3298 9 : if( self->votes ) {
3299 9 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes );
3300 108 : !deq_fd_landed_vote_t_iter_done( self->votes, iter );
3301 99 : iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
3302 99 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
3303 99 : fd_landed_vote_walk(w, ele, fun, "votes", level, 0 );
3304 99 : }
3305 9 : }
3306 9 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
3307 : /* Done walking deque */
3308 :
3309 9 : if( !self->has_root_slot ) {
3310 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3311 9 : } else {
3312 9 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3313 9 : }
3314 9 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level, 0 );
3315 9 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
3316 :
3317 : /* Walk deque */
3318 9 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
3319 9 : if( self->epoch_credits ) {
3320 9 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
3321 207 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
3322 198 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
3323 198 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3324 198 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
3325 198 : }
3326 9 : }
3327 9 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
3328 : /* Done walking deque */
3329 :
3330 9 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
3331 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state", level--, 0 );
3332 9 : }
3333 0 : ulong fd_vote_state_size( fd_vote_state_t const * self ) {
3334 0 : ulong size = 0;
3335 0 : size += fd_pubkey_size( &self->node_pubkey );
3336 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
3337 0 : size += sizeof(char);
3338 0 : if( self->votes ) {
3339 0 : size += sizeof(ulong);
3340 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 ) ) {
3341 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
3342 0 : size += fd_landed_vote_size( ele );
3343 0 : }
3344 0 : } else {
3345 0 : size += sizeof(ulong);
3346 0 : }
3347 0 : size += sizeof(char);
3348 0 : if( self->has_root_slot ) {
3349 0 : size += sizeof(ulong);
3350 0 : }
3351 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
3352 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
3353 0 : if( self->epoch_credits ) {
3354 0 : size += sizeof(ulong);
3355 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 ) ) {
3356 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3357 0 : size += fd_vote_epoch_credits_size( ele );
3358 0 : }
3359 0 : } else {
3360 0 : size += sizeof(ulong);
3361 0 : }
3362 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
3363 0 : return size;
3364 0 : }
3365 :
3366 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v0_23_5(fd_vote_state_versioned_t const * self) {
3367 0 : return self->discriminant == 0;
3368 0 : }
3369 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v1_14_11(fd_vote_state_versioned_t const * self) {
3370 0 : return self->discriminant == 1;
3371 0 : }
3372 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_current(fd_vote_state_versioned_t const * self) {
3373 0 : return self->discriminant == 2;
3374 0 : }
3375 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant );
3376 15 : int fd_vote_state_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3377 15 : int err;
3378 15 : switch (discriminant) {
3379 0 : case 0: {
3380 0 : err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
3381 0 : if( FD_UNLIKELY( err ) ) return err;
3382 0 : return FD_BINCODE_SUCCESS;
3383 0 : }
3384 0 : case 1: {
3385 0 : err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
3386 0 : if( FD_UNLIKELY( err ) ) return err;
3387 0 : return FD_BINCODE_SUCCESS;
3388 0 : }
3389 15 : case 2: {
3390 15 : err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
3391 15 : if( FD_UNLIKELY( err ) ) return err;
3392 15 : return FD_BINCODE_SUCCESS;
3393 15 : }
3394 0 : default: return FD_BINCODE_ERR_ENCODING;
3395 15 : }
3396 15 : }
3397 15 : static int fd_vote_state_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3398 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3399 15 : uint discriminant = 0;
3400 15 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
3401 15 : if( FD_UNLIKELY( err ) ) return err;
3402 15 : return fd_vote_state_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
3403 15 : }
3404 15 : int fd_vote_state_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3405 15 : *total_sz += sizeof(fd_vote_state_versioned_t);
3406 15 : void const * start_data = ctx->data;
3407 15 : int err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
3408 15 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3409 15 : ctx->data = start_data;
3410 15 : return err;
3411 15 : }
3412 15 : 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 ) {
3413 15 : switch (discriminant) {
3414 0 : case 0: {
3415 0 : fd_vote_state_0_23_5_decode_inner( &self->v0_23_5, alloc_mem, ctx );
3416 0 : break;
3417 0 : }
3418 0 : case 1: {
3419 0 : fd_vote_state_1_14_11_decode_inner( &self->v1_14_11, alloc_mem, ctx );
3420 0 : break;
3421 0 : }
3422 15 : case 2: {
3423 15 : fd_vote_state_decode_inner( &self->current, alloc_mem, ctx );
3424 15 : break;
3425 0 : }
3426 15 : }
3427 15 : }
3428 15 : static void fd_vote_state_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3429 15 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)struct_mem;
3430 15 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
3431 15 : fd_vote_state_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
3432 15 : }
3433 15 : void * fd_vote_state_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3434 15 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)mem;
3435 15 : fd_vote_state_versioned_new( self );
3436 15 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_versioned_t);
3437 15 : void * * alloc_mem = &alloc_region;
3438 15 : fd_vote_state_versioned_decode_inner( mem, alloc_mem, ctx );
3439 15 : return self;
3440 15 : }
3441 27 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
3442 27 : switch( discriminant ) {
3443 0 : case 0: {
3444 0 : fd_vote_state_0_23_5_new( &self->v0_23_5 );
3445 0 : break;
3446 0 : }
3447 0 : case 1: {
3448 0 : fd_vote_state_1_14_11_new( &self->v1_14_11 );
3449 0 : break;
3450 0 : }
3451 12 : case 2: {
3452 12 : fd_vote_state_new( &self->current );
3453 12 : break;
3454 0 : }
3455 15 : default: break; // FD_LOG_ERR(( "unhandled type"));
3456 27 : }
3457 27 : }
3458 27 : void fd_vote_state_versioned_new_disc( fd_vote_state_versioned_t * self, uint discriminant ) {
3459 27 : self->discriminant = discriminant;
3460 27 : fd_vote_state_versioned_inner_new( &self->inner, self->discriminant );
3461 27 : }
3462 15 : void fd_vote_state_versioned_new( fd_vote_state_versioned_t * self ) {
3463 15 : fd_memset( self, 0, sizeof(fd_vote_state_versioned_t) );
3464 15 : fd_vote_state_versioned_new_disc( self, UINT_MAX );
3465 15 : }
3466 :
3467 9 : 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 ) {
3468 9 : (void) varint;
3469 9 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_state_versioned", level++, 0);
3470 9 : switch( self->discriminant ) {
3471 0 : case 0: {
3472 0 : fun( w, self, "v0_23_5", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
3473 0 : fd_vote_state_0_23_5_walk( w, &self->inner.v0_23_5, fun, "v0_23_5", level, 0 );
3474 0 : break;
3475 0 : }
3476 0 : case 1: {
3477 0 : fun( w, self, "v1_14_11", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
3478 0 : fd_vote_state_1_14_11_walk( w, &self->inner.v1_14_11, fun, "v1_14_11", level, 0 );
3479 0 : break;
3480 0 : }
3481 9 : case 2: {
3482 9 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
3483 9 : fd_vote_state_walk( w, &self->inner.current, fun, "current", level, 0 );
3484 9 : break;
3485 0 : }
3486 9 : }
3487 9 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_state_versioned", level--, 0 );
3488 9 : }
3489 0 : ulong fd_vote_state_versioned_size( fd_vote_state_versioned_t const * self ) {
3490 0 : ulong size = 0;
3491 0 : size += sizeof(uint);
3492 0 : switch (self->discriminant) {
3493 0 : case 0: {
3494 0 : size += fd_vote_state_0_23_5_size( &self->inner.v0_23_5 );
3495 0 : break;
3496 0 : }
3497 0 : case 1: {
3498 0 : size += fd_vote_state_1_14_11_size( &self->inner.v1_14_11 );
3499 0 : break;
3500 0 : }
3501 0 : case 2: {
3502 0 : size += fd_vote_state_size( &self->inner.current );
3503 0 : break;
3504 0 : }
3505 0 : }
3506 0 : return size;
3507 0 : }
3508 :
3509 18 : int fd_vote_state_versioned_inner_encode( fd_vote_state_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
3510 18 : int err;
3511 18 : switch (discriminant) {
3512 0 : case 0: {
3513 0 : err = fd_vote_state_0_23_5_encode( &self->v0_23_5, ctx );
3514 0 : if( FD_UNLIKELY( err ) ) return err;
3515 0 : break;
3516 0 : }
3517 0 : case 1: {
3518 0 : err = fd_vote_state_1_14_11_encode( &self->v1_14_11, ctx );
3519 0 : if( FD_UNLIKELY( err ) ) return err;
3520 0 : break;
3521 0 : }
3522 18 : case 2: {
3523 18 : err = fd_vote_state_encode( &self->current, ctx );
3524 18 : if( FD_UNLIKELY( err ) ) return err;
3525 18 : break;
3526 18 : }
3527 18 : }
3528 18 : return FD_BINCODE_SUCCESS;
3529 18 : }
3530 18 : int fd_vote_state_versioned_encode( fd_vote_state_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3531 18 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
3532 18 : if( FD_UNLIKELY( err ) ) return err;
3533 18 : return fd_vote_state_versioned_inner_encode( &self->inner, self->discriminant, ctx );
3534 18 : }
3535 :
3536 0 : int fd_vote_state_update_encode( fd_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3537 0 : int err;
3538 0 : if( self->lockouts ) {
3539 0 : ulong lockouts_len = deq_fd_vote_lockout_t_cnt( self->lockouts );
3540 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
3541 0 : if( FD_UNLIKELY( err ) ) return err;
3542 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 ) ) {
3543 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->lockouts, iter );
3544 0 : err = fd_vote_lockout_encode( ele, ctx );
3545 0 : if( FD_UNLIKELY( err ) ) return err;
3546 0 : }
3547 0 : } else {
3548 0 : ulong lockouts_len = 0;
3549 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
3550 0 : if( FD_UNLIKELY( err ) ) return err;
3551 0 : }
3552 0 : err = fd_bincode_bool_encode( self->has_root, ctx );
3553 0 : if( FD_UNLIKELY( err ) ) return err;
3554 0 : if( self->has_root ) {
3555 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3556 0 : if( FD_UNLIKELY( err ) ) return err;
3557 0 : }
3558 0 : err = fd_hash_encode( &self->hash, ctx );
3559 0 : if( FD_UNLIKELY( err ) ) return err;
3560 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3561 0 : if( FD_UNLIKELY( err ) ) return err;
3562 0 : if( self->has_timestamp ) {
3563 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3564 0 : if( FD_UNLIKELY( err ) ) return err;
3565 0 : }
3566 0 : return FD_BINCODE_SUCCESS;
3567 0 : }
3568 0 : static int fd_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3569 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3570 0 : int err = 0;
3571 0 : ulong lockouts_len;
3572 0 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
3573 0 : if( FD_UNLIKELY( err ) ) return err;
3574 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
3575 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( lockouts_max );
3576 0 : ulong lockouts_sz;
3577 0 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3578 0 : err = fd_bincode_bytes_decode_footprint( lockouts_sz, ctx );
3579 0 : if( FD_UNLIKELY( err ) ) return err;
3580 0 : {
3581 0 : uchar o;
3582 0 : err = fd_bincode_bool_decode( &o, ctx );
3583 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3584 0 : if( o ) {
3585 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3586 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3587 0 : }
3588 0 : }
3589 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3590 0 : if( FD_UNLIKELY( err ) ) return err;
3591 0 : {
3592 0 : uchar o;
3593 0 : err = fd_bincode_bool_decode( &o, ctx );
3594 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3595 0 : if( o ) {
3596 0 : err = fd_bincode_int64_decode_footprint( ctx );
3597 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3598 0 : }
3599 0 : }
3600 0 : return 0;
3601 0 : }
3602 0 : int fd_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3603 0 : *total_sz += sizeof(fd_vote_state_update_t);
3604 0 : void const * start_data = ctx->data;
3605 0 : int err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
3606 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3607 0 : ctx->data = start_data;
3608 0 : return err;
3609 0 : }
3610 0 : static void fd_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3611 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)struct_mem;
3612 0 : ulong lockouts_len;
3613 0 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
3614 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
3615 0 : self->lockouts = deq_fd_vote_lockout_t_join_new( alloc_mem, lockouts_max );
3616 0 : for( ulong i=0; i < lockouts_len; i++ ) {
3617 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->lockouts );
3618 0 : fd_vote_lockout_new( elem );
3619 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
3620 0 : }
3621 0 : {
3622 0 : uchar o;
3623 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3624 0 : self->has_root = !!o;
3625 0 : if( o ) {
3626 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3627 0 : }
3628 0 : }
3629 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3630 0 : {
3631 0 : uchar o;
3632 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3633 0 : self->has_timestamp = !!o;
3634 0 : if( o ) {
3635 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3636 0 : }
3637 0 : }
3638 0 : }
3639 0 : void * fd_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3640 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)mem;
3641 0 : fd_vote_state_update_new( self );
3642 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_update_t);
3643 0 : void * * alloc_mem = &alloc_region;
3644 0 : fd_vote_state_update_decode_inner( mem, alloc_mem, ctx );
3645 0 : return self;
3646 0 : }
3647 0 : void fd_vote_state_update_new(fd_vote_state_update_t * self) {
3648 0 : fd_memset( self, 0, sizeof(fd_vote_state_update_t) );
3649 0 : fd_hash_new( &self->hash );
3650 0 : }
3651 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 ) {
3652 0 : (void) varint;
3653 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_update", level++, 0 );
3654 :
3655 : /* Walk deque */
3656 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++, 0 );
3657 0 : if( self->lockouts ) {
3658 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
3659 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
3660 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
3661 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3662 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level, 0 );
3663 0 : }
3664 0 : }
3665 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level--, 0 );
3666 : /* Done walking deque */
3667 :
3668 0 : if( !self->has_root ) {
3669 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3670 0 : } else {
3671 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3672 0 : }
3673 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3674 0 : if( !self->has_timestamp ) {
3675 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
3676 0 : } else {
3677 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
3678 0 : }
3679 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_update", level--, 0 );
3680 0 : }
3681 0 : ulong fd_vote_state_update_size( fd_vote_state_update_t const * self ) {
3682 0 : ulong size = 0;
3683 0 : if( self->lockouts ) {
3684 0 : size += sizeof(ulong);
3685 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 ) ) {
3686 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3687 0 : size += fd_vote_lockout_size( ele );
3688 0 : }
3689 0 : } else {
3690 0 : size += sizeof(ulong);
3691 0 : }
3692 0 : size += sizeof(char);
3693 0 : if( self->has_root ) {
3694 0 : size += sizeof(ulong);
3695 0 : }
3696 0 : size += fd_hash_size( &self->hash );
3697 0 : size += sizeof(char);
3698 0 : if( self->has_timestamp ) {
3699 0 : size += sizeof(long);
3700 0 : }
3701 0 : return size;
3702 0 : }
3703 :
3704 0 : int fd_compact_vote_state_update_encode( fd_compact_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3705 0 : int err;
3706 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3707 0 : if( FD_UNLIKELY( err ) ) return err;
3708 0 : err = fd_bincode_compact_u16_encode( &self->lockouts_len, ctx );
3709 0 : if( FD_UNLIKELY(err) ) return err;
3710 0 : if( self->lockouts_len ) {
3711 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3712 0 : err = fd_lockout_offset_encode( self->lockouts + i, ctx );
3713 0 : if( FD_UNLIKELY( err ) ) return err;
3714 0 : }
3715 0 : }
3716 0 : err = fd_hash_encode( &self->hash, ctx );
3717 0 : if( FD_UNLIKELY( err ) ) return err;
3718 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3719 0 : if( FD_UNLIKELY( err ) ) return err;
3720 0 : if( self->has_timestamp ) {
3721 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3722 0 : if( FD_UNLIKELY( err ) ) return err;
3723 0 : }
3724 0 : return FD_BINCODE_SUCCESS;
3725 0 : }
3726 0 : static int fd_compact_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3727 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3728 0 : int err = 0;
3729 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3730 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3731 0 : ushort lockouts_len;
3732 0 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
3733 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3734 0 : if( lockouts_len ) {
3735 0 : *total_sz += FD_LOCKOUT_OFFSET_ALIGN + sizeof(fd_lockout_offset_t)*lockouts_len;
3736 0 : for( ulong i=0; i < lockouts_len; i++ ) {
3737 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3738 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3739 0 : }
3740 0 : }
3741 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3742 0 : if( FD_UNLIKELY( err ) ) return err;
3743 0 : {
3744 0 : uchar o;
3745 0 : err = fd_bincode_bool_decode( &o, ctx );
3746 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3747 0 : if( o ) {
3748 0 : err = fd_bincode_int64_decode_footprint( ctx );
3749 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3750 0 : }
3751 0 : }
3752 0 : return 0;
3753 0 : }
3754 0 : int fd_compact_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3755 0 : *total_sz += sizeof(fd_compact_vote_state_update_t);
3756 0 : void const * start_data = ctx->data;
3757 0 : int err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3758 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3759 0 : ctx->data = start_data;
3760 0 : return err;
3761 0 : }
3762 0 : static void fd_compact_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3763 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)struct_mem;
3764 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3765 0 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
3766 0 : if( self->lockouts_len ) {
3767 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_LOCKOUT_OFFSET_ALIGN );
3768 0 : self->lockouts = *alloc_mem;
3769 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_lockout_offset_t)*self->lockouts_len;
3770 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3771 0 : fd_lockout_offset_new( self->lockouts + i );
3772 0 : fd_lockout_offset_decode_inner( self->lockouts + i, alloc_mem, ctx );
3773 0 : }
3774 0 : } else
3775 0 : self->lockouts = NULL;
3776 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3777 0 : {
3778 0 : uchar o;
3779 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3780 0 : self->has_timestamp = !!o;
3781 0 : if( o ) {
3782 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3783 0 : }
3784 0 : }
3785 0 : }
3786 0 : void * fd_compact_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3787 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)mem;
3788 0 : fd_compact_vote_state_update_new( self );
3789 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_t);
3790 0 : void * * alloc_mem = &alloc_region;
3791 0 : fd_compact_vote_state_update_decode_inner( mem, alloc_mem, ctx );
3792 0 : return self;
3793 0 : }
3794 0 : void fd_compact_vote_state_update_new(fd_compact_vote_state_update_t * self) {
3795 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_t) );
3796 0 : fd_hash_new( &self->hash );
3797 0 : }
3798 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 ) {
3799 0 : (void) varint;
3800 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update", level++, 0 );
3801 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3802 0 : fun( w, &self->lockouts_len, "lockouts_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
3803 0 : if( self->lockouts_len ) {
3804 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
3805 0 : for( ulong i=0; i < self->lockouts_len; i++ )
3806 0 : fd_lockout_offset_walk(w, self->lockouts + i, fun, "lockout_offset", level, 0 );
3807 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
3808 0 : }
3809 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3810 0 : if( !self->has_timestamp ) {
3811 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
3812 0 : } else {
3813 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
3814 0 : }
3815 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update", level--, 0 );
3816 0 : }
3817 0 : ulong fd_compact_vote_state_update_size( fd_compact_vote_state_update_t const * self ) {
3818 0 : ulong size = 0;
3819 0 : size += sizeof(ulong);
3820 0 : do {
3821 0 : ushort tmp = (ushort)self->lockouts_len;
3822 0 : size += fd_bincode_compact_u16_size( &tmp );
3823 0 : for( ulong i=0; i < self->lockouts_len; i++ )
3824 0 : size += fd_lockout_offset_size( self->lockouts + i );
3825 0 : } while(0);
3826 0 : size += fd_hash_size( &self->hash );
3827 0 : size += sizeof(char);
3828 0 : if( self->has_timestamp ) {
3829 0 : size += sizeof(long);
3830 0 : }
3831 0 : return size;
3832 0 : }
3833 :
3834 0 : int fd_compact_vote_state_update_switch_encode( fd_compact_vote_state_update_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3835 0 : int err;
3836 0 : err = fd_compact_vote_state_update_encode( &self->compact_vote_state_update, ctx );
3837 0 : if( FD_UNLIKELY( err ) ) return err;
3838 0 : err = fd_hash_encode( &self->hash, ctx );
3839 0 : if( FD_UNLIKELY( err ) ) return err;
3840 0 : return FD_BINCODE_SUCCESS;
3841 0 : }
3842 0 : static int fd_compact_vote_state_update_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3843 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3844 0 : int err = 0;
3845 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3846 0 : if( FD_UNLIKELY( err ) ) return err;
3847 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3848 0 : if( FD_UNLIKELY( err ) ) return err;
3849 0 : return 0;
3850 0 : }
3851 0 : int fd_compact_vote_state_update_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3852 0 : *total_sz += sizeof(fd_compact_vote_state_update_switch_t);
3853 0 : void const * start_data = ctx->data;
3854 0 : int err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
3855 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3856 0 : ctx->data = start_data;
3857 0 : return err;
3858 0 : }
3859 0 : static void fd_compact_vote_state_update_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3860 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)struct_mem;
3861 0 : fd_compact_vote_state_update_decode_inner( &self->compact_vote_state_update, alloc_mem, ctx );
3862 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3863 0 : }
3864 0 : void * fd_compact_vote_state_update_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3865 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)mem;
3866 0 : fd_compact_vote_state_update_switch_new( self );
3867 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_switch_t);
3868 0 : void * * alloc_mem = &alloc_region;
3869 0 : fd_compact_vote_state_update_switch_decode_inner( mem, alloc_mem, ctx );
3870 0 : return self;
3871 0 : }
3872 0 : void fd_compact_vote_state_update_switch_new(fd_compact_vote_state_update_switch_t * self) {
3873 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_switch_t) );
3874 0 : fd_compact_vote_state_update_new( &self->compact_vote_state_update );
3875 0 : fd_hash_new( &self->hash );
3876 0 : }
3877 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 ) {
3878 0 : (void) varint;
3879 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update_switch", level++, 0 );
3880 0 : fd_compact_vote_state_update_walk( w, &self->compact_vote_state_update, fun, "compact_vote_state_update", level, 0 );
3881 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3882 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update_switch", level--, 0 );
3883 0 : }
3884 0 : ulong fd_compact_vote_state_update_switch_size( fd_compact_vote_state_update_switch_t const * self ) {
3885 0 : ulong size = 0;
3886 0 : size += fd_compact_vote_state_update_size( &self->compact_vote_state_update );
3887 0 : size += fd_hash_size( &self->hash );
3888 0 : return size;
3889 0 : }
3890 :
3891 0 : int fd_compact_tower_sync_encode( fd_compact_tower_sync_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3892 0 : int err;
3893 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3894 0 : if( FD_UNLIKELY( err ) ) return err;
3895 0 : if( self->lockout_offsets ) {
3896 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
3897 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3898 0 : if( FD_UNLIKELY( err ) ) return err;
3899 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 ) ) {
3900 0 : fd_lockout_offset_t const * ele = deq_fd_lockout_offset_t_iter_ele_const( self->lockout_offsets, iter );
3901 0 : err = fd_lockout_offset_encode( ele, ctx );
3902 0 : if( FD_UNLIKELY( err ) ) return err;
3903 0 : }
3904 0 : } else {
3905 0 : ushort lockout_offsets_len = 0;
3906 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3907 0 : if( FD_UNLIKELY( err ) ) return err;
3908 0 : }
3909 0 : err = fd_hash_encode( &self->hash, ctx );
3910 0 : if( FD_UNLIKELY( err ) ) return err;
3911 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3912 0 : if( FD_UNLIKELY( err ) ) return err;
3913 0 : if( self->has_timestamp ) {
3914 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3915 0 : if( FD_UNLIKELY( err ) ) return err;
3916 0 : }
3917 0 : err = fd_hash_encode( &self->block_id, ctx );
3918 0 : if( FD_UNLIKELY( err ) ) return err;
3919 0 : return FD_BINCODE_SUCCESS;
3920 0 : }
3921 0 : static int fd_compact_tower_sync_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3922 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3923 0 : int err = 0;
3924 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3925 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3926 0 : ushort lockout_offsets_len;
3927 0 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
3928 0 : if( FD_UNLIKELY( err ) ) return err;
3929 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
3930 0 : *total_sz += deq_fd_lockout_offset_t_align() + deq_fd_lockout_offset_t_footprint( lockout_offsets_max );
3931 0 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
3932 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3933 0 : if( FD_UNLIKELY( err ) ) return err;
3934 0 : }
3935 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3936 0 : if( FD_UNLIKELY( err ) ) return err;
3937 0 : {
3938 0 : uchar o;
3939 0 : err = fd_bincode_bool_decode( &o, ctx );
3940 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3941 0 : if( o ) {
3942 0 : err = fd_bincode_int64_decode_footprint( ctx );
3943 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3944 0 : }
3945 0 : }
3946 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3947 0 : if( FD_UNLIKELY( err ) ) return err;
3948 0 : return 0;
3949 0 : }
3950 0 : int fd_compact_tower_sync_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3951 0 : *total_sz += sizeof(fd_compact_tower_sync_t);
3952 0 : void const * start_data = ctx->data;
3953 0 : int err = fd_compact_tower_sync_decode_footprint_inner( ctx, total_sz );
3954 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3955 0 : ctx->data = start_data;
3956 0 : return err;
3957 0 : }
3958 0 : static void fd_compact_tower_sync_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3959 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)struct_mem;
3960 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3961 0 : ushort lockout_offsets_len;
3962 0 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
3963 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
3964 0 : self->lockout_offsets = deq_fd_lockout_offset_t_join_new( alloc_mem, lockout_offsets_max );
3965 0 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
3966 0 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( self->lockout_offsets );
3967 0 : fd_lockout_offset_new( elem );
3968 0 : fd_lockout_offset_decode_inner( elem, alloc_mem, ctx );
3969 0 : }
3970 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3971 0 : {
3972 0 : uchar o;
3973 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3974 0 : self->has_timestamp = !!o;
3975 0 : if( o ) {
3976 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3977 0 : }
3978 0 : }
3979 0 : fd_hash_decode_inner( &self->block_id, alloc_mem, ctx );
3980 0 : }
3981 0 : void * fd_compact_tower_sync_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3982 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)mem;
3983 0 : fd_compact_tower_sync_new( self );
3984 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_tower_sync_t);
3985 0 : void * * alloc_mem = &alloc_region;
3986 0 : fd_compact_tower_sync_decode_inner( mem, alloc_mem, ctx );
3987 0 : return self;
3988 0 : }
3989 0 : void fd_compact_tower_sync_new(fd_compact_tower_sync_t * self) {
3990 0 : fd_memset( self, 0, sizeof(fd_compact_tower_sync_t) );
3991 0 : fd_hash_new( &self->hash );
3992 0 : fd_hash_new( &self->block_id );
3993 0 : }
3994 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 ) {
3995 0 : (void) varint;
3996 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_tower_sync", level++, 0 );
3997 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3998 :
3999 : /* Walk deque */
4000 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR, "lockout_offsets", level++, 0 );
4001 0 : if( self->lockout_offsets ) {
4002 0 : for( deq_fd_lockout_offset_t_iter_t iter = deq_fd_lockout_offset_t_iter_init( self->lockout_offsets );
4003 0 : !deq_fd_lockout_offset_t_iter_done( self->lockout_offsets, iter );
4004 0 : iter = deq_fd_lockout_offset_t_iter_next( self->lockout_offsets, iter ) ) {
4005 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
4006 0 : fd_lockout_offset_walk(w, ele, fun, "lockout_offsets", level, 0 );
4007 0 : }
4008 0 : }
4009 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR_END, "lockout_offsets", level--, 0 );
4010 : /* Done walking deque */
4011 :
4012 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4013 0 : if( !self->has_timestamp ) {
4014 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
4015 0 : } else {
4016 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
4017 0 : }
4018 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level, 0 );
4019 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_tower_sync", level--, 0 );
4020 0 : }
4021 0 : ulong fd_compact_tower_sync_size( fd_compact_tower_sync_t const * self ) {
4022 0 : ulong size = 0;
4023 0 : size += sizeof(ulong);
4024 0 : if( self->lockout_offsets ) {
4025 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
4026 0 : size += fd_bincode_compact_u16_size( &lockout_offsets_len );
4027 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 ) ) {
4028 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
4029 0 : size += fd_lockout_offset_size( ele );
4030 0 : }
4031 0 : } else {
4032 0 : size += 1;
4033 0 : }
4034 0 : size += fd_hash_size( &self->hash );
4035 0 : size += sizeof(char);
4036 0 : if( self->has_timestamp ) {
4037 0 : size += sizeof(long);
4038 0 : }
4039 0 : size += fd_hash_size( &self->block_id );
4040 0 : return size;
4041 0 : }
4042 :
4043 0 : void fd_tower_sync_new(fd_tower_sync_t * self) {
4044 0 : fd_memset( self, 0, sizeof(fd_tower_sync_t) );
4045 0 : fd_hash_new( &self->hash );
4046 0 : fd_hash_new( &self->block_id );
4047 0 : }
4048 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 ) {
4049 0 : (void) varint;
4050 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync", level++, 0 );
4051 :
4052 : /* Walk deque */
4053 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++, 0 );
4054 0 : if( self->lockouts ) {
4055 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
4056 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
4057 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
4058 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
4059 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level, 0 );
4060 0 : }
4061 0 : }
4062 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level--, 0 );
4063 : /* Done walking deque */
4064 :
4065 0 : fun( w, &self->lockouts_cnt, "lockouts_cnt", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4066 0 : if( !self->has_root ) {
4067 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
4068 0 : } else {
4069 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4070 0 : }
4071 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4072 0 : if( !self->has_timestamp ) {
4073 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
4074 0 : } else {
4075 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
4076 0 : }
4077 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level, 0 );
4078 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync", level--, 0 );
4079 0 : }
4080 0 : ulong fd_tower_sync_size( fd_tower_sync_t const * self ) {
4081 0 : ulong size = 0;
4082 0 : if( self->lockouts ) {
4083 0 : size += sizeof(ulong);
4084 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 ) ) {
4085 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
4086 0 : size += fd_vote_lockout_size( ele );
4087 0 : }
4088 0 : } else {
4089 0 : size += sizeof(ulong);
4090 0 : }
4091 0 : size += sizeof(ulong);
4092 0 : size += sizeof(char);
4093 0 : if( self->has_root ) {
4094 0 : size += sizeof(ulong);
4095 0 : }
4096 0 : size += fd_hash_size( &self->hash );
4097 0 : size += sizeof(char);
4098 0 : if( self->has_timestamp ) {
4099 0 : size += sizeof(long);
4100 0 : }
4101 0 : size += fd_hash_size( &self->block_id );
4102 0 : return size;
4103 0 : }
4104 :
4105 0 : int fd_tower_sync_switch_encode( fd_tower_sync_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4106 0 : int err;
4107 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
4108 0 : if( FD_UNLIKELY( err ) ) return err;
4109 0 : err = fd_hash_encode( &self->hash, ctx );
4110 0 : if( FD_UNLIKELY( err ) ) return err;
4111 0 : return FD_BINCODE_SUCCESS;
4112 0 : }
4113 0 : static int fd_tower_sync_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4114 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4115 0 : int err = 0;
4116 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
4117 0 : if( FD_UNLIKELY( err ) ) return err;
4118 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4119 0 : if( FD_UNLIKELY( err ) ) return err;
4120 0 : return 0;
4121 0 : }
4122 0 : int fd_tower_sync_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4123 0 : *total_sz += sizeof(fd_tower_sync_switch_t);
4124 0 : void const * start_data = ctx->data;
4125 0 : int err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
4126 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4127 0 : ctx->data = start_data;
4128 0 : return err;
4129 0 : }
4130 0 : static void fd_tower_sync_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4131 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)struct_mem;
4132 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
4133 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4134 0 : }
4135 0 : void * fd_tower_sync_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4136 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)mem;
4137 0 : fd_tower_sync_switch_new( self );
4138 0 : void * alloc_region = (uchar *)mem + sizeof(fd_tower_sync_switch_t);
4139 0 : void * * alloc_mem = &alloc_region;
4140 0 : fd_tower_sync_switch_decode_inner( mem, alloc_mem, ctx );
4141 0 : return self;
4142 0 : }
4143 0 : void fd_tower_sync_switch_new(fd_tower_sync_switch_t * self) {
4144 0 : fd_memset( self, 0, sizeof(fd_tower_sync_switch_t) );
4145 0 : fd_tower_sync_new( &self->tower_sync );
4146 0 : fd_hash_new( &self->hash );
4147 0 : }
4148 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 ) {
4149 0 : (void) varint;
4150 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync_switch", level++, 0 );
4151 0 : fd_tower_sync_walk( w, &self->tower_sync, fun, "tower_sync", level, 0 );
4152 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4153 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync_switch", level--, 0 );
4154 0 : }
4155 0 : ulong fd_tower_sync_switch_size( fd_tower_sync_switch_t const * self ) {
4156 0 : ulong size = 0;
4157 0 : size += fd_tower_sync_size( &self->tower_sync );
4158 0 : size += fd_hash_size( &self->hash );
4159 0 : return size;
4160 0 : }
4161 :
4162 0 : int fd_slot_history_encode( fd_slot_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4163 0 : int err;
4164 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
4165 0 : if( FD_UNLIKELY( err ) ) return err;
4166 0 : if( self->has_bits ) {
4167 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
4168 0 : if( FD_UNLIKELY(err) ) return err;
4169 0 : if( self->bits_bitvec_len ) {
4170 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
4171 0 : err = fd_bincode_uint64_encode( self->bits_bitvec[i], ctx );
4172 0 : }
4173 0 : }
4174 0 : if( FD_UNLIKELY( err ) ) return err;
4175 0 : }
4176 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
4177 0 : if( FD_UNLIKELY( err ) ) return err;
4178 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
4179 0 : if( FD_UNLIKELY( err ) ) return err;
4180 0 : return FD_BINCODE_SUCCESS;
4181 0 : }
4182 0 : int fd_slot_history_encode_global( fd_slot_history_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4183 0 : int err;
4184 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
4185 0 : if( FD_UNLIKELY( err ) ) return err;
4186 0 : if( self->has_bits ) {
4187 0 : if( FD_UNLIKELY( err ) ) return err;
4188 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
4189 0 : if( FD_UNLIKELY( err ) ) return err;
4190 0 : if( self->bits_bitvec_len ) {
4191 0 : uchar * bits_bitvec_laddr = (uchar*)self + self->bits_bitvec_offset;
4192 0 : ulong * bits_bitvec = (ulong *)bits_bitvec_laddr;
4193 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
4194 0 : err = fd_bincode_uint64_encode( bits_bitvec[i], ctx );
4195 0 : if( FD_UNLIKELY( err ) ) return err;
4196 0 : }
4197 0 : }
4198 0 : if( FD_UNLIKELY( err ) ) return err;
4199 0 : }
4200 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
4201 0 : if( FD_UNLIKELY( err ) ) return err;
4202 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
4203 0 : if( FD_UNLIKELY( err ) ) return err;
4204 0 : return FD_BINCODE_SUCCESS;
4205 0 : }
4206 3 : static int fd_slot_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4207 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4208 3 : int err = 0;
4209 3 : {
4210 3 : uchar o;
4211 3 : ulong inner_len = 0UL;
4212 3 : err = fd_bincode_bool_decode( &o, ctx );
4213 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4214 3 : if( o ) {
4215 3 : ulong bits_bitvec_len;
4216 3 : err = fd_bincode_uint64_decode( &bits_bitvec_len, ctx );
4217 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4218 3 : if( bits_bitvec_len ) {
4219 3 : *total_sz += 8UL + sizeof(ulong)*bits_bitvec_len;
4220 49155 : for( ulong i=0; i < bits_bitvec_len; i++ ) {
4221 49152 : err = fd_bincode_uint64_decode_footprint( ctx );
4222 49152 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4223 49152 : }
4224 3 : }
4225 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4226 3 : inner_len = bits_bitvec_len;
4227 3 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
4228 3 : }
4229 3 : ulong len;
4230 3 : err = fd_bincode_uint64_decode( &len, ctx );
4231 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4232 3 : if( len > inner_len * sizeof(ulong) * 8UL ) return FD_BINCODE_ERR_ENCODING;
4233 3 : }
4234 3 : err = fd_bincode_uint64_decode_footprint( ctx );
4235 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4236 3 : return 0;
4237 3 : }
4238 3 : int fd_slot_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4239 3 : *total_sz += sizeof(fd_slot_history_t);
4240 3 : void const * start_data = ctx->data;
4241 3 : int err = fd_slot_history_decode_footprint_inner( ctx, total_sz );
4242 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4243 3 : ctx->data = start_data;
4244 3 : return err;
4245 3 : }
4246 0 : static void fd_slot_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4247 0 : fd_slot_history_t * self = (fd_slot_history_t *)struct_mem;
4248 0 : {
4249 0 : uchar o;
4250 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
4251 0 : self->has_bits = !!o;
4252 0 : if( o ) {
4253 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
4254 0 : if( self->bits_bitvec_len ) {
4255 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4256 0 : self->bits_bitvec = *alloc_mem;
4257 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
4258 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
4259 0 : fd_bincode_uint64_decode_unsafe( self->bits_bitvec + i, ctx );
4260 0 : }
4261 0 : } else
4262 0 : self->bits_bitvec = NULL;
4263 0 : } else {
4264 0 : self->bits_bitvec = NULL;
4265 0 : }
4266 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
4267 0 : }
4268 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
4269 0 : }
4270 0 : void * fd_slot_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4271 0 : fd_slot_history_t * self = (fd_slot_history_t *)mem;
4272 0 : fd_slot_history_new( self );
4273 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_t);
4274 0 : void * * alloc_mem = &alloc_region;
4275 0 : fd_slot_history_decode_inner( mem, alloc_mem, ctx );
4276 0 : return self;
4277 0 : }
4278 0 : static void fd_slot_history_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4279 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)struct_mem;
4280 0 : {
4281 0 : uchar o;
4282 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
4283 0 : self->has_bits = !!o;
4284 0 : if( o ) {
4285 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
4286 0 : if( self->bits_bitvec_len ) {
4287 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4288 0 : self->bits_bitvec_offset = (ulong)*alloc_mem - (ulong)struct_mem;
4289 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
4290 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
4291 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
4292 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
4293 0 : }
4294 0 : } else {
4295 0 : self->bits_bitvec_offset = 0UL;
4296 0 : }
4297 0 : }
4298 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
4299 0 : }
4300 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
4301 0 : }
4302 0 : void * fd_slot_history_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4303 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)mem;
4304 0 : fd_slot_history_new( (fd_slot_history_t *)self );
4305 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_global_t);
4306 0 : void * * alloc_mem = &alloc_region;
4307 0 : fd_slot_history_decode_inner_global( mem, alloc_mem, ctx );
4308 0 : return self;
4309 0 : }
4310 0 : void fd_slot_history_new(fd_slot_history_t * self) {
4311 0 : fd_memset( self, 0, sizeof(fd_slot_history_t) );
4312 0 : }
4313 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 ) {
4314 0 : (void) varint;
4315 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history", level++, 0 );
4316 0 : if( !self->has_bits ) {
4317 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
4318 0 : } else {
4319 0 : if( self->bits_bitvec_len ) {
4320 0 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4321 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ )
4322 0 : fun( w, self->bits_bitvec + i, "bits_bitvec", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4323 0 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4324 0 : }
4325 0 : }
4326 0 : fun( w, &self->bits_len, "bits_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4327 0 : fun( w, &self->next_slot, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4328 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history", level--, 0 );
4329 0 : }
4330 0 : ulong fd_slot_history_size( fd_slot_history_t const * self ) {
4331 0 : ulong size = 0;
4332 0 : size += sizeof(char);
4333 0 : if( self->has_bits ) {
4334 0 : do {
4335 0 : size += sizeof(ulong);
4336 0 : size += self->bits_bitvec_len * sizeof(ulong);
4337 0 : } while(0);
4338 0 : }
4339 0 : size += sizeof(ulong);
4340 0 : size += sizeof(ulong);
4341 0 : return size;
4342 0 : }
4343 :
4344 0 : ulong fd_slot_history_size_global( fd_slot_history_global_t const * self ) {
4345 0 : ulong size = 0;
4346 0 : do {
4347 0 : size += sizeof(char);
4348 0 : if( self->has_bits ) {
4349 0 : do {
4350 0 : size += sizeof(ulong);
4351 0 : ulong * bits_bitvec = self->bits_bitvec_offset ? (ulong *)fd_type_pun( (uchar *)self + self->bits_bitvec_offset ) : NULL;
4352 0 : size += self->bits_bitvec_len * sizeof(ulong);
4353 0 : } while(0);
4354 0 : }
4355 0 : } while(0);
4356 0 : size += sizeof(ulong);
4357 0 : return size;
4358 0 : }
4359 :
4360 0 : int fd_slot_hash_encode( fd_slot_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4361 0 : int err;
4362 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4363 0 : if( FD_UNLIKELY( err ) ) return err;
4364 0 : err = fd_hash_encode( &self->hash, ctx );
4365 0 : if( FD_UNLIKELY( err ) ) return err;
4366 0 : return FD_BINCODE_SUCCESS;
4367 0 : }
4368 0 : static inline int fd_slot_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4369 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4370 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
4371 0 : return 0;
4372 0 : }
4373 0 : static void fd_slot_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4374 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)struct_mem;
4375 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4376 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4377 0 : }
4378 0 : void * fd_slot_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4379 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)mem;
4380 0 : fd_slot_hash_new( self );
4381 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hash_t);
4382 0 : void * * alloc_mem = &alloc_region;
4383 0 : fd_slot_hash_decode_inner( mem, alloc_mem, ctx );
4384 0 : return self;
4385 0 : }
4386 0 : 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 ) {
4387 0 : (void) varint;
4388 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hash", level++, 0 );
4389 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4390 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4391 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hash", level--, 0 );
4392 0 : }
4393 0 : int fd_slot_hashes_encode( fd_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4394 0 : int err;
4395 0 : if( self->hashes ) {
4396 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( self->hashes );
4397 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4398 0 : if( FD_UNLIKELY( err ) ) return err;
4399 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 ) ) {
4400 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( self->hashes, iter );
4401 0 : err = fd_slot_hash_encode( ele, ctx );
4402 0 : if( FD_UNLIKELY( err ) ) return err;
4403 0 : }
4404 0 : } else {
4405 0 : ulong hashes_len = 0;
4406 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4407 0 : if( FD_UNLIKELY( err ) ) return err;
4408 0 : }
4409 0 : return FD_BINCODE_SUCCESS;
4410 0 : }
4411 0 : int fd_slot_hashes_encode_global( fd_slot_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4412 0 : int err;
4413 0 : if( self->hashes_offset ) {
4414 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
4415 0 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join( hashes_laddr );
4416 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( hashes );
4417 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4418 0 : if( FD_UNLIKELY( err ) ) return err;
4419 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 ) ) {
4420 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( hashes, iter );
4421 0 : err = fd_slot_hash_encode( ele, ctx );
4422 0 : if( FD_UNLIKELY( err ) ) return err;
4423 0 : }
4424 0 : } else {
4425 0 : ulong hashes_len = 0;
4426 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4427 0 : if( FD_UNLIKELY( err ) ) return err;
4428 0 : }
4429 0 : return FD_BINCODE_SUCCESS;
4430 0 : }
4431 3 : static int fd_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4432 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4433 3 : int err = 0;
4434 3 : ulong hashes_len;
4435 3 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
4436 3 : if( FD_UNLIKELY( err ) ) return err;
4437 3 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
4438 3 : *total_sz += deq_fd_slot_hash_t_align() + deq_fd_slot_hash_t_footprint( hashes_max );
4439 3 : ulong hashes_sz;
4440 3 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
4441 3 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
4442 3 : if( FD_UNLIKELY( err ) ) return err;
4443 3 : return 0;
4444 3 : }
4445 3 : int fd_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4446 3 : *total_sz += sizeof(fd_slot_hashes_t);
4447 3 : void const * start_data = ctx->data;
4448 3 : int err = fd_slot_hashes_decode_footprint_inner( ctx, total_sz );
4449 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4450 3 : ctx->data = start_data;
4451 3 : return err;
4452 3 : }
4453 0 : static void fd_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4454 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)struct_mem;
4455 0 : ulong hashes_len;
4456 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4457 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
4458 0 : self->hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
4459 0 : for( ulong i=0; i < hashes_len; i++ ) {
4460 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( self->hashes );
4461 0 : fd_slot_hash_new( elem );
4462 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
4463 0 : }
4464 0 : }
4465 0 : void * fd_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4466 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)mem;
4467 0 : fd_slot_hashes_new( self );
4468 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_t);
4469 0 : void * * alloc_mem = &alloc_region;
4470 0 : fd_slot_hashes_decode_inner( mem, alloc_mem, ctx );
4471 0 : return self;
4472 0 : }
4473 0 : static void fd_slot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4474 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)struct_mem;
4475 0 : ulong hashes_len;
4476 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4477 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_slot_hash_t_align() );
4478 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
4479 0 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
4480 0 : for( ulong i=0; i < hashes_len; i++ ) {
4481 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( hashes );
4482 0 : fd_slot_hash_new( (fd_slot_hash_t*)fd_type_pun( elem ) );
4483 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
4484 0 : }
4485 0 : self->hashes_offset = (ulong)deq_fd_slot_hash_t_leave( hashes ) - (ulong)struct_mem;
4486 0 : }
4487 0 : void * fd_slot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4488 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)mem;
4489 0 : fd_slot_hashes_new( (fd_slot_hashes_t *)self );
4490 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_global_t);
4491 0 : void * * alloc_mem = &alloc_region;
4492 0 : fd_slot_hashes_decode_inner_global( mem, alloc_mem, ctx );
4493 0 : return self;
4494 0 : }
4495 0 : void fd_slot_hashes_new(fd_slot_hashes_t * self) {
4496 0 : fd_memset( self, 0, sizeof(fd_slot_hashes_t) );
4497 0 : }
4498 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 ) {
4499 0 : (void) varint;
4500 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hashes", level++, 0 );
4501 :
4502 : /* Walk deque */
4503 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++, 0 );
4504 0 : if( self->hashes ) {
4505 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( self->hashes );
4506 0 : !deq_fd_slot_hash_t_iter_done( self->hashes, iter );
4507 0 : iter = deq_fd_slot_hash_t_iter_next( self->hashes, iter ) ) {
4508 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
4509 0 : fd_slot_hash_walk(w, ele, fun, "hashes", level, 0 );
4510 0 : }
4511 0 : }
4512 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level--, 0 );
4513 : /* Done walking deque */
4514 :
4515 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hashes", level--, 0 );
4516 0 : }
4517 0 : ulong fd_slot_hashes_size( fd_slot_hashes_t const * self ) {
4518 0 : ulong size = 0;
4519 0 : if( self->hashes ) {
4520 0 : size += sizeof(ulong);
4521 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 ) ) {
4522 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
4523 0 : size += fd_slot_hash_size( ele );
4524 0 : }
4525 0 : } else {
4526 0 : size += sizeof(ulong);
4527 0 : }
4528 0 : return size;
4529 0 : }
4530 :
4531 0 : ulong fd_slot_hashes_size_global( fd_slot_hashes_global_t const * self ) {
4532 0 : ulong size = 0;
4533 0 : if( self->hashes_offset!=0 ) {
4534 0 : fd_slot_hash_t * hashes = (fd_slot_hash_t *)deq_fd_slot_hash_t_join( fd_type_pun( (uchar *)self + self->hashes_offset ) );
4535 0 : size += sizeof(ulong);
4536 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 ) ) {
4537 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( hashes, iter );
4538 0 : size += fd_slot_hash_size( ele );
4539 0 : }
4540 0 : } else {
4541 0 : size += sizeof(ulong);
4542 0 : }
4543 0 : return size;
4544 0 : }
4545 :
4546 0 : int fd_block_block_hash_entry_encode( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4547 0 : int err;
4548 0 : err = fd_hash_encode( &self->blockhash, ctx );
4549 0 : if( FD_UNLIKELY( err ) ) return err;
4550 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
4551 0 : if( FD_UNLIKELY( err ) ) return err;
4552 0 : return FD_BINCODE_SUCCESS;
4553 0 : }
4554 0 : static inline int fd_block_block_hash_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4555 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4556 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
4557 0 : return 0;
4558 0 : }
4559 33975 : static void fd_block_block_hash_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4560 33975 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)struct_mem;
4561 33975 : fd_hash_decode_inner( &self->blockhash, alloc_mem, ctx );
4562 33975 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
4563 33975 : }
4564 0 : void * fd_block_block_hash_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4565 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)mem;
4566 0 : fd_block_block_hash_entry_new( self );
4567 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_block_hash_entry_t);
4568 0 : void * * alloc_mem = &alloc_region;
4569 0 : fd_block_block_hash_entry_decode_inner( mem, alloc_mem, ctx );
4570 0 : return self;
4571 0 : }
4572 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 ) {
4573 0 : (void) varint;
4574 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_block_hash_entry", level++, 0 );
4575 0 : fd_hash_walk( w, &self->blockhash, fun, "blockhash", level, 0 );
4576 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
4577 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_block_hash_entry", level--, 0 );
4578 0 : }
4579 0 : int fd_recent_block_hashes_encode( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4580 0 : int err;
4581 0 : if( self->hashes ) {
4582 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
4583 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4584 0 : if( FD_UNLIKELY( err ) ) return err;
4585 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 ) ) {
4586 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
4587 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
4588 0 : if( FD_UNLIKELY( err ) ) return err;
4589 0 : }
4590 0 : } else {
4591 0 : ulong hashes_len = 0;
4592 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4593 0 : if( FD_UNLIKELY( err ) ) return err;
4594 0 : }
4595 0 : return FD_BINCODE_SUCCESS;
4596 0 : }
4597 0 : int fd_recent_block_hashes_encode_global( fd_recent_block_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4598 0 : int err;
4599 0 : if( self->hashes_offset ) {
4600 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
4601 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join( hashes_laddr );
4602 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( hashes );
4603 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4604 0 : if( FD_UNLIKELY( err ) ) return err;
4605 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 ) ) {
4606 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( hashes, iter );
4607 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
4608 0 : if( FD_UNLIKELY( err ) ) return err;
4609 0 : }
4610 0 : } else {
4611 0 : ulong hashes_len = 0;
4612 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4613 0 : if( FD_UNLIKELY( err ) ) return err;
4614 0 : }
4615 0 : return FD_BINCODE_SUCCESS;
4616 0 : }
4617 456 : static int fd_recent_block_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4618 456 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4619 456 : int err = 0;
4620 456 : ulong hashes_len;
4621 456 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
4622 456 : if( FD_UNLIKELY( err ) ) return err;
4623 456 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
4624 456 : *total_sz += deq_fd_block_block_hash_entry_t_align() + deq_fd_block_block_hash_entry_t_footprint( hashes_max );
4625 456 : ulong hashes_sz;
4626 456 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
4627 456 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
4628 456 : if( FD_UNLIKELY( err ) ) return err;
4629 456 : return 0;
4630 456 : }
4631 456 : int fd_recent_block_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4632 456 : *total_sz += sizeof(fd_recent_block_hashes_t);
4633 456 : void const * start_data = ctx->data;
4634 456 : int err = fd_recent_block_hashes_decode_footprint_inner( ctx, total_sz );
4635 456 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4636 456 : ctx->data = start_data;
4637 456 : return err;
4638 456 : }
4639 0 : static void fd_recent_block_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4640 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)struct_mem;
4641 0 : ulong hashes_len;
4642 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4643 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
4644 0 : self->hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
4645 0 : for( ulong i=0; i < hashes_len; i++ ) {
4646 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
4647 0 : fd_block_block_hash_entry_new( elem );
4648 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
4649 0 : }
4650 0 : }
4651 0 : void * fd_recent_block_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4652 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)mem;
4653 0 : fd_recent_block_hashes_new( self );
4654 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_t);
4655 0 : void * * alloc_mem = &alloc_region;
4656 0 : fd_recent_block_hashes_decode_inner( mem, alloc_mem, ctx );
4657 0 : return self;
4658 0 : }
4659 453 : static void fd_recent_block_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4660 453 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)struct_mem;
4661 453 : ulong hashes_len;
4662 453 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4663 453 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_block_block_hash_entry_t_align() );
4664 453 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
4665 453 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
4666 34428 : for( ulong i=0; i < hashes_len; i++ ) {
4667 33975 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( hashes );
4668 33975 : fd_block_block_hash_entry_new( (fd_block_block_hash_entry_t*)fd_type_pun( elem ) );
4669 33975 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
4670 33975 : }
4671 453 : self->hashes_offset = (ulong)deq_fd_block_block_hash_entry_t_leave( hashes ) - (ulong)struct_mem;
4672 453 : }
4673 453 : void * fd_recent_block_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4674 453 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)mem;
4675 453 : fd_recent_block_hashes_new( (fd_recent_block_hashes_t *)self );
4676 453 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_global_t);
4677 453 : void * * alloc_mem = &alloc_region;
4678 453 : fd_recent_block_hashes_decode_inner_global( mem, alloc_mem, ctx );
4679 453 : return self;
4680 453 : }
4681 453 : void fd_recent_block_hashes_new(fd_recent_block_hashes_t * self) {
4682 453 : fd_memset( self, 0, sizeof(fd_recent_block_hashes_t) );
4683 453 : }
4684 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 ) {
4685 0 : (void) varint;
4686 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_recent_block_hashes", level++, 0 );
4687 :
4688 : /* Walk deque */
4689 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++, 0 );
4690 0 : if( self->hashes ) {
4691 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes );
4692 0 : !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter );
4693 0 : iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
4694 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
4695 0 : fd_block_block_hash_entry_walk(w, ele, fun, "hashes", level, 0 );
4696 0 : }
4697 0 : }
4698 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level--, 0 );
4699 : /* Done walking deque */
4700 :
4701 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_recent_block_hashes", level--, 0 );
4702 0 : }
4703 0 : ulong fd_recent_block_hashes_size( fd_recent_block_hashes_t const * self ) {
4704 0 : ulong size = 0;
4705 0 : if( self->hashes ) {
4706 0 : size += sizeof(ulong);
4707 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 ) ) {
4708 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
4709 0 : size += fd_block_block_hash_entry_size( ele );
4710 0 : }
4711 0 : } else {
4712 0 : size += sizeof(ulong);
4713 0 : }
4714 0 : return size;
4715 0 : }
4716 :
4717 0 : ulong fd_recent_block_hashes_size_global( fd_recent_block_hashes_global_t const * self ) {
4718 0 : ulong size = 0;
4719 0 : if( self->hashes_offset!=0 ) {
4720 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 ) );
4721 0 : size += sizeof(ulong);
4722 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 ) ) {
4723 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( hashes, iter );
4724 0 : size += fd_block_block_hash_entry_size( ele );
4725 0 : }
4726 0 : } else {
4727 0 : size += sizeof(ulong);
4728 0 : }
4729 0 : return size;
4730 0 : }
4731 :
4732 0 : int fd_slot_meta_encode( fd_slot_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4733 0 : int err;
4734 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4735 0 : if( FD_UNLIKELY( err ) ) return err;
4736 0 : err = fd_bincode_uint64_encode( self->consumed, ctx );
4737 0 : if( FD_UNLIKELY( err ) ) return err;
4738 0 : err = fd_bincode_uint64_encode( self->received, ctx );
4739 0 : if( FD_UNLIKELY( err ) ) return err;
4740 0 : err = fd_bincode_uint64_encode( (ulong)self->first_shred_timestamp, ctx );
4741 0 : if( FD_UNLIKELY( err ) ) return err;
4742 0 : err = fd_bincode_uint64_encode( self->last_index, ctx );
4743 0 : if( FD_UNLIKELY( err ) ) return err;
4744 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
4745 0 : if( FD_UNLIKELY( err ) ) return err;
4746 0 : err = fd_bincode_uint64_encode( self->next_slot_len, ctx );
4747 0 : if( FD_UNLIKELY(err) ) return err;
4748 0 : if( self->next_slot_len ) {
4749 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
4750 0 : err = fd_bincode_uint64_encode( self->next_slot[i], ctx );
4751 0 : }
4752 0 : }
4753 0 : err = fd_bincode_uint8_encode( (uchar)(self->is_connected), ctx );
4754 0 : if( FD_UNLIKELY( err ) ) return err;
4755 0 : err = fd_bincode_uint64_encode( self->entry_end_indexes_len, ctx );
4756 0 : if( FD_UNLIKELY(err) ) return err;
4757 0 : if( self->entry_end_indexes_len ) {
4758 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
4759 0 : err = fd_bincode_uint32_encode( self->entry_end_indexes[i], ctx );
4760 0 : }
4761 0 : }
4762 0 : return FD_BINCODE_SUCCESS;
4763 0 : }
4764 0 : static int fd_slot_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4765 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4766 0 : int err = 0;
4767 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4768 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4769 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4770 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4771 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4772 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4773 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4774 0 : if( FD_UNLIKELY( err ) ) return err;
4775 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4776 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4777 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4778 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4779 0 : ulong next_slot_len;
4780 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
4781 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4782 0 : if( next_slot_len ) {
4783 0 : *total_sz += 8UL + sizeof(ulong)*next_slot_len;
4784 0 : for( ulong i=0; i < next_slot_len; i++ ) {
4785 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4786 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4787 0 : }
4788 0 : }
4789 0 : err = fd_bincode_uint8_decode_footprint( ctx );
4790 0 : if( FD_UNLIKELY( err ) ) return err;
4791 0 : ulong entry_end_indexes_len;
4792 0 : err = fd_bincode_uint64_decode( &entry_end_indexes_len, ctx );
4793 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4794 0 : if( entry_end_indexes_len ) {
4795 0 : *total_sz += 8UL + sizeof(uint)*entry_end_indexes_len;
4796 0 : for( ulong i=0; i < entry_end_indexes_len; i++ ) {
4797 0 : err = fd_bincode_uint32_decode_footprint( ctx );
4798 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4799 0 : }
4800 0 : }
4801 0 : return 0;
4802 0 : }
4803 0 : int fd_slot_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4804 0 : *total_sz += sizeof(fd_slot_meta_t);
4805 0 : void const * start_data = ctx->data;
4806 0 : int err = fd_slot_meta_decode_footprint_inner( ctx, total_sz );
4807 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4808 0 : ctx->data = start_data;
4809 0 : return err;
4810 0 : }
4811 0 : static void fd_slot_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4812 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)struct_mem;
4813 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4814 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
4815 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
4816 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
4817 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
4818 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
4819 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
4820 0 : if( self->next_slot_len ) {
4821 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4822 0 : self->next_slot = *alloc_mem;
4823 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->next_slot_len;
4824 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
4825 0 : fd_bincode_uint64_decode_unsafe( self->next_slot + i, ctx );
4826 0 : }
4827 0 : } else
4828 0 : self->next_slot = NULL;
4829 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
4830 0 : fd_bincode_uint64_decode_unsafe( &self->entry_end_indexes_len, ctx );
4831 0 : if( self->entry_end_indexes_len ) {
4832 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4833 0 : self->entry_end_indexes = *alloc_mem;
4834 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(uint)*self->entry_end_indexes_len;
4835 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ ) {
4836 0 : fd_bincode_uint32_decode_unsafe( self->entry_end_indexes + i, ctx );
4837 0 : }
4838 0 : } else
4839 0 : self->entry_end_indexes = NULL;
4840 0 : }
4841 0 : void * fd_slot_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4842 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)mem;
4843 0 : fd_slot_meta_new( self );
4844 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_meta_t);
4845 0 : void * * alloc_mem = &alloc_region;
4846 0 : fd_slot_meta_decode_inner( mem, alloc_mem, ctx );
4847 0 : return self;
4848 0 : }
4849 0 : void fd_slot_meta_new(fd_slot_meta_t * self) {
4850 0 : fd_memset( self, 0, sizeof(fd_slot_meta_t) );
4851 0 : }
4852 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 ) {
4853 0 : (void) varint;
4854 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_meta", level++, 0 );
4855 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4856 0 : fun( w, &self->consumed, "consumed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4857 0 : fun( w, &self->received, "received", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4858 0 : fun( w, &self->first_shred_timestamp, "first_shred_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
4859 0 : fun( w, &self->last_index, "last_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4860 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4861 0 : if( self->next_slot_len ) {
4862 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4863 0 : for( ulong i=0; i < self->next_slot_len; i++ )
4864 0 : fun( w, self->next_slot + i, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4865 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4866 0 : }
4867 0 : fun( w, &self->is_connected, "is_connected", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
4868 0 : if( self->entry_end_indexes_len ) {
4869 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4870 0 : for( ulong i=0; i < self->entry_end_indexes_len; i++ )
4871 0 : fun( w, self->entry_end_indexes + i, "entry_end_indexes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
4872 0 : fun( w, NULL, "entry_end_indexes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4873 0 : }
4874 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_meta", level--, 0 );
4875 0 : }
4876 0 : ulong fd_slot_meta_size( fd_slot_meta_t const * self ) {
4877 0 : ulong size = 0;
4878 0 : size += sizeof(ulong);
4879 0 : size += sizeof(ulong);
4880 0 : size += sizeof(ulong);
4881 0 : size += sizeof(long);
4882 0 : size += sizeof(ulong);
4883 0 : size += sizeof(ulong);
4884 0 : do {
4885 0 : size += sizeof(ulong);
4886 0 : size += self->next_slot_len * sizeof(ulong);
4887 0 : } while(0);
4888 0 : size += sizeof(char);
4889 0 : do {
4890 0 : size += sizeof(ulong);
4891 0 : size += self->entry_end_indexes_len * sizeof(uint);
4892 0 : } while(0);
4893 0 : return size;
4894 0 : }
4895 :
4896 0 : int fd_clock_timestamp_vote_encode( fd_clock_timestamp_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4897 0 : int err;
4898 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
4899 0 : if( FD_UNLIKELY( err ) ) return err;
4900 0 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
4901 0 : if( FD_UNLIKELY( err ) ) return err;
4902 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4903 0 : if( FD_UNLIKELY( err ) ) return err;
4904 0 : return FD_BINCODE_SUCCESS;
4905 0 : }
4906 0 : static inline int fd_clock_timestamp_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4907 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4908 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
4909 0 : return 0;
4910 0 : }
4911 0 : static void fd_clock_timestamp_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4912 0 : fd_clock_timestamp_vote_t * self = (fd_clock_timestamp_vote_t *)struct_mem;
4913 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
4914 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
4915 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4916 0 : }
4917 0 : void * fd_clock_timestamp_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4918 0 : fd_clock_timestamp_vote_t * self = (fd_clock_timestamp_vote_t *)mem;
4919 0 : fd_clock_timestamp_vote_new( self );
4920 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_vote_t);
4921 0 : void * * alloc_mem = &alloc_region;
4922 0 : fd_clock_timestamp_vote_decode_inner( mem, alloc_mem, ctx );
4923 0 : return self;
4924 0 : }
4925 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 ) {
4926 0 : (void) varint;
4927 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_vote", level++, 0 );
4928 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
4929 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
4930 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4931 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_vote", level--, 0 );
4932 0 : }
4933 0 : int fd_clock_timestamp_votes_encode( fd_clock_timestamp_votes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4934 0 : int err;
4935 0 : if( self->votes_root ) {
4936 0 : ulong votes_len = fd_clock_timestamp_vote_t_map_size( self->votes_pool, self->votes_root );
4937 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
4938 0 : if( FD_UNLIKELY( err ) ) return err;
4939 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 ) ) {
4940 0 : err = fd_clock_timestamp_vote_encode( &n->elem, ctx );
4941 0 : if( FD_UNLIKELY( err ) ) return err;
4942 0 : }
4943 0 : } else {
4944 0 : ulong votes_len = 0;
4945 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
4946 0 : if( FD_UNLIKELY( err ) ) return err;
4947 0 : }
4948 0 : return FD_BINCODE_SUCCESS;
4949 0 : }
4950 0 : int fd_clock_timestamp_votes_encode_global( fd_clock_timestamp_votes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4951 0 : int err;
4952 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_root = fd_clock_timestamp_vote_t_map_join( (uchar *)self + self->votes_root_offset );
4953 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_pool = fd_clock_timestamp_vote_t_map_join( (uchar *)self + self->votes_pool_offset );
4954 0 : if( votes_root ) {
4955 0 : ulong votes_len = fd_clock_timestamp_vote_t_map_size( votes_pool, votes_root );
4956 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
4957 0 : if( FD_UNLIKELY( err ) ) return err;
4958 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 ) ) {
4959 0 : err = fd_clock_timestamp_vote_encode( &n->elem, ctx );
4960 0 : if( FD_UNLIKELY( err ) ) return err;
4961 0 : }
4962 0 : } else {
4963 0 : ulong votes_len = 0;
4964 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
4965 0 : if( FD_UNLIKELY( err ) ) return err;
4966 0 : }
4967 0 : return FD_BINCODE_SUCCESS;
4968 0 : }
4969 0 : static int fd_clock_timestamp_votes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4970 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4971 0 : int err = 0;
4972 0 : ulong votes_len = 0UL;
4973 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
4974 0 : ulong votes_cnt = fd_ulong_max( votes_len, 15000 );
4975 0 : *total_sz += fd_clock_timestamp_vote_t_map_align() + fd_clock_timestamp_vote_t_map_footprint( votes_cnt );
4976 0 : if( FD_UNLIKELY( err ) ) return err;
4977 0 : for( ulong i=0; i < votes_len; i++ ) {
4978 0 : err = fd_clock_timestamp_vote_decode_footprint_inner( ctx, total_sz );
4979 0 : if( FD_UNLIKELY( err ) ) return err;
4980 0 : }
4981 0 : return 0;
4982 0 : }
4983 0 : int fd_clock_timestamp_votes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4984 0 : *total_sz += sizeof(fd_clock_timestamp_votes_t);
4985 0 : void const * start_data = ctx->data;
4986 0 : int err = fd_clock_timestamp_votes_decode_footprint_inner( ctx, total_sz );
4987 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4988 0 : ctx->data = start_data;
4989 0 : return err;
4990 0 : }
4991 0 : static void fd_clock_timestamp_votes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4992 0 : fd_clock_timestamp_votes_t * self = (fd_clock_timestamp_votes_t *)struct_mem;
4993 0 : ulong votes_len;
4994 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
4995 0 : self->votes_pool = fd_clock_timestamp_vote_t_map_join_new( alloc_mem, fd_ulong_max( votes_len, 15000 ) );
4996 0 : self->votes_root = NULL;
4997 0 : for( ulong i=0; i < votes_len; i++ ) {
4998 0 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( self->votes_pool );
4999 0 : fd_clock_timestamp_vote_new( &node->elem );
5000 0 : fd_clock_timestamp_vote_decode_inner( &node->elem, alloc_mem, ctx );
5001 0 : fd_clock_timestamp_vote_t_mapnode_t * out = NULL;;
5002 0 : fd_clock_timestamp_vote_t_map_insert_or_replace( self->votes_pool, &self->votes_root, node, &out );
5003 0 : if( out != NULL ) {
5004 0 : fd_clock_timestamp_vote_t_map_release( self->votes_pool, out );
5005 0 : }
5006 0 : }
5007 0 : }
5008 0 : void * fd_clock_timestamp_votes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5009 0 : fd_clock_timestamp_votes_t * self = (fd_clock_timestamp_votes_t *)mem;
5010 0 : fd_clock_timestamp_votes_new( self );
5011 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_votes_t);
5012 0 : void * * alloc_mem = &alloc_region;
5013 0 : fd_clock_timestamp_votes_decode_inner( mem, alloc_mem, ctx );
5014 0 : return self;
5015 0 : }
5016 0 : static void fd_clock_timestamp_votes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5017 0 : fd_clock_timestamp_votes_global_t * self = (fd_clock_timestamp_votes_global_t *)struct_mem;
5018 0 : ulong votes_len;
5019 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
5020 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_clock_timestamp_vote_t_map_align() );
5021 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 ) );
5022 0 : fd_clock_timestamp_vote_t_mapnode_t * votes_root = NULL;
5023 0 : for( ulong i=0; i < votes_len; i++ ) {
5024 0 : fd_clock_timestamp_vote_t_mapnode_t * node = fd_clock_timestamp_vote_t_map_acquire( votes_pool );
5025 0 : fd_clock_timestamp_vote_new( (fd_clock_timestamp_vote_t *)fd_type_pun(&node->elem) );
5026 0 : fd_clock_timestamp_vote_decode_inner( &node->elem, alloc_mem, ctx );
5027 0 : fd_clock_timestamp_vote_t_map_insert( votes_pool, &votes_root, node );
5028 0 : }
5029 0 : self->votes_pool_offset = (ulong)fd_clock_timestamp_vote_t_map_leave( votes_pool ) - (ulong)struct_mem;
5030 0 : self->votes_root_offset = (ulong)votes_root - (ulong)struct_mem;
5031 0 : }
5032 0 : void * fd_clock_timestamp_votes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5033 0 : fd_clock_timestamp_votes_global_t * self = (fd_clock_timestamp_votes_global_t *)mem;
5034 0 : fd_clock_timestamp_votes_new( (fd_clock_timestamp_votes_t *)self );
5035 0 : void * alloc_region = (uchar *)mem + sizeof(fd_clock_timestamp_votes_global_t);
5036 0 : void * * alloc_mem = &alloc_region;
5037 0 : fd_clock_timestamp_votes_decode_inner_global( mem, alloc_mem, ctx );
5038 0 : return self;
5039 0 : }
5040 0 : void fd_clock_timestamp_votes_new(fd_clock_timestamp_votes_t * self) {
5041 0 : fd_memset( self, 0, sizeof(fd_clock_timestamp_votes_t) );
5042 0 : }
5043 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 ) {
5044 0 : (void) varint;
5045 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_clock_timestamp_votes", level++, 0 );
5046 0 : if( self->votes_root ) {
5047 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 ) ) {
5048 0 : fd_clock_timestamp_vote_walk(w, &n->elem, fun, "votes", level, 0 );
5049 0 : }
5050 0 : }
5051 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_clock_timestamp_votes", level--, 0 );
5052 0 : }
5053 0 : ulong fd_clock_timestamp_votes_size( fd_clock_timestamp_votes_t const * self ) {
5054 0 : ulong size = 0;
5055 0 : if( self->votes_root ) {
5056 0 : size += sizeof(ulong);
5057 0 : ulong max = fd_clock_timestamp_vote_t_map_max( self->votes_pool );
5058 0 : size += fd_clock_timestamp_vote_t_map_footprint( max );
5059 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 ) ) {
5060 0 : size += fd_clock_timestamp_vote_size( &n->elem ) - sizeof(fd_clock_timestamp_vote_t);
5061 0 : }
5062 0 : } else {
5063 0 : size += sizeof(ulong);
5064 0 : }
5065 0 : return size;
5066 0 : }
5067 :
5068 0 : ulong fd_clock_timestamp_votes_size_global( fd_clock_timestamp_votes_global_t const * self ) {
5069 0 : ulong size = 0;
5070 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;
5071 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;
5072 0 : if( votes_root ) {
5073 0 : size += sizeof(ulong);
5074 0 : ulong max = fd_clock_timestamp_vote_t_map_max( votes_pool );
5075 0 : size += fd_clock_timestamp_vote_t_map_footprint( max );
5076 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 ) ) {
5077 0 : size += fd_clock_timestamp_vote_size( &n->elem ) - sizeof(fd_clock_timestamp_vote_t);
5078 0 : }
5079 0 : } else {
5080 0 : size += sizeof(ulong);
5081 0 : }
5082 0 : return size;
5083 0 : }
5084 :
5085 0 : int fd_sysvar_fees_encode( fd_sysvar_fees_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5086 0 : int err;
5087 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
5088 0 : if( FD_UNLIKELY( err ) ) return err;
5089 0 : return FD_BINCODE_SUCCESS;
5090 0 : }
5091 0 : static inline int fd_sysvar_fees_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5092 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5093 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
5094 0 : return 0;
5095 0 : }
5096 0 : static void fd_sysvar_fees_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5097 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)struct_mem;
5098 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
5099 0 : }
5100 0 : void * fd_sysvar_fees_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5101 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)mem;
5102 0 : fd_sysvar_fees_new( self );
5103 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_fees_t);
5104 0 : void * * alloc_mem = &alloc_region;
5105 0 : fd_sysvar_fees_decode_inner( mem, alloc_mem, ctx );
5106 0 : return self;
5107 0 : }
5108 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 ) {
5109 0 : (void) varint;
5110 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_fees", level++, 0 );
5111 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
5112 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_fees", level--, 0 );
5113 0 : }
5114 0 : int fd_sysvar_epoch_rewards_encode( fd_sysvar_epoch_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5115 0 : int err;
5116 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
5117 0 : if( FD_UNLIKELY( err ) ) return err;
5118 0 : err = fd_bincode_uint64_encode( self->num_partitions, ctx );
5119 0 : if( FD_UNLIKELY( err ) ) return err;
5120 0 : err = fd_hash_encode( &self->parent_blockhash, ctx );
5121 0 : if( FD_UNLIKELY( err ) ) return err;
5122 0 : err = fd_bincode_uint128_encode( self->total_points, ctx );
5123 0 : if( FD_UNLIKELY( err ) ) return err;
5124 0 : err = fd_bincode_uint64_encode( self->total_rewards, ctx );
5125 0 : if( FD_UNLIKELY( err ) ) return err;
5126 0 : err = fd_bincode_uint64_encode( self->distributed_rewards, ctx );
5127 0 : if( FD_UNLIKELY( err ) ) return err;
5128 0 : err = fd_bincode_bool_encode( (uchar)(self->active), ctx );
5129 0 : if( FD_UNLIKELY( err ) ) return err;
5130 0 : return FD_BINCODE_SUCCESS;
5131 0 : }
5132 3 : static int fd_sysvar_epoch_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5133 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5134 3 : int err = 0;
5135 3 : err = fd_bincode_uint64_decode_footprint( ctx );
5136 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5137 3 : err = fd_bincode_uint64_decode_footprint( ctx );
5138 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5139 3 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
5140 3 : if( FD_UNLIKELY( err ) ) return err;
5141 3 : err = fd_bincode_uint128_decode_footprint( ctx );
5142 3 : if( FD_UNLIKELY( err ) ) return err;
5143 3 : err = fd_bincode_uint64_decode_footprint( ctx );
5144 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5145 3 : err = fd_bincode_uint64_decode_footprint( ctx );
5146 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5147 3 : err = fd_bincode_bool_decode_footprint( ctx );
5148 3 : if( FD_UNLIKELY( err ) ) return err;
5149 3 : return 0;
5150 3 : }
5151 3 : int fd_sysvar_epoch_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5152 3 : *total_sz += sizeof(fd_sysvar_epoch_rewards_t);
5153 3 : void const * start_data = ctx->data;
5154 3 : int err = fd_sysvar_epoch_rewards_decode_footprint_inner( ctx, total_sz );
5155 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5156 3 : ctx->data = start_data;
5157 3 : return err;
5158 3 : }
5159 0 : static void fd_sysvar_epoch_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5160 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)struct_mem;
5161 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
5162 0 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
5163 0 : fd_hash_decode_inner( &self->parent_blockhash, alloc_mem, ctx );
5164 0 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
5165 0 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
5166 0 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
5167 0 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
5168 0 : }
5169 0 : void * fd_sysvar_epoch_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5170 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)mem;
5171 0 : fd_sysvar_epoch_rewards_new( self );
5172 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_epoch_rewards_t);
5173 0 : void * * alloc_mem = &alloc_region;
5174 0 : fd_sysvar_epoch_rewards_decode_inner( mem, alloc_mem, ctx );
5175 0 : return self;
5176 0 : }
5177 0 : void fd_sysvar_epoch_rewards_new(fd_sysvar_epoch_rewards_t * self) {
5178 0 : fd_memset( self, 0, sizeof(fd_sysvar_epoch_rewards_t) );
5179 0 : fd_hash_new( &self->parent_blockhash );
5180 0 : }
5181 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 ) {
5182 0 : (void) varint;
5183 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_epoch_rewards", level++, 0 );
5184 0 : fun( w, &self->distribution_starting_block_height, "distribution_starting_block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5185 0 : fun( w, &self->num_partitions, "num_partitions", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5186 0 : fd_hash_walk( w, &self->parent_blockhash, fun, "parent_blockhash", level, 0 );
5187 0 : fun( w, &self->total_points, "total_points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
5188 0 : fun( w, &self->total_rewards, "total_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5189 0 : fun( w, &self->distributed_rewards, "distributed_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5190 0 : fun( w, &self->active, "active", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
5191 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_epoch_rewards", level--, 0 );
5192 0 : }
5193 0 : int fd_config_keys_pair_encode( fd_config_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5194 0 : int err;
5195 0 : err = fd_pubkey_encode( &self->key, ctx );
5196 0 : if( FD_UNLIKELY( err ) ) return err;
5197 0 : err = fd_bincode_bool_encode( (uchar)(self->signer), ctx );
5198 0 : if( FD_UNLIKELY( err ) ) return err;
5199 0 : return FD_BINCODE_SUCCESS;
5200 0 : }
5201 0 : static int fd_config_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5202 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5203 0 : int err = 0;
5204 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5205 0 : if( FD_UNLIKELY( err ) ) return err;
5206 0 : err = fd_bincode_bool_decode_footprint( ctx );
5207 0 : if( FD_UNLIKELY( err ) ) return err;
5208 0 : return 0;
5209 0 : }
5210 0 : int fd_config_keys_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5211 0 : *total_sz += sizeof(fd_config_keys_pair_t);
5212 0 : void const * start_data = ctx->data;
5213 0 : int err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
5214 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5215 0 : ctx->data = start_data;
5216 0 : return err;
5217 0 : }
5218 0 : static void fd_config_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5219 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)struct_mem;
5220 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
5221 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
5222 0 : }
5223 0 : void * fd_config_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5224 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)mem;
5225 0 : fd_config_keys_pair_new( self );
5226 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_pair_t);
5227 0 : void * * alloc_mem = &alloc_region;
5228 0 : fd_config_keys_pair_decode_inner( mem, alloc_mem, ctx );
5229 0 : return self;
5230 0 : }
5231 0 : void fd_config_keys_pair_new(fd_config_keys_pair_t * self) {
5232 0 : fd_memset( self, 0, sizeof(fd_config_keys_pair_t) );
5233 0 : fd_pubkey_new( &self->key );
5234 0 : }
5235 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 ) {
5236 0 : (void) varint;
5237 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys_pair", level++, 0 );
5238 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
5239 0 : fun( w, &self->signer, "signer", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
5240 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys_pair", level--, 0 );
5241 0 : }
5242 12 : int fd_stake_config_encode( fd_stake_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5243 12 : int err;
5244 12 : err = fd_bincode_compact_u16_encode( &self->config_keys_len, ctx );
5245 12 : if( FD_UNLIKELY(err) ) return err;
5246 12 : if( self->config_keys_len ) {
5247 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
5248 0 : err = fd_config_keys_pair_encode( self->config_keys + i, ctx );
5249 0 : if( FD_UNLIKELY( err ) ) return err;
5250 0 : }
5251 0 : }
5252 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
5253 12 : if( FD_UNLIKELY( err ) ) return err;
5254 12 : err = fd_bincode_uint8_encode( (uchar)(self->slash_penalty), ctx );
5255 12 : if( FD_UNLIKELY( err ) ) return err;
5256 12 : return FD_BINCODE_SUCCESS;
5257 12 : }
5258 0 : static int fd_stake_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5259 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5260 0 : int err = 0;
5261 0 : ushort config_keys_len;
5262 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
5263 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5264 0 : if( config_keys_len ) {
5265 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*config_keys_len;
5266 0 : for( ulong i=0; i < config_keys_len; i++ ) {
5267 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
5268 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5269 0 : }
5270 0 : }
5271 0 : err = fd_bincode_double_decode_footprint( ctx );
5272 0 : if( FD_UNLIKELY( err ) ) return err;
5273 0 : err = fd_bincode_uint8_decode_footprint( ctx );
5274 0 : if( FD_UNLIKELY( err ) ) return err;
5275 0 : return 0;
5276 0 : }
5277 0 : int fd_stake_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5278 0 : *total_sz += sizeof(fd_stake_config_t);
5279 0 : void const * start_data = ctx->data;
5280 0 : int err = fd_stake_config_decode_footprint_inner( ctx, total_sz );
5281 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5282 0 : ctx->data = start_data;
5283 0 : return err;
5284 0 : }
5285 0 : static void fd_stake_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5286 0 : fd_stake_config_t * self = (fd_stake_config_t *)struct_mem;
5287 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
5288 0 : if( self->config_keys_len ) {
5289 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
5290 0 : self->config_keys = *alloc_mem;
5291 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->config_keys_len;
5292 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
5293 0 : fd_config_keys_pair_new( self->config_keys + i );
5294 0 : fd_config_keys_pair_decode_inner( self->config_keys + i, alloc_mem, ctx );
5295 0 : }
5296 0 : } else
5297 0 : self->config_keys = NULL;
5298 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
5299 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
5300 0 : }
5301 0 : void * fd_stake_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5302 0 : fd_stake_config_t * self = (fd_stake_config_t *)mem;
5303 0 : fd_stake_config_new( self );
5304 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_config_t);
5305 0 : void * * alloc_mem = &alloc_region;
5306 0 : fd_stake_config_decode_inner( mem, alloc_mem, ctx );
5307 0 : return self;
5308 0 : }
5309 0 : void fd_stake_config_new(fd_stake_config_t * self) {
5310 0 : fd_memset( self, 0, sizeof(fd_stake_config_t) );
5311 0 : }
5312 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 ) {
5313 0 : (void) varint;
5314 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_config", level++, 0 );
5315 0 : fun( w, &self->config_keys_len, "config_keys_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
5316 0 : if( self->config_keys_len ) {
5317 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
5318 0 : for( ulong i=0; i < self->config_keys_len; i++ )
5319 0 : fd_config_keys_pair_walk(w, self->config_keys + i, fun, "config_keys_pair", level, 0 );
5320 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
5321 0 : }
5322 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
5323 0 : fun( w, &self->slash_penalty, "slash_penalty", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5324 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_config", level--, 0 );
5325 0 : }
5326 0 : ulong fd_stake_config_size( fd_stake_config_t const * self ) {
5327 0 : ulong size = 0;
5328 0 : do {
5329 0 : ushort tmp = (ushort)self->config_keys_len;
5330 0 : size += fd_bincode_compact_u16_size( &tmp );
5331 0 : for( ulong i=0; i < self->config_keys_len; i++ )
5332 0 : size += fd_config_keys_pair_size( self->config_keys + i );
5333 0 : } while(0);
5334 0 : size += sizeof(double);
5335 0 : size += sizeof(char);
5336 0 : return size;
5337 0 : }
5338 :
5339 0 : int fd_feature_entry_encode( fd_feature_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5340 0 : int err;
5341 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
5342 0 : if( FD_UNLIKELY( err ) ) return err;
5343 0 : err = fd_bincode_uint64_encode( self->description_len, ctx );
5344 0 : if( FD_UNLIKELY(err) ) return err;
5345 0 : if( self->description_len ) {
5346 0 : err = fd_bincode_bytes_encode( self->description, self->description_len, ctx );
5347 0 : if( FD_UNLIKELY( err ) ) return err;
5348 0 : }
5349 0 : err = fd_bincode_uint64_encode( self->since_slot, ctx );
5350 0 : if( FD_UNLIKELY( err ) ) return err;
5351 0 : return FD_BINCODE_SUCCESS;
5352 0 : }
5353 0 : static int fd_feature_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5354 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5355 0 : int err = 0;
5356 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5357 0 : if( FD_UNLIKELY( err ) ) return err;
5358 0 : ulong description_len;
5359 0 : err = fd_bincode_uint64_decode( &description_len, ctx );
5360 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5361 0 : *total_sz += description_len;
5362 0 : if( description_len ) {
5363 0 : err = fd_bincode_bytes_decode_footprint( description_len, ctx );
5364 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5365 0 : err = !fd_utf8_verify( (char const *) ctx->data - description_len, description_len );
5366 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5367 0 : }
5368 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5369 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5370 0 : return 0;
5371 0 : }
5372 0 : int fd_feature_entry_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5373 0 : *total_sz += sizeof(fd_feature_entry_t);
5374 0 : void const * start_data = ctx->data;
5375 0 : int err = fd_feature_entry_decode_footprint_inner( ctx, total_sz );
5376 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5377 0 : ctx->data = start_data;
5378 0 : return err;
5379 0 : }
5380 0 : static void fd_feature_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5381 0 : fd_feature_entry_t * self = (fd_feature_entry_t *)struct_mem;
5382 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
5383 0 : fd_bincode_uint64_decode_unsafe( &self->description_len, ctx );
5384 0 : if( self->description_len ) {
5385 0 : self->description = *alloc_mem;
5386 0 : fd_bincode_bytes_decode_unsafe( self->description, self->description_len, ctx );
5387 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->description_len;
5388 0 : } else
5389 0 : self->description = NULL;
5390 0 : fd_bincode_uint64_decode_unsafe( &self->since_slot, ctx );
5391 0 : }
5392 0 : void * fd_feature_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5393 0 : fd_feature_entry_t * self = (fd_feature_entry_t *)mem;
5394 0 : fd_feature_entry_new( self );
5395 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_entry_t);
5396 0 : void * * alloc_mem = &alloc_region;
5397 0 : fd_feature_entry_decode_inner( mem, alloc_mem, ctx );
5398 0 : return self;
5399 0 : }
5400 0 : void fd_feature_entry_new(fd_feature_entry_t * self) {
5401 0 : fd_memset( self, 0, sizeof(fd_feature_entry_t) );
5402 0 : fd_pubkey_new( &self->pubkey );
5403 0 : }
5404 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 ) {
5405 0 : (void) varint;
5406 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_feature_entry", level++, 0 );
5407 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
5408 0 : if( self->description_len ) {
5409 0 : fun( w, NULL, "description", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
5410 0 : for( ulong i=0; i < self->description_len; i++ )
5411 0 : fun( w, self->description + i, "description", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5412 0 : fun( w, NULL, "description", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
5413 0 : }
5414 0 : fun( w, &self->since_slot, "since_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5415 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_feature_entry", level--, 0 );
5416 0 : }
5417 0 : ulong fd_feature_entry_size( fd_feature_entry_t const * self ) {
5418 0 : ulong size = 0;
5419 0 : size += fd_pubkey_size( &self->pubkey );
5420 0 : do {
5421 0 : size += sizeof(ulong);
5422 0 : size += self->description_len;
5423 0 : } while(0);
5424 0 : size += sizeof(ulong);
5425 0 : return size;
5426 0 : }
5427 :
5428 0 : FD_FN_PURE uchar fd_cluster_type_is_Testnet(fd_cluster_type_t const * self) {
5429 0 : return self->discriminant == 0;
5430 0 : }
5431 0 : FD_FN_PURE uchar fd_cluster_type_is_MainnetBeta(fd_cluster_type_t const * self) {
5432 0 : return self->discriminant == 1;
5433 0 : }
5434 0 : FD_FN_PURE uchar fd_cluster_type_is_Devnet(fd_cluster_type_t const * self) {
5435 0 : return self->discriminant == 2;
5436 0 : }
5437 0 : FD_FN_PURE uchar fd_cluster_type_is_Development(fd_cluster_type_t const * self) {
5438 0 : return self->discriminant == 3;
5439 0 : }
5440 0 : int fd_cluster_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5441 0 : int err;
5442 0 : switch (discriminant) {
5443 0 : case 0: {
5444 0 : return FD_BINCODE_SUCCESS;
5445 0 : }
5446 0 : case 1: {
5447 0 : return FD_BINCODE_SUCCESS;
5448 0 : }
5449 0 : case 2: {
5450 0 : return FD_BINCODE_SUCCESS;
5451 0 : }
5452 0 : case 3: {
5453 0 : return FD_BINCODE_SUCCESS;
5454 0 : }
5455 0 : default: return FD_BINCODE_ERR_ENCODING;
5456 0 : }
5457 0 : }
5458 0 : static int fd_cluster_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5459 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5460 0 : uint discriminant = 0;
5461 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
5462 0 : if( FD_UNLIKELY( err ) ) return err;
5463 0 : return fd_cluster_type_inner_decode_footprint( discriminant, ctx, total_sz );
5464 0 : }
5465 0 : int fd_cluster_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5466 0 : *total_sz += sizeof(fd_cluster_type_t);
5467 0 : void const * start_data = ctx->data;
5468 0 : int err = fd_cluster_type_decode_footprint_inner( ctx, total_sz );
5469 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5470 0 : ctx->data = start_data;
5471 0 : return err;
5472 0 : }
5473 0 : static void fd_cluster_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5474 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)struct_mem;
5475 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5476 0 : }
5477 0 : void * fd_cluster_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5478 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)mem;
5479 0 : fd_cluster_type_new( self );
5480 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_type_t);
5481 0 : void * * alloc_mem = &alloc_region;
5482 0 : fd_cluster_type_decode_inner( mem, alloc_mem, ctx );
5483 0 : return self;
5484 0 : }
5485 :
5486 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 ) {
5487 0 : (void) varint;
5488 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_cluster_type", level++, 0);
5489 0 : switch( self->discriminant ) {
5490 0 : case 0: {
5491 0 : fun( w, self, "Testnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5492 0 : break;
5493 0 : }
5494 0 : case 1: {
5495 0 : fun( w, self, "MainnetBeta", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5496 0 : break;
5497 0 : }
5498 0 : case 2: {
5499 0 : fun( w, self, "Devnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5500 0 : break;
5501 0 : }
5502 0 : case 3: {
5503 0 : fun( w, self, "Development", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5504 0 : break;
5505 0 : }
5506 0 : }
5507 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_cluster_type", level--, 0 );
5508 0 : }
5509 0 : ulong fd_cluster_type_size( fd_cluster_type_t const * self ) {
5510 0 : ulong size = 0;
5511 0 : size += sizeof(uint);
5512 0 : switch (self->discriminant) {
5513 0 : }
5514 0 : return size;
5515 0 : }
5516 :
5517 0 : int fd_cluster_type_encode( fd_cluster_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5518 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
5519 0 : if( FD_UNLIKELY( err ) ) return err;
5520 0 : return err;
5521 0 : }
5522 :
5523 0 : int fd_cluster_version_encode( fd_cluster_version_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5524 0 : int err;
5525 0 : err = fd_bincode_uint32_encode( self->major, ctx );
5526 0 : if( FD_UNLIKELY( err ) ) return err;
5527 0 : err = fd_bincode_uint32_encode( self->minor, ctx );
5528 0 : if( FD_UNLIKELY( err ) ) return err;
5529 0 : err = fd_bincode_uint32_encode( self->patch, ctx );
5530 0 : if( FD_UNLIKELY( err ) ) return err;
5531 0 : return FD_BINCODE_SUCCESS;
5532 0 : }
5533 0 : static inline int fd_cluster_version_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5534 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5535 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
5536 0 : return 0;
5537 0 : }
5538 0 : static void fd_cluster_version_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5539 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)struct_mem;
5540 0 : fd_bincode_uint32_decode_unsafe( &self->major, ctx );
5541 0 : fd_bincode_uint32_decode_unsafe( &self->minor, ctx );
5542 0 : fd_bincode_uint32_decode_unsafe( &self->patch, ctx );
5543 0 : }
5544 0 : void * fd_cluster_version_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5545 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)mem;
5546 0 : fd_cluster_version_new( self );
5547 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_version_t);
5548 0 : void * * alloc_mem = &alloc_region;
5549 0 : fd_cluster_version_decode_inner( mem, alloc_mem, ctx );
5550 0 : return self;
5551 0 : }
5552 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 ) {
5553 0 : (void) varint;
5554 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cluster_version", level++, 0 );
5555 0 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
5556 0 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
5557 0 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
5558 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cluster_version", level--, 0 );
5559 0 : }
5560 0 : int fd_stake_reward_encode( fd_stake_reward_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5561 0 : int err;
5562 0 : err = fd_pubkey_encode( &self->stake_pubkey, ctx );
5563 0 : if( FD_UNLIKELY( err ) ) return err;
5564 0 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
5565 0 : if( FD_UNLIKELY( err ) ) return err;
5566 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5567 0 : if( FD_UNLIKELY( err ) ) return err;
5568 0 : err = fd_bincode_uint8_encode( (uchar)(self->valid), ctx );
5569 0 : if( FD_UNLIKELY( err ) ) return err;
5570 0 : return FD_BINCODE_SUCCESS;
5571 0 : }
5572 0 : static inline int fd_stake_reward_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5573 0 : if( (ulong)ctx->data + 49UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5574 0 : ctx->data = (void *)( (ulong)ctx->data + 49UL );
5575 0 : return 0;
5576 0 : }
5577 0 : static void fd_stake_reward_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5578 0 : fd_stake_reward_t * self = (fd_stake_reward_t *)struct_mem;
5579 0 : fd_pubkey_decode_inner( &self->stake_pubkey, alloc_mem, ctx );
5580 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
5581 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5582 0 : fd_bincode_uint8_decode_unsafe( &self->valid, ctx );
5583 0 : }
5584 0 : void * fd_stake_reward_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5585 0 : fd_stake_reward_t * self = (fd_stake_reward_t *)mem;
5586 0 : fd_stake_reward_new( self );
5587 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_t);
5588 0 : void * * alloc_mem = &alloc_region;
5589 0 : fd_stake_reward_decode_inner( mem, alloc_mem, ctx );
5590 0 : return self;
5591 0 : }
5592 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 ) {
5593 0 : (void) varint;
5594 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward", level++, 0 );
5595 0 : fd_pubkey_walk( w, &self->stake_pubkey, fun, "stake_pubkey", level, 0 );
5596 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5597 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5598 0 : fun( w, &self->valid, "valid", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5599 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward", level--, 0 );
5600 0 : }
5601 0 : int fd_vote_reward_encode( fd_vote_reward_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5602 0 : int err;
5603 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
5604 0 : if( FD_UNLIKELY( err ) ) return err;
5605 0 : err = fd_bincode_uint64_encode( self->vote_rewards, ctx );
5606 0 : if( FD_UNLIKELY( err ) ) return err;
5607 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
5608 0 : if( FD_UNLIKELY( err ) ) return err;
5609 0 : err = fd_bincode_uint8_encode( (uchar)(self->needs_store), ctx );
5610 0 : if( FD_UNLIKELY( err ) ) return err;
5611 0 : return FD_BINCODE_SUCCESS;
5612 0 : }
5613 0 : static inline int fd_vote_reward_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5614 0 : if( (ulong)ctx->data + 42UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5615 0 : ctx->data = (void *)( (ulong)ctx->data + 42UL );
5616 0 : return 0;
5617 0 : }
5618 0 : static void fd_vote_reward_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5619 0 : fd_vote_reward_t * self = (fd_vote_reward_t *)struct_mem;
5620 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
5621 0 : fd_bincode_uint64_decode_unsafe( &self->vote_rewards, ctx );
5622 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
5623 0 : fd_bincode_uint8_decode_unsafe( &self->needs_store, ctx );
5624 0 : }
5625 0 : void * fd_vote_reward_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5626 0 : fd_vote_reward_t * self = (fd_vote_reward_t *)mem;
5627 0 : fd_vote_reward_new( self );
5628 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_reward_t);
5629 0 : void * * alloc_mem = &alloc_region;
5630 0 : fd_vote_reward_decode_inner( mem, alloc_mem, ctx );
5631 0 : return self;
5632 0 : }
5633 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 ) {
5634 0 : (void) varint;
5635 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_reward", level++, 0 );
5636 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
5637 0 : fun( w, &self->vote_rewards, "vote_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5638 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5639 0 : fun( w, &self->needs_store, "needs_store", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5640 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_reward", level--, 0 );
5641 0 : }
5642 0 : int fd_point_value_encode( fd_point_value_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5643 0 : int err;
5644 0 : err = fd_bincode_uint64_encode( self->rewards, ctx );
5645 0 : if( FD_UNLIKELY( err ) ) return err;
5646 0 : err = fd_bincode_uint128_encode( self->points, ctx );
5647 0 : if( FD_UNLIKELY( err ) ) return err;
5648 0 : return FD_BINCODE_SUCCESS;
5649 0 : }
5650 0 : static inline int fd_point_value_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5651 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5652 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
5653 0 : return 0;
5654 0 : }
5655 0 : static void fd_point_value_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5656 0 : fd_point_value_t * self = (fd_point_value_t *)struct_mem;
5657 0 : fd_bincode_uint64_decode_unsafe( &self->rewards, ctx );
5658 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
5659 0 : }
5660 0 : void * fd_point_value_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5661 0 : fd_point_value_t * self = (fd_point_value_t *)mem;
5662 0 : fd_point_value_new( self );
5663 0 : void * alloc_region = (uchar *)mem + sizeof(fd_point_value_t);
5664 0 : void * * alloc_mem = &alloc_region;
5665 0 : fd_point_value_decode_inner( mem, alloc_mem, ctx );
5666 0 : return self;
5667 0 : }
5668 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 ) {
5669 0 : (void) varint;
5670 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_point_value", level++, 0 );
5671 0 : fun( w, &self->rewards, "rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5672 0 : fun( w, &self->points, "points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
5673 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_point_value", level--, 0 );
5674 0 : }
5675 0 : int fd_partitioned_stake_rewards_encode( fd_partitioned_stake_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5676 0 : int err;
5677 0 : if( self->partitions ) {
5678 0 : err = fd_bincode_uint64_encode( self->partitions_len, ctx );
5679 0 : if( FD_UNLIKELY( err ) ) return err;
5680 0 : for( ulong i=0; i < 4096; i++ ) {
5681 0 : err = fd_bincode_uint64_encode( self->partitions_lengths[ i ], ctx );
5682 0 : if( FD_UNLIKELY( err ) ) return err;
5683 0 : }
5684 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5685 0 : for( fd_partitioned_stake_rewards_dlist_iter_t iter = fd_partitioned_stake_rewards_dlist_iter_fwd_init( &self->partitions[ i ], self->pool );
5686 0 : !fd_partitioned_stake_rewards_dlist_iter_done( iter, &self->partitions[ i ], self->pool );
5687 0 : iter = fd_partitioned_stake_rewards_dlist_iter_fwd_next( iter, &self->partitions[ i ], self->pool ) ) {
5688 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_dlist_iter_ele( iter, &self->partitions[ i ], self->pool );
5689 0 : err = fd_stake_reward_encode( ele, ctx );
5690 0 : if( FD_UNLIKELY( err ) ) return err;
5691 0 : }
5692 0 : }
5693 0 : } else {
5694 0 : err = fd_bincode_uint64_encode( self->partitions_len, ctx );
5695 0 : if( FD_UNLIKELY( err ) ) return err;
5696 0 : }
5697 0 : return FD_BINCODE_SUCCESS;
5698 0 : }
5699 0 : int fd_partitioned_stake_rewards_encode_global( fd_partitioned_stake_rewards_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5700 0 : int err;
5701 0 : return FD_BINCODE_SUCCESS;
5702 0 : }
5703 0 : static int fd_partitioned_stake_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5704 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5705 0 : int err = 0;
5706 0 : ulong partitions_len;
5707 0 : err = fd_bincode_uint64_decode( &partitions_len, ctx );
5708 0 : if( FD_UNLIKELY( err ) ) return err;
5709 0 : ulong total_count = 0UL;
5710 0 : ulong partitions_lengths[4096];
5711 0 : for( ulong i=0; i<4096; i++ ) {
5712 0 : err = fd_bincode_uint64_decode( partitions_lengths + i, ctx );
5713 0 : total_count+=partitions_lengths[ i ];
5714 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5715 0 : }
5716 0 : *total_sz += fd_partitioned_stake_rewards_pool_align() + fd_partitioned_stake_rewards_pool_footprint( total_count );
5717 0 : *total_sz += fd_partitioned_stake_rewards_dlist_align() + fd_partitioned_stake_rewards_dlist_footprint()*partitions_len;
5718 0 : for( ulong i=0; i < partitions_len; i++ ) {
5719 0 : err = fd_stake_reward_decode_footprint_inner( ctx, total_sz );
5720 0 : if( FD_UNLIKELY ( err ) ) return err;
5721 0 : }
5722 0 : return 0;
5723 0 : }
5724 0 : int fd_partitioned_stake_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5725 0 : *total_sz += sizeof(fd_partitioned_stake_rewards_t);
5726 0 : void const * start_data = ctx->data;
5727 0 : int err = fd_partitioned_stake_rewards_decode_footprint_inner( ctx, total_sz );
5728 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5729 0 : ctx->data = start_data;
5730 0 : return err;
5731 0 : }
5732 0 : static void fd_partitioned_stake_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5733 0 : fd_partitioned_stake_rewards_t * self = (fd_partitioned_stake_rewards_t *)struct_mem;
5734 0 : fd_bincode_uint64_decode_unsafe( &self->partitions_len, ctx );
5735 0 : ulong total_count = 0UL;
5736 0 : for( ulong i=0; i < 4096; i++ ) {
5737 0 : fd_bincode_uint64_decode_unsafe( self->partitions_lengths + i, ctx );
5738 0 : total_count += self->partitions_lengths[ i ];
5739 0 : }
5740 0 : self->pool = fd_partitioned_stake_rewards_pool_join_new( alloc_mem, total_count );
5741 0 : self->partitions = fd_partitioned_stake_rewards_dlist_join_new( alloc_mem, self->partitions_len );
5742 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5743 0 : fd_partitioned_stake_rewards_dlist_new( &self->partitions[ i ] );
5744 0 : for( ulong j=0; j < self->partitions_lengths[ i ]; j++ ) {
5745 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_pool_ele_acquire( self->pool );
5746 0 : fd_stake_reward_new( ele );
5747 0 : fd_stake_reward_decode_inner( ele, alloc_mem, ctx );
5748 0 : fd_partitioned_stake_rewards_dlist_ele_push_tail( &self->partitions[ i ], ele, self->pool );
5749 0 : }
5750 0 : }
5751 0 : }
5752 0 : void * fd_partitioned_stake_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5753 0 : fd_partitioned_stake_rewards_t * self = (fd_partitioned_stake_rewards_t *)mem;
5754 0 : fd_partitioned_stake_rewards_new( self );
5755 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_stake_rewards_t);
5756 0 : void * * alloc_mem = &alloc_region;
5757 0 : fd_partitioned_stake_rewards_decode_inner( mem, alloc_mem, ctx );
5758 0 : return self;
5759 0 : }
5760 0 : static void fd_partitioned_stake_rewards_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5761 0 : fd_partitioned_stake_rewards_global_t * self = (fd_partitioned_stake_rewards_global_t *)struct_mem;
5762 0 : fd_bincode_uint64_decode_unsafe( &self->partitions_len, ctx );
5763 0 : ulong total_count = 0UL;
5764 0 : for( ulong i=0; i < 4096; i++ ) {
5765 0 : fd_bincode_uint64_decode_unsafe( self->partitions_lengths + i, ctx );
5766 0 : total_count += self->partitions_lengths[ i ];
5767 0 : }
5768 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_partitioned_stake_rewards_pool_align() );
5769 0 : fd_stake_reward_t * pool = fd_partitioned_stake_rewards_pool_join_new( alloc_mem, total_count );
5770 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, fd_partitioned_stake_rewards_dlist_align() );
5771 0 : fd_partitioned_stake_rewards_dlist_t * partitions = fd_partitioned_stake_rewards_dlist_join_new( alloc_mem, self->partitions_len );
5772 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5773 0 : fd_partitioned_stake_rewards_dlist_new( &partitions[ i ] );
5774 0 : for( ulong j=0; j < self->partitions_lengths[ i ]; j++ ) {
5775 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_pool_ele_acquire( pool );
5776 0 : fd_stake_reward_new( ele );
5777 0 : fd_stake_reward_decode_inner( ele, alloc_mem, ctx );
5778 0 : fd_partitioned_stake_rewards_dlist_ele_push_tail( &partitions[ i ], ele, pool );
5779 0 : }
5780 0 : }
5781 0 : self->pool_offset = (ulong)fd_partitioned_stake_rewards_pool_leave( pool ) - (ulong)struct_mem;
5782 0 : self->partitions_offset = (ulong)fd_partitioned_stake_rewards_dlist_leave( partitions ) - (ulong)struct_mem;
5783 0 : }
5784 0 : void * fd_partitioned_stake_rewards_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5785 0 : fd_partitioned_stake_rewards_global_t * self = (fd_partitioned_stake_rewards_global_t *)mem;
5786 0 : fd_partitioned_stake_rewards_new( (fd_partitioned_stake_rewards_t *)self );
5787 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_stake_rewards_global_t);
5788 0 : void * * alloc_mem = &alloc_region;
5789 0 : fd_partitioned_stake_rewards_decode_inner_global( mem, alloc_mem, ctx );
5790 0 : return self;
5791 0 : }
5792 0 : void fd_partitioned_stake_rewards_new(fd_partitioned_stake_rewards_t * self) {
5793 0 : fd_memset( self, 0, sizeof(fd_partitioned_stake_rewards_t) );
5794 0 : }
5795 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 ) {
5796 0 : (void) varint;
5797 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_partitioned_stake_rewards", level++, 0 );
5798 0 : if( self->partitions ) {
5799 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5800 0 : for( fd_partitioned_stake_rewards_dlist_iter_t iter = fd_partitioned_stake_rewards_dlist_iter_fwd_init( &self->partitions[ i ], self->pool );
5801 0 : !fd_partitioned_stake_rewards_dlist_iter_done( iter, &self->partitions[ i ], self->pool );
5802 0 : iter = fd_partitioned_stake_rewards_dlist_iter_fwd_next( iter, &self->partitions[ i ], self->pool ) ) {
5803 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_dlist_iter_ele( iter, &self->partitions[ i ], self->pool );
5804 0 : fd_stake_reward_walk( w, ele, fun, "fd_stake_reward_t", level, 0 );
5805 0 : }
5806 0 : }
5807 0 : }
5808 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_partitioned_stake_rewards", level--, 0 );
5809 0 : }
5810 0 : ulong fd_partitioned_stake_rewards_size( fd_partitioned_stake_rewards_t const * self ) {
5811 0 : ulong size = 0;
5812 0 : size += sizeof(ulong);
5813 0 : size += 4096 * sizeof(ulong);
5814 0 : if( self->partitions ) {
5815 0 : for( ulong i=0; i < self->partitions_len; i++ ) {
5816 0 : for( fd_partitioned_stake_rewards_dlist_iter_t iter = fd_partitioned_stake_rewards_dlist_iter_fwd_init( &self->partitions[ i ], self->pool );
5817 0 : !fd_partitioned_stake_rewards_dlist_iter_done( iter, &self->partitions[ i ], self->pool );
5818 0 : iter = fd_partitioned_stake_rewards_dlist_iter_fwd_next( iter, &self->partitions[ i ], self->pool ) ) {
5819 0 : fd_stake_reward_t * ele = fd_partitioned_stake_rewards_dlist_iter_ele( iter, &self->partitions[ i ], self->pool );
5820 0 : size += fd_stake_reward_size( ele );
5821 0 : }
5822 0 : }
5823 0 : }
5824 0 : return size;
5825 0 : }
5826 :
5827 0 : ulong fd_partitioned_stake_rewards_size_global( fd_partitioned_stake_rewards_global_t const * self ) {
5828 0 : ulong size = 0;
5829 0 : FD_LOG_CRIT(( "FIXME: not implemented" ));
5830 0 : return size;
5831 0 : }
5832 :
5833 0 : int fd_stake_reward_calculation_partitioned_encode( fd_stake_reward_calculation_partitioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5834 0 : int err;
5835 0 : err = fd_partitioned_stake_rewards_encode( &self->partitioned_stake_rewards, ctx );
5836 0 : if( FD_UNLIKELY( err ) ) return err;
5837 0 : err = fd_bincode_uint64_encode( self->total_stake_rewards_lamports, ctx );
5838 0 : if( FD_UNLIKELY( err ) ) return err;
5839 0 : return FD_BINCODE_SUCCESS;
5840 0 : }
5841 0 : static int fd_stake_reward_calculation_partitioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5842 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5843 0 : int err = 0;
5844 0 : err = fd_partitioned_stake_rewards_decode_footprint_inner( ctx, total_sz );
5845 0 : if( FD_UNLIKELY( err ) ) return err;
5846 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5847 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5848 0 : return 0;
5849 0 : }
5850 0 : int fd_stake_reward_calculation_partitioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5851 0 : *total_sz += sizeof(fd_stake_reward_calculation_partitioned_t);
5852 0 : void const * start_data = ctx->data;
5853 0 : int err = fd_stake_reward_calculation_partitioned_decode_footprint_inner( ctx, total_sz );
5854 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5855 0 : ctx->data = start_data;
5856 0 : return err;
5857 0 : }
5858 0 : static void fd_stake_reward_calculation_partitioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5859 0 : fd_stake_reward_calculation_partitioned_t * self = (fd_stake_reward_calculation_partitioned_t *)struct_mem;
5860 0 : fd_partitioned_stake_rewards_decode_inner( &self->partitioned_stake_rewards, alloc_mem, ctx );
5861 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake_rewards_lamports, ctx );
5862 0 : }
5863 0 : void * fd_stake_reward_calculation_partitioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5864 0 : fd_stake_reward_calculation_partitioned_t * self = (fd_stake_reward_calculation_partitioned_t *)mem;
5865 0 : fd_stake_reward_calculation_partitioned_new( self );
5866 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_calculation_partitioned_t);
5867 0 : void * * alloc_mem = &alloc_region;
5868 0 : fd_stake_reward_calculation_partitioned_decode_inner( mem, alloc_mem, ctx );
5869 0 : return self;
5870 0 : }
5871 0 : void fd_stake_reward_calculation_partitioned_new(fd_stake_reward_calculation_partitioned_t * self) {
5872 0 : fd_memset( self, 0, sizeof(fd_stake_reward_calculation_partitioned_t) );
5873 0 : fd_partitioned_stake_rewards_new( &self->partitioned_stake_rewards );
5874 0 : }
5875 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 ) {
5876 0 : (void) varint;
5877 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward_calculation_partitioned", level++, 0 );
5878 0 : fd_partitioned_stake_rewards_walk( w, &self->partitioned_stake_rewards, fun, "partitioned_stake_rewards", level, 0 );
5879 0 : fun( w, &self->total_stake_rewards_lamports, "total_stake_rewards_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5880 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward_calculation_partitioned", level--, 0 );
5881 0 : }
5882 0 : ulong fd_stake_reward_calculation_partitioned_size( fd_stake_reward_calculation_partitioned_t const * self ) {
5883 0 : ulong size = 0;
5884 0 : size += fd_partitioned_stake_rewards_size( &self->partitioned_stake_rewards );
5885 0 : size += sizeof(ulong);
5886 0 : return size;
5887 0 : }
5888 :
5889 0 : int fd_stake_reward_calculation_encode( fd_stake_reward_calculation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5890 0 : int err;
5891 0 : if( self->stake_rewards ) {
5892 0 : err = fd_bincode_uint64_encode( self->stake_rewards_len, ctx );
5893 0 : if( FD_UNLIKELY( err ) ) return err;
5894 0 : for( fd_stake_reward_calculation_dlist_iter_t iter = fd_stake_reward_calculation_dlist_iter_fwd_init( self->stake_rewards, self->pool );
5895 0 : !fd_stake_reward_calculation_dlist_iter_done( iter, self->stake_rewards, self->pool );
5896 0 : iter = fd_stake_reward_calculation_dlist_iter_fwd_next( iter, self->stake_rewards, self->pool ) ) {
5897 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_dlist_iter_ele( iter, self->stake_rewards, self->pool );
5898 0 : err = fd_stake_reward_encode( ele, ctx );
5899 0 : if( FD_UNLIKELY( err ) ) return err;
5900 0 : }
5901 0 : } else {
5902 0 : err = fd_bincode_uint64_encode( self->stake_rewards_len, ctx );
5903 0 : if( FD_UNLIKELY( err ) ) return err;
5904 0 : }
5905 0 : err = fd_bincode_uint64_encode( self->total_stake_rewards_lamports, ctx );
5906 0 : if( FD_UNLIKELY( err ) ) return err;
5907 0 : return FD_BINCODE_SUCCESS;
5908 0 : }
5909 0 : static int fd_stake_reward_calculation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5910 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5911 0 : int err = 0;
5912 0 : ulong stake_rewards_len;
5913 0 : err = fd_bincode_uint64_decode( &stake_rewards_len, ctx );
5914 0 : if( FD_UNLIKELY( err ) ) return err;
5915 0 : *total_sz += fd_stake_reward_calculation_pool_align() + fd_stake_reward_calculation_pool_footprint( stake_rewards_len );
5916 0 : *total_sz += fd_stake_reward_calculation_dlist_align() + fd_stake_reward_calculation_dlist_footprint()*stake_rewards_len;
5917 0 : for( ulong i=0; i < stake_rewards_len; i++ ) {
5918 0 : err = fd_stake_reward_decode_footprint_inner( ctx, total_sz );
5919 0 : if( FD_UNLIKELY ( err ) ) return err;
5920 0 : }
5921 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5922 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5923 0 : return 0;
5924 0 : }
5925 0 : int fd_stake_reward_calculation_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5926 0 : *total_sz += sizeof(fd_stake_reward_calculation_t);
5927 0 : void const * start_data = ctx->data;
5928 0 : int err = fd_stake_reward_calculation_decode_footprint_inner( ctx, total_sz );
5929 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5930 0 : ctx->data = start_data;
5931 0 : return err;
5932 0 : }
5933 0 : static void fd_stake_reward_calculation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5934 0 : fd_stake_reward_calculation_t * self = (fd_stake_reward_calculation_t *)struct_mem;
5935 0 : fd_bincode_uint64_decode_unsafe( &self->stake_rewards_len, ctx );
5936 0 : self->pool = fd_stake_reward_calculation_pool_join_new( alloc_mem, self->stake_rewards_len );
5937 0 : self->stake_rewards = fd_stake_reward_calculation_dlist_join_new( alloc_mem, self->stake_rewards_len );
5938 0 : fd_stake_reward_calculation_dlist_new( self->stake_rewards );
5939 0 : for( ulong i=0; i < self->stake_rewards_len; i++ ) {
5940 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_pool_ele_acquire( self->pool );
5941 0 : fd_stake_reward_new( ele );
5942 0 : fd_stake_reward_decode_inner( ele, alloc_mem, ctx );
5943 0 : fd_stake_reward_calculation_dlist_ele_push_tail( self->stake_rewards, ele, self->pool );
5944 0 : }
5945 0 : fd_bincode_uint64_decode_unsafe( &self->total_stake_rewards_lamports, ctx );
5946 0 : }
5947 0 : void * fd_stake_reward_calculation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5948 0 : fd_stake_reward_calculation_t * self = (fd_stake_reward_calculation_t *)mem;
5949 0 : fd_stake_reward_calculation_new( self );
5950 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_calculation_t);
5951 0 : void * * alloc_mem = &alloc_region;
5952 0 : fd_stake_reward_calculation_decode_inner( mem, alloc_mem, ctx );
5953 0 : return self;
5954 0 : }
5955 0 : void fd_stake_reward_calculation_new(fd_stake_reward_calculation_t * self) {
5956 0 : fd_memset( self, 0, sizeof(fd_stake_reward_calculation_t) );
5957 0 : }
5958 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 ) {
5959 0 : (void) varint;
5960 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward_calculation", level++, 0 );
5961 0 : if( self->stake_rewards ) {
5962 0 : for( fd_stake_reward_calculation_dlist_iter_t iter = fd_stake_reward_calculation_dlist_iter_fwd_init( self->stake_rewards, self->pool );
5963 0 : !fd_stake_reward_calculation_dlist_iter_done( iter, self->stake_rewards, self->pool );
5964 0 : iter = fd_stake_reward_calculation_dlist_iter_fwd_next( iter, self->stake_rewards, self->pool ) ) {
5965 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_dlist_iter_ele( iter, self->stake_rewards, self->pool );
5966 0 : fd_stake_reward_walk( w, ele, fun, "fd_stake_reward_t", level, 0 );
5967 0 : }
5968 0 : }
5969 0 : fun( w, &self->total_stake_rewards_lamports, "total_stake_rewards_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5970 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward_calculation", level--, 0 );
5971 0 : }
5972 0 : ulong fd_stake_reward_calculation_size( fd_stake_reward_calculation_t const * self ) {
5973 0 : ulong size = 0;
5974 0 : size += sizeof(ulong);
5975 0 : if( self->stake_rewards ) {
5976 0 : for( fd_stake_reward_calculation_dlist_iter_t iter = fd_stake_reward_calculation_dlist_iter_fwd_init( self->stake_rewards, self->pool );
5977 0 : !fd_stake_reward_calculation_dlist_iter_done( iter, self->stake_rewards, self->pool );
5978 0 : iter = fd_stake_reward_calculation_dlist_iter_fwd_next( iter, self->stake_rewards, self->pool ) ) {
5979 0 : fd_stake_reward_t * ele = fd_stake_reward_calculation_dlist_iter_ele( iter, self->stake_rewards, self->pool );
5980 0 : size += fd_stake_reward_size( ele );
5981 0 : }
5982 0 : }
5983 0 : size += sizeof(ulong);
5984 0 : return size;
5985 0 : }
5986 :
5987 0 : int fd_calculate_stake_vote_rewards_result_encode( fd_calculate_stake_vote_rewards_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5988 0 : int err;
5989 0 : err = fd_stake_reward_calculation_encode( &self->stake_reward_calculation, ctx );
5990 0 : if( FD_UNLIKELY( err ) ) return err;
5991 0 : if( self->vote_reward_map_root ) {
5992 0 : ulong vote_reward_map_len = fd_vote_reward_t_map_size( self->vote_reward_map_pool, self->vote_reward_map_root );
5993 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
5994 0 : if( FD_UNLIKELY( err ) ) return err;
5995 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 ) ) {
5996 0 : err = fd_vote_reward_encode( &n->elem, ctx );
5997 0 : if( FD_UNLIKELY( err ) ) return err;
5998 0 : }
5999 0 : } else {
6000 0 : ulong vote_reward_map_len = 0;
6001 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
6002 0 : if( FD_UNLIKELY( err ) ) return err;
6003 0 : }
6004 0 : return FD_BINCODE_SUCCESS;
6005 0 : }
6006 0 : static int fd_calculate_stake_vote_rewards_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6007 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6008 0 : int err = 0;
6009 0 : err = fd_stake_reward_calculation_decode_footprint_inner( ctx, total_sz );
6010 0 : if( FD_UNLIKELY( err ) ) return err;
6011 0 : ulong vote_reward_map_len = 0UL;
6012 0 : err = fd_bincode_uint64_decode( &vote_reward_map_len, ctx );
6013 0 : ulong vote_reward_map_cnt = fd_ulong_max( vote_reward_map_len, 15000 );
6014 0 : *total_sz += fd_vote_reward_t_map_align() + fd_vote_reward_t_map_footprint( vote_reward_map_cnt );
6015 0 : if( FD_UNLIKELY( err ) ) return err;
6016 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
6017 0 : err = fd_vote_reward_decode_footprint_inner( ctx, total_sz );
6018 0 : if( FD_UNLIKELY( err ) ) return err;
6019 0 : }
6020 0 : return 0;
6021 0 : }
6022 0 : int fd_calculate_stake_vote_rewards_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6023 0 : *total_sz += sizeof(fd_calculate_stake_vote_rewards_result_t);
6024 0 : void const * start_data = ctx->data;
6025 0 : int err = fd_calculate_stake_vote_rewards_result_decode_footprint_inner( ctx, total_sz );
6026 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6027 0 : ctx->data = start_data;
6028 0 : return err;
6029 0 : }
6030 0 : static void fd_calculate_stake_vote_rewards_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6031 0 : fd_calculate_stake_vote_rewards_result_t * self = (fd_calculate_stake_vote_rewards_result_t *)struct_mem;
6032 0 : fd_stake_reward_calculation_decode_inner( &self->stake_reward_calculation, alloc_mem, ctx );
6033 0 : ulong vote_reward_map_len;
6034 0 : fd_bincode_uint64_decode_unsafe( &vote_reward_map_len, ctx );
6035 0 : self->vote_reward_map_pool = fd_vote_reward_t_map_join_new( alloc_mem, fd_ulong_max( vote_reward_map_len, 15000 ) );
6036 0 : self->vote_reward_map_root = NULL;
6037 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
6038 0 : fd_vote_reward_t_mapnode_t * node = fd_vote_reward_t_map_acquire( self->vote_reward_map_pool );
6039 0 : fd_vote_reward_new( &node->elem );
6040 0 : fd_vote_reward_decode_inner( &node->elem, alloc_mem, ctx );
6041 0 : fd_vote_reward_t_mapnode_t * out = NULL;;
6042 0 : fd_vote_reward_t_map_insert_or_replace( self->vote_reward_map_pool, &self->vote_reward_map_root, node, &out );
6043 0 : if( out != NULL ) {
6044 0 : fd_vote_reward_t_map_release( self->vote_reward_map_pool, out );
6045 0 : }
6046 0 : }
6047 0 : }
6048 0 : void * fd_calculate_stake_vote_rewards_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6049 0 : fd_calculate_stake_vote_rewards_result_t * self = (fd_calculate_stake_vote_rewards_result_t *)mem;
6050 0 : fd_calculate_stake_vote_rewards_result_new( self );
6051 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculate_stake_vote_rewards_result_t);
6052 0 : void * * alloc_mem = &alloc_region;
6053 0 : fd_calculate_stake_vote_rewards_result_decode_inner( mem, alloc_mem, ctx );
6054 0 : return self;
6055 0 : }
6056 0 : void fd_calculate_stake_vote_rewards_result_new(fd_calculate_stake_vote_rewards_result_t * self) {
6057 0 : fd_memset( self, 0, sizeof(fd_calculate_stake_vote_rewards_result_t) );
6058 0 : fd_stake_reward_calculation_new( &self->stake_reward_calculation );
6059 0 : }
6060 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 ) {
6061 0 : (void) varint;
6062 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculate_stake_vote_rewards_result", level++, 0 );
6063 0 : fd_stake_reward_calculation_walk( w, &self->stake_reward_calculation, fun, "stake_reward_calculation", level, 0 );
6064 0 : if( self->vote_reward_map_root ) {
6065 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 ) ) {
6066 0 : fd_vote_reward_walk(w, &n->elem, fun, "vote_reward_map", level, 0 );
6067 0 : }
6068 0 : }
6069 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculate_stake_vote_rewards_result", level--, 0 );
6070 0 : }
6071 0 : ulong fd_calculate_stake_vote_rewards_result_size( fd_calculate_stake_vote_rewards_result_t const * self ) {
6072 0 : ulong size = 0;
6073 0 : size += fd_stake_reward_calculation_size( &self->stake_reward_calculation );
6074 0 : if( self->vote_reward_map_root ) {
6075 0 : size += sizeof(ulong);
6076 0 : ulong max = fd_vote_reward_t_map_max( self->vote_reward_map_pool );
6077 0 : size += fd_vote_reward_t_map_footprint( max );
6078 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 ) ) {
6079 0 : size += fd_vote_reward_size( &n->elem ) - sizeof(fd_vote_reward_t);
6080 0 : }
6081 0 : } else {
6082 0 : size += sizeof(ulong);
6083 0 : }
6084 0 : return size;
6085 0 : }
6086 :
6087 0 : int fd_calculate_validator_rewards_result_encode( fd_calculate_validator_rewards_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6088 0 : int err;
6089 0 : err = fd_calculate_stake_vote_rewards_result_encode( &self->calculate_stake_vote_rewards_result, ctx );
6090 0 : if( FD_UNLIKELY( err ) ) return err;
6091 0 : err = fd_point_value_encode( &self->point_value, ctx );
6092 0 : if( FD_UNLIKELY( err ) ) return err;
6093 0 : return FD_BINCODE_SUCCESS;
6094 0 : }
6095 0 : static int fd_calculate_validator_rewards_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6096 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6097 0 : int err = 0;
6098 0 : err = fd_calculate_stake_vote_rewards_result_decode_footprint_inner( ctx, total_sz );
6099 0 : if( FD_UNLIKELY( err ) ) return err;
6100 0 : err = fd_point_value_decode_footprint_inner( ctx, total_sz );
6101 0 : if( FD_UNLIKELY( err ) ) return err;
6102 0 : return 0;
6103 0 : }
6104 0 : int fd_calculate_validator_rewards_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6105 0 : *total_sz += sizeof(fd_calculate_validator_rewards_result_t);
6106 0 : void const * start_data = ctx->data;
6107 0 : int err = fd_calculate_validator_rewards_result_decode_footprint_inner( ctx, total_sz );
6108 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6109 0 : ctx->data = start_data;
6110 0 : return err;
6111 0 : }
6112 0 : static void fd_calculate_validator_rewards_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6113 0 : fd_calculate_validator_rewards_result_t * self = (fd_calculate_validator_rewards_result_t *)struct_mem;
6114 0 : fd_calculate_stake_vote_rewards_result_decode_inner( &self->calculate_stake_vote_rewards_result, alloc_mem, ctx );
6115 0 : fd_point_value_decode_inner( &self->point_value, alloc_mem, ctx );
6116 0 : }
6117 0 : void * fd_calculate_validator_rewards_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6118 0 : fd_calculate_validator_rewards_result_t * self = (fd_calculate_validator_rewards_result_t *)mem;
6119 0 : fd_calculate_validator_rewards_result_new( self );
6120 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculate_validator_rewards_result_t);
6121 0 : void * * alloc_mem = &alloc_region;
6122 0 : fd_calculate_validator_rewards_result_decode_inner( mem, alloc_mem, ctx );
6123 0 : return self;
6124 0 : }
6125 0 : void fd_calculate_validator_rewards_result_new(fd_calculate_validator_rewards_result_t * self) {
6126 0 : fd_memset( self, 0, sizeof(fd_calculate_validator_rewards_result_t) );
6127 0 : fd_calculate_stake_vote_rewards_result_new( &self->calculate_stake_vote_rewards_result );
6128 0 : fd_point_value_new( &self->point_value );
6129 0 : }
6130 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 ) {
6131 0 : (void) varint;
6132 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculate_validator_rewards_result", level++, 0 );
6133 0 : fd_calculate_stake_vote_rewards_result_walk( w, &self->calculate_stake_vote_rewards_result, fun, "calculate_stake_vote_rewards_result", level, 0 );
6134 0 : fd_point_value_walk( w, &self->point_value, fun, "point_value", level, 0 );
6135 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculate_validator_rewards_result", level--, 0 );
6136 0 : }
6137 0 : ulong fd_calculate_validator_rewards_result_size( fd_calculate_validator_rewards_result_t const * self ) {
6138 0 : ulong size = 0;
6139 0 : size += fd_calculate_stake_vote_rewards_result_size( &self->calculate_stake_vote_rewards_result );
6140 0 : size += fd_point_value_size( &self->point_value );
6141 0 : return size;
6142 0 : }
6143 :
6144 0 : int fd_partitioned_rewards_calculation_encode( fd_partitioned_rewards_calculation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6145 0 : int err;
6146 0 : if( self->vote_reward_map_root ) {
6147 0 : ulong vote_reward_map_len = fd_vote_reward_t_map_size( self->vote_reward_map_pool, self->vote_reward_map_root );
6148 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
6149 0 : if( FD_UNLIKELY( err ) ) return err;
6150 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 ) ) {
6151 0 : err = fd_vote_reward_encode( &n->elem, ctx );
6152 0 : if( FD_UNLIKELY( err ) ) return err;
6153 0 : }
6154 0 : } else {
6155 0 : ulong vote_reward_map_len = 0;
6156 0 : err = fd_bincode_uint64_encode( vote_reward_map_len, ctx );
6157 0 : if( FD_UNLIKELY( err ) ) return err;
6158 0 : }
6159 0 : err = fd_stake_reward_calculation_partitioned_encode( &self->stake_rewards_by_partition, ctx );
6160 0 : if( FD_UNLIKELY( err ) ) return err;
6161 0 : err = fd_bincode_uint64_encode( self->old_vote_balance_and_staked, ctx );
6162 0 : if( FD_UNLIKELY( err ) ) return err;
6163 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
6164 0 : if( FD_UNLIKELY( err ) ) return err;
6165 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
6166 0 : if( FD_UNLIKELY( err ) ) return err;
6167 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
6168 0 : if( FD_UNLIKELY( err ) ) return err;
6169 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
6170 0 : if( FD_UNLIKELY( err ) ) return err;
6171 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
6172 0 : if( FD_UNLIKELY( err ) ) return err;
6173 0 : err = fd_point_value_encode( &self->point_value, ctx );
6174 0 : if( FD_UNLIKELY( err ) ) return err;
6175 0 : return FD_BINCODE_SUCCESS;
6176 0 : }
6177 0 : static int fd_partitioned_rewards_calculation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6178 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6179 0 : int err = 0;
6180 0 : ulong vote_reward_map_len = 0UL;
6181 0 : err = fd_bincode_uint64_decode( &vote_reward_map_len, ctx );
6182 0 : ulong vote_reward_map_cnt = fd_ulong_max( vote_reward_map_len, 15000 );
6183 0 : *total_sz += fd_vote_reward_t_map_align() + fd_vote_reward_t_map_footprint( vote_reward_map_cnt );
6184 0 : if( FD_UNLIKELY( err ) ) return err;
6185 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
6186 0 : err = fd_vote_reward_decode_footprint_inner( ctx, total_sz );
6187 0 : if( FD_UNLIKELY( err ) ) return err;
6188 0 : }
6189 0 : err = fd_stake_reward_calculation_partitioned_decode_footprint_inner( ctx, total_sz );
6190 0 : if( FD_UNLIKELY( err ) ) return err;
6191 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6192 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6193 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6194 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6195 0 : err = fd_bincode_double_decode_footprint( ctx );
6196 0 : if( FD_UNLIKELY( err ) ) return err;
6197 0 : err = fd_bincode_double_decode_footprint( ctx );
6198 0 : if( FD_UNLIKELY( err ) ) return err;
6199 0 : err = fd_bincode_double_decode_footprint( ctx );
6200 0 : if( FD_UNLIKELY( err ) ) return err;
6201 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6202 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6203 0 : err = fd_point_value_decode_footprint_inner( ctx, total_sz );
6204 0 : if( FD_UNLIKELY( err ) ) return err;
6205 0 : return 0;
6206 0 : }
6207 0 : int fd_partitioned_rewards_calculation_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6208 0 : *total_sz += sizeof(fd_partitioned_rewards_calculation_t);
6209 0 : void const * start_data = ctx->data;
6210 0 : int err = fd_partitioned_rewards_calculation_decode_footprint_inner( ctx, total_sz );
6211 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6212 0 : ctx->data = start_data;
6213 0 : return err;
6214 0 : }
6215 0 : static void fd_partitioned_rewards_calculation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6216 0 : fd_partitioned_rewards_calculation_t * self = (fd_partitioned_rewards_calculation_t *)struct_mem;
6217 0 : ulong vote_reward_map_len;
6218 0 : fd_bincode_uint64_decode_unsafe( &vote_reward_map_len, ctx );
6219 0 : self->vote_reward_map_pool = fd_vote_reward_t_map_join_new( alloc_mem, fd_ulong_max( vote_reward_map_len, 15000 ) );
6220 0 : self->vote_reward_map_root = NULL;
6221 0 : for( ulong i=0; i < vote_reward_map_len; i++ ) {
6222 0 : fd_vote_reward_t_mapnode_t * node = fd_vote_reward_t_map_acquire( self->vote_reward_map_pool );
6223 0 : fd_vote_reward_new( &node->elem );
6224 0 : fd_vote_reward_decode_inner( &node->elem, alloc_mem, ctx );
6225 0 : fd_vote_reward_t_mapnode_t * out = NULL;;
6226 0 : fd_vote_reward_t_map_insert_or_replace( self->vote_reward_map_pool, &self->vote_reward_map_root, node, &out );
6227 0 : if( out != NULL ) {
6228 0 : fd_vote_reward_t_map_release( self->vote_reward_map_pool, out );
6229 0 : }
6230 0 : }
6231 0 : fd_stake_reward_calculation_partitioned_decode_inner( &self->stake_rewards_by_partition, alloc_mem, ctx );
6232 0 : fd_bincode_uint64_decode_unsafe( &self->old_vote_balance_and_staked, ctx );
6233 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
6234 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
6235 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
6236 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
6237 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
6238 0 : fd_point_value_decode_inner( &self->point_value, alloc_mem, ctx );
6239 0 : }
6240 0 : void * fd_partitioned_rewards_calculation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6241 0 : fd_partitioned_rewards_calculation_t * self = (fd_partitioned_rewards_calculation_t *)mem;
6242 0 : fd_partitioned_rewards_calculation_new( self );
6243 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_rewards_calculation_t);
6244 0 : void * * alloc_mem = &alloc_region;
6245 0 : fd_partitioned_rewards_calculation_decode_inner( mem, alloc_mem, ctx );
6246 0 : return self;
6247 0 : }
6248 0 : void fd_partitioned_rewards_calculation_new(fd_partitioned_rewards_calculation_t * self) {
6249 0 : fd_memset( self, 0, sizeof(fd_partitioned_rewards_calculation_t) );
6250 0 : fd_stake_reward_calculation_partitioned_new( &self->stake_rewards_by_partition );
6251 0 : fd_point_value_new( &self->point_value );
6252 0 : }
6253 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 ) {
6254 0 : (void) varint;
6255 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_partitioned_rewards_calculation", level++, 0 );
6256 0 : if( self->vote_reward_map_root ) {
6257 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 ) ) {
6258 0 : fd_vote_reward_walk(w, &n->elem, fun, "vote_reward_map", level, 0 );
6259 0 : }
6260 0 : }
6261 0 : fd_stake_reward_calculation_partitioned_walk( w, &self->stake_rewards_by_partition, fun, "stake_rewards_by_partition", level, 0 );
6262 0 : fun( w, &self->old_vote_balance_and_staked, "old_vote_balance_and_staked", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6263 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6264 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6265 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6266 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6267 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6268 0 : fd_point_value_walk( w, &self->point_value, fun, "point_value", level, 0 );
6269 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_partitioned_rewards_calculation", level--, 0 );
6270 0 : }
6271 0 : ulong fd_partitioned_rewards_calculation_size( fd_partitioned_rewards_calculation_t const * self ) {
6272 0 : ulong size = 0;
6273 0 : if( self->vote_reward_map_root ) {
6274 0 : size += sizeof(ulong);
6275 0 : ulong max = fd_vote_reward_t_map_max( self->vote_reward_map_pool );
6276 0 : size += fd_vote_reward_t_map_footprint( max );
6277 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 ) ) {
6278 0 : size += fd_vote_reward_size( &n->elem ) - sizeof(fd_vote_reward_t);
6279 0 : }
6280 0 : } else {
6281 0 : size += sizeof(ulong);
6282 0 : }
6283 0 : size += fd_stake_reward_calculation_partitioned_size( &self->stake_rewards_by_partition );
6284 0 : size += sizeof(ulong);
6285 0 : size += sizeof(ulong);
6286 0 : size += sizeof(double);
6287 0 : size += sizeof(double);
6288 0 : size += sizeof(double);
6289 0 : size += sizeof(ulong);
6290 0 : size += fd_point_value_size( &self->point_value );
6291 0 : return size;
6292 0 : }
6293 :
6294 0 : int fd_start_block_height_and_rewards_encode( fd_start_block_height_and_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6295 0 : int err;
6296 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
6297 0 : if( FD_UNLIKELY( err ) ) return err;
6298 0 : err = fd_partitioned_stake_rewards_encode( &self->partitioned_stake_rewards, ctx );
6299 0 : if( FD_UNLIKELY( err ) ) return err;
6300 0 : return FD_BINCODE_SUCCESS;
6301 0 : }
6302 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 ) {
6303 0 : int err;
6304 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
6305 0 : if( FD_UNLIKELY( err ) ) return err;
6306 0 : err = fd_partitioned_stake_rewards_encode_global( &self->partitioned_stake_rewards, ctx );
6307 0 : if( FD_UNLIKELY( err ) ) return err;
6308 0 : return FD_BINCODE_SUCCESS;
6309 0 : }
6310 0 : static int fd_start_block_height_and_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6311 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6312 0 : int err = 0;
6313 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6314 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6315 0 : err = fd_partitioned_stake_rewards_decode_footprint_inner( ctx, total_sz );
6316 0 : if( FD_UNLIKELY( err ) ) return err;
6317 0 : return 0;
6318 0 : }
6319 0 : int fd_start_block_height_and_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6320 0 : *total_sz += sizeof(fd_start_block_height_and_rewards_t);
6321 0 : void const * start_data = ctx->data;
6322 0 : int err = fd_start_block_height_and_rewards_decode_footprint_inner( ctx, total_sz );
6323 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6324 0 : ctx->data = start_data;
6325 0 : return err;
6326 0 : }
6327 0 : static void fd_start_block_height_and_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6328 0 : fd_start_block_height_and_rewards_t * self = (fd_start_block_height_and_rewards_t *)struct_mem;
6329 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
6330 0 : fd_partitioned_stake_rewards_decode_inner( &self->partitioned_stake_rewards, alloc_mem, ctx );
6331 0 : }
6332 0 : void * fd_start_block_height_and_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6333 0 : fd_start_block_height_and_rewards_t * self = (fd_start_block_height_and_rewards_t *)mem;
6334 0 : fd_start_block_height_and_rewards_new( self );
6335 0 : void * alloc_region = (uchar *)mem + sizeof(fd_start_block_height_and_rewards_t);
6336 0 : void * * alloc_mem = &alloc_region;
6337 0 : fd_start_block_height_and_rewards_decode_inner( mem, alloc_mem, ctx );
6338 0 : return self;
6339 0 : }
6340 0 : static void fd_start_block_height_and_rewards_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6341 0 : fd_start_block_height_and_rewards_global_t * self = (fd_start_block_height_and_rewards_global_t *)struct_mem;
6342 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
6343 0 : fd_partitioned_stake_rewards_decode_inner_global( &self->partitioned_stake_rewards, alloc_mem, ctx );
6344 0 : }
6345 0 : void * fd_start_block_height_and_rewards_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6346 0 : fd_start_block_height_and_rewards_global_t * self = (fd_start_block_height_and_rewards_global_t *)mem;
6347 0 : fd_start_block_height_and_rewards_new( (fd_start_block_height_and_rewards_t *)self );
6348 0 : void * alloc_region = (uchar *)mem + sizeof(fd_start_block_height_and_rewards_global_t);
6349 0 : void * * alloc_mem = &alloc_region;
6350 0 : fd_start_block_height_and_rewards_decode_inner_global( mem, alloc_mem, ctx );
6351 0 : return self;
6352 0 : }
6353 0 : void fd_start_block_height_and_rewards_new(fd_start_block_height_and_rewards_t * self) {
6354 0 : fd_memset( self, 0, sizeof(fd_start_block_height_and_rewards_t) );
6355 0 : fd_partitioned_stake_rewards_new( &self->partitioned_stake_rewards );
6356 0 : }
6357 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 ) {
6358 0 : (void) varint;
6359 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_start_block_height_and_rewards", level++, 0 );
6360 0 : fun( w, &self->distribution_starting_block_height, "distribution_starting_block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6361 0 : fd_partitioned_stake_rewards_walk( w, &self->partitioned_stake_rewards, fun, "partitioned_stake_rewards", level, 0 );
6362 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_start_block_height_and_rewards", level--, 0 );
6363 0 : }
6364 0 : ulong fd_start_block_height_and_rewards_size( fd_start_block_height_and_rewards_t const * self ) {
6365 0 : ulong size = 0;
6366 0 : size += sizeof(ulong);
6367 0 : size += fd_partitioned_stake_rewards_size( &self->partitioned_stake_rewards );
6368 0 : return size;
6369 0 : }
6370 :
6371 0 : ulong fd_start_block_height_and_rewards_size_global( fd_start_block_height_and_rewards_global_t const * self ) {
6372 0 : ulong size = 0;
6373 0 : size += sizeof(ulong);
6374 0 : size += fd_partitioned_stake_rewards_size_global( &self->partitioned_stake_rewards );
6375 0 : return size;
6376 0 : }
6377 :
6378 0 : int fd_fd_epoch_reward_status_inner_encode( fd_fd_epoch_reward_status_inner_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6379 0 : int err;
6380 0 : err = fd_start_block_height_and_rewards_encode( &self->Active, ctx );
6381 0 : if( FD_UNLIKELY( err ) ) return err;
6382 0 : return FD_BINCODE_SUCCESS;
6383 0 : }
6384 0 : static int fd_fd_epoch_reward_status_inner_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6385 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6386 0 : int err = 0;
6387 0 : err = fd_start_block_height_and_rewards_decode_footprint_inner( ctx, total_sz );
6388 0 : if( FD_UNLIKELY( err ) ) return err;
6389 0 : return 0;
6390 0 : }
6391 0 : int fd_fd_epoch_reward_status_inner_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6392 0 : *total_sz += sizeof(fd_fd_epoch_reward_status_inner_t);
6393 0 : void const * start_data = ctx->data;
6394 0 : int err = fd_fd_epoch_reward_status_inner_decode_footprint_inner( ctx, total_sz );
6395 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6396 0 : ctx->data = start_data;
6397 0 : return err;
6398 0 : }
6399 0 : static void fd_fd_epoch_reward_status_inner_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6400 0 : fd_fd_epoch_reward_status_inner_t * self = (fd_fd_epoch_reward_status_inner_t *)struct_mem;
6401 0 : fd_start_block_height_and_rewards_decode_inner( &self->Active, alloc_mem, ctx );
6402 0 : }
6403 0 : void * fd_fd_epoch_reward_status_inner_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6404 0 : fd_fd_epoch_reward_status_inner_t * self = (fd_fd_epoch_reward_status_inner_t *)mem;
6405 0 : fd_fd_epoch_reward_status_inner_new( self );
6406 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fd_epoch_reward_status_inner_t);
6407 0 : void * * alloc_mem = &alloc_region;
6408 0 : fd_fd_epoch_reward_status_inner_decode_inner( mem, alloc_mem, ctx );
6409 0 : return self;
6410 0 : }
6411 0 : void fd_fd_epoch_reward_status_inner_new(fd_fd_epoch_reward_status_inner_t * self) {
6412 0 : fd_memset( self, 0, sizeof(fd_fd_epoch_reward_status_inner_t) );
6413 0 : fd_start_block_height_and_rewards_new( &self->Active );
6414 0 : }
6415 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 ) {
6416 0 : (void) varint;
6417 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_fd_epoch_reward_status_inner", level++, 0 );
6418 0 : fd_start_block_height_and_rewards_walk( w, &self->Active, fun, "Active", level, 0 );
6419 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_fd_epoch_reward_status_inner", level--, 0 );
6420 0 : }
6421 0 : ulong fd_fd_epoch_reward_status_inner_size( fd_fd_epoch_reward_status_inner_t const * self ) {
6422 0 : ulong size = 0;
6423 0 : size += fd_start_block_height_and_rewards_size( &self->Active );
6424 0 : return size;
6425 0 : }
6426 :
6427 0 : FD_FN_PURE uchar fd_epoch_reward_status_is_Active(fd_epoch_reward_status_t const * self) {
6428 0 : return self->discriminant == 0;
6429 0 : }
6430 0 : FD_FN_PURE uchar fd_epoch_reward_status_is_Inactive(fd_epoch_reward_status_t const * self) {
6431 0 : return self->discriminant == 1;
6432 0 : }
6433 : void fd_epoch_reward_status_inner_new( fd_epoch_reward_status_inner_t * self, uint discriminant );
6434 0 : int fd_epoch_reward_status_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6435 0 : int err;
6436 0 : switch (discriminant) {
6437 0 : case 0: {
6438 0 : err = fd_start_block_height_and_rewards_decode_footprint_inner( ctx, total_sz );
6439 0 : if( FD_UNLIKELY( err ) ) return err;
6440 0 : return FD_BINCODE_SUCCESS;
6441 0 : }
6442 0 : case 1: {
6443 0 : return FD_BINCODE_SUCCESS;
6444 0 : }
6445 0 : default: return FD_BINCODE_ERR_ENCODING;
6446 0 : }
6447 0 : }
6448 0 : static int fd_epoch_reward_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6449 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6450 0 : uint discriminant = 0;
6451 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6452 0 : if( FD_UNLIKELY( err ) ) return err;
6453 0 : return fd_epoch_reward_status_inner_decode_footprint( discriminant, ctx, total_sz );
6454 0 : }
6455 0 : int fd_epoch_reward_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6456 0 : *total_sz += sizeof(fd_epoch_reward_status_t);
6457 0 : void const * start_data = ctx->data;
6458 0 : int err = fd_epoch_reward_status_decode_footprint_inner( ctx, total_sz );
6459 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6460 0 : ctx->data = start_data;
6461 0 : return err;
6462 0 : }
6463 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 ) {
6464 0 : switch (discriminant) {
6465 0 : case 0: {
6466 0 : fd_start_block_height_and_rewards_decode_inner( &self->Active, alloc_mem, ctx );
6467 0 : break;
6468 0 : }
6469 0 : case 1: {
6470 0 : break;
6471 0 : }
6472 0 : }
6473 0 : }
6474 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 ) {
6475 0 : switch (discriminant) {
6476 0 : case 0: {
6477 0 : fd_start_block_height_and_rewards_decode_inner_global( &self->Active, alloc_mem, ctx );
6478 0 : break;
6479 0 : }
6480 0 : case 1: {
6481 0 : break;
6482 0 : }
6483 0 : }
6484 0 : }
6485 0 : static void fd_epoch_reward_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6486 0 : fd_epoch_reward_status_t * self = (fd_epoch_reward_status_t *)struct_mem;
6487 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6488 0 : fd_epoch_reward_status_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
6489 0 : }
6490 0 : void * fd_epoch_reward_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6491 0 : fd_epoch_reward_status_t * self = (fd_epoch_reward_status_t *)mem;
6492 0 : fd_epoch_reward_status_new( self );
6493 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_reward_status_t);
6494 0 : void * * alloc_mem = &alloc_region;
6495 0 : fd_epoch_reward_status_decode_inner( mem, alloc_mem, ctx );
6496 0 : return self;
6497 0 : }
6498 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 ) {
6499 0 : int err;
6500 0 : switch (discriminant) {
6501 0 : case 0: {
6502 0 : err = fd_start_block_height_and_rewards_encode_global( &self->Active, ctx );
6503 0 : if( FD_UNLIKELY( err ) ) return err;
6504 0 : break;
6505 0 : }
6506 0 : }
6507 0 : return FD_BINCODE_SUCCESS;
6508 0 : }
6509 0 : int fd_epoch_reward_status_encode_global( fd_epoch_reward_status_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6510 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6511 0 : if( FD_UNLIKELY( err ) ) return err;
6512 0 : return fd_epoch_reward_status_inner_encode_global( &self->inner, self->discriminant, ctx );
6513 0 : }
6514 :
6515 0 : static void fd_epoch_reward_status_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6516 0 : fd_epoch_reward_status_global_t * self = (fd_epoch_reward_status_global_t *)struct_mem;
6517 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6518 0 : fd_epoch_reward_status_inner_decode_inner_global( &self->inner, alloc_mem, self->discriminant, ctx );
6519 0 : }
6520 0 : void * fd_epoch_reward_status_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6521 0 : fd_epoch_reward_status_t * self = (fd_epoch_reward_status_t *)mem;
6522 0 : fd_epoch_reward_status_new( self );
6523 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_reward_status_t);
6524 0 : void * * alloc_mem = &alloc_region;
6525 0 : fd_epoch_reward_status_decode_inner_global( mem, alloc_mem, ctx );
6526 0 : return self;
6527 0 : }
6528 0 : void fd_epoch_reward_status_inner_new( fd_epoch_reward_status_inner_t * self, uint discriminant ) {
6529 0 : switch( discriminant ) {
6530 0 : case 0: {
6531 0 : fd_start_block_height_and_rewards_new( &self->Active );
6532 0 : break;
6533 0 : }
6534 0 : case 1: {
6535 0 : break;
6536 0 : }
6537 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
6538 0 : }
6539 0 : }
6540 0 : void fd_epoch_reward_status_new_disc( fd_epoch_reward_status_t * self, uint discriminant ) {
6541 0 : self->discriminant = discriminant;
6542 0 : fd_epoch_reward_status_inner_new( &self->inner, self->discriminant );
6543 0 : }
6544 0 : void fd_epoch_reward_status_new( fd_epoch_reward_status_t * self ) {
6545 0 : fd_memset( self, 0, sizeof(fd_epoch_reward_status_t) );
6546 0 : fd_epoch_reward_status_new_disc( self, UINT_MAX );
6547 0 : }
6548 :
6549 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 ) {
6550 0 : (void) varint;
6551 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_epoch_reward_status", level++, 0);
6552 0 : switch( self->discriminant ) {
6553 0 : case 0: {
6554 0 : fun( w, self, "Active", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6555 0 : fd_start_block_height_and_rewards_walk( w, &self->inner.Active, fun, "Active", level, 0 );
6556 0 : break;
6557 0 : }
6558 0 : case 1: {
6559 0 : fun( w, self, "Inactive", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6560 0 : break;
6561 0 : }
6562 0 : }
6563 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_epoch_reward_status", level--, 0 );
6564 0 : }
6565 0 : ulong fd_epoch_reward_status_size( fd_epoch_reward_status_t const * self ) {
6566 0 : ulong size = 0;
6567 0 : size += sizeof(uint);
6568 0 : switch (self->discriminant) {
6569 0 : case 0: {
6570 0 : size += fd_start_block_height_and_rewards_size( &self->inner.Active );
6571 0 : break;
6572 0 : }
6573 0 : }
6574 0 : return size;
6575 0 : }
6576 :
6577 0 : ulong fd_epoch_reward_status_size_global( fd_epoch_reward_status_global_t const * self ) {
6578 0 : ulong size = 0;
6579 0 : size += sizeof(uint);
6580 0 : switch (self->discriminant) {
6581 0 : case 0: {
6582 0 : size += fd_start_block_height_and_rewards_size_global( &self->inner.Active );
6583 0 : break;
6584 0 : }
6585 0 : }
6586 0 : return size;
6587 0 : }
6588 :
6589 0 : int fd_epoch_reward_status_inner_encode( fd_epoch_reward_status_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6590 0 : int err;
6591 0 : switch (discriminant) {
6592 0 : case 0: {
6593 0 : err = fd_start_block_height_and_rewards_encode( &self->Active, ctx );
6594 0 : if( FD_UNLIKELY( err ) ) return err;
6595 0 : break;
6596 0 : }
6597 0 : }
6598 0 : return FD_BINCODE_SUCCESS;
6599 0 : }
6600 0 : int fd_epoch_reward_status_encode( fd_epoch_reward_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6601 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6602 0 : if( FD_UNLIKELY( err ) ) return err;
6603 0 : return fd_epoch_reward_status_inner_encode( &self->inner, self->discriminant, ctx );
6604 0 : }
6605 :
6606 0 : int fd_prev_epoch_inflation_rewards_encode( fd_prev_epoch_inflation_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6607 0 : int err;
6608 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
6609 0 : if( FD_UNLIKELY( err ) ) return err;
6610 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
6611 0 : if( FD_UNLIKELY( err ) ) return err;
6612 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
6613 0 : if( FD_UNLIKELY( err ) ) return err;
6614 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
6615 0 : if( FD_UNLIKELY( err ) ) return err;
6616 0 : return FD_BINCODE_SUCCESS;
6617 0 : }
6618 0 : static inline int fd_prev_epoch_inflation_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6619 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6620 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
6621 0 : return 0;
6622 0 : }
6623 0 : static void fd_prev_epoch_inflation_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6624 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)struct_mem;
6625 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
6626 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
6627 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
6628 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
6629 0 : }
6630 0 : void * fd_prev_epoch_inflation_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6631 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)mem;
6632 0 : fd_prev_epoch_inflation_rewards_new( self );
6633 0 : void * alloc_region = (uchar *)mem + sizeof(fd_prev_epoch_inflation_rewards_t);
6634 0 : void * * alloc_mem = &alloc_region;
6635 0 : fd_prev_epoch_inflation_rewards_decode_inner( mem, alloc_mem, ctx );
6636 0 : return self;
6637 0 : }
6638 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 ) {
6639 0 : (void) varint;
6640 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_prev_epoch_inflation_rewards", level++, 0 );
6641 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6642 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6643 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6644 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
6645 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_prev_epoch_inflation_rewards", level--, 0 );
6646 0 : }
6647 0 : int fd_vote_encode( fd_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6648 0 : int err;
6649 0 : if( self->slots ) {
6650 0 : ulong slots_len = deq_ulong_cnt( self->slots );
6651 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
6652 0 : if( FD_UNLIKELY( err ) ) return err;
6653 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 ) ) {
6654 0 : ulong const * ele = deq_ulong_iter_ele_const( self->slots, iter );
6655 0 : err = fd_bincode_uint64_encode( ele[0], ctx );
6656 0 : }
6657 0 : } else {
6658 0 : ulong slots_len = 0;
6659 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
6660 0 : if( FD_UNLIKELY( err ) ) return err;
6661 0 : }
6662 0 : err = fd_hash_encode( &self->hash, ctx );
6663 0 : if( FD_UNLIKELY( err ) ) return err;
6664 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
6665 0 : if( FD_UNLIKELY( err ) ) return err;
6666 0 : if( self->has_timestamp ) {
6667 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
6668 0 : if( FD_UNLIKELY( err ) ) return err;
6669 0 : }
6670 0 : return FD_BINCODE_SUCCESS;
6671 0 : }
6672 0 : static int fd_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6673 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6674 0 : int err = 0;
6675 0 : ulong slots_len;
6676 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
6677 0 : if( FD_UNLIKELY( err ) ) return err;
6678 0 : ulong slots_max = slots_len == 0 ? 1 : slots_len;
6679 0 : *total_sz += deq_ulong_align() + deq_ulong_footprint( slots_max ) ;
6680 0 : ulong slots_sz;
6681 0 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
6682 0 : err = fd_bincode_bytes_decode_footprint( slots_sz, ctx );
6683 0 : if( FD_UNLIKELY( err ) ) return err;
6684 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
6685 0 : if( FD_UNLIKELY( err ) ) return err;
6686 0 : {
6687 0 : uchar o;
6688 0 : err = fd_bincode_bool_decode( &o, ctx );
6689 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6690 0 : if( o ) {
6691 0 : err = fd_bincode_int64_decode_footprint( ctx );
6692 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6693 0 : }
6694 0 : }
6695 0 : return 0;
6696 0 : }
6697 0 : int fd_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6698 0 : *total_sz += sizeof(fd_vote_t);
6699 0 : void const * start_data = ctx->data;
6700 0 : int err = fd_vote_decode_footprint_inner( ctx, total_sz );
6701 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6702 0 : ctx->data = start_data;
6703 0 : return err;
6704 0 : }
6705 0 : static void fd_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6706 0 : fd_vote_t * self = (fd_vote_t *)struct_mem;
6707 0 : ulong slots_len;
6708 0 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
6709 0 : self->slots = deq_ulong_join_new( alloc_mem, slots_len );
6710 0 : for( ulong i=0; i < slots_len; i++ ) {
6711 0 : ulong * elem = deq_ulong_push_tail_nocopy( self->slots );
6712 0 : fd_bincode_uint64_decode_unsafe( elem, ctx );
6713 0 : }
6714 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
6715 0 : {
6716 0 : uchar o;
6717 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6718 0 : self->has_timestamp = !!o;
6719 0 : if( o ) {
6720 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
6721 0 : }
6722 0 : }
6723 0 : }
6724 0 : void * fd_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6725 0 : fd_vote_t * self = (fd_vote_t *)mem;
6726 0 : fd_vote_new( self );
6727 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_t);
6728 0 : void * * alloc_mem = &alloc_region;
6729 0 : fd_vote_decode_inner( mem, alloc_mem, ctx );
6730 0 : return self;
6731 0 : }
6732 0 : void fd_vote_new(fd_vote_t * self) {
6733 0 : fd_memset( self, 0, sizeof(fd_vote_t) );
6734 0 : fd_hash_new( &self->hash );
6735 0 : }
6736 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 ) {
6737 0 : (void) varint;
6738 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote", level++, 0 );
6739 :
6740 : /* Walk deque */
6741 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR, "slots", level++, 0 );
6742 0 : if( self->slots ) {
6743 0 : for( deq_ulong_iter_t iter = deq_ulong_iter_init( self->slots );
6744 0 : !deq_ulong_iter_done( self->slots, iter );
6745 0 : iter = deq_ulong_iter_next( self->slots, iter ) ) {
6746 0 : ulong * ele = deq_ulong_iter_ele( self->slots, iter );
6747 0 : fun(w, ele, "ele", FD_FLAMENCO_TYPE_ULONG, "long", level, 0 );
6748 0 : }
6749 0 : }
6750 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR_END, "slots", level--, 0 );
6751 : /* Done walking deque */
6752 :
6753 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
6754 0 : if( !self->has_timestamp ) {
6755 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
6756 0 : } else {
6757 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
6758 0 : }
6759 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote", level--, 0 );
6760 0 : }
6761 0 : ulong fd_vote_size( fd_vote_t const * self ) {
6762 0 : ulong size = 0;
6763 0 : if( self->slots ) {
6764 0 : size += sizeof(ulong);
6765 0 : ulong slots_len = deq_ulong_cnt(self->slots);
6766 0 : size += slots_len * sizeof(ulong);
6767 0 : } else {
6768 0 : size += sizeof(ulong);
6769 0 : }
6770 0 : size += fd_hash_size( &self->hash );
6771 0 : size += sizeof(char);
6772 0 : if( self->has_timestamp ) {
6773 0 : size += sizeof(long);
6774 0 : }
6775 0 : return size;
6776 0 : }
6777 :
6778 0 : int fd_vote_init_encode( fd_vote_init_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6779 0 : int err;
6780 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
6781 0 : if( FD_UNLIKELY( err ) ) return err;
6782 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
6783 0 : if( FD_UNLIKELY( err ) ) return err;
6784 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
6785 0 : if( FD_UNLIKELY( err ) ) return err;
6786 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
6787 0 : if( FD_UNLIKELY( err ) ) return err;
6788 0 : return FD_BINCODE_SUCCESS;
6789 0 : }
6790 0 : static inline int fd_vote_init_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6791 0 : if( (ulong)ctx->data + 97UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6792 0 : ctx->data = (void *)( (ulong)ctx->data + 97UL );
6793 0 : return 0;
6794 0 : }
6795 0 : static void fd_vote_init_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6796 0 : fd_vote_init_t * self = (fd_vote_init_t *)struct_mem;
6797 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
6798 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
6799 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
6800 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
6801 0 : }
6802 0 : void * fd_vote_init_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6803 0 : fd_vote_init_t * self = (fd_vote_init_t *)mem;
6804 0 : fd_vote_init_new( self );
6805 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_t);
6806 0 : void * * alloc_mem = &alloc_region;
6807 0 : fd_vote_init_decode_inner( mem, alloc_mem, ctx );
6808 0 : return self;
6809 0 : }
6810 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 ) {
6811 0 : (void) varint;
6812 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_init", level++, 0 );
6813 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
6814 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level, 0 );
6815 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
6816 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
6817 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_init", level--, 0 );
6818 0 : }
6819 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter(fd_vote_authorize_t const * self) {
6820 0 : return self->discriminant == 0;
6821 0 : }
6822 0 : FD_FN_PURE uchar fd_vote_authorize_is_withdrawer(fd_vote_authorize_t const * self) {
6823 0 : return self->discriminant == 1;
6824 0 : }
6825 0 : int fd_vote_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6826 0 : int err;
6827 0 : switch (discriminant) {
6828 0 : case 0: {
6829 0 : return FD_BINCODE_SUCCESS;
6830 0 : }
6831 0 : case 1: {
6832 0 : return FD_BINCODE_SUCCESS;
6833 0 : }
6834 0 : default: return FD_BINCODE_ERR_ENCODING;
6835 0 : }
6836 0 : }
6837 0 : static int fd_vote_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6838 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6839 0 : uint discriminant = 0;
6840 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6841 0 : if( FD_UNLIKELY( err ) ) return err;
6842 0 : return fd_vote_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
6843 0 : }
6844 0 : int fd_vote_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6845 0 : *total_sz += sizeof(fd_vote_authorize_t);
6846 0 : void const * start_data = ctx->data;
6847 0 : int err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
6848 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6849 0 : ctx->data = start_data;
6850 0 : return err;
6851 0 : }
6852 0 : static void fd_vote_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6853 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)struct_mem;
6854 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6855 0 : }
6856 0 : void * fd_vote_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6857 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)mem;
6858 0 : fd_vote_authorize_new( self );
6859 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_t);
6860 0 : void * * alloc_mem = &alloc_region;
6861 0 : fd_vote_authorize_decode_inner( mem, alloc_mem, ctx );
6862 0 : return self;
6863 0 : }
6864 :
6865 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 ) {
6866 0 : (void) varint;
6867 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_authorize", level++, 0);
6868 0 : switch( self->discriminant ) {
6869 0 : case 0: {
6870 0 : fun( w, self, "voter", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6871 0 : break;
6872 0 : }
6873 0 : case 1: {
6874 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6875 0 : break;
6876 0 : }
6877 0 : }
6878 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_authorize", level--, 0 );
6879 0 : }
6880 0 : ulong fd_vote_authorize_size( fd_vote_authorize_t const * self ) {
6881 0 : ulong size = 0;
6882 0 : size += sizeof(uint);
6883 0 : switch (self->discriminant) {
6884 0 : }
6885 0 : return size;
6886 0 : }
6887 :
6888 0 : int fd_vote_authorize_encode( fd_vote_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6889 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6890 0 : if( FD_UNLIKELY( err ) ) return err;
6891 0 : return err;
6892 0 : }
6893 :
6894 0 : int fd_vote_authorize_pubkey_encode( fd_vote_authorize_pubkey_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6895 0 : int err;
6896 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
6897 0 : if( FD_UNLIKELY( err ) ) return err;
6898 0 : err = fd_vote_authorize_encode( &self->vote_authorize, ctx );
6899 0 : if( FD_UNLIKELY( err ) ) return err;
6900 0 : return FD_BINCODE_SUCCESS;
6901 0 : }
6902 0 : static int fd_vote_authorize_pubkey_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6903 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6904 0 : int err = 0;
6905 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6906 0 : if( FD_UNLIKELY( err ) ) return err;
6907 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
6908 0 : if( FD_UNLIKELY( err ) ) return err;
6909 0 : return 0;
6910 0 : }
6911 0 : int fd_vote_authorize_pubkey_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6912 0 : *total_sz += sizeof(fd_vote_authorize_pubkey_t);
6913 0 : void const * start_data = ctx->data;
6914 0 : int err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
6915 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6916 0 : ctx->data = start_data;
6917 0 : return err;
6918 0 : }
6919 0 : static void fd_vote_authorize_pubkey_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6920 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)struct_mem;
6921 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
6922 0 : fd_vote_authorize_decode_inner( &self->vote_authorize, alloc_mem, ctx );
6923 0 : }
6924 0 : void * fd_vote_authorize_pubkey_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6925 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)mem;
6926 0 : fd_vote_authorize_pubkey_new( self );
6927 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_pubkey_t);
6928 0 : void * * alloc_mem = &alloc_region;
6929 0 : fd_vote_authorize_pubkey_decode_inner( mem, alloc_mem, ctx );
6930 0 : return self;
6931 0 : }
6932 0 : void fd_vote_authorize_pubkey_new(fd_vote_authorize_pubkey_t * self) {
6933 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_pubkey_t) );
6934 0 : fd_pubkey_new( &self->pubkey );
6935 0 : fd_vote_authorize_new( &self->vote_authorize );
6936 0 : }
6937 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 ) {
6938 0 : (void) varint;
6939 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_pubkey", level++, 0 );
6940 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
6941 0 : fd_vote_authorize_walk( w, &self->vote_authorize, fun, "vote_authorize", level, 0 );
6942 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_pubkey", level--, 0 );
6943 0 : }
6944 0 : int fd_vote_switch_encode( fd_vote_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6945 0 : int err;
6946 0 : err = fd_vote_encode( &self->vote, ctx );
6947 0 : if( FD_UNLIKELY( err ) ) return err;
6948 0 : err = fd_hash_encode( &self->hash, ctx );
6949 0 : if( FD_UNLIKELY( err ) ) return err;
6950 0 : return FD_BINCODE_SUCCESS;
6951 0 : }
6952 0 : static int fd_vote_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6953 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6954 0 : int err = 0;
6955 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
6956 0 : if( FD_UNLIKELY( err ) ) return err;
6957 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
6958 0 : if( FD_UNLIKELY( err ) ) return err;
6959 0 : return 0;
6960 0 : }
6961 0 : int fd_vote_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6962 0 : *total_sz += sizeof(fd_vote_switch_t);
6963 0 : void const * start_data = ctx->data;
6964 0 : int err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
6965 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6966 0 : ctx->data = start_data;
6967 0 : return err;
6968 0 : }
6969 0 : static void fd_vote_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6970 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)struct_mem;
6971 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
6972 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
6973 0 : }
6974 0 : void * fd_vote_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6975 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)mem;
6976 0 : fd_vote_switch_new( self );
6977 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_switch_t);
6978 0 : void * * alloc_mem = &alloc_region;
6979 0 : fd_vote_switch_decode_inner( mem, alloc_mem, ctx );
6980 0 : return self;
6981 0 : }
6982 0 : void fd_vote_switch_new(fd_vote_switch_t * self) {
6983 0 : fd_memset( self, 0, sizeof(fd_vote_switch_t) );
6984 0 : fd_vote_new( &self->vote );
6985 0 : fd_hash_new( &self->hash );
6986 0 : }
6987 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 ) {
6988 0 : (void) varint;
6989 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_switch", level++, 0 );
6990 0 : fd_vote_walk( w, &self->vote, fun, "vote", level, 0 );
6991 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
6992 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_switch", level--, 0 );
6993 0 : }
6994 0 : ulong fd_vote_switch_size( fd_vote_switch_t const * self ) {
6995 0 : ulong size = 0;
6996 0 : size += fd_vote_size( &self->vote );
6997 0 : size += fd_hash_size( &self->hash );
6998 0 : return size;
6999 0 : }
7000 :
7001 0 : int fd_update_vote_state_switch_encode( fd_update_vote_state_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7002 0 : int err;
7003 0 : err = fd_vote_state_update_encode( &self->vote_state_update, ctx );
7004 0 : if( FD_UNLIKELY( err ) ) return err;
7005 0 : err = fd_hash_encode( &self->hash, ctx );
7006 0 : if( FD_UNLIKELY( err ) ) return err;
7007 0 : return FD_BINCODE_SUCCESS;
7008 0 : }
7009 0 : static int fd_update_vote_state_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7010 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7011 0 : int err = 0;
7012 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
7013 0 : if( FD_UNLIKELY( err ) ) return err;
7014 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
7015 0 : if( FD_UNLIKELY( err ) ) return err;
7016 0 : return 0;
7017 0 : }
7018 0 : int fd_update_vote_state_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7019 0 : *total_sz += sizeof(fd_update_vote_state_switch_t);
7020 0 : void const * start_data = ctx->data;
7021 0 : int err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
7022 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7023 0 : ctx->data = start_data;
7024 0 : return err;
7025 0 : }
7026 0 : static void fd_update_vote_state_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7027 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)struct_mem;
7028 0 : fd_vote_state_update_decode_inner( &self->vote_state_update, alloc_mem, ctx );
7029 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
7030 0 : }
7031 0 : void * fd_update_vote_state_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7032 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)mem;
7033 0 : fd_update_vote_state_switch_new( self );
7034 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_vote_state_switch_t);
7035 0 : void * * alloc_mem = &alloc_region;
7036 0 : fd_update_vote_state_switch_decode_inner( mem, alloc_mem, ctx );
7037 0 : return self;
7038 0 : }
7039 0 : void fd_update_vote_state_switch_new(fd_update_vote_state_switch_t * self) {
7040 0 : fd_memset( self, 0, sizeof(fd_update_vote_state_switch_t) );
7041 0 : fd_vote_state_update_new( &self->vote_state_update );
7042 0 : fd_hash_new( &self->hash );
7043 0 : }
7044 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 ) {
7045 0 : (void) varint;
7046 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_update_vote_state_switch", level++, 0 );
7047 0 : fd_vote_state_update_walk( w, &self->vote_state_update, fun, "vote_state_update", level, 0 );
7048 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
7049 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_update_vote_state_switch", level--, 0 );
7050 0 : }
7051 0 : ulong fd_update_vote_state_switch_size( fd_update_vote_state_switch_t const * self ) {
7052 0 : ulong size = 0;
7053 0 : size += fd_vote_state_update_size( &self->vote_state_update );
7054 0 : size += fd_hash_size( &self->hash );
7055 0 : return size;
7056 0 : }
7057 :
7058 0 : int fd_vote_authorize_with_seed_args_encode( fd_vote_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7059 0 : int err;
7060 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
7061 0 : if( FD_UNLIKELY( err ) ) return err;
7062 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
7063 0 : if( FD_UNLIKELY( err ) ) return err;
7064 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
7065 0 : if( FD_UNLIKELY(err) ) return err;
7066 0 : if( self->current_authority_derived_key_seed_len ) {
7067 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
7068 0 : if( FD_UNLIKELY( err ) ) return err;
7069 0 : }
7070 0 : err = fd_pubkey_encode( &self->new_authority, ctx );
7071 0 : if( FD_UNLIKELY( err ) ) return err;
7072 0 : return FD_BINCODE_SUCCESS;
7073 0 : }
7074 0 : static int fd_vote_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7075 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7076 0 : int err = 0;
7077 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
7078 0 : if( FD_UNLIKELY( err ) ) return err;
7079 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7080 0 : if( FD_UNLIKELY( err ) ) return err;
7081 0 : ulong current_authority_derived_key_seed_len;
7082 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
7083 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7084 0 : *total_sz += current_authority_derived_key_seed_len;
7085 0 : if( current_authority_derived_key_seed_len ) {
7086 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
7087 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7088 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
7089 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7090 0 : }
7091 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7092 0 : if( FD_UNLIKELY( err ) ) return err;
7093 0 : return 0;
7094 0 : }
7095 0 : int fd_vote_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7096 0 : *total_sz += sizeof(fd_vote_authorize_with_seed_args_t);
7097 0 : void const * start_data = ctx->data;
7098 0 : int err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
7099 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7100 0 : ctx->data = start_data;
7101 0 : return err;
7102 0 : }
7103 0 : static void fd_vote_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7104 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)struct_mem;
7105 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
7106 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
7107 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
7108 0 : if( self->current_authority_derived_key_seed_len ) {
7109 0 : self->current_authority_derived_key_seed = *alloc_mem;
7110 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
7111 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
7112 0 : } else
7113 0 : self->current_authority_derived_key_seed = NULL;
7114 0 : fd_pubkey_decode_inner( &self->new_authority, alloc_mem, ctx );
7115 0 : }
7116 0 : void * fd_vote_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7117 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)mem;
7118 0 : fd_vote_authorize_with_seed_args_new( self );
7119 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_with_seed_args_t);
7120 0 : void * * alloc_mem = &alloc_region;
7121 0 : fd_vote_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
7122 0 : return self;
7123 0 : }
7124 0 : void fd_vote_authorize_with_seed_args_new(fd_vote_authorize_with_seed_args_t * self) {
7125 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_with_seed_args_t) );
7126 0 : fd_vote_authorize_new( &self->authorization_type );
7127 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
7128 0 : fd_pubkey_new( &self->new_authority );
7129 0 : }
7130 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 ) {
7131 0 : (void) varint;
7132 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_with_seed_args", level++, 0 );
7133 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level, 0 );
7134 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level, 0 );
7135 0 : if( self->current_authority_derived_key_seed_len ) {
7136 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
7137 0 : for( ulong i=0; i < self->current_authority_derived_key_seed_len; i++ )
7138 0 : fun( w, self->current_authority_derived_key_seed + i, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7139 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
7140 0 : }
7141 0 : fd_pubkey_walk( w, &self->new_authority, fun, "new_authority", level, 0 );
7142 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_with_seed_args", level--, 0 );
7143 0 : }
7144 0 : ulong fd_vote_authorize_with_seed_args_size( fd_vote_authorize_with_seed_args_t const * self ) {
7145 0 : ulong size = 0;
7146 0 : size += fd_vote_authorize_size( &self->authorization_type );
7147 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
7148 0 : do {
7149 0 : size += sizeof(ulong);
7150 0 : size += self->current_authority_derived_key_seed_len;
7151 0 : } while(0);
7152 0 : size += fd_pubkey_size( &self->new_authority );
7153 0 : return size;
7154 0 : }
7155 :
7156 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 ) {
7157 0 : int err;
7158 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
7159 0 : if( FD_UNLIKELY( err ) ) return err;
7160 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
7161 0 : if( FD_UNLIKELY( err ) ) return err;
7162 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
7163 0 : if( FD_UNLIKELY(err) ) return err;
7164 0 : if( self->current_authority_derived_key_seed_len ) {
7165 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
7166 0 : if( FD_UNLIKELY( err ) ) return err;
7167 0 : }
7168 0 : return FD_BINCODE_SUCCESS;
7169 0 : }
7170 0 : static int fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7171 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7172 0 : int err = 0;
7173 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
7174 0 : if( FD_UNLIKELY( err ) ) return err;
7175 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7176 0 : if( FD_UNLIKELY( err ) ) return err;
7177 0 : ulong current_authority_derived_key_seed_len;
7178 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
7179 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7180 0 : *total_sz += current_authority_derived_key_seed_len;
7181 0 : if( current_authority_derived_key_seed_len ) {
7182 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
7183 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7184 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
7185 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7186 0 : }
7187 0 : return 0;
7188 0 : }
7189 0 : int fd_vote_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7190 0 : *total_sz += sizeof(fd_vote_authorize_checked_with_seed_args_t);
7191 0 : void const * start_data = ctx->data;
7192 0 : int err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
7193 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7194 0 : ctx->data = start_data;
7195 0 : return err;
7196 0 : }
7197 0 : static void fd_vote_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7198 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)struct_mem;
7199 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
7200 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
7201 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
7202 0 : if( self->current_authority_derived_key_seed_len ) {
7203 0 : self->current_authority_derived_key_seed = *alloc_mem;
7204 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
7205 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
7206 0 : } else
7207 0 : self->current_authority_derived_key_seed = NULL;
7208 0 : }
7209 0 : void * fd_vote_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7210 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)mem;
7211 0 : fd_vote_authorize_checked_with_seed_args_new( self );
7212 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_checked_with_seed_args_t);
7213 0 : void * * alloc_mem = &alloc_region;
7214 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
7215 0 : return self;
7216 0 : }
7217 0 : void fd_vote_authorize_checked_with_seed_args_new(fd_vote_authorize_checked_with_seed_args_t * self) {
7218 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_checked_with_seed_args_t) );
7219 0 : fd_vote_authorize_new( &self->authorization_type );
7220 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
7221 0 : }
7222 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 ) {
7223 0 : (void) varint;
7224 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_checked_with_seed_args", level++, 0 );
7225 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level, 0 );
7226 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level, 0 );
7227 0 : if( self->current_authority_derived_key_seed_len ) {
7228 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
7229 0 : for( ulong i=0; i < self->current_authority_derived_key_seed_len; i++ )
7230 0 : fun( w, self->current_authority_derived_key_seed + i, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7231 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
7232 0 : }
7233 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_checked_with_seed_args", level--, 0 );
7234 0 : }
7235 0 : ulong fd_vote_authorize_checked_with_seed_args_size( fd_vote_authorize_checked_with_seed_args_t const * self ) {
7236 0 : ulong size = 0;
7237 0 : size += fd_vote_authorize_size( &self->authorization_type );
7238 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
7239 0 : do {
7240 0 : size += sizeof(ulong);
7241 0 : size += self->current_authority_derived_key_seed_len;
7242 0 : } while(0);
7243 0 : return size;
7244 0 : }
7245 :
7246 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account(fd_vote_instruction_t const * self) {
7247 0 : return self->discriminant == 0;
7248 0 : }
7249 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize(fd_vote_instruction_t const * self) {
7250 0 : return self->discriminant == 1;
7251 0 : }
7252 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote(fd_vote_instruction_t const * self) {
7253 0 : return self->discriminant == 2;
7254 0 : }
7255 0 : FD_FN_PURE uchar fd_vote_instruction_is_withdraw(fd_vote_instruction_t const * self) {
7256 0 : return self->discriminant == 3;
7257 0 : }
7258 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_validator_identity(fd_vote_instruction_t const * self) {
7259 0 : return self->discriminant == 4;
7260 0 : }
7261 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission(fd_vote_instruction_t const * self) {
7262 0 : return self->discriminant == 5;
7263 0 : }
7264 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote_switch(fd_vote_instruction_t const * self) {
7265 0 : return self->discriminant == 6;
7266 0 : }
7267 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked(fd_vote_instruction_t const * self) {
7268 0 : return self->discriminant == 7;
7269 0 : }
7270 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state(fd_vote_instruction_t const * self) {
7271 0 : return self->discriminant == 8;
7272 0 : }
7273 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state_switch(fd_vote_instruction_t const * self) {
7274 0 : return self->discriminant == 9;
7275 0 : }
7276 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_with_seed(fd_vote_instruction_t const * self) {
7277 0 : return self->discriminant == 10;
7278 0 : }
7279 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked_with_seed(fd_vote_instruction_t const * self) {
7280 0 : return self->discriminant == 11;
7281 0 : }
7282 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state(fd_vote_instruction_t const * self) {
7283 0 : return self->discriminant == 12;
7284 0 : }
7285 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state_switch(fd_vote_instruction_t const * self) {
7286 0 : return self->discriminant == 13;
7287 0 : }
7288 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync(fd_vote_instruction_t const * self) {
7289 0 : return self->discriminant == 14;
7290 0 : }
7291 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync_switch(fd_vote_instruction_t const * self) {
7292 0 : return self->discriminant == 15;
7293 0 : }
7294 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant );
7295 0 : int fd_vote_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7296 0 : int err;
7297 0 : switch (discriminant) {
7298 0 : case 0: {
7299 0 : err = fd_vote_init_decode_footprint_inner( ctx, total_sz );
7300 0 : if( FD_UNLIKELY( err ) ) return err;
7301 0 : return FD_BINCODE_SUCCESS;
7302 0 : }
7303 0 : case 1: {
7304 0 : err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
7305 0 : if( FD_UNLIKELY( err ) ) return err;
7306 0 : return FD_BINCODE_SUCCESS;
7307 0 : }
7308 0 : case 2: {
7309 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
7310 0 : if( FD_UNLIKELY( err ) ) return err;
7311 0 : return FD_BINCODE_SUCCESS;
7312 0 : }
7313 0 : case 3: {
7314 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7315 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7316 0 : return FD_BINCODE_SUCCESS;
7317 0 : }
7318 0 : case 4: {
7319 0 : return FD_BINCODE_SUCCESS;
7320 0 : }
7321 0 : case 5: {
7322 0 : err = fd_bincode_uint8_decode_footprint( ctx );
7323 0 : if( FD_UNLIKELY( err ) ) return err;
7324 0 : return FD_BINCODE_SUCCESS;
7325 0 : }
7326 0 : case 6: {
7327 0 : err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
7328 0 : if( FD_UNLIKELY( err ) ) return err;
7329 0 : return FD_BINCODE_SUCCESS;
7330 0 : }
7331 0 : case 7: {
7332 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
7333 0 : if( FD_UNLIKELY( err ) ) return err;
7334 0 : return FD_BINCODE_SUCCESS;
7335 0 : }
7336 0 : case 8: {
7337 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
7338 0 : if( FD_UNLIKELY( err ) ) return err;
7339 0 : return FD_BINCODE_SUCCESS;
7340 0 : }
7341 0 : case 9: {
7342 0 : err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
7343 0 : if( FD_UNLIKELY( err ) ) return err;
7344 0 : return FD_BINCODE_SUCCESS;
7345 0 : }
7346 0 : case 10: {
7347 0 : err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
7348 0 : if( FD_UNLIKELY( err ) ) return err;
7349 0 : return FD_BINCODE_SUCCESS;
7350 0 : }
7351 0 : case 11: {
7352 0 : err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
7353 0 : if( FD_UNLIKELY( err ) ) return err;
7354 0 : return FD_BINCODE_SUCCESS;
7355 0 : }
7356 0 : case 12: {
7357 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
7358 0 : if( FD_UNLIKELY( err ) ) return err;
7359 0 : return FD_BINCODE_SUCCESS;
7360 0 : }
7361 0 : case 13: {
7362 0 : err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
7363 0 : if( FD_UNLIKELY( err ) ) return err;
7364 0 : return FD_BINCODE_SUCCESS;
7365 0 : }
7366 0 : case 14: {
7367 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
7368 0 : if( FD_UNLIKELY( err ) ) return err;
7369 0 : return FD_BINCODE_SUCCESS;
7370 0 : }
7371 0 : case 15: {
7372 0 : err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
7373 0 : if( FD_UNLIKELY( err ) ) return err;
7374 0 : return FD_BINCODE_SUCCESS;
7375 0 : }
7376 0 : default: return FD_BINCODE_ERR_ENCODING;
7377 0 : }
7378 0 : }
7379 0 : static int fd_vote_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7380 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7381 0 : uint discriminant = 0;
7382 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7383 0 : if( FD_UNLIKELY( err ) ) return err;
7384 0 : return fd_vote_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
7385 0 : }
7386 0 : int fd_vote_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7387 0 : *total_sz += sizeof(fd_vote_instruction_t);
7388 0 : void const * start_data = ctx->data;
7389 0 : int err = fd_vote_instruction_decode_footprint_inner( ctx, total_sz );
7390 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7391 0 : ctx->data = start_data;
7392 0 : return err;
7393 0 : }
7394 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 ) {
7395 0 : switch (discriminant) {
7396 0 : case 0: {
7397 0 : fd_vote_init_decode_inner( &self->initialize_account, alloc_mem, ctx );
7398 0 : break;
7399 0 : }
7400 0 : case 1: {
7401 0 : fd_vote_authorize_pubkey_decode_inner( &self->authorize, alloc_mem, ctx );
7402 0 : break;
7403 0 : }
7404 0 : case 2: {
7405 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
7406 0 : break;
7407 0 : }
7408 0 : case 3: {
7409 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
7410 0 : break;
7411 0 : }
7412 0 : case 4: {
7413 0 : break;
7414 0 : }
7415 0 : case 5: {
7416 0 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
7417 0 : break;
7418 0 : }
7419 0 : case 6: {
7420 0 : fd_vote_switch_decode_inner( &self->vote_switch, alloc_mem, ctx );
7421 0 : break;
7422 0 : }
7423 0 : case 7: {
7424 0 : fd_vote_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
7425 0 : break;
7426 0 : }
7427 0 : case 8: {
7428 0 : fd_vote_state_update_decode_inner( &self->update_vote_state, alloc_mem, ctx );
7429 0 : break;
7430 0 : }
7431 0 : case 9: {
7432 0 : fd_update_vote_state_switch_decode_inner( &self->update_vote_state_switch, alloc_mem, ctx );
7433 0 : break;
7434 0 : }
7435 0 : case 10: {
7436 0 : fd_vote_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
7437 0 : break;
7438 0 : }
7439 0 : case 11: {
7440 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
7441 0 : break;
7442 0 : }
7443 0 : case 12: {
7444 0 : fd_compact_vote_state_update_decode_inner( &self->compact_update_vote_state, alloc_mem, ctx );
7445 0 : break;
7446 0 : }
7447 0 : case 13: {
7448 0 : fd_compact_vote_state_update_switch_decode_inner( &self->compact_update_vote_state_switch, alloc_mem, ctx );
7449 0 : break;
7450 0 : }
7451 0 : case 14: {
7452 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
7453 0 : break;
7454 0 : }
7455 0 : case 15: {
7456 0 : fd_tower_sync_switch_decode_inner( &self->tower_sync_switch, alloc_mem, ctx );
7457 0 : break;
7458 0 : }
7459 0 : }
7460 0 : }
7461 0 : static void fd_vote_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7462 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)struct_mem;
7463 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7464 0 : fd_vote_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7465 0 : }
7466 0 : void * fd_vote_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7467 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)mem;
7468 0 : fd_vote_instruction_new( self );
7469 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_instruction_t);
7470 0 : void * * alloc_mem = &alloc_region;
7471 0 : fd_vote_instruction_decode_inner( mem, alloc_mem, ctx );
7472 0 : return self;
7473 0 : }
7474 0 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant ) {
7475 0 : switch( discriminant ) {
7476 0 : case 0: {
7477 0 : fd_vote_init_new( &self->initialize_account );
7478 0 : break;
7479 0 : }
7480 0 : case 1: {
7481 0 : fd_vote_authorize_pubkey_new( &self->authorize );
7482 0 : break;
7483 0 : }
7484 0 : case 2: {
7485 0 : fd_vote_new( &self->vote );
7486 0 : break;
7487 0 : }
7488 0 : case 3: {
7489 0 : break;
7490 0 : }
7491 0 : case 4: {
7492 0 : break;
7493 0 : }
7494 0 : case 5: {
7495 0 : break;
7496 0 : }
7497 0 : case 6: {
7498 0 : fd_vote_switch_new( &self->vote_switch );
7499 0 : break;
7500 0 : }
7501 0 : case 7: {
7502 0 : fd_vote_authorize_new( &self->authorize_checked );
7503 0 : break;
7504 0 : }
7505 0 : case 8: {
7506 0 : fd_vote_state_update_new( &self->update_vote_state );
7507 0 : break;
7508 0 : }
7509 0 : case 9: {
7510 0 : fd_update_vote_state_switch_new( &self->update_vote_state_switch );
7511 0 : break;
7512 0 : }
7513 0 : case 10: {
7514 0 : fd_vote_authorize_with_seed_args_new( &self->authorize_with_seed );
7515 0 : break;
7516 0 : }
7517 0 : case 11: {
7518 0 : fd_vote_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
7519 0 : break;
7520 0 : }
7521 0 : case 12: {
7522 0 : fd_compact_vote_state_update_new( &self->compact_update_vote_state );
7523 0 : break;
7524 0 : }
7525 0 : case 13: {
7526 0 : fd_compact_vote_state_update_switch_new( &self->compact_update_vote_state_switch );
7527 0 : break;
7528 0 : }
7529 0 : case 14: {
7530 0 : fd_tower_sync_new( &self->tower_sync );
7531 0 : break;
7532 0 : }
7533 0 : case 15: {
7534 0 : fd_tower_sync_switch_new( &self->tower_sync_switch );
7535 0 : break;
7536 0 : }
7537 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7538 0 : }
7539 0 : }
7540 0 : void fd_vote_instruction_new_disc( fd_vote_instruction_t * self, uint discriminant ) {
7541 0 : self->discriminant = discriminant;
7542 0 : fd_vote_instruction_inner_new( &self->inner, self->discriminant );
7543 0 : }
7544 0 : void fd_vote_instruction_new( fd_vote_instruction_t * self ) {
7545 0 : fd_memset( self, 0, sizeof(fd_vote_instruction_t) );
7546 0 : fd_vote_instruction_new_disc( self, UINT_MAX );
7547 0 : }
7548 :
7549 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 ) {
7550 0 : (void) varint;
7551 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_instruction", level++, 0);
7552 0 : switch( self->discriminant ) {
7553 0 : case 0: {
7554 0 : fun( w, self, "initialize_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7555 0 : fd_vote_init_walk( w, &self->inner.initialize_account, fun, "initialize_account", level, 0 );
7556 0 : break;
7557 0 : }
7558 0 : case 1: {
7559 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7560 0 : fd_vote_authorize_pubkey_walk( w, &self->inner.authorize, fun, "authorize", level, 0 );
7561 0 : break;
7562 0 : }
7563 0 : case 2: {
7564 0 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7565 0 : fd_vote_walk( w, &self->inner.vote, fun, "vote", level, 0 );
7566 0 : break;
7567 0 : }
7568 0 : case 3: {
7569 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7570 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7571 0 : break;
7572 0 : }
7573 0 : case 4: {
7574 0 : fun( w, self, "update_validator_identity", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7575 0 : break;
7576 0 : }
7577 0 : case 5: {
7578 0 : fun( w, self, "update_commission", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7579 0 : fun( w, &self->inner.update_commission, "update_commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7580 0 : break;
7581 0 : }
7582 0 : case 6: {
7583 0 : fun( w, self, "vote_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7584 0 : fd_vote_switch_walk( w, &self->inner.vote_switch, fun, "vote_switch", level, 0 );
7585 0 : break;
7586 0 : }
7587 0 : case 7: {
7588 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7589 0 : fd_vote_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level, 0 );
7590 0 : break;
7591 0 : }
7592 0 : case 8: {
7593 0 : fun( w, self, "update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7594 0 : fd_vote_state_update_walk( w, &self->inner.update_vote_state, fun, "update_vote_state", level, 0 );
7595 0 : break;
7596 0 : }
7597 0 : case 9: {
7598 0 : fun( w, self, "update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7599 0 : fd_update_vote_state_switch_walk( w, &self->inner.update_vote_state_switch, fun, "update_vote_state_switch", level, 0 );
7600 0 : break;
7601 0 : }
7602 0 : case 10: {
7603 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7604 0 : fd_vote_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level, 0 );
7605 0 : break;
7606 0 : }
7607 0 : case 11: {
7608 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7609 0 : fd_vote_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level, 0 );
7610 0 : break;
7611 0 : }
7612 0 : case 12: {
7613 0 : fun( w, self, "compact_update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7614 0 : fd_compact_vote_state_update_walk( w, &self->inner.compact_update_vote_state, fun, "compact_update_vote_state", level, 0 );
7615 0 : break;
7616 0 : }
7617 0 : case 13: {
7618 0 : fun( w, self, "compact_update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7619 0 : fd_compact_vote_state_update_switch_walk( w, &self->inner.compact_update_vote_state_switch, fun, "compact_update_vote_state_switch", level, 0 );
7620 0 : break;
7621 0 : }
7622 0 : case 14: {
7623 0 : fun( w, self, "tower_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7624 0 : fd_tower_sync_walk( w, &self->inner.tower_sync, fun, "tower_sync", level, 0 );
7625 0 : break;
7626 0 : }
7627 0 : case 15: {
7628 0 : fun( w, self, "tower_sync_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7629 0 : fd_tower_sync_switch_walk( w, &self->inner.tower_sync_switch, fun, "tower_sync_switch", level, 0 );
7630 0 : break;
7631 0 : }
7632 0 : }
7633 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_instruction", level--, 0 );
7634 0 : }
7635 0 : ulong fd_vote_instruction_size( fd_vote_instruction_t const * self ) {
7636 0 : ulong size = 0;
7637 0 : size += sizeof(uint);
7638 0 : switch (self->discriminant) {
7639 0 : case 0: {
7640 0 : size += fd_vote_init_size( &self->inner.initialize_account );
7641 0 : break;
7642 0 : }
7643 0 : case 1: {
7644 0 : size += fd_vote_authorize_pubkey_size( &self->inner.authorize );
7645 0 : break;
7646 0 : }
7647 0 : case 2: {
7648 0 : size += fd_vote_size( &self->inner.vote );
7649 0 : break;
7650 0 : }
7651 0 : case 3: {
7652 0 : size += sizeof(ulong);
7653 0 : break;
7654 0 : }
7655 0 : case 5: {
7656 0 : size += sizeof(char);
7657 0 : break;
7658 0 : }
7659 0 : case 6: {
7660 0 : size += fd_vote_switch_size( &self->inner.vote_switch );
7661 0 : break;
7662 0 : }
7663 0 : case 7: {
7664 0 : size += fd_vote_authorize_size( &self->inner.authorize_checked );
7665 0 : break;
7666 0 : }
7667 0 : case 8: {
7668 0 : size += fd_vote_state_update_size( &self->inner.update_vote_state );
7669 0 : break;
7670 0 : }
7671 0 : case 9: {
7672 0 : size += fd_update_vote_state_switch_size( &self->inner.update_vote_state_switch );
7673 0 : break;
7674 0 : }
7675 0 : case 10: {
7676 0 : size += fd_vote_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
7677 0 : break;
7678 0 : }
7679 0 : case 11: {
7680 0 : size += fd_vote_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
7681 0 : break;
7682 0 : }
7683 0 : case 12: {
7684 0 : size += fd_compact_vote_state_update_size( &self->inner.compact_update_vote_state );
7685 0 : break;
7686 0 : }
7687 0 : case 13: {
7688 0 : size += fd_compact_vote_state_update_switch_size( &self->inner.compact_update_vote_state_switch );
7689 0 : break;
7690 0 : }
7691 0 : case 14: {
7692 0 : size += fd_tower_sync_size( &self->inner.tower_sync );
7693 0 : break;
7694 0 : }
7695 0 : case 15: {
7696 0 : size += fd_tower_sync_switch_size( &self->inner.tower_sync_switch );
7697 0 : break;
7698 0 : }
7699 0 : }
7700 0 : return size;
7701 0 : }
7702 :
7703 0 : int fd_vote_instruction_inner_encode( fd_vote_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7704 0 : int err;
7705 0 : switch (discriminant) {
7706 0 : case 0: {
7707 0 : err = fd_vote_init_encode( &self->initialize_account, ctx );
7708 0 : if( FD_UNLIKELY( err ) ) return err;
7709 0 : break;
7710 0 : }
7711 0 : case 1: {
7712 0 : err = fd_vote_authorize_pubkey_encode( &self->authorize, ctx );
7713 0 : if( FD_UNLIKELY( err ) ) return err;
7714 0 : break;
7715 0 : }
7716 0 : case 2: {
7717 0 : err = fd_vote_encode( &self->vote, ctx );
7718 0 : if( FD_UNLIKELY( err ) ) return err;
7719 0 : break;
7720 0 : }
7721 0 : case 3: {
7722 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
7723 0 : if( FD_UNLIKELY( err ) ) return err;
7724 0 : break;
7725 0 : }
7726 0 : case 5: {
7727 0 : err = fd_bincode_uint8_encode( (uchar)(self->update_commission), ctx );
7728 0 : if( FD_UNLIKELY( err ) ) return err;
7729 0 : break;
7730 0 : }
7731 0 : case 6: {
7732 0 : err = fd_vote_switch_encode( &self->vote_switch, ctx );
7733 0 : if( FD_UNLIKELY( err ) ) return err;
7734 0 : break;
7735 0 : }
7736 0 : case 7: {
7737 0 : err = fd_vote_authorize_encode( &self->authorize_checked, ctx );
7738 0 : if( FD_UNLIKELY( err ) ) return err;
7739 0 : break;
7740 0 : }
7741 0 : case 8: {
7742 0 : err = fd_vote_state_update_encode( &self->update_vote_state, ctx );
7743 0 : if( FD_UNLIKELY( err ) ) return err;
7744 0 : break;
7745 0 : }
7746 0 : case 9: {
7747 0 : err = fd_update_vote_state_switch_encode( &self->update_vote_state_switch, ctx );
7748 0 : if( FD_UNLIKELY( err ) ) return err;
7749 0 : break;
7750 0 : }
7751 0 : case 10: {
7752 0 : err = fd_vote_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
7753 0 : if( FD_UNLIKELY( err ) ) return err;
7754 0 : break;
7755 0 : }
7756 0 : case 11: {
7757 0 : err = fd_vote_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
7758 0 : if( FD_UNLIKELY( err ) ) return err;
7759 0 : break;
7760 0 : }
7761 0 : case 12: {
7762 0 : err = fd_compact_vote_state_update_encode( &self->compact_update_vote_state, ctx );
7763 0 : if( FD_UNLIKELY( err ) ) return err;
7764 0 : break;
7765 0 : }
7766 0 : case 13: {
7767 0 : err = fd_compact_vote_state_update_switch_encode( &self->compact_update_vote_state_switch, ctx );
7768 0 : if( FD_UNLIKELY( err ) ) return err;
7769 0 : break;
7770 0 : }
7771 0 : case 14: {
7772 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
7773 0 : if( FD_UNLIKELY( err ) ) return err;
7774 0 : break;
7775 0 : }
7776 0 : case 15: {
7777 0 : err = fd_tower_sync_switch_encode( &self->tower_sync_switch, ctx );
7778 0 : if( FD_UNLIKELY( err ) ) return err;
7779 0 : break;
7780 0 : }
7781 0 : }
7782 0 : return FD_BINCODE_SUCCESS;
7783 0 : }
7784 0 : int fd_vote_instruction_encode( fd_vote_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7785 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7786 0 : if( FD_UNLIKELY( err ) ) return err;
7787 0 : return fd_vote_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7788 0 : }
7789 :
7790 0 : int fd_system_program_instruction_create_account_encode( fd_system_program_instruction_create_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7791 0 : int err;
7792 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
7793 0 : if( FD_UNLIKELY( err ) ) return err;
7794 0 : err = fd_bincode_uint64_encode( self->space, ctx );
7795 0 : if( FD_UNLIKELY( err ) ) return err;
7796 0 : err = fd_pubkey_encode( &self->owner, ctx );
7797 0 : if( FD_UNLIKELY( err ) ) return err;
7798 0 : return FD_BINCODE_SUCCESS;
7799 0 : }
7800 0 : static inline int fd_system_program_instruction_create_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7801 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7802 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
7803 0 : return 0;
7804 0 : }
7805 0 : static void fd_system_program_instruction_create_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7806 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)struct_mem;
7807 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
7808 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
7809 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
7810 0 : }
7811 0 : void * fd_system_program_instruction_create_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7812 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)mem;
7813 0 : fd_system_program_instruction_create_account_new( self );
7814 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_t);
7815 0 : void * * alloc_mem = &alloc_region;
7816 0 : fd_system_program_instruction_create_account_decode_inner( mem, alloc_mem, ctx );
7817 0 : return self;
7818 0 : }
7819 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 ) {
7820 0 : (void) varint;
7821 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account", level++, 0 );
7822 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7823 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7824 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
7825 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account", level--, 0 );
7826 0 : }
7827 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 ) {
7828 0 : int err;
7829 0 : err = fd_pubkey_encode( &self->base, ctx );
7830 0 : if( FD_UNLIKELY( err ) ) return err;
7831 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
7832 0 : if( FD_UNLIKELY(err) ) return err;
7833 0 : if( self->seed_len ) {
7834 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
7835 0 : if( FD_UNLIKELY( err ) ) return err;
7836 0 : }
7837 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
7838 0 : if( FD_UNLIKELY( err ) ) return err;
7839 0 : err = fd_bincode_uint64_encode( self->space, ctx );
7840 0 : if( FD_UNLIKELY( err ) ) return err;
7841 0 : err = fd_pubkey_encode( &self->owner, ctx );
7842 0 : if( FD_UNLIKELY( err ) ) return err;
7843 0 : return FD_BINCODE_SUCCESS;
7844 0 : }
7845 0 : static int fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7846 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7847 0 : int err = 0;
7848 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7849 0 : if( FD_UNLIKELY( err ) ) return err;
7850 0 : ulong seed_len;
7851 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
7852 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7853 0 : *total_sz += seed_len;
7854 0 : if( seed_len ) {
7855 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
7856 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7857 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
7858 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7859 0 : }
7860 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7861 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7862 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7863 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7864 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7865 0 : if( FD_UNLIKELY( err ) ) return err;
7866 0 : return 0;
7867 0 : }
7868 0 : int fd_system_program_instruction_create_account_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7869 0 : *total_sz += sizeof(fd_system_program_instruction_create_account_with_seed_t);
7870 0 : void const * start_data = ctx->data;
7871 0 : int err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
7872 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7873 0 : ctx->data = start_data;
7874 0 : return err;
7875 0 : }
7876 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 ) {
7877 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)struct_mem;
7878 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
7879 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
7880 0 : if( self->seed_len ) {
7881 0 : self->seed = *alloc_mem;
7882 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
7883 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
7884 0 : } else
7885 0 : self->seed = NULL;
7886 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
7887 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
7888 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
7889 0 : }
7890 0 : void * fd_system_program_instruction_create_account_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7891 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)mem;
7892 0 : fd_system_program_instruction_create_account_with_seed_new( self );
7893 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_with_seed_t);
7894 0 : void * * alloc_mem = &alloc_region;
7895 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( mem, alloc_mem, ctx );
7896 0 : return self;
7897 0 : }
7898 0 : void fd_system_program_instruction_create_account_with_seed_new(fd_system_program_instruction_create_account_with_seed_t * self) {
7899 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_with_seed_t) );
7900 0 : fd_pubkey_new( &self->base );
7901 0 : fd_pubkey_new( &self->owner );
7902 0 : }
7903 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 ) {
7904 0 : (void) varint;
7905 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account_with_seed", level++, 0 );
7906 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
7907 0 : if( self->seed_len ) {
7908 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
7909 0 : for( ulong i=0; i < self->seed_len; i++ )
7910 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7911 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
7912 0 : }
7913 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7914 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7915 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
7916 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account_with_seed", level--, 0 );
7917 0 : }
7918 0 : ulong fd_system_program_instruction_create_account_with_seed_size( fd_system_program_instruction_create_account_with_seed_t const * self ) {
7919 0 : ulong size = 0;
7920 0 : size += fd_pubkey_size( &self->base );
7921 0 : do {
7922 0 : size += sizeof(ulong);
7923 0 : size += self->seed_len;
7924 0 : } while(0);
7925 0 : size += sizeof(ulong);
7926 0 : size += sizeof(ulong);
7927 0 : size += fd_pubkey_size( &self->owner );
7928 0 : return size;
7929 0 : }
7930 :
7931 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 ) {
7932 0 : int err;
7933 0 : err = fd_pubkey_encode( &self->base, ctx );
7934 0 : if( FD_UNLIKELY( err ) ) return err;
7935 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
7936 0 : if( FD_UNLIKELY(err) ) return err;
7937 0 : if( self->seed_len ) {
7938 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
7939 0 : if( FD_UNLIKELY( err ) ) return err;
7940 0 : }
7941 0 : err = fd_bincode_uint64_encode( self->space, ctx );
7942 0 : if( FD_UNLIKELY( err ) ) return err;
7943 0 : err = fd_pubkey_encode( &self->owner, ctx );
7944 0 : if( FD_UNLIKELY( err ) ) return err;
7945 0 : return FD_BINCODE_SUCCESS;
7946 0 : }
7947 0 : static int fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7948 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7949 0 : int err = 0;
7950 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7951 0 : if( FD_UNLIKELY( err ) ) return err;
7952 0 : ulong seed_len;
7953 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
7954 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7955 0 : *total_sz += seed_len;
7956 0 : if( seed_len ) {
7957 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
7958 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7959 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
7960 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7961 0 : }
7962 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7963 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7964 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7965 0 : if( FD_UNLIKELY( err ) ) return err;
7966 0 : return 0;
7967 0 : }
7968 0 : int fd_system_program_instruction_allocate_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7969 0 : *total_sz += sizeof(fd_system_program_instruction_allocate_with_seed_t);
7970 0 : void const * start_data = ctx->data;
7971 0 : int err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
7972 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7973 0 : ctx->data = start_data;
7974 0 : return err;
7975 0 : }
7976 0 : static void fd_system_program_instruction_allocate_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7977 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)struct_mem;
7978 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
7979 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
7980 0 : if( self->seed_len ) {
7981 0 : self->seed = *alloc_mem;
7982 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
7983 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
7984 0 : } else
7985 0 : self->seed = NULL;
7986 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
7987 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
7988 0 : }
7989 0 : void * fd_system_program_instruction_allocate_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7990 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)mem;
7991 0 : fd_system_program_instruction_allocate_with_seed_new( self );
7992 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_allocate_with_seed_t);
7993 0 : void * * alloc_mem = &alloc_region;
7994 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( mem, alloc_mem, ctx );
7995 0 : return self;
7996 0 : }
7997 0 : void fd_system_program_instruction_allocate_with_seed_new(fd_system_program_instruction_allocate_with_seed_t * self) {
7998 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_allocate_with_seed_t) );
7999 0 : fd_pubkey_new( &self->base );
8000 0 : fd_pubkey_new( &self->owner );
8001 0 : }
8002 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 ) {
8003 0 : (void) varint;
8004 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_allocate_with_seed", level++, 0 );
8005 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
8006 0 : if( self->seed_len ) {
8007 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
8008 0 : for( ulong i=0; i < self->seed_len; i++ )
8009 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
8010 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
8011 0 : }
8012 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8013 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
8014 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_allocate_with_seed", level--, 0 );
8015 0 : }
8016 0 : ulong fd_system_program_instruction_allocate_with_seed_size( fd_system_program_instruction_allocate_with_seed_t const * self ) {
8017 0 : ulong size = 0;
8018 0 : size += fd_pubkey_size( &self->base );
8019 0 : do {
8020 0 : size += sizeof(ulong);
8021 0 : size += self->seed_len;
8022 0 : } while(0);
8023 0 : size += sizeof(ulong);
8024 0 : size += fd_pubkey_size( &self->owner );
8025 0 : return size;
8026 0 : }
8027 :
8028 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 ) {
8029 0 : int err;
8030 0 : err = fd_pubkey_encode( &self->base, ctx );
8031 0 : if( FD_UNLIKELY( err ) ) return err;
8032 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
8033 0 : if( FD_UNLIKELY(err) ) return err;
8034 0 : if( self->seed_len ) {
8035 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
8036 0 : if( FD_UNLIKELY( err ) ) return err;
8037 0 : }
8038 0 : err = fd_pubkey_encode( &self->owner, ctx );
8039 0 : if( FD_UNLIKELY( err ) ) return err;
8040 0 : return FD_BINCODE_SUCCESS;
8041 0 : }
8042 0 : static int fd_system_program_instruction_assign_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8043 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8044 0 : int err = 0;
8045 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8046 0 : if( FD_UNLIKELY( err ) ) return err;
8047 0 : ulong seed_len;
8048 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
8049 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8050 0 : *total_sz += seed_len;
8051 0 : if( seed_len ) {
8052 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
8053 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8054 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
8055 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8056 0 : }
8057 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8058 0 : if( FD_UNLIKELY( err ) ) return err;
8059 0 : return 0;
8060 0 : }
8061 0 : int fd_system_program_instruction_assign_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8062 0 : *total_sz += sizeof(fd_system_program_instruction_assign_with_seed_t);
8063 0 : void const * start_data = ctx->data;
8064 0 : int err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
8065 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8066 0 : ctx->data = start_data;
8067 0 : return err;
8068 0 : }
8069 0 : static void fd_system_program_instruction_assign_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8070 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)struct_mem;
8071 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
8072 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
8073 0 : if( self->seed_len ) {
8074 0 : self->seed = *alloc_mem;
8075 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
8076 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
8077 0 : } else
8078 0 : self->seed = NULL;
8079 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
8080 0 : }
8081 0 : void * fd_system_program_instruction_assign_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8082 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)mem;
8083 0 : fd_system_program_instruction_assign_with_seed_new( self );
8084 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_assign_with_seed_t);
8085 0 : void * * alloc_mem = &alloc_region;
8086 0 : fd_system_program_instruction_assign_with_seed_decode_inner( mem, alloc_mem, ctx );
8087 0 : return self;
8088 0 : }
8089 0 : void fd_system_program_instruction_assign_with_seed_new(fd_system_program_instruction_assign_with_seed_t * self) {
8090 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_assign_with_seed_t) );
8091 0 : fd_pubkey_new( &self->base );
8092 0 : fd_pubkey_new( &self->owner );
8093 0 : }
8094 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 ) {
8095 0 : (void) varint;
8096 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_assign_with_seed", level++, 0 );
8097 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
8098 0 : if( self->seed_len ) {
8099 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
8100 0 : for( ulong i=0; i < self->seed_len; i++ )
8101 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
8102 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
8103 0 : }
8104 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
8105 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_assign_with_seed", level--, 0 );
8106 0 : }
8107 0 : ulong fd_system_program_instruction_assign_with_seed_size( fd_system_program_instruction_assign_with_seed_t const * self ) {
8108 0 : ulong size = 0;
8109 0 : size += fd_pubkey_size( &self->base );
8110 0 : do {
8111 0 : size += sizeof(ulong);
8112 0 : size += self->seed_len;
8113 0 : } while(0);
8114 0 : size += fd_pubkey_size( &self->owner );
8115 0 : return size;
8116 0 : }
8117 :
8118 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 ) {
8119 0 : int err;
8120 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
8121 0 : if( FD_UNLIKELY( err ) ) return err;
8122 0 : err = fd_bincode_uint64_encode( self->from_seed_len, ctx );
8123 0 : if( FD_UNLIKELY(err) ) return err;
8124 0 : if( self->from_seed_len ) {
8125 0 : err = fd_bincode_bytes_encode( self->from_seed, self->from_seed_len, ctx );
8126 0 : if( FD_UNLIKELY( err ) ) return err;
8127 0 : }
8128 0 : err = fd_pubkey_encode( &self->from_owner, ctx );
8129 0 : if( FD_UNLIKELY( err ) ) return err;
8130 0 : return FD_BINCODE_SUCCESS;
8131 0 : }
8132 0 : static int fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8133 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8134 0 : int err = 0;
8135 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8136 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8137 0 : ulong from_seed_len;
8138 0 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
8139 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8140 0 : *total_sz += from_seed_len;
8141 0 : if( from_seed_len ) {
8142 0 : err = fd_bincode_bytes_decode_footprint( from_seed_len, ctx );
8143 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8144 0 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
8145 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8146 0 : }
8147 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8148 0 : if( FD_UNLIKELY( err ) ) return err;
8149 0 : return 0;
8150 0 : }
8151 0 : int fd_system_program_instruction_transfer_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8152 0 : *total_sz += sizeof(fd_system_program_instruction_transfer_with_seed_t);
8153 0 : void const * start_data = ctx->data;
8154 0 : int err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
8155 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8156 0 : ctx->data = start_data;
8157 0 : return err;
8158 0 : }
8159 0 : static void fd_system_program_instruction_transfer_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8160 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)struct_mem;
8161 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
8162 0 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
8163 0 : if( self->from_seed_len ) {
8164 0 : self->from_seed = *alloc_mem;
8165 0 : fd_bincode_bytes_decode_unsafe( self->from_seed, self->from_seed_len, ctx );
8166 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->from_seed_len;
8167 0 : } else
8168 0 : self->from_seed = NULL;
8169 0 : fd_pubkey_decode_inner( &self->from_owner, alloc_mem, ctx );
8170 0 : }
8171 0 : void * fd_system_program_instruction_transfer_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8172 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)mem;
8173 0 : fd_system_program_instruction_transfer_with_seed_new( self );
8174 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_transfer_with_seed_t);
8175 0 : void * * alloc_mem = &alloc_region;
8176 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( mem, alloc_mem, ctx );
8177 0 : return self;
8178 0 : }
8179 0 : void fd_system_program_instruction_transfer_with_seed_new(fd_system_program_instruction_transfer_with_seed_t * self) {
8180 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_transfer_with_seed_t) );
8181 0 : fd_pubkey_new( &self->from_owner );
8182 0 : }
8183 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 ) {
8184 0 : (void) varint;
8185 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_transfer_with_seed", level++, 0 );
8186 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8187 0 : if( self->from_seed_len ) {
8188 0 : fun( w, NULL, "from_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
8189 0 : for( ulong i=0; i < self->from_seed_len; i++ )
8190 0 : fun( w, self->from_seed + i, "from_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
8191 0 : fun( w, NULL, "from_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
8192 0 : }
8193 0 : fd_pubkey_walk( w, &self->from_owner, fun, "from_owner", level, 0 );
8194 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_transfer_with_seed", level--, 0 );
8195 0 : }
8196 0 : ulong fd_system_program_instruction_transfer_with_seed_size( fd_system_program_instruction_transfer_with_seed_t const * self ) {
8197 0 : ulong size = 0;
8198 0 : size += sizeof(ulong);
8199 0 : do {
8200 0 : size += sizeof(ulong);
8201 0 : size += self->from_seed_len;
8202 0 : } while(0);
8203 0 : size += fd_pubkey_size( &self->from_owner );
8204 0 : return size;
8205 0 : }
8206 :
8207 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account(fd_system_program_instruction_t const * self) {
8208 0 : return self->discriminant == 0;
8209 0 : }
8210 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign(fd_system_program_instruction_t const * self) {
8211 0 : return self->discriminant == 1;
8212 0 : }
8213 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer(fd_system_program_instruction_t const * self) {
8214 0 : return self->discriminant == 2;
8215 0 : }
8216 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_with_seed(fd_system_program_instruction_t const * self) {
8217 0 : return self->discriminant == 3;
8218 0 : }
8219 0 : FD_FN_PURE uchar fd_system_program_instruction_is_advance_nonce_account(fd_system_program_instruction_t const * self) {
8220 0 : return self->discriminant == 4;
8221 0 : }
8222 0 : FD_FN_PURE uchar fd_system_program_instruction_is_withdraw_nonce_account(fd_system_program_instruction_t const * self) {
8223 0 : return self->discriminant == 5;
8224 0 : }
8225 0 : FD_FN_PURE uchar fd_system_program_instruction_is_initialize_nonce_account(fd_system_program_instruction_t const * self) {
8226 0 : return self->discriminant == 6;
8227 0 : }
8228 0 : FD_FN_PURE uchar fd_system_program_instruction_is_authorize_nonce_account(fd_system_program_instruction_t const * self) {
8229 0 : return self->discriminant == 7;
8230 0 : }
8231 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate(fd_system_program_instruction_t const * self) {
8232 0 : return self->discriminant == 8;
8233 0 : }
8234 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate_with_seed(fd_system_program_instruction_t const * self) {
8235 0 : return self->discriminant == 9;
8236 0 : }
8237 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign_with_seed(fd_system_program_instruction_t const * self) {
8238 0 : return self->discriminant == 10;
8239 0 : }
8240 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer_with_seed(fd_system_program_instruction_t const * self) {
8241 0 : return self->discriminant == 11;
8242 0 : }
8243 0 : FD_FN_PURE uchar fd_system_program_instruction_is_upgrade_nonce_account(fd_system_program_instruction_t const * self) {
8244 0 : return self->discriminant == 12;
8245 0 : }
8246 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant );
8247 0 : int fd_system_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8248 0 : int err;
8249 0 : switch (discriminant) {
8250 0 : case 0: {
8251 0 : err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
8252 0 : if( FD_UNLIKELY( err ) ) return err;
8253 0 : return FD_BINCODE_SUCCESS;
8254 0 : }
8255 0 : case 1: {
8256 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8257 0 : if( FD_UNLIKELY( err ) ) return err;
8258 0 : return FD_BINCODE_SUCCESS;
8259 0 : }
8260 0 : case 2: {
8261 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8262 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8263 0 : return FD_BINCODE_SUCCESS;
8264 0 : }
8265 0 : case 3: {
8266 0 : err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
8267 0 : if( FD_UNLIKELY( err ) ) return err;
8268 0 : return FD_BINCODE_SUCCESS;
8269 0 : }
8270 0 : case 4: {
8271 0 : return FD_BINCODE_SUCCESS;
8272 0 : }
8273 0 : case 5: {
8274 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8275 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8276 0 : return FD_BINCODE_SUCCESS;
8277 0 : }
8278 0 : case 6: {
8279 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8280 0 : if( FD_UNLIKELY( err ) ) return err;
8281 0 : return FD_BINCODE_SUCCESS;
8282 0 : }
8283 0 : case 7: {
8284 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8285 0 : if( FD_UNLIKELY( err ) ) return err;
8286 0 : return FD_BINCODE_SUCCESS;
8287 0 : }
8288 0 : case 8: {
8289 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8290 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8291 0 : return FD_BINCODE_SUCCESS;
8292 0 : }
8293 0 : case 9: {
8294 0 : err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
8295 0 : if( FD_UNLIKELY( err ) ) return err;
8296 0 : return FD_BINCODE_SUCCESS;
8297 0 : }
8298 0 : case 10: {
8299 0 : err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
8300 0 : if( FD_UNLIKELY( err ) ) return err;
8301 0 : return FD_BINCODE_SUCCESS;
8302 0 : }
8303 0 : case 11: {
8304 0 : err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
8305 0 : if( FD_UNLIKELY( err ) ) return err;
8306 0 : return FD_BINCODE_SUCCESS;
8307 0 : }
8308 0 : case 12: {
8309 0 : return FD_BINCODE_SUCCESS;
8310 0 : }
8311 0 : default: return FD_BINCODE_ERR_ENCODING;
8312 0 : }
8313 0 : }
8314 0 : static int fd_system_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8315 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8316 0 : uint discriminant = 0;
8317 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8318 0 : if( FD_UNLIKELY( err ) ) return err;
8319 0 : return fd_system_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
8320 0 : }
8321 0 : int fd_system_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8322 0 : *total_sz += sizeof(fd_system_program_instruction_t);
8323 0 : void const * start_data = ctx->data;
8324 0 : int err = fd_system_program_instruction_decode_footprint_inner( ctx, total_sz );
8325 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8326 0 : ctx->data = start_data;
8327 0 : return err;
8328 0 : }
8329 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 ) {
8330 0 : switch (discriminant) {
8331 0 : case 0: {
8332 0 : fd_system_program_instruction_create_account_decode_inner( &self->create_account, alloc_mem, ctx );
8333 0 : break;
8334 0 : }
8335 0 : case 1: {
8336 0 : fd_pubkey_decode_inner( &self->assign, alloc_mem, ctx );
8337 0 : break;
8338 0 : }
8339 0 : case 2: {
8340 0 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
8341 0 : break;
8342 0 : }
8343 0 : case 3: {
8344 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( &self->create_account_with_seed, alloc_mem, ctx );
8345 0 : break;
8346 0 : }
8347 0 : case 4: {
8348 0 : break;
8349 0 : }
8350 0 : case 5: {
8351 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
8352 0 : break;
8353 0 : }
8354 0 : case 6: {
8355 0 : fd_pubkey_decode_inner( &self->initialize_nonce_account, alloc_mem, ctx );
8356 0 : break;
8357 0 : }
8358 0 : case 7: {
8359 0 : fd_pubkey_decode_inner( &self->authorize_nonce_account, alloc_mem, ctx );
8360 0 : break;
8361 0 : }
8362 0 : case 8: {
8363 0 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
8364 0 : break;
8365 0 : }
8366 0 : case 9: {
8367 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( &self->allocate_with_seed, alloc_mem, ctx );
8368 0 : break;
8369 0 : }
8370 0 : case 10: {
8371 0 : fd_system_program_instruction_assign_with_seed_decode_inner( &self->assign_with_seed, alloc_mem, ctx );
8372 0 : break;
8373 0 : }
8374 0 : case 11: {
8375 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( &self->transfer_with_seed, alloc_mem, ctx );
8376 0 : break;
8377 0 : }
8378 0 : case 12: {
8379 0 : break;
8380 0 : }
8381 0 : }
8382 0 : }
8383 0 : static void fd_system_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8384 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)struct_mem;
8385 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8386 0 : fd_system_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8387 0 : }
8388 0 : void * fd_system_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8389 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)mem;
8390 0 : fd_system_program_instruction_new( self );
8391 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_t);
8392 0 : void * * alloc_mem = &alloc_region;
8393 0 : fd_system_program_instruction_decode_inner( mem, alloc_mem, ctx );
8394 0 : return self;
8395 0 : }
8396 0 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant ) {
8397 0 : switch( discriminant ) {
8398 0 : case 0: {
8399 0 : fd_system_program_instruction_create_account_new( &self->create_account );
8400 0 : break;
8401 0 : }
8402 0 : case 1: {
8403 0 : fd_pubkey_new( &self->assign );
8404 0 : break;
8405 0 : }
8406 0 : case 2: {
8407 0 : break;
8408 0 : }
8409 0 : case 3: {
8410 0 : fd_system_program_instruction_create_account_with_seed_new( &self->create_account_with_seed );
8411 0 : break;
8412 0 : }
8413 0 : case 4: {
8414 0 : break;
8415 0 : }
8416 0 : case 5: {
8417 0 : break;
8418 0 : }
8419 0 : case 6: {
8420 0 : fd_pubkey_new( &self->initialize_nonce_account );
8421 0 : break;
8422 0 : }
8423 0 : case 7: {
8424 0 : fd_pubkey_new( &self->authorize_nonce_account );
8425 0 : break;
8426 0 : }
8427 0 : case 8: {
8428 0 : break;
8429 0 : }
8430 0 : case 9: {
8431 0 : fd_system_program_instruction_allocate_with_seed_new( &self->allocate_with_seed );
8432 0 : break;
8433 0 : }
8434 0 : case 10: {
8435 0 : fd_system_program_instruction_assign_with_seed_new( &self->assign_with_seed );
8436 0 : break;
8437 0 : }
8438 0 : case 11: {
8439 0 : fd_system_program_instruction_transfer_with_seed_new( &self->transfer_with_seed );
8440 0 : break;
8441 0 : }
8442 0 : case 12: {
8443 0 : break;
8444 0 : }
8445 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8446 0 : }
8447 0 : }
8448 0 : void fd_system_program_instruction_new_disc( fd_system_program_instruction_t * self, uint discriminant ) {
8449 0 : self->discriminant = discriminant;
8450 0 : fd_system_program_instruction_inner_new( &self->inner, self->discriminant );
8451 0 : }
8452 0 : void fd_system_program_instruction_new( fd_system_program_instruction_t * self ) {
8453 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_t) );
8454 0 : fd_system_program_instruction_new_disc( self, UINT_MAX );
8455 0 : }
8456 :
8457 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 ) {
8458 0 : (void) varint;
8459 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_program_instruction", level++, 0);
8460 0 : switch( self->discriminant ) {
8461 0 : case 0: {
8462 0 : fun( w, self, "create_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8463 0 : fd_system_program_instruction_create_account_walk( w, &self->inner.create_account, fun, "create_account", level, 0 );
8464 0 : break;
8465 0 : }
8466 0 : case 1: {
8467 0 : fun( w, self, "assign", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8468 0 : fd_pubkey_walk( w, &self->inner.assign, fun, "assign", level, 0 );
8469 0 : break;
8470 0 : }
8471 0 : case 2: {
8472 0 : fun( w, self, "transfer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8473 0 : fun( w, &self->inner.transfer, "transfer", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8474 0 : break;
8475 0 : }
8476 0 : case 3: {
8477 0 : fun( w, self, "create_account_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8478 0 : fd_system_program_instruction_create_account_with_seed_walk( w, &self->inner.create_account_with_seed, fun, "create_account_with_seed", level, 0 );
8479 0 : break;
8480 0 : }
8481 0 : case 4: {
8482 0 : fun( w, self, "advance_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8483 0 : break;
8484 0 : }
8485 0 : case 5: {
8486 0 : fun( w, self, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8487 0 : fun( w, &self->inner.withdraw_nonce_account, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8488 0 : break;
8489 0 : }
8490 0 : case 6: {
8491 0 : fun( w, self, "initialize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8492 0 : fd_pubkey_walk( w, &self->inner.initialize_nonce_account, fun, "initialize_nonce_account", level, 0 );
8493 0 : break;
8494 0 : }
8495 0 : case 7: {
8496 0 : fun( w, self, "authorize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8497 0 : fd_pubkey_walk( w, &self->inner.authorize_nonce_account, fun, "authorize_nonce_account", level, 0 );
8498 0 : break;
8499 0 : }
8500 0 : case 8: {
8501 0 : fun( w, self, "allocate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8502 0 : fun( w, &self->inner.allocate, "allocate", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8503 0 : break;
8504 0 : }
8505 0 : case 9: {
8506 0 : fun( w, self, "allocate_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8507 0 : fd_system_program_instruction_allocate_with_seed_walk( w, &self->inner.allocate_with_seed, fun, "allocate_with_seed", level, 0 );
8508 0 : break;
8509 0 : }
8510 0 : case 10: {
8511 0 : fun( w, self, "assign_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8512 0 : fd_system_program_instruction_assign_with_seed_walk( w, &self->inner.assign_with_seed, fun, "assign_with_seed", level, 0 );
8513 0 : break;
8514 0 : }
8515 0 : case 11: {
8516 0 : fun( w, self, "transfer_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8517 0 : fd_system_program_instruction_transfer_with_seed_walk( w, &self->inner.transfer_with_seed, fun, "transfer_with_seed", level, 0 );
8518 0 : break;
8519 0 : }
8520 0 : case 12: {
8521 0 : fun( w, self, "upgrade_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8522 0 : break;
8523 0 : }
8524 0 : }
8525 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_program_instruction", level--, 0 );
8526 0 : }
8527 0 : ulong fd_system_program_instruction_size( fd_system_program_instruction_t const * self ) {
8528 0 : ulong size = 0;
8529 0 : size += sizeof(uint);
8530 0 : switch (self->discriminant) {
8531 0 : case 0: {
8532 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account );
8533 0 : break;
8534 0 : }
8535 0 : case 1: {
8536 0 : size += fd_pubkey_size( &self->inner.assign );
8537 0 : break;
8538 0 : }
8539 0 : case 2: {
8540 0 : size += sizeof(ulong);
8541 0 : break;
8542 0 : }
8543 0 : case 3: {
8544 0 : size += fd_system_program_instruction_create_account_with_seed_size( &self->inner.create_account_with_seed );
8545 0 : break;
8546 0 : }
8547 0 : case 5: {
8548 0 : size += sizeof(ulong);
8549 0 : break;
8550 0 : }
8551 0 : case 6: {
8552 0 : size += fd_pubkey_size( &self->inner.initialize_nonce_account );
8553 0 : break;
8554 0 : }
8555 0 : case 7: {
8556 0 : size += fd_pubkey_size( &self->inner.authorize_nonce_account );
8557 0 : break;
8558 0 : }
8559 0 : case 8: {
8560 0 : size += sizeof(ulong);
8561 0 : break;
8562 0 : }
8563 0 : case 9: {
8564 0 : size += fd_system_program_instruction_allocate_with_seed_size( &self->inner.allocate_with_seed );
8565 0 : break;
8566 0 : }
8567 0 : case 10: {
8568 0 : size += fd_system_program_instruction_assign_with_seed_size( &self->inner.assign_with_seed );
8569 0 : break;
8570 0 : }
8571 0 : case 11: {
8572 0 : size += fd_system_program_instruction_transfer_with_seed_size( &self->inner.transfer_with_seed );
8573 0 : break;
8574 0 : }
8575 0 : }
8576 0 : return size;
8577 0 : }
8578 :
8579 0 : int fd_system_program_instruction_inner_encode( fd_system_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
8580 0 : int err;
8581 0 : switch (discriminant) {
8582 0 : case 0: {
8583 0 : err = fd_system_program_instruction_create_account_encode( &self->create_account, ctx );
8584 0 : if( FD_UNLIKELY( err ) ) return err;
8585 0 : break;
8586 0 : }
8587 0 : case 1: {
8588 0 : err = fd_pubkey_encode( &self->assign, ctx );
8589 0 : if( FD_UNLIKELY( err ) ) return err;
8590 0 : break;
8591 0 : }
8592 0 : case 2: {
8593 0 : err = fd_bincode_uint64_encode( self->transfer, ctx );
8594 0 : if( FD_UNLIKELY( err ) ) return err;
8595 0 : break;
8596 0 : }
8597 0 : case 3: {
8598 0 : err = fd_system_program_instruction_create_account_with_seed_encode( &self->create_account_with_seed, ctx );
8599 0 : if( FD_UNLIKELY( err ) ) return err;
8600 0 : break;
8601 0 : }
8602 0 : case 5: {
8603 0 : err = fd_bincode_uint64_encode( self->withdraw_nonce_account, ctx );
8604 0 : if( FD_UNLIKELY( err ) ) return err;
8605 0 : break;
8606 0 : }
8607 0 : case 6: {
8608 0 : err = fd_pubkey_encode( &self->initialize_nonce_account, ctx );
8609 0 : if( FD_UNLIKELY( err ) ) return err;
8610 0 : break;
8611 0 : }
8612 0 : case 7: {
8613 0 : err = fd_pubkey_encode( &self->authorize_nonce_account, ctx );
8614 0 : if( FD_UNLIKELY( err ) ) return err;
8615 0 : break;
8616 0 : }
8617 0 : case 8: {
8618 0 : err = fd_bincode_uint64_encode( self->allocate, ctx );
8619 0 : if( FD_UNLIKELY( err ) ) return err;
8620 0 : break;
8621 0 : }
8622 0 : case 9: {
8623 0 : err = fd_system_program_instruction_allocate_with_seed_encode( &self->allocate_with_seed, ctx );
8624 0 : if( FD_UNLIKELY( err ) ) return err;
8625 0 : break;
8626 0 : }
8627 0 : case 10: {
8628 0 : err = fd_system_program_instruction_assign_with_seed_encode( &self->assign_with_seed, ctx );
8629 0 : if( FD_UNLIKELY( err ) ) return err;
8630 0 : break;
8631 0 : }
8632 0 : case 11: {
8633 0 : err = fd_system_program_instruction_transfer_with_seed_encode( &self->transfer_with_seed, ctx );
8634 0 : if( FD_UNLIKELY( err ) ) return err;
8635 0 : break;
8636 0 : }
8637 0 : }
8638 0 : return FD_BINCODE_SUCCESS;
8639 0 : }
8640 0 : int fd_system_program_instruction_encode( fd_system_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8641 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8642 0 : if( FD_UNLIKELY( err ) ) return err;
8643 0 : return fd_system_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
8644 0 : }
8645 :
8646 0 : FD_FN_PURE uchar fd_system_error_is_account_already_in_use(fd_system_error_t const * self) {
8647 0 : return self->discriminant == 0;
8648 0 : }
8649 0 : FD_FN_PURE uchar fd_system_error_is_result_with_negative_lamports(fd_system_error_t const * self) {
8650 0 : return self->discriminant == 1;
8651 0 : }
8652 0 : FD_FN_PURE uchar fd_system_error_is_invalid_program_id(fd_system_error_t const * self) {
8653 0 : return self->discriminant == 2;
8654 0 : }
8655 0 : FD_FN_PURE uchar fd_system_error_is_invalid_account_data_length(fd_system_error_t const * self) {
8656 0 : return self->discriminant == 3;
8657 0 : }
8658 0 : FD_FN_PURE uchar fd_system_error_is_max_seed_length_exceeded(fd_system_error_t const * self) {
8659 0 : return self->discriminant == 4;
8660 0 : }
8661 0 : FD_FN_PURE uchar fd_system_error_is_address_with_seed_mismatch(fd_system_error_t const * self) {
8662 0 : return self->discriminant == 5;
8663 0 : }
8664 0 : FD_FN_PURE uchar fd_system_error_is_nonce_no_recent_blockhashes(fd_system_error_t const * self) {
8665 0 : return self->discriminant == 6;
8666 0 : }
8667 0 : FD_FN_PURE uchar fd_system_error_is_nonce_blockhash_not_expired(fd_system_error_t const * self) {
8668 0 : return self->discriminant == 7;
8669 0 : }
8670 0 : FD_FN_PURE uchar fd_system_error_is_nonce_unexpected_blockhash_value(fd_system_error_t const * self) {
8671 0 : return self->discriminant == 8;
8672 0 : }
8673 0 : int fd_system_error_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8674 0 : int err;
8675 0 : switch (discriminant) {
8676 0 : case 0: {
8677 0 : return FD_BINCODE_SUCCESS;
8678 0 : }
8679 0 : case 1: {
8680 0 : return FD_BINCODE_SUCCESS;
8681 0 : }
8682 0 : case 2: {
8683 0 : return FD_BINCODE_SUCCESS;
8684 0 : }
8685 0 : case 3: {
8686 0 : return FD_BINCODE_SUCCESS;
8687 0 : }
8688 0 : case 4: {
8689 0 : return FD_BINCODE_SUCCESS;
8690 0 : }
8691 0 : case 5: {
8692 0 : return FD_BINCODE_SUCCESS;
8693 0 : }
8694 0 : case 6: {
8695 0 : return FD_BINCODE_SUCCESS;
8696 0 : }
8697 0 : case 7: {
8698 0 : return FD_BINCODE_SUCCESS;
8699 0 : }
8700 0 : case 8: {
8701 0 : return FD_BINCODE_SUCCESS;
8702 0 : }
8703 0 : default: return FD_BINCODE_ERR_ENCODING;
8704 0 : }
8705 0 : }
8706 0 : static int fd_system_error_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8707 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8708 0 : uint discriminant = 0;
8709 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8710 0 : if( FD_UNLIKELY( err ) ) return err;
8711 0 : return fd_system_error_inner_decode_footprint( discriminant, ctx, total_sz );
8712 0 : }
8713 0 : int fd_system_error_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8714 0 : *total_sz += sizeof(fd_system_error_t);
8715 0 : void const * start_data = ctx->data;
8716 0 : int err = fd_system_error_decode_footprint_inner( ctx, total_sz );
8717 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8718 0 : ctx->data = start_data;
8719 0 : return err;
8720 0 : }
8721 0 : static void fd_system_error_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8722 0 : fd_system_error_t * self = (fd_system_error_t *)struct_mem;
8723 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8724 0 : }
8725 0 : void * fd_system_error_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8726 0 : fd_system_error_t * self = (fd_system_error_t *)mem;
8727 0 : fd_system_error_new( self );
8728 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_error_t);
8729 0 : void * * alloc_mem = &alloc_region;
8730 0 : fd_system_error_decode_inner( mem, alloc_mem, ctx );
8731 0 : return self;
8732 0 : }
8733 :
8734 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 ) {
8735 0 : (void) varint;
8736 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_error", level++, 0);
8737 0 : switch( self->discriminant ) {
8738 0 : case 0: {
8739 0 : fun( w, self, "account_already_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8740 0 : break;
8741 0 : }
8742 0 : case 1: {
8743 0 : fun( w, self, "result_with_negative_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8744 0 : break;
8745 0 : }
8746 0 : case 2: {
8747 0 : fun( w, self, "invalid_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8748 0 : break;
8749 0 : }
8750 0 : case 3: {
8751 0 : fun( w, self, "invalid_account_data_length", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8752 0 : break;
8753 0 : }
8754 0 : case 4: {
8755 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8756 0 : break;
8757 0 : }
8758 0 : case 5: {
8759 0 : fun( w, self, "address_with_seed_mismatch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8760 0 : break;
8761 0 : }
8762 0 : case 6: {
8763 0 : fun( w, self, "nonce_no_recent_blockhashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8764 0 : break;
8765 0 : }
8766 0 : case 7: {
8767 0 : fun( w, self, "nonce_blockhash_not_expired", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8768 0 : break;
8769 0 : }
8770 0 : case 8: {
8771 0 : fun( w, self, "nonce_unexpected_blockhash_value", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8772 0 : break;
8773 0 : }
8774 0 : }
8775 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_error", level--, 0 );
8776 0 : }
8777 0 : ulong fd_system_error_size( fd_system_error_t const * self ) {
8778 0 : ulong size = 0;
8779 0 : size += sizeof(uint);
8780 0 : switch (self->discriminant) {
8781 0 : }
8782 0 : return size;
8783 0 : }
8784 :
8785 0 : int fd_system_error_encode( fd_system_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8786 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8787 0 : if( FD_UNLIKELY( err ) ) return err;
8788 0 : return err;
8789 0 : }
8790 :
8791 12 : int fd_stake_authorized_encode( fd_stake_authorized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8792 12 : int err;
8793 12 : err = fd_pubkey_encode( &self->staker, ctx );
8794 12 : if( FD_UNLIKELY( err ) ) return err;
8795 12 : err = fd_pubkey_encode( &self->withdrawer, ctx );
8796 12 : if( FD_UNLIKELY( err ) ) return err;
8797 12 : return FD_BINCODE_SUCCESS;
8798 12 : }
8799 0 : static inline int fd_stake_authorized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8800 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8801 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
8802 0 : return 0;
8803 0 : }
8804 0 : static void fd_stake_authorized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8805 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)struct_mem;
8806 0 : fd_pubkey_decode_inner( &self->staker, alloc_mem, ctx );
8807 0 : fd_pubkey_decode_inner( &self->withdrawer, alloc_mem, ctx );
8808 0 : }
8809 0 : void * fd_stake_authorized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8810 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)mem;
8811 0 : fd_stake_authorized_new( self );
8812 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorized_t);
8813 0 : void * * alloc_mem = &alloc_region;
8814 0 : fd_stake_authorized_decode_inner( mem, alloc_mem, ctx );
8815 0 : return self;
8816 0 : }
8817 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 ) {
8818 0 : (void) varint;
8819 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_authorized", level++, 0 );
8820 0 : fd_pubkey_walk( w, &self->staker, fun, "staker", level, 0 );
8821 0 : fd_pubkey_walk( w, &self->withdrawer, fun, "withdrawer", level, 0 );
8822 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_authorized", level--, 0 );
8823 0 : }
8824 12 : int fd_stake_lockup_encode( fd_stake_lockup_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8825 12 : int err;
8826 12 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
8827 12 : if( FD_UNLIKELY( err ) ) return err;
8828 12 : err = fd_bincode_uint64_encode( self->epoch, ctx );
8829 12 : if( FD_UNLIKELY( err ) ) return err;
8830 12 : err = fd_pubkey_encode( &self->custodian, ctx );
8831 12 : if( FD_UNLIKELY( err ) ) return err;
8832 12 : return FD_BINCODE_SUCCESS;
8833 12 : }
8834 0 : static inline int fd_stake_lockup_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8835 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8836 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
8837 0 : return 0;
8838 0 : }
8839 0 : static void fd_stake_lockup_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8840 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)struct_mem;
8841 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
8842 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
8843 0 : fd_pubkey_decode_inner( &self->custodian, alloc_mem, ctx );
8844 0 : }
8845 0 : void * fd_stake_lockup_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8846 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)mem;
8847 0 : fd_stake_lockup_new( self );
8848 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_t);
8849 0 : void * * alloc_mem = &alloc_region;
8850 0 : fd_stake_lockup_decode_inner( mem, alloc_mem, ctx );
8851 0 : return self;
8852 0 : }
8853 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 ) {
8854 0 : (void) varint;
8855 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup", level++, 0 );
8856 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
8857 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8858 0 : fd_pubkey_walk( w, &self->custodian, fun, "custodian", level, 0 );
8859 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup", level--, 0 );
8860 0 : }
8861 0 : int fd_stake_instruction_initialize_encode( fd_stake_instruction_initialize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8862 0 : int err;
8863 0 : err = fd_stake_authorized_encode( &self->authorized, ctx );
8864 0 : if( FD_UNLIKELY( err ) ) return err;
8865 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
8866 0 : if( FD_UNLIKELY( err ) ) return err;
8867 0 : return FD_BINCODE_SUCCESS;
8868 0 : }
8869 0 : static inline int fd_stake_instruction_initialize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8870 0 : if( (ulong)ctx->data + 112UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8871 0 : ctx->data = (void *)( (ulong)ctx->data + 112UL );
8872 0 : return 0;
8873 0 : }
8874 0 : static void fd_stake_instruction_initialize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8875 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)struct_mem;
8876 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
8877 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
8878 0 : }
8879 0 : void * fd_stake_instruction_initialize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8880 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)mem;
8881 0 : fd_stake_instruction_initialize_new( self );
8882 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_initialize_t);
8883 0 : void * * alloc_mem = &alloc_region;
8884 0 : fd_stake_instruction_initialize_decode_inner( mem, alloc_mem, ctx );
8885 0 : return self;
8886 0 : }
8887 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 ) {
8888 0 : (void) varint;
8889 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_initialize", level++, 0 );
8890 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level, 0 );
8891 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
8892 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_initialize", level--, 0 );
8893 0 : }
8894 0 : int fd_stake_lockup_custodian_args_encode( fd_stake_lockup_custodian_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8895 0 : int err;
8896 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
8897 0 : if( FD_UNLIKELY( err ) ) return err;
8898 0 : err = fd_sol_sysvar_clock_encode( &self->clock, ctx );
8899 0 : if( FD_UNLIKELY( err ) ) return err;
8900 0 : if( self->custodian != NULL ) {
8901 0 : err = fd_bincode_bool_encode( 1, ctx );
8902 0 : if( FD_UNLIKELY( err ) ) return err;
8903 0 : err = fd_pubkey_encode( self->custodian, ctx );
8904 0 : if( FD_UNLIKELY( err ) ) return err;
8905 0 : } else {
8906 0 : err = fd_bincode_bool_encode( 0, ctx );
8907 0 : if( FD_UNLIKELY( err ) ) return err;
8908 0 : }
8909 0 : return FD_BINCODE_SUCCESS;
8910 0 : }
8911 0 : static int fd_stake_lockup_custodian_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8912 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8913 0 : int err = 0;
8914 0 : err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
8915 0 : if( FD_UNLIKELY( err ) ) return err;
8916 0 : err = fd_sol_sysvar_clock_decode_footprint_inner( ctx, total_sz );
8917 0 : if( FD_UNLIKELY( err ) ) return err;
8918 0 : {
8919 0 : uchar o;
8920 0 : err = fd_bincode_bool_decode( &o, ctx );
8921 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8922 0 : if( o ) {
8923 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
8924 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8925 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8926 0 : }
8927 0 : }
8928 0 : return 0;
8929 0 : }
8930 0 : int fd_stake_lockup_custodian_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8931 0 : *total_sz += sizeof(fd_stake_lockup_custodian_args_t);
8932 0 : void const * start_data = ctx->data;
8933 0 : int err = fd_stake_lockup_custodian_args_decode_footprint_inner( ctx, total_sz );
8934 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8935 0 : ctx->data = start_data;
8936 0 : return err;
8937 0 : }
8938 0 : static void fd_stake_lockup_custodian_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8939 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)struct_mem;
8940 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
8941 0 : fd_sol_sysvar_clock_decode_inner( &self->clock, alloc_mem, ctx );
8942 0 : {
8943 0 : uchar o;
8944 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8945 0 : if( o ) {
8946 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
8947 0 : self->custodian = *alloc_mem;
8948 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
8949 0 : fd_pubkey_new( self->custodian );
8950 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
8951 0 : } else {
8952 0 : self->custodian = NULL;
8953 0 : }
8954 0 : }
8955 0 : }
8956 0 : void * fd_stake_lockup_custodian_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8957 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)mem;
8958 0 : fd_stake_lockup_custodian_args_new( self );
8959 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_custodian_args_t);
8960 0 : void * * alloc_mem = &alloc_region;
8961 0 : fd_stake_lockup_custodian_args_decode_inner( mem, alloc_mem, ctx );
8962 0 : return self;
8963 0 : }
8964 0 : void fd_stake_lockup_custodian_args_new(fd_stake_lockup_custodian_args_t * self) {
8965 0 : fd_memset( self, 0, sizeof(fd_stake_lockup_custodian_args_t) );
8966 0 : fd_stake_lockup_new( &self->lockup );
8967 0 : fd_sol_sysvar_clock_new( &self->clock );
8968 0 : }
8969 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 ) {
8970 0 : (void) varint;
8971 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup_custodian_args", level++, 0 );
8972 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
8973 0 : fd_sol_sysvar_clock_walk( w, &self->clock, fun, "clock", level, 0 );
8974 0 : if( !self->custodian ) {
8975 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
8976 0 : } else {
8977 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level, 0 );
8978 0 : }
8979 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup_custodian_args", level--, 0 );
8980 0 : }
8981 0 : ulong fd_stake_lockup_custodian_args_size( fd_stake_lockup_custodian_args_t const * self ) {
8982 0 : ulong size = 0;
8983 0 : size += fd_stake_lockup_size( &self->lockup );
8984 0 : size += fd_sol_sysvar_clock_size( &self->clock );
8985 0 : size += sizeof(char);
8986 0 : if( NULL != self->custodian ) {
8987 0 : size += fd_pubkey_size( self->custodian );
8988 0 : }
8989 0 : return size;
8990 0 : }
8991 :
8992 0 : FD_FN_PURE uchar fd_stake_authorize_is_staker(fd_stake_authorize_t const * self) {
8993 0 : return self->discriminant == 0;
8994 0 : }
8995 0 : FD_FN_PURE uchar fd_stake_authorize_is_withdrawer(fd_stake_authorize_t const * self) {
8996 0 : return self->discriminant == 1;
8997 0 : }
8998 0 : int fd_stake_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8999 0 : int err;
9000 0 : switch (discriminant) {
9001 0 : case 0: {
9002 0 : return FD_BINCODE_SUCCESS;
9003 0 : }
9004 0 : case 1: {
9005 0 : return FD_BINCODE_SUCCESS;
9006 0 : }
9007 0 : default: return FD_BINCODE_ERR_ENCODING;
9008 0 : }
9009 0 : }
9010 0 : static int fd_stake_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9011 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9012 0 : uint discriminant = 0;
9013 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9014 0 : if( FD_UNLIKELY( err ) ) return err;
9015 0 : return fd_stake_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
9016 0 : }
9017 0 : int fd_stake_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9018 0 : *total_sz += sizeof(fd_stake_authorize_t);
9019 0 : void const * start_data = ctx->data;
9020 0 : int err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9021 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9022 0 : ctx->data = start_data;
9023 0 : return err;
9024 0 : }
9025 0 : static void fd_stake_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9026 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)struct_mem;
9027 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9028 0 : }
9029 0 : void * fd_stake_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9030 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)mem;
9031 0 : fd_stake_authorize_new( self );
9032 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorize_t);
9033 0 : void * * alloc_mem = &alloc_region;
9034 0 : fd_stake_authorize_decode_inner( mem, alloc_mem, ctx );
9035 0 : return self;
9036 0 : }
9037 :
9038 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 ) {
9039 0 : (void) varint;
9040 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_authorize", level++, 0);
9041 0 : switch( self->discriminant ) {
9042 0 : case 0: {
9043 0 : fun( w, self, "staker", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9044 0 : break;
9045 0 : }
9046 0 : case 1: {
9047 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9048 0 : break;
9049 0 : }
9050 0 : }
9051 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_authorize", level--, 0 );
9052 0 : }
9053 0 : ulong fd_stake_authorize_size( fd_stake_authorize_t const * self ) {
9054 0 : ulong size = 0;
9055 0 : size += sizeof(uint);
9056 0 : switch (self->discriminant) {
9057 0 : }
9058 0 : return size;
9059 0 : }
9060 :
9061 0 : int fd_stake_authorize_encode( fd_stake_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9062 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9063 0 : if( FD_UNLIKELY( err ) ) return err;
9064 0 : return err;
9065 0 : }
9066 :
9067 0 : int fd_stake_instruction_authorize_encode( fd_stake_instruction_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9068 0 : int err;
9069 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
9070 0 : if( FD_UNLIKELY( err ) ) return err;
9071 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
9072 0 : if( FD_UNLIKELY( err ) ) return err;
9073 0 : return FD_BINCODE_SUCCESS;
9074 0 : }
9075 0 : static int fd_stake_instruction_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9076 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9077 0 : int err = 0;
9078 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9079 0 : if( FD_UNLIKELY( err ) ) return err;
9080 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9081 0 : if( FD_UNLIKELY( err ) ) return err;
9082 0 : return 0;
9083 0 : }
9084 0 : int fd_stake_instruction_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9085 0 : *total_sz += sizeof(fd_stake_instruction_authorize_t);
9086 0 : void const * start_data = ctx->data;
9087 0 : int err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
9088 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9089 0 : ctx->data = start_data;
9090 0 : return err;
9091 0 : }
9092 0 : static void fd_stake_instruction_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9093 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)struct_mem;
9094 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
9095 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
9096 0 : }
9097 0 : void * fd_stake_instruction_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9098 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)mem;
9099 0 : fd_stake_instruction_authorize_new( self );
9100 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_authorize_t);
9101 0 : void * * alloc_mem = &alloc_region;
9102 0 : fd_stake_instruction_authorize_decode_inner( mem, alloc_mem, ctx );
9103 0 : return self;
9104 0 : }
9105 0 : void fd_stake_instruction_authorize_new(fd_stake_instruction_authorize_t * self) {
9106 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_authorize_t) );
9107 0 : fd_pubkey_new( &self->pubkey );
9108 0 : fd_stake_authorize_new( &self->stake_authorize );
9109 0 : }
9110 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 ) {
9111 0 : (void) varint;
9112 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_authorize", level++, 0 );
9113 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
9114 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
9115 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_authorize", level--, 0 );
9116 0 : }
9117 0 : int fd_authorize_with_seed_args_encode( fd_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9118 0 : int err;
9119 0 : err = fd_pubkey_encode( &self->new_authorized_pubkey, ctx );
9120 0 : if( FD_UNLIKELY( err ) ) return err;
9121 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
9122 0 : if( FD_UNLIKELY( err ) ) return err;
9123 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
9124 0 : if( FD_UNLIKELY(err) ) return err;
9125 0 : if( self->authority_seed_len ) {
9126 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
9127 0 : if( FD_UNLIKELY( err ) ) return err;
9128 0 : }
9129 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
9130 0 : if( FD_UNLIKELY( err ) ) return err;
9131 0 : return FD_BINCODE_SUCCESS;
9132 0 : }
9133 0 : static int fd_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9134 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9135 0 : int err = 0;
9136 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9137 0 : if( FD_UNLIKELY( err ) ) return err;
9138 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9139 0 : if( FD_UNLIKELY( err ) ) return err;
9140 0 : ulong authority_seed_len;
9141 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
9142 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9143 0 : *total_sz += authority_seed_len;
9144 0 : if( authority_seed_len ) {
9145 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
9146 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9147 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
9148 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9149 0 : }
9150 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9151 0 : if( FD_UNLIKELY( err ) ) return err;
9152 0 : return 0;
9153 0 : }
9154 0 : int fd_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9155 0 : *total_sz += sizeof(fd_authorize_with_seed_args_t);
9156 0 : void const * start_data = ctx->data;
9157 0 : int err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
9158 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9159 0 : ctx->data = start_data;
9160 0 : return err;
9161 0 : }
9162 0 : static void fd_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9163 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)struct_mem;
9164 0 : fd_pubkey_decode_inner( &self->new_authorized_pubkey, alloc_mem, ctx );
9165 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
9166 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
9167 0 : if( self->authority_seed_len ) {
9168 0 : self->authority_seed = *alloc_mem;
9169 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
9170 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
9171 0 : } else
9172 0 : self->authority_seed = NULL;
9173 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
9174 0 : }
9175 0 : void * fd_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9176 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)mem;
9177 0 : fd_authorize_with_seed_args_new( self );
9178 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_with_seed_args_t);
9179 0 : void * * alloc_mem = &alloc_region;
9180 0 : fd_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
9181 0 : return self;
9182 0 : }
9183 0 : void fd_authorize_with_seed_args_new(fd_authorize_with_seed_args_t * self) {
9184 0 : fd_memset( self, 0, sizeof(fd_authorize_with_seed_args_t) );
9185 0 : fd_pubkey_new( &self->new_authorized_pubkey );
9186 0 : fd_stake_authorize_new( &self->stake_authorize );
9187 0 : fd_pubkey_new( &self->authority_owner );
9188 0 : }
9189 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 ) {
9190 0 : (void) varint;
9191 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_with_seed_args", level++, 0 );
9192 0 : fd_pubkey_walk( w, &self->new_authorized_pubkey, fun, "new_authorized_pubkey", level, 0 );
9193 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
9194 0 : if( self->authority_seed_len ) {
9195 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9196 0 : for( ulong i=0; i < self->authority_seed_len; i++ )
9197 0 : fun( w, self->authority_seed + i, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9198 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9199 0 : }
9200 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level, 0 );
9201 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_with_seed_args", level--, 0 );
9202 0 : }
9203 0 : ulong fd_authorize_with_seed_args_size( fd_authorize_with_seed_args_t const * self ) {
9204 0 : ulong size = 0;
9205 0 : size += fd_pubkey_size( &self->new_authorized_pubkey );
9206 0 : size += fd_stake_authorize_size( &self->stake_authorize );
9207 0 : do {
9208 0 : size += sizeof(ulong);
9209 0 : size += self->authority_seed_len;
9210 0 : } while(0);
9211 0 : size += fd_pubkey_size( &self->authority_owner );
9212 0 : return size;
9213 0 : }
9214 :
9215 0 : int fd_authorize_checked_with_seed_args_encode( fd_authorize_checked_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9216 0 : int err;
9217 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
9218 0 : if( FD_UNLIKELY( err ) ) return err;
9219 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
9220 0 : if( FD_UNLIKELY(err) ) return err;
9221 0 : if( self->authority_seed_len ) {
9222 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
9223 0 : if( FD_UNLIKELY( err ) ) return err;
9224 0 : }
9225 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
9226 0 : if( FD_UNLIKELY( err ) ) return err;
9227 0 : return FD_BINCODE_SUCCESS;
9228 0 : }
9229 0 : static int fd_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9230 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9231 0 : int err = 0;
9232 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9233 0 : if( FD_UNLIKELY( err ) ) return err;
9234 0 : ulong authority_seed_len;
9235 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
9236 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9237 0 : *total_sz += authority_seed_len;
9238 0 : if( authority_seed_len ) {
9239 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
9240 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9241 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
9242 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9243 0 : }
9244 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9245 0 : if( FD_UNLIKELY( err ) ) return err;
9246 0 : return 0;
9247 0 : }
9248 0 : int fd_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9249 0 : *total_sz += sizeof(fd_authorize_checked_with_seed_args_t);
9250 0 : void const * start_data = ctx->data;
9251 0 : int err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
9252 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9253 0 : ctx->data = start_data;
9254 0 : return err;
9255 0 : }
9256 0 : static void fd_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9257 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)struct_mem;
9258 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
9259 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
9260 0 : if( self->authority_seed_len ) {
9261 0 : self->authority_seed = *alloc_mem;
9262 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
9263 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
9264 0 : } else
9265 0 : self->authority_seed = NULL;
9266 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
9267 0 : }
9268 0 : void * fd_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9269 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)mem;
9270 0 : fd_authorize_checked_with_seed_args_new( self );
9271 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_checked_with_seed_args_t);
9272 0 : void * * alloc_mem = &alloc_region;
9273 0 : fd_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
9274 0 : return self;
9275 0 : }
9276 0 : void fd_authorize_checked_with_seed_args_new(fd_authorize_checked_with_seed_args_t * self) {
9277 0 : fd_memset( self, 0, sizeof(fd_authorize_checked_with_seed_args_t) );
9278 0 : fd_stake_authorize_new( &self->stake_authorize );
9279 0 : fd_pubkey_new( &self->authority_owner );
9280 0 : }
9281 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 ) {
9282 0 : (void) varint;
9283 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_checked_with_seed_args", level++, 0 );
9284 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
9285 0 : if( self->authority_seed_len ) {
9286 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9287 0 : for( ulong i=0; i < self->authority_seed_len; i++ )
9288 0 : fun( w, self->authority_seed + i, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9289 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9290 0 : }
9291 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level, 0 );
9292 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_checked_with_seed_args", level--, 0 );
9293 0 : }
9294 0 : ulong fd_authorize_checked_with_seed_args_size( fd_authorize_checked_with_seed_args_t const * self ) {
9295 0 : ulong size = 0;
9296 0 : size += fd_stake_authorize_size( &self->stake_authorize );
9297 0 : do {
9298 0 : size += sizeof(ulong);
9299 0 : size += self->authority_seed_len;
9300 0 : } while(0);
9301 0 : size += fd_pubkey_size( &self->authority_owner );
9302 0 : return size;
9303 0 : }
9304 :
9305 0 : int fd_lockup_checked_args_encode( fd_lockup_checked_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9306 0 : int err;
9307 0 : if( self->unix_timestamp != NULL ) {
9308 0 : err = fd_bincode_bool_encode( 1, ctx );
9309 0 : if( FD_UNLIKELY( err ) ) return err;
9310 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
9311 0 : if( FD_UNLIKELY( err ) ) return err;
9312 0 : } else {
9313 0 : err = fd_bincode_bool_encode( 0, ctx );
9314 0 : if( FD_UNLIKELY( err ) ) return err;
9315 0 : }
9316 0 : if( self->epoch != NULL ) {
9317 0 : err = fd_bincode_bool_encode( 1, ctx );
9318 0 : if( FD_UNLIKELY( err ) ) return err;
9319 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
9320 0 : if( FD_UNLIKELY( err ) ) return err;
9321 0 : } else {
9322 0 : err = fd_bincode_bool_encode( 0, ctx );
9323 0 : if( FD_UNLIKELY( err ) ) return err;
9324 0 : }
9325 0 : return FD_BINCODE_SUCCESS;
9326 0 : }
9327 0 : static int fd_lockup_checked_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9328 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9329 0 : int err = 0;
9330 0 : {
9331 0 : uchar o;
9332 0 : err = fd_bincode_bool_decode( &o, ctx );
9333 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9334 0 : if( o ) {
9335 0 : *total_sz += 8UL + sizeof(long);
9336 0 : err = fd_bincode_int64_decode_footprint( ctx );
9337 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9338 0 : }
9339 0 : }
9340 0 : {
9341 0 : uchar o;
9342 0 : err = fd_bincode_bool_decode( &o, ctx );
9343 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9344 0 : if( o ) {
9345 0 : *total_sz += 8UL + sizeof(ulong);
9346 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9347 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9348 0 : }
9349 0 : }
9350 0 : return 0;
9351 0 : }
9352 0 : int fd_lockup_checked_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9353 0 : *total_sz += sizeof(fd_lockup_checked_args_t);
9354 0 : void const * start_data = ctx->data;
9355 0 : int err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
9356 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9357 0 : ctx->data = start_data;
9358 0 : return err;
9359 0 : }
9360 0 : static void fd_lockup_checked_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9361 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)struct_mem;
9362 0 : {
9363 0 : uchar o;
9364 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9365 0 : if( o ) {
9366 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
9367 0 : self->unix_timestamp = *alloc_mem;
9368 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
9369 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
9370 0 : } else {
9371 0 : self->unix_timestamp = NULL;
9372 0 : }
9373 0 : }
9374 0 : {
9375 0 : uchar o;
9376 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9377 0 : if( o ) {
9378 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
9379 0 : self->epoch = *alloc_mem;
9380 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
9381 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
9382 0 : } else {
9383 0 : self->epoch = NULL;
9384 0 : }
9385 0 : }
9386 0 : }
9387 0 : void * fd_lockup_checked_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9388 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)mem;
9389 0 : fd_lockup_checked_args_new( self );
9390 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_checked_args_t);
9391 0 : void * * alloc_mem = &alloc_region;
9392 0 : fd_lockup_checked_args_decode_inner( mem, alloc_mem, ctx );
9393 0 : return self;
9394 0 : }
9395 0 : void fd_lockup_checked_args_new(fd_lockup_checked_args_t * self) {
9396 0 : fd_memset( self, 0, sizeof(fd_lockup_checked_args_t) );
9397 0 : }
9398 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 ) {
9399 0 : (void) varint;
9400 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_checked_args", level++, 0 );
9401 0 : if( !self->unix_timestamp ) {
9402 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
9403 0 : } else {
9404 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
9405 0 : }
9406 0 : if( !self->epoch ) {
9407 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
9408 0 : } else {
9409 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9410 0 : }
9411 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_checked_args", level--, 0 );
9412 0 : }
9413 0 : ulong fd_lockup_checked_args_size( fd_lockup_checked_args_t const * self ) {
9414 0 : ulong size = 0;
9415 0 : size += sizeof(char);
9416 0 : if( NULL != self->unix_timestamp ) {
9417 0 : size += sizeof(long);
9418 0 : }
9419 0 : size += sizeof(char);
9420 0 : if( NULL != self->epoch ) {
9421 0 : size += sizeof(ulong);
9422 0 : }
9423 0 : return size;
9424 0 : }
9425 :
9426 0 : int fd_lockup_args_encode( fd_lockup_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9427 0 : int err;
9428 0 : if( self->unix_timestamp != NULL ) {
9429 0 : err = fd_bincode_bool_encode( 1, ctx );
9430 0 : if( FD_UNLIKELY( err ) ) return err;
9431 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
9432 0 : if( FD_UNLIKELY( err ) ) return err;
9433 0 : } else {
9434 0 : err = fd_bincode_bool_encode( 0, ctx );
9435 0 : if( FD_UNLIKELY( err ) ) return err;
9436 0 : }
9437 0 : if( self->epoch != NULL ) {
9438 0 : err = fd_bincode_bool_encode( 1, ctx );
9439 0 : if( FD_UNLIKELY( err ) ) return err;
9440 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
9441 0 : if( FD_UNLIKELY( err ) ) return err;
9442 0 : } else {
9443 0 : err = fd_bincode_bool_encode( 0, ctx );
9444 0 : if( FD_UNLIKELY( err ) ) return err;
9445 0 : }
9446 0 : if( self->custodian != NULL ) {
9447 0 : err = fd_bincode_bool_encode( 1, ctx );
9448 0 : if( FD_UNLIKELY( err ) ) return err;
9449 0 : err = fd_pubkey_encode( self->custodian, ctx );
9450 0 : if( FD_UNLIKELY( err ) ) return err;
9451 0 : } else {
9452 0 : err = fd_bincode_bool_encode( 0, ctx );
9453 0 : if( FD_UNLIKELY( err ) ) return err;
9454 0 : }
9455 0 : return FD_BINCODE_SUCCESS;
9456 0 : }
9457 0 : static int fd_lockup_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9458 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9459 0 : int err = 0;
9460 0 : {
9461 0 : uchar o;
9462 0 : err = fd_bincode_bool_decode( &o, ctx );
9463 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9464 0 : if( o ) {
9465 0 : *total_sz += 8UL + sizeof(long);
9466 0 : err = fd_bincode_int64_decode_footprint( ctx );
9467 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9468 0 : }
9469 0 : }
9470 0 : {
9471 0 : uchar o;
9472 0 : err = fd_bincode_bool_decode( &o, ctx );
9473 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9474 0 : if( o ) {
9475 0 : *total_sz += 8UL + sizeof(ulong);
9476 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9477 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9478 0 : }
9479 0 : }
9480 0 : {
9481 0 : uchar o;
9482 0 : err = fd_bincode_bool_decode( &o, ctx );
9483 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9484 0 : if( o ) {
9485 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
9486 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9487 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9488 0 : }
9489 0 : }
9490 0 : return 0;
9491 0 : }
9492 0 : int fd_lockup_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9493 0 : *total_sz += sizeof(fd_lockup_args_t);
9494 0 : void const * start_data = ctx->data;
9495 0 : int err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
9496 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9497 0 : ctx->data = start_data;
9498 0 : return err;
9499 0 : }
9500 0 : static void fd_lockup_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9501 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)struct_mem;
9502 0 : {
9503 0 : uchar o;
9504 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9505 0 : if( o ) {
9506 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
9507 0 : self->unix_timestamp = *alloc_mem;
9508 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
9509 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
9510 0 : } else {
9511 0 : self->unix_timestamp = NULL;
9512 0 : }
9513 0 : }
9514 0 : {
9515 0 : uchar o;
9516 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9517 0 : if( o ) {
9518 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
9519 0 : self->epoch = *alloc_mem;
9520 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
9521 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
9522 0 : } else {
9523 0 : self->epoch = NULL;
9524 0 : }
9525 0 : }
9526 0 : {
9527 0 : uchar o;
9528 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9529 0 : if( o ) {
9530 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
9531 0 : self->custodian = *alloc_mem;
9532 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
9533 0 : fd_pubkey_new( self->custodian );
9534 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
9535 0 : } else {
9536 0 : self->custodian = NULL;
9537 0 : }
9538 0 : }
9539 0 : }
9540 0 : void * fd_lockup_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9541 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)mem;
9542 0 : fd_lockup_args_new( self );
9543 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_args_t);
9544 0 : void * * alloc_mem = &alloc_region;
9545 0 : fd_lockup_args_decode_inner( mem, alloc_mem, ctx );
9546 0 : return self;
9547 0 : }
9548 0 : void fd_lockup_args_new(fd_lockup_args_t * self) {
9549 0 : fd_memset( self, 0, sizeof(fd_lockup_args_t) );
9550 0 : }
9551 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 ) {
9552 0 : (void) varint;
9553 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_args", level++, 0 );
9554 0 : if( !self->unix_timestamp ) {
9555 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
9556 0 : } else {
9557 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
9558 0 : }
9559 0 : if( !self->epoch ) {
9560 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
9561 0 : } else {
9562 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9563 0 : }
9564 0 : if( !self->custodian ) {
9565 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
9566 0 : } else {
9567 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level, 0 );
9568 0 : }
9569 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_args", level--, 0 );
9570 0 : }
9571 0 : ulong fd_lockup_args_size( fd_lockup_args_t const * self ) {
9572 0 : ulong size = 0;
9573 0 : size += sizeof(char);
9574 0 : if( NULL != self->unix_timestamp ) {
9575 0 : size += sizeof(long);
9576 0 : }
9577 0 : size += sizeof(char);
9578 0 : if( NULL != self->epoch ) {
9579 0 : size += sizeof(ulong);
9580 0 : }
9581 0 : size += sizeof(char);
9582 0 : if( NULL != self->custodian ) {
9583 0 : size += fd_pubkey_size( self->custodian );
9584 0 : }
9585 0 : return size;
9586 0 : }
9587 :
9588 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize(fd_stake_instruction_t const * self) {
9589 0 : return self->discriminant == 0;
9590 0 : }
9591 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize(fd_stake_instruction_t const * self) {
9592 0 : return self->discriminant == 1;
9593 0 : }
9594 0 : FD_FN_PURE uchar fd_stake_instruction_is_delegate_stake(fd_stake_instruction_t const * self) {
9595 0 : return self->discriminant == 2;
9596 0 : }
9597 0 : FD_FN_PURE uchar fd_stake_instruction_is_split(fd_stake_instruction_t const * self) {
9598 0 : return self->discriminant == 3;
9599 0 : }
9600 0 : FD_FN_PURE uchar fd_stake_instruction_is_withdraw(fd_stake_instruction_t const * self) {
9601 0 : return self->discriminant == 4;
9602 0 : }
9603 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate(fd_stake_instruction_t const * self) {
9604 0 : return self->discriminant == 5;
9605 0 : }
9606 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup(fd_stake_instruction_t const * self) {
9607 0 : return self->discriminant == 6;
9608 0 : }
9609 0 : FD_FN_PURE uchar fd_stake_instruction_is_merge(fd_stake_instruction_t const * self) {
9610 0 : return self->discriminant == 7;
9611 0 : }
9612 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_with_seed(fd_stake_instruction_t const * self) {
9613 0 : return self->discriminant == 8;
9614 0 : }
9615 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize_checked(fd_stake_instruction_t const * self) {
9616 0 : return self->discriminant == 9;
9617 0 : }
9618 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked(fd_stake_instruction_t const * self) {
9619 0 : return self->discriminant == 10;
9620 0 : }
9621 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked_with_seed(fd_stake_instruction_t const * self) {
9622 0 : return self->discriminant == 11;
9623 0 : }
9624 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup_checked(fd_stake_instruction_t const * self) {
9625 0 : return self->discriminant == 12;
9626 0 : }
9627 0 : FD_FN_PURE uchar fd_stake_instruction_is_get_minimum_delegation(fd_stake_instruction_t const * self) {
9628 0 : return self->discriminant == 13;
9629 0 : }
9630 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate_delinquent(fd_stake_instruction_t const * self) {
9631 0 : return self->discriminant == 14;
9632 0 : }
9633 0 : FD_FN_PURE uchar fd_stake_instruction_is_redelegate(fd_stake_instruction_t const * self) {
9634 0 : return self->discriminant == 15;
9635 0 : }
9636 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_stake(fd_stake_instruction_t const * self) {
9637 0 : return self->discriminant == 16;
9638 0 : }
9639 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_lamports(fd_stake_instruction_t const * self) {
9640 0 : return self->discriminant == 17;
9641 0 : }
9642 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant );
9643 0 : int fd_stake_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9644 0 : int err;
9645 0 : switch (discriminant) {
9646 0 : case 0: {
9647 0 : err = fd_stake_instruction_initialize_decode_footprint_inner( ctx, total_sz );
9648 0 : if( FD_UNLIKELY( err ) ) return err;
9649 0 : return FD_BINCODE_SUCCESS;
9650 0 : }
9651 0 : case 1: {
9652 0 : err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
9653 0 : if( FD_UNLIKELY( err ) ) return err;
9654 0 : return FD_BINCODE_SUCCESS;
9655 0 : }
9656 0 : case 2: {
9657 0 : return FD_BINCODE_SUCCESS;
9658 0 : }
9659 0 : case 3: {
9660 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9661 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9662 0 : return FD_BINCODE_SUCCESS;
9663 0 : }
9664 0 : case 4: {
9665 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9666 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9667 0 : return FD_BINCODE_SUCCESS;
9668 0 : }
9669 0 : case 5: {
9670 0 : return FD_BINCODE_SUCCESS;
9671 0 : }
9672 0 : case 6: {
9673 0 : err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
9674 0 : if( FD_UNLIKELY( err ) ) return err;
9675 0 : return FD_BINCODE_SUCCESS;
9676 0 : }
9677 0 : case 7: {
9678 0 : return FD_BINCODE_SUCCESS;
9679 0 : }
9680 0 : case 8: {
9681 0 : err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
9682 0 : if( FD_UNLIKELY( err ) ) return err;
9683 0 : return FD_BINCODE_SUCCESS;
9684 0 : }
9685 0 : case 9: {
9686 0 : return FD_BINCODE_SUCCESS;
9687 0 : }
9688 0 : case 10: {
9689 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
9690 0 : if( FD_UNLIKELY( err ) ) return err;
9691 0 : return FD_BINCODE_SUCCESS;
9692 0 : }
9693 0 : case 11: {
9694 0 : err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
9695 0 : if( FD_UNLIKELY( err ) ) return err;
9696 0 : return FD_BINCODE_SUCCESS;
9697 0 : }
9698 0 : case 12: {
9699 0 : err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
9700 0 : if( FD_UNLIKELY( err ) ) return err;
9701 0 : return FD_BINCODE_SUCCESS;
9702 0 : }
9703 0 : case 13: {
9704 0 : return FD_BINCODE_SUCCESS;
9705 0 : }
9706 0 : case 14: {
9707 0 : return FD_BINCODE_SUCCESS;
9708 0 : }
9709 0 : case 15: {
9710 0 : return FD_BINCODE_SUCCESS;
9711 0 : }
9712 0 : case 16: {
9713 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9714 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9715 0 : return FD_BINCODE_SUCCESS;
9716 0 : }
9717 0 : case 17: {
9718 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9719 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9720 0 : return FD_BINCODE_SUCCESS;
9721 0 : }
9722 0 : default: return FD_BINCODE_ERR_ENCODING;
9723 0 : }
9724 0 : }
9725 0 : static int fd_stake_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9726 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9727 0 : uint discriminant = 0;
9728 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9729 0 : if( FD_UNLIKELY( err ) ) return err;
9730 0 : return fd_stake_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
9731 0 : }
9732 0 : int fd_stake_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9733 0 : *total_sz += sizeof(fd_stake_instruction_t);
9734 0 : void const * start_data = ctx->data;
9735 0 : int err = fd_stake_instruction_decode_footprint_inner( ctx, total_sz );
9736 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9737 0 : ctx->data = start_data;
9738 0 : return err;
9739 0 : }
9740 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 ) {
9741 0 : switch (discriminant) {
9742 0 : case 0: {
9743 0 : fd_stake_instruction_initialize_decode_inner( &self->initialize, alloc_mem, ctx );
9744 0 : break;
9745 0 : }
9746 0 : case 1: {
9747 0 : fd_stake_instruction_authorize_decode_inner( &self->authorize, alloc_mem, ctx );
9748 0 : break;
9749 0 : }
9750 0 : case 2: {
9751 0 : break;
9752 0 : }
9753 0 : case 3: {
9754 0 : fd_bincode_uint64_decode_unsafe( &self->split, ctx );
9755 0 : break;
9756 0 : }
9757 0 : case 4: {
9758 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
9759 0 : break;
9760 0 : }
9761 0 : case 5: {
9762 0 : break;
9763 0 : }
9764 0 : case 6: {
9765 0 : fd_lockup_args_decode_inner( &self->set_lockup, alloc_mem, ctx );
9766 0 : break;
9767 0 : }
9768 0 : case 7: {
9769 0 : break;
9770 0 : }
9771 0 : case 8: {
9772 0 : fd_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
9773 0 : break;
9774 0 : }
9775 0 : case 9: {
9776 0 : break;
9777 0 : }
9778 0 : case 10: {
9779 0 : fd_stake_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
9780 0 : break;
9781 0 : }
9782 0 : case 11: {
9783 0 : fd_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
9784 0 : break;
9785 0 : }
9786 0 : case 12: {
9787 0 : fd_lockup_checked_args_decode_inner( &self->set_lockup_checked, alloc_mem, ctx );
9788 0 : break;
9789 0 : }
9790 0 : case 13: {
9791 0 : break;
9792 0 : }
9793 0 : case 14: {
9794 0 : break;
9795 0 : }
9796 0 : case 15: {
9797 0 : break;
9798 0 : }
9799 0 : case 16: {
9800 0 : fd_bincode_uint64_decode_unsafe( &self->move_stake, ctx );
9801 0 : break;
9802 0 : }
9803 0 : case 17: {
9804 0 : fd_bincode_uint64_decode_unsafe( &self->move_lamports, ctx );
9805 0 : break;
9806 0 : }
9807 0 : }
9808 0 : }
9809 0 : static void fd_stake_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9810 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)struct_mem;
9811 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9812 0 : fd_stake_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9813 0 : }
9814 0 : void * fd_stake_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9815 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)mem;
9816 0 : fd_stake_instruction_new( self );
9817 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_t);
9818 0 : void * * alloc_mem = &alloc_region;
9819 0 : fd_stake_instruction_decode_inner( mem, alloc_mem, ctx );
9820 0 : return self;
9821 0 : }
9822 0 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant ) {
9823 0 : switch( discriminant ) {
9824 0 : case 0: {
9825 0 : fd_stake_instruction_initialize_new( &self->initialize );
9826 0 : break;
9827 0 : }
9828 0 : case 1: {
9829 0 : fd_stake_instruction_authorize_new( &self->authorize );
9830 0 : break;
9831 0 : }
9832 0 : case 2: {
9833 0 : break;
9834 0 : }
9835 0 : case 3: {
9836 0 : break;
9837 0 : }
9838 0 : case 4: {
9839 0 : break;
9840 0 : }
9841 0 : case 5: {
9842 0 : break;
9843 0 : }
9844 0 : case 6: {
9845 0 : fd_lockup_args_new( &self->set_lockup );
9846 0 : break;
9847 0 : }
9848 0 : case 7: {
9849 0 : break;
9850 0 : }
9851 0 : case 8: {
9852 0 : fd_authorize_with_seed_args_new( &self->authorize_with_seed );
9853 0 : break;
9854 0 : }
9855 0 : case 9: {
9856 0 : break;
9857 0 : }
9858 0 : case 10: {
9859 0 : fd_stake_authorize_new( &self->authorize_checked );
9860 0 : break;
9861 0 : }
9862 0 : case 11: {
9863 0 : fd_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
9864 0 : break;
9865 0 : }
9866 0 : case 12: {
9867 0 : fd_lockup_checked_args_new( &self->set_lockup_checked );
9868 0 : break;
9869 0 : }
9870 0 : case 13: {
9871 0 : break;
9872 0 : }
9873 0 : case 14: {
9874 0 : break;
9875 0 : }
9876 0 : case 15: {
9877 0 : break;
9878 0 : }
9879 0 : case 16: {
9880 0 : break;
9881 0 : }
9882 0 : case 17: {
9883 0 : break;
9884 0 : }
9885 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9886 0 : }
9887 0 : }
9888 0 : void fd_stake_instruction_new_disc( fd_stake_instruction_t * self, uint discriminant ) {
9889 0 : self->discriminant = discriminant;
9890 0 : fd_stake_instruction_inner_new( &self->inner, self->discriminant );
9891 0 : }
9892 0 : void fd_stake_instruction_new( fd_stake_instruction_t * self ) {
9893 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_t) );
9894 0 : fd_stake_instruction_new_disc( self, UINT_MAX );
9895 0 : }
9896 :
9897 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 ) {
9898 0 : (void) varint;
9899 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_instruction", level++, 0);
9900 0 : switch( self->discriminant ) {
9901 0 : case 0: {
9902 0 : fun( w, self, "initialize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9903 0 : fd_stake_instruction_initialize_walk( w, &self->inner.initialize, fun, "initialize", level, 0 );
9904 0 : break;
9905 0 : }
9906 0 : case 1: {
9907 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9908 0 : fd_stake_instruction_authorize_walk( w, &self->inner.authorize, fun, "authorize", level, 0 );
9909 0 : break;
9910 0 : }
9911 0 : case 2: {
9912 0 : fun( w, self, "delegate_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9913 0 : break;
9914 0 : }
9915 0 : case 3: {
9916 0 : fun( w, self, "split", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9917 0 : fun( w, &self->inner.split, "split", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9918 0 : break;
9919 0 : }
9920 0 : case 4: {
9921 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9922 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9923 0 : break;
9924 0 : }
9925 0 : case 5: {
9926 0 : fun( w, self, "deactivate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9927 0 : break;
9928 0 : }
9929 0 : case 6: {
9930 0 : fun( w, self, "set_lockup", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9931 0 : fd_lockup_args_walk( w, &self->inner.set_lockup, fun, "set_lockup", level, 0 );
9932 0 : break;
9933 0 : }
9934 0 : case 7: {
9935 0 : fun( w, self, "merge", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9936 0 : break;
9937 0 : }
9938 0 : case 8: {
9939 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9940 0 : fd_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level, 0 );
9941 0 : break;
9942 0 : }
9943 0 : case 9: {
9944 0 : fun( w, self, "initialize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9945 0 : break;
9946 0 : }
9947 0 : case 10: {
9948 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9949 0 : fd_stake_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level, 0 );
9950 0 : break;
9951 0 : }
9952 0 : case 11: {
9953 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9954 0 : fd_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level, 0 );
9955 0 : break;
9956 0 : }
9957 0 : case 12: {
9958 0 : fun( w, self, "set_lockup_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9959 0 : fd_lockup_checked_args_walk( w, &self->inner.set_lockup_checked, fun, "set_lockup_checked", level, 0 );
9960 0 : break;
9961 0 : }
9962 0 : case 13: {
9963 0 : fun( w, self, "get_minimum_delegation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9964 0 : break;
9965 0 : }
9966 0 : case 14: {
9967 0 : fun( w, self, "deactivate_delinquent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9968 0 : break;
9969 0 : }
9970 0 : case 15: {
9971 0 : fun( w, self, "redelegate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9972 0 : break;
9973 0 : }
9974 0 : case 16: {
9975 0 : fun( w, self, "move_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9976 0 : fun( w, &self->inner.move_stake, "move_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9977 0 : break;
9978 0 : }
9979 0 : case 17: {
9980 0 : fun( w, self, "move_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9981 0 : fun( w, &self->inner.move_lamports, "move_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9982 0 : break;
9983 0 : }
9984 0 : }
9985 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_instruction", level--, 0 );
9986 0 : }
9987 0 : ulong fd_stake_instruction_size( fd_stake_instruction_t const * self ) {
9988 0 : ulong size = 0;
9989 0 : size += sizeof(uint);
9990 0 : switch (self->discriminant) {
9991 0 : case 0: {
9992 0 : size += fd_stake_instruction_initialize_size( &self->inner.initialize );
9993 0 : break;
9994 0 : }
9995 0 : case 1: {
9996 0 : size += fd_stake_instruction_authorize_size( &self->inner.authorize );
9997 0 : break;
9998 0 : }
9999 0 : case 3: {
10000 0 : size += sizeof(ulong);
10001 0 : break;
10002 0 : }
10003 0 : case 4: {
10004 0 : size += sizeof(ulong);
10005 0 : break;
10006 0 : }
10007 0 : case 6: {
10008 0 : size += fd_lockup_args_size( &self->inner.set_lockup );
10009 0 : break;
10010 0 : }
10011 0 : case 8: {
10012 0 : size += fd_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
10013 0 : break;
10014 0 : }
10015 0 : case 10: {
10016 0 : size += fd_stake_authorize_size( &self->inner.authorize_checked );
10017 0 : break;
10018 0 : }
10019 0 : case 11: {
10020 0 : size += fd_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
10021 0 : break;
10022 0 : }
10023 0 : case 12: {
10024 0 : size += fd_lockup_checked_args_size( &self->inner.set_lockup_checked );
10025 0 : break;
10026 0 : }
10027 0 : case 16: {
10028 0 : size += sizeof(ulong);
10029 0 : break;
10030 0 : }
10031 0 : case 17: {
10032 0 : size += sizeof(ulong);
10033 0 : break;
10034 0 : }
10035 0 : }
10036 0 : return size;
10037 0 : }
10038 :
10039 0 : int fd_stake_instruction_inner_encode( fd_stake_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10040 0 : int err;
10041 0 : switch (discriminant) {
10042 0 : case 0: {
10043 0 : err = fd_stake_instruction_initialize_encode( &self->initialize, ctx );
10044 0 : if( FD_UNLIKELY( err ) ) return err;
10045 0 : break;
10046 0 : }
10047 0 : case 1: {
10048 0 : err = fd_stake_instruction_authorize_encode( &self->authorize, ctx );
10049 0 : if( FD_UNLIKELY( err ) ) return err;
10050 0 : break;
10051 0 : }
10052 0 : case 3: {
10053 0 : err = fd_bincode_uint64_encode( self->split, ctx );
10054 0 : if( FD_UNLIKELY( err ) ) return err;
10055 0 : break;
10056 0 : }
10057 0 : case 4: {
10058 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
10059 0 : if( FD_UNLIKELY( err ) ) return err;
10060 0 : break;
10061 0 : }
10062 0 : case 6: {
10063 0 : err = fd_lockup_args_encode( &self->set_lockup, ctx );
10064 0 : if( FD_UNLIKELY( err ) ) return err;
10065 0 : break;
10066 0 : }
10067 0 : case 8: {
10068 0 : err = fd_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
10069 0 : if( FD_UNLIKELY( err ) ) return err;
10070 0 : break;
10071 0 : }
10072 0 : case 10: {
10073 0 : err = fd_stake_authorize_encode( &self->authorize_checked, ctx );
10074 0 : if( FD_UNLIKELY( err ) ) return err;
10075 0 : break;
10076 0 : }
10077 0 : case 11: {
10078 0 : err = fd_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
10079 0 : if( FD_UNLIKELY( err ) ) return err;
10080 0 : break;
10081 0 : }
10082 0 : case 12: {
10083 0 : err = fd_lockup_checked_args_encode( &self->set_lockup_checked, ctx );
10084 0 : if( FD_UNLIKELY( err ) ) return err;
10085 0 : break;
10086 0 : }
10087 0 : case 16: {
10088 0 : err = fd_bincode_uint64_encode( self->move_stake, ctx );
10089 0 : if( FD_UNLIKELY( err ) ) return err;
10090 0 : break;
10091 0 : }
10092 0 : case 17: {
10093 0 : err = fd_bincode_uint64_encode( self->move_lamports, ctx );
10094 0 : if( FD_UNLIKELY( err ) ) return err;
10095 0 : break;
10096 0 : }
10097 0 : }
10098 0 : return FD_BINCODE_SUCCESS;
10099 0 : }
10100 0 : int fd_stake_instruction_encode( fd_stake_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10101 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10102 0 : if( FD_UNLIKELY( err ) ) return err;
10103 0 : return fd_stake_instruction_inner_encode( &self->inner, self->discriminant, ctx );
10104 0 : }
10105 :
10106 12 : int fd_stake_meta_encode( fd_stake_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10107 12 : int err;
10108 12 : err = fd_bincode_uint64_encode( self->rent_exempt_reserve, ctx );
10109 12 : if( FD_UNLIKELY( err ) ) return err;
10110 12 : err = fd_stake_authorized_encode( &self->authorized, ctx );
10111 12 : if( FD_UNLIKELY( err ) ) return err;
10112 12 : err = fd_stake_lockup_encode( &self->lockup, ctx );
10113 12 : if( FD_UNLIKELY( err ) ) return err;
10114 12 : return FD_BINCODE_SUCCESS;
10115 12 : }
10116 0 : static inline int fd_stake_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10117 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10118 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
10119 0 : return 0;
10120 0 : }
10121 0 : static void fd_stake_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10122 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)struct_mem;
10123 0 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
10124 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
10125 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
10126 0 : }
10127 0 : void * fd_stake_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10128 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)mem;
10129 0 : fd_stake_meta_new( self );
10130 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_meta_t);
10131 0 : void * * alloc_mem = &alloc_region;
10132 0 : fd_stake_meta_decode_inner( mem, alloc_mem, ctx );
10133 0 : return self;
10134 0 : }
10135 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 ) {
10136 0 : (void) varint;
10137 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_meta", level++, 0 );
10138 0 : fun( w, &self->rent_exempt_reserve, "rent_exempt_reserve", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10139 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level, 0 );
10140 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
10141 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_meta", level--, 0 );
10142 0 : }
10143 12 : int fd_stake_flags_encode( fd_stake_flags_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10144 12 : int err;
10145 12 : err = fd_bincode_uint8_encode( (uchar)(self->bits), ctx );
10146 12 : if( FD_UNLIKELY( err ) ) return err;
10147 12 : return FD_BINCODE_SUCCESS;
10148 12 : }
10149 0 : static inline int fd_stake_flags_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10150 0 : if( (ulong)ctx->data + 1UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10151 0 : ctx->data = (void *)( (ulong)ctx->data + 1UL );
10152 0 : return 0;
10153 0 : }
10154 0 : static void fd_stake_flags_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10155 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)struct_mem;
10156 0 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
10157 0 : }
10158 0 : void * fd_stake_flags_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10159 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)mem;
10160 0 : fd_stake_flags_new( self );
10161 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_flags_t);
10162 0 : void * * alloc_mem = &alloc_region;
10163 0 : fd_stake_flags_decode_inner( mem, alloc_mem, ctx );
10164 0 : return self;
10165 0 : }
10166 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 ) {
10167 0 : (void) varint;
10168 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_flags", level++, 0 );
10169 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
10170 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_flags", level--, 0 );
10171 0 : }
10172 0 : int fd_stake_state_v2_initialized_encode( fd_stake_state_v2_initialized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10173 0 : int err;
10174 0 : err = fd_stake_meta_encode( &self->meta, ctx );
10175 0 : if( FD_UNLIKELY( err ) ) return err;
10176 0 : return FD_BINCODE_SUCCESS;
10177 0 : }
10178 0 : static inline int fd_stake_state_v2_initialized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10179 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10180 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
10181 0 : return 0;
10182 0 : }
10183 0 : static void fd_stake_state_v2_initialized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10184 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)struct_mem;
10185 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
10186 0 : }
10187 0 : void * fd_stake_state_v2_initialized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10188 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)mem;
10189 0 : fd_stake_state_v2_initialized_new( self );
10190 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_initialized_t);
10191 0 : void * * alloc_mem = &alloc_region;
10192 0 : fd_stake_state_v2_initialized_decode_inner( mem, alloc_mem, ctx );
10193 0 : return self;
10194 0 : }
10195 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 ) {
10196 0 : (void) varint;
10197 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_initialized", level++, 0 );
10198 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level, 0 );
10199 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_initialized", level--, 0 );
10200 0 : }
10201 12 : int fd_stake_state_v2_stake_encode( fd_stake_state_v2_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10202 12 : int err;
10203 12 : err = fd_stake_meta_encode( &self->meta, ctx );
10204 12 : if( FD_UNLIKELY( err ) ) return err;
10205 12 : err = fd_stake_encode( &self->stake, ctx );
10206 12 : if( FD_UNLIKELY( err ) ) return err;
10207 12 : err = fd_stake_flags_encode( &self->stake_flags, ctx );
10208 12 : if( FD_UNLIKELY( err ) ) return err;
10209 12 : return FD_BINCODE_SUCCESS;
10210 12 : }
10211 0 : static inline int fd_stake_state_v2_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10212 0 : if( (ulong)ctx->data + 193UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10213 0 : ctx->data = (void *)( (ulong)ctx->data + 193UL );
10214 0 : return 0;
10215 0 : }
10216 0 : static void fd_stake_state_v2_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10217 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)struct_mem;
10218 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
10219 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
10220 0 : fd_stake_flags_decode_inner( &self->stake_flags, alloc_mem, ctx );
10221 0 : }
10222 0 : void * fd_stake_state_v2_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10223 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)mem;
10224 0 : fd_stake_state_v2_stake_new( self );
10225 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_stake_t);
10226 0 : void * * alloc_mem = &alloc_region;
10227 0 : fd_stake_state_v2_stake_decode_inner( mem, alloc_mem, ctx );
10228 0 : return self;
10229 0 : }
10230 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 ) {
10231 0 : (void) varint;
10232 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_stake", level++, 0 );
10233 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level, 0 );
10234 0 : fd_stake_walk( w, &self->stake, fun, "stake", level, 0 );
10235 0 : fd_stake_flags_walk( w, &self->stake_flags, fun, "stake_flags", level, 0 );
10236 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_stake", level--, 0 );
10237 0 : }
10238 0 : FD_FN_PURE uchar fd_stake_state_v2_is_uninitialized(fd_stake_state_v2_t const * self) {
10239 0 : return self->discriminant == 0;
10240 0 : }
10241 0 : FD_FN_PURE uchar fd_stake_state_v2_is_initialized(fd_stake_state_v2_t const * self) {
10242 0 : return self->discriminant == 1;
10243 0 : }
10244 0 : FD_FN_PURE uchar fd_stake_state_v2_is_stake(fd_stake_state_v2_t const * self) {
10245 0 : return self->discriminant == 2;
10246 0 : }
10247 0 : FD_FN_PURE uchar fd_stake_state_v2_is_rewards_pool(fd_stake_state_v2_t const * self) {
10248 0 : return self->discriminant == 3;
10249 0 : }
10250 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant );
10251 0 : int fd_stake_state_v2_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10252 0 : int err;
10253 0 : switch (discriminant) {
10254 0 : case 0: {
10255 0 : return FD_BINCODE_SUCCESS;
10256 0 : }
10257 0 : case 1: {
10258 0 : err = fd_stake_state_v2_initialized_decode_footprint_inner( ctx, total_sz );
10259 0 : if( FD_UNLIKELY( err ) ) return err;
10260 0 : return FD_BINCODE_SUCCESS;
10261 0 : }
10262 0 : case 2: {
10263 0 : err = fd_stake_state_v2_stake_decode_footprint_inner( ctx, total_sz );
10264 0 : if( FD_UNLIKELY( err ) ) return err;
10265 0 : return FD_BINCODE_SUCCESS;
10266 0 : }
10267 0 : case 3: {
10268 0 : return FD_BINCODE_SUCCESS;
10269 0 : }
10270 0 : default: return FD_BINCODE_ERR_ENCODING;
10271 0 : }
10272 0 : }
10273 0 : static int fd_stake_state_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10274 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10275 0 : uint discriminant = 0;
10276 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10277 0 : if( FD_UNLIKELY( err ) ) return err;
10278 0 : return fd_stake_state_v2_inner_decode_footprint( discriminant, ctx, total_sz );
10279 0 : }
10280 0 : int fd_stake_state_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10281 0 : *total_sz += sizeof(fd_stake_state_v2_t);
10282 0 : void const * start_data = ctx->data;
10283 0 : int err = fd_stake_state_v2_decode_footprint_inner( ctx, total_sz );
10284 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10285 0 : ctx->data = start_data;
10286 0 : return err;
10287 0 : }
10288 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 ) {
10289 0 : switch (discriminant) {
10290 0 : case 0: {
10291 0 : break;
10292 0 : }
10293 0 : case 1: {
10294 0 : fd_stake_state_v2_initialized_decode_inner( &self->initialized, alloc_mem, ctx );
10295 0 : break;
10296 0 : }
10297 0 : case 2: {
10298 0 : fd_stake_state_v2_stake_decode_inner( &self->stake, alloc_mem, ctx );
10299 0 : break;
10300 0 : }
10301 0 : case 3: {
10302 0 : break;
10303 0 : }
10304 0 : }
10305 0 : }
10306 0 : static void fd_stake_state_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10307 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)struct_mem;
10308 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10309 0 : fd_stake_state_v2_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10310 0 : }
10311 0 : void * fd_stake_state_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10312 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)mem;
10313 0 : fd_stake_state_v2_new( self );
10314 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_t);
10315 0 : void * * alloc_mem = &alloc_region;
10316 0 : fd_stake_state_v2_decode_inner( mem, alloc_mem, ctx );
10317 0 : return self;
10318 0 : }
10319 12 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant ) {
10320 12 : switch( discriminant ) {
10321 0 : case 0: {
10322 0 : break;
10323 0 : }
10324 0 : case 1: {
10325 0 : fd_stake_state_v2_initialized_new( &self->initialized );
10326 0 : break;
10327 0 : }
10328 12 : case 2: {
10329 12 : fd_stake_state_v2_stake_new( &self->stake );
10330 12 : break;
10331 0 : }
10332 0 : case 3: {
10333 0 : break;
10334 0 : }
10335 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10336 12 : }
10337 12 : }
10338 12 : void fd_stake_state_v2_new_disc( fd_stake_state_v2_t * self, uint discriminant ) {
10339 12 : self->discriminant = discriminant;
10340 12 : fd_stake_state_v2_inner_new( &self->inner, self->discriminant );
10341 12 : }
10342 0 : void fd_stake_state_v2_new( fd_stake_state_v2_t * self ) {
10343 0 : fd_memset( self, 0, sizeof(fd_stake_state_v2_t) );
10344 0 : fd_stake_state_v2_new_disc( self, UINT_MAX );
10345 0 : }
10346 :
10347 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 ) {
10348 0 : (void) varint;
10349 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_state_v2", level++, 0);
10350 0 : switch( self->discriminant ) {
10351 0 : case 0: {
10352 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10353 0 : break;
10354 0 : }
10355 0 : case 1: {
10356 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10357 0 : fd_stake_state_v2_initialized_walk( w, &self->inner.initialized, fun, "initialized", level, 0 );
10358 0 : break;
10359 0 : }
10360 0 : case 2: {
10361 0 : fun( w, self, "stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10362 0 : fd_stake_state_v2_stake_walk( w, &self->inner.stake, fun, "stake", level, 0 );
10363 0 : break;
10364 0 : }
10365 0 : case 3: {
10366 0 : fun( w, self, "rewards_pool", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10367 0 : break;
10368 0 : }
10369 0 : }
10370 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_state_v2", level--, 0 );
10371 0 : }
10372 0 : ulong fd_stake_state_v2_size( fd_stake_state_v2_t const * self ) {
10373 0 : ulong size = 0;
10374 0 : size += sizeof(uint);
10375 0 : switch (self->discriminant) {
10376 0 : case 1: {
10377 0 : size += fd_stake_state_v2_initialized_size( &self->inner.initialized );
10378 0 : break;
10379 0 : }
10380 0 : case 2: {
10381 0 : size += fd_stake_state_v2_stake_size( &self->inner.stake );
10382 0 : break;
10383 0 : }
10384 0 : }
10385 0 : return size;
10386 0 : }
10387 :
10388 12 : int fd_stake_state_v2_inner_encode( fd_stake_state_v2_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10389 12 : int err;
10390 12 : switch (discriminant) {
10391 0 : case 1: {
10392 0 : err = fd_stake_state_v2_initialized_encode( &self->initialized, ctx );
10393 0 : if( FD_UNLIKELY( err ) ) return err;
10394 0 : break;
10395 0 : }
10396 12 : case 2: {
10397 12 : err = fd_stake_state_v2_stake_encode( &self->stake, ctx );
10398 12 : if( FD_UNLIKELY( err ) ) return err;
10399 12 : break;
10400 12 : }
10401 12 : }
10402 12 : return FD_BINCODE_SUCCESS;
10403 12 : }
10404 12 : int fd_stake_state_v2_encode( fd_stake_state_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10405 12 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10406 12 : if( FD_UNLIKELY( err ) ) return err;
10407 12 : return fd_stake_state_v2_inner_encode( &self->inner, self->discriminant, ctx );
10408 12 : }
10409 :
10410 0 : int fd_nonce_data_encode( fd_nonce_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10411 0 : int err;
10412 0 : err = fd_pubkey_encode( &self->authority, ctx );
10413 0 : if( FD_UNLIKELY( err ) ) return err;
10414 0 : err = fd_hash_encode( &self->durable_nonce, ctx );
10415 0 : if( FD_UNLIKELY( err ) ) return err;
10416 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
10417 0 : if( FD_UNLIKELY( err ) ) return err;
10418 0 : return FD_BINCODE_SUCCESS;
10419 0 : }
10420 0 : static inline int fd_nonce_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10421 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10422 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
10423 0 : return 0;
10424 0 : }
10425 0 : static void fd_nonce_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10426 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)struct_mem;
10427 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
10428 0 : fd_hash_decode_inner( &self->durable_nonce, alloc_mem, ctx );
10429 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
10430 0 : }
10431 0 : void * fd_nonce_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10432 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)mem;
10433 0 : fd_nonce_data_new( self );
10434 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_data_t);
10435 0 : void * * alloc_mem = &alloc_region;
10436 0 : fd_nonce_data_decode_inner( mem, alloc_mem, ctx );
10437 0 : return self;
10438 0 : }
10439 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 ) {
10440 0 : (void) varint;
10441 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_nonce_data", level++, 0 );
10442 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level, 0 );
10443 0 : fd_hash_walk( w, &self->durable_nonce, fun, "durable_nonce", level, 0 );
10444 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
10445 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_nonce_data", level--, 0 );
10446 0 : }
10447 0 : FD_FN_PURE uchar fd_nonce_state_is_uninitialized(fd_nonce_state_t const * self) {
10448 0 : return self->discriminant == 0;
10449 0 : }
10450 0 : FD_FN_PURE uchar fd_nonce_state_is_initialized(fd_nonce_state_t const * self) {
10451 0 : return self->discriminant == 1;
10452 0 : }
10453 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant );
10454 0 : int fd_nonce_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10455 0 : int err;
10456 0 : switch (discriminant) {
10457 0 : case 0: {
10458 0 : return FD_BINCODE_SUCCESS;
10459 0 : }
10460 0 : case 1: {
10461 0 : err = fd_nonce_data_decode_footprint_inner( ctx, total_sz );
10462 0 : if( FD_UNLIKELY( err ) ) return err;
10463 0 : return FD_BINCODE_SUCCESS;
10464 0 : }
10465 0 : default: return FD_BINCODE_ERR_ENCODING;
10466 0 : }
10467 0 : }
10468 0 : static int fd_nonce_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10469 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10470 0 : uint discriminant = 0;
10471 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10472 0 : if( FD_UNLIKELY( err ) ) return err;
10473 0 : return fd_nonce_state_inner_decode_footprint( discriminant, ctx, total_sz );
10474 0 : }
10475 0 : int fd_nonce_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10476 0 : *total_sz += sizeof(fd_nonce_state_t);
10477 0 : void const * start_data = ctx->data;
10478 0 : int err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
10479 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10480 0 : ctx->data = start_data;
10481 0 : return err;
10482 0 : }
10483 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 ) {
10484 0 : switch (discriminant) {
10485 0 : case 0: {
10486 0 : break;
10487 0 : }
10488 0 : case 1: {
10489 0 : fd_nonce_data_decode_inner( &self->initialized, alloc_mem, ctx );
10490 0 : break;
10491 0 : }
10492 0 : }
10493 0 : }
10494 0 : static void fd_nonce_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10495 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)struct_mem;
10496 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10497 0 : fd_nonce_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10498 0 : }
10499 0 : void * fd_nonce_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10500 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)mem;
10501 0 : fd_nonce_state_new( self );
10502 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_t);
10503 0 : void * * alloc_mem = &alloc_region;
10504 0 : fd_nonce_state_decode_inner( mem, alloc_mem, ctx );
10505 0 : return self;
10506 0 : }
10507 0 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant ) {
10508 0 : switch( discriminant ) {
10509 0 : case 0: {
10510 0 : break;
10511 0 : }
10512 0 : case 1: {
10513 0 : fd_nonce_data_new( &self->initialized );
10514 0 : break;
10515 0 : }
10516 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10517 0 : }
10518 0 : }
10519 0 : void fd_nonce_state_new_disc( fd_nonce_state_t * self, uint discriminant ) {
10520 0 : self->discriminant = discriminant;
10521 0 : fd_nonce_state_inner_new( &self->inner, self->discriminant );
10522 0 : }
10523 0 : void fd_nonce_state_new( fd_nonce_state_t * self ) {
10524 0 : fd_memset( self, 0, sizeof(fd_nonce_state_t) );
10525 0 : fd_nonce_state_new_disc( self, UINT_MAX );
10526 0 : }
10527 :
10528 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 ) {
10529 0 : (void) varint;
10530 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state", level++, 0);
10531 0 : switch( self->discriminant ) {
10532 0 : case 0: {
10533 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10534 0 : break;
10535 0 : }
10536 0 : case 1: {
10537 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10538 0 : fd_nonce_data_walk( w, &self->inner.initialized, fun, "initialized", level, 0 );
10539 0 : break;
10540 0 : }
10541 0 : }
10542 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state", level--, 0 );
10543 0 : }
10544 0 : ulong fd_nonce_state_size( fd_nonce_state_t const * self ) {
10545 0 : ulong size = 0;
10546 0 : size += sizeof(uint);
10547 0 : switch (self->discriminant) {
10548 0 : case 1: {
10549 0 : size += fd_nonce_data_size( &self->inner.initialized );
10550 0 : break;
10551 0 : }
10552 0 : }
10553 0 : return size;
10554 0 : }
10555 :
10556 0 : int fd_nonce_state_inner_encode( fd_nonce_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10557 0 : int err;
10558 0 : switch (discriminant) {
10559 0 : case 1: {
10560 0 : err = fd_nonce_data_encode( &self->initialized, ctx );
10561 0 : if( FD_UNLIKELY( err ) ) return err;
10562 0 : break;
10563 0 : }
10564 0 : }
10565 0 : return FD_BINCODE_SUCCESS;
10566 0 : }
10567 0 : int fd_nonce_state_encode( fd_nonce_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10568 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10569 0 : if( FD_UNLIKELY( err ) ) return err;
10570 0 : return fd_nonce_state_inner_encode( &self->inner, self->discriminant, ctx );
10571 0 : }
10572 :
10573 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_legacy(fd_nonce_state_versions_t const * self) {
10574 0 : return self->discriminant == 0;
10575 0 : }
10576 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_current(fd_nonce_state_versions_t const * self) {
10577 0 : return self->discriminant == 1;
10578 0 : }
10579 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant );
10580 0 : int fd_nonce_state_versions_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10581 0 : int err;
10582 0 : switch (discriminant) {
10583 0 : case 0: {
10584 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
10585 0 : if( FD_UNLIKELY( err ) ) return err;
10586 0 : return FD_BINCODE_SUCCESS;
10587 0 : }
10588 0 : case 1: {
10589 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
10590 0 : if( FD_UNLIKELY( err ) ) return err;
10591 0 : return FD_BINCODE_SUCCESS;
10592 0 : }
10593 0 : default: return FD_BINCODE_ERR_ENCODING;
10594 0 : }
10595 0 : }
10596 0 : static int fd_nonce_state_versions_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10597 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10598 0 : uint discriminant = 0;
10599 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10600 0 : if( FD_UNLIKELY( err ) ) return err;
10601 0 : return fd_nonce_state_versions_inner_decode_footprint( discriminant, ctx, total_sz );
10602 0 : }
10603 0 : int fd_nonce_state_versions_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10604 0 : *total_sz += sizeof(fd_nonce_state_versions_t);
10605 0 : void const * start_data = ctx->data;
10606 0 : int err = fd_nonce_state_versions_decode_footprint_inner( ctx, total_sz );
10607 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10608 0 : ctx->data = start_data;
10609 0 : return err;
10610 0 : }
10611 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 ) {
10612 0 : switch (discriminant) {
10613 0 : case 0: {
10614 0 : fd_nonce_state_decode_inner( &self->legacy, alloc_mem, ctx );
10615 0 : break;
10616 0 : }
10617 0 : case 1: {
10618 0 : fd_nonce_state_decode_inner( &self->current, alloc_mem, ctx );
10619 0 : break;
10620 0 : }
10621 0 : }
10622 0 : }
10623 0 : static void fd_nonce_state_versions_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10624 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)struct_mem;
10625 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10626 0 : fd_nonce_state_versions_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10627 0 : }
10628 0 : void * fd_nonce_state_versions_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10629 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)mem;
10630 0 : fd_nonce_state_versions_new( self );
10631 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_versions_t);
10632 0 : void * * alloc_mem = &alloc_region;
10633 0 : fd_nonce_state_versions_decode_inner( mem, alloc_mem, ctx );
10634 0 : return self;
10635 0 : }
10636 0 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
10637 0 : switch( discriminant ) {
10638 0 : case 0: {
10639 0 : fd_nonce_state_new( &self->legacy );
10640 0 : break;
10641 0 : }
10642 0 : case 1: {
10643 0 : fd_nonce_state_new( &self->current );
10644 0 : break;
10645 0 : }
10646 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10647 0 : }
10648 0 : }
10649 0 : void fd_nonce_state_versions_new_disc( fd_nonce_state_versions_t * self, uint discriminant ) {
10650 0 : self->discriminant = discriminant;
10651 0 : fd_nonce_state_versions_inner_new( &self->inner, self->discriminant );
10652 0 : }
10653 0 : void fd_nonce_state_versions_new( fd_nonce_state_versions_t * self ) {
10654 0 : fd_memset( self, 0, sizeof(fd_nonce_state_versions_t) );
10655 0 : fd_nonce_state_versions_new_disc( self, UINT_MAX );
10656 0 : }
10657 :
10658 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 ) {
10659 0 : (void) varint;
10660 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state_versions", level++, 0);
10661 0 : switch( self->discriminant ) {
10662 0 : case 0: {
10663 0 : fun( w, self, "legacy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10664 0 : fd_nonce_state_walk( w, &self->inner.legacy, fun, "legacy", level, 0 );
10665 0 : break;
10666 0 : }
10667 0 : case 1: {
10668 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10669 0 : fd_nonce_state_walk( w, &self->inner.current, fun, "current", level, 0 );
10670 0 : break;
10671 0 : }
10672 0 : }
10673 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state_versions", level--, 0 );
10674 0 : }
10675 0 : ulong fd_nonce_state_versions_size( fd_nonce_state_versions_t const * self ) {
10676 0 : ulong size = 0;
10677 0 : size += sizeof(uint);
10678 0 : switch (self->discriminant) {
10679 0 : case 0: {
10680 0 : size += fd_nonce_state_size( &self->inner.legacy );
10681 0 : break;
10682 0 : }
10683 0 : case 1: {
10684 0 : size += fd_nonce_state_size( &self->inner.current );
10685 0 : break;
10686 0 : }
10687 0 : }
10688 0 : return size;
10689 0 : }
10690 :
10691 0 : int fd_nonce_state_versions_inner_encode( fd_nonce_state_versions_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10692 0 : int err;
10693 0 : switch (discriminant) {
10694 0 : case 0: {
10695 0 : err = fd_nonce_state_encode( &self->legacy, ctx );
10696 0 : if( FD_UNLIKELY( err ) ) return err;
10697 0 : break;
10698 0 : }
10699 0 : case 1: {
10700 0 : err = fd_nonce_state_encode( &self->current, ctx );
10701 0 : if( FD_UNLIKELY( err ) ) return err;
10702 0 : break;
10703 0 : }
10704 0 : }
10705 0 : return FD_BINCODE_SUCCESS;
10706 0 : }
10707 0 : int fd_nonce_state_versions_encode( fd_nonce_state_versions_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10708 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10709 0 : if( FD_UNLIKELY( err ) ) return err;
10710 0 : return fd_nonce_state_versions_inner_encode( &self->inner, self->discriminant, ctx );
10711 0 : }
10712 :
10713 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 ) {
10714 0 : int err;
10715 0 : err = fd_bincode_uint32_encode( self->units, ctx );
10716 0 : if( FD_UNLIKELY( err ) ) return err;
10717 0 : err = fd_bincode_uint32_encode( self->additional_fee, ctx );
10718 0 : if( FD_UNLIKELY( err ) ) return err;
10719 0 : return FD_BINCODE_SUCCESS;
10720 0 : }
10721 0 : static inline int fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10722 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10723 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
10724 0 : return 0;
10725 0 : }
10726 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 ) {
10727 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)struct_mem;
10728 0 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
10729 0 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
10730 0 : }
10731 0 : void * fd_compute_budget_program_instruction_request_units_deprecated_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10732 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)mem;
10733 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( self );
10734 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t);
10735 0 : void * * alloc_mem = &alloc_region;
10736 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( mem, alloc_mem, ctx );
10737 0 : return self;
10738 0 : }
10739 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 ) {
10740 0 : (void) varint;
10741 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compute_budget_program_instruction_request_units_deprecated", level++, 0 );
10742 0 : fun( w, &self->units, "units", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10743 0 : fun( w, &self->additional_fee, "additional_fee", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10744 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compute_budget_program_instruction_request_units_deprecated", level--, 0 );
10745 0 : }
10746 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_units_deprecated(fd_compute_budget_program_instruction_t const * self) {
10747 0 : return self->discriminant == 0;
10748 0 : }
10749 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_heap_frame(fd_compute_budget_program_instruction_t const * self) {
10750 0 : return self->discriminant == 1;
10751 0 : }
10752 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_limit(fd_compute_budget_program_instruction_t const * self) {
10753 0 : return self->discriminant == 2;
10754 0 : }
10755 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_price(fd_compute_budget_program_instruction_t const * self) {
10756 0 : return self->discriminant == 3;
10757 0 : }
10758 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) {
10759 0 : return self->discriminant == 4;
10760 0 : }
10761 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant );
10762 0 : int fd_compute_budget_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10763 0 : int err;
10764 0 : switch (discriminant) {
10765 0 : case 0: {
10766 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( ctx, total_sz );
10767 0 : if( FD_UNLIKELY( err ) ) return err;
10768 0 : return FD_BINCODE_SUCCESS;
10769 0 : }
10770 0 : case 1: {
10771 0 : err = fd_bincode_uint32_decode_footprint( ctx );
10772 0 : if( FD_UNLIKELY( err ) ) return err;
10773 0 : return FD_BINCODE_SUCCESS;
10774 0 : }
10775 0 : case 2: {
10776 0 : err = fd_bincode_uint32_decode_footprint( ctx );
10777 0 : if( FD_UNLIKELY( err ) ) return err;
10778 0 : return FD_BINCODE_SUCCESS;
10779 0 : }
10780 0 : case 3: {
10781 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10782 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10783 0 : return FD_BINCODE_SUCCESS;
10784 0 : }
10785 0 : case 4: {
10786 0 : err = fd_bincode_uint32_decode_footprint( ctx );
10787 0 : if( FD_UNLIKELY( err ) ) return err;
10788 0 : return FD_BINCODE_SUCCESS;
10789 0 : }
10790 0 : default: return FD_BINCODE_ERR_ENCODING;
10791 0 : }
10792 0 : }
10793 0 : static int fd_compute_budget_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10794 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10795 0 : ushort discriminant = 0;
10796 0 : int err = fd_bincode_compact_u16_decode( &discriminant, ctx );
10797 0 : if( FD_UNLIKELY( err ) ) return err;
10798 0 : return fd_compute_budget_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
10799 0 : }
10800 0 : int fd_compute_budget_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10801 0 : *total_sz += sizeof(fd_compute_budget_program_instruction_t);
10802 0 : void const * start_data = ctx->data;
10803 0 : int err = fd_compute_budget_program_instruction_decode_footprint_inner( ctx, total_sz );
10804 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10805 0 : ctx->data = start_data;
10806 0 : return err;
10807 0 : }
10808 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 ) {
10809 0 : switch (discriminant) {
10810 0 : case 0: {
10811 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( &self->request_units_deprecated, alloc_mem, ctx );
10812 0 : break;
10813 0 : }
10814 0 : case 1: {
10815 0 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
10816 0 : break;
10817 0 : }
10818 0 : case 2: {
10819 0 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
10820 0 : break;
10821 0 : }
10822 0 : case 3: {
10823 0 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
10824 0 : break;
10825 0 : }
10826 0 : case 4: {
10827 0 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
10828 0 : break;
10829 0 : }
10830 0 : }
10831 0 : }
10832 0 : static void fd_compute_budget_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10833 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)struct_mem;
10834 0 : ushort tmp = 0;
10835 0 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
10836 0 : self->discriminant = tmp;
10837 0 : fd_compute_budget_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10838 0 : }
10839 0 : void * fd_compute_budget_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10840 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)mem;
10841 0 : fd_compute_budget_program_instruction_new( self );
10842 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_t);
10843 0 : void * * alloc_mem = &alloc_region;
10844 0 : fd_compute_budget_program_instruction_decode_inner( mem, alloc_mem, ctx );
10845 0 : return self;
10846 0 : }
10847 0 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
10848 0 : switch( discriminant ) {
10849 0 : case 0: {
10850 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( &self->request_units_deprecated );
10851 0 : break;
10852 0 : }
10853 0 : case 1: {
10854 0 : break;
10855 0 : }
10856 0 : case 2: {
10857 0 : break;
10858 0 : }
10859 0 : case 3: {
10860 0 : break;
10861 0 : }
10862 0 : case 4: {
10863 0 : break;
10864 0 : }
10865 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10866 0 : }
10867 0 : }
10868 0 : void fd_compute_budget_program_instruction_new_disc( fd_compute_budget_program_instruction_t * self, uint discriminant ) {
10869 0 : self->discriminant = discriminant;
10870 0 : fd_compute_budget_program_instruction_inner_new( &self->inner, self->discriminant );
10871 0 : }
10872 0 : void fd_compute_budget_program_instruction_new( fd_compute_budget_program_instruction_t * self ) {
10873 0 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_t) );
10874 0 : fd_compute_budget_program_instruction_new_disc( self, UINT_MAX );
10875 0 : }
10876 :
10877 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 ) {
10878 0 : (void) varint;
10879 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_compute_budget_program_instruction", level++, 0);
10880 0 : switch( self->discriminant ) {
10881 0 : case 0: {
10882 0 : fun( w, self, "request_units_deprecated", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10883 0 : fd_compute_budget_program_instruction_request_units_deprecated_walk( w, &self->inner.request_units_deprecated, fun, "request_units_deprecated", level, 0 );
10884 0 : break;
10885 0 : }
10886 0 : case 1: {
10887 0 : fun( w, self, "request_heap_frame", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10888 0 : fun( w, &self->inner.request_heap_frame, "request_heap_frame", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10889 0 : break;
10890 0 : }
10891 0 : case 2: {
10892 0 : fun( w, self, "set_compute_unit_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10893 0 : fun( w, &self->inner.set_compute_unit_limit, "set_compute_unit_limit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10894 0 : break;
10895 0 : }
10896 0 : case 3: {
10897 0 : fun( w, self, "set_compute_unit_price", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10898 0 : fun( w, &self->inner.set_compute_unit_price, "set_compute_unit_price", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10899 0 : break;
10900 0 : }
10901 0 : case 4: {
10902 0 : fun( w, self, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10903 0 : fun( w, &self->inner.set_loaded_accounts_data_size_limit, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10904 0 : break;
10905 0 : }
10906 0 : }
10907 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_compute_budget_program_instruction", level--, 0 );
10908 0 : }
10909 0 : ulong fd_compute_budget_program_instruction_size( fd_compute_budget_program_instruction_t const * self ) {
10910 0 : ulong size = 0;
10911 0 : size += sizeof(uint);
10912 0 : switch (self->discriminant) {
10913 0 : case 0: {
10914 0 : size += fd_compute_budget_program_instruction_request_units_deprecated_size( &self->inner.request_units_deprecated );
10915 0 : break;
10916 0 : }
10917 0 : case 1: {
10918 0 : size += sizeof(uint);
10919 0 : break;
10920 0 : }
10921 0 : case 2: {
10922 0 : size += sizeof(uint);
10923 0 : break;
10924 0 : }
10925 0 : case 3: {
10926 0 : size += sizeof(ulong);
10927 0 : break;
10928 0 : }
10929 0 : case 4: {
10930 0 : size += sizeof(uint);
10931 0 : break;
10932 0 : }
10933 0 : }
10934 0 : return size;
10935 0 : }
10936 :
10937 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 ) {
10938 0 : int err;
10939 0 : switch (discriminant) {
10940 0 : case 0: {
10941 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_encode( &self->request_units_deprecated, ctx );
10942 0 : if( FD_UNLIKELY( err ) ) return err;
10943 0 : break;
10944 0 : }
10945 0 : case 1: {
10946 0 : err = fd_bincode_uint32_encode( self->request_heap_frame, ctx );
10947 0 : if( FD_UNLIKELY( err ) ) return err;
10948 0 : break;
10949 0 : }
10950 0 : case 2: {
10951 0 : err = fd_bincode_uint32_encode( self->set_compute_unit_limit, ctx );
10952 0 : if( FD_UNLIKELY( err ) ) return err;
10953 0 : break;
10954 0 : }
10955 0 : case 3: {
10956 0 : err = fd_bincode_uint64_encode( self->set_compute_unit_price, ctx );
10957 0 : if( FD_UNLIKELY( err ) ) return err;
10958 0 : break;
10959 0 : }
10960 0 : case 4: {
10961 0 : err = fd_bincode_uint32_encode( self->set_loaded_accounts_data_size_limit, ctx );
10962 0 : if( FD_UNLIKELY( err ) ) return err;
10963 0 : break;
10964 0 : }
10965 0 : }
10966 0 : return FD_BINCODE_SUCCESS;
10967 0 : }
10968 0 : int fd_compute_budget_program_instruction_encode( fd_compute_budget_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10969 0 : ushort discriminant = (ushort) self->discriminant;
10970 0 : int err = fd_bincode_compact_u16_encode( &discriminant, ctx );
10971 0 : if( FD_UNLIKELY( err ) ) return err;
10972 0 : return fd_compute_budget_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
10973 0 : }
10974 :
10975 0 : int fd_config_keys_encode( fd_config_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10976 0 : int err;
10977 0 : err = fd_bincode_compact_u16_encode( &self->keys_len, ctx );
10978 0 : if( FD_UNLIKELY(err) ) return err;
10979 0 : if( self->keys_len ) {
10980 0 : for( ulong i=0; i < self->keys_len; i++ ) {
10981 0 : err = fd_config_keys_pair_encode( self->keys + i, ctx );
10982 0 : if( FD_UNLIKELY( err ) ) return err;
10983 0 : }
10984 0 : }
10985 0 : return FD_BINCODE_SUCCESS;
10986 0 : }
10987 0 : static int fd_config_keys_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10988 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10989 0 : int err = 0;
10990 0 : ushort keys_len;
10991 0 : err = fd_bincode_compact_u16_decode( &keys_len, ctx );
10992 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10993 0 : if( keys_len ) {
10994 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*keys_len;
10995 0 : for( ulong i=0; i < keys_len; i++ ) {
10996 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
10997 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10998 0 : }
10999 0 : }
11000 0 : return 0;
11001 0 : }
11002 0 : int fd_config_keys_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11003 0 : *total_sz += sizeof(fd_config_keys_t);
11004 0 : void const * start_data = ctx->data;
11005 0 : int err = fd_config_keys_decode_footprint_inner( ctx, total_sz );
11006 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11007 0 : ctx->data = start_data;
11008 0 : return err;
11009 0 : }
11010 0 : static void fd_config_keys_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11011 0 : fd_config_keys_t * self = (fd_config_keys_t *)struct_mem;
11012 0 : fd_bincode_compact_u16_decode_unsafe( &self->keys_len, ctx );
11013 0 : if( self->keys_len ) {
11014 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
11015 0 : self->keys = *alloc_mem;
11016 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->keys_len;
11017 0 : for( ulong i=0; i < self->keys_len; i++ ) {
11018 0 : fd_config_keys_pair_new( self->keys + i );
11019 0 : fd_config_keys_pair_decode_inner( self->keys + i, alloc_mem, ctx );
11020 0 : }
11021 0 : } else
11022 0 : self->keys = NULL;
11023 0 : }
11024 0 : void * fd_config_keys_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11025 0 : fd_config_keys_t * self = (fd_config_keys_t *)mem;
11026 0 : fd_config_keys_new( self );
11027 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_t);
11028 0 : void * * alloc_mem = &alloc_region;
11029 0 : fd_config_keys_decode_inner( mem, alloc_mem, ctx );
11030 0 : return self;
11031 0 : }
11032 0 : void fd_config_keys_new(fd_config_keys_t * self) {
11033 0 : fd_memset( self, 0, sizeof(fd_config_keys_t) );
11034 0 : }
11035 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 ) {
11036 0 : (void) varint;
11037 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys", level++, 0 );
11038 0 : fun( w, &self->keys_len, "keys_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
11039 0 : if( self->keys_len ) {
11040 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11041 0 : for( ulong i=0; i < self->keys_len; i++ )
11042 0 : fd_config_keys_pair_walk(w, self->keys + i, fun, "config_keys_pair", level, 0 );
11043 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11044 0 : }
11045 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys", level--, 0 );
11046 0 : }
11047 0 : ulong fd_config_keys_size( fd_config_keys_t const * self ) {
11048 0 : ulong size = 0;
11049 0 : do {
11050 0 : ushort tmp = (ushort)self->keys_len;
11051 0 : size += fd_bincode_compact_u16_size( &tmp );
11052 0 : for( ulong i=0; i < self->keys_len; i++ )
11053 0 : size += fd_config_keys_pair_size( self->keys + i );
11054 0 : } while(0);
11055 0 : return size;
11056 0 : }
11057 :
11058 0 : int fd_bpf_loader_program_instruction_write_encode( fd_bpf_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11059 0 : int err;
11060 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
11061 0 : if( FD_UNLIKELY( err ) ) return err;
11062 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
11063 0 : if( FD_UNLIKELY(err) ) return err;
11064 0 : if( self->bytes_len ) {
11065 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
11066 0 : if( FD_UNLIKELY( err ) ) return err;
11067 0 : }
11068 0 : return FD_BINCODE_SUCCESS;
11069 0 : }
11070 0 : static int fd_bpf_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11071 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11072 0 : int err = 0;
11073 0 : err = fd_bincode_uint32_decode_footprint( ctx );
11074 0 : if( FD_UNLIKELY( err ) ) return err;
11075 0 : ulong bytes_len;
11076 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
11077 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11078 0 : if( bytes_len ) {
11079 0 : *total_sz += 8UL + bytes_len;
11080 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
11081 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11082 0 : }
11083 0 : return 0;
11084 0 : }
11085 0 : int fd_bpf_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11086 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_write_t);
11087 0 : void const * start_data = ctx->data;
11088 0 : int err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11089 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11090 0 : ctx->data = start_data;
11091 0 : return err;
11092 0 : }
11093 0 : static void fd_bpf_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11094 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)struct_mem;
11095 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
11096 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
11097 0 : if( self->bytes_len ) {
11098 0 : self->bytes = *alloc_mem;
11099 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
11100 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
11101 0 : } else
11102 0 : self->bytes = NULL;
11103 0 : }
11104 0 : void * fd_bpf_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11105 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)mem;
11106 0 : fd_bpf_loader_program_instruction_write_new( self );
11107 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_write_t);
11108 0 : void * * alloc_mem = &alloc_region;
11109 0 : fd_bpf_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
11110 0 : return self;
11111 0 : }
11112 0 : void fd_bpf_loader_program_instruction_write_new(fd_bpf_loader_program_instruction_write_t * self) {
11113 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_write_t) );
11114 0 : }
11115 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 ) {
11116 0 : (void) varint;
11117 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_loader_program_instruction_write", level++, 0 );
11118 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11119 0 : if( self->bytes_len ) {
11120 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11121 0 : for( ulong i=0; i < self->bytes_len; i++ )
11122 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11123 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11124 0 : }
11125 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_loader_program_instruction_write", level--, 0 );
11126 0 : }
11127 0 : ulong fd_bpf_loader_program_instruction_write_size( fd_bpf_loader_program_instruction_write_t const * self ) {
11128 0 : ulong size = 0;
11129 0 : size += sizeof(uint);
11130 0 : do {
11131 0 : size += sizeof(ulong);
11132 0 : size += self->bytes_len;
11133 0 : } while(0);
11134 0 : return size;
11135 0 : }
11136 :
11137 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_write(fd_bpf_loader_program_instruction_t const * self) {
11138 0 : return self->discriminant == 0;
11139 0 : }
11140 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_finalize(fd_bpf_loader_program_instruction_t const * self) {
11141 0 : return self->discriminant == 1;
11142 0 : }
11143 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant );
11144 0 : int fd_bpf_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11145 0 : int err;
11146 0 : switch (discriminant) {
11147 0 : case 0: {
11148 0 : err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11149 0 : if( FD_UNLIKELY( err ) ) return err;
11150 0 : return FD_BINCODE_SUCCESS;
11151 0 : }
11152 0 : case 1: {
11153 0 : return FD_BINCODE_SUCCESS;
11154 0 : }
11155 0 : default: return FD_BINCODE_ERR_ENCODING;
11156 0 : }
11157 0 : }
11158 0 : static int fd_bpf_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11159 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11160 0 : uint discriminant = 0;
11161 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11162 0 : if( FD_UNLIKELY( err ) ) return err;
11163 0 : return fd_bpf_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
11164 0 : }
11165 0 : int fd_bpf_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11166 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_t);
11167 0 : void const * start_data = ctx->data;
11168 0 : int err = fd_bpf_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
11169 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11170 0 : ctx->data = start_data;
11171 0 : return err;
11172 0 : }
11173 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 ) {
11174 0 : switch (discriminant) {
11175 0 : case 0: {
11176 0 : fd_bpf_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
11177 0 : break;
11178 0 : }
11179 0 : case 1: {
11180 0 : break;
11181 0 : }
11182 0 : }
11183 0 : }
11184 0 : static void fd_bpf_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11185 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)struct_mem;
11186 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11187 0 : fd_bpf_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11188 0 : }
11189 0 : void * fd_bpf_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11190 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)mem;
11191 0 : fd_bpf_loader_program_instruction_new( self );
11192 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_t);
11193 0 : void * * alloc_mem = &alloc_region;
11194 0 : fd_bpf_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
11195 0 : return self;
11196 0 : }
11197 0 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
11198 0 : switch( discriminant ) {
11199 0 : case 0: {
11200 0 : fd_bpf_loader_program_instruction_write_new( &self->write );
11201 0 : break;
11202 0 : }
11203 0 : case 1: {
11204 0 : break;
11205 0 : }
11206 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11207 0 : }
11208 0 : }
11209 0 : void fd_bpf_loader_program_instruction_new_disc( fd_bpf_loader_program_instruction_t * self, uint discriminant ) {
11210 0 : self->discriminant = discriminant;
11211 0 : fd_bpf_loader_program_instruction_inner_new( &self->inner, self->discriminant );
11212 0 : }
11213 0 : void fd_bpf_loader_program_instruction_new( fd_bpf_loader_program_instruction_t * self ) {
11214 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_t) );
11215 0 : fd_bpf_loader_program_instruction_new_disc( self, UINT_MAX );
11216 0 : }
11217 :
11218 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 ) {
11219 0 : (void) varint;
11220 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_loader_program_instruction", level++, 0);
11221 0 : switch( self->discriminant ) {
11222 0 : case 0: {
11223 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11224 0 : fd_bpf_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
11225 0 : break;
11226 0 : }
11227 0 : case 1: {
11228 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11229 0 : break;
11230 0 : }
11231 0 : }
11232 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_loader_program_instruction", level--, 0 );
11233 0 : }
11234 0 : ulong fd_bpf_loader_program_instruction_size( fd_bpf_loader_program_instruction_t const * self ) {
11235 0 : ulong size = 0;
11236 0 : size += sizeof(uint);
11237 0 : switch (self->discriminant) {
11238 0 : case 0: {
11239 0 : size += fd_bpf_loader_program_instruction_write_size( &self->inner.write );
11240 0 : break;
11241 0 : }
11242 0 : }
11243 0 : return size;
11244 0 : }
11245 :
11246 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 ) {
11247 0 : int err;
11248 0 : switch (discriminant) {
11249 0 : case 0: {
11250 0 : err = fd_bpf_loader_program_instruction_write_encode( &self->write, ctx );
11251 0 : if( FD_UNLIKELY( err ) ) return err;
11252 0 : break;
11253 0 : }
11254 0 : }
11255 0 : return FD_BINCODE_SUCCESS;
11256 0 : }
11257 0 : int fd_bpf_loader_program_instruction_encode( fd_bpf_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11258 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11259 0 : if( FD_UNLIKELY( err ) ) return err;
11260 0 : return fd_bpf_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
11261 0 : }
11262 :
11263 0 : int fd_loader_v4_program_instruction_write_encode( fd_loader_v4_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11264 0 : int err;
11265 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
11266 0 : if( FD_UNLIKELY( err ) ) return err;
11267 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
11268 0 : if( FD_UNLIKELY(err) ) return err;
11269 0 : if( self->bytes_len ) {
11270 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
11271 0 : if( FD_UNLIKELY( err ) ) return err;
11272 0 : }
11273 0 : return FD_BINCODE_SUCCESS;
11274 0 : }
11275 0 : static int fd_loader_v4_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11276 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11277 0 : int err = 0;
11278 0 : err = fd_bincode_uint32_decode_footprint( ctx );
11279 0 : if( FD_UNLIKELY( err ) ) return err;
11280 0 : ulong bytes_len;
11281 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
11282 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11283 0 : if( bytes_len ) {
11284 0 : *total_sz += 8UL + bytes_len;
11285 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
11286 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11287 0 : }
11288 0 : return 0;
11289 0 : }
11290 0 : int fd_loader_v4_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11291 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_write_t);
11292 0 : void const * start_data = ctx->data;
11293 0 : int err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11294 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11295 0 : ctx->data = start_data;
11296 0 : return err;
11297 0 : }
11298 0 : static void fd_loader_v4_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11299 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)struct_mem;
11300 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
11301 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
11302 0 : if( self->bytes_len ) {
11303 0 : self->bytes = *alloc_mem;
11304 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
11305 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
11306 0 : } else
11307 0 : self->bytes = NULL;
11308 0 : }
11309 0 : void * fd_loader_v4_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11310 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)mem;
11311 0 : fd_loader_v4_program_instruction_write_new( self );
11312 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_write_t);
11313 0 : void * * alloc_mem = &alloc_region;
11314 0 : fd_loader_v4_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
11315 0 : return self;
11316 0 : }
11317 0 : void fd_loader_v4_program_instruction_write_new(fd_loader_v4_program_instruction_write_t * self) {
11318 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_write_t) );
11319 0 : }
11320 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 ) {
11321 0 : (void) varint;
11322 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_write", level++, 0 );
11323 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11324 0 : if( self->bytes_len ) {
11325 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11326 0 : for( ulong i=0; i < self->bytes_len; i++ )
11327 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11328 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11329 0 : }
11330 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_write", level--, 0 );
11331 0 : }
11332 0 : ulong fd_loader_v4_program_instruction_write_size( fd_loader_v4_program_instruction_write_t const * self ) {
11333 0 : ulong size = 0;
11334 0 : size += sizeof(uint);
11335 0 : do {
11336 0 : size += sizeof(ulong);
11337 0 : size += self->bytes_len;
11338 0 : } while(0);
11339 0 : return size;
11340 0 : }
11341 :
11342 0 : int fd_loader_v4_program_instruction_copy_encode( fd_loader_v4_program_instruction_copy_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11343 0 : int err;
11344 0 : err = fd_bincode_uint32_encode( self->destination_offset, ctx );
11345 0 : if( FD_UNLIKELY( err ) ) return err;
11346 0 : err = fd_bincode_uint32_encode( self->source_offset, ctx );
11347 0 : if( FD_UNLIKELY( err ) ) return err;
11348 0 : err = fd_bincode_uint32_encode( self->length, ctx );
11349 0 : if( FD_UNLIKELY( err ) ) return err;
11350 0 : return FD_BINCODE_SUCCESS;
11351 0 : }
11352 0 : static inline int fd_loader_v4_program_instruction_copy_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11353 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11354 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
11355 0 : return 0;
11356 0 : }
11357 0 : static void fd_loader_v4_program_instruction_copy_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11358 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)struct_mem;
11359 0 : fd_bincode_uint32_decode_unsafe( &self->destination_offset, ctx );
11360 0 : fd_bincode_uint32_decode_unsafe( &self->source_offset, ctx );
11361 0 : fd_bincode_uint32_decode_unsafe( &self->length, ctx );
11362 0 : }
11363 0 : void * fd_loader_v4_program_instruction_copy_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11364 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)mem;
11365 0 : fd_loader_v4_program_instruction_copy_new( self );
11366 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_copy_t);
11367 0 : void * * alloc_mem = &alloc_region;
11368 0 : fd_loader_v4_program_instruction_copy_decode_inner( mem, alloc_mem, ctx );
11369 0 : return self;
11370 0 : }
11371 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 ) {
11372 0 : (void) varint;
11373 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_copy", level++, 0 );
11374 0 : fun( w, &self->destination_offset, "destination_offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11375 0 : fun( w, &self->source_offset, "source_offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11376 0 : fun( w, &self->length, "length", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11377 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_copy", level--, 0 );
11378 0 : }
11379 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 ) {
11380 0 : int err;
11381 0 : err = fd_bincode_uint32_encode( self->new_size, ctx );
11382 0 : if( FD_UNLIKELY( err ) ) return err;
11383 0 : return FD_BINCODE_SUCCESS;
11384 0 : }
11385 0 : static inline int fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11386 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11387 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
11388 0 : return 0;
11389 0 : }
11390 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 ) {
11391 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)struct_mem;
11392 0 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
11393 0 : }
11394 0 : void * fd_loader_v4_program_instruction_set_program_length_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11395 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)mem;
11396 0 : fd_loader_v4_program_instruction_set_program_length_new( self );
11397 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_set_program_length_t);
11398 0 : void * * alloc_mem = &alloc_region;
11399 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( mem, alloc_mem, ctx );
11400 0 : return self;
11401 0 : }
11402 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 ) {
11403 0 : (void) varint;
11404 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_set_program_length", level++, 0 );
11405 0 : fun( w, &self->new_size, "new_size", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11406 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_set_program_length", level--, 0 );
11407 0 : }
11408 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_write(fd_loader_v4_program_instruction_t const * self) {
11409 0 : return self->discriminant == 0;
11410 0 : }
11411 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_copy(fd_loader_v4_program_instruction_t const * self) {
11412 0 : return self->discriminant == 1;
11413 0 : }
11414 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_set_program_length(fd_loader_v4_program_instruction_t const * self) {
11415 0 : return self->discriminant == 2;
11416 0 : }
11417 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_deploy(fd_loader_v4_program_instruction_t const * self) {
11418 0 : return self->discriminant == 3;
11419 0 : }
11420 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_retract(fd_loader_v4_program_instruction_t const * self) {
11421 0 : return self->discriminant == 4;
11422 0 : }
11423 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_transfer_authority(fd_loader_v4_program_instruction_t const * self) {
11424 0 : return self->discriminant == 5;
11425 0 : }
11426 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_finalize(fd_loader_v4_program_instruction_t const * self) {
11427 0 : return self->discriminant == 6;
11428 0 : }
11429 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant );
11430 0 : int fd_loader_v4_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11431 0 : int err;
11432 0 : switch (discriminant) {
11433 0 : case 0: {
11434 0 : err = fd_loader_v4_program_instruction_write_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 1: {
11439 0 : err = fd_loader_v4_program_instruction_copy_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 2: {
11444 0 : err = fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( ctx, total_sz );
11445 0 : if( FD_UNLIKELY( err ) ) return err;
11446 0 : return FD_BINCODE_SUCCESS;
11447 0 : }
11448 0 : case 3: {
11449 0 : return FD_BINCODE_SUCCESS;
11450 0 : }
11451 0 : case 4: {
11452 0 : return FD_BINCODE_SUCCESS;
11453 0 : }
11454 0 : case 5: {
11455 0 : return FD_BINCODE_SUCCESS;
11456 0 : }
11457 0 : case 6: {
11458 0 : return FD_BINCODE_SUCCESS;
11459 0 : }
11460 0 : default: return FD_BINCODE_ERR_ENCODING;
11461 0 : }
11462 0 : }
11463 0 : static int fd_loader_v4_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11464 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11465 0 : uint discriminant = 0;
11466 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11467 0 : if( FD_UNLIKELY( err ) ) return err;
11468 0 : return fd_loader_v4_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
11469 0 : }
11470 0 : int fd_loader_v4_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11471 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_t);
11472 0 : void const * start_data = ctx->data;
11473 0 : int err = fd_loader_v4_program_instruction_decode_footprint_inner( ctx, total_sz );
11474 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11475 0 : ctx->data = start_data;
11476 0 : return err;
11477 0 : }
11478 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 ) {
11479 0 : switch (discriminant) {
11480 0 : case 0: {
11481 0 : fd_loader_v4_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
11482 0 : break;
11483 0 : }
11484 0 : case 1: {
11485 0 : fd_loader_v4_program_instruction_copy_decode_inner( &self->copy, alloc_mem, ctx );
11486 0 : break;
11487 0 : }
11488 0 : case 2: {
11489 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( &self->set_program_length, alloc_mem, ctx );
11490 0 : break;
11491 0 : }
11492 0 : case 3: {
11493 0 : break;
11494 0 : }
11495 0 : case 4: {
11496 0 : break;
11497 0 : }
11498 0 : case 5: {
11499 0 : break;
11500 0 : }
11501 0 : case 6: {
11502 0 : break;
11503 0 : }
11504 0 : }
11505 0 : }
11506 0 : static void fd_loader_v4_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11507 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)struct_mem;
11508 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11509 0 : fd_loader_v4_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11510 0 : }
11511 0 : void * fd_loader_v4_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11512 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)mem;
11513 0 : fd_loader_v4_program_instruction_new( self );
11514 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_t);
11515 0 : void * * alloc_mem = &alloc_region;
11516 0 : fd_loader_v4_program_instruction_decode_inner( mem, alloc_mem, ctx );
11517 0 : return self;
11518 0 : }
11519 0 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
11520 0 : switch( discriminant ) {
11521 0 : case 0: {
11522 0 : fd_loader_v4_program_instruction_write_new( &self->write );
11523 0 : break;
11524 0 : }
11525 0 : case 1: {
11526 0 : fd_loader_v4_program_instruction_copy_new( &self->copy );
11527 0 : break;
11528 0 : }
11529 0 : case 2: {
11530 0 : fd_loader_v4_program_instruction_set_program_length_new( &self->set_program_length );
11531 0 : break;
11532 0 : }
11533 0 : case 3: {
11534 0 : break;
11535 0 : }
11536 0 : case 4: {
11537 0 : break;
11538 0 : }
11539 0 : case 5: {
11540 0 : break;
11541 0 : }
11542 0 : case 6: {
11543 0 : break;
11544 0 : }
11545 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11546 0 : }
11547 0 : }
11548 0 : void fd_loader_v4_program_instruction_new_disc( fd_loader_v4_program_instruction_t * self, uint discriminant ) {
11549 0 : self->discriminant = discriminant;
11550 0 : fd_loader_v4_program_instruction_inner_new( &self->inner, self->discriminant );
11551 0 : }
11552 0 : void fd_loader_v4_program_instruction_new( fd_loader_v4_program_instruction_t * self ) {
11553 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_t) );
11554 0 : fd_loader_v4_program_instruction_new_disc( self, UINT_MAX );
11555 0 : }
11556 :
11557 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 ) {
11558 0 : (void) varint;
11559 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_loader_v4_program_instruction", level++, 0);
11560 0 : switch( self->discriminant ) {
11561 0 : case 0: {
11562 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11563 0 : fd_loader_v4_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
11564 0 : break;
11565 0 : }
11566 0 : case 1: {
11567 0 : fun( w, self, "copy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11568 0 : fd_loader_v4_program_instruction_copy_walk( w, &self->inner.copy, fun, "copy", level, 0 );
11569 0 : break;
11570 0 : }
11571 0 : case 2: {
11572 0 : fun( w, self, "set_program_length", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11573 0 : fd_loader_v4_program_instruction_set_program_length_walk( w, &self->inner.set_program_length, fun, "set_program_length", level, 0 );
11574 0 : break;
11575 0 : }
11576 0 : case 3: {
11577 0 : fun( w, self, "deploy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11578 0 : break;
11579 0 : }
11580 0 : case 4: {
11581 0 : fun( w, self, "retract", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11582 0 : break;
11583 0 : }
11584 0 : case 5: {
11585 0 : fun( w, self, "transfer_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11586 0 : break;
11587 0 : }
11588 0 : case 6: {
11589 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11590 0 : break;
11591 0 : }
11592 0 : }
11593 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_loader_v4_program_instruction", level--, 0 );
11594 0 : }
11595 0 : ulong fd_loader_v4_program_instruction_size( fd_loader_v4_program_instruction_t const * self ) {
11596 0 : ulong size = 0;
11597 0 : size += sizeof(uint);
11598 0 : switch (self->discriminant) {
11599 0 : case 0: {
11600 0 : size += fd_loader_v4_program_instruction_write_size( &self->inner.write );
11601 0 : break;
11602 0 : }
11603 0 : case 1: {
11604 0 : size += fd_loader_v4_program_instruction_copy_size( &self->inner.copy );
11605 0 : break;
11606 0 : }
11607 0 : case 2: {
11608 0 : size += fd_loader_v4_program_instruction_set_program_length_size( &self->inner.set_program_length );
11609 0 : break;
11610 0 : }
11611 0 : }
11612 0 : return size;
11613 0 : }
11614 :
11615 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 ) {
11616 0 : int err;
11617 0 : switch (discriminant) {
11618 0 : case 0: {
11619 0 : err = fd_loader_v4_program_instruction_write_encode( &self->write, ctx );
11620 0 : if( FD_UNLIKELY( err ) ) return err;
11621 0 : break;
11622 0 : }
11623 0 : case 1: {
11624 0 : err = fd_loader_v4_program_instruction_copy_encode( &self->copy, ctx );
11625 0 : if( FD_UNLIKELY( err ) ) return err;
11626 0 : break;
11627 0 : }
11628 0 : case 2: {
11629 0 : err = fd_loader_v4_program_instruction_set_program_length_encode( &self->set_program_length, ctx );
11630 0 : if( FD_UNLIKELY( err ) ) return err;
11631 0 : break;
11632 0 : }
11633 0 : }
11634 0 : return FD_BINCODE_SUCCESS;
11635 0 : }
11636 0 : int fd_loader_v4_program_instruction_encode( fd_loader_v4_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11637 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11638 0 : if( FD_UNLIKELY( err ) ) return err;
11639 0 : return fd_loader_v4_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
11640 0 : }
11641 :
11642 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 ) {
11643 0 : int err;
11644 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
11645 0 : if( FD_UNLIKELY( err ) ) return err;
11646 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
11647 0 : if( FD_UNLIKELY(err) ) return err;
11648 0 : if( self->bytes_len ) {
11649 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
11650 0 : if( FD_UNLIKELY( err ) ) return err;
11651 0 : }
11652 0 : return FD_BINCODE_SUCCESS;
11653 0 : }
11654 0 : static int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11655 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11656 0 : int err = 0;
11657 0 : err = fd_bincode_uint32_decode_footprint( ctx );
11658 0 : if( FD_UNLIKELY( err ) ) return err;
11659 0 : ulong bytes_len;
11660 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
11661 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11662 0 : if( bytes_len ) {
11663 0 : *total_sz += 8UL + bytes_len;
11664 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
11665 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11666 0 : }
11667 0 : return 0;
11668 0 : }
11669 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11670 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
11671 0 : void const * start_data = ctx->data;
11672 0 : int err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11673 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11674 0 : ctx->data = start_data;
11675 0 : return err;
11676 0 : }
11677 0 : static void fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11678 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)struct_mem;
11679 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
11680 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
11681 0 : if( self->bytes_len ) {
11682 0 : self->bytes = *alloc_mem;
11683 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
11684 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
11685 0 : } else
11686 0 : self->bytes = NULL;
11687 0 : }
11688 0 : void * fd_bpf_upgradeable_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11689 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)mem;
11690 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( self );
11691 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
11692 0 : void * * alloc_mem = &alloc_region;
11693 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
11694 0 : return self;
11695 0 : }
11696 0 : void fd_bpf_upgradeable_loader_program_instruction_write_new(fd_bpf_upgradeable_loader_program_instruction_write_t * self) {
11697 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t) );
11698 0 : }
11699 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 ) {
11700 0 : (void) varint;
11701 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_write", level++, 0 );
11702 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11703 0 : if( self->bytes_len ) {
11704 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11705 0 : for( ulong i=0; i < self->bytes_len; i++ )
11706 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11707 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11708 0 : }
11709 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_write", level--, 0 );
11710 0 : }
11711 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_size( fd_bpf_upgradeable_loader_program_instruction_write_t const * self ) {
11712 0 : ulong size = 0;
11713 0 : size += sizeof(uint);
11714 0 : do {
11715 0 : size += sizeof(ulong);
11716 0 : size += self->bytes_len;
11717 0 : } while(0);
11718 0 : return size;
11719 0 : }
11720 :
11721 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 ) {
11722 0 : int err;
11723 0 : err = fd_bincode_uint64_encode( self->max_data_len, ctx );
11724 0 : if( FD_UNLIKELY( err ) ) return err;
11725 0 : return FD_BINCODE_SUCCESS;
11726 0 : }
11727 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 ) {
11728 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11729 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
11730 0 : return 0;
11731 0 : }
11732 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 ) {
11733 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;
11734 0 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
11735 0 : }
11736 0 : void * fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11737 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;
11738 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( self );
11739 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t);
11740 0 : void * * alloc_mem = &alloc_region;
11741 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( mem, alloc_mem, ctx );
11742 0 : return self;
11743 0 : }
11744 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 ) {
11745 0 : (void) varint;
11746 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level++, 0 );
11747 0 : fun( w, &self->max_data_len, "max_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11748 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level--, 0 );
11749 0 : }
11750 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 ) {
11751 0 : int err;
11752 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
11753 0 : if( FD_UNLIKELY( err ) ) return err;
11754 0 : return FD_BINCODE_SUCCESS;
11755 0 : }
11756 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11757 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11758 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
11759 0 : return 0;
11760 0 : }
11761 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 ) {
11762 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)struct_mem;
11763 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
11764 0 : }
11765 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11766 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)mem;
11767 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( self );
11768 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t);
11769 0 : void * * alloc_mem = &alloc_region;
11770 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( mem, alloc_mem, ctx );
11771 0 : return self;
11772 0 : }
11773 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 ) {
11774 0 : (void) varint;
11775 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level++, 0 );
11776 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11777 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level--, 0 );
11778 0 : }
11779 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 ) {
11780 0 : int err;
11781 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
11782 0 : if( FD_UNLIKELY( err ) ) return err;
11783 0 : return FD_BINCODE_SUCCESS;
11784 0 : }
11785 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 ) {
11786 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11787 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
11788 0 : return 0;
11789 0 : }
11790 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 ) {
11791 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)struct_mem;
11792 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
11793 0 : }
11794 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11795 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)mem;
11796 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( self );
11797 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t);
11798 0 : void * * alloc_mem = &alloc_region;
11799 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( mem, alloc_mem, ctx );
11800 0 : return self;
11801 0 : }
11802 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 ) {
11803 0 : (void) varint;
11804 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program_checked", level++, 0 );
11805 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
11806 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program_checked", level--, 0 );
11807 0 : }
11808 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_initialize_buffer(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11809 0 : return self->discriminant == 0;
11810 0 : }
11811 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_write(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11812 0 : return self->discriminant == 1;
11813 0 : }
11814 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) {
11815 0 : return self->discriminant == 2;
11816 0 : }
11817 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_upgrade(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11818 0 : return self->discriminant == 3;
11819 0 : }
11820 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11821 0 : return self->discriminant == 4;
11822 0 : }
11823 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_close(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11824 0 : return self->discriminant == 5;
11825 0 : }
11826 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11827 0 : return self->discriminant == 6;
11828 0 : }
11829 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11830 0 : return self->discriminant == 7;
11831 0 : }
11832 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_migrate(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11833 0 : return self->discriminant == 8;
11834 0 : }
11835 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
11836 0 : return self->discriminant == 9;
11837 0 : }
11838 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant );
11839 0 : int fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11840 0 : int err;
11841 0 : switch (discriminant) {
11842 0 : case 0: {
11843 0 : return FD_BINCODE_SUCCESS;
11844 0 : }
11845 0 : case 1: {
11846 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
11847 0 : if( FD_UNLIKELY( err ) ) return err;
11848 0 : return FD_BINCODE_SUCCESS;
11849 0 : }
11850 0 : case 2: {
11851 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( ctx, total_sz );
11852 0 : if( FD_UNLIKELY( err ) ) return err;
11853 0 : return FD_BINCODE_SUCCESS;
11854 0 : }
11855 0 : case 3: {
11856 0 : return FD_BINCODE_SUCCESS;
11857 0 : }
11858 0 : case 4: {
11859 0 : return FD_BINCODE_SUCCESS;
11860 0 : }
11861 0 : case 5: {
11862 0 : return FD_BINCODE_SUCCESS;
11863 0 : }
11864 0 : case 6: {
11865 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( ctx, total_sz );
11866 0 : if( FD_UNLIKELY( err ) ) return err;
11867 0 : return FD_BINCODE_SUCCESS;
11868 0 : }
11869 0 : case 7: {
11870 0 : return FD_BINCODE_SUCCESS;
11871 0 : }
11872 0 : case 8: {
11873 0 : return FD_BINCODE_SUCCESS;
11874 0 : }
11875 0 : case 9: {
11876 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_footprint_inner( ctx, total_sz );
11877 0 : if( FD_UNLIKELY( err ) ) return err;
11878 0 : return FD_BINCODE_SUCCESS;
11879 0 : }
11880 0 : default: return FD_BINCODE_ERR_ENCODING;
11881 0 : }
11882 0 : }
11883 0 : static int fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11884 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11885 0 : uint discriminant = 0;
11886 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11887 0 : if( FD_UNLIKELY( err ) ) return err;
11888 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
11889 0 : }
11890 0 : int fd_bpf_upgradeable_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11891 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
11892 0 : void const * start_data = ctx->data;
11893 0 : int err = fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
11894 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11895 0 : ctx->data = start_data;
11896 0 : return err;
11897 0 : }
11898 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 ) {
11899 0 : switch (discriminant) {
11900 0 : case 0: {
11901 0 : break;
11902 0 : }
11903 0 : case 1: {
11904 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
11905 0 : break;
11906 0 : }
11907 0 : case 2: {
11908 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( &self->deploy_with_max_data_len, alloc_mem, ctx );
11909 0 : break;
11910 0 : }
11911 0 : case 3: {
11912 0 : break;
11913 0 : }
11914 0 : case 4: {
11915 0 : break;
11916 0 : }
11917 0 : case 5: {
11918 0 : break;
11919 0 : }
11920 0 : case 6: {
11921 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( &self->extend_program, alloc_mem, ctx );
11922 0 : break;
11923 0 : }
11924 0 : case 7: {
11925 0 : break;
11926 0 : }
11927 0 : case 8: {
11928 0 : break;
11929 0 : }
11930 0 : case 9: {
11931 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( &self->extend_program_checked, alloc_mem, ctx );
11932 0 : break;
11933 0 : }
11934 0 : }
11935 0 : }
11936 0 : static void fd_bpf_upgradeable_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11937 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)struct_mem;
11938 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11939 0 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11940 0 : }
11941 0 : void * fd_bpf_upgradeable_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11942 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)mem;
11943 0 : fd_bpf_upgradeable_loader_program_instruction_new( self );
11944 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
11945 0 : void * * alloc_mem = &alloc_region;
11946 0 : fd_bpf_upgradeable_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
11947 0 : return self;
11948 0 : }
11949 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
11950 0 : switch( discriminant ) {
11951 0 : case 0: {
11952 0 : break;
11953 0 : }
11954 0 : case 1: {
11955 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( &self->write );
11956 0 : break;
11957 0 : }
11958 0 : case 2: {
11959 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( &self->deploy_with_max_data_len );
11960 0 : break;
11961 0 : }
11962 0 : case 3: {
11963 0 : break;
11964 0 : }
11965 0 : case 4: {
11966 0 : break;
11967 0 : }
11968 0 : case 5: {
11969 0 : break;
11970 0 : }
11971 0 : case 6: {
11972 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( &self->extend_program );
11973 0 : break;
11974 0 : }
11975 0 : case 7: {
11976 0 : break;
11977 0 : }
11978 0 : case 8: {
11979 0 : break;
11980 0 : }
11981 0 : case 9: {
11982 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( &self->extend_program_checked );
11983 0 : break;
11984 0 : }
11985 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11986 0 : }
11987 0 : }
11988 0 : void fd_bpf_upgradeable_loader_program_instruction_new_disc( fd_bpf_upgradeable_loader_program_instruction_t * self, uint discriminant ) {
11989 0 : self->discriminant = discriminant;
11990 0 : fd_bpf_upgradeable_loader_program_instruction_inner_new( &self->inner, self->discriminant );
11991 0 : }
11992 0 : void fd_bpf_upgradeable_loader_program_instruction_new( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
11993 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_t) );
11994 0 : fd_bpf_upgradeable_loader_program_instruction_new_disc( self, UINT_MAX );
11995 0 : }
11996 :
11997 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 ) {
11998 0 : (void) varint;
11999 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_program_instruction", level++, 0);
12000 0 : switch( self->discriminant ) {
12001 0 : case 0: {
12002 0 : fun( w, self, "initialize_buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12003 0 : break;
12004 0 : }
12005 0 : case 1: {
12006 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12007 0 : fd_bpf_upgradeable_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
12008 0 : break;
12009 0 : }
12010 0 : case 2: {
12011 0 : fun( w, self, "deploy_with_max_data_len", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12012 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 );
12013 0 : break;
12014 0 : }
12015 0 : case 3: {
12016 0 : fun( w, self, "upgrade", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12017 0 : break;
12018 0 : }
12019 0 : case 4: {
12020 0 : fun( w, self, "set_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12021 0 : break;
12022 0 : }
12023 0 : case 5: {
12024 0 : fun( w, self, "close", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12025 0 : break;
12026 0 : }
12027 0 : case 6: {
12028 0 : fun( w, self, "extend_program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12029 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_walk( w, &self->inner.extend_program, fun, "extend_program", level, 0 );
12030 0 : break;
12031 0 : }
12032 0 : case 7: {
12033 0 : fun( w, self, "set_authority_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12034 0 : break;
12035 0 : }
12036 0 : case 8: {
12037 0 : fun( w, self, "migrate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12038 0 : break;
12039 0 : }
12040 0 : case 9: {
12041 0 : fun( w, self, "extend_program_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12042 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_walk( w, &self->inner.extend_program_checked, fun, "extend_program_checked", level, 0 );
12043 0 : break;
12044 0 : }
12045 0 : }
12046 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_program_instruction", level--, 0 );
12047 0 : }
12048 0 : ulong fd_bpf_upgradeable_loader_program_instruction_size( fd_bpf_upgradeable_loader_program_instruction_t const * self ) {
12049 0 : ulong size = 0;
12050 0 : size += sizeof(uint);
12051 0 : switch (self->discriminant) {
12052 0 : case 1: {
12053 0 : size += fd_bpf_upgradeable_loader_program_instruction_write_size( &self->inner.write );
12054 0 : break;
12055 0 : }
12056 0 : case 2: {
12057 0 : size += fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( &self->inner.deploy_with_max_data_len );
12058 0 : break;
12059 0 : }
12060 0 : case 6: {
12061 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_size( &self->inner.extend_program );
12062 0 : break;
12063 0 : }
12064 0 : case 9: {
12065 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_size( &self->inner.extend_program_checked );
12066 0 : break;
12067 0 : }
12068 0 : }
12069 0 : return size;
12070 0 : }
12071 :
12072 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 ) {
12073 0 : int err;
12074 0 : switch (discriminant) {
12075 0 : case 1: {
12076 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_encode( &self->write, ctx );
12077 0 : if( FD_UNLIKELY( err ) ) return err;
12078 0 : break;
12079 0 : }
12080 0 : case 2: {
12081 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( &self->deploy_with_max_data_len, ctx );
12082 0 : if( FD_UNLIKELY( err ) ) return err;
12083 0 : break;
12084 0 : }
12085 0 : case 6: {
12086 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( &self->extend_program, ctx );
12087 0 : if( FD_UNLIKELY( err ) ) return err;
12088 0 : break;
12089 0 : }
12090 0 : case 9: {
12091 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_encode( &self->extend_program_checked, ctx );
12092 0 : if( FD_UNLIKELY( err ) ) return err;
12093 0 : break;
12094 0 : }
12095 0 : }
12096 0 : return FD_BINCODE_SUCCESS;
12097 0 : }
12098 0 : int fd_bpf_upgradeable_loader_program_instruction_encode( fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12099 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12100 0 : if( FD_UNLIKELY( err ) ) return err;
12101 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
12102 0 : }
12103 :
12104 0 : int fd_bpf_upgradeable_loader_state_buffer_encode( fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12105 0 : int err;
12106 0 : err = fd_bincode_bool_encode( self->has_authority_address, ctx );
12107 0 : if( FD_UNLIKELY( err ) ) return err;
12108 0 : if( self->has_authority_address ) {
12109 0 : err = fd_pubkey_encode( &self->authority_address, ctx );
12110 0 : if( FD_UNLIKELY( err ) ) return err;
12111 0 : }
12112 0 : return FD_BINCODE_SUCCESS;
12113 0 : }
12114 0 : static int fd_bpf_upgradeable_loader_state_buffer_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 : {
12118 0 : uchar o;
12119 0 : err = fd_bincode_bool_decode( &o, ctx );
12120 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12121 0 : if( o ) {
12122 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12123 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12124 0 : }
12125 0 : }
12126 0 : return 0;
12127 0 : }
12128 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12129 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
12130 0 : void const * start_data = ctx->data;
12131 0 : int err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
12132 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12133 0 : ctx->data = start_data;
12134 0 : return err;
12135 0 : }
12136 0 : static void fd_bpf_upgradeable_loader_state_buffer_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12137 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)struct_mem;
12138 0 : {
12139 0 : uchar o;
12140 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
12141 0 : self->has_authority_address = !!o;
12142 0 : if( o ) {
12143 0 : fd_pubkey_new( &self->authority_address );
12144 0 : fd_pubkey_decode_inner( &self->authority_address, alloc_mem, ctx );
12145 0 : }
12146 0 : }
12147 0 : }
12148 0 : void * fd_bpf_upgradeable_loader_state_buffer_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12149 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)mem;
12150 0 : fd_bpf_upgradeable_loader_state_buffer_new( self );
12151 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
12152 0 : void * * alloc_mem = &alloc_region;
12153 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( mem, alloc_mem, ctx );
12154 0 : return self;
12155 0 : }
12156 0 : void fd_bpf_upgradeable_loader_state_buffer_new(fd_bpf_upgradeable_loader_state_buffer_t * self) {
12157 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_buffer_t) );
12158 0 : }
12159 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 ) {
12160 0 : (void) varint;
12161 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_buffer", level++, 0 );
12162 0 : if( !self->has_authority_address ) {
12163 0 : fun( w, NULL, "authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
12164 0 : } else {
12165 0 : fd_pubkey_walk( w, &self->authority_address, fun, "authority_address", level, 0 );
12166 0 : }
12167 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_buffer", level--, 0 );
12168 0 : }
12169 0 : ulong fd_bpf_upgradeable_loader_state_buffer_size( fd_bpf_upgradeable_loader_state_buffer_t const * self ) {
12170 0 : ulong size = 0;
12171 0 : size += sizeof(char);
12172 0 : if( self->has_authority_address ) {
12173 0 : size += fd_pubkey_size( &self->authority_address );
12174 0 : }
12175 0 : return size;
12176 0 : }
12177 :
12178 0 : int fd_bpf_upgradeable_loader_state_program_encode( fd_bpf_upgradeable_loader_state_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12179 0 : int err;
12180 0 : err = fd_pubkey_encode( &self->programdata_address, ctx );
12181 0 : if( FD_UNLIKELY( err ) ) return err;
12182 0 : return FD_BINCODE_SUCCESS;
12183 0 : }
12184 0 : static inline int fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12185 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12186 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
12187 0 : return 0;
12188 0 : }
12189 0 : static void fd_bpf_upgradeable_loader_state_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12190 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)struct_mem;
12191 0 : fd_pubkey_decode_inner( &self->programdata_address, alloc_mem, ctx );
12192 0 : }
12193 0 : void * fd_bpf_upgradeable_loader_state_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12194 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)mem;
12195 0 : fd_bpf_upgradeable_loader_state_program_new( self );
12196 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_t);
12197 0 : void * * alloc_mem = &alloc_region;
12198 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( mem, alloc_mem, ctx );
12199 0 : return self;
12200 0 : }
12201 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 ) {
12202 0 : (void) varint;
12203 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program", level++, 0 );
12204 0 : fd_pubkey_walk( w, &self->programdata_address, fun, "programdata_address", level, 0 );
12205 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program", level--, 0 );
12206 0 : }
12207 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 ) {
12208 0 : int err;
12209 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
12210 0 : if( FD_UNLIKELY( err ) ) return err;
12211 0 : err = fd_bincode_bool_encode( self->has_upgrade_authority_address, ctx );
12212 0 : if( FD_UNLIKELY( err ) ) return err;
12213 0 : if( self->has_upgrade_authority_address ) {
12214 0 : err = fd_pubkey_encode( &self->upgrade_authority_address, ctx );
12215 0 : if( FD_UNLIKELY( err ) ) return err;
12216 0 : }
12217 0 : return FD_BINCODE_SUCCESS;
12218 0 : }
12219 0 : static int fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12220 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12221 0 : int err = 0;
12222 0 : err = fd_bincode_uint64_decode_footprint( ctx );
12223 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12224 0 : {
12225 0 : uchar o;
12226 0 : err = fd_bincode_bool_decode( &o, ctx );
12227 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12228 0 : if( o ) {
12229 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12230 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12231 0 : }
12232 0 : }
12233 0 : return 0;
12234 0 : }
12235 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12236 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
12237 0 : void const * start_data = ctx->data;
12238 0 : int err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
12239 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12240 0 : ctx->data = start_data;
12241 0 : return err;
12242 0 : }
12243 0 : static void fd_bpf_upgradeable_loader_state_program_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12244 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)struct_mem;
12245 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
12246 0 : {
12247 0 : uchar o;
12248 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
12249 0 : self->has_upgrade_authority_address = !!o;
12250 0 : if( o ) {
12251 0 : fd_pubkey_new( &self->upgrade_authority_address );
12252 0 : fd_pubkey_decode_inner( &self->upgrade_authority_address, alloc_mem, ctx );
12253 0 : }
12254 0 : }
12255 0 : }
12256 0 : void * fd_bpf_upgradeable_loader_state_program_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12257 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)mem;
12258 0 : fd_bpf_upgradeable_loader_state_program_data_new( self );
12259 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
12260 0 : void * * alloc_mem = &alloc_region;
12261 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( mem, alloc_mem, ctx );
12262 0 : return self;
12263 0 : }
12264 0 : void fd_bpf_upgradeable_loader_state_program_data_new(fd_bpf_upgradeable_loader_state_program_data_t * self) {
12265 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_data_t) );
12266 0 : }
12267 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 ) {
12268 0 : (void) varint;
12269 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program_data", level++, 0 );
12270 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12271 0 : if( !self->has_upgrade_authority_address ) {
12272 0 : fun( w, NULL, "upgrade_authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
12273 0 : } else {
12274 0 : fd_pubkey_walk( w, &self->upgrade_authority_address, fun, "upgrade_authority_address", level, 0 );
12275 0 : }
12276 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program_data", level--, 0 );
12277 0 : }
12278 0 : ulong fd_bpf_upgradeable_loader_state_program_data_size( fd_bpf_upgradeable_loader_state_program_data_t const * self ) {
12279 0 : ulong size = 0;
12280 0 : size += sizeof(ulong);
12281 0 : size += sizeof(char);
12282 0 : if( self->has_upgrade_authority_address ) {
12283 0 : size += fd_pubkey_size( &self->upgrade_authority_address );
12284 0 : }
12285 0 : return size;
12286 0 : }
12287 :
12288 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_uninitialized(fd_bpf_upgradeable_loader_state_t const * self) {
12289 0 : return self->discriminant == 0;
12290 0 : }
12291 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_buffer(fd_bpf_upgradeable_loader_state_t const * self) {
12292 0 : return self->discriminant == 1;
12293 0 : }
12294 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program(fd_bpf_upgradeable_loader_state_t const * self) {
12295 0 : return self->discriminant == 2;
12296 0 : }
12297 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program_data(fd_bpf_upgradeable_loader_state_t const * self) {
12298 0 : return self->discriminant == 3;
12299 0 : }
12300 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant );
12301 0 : int fd_bpf_upgradeable_loader_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12302 0 : int err;
12303 0 : switch (discriminant) {
12304 0 : case 0: {
12305 0 : return FD_BINCODE_SUCCESS;
12306 0 : }
12307 0 : case 1: {
12308 0 : err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
12309 0 : if( FD_UNLIKELY( err ) ) return err;
12310 0 : return FD_BINCODE_SUCCESS;
12311 0 : }
12312 0 : case 2: {
12313 0 : err = fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( ctx, total_sz );
12314 0 : if( FD_UNLIKELY( err ) ) return err;
12315 0 : return FD_BINCODE_SUCCESS;
12316 0 : }
12317 0 : case 3: {
12318 0 : err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
12319 0 : if( FD_UNLIKELY( err ) ) return err;
12320 0 : return FD_BINCODE_SUCCESS;
12321 0 : }
12322 0 : default: return FD_BINCODE_ERR_ENCODING;
12323 0 : }
12324 0 : }
12325 0 : static int fd_bpf_upgradeable_loader_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12326 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12327 0 : uint discriminant = 0;
12328 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
12329 0 : if( FD_UNLIKELY( err ) ) return err;
12330 0 : return fd_bpf_upgradeable_loader_state_inner_decode_footprint( discriminant, ctx, total_sz );
12331 0 : }
12332 0 : int fd_bpf_upgradeable_loader_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12333 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_t);
12334 0 : void const * start_data = ctx->data;
12335 0 : int err = fd_bpf_upgradeable_loader_state_decode_footprint_inner( ctx, total_sz );
12336 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12337 0 : ctx->data = start_data;
12338 0 : return err;
12339 0 : }
12340 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 ) {
12341 0 : switch (discriminant) {
12342 0 : case 0: {
12343 0 : break;
12344 0 : }
12345 0 : case 1: {
12346 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( &self->buffer, alloc_mem, ctx );
12347 0 : break;
12348 0 : }
12349 0 : case 2: {
12350 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( &self->program, alloc_mem, ctx );
12351 0 : break;
12352 0 : }
12353 0 : case 3: {
12354 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( &self->program_data, alloc_mem, ctx );
12355 0 : break;
12356 0 : }
12357 0 : }
12358 0 : }
12359 0 : static void fd_bpf_upgradeable_loader_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12360 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)struct_mem;
12361 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
12362 0 : fd_bpf_upgradeable_loader_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
12363 0 : }
12364 0 : void * fd_bpf_upgradeable_loader_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12365 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)mem;
12366 0 : fd_bpf_upgradeable_loader_state_new( self );
12367 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_t);
12368 0 : void * * alloc_mem = &alloc_region;
12369 0 : fd_bpf_upgradeable_loader_state_decode_inner( mem, alloc_mem, ctx );
12370 0 : return self;
12371 0 : }
12372 0 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
12373 0 : switch( discriminant ) {
12374 0 : case 0: {
12375 0 : break;
12376 0 : }
12377 0 : case 1: {
12378 0 : fd_bpf_upgradeable_loader_state_buffer_new( &self->buffer );
12379 0 : break;
12380 0 : }
12381 0 : case 2: {
12382 0 : fd_bpf_upgradeable_loader_state_program_new( &self->program );
12383 0 : break;
12384 0 : }
12385 0 : case 3: {
12386 0 : fd_bpf_upgradeable_loader_state_program_data_new( &self->program_data );
12387 0 : break;
12388 0 : }
12389 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
12390 0 : }
12391 0 : }
12392 0 : void fd_bpf_upgradeable_loader_state_new_disc( fd_bpf_upgradeable_loader_state_t * self, uint discriminant ) {
12393 0 : self->discriminant = discriminant;
12394 0 : fd_bpf_upgradeable_loader_state_inner_new( &self->inner, self->discriminant );
12395 0 : }
12396 0 : void fd_bpf_upgradeable_loader_state_new( fd_bpf_upgradeable_loader_state_t * self ) {
12397 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_t) );
12398 0 : fd_bpf_upgradeable_loader_state_new_disc( self, UINT_MAX );
12399 0 : }
12400 :
12401 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 ) {
12402 0 : (void) varint;
12403 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_state", level++, 0);
12404 0 : switch( self->discriminant ) {
12405 0 : case 0: {
12406 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12407 0 : break;
12408 0 : }
12409 0 : case 1: {
12410 0 : fun( w, self, "buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12411 0 : fd_bpf_upgradeable_loader_state_buffer_walk( w, &self->inner.buffer, fun, "buffer", level, 0 );
12412 0 : break;
12413 0 : }
12414 0 : case 2: {
12415 0 : fun( w, self, "program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12416 0 : fd_bpf_upgradeable_loader_state_program_walk( w, &self->inner.program, fun, "program", level, 0 );
12417 0 : break;
12418 0 : }
12419 0 : case 3: {
12420 0 : fun( w, self, "program_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12421 0 : fd_bpf_upgradeable_loader_state_program_data_walk( w, &self->inner.program_data, fun, "program_data", level, 0 );
12422 0 : break;
12423 0 : }
12424 0 : }
12425 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_state", level--, 0 );
12426 0 : }
12427 0 : ulong fd_bpf_upgradeable_loader_state_size( fd_bpf_upgradeable_loader_state_t const * self ) {
12428 0 : ulong size = 0;
12429 0 : size += sizeof(uint);
12430 0 : switch (self->discriminant) {
12431 0 : case 1: {
12432 0 : size += fd_bpf_upgradeable_loader_state_buffer_size( &self->inner.buffer );
12433 0 : break;
12434 0 : }
12435 0 : case 2: {
12436 0 : size += fd_bpf_upgradeable_loader_state_program_size( &self->inner.program );
12437 0 : break;
12438 0 : }
12439 0 : case 3: {
12440 0 : size += fd_bpf_upgradeable_loader_state_program_data_size( &self->inner.program_data );
12441 0 : break;
12442 0 : }
12443 0 : }
12444 0 : return size;
12445 0 : }
12446 :
12447 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 ) {
12448 0 : int err;
12449 0 : switch (discriminant) {
12450 0 : case 1: {
12451 0 : err = fd_bpf_upgradeable_loader_state_buffer_encode( &self->buffer, ctx );
12452 0 : if( FD_UNLIKELY( err ) ) return err;
12453 0 : break;
12454 0 : }
12455 0 : case 2: {
12456 0 : err = fd_bpf_upgradeable_loader_state_program_encode( &self->program, ctx );
12457 0 : if( FD_UNLIKELY( err ) ) return err;
12458 0 : break;
12459 0 : }
12460 0 : case 3: {
12461 0 : err = fd_bpf_upgradeable_loader_state_program_data_encode( &self->program_data, ctx );
12462 0 : if( FD_UNLIKELY( err ) ) return err;
12463 0 : break;
12464 0 : }
12465 0 : }
12466 0 : return FD_BINCODE_SUCCESS;
12467 0 : }
12468 0 : int fd_bpf_upgradeable_loader_state_encode( fd_bpf_upgradeable_loader_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12469 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12470 0 : if( FD_UNLIKELY( err ) ) return err;
12471 0 : return fd_bpf_upgradeable_loader_state_inner_encode( &self->inner, self->discriminant, ctx );
12472 0 : }
12473 :
12474 0 : int fd_loader_v4_state_encode( fd_loader_v4_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12475 0 : int err;
12476 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
12477 0 : if( FD_UNLIKELY( err ) ) return err;
12478 0 : err = fd_pubkey_encode( &self->authority_address_or_next_version, ctx );
12479 0 : if( FD_UNLIKELY( err ) ) return err;
12480 0 : err = fd_bincode_uint64_encode( self->status, ctx );
12481 0 : if( FD_UNLIKELY( err ) ) return err;
12482 0 : return FD_BINCODE_SUCCESS;
12483 0 : }
12484 0 : static inline int fd_loader_v4_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12485 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12486 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
12487 0 : return 0;
12488 0 : }
12489 0 : static void fd_loader_v4_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12490 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)struct_mem;
12491 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
12492 0 : fd_pubkey_decode_inner( &self->authority_address_or_next_version, alloc_mem, ctx );
12493 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
12494 0 : }
12495 0 : void * fd_loader_v4_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12496 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)mem;
12497 0 : fd_loader_v4_state_new( self );
12498 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_state_t);
12499 0 : void * * alloc_mem = &alloc_region;
12500 0 : fd_loader_v4_state_decode_inner( mem, alloc_mem, ctx );
12501 0 : return self;
12502 0 : }
12503 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 ) {
12504 0 : (void) varint;
12505 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_state", level++, 0 );
12506 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12507 0 : fd_pubkey_walk( w, &self->authority_address_or_next_version, fun, "authority_address_or_next_version", level, 0 );
12508 0 : fun( w, &self->status, "status", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12509 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_state", level--, 0 );
12510 0 : }
12511 0 : int fd_frozen_hash_status_encode( fd_frozen_hash_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12512 0 : int err;
12513 0 : err = fd_hash_encode( &self->frozen_hash, ctx );
12514 0 : if( FD_UNLIKELY( err ) ) return err;
12515 0 : err = fd_bincode_bool_encode( (uchar)(self->is_duplicate_confirmed), ctx );
12516 0 : if( FD_UNLIKELY( err ) ) return err;
12517 0 : return FD_BINCODE_SUCCESS;
12518 0 : }
12519 0 : static int fd_frozen_hash_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12520 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12521 0 : int err = 0;
12522 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
12523 0 : if( FD_UNLIKELY( err ) ) return err;
12524 0 : err = fd_bincode_bool_decode_footprint( ctx );
12525 0 : if( FD_UNLIKELY( err ) ) return err;
12526 0 : return 0;
12527 0 : }
12528 0 : int fd_frozen_hash_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12529 0 : *total_sz += sizeof(fd_frozen_hash_status_t);
12530 0 : void const * start_data = ctx->data;
12531 0 : int err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
12532 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12533 0 : ctx->data = start_data;
12534 0 : return err;
12535 0 : }
12536 0 : static void fd_frozen_hash_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12537 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)struct_mem;
12538 0 : fd_hash_decode_inner( &self->frozen_hash, alloc_mem, ctx );
12539 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
12540 0 : }
12541 0 : void * fd_frozen_hash_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12542 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)mem;
12543 0 : fd_frozen_hash_status_new( self );
12544 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_status_t);
12545 0 : void * * alloc_mem = &alloc_region;
12546 0 : fd_frozen_hash_status_decode_inner( mem, alloc_mem, ctx );
12547 0 : return self;
12548 0 : }
12549 0 : void fd_frozen_hash_status_new(fd_frozen_hash_status_t * self) {
12550 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_status_t) );
12551 0 : fd_hash_new( &self->frozen_hash );
12552 0 : }
12553 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 ) {
12554 0 : (void) varint;
12555 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_frozen_hash_status", level++, 0 );
12556 0 : fd_hash_walk( w, &self->frozen_hash, fun, "frozen_hash", level, 0 );
12557 0 : fun( w, &self->is_duplicate_confirmed, "is_duplicate_confirmed", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
12558 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_frozen_hash_status", level--, 0 );
12559 0 : }
12560 0 : FD_FN_PURE uchar fd_frozen_hash_versioned_is_current(fd_frozen_hash_versioned_t const * self) {
12561 0 : return self->discriminant == 0;
12562 0 : }
12563 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant );
12564 0 : int fd_frozen_hash_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12565 0 : int err;
12566 0 : switch (discriminant) {
12567 0 : case 0: {
12568 0 : err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
12569 0 : if( FD_UNLIKELY( err ) ) return err;
12570 0 : return FD_BINCODE_SUCCESS;
12571 0 : }
12572 0 : default: return FD_BINCODE_ERR_ENCODING;
12573 0 : }
12574 0 : }
12575 0 : static int fd_frozen_hash_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12576 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12577 0 : uint discriminant = 0;
12578 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
12579 0 : if( FD_UNLIKELY( err ) ) return err;
12580 0 : return fd_frozen_hash_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
12581 0 : }
12582 0 : int fd_frozen_hash_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12583 0 : *total_sz += sizeof(fd_frozen_hash_versioned_t);
12584 0 : void const * start_data = ctx->data;
12585 0 : int err = fd_frozen_hash_versioned_decode_footprint_inner( ctx, total_sz );
12586 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12587 0 : ctx->data = start_data;
12588 0 : return err;
12589 0 : }
12590 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 ) {
12591 0 : switch (discriminant) {
12592 0 : case 0: {
12593 0 : fd_frozen_hash_status_decode_inner( &self->current, alloc_mem, ctx );
12594 0 : break;
12595 0 : }
12596 0 : }
12597 0 : }
12598 0 : static void fd_frozen_hash_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12599 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)struct_mem;
12600 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
12601 0 : fd_frozen_hash_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
12602 0 : }
12603 0 : void * fd_frozen_hash_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12604 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)mem;
12605 0 : fd_frozen_hash_versioned_new( self );
12606 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_versioned_t);
12607 0 : void * * alloc_mem = &alloc_region;
12608 0 : fd_frozen_hash_versioned_decode_inner( mem, alloc_mem, ctx );
12609 0 : return self;
12610 0 : }
12611 0 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
12612 0 : switch( discriminant ) {
12613 0 : case 0: {
12614 0 : fd_frozen_hash_status_new( &self->current );
12615 0 : break;
12616 0 : }
12617 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
12618 0 : }
12619 0 : }
12620 0 : void fd_frozen_hash_versioned_new_disc( fd_frozen_hash_versioned_t * self, uint discriminant ) {
12621 0 : self->discriminant = discriminant;
12622 0 : fd_frozen_hash_versioned_inner_new( &self->inner, self->discriminant );
12623 0 : }
12624 0 : void fd_frozen_hash_versioned_new( fd_frozen_hash_versioned_t * self ) {
12625 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_versioned_t) );
12626 0 : fd_frozen_hash_versioned_new_disc( self, UINT_MAX );
12627 0 : }
12628 :
12629 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 ) {
12630 0 : (void) varint;
12631 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_frozen_hash_versioned", level++, 0);
12632 0 : switch( self->discriminant ) {
12633 0 : case 0: {
12634 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12635 0 : fd_frozen_hash_status_walk( w, &self->inner.current, fun, "current", level, 0 );
12636 0 : break;
12637 0 : }
12638 0 : }
12639 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_frozen_hash_versioned", level--, 0 );
12640 0 : }
12641 0 : ulong fd_frozen_hash_versioned_size( fd_frozen_hash_versioned_t const * self ) {
12642 0 : ulong size = 0;
12643 0 : size += sizeof(uint);
12644 0 : switch (self->discriminant) {
12645 0 : case 0: {
12646 0 : size += fd_frozen_hash_status_size( &self->inner.current );
12647 0 : break;
12648 0 : }
12649 0 : }
12650 0 : return size;
12651 0 : }
12652 :
12653 0 : int fd_frozen_hash_versioned_inner_encode( fd_frozen_hash_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
12654 0 : int err;
12655 0 : switch (discriminant) {
12656 0 : case 0: {
12657 0 : err = fd_frozen_hash_status_encode( &self->current, ctx );
12658 0 : if( FD_UNLIKELY( err ) ) return err;
12659 0 : break;
12660 0 : }
12661 0 : }
12662 0 : return FD_BINCODE_SUCCESS;
12663 0 : }
12664 0 : int fd_frozen_hash_versioned_encode( fd_frozen_hash_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12665 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12666 0 : if( FD_UNLIKELY( err ) ) return err;
12667 0 : return fd_frozen_hash_versioned_inner_encode( &self->inner, self->discriminant, ctx );
12668 0 : }
12669 :
12670 12 : int fd_lookup_table_meta_encode( fd_lookup_table_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12671 12 : int err;
12672 12 : err = fd_bincode_uint64_encode( self->deactivation_slot, ctx );
12673 12 : if( FD_UNLIKELY( err ) ) return err;
12674 12 : err = fd_bincode_uint64_encode( self->last_extended_slot, ctx );
12675 12 : if( FD_UNLIKELY( err ) ) return err;
12676 12 : err = fd_bincode_uint8_encode( (uchar)(self->last_extended_slot_start_index), ctx );
12677 12 : if( FD_UNLIKELY( err ) ) return err;
12678 12 : err = fd_bincode_bool_encode( self->has_authority, ctx );
12679 12 : if( FD_UNLIKELY( err ) ) return err;
12680 12 : if( self->has_authority ) {
12681 12 : err = fd_pubkey_encode( &self->authority, ctx );
12682 12 : if( FD_UNLIKELY( err ) ) return err;
12683 12 : }
12684 12 : err = fd_bincode_uint16_encode( self->_padding, ctx );
12685 12 : if( FD_UNLIKELY( err ) ) return err;
12686 12 : return FD_BINCODE_SUCCESS;
12687 12 : }
12688 12 : static int fd_lookup_table_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12689 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12690 12 : int err = 0;
12691 12 : err = fd_bincode_uint64_decode_footprint( ctx );
12692 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12693 12 : err = fd_bincode_uint64_decode_footprint( ctx );
12694 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12695 12 : err = fd_bincode_uint8_decode_footprint( ctx );
12696 12 : if( FD_UNLIKELY( err ) ) return err;
12697 12 : {
12698 12 : uchar o;
12699 12 : err = fd_bincode_bool_decode( &o, ctx );
12700 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12701 12 : if( o ) {
12702 12 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
12703 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12704 12 : }
12705 12 : }
12706 12 : err = fd_bincode_uint16_decode_footprint( ctx );
12707 12 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
12708 12 : return 0;
12709 12 : }
12710 0 : int fd_lookup_table_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12711 0 : *total_sz += sizeof(fd_lookup_table_meta_t);
12712 0 : void const * start_data = ctx->data;
12713 0 : int err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
12714 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12715 0 : ctx->data = start_data;
12716 0 : return err;
12717 0 : }
12718 12 : static void fd_lookup_table_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12719 12 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)struct_mem;
12720 12 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
12721 12 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
12722 12 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
12723 12 : {
12724 12 : uchar o;
12725 12 : fd_bincode_bool_decode_unsafe( &o, ctx );
12726 12 : self->has_authority = !!o;
12727 12 : if( o ) {
12728 12 : fd_pubkey_new( &self->authority );
12729 12 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
12730 12 : }
12731 12 : }
12732 12 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
12733 12 : }
12734 0 : void * fd_lookup_table_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12735 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)mem;
12736 0 : fd_lookup_table_meta_new( self );
12737 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lookup_table_meta_t);
12738 0 : void * * alloc_mem = &alloc_region;
12739 0 : fd_lookup_table_meta_decode_inner( mem, alloc_mem, ctx );
12740 0 : return self;
12741 0 : }
12742 0 : void fd_lookup_table_meta_new(fd_lookup_table_meta_t * self) {
12743 0 : fd_memset( self, 0, sizeof(fd_lookup_table_meta_t) );
12744 0 : }
12745 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 ) {
12746 0 : (void) varint;
12747 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lookup_table_meta", level++, 0 );
12748 0 : fun( w, &self->deactivation_slot, "deactivation_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12749 0 : fun( w, &self->last_extended_slot, "last_extended_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
12750 0 : fun( w, &self->last_extended_slot_start_index, "last_extended_slot_start_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
12751 0 : if( !self->has_authority ) {
12752 0 : fun( w, NULL, "authority", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
12753 0 : } else {
12754 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level, 0 );
12755 0 : }
12756 0 : fun( w, &self->_padding, "_padding", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
12757 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lookup_table_meta", level--, 0 );
12758 0 : }
12759 0 : ulong fd_lookup_table_meta_size( fd_lookup_table_meta_t const * self ) {
12760 0 : ulong size = 0;
12761 0 : size += sizeof(ulong);
12762 0 : size += sizeof(ulong);
12763 0 : size += sizeof(char);
12764 0 : size += sizeof(char);
12765 0 : if( self->has_authority ) {
12766 0 : size += fd_pubkey_size( &self->authority );
12767 0 : }
12768 0 : size += sizeof(ushort);
12769 0 : return size;
12770 0 : }
12771 :
12772 12 : int fd_address_lookup_table_encode( fd_address_lookup_table_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12773 12 : int err;
12774 12 : err = fd_lookup_table_meta_encode( &self->meta, ctx );
12775 12 : if( FD_UNLIKELY( err ) ) return err;
12776 12 : return FD_BINCODE_SUCCESS;
12777 12 : }
12778 12 : static int fd_address_lookup_table_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12779 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12780 12 : int err = 0;
12781 12 : err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
12782 12 : if( FD_UNLIKELY( err ) ) return err;
12783 12 : return 0;
12784 12 : }
12785 0 : int fd_address_lookup_table_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12786 0 : *total_sz += sizeof(fd_address_lookup_table_t);
12787 0 : void const * start_data = ctx->data;
12788 0 : int err = fd_address_lookup_table_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 12 : static void fd_address_lookup_table_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12794 12 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)struct_mem;
12795 12 : fd_lookup_table_meta_decode_inner( &self->meta, alloc_mem, ctx );
12796 12 : }
12797 0 : void * fd_address_lookup_table_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12798 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)mem;
12799 0 : fd_address_lookup_table_new( self );
12800 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_t);
12801 0 : void * * alloc_mem = &alloc_region;
12802 0 : fd_address_lookup_table_decode_inner( mem, alloc_mem, ctx );
12803 0 : return self;
12804 0 : }
12805 0 : void fd_address_lookup_table_new(fd_address_lookup_table_t * self) {
12806 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_t) );
12807 0 : fd_lookup_table_meta_new( &self->meta );
12808 0 : }
12809 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 ) {
12810 0 : (void) varint;
12811 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_address_lookup_table", level++, 0 );
12812 0 : fd_lookup_table_meta_walk( w, &self->meta, fun, "meta", level, 0 );
12813 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_address_lookup_table", level--, 0 );
12814 0 : }
12815 0 : ulong fd_address_lookup_table_size( fd_address_lookup_table_t const * self ) {
12816 0 : ulong size = 0;
12817 0 : size += fd_lookup_table_meta_size( &self->meta );
12818 0 : return size;
12819 0 : }
12820 :
12821 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_uninitialized(fd_address_lookup_table_state_t const * self) {
12822 0 : return self->discriminant == 0;
12823 0 : }
12824 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_lookup_table(fd_address_lookup_table_state_t const * self) {
12825 0 : return self->discriminant == 1;
12826 0 : }
12827 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant );
12828 12 : int fd_address_lookup_table_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12829 12 : int err;
12830 12 : switch (discriminant) {
12831 0 : case 0: {
12832 0 : return FD_BINCODE_SUCCESS;
12833 0 : }
12834 12 : case 1: {
12835 12 : err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
12836 12 : if( FD_UNLIKELY( err ) ) return err;
12837 12 : return FD_BINCODE_SUCCESS;
12838 12 : }
12839 0 : default: return FD_BINCODE_ERR_ENCODING;
12840 12 : }
12841 12 : }
12842 12 : static int fd_address_lookup_table_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12843 12 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12844 12 : uint discriminant = 0;
12845 12 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
12846 12 : if( FD_UNLIKELY( err ) ) return err;
12847 12 : return fd_address_lookup_table_state_inner_decode_footprint( discriminant, ctx, total_sz );
12848 12 : }
12849 12 : int fd_address_lookup_table_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12850 12 : *total_sz += sizeof(fd_address_lookup_table_state_t);
12851 12 : void const * start_data = ctx->data;
12852 12 : int err = fd_address_lookup_table_state_decode_footprint_inner( ctx, total_sz );
12853 12 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12854 12 : ctx->data = start_data;
12855 12 : return err;
12856 12 : }
12857 12 : 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 ) {
12858 12 : switch (discriminant) {
12859 0 : case 0: {
12860 0 : break;
12861 0 : }
12862 12 : case 1: {
12863 12 : fd_address_lookup_table_decode_inner( &self->lookup_table, alloc_mem, ctx );
12864 12 : break;
12865 0 : }
12866 12 : }
12867 12 : }
12868 12 : static void fd_address_lookup_table_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12869 12 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)struct_mem;
12870 12 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
12871 12 : fd_address_lookup_table_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
12872 12 : }
12873 12 : void * fd_address_lookup_table_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12874 12 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)mem;
12875 12 : fd_address_lookup_table_state_new( self );
12876 12 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_state_t);
12877 12 : void * * alloc_mem = &alloc_region;
12878 12 : fd_address_lookup_table_state_decode_inner( mem, alloc_mem, ctx );
12879 12 : return self;
12880 12 : }
12881 12 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
12882 12 : switch( discriminant ) {
12883 0 : case 0: {
12884 0 : break;
12885 0 : }
12886 0 : case 1: {
12887 0 : fd_address_lookup_table_new( &self->lookup_table );
12888 0 : break;
12889 0 : }
12890 12 : default: break; // FD_LOG_ERR(( "unhandled type"));
12891 12 : }
12892 12 : }
12893 12 : void fd_address_lookup_table_state_new_disc( fd_address_lookup_table_state_t * self, uint discriminant ) {
12894 12 : self->discriminant = discriminant;
12895 12 : fd_address_lookup_table_state_inner_new( &self->inner, self->discriminant );
12896 12 : }
12897 12 : void fd_address_lookup_table_state_new( fd_address_lookup_table_state_t * self ) {
12898 12 : fd_memset( self, 0, sizeof(fd_address_lookup_table_state_t) );
12899 12 : fd_address_lookup_table_state_new_disc( self, UINT_MAX );
12900 12 : }
12901 :
12902 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 ) {
12903 0 : (void) varint;
12904 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_address_lookup_table_state", level++, 0);
12905 0 : switch( self->discriminant ) {
12906 0 : case 0: {
12907 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12908 0 : break;
12909 0 : }
12910 0 : case 1: {
12911 0 : fun( w, self, "lookup_table", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
12912 0 : fd_address_lookup_table_walk( w, &self->inner.lookup_table, fun, "lookup_table", level, 0 );
12913 0 : break;
12914 0 : }
12915 0 : }
12916 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_address_lookup_table_state", level--, 0 );
12917 0 : }
12918 0 : ulong fd_address_lookup_table_state_size( fd_address_lookup_table_state_t const * self ) {
12919 0 : ulong size = 0;
12920 0 : size += sizeof(uint);
12921 0 : switch (self->discriminant) {
12922 0 : case 1: {
12923 0 : size += fd_address_lookup_table_size( &self->inner.lookup_table );
12924 0 : break;
12925 0 : }
12926 0 : }
12927 0 : return size;
12928 0 : }
12929 :
12930 12 : 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 ) {
12931 12 : int err;
12932 12 : switch (discriminant) {
12933 12 : case 1: {
12934 12 : err = fd_address_lookup_table_encode( &self->lookup_table, ctx );
12935 12 : if( FD_UNLIKELY( err ) ) return err;
12936 12 : break;
12937 12 : }
12938 12 : }
12939 12 : return FD_BINCODE_SUCCESS;
12940 12 : }
12941 12 : int fd_address_lookup_table_state_encode( fd_address_lookup_table_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12942 12 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
12943 12 : if( FD_UNLIKELY( err ) ) return err;
12944 12 : return fd_address_lookup_table_state_inner_encode( &self->inner, self->discriminant, ctx );
12945 12 : }
12946 :
12947 0 : int fd_gossip_ping_encode( fd_gossip_ping_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12948 0 : int err;
12949 0 : err = fd_pubkey_encode( &self->from, ctx );
12950 0 : if( FD_UNLIKELY( err ) ) return err;
12951 0 : err = fd_hash_encode( &self->token, ctx );
12952 0 : if( FD_UNLIKELY( err ) ) return err;
12953 0 : err = fd_signature_encode( &self->signature, ctx );
12954 0 : if( FD_UNLIKELY( err ) ) return err;
12955 0 : return FD_BINCODE_SUCCESS;
12956 0 : }
12957 3 : static inline int fd_gossip_ping_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12958 3 : if( (ulong)ctx->data + 128UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12959 3 : ctx->data = (void *)( (ulong)ctx->data + 128UL );
12960 3 : return 0;
12961 3 : }
12962 3 : static void fd_gossip_ping_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12963 3 : fd_gossip_ping_t * self = (fd_gossip_ping_t *)struct_mem;
12964 3 : fd_pubkey_decode_inner( &self->from, alloc_mem, ctx );
12965 3 : fd_hash_decode_inner( &self->token, alloc_mem, ctx );
12966 3 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
12967 3 : }
12968 0 : void * fd_gossip_ping_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
12969 0 : fd_gossip_ping_t * self = (fd_gossip_ping_t *)mem;
12970 0 : fd_gossip_ping_new( self );
12971 0 : void * alloc_region = (uchar *)mem + sizeof(fd_gossip_ping_t);
12972 0 : void * * alloc_mem = &alloc_region;
12973 0 : fd_gossip_ping_decode_inner( mem, alloc_mem, ctx );
12974 0 : return self;
12975 0 : }
12976 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 ) {
12977 3 : (void) varint;
12978 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_gossip_ping", level++, 0 );
12979 3 : fd_pubkey_walk( w, &self->from, fun, "from", level, 0 );
12980 3 : fd_hash_walk( w, &self->token, fun, "token", level, 0 );
12981 3 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
12982 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_gossip_ping", level--, 0 );
12983 3 : }
12984 0 : int fd_addrlut_create_encode( fd_addrlut_create_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12985 0 : int err;
12986 0 : err = fd_bincode_uint64_encode( self->recent_slot, ctx );
12987 0 : if( FD_UNLIKELY( err ) ) return err;
12988 0 : err = fd_bincode_uint8_encode( (uchar)(self->bump_seed), ctx );
12989 0 : if( FD_UNLIKELY( err ) ) return err;
12990 0 : return FD_BINCODE_SUCCESS;
12991 0 : }
12992 0 : static inline int fd_addrlut_create_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
12993 0 : if( (ulong)ctx->data + 9UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
12994 0 : ctx->data = (void *)( (ulong)ctx->data + 9UL );
12995 0 : return 0;
12996 0 : }
12997 0 : static void fd_addrlut_create_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
12998 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)struct_mem;
12999 0 : fd_bincode_uint64_decode_unsafe( &self->recent_slot, ctx );
13000 0 : fd_bincode_uint8_decode_unsafe( &self->bump_seed, ctx );
13001 0 : }
13002 0 : void * fd_addrlut_create_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13003 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)mem;
13004 0 : fd_addrlut_create_new( self );
13005 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_create_t);
13006 0 : void * * alloc_mem = &alloc_region;
13007 0 : fd_addrlut_create_decode_inner( mem, alloc_mem, ctx );
13008 0 : return self;
13009 0 : }
13010 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 ) {
13011 0 : (void) varint;
13012 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_create", level++, 0 );
13013 0 : fun( w, &self->recent_slot, "recent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13014 0 : fun( w, &self->bump_seed, "bump_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
13015 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_create", level--, 0 );
13016 0 : }
13017 0 : int fd_addrlut_extend_encode( fd_addrlut_extend_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13018 0 : int err;
13019 0 : err = fd_bincode_uint64_encode( self->new_addrs_len, ctx );
13020 0 : if( FD_UNLIKELY(err) ) return err;
13021 0 : if( self->new_addrs_len ) {
13022 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
13023 0 : err = fd_pubkey_encode( self->new_addrs + i, ctx );
13024 0 : if( FD_UNLIKELY( err ) ) return err;
13025 0 : }
13026 0 : }
13027 0 : return FD_BINCODE_SUCCESS;
13028 0 : }
13029 0 : static int fd_addrlut_extend_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13030 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13031 0 : int err = 0;
13032 0 : ulong new_addrs_len;
13033 0 : err = fd_bincode_uint64_decode( &new_addrs_len, ctx );
13034 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13035 0 : if( new_addrs_len ) {
13036 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*new_addrs_len;
13037 0 : for( ulong i=0; i < new_addrs_len; i++ ) {
13038 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
13039 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
13040 0 : }
13041 0 : }
13042 0 : return 0;
13043 0 : }
13044 0 : int fd_addrlut_extend_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13045 0 : *total_sz += sizeof(fd_addrlut_extend_t);
13046 0 : void const * start_data = ctx->data;
13047 0 : int err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
13048 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13049 0 : ctx->data = start_data;
13050 0 : return err;
13051 0 : }
13052 0 : static void fd_addrlut_extend_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13053 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)struct_mem;
13054 0 : fd_bincode_uint64_decode_unsafe( &self->new_addrs_len, ctx );
13055 0 : if( self->new_addrs_len ) {
13056 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
13057 0 : self->new_addrs = *alloc_mem;
13058 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->new_addrs_len;
13059 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
13060 0 : fd_pubkey_new( self->new_addrs + i );
13061 0 : fd_pubkey_decode_inner( self->new_addrs + i, alloc_mem, ctx );
13062 0 : }
13063 0 : } else
13064 0 : self->new_addrs = NULL;
13065 0 : }
13066 0 : void * fd_addrlut_extend_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13067 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)mem;
13068 0 : fd_addrlut_extend_new( self );
13069 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_extend_t);
13070 0 : void * * alloc_mem = &alloc_region;
13071 0 : fd_addrlut_extend_decode_inner( mem, alloc_mem, ctx );
13072 0 : return self;
13073 0 : }
13074 0 : void fd_addrlut_extend_new(fd_addrlut_extend_t * self) {
13075 0 : fd_memset( self, 0, sizeof(fd_addrlut_extend_t) );
13076 0 : }
13077 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 ) {
13078 0 : (void) varint;
13079 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_extend", level++, 0 );
13080 0 : if( self->new_addrs_len ) {
13081 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
13082 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
13083 0 : fd_pubkey_walk(w, self->new_addrs + i, fun, "pubkey", level, 0 );
13084 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
13085 0 : }
13086 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_extend", level--, 0 );
13087 0 : }
13088 0 : ulong fd_addrlut_extend_size( fd_addrlut_extend_t const * self ) {
13089 0 : ulong size = 0;
13090 0 : do {
13091 0 : size += sizeof(ulong);
13092 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
13093 0 : size += fd_pubkey_size( self->new_addrs + i );
13094 0 : } while(0);
13095 0 : return size;
13096 0 : }
13097 :
13098 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_create_lut(fd_addrlut_instruction_t const * self) {
13099 0 : return self->discriminant == 0;
13100 0 : }
13101 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_freeze_lut(fd_addrlut_instruction_t const * self) {
13102 0 : return self->discriminant == 1;
13103 0 : }
13104 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_extend_lut(fd_addrlut_instruction_t const * self) {
13105 0 : return self->discriminant == 2;
13106 0 : }
13107 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_deactivate_lut(fd_addrlut_instruction_t const * self) {
13108 0 : return self->discriminant == 3;
13109 0 : }
13110 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_close_lut(fd_addrlut_instruction_t const * self) {
13111 0 : return self->discriminant == 4;
13112 0 : }
13113 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant );
13114 0 : int fd_addrlut_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13115 0 : int err;
13116 0 : switch (discriminant) {
13117 0 : case 0: {
13118 0 : err = fd_addrlut_create_decode_footprint_inner( ctx, total_sz );
13119 0 : if( FD_UNLIKELY( err ) ) return err;
13120 0 : return FD_BINCODE_SUCCESS;
13121 0 : }
13122 0 : case 1: {
13123 0 : return FD_BINCODE_SUCCESS;
13124 0 : }
13125 0 : case 2: {
13126 0 : err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
13127 0 : if( FD_UNLIKELY( err ) ) return err;
13128 0 : return FD_BINCODE_SUCCESS;
13129 0 : }
13130 0 : case 3: {
13131 0 : return FD_BINCODE_SUCCESS;
13132 0 : }
13133 0 : case 4: {
13134 0 : return FD_BINCODE_SUCCESS;
13135 0 : }
13136 0 : default: return FD_BINCODE_ERR_ENCODING;
13137 0 : }
13138 0 : }
13139 0 : static int fd_addrlut_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13140 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13141 0 : uint discriminant = 0;
13142 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
13143 0 : if( FD_UNLIKELY( err ) ) return err;
13144 0 : return fd_addrlut_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
13145 0 : }
13146 0 : int fd_addrlut_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13147 0 : *total_sz += sizeof(fd_addrlut_instruction_t);
13148 0 : void const * start_data = ctx->data;
13149 0 : int err = fd_addrlut_instruction_decode_footprint_inner( ctx, total_sz );
13150 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13151 0 : ctx->data = start_data;
13152 0 : return err;
13153 0 : }
13154 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 ) {
13155 0 : switch (discriminant) {
13156 0 : case 0: {
13157 0 : fd_addrlut_create_decode_inner( &self->create_lut, alloc_mem, ctx );
13158 0 : break;
13159 0 : }
13160 0 : case 1: {
13161 0 : break;
13162 0 : }
13163 0 : case 2: {
13164 0 : fd_addrlut_extend_decode_inner( &self->extend_lut, alloc_mem, ctx );
13165 0 : break;
13166 0 : }
13167 0 : case 3: {
13168 0 : break;
13169 0 : }
13170 0 : case 4: {
13171 0 : break;
13172 0 : }
13173 0 : }
13174 0 : }
13175 0 : static void fd_addrlut_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13176 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)struct_mem;
13177 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
13178 0 : fd_addrlut_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
13179 0 : }
13180 0 : void * fd_addrlut_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13181 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)mem;
13182 0 : fd_addrlut_instruction_new( self );
13183 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_instruction_t);
13184 0 : void * * alloc_mem = &alloc_region;
13185 0 : fd_addrlut_instruction_decode_inner( mem, alloc_mem, ctx );
13186 0 : return self;
13187 0 : }
13188 0 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant ) {
13189 0 : switch( discriminant ) {
13190 0 : case 0: {
13191 0 : fd_addrlut_create_new( &self->create_lut );
13192 0 : break;
13193 0 : }
13194 0 : case 1: {
13195 0 : break;
13196 0 : }
13197 0 : case 2: {
13198 0 : fd_addrlut_extend_new( &self->extend_lut );
13199 0 : break;
13200 0 : }
13201 0 : case 3: {
13202 0 : break;
13203 0 : }
13204 0 : case 4: {
13205 0 : break;
13206 0 : }
13207 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
13208 0 : }
13209 0 : }
13210 0 : void fd_addrlut_instruction_new_disc( fd_addrlut_instruction_t * self, uint discriminant ) {
13211 0 : self->discriminant = discriminant;
13212 0 : fd_addrlut_instruction_inner_new( &self->inner, self->discriminant );
13213 0 : }
13214 0 : void fd_addrlut_instruction_new( fd_addrlut_instruction_t * self ) {
13215 0 : fd_memset( self, 0, sizeof(fd_addrlut_instruction_t) );
13216 0 : fd_addrlut_instruction_new_disc( self, UINT_MAX );
13217 0 : }
13218 :
13219 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 ) {
13220 0 : (void) varint;
13221 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_addrlut_instruction", level++, 0);
13222 0 : switch( self->discriminant ) {
13223 0 : case 0: {
13224 0 : fun( w, self, "create_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13225 0 : fd_addrlut_create_walk( w, &self->inner.create_lut, fun, "create_lut", level, 0 );
13226 0 : break;
13227 0 : }
13228 0 : case 1: {
13229 0 : fun( w, self, "freeze_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13230 0 : break;
13231 0 : }
13232 0 : case 2: {
13233 0 : fun( w, self, "extend_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13234 0 : fd_addrlut_extend_walk( w, &self->inner.extend_lut, fun, "extend_lut", level, 0 );
13235 0 : break;
13236 0 : }
13237 0 : case 3: {
13238 0 : fun( w, self, "deactivate_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13239 0 : break;
13240 0 : }
13241 0 : case 4: {
13242 0 : fun( w, self, "close_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13243 0 : break;
13244 0 : }
13245 0 : }
13246 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_addrlut_instruction", level--, 0 );
13247 0 : }
13248 0 : ulong fd_addrlut_instruction_size( fd_addrlut_instruction_t const * self ) {
13249 0 : ulong size = 0;
13250 0 : size += sizeof(uint);
13251 0 : switch (self->discriminant) {
13252 0 : case 0: {
13253 0 : size += fd_addrlut_create_size( &self->inner.create_lut );
13254 0 : break;
13255 0 : }
13256 0 : case 2: {
13257 0 : size += fd_addrlut_extend_size( &self->inner.extend_lut );
13258 0 : break;
13259 0 : }
13260 0 : }
13261 0 : return size;
13262 0 : }
13263 :
13264 0 : int fd_addrlut_instruction_inner_encode( fd_addrlut_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
13265 0 : int err;
13266 0 : switch (discriminant) {
13267 0 : case 0: {
13268 0 : err = fd_addrlut_create_encode( &self->create_lut, ctx );
13269 0 : if( FD_UNLIKELY( err ) ) return err;
13270 0 : break;
13271 0 : }
13272 0 : case 2: {
13273 0 : err = fd_addrlut_extend_encode( &self->extend_lut, ctx );
13274 0 : if( FD_UNLIKELY( err ) ) return err;
13275 0 : break;
13276 0 : }
13277 0 : }
13278 0 : return FD_BINCODE_SUCCESS;
13279 0 : }
13280 0 : int fd_addrlut_instruction_encode( fd_addrlut_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13281 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
13282 0 : if( FD_UNLIKELY( err ) ) return err;
13283 0 : return fd_addrlut_instruction_inner_encode( &self->inner, self->discriminant, ctx );
13284 0 : }
13285 :
13286 0 : int fd_repair_request_header_encode( fd_repair_request_header_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13287 0 : int err;
13288 0 : err = fd_signature_encode( &self->signature, ctx );
13289 0 : if( FD_UNLIKELY( err ) ) return err;
13290 0 : err = fd_pubkey_encode( &self->sender, ctx );
13291 0 : if( FD_UNLIKELY( err ) ) return err;
13292 0 : err = fd_pubkey_encode( &self->recipient, ctx );
13293 0 : if( FD_UNLIKELY( err ) ) return err;
13294 0 : err = fd_bincode_uint64_encode( self->timestamp, ctx );
13295 0 : if( FD_UNLIKELY( err ) ) return err;
13296 0 : err = fd_bincode_uint32_encode( self->nonce, ctx );
13297 0 : if( FD_UNLIKELY( err ) ) return err;
13298 0 : return FD_BINCODE_SUCCESS;
13299 0 : }
13300 0 : static inline int fd_repair_request_header_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13301 0 : if( (ulong)ctx->data + 140UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13302 0 : ctx->data = (void *)( (ulong)ctx->data + 140UL );
13303 0 : return 0;
13304 0 : }
13305 6 : static void fd_repair_request_header_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13306 6 : fd_repair_request_header_t * self = (fd_repair_request_header_t *)struct_mem;
13307 6 : fd_signature_decode_inner( &self->signature, alloc_mem, ctx );
13308 6 : fd_pubkey_decode_inner( &self->sender, alloc_mem, ctx );
13309 6 : fd_pubkey_decode_inner( &self->recipient, alloc_mem, ctx );
13310 6 : fd_bincode_uint64_decode_unsafe( &self->timestamp, ctx );
13311 6 : fd_bincode_uint32_decode_unsafe( &self->nonce, ctx );
13312 6 : }
13313 0 : void * fd_repair_request_header_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13314 0 : fd_repair_request_header_t * self = (fd_repair_request_header_t *)mem;
13315 0 : fd_repair_request_header_new( self );
13316 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_request_header_t);
13317 0 : void * * alloc_mem = &alloc_region;
13318 0 : fd_repair_request_header_decode_inner( mem, alloc_mem, ctx );
13319 0 : return self;
13320 0 : }
13321 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 ) {
13322 6 : (void) varint;
13323 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_request_header", level++, 0 );
13324 6 : fd_signature_walk( w, &self->signature, fun, "signature", level, 0 );
13325 6 : fd_pubkey_walk( w, &self->sender, fun, "sender", level, 0 );
13326 6 : fd_pubkey_walk( w, &self->recipient, fun, "recipient", level, 0 );
13327 6 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13328 6 : fun( w, &self->nonce, "nonce", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
13329 6 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_request_header", level--, 0 );
13330 6 : }
13331 0 : int fd_repair_window_index_encode( fd_repair_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13332 0 : int err;
13333 0 : err = fd_repair_request_header_encode( &self->header, ctx );
13334 0 : if( FD_UNLIKELY( err ) ) return err;
13335 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
13336 0 : if( FD_UNLIKELY( err ) ) return err;
13337 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
13338 0 : if( FD_UNLIKELY( err ) ) return err;
13339 0 : return FD_BINCODE_SUCCESS;
13340 0 : }
13341 3 : static inline int fd_repair_window_index_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13342 3 : if( (ulong)ctx->data + 156UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13343 3 : ctx->data = (void *)( (ulong)ctx->data + 156UL );
13344 3 : return 0;
13345 3 : }
13346 3 : static void fd_repair_window_index_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13347 3 : fd_repair_window_index_t * self = (fd_repair_window_index_t *)struct_mem;
13348 3 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
13349 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
13350 3 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
13351 3 : }
13352 0 : void * fd_repair_window_index_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13353 0 : fd_repair_window_index_t * self = (fd_repair_window_index_t *)mem;
13354 0 : fd_repair_window_index_new( self );
13355 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_window_index_t);
13356 0 : void * * alloc_mem = &alloc_region;
13357 0 : fd_repair_window_index_decode_inner( mem, alloc_mem, ctx );
13358 0 : return self;
13359 0 : }
13360 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 ) {
13361 3 : (void) varint;
13362 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_window_index", level++, 0 );
13363 3 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
13364 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13365 3 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13366 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_window_index", level--, 0 );
13367 3 : }
13368 0 : int fd_repair_highest_window_index_encode( fd_repair_highest_window_index_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13369 0 : int err;
13370 0 : err = fd_repair_request_header_encode( &self->header, ctx );
13371 0 : if( FD_UNLIKELY( err ) ) return err;
13372 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
13373 0 : if( FD_UNLIKELY( err ) ) return err;
13374 0 : err = fd_bincode_uint64_encode( self->shred_index, ctx );
13375 0 : if( FD_UNLIKELY( err ) ) return err;
13376 0 : return FD_BINCODE_SUCCESS;
13377 0 : }
13378 3 : static inline int fd_repair_highest_window_index_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13379 3 : if( (ulong)ctx->data + 156UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13380 3 : ctx->data = (void *)( (ulong)ctx->data + 156UL );
13381 3 : return 0;
13382 3 : }
13383 3 : static void fd_repair_highest_window_index_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13384 3 : fd_repair_highest_window_index_t * self = (fd_repair_highest_window_index_t *)struct_mem;
13385 3 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
13386 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
13387 3 : fd_bincode_uint64_decode_unsafe( &self->shred_index, ctx );
13388 3 : }
13389 0 : void * fd_repair_highest_window_index_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13390 0 : fd_repair_highest_window_index_t * self = (fd_repair_highest_window_index_t *)mem;
13391 0 : fd_repair_highest_window_index_new( self );
13392 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_highest_window_index_t);
13393 0 : void * * alloc_mem = &alloc_region;
13394 0 : fd_repair_highest_window_index_decode_inner( mem, alloc_mem, ctx );
13395 0 : return self;
13396 0 : }
13397 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 ) {
13398 3 : (void) varint;
13399 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_highest_window_index", level++, 0 );
13400 3 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
13401 3 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13402 3 : fun( w, &self->shred_index, "shred_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13403 3 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_highest_window_index", level--, 0 );
13404 3 : }
13405 0 : int fd_repair_orphan_encode( fd_repair_orphan_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13406 0 : int err;
13407 0 : err = fd_repair_request_header_encode( &self->header, ctx );
13408 0 : if( FD_UNLIKELY( err ) ) return err;
13409 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
13410 0 : if( FD_UNLIKELY( err ) ) return err;
13411 0 : return FD_BINCODE_SUCCESS;
13412 0 : }
13413 0 : static inline int fd_repair_orphan_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13414 0 : if( (ulong)ctx->data + 148UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13415 0 : ctx->data = (void *)( (ulong)ctx->data + 148UL );
13416 0 : return 0;
13417 0 : }
13418 0 : static void fd_repair_orphan_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13419 0 : fd_repair_orphan_t * self = (fd_repair_orphan_t *)struct_mem;
13420 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
13421 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
13422 0 : }
13423 0 : void * fd_repair_orphan_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13424 0 : fd_repair_orphan_t * self = (fd_repair_orphan_t *)mem;
13425 0 : fd_repair_orphan_new( self );
13426 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_orphan_t);
13427 0 : void * * alloc_mem = &alloc_region;
13428 0 : fd_repair_orphan_decode_inner( mem, alloc_mem, ctx );
13429 0 : return self;
13430 0 : }
13431 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 ) {
13432 0 : (void) varint;
13433 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_orphan", level++, 0 );
13434 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
13435 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13436 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_orphan", level--, 0 );
13437 0 : }
13438 0 : int fd_repair_ancestor_hashes_encode( fd_repair_ancestor_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13439 0 : int err;
13440 0 : err = fd_repair_request_header_encode( &self->header, ctx );
13441 0 : if( FD_UNLIKELY( err ) ) return err;
13442 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
13443 0 : if( FD_UNLIKELY( err ) ) return err;
13444 0 : return FD_BINCODE_SUCCESS;
13445 0 : }
13446 0 : static inline int fd_repair_ancestor_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13447 0 : if( (ulong)ctx->data + 148UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13448 0 : ctx->data = (void *)( (ulong)ctx->data + 148UL );
13449 0 : return 0;
13450 0 : }
13451 0 : static void fd_repair_ancestor_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13452 0 : fd_repair_ancestor_hashes_t * self = (fd_repair_ancestor_hashes_t *)struct_mem;
13453 0 : fd_repair_request_header_decode_inner( &self->header, alloc_mem, ctx );
13454 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
13455 0 : }
13456 0 : void * fd_repair_ancestor_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13457 0 : fd_repair_ancestor_hashes_t * self = (fd_repair_ancestor_hashes_t *)mem;
13458 0 : fd_repair_ancestor_hashes_new( self );
13459 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_ancestor_hashes_t);
13460 0 : void * * alloc_mem = &alloc_region;
13461 0 : fd_repair_ancestor_hashes_decode_inner( mem, alloc_mem, ctx );
13462 0 : return self;
13463 0 : }
13464 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 ) {
13465 0 : (void) varint;
13466 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_repair_ancestor_hashes", level++, 0 );
13467 0 : fd_repair_request_header_walk( w, &self->header, fun, "header", level, 0 );
13468 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
13469 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_repair_ancestor_hashes", level--, 0 );
13470 0 : }
13471 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndex(fd_repair_protocol_t const * self) {
13472 0 : return self->discriminant == 0;
13473 0 : }
13474 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndex(fd_repair_protocol_t const * self) {
13475 0 : return self->discriminant == 1;
13476 0 : }
13477 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphan(fd_repair_protocol_t const * self) {
13478 0 : return self->discriminant == 2;
13479 0 : }
13480 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyWindowIndexWithNonce(fd_repair_protocol_t const * self) {
13481 0 : return self->discriminant == 3;
13482 0 : }
13483 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyHighestWindowIndexWithNonce(fd_repair_protocol_t const * self) {
13484 0 : return self->discriminant == 4;
13485 0 : }
13486 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyOrphanWithNonce(fd_repair_protocol_t const * self) {
13487 0 : return self->discriminant == 5;
13488 0 : }
13489 0 : FD_FN_PURE uchar fd_repair_protocol_is_LegacyAncestorHashes(fd_repair_protocol_t const * self) {
13490 0 : return self->discriminant == 6;
13491 0 : }
13492 0 : FD_FN_PURE uchar fd_repair_protocol_is_pong(fd_repair_protocol_t const * self) {
13493 0 : return self->discriminant == 7;
13494 0 : }
13495 0 : FD_FN_PURE uchar fd_repair_protocol_is_window_index(fd_repair_protocol_t const * self) {
13496 0 : return self->discriminant == 8;
13497 0 : }
13498 0 : FD_FN_PURE uchar fd_repair_protocol_is_highest_window_index(fd_repair_protocol_t const * self) {
13499 0 : return self->discriminant == 9;
13500 0 : }
13501 0 : FD_FN_PURE uchar fd_repair_protocol_is_orphan(fd_repair_protocol_t const * self) {
13502 0 : return self->discriminant == 10;
13503 0 : }
13504 0 : FD_FN_PURE uchar fd_repair_protocol_is_ancestor_hashes(fd_repair_protocol_t const * self) {
13505 0 : return self->discriminant == 11;
13506 0 : }
13507 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant );
13508 9 : int fd_repair_protocol_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13509 9 : int err;
13510 9 : switch (discriminant) {
13511 0 : case 0: {
13512 0 : return FD_BINCODE_SUCCESS;
13513 0 : }
13514 0 : case 1: {
13515 0 : return FD_BINCODE_SUCCESS;
13516 0 : }
13517 0 : case 2: {
13518 0 : return FD_BINCODE_SUCCESS;
13519 0 : }
13520 0 : case 3: {
13521 0 : return FD_BINCODE_SUCCESS;
13522 0 : }
13523 0 : case 4: {
13524 0 : return FD_BINCODE_SUCCESS;
13525 0 : }
13526 0 : case 5: {
13527 0 : return FD_BINCODE_SUCCESS;
13528 0 : }
13529 0 : case 6: {
13530 0 : return FD_BINCODE_SUCCESS;
13531 0 : }
13532 3 : case 7: {
13533 3 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
13534 3 : if( FD_UNLIKELY( err ) ) return err;
13535 3 : return FD_BINCODE_SUCCESS;
13536 3 : }
13537 3 : case 8: {
13538 3 : err = fd_repair_window_index_decode_footprint_inner( ctx, total_sz );
13539 3 : if( FD_UNLIKELY( err ) ) return err;
13540 3 : return FD_BINCODE_SUCCESS;
13541 3 : }
13542 3 : case 9: {
13543 3 : err = fd_repair_highest_window_index_decode_footprint_inner( ctx, total_sz );
13544 3 : if( FD_UNLIKELY( err ) ) return err;
13545 3 : return FD_BINCODE_SUCCESS;
13546 3 : }
13547 0 : case 10: {
13548 0 : err = fd_repair_orphan_decode_footprint_inner( ctx, total_sz );
13549 0 : if( FD_UNLIKELY( err ) ) return err;
13550 0 : return FD_BINCODE_SUCCESS;
13551 0 : }
13552 0 : case 11: {
13553 0 : err = fd_repair_ancestor_hashes_decode_footprint_inner( ctx, total_sz );
13554 0 : if( FD_UNLIKELY( err ) ) return err;
13555 0 : return FD_BINCODE_SUCCESS;
13556 0 : }
13557 0 : default: return FD_BINCODE_ERR_ENCODING;
13558 9 : }
13559 9 : }
13560 9 : static int fd_repair_protocol_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13561 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13562 9 : uint discriminant = 0;
13563 9 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
13564 9 : if( FD_UNLIKELY( err ) ) return err;
13565 9 : return fd_repair_protocol_inner_decode_footprint( discriminant, ctx, total_sz );
13566 9 : }
13567 9 : int fd_repair_protocol_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13568 9 : *total_sz += sizeof(fd_repair_protocol_t);
13569 9 : void const * start_data = ctx->data;
13570 9 : int err = fd_repair_protocol_decode_footprint_inner( ctx, total_sz );
13571 9 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13572 9 : ctx->data = start_data;
13573 9 : return err;
13574 9 : }
13575 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 ) {
13576 9 : switch (discriminant) {
13577 0 : case 0: {
13578 0 : break;
13579 0 : }
13580 0 : case 1: {
13581 0 : break;
13582 0 : }
13583 0 : case 2: {
13584 0 : break;
13585 0 : }
13586 0 : case 3: {
13587 0 : break;
13588 0 : }
13589 0 : case 4: {
13590 0 : break;
13591 0 : }
13592 0 : case 5: {
13593 0 : break;
13594 0 : }
13595 0 : case 6: {
13596 0 : break;
13597 0 : }
13598 3 : case 7: {
13599 3 : fd_gossip_ping_decode_inner( &self->pong, alloc_mem, ctx );
13600 3 : break;
13601 0 : }
13602 3 : case 8: {
13603 3 : fd_repair_window_index_decode_inner( &self->window_index, alloc_mem, ctx );
13604 3 : break;
13605 0 : }
13606 3 : case 9: {
13607 3 : fd_repair_highest_window_index_decode_inner( &self->highest_window_index, alloc_mem, ctx );
13608 3 : break;
13609 0 : }
13610 0 : case 10: {
13611 0 : fd_repair_orphan_decode_inner( &self->orphan, alloc_mem, ctx );
13612 0 : break;
13613 0 : }
13614 0 : case 11: {
13615 0 : fd_repair_ancestor_hashes_decode_inner( &self->ancestor_hashes, alloc_mem, ctx );
13616 0 : break;
13617 0 : }
13618 9 : }
13619 9 : }
13620 9 : static void fd_repair_protocol_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13621 9 : fd_repair_protocol_t * self = (fd_repair_protocol_t *)struct_mem;
13622 9 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
13623 9 : fd_repair_protocol_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
13624 9 : }
13625 9 : void * fd_repair_protocol_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13626 9 : fd_repair_protocol_t * self = (fd_repair_protocol_t *)mem;
13627 9 : fd_repair_protocol_new( self );
13628 9 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_protocol_t);
13629 9 : void * * alloc_mem = &alloc_region;
13630 9 : fd_repair_protocol_decode_inner( mem, alloc_mem, ctx );
13631 9 : return self;
13632 9 : }
13633 9 : void fd_repair_protocol_inner_new( fd_repair_protocol_inner_t * self, uint discriminant ) {
13634 9 : switch( discriminant ) {
13635 0 : case 0: {
13636 0 : break;
13637 0 : }
13638 0 : case 1: {
13639 0 : break;
13640 0 : }
13641 0 : case 2: {
13642 0 : break;
13643 0 : }
13644 0 : case 3: {
13645 0 : break;
13646 0 : }
13647 0 : case 4: {
13648 0 : break;
13649 0 : }
13650 0 : case 5: {
13651 0 : break;
13652 0 : }
13653 0 : case 6: {
13654 0 : break;
13655 0 : }
13656 0 : case 7: {
13657 0 : fd_gossip_ping_new( &self->pong );
13658 0 : break;
13659 0 : }
13660 0 : case 8: {
13661 0 : fd_repair_window_index_new( &self->window_index );
13662 0 : break;
13663 0 : }
13664 0 : case 9: {
13665 0 : fd_repair_highest_window_index_new( &self->highest_window_index );
13666 0 : break;
13667 0 : }
13668 0 : case 10: {
13669 0 : fd_repair_orphan_new( &self->orphan );
13670 0 : break;
13671 0 : }
13672 0 : case 11: {
13673 0 : fd_repair_ancestor_hashes_new( &self->ancestor_hashes );
13674 0 : break;
13675 0 : }
13676 9 : default: break; // FD_LOG_ERR(( "unhandled type"));
13677 9 : }
13678 9 : }
13679 9 : void fd_repair_protocol_new_disc( fd_repair_protocol_t * self, uint discriminant ) {
13680 9 : self->discriminant = discriminant;
13681 9 : fd_repair_protocol_inner_new( &self->inner, self->discriminant );
13682 9 : }
13683 9 : void fd_repair_protocol_new( fd_repair_protocol_t * self ) {
13684 9 : fd_memset( self, 0, sizeof(fd_repair_protocol_t) );
13685 9 : fd_repair_protocol_new_disc( self, UINT_MAX );
13686 9 : }
13687 :
13688 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 ) {
13689 9 : (void) varint;
13690 9 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_protocol", level++, 0);
13691 9 : switch( self->discriminant ) {
13692 0 : case 0: {
13693 0 : fun( w, self, "LegacyWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13694 0 : break;
13695 0 : }
13696 0 : case 1: {
13697 0 : fun( w, self, "LegacyHighestWindowIndex", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13698 0 : break;
13699 0 : }
13700 0 : case 2: {
13701 0 : fun( w, self, "LegacyOrphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13702 0 : break;
13703 0 : }
13704 0 : case 3: {
13705 0 : fun( w, self, "LegacyWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13706 0 : break;
13707 0 : }
13708 0 : case 4: {
13709 0 : fun( w, self, "LegacyHighestWindowIndexWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13710 0 : break;
13711 0 : }
13712 0 : case 5: {
13713 0 : fun( w, self, "LegacyOrphanWithNonce", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13714 0 : break;
13715 0 : }
13716 0 : case 6: {
13717 0 : fun( w, self, "LegacyAncestorHashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13718 0 : break;
13719 0 : }
13720 3 : case 7: {
13721 3 : fun( w, self, "pong", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13722 3 : fd_gossip_ping_walk( w, &self->inner.pong, fun, "pong", level, 0 );
13723 3 : break;
13724 0 : }
13725 3 : case 8: {
13726 3 : fun( w, self, "window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13727 3 : fd_repair_window_index_walk( w, &self->inner.window_index, fun, "window_index", level, 0 );
13728 3 : break;
13729 0 : }
13730 3 : case 9: {
13731 3 : fun( w, self, "highest_window_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13732 3 : fd_repair_highest_window_index_walk( w, &self->inner.highest_window_index, fun, "highest_window_index", level, 0 );
13733 3 : break;
13734 0 : }
13735 0 : case 10: {
13736 0 : fun( w, self, "orphan", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13737 0 : fd_repair_orphan_walk( w, &self->inner.orphan, fun, "orphan", level, 0 );
13738 0 : break;
13739 0 : }
13740 0 : case 11: {
13741 0 : fun( w, self, "ancestor_hashes", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13742 0 : fd_repair_ancestor_hashes_walk( w, &self->inner.ancestor_hashes, fun, "ancestor_hashes", level, 0 );
13743 0 : break;
13744 0 : }
13745 9 : }
13746 9 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_protocol", level--, 0 );
13747 9 : }
13748 0 : ulong fd_repair_protocol_size( fd_repair_protocol_t const * self ) {
13749 0 : ulong size = 0;
13750 0 : size += sizeof(uint);
13751 0 : switch (self->discriminant) {
13752 0 : case 7: {
13753 0 : size += fd_gossip_ping_size( &self->inner.pong );
13754 0 : break;
13755 0 : }
13756 0 : case 8: {
13757 0 : size += fd_repair_window_index_size( &self->inner.window_index );
13758 0 : break;
13759 0 : }
13760 0 : case 9: {
13761 0 : size += fd_repair_highest_window_index_size( &self->inner.highest_window_index );
13762 0 : break;
13763 0 : }
13764 0 : case 10: {
13765 0 : size += fd_repair_orphan_size( &self->inner.orphan );
13766 0 : break;
13767 0 : }
13768 0 : case 11: {
13769 0 : size += fd_repair_ancestor_hashes_size( &self->inner.ancestor_hashes );
13770 0 : break;
13771 0 : }
13772 0 : }
13773 0 : return size;
13774 0 : }
13775 :
13776 0 : int fd_repair_protocol_inner_encode( fd_repair_protocol_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
13777 0 : int err;
13778 0 : switch (discriminant) {
13779 0 : case 7: {
13780 0 : err = fd_gossip_ping_encode( &self->pong, ctx );
13781 0 : if( FD_UNLIKELY( err ) ) return err;
13782 0 : break;
13783 0 : }
13784 0 : case 8: {
13785 0 : err = fd_repair_window_index_encode( &self->window_index, ctx );
13786 0 : if( FD_UNLIKELY( err ) ) return err;
13787 0 : break;
13788 0 : }
13789 0 : case 9: {
13790 0 : err = fd_repair_highest_window_index_encode( &self->highest_window_index, ctx );
13791 0 : if( FD_UNLIKELY( err ) ) return err;
13792 0 : break;
13793 0 : }
13794 0 : case 10: {
13795 0 : err = fd_repair_orphan_encode( &self->orphan, ctx );
13796 0 : if( FD_UNLIKELY( err ) ) return err;
13797 0 : break;
13798 0 : }
13799 0 : case 11: {
13800 0 : err = fd_repair_ancestor_hashes_encode( &self->ancestor_hashes, ctx );
13801 0 : if( FD_UNLIKELY( err ) ) return err;
13802 0 : break;
13803 0 : }
13804 0 : }
13805 0 : return FD_BINCODE_SUCCESS;
13806 0 : }
13807 0 : int fd_repair_protocol_encode( fd_repair_protocol_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13808 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
13809 0 : if( FD_UNLIKELY( err ) ) return err;
13810 0 : return fd_repair_protocol_inner_encode( &self->inner, self->discriminant, ctx );
13811 0 : }
13812 :
13813 0 : FD_FN_PURE uchar fd_repair_response_is_ping(fd_repair_response_t const * self) {
13814 0 : return self->discriminant == 0;
13815 0 : }
13816 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant );
13817 0 : int fd_repair_response_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13818 0 : int err;
13819 0 : switch (discriminant) {
13820 0 : case 0: {
13821 0 : err = fd_gossip_ping_decode_footprint_inner( ctx, total_sz );
13822 0 : if( FD_UNLIKELY( err ) ) return err;
13823 0 : return FD_BINCODE_SUCCESS;
13824 0 : }
13825 0 : default: return FD_BINCODE_ERR_ENCODING;
13826 0 : }
13827 0 : }
13828 0 : static int fd_repair_response_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13829 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13830 0 : uint discriminant = 0;
13831 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
13832 0 : if( FD_UNLIKELY( err ) ) return err;
13833 0 : return fd_repair_response_inner_decode_footprint( discriminant, ctx, total_sz );
13834 0 : }
13835 0 : int fd_repair_response_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
13836 0 : *total_sz += sizeof(fd_repair_response_t);
13837 0 : void const * start_data = ctx->data;
13838 0 : int err = fd_repair_response_decode_footprint_inner( ctx, total_sz );
13839 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
13840 0 : ctx->data = start_data;
13841 0 : return err;
13842 0 : }
13843 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 ) {
13844 0 : switch (discriminant) {
13845 0 : case 0: {
13846 0 : fd_gossip_ping_decode_inner( &self->ping, alloc_mem, ctx );
13847 0 : break;
13848 0 : }
13849 0 : }
13850 0 : }
13851 0 : static void fd_repair_response_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
13852 0 : fd_repair_response_t * self = (fd_repair_response_t *)struct_mem;
13853 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
13854 0 : fd_repair_response_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
13855 0 : }
13856 0 : void * fd_repair_response_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
13857 0 : fd_repair_response_t * self = (fd_repair_response_t *)mem;
13858 0 : fd_repair_response_new( self );
13859 0 : void * alloc_region = (uchar *)mem + sizeof(fd_repair_response_t);
13860 0 : void * * alloc_mem = &alloc_region;
13861 0 : fd_repair_response_decode_inner( mem, alloc_mem, ctx );
13862 0 : return self;
13863 0 : }
13864 0 : void fd_repair_response_inner_new( fd_repair_response_inner_t * self, uint discriminant ) {
13865 0 : switch( discriminant ) {
13866 0 : case 0: {
13867 0 : fd_gossip_ping_new( &self->ping );
13868 0 : break;
13869 0 : }
13870 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
13871 0 : }
13872 0 : }
13873 0 : void fd_repair_response_new_disc( fd_repair_response_t * self, uint discriminant ) {
13874 0 : self->discriminant = discriminant;
13875 0 : fd_repair_response_inner_new( &self->inner, self->discriminant );
13876 0 : }
13877 0 : void fd_repair_response_new( fd_repair_response_t * self ) {
13878 0 : fd_memset( self, 0, sizeof(fd_repair_response_t) );
13879 0 : fd_repair_response_new_disc( self, UINT_MAX );
13880 0 : }
13881 :
13882 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 ) {
13883 0 : (void) varint;
13884 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_repair_response", level++, 0);
13885 0 : switch( self->discriminant ) {
13886 0 : case 0: {
13887 0 : fun( w, self, "ping", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
13888 0 : fd_gossip_ping_walk( w, &self->inner.ping, fun, "ping", level, 0 );
13889 0 : break;
13890 0 : }
13891 0 : }
13892 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_repair_response", level--, 0 );
13893 0 : }
13894 0 : ulong fd_repair_response_size( fd_repair_response_t const * self ) {
13895 0 : ulong size = 0;
13896 0 : size += sizeof(uint);
13897 0 : switch (self->discriminant) {
13898 0 : case 0: {
13899 0 : size += fd_gossip_ping_size( &self->inner.ping );
13900 0 : break;
13901 0 : }
13902 0 : }
13903 0 : return size;
13904 0 : }
13905 :
13906 0 : int fd_repair_response_inner_encode( fd_repair_response_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
13907 0 : int err;
13908 0 : switch (discriminant) {
13909 0 : case 0: {
13910 0 : err = fd_gossip_ping_encode( &self->ping, ctx );
13911 0 : if( FD_UNLIKELY( err ) ) return err;
13912 0 : break;
13913 0 : }
13914 0 : }
13915 0 : return FD_BINCODE_SUCCESS;
13916 0 : }
13917 0 : int fd_repair_response_encode( fd_repair_response_t const * self, fd_bincode_encode_ctx_t * ctx ) {
13918 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
13919 0 : if( FD_UNLIKELY( err ) ) return err;
13920 0 : return fd_repair_response_inner_encode( &self->inner, self->discriminant, ctx );
13921 0 : }
13922 :
13923 0 : FD_FN_PURE uchar fd_instr_error_enum_is_generic_error(fd_instr_error_enum_t const * self) {
13924 0 : return self->discriminant == 0;
13925 0 : }
13926 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_argument(fd_instr_error_enum_t const * self) {
13927 0 : return self->discriminant == 1;
13928 0 : }
13929 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_instruction_data(fd_instr_error_enum_t const * self) {
13930 0 : return self->discriminant == 2;
13931 0 : }
13932 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_data(fd_instr_error_enum_t const * self) {
13933 0 : return self->discriminant == 3;
13934 0 : }
13935 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_too_small(fd_instr_error_enum_t const * self) {
13936 0 : return self->discriminant == 4;
13937 0 : }
13938 0 : FD_FN_PURE uchar fd_instr_error_enum_is_insufficient_funds(fd_instr_error_enum_t const * self) {
13939 0 : return self->discriminant == 5;
13940 0 : }
13941 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_program_id(fd_instr_error_enum_t const * self) {
13942 0 : return self->discriminant == 6;
13943 0 : }
13944 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_required_signature(fd_instr_error_enum_t const * self) {
13945 0 : return self->discriminant == 7;
13946 0 : }
13947 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_already_initialized(fd_instr_error_enum_t const * self) {
13948 0 : return self->discriminant == 8;
13949 0 : }
13950 0 : FD_FN_PURE uchar fd_instr_error_enum_is_uninitialized_account(fd_instr_error_enum_t const * self) {
13951 0 : return self->discriminant == 9;
13952 0 : }
13953 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unbalanced_instruction(fd_instr_error_enum_t const * self) {
13954 0 : return self->discriminant == 10;
13955 0 : }
13956 0 : FD_FN_PURE uchar fd_instr_error_enum_is_modified_program_id(fd_instr_error_enum_t const * self) {
13957 0 : return self->discriminant == 11;
13958 0 : }
13959 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_lamport_spend(fd_instr_error_enum_t const * self) {
13960 0 : return self->discriminant == 12;
13961 0 : }
13962 0 : FD_FN_PURE uchar fd_instr_error_enum_is_external_account_data_modified(fd_instr_error_enum_t const * self) {
13963 0 : return self->discriminant == 13;
13964 0 : }
13965 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_lamport_change(fd_instr_error_enum_t const * self) {
13966 0 : return self->discriminant == 14;
13967 0 : }
13968 0 : FD_FN_PURE uchar fd_instr_error_enum_is_readonly_data_modified(fd_instr_error_enum_t const * self) {
13969 0 : return self->discriminant == 15;
13970 0 : }
13971 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_index(fd_instr_error_enum_t const * self) {
13972 0 : return self->discriminant == 16;
13973 0 : }
13974 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_modified(fd_instr_error_enum_t const * self) {
13975 0 : return self->discriminant == 17;
13976 0 : }
13977 0 : FD_FN_PURE uchar fd_instr_error_enum_is_rent_epoch_modified(fd_instr_error_enum_t const * self) {
13978 0 : return self->discriminant == 18;
13979 0 : }
13980 0 : FD_FN_PURE uchar fd_instr_error_enum_is_not_enough_account_keys(fd_instr_error_enum_t const * self) {
13981 0 : return self->discriminant == 19;
13982 0 : }
13983 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_data_size_changed(fd_instr_error_enum_t const * self) {
13984 0 : return self->discriminant == 20;
13985 0 : }
13986 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_executable(fd_instr_error_enum_t const * self) {
13987 0 : return self->discriminant == 21;
13988 0 : }
13989 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_failed(fd_instr_error_enum_t const * self) {
13990 0 : return self->discriminant == 22;
13991 0 : }
13992 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_borrow_outstanding(fd_instr_error_enum_t const * self) {
13993 0 : return self->discriminant == 23;
13994 0 : }
13995 0 : FD_FN_PURE uchar fd_instr_error_enum_is_duplicate_account_out_of_sync(fd_instr_error_enum_t const * self) {
13996 0 : return self->discriminant == 24;
13997 0 : }
13998 0 : FD_FN_PURE uchar fd_instr_error_enum_is_custom(fd_instr_error_enum_t const * self) {
13999 0 : return self->discriminant == 25;
14000 0 : }
14001 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_error(fd_instr_error_enum_t const * self) {
14002 0 : return self->discriminant == 26;
14003 0 : }
14004 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_data_modified(fd_instr_error_enum_t const * self) {
14005 0 : return self->discriminant == 27;
14006 0 : }
14007 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_lamport_change(fd_instr_error_enum_t const * self) {
14008 0 : return self->discriminant == 28;
14009 0 : }
14010 0 : FD_FN_PURE uchar fd_instr_error_enum_is_executable_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
14011 0 : return self->discriminant == 29;
14012 0 : }
14013 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_program_id(fd_instr_error_enum_t const * self) {
14014 0 : return self->discriminant == 30;
14015 0 : }
14016 0 : FD_FN_PURE uchar fd_instr_error_enum_is_call_depth(fd_instr_error_enum_t const * self) {
14017 0 : return self->discriminant == 31;
14018 0 : }
14019 0 : FD_FN_PURE uchar fd_instr_error_enum_is_missing_account(fd_instr_error_enum_t const * self) {
14020 0 : return self->discriminant == 32;
14021 0 : }
14022 0 : FD_FN_PURE uchar fd_instr_error_enum_is_reentrancy_not_allowed(fd_instr_error_enum_t const * self) {
14023 0 : return self->discriminant == 33;
14024 0 : }
14025 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_seed_length_exceeded(fd_instr_error_enum_t const * self) {
14026 0 : return self->discriminant == 34;
14027 0 : }
14028 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_seeds(fd_instr_error_enum_t const * self) {
14029 0 : return self->discriminant == 35;
14030 0 : }
14031 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_realloc(fd_instr_error_enum_t const * self) {
14032 0 : return self->discriminant == 36;
14033 0 : }
14034 0 : FD_FN_PURE uchar fd_instr_error_enum_is_computational_budget_exceeded(fd_instr_error_enum_t const * self) {
14035 0 : return self->discriminant == 37;
14036 0 : }
14037 0 : FD_FN_PURE uchar fd_instr_error_enum_is_privilege_escalation(fd_instr_error_enum_t const * self) {
14038 0 : return self->discriminant == 38;
14039 0 : }
14040 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_environment_setup_failure(fd_instr_error_enum_t const * self) {
14041 0 : return self->discriminant == 39;
14042 0 : }
14043 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_complete(fd_instr_error_enum_t const * self) {
14044 0 : return self->discriminant == 40;
14045 0 : }
14046 0 : FD_FN_PURE uchar fd_instr_error_enum_is_program_failed_to_compile(fd_instr_error_enum_t const * self) {
14047 0 : return self->discriminant == 41;
14048 0 : }
14049 0 : FD_FN_PURE uchar fd_instr_error_enum_is_immutable(fd_instr_error_enum_t const * self) {
14050 0 : return self->discriminant == 42;
14051 0 : }
14052 0 : FD_FN_PURE uchar fd_instr_error_enum_is_incorrect_authority(fd_instr_error_enum_t const * self) {
14053 0 : return self->discriminant == 43;
14054 0 : }
14055 0 : FD_FN_PURE uchar fd_instr_error_enum_is_borsh_io_error(fd_instr_error_enum_t const * self) {
14056 0 : return self->discriminant == 44;
14057 0 : }
14058 0 : FD_FN_PURE uchar fd_instr_error_enum_is_account_not_rent_exempt(fd_instr_error_enum_t const * self) {
14059 0 : return self->discriminant == 45;
14060 0 : }
14061 0 : FD_FN_PURE uchar fd_instr_error_enum_is_invalid_account_owner(fd_instr_error_enum_t const * self) {
14062 0 : return self->discriminant == 46;
14063 0 : }
14064 0 : FD_FN_PURE uchar fd_instr_error_enum_is_arithmetic_overflow(fd_instr_error_enum_t const * self) {
14065 0 : return self->discriminant == 47;
14066 0 : }
14067 0 : FD_FN_PURE uchar fd_instr_error_enum_is_unsupported_sysvar(fd_instr_error_enum_t const * self) {
14068 0 : return self->discriminant == 48;
14069 0 : }
14070 0 : FD_FN_PURE uchar fd_instr_error_enum_is_illegal_owner(fd_instr_error_enum_t const * self) {
14071 0 : return self->discriminant == 49;
14072 0 : }
14073 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_data_allocations_exceeded(fd_instr_error_enum_t const * self) {
14074 0 : return self->discriminant == 50;
14075 0 : }
14076 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_accounts_exceeded(fd_instr_error_enum_t const * self) {
14077 0 : return self->discriminant == 51;
14078 0 : }
14079 0 : FD_FN_PURE uchar fd_instr_error_enum_is_max_instruction_trace_length_exceeded(fd_instr_error_enum_t const * self) {
14080 0 : return self->discriminant == 52;
14081 0 : }
14082 0 : FD_FN_PURE uchar fd_instr_error_enum_is_builtin_programs_must_consume_compute_units(fd_instr_error_enum_t const * self) {
14083 0 : return self->discriminant == 53;
14084 0 : }
14085 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant );
14086 0 : int fd_instr_error_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14087 0 : int err;
14088 0 : switch (discriminant) {
14089 0 : case 0: {
14090 0 : return FD_BINCODE_SUCCESS;
14091 0 : }
14092 0 : case 1: {
14093 0 : return FD_BINCODE_SUCCESS;
14094 0 : }
14095 0 : case 2: {
14096 0 : return FD_BINCODE_SUCCESS;
14097 0 : }
14098 0 : case 3: {
14099 0 : return FD_BINCODE_SUCCESS;
14100 0 : }
14101 0 : case 4: {
14102 0 : return FD_BINCODE_SUCCESS;
14103 0 : }
14104 0 : case 5: {
14105 0 : return FD_BINCODE_SUCCESS;
14106 0 : }
14107 0 : case 6: {
14108 0 : return FD_BINCODE_SUCCESS;
14109 0 : }
14110 0 : case 7: {
14111 0 : return FD_BINCODE_SUCCESS;
14112 0 : }
14113 0 : case 8: {
14114 0 : return FD_BINCODE_SUCCESS;
14115 0 : }
14116 0 : case 9: {
14117 0 : return FD_BINCODE_SUCCESS;
14118 0 : }
14119 0 : case 10: {
14120 0 : return FD_BINCODE_SUCCESS;
14121 0 : }
14122 0 : case 11: {
14123 0 : return FD_BINCODE_SUCCESS;
14124 0 : }
14125 0 : case 12: {
14126 0 : return FD_BINCODE_SUCCESS;
14127 0 : }
14128 0 : case 13: {
14129 0 : return FD_BINCODE_SUCCESS;
14130 0 : }
14131 0 : case 14: {
14132 0 : return FD_BINCODE_SUCCESS;
14133 0 : }
14134 0 : case 15: {
14135 0 : return FD_BINCODE_SUCCESS;
14136 0 : }
14137 0 : case 16: {
14138 0 : return FD_BINCODE_SUCCESS;
14139 0 : }
14140 0 : case 17: {
14141 0 : return FD_BINCODE_SUCCESS;
14142 0 : }
14143 0 : case 18: {
14144 0 : return FD_BINCODE_SUCCESS;
14145 0 : }
14146 0 : case 19: {
14147 0 : return FD_BINCODE_SUCCESS;
14148 0 : }
14149 0 : case 20: {
14150 0 : return FD_BINCODE_SUCCESS;
14151 0 : }
14152 0 : case 21: {
14153 0 : return FD_BINCODE_SUCCESS;
14154 0 : }
14155 0 : case 22: {
14156 0 : return FD_BINCODE_SUCCESS;
14157 0 : }
14158 0 : case 23: {
14159 0 : return FD_BINCODE_SUCCESS;
14160 0 : }
14161 0 : case 24: {
14162 0 : return FD_BINCODE_SUCCESS;
14163 0 : }
14164 0 : case 25: {
14165 0 : err = fd_bincode_uint32_decode_footprint( ctx );
14166 0 : if( FD_UNLIKELY( err ) ) return err;
14167 0 : return FD_BINCODE_SUCCESS;
14168 0 : }
14169 0 : case 26: {
14170 0 : return FD_BINCODE_SUCCESS;
14171 0 : }
14172 0 : case 27: {
14173 0 : return FD_BINCODE_SUCCESS;
14174 0 : }
14175 0 : case 28: {
14176 0 : return FD_BINCODE_SUCCESS;
14177 0 : }
14178 0 : case 29: {
14179 0 : return FD_BINCODE_SUCCESS;
14180 0 : }
14181 0 : case 30: {
14182 0 : return FD_BINCODE_SUCCESS;
14183 0 : }
14184 0 : case 31: {
14185 0 : return FD_BINCODE_SUCCESS;
14186 0 : }
14187 0 : case 32: {
14188 0 : return FD_BINCODE_SUCCESS;
14189 0 : }
14190 0 : case 33: {
14191 0 : return FD_BINCODE_SUCCESS;
14192 0 : }
14193 0 : case 34: {
14194 0 : return FD_BINCODE_SUCCESS;
14195 0 : }
14196 0 : case 35: {
14197 0 : return FD_BINCODE_SUCCESS;
14198 0 : }
14199 0 : case 36: {
14200 0 : return FD_BINCODE_SUCCESS;
14201 0 : }
14202 0 : case 37: {
14203 0 : return FD_BINCODE_SUCCESS;
14204 0 : }
14205 0 : case 38: {
14206 0 : return FD_BINCODE_SUCCESS;
14207 0 : }
14208 0 : case 39: {
14209 0 : return FD_BINCODE_SUCCESS;
14210 0 : }
14211 0 : case 40: {
14212 0 : return FD_BINCODE_SUCCESS;
14213 0 : }
14214 0 : case 41: {
14215 0 : return FD_BINCODE_SUCCESS;
14216 0 : }
14217 0 : case 42: {
14218 0 : return FD_BINCODE_SUCCESS;
14219 0 : }
14220 0 : case 43: {
14221 0 : return FD_BINCODE_SUCCESS;
14222 0 : }
14223 0 : case 44: {
14224 0 : ulong slen;
14225 0 : err = fd_bincode_uint64_decode( &slen, ctx );
14226 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14227 0 : err = fd_bincode_bytes_decode_footprint( slen, ctx );
14228 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
14229 0 : *total_sz += slen + 1; // Need an extra byte for null termination
14230 0 : return FD_BINCODE_SUCCESS;
14231 0 : }
14232 0 : case 45: {
14233 0 : return FD_BINCODE_SUCCESS;
14234 0 : }
14235 0 : case 46: {
14236 0 : return FD_BINCODE_SUCCESS;
14237 0 : }
14238 0 : case 47: {
14239 0 : return FD_BINCODE_SUCCESS;
14240 0 : }
14241 0 : case 48: {
14242 0 : return FD_BINCODE_SUCCESS;
14243 0 : }
14244 0 : case 49: {
14245 0 : return FD_BINCODE_SUCCESS;
14246 0 : }
14247 0 : case 50: {
14248 0 : return FD_BINCODE_SUCCESS;
14249 0 : }
14250 0 : case 51: {
14251 0 : return FD_BINCODE_SUCCESS;
14252 0 : }
14253 0 : case 52: {
14254 0 : return FD_BINCODE_SUCCESS;
14255 0 : }
14256 0 : case 53: {
14257 0 : return FD_BINCODE_SUCCESS;
14258 0 : }
14259 0 : default: return FD_BINCODE_ERR_ENCODING;
14260 0 : }
14261 0 : }
14262 0 : static int fd_instr_error_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14263 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14264 0 : uint discriminant = 0;
14265 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
14266 0 : if( FD_UNLIKELY( err ) ) return err;
14267 0 : return fd_instr_error_enum_inner_decode_footprint( discriminant, ctx, total_sz );
14268 0 : }
14269 0 : int fd_instr_error_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14270 0 : *total_sz += sizeof(fd_instr_error_enum_t);
14271 0 : void const * start_data = ctx->data;
14272 0 : int err = fd_instr_error_enum_decode_footprint_inner( ctx, total_sz );
14273 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14274 0 : ctx->data = start_data;
14275 0 : return err;
14276 0 : }
14277 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 ) {
14278 0 : switch (discriminant) {
14279 0 : case 0: {
14280 0 : break;
14281 0 : }
14282 0 : case 1: {
14283 0 : break;
14284 0 : }
14285 0 : case 2: {
14286 0 : break;
14287 0 : }
14288 0 : case 3: {
14289 0 : break;
14290 0 : }
14291 0 : case 4: {
14292 0 : break;
14293 0 : }
14294 0 : case 5: {
14295 0 : break;
14296 0 : }
14297 0 : case 6: {
14298 0 : break;
14299 0 : }
14300 0 : case 7: {
14301 0 : break;
14302 0 : }
14303 0 : case 8: {
14304 0 : break;
14305 0 : }
14306 0 : case 9: {
14307 0 : break;
14308 0 : }
14309 0 : case 10: {
14310 0 : break;
14311 0 : }
14312 0 : case 11: {
14313 0 : break;
14314 0 : }
14315 0 : case 12: {
14316 0 : break;
14317 0 : }
14318 0 : case 13: {
14319 0 : break;
14320 0 : }
14321 0 : case 14: {
14322 0 : break;
14323 0 : }
14324 0 : case 15: {
14325 0 : break;
14326 0 : }
14327 0 : case 16: {
14328 0 : break;
14329 0 : }
14330 0 : case 17: {
14331 0 : break;
14332 0 : }
14333 0 : case 18: {
14334 0 : break;
14335 0 : }
14336 0 : case 19: {
14337 0 : break;
14338 0 : }
14339 0 : case 20: {
14340 0 : break;
14341 0 : }
14342 0 : case 21: {
14343 0 : break;
14344 0 : }
14345 0 : case 22: {
14346 0 : break;
14347 0 : }
14348 0 : case 23: {
14349 0 : break;
14350 0 : }
14351 0 : case 24: {
14352 0 : break;
14353 0 : }
14354 0 : case 25: {
14355 0 : fd_bincode_uint32_decode_unsafe( &self->custom, ctx );
14356 0 : break;
14357 0 : }
14358 0 : case 26: {
14359 0 : break;
14360 0 : }
14361 0 : case 27: {
14362 0 : break;
14363 0 : }
14364 0 : case 28: {
14365 0 : break;
14366 0 : }
14367 0 : case 29: {
14368 0 : break;
14369 0 : }
14370 0 : case 30: {
14371 0 : break;
14372 0 : }
14373 0 : case 31: {
14374 0 : break;
14375 0 : }
14376 0 : case 32: {
14377 0 : break;
14378 0 : }
14379 0 : case 33: {
14380 0 : break;
14381 0 : }
14382 0 : case 34: {
14383 0 : break;
14384 0 : }
14385 0 : case 35: {
14386 0 : break;
14387 0 : }
14388 0 : case 36: {
14389 0 : break;
14390 0 : }
14391 0 : case 37: {
14392 0 : break;
14393 0 : }
14394 0 : case 38: {
14395 0 : break;
14396 0 : }
14397 0 : case 39: {
14398 0 : break;
14399 0 : }
14400 0 : case 40: {
14401 0 : break;
14402 0 : }
14403 0 : case 41: {
14404 0 : break;
14405 0 : }
14406 0 : case 42: {
14407 0 : break;
14408 0 : }
14409 0 : case 43: {
14410 0 : break;
14411 0 : }
14412 0 : case 44: {
14413 0 : ulong slen;
14414 0 : fd_bincode_uint64_decode_unsafe( &slen, ctx );
14415 0 : self->borsh_io_error = *alloc_mem;
14416 0 : fd_bincode_bytes_decode_unsafe( (uchar *)self->borsh_io_error, slen, ctx );
14417 0 : self->borsh_io_error[slen] = '\0';
14418 0 : *alloc_mem = (uchar *)(*alloc_mem) + (slen + 1); // extra byte for null termination
14419 0 : break;
14420 0 : }
14421 0 : case 45: {
14422 0 : break;
14423 0 : }
14424 0 : case 46: {
14425 0 : break;
14426 0 : }
14427 0 : case 47: {
14428 0 : break;
14429 0 : }
14430 0 : case 48: {
14431 0 : break;
14432 0 : }
14433 0 : case 49: {
14434 0 : break;
14435 0 : }
14436 0 : case 50: {
14437 0 : break;
14438 0 : }
14439 0 : case 51: {
14440 0 : break;
14441 0 : }
14442 0 : case 52: {
14443 0 : break;
14444 0 : }
14445 0 : case 53: {
14446 0 : break;
14447 0 : }
14448 0 : }
14449 0 : }
14450 0 : static void fd_instr_error_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14451 0 : fd_instr_error_enum_t * self = (fd_instr_error_enum_t *)struct_mem;
14452 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
14453 0 : fd_instr_error_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
14454 0 : }
14455 0 : void * fd_instr_error_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14456 0 : fd_instr_error_enum_t * self = (fd_instr_error_enum_t *)mem;
14457 0 : fd_instr_error_enum_new( self );
14458 0 : void * alloc_region = (uchar *)mem + sizeof(fd_instr_error_enum_t);
14459 0 : void * * alloc_mem = &alloc_region;
14460 0 : fd_instr_error_enum_decode_inner( mem, alloc_mem, ctx );
14461 0 : return self;
14462 0 : }
14463 0 : void fd_instr_error_enum_inner_new( fd_instr_error_enum_inner_t * self, uint discriminant ) {
14464 0 : switch( discriminant ) {
14465 0 : case 0: {
14466 0 : break;
14467 0 : }
14468 0 : case 1: {
14469 0 : break;
14470 0 : }
14471 0 : case 2: {
14472 0 : break;
14473 0 : }
14474 0 : case 3: {
14475 0 : break;
14476 0 : }
14477 0 : case 4: {
14478 0 : break;
14479 0 : }
14480 0 : case 5: {
14481 0 : break;
14482 0 : }
14483 0 : case 6: {
14484 0 : break;
14485 0 : }
14486 0 : case 7: {
14487 0 : break;
14488 0 : }
14489 0 : case 8: {
14490 0 : break;
14491 0 : }
14492 0 : case 9: {
14493 0 : break;
14494 0 : }
14495 0 : case 10: {
14496 0 : break;
14497 0 : }
14498 0 : case 11: {
14499 0 : break;
14500 0 : }
14501 0 : case 12: {
14502 0 : break;
14503 0 : }
14504 0 : case 13: {
14505 0 : break;
14506 0 : }
14507 0 : case 14: {
14508 0 : break;
14509 0 : }
14510 0 : case 15: {
14511 0 : break;
14512 0 : }
14513 0 : case 16: {
14514 0 : break;
14515 0 : }
14516 0 : case 17: {
14517 0 : break;
14518 0 : }
14519 0 : case 18: {
14520 0 : break;
14521 0 : }
14522 0 : case 19: {
14523 0 : break;
14524 0 : }
14525 0 : case 20: {
14526 0 : break;
14527 0 : }
14528 0 : case 21: {
14529 0 : break;
14530 0 : }
14531 0 : case 22: {
14532 0 : break;
14533 0 : }
14534 0 : case 23: {
14535 0 : break;
14536 0 : }
14537 0 : case 24: {
14538 0 : break;
14539 0 : }
14540 0 : case 25: {
14541 0 : break;
14542 0 : }
14543 0 : case 26: {
14544 0 : break;
14545 0 : }
14546 0 : case 27: {
14547 0 : break;
14548 0 : }
14549 0 : case 28: {
14550 0 : break;
14551 0 : }
14552 0 : case 29: {
14553 0 : break;
14554 0 : }
14555 0 : case 30: {
14556 0 : break;
14557 0 : }
14558 0 : case 31: {
14559 0 : break;
14560 0 : }
14561 0 : case 32: {
14562 0 : break;
14563 0 : }
14564 0 : case 33: {
14565 0 : break;
14566 0 : }
14567 0 : case 34: {
14568 0 : break;
14569 0 : }
14570 0 : case 35: {
14571 0 : break;
14572 0 : }
14573 0 : case 36: {
14574 0 : break;
14575 0 : }
14576 0 : case 37: {
14577 0 : break;
14578 0 : }
14579 0 : case 38: {
14580 0 : break;
14581 0 : }
14582 0 : case 39: {
14583 0 : break;
14584 0 : }
14585 0 : case 40: {
14586 0 : break;
14587 0 : }
14588 0 : case 41: {
14589 0 : break;
14590 0 : }
14591 0 : case 42: {
14592 0 : break;
14593 0 : }
14594 0 : case 43: {
14595 0 : break;
14596 0 : }
14597 0 : case 44: {
14598 0 : break;
14599 0 : }
14600 0 : case 45: {
14601 0 : break;
14602 0 : }
14603 0 : case 46: {
14604 0 : break;
14605 0 : }
14606 0 : case 47: {
14607 0 : break;
14608 0 : }
14609 0 : case 48: {
14610 0 : break;
14611 0 : }
14612 0 : case 49: {
14613 0 : break;
14614 0 : }
14615 0 : case 50: {
14616 0 : break;
14617 0 : }
14618 0 : case 51: {
14619 0 : break;
14620 0 : }
14621 0 : case 52: {
14622 0 : break;
14623 0 : }
14624 0 : case 53: {
14625 0 : break;
14626 0 : }
14627 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
14628 0 : }
14629 0 : }
14630 0 : void fd_instr_error_enum_new_disc( fd_instr_error_enum_t * self, uint discriminant ) {
14631 0 : self->discriminant = discriminant;
14632 0 : fd_instr_error_enum_inner_new( &self->inner, self->discriminant );
14633 0 : }
14634 0 : void fd_instr_error_enum_new( fd_instr_error_enum_t * self ) {
14635 0 : fd_memset( self, 0, sizeof(fd_instr_error_enum_t) );
14636 0 : fd_instr_error_enum_new_disc( self, UINT_MAX );
14637 0 : }
14638 :
14639 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 ) {
14640 0 : (void) varint;
14641 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_instr_error_enum", level++, 0);
14642 0 : switch( self->discriminant ) {
14643 0 : case 0: {
14644 0 : fun( w, self, "generic_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14645 0 : break;
14646 0 : }
14647 0 : case 1: {
14648 0 : fun( w, self, "invalid_argument", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14649 0 : break;
14650 0 : }
14651 0 : case 2: {
14652 0 : fun( w, self, "invalid_instruction_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14653 0 : break;
14654 0 : }
14655 0 : case 3: {
14656 0 : fun( w, self, "invalid_account_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14657 0 : break;
14658 0 : }
14659 0 : case 4: {
14660 0 : fun( w, self, "account_data_too_small", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14661 0 : break;
14662 0 : }
14663 0 : case 5: {
14664 0 : fun( w, self, "insufficient_funds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14665 0 : break;
14666 0 : }
14667 0 : case 6: {
14668 0 : fun( w, self, "incorrect_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14669 0 : break;
14670 0 : }
14671 0 : case 7: {
14672 0 : fun( w, self, "missing_required_signature", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14673 0 : break;
14674 0 : }
14675 0 : case 8: {
14676 0 : fun( w, self, "account_already_initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14677 0 : break;
14678 0 : }
14679 0 : case 9: {
14680 0 : fun( w, self, "uninitialized_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14681 0 : break;
14682 0 : }
14683 0 : case 10: {
14684 0 : fun( w, self, "unbalanced_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14685 0 : break;
14686 0 : }
14687 0 : case 11: {
14688 0 : fun( w, self, "modified_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14689 0 : break;
14690 0 : }
14691 0 : case 12: {
14692 0 : fun( w, self, "external_account_lamport_spend", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14693 0 : break;
14694 0 : }
14695 0 : case 13: {
14696 0 : fun( w, self, "external_account_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14697 0 : break;
14698 0 : }
14699 0 : case 14: {
14700 0 : fun( w, self, "readonly_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14701 0 : break;
14702 0 : }
14703 0 : case 15: {
14704 0 : fun( w, self, "readonly_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14705 0 : break;
14706 0 : }
14707 0 : case 16: {
14708 0 : fun( w, self, "duplicate_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14709 0 : break;
14710 0 : }
14711 0 : case 17: {
14712 0 : fun( w, self, "executable_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14713 0 : break;
14714 0 : }
14715 0 : case 18: {
14716 0 : fun( w, self, "rent_epoch_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14717 0 : break;
14718 0 : }
14719 0 : case 19: {
14720 0 : fun( w, self, "not_enough_account_keys", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14721 0 : break;
14722 0 : }
14723 0 : case 20: {
14724 0 : fun( w, self, "account_data_size_changed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14725 0 : break;
14726 0 : }
14727 0 : case 21: {
14728 0 : fun( w, self, "account_not_executable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14729 0 : break;
14730 0 : }
14731 0 : case 22: {
14732 0 : fun( w, self, "account_borrow_failed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14733 0 : break;
14734 0 : }
14735 0 : case 23: {
14736 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14737 0 : break;
14738 0 : }
14739 0 : case 24: {
14740 0 : fun( w, self, "duplicate_account_out_of_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14741 0 : break;
14742 0 : }
14743 0 : case 25: {
14744 0 : fun( w, self, "custom", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14745 0 : fun( w, &self->inner.custom, "custom", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
14746 0 : break;
14747 0 : }
14748 0 : case 26: {
14749 0 : fun( w, self, "invalid_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14750 0 : break;
14751 0 : }
14752 0 : case 27: {
14753 0 : fun( w, self, "executable_data_modified", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14754 0 : break;
14755 0 : }
14756 0 : case 28: {
14757 0 : fun( w, self, "executable_lamport_change", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14758 0 : break;
14759 0 : }
14760 0 : case 29: {
14761 0 : fun( w, self, "executable_account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14762 0 : break;
14763 0 : }
14764 0 : case 30: {
14765 0 : fun( w, self, "unsupported_program_id", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14766 0 : break;
14767 0 : }
14768 0 : case 31: {
14769 0 : fun( w, self, "call_depth", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14770 0 : break;
14771 0 : }
14772 0 : case 32: {
14773 0 : fun( w, self, "missing_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14774 0 : break;
14775 0 : }
14776 0 : case 33: {
14777 0 : fun( w, self, "reentrancy_not_allowed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14778 0 : break;
14779 0 : }
14780 0 : case 34: {
14781 0 : fun( w, self, "max_seed_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14782 0 : break;
14783 0 : }
14784 0 : case 35: {
14785 0 : fun( w, self, "invalid_seeds", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14786 0 : break;
14787 0 : }
14788 0 : case 36: {
14789 0 : fun( w, self, "invalid_realloc", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14790 0 : break;
14791 0 : }
14792 0 : case 37: {
14793 0 : fun( w, self, "computational_budget_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14794 0 : break;
14795 0 : }
14796 0 : case 38: {
14797 0 : fun( w, self, "privilege_escalation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14798 0 : break;
14799 0 : }
14800 0 : case 39: {
14801 0 : fun( w, self, "program_environment_setup_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14802 0 : break;
14803 0 : }
14804 0 : case 40: {
14805 0 : fun( w, self, "program_failed_to_complete", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14806 0 : break;
14807 0 : }
14808 0 : case 41: {
14809 0 : fun( w, self, "program_failed_to_compile", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14810 0 : break;
14811 0 : }
14812 0 : case 42: {
14813 0 : fun( w, self, "immutable", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14814 0 : break;
14815 0 : }
14816 0 : case 43: {
14817 0 : fun( w, self, "incorrect_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14818 0 : break;
14819 0 : }
14820 0 : case 44: {
14821 0 : fun( w, self, "borsh_io_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14822 0 : fun( w, self->inner.borsh_io_error, "borsh_io_error", FD_FLAMENCO_TYPE_CSTR, "char*", level, 0 );
14823 0 : break;
14824 0 : }
14825 0 : case 45: {
14826 0 : fun( w, self, "account_not_rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14827 0 : break;
14828 0 : }
14829 0 : case 46: {
14830 0 : fun( w, self, "invalid_account_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14831 0 : break;
14832 0 : }
14833 0 : case 47: {
14834 0 : fun( w, self, "arithmetic_overflow", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14835 0 : break;
14836 0 : }
14837 0 : case 48: {
14838 0 : fun( w, self, "unsupported_sysvar", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14839 0 : break;
14840 0 : }
14841 0 : case 49: {
14842 0 : fun( w, self, "illegal_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14843 0 : break;
14844 0 : }
14845 0 : case 50: {
14846 0 : fun( w, self, "max_accounts_data_allocations_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14847 0 : break;
14848 0 : }
14849 0 : case 51: {
14850 0 : fun( w, self, "max_accounts_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14851 0 : break;
14852 0 : }
14853 0 : case 52: {
14854 0 : fun( w, self, "max_instruction_trace_length_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14855 0 : break;
14856 0 : }
14857 0 : case 53: {
14858 0 : fun( w, self, "builtin_programs_must_consume_compute_units", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
14859 0 : break;
14860 0 : }
14861 0 : }
14862 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_instr_error_enum", level--, 0 );
14863 0 : }
14864 0 : ulong fd_instr_error_enum_size( fd_instr_error_enum_t const * self ) {
14865 0 : ulong size = 0;
14866 0 : size += sizeof(uint);
14867 0 : switch (self->discriminant) {
14868 0 : case 25: {
14869 0 : size += sizeof(uint);
14870 0 : break;
14871 0 : }
14872 0 : case 44: {
14873 0 : size += sizeof(ulong) + strlen(self->inner.borsh_io_error);
14874 0 : break;
14875 0 : }
14876 0 : }
14877 0 : return size;
14878 0 : }
14879 :
14880 0 : int fd_instr_error_enum_inner_encode( fd_instr_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
14881 0 : int err;
14882 0 : switch (discriminant) {
14883 0 : case 25: {
14884 0 : err = fd_bincode_uint32_encode( self->custom, ctx );
14885 0 : if( FD_UNLIKELY( err ) ) return err;
14886 0 : break;
14887 0 : }
14888 0 : case 44: {
14889 0 : ulong slen = strlen( (char *) self->borsh_io_error );
14890 0 : err = fd_bincode_uint64_encode( slen, ctx );
14891 0 : if( FD_UNLIKELY( err ) ) return err;
14892 0 : err = fd_bincode_bytes_encode( (uchar *) self->borsh_io_error, slen, ctx );
14893 0 : if( FD_UNLIKELY( err ) ) return err;
14894 0 : break;
14895 0 : }
14896 0 : }
14897 0 : return FD_BINCODE_SUCCESS;
14898 0 : }
14899 0 : int fd_instr_error_enum_encode( fd_instr_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14900 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
14901 0 : if( FD_UNLIKELY( err ) ) return err;
14902 0 : return fd_instr_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
14903 0 : }
14904 :
14905 0 : int fd_txn_instr_error_encode( fd_txn_instr_error_t const * self, fd_bincode_encode_ctx_t * ctx ) {
14906 0 : int err;
14907 0 : err = fd_bincode_uint8_encode( (uchar)(self->instr_idx), ctx );
14908 0 : if( FD_UNLIKELY( err ) ) return err;
14909 0 : err = fd_instr_error_enum_encode( &self->error, ctx );
14910 0 : if( FD_UNLIKELY( err ) ) return err;
14911 0 : return FD_BINCODE_SUCCESS;
14912 0 : }
14913 0 : static int fd_txn_instr_error_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14914 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14915 0 : int err = 0;
14916 0 : err = fd_bincode_uint8_decode_footprint( ctx );
14917 0 : if( FD_UNLIKELY( err ) ) return err;
14918 0 : err = fd_instr_error_enum_decode_footprint_inner( ctx, total_sz );
14919 0 : if( FD_UNLIKELY( err ) ) return err;
14920 0 : return 0;
14921 0 : }
14922 0 : int fd_txn_instr_error_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
14923 0 : *total_sz += sizeof(fd_txn_instr_error_t);
14924 0 : void const * start_data = ctx->data;
14925 0 : int err = fd_txn_instr_error_decode_footprint_inner( ctx, total_sz );
14926 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
14927 0 : ctx->data = start_data;
14928 0 : return err;
14929 0 : }
14930 0 : static void fd_txn_instr_error_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
14931 0 : fd_txn_instr_error_t * self = (fd_txn_instr_error_t *)struct_mem;
14932 0 : fd_bincode_uint8_decode_unsafe( &self->instr_idx, ctx );
14933 0 : fd_instr_error_enum_decode_inner( &self->error, alloc_mem, ctx );
14934 0 : }
14935 0 : void * fd_txn_instr_error_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
14936 0 : fd_txn_instr_error_t * self = (fd_txn_instr_error_t *)mem;
14937 0 : fd_txn_instr_error_new( self );
14938 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_instr_error_t);
14939 0 : void * * alloc_mem = &alloc_region;
14940 0 : fd_txn_instr_error_decode_inner( mem, alloc_mem, ctx );
14941 0 : return self;
14942 0 : }
14943 0 : void fd_txn_instr_error_new(fd_txn_instr_error_t * self) {
14944 0 : fd_memset( self, 0, sizeof(fd_txn_instr_error_t) );
14945 0 : fd_instr_error_enum_new( &self->error );
14946 0 : }
14947 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 ) {
14948 0 : (void) varint;
14949 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_txn_instr_error", level++, 0 );
14950 0 : fun( w, &self->instr_idx, "instr_idx", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
14951 0 : fd_instr_error_enum_walk( w, &self->error, fun, "error", level, 0 );
14952 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_txn_instr_error", level--, 0 );
14953 0 : }
14954 0 : ulong fd_txn_instr_error_size( fd_txn_instr_error_t const * self ) {
14955 0 : ulong size = 0;
14956 0 : size += sizeof(char);
14957 0 : size += fd_instr_error_enum_size( &self->error );
14958 0 : return size;
14959 0 : }
14960 :
14961 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_in_use(fd_txn_error_enum_t const * self) {
14962 0 : return self->discriminant == 0;
14963 0 : }
14964 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_loaded_twice(fd_txn_error_enum_t const * self) {
14965 0 : return self->discriminant == 1;
14966 0 : }
14967 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_not_found(fd_txn_error_enum_t const * self) {
14968 0 : return self->discriminant == 2;
14969 0 : }
14970 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_account_not_found(fd_txn_error_enum_t const * self) {
14971 0 : return self->discriminant == 3;
14972 0 : }
14973 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_fee(fd_txn_error_enum_t const * self) {
14974 0 : return self->discriminant == 4;
14975 0 : }
14976 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_for_fee(fd_txn_error_enum_t const * self) {
14977 0 : return self->discriminant == 5;
14978 0 : }
14979 0 : FD_FN_PURE uchar fd_txn_error_enum_is_already_processed(fd_txn_error_enum_t const * self) {
14980 0 : return self->discriminant == 6;
14981 0 : }
14982 0 : FD_FN_PURE uchar fd_txn_error_enum_is_blockhash_not_found(fd_txn_error_enum_t const * self) {
14983 0 : return self->discriminant == 7;
14984 0 : }
14985 0 : FD_FN_PURE uchar fd_txn_error_enum_is_instruction_error(fd_txn_error_enum_t const * self) {
14986 0 : return self->discriminant == 8;
14987 0 : }
14988 0 : FD_FN_PURE uchar fd_txn_error_enum_is_call_chain_too_deep(fd_txn_error_enum_t const * self) {
14989 0 : return self->discriminant == 9;
14990 0 : }
14991 0 : FD_FN_PURE uchar fd_txn_error_enum_is_missing_signature_for_fee(fd_txn_error_enum_t const * self) {
14992 0 : return self->discriminant == 10;
14993 0 : }
14994 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_account_index(fd_txn_error_enum_t const * self) {
14995 0 : return self->discriminant == 11;
14996 0 : }
14997 0 : FD_FN_PURE uchar fd_txn_error_enum_is_signature_failure(fd_txn_error_enum_t const * self) {
14998 0 : return self->discriminant == 12;
14999 0 : }
15000 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_program_for_execution(fd_txn_error_enum_t const * self) {
15001 0 : return self->discriminant == 13;
15002 0 : }
15003 0 : FD_FN_PURE uchar fd_txn_error_enum_is_sanitize_failure(fd_txn_error_enum_t const * self) {
15004 0 : return self->discriminant == 14;
15005 0 : }
15006 0 : FD_FN_PURE uchar fd_txn_error_enum_is_cluster_maintenance(fd_txn_error_enum_t const * self) {
15007 0 : return self->discriminant == 15;
15008 0 : }
15009 0 : FD_FN_PURE uchar fd_txn_error_enum_is_account_borrow_outstanding(fd_txn_error_enum_t const * self) {
15010 0 : return self->discriminant == 16;
15011 0 : }
15012 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_block_cost_limit(fd_txn_error_enum_t const * self) {
15013 0 : return self->discriminant == 17;
15014 0 : }
15015 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unsupported_version(fd_txn_error_enum_t const * self) {
15016 0 : return self->discriminant == 18;
15017 0 : }
15018 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_writable_account(fd_txn_error_enum_t const * self) {
15019 0 : return self->discriminant == 19;
15020 0 : }
15021 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_account_cost_limit(fd_txn_error_enum_t const * self) {
15022 0 : return self->discriminant == 20;
15023 0 : }
15024 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_block_limit(fd_txn_error_enum_t const * self) {
15025 0 : return self->discriminant == 21;
15026 0 : }
15027 0 : FD_FN_PURE uchar fd_txn_error_enum_is_too_many_account_locks(fd_txn_error_enum_t const * self) {
15028 0 : return self->discriminant == 22;
15029 0 : }
15030 0 : FD_FN_PURE uchar fd_txn_error_enum_is_address_lookup_table_not_found(fd_txn_error_enum_t const * self) {
15031 0 : return self->discriminant == 23;
15032 0 : }
15033 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_owner(fd_txn_error_enum_t const * self) {
15034 0 : return self->discriminant == 24;
15035 0 : }
15036 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_data(fd_txn_error_enum_t const * self) {
15037 0 : return self->discriminant == 25;
15038 0 : }
15039 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_address_lookup_table_index(fd_txn_error_enum_t const * self) {
15040 0 : return self->discriminant == 26;
15041 0 : }
15042 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_rent_paying_account(fd_txn_error_enum_t const * self) {
15043 0 : return self->discriminant == 27;
15044 0 : }
15045 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_max_vote_cost_limit(fd_txn_error_enum_t const * self) {
15046 0 : return self->discriminant == 28;
15047 0 : }
15048 0 : FD_FN_PURE uchar fd_txn_error_enum_is_would_exceed_account_data_total_limit(fd_txn_error_enum_t const * self) {
15049 0 : return self->discriminant == 29;
15050 0 : }
15051 0 : FD_FN_PURE uchar fd_txn_error_enum_is_duplicate_instruction(fd_txn_error_enum_t const * self) {
15052 0 : return self->discriminant == 30;
15053 0 : }
15054 0 : FD_FN_PURE uchar fd_txn_error_enum_is_insufficient_funds_for_rent(fd_txn_error_enum_t const * self) {
15055 0 : return self->discriminant == 31;
15056 0 : }
15057 0 : FD_FN_PURE uchar fd_txn_error_enum_is_max_loaded_accounts_data_size_exceeded(fd_txn_error_enum_t const * self) {
15058 0 : return self->discriminant == 32;
15059 0 : }
15060 0 : FD_FN_PURE uchar fd_txn_error_enum_is_invalid_loaded_accounts_data_size_limit(fd_txn_error_enum_t const * self) {
15061 0 : return self->discriminant == 33;
15062 0 : }
15063 0 : FD_FN_PURE uchar fd_txn_error_enum_is_resanitization_needed(fd_txn_error_enum_t const * self) {
15064 0 : return self->discriminant == 34;
15065 0 : }
15066 0 : FD_FN_PURE uchar fd_txn_error_enum_is_program_execution_temporarily_restricted(fd_txn_error_enum_t const * self) {
15067 0 : return self->discriminant == 35;
15068 0 : }
15069 0 : FD_FN_PURE uchar fd_txn_error_enum_is_unbalanced_transaction(fd_txn_error_enum_t const * self) {
15070 0 : return self->discriminant == 36;
15071 0 : }
15072 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant );
15073 0 : int fd_txn_error_enum_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15074 0 : int err;
15075 0 : switch (discriminant) {
15076 0 : case 0: {
15077 0 : return FD_BINCODE_SUCCESS;
15078 0 : }
15079 0 : case 1: {
15080 0 : return FD_BINCODE_SUCCESS;
15081 0 : }
15082 0 : case 2: {
15083 0 : return FD_BINCODE_SUCCESS;
15084 0 : }
15085 0 : case 3: {
15086 0 : return FD_BINCODE_SUCCESS;
15087 0 : }
15088 0 : case 4: {
15089 0 : return FD_BINCODE_SUCCESS;
15090 0 : }
15091 0 : case 5: {
15092 0 : return FD_BINCODE_SUCCESS;
15093 0 : }
15094 0 : case 6: {
15095 0 : return FD_BINCODE_SUCCESS;
15096 0 : }
15097 0 : case 7: {
15098 0 : return FD_BINCODE_SUCCESS;
15099 0 : }
15100 0 : case 8: {
15101 0 : err = fd_txn_instr_error_decode_footprint_inner( ctx, total_sz );
15102 0 : if( FD_UNLIKELY( err ) ) return err;
15103 0 : return FD_BINCODE_SUCCESS;
15104 0 : }
15105 0 : case 9: {
15106 0 : return FD_BINCODE_SUCCESS;
15107 0 : }
15108 0 : case 10: {
15109 0 : return FD_BINCODE_SUCCESS;
15110 0 : }
15111 0 : case 11: {
15112 0 : return FD_BINCODE_SUCCESS;
15113 0 : }
15114 0 : case 12: {
15115 0 : return FD_BINCODE_SUCCESS;
15116 0 : }
15117 0 : case 13: {
15118 0 : return FD_BINCODE_SUCCESS;
15119 0 : }
15120 0 : case 14: {
15121 0 : return FD_BINCODE_SUCCESS;
15122 0 : }
15123 0 : case 15: {
15124 0 : return FD_BINCODE_SUCCESS;
15125 0 : }
15126 0 : case 16: {
15127 0 : return FD_BINCODE_SUCCESS;
15128 0 : }
15129 0 : case 17: {
15130 0 : return FD_BINCODE_SUCCESS;
15131 0 : }
15132 0 : case 18: {
15133 0 : return FD_BINCODE_SUCCESS;
15134 0 : }
15135 0 : case 19: {
15136 0 : return FD_BINCODE_SUCCESS;
15137 0 : }
15138 0 : case 20: {
15139 0 : return FD_BINCODE_SUCCESS;
15140 0 : }
15141 0 : case 21: {
15142 0 : return FD_BINCODE_SUCCESS;
15143 0 : }
15144 0 : case 22: {
15145 0 : return FD_BINCODE_SUCCESS;
15146 0 : }
15147 0 : case 23: {
15148 0 : return FD_BINCODE_SUCCESS;
15149 0 : }
15150 0 : case 24: {
15151 0 : return FD_BINCODE_SUCCESS;
15152 0 : }
15153 0 : case 25: {
15154 0 : return FD_BINCODE_SUCCESS;
15155 0 : }
15156 0 : case 26: {
15157 0 : return FD_BINCODE_SUCCESS;
15158 0 : }
15159 0 : case 27: {
15160 0 : return FD_BINCODE_SUCCESS;
15161 0 : }
15162 0 : case 28: {
15163 0 : return FD_BINCODE_SUCCESS;
15164 0 : }
15165 0 : case 29: {
15166 0 : return FD_BINCODE_SUCCESS;
15167 0 : }
15168 0 : case 30: {
15169 0 : err = fd_bincode_uint8_decode_footprint( ctx );
15170 0 : if( FD_UNLIKELY( err ) ) return err;
15171 0 : return FD_BINCODE_SUCCESS;
15172 0 : }
15173 0 : case 31: {
15174 0 : err = fd_bincode_uint8_decode_footprint( ctx );
15175 0 : if( FD_UNLIKELY( err ) ) return err;
15176 0 : return FD_BINCODE_SUCCESS;
15177 0 : }
15178 0 : case 32: {
15179 0 : return FD_BINCODE_SUCCESS;
15180 0 : }
15181 0 : case 33: {
15182 0 : return FD_BINCODE_SUCCESS;
15183 0 : }
15184 0 : case 34: {
15185 0 : return FD_BINCODE_SUCCESS;
15186 0 : }
15187 0 : case 35: {
15188 0 : err = fd_bincode_uint8_decode_footprint( ctx );
15189 0 : if( FD_UNLIKELY( err ) ) return err;
15190 0 : return FD_BINCODE_SUCCESS;
15191 0 : }
15192 0 : case 36: {
15193 0 : return FD_BINCODE_SUCCESS;
15194 0 : }
15195 0 : default: return FD_BINCODE_ERR_ENCODING;
15196 0 : }
15197 0 : }
15198 0 : static int fd_txn_error_enum_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15199 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15200 0 : uint discriminant = 0;
15201 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
15202 0 : if( FD_UNLIKELY( err ) ) return err;
15203 0 : return fd_txn_error_enum_inner_decode_footprint( discriminant, ctx, total_sz );
15204 0 : }
15205 0 : int fd_txn_error_enum_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15206 0 : *total_sz += sizeof(fd_txn_error_enum_t);
15207 0 : void const * start_data = ctx->data;
15208 0 : int err = fd_txn_error_enum_decode_footprint_inner( ctx, total_sz );
15209 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15210 0 : ctx->data = start_data;
15211 0 : return err;
15212 0 : }
15213 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 ) {
15214 0 : switch (discriminant) {
15215 0 : case 0: {
15216 0 : break;
15217 0 : }
15218 0 : case 1: {
15219 0 : break;
15220 0 : }
15221 0 : case 2: {
15222 0 : break;
15223 0 : }
15224 0 : case 3: {
15225 0 : break;
15226 0 : }
15227 0 : case 4: {
15228 0 : break;
15229 0 : }
15230 0 : case 5: {
15231 0 : break;
15232 0 : }
15233 0 : case 6: {
15234 0 : break;
15235 0 : }
15236 0 : case 7: {
15237 0 : break;
15238 0 : }
15239 0 : case 8: {
15240 0 : fd_txn_instr_error_decode_inner( &self->instruction_error, alloc_mem, ctx );
15241 0 : break;
15242 0 : }
15243 0 : case 9: {
15244 0 : break;
15245 0 : }
15246 0 : case 10: {
15247 0 : break;
15248 0 : }
15249 0 : case 11: {
15250 0 : break;
15251 0 : }
15252 0 : case 12: {
15253 0 : break;
15254 0 : }
15255 0 : case 13: {
15256 0 : break;
15257 0 : }
15258 0 : case 14: {
15259 0 : break;
15260 0 : }
15261 0 : case 15: {
15262 0 : break;
15263 0 : }
15264 0 : case 16: {
15265 0 : break;
15266 0 : }
15267 0 : case 17: {
15268 0 : break;
15269 0 : }
15270 0 : case 18: {
15271 0 : break;
15272 0 : }
15273 0 : case 19: {
15274 0 : break;
15275 0 : }
15276 0 : case 20: {
15277 0 : break;
15278 0 : }
15279 0 : case 21: {
15280 0 : break;
15281 0 : }
15282 0 : case 22: {
15283 0 : break;
15284 0 : }
15285 0 : case 23: {
15286 0 : break;
15287 0 : }
15288 0 : case 24: {
15289 0 : break;
15290 0 : }
15291 0 : case 25: {
15292 0 : break;
15293 0 : }
15294 0 : case 26: {
15295 0 : break;
15296 0 : }
15297 0 : case 27: {
15298 0 : break;
15299 0 : }
15300 0 : case 28: {
15301 0 : break;
15302 0 : }
15303 0 : case 29: {
15304 0 : break;
15305 0 : }
15306 0 : case 30: {
15307 0 : fd_bincode_uint8_decode_unsafe( &self->duplicate_instruction, ctx );
15308 0 : break;
15309 0 : }
15310 0 : case 31: {
15311 0 : fd_bincode_uint8_decode_unsafe( &self->insufficient_funds_for_rent, ctx );
15312 0 : break;
15313 0 : }
15314 0 : case 32: {
15315 0 : break;
15316 0 : }
15317 0 : case 33: {
15318 0 : break;
15319 0 : }
15320 0 : case 34: {
15321 0 : break;
15322 0 : }
15323 0 : case 35: {
15324 0 : fd_bincode_uint8_decode_unsafe( &self->program_execution_temporarily_restricted, ctx );
15325 0 : break;
15326 0 : }
15327 0 : case 36: {
15328 0 : break;
15329 0 : }
15330 0 : }
15331 0 : }
15332 0 : static void fd_txn_error_enum_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15333 0 : fd_txn_error_enum_t * self = (fd_txn_error_enum_t *)struct_mem;
15334 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
15335 0 : fd_txn_error_enum_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
15336 0 : }
15337 0 : void * fd_txn_error_enum_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15338 0 : fd_txn_error_enum_t * self = (fd_txn_error_enum_t *)mem;
15339 0 : fd_txn_error_enum_new( self );
15340 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_error_enum_t);
15341 0 : void * * alloc_mem = &alloc_region;
15342 0 : fd_txn_error_enum_decode_inner( mem, alloc_mem, ctx );
15343 0 : return self;
15344 0 : }
15345 0 : void fd_txn_error_enum_inner_new( fd_txn_error_enum_inner_t * self, uint discriminant ) {
15346 0 : switch( discriminant ) {
15347 0 : case 0: {
15348 0 : break;
15349 0 : }
15350 0 : case 1: {
15351 0 : break;
15352 0 : }
15353 0 : case 2: {
15354 0 : break;
15355 0 : }
15356 0 : case 3: {
15357 0 : break;
15358 0 : }
15359 0 : case 4: {
15360 0 : break;
15361 0 : }
15362 0 : case 5: {
15363 0 : break;
15364 0 : }
15365 0 : case 6: {
15366 0 : break;
15367 0 : }
15368 0 : case 7: {
15369 0 : break;
15370 0 : }
15371 0 : case 8: {
15372 0 : fd_txn_instr_error_new( &self->instruction_error );
15373 0 : break;
15374 0 : }
15375 0 : case 9: {
15376 0 : break;
15377 0 : }
15378 0 : case 10: {
15379 0 : break;
15380 0 : }
15381 0 : case 11: {
15382 0 : break;
15383 0 : }
15384 0 : case 12: {
15385 0 : break;
15386 0 : }
15387 0 : case 13: {
15388 0 : break;
15389 0 : }
15390 0 : case 14: {
15391 0 : break;
15392 0 : }
15393 0 : case 15: {
15394 0 : break;
15395 0 : }
15396 0 : case 16: {
15397 0 : break;
15398 0 : }
15399 0 : case 17: {
15400 0 : break;
15401 0 : }
15402 0 : case 18: {
15403 0 : break;
15404 0 : }
15405 0 : case 19: {
15406 0 : break;
15407 0 : }
15408 0 : case 20: {
15409 0 : break;
15410 0 : }
15411 0 : case 21: {
15412 0 : break;
15413 0 : }
15414 0 : case 22: {
15415 0 : break;
15416 0 : }
15417 0 : case 23: {
15418 0 : break;
15419 0 : }
15420 0 : case 24: {
15421 0 : break;
15422 0 : }
15423 0 : case 25: {
15424 0 : break;
15425 0 : }
15426 0 : case 26: {
15427 0 : break;
15428 0 : }
15429 0 : case 27: {
15430 0 : break;
15431 0 : }
15432 0 : case 28: {
15433 0 : break;
15434 0 : }
15435 0 : case 29: {
15436 0 : break;
15437 0 : }
15438 0 : case 30: {
15439 0 : break;
15440 0 : }
15441 0 : case 31: {
15442 0 : break;
15443 0 : }
15444 0 : case 32: {
15445 0 : break;
15446 0 : }
15447 0 : case 33: {
15448 0 : break;
15449 0 : }
15450 0 : case 34: {
15451 0 : break;
15452 0 : }
15453 0 : case 35: {
15454 0 : break;
15455 0 : }
15456 0 : case 36: {
15457 0 : break;
15458 0 : }
15459 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
15460 0 : }
15461 0 : }
15462 0 : void fd_txn_error_enum_new_disc( fd_txn_error_enum_t * self, uint discriminant ) {
15463 0 : self->discriminant = discriminant;
15464 0 : fd_txn_error_enum_inner_new( &self->inner, self->discriminant );
15465 0 : }
15466 0 : void fd_txn_error_enum_new( fd_txn_error_enum_t * self ) {
15467 0 : fd_memset( self, 0, sizeof(fd_txn_error_enum_t) );
15468 0 : fd_txn_error_enum_new_disc( self, UINT_MAX );
15469 0 : }
15470 :
15471 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 ) {
15472 0 : (void) varint;
15473 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_error_enum", level++, 0);
15474 0 : switch( self->discriminant ) {
15475 0 : case 0: {
15476 0 : fun( w, self, "account_in_use", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15477 0 : break;
15478 0 : }
15479 0 : case 1: {
15480 0 : fun( w, self, "account_loaded_twice", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15481 0 : break;
15482 0 : }
15483 0 : case 2: {
15484 0 : fun( w, self, "account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15485 0 : break;
15486 0 : }
15487 0 : case 3: {
15488 0 : fun( w, self, "program_account_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15489 0 : break;
15490 0 : }
15491 0 : case 4: {
15492 0 : fun( w, self, "insufficient_funds_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15493 0 : break;
15494 0 : }
15495 0 : case 5: {
15496 0 : fun( w, self, "invalid_account_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15497 0 : break;
15498 0 : }
15499 0 : case 6: {
15500 0 : fun( w, self, "already_processed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15501 0 : break;
15502 0 : }
15503 0 : case 7: {
15504 0 : fun( w, self, "blockhash_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15505 0 : break;
15506 0 : }
15507 0 : case 8: {
15508 0 : fun( w, self, "instruction_error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15509 0 : fd_txn_instr_error_walk( w, &self->inner.instruction_error, fun, "instruction_error", level, 0 );
15510 0 : break;
15511 0 : }
15512 0 : case 9: {
15513 0 : fun( w, self, "call_chain_too_deep", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15514 0 : break;
15515 0 : }
15516 0 : case 10: {
15517 0 : fun( w, self, "missing_signature_for_fee", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15518 0 : break;
15519 0 : }
15520 0 : case 11: {
15521 0 : fun( w, self, "invalid_account_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15522 0 : break;
15523 0 : }
15524 0 : case 12: {
15525 0 : fun( w, self, "signature_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15526 0 : break;
15527 0 : }
15528 0 : case 13: {
15529 0 : fun( w, self, "invalid_program_for_execution", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15530 0 : break;
15531 0 : }
15532 0 : case 14: {
15533 0 : fun( w, self, "sanitize_failure", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15534 0 : break;
15535 0 : }
15536 0 : case 15: {
15537 0 : fun( w, self, "cluster_maintenance", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15538 0 : break;
15539 0 : }
15540 0 : case 16: {
15541 0 : fun( w, self, "account_borrow_outstanding", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15542 0 : break;
15543 0 : }
15544 0 : case 17: {
15545 0 : fun( w, self, "would_exceed_max_block_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15546 0 : break;
15547 0 : }
15548 0 : case 18: {
15549 0 : fun( w, self, "unsupported_version", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15550 0 : break;
15551 0 : }
15552 0 : case 19: {
15553 0 : fun( w, self, "invalid_writable_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15554 0 : break;
15555 0 : }
15556 0 : case 20: {
15557 0 : fun( w, self, "would_exceed_max_account_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15558 0 : break;
15559 0 : }
15560 0 : case 21: {
15561 0 : fun( w, self, "would_exceed_account_data_block_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15562 0 : break;
15563 0 : }
15564 0 : case 22: {
15565 0 : fun( w, self, "too_many_account_locks", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15566 0 : break;
15567 0 : }
15568 0 : case 23: {
15569 0 : fun( w, self, "address_lookup_table_not_found", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15570 0 : break;
15571 0 : }
15572 0 : case 24: {
15573 0 : fun( w, self, "invalid_address_lookup_table_owner", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15574 0 : break;
15575 0 : }
15576 0 : case 25: {
15577 0 : fun( w, self, "invalid_address_lookup_table_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15578 0 : break;
15579 0 : }
15580 0 : case 26: {
15581 0 : fun( w, self, "invalid_address_lookup_table_index", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15582 0 : break;
15583 0 : }
15584 0 : case 27: {
15585 0 : fun( w, self, "invalid_rent_paying_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15586 0 : break;
15587 0 : }
15588 0 : case 28: {
15589 0 : fun( w, self, "would_exceed_max_vote_cost_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15590 0 : break;
15591 0 : }
15592 0 : case 29: {
15593 0 : fun( w, self, "would_exceed_account_data_total_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15594 0 : break;
15595 0 : }
15596 0 : case 30: {
15597 0 : fun( w, self, "duplicate_instruction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15598 0 : fun( w, &self->inner.duplicate_instruction, "duplicate_instruction", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15599 0 : break;
15600 0 : }
15601 0 : case 31: {
15602 0 : fun( w, self, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15603 0 : fun( w, &self->inner.insufficient_funds_for_rent, "insufficient_funds_for_rent", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15604 0 : break;
15605 0 : }
15606 0 : case 32: {
15607 0 : fun( w, self, "max_loaded_accounts_data_size_exceeded", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15608 0 : break;
15609 0 : }
15610 0 : case 33: {
15611 0 : fun( w, self, "invalid_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15612 0 : break;
15613 0 : }
15614 0 : case 34: {
15615 0 : fun( w, self, "resanitization_needed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15616 0 : break;
15617 0 : }
15618 0 : case 35: {
15619 0 : fun( w, self, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15620 0 : fun( w, &self->inner.program_execution_temporarily_restricted, "program_execution_temporarily_restricted", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15621 0 : break;
15622 0 : }
15623 0 : case 36: {
15624 0 : fun( w, self, "unbalanced_transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15625 0 : break;
15626 0 : }
15627 0 : }
15628 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_error_enum", level--, 0 );
15629 0 : }
15630 0 : ulong fd_txn_error_enum_size( fd_txn_error_enum_t const * self ) {
15631 0 : ulong size = 0;
15632 0 : size += sizeof(uint);
15633 0 : switch (self->discriminant) {
15634 0 : case 8: {
15635 0 : size += fd_txn_instr_error_size( &self->inner.instruction_error );
15636 0 : break;
15637 0 : }
15638 0 : case 30: {
15639 0 : size += sizeof(char);
15640 0 : break;
15641 0 : }
15642 0 : case 31: {
15643 0 : size += sizeof(char);
15644 0 : break;
15645 0 : }
15646 0 : case 35: {
15647 0 : size += sizeof(char);
15648 0 : break;
15649 0 : }
15650 0 : }
15651 0 : return size;
15652 0 : }
15653 :
15654 0 : int fd_txn_error_enum_inner_encode( fd_txn_error_enum_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
15655 0 : int err;
15656 0 : switch (discriminant) {
15657 0 : case 8: {
15658 0 : err = fd_txn_instr_error_encode( &self->instruction_error, ctx );
15659 0 : if( FD_UNLIKELY( err ) ) return err;
15660 0 : break;
15661 0 : }
15662 0 : case 30: {
15663 0 : err = fd_bincode_uint8_encode( (uchar)(self->duplicate_instruction), ctx );
15664 0 : if( FD_UNLIKELY( err ) ) return err;
15665 0 : break;
15666 0 : }
15667 0 : case 31: {
15668 0 : err = fd_bincode_uint8_encode( (uchar)(self->insufficient_funds_for_rent), ctx );
15669 0 : if( FD_UNLIKELY( err ) ) return err;
15670 0 : break;
15671 0 : }
15672 0 : case 35: {
15673 0 : err = fd_bincode_uint8_encode( (uchar)(self->program_execution_temporarily_restricted), ctx );
15674 0 : if( FD_UNLIKELY( err ) ) return err;
15675 0 : break;
15676 0 : }
15677 0 : }
15678 0 : return FD_BINCODE_SUCCESS;
15679 0 : }
15680 0 : int fd_txn_error_enum_encode( fd_txn_error_enum_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15681 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
15682 0 : if( FD_UNLIKELY( err ) ) return err;
15683 0 : return fd_txn_error_enum_inner_encode( &self->inner, self->discriminant, ctx );
15684 0 : }
15685 :
15686 0 : FD_FN_PURE uchar fd_txn_result_is_ok(fd_txn_result_t const * self) {
15687 0 : return self->discriminant == 0;
15688 0 : }
15689 0 : FD_FN_PURE uchar fd_txn_result_is_error(fd_txn_result_t const * self) {
15690 0 : return self->discriminant == 1;
15691 0 : }
15692 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant );
15693 0 : int fd_txn_result_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15694 0 : int err;
15695 0 : switch (discriminant) {
15696 0 : case 0: {
15697 0 : return FD_BINCODE_SUCCESS;
15698 0 : }
15699 0 : case 1: {
15700 0 : err = fd_txn_error_enum_decode_footprint_inner( ctx, total_sz );
15701 0 : if( FD_UNLIKELY( err ) ) return err;
15702 0 : return FD_BINCODE_SUCCESS;
15703 0 : }
15704 0 : default: return FD_BINCODE_ERR_ENCODING;
15705 0 : }
15706 0 : }
15707 0 : static int fd_txn_result_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15708 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15709 0 : uint discriminant = 0;
15710 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
15711 0 : if( FD_UNLIKELY( err ) ) return err;
15712 0 : return fd_txn_result_inner_decode_footprint( discriminant, ctx, total_sz );
15713 0 : }
15714 0 : int fd_txn_result_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15715 0 : *total_sz += sizeof(fd_txn_result_t);
15716 0 : void const * start_data = ctx->data;
15717 0 : int err = fd_txn_result_decode_footprint_inner( ctx, total_sz );
15718 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15719 0 : ctx->data = start_data;
15720 0 : return err;
15721 0 : }
15722 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 ) {
15723 0 : switch (discriminant) {
15724 0 : case 0: {
15725 0 : break;
15726 0 : }
15727 0 : case 1: {
15728 0 : fd_txn_error_enum_decode_inner( &self->error, alloc_mem, ctx );
15729 0 : break;
15730 0 : }
15731 0 : }
15732 0 : }
15733 0 : static void fd_txn_result_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15734 0 : fd_txn_result_t * self = (fd_txn_result_t *)struct_mem;
15735 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
15736 0 : fd_txn_result_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
15737 0 : }
15738 0 : void * fd_txn_result_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15739 0 : fd_txn_result_t * self = (fd_txn_result_t *)mem;
15740 0 : fd_txn_result_new( self );
15741 0 : void * alloc_region = (uchar *)mem + sizeof(fd_txn_result_t);
15742 0 : void * * alloc_mem = &alloc_region;
15743 0 : fd_txn_result_decode_inner( mem, alloc_mem, ctx );
15744 0 : return self;
15745 0 : }
15746 0 : void fd_txn_result_inner_new( fd_txn_result_inner_t * self, uint discriminant ) {
15747 0 : switch( discriminant ) {
15748 0 : case 0: {
15749 0 : break;
15750 0 : }
15751 0 : case 1: {
15752 0 : fd_txn_error_enum_new( &self->error );
15753 0 : break;
15754 0 : }
15755 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
15756 0 : }
15757 0 : }
15758 0 : void fd_txn_result_new_disc( fd_txn_result_t * self, uint discriminant ) {
15759 0 : self->discriminant = discriminant;
15760 0 : fd_txn_result_inner_new( &self->inner, self->discriminant );
15761 0 : }
15762 0 : void fd_txn_result_new( fd_txn_result_t * self ) {
15763 0 : fd_memset( self, 0, sizeof(fd_txn_result_t) );
15764 0 : fd_txn_result_new_disc( self, UINT_MAX );
15765 0 : }
15766 :
15767 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 ) {
15768 0 : (void) varint;
15769 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_txn_result", level++, 0);
15770 0 : switch( self->discriminant ) {
15771 0 : case 0: {
15772 0 : fun( w, self, "ok", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15773 0 : break;
15774 0 : }
15775 0 : case 1: {
15776 0 : fun( w, self, "error", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
15777 0 : fd_txn_error_enum_walk( w, &self->inner.error, fun, "error", level, 0 );
15778 0 : break;
15779 0 : }
15780 0 : }
15781 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_txn_result", level--, 0 );
15782 0 : }
15783 0 : ulong fd_txn_result_size( fd_txn_result_t const * self ) {
15784 0 : ulong size = 0;
15785 0 : size += sizeof(uint);
15786 0 : switch (self->discriminant) {
15787 0 : case 1: {
15788 0 : size += fd_txn_error_enum_size( &self->inner.error );
15789 0 : break;
15790 0 : }
15791 0 : }
15792 0 : return size;
15793 0 : }
15794 :
15795 0 : int fd_txn_result_inner_encode( fd_txn_result_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
15796 0 : int err;
15797 0 : switch (discriminant) {
15798 0 : case 1: {
15799 0 : err = fd_txn_error_enum_encode( &self->error, ctx );
15800 0 : if( FD_UNLIKELY( err ) ) return err;
15801 0 : break;
15802 0 : }
15803 0 : }
15804 0 : return FD_BINCODE_SUCCESS;
15805 0 : }
15806 0 : int fd_txn_result_encode( fd_txn_result_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15807 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
15808 0 : if( FD_UNLIKELY( err ) ) return err;
15809 0 : return fd_txn_result_inner_encode( &self->inner, self->discriminant, ctx );
15810 0 : }
15811 :
15812 0 : int fd_pubkey_rewardinfo_pair_encode( fd_pubkey_rewardinfo_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15813 0 : int err;
15814 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
15815 0 : if( FD_UNLIKELY( err ) ) return err;
15816 0 : err = fd_reward_info_encode( &self->reward_info, ctx );
15817 0 : if( FD_UNLIKELY( err ) ) return err;
15818 0 : return FD_BINCODE_SUCCESS;
15819 0 : }
15820 0 : static int fd_pubkey_rewardinfo_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15821 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15822 0 : int err = 0;
15823 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
15824 0 : if( FD_UNLIKELY( err ) ) return err;
15825 0 : err = fd_reward_info_decode_footprint_inner( ctx, total_sz );
15826 0 : if( FD_UNLIKELY( err ) ) return err;
15827 0 : return 0;
15828 0 : }
15829 0 : int fd_pubkey_rewardinfo_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15830 0 : *total_sz += sizeof(fd_pubkey_rewardinfo_pair_t);
15831 0 : void const * start_data = ctx->data;
15832 0 : int err = fd_pubkey_rewardinfo_pair_decode_footprint_inner( ctx, total_sz );
15833 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15834 0 : ctx->data = start_data;
15835 0 : return err;
15836 0 : }
15837 0 : static void fd_pubkey_rewardinfo_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15838 0 : fd_pubkey_rewardinfo_pair_t * self = (fd_pubkey_rewardinfo_pair_t *)struct_mem;
15839 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
15840 0 : fd_reward_info_decode_inner( &self->reward_info, alloc_mem, ctx );
15841 0 : }
15842 0 : void * fd_pubkey_rewardinfo_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15843 0 : fd_pubkey_rewardinfo_pair_t * self = (fd_pubkey_rewardinfo_pair_t *)mem;
15844 0 : fd_pubkey_rewardinfo_pair_new( self );
15845 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_rewardinfo_pair_t);
15846 0 : void * * alloc_mem = &alloc_region;
15847 0 : fd_pubkey_rewardinfo_pair_decode_inner( mem, alloc_mem, ctx );
15848 0 : return self;
15849 0 : }
15850 0 : void fd_pubkey_rewardinfo_pair_new(fd_pubkey_rewardinfo_pair_t * self) {
15851 0 : fd_memset( self, 0, sizeof(fd_pubkey_rewardinfo_pair_t) );
15852 0 : fd_pubkey_new( &self->pubkey );
15853 0 : fd_reward_info_new( &self->reward_info );
15854 0 : }
15855 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 ) {
15856 0 : (void) varint;
15857 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_rewardinfo_pair", level++, 0 );
15858 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
15859 0 : fd_reward_info_walk( w, &self->reward_info, fun, "reward_info", level, 0 );
15860 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_rewardinfo_pair", level--, 0 );
15861 0 : }
15862 0 : int fd_calculated_stake_points_encode( fd_calculated_stake_points_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15863 0 : int err;
15864 0 : err = fd_bincode_uint128_encode( self->points, ctx );
15865 0 : if( FD_UNLIKELY( err ) ) return err;
15866 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
15867 0 : if( FD_UNLIKELY( err ) ) return err;
15868 0 : err = fd_bincode_uint8_encode( (uchar)(self->force_credits_update_with_skipped_reward), ctx );
15869 0 : if( FD_UNLIKELY( err ) ) return err;
15870 0 : return FD_BINCODE_SUCCESS;
15871 0 : }
15872 0 : static inline int fd_calculated_stake_points_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15873 0 : if( (ulong)ctx->data + 25UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15874 0 : ctx->data = (void *)( (ulong)ctx->data + 25UL );
15875 0 : return 0;
15876 0 : }
15877 0 : static void fd_calculated_stake_points_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15878 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)struct_mem;
15879 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
15880 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
15881 0 : fd_bincode_uint8_decode_unsafe( &self->force_credits_update_with_skipped_reward, ctx );
15882 0 : }
15883 0 : void * fd_calculated_stake_points_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15884 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)mem;
15885 0 : fd_calculated_stake_points_new( self );
15886 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_points_t);
15887 0 : void * * alloc_mem = &alloc_region;
15888 0 : fd_calculated_stake_points_decode_inner( mem, alloc_mem, ctx );
15889 0 : return self;
15890 0 : }
15891 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 ) {
15892 0 : (void) varint;
15893 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_points", level++, 0 );
15894 0 : fun( w, &self->points, "points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
15895 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15896 0 : fun( w, &self->force_credits_update_with_skipped_reward, "force_credits_update_with_skipped_reward", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
15897 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_points", level--, 0 );
15898 0 : }
15899 0 : int fd_calculated_stake_rewards_encode( fd_calculated_stake_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15900 0 : int err;
15901 0 : err = fd_bincode_uint64_encode( self->staker_rewards, ctx );
15902 0 : if( FD_UNLIKELY( err ) ) return err;
15903 0 : err = fd_bincode_uint64_encode( self->voter_rewards, ctx );
15904 0 : if( FD_UNLIKELY( err ) ) return err;
15905 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
15906 0 : if( FD_UNLIKELY( err ) ) return err;
15907 0 : return FD_BINCODE_SUCCESS;
15908 0 : }
15909 0 : static inline int fd_calculated_stake_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15910 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15911 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
15912 0 : return 0;
15913 0 : }
15914 0 : static void fd_calculated_stake_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15915 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)struct_mem;
15916 0 : fd_bincode_uint64_decode_unsafe( &self->staker_rewards, ctx );
15917 0 : fd_bincode_uint64_decode_unsafe( &self->voter_rewards, ctx );
15918 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
15919 0 : }
15920 0 : void * fd_calculated_stake_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15921 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)mem;
15922 0 : fd_calculated_stake_rewards_new( self );
15923 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_rewards_t);
15924 0 : void * * alloc_mem = &alloc_region;
15925 0 : fd_calculated_stake_rewards_decode_inner( mem, alloc_mem, ctx );
15926 0 : return self;
15927 0 : }
15928 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 ) {
15929 0 : (void) varint;
15930 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_rewards", level++, 0 );
15931 0 : fun( w, &self->staker_rewards, "staker_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15932 0 : fun( w, &self->voter_rewards, "voter_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15933 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
15934 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_rewards", level--, 0 );
15935 0 : }
15936 0 : int fd_duplicate_slot_proof_encode( fd_duplicate_slot_proof_t const * self, fd_bincode_encode_ctx_t * ctx ) {
15937 0 : int err;
15938 0 : err = fd_bincode_uint64_encode( self->shred1_len, ctx );
15939 0 : if( FD_UNLIKELY(err) ) return err;
15940 0 : if( self->shred1_len ) {
15941 0 : err = fd_bincode_bytes_encode( self->shred1, self->shred1_len, ctx );
15942 0 : if( FD_UNLIKELY( err ) ) return err;
15943 0 : }
15944 0 : err = fd_bincode_uint64_encode( self->shred2_len, ctx );
15945 0 : if( FD_UNLIKELY(err) ) return err;
15946 0 : if( self->shred2_len ) {
15947 0 : err = fd_bincode_bytes_encode( self->shred2, self->shred2_len, ctx );
15948 0 : if( FD_UNLIKELY( err ) ) return err;
15949 0 : }
15950 0 : return FD_BINCODE_SUCCESS;
15951 0 : }
15952 0 : static int fd_duplicate_slot_proof_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15953 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15954 0 : int err = 0;
15955 0 : ulong shred1_len;
15956 0 : err = fd_bincode_uint64_decode( &shred1_len, ctx );
15957 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15958 0 : if( shred1_len ) {
15959 0 : *total_sz += 8UL + shred1_len;
15960 0 : err = fd_bincode_bytes_decode_footprint( shred1_len, ctx );
15961 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15962 0 : }
15963 0 : ulong shred2_len;
15964 0 : err = fd_bincode_uint64_decode( &shred2_len, ctx );
15965 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15966 0 : if( shred2_len ) {
15967 0 : *total_sz += 8UL + shred2_len;
15968 0 : err = fd_bincode_bytes_decode_footprint( shred2_len, ctx );
15969 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
15970 0 : }
15971 0 : return 0;
15972 0 : }
15973 0 : int fd_duplicate_slot_proof_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
15974 0 : *total_sz += sizeof(fd_duplicate_slot_proof_t);
15975 0 : void const * start_data = ctx->data;
15976 0 : int err = fd_duplicate_slot_proof_decode_footprint_inner( ctx, total_sz );
15977 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
15978 0 : ctx->data = start_data;
15979 0 : return err;
15980 0 : }
15981 0 : static void fd_duplicate_slot_proof_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
15982 0 : fd_duplicate_slot_proof_t * self = (fd_duplicate_slot_proof_t *)struct_mem;
15983 0 : fd_bincode_uint64_decode_unsafe( &self->shred1_len, ctx );
15984 0 : if( self->shred1_len ) {
15985 0 : self->shred1 = *alloc_mem;
15986 0 : fd_bincode_bytes_decode_unsafe( self->shred1, self->shred1_len, ctx );
15987 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred1_len;
15988 0 : } else
15989 0 : self->shred1 = NULL;
15990 0 : fd_bincode_uint64_decode_unsafe( &self->shred2_len, ctx );
15991 0 : if( self->shred2_len ) {
15992 0 : self->shred2 = *alloc_mem;
15993 0 : fd_bincode_bytes_decode_unsafe( self->shred2, self->shred2_len, ctx );
15994 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->shred2_len;
15995 0 : } else
15996 0 : self->shred2 = NULL;
15997 0 : }
15998 0 : void * fd_duplicate_slot_proof_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
15999 0 : fd_duplicate_slot_proof_t * self = (fd_duplicate_slot_proof_t *)mem;
16000 0 : fd_duplicate_slot_proof_new( self );
16001 0 : void * alloc_region = (uchar *)mem + sizeof(fd_duplicate_slot_proof_t);
16002 0 : void * * alloc_mem = &alloc_region;
16003 0 : fd_duplicate_slot_proof_decode_inner( mem, alloc_mem, ctx );
16004 0 : return self;
16005 0 : }
16006 0 : void fd_duplicate_slot_proof_new(fd_duplicate_slot_proof_t * self) {
16007 0 : fd_memset( self, 0, sizeof(fd_duplicate_slot_proof_t) );
16008 0 : }
16009 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 ) {
16010 0 : (void) varint;
16011 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_duplicate_slot_proof", level++, 0 );
16012 0 : if( self->shred1_len ) {
16013 0 : fun( w, NULL, "shred1", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
16014 0 : for( ulong i=0; i < self->shred1_len; i++ )
16015 0 : fun( w, self->shred1 + i, "shred1", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
16016 0 : fun( w, NULL, "shred1", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
16017 0 : }
16018 0 : if( self->shred2_len ) {
16019 0 : fun( w, NULL, "shred2", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
16020 0 : for( ulong i=0; i < self->shred2_len; i++ )
16021 0 : fun( w, self->shred2 + i, "shred2", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
16022 0 : fun( w, NULL, "shred2", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
16023 0 : }
16024 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_duplicate_slot_proof", level--, 0 );
16025 0 : }
16026 0 : ulong fd_duplicate_slot_proof_size( fd_duplicate_slot_proof_t const * self ) {
16027 0 : ulong size = 0;
16028 0 : do {
16029 0 : size += sizeof(ulong);
16030 0 : size += self->shred1_len;
16031 0 : } while(0);
16032 0 : do {
16033 0 : size += sizeof(ulong);
16034 0 : size += self->shred2_len;
16035 0 : } while(0);
16036 0 : return size;
16037 0 : }
16038 :
16039 0 : int fd_epoch_info_pair_encode( fd_epoch_info_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16040 0 : int err;
16041 0 : err = fd_pubkey_encode( &self->account, ctx );
16042 0 : if( FD_UNLIKELY( err ) ) return err;
16043 0 : err = fd_stake_encode( &self->stake, ctx );
16044 0 : if( FD_UNLIKELY( err ) ) return err;
16045 0 : return FD_BINCODE_SUCCESS;
16046 0 : }
16047 0 : static inline int fd_epoch_info_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16048 0 : if( (ulong)ctx->data + 104UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16049 0 : ctx->data = (void *)( (ulong)ctx->data + 104UL );
16050 0 : return 0;
16051 0 : }
16052 0 : static void fd_epoch_info_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16053 0 : fd_epoch_info_pair_t * self = (fd_epoch_info_pair_t *)struct_mem;
16054 0 : fd_pubkey_decode_inner( &self->account, alloc_mem, ctx );
16055 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
16056 0 : }
16057 0 : void * fd_epoch_info_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16058 0 : fd_epoch_info_pair_t * self = (fd_epoch_info_pair_t *)mem;
16059 0 : fd_epoch_info_pair_new( self );
16060 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_info_pair_t);
16061 0 : void * * alloc_mem = &alloc_region;
16062 0 : fd_epoch_info_pair_decode_inner( mem, alloc_mem, ctx );
16063 0 : return self;
16064 0 : }
16065 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 ) {
16066 0 : (void) varint;
16067 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_epoch_info_pair", level++, 0 );
16068 0 : fd_pubkey_walk( w, &self->account, fun, "account", level, 0 );
16069 0 : fd_stake_walk( w, &self->stake, fun, "stake", level, 0 );
16070 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_epoch_info_pair", level--, 0 );
16071 0 : }
16072 0 : int fd_usage_cost_details_encode( fd_usage_cost_details_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16073 0 : int err;
16074 0 : err = fd_bincode_uint64_encode( self->signature_cost, ctx );
16075 0 : if( FD_UNLIKELY( err ) ) return err;
16076 0 : err = fd_bincode_uint64_encode( self->write_lock_cost, ctx );
16077 0 : if( FD_UNLIKELY( err ) ) return err;
16078 0 : err = fd_bincode_uint64_encode( self->data_bytes_cost, ctx );
16079 0 : if( FD_UNLIKELY( err ) ) return err;
16080 0 : err = fd_bincode_uint64_encode( self->programs_execution_cost, ctx );
16081 0 : if( FD_UNLIKELY( err ) ) return err;
16082 0 : err = fd_bincode_uint64_encode( self->loaded_accounts_data_size_cost, ctx );
16083 0 : if( FD_UNLIKELY( err ) ) return err;
16084 0 : err = fd_bincode_uint64_encode( self->allocated_accounts_data_size, ctx );
16085 0 : if( FD_UNLIKELY( err ) ) return err;
16086 0 : return FD_BINCODE_SUCCESS;
16087 0 : }
16088 0 : static inline int fd_usage_cost_details_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16089 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16090 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
16091 0 : return 0;
16092 0 : }
16093 0 : static void fd_usage_cost_details_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16094 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)struct_mem;
16095 0 : fd_bincode_uint64_decode_unsafe( &self->signature_cost, ctx );
16096 0 : fd_bincode_uint64_decode_unsafe( &self->write_lock_cost, ctx );
16097 0 : fd_bincode_uint64_decode_unsafe( &self->data_bytes_cost, ctx );
16098 0 : fd_bincode_uint64_decode_unsafe( &self->programs_execution_cost, ctx );
16099 0 : fd_bincode_uint64_decode_unsafe( &self->loaded_accounts_data_size_cost, ctx );
16100 0 : fd_bincode_uint64_decode_unsafe( &self->allocated_accounts_data_size, ctx );
16101 0 : }
16102 0 : void * fd_usage_cost_details_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16103 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)mem;
16104 0 : fd_usage_cost_details_new( self );
16105 0 : void * alloc_region = (uchar *)mem + sizeof(fd_usage_cost_details_t);
16106 0 : void * * alloc_mem = &alloc_region;
16107 0 : fd_usage_cost_details_decode_inner( mem, alloc_mem, ctx );
16108 0 : return self;
16109 0 : }
16110 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 ) {
16111 0 : (void) varint;
16112 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_usage_cost_details", level++, 0 );
16113 0 : fun( w, &self->signature_cost, "signature_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16114 0 : fun( w, &self->write_lock_cost, "write_lock_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16115 0 : fun( w, &self->data_bytes_cost, "data_bytes_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16116 0 : fun( w, &self->programs_execution_cost, "programs_execution_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16117 0 : fun( w, &self->loaded_accounts_data_size_cost, "loaded_accounts_data_size_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16118 0 : fun( w, &self->allocated_accounts_data_size, "allocated_accounts_data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16119 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_usage_cost_details", level--, 0 );
16120 0 : }
16121 0 : FD_FN_PURE uchar fd_transaction_cost_is_simple_vote(fd_transaction_cost_t const * self) {
16122 0 : return self->discriminant == 0;
16123 0 : }
16124 0 : FD_FN_PURE uchar fd_transaction_cost_is_transaction(fd_transaction_cost_t const * self) {
16125 0 : return self->discriminant == 1;
16126 0 : }
16127 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant );
16128 0 : int fd_transaction_cost_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16129 0 : int err;
16130 0 : switch (discriminant) {
16131 0 : case 0: {
16132 0 : return FD_BINCODE_SUCCESS;
16133 0 : }
16134 0 : case 1: {
16135 0 : err = fd_usage_cost_details_decode_footprint_inner( ctx, total_sz );
16136 0 : if( FD_UNLIKELY( err ) ) return err;
16137 0 : return FD_BINCODE_SUCCESS;
16138 0 : }
16139 0 : default: return FD_BINCODE_ERR_ENCODING;
16140 0 : }
16141 0 : }
16142 0 : static int fd_transaction_cost_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16143 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16144 0 : uint discriminant = 0;
16145 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
16146 0 : if( FD_UNLIKELY( err ) ) return err;
16147 0 : return fd_transaction_cost_inner_decode_footprint( discriminant, ctx, total_sz );
16148 0 : }
16149 0 : int fd_transaction_cost_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16150 0 : *total_sz += sizeof(fd_transaction_cost_t);
16151 0 : void const * start_data = ctx->data;
16152 0 : int err = fd_transaction_cost_decode_footprint_inner( ctx, total_sz );
16153 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16154 0 : ctx->data = start_data;
16155 0 : return err;
16156 0 : }
16157 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 ) {
16158 0 : switch (discriminant) {
16159 0 : case 0: {
16160 0 : break;
16161 0 : }
16162 0 : case 1: {
16163 0 : fd_usage_cost_details_decode_inner( &self->transaction, alloc_mem, ctx );
16164 0 : break;
16165 0 : }
16166 0 : }
16167 0 : }
16168 0 : static void fd_transaction_cost_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16169 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)struct_mem;
16170 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16171 0 : fd_transaction_cost_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
16172 0 : }
16173 0 : void * fd_transaction_cost_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16174 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)mem;
16175 0 : fd_transaction_cost_new( self );
16176 0 : void * alloc_region = (uchar *)mem + sizeof(fd_transaction_cost_t);
16177 0 : void * * alloc_mem = &alloc_region;
16178 0 : fd_transaction_cost_decode_inner( mem, alloc_mem, ctx );
16179 0 : return self;
16180 0 : }
16181 0 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant ) {
16182 0 : switch( discriminant ) {
16183 0 : case 0: {
16184 0 : break;
16185 0 : }
16186 0 : case 1: {
16187 0 : fd_usage_cost_details_new( &self->transaction );
16188 0 : break;
16189 0 : }
16190 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
16191 0 : }
16192 0 : }
16193 0 : void fd_transaction_cost_new_disc( fd_transaction_cost_t * self, uint discriminant ) {
16194 0 : self->discriminant = discriminant;
16195 0 : fd_transaction_cost_inner_new( &self->inner, self->discriminant );
16196 0 : }
16197 0 : void fd_transaction_cost_new( fd_transaction_cost_t * self ) {
16198 0 : fd_memset( self, 0, sizeof(fd_transaction_cost_t) );
16199 0 : fd_transaction_cost_new_disc( self, UINT_MAX );
16200 0 : }
16201 :
16202 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 ) {
16203 0 : (void) varint;
16204 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_transaction_cost", level++, 0);
16205 0 : switch( self->discriminant ) {
16206 0 : case 0: {
16207 0 : fun( w, self, "simple_vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16208 0 : break;
16209 0 : }
16210 0 : case 1: {
16211 0 : fun( w, self, "transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16212 0 : fd_usage_cost_details_walk( w, &self->inner.transaction, fun, "transaction", level, 0 );
16213 0 : break;
16214 0 : }
16215 0 : }
16216 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_transaction_cost", level--, 0 );
16217 0 : }
16218 0 : ulong fd_transaction_cost_size( fd_transaction_cost_t const * self ) {
16219 0 : ulong size = 0;
16220 0 : size += sizeof(uint);
16221 0 : switch (self->discriminant) {
16222 0 : case 1: {
16223 0 : size += fd_usage_cost_details_size( &self->inner.transaction );
16224 0 : break;
16225 0 : }
16226 0 : }
16227 0 : return size;
16228 0 : }
16229 :
16230 0 : int fd_transaction_cost_inner_encode( fd_transaction_cost_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
16231 0 : int err;
16232 0 : switch (discriminant) {
16233 0 : case 1: {
16234 0 : err = fd_usage_cost_details_encode( &self->transaction, ctx );
16235 0 : if( FD_UNLIKELY( err ) ) return err;
16236 0 : break;
16237 0 : }
16238 0 : }
16239 0 : return FD_BINCODE_SUCCESS;
16240 0 : }
16241 0 : int fd_transaction_cost_encode( fd_transaction_cost_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16242 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
16243 0 : if( FD_UNLIKELY( err ) ) return err;
16244 0 : return fd_transaction_cost_inner_encode( &self->inner, self->discriminant, ctx );
16245 0 : }
16246 :
16247 0 : int fd_rent_paying_encode( fd_rent_paying_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16248 0 : int err;
16249 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
16250 0 : if( FD_UNLIKELY( err ) ) return err;
16251 0 : err = fd_bincode_uint64_encode( self->data_size, ctx );
16252 0 : if( FD_UNLIKELY( err ) ) return err;
16253 0 : return FD_BINCODE_SUCCESS;
16254 0 : }
16255 0 : static inline int fd_rent_paying_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16256 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16257 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
16258 0 : return 0;
16259 0 : }
16260 0 : static void fd_rent_paying_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16261 0 : fd_rent_paying_t * self = (fd_rent_paying_t *)struct_mem;
16262 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
16263 0 : fd_bincode_uint64_decode_unsafe( &self->data_size, ctx );
16264 0 : }
16265 0 : void * fd_rent_paying_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16266 0 : fd_rent_paying_t * self = (fd_rent_paying_t *)mem;
16267 0 : fd_rent_paying_new( self );
16268 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_paying_t);
16269 0 : void * * alloc_mem = &alloc_region;
16270 0 : fd_rent_paying_decode_inner( mem, alloc_mem, ctx );
16271 0 : return self;
16272 0 : }
16273 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 ) {
16274 0 : (void) varint;
16275 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_paying", level++, 0 );
16276 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16277 0 : fun( w, &self->data_size, "data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
16278 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_paying", level--, 0 );
16279 0 : }
16280 0 : FD_FN_PURE uchar fd_rent_state_is_uninitialized(fd_rent_state_t const * self) {
16281 0 : return self->discriminant == 0;
16282 0 : }
16283 0 : FD_FN_PURE uchar fd_rent_state_is_rent_paying(fd_rent_state_t const * self) {
16284 0 : return self->discriminant == 1;
16285 0 : }
16286 0 : FD_FN_PURE uchar fd_rent_state_is_rent_exempt(fd_rent_state_t const * self) {
16287 0 : return self->discriminant == 2;
16288 0 : }
16289 : void fd_rent_state_inner_new( fd_rent_state_inner_t * self, uint discriminant );
16290 0 : int fd_rent_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16291 0 : int err;
16292 0 : switch (discriminant) {
16293 0 : case 0: {
16294 0 : return FD_BINCODE_SUCCESS;
16295 0 : }
16296 0 : case 1: {
16297 0 : err = fd_rent_paying_decode_footprint_inner( ctx, total_sz );
16298 0 : if( FD_UNLIKELY( err ) ) return err;
16299 0 : return FD_BINCODE_SUCCESS;
16300 0 : }
16301 0 : case 2: {
16302 0 : return FD_BINCODE_SUCCESS;
16303 0 : }
16304 0 : default: return FD_BINCODE_ERR_ENCODING;
16305 0 : }
16306 0 : }
16307 0 : static int fd_rent_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16308 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16309 0 : uint discriminant = 0;
16310 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
16311 0 : if( FD_UNLIKELY( err ) ) return err;
16312 0 : return fd_rent_state_inner_decode_footprint( discriminant, ctx, total_sz );
16313 0 : }
16314 0 : int fd_rent_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
16315 0 : *total_sz += sizeof(fd_rent_state_t);
16316 0 : void const * start_data = ctx->data;
16317 0 : int err = fd_rent_state_decode_footprint_inner( ctx, total_sz );
16318 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
16319 0 : ctx->data = start_data;
16320 0 : return err;
16321 0 : }
16322 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 ) {
16323 0 : switch (discriminant) {
16324 0 : case 0: {
16325 0 : break;
16326 0 : }
16327 0 : case 1: {
16328 0 : fd_rent_paying_decode_inner( &self->rent_paying, alloc_mem, ctx );
16329 0 : break;
16330 0 : }
16331 0 : case 2: {
16332 0 : break;
16333 0 : }
16334 0 : }
16335 0 : }
16336 0 : static void fd_rent_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
16337 0 : fd_rent_state_t * self = (fd_rent_state_t *)struct_mem;
16338 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
16339 0 : fd_rent_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
16340 0 : }
16341 0 : void * fd_rent_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
16342 0 : fd_rent_state_t * self = (fd_rent_state_t *)mem;
16343 0 : fd_rent_state_new( self );
16344 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_state_t);
16345 0 : void * * alloc_mem = &alloc_region;
16346 0 : fd_rent_state_decode_inner( mem, alloc_mem, ctx );
16347 0 : return self;
16348 0 : }
16349 0 : void fd_rent_state_inner_new( fd_rent_state_inner_t * self, uint discriminant ) {
16350 0 : switch( discriminant ) {
16351 0 : case 0: {
16352 0 : break;
16353 0 : }
16354 0 : case 1: {
16355 0 : fd_rent_paying_new( &self->rent_paying );
16356 0 : break;
16357 0 : }
16358 0 : case 2: {
16359 0 : break;
16360 0 : }
16361 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
16362 0 : }
16363 0 : }
16364 0 : void fd_rent_state_new_disc( fd_rent_state_t * self, uint discriminant ) {
16365 0 : self->discriminant = discriminant;
16366 0 : fd_rent_state_inner_new( &self->inner, self->discriminant );
16367 0 : }
16368 0 : void fd_rent_state_new( fd_rent_state_t * self ) {
16369 0 : fd_memset( self, 0, sizeof(fd_rent_state_t) );
16370 0 : fd_rent_state_new_disc( self, UINT_MAX );
16371 0 : }
16372 :
16373 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 ) {
16374 0 : (void) varint;
16375 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_rent_state", level++, 0);
16376 0 : switch( self->discriminant ) {
16377 0 : case 0: {
16378 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16379 0 : break;
16380 0 : }
16381 0 : case 1: {
16382 0 : fun( w, self, "rent_paying", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16383 0 : fd_rent_paying_walk( w, &self->inner.rent_paying, fun, "rent_paying", level, 0 );
16384 0 : break;
16385 0 : }
16386 0 : case 2: {
16387 0 : fun( w, self, "rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
16388 0 : break;
16389 0 : }
16390 0 : }
16391 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_rent_state", level--, 0 );
16392 0 : }
16393 0 : ulong fd_rent_state_size( fd_rent_state_t const * self ) {
16394 0 : ulong size = 0;
16395 0 : size += sizeof(uint);
16396 0 : switch (self->discriminant) {
16397 0 : case 1: {
16398 0 : size += fd_rent_paying_size( &self->inner.rent_paying );
16399 0 : break;
16400 0 : }
16401 0 : }
16402 0 : return size;
16403 0 : }
16404 :
16405 0 : int fd_rent_state_inner_encode( fd_rent_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
16406 0 : int err;
16407 0 : switch (discriminant) {
16408 0 : case 1: {
16409 0 : err = fd_rent_paying_encode( &self->rent_paying, ctx );
16410 0 : if( FD_UNLIKELY( err ) ) return err;
16411 0 : break;
16412 0 : }
16413 0 : }
16414 0 : return FD_BINCODE_SUCCESS;
16415 0 : }
16416 0 : int fd_rent_state_encode( fd_rent_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
16417 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
16418 0 : if( FD_UNLIKELY( err ) ) return err;
16419 0 : return fd_rent_state_inner_encode( &self->inner, self->discriminant, ctx );
16420 0 : }
16421 :
16422 0 : #define REDBLK_T fd_clock_timestamp_vote_t_mapnode_t
16423 : #define REDBLK_NAME fd_clock_timestamp_vote_t_map
16424 : #define REDBLK_IMPL_STYLE 2
16425 : #include "../../util/tmpl/fd_redblack.c"
16426 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 ) {
16427 0 : return memcmp( left->elem.pubkey.uc, right->elem.pubkey.uc, sizeof(right->elem.pubkey) );
16428 0 : }
16429 0 : #define REDBLK_T fd_vote_reward_t_mapnode_t
16430 : #define REDBLK_NAME fd_vote_reward_t_map
16431 : #define REDBLK_IMPL_STYLE 2
16432 : #include "../../util/tmpl/fd_redblack.c"
16433 0 : long fd_vote_reward_t_map_compare( fd_vote_reward_t_mapnode_t * left, fd_vote_reward_t_mapnode_t * right ) {
16434 0 : return memcmp( left->elem.pubkey.uc, right->elem.pubkey.uc, sizeof(right->elem.pubkey) );
16435 0 : }
16436 : #include "fd_types_custom.c"
|