Line data Source code
1 : // This is an auto-generated file. To add entries, edit fd_types.json
2 : #include "fd_types.h"
3 : #pragma GCC diagnostic ignored "-Wunused-parameter"
4 : #pragma GCC diagnostic ignored "-Wunused-variable"
5 : #pragma GCC diagnostic ignored "-Wunused-function"
6 : #if defined(__GNUC__) && (__GNUC__ >= 9)
7 : #pragma GCC diagnostic ignored "-Waddress-of-packed-member"
8 : #endif
9 : #define SOURCE_fd_src_flamenco_types_fd_types_c
10 : #include "fd_types_custom.h"
11 966 : int fd_hash_encode( fd_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12 966 : return fd_bincode_bytes_encode( (uchar const *)self, sizeof(fd_hash_t), ctx );
13 966 : }
14 315 : 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 315 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_HASH256, name, level, varint );
16 315 : }
17 33 : static int fd_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18 33 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19 33 : return fd_bincode_bytes_decode_footprint( sizeof(fd_hash_t), ctx );
20 33 : }
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 34500 : static void fd_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
30 34500 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_hash_t), ctx );
31 34500 : return;
32 34500 : }
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 0 : 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 0 : fun( w, (uchar const *)self, name, FD_FLAMENCO_TYPE_SIG512, name, level, varint );
43 0 : }
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 0 : static void fd_signature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
57 0 : fd_bincode_bytes_decode_unsafe( struct_mem, sizeof(fd_signature_t), ctx );
58 0 : return;
59 0 : }
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 12 : int fd_delegation_encode( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
885 12 : int err;
886 12 : err = fd_pubkey_encode( &self->voter_pubkey, ctx );
887 12 : if( FD_UNLIKELY( err ) ) return err;
888 12 : err = fd_bincode_uint64_encode( self->stake, ctx );
889 12 : if( FD_UNLIKELY( err ) ) return err;
890 12 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
891 12 : if( FD_UNLIKELY( err ) ) return err;
892 12 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
893 12 : if( FD_UNLIKELY( err ) ) return err;
894 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
895 12 : if( FD_UNLIKELY( err ) ) return err;
896 12 : return FD_BINCODE_SUCCESS;
897 12 : }
898 0 : static inline int fd_delegation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
899 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
900 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
901 0 : return 0;
902 0 : }
903 0 : static void fd_delegation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
904 0 : fd_delegation_t * self = (fd_delegation_t *)struct_mem;
905 0 : fd_pubkey_decode_inner( &self->voter_pubkey, alloc_mem, ctx );
906 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
907 0 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
908 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
909 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
910 0 : }
911 0 : void * fd_delegation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
912 0 : fd_delegation_t * self = (fd_delegation_t *)mem;
913 0 : fd_delegation_new( self );
914 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_t);
915 0 : void * * alloc_mem = &alloc_region;
916 0 : fd_delegation_decode_inner( mem, alloc_mem, ctx );
917 0 : return self;
918 0 : }
919 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 ) {
920 0 : (void) varint;
921 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_delegation", level++, 0 );
922 0 : fd_pubkey_walk( w, &self->voter_pubkey, fun, "voter_pubkey", level, 0 );
923 0 : fun( w, &self->stake, "stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
924 0 : fun( w, &self->activation_epoch, "activation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
925 0 : fun( w, &self->deactivation_epoch, "deactivation_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
926 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
927 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_delegation", level--, 0 );
928 0 : }
929 12 : int fd_stake_encode( fd_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
930 12 : int err;
931 12 : err = fd_delegation_encode( &self->delegation, ctx );
932 12 : if( FD_UNLIKELY( err ) ) return err;
933 12 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
934 12 : if( FD_UNLIKELY( err ) ) return err;
935 12 : return FD_BINCODE_SUCCESS;
936 12 : }
937 0 : static inline int fd_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
938 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
939 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
940 0 : return 0;
941 0 : }
942 0 : static void fd_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
943 0 : fd_stake_t * self = (fd_stake_t *)struct_mem;
944 0 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
945 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
946 0 : }
947 0 : void * fd_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
948 0 : fd_stake_t * self = (fd_stake_t *)mem;
949 0 : fd_stake_new( self );
950 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_t);
951 0 : void * * alloc_mem = &alloc_region;
952 0 : fd_stake_decode_inner( mem, alloc_mem, ctx );
953 0 : return self;
954 0 : }
955 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 ) {
956 0 : (void) varint;
957 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake", level++, 0 );
958 0 : fd_delegation_walk( w, &self->delegation, fun, "delegation", level, 0 );
959 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
960 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake", level--, 0 );
961 0 : }
962 9 : int fd_rust_duration_encode( fd_rust_duration_t const * self, fd_bincode_encode_ctx_t * ctx ) {
963 9 : int err;
964 9 : err = fd_bincode_uint64_encode( self->seconds, ctx );
965 9 : if( FD_UNLIKELY( err ) ) return err;
966 9 : err = fd_bincode_uint32_encode( self->nanoseconds, ctx );
967 9 : if( FD_UNLIKELY( err ) ) return err;
968 9 : return FD_BINCODE_SUCCESS;
969 9 : }
970 0 : static inline int fd_rust_duration_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
971 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
972 0 : int err = fd_rust_duration_footprint_validator( ctx );
973 0 : if( FD_UNLIKELY( err != FD_BINCODE_SUCCESS ) )
974 0 : return err;
975 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
976 0 : return 0;
977 0 : }
978 0 : static void fd_rust_duration_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
979 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)struct_mem;
980 0 : fd_bincode_uint64_decode_unsafe( &self->seconds, ctx );
981 0 : fd_bincode_uint32_decode_unsafe( &self->nanoseconds, ctx );
982 0 : fd_rust_duration_normalize( self );
983 0 : }
984 0 : void * fd_rust_duration_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
985 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)mem;
986 0 : fd_rust_duration_new( self );
987 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rust_duration_t);
988 0 : void * * alloc_mem = &alloc_region;
989 0 : fd_rust_duration_decode_inner( mem, alloc_mem, ctx );
990 0 : return self;
991 0 : }
992 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 ) {
993 0 : (void) varint;
994 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rust_duration", level++, 0 );
995 0 : fun( w, &self->seconds, "seconds", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
996 0 : fun( w, &self->nanoseconds, "nanoseconds", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
997 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rust_duration", level--, 0 );
998 0 : }
999 9 : int fd_poh_config_encode( fd_poh_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1000 9 : int err;
1001 9 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
1002 9 : if( FD_UNLIKELY( err ) ) return err;
1003 9 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
1004 9 : if( FD_UNLIKELY( err ) ) return err;
1005 9 : if( self->has_target_tick_count ) {
1006 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
1007 0 : if( FD_UNLIKELY( err ) ) return err;
1008 0 : }
1009 9 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
1010 9 : if( FD_UNLIKELY( err ) ) return err;
1011 9 : if( self->has_hashes_per_tick ) {
1012 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
1013 0 : if( FD_UNLIKELY( err ) ) return err;
1014 0 : }
1015 9 : return FD_BINCODE_SUCCESS;
1016 9 : }
1017 0 : int fd_poh_config_encode_global( fd_poh_config_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1018 0 : int err;
1019 0 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
1020 0 : if( FD_UNLIKELY( err ) ) return err;
1021 0 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
1022 0 : if( FD_UNLIKELY( err ) ) return err;
1023 0 : if( self->has_target_tick_count ) {
1024 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
1025 0 : if( FD_UNLIKELY( err ) ) return err;
1026 0 : }
1027 0 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
1028 0 : if( FD_UNLIKELY( err ) ) return err;
1029 0 : if( self->has_hashes_per_tick ) {
1030 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
1031 0 : if( FD_UNLIKELY( err ) ) return err;
1032 0 : }
1033 0 : return FD_BINCODE_SUCCESS;
1034 0 : }
1035 0 : static int fd_poh_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1036 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1037 0 : int err = 0;
1038 0 : err = fd_rust_duration_decode_footprint_inner( ctx, total_sz );
1039 0 : if( FD_UNLIKELY( err ) ) return err;
1040 0 : {
1041 0 : uchar o;
1042 0 : err = fd_bincode_bool_decode( &o, ctx );
1043 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1044 0 : if( o ) {
1045 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1046 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1047 0 : }
1048 0 : }
1049 0 : {
1050 0 : uchar o;
1051 0 : err = fd_bincode_bool_decode( &o, ctx );
1052 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1053 0 : if( o ) {
1054 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1055 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1056 0 : }
1057 0 : }
1058 0 : return 0;
1059 0 : }
1060 0 : int fd_poh_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1061 0 : *total_sz += sizeof(fd_poh_config_t);
1062 0 : void const * start_data = ctx->data;
1063 0 : int err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
1064 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1065 0 : ctx->data = start_data;
1066 0 : return err;
1067 0 : }
1068 0 : static void fd_poh_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1069 0 : fd_poh_config_t * self = (fd_poh_config_t *)struct_mem;
1070 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
1071 0 : {
1072 0 : uchar o;
1073 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1074 0 : self->has_target_tick_count = !!o;
1075 0 : if( o ) {
1076 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
1077 0 : }
1078 0 : }
1079 0 : {
1080 0 : uchar o;
1081 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1082 0 : self->has_hashes_per_tick = !!o;
1083 0 : if( o ) {
1084 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
1085 0 : }
1086 0 : }
1087 0 : }
1088 0 : void * fd_poh_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1089 0 : fd_poh_config_t * self = (fd_poh_config_t *)mem;
1090 0 : fd_poh_config_new( self );
1091 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_t);
1092 0 : void * * alloc_mem = &alloc_region;
1093 0 : fd_poh_config_decode_inner( mem, alloc_mem, ctx );
1094 0 : return self;
1095 0 : }
1096 0 : static void fd_poh_config_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1097 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)struct_mem;
1098 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
1099 0 : {
1100 0 : uchar o;
1101 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1102 0 : self->has_target_tick_count = !!o;
1103 0 : if( o ) {
1104 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
1105 0 : }
1106 0 : }
1107 0 : {
1108 0 : uchar o;
1109 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1110 0 : self->has_hashes_per_tick = !!o;
1111 0 : if( o ) {
1112 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
1113 0 : }
1114 0 : }
1115 0 : }
1116 0 : void * fd_poh_config_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1117 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)mem;
1118 0 : fd_poh_config_new( (fd_poh_config_t *)self );
1119 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_global_t);
1120 0 : void * * alloc_mem = &alloc_region;
1121 0 : fd_poh_config_decode_inner_global( mem, alloc_mem, ctx );
1122 0 : return self;
1123 0 : }
1124 12 : void fd_poh_config_new(fd_poh_config_t * self) {
1125 12 : fd_memset( self, 0, sizeof(fd_poh_config_t) );
1126 12 : fd_rust_duration_new( &self->target_tick_duration );
1127 12 : }
1128 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 ) {
1129 0 : (void) varint;
1130 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_poh_config", level++, 0 );
1131 0 : fd_rust_duration_walk( w, &self->target_tick_duration, fun, "target_tick_duration", level, 0 );
1132 0 : if( !self->has_target_tick_count ) {
1133 0 : fun( w, NULL, "target_tick_count", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
1134 0 : } else {
1135 0 : fun( w, &self->target_tick_count, "target_tick_count", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1136 0 : }
1137 0 : if( !self->has_hashes_per_tick ) {
1138 0 : fun( w, NULL, "hashes_per_tick", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
1139 0 : } else {
1140 0 : fun( w, &self->hashes_per_tick, "hashes_per_tick", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1141 0 : }
1142 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_poh_config", level--, 0 );
1143 0 : }
1144 0 : ulong fd_poh_config_size( fd_poh_config_t const * self ) {
1145 0 : ulong size = 0;
1146 0 : size += fd_rust_duration_size( &self->target_tick_duration );
1147 0 : size += sizeof(char);
1148 0 : if( self->has_target_tick_count ) {
1149 0 : size += sizeof(ulong);
1150 0 : }
1151 0 : size += sizeof(char);
1152 0 : if( self->has_hashes_per_tick ) {
1153 0 : size += sizeof(ulong);
1154 0 : }
1155 0 : return size;
1156 0 : }
1157 :
1158 0 : ulong fd_poh_config_size_global( fd_poh_config_global_t const * self ) {
1159 0 : ulong size = 0;
1160 0 : size += fd_rust_duration_size( &self->target_tick_duration );
1161 0 : size += sizeof(char);
1162 0 : if( self->has_target_tick_count ) {
1163 0 : size += sizeof(ulong);
1164 0 : }
1165 0 : size += sizeof(char);
1166 0 : if( self->has_hashes_per_tick ) {
1167 0 : size += sizeof(ulong);
1168 0 : }
1169 0 : return size;
1170 0 : }
1171 :
1172 0 : int fd_string_pubkey_pair_encode( fd_string_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1173 0 : int err;
1174 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
1175 0 : if( FD_UNLIKELY(err) ) return err;
1176 0 : if( self->string_len ) {
1177 0 : err = fd_bincode_bytes_encode( self->string, self->string_len, ctx );
1178 0 : if( FD_UNLIKELY( err ) ) return err;
1179 0 : }
1180 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
1181 0 : if( FD_UNLIKELY( err ) ) return err;
1182 0 : return FD_BINCODE_SUCCESS;
1183 0 : }
1184 0 : int fd_string_pubkey_pair_encode_global( fd_string_pubkey_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1185 0 : int err;
1186 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
1187 0 : if( FD_UNLIKELY( err ) ) return err;
1188 0 : if( self->string_len ) {
1189 0 : uchar * string_laddr = (uchar*)self + self->string_offset;
1190 0 : err = fd_bincode_bytes_encode( string_laddr, self->string_len, ctx );
1191 0 : if( FD_UNLIKELY( err ) ) return err;
1192 0 : }
1193 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
1194 0 : if( FD_UNLIKELY( err ) ) return err;
1195 0 : return FD_BINCODE_SUCCESS;
1196 0 : }
1197 0 : static int fd_string_pubkey_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1198 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1199 0 : int err = 0;
1200 0 : ulong string_len;
1201 0 : err = fd_bincode_uint64_decode( &string_len, ctx );
1202 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1203 0 : *total_sz += string_len;
1204 0 : if( string_len ) {
1205 0 : err = fd_bincode_bytes_decode_footprint( string_len, ctx );
1206 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1207 0 : err = !fd_utf8_verify( (char const *) ctx->data - string_len, string_len );
1208 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1209 0 : }
1210 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1211 0 : if( FD_UNLIKELY( err ) ) return err;
1212 0 : return 0;
1213 0 : }
1214 0 : int fd_string_pubkey_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1215 0 : *total_sz += sizeof(fd_string_pubkey_pair_t);
1216 0 : void const * start_data = ctx->data;
1217 0 : int err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
1218 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1219 0 : ctx->data = start_data;
1220 0 : return err;
1221 0 : }
1222 0 : static void fd_string_pubkey_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1223 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)struct_mem;
1224 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
1225 0 : if( self->string_len ) {
1226 0 : self->string = *alloc_mem;
1227 0 : fd_bincode_bytes_decode_unsafe( self->string, self->string_len, ctx );
1228 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
1229 0 : } else
1230 0 : self->string = NULL;
1231 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1232 0 : }
1233 0 : void * fd_string_pubkey_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1234 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)mem;
1235 0 : fd_string_pubkey_pair_new( self );
1236 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_t);
1237 0 : void * * alloc_mem = &alloc_region;
1238 0 : fd_string_pubkey_pair_decode_inner( mem, alloc_mem, ctx );
1239 0 : return self;
1240 0 : }
1241 0 : static void fd_string_pubkey_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1242 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)struct_mem;
1243 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
1244 0 : if( self->string_len ) {
1245 0 : self->string_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1246 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->string_len, ctx );
1247 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
1248 0 : } else {
1249 0 : self->string_offset = 0UL;
1250 0 : }
1251 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1252 0 : }
1253 0 : void * fd_string_pubkey_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1254 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)mem;
1255 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)self );
1256 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_global_t);
1257 0 : void * * alloc_mem = &alloc_region;
1258 0 : fd_string_pubkey_pair_decode_inner_global( mem, alloc_mem, ctx );
1259 0 : return self;
1260 0 : }
1261 0 : void fd_string_pubkey_pair_new(fd_string_pubkey_pair_t * self) {
1262 0 : fd_memset( self, 0, sizeof(fd_string_pubkey_pair_t) );
1263 0 : fd_pubkey_new( &self->pubkey );
1264 0 : }
1265 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 ) {
1266 0 : (void) varint;
1267 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_string_pubkey_pair", level++, 0 );
1268 0 : if( self->string_len ) {
1269 0 : fun( w, NULL, "string", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
1270 0 : for( ulong i=0; i < self->string_len; i++ )
1271 0 : fun( w, self->string + i, "string", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1272 0 : fun( w, NULL, "string", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
1273 0 : }
1274 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
1275 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_string_pubkey_pair", level--, 0 );
1276 0 : }
1277 0 : ulong fd_string_pubkey_pair_size( fd_string_pubkey_pair_t const * self ) {
1278 0 : ulong size = 0;
1279 0 : do {
1280 0 : size += sizeof(ulong);
1281 0 : size += self->string_len;
1282 0 : } while(0);
1283 0 : size += fd_pubkey_size( &self->pubkey );
1284 0 : return size;
1285 0 : }
1286 :
1287 0 : ulong fd_string_pubkey_pair_size_global( fd_string_pubkey_pair_global_t const * self ) {
1288 0 : ulong size = 0;
1289 0 : do {
1290 0 : size += sizeof(ulong);
1291 0 : uchar * string = self->string_offset ? (uchar *)fd_type_pun( (uchar *)self + self->string_offset ) : NULL;
1292 0 : size += self->string_len;
1293 0 : } while(0);
1294 0 : size += fd_pubkey_size( &self->pubkey );
1295 0 : return size;
1296 0 : }
1297 :
1298 144 : int fd_pubkey_account_pair_encode( fd_pubkey_account_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1299 144 : int err;
1300 144 : err = fd_pubkey_encode( &self->key, ctx );
1301 144 : if( FD_UNLIKELY( err ) ) return err;
1302 144 : err = fd_solana_account_encode( &self->account, ctx );
1303 144 : if( FD_UNLIKELY( err ) ) return err;
1304 144 : return FD_BINCODE_SUCCESS;
1305 144 : }
1306 0 : int fd_pubkey_account_pair_encode_global( fd_pubkey_account_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1307 0 : int err;
1308 0 : err = fd_pubkey_encode( &self->key, ctx );
1309 0 : if( FD_UNLIKELY( err ) ) return err;
1310 0 : err = fd_solana_account_encode_global( &self->account, ctx );
1311 0 : if( FD_UNLIKELY( err ) ) return err;
1312 0 : return FD_BINCODE_SUCCESS;
1313 0 : }
1314 0 : static int fd_pubkey_account_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1315 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1316 0 : int err = 0;
1317 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1318 0 : if( FD_UNLIKELY( err ) ) return err;
1319 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
1320 0 : if( FD_UNLIKELY( err ) ) return err;
1321 0 : return 0;
1322 0 : }
1323 0 : int fd_pubkey_account_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1324 0 : *total_sz += sizeof(fd_pubkey_account_pair_t);
1325 0 : void const * start_data = ctx->data;
1326 0 : int err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1327 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1328 0 : ctx->data = start_data;
1329 0 : return err;
1330 0 : }
1331 0 : static void fd_pubkey_account_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1332 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)struct_mem;
1333 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1334 0 : fd_solana_account_decode_inner( &self->account, alloc_mem, ctx );
1335 0 : }
1336 0 : void * fd_pubkey_account_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1337 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)mem;
1338 0 : fd_pubkey_account_pair_new( self );
1339 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_t);
1340 0 : void * * alloc_mem = &alloc_region;
1341 0 : fd_pubkey_account_pair_decode_inner( mem, alloc_mem, ctx );
1342 0 : return self;
1343 0 : }
1344 0 : static void fd_pubkey_account_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1345 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)struct_mem;
1346 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1347 0 : fd_solana_account_decode_inner_global( &self->account, alloc_mem, ctx );
1348 0 : }
1349 0 : void * fd_pubkey_account_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1350 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)mem;
1351 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)self );
1352 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_global_t);
1353 0 : void * * alloc_mem = &alloc_region;
1354 0 : fd_pubkey_account_pair_decode_inner_global( mem, alloc_mem, ctx );
1355 0 : return self;
1356 0 : }
1357 0 : void fd_pubkey_account_pair_new(fd_pubkey_account_pair_t * self) {
1358 0 : fd_memset( self, 0, sizeof(fd_pubkey_account_pair_t) );
1359 0 : fd_pubkey_new( &self->key );
1360 0 : fd_solana_account_new( &self->account );
1361 0 : }
1362 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 ) {
1363 0 : (void) varint;
1364 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_pubkey_account_pair", level++, 0 );
1365 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
1366 0 : fd_solana_account_walk( w, &self->account, fun, "account", level, 0 );
1367 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_pubkey_account_pair", level--, 0 );
1368 0 : }
1369 0 : ulong fd_pubkey_account_pair_size( fd_pubkey_account_pair_t const * self ) {
1370 0 : ulong size = 0;
1371 0 : size += fd_pubkey_size( &self->key );
1372 0 : size += fd_solana_account_size( &self->account );
1373 0 : return size;
1374 0 : }
1375 :
1376 0 : ulong fd_pubkey_account_pair_size_global( fd_pubkey_account_pair_global_t const * self ) {
1377 0 : ulong size = 0;
1378 0 : size += fd_pubkey_size( &self->key );
1379 0 : size += fd_solana_account_size_global( &self->account );
1380 0 : return size;
1381 0 : }
1382 :
1383 12 : int fd_genesis_solana_encode( fd_genesis_solana_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1384 12 : int err;
1385 12 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1386 12 : if( FD_UNLIKELY( err ) ) return err;
1387 9 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1388 9 : if( FD_UNLIKELY(err) ) return err;
1389 9 : if( self->accounts_len ) {
1390 153 : for( ulong i=0; i < self->accounts_len; i++ ) {
1391 144 : err = fd_pubkey_account_pair_encode( self->accounts + i, ctx );
1392 144 : if( FD_UNLIKELY( err ) ) return err;
1393 144 : }
1394 9 : }
1395 9 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1396 9 : if( FD_UNLIKELY(err) ) return err;
1397 9 : if( self->native_instruction_processors_len ) {
1398 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1399 0 : err = fd_string_pubkey_pair_encode( self->native_instruction_processors + i, ctx );
1400 0 : if( FD_UNLIKELY( err ) ) return err;
1401 0 : }
1402 0 : }
1403 9 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1404 9 : if( FD_UNLIKELY(err) ) return err;
1405 9 : if( self->rewards_pools_len ) {
1406 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1407 0 : err = fd_pubkey_account_pair_encode( self->rewards_pools + i, ctx );
1408 0 : if( FD_UNLIKELY( err ) ) return err;
1409 0 : }
1410 0 : }
1411 9 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1412 9 : if( FD_UNLIKELY( err ) ) return err;
1413 9 : err = fd_bincode_uint64_encode( self->unused, ctx );
1414 9 : if( FD_UNLIKELY( err ) ) return err;
1415 9 : err = fd_poh_config_encode( &self->poh_config, ctx );
1416 9 : if( FD_UNLIKELY( err ) ) return err;
1417 9 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1418 9 : if( FD_UNLIKELY( err ) ) return err;
1419 9 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1420 9 : if( FD_UNLIKELY( err ) ) return err;
1421 9 : err = fd_rent_encode( &self->rent, ctx );
1422 9 : if( FD_UNLIKELY( err ) ) return err;
1423 9 : err = fd_inflation_encode( &self->inflation, ctx );
1424 9 : if( FD_UNLIKELY( err ) ) return err;
1425 9 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1426 9 : if( FD_UNLIKELY( err ) ) return err;
1427 9 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1428 9 : if( FD_UNLIKELY( err ) ) return err;
1429 9 : return FD_BINCODE_SUCCESS;
1430 9 : }
1431 0 : int fd_genesis_solana_encode_global( fd_genesis_solana_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1432 0 : int err;
1433 0 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1434 0 : if( FD_UNLIKELY( err ) ) return err;
1435 0 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1436 0 : if( FD_UNLIKELY( err ) ) return err;
1437 0 : if( self->accounts_len ) {
1438 0 : uchar * accounts_laddr = (uchar*)self + self->accounts_offset;
1439 0 : fd_pubkey_account_pair_global_t * accounts = (fd_pubkey_account_pair_global_t *)accounts_laddr;
1440 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1441 0 : err = fd_pubkey_account_pair_encode_global( &accounts[i], ctx );
1442 0 : if( FD_UNLIKELY( err ) ) return err;
1443 0 : }
1444 0 : }
1445 0 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1446 0 : if( FD_UNLIKELY( err ) ) return err;
1447 0 : if( self->native_instruction_processors_len ) {
1448 0 : uchar * native_instruction_processors_laddr = (uchar*)self + self->native_instruction_processors_offset;
1449 0 : fd_string_pubkey_pair_global_t * native_instruction_processors = (fd_string_pubkey_pair_global_t *)native_instruction_processors_laddr;
1450 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1451 0 : err = fd_string_pubkey_pair_encode_global( &native_instruction_processors[i], ctx );
1452 0 : if( FD_UNLIKELY( err ) ) return err;
1453 0 : }
1454 0 : }
1455 0 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1456 0 : if( FD_UNLIKELY( err ) ) return err;
1457 0 : if( self->rewards_pools_len ) {
1458 0 : uchar * rewards_pools_laddr = (uchar*)self + self->rewards_pools_offset;
1459 0 : fd_pubkey_account_pair_global_t * rewards_pools = (fd_pubkey_account_pair_global_t *)rewards_pools_laddr;
1460 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1461 0 : err = fd_pubkey_account_pair_encode_global( &rewards_pools[i], ctx );
1462 0 : if( FD_UNLIKELY( err ) ) return err;
1463 0 : }
1464 0 : }
1465 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1466 0 : if( FD_UNLIKELY( err ) ) return err;
1467 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
1468 0 : if( FD_UNLIKELY( err ) ) return err;
1469 0 : err = fd_poh_config_encode_global( &self->poh_config, ctx );
1470 0 : if( FD_UNLIKELY( err ) ) return err;
1471 0 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1472 0 : if( FD_UNLIKELY( err ) ) return err;
1473 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1474 0 : if( FD_UNLIKELY( err ) ) return err;
1475 0 : err = fd_rent_encode( &self->rent, ctx );
1476 0 : if( FD_UNLIKELY( err ) ) return err;
1477 0 : err = fd_inflation_encode( &self->inflation, ctx );
1478 0 : if( FD_UNLIKELY( err ) ) return err;
1479 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1480 0 : if( FD_UNLIKELY( err ) ) return err;
1481 0 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1482 0 : if( FD_UNLIKELY( err ) ) return err;
1483 0 : return FD_BINCODE_SUCCESS;
1484 0 : }
1485 0 : static int fd_genesis_solana_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1486 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1487 0 : int err = 0;
1488 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1489 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1490 0 : ulong accounts_len;
1491 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
1492 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1493 0 : if( accounts_len ) {
1494 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*accounts_len;
1495 0 : for( ulong i=0; i < accounts_len; i++ ) {
1496 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1497 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1498 0 : }
1499 0 : }
1500 0 : ulong native_instruction_processors_len;
1501 0 : err = fd_bincode_uint64_decode( &native_instruction_processors_len, ctx );
1502 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1503 0 : if( native_instruction_processors_len ) {
1504 0 : *total_sz += FD_STRING_PUBKEY_PAIR_ALIGN + sizeof(fd_string_pubkey_pair_t)*native_instruction_processors_len;
1505 0 : for( ulong i=0; i < native_instruction_processors_len; i++ ) {
1506 0 : err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
1507 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1508 0 : }
1509 0 : }
1510 0 : ulong rewards_pools_len;
1511 0 : err = fd_bincode_uint64_decode( &rewards_pools_len, ctx );
1512 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1513 0 : if( rewards_pools_len ) {
1514 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*rewards_pools_len;
1515 0 : for( ulong i=0; i < rewards_pools_len; i++ ) {
1516 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1517 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1518 0 : }
1519 0 : }
1520 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1521 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1522 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1523 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1524 0 : err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
1525 0 : if( FD_UNLIKELY( err ) ) return err;
1526 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1527 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1528 0 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
1529 0 : if( FD_UNLIKELY( err ) ) return err;
1530 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
1531 0 : if( FD_UNLIKELY( err ) ) return err;
1532 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
1533 0 : if( FD_UNLIKELY( err ) ) return err;
1534 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
1535 0 : if( FD_UNLIKELY( err ) ) return err;
1536 0 : err = fd_bincode_uint32_decode_footprint( ctx );
1537 0 : if( FD_UNLIKELY( err ) ) return err;
1538 0 : return 0;
1539 0 : }
1540 0 : int fd_genesis_solana_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1541 0 : *total_sz += sizeof(fd_genesis_solana_t);
1542 0 : void const * start_data = ctx->data;
1543 0 : int err = fd_genesis_solana_decode_footprint_inner( ctx, total_sz );
1544 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1545 0 : ctx->data = start_data;
1546 0 : return err;
1547 0 : }
1548 0 : static void fd_genesis_solana_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1549 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)struct_mem;
1550 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1551 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1552 0 : if( self->accounts_len ) {
1553 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1554 0 : self->accounts = *alloc_mem;
1555 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1556 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1557 0 : fd_pubkey_account_pair_new( self->accounts + i );
1558 0 : fd_pubkey_account_pair_decode_inner( self->accounts + i, alloc_mem, ctx );
1559 0 : }
1560 0 : } else
1561 0 : self->accounts = NULL;
1562 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1563 0 : if( self->native_instruction_processors_len ) {
1564 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1565 0 : self->native_instruction_processors = *alloc_mem;
1566 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1567 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1568 0 : fd_string_pubkey_pair_new( self->native_instruction_processors + i );
1569 0 : fd_string_pubkey_pair_decode_inner( self->native_instruction_processors + i, alloc_mem, ctx );
1570 0 : }
1571 0 : } else
1572 0 : self->native_instruction_processors = NULL;
1573 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
1574 0 : if( self->rewards_pools_len ) {
1575 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1576 0 : self->rewards_pools = *alloc_mem;
1577 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
1578 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1579 0 : fd_pubkey_account_pair_new( self->rewards_pools + i );
1580 0 : fd_pubkey_account_pair_decode_inner( self->rewards_pools + i, alloc_mem, ctx );
1581 0 : }
1582 0 : } else
1583 0 : self->rewards_pools = NULL;
1584 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
1585 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
1586 0 : fd_poh_config_decode_inner( &self->poh_config, alloc_mem, ctx );
1587 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
1588 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
1589 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1590 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
1591 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1592 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
1593 0 : }
1594 0 : void * fd_genesis_solana_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1595 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)mem;
1596 0 : fd_genesis_solana_new( self );
1597 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_t);
1598 0 : void * * alloc_mem = &alloc_region;
1599 0 : fd_genesis_solana_decode_inner( mem, alloc_mem, ctx );
1600 0 : return self;
1601 0 : }
1602 0 : static void fd_genesis_solana_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1603 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)struct_mem;
1604 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1605 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1606 0 : if( self->accounts_len ) {
1607 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1608 0 : self->accounts_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1609 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1610 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1611 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1612 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
1613 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
1614 0 : }
1615 0 : } else {
1616 0 : self->accounts_offset = 0UL;
1617 0 : }
1618 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1619 0 : if( self->native_instruction_processors_len ) {
1620 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1621 0 : self->native_instruction_processors_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1622 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1623 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1624 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1625 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)fd_type_pun(cur_mem + sizeof(fd_string_pubkey_pair_t) * i) );
1626 0 : fd_string_pubkey_pair_decode_inner_global( cur_mem + sizeof(fd_string_pubkey_pair_t) * i, alloc_mem, ctx );
1627 0 : }
1628 0 : } else {
1629 0 : self->native_instruction_processors_offset = 0UL;
1630 0 : }
1631 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
1632 0 : if( self->rewards_pools_len ) {
1633 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1634 0 : self->rewards_pools_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1635 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1636 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
1637 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1638 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
1639 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
1640 0 : }
1641 0 : } else {
1642 0 : self->rewards_pools_offset = 0UL;
1643 0 : }
1644 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
1645 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
1646 0 : fd_poh_config_decode_inner_global( &self->poh_config, alloc_mem, ctx );
1647 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
1648 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
1649 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1650 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
1651 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1652 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
1653 0 : }
1654 0 : void * fd_genesis_solana_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1655 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)mem;
1656 0 : fd_genesis_solana_new( (fd_genesis_solana_t *)self );
1657 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_global_t);
1658 0 : void * * alloc_mem = &alloc_region;
1659 0 : fd_genesis_solana_decode_inner_global( mem, alloc_mem, ctx );
1660 0 : return self;
1661 0 : }
1662 12 : void fd_genesis_solana_new(fd_genesis_solana_t * self) {
1663 12 : fd_memset( self, 0, sizeof(fd_genesis_solana_t) );
1664 12 : fd_poh_config_new( &self->poh_config );
1665 12 : fd_fee_rate_governor_new( &self->fee_rate_governor );
1666 12 : fd_rent_new( &self->rent );
1667 12 : fd_inflation_new( &self->inflation );
1668 12 : fd_epoch_schedule_new( &self->epoch_schedule );
1669 12 : }
1670 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 ) {
1671 0 : (void) varint;
1672 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_genesis_solana", level++, 0 );
1673 0 : fun( w, &self->creation_time, "creation_time", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1674 0 : if( self->accounts_len ) {
1675 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
1676 0 : for( ulong i=0; i < self->accounts_len; i++ )
1677 0 : fd_pubkey_account_pair_walk(w, self->accounts + i, fun, "pubkey_account_pair", level, 0 );
1678 0 : fun( w, NULL, "accounts", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
1679 0 : }
1680 0 : if( self->native_instruction_processors_len ) {
1681 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
1682 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
1683 0 : fd_string_pubkey_pair_walk(w, self->native_instruction_processors + i, fun, "string_pubkey_pair", level, 0 );
1684 0 : fun( w, NULL, "native_instruction_processors", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
1685 0 : }
1686 0 : if( self->rewards_pools_len ) {
1687 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
1688 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
1689 0 : fd_pubkey_account_pair_walk(w, self->rewards_pools + i, fun, "pubkey_account_pair", level, 0 );
1690 0 : fun( w, NULL, "rewards_pools", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
1691 0 : }
1692 0 : fun( w, &self->ticks_per_slot, "ticks_per_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1693 0 : fun( w, &self->unused, "unused", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1694 0 : fd_poh_config_walk( w, &self->poh_config, fun, "poh_config", level, 0 );
1695 0 : fun( w, &self->__backwards_compat_with_v0_23, "__backwards_compat_with_v0_23", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1696 0 : fd_fee_rate_governor_walk( w, &self->fee_rate_governor, fun, "fee_rate_governor", level, 0 );
1697 0 : fd_rent_walk( w, &self->rent, fun, "rent", level, 0 );
1698 0 : fd_inflation_walk( w, &self->inflation, fun, "inflation", level, 0 );
1699 0 : fd_epoch_schedule_walk( w, &self->epoch_schedule, fun, "epoch_schedule", level, 0 );
1700 0 : fun( w, &self->cluster_type, "cluster_type", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
1701 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_genesis_solana", level--, 0 );
1702 0 : }
1703 0 : ulong fd_genesis_solana_size( fd_genesis_solana_t const * self ) {
1704 0 : ulong size = 0;
1705 0 : size += sizeof(ulong);
1706 0 : do {
1707 0 : size += sizeof(ulong);
1708 0 : for( ulong i=0; i < self->accounts_len; i++ )
1709 0 : size += fd_pubkey_account_pair_size( self->accounts + i );
1710 0 : } while(0);
1711 0 : do {
1712 0 : size += sizeof(ulong);
1713 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
1714 0 : size += fd_string_pubkey_pair_size( self->native_instruction_processors + i );
1715 0 : } while(0);
1716 0 : do {
1717 0 : size += sizeof(ulong);
1718 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
1719 0 : size += fd_pubkey_account_pair_size( self->rewards_pools + i );
1720 0 : } while(0);
1721 0 : size += sizeof(ulong);
1722 0 : size += sizeof(ulong);
1723 0 : size += fd_poh_config_size( &self->poh_config );
1724 0 : size += sizeof(ulong);
1725 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
1726 0 : size += fd_rent_size( &self->rent );
1727 0 : size += fd_inflation_size( &self->inflation );
1728 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
1729 0 : size += sizeof(uint);
1730 0 : return size;
1731 0 : }
1732 :
1733 0 : ulong fd_genesis_solana_size_global( fd_genesis_solana_global_t const * self ) {
1734 0 : ulong size = 0;
1735 0 : size += sizeof(ulong);
1736 0 : do {
1737 0 : size += sizeof(ulong);
1738 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;
1739 0 : for( ulong i=0; i < self->accounts_len; i++ )
1740 0 : size += fd_pubkey_account_pair_size_global( accounts + i );
1741 0 : } while(0);
1742 0 : do {
1743 0 : size += sizeof(ulong);
1744 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;
1745 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
1746 0 : size += fd_string_pubkey_pair_size_global( native_instruction_processors + i );
1747 0 : } while(0);
1748 0 : do {
1749 0 : size += sizeof(ulong);
1750 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;
1751 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
1752 0 : size += fd_pubkey_account_pair_size_global( rewards_pools + i );
1753 0 : } while(0);
1754 0 : size += sizeof(ulong);
1755 0 : size += sizeof(ulong);
1756 0 : size += fd_poh_config_size_global( &self->poh_config );
1757 0 : size += sizeof(ulong);
1758 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
1759 0 : size += fd_rent_size( &self->rent );
1760 0 : size += fd_inflation_size( &self->inflation );
1761 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
1762 0 : size += sizeof(uint);
1763 0 : return size;
1764 0 : }
1765 :
1766 0 : int fd_sol_sysvar_clock_encode( fd_sol_sysvar_clock_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1767 0 : int err;
1768 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1769 0 : if( FD_UNLIKELY( err ) ) return err;
1770 0 : err = fd_bincode_uint64_encode( (ulong)self->epoch_start_timestamp, ctx );
1771 0 : if( FD_UNLIKELY( err ) ) return err;
1772 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1773 0 : if( FD_UNLIKELY( err ) ) return err;
1774 0 : err = fd_bincode_uint64_encode( self->leader_schedule_epoch, ctx );
1775 0 : if( FD_UNLIKELY( err ) ) return err;
1776 0 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
1777 0 : if( FD_UNLIKELY( err ) ) return err;
1778 0 : return FD_BINCODE_SUCCESS;
1779 0 : }
1780 0 : static inline int fd_sol_sysvar_clock_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1781 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1782 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
1783 0 : return 0;
1784 0 : }
1785 3 : static void fd_sol_sysvar_clock_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1786 3 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)struct_mem;
1787 3 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1788 3 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
1789 3 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1790 3 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
1791 3 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
1792 3 : }
1793 3 : void * fd_sol_sysvar_clock_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1794 3 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)mem;
1795 3 : fd_sol_sysvar_clock_new( self );
1796 3 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_clock_t);
1797 3 : void * * alloc_mem = &alloc_region;
1798 3 : fd_sol_sysvar_clock_decode_inner( mem, alloc_mem, ctx );
1799 3 : return self;
1800 3 : }
1801 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 ) {
1802 0 : (void) varint;
1803 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_clock", level++, 0 );
1804 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1805 0 : fun( w, &self->epoch_start_timestamp, "epoch_start_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
1806 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1807 0 : fun( w, &self->leader_schedule_epoch, "leader_schedule_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1808 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
1809 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_clock", level--, 0 );
1810 0 : }
1811 0 : int fd_sol_sysvar_last_restart_slot_encode( fd_sol_sysvar_last_restart_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1812 0 : int err;
1813 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1814 0 : if( FD_UNLIKELY( err ) ) return err;
1815 0 : return FD_BINCODE_SUCCESS;
1816 0 : }
1817 0 : static inline int fd_sol_sysvar_last_restart_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1818 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1819 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
1820 0 : return 0;
1821 0 : }
1822 0 : static void fd_sol_sysvar_last_restart_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1823 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)struct_mem;
1824 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1825 0 : }
1826 0 : void * fd_sol_sysvar_last_restart_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1827 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)mem;
1828 0 : fd_sol_sysvar_last_restart_slot_new( self );
1829 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_last_restart_slot_t);
1830 0 : void * * alloc_mem = &alloc_region;
1831 0 : fd_sol_sysvar_last_restart_slot_decode_inner( mem, alloc_mem, ctx );
1832 0 : return self;
1833 0 : }
1834 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 ) {
1835 0 : (void) varint;
1836 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sol_sysvar_last_restart_slot", level++, 0 );
1837 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1838 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sol_sysvar_last_restart_slot", level--, 0 );
1839 0 : }
1840 96 : int fd_vote_lockout_encode( fd_vote_lockout_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1841 96 : int err;
1842 96 : err = fd_bincode_uint64_encode( self->slot, ctx );
1843 96 : if( FD_UNLIKELY( err ) ) return err;
1844 96 : err = fd_bincode_uint32_encode( self->confirmation_count, ctx );
1845 96 : if( FD_UNLIKELY( err ) ) return err;
1846 96 : return FD_BINCODE_SUCCESS;
1847 96 : }
1848 0 : static inline int fd_vote_lockout_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1849 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1850 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
1851 0 : return 0;
1852 0 : }
1853 195 : static void fd_vote_lockout_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1854 195 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)struct_mem;
1855 195 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1856 195 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
1857 195 : }
1858 0 : void * fd_vote_lockout_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1859 0 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)mem;
1860 0 : fd_vote_lockout_new( self );
1861 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_lockout_t);
1862 0 : void * * alloc_mem = &alloc_region;
1863 0 : fd_vote_lockout_decode_inner( mem, alloc_mem, ctx );
1864 0 : return self;
1865 0 : }
1866 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 ) {
1867 99 : (void) varint;
1868 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_lockout", level++, 0 );
1869 99 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1870 99 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
1871 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_lockout", level--, 0 );
1872 99 : }
1873 0 : int fd_lockout_offset_encode( fd_lockout_offset_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1874 0 : int err;
1875 0 : err = fd_bincode_varint_encode( self->offset, ctx );
1876 0 : if( FD_UNLIKELY( err ) ) return err;
1877 0 : err = fd_bincode_uint8_encode( (uchar)(self->confirmation_count), ctx );
1878 0 : if( FD_UNLIKELY( err ) ) return err;
1879 0 : return FD_BINCODE_SUCCESS;
1880 0 : }
1881 0 : static int fd_lockout_offset_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1882 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1883 0 : int err = 0;
1884 0 : err = fd_bincode_varint_decode_footprint( ctx );
1885 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1886 0 : err = fd_bincode_uint8_decode_footprint( ctx );
1887 0 : if( FD_UNLIKELY( err ) ) return err;
1888 0 : return 0;
1889 0 : }
1890 0 : int fd_lockout_offset_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1891 0 : *total_sz += sizeof(fd_lockout_offset_t);
1892 0 : void const * start_data = ctx->data;
1893 0 : int err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
1894 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1895 0 : ctx->data = start_data;
1896 0 : return err;
1897 0 : }
1898 0 : static void fd_lockout_offset_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1899 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)struct_mem;
1900 0 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
1901 0 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
1902 0 : }
1903 0 : void * fd_lockout_offset_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1904 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)mem;
1905 0 : fd_lockout_offset_new( self );
1906 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockout_offset_t);
1907 0 : void * * alloc_mem = &alloc_region;
1908 0 : fd_lockout_offset_decode_inner( mem, alloc_mem, ctx );
1909 0 : return self;
1910 0 : }
1911 0 : void fd_lockout_offset_new(fd_lockout_offset_t * self) {
1912 0 : fd_memset( self, 0, sizeof(fd_lockout_offset_t) );
1913 0 : }
1914 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 ) {
1915 0 : (void) varint;
1916 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockout_offset", level++, 0 );
1917 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 1 );
1918 0 : fun( w, &self->confirmation_count, "confirmation_count", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
1919 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockout_offset", level--, 0 );
1920 0 : }
1921 0 : ulong fd_lockout_offset_size( fd_lockout_offset_t const * self ) {
1922 0 : ulong size = 0;
1923 0 : size += fd_bincode_varint_size( self->offset );
1924 0 : size += sizeof(char);
1925 0 : return size;
1926 0 : }
1927 :
1928 18 : int fd_vote_authorized_voter_encode( fd_vote_authorized_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1929 18 : int err;
1930 18 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1931 18 : if( FD_UNLIKELY( err ) ) return err;
1932 18 : err = fd_pubkey_encode( &self->pubkey, ctx );
1933 18 : if( FD_UNLIKELY( err ) ) return err;
1934 18 : return FD_BINCODE_SUCCESS;
1935 18 : }
1936 15 : static inline int fd_vote_authorized_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1937 15 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1938 15 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
1939 15 : return 0;
1940 15 : }
1941 15 : static void fd_vote_authorized_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1942 15 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)struct_mem;
1943 15 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1944 15 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1945 15 : }
1946 0 : void * fd_vote_authorized_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1947 0 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)mem;
1948 0 : fd_vote_authorized_voter_new( self );
1949 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voter_t);
1950 0 : void * * alloc_mem = &alloc_region;
1951 0 : fd_vote_authorized_voter_decode_inner( mem, alloc_mem, ctx );
1952 0 : return self;
1953 0 : }
1954 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 ) {
1955 9 : (void) varint;
1956 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voter", level++, 0 );
1957 9 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1958 9 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
1959 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voter", level--, 0 );
1960 9 : }
1961 576 : int fd_vote_prior_voter_encode( fd_vote_prior_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1962 576 : int err;
1963 576 : err = fd_pubkey_encode( &self->pubkey, ctx );
1964 576 : if( FD_UNLIKELY( err ) ) return err;
1965 576 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
1966 576 : if( FD_UNLIKELY( err ) ) return err;
1967 576 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
1968 576 : if( FD_UNLIKELY( err ) ) return err;
1969 576 : return FD_BINCODE_SUCCESS;
1970 576 : }
1971 480 : static inline int fd_vote_prior_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1972 480 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1973 480 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
1974 480 : return 0;
1975 480 : }
1976 480 : static void fd_vote_prior_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1977 480 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)struct_mem;
1978 480 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1979 480 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
1980 480 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
1981 480 : }
1982 0 : void * fd_vote_prior_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1983 0 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)mem;
1984 0 : fd_vote_prior_voter_new( self );
1985 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_t);
1986 0 : void * * alloc_mem = &alloc_region;
1987 0 : fd_vote_prior_voter_decode_inner( mem, alloc_mem, ctx );
1988 0 : return self;
1989 0 : }
1990 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 ) {
1991 288 : (void) varint;
1992 288 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter", level++, 0 );
1993 288 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
1994 288 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1995 288 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
1996 288 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter", level--, 0 );
1997 288 : }
1998 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 ) {
1999 0 : int err;
2000 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
2001 0 : if( FD_UNLIKELY( err ) ) return err;
2002 0 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
2003 0 : if( FD_UNLIKELY( err ) ) return err;
2004 0 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
2005 0 : if( FD_UNLIKELY( err ) ) return err;
2006 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
2007 0 : if( FD_UNLIKELY( err ) ) return err;
2008 0 : return FD_BINCODE_SUCCESS;
2009 0 : }
2010 0 : static inline int fd_vote_prior_voter_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2011 0 : if( (ulong)ctx->data + 56UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2012 0 : ctx->data = (void *)( (ulong)ctx->data + 56UL );
2013 0 : return 0;
2014 0 : }
2015 0 : static void fd_vote_prior_voter_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2016 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)struct_mem;
2017 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
2018 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
2019 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
2020 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2021 0 : }
2022 0 : void * fd_vote_prior_voter_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2023 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)mem;
2024 0 : fd_vote_prior_voter_0_23_5_new( self );
2025 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_0_23_5_t);
2026 0 : void * * alloc_mem = &alloc_region;
2027 0 : fd_vote_prior_voter_0_23_5_decode_inner( mem, alloc_mem, ctx );
2028 0 : return self;
2029 0 : }
2030 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 ) {
2031 0 : (void) varint;
2032 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voter_0_23_5", level++, 0 );
2033 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
2034 0 : fun( w, &self->epoch_start, "epoch_start", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2035 0 : fun( w, &self->epoch_end, "epoch_end", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2036 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2037 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voter_0_23_5", level--, 0 );
2038 0 : }
2039 195 : int fd_vote_epoch_credits_encode( fd_vote_epoch_credits_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2040 195 : int err;
2041 195 : err = fd_bincode_uint64_encode( self->epoch, ctx );
2042 195 : if( FD_UNLIKELY( err ) ) return err;
2043 195 : err = fd_bincode_uint64_encode( self->credits, ctx );
2044 195 : if( FD_UNLIKELY( err ) ) return err;
2045 195 : err = fd_bincode_uint64_encode( self->prev_credits, ctx );
2046 195 : if( FD_UNLIKELY( err ) ) return err;
2047 195 : return FD_BINCODE_SUCCESS;
2048 195 : }
2049 0 : static inline int fd_vote_epoch_credits_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2050 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2051 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
2052 0 : return 0;
2053 0 : }
2054 393 : static void fd_vote_epoch_credits_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2055 393 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)struct_mem;
2056 393 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
2057 393 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
2058 393 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
2059 393 : }
2060 0 : void * fd_vote_epoch_credits_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2061 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)mem;
2062 0 : fd_vote_epoch_credits_new( self );
2063 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_epoch_credits_t);
2064 0 : void * * alloc_mem = &alloc_region;
2065 0 : fd_vote_epoch_credits_decode_inner( mem, alloc_mem, ctx );
2066 0 : return self;
2067 0 : }
2068 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 ) {
2069 198 : (void) varint;
2070 198 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_epoch_credits", level++, 0 );
2071 198 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2072 198 : fun( w, &self->credits, "credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2073 198 : fun( w, &self->prev_credits, "prev_credits", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2074 198 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_epoch_credits", level--, 0 );
2075 198 : }
2076 18 : int fd_vote_block_timestamp_encode( fd_vote_block_timestamp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2077 18 : int err;
2078 18 : err = fd_bincode_uint64_encode( self->slot, ctx );
2079 18 : if( FD_UNLIKELY( err ) ) return err;
2080 18 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
2081 18 : if( FD_UNLIKELY( err ) ) return err;
2082 18 : return FD_BINCODE_SUCCESS;
2083 18 : }
2084 15 : static inline int fd_vote_block_timestamp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2085 15 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2086 15 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
2087 15 : return 0;
2088 15 : }
2089 15 : static void fd_vote_block_timestamp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2090 15 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)struct_mem;
2091 15 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
2092 15 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
2093 15 : }
2094 0 : void * fd_vote_block_timestamp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2095 0 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)mem;
2096 0 : fd_vote_block_timestamp_new( self );
2097 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_block_timestamp_t);
2098 0 : void * * alloc_mem = &alloc_region;
2099 0 : fd_vote_block_timestamp_decode_inner( mem, alloc_mem, ctx );
2100 0 : return self;
2101 0 : }
2102 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 ) {
2103 9 : (void) varint;
2104 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_block_timestamp", level++, 0 );
2105 9 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2106 9 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
2107 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_block_timestamp", level--, 0 );
2108 9 : }
2109 18 : int fd_vote_prior_voters_encode( fd_vote_prior_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2110 18 : int err;
2111 594 : for( ulong i=0; i<32; i++ ) {
2112 576 : err = fd_vote_prior_voter_encode( self->buf + i, ctx );
2113 576 : if( FD_UNLIKELY( err ) ) return err;
2114 576 : }
2115 18 : err = fd_bincode_uint64_encode( self->idx, ctx );
2116 18 : if( FD_UNLIKELY( err ) ) return err;
2117 18 : err = fd_bincode_bool_encode( (uchar)(self->is_empty), ctx );
2118 18 : if( FD_UNLIKELY( err ) ) return err;
2119 18 : return FD_BINCODE_SUCCESS;
2120 18 : }
2121 15 : static int fd_vote_prior_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2122 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2123 15 : int err = 0;
2124 495 : for( ulong i=0; i<32; i++ ) {
2125 480 : err = fd_vote_prior_voter_decode_footprint_inner( ctx, total_sz );
2126 480 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2127 480 : }
2128 15 : err = fd_bincode_uint64_decode_footprint( ctx );
2129 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2130 15 : err = fd_bincode_bool_decode_footprint( ctx );
2131 15 : if( FD_UNLIKELY( err ) ) return err;
2132 15 : return 0;
2133 15 : }
2134 0 : int fd_vote_prior_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2135 0 : *total_sz += sizeof(fd_vote_prior_voters_t);
2136 0 : void const * start_data = ctx->data;
2137 0 : int err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2138 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2139 0 : ctx->data = start_data;
2140 0 : return err;
2141 0 : }
2142 15 : static void fd_vote_prior_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2143 15 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)struct_mem;
2144 495 : for( ulong i=0; i<32; i++ ) {
2145 480 : fd_vote_prior_voter_decode_inner( self->buf + i, alloc_mem, ctx );
2146 480 : }
2147 15 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
2148 15 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
2149 15 : }
2150 0 : void * fd_vote_prior_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2151 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)mem;
2152 0 : fd_vote_prior_voters_new( self );
2153 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_t);
2154 0 : void * * alloc_mem = &alloc_region;
2155 0 : fd_vote_prior_voters_decode_inner( mem, alloc_mem, ctx );
2156 0 : return self;
2157 0 : }
2158 12 : void fd_vote_prior_voters_new(fd_vote_prior_voters_t * self) {
2159 12 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_t) );
2160 396 : for( ulong i=0; i<32; i++ )
2161 384 : fd_vote_prior_voter_new( self->buf + i );
2162 12 : }
2163 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 ) {
2164 9 : (void) varint;
2165 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters", level++, 0 );
2166 9 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter[]", level++, 0 );
2167 297 : for( ulong i=0; i<32; i++ )
2168 288 : fd_vote_prior_voter_walk( w, self->buf + i, fun, "vote_prior_voter", level, 0 );
2169 9 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter[]", level--, 0 );
2170 9 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2171 9 : fun( w, &self->is_empty, "is_empty", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
2172 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters", level--, 0 );
2173 9 : }
2174 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 ) {
2175 0 : int err;
2176 0 : for( ulong i=0; i<32; i++ ) {
2177 0 : err = fd_vote_prior_voter_0_23_5_encode( self->buf + i, ctx );
2178 0 : if( FD_UNLIKELY( err ) ) return err;
2179 0 : }
2180 0 : err = fd_bincode_uint64_encode( self->idx, ctx );
2181 0 : if( FD_UNLIKELY( err ) ) return err;
2182 0 : return FD_BINCODE_SUCCESS;
2183 0 : }
2184 0 : static inline int fd_vote_prior_voters_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2185 0 : if( (ulong)ctx->data + 1800UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2186 0 : ctx->data = (void *)( (ulong)ctx->data + 1800UL );
2187 0 : return 0;
2188 0 : }
2189 0 : static void fd_vote_prior_voters_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2190 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)struct_mem;
2191 0 : for( ulong i=0; i<32; i++ ) {
2192 0 : fd_vote_prior_voter_0_23_5_decode_inner( self->buf + i, alloc_mem, ctx );
2193 0 : }
2194 0 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
2195 0 : }
2196 0 : void * fd_vote_prior_voters_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2197 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)mem;
2198 0 : fd_vote_prior_voters_0_23_5_new( self );
2199 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_0_23_5_t);
2200 0 : void * * alloc_mem = &alloc_region;
2201 0 : fd_vote_prior_voters_0_23_5_decode_inner( mem, alloc_mem, ctx );
2202 0 : return self;
2203 0 : }
2204 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 ) {
2205 0 : (void) varint;
2206 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_prior_voters_0_23_5", level++, 0 );
2207 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR, "vote_prior_voter_0_23_5[]", level++, 0 );
2208 0 : for( ulong i=0; i<32; i++ )
2209 0 : fd_vote_prior_voter_0_23_5_walk( w, self->buf + i, fun, "vote_prior_voter_0_23_5", level, 0 );
2210 0 : fun( w, NULL, "buf", FD_FLAMENCO_TYPE_ARR_END, "vote_prior_voter_0_23_5[]", level--, 0 );
2211 0 : fun( w, &self->idx, "idx", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2212 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_prior_voters_0_23_5", level--, 0 );
2213 0 : }
2214 96 : int fd_landed_vote_encode( fd_landed_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2215 96 : int err;
2216 96 : err = fd_bincode_uint8_encode( (uchar)(self->latency), ctx );
2217 96 : if( FD_UNLIKELY( err ) ) return err;
2218 96 : err = fd_vote_lockout_encode( &self->lockout, ctx );
2219 96 : if( FD_UNLIKELY( err ) ) return err;
2220 96 : return FD_BINCODE_SUCCESS;
2221 96 : }
2222 0 : static inline int fd_landed_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2223 0 : if( (ulong)ctx->data + 13UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2224 0 : ctx->data = (void *)( (ulong)ctx->data + 13UL );
2225 0 : return 0;
2226 0 : }
2227 195 : static void fd_landed_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2228 195 : fd_landed_vote_t * self = (fd_landed_vote_t *)struct_mem;
2229 195 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
2230 195 : fd_vote_lockout_decode_inner( &self->lockout, alloc_mem, ctx );
2231 195 : }
2232 0 : void * fd_landed_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2233 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)mem;
2234 0 : fd_landed_vote_new( self );
2235 0 : void * alloc_region = (uchar *)mem + sizeof(fd_landed_vote_t);
2236 0 : void * * alloc_mem = &alloc_region;
2237 0 : fd_landed_vote_decode_inner( mem, alloc_mem, ctx );
2238 0 : return self;
2239 0 : }
2240 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 ) {
2241 99 : (void) varint;
2242 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_landed_vote", level++, 0 );
2243 99 : fun( w, &self->latency, "latency", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2244 99 : fd_vote_lockout_walk( w, &self->lockout, fun, "lockout", level, 0 );
2245 99 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_landed_vote", level--, 0 );
2246 99 : }
2247 0 : int fd_vote_state_0_23_5_encode( fd_vote_state_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2248 0 : int err;
2249 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2250 0 : if( FD_UNLIKELY( err ) ) return err;
2251 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
2252 0 : if( FD_UNLIKELY( err ) ) return err;
2253 0 : err = fd_bincode_uint64_encode( self->authorized_voter_epoch, ctx );
2254 0 : if( FD_UNLIKELY( err ) ) return err;
2255 0 : err = fd_vote_prior_voters_0_23_5_encode( &self->prior_voters, ctx );
2256 0 : if( FD_UNLIKELY( err ) ) return err;
2257 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2258 0 : if( FD_UNLIKELY( err ) ) return err;
2259 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2260 0 : if( FD_UNLIKELY( err ) ) return err;
2261 0 : if( self->votes ) {
2262 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
2263 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2264 0 : if( FD_UNLIKELY( err ) ) return err;
2265 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 ) ) {
2266 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
2267 0 : err = fd_vote_lockout_encode( ele, ctx );
2268 0 : if( FD_UNLIKELY( err ) ) return err;
2269 0 : }
2270 0 : } else {
2271 0 : ulong votes_len = 0;
2272 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2273 0 : if( FD_UNLIKELY( err ) ) return err;
2274 0 : }
2275 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2276 0 : if( FD_UNLIKELY( err ) ) return err;
2277 0 : if( self->has_root_slot ) {
2278 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2279 0 : if( FD_UNLIKELY( err ) ) return err;
2280 0 : }
2281 0 : if( self->epoch_credits ) {
2282 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2283 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2284 0 : if( FD_UNLIKELY( err ) ) return err;
2285 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 ) ) {
2286 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2287 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2288 0 : if( FD_UNLIKELY( err ) ) return err;
2289 0 : }
2290 0 : } else {
2291 0 : ulong epoch_credits_len = 0;
2292 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2293 0 : if( FD_UNLIKELY( err ) ) return err;
2294 0 : }
2295 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2296 0 : if( FD_UNLIKELY( err ) ) return err;
2297 0 : return FD_BINCODE_SUCCESS;
2298 0 : }
2299 0 : static int fd_vote_state_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2300 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2301 0 : int err = 0;
2302 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2303 0 : if( FD_UNLIKELY( err ) ) return err;
2304 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2305 0 : if( FD_UNLIKELY( err ) ) return err;
2306 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2307 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2308 0 : err = fd_vote_prior_voters_0_23_5_decode_footprint_inner( ctx, total_sz );
2309 0 : if( FD_UNLIKELY( err ) ) return err;
2310 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2311 0 : if( FD_UNLIKELY( err ) ) return err;
2312 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2313 0 : if( FD_UNLIKELY( err ) ) return err;
2314 0 : ulong votes_len;
2315 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2316 0 : if( FD_UNLIKELY( err ) ) return err;
2317 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2318 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
2319 0 : ulong votes_sz;
2320 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2321 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2322 0 : if( FD_UNLIKELY( err ) ) return err;
2323 0 : {
2324 0 : uchar o;
2325 0 : err = fd_bincode_bool_decode( &o, ctx );
2326 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2327 0 : if( o ) {
2328 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2329 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2330 0 : }
2331 0 : }
2332 0 : ulong epoch_credits_len;
2333 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2334 0 : if( FD_UNLIKELY( err ) ) return err;
2335 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2336 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2337 0 : ulong epoch_credits_sz;
2338 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2339 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2340 0 : if( FD_UNLIKELY( err ) ) return err;
2341 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2342 0 : if( FD_UNLIKELY( err ) ) return err;
2343 0 : return 0;
2344 0 : }
2345 0 : int fd_vote_state_0_23_5_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2346 0 : *total_sz += sizeof(fd_vote_state_0_23_5_t);
2347 0 : void const * start_data = ctx->data;
2348 0 : int err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
2349 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2350 0 : ctx->data = start_data;
2351 0 : return err;
2352 0 : }
2353 0 : static void fd_vote_state_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2354 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)struct_mem;
2355 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2356 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
2357 0 : fd_bincode_uint64_decode_unsafe( &self->authorized_voter_epoch, ctx );
2358 0 : fd_vote_prior_voters_0_23_5_decode_inner( &self->prior_voters, alloc_mem, ctx );
2359 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2360 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2361 0 : ulong votes_len;
2362 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2363 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2364 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
2365 0 : for( ulong i=0; i < votes_len; i++ ) {
2366 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
2367 0 : fd_vote_lockout_new( elem );
2368 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
2369 0 : }
2370 0 : {
2371 0 : uchar o;
2372 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2373 0 : self->has_root_slot = !!o;
2374 0 : if( o ) {
2375 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2376 0 : }
2377 0 : }
2378 0 : ulong epoch_credits_len;
2379 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2380 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2381 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2382 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2383 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2384 0 : fd_vote_epoch_credits_new( elem );
2385 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2386 0 : }
2387 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2388 0 : }
2389 0 : void * fd_vote_state_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2390 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)mem;
2391 0 : fd_vote_state_0_23_5_new( self );
2392 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_0_23_5_t);
2393 0 : void * * alloc_mem = &alloc_region;
2394 0 : fd_vote_state_0_23_5_decode_inner( mem, alloc_mem, ctx );
2395 0 : return self;
2396 0 : }
2397 0 : void fd_vote_state_0_23_5_new(fd_vote_state_0_23_5_t * self) {
2398 0 : fd_memset( self, 0, sizeof(fd_vote_state_0_23_5_t) );
2399 0 : fd_pubkey_new( &self->node_pubkey );
2400 0 : fd_pubkey_new( &self->authorized_voter );
2401 0 : fd_vote_prior_voters_0_23_5_new( &self->prior_voters );
2402 0 : fd_pubkey_new( &self->authorized_withdrawer );
2403 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2404 0 : }
2405 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 ) {
2406 0 : (void) varint;
2407 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_0_23_5", level++, 0 );
2408 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
2409 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level, 0 );
2410 0 : fun( w, &self->authorized_voter_epoch, "authorized_voter_epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2411 0 : fd_vote_prior_voters_0_23_5_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
2412 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
2413 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2414 :
2415 : /* Walk deque */
2416 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
2417 0 : if( self->votes ) {
2418 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
2419 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
2420 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
2421 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2422 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level, 0 );
2423 0 : }
2424 0 : }
2425 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
2426 : /* Done walking deque */
2427 :
2428 0 : if( !self->has_root_slot ) {
2429 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
2430 0 : } else {
2431 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2432 0 : }
2433 :
2434 : /* Walk deque */
2435 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
2436 0 : if( self->epoch_credits ) {
2437 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
2438 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
2439 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
2440 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2441 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
2442 0 : }
2443 0 : }
2444 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
2445 : /* Done walking deque */
2446 :
2447 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
2448 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_0_23_5", level--, 0 );
2449 0 : }
2450 0 : ulong fd_vote_state_0_23_5_size( fd_vote_state_0_23_5_t const * self ) {
2451 0 : ulong size = 0;
2452 0 : size += fd_pubkey_size( &self->node_pubkey );
2453 0 : size += fd_pubkey_size( &self->authorized_voter );
2454 0 : size += sizeof(ulong);
2455 0 : size += fd_vote_prior_voters_0_23_5_size( &self->prior_voters );
2456 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
2457 0 : size += sizeof(char);
2458 0 : if( self->votes ) {
2459 0 : size += sizeof(ulong);
2460 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 ) ) {
2461 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2462 0 : size += fd_vote_lockout_size( ele );
2463 0 : }
2464 0 : } else {
2465 0 : size += sizeof(ulong);
2466 0 : }
2467 0 : size += sizeof(char);
2468 0 : if( self->has_root_slot ) {
2469 0 : size += sizeof(ulong);
2470 0 : }
2471 0 : if( self->epoch_credits ) {
2472 0 : size += sizeof(ulong);
2473 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 ) ) {
2474 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2475 0 : size += fd_vote_epoch_credits_size( ele );
2476 0 : }
2477 0 : } else {
2478 0 : size += sizeof(ulong);
2479 0 : }
2480 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2481 0 : return size;
2482 0 : }
2483 :
2484 18 : int fd_vote_authorized_voters_encode( fd_vote_authorized_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2485 18 : int err;
2486 18 : if( self->treap ) {
2487 18 : ulong fd_vote_authorized_voters_len = fd_vote_authorized_voters_treap_ele_cnt( self->treap );
2488 18 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2489 18 : if( FD_UNLIKELY( err ) ) return err;
2490 18 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2491 36 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2492 18 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2493 18 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2494 18 : err = fd_vote_authorized_voter_encode( ele, ctx );
2495 18 : if( FD_UNLIKELY( err ) ) return err;
2496 18 : }
2497 18 : } else {
2498 0 : ulong fd_vote_authorized_voters_len = 0;
2499 0 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2500 0 : if( FD_UNLIKELY( err ) ) return err;
2501 0 : }
2502 18 : return FD_BINCODE_SUCCESS;
2503 18 : }
2504 15 : static int fd_vote_authorized_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2505 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2506 15 : int err = 0;
2507 15 : ulong fd_vote_authorized_voters_treap_len;
2508 15 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
2509 15 : if( FD_UNLIKELY( err ) ) return err;
2510 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 );
2511 15 : *total_sz += fd_vote_authorized_voters_pool_align() + fd_vote_authorized_voters_pool_footprint( fd_vote_authorized_voters_treap_max );
2512 15 : *total_sz += fd_vote_authorized_voters_treap_align() + fd_vote_authorized_voters_treap_footprint( fd_vote_authorized_voters_treap_max );
2513 30 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2514 15 : err = fd_vote_authorized_voter_decode_footprint_inner( ctx, total_sz );
2515 15 : if( FD_UNLIKELY ( err ) ) return err;
2516 15 : }
2517 15 : return 0;
2518 15 : }
2519 0 : int fd_vote_authorized_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2520 0 : *total_sz += sizeof(fd_vote_authorized_voters_t);
2521 0 : void const * start_data = ctx->data;
2522 0 : int err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2523 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2524 0 : ctx->data = start_data;
2525 0 : return err;
2526 0 : }
2527 15 : static void fd_vote_authorized_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2528 15 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)struct_mem;
2529 15 : ulong fd_vote_authorized_voters_treap_len;
2530 15 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
2531 15 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
2532 15 : self->pool = fd_vote_authorized_voters_pool_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2533 15 : self->treap = fd_vote_authorized_voters_treap_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2534 30 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2535 15 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( self->pool );
2536 15 : fd_vote_authorized_voter_new( ele );
2537 15 : fd_vote_authorized_voter_decode_inner( ele, alloc_mem, ctx );
2538 15 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( self->treap, ele->epoch, self->pool );
2539 15 : if( repeated_entry ) {
2540 0 : fd_vote_authorized_voters_treap_ele_remove( self->treap, repeated_entry, self->pool ); // Remove the element before inserting it back to avoid duplication
2541 0 : fd_vote_authorized_voters_pool_ele_release( self->pool, repeated_entry );
2542 0 : }
2543 15 : fd_vote_authorized_voters_treap_ele_insert( self->treap, ele, self->pool ); /* this cannot fail */
2544 15 : }
2545 15 : }
2546 0 : void * fd_vote_authorized_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2547 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)mem;
2548 0 : fd_vote_authorized_voters_new( self );
2549 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voters_t);
2550 0 : void * * alloc_mem = &alloc_region;
2551 0 : fd_vote_authorized_voters_decode_inner( mem, alloc_mem, ctx );
2552 0 : return self;
2553 0 : }
2554 12 : void fd_vote_authorized_voters_new(fd_vote_authorized_voters_t * self) {
2555 12 : fd_memset( self, 0, sizeof(fd_vote_authorized_voters_t) );
2556 12 : }
2557 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 ) {
2558 9 : (void) varint;
2559 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorized_voters", level++, 0 );
2560 9 : if( self->treap ) {
2561 9 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2562 18 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2563 9 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2564 9 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2565 9 : fd_vote_authorized_voter_walk( w, ele, fun, "fd_vote_authorized_voter_t", level, 0 );
2566 9 : }
2567 9 : }
2568 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorized_voters", level--, 0 );
2569 9 : }
2570 0 : ulong fd_vote_authorized_voters_size( fd_vote_authorized_voters_t const * self ) {
2571 0 : ulong size = 0;
2572 0 : size += sizeof(ulong);
2573 0 : if( self->treap ) {
2574 0 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2575 0 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2576 0 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2577 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2578 0 : size += fd_vote_authorized_voter_size( ele );
2579 0 : }
2580 0 : }
2581 0 : return size;
2582 0 : }
2583 :
2584 0 : int fd_vote_state_1_14_11_encode( fd_vote_state_1_14_11_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2585 0 : int err;
2586 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2587 0 : if( FD_UNLIKELY( err ) ) return err;
2588 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2589 0 : if( FD_UNLIKELY( err ) ) return err;
2590 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2591 0 : if( FD_UNLIKELY( err ) ) return err;
2592 0 : if( self->votes ) {
2593 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
2594 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2595 0 : if( FD_UNLIKELY( err ) ) return err;
2596 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 ) ) {
2597 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
2598 0 : err = fd_vote_lockout_encode( ele, ctx );
2599 0 : if( FD_UNLIKELY( err ) ) return err;
2600 0 : }
2601 0 : } else {
2602 0 : ulong votes_len = 0;
2603 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2604 0 : if( FD_UNLIKELY( err ) ) return err;
2605 0 : }
2606 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2607 0 : if( FD_UNLIKELY( err ) ) return err;
2608 0 : if( self->has_root_slot ) {
2609 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2610 0 : if( FD_UNLIKELY( err ) ) return err;
2611 0 : }
2612 0 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2613 0 : if( FD_UNLIKELY( err ) ) return err;
2614 0 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
2615 0 : if( FD_UNLIKELY( err ) ) return err;
2616 0 : if( self->epoch_credits ) {
2617 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2618 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2619 0 : if( FD_UNLIKELY( err ) ) return err;
2620 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 ) ) {
2621 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2622 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2623 0 : if( FD_UNLIKELY( err ) ) return err;
2624 0 : }
2625 0 : } else {
2626 0 : ulong epoch_credits_len = 0;
2627 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2628 0 : if( FD_UNLIKELY( err ) ) return err;
2629 0 : }
2630 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2631 0 : if( FD_UNLIKELY( err ) ) return err;
2632 0 : return FD_BINCODE_SUCCESS;
2633 0 : }
2634 0 : static int fd_vote_state_1_14_11_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2635 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2636 0 : int err = 0;
2637 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2638 0 : if( FD_UNLIKELY( err ) ) return err;
2639 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2640 0 : if( FD_UNLIKELY( err ) ) return err;
2641 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2642 0 : if( FD_UNLIKELY( err ) ) return err;
2643 0 : ulong votes_len;
2644 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2645 0 : if( FD_UNLIKELY( err ) ) return err;
2646 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2647 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
2648 0 : ulong votes_sz;
2649 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2650 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2651 0 : if( FD_UNLIKELY( err ) ) return err;
2652 0 : {
2653 0 : uchar o;
2654 0 : err = fd_bincode_bool_decode( &o, ctx );
2655 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2656 0 : if( o ) {
2657 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2658 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2659 0 : }
2660 0 : }
2661 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2662 0 : if( FD_UNLIKELY( err ) ) return err;
2663 0 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2664 0 : if( FD_UNLIKELY( err ) ) return err;
2665 0 : ulong epoch_credits_len;
2666 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2667 0 : if( FD_UNLIKELY( err ) ) return err;
2668 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2669 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2670 0 : ulong epoch_credits_sz;
2671 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2672 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2673 0 : if( FD_UNLIKELY( err ) ) return err;
2674 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2675 0 : if( FD_UNLIKELY( err ) ) return err;
2676 0 : return 0;
2677 0 : }
2678 0 : int fd_vote_state_1_14_11_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2679 0 : *total_sz += sizeof(fd_vote_state_1_14_11_t);
2680 0 : void const * start_data = ctx->data;
2681 0 : int err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
2682 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2683 0 : ctx->data = start_data;
2684 0 : return err;
2685 0 : }
2686 0 : static void fd_vote_state_1_14_11_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2687 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)struct_mem;
2688 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2689 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2690 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2691 0 : ulong votes_len;
2692 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2693 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2694 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
2695 0 : for( ulong i=0; i < votes_len; i++ ) {
2696 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
2697 0 : fd_vote_lockout_new( elem );
2698 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
2699 0 : }
2700 0 : {
2701 0 : uchar o;
2702 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2703 0 : self->has_root_slot = !!o;
2704 0 : if( o ) {
2705 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2706 0 : }
2707 0 : }
2708 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2709 0 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
2710 0 : ulong epoch_credits_len;
2711 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2712 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2713 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2714 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2715 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2716 0 : fd_vote_epoch_credits_new( elem );
2717 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2718 0 : }
2719 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2720 0 : }
2721 0 : void * fd_vote_state_1_14_11_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2722 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)mem;
2723 0 : fd_vote_state_1_14_11_new( self );
2724 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_1_14_11_t);
2725 0 : void * * alloc_mem = &alloc_region;
2726 0 : fd_vote_state_1_14_11_decode_inner( mem, alloc_mem, ctx );
2727 0 : return self;
2728 0 : }
2729 0 : void fd_vote_state_1_14_11_new(fd_vote_state_1_14_11_t * self) {
2730 0 : fd_memset( self, 0, sizeof(fd_vote_state_1_14_11_t) );
2731 0 : fd_pubkey_new( &self->node_pubkey );
2732 0 : fd_pubkey_new( &self->authorized_withdrawer );
2733 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
2734 0 : fd_vote_prior_voters_new( &self->prior_voters );
2735 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2736 0 : }
2737 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 ) {
2738 0 : (void) varint;
2739 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_1_14_11", level++, 0 );
2740 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
2741 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
2742 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2743 :
2744 : /* Walk deque */
2745 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
2746 0 : if( self->votes ) {
2747 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->votes );
2748 0 : !deq_fd_vote_lockout_t_iter_done( self->votes, iter );
2749 0 : iter = deq_fd_vote_lockout_t_iter_next( self->votes, iter ) ) {
2750 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2751 0 : fd_vote_lockout_walk(w, ele, fun, "votes", level, 0 );
2752 0 : }
2753 0 : }
2754 0 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
2755 : /* Done walking deque */
2756 :
2757 0 : if( !self->has_root_slot ) {
2758 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
2759 0 : } else {
2760 0 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2761 0 : }
2762 0 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level, 0 );
2763 0 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
2764 :
2765 : /* Walk deque */
2766 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
2767 0 : if( self->epoch_credits ) {
2768 0 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
2769 0 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
2770 0 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
2771 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2772 0 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
2773 0 : }
2774 0 : }
2775 0 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
2776 : /* Done walking deque */
2777 :
2778 0 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
2779 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_1_14_11", level--, 0 );
2780 0 : }
2781 0 : ulong fd_vote_state_1_14_11_size( fd_vote_state_1_14_11_t const * self ) {
2782 0 : ulong size = 0;
2783 0 : size += fd_pubkey_size( &self->node_pubkey );
2784 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
2785 0 : size += sizeof(char);
2786 0 : if( self->votes ) {
2787 0 : size += sizeof(ulong);
2788 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 ) ) {
2789 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2790 0 : size += fd_vote_lockout_size( ele );
2791 0 : }
2792 0 : } else {
2793 0 : size += sizeof(ulong);
2794 0 : }
2795 0 : size += sizeof(char);
2796 0 : if( self->has_root_slot ) {
2797 0 : size += sizeof(ulong);
2798 0 : }
2799 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2800 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
2801 0 : if( self->epoch_credits ) {
2802 0 : size += sizeof(ulong);
2803 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 ) ) {
2804 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2805 0 : size += fd_vote_epoch_credits_size( ele );
2806 0 : }
2807 0 : } else {
2808 0 : size += sizeof(ulong);
2809 0 : }
2810 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2811 0 : return size;
2812 0 : }
2813 :
2814 18 : int fd_vote_state_encode( fd_vote_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2815 18 : int err;
2816 18 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2817 18 : if( FD_UNLIKELY( err ) ) return err;
2818 18 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2819 18 : if( FD_UNLIKELY( err ) ) return err;
2820 18 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2821 18 : if( FD_UNLIKELY( err ) ) return err;
2822 18 : if( self->votes ) {
2823 6 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
2824 6 : err = fd_bincode_uint64_encode( votes_len, ctx );
2825 6 : if( FD_UNLIKELY( err ) ) return err;
2826 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 ) ) {
2827 96 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
2828 96 : err = fd_landed_vote_encode( ele, ctx );
2829 96 : if( FD_UNLIKELY( err ) ) return err;
2830 96 : }
2831 12 : } else {
2832 12 : ulong votes_len = 0;
2833 12 : err = fd_bincode_uint64_encode( votes_len, ctx );
2834 12 : if( FD_UNLIKELY( err ) ) return err;
2835 12 : }
2836 18 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2837 18 : if( FD_UNLIKELY( err ) ) return err;
2838 18 : if( self->has_root_slot ) {
2839 6 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2840 6 : if( FD_UNLIKELY( err ) ) return err;
2841 6 : }
2842 18 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2843 18 : if( FD_UNLIKELY( err ) ) return err;
2844 18 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
2845 18 : if( FD_UNLIKELY( err ) ) return err;
2846 18 : if( self->epoch_credits ) {
2847 6 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2848 6 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2849 6 : if( FD_UNLIKELY( err ) ) return err;
2850 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 ) ) {
2851 195 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2852 195 : err = fd_vote_epoch_credits_encode( ele, ctx );
2853 195 : if( FD_UNLIKELY( err ) ) return err;
2854 195 : }
2855 12 : } else {
2856 12 : ulong epoch_credits_len = 0;
2857 12 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2858 12 : if( FD_UNLIKELY( err ) ) return err;
2859 12 : }
2860 18 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2861 18 : if( FD_UNLIKELY( err ) ) return err;
2862 18 : return FD_BINCODE_SUCCESS;
2863 18 : }
2864 15 : static int fd_vote_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2865 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2866 15 : int err = 0;
2867 15 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2868 15 : if( FD_UNLIKELY( err ) ) return err;
2869 15 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2870 15 : if( FD_UNLIKELY( err ) ) return err;
2871 15 : err = fd_bincode_uint8_decode_footprint( ctx );
2872 15 : if( FD_UNLIKELY( err ) ) return err;
2873 15 : ulong votes_len;
2874 15 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2875 15 : if( FD_UNLIKELY( err ) ) return err;
2876 15 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2877 15 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
2878 15 : ulong votes_sz;
2879 15 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2880 15 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2881 15 : if( FD_UNLIKELY( err ) ) return err;
2882 15 : {
2883 15 : uchar o;
2884 15 : err = fd_bincode_bool_decode( &o, ctx );
2885 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2886 15 : if( o ) {
2887 15 : err = fd_bincode_uint64_decode_footprint( ctx );
2888 15 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2889 15 : }
2890 15 : }
2891 15 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2892 15 : if( FD_UNLIKELY( err ) ) return err;
2893 15 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2894 15 : if( FD_UNLIKELY( err ) ) return err;
2895 15 : ulong epoch_credits_len;
2896 15 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2897 15 : if( FD_UNLIKELY( err ) ) return err;
2898 15 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2899 15 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2900 15 : ulong epoch_credits_sz;
2901 15 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2902 15 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2903 15 : if( FD_UNLIKELY( err ) ) return err;
2904 15 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2905 15 : if( FD_UNLIKELY( err ) ) return err;
2906 15 : return 0;
2907 15 : }
2908 0 : int fd_vote_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2909 0 : *total_sz += sizeof(fd_vote_state_t);
2910 0 : void const * start_data = ctx->data;
2911 0 : int err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
2912 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2913 0 : ctx->data = start_data;
2914 0 : return err;
2915 0 : }
2916 15 : static void fd_vote_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2917 15 : fd_vote_state_t * self = (fd_vote_state_t *)struct_mem;
2918 15 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2919 15 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2920 15 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2921 15 : ulong votes_len;
2922 15 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2923 15 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2924 15 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
2925 210 : for( ulong i=0; i < votes_len; i++ ) {
2926 195 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
2927 195 : fd_landed_vote_new( elem );
2928 195 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
2929 195 : }
2930 15 : {
2931 15 : uchar o;
2932 15 : fd_bincode_bool_decode_unsafe( &o, ctx );
2933 15 : self->has_root_slot = !!o;
2934 15 : if( o ) {
2935 15 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2936 15 : }
2937 15 : }
2938 15 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2939 15 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
2940 15 : ulong epoch_credits_len;
2941 15 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2942 15 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2943 15 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2944 408 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2945 393 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2946 393 : fd_vote_epoch_credits_new( elem );
2947 393 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2948 393 : }
2949 15 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2950 15 : }
2951 0 : void * fd_vote_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2952 0 : fd_vote_state_t * self = (fd_vote_state_t *)mem;
2953 0 : fd_vote_state_new( self );
2954 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_t);
2955 0 : void * * alloc_mem = &alloc_region;
2956 0 : fd_vote_state_decode_inner( mem, alloc_mem, ctx );
2957 0 : return self;
2958 0 : }
2959 12 : void fd_vote_state_new(fd_vote_state_t * self) {
2960 12 : fd_memset( self, 0, sizeof(fd_vote_state_t) );
2961 12 : fd_pubkey_new( &self->node_pubkey );
2962 12 : fd_pubkey_new( &self->authorized_withdrawer );
2963 12 : fd_vote_authorized_voters_new( &self->authorized_voters );
2964 12 : fd_vote_prior_voters_new( &self->prior_voters );
2965 12 : fd_vote_block_timestamp_new( &self->last_timestamp );
2966 12 : }
2967 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 ) {
2968 9 : (void) varint;
2969 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state", level++, 0 );
2970 9 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
2971 9 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
2972 9 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
2973 :
2974 : /* Walk deque */
2975 9 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR, "votes", level++, 0 );
2976 9 : if( self->votes ) {
2977 9 : for( deq_fd_landed_vote_t_iter_t iter = deq_fd_landed_vote_t_iter_init( self->votes );
2978 108 : !deq_fd_landed_vote_t_iter_done( self->votes, iter );
2979 99 : iter = deq_fd_landed_vote_t_iter_next( self->votes, iter ) ) {
2980 99 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
2981 99 : fd_landed_vote_walk(w, ele, fun, "votes", level, 0 );
2982 99 : }
2983 9 : }
2984 9 : fun( w, self->votes, "votes", FD_FLAMENCO_TYPE_ARR_END, "votes", level--, 0 );
2985 : /* Done walking deque */
2986 :
2987 9 : if( !self->has_root_slot ) {
2988 0 : fun( w, NULL, "root_slot", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
2989 9 : } else {
2990 9 : fun( w, &self->root_slot, "root_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
2991 9 : }
2992 9 : fd_vote_authorized_voters_walk( w, &self->authorized_voters, fun, "authorized_voters", level, 0 );
2993 9 : fd_vote_prior_voters_walk( w, &self->prior_voters, fun, "prior_voters", level, 0 );
2994 :
2995 : /* Walk deque */
2996 9 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR, "epoch_credits", level++, 0 );
2997 9 : if( self->epoch_credits ) {
2998 9 : for( deq_fd_vote_epoch_credits_t_iter_t iter = deq_fd_vote_epoch_credits_t_iter_init( self->epoch_credits );
2999 207 : !deq_fd_vote_epoch_credits_t_iter_done( self->epoch_credits, iter );
3000 198 : iter = deq_fd_vote_epoch_credits_t_iter_next( self->epoch_credits, iter ) ) {
3001 198 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3002 198 : fd_vote_epoch_credits_walk(w, ele, fun, "epoch_credits", level, 0 );
3003 198 : }
3004 9 : }
3005 9 : fun( w, self->epoch_credits, "epoch_credits", FD_FLAMENCO_TYPE_ARR_END, "epoch_credits", level--, 0 );
3006 : /* Done walking deque */
3007 :
3008 9 : fd_vote_block_timestamp_walk( w, &self->last_timestamp, fun, "last_timestamp", level, 0 );
3009 9 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state", level--, 0 );
3010 9 : }
3011 0 : ulong fd_vote_state_size( fd_vote_state_t const * self ) {
3012 0 : ulong size = 0;
3013 0 : size += fd_pubkey_size( &self->node_pubkey );
3014 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
3015 0 : size += sizeof(char);
3016 0 : if( self->votes ) {
3017 0 : size += sizeof(ulong);
3018 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 ) ) {
3019 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
3020 0 : size += fd_landed_vote_size( ele );
3021 0 : }
3022 0 : } else {
3023 0 : size += sizeof(ulong);
3024 0 : }
3025 0 : size += sizeof(char);
3026 0 : if( self->has_root_slot ) {
3027 0 : size += sizeof(ulong);
3028 0 : }
3029 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
3030 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
3031 0 : if( self->epoch_credits ) {
3032 0 : size += sizeof(ulong);
3033 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 ) ) {
3034 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
3035 0 : size += fd_vote_epoch_credits_size( ele );
3036 0 : }
3037 0 : } else {
3038 0 : size += sizeof(ulong);
3039 0 : }
3040 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
3041 0 : return size;
3042 0 : }
3043 :
3044 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v0_23_5(fd_vote_state_versioned_t const * self) {
3045 0 : return self->discriminant == 0;
3046 0 : }
3047 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v1_14_11(fd_vote_state_versioned_t const * self) {
3048 0 : return self->discriminant == 1;
3049 0 : }
3050 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_current(fd_vote_state_versioned_t const * self) {
3051 0 : return self->discriminant == 2;
3052 0 : }
3053 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant );
3054 15 : int fd_vote_state_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3055 15 : int err;
3056 15 : switch (discriminant) {
3057 0 : case 0: {
3058 0 : err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
3059 0 : if( FD_UNLIKELY( err ) ) return err;
3060 0 : return FD_BINCODE_SUCCESS;
3061 0 : }
3062 0 : case 1: {
3063 0 : err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
3064 0 : if( FD_UNLIKELY( err ) ) return err;
3065 0 : return FD_BINCODE_SUCCESS;
3066 0 : }
3067 15 : case 2: {
3068 15 : err = fd_vote_state_decode_footprint_inner( ctx, total_sz );
3069 15 : if( FD_UNLIKELY( err ) ) return err;
3070 15 : return FD_BINCODE_SUCCESS;
3071 15 : }
3072 0 : default: return FD_BINCODE_ERR_ENCODING;
3073 15 : }
3074 15 : }
3075 15 : static int fd_vote_state_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3076 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3077 15 : uint discriminant = 0;
3078 15 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
3079 15 : if( FD_UNLIKELY( err ) ) return err;
3080 15 : return fd_vote_state_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
3081 15 : }
3082 15 : int fd_vote_state_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3083 15 : *total_sz += sizeof(fd_vote_state_versioned_t);
3084 15 : void const * start_data = ctx->data;
3085 15 : int err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
3086 15 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3087 15 : ctx->data = start_data;
3088 15 : return err;
3089 15 : }
3090 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 ) {
3091 15 : switch (discriminant) {
3092 0 : case 0: {
3093 0 : fd_vote_state_0_23_5_decode_inner( &self->v0_23_5, alloc_mem, ctx );
3094 0 : break;
3095 0 : }
3096 0 : case 1: {
3097 0 : fd_vote_state_1_14_11_decode_inner( &self->v1_14_11, alloc_mem, ctx );
3098 0 : break;
3099 0 : }
3100 15 : case 2: {
3101 15 : fd_vote_state_decode_inner( &self->current, alloc_mem, ctx );
3102 15 : break;
3103 0 : }
3104 15 : }
3105 15 : }
3106 15 : static void fd_vote_state_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3107 15 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)struct_mem;
3108 15 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
3109 15 : fd_vote_state_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
3110 15 : }
3111 15 : void * fd_vote_state_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3112 15 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)mem;
3113 15 : fd_vote_state_versioned_new( self );
3114 15 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_versioned_t);
3115 15 : void * * alloc_mem = &alloc_region;
3116 15 : fd_vote_state_versioned_decode_inner( mem, alloc_mem, ctx );
3117 15 : return self;
3118 15 : }
3119 27 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
3120 27 : switch( discriminant ) {
3121 0 : case 0: {
3122 0 : fd_vote_state_0_23_5_new( &self->v0_23_5 );
3123 0 : break;
3124 0 : }
3125 0 : case 1: {
3126 0 : fd_vote_state_1_14_11_new( &self->v1_14_11 );
3127 0 : break;
3128 0 : }
3129 12 : case 2: {
3130 12 : fd_vote_state_new( &self->current );
3131 12 : break;
3132 0 : }
3133 15 : default: break; // FD_LOG_ERR(( "unhandled type"));
3134 27 : }
3135 27 : }
3136 27 : void fd_vote_state_versioned_new_disc( fd_vote_state_versioned_t * self, uint discriminant ) {
3137 27 : self->discriminant = discriminant;
3138 27 : fd_vote_state_versioned_inner_new( &self->inner, self->discriminant );
3139 27 : }
3140 15 : void fd_vote_state_versioned_new( fd_vote_state_versioned_t * self ) {
3141 15 : fd_memset( self, 0, sizeof(fd_vote_state_versioned_t) );
3142 15 : fd_vote_state_versioned_new_disc( self, UINT_MAX );
3143 15 : }
3144 :
3145 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 ) {
3146 9 : (void) varint;
3147 9 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_state_versioned", level++, 0);
3148 9 : switch( self->discriminant ) {
3149 0 : case 0: {
3150 0 : fun( w, self, "v0_23_5", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
3151 0 : fd_vote_state_0_23_5_walk( w, &self->inner.v0_23_5, fun, "v0_23_5", level, 0 );
3152 0 : break;
3153 0 : }
3154 0 : case 1: {
3155 0 : fun( w, self, "v1_14_11", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
3156 0 : fd_vote_state_1_14_11_walk( w, &self->inner.v1_14_11, fun, "v1_14_11", level, 0 );
3157 0 : break;
3158 0 : }
3159 9 : case 2: {
3160 9 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
3161 9 : fd_vote_state_walk( w, &self->inner.current, fun, "current", level, 0 );
3162 9 : break;
3163 0 : }
3164 9 : }
3165 9 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_state_versioned", level--, 0 );
3166 9 : }
3167 0 : ulong fd_vote_state_versioned_size( fd_vote_state_versioned_t const * self ) {
3168 0 : ulong size = 0;
3169 0 : size += sizeof(uint);
3170 0 : switch (self->discriminant) {
3171 0 : case 0: {
3172 0 : size += fd_vote_state_0_23_5_size( &self->inner.v0_23_5 );
3173 0 : break;
3174 0 : }
3175 0 : case 1: {
3176 0 : size += fd_vote_state_1_14_11_size( &self->inner.v1_14_11 );
3177 0 : break;
3178 0 : }
3179 0 : case 2: {
3180 0 : size += fd_vote_state_size( &self->inner.current );
3181 0 : break;
3182 0 : }
3183 0 : }
3184 0 : return size;
3185 0 : }
3186 :
3187 18 : int fd_vote_state_versioned_inner_encode( fd_vote_state_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
3188 18 : int err;
3189 18 : switch (discriminant) {
3190 0 : case 0: {
3191 0 : err = fd_vote_state_0_23_5_encode( &self->v0_23_5, ctx );
3192 0 : if( FD_UNLIKELY( err ) ) return err;
3193 0 : break;
3194 0 : }
3195 0 : case 1: {
3196 0 : err = fd_vote_state_1_14_11_encode( &self->v1_14_11, ctx );
3197 0 : if( FD_UNLIKELY( err ) ) return err;
3198 0 : break;
3199 0 : }
3200 18 : case 2: {
3201 18 : err = fd_vote_state_encode( &self->current, ctx );
3202 18 : if( FD_UNLIKELY( err ) ) return err;
3203 18 : break;
3204 18 : }
3205 18 : }
3206 18 : return FD_BINCODE_SUCCESS;
3207 18 : }
3208 18 : int fd_vote_state_versioned_encode( fd_vote_state_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3209 18 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
3210 18 : if( FD_UNLIKELY( err ) ) return err;
3211 18 : return fd_vote_state_versioned_inner_encode( &self->inner, self->discriminant, ctx );
3212 18 : }
3213 :
3214 0 : int fd_vote_state_update_encode( fd_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3215 0 : int err;
3216 0 : if( self->lockouts ) {
3217 0 : ulong lockouts_len = deq_fd_vote_lockout_t_cnt( self->lockouts );
3218 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
3219 0 : if( FD_UNLIKELY( err ) ) return err;
3220 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 ) ) {
3221 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->lockouts, iter );
3222 0 : err = fd_vote_lockout_encode( ele, ctx );
3223 0 : if( FD_UNLIKELY( err ) ) return err;
3224 0 : }
3225 0 : } else {
3226 0 : ulong lockouts_len = 0;
3227 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
3228 0 : if( FD_UNLIKELY( err ) ) return err;
3229 0 : }
3230 0 : err = fd_bincode_bool_encode( self->has_root, ctx );
3231 0 : if( FD_UNLIKELY( err ) ) return err;
3232 0 : if( self->has_root ) {
3233 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3234 0 : if( FD_UNLIKELY( err ) ) return err;
3235 0 : }
3236 0 : err = fd_hash_encode( &self->hash, ctx );
3237 0 : if( FD_UNLIKELY( err ) ) return err;
3238 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3239 0 : if( FD_UNLIKELY( err ) ) return err;
3240 0 : if( self->has_timestamp ) {
3241 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3242 0 : if( FD_UNLIKELY( err ) ) return err;
3243 0 : }
3244 0 : return FD_BINCODE_SUCCESS;
3245 0 : }
3246 0 : static int fd_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3247 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3248 0 : int err = 0;
3249 0 : ulong lockouts_len;
3250 0 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
3251 0 : if( FD_UNLIKELY( err ) ) return err;
3252 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
3253 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( lockouts_max );
3254 0 : ulong lockouts_sz;
3255 0 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3256 0 : err = fd_bincode_bytes_decode_footprint( lockouts_sz, ctx );
3257 0 : if( FD_UNLIKELY( err ) ) return err;
3258 0 : {
3259 0 : uchar o;
3260 0 : err = fd_bincode_bool_decode( &o, ctx );
3261 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3262 0 : if( o ) {
3263 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3264 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3265 0 : }
3266 0 : }
3267 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3268 0 : if( FD_UNLIKELY( err ) ) return err;
3269 0 : {
3270 0 : uchar o;
3271 0 : err = fd_bincode_bool_decode( &o, ctx );
3272 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3273 0 : if( o ) {
3274 0 : err = fd_bincode_int64_decode_footprint( ctx );
3275 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3276 0 : }
3277 0 : }
3278 0 : return 0;
3279 0 : }
3280 0 : int fd_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3281 0 : *total_sz += sizeof(fd_vote_state_update_t);
3282 0 : void const * start_data = ctx->data;
3283 0 : int err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
3284 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3285 0 : ctx->data = start_data;
3286 0 : return err;
3287 0 : }
3288 0 : static void fd_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3289 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)struct_mem;
3290 0 : ulong lockouts_len;
3291 0 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
3292 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
3293 0 : self->lockouts = deq_fd_vote_lockout_t_join_new( alloc_mem, lockouts_max );
3294 0 : for( ulong i=0; i < lockouts_len; i++ ) {
3295 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->lockouts );
3296 0 : fd_vote_lockout_new( elem );
3297 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
3298 0 : }
3299 0 : {
3300 0 : uchar o;
3301 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3302 0 : self->has_root = !!o;
3303 0 : if( o ) {
3304 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3305 0 : }
3306 0 : }
3307 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3308 0 : {
3309 0 : uchar o;
3310 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3311 0 : self->has_timestamp = !!o;
3312 0 : if( o ) {
3313 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3314 0 : }
3315 0 : }
3316 0 : }
3317 0 : void * fd_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3318 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)mem;
3319 0 : fd_vote_state_update_new( self );
3320 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_update_t);
3321 0 : void * * alloc_mem = &alloc_region;
3322 0 : fd_vote_state_update_decode_inner( mem, alloc_mem, ctx );
3323 0 : return self;
3324 0 : }
3325 0 : void fd_vote_state_update_new(fd_vote_state_update_t * self) {
3326 0 : fd_memset( self, 0, sizeof(fd_vote_state_update_t) );
3327 0 : fd_hash_new( &self->hash );
3328 0 : }
3329 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 ) {
3330 0 : (void) varint;
3331 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_state_update", level++, 0 );
3332 :
3333 : /* Walk deque */
3334 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++, 0 );
3335 0 : if( self->lockouts ) {
3336 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
3337 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
3338 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
3339 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3340 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level, 0 );
3341 0 : }
3342 0 : }
3343 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level--, 0 );
3344 : /* Done walking deque */
3345 :
3346 0 : if( !self->has_root ) {
3347 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3348 0 : } else {
3349 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3350 0 : }
3351 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3352 0 : if( !self->has_timestamp ) {
3353 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
3354 0 : } else {
3355 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
3356 0 : }
3357 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_state_update", level--, 0 );
3358 0 : }
3359 0 : ulong fd_vote_state_update_size( fd_vote_state_update_t const * self ) {
3360 0 : ulong size = 0;
3361 0 : if( self->lockouts ) {
3362 0 : size += sizeof(ulong);
3363 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 ) ) {
3364 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3365 0 : size += fd_vote_lockout_size( ele );
3366 0 : }
3367 0 : } else {
3368 0 : size += sizeof(ulong);
3369 0 : }
3370 0 : size += sizeof(char);
3371 0 : if( self->has_root ) {
3372 0 : size += sizeof(ulong);
3373 0 : }
3374 0 : size += fd_hash_size( &self->hash );
3375 0 : size += sizeof(char);
3376 0 : if( self->has_timestamp ) {
3377 0 : size += sizeof(long);
3378 0 : }
3379 0 : return size;
3380 0 : }
3381 :
3382 0 : int fd_compact_vote_state_update_encode( fd_compact_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3383 0 : int err;
3384 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3385 0 : if( FD_UNLIKELY( err ) ) return err;
3386 0 : err = fd_bincode_compact_u16_encode( &self->lockouts_len, ctx );
3387 0 : if( FD_UNLIKELY(err) ) return err;
3388 0 : if( self->lockouts_len ) {
3389 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3390 0 : err = fd_lockout_offset_encode( self->lockouts + i, ctx );
3391 0 : if( FD_UNLIKELY( err ) ) return err;
3392 0 : }
3393 0 : }
3394 0 : err = fd_hash_encode( &self->hash, ctx );
3395 0 : if( FD_UNLIKELY( err ) ) return err;
3396 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3397 0 : if( FD_UNLIKELY( err ) ) return err;
3398 0 : if( self->has_timestamp ) {
3399 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3400 0 : if( FD_UNLIKELY( err ) ) return err;
3401 0 : }
3402 0 : return FD_BINCODE_SUCCESS;
3403 0 : }
3404 0 : static int fd_compact_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3405 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3406 0 : int err = 0;
3407 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3408 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3409 0 : ushort lockouts_len;
3410 0 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
3411 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3412 0 : if( lockouts_len ) {
3413 0 : *total_sz += FD_LOCKOUT_OFFSET_ALIGN + sizeof(fd_lockout_offset_t)*lockouts_len;
3414 0 : for( ulong i=0; i < lockouts_len; i++ ) {
3415 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3416 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3417 0 : }
3418 0 : }
3419 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3420 0 : if( FD_UNLIKELY( err ) ) return err;
3421 0 : {
3422 0 : uchar o;
3423 0 : err = fd_bincode_bool_decode( &o, ctx );
3424 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3425 0 : if( o ) {
3426 0 : err = fd_bincode_int64_decode_footprint( ctx );
3427 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3428 0 : }
3429 0 : }
3430 0 : return 0;
3431 0 : }
3432 0 : int fd_compact_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3433 0 : *total_sz += sizeof(fd_compact_vote_state_update_t);
3434 0 : void const * start_data = ctx->data;
3435 0 : int err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3436 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3437 0 : ctx->data = start_data;
3438 0 : return err;
3439 0 : }
3440 0 : static void fd_compact_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3441 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)struct_mem;
3442 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3443 0 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
3444 0 : if( self->lockouts_len ) {
3445 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_LOCKOUT_OFFSET_ALIGN );
3446 0 : self->lockouts = *alloc_mem;
3447 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_lockout_offset_t)*self->lockouts_len;
3448 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3449 0 : fd_lockout_offset_new( self->lockouts + i );
3450 0 : fd_lockout_offset_decode_inner( self->lockouts + i, alloc_mem, ctx );
3451 0 : }
3452 0 : } else
3453 0 : self->lockouts = NULL;
3454 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3455 0 : {
3456 0 : uchar o;
3457 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3458 0 : self->has_timestamp = !!o;
3459 0 : if( o ) {
3460 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3461 0 : }
3462 0 : }
3463 0 : }
3464 0 : void * fd_compact_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3465 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)mem;
3466 0 : fd_compact_vote_state_update_new( self );
3467 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_t);
3468 0 : void * * alloc_mem = &alloc_region;
3469 0 : fd_compact_vote_state_update_decode_inner( mem, alloc_mem, ctx );
3470 0 : return self;
3471 0 : }
3472 0 : void fd_compact_vote_state_update_new(fd_compact_vote_state_update_t * self) {
3473 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_t) );
3474 0 : fd_hash_new( &self->hash );
3475 0 : }
3476 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 ) {
3477 0 : (void) varint;
3478 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update", level++, 0 );
3479 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3480 0 : fun( w, &self->lockouts_len, "lockouts_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
3481 0 : if( self->lockouts_len ) {
3482 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
3483 0 : for( ulong i=0; i < self->lockouts_len; i++ )
3484 0 : fd_lockout_offset_walk(w, self->lockouts + i, fun, "lockout_offset", level, 0 );
3485 0 : fun( w, NULL, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
3486 0 : }
3487 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3488 0 : if( !self->has_timestamp ) {
3489 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
3490 0 : } else {
3491 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
3492 0 : }
3493 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update", level--, 0 );
3494 0 : }
3495 0 : ulong fd_compact_vote_state_update_size( fd_compact_vote_state_update_t const * self ) {
3496 0 : ulong size = 0;
3497 0 : size += sizeof(ulong);
3498 0 : do {
3499 0 : ushort tmp = (ushort)self->lockouts_len;
3500 0 : size += fd_bincode_compact_u16_size( &tmp );
3501 0 : for( ulong i=0; i < self->lockouts_len; i++ )
3502 0 : size += fd_lockout_offset_size( self->lockouts + i );
3503 0 : } while(0);
3504 0 : size += fd_hash_size( &self->hash );
3505 0 : size += sizeof(char);
3506 0 : if( self->has_timestamp ) {
3507 0 : size += sizeof(long);
3508 0 : }
3509 0 : return size;
3510 0 : }
3511 :
3512 0 : int fd_compact_vote_state_update_switch_encode( fd_compact_vote_state_update_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3513 0 : int err;
3514 0 : err = fd_compact_vote_state_update_encode( &self->compact_vote_state_update, ctx );
3515 0 : if( FD_UNLIKELY( err ) ) return err;
3516 0 : err = fd_hash_encode( &self->hash, ctx );
3517 0 : if( FD_UNLIKELY( err ) ) return err;
3518 0 : return FD_BINCODE_SUCCESS;
3519 0 : }
3520 0 : static int fd_compact_vote_state_update_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3521 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3522 0 : int err = 0;
3523 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3524 0 : if( FD_UNLIKELY( err ) ) return err;
3525 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3526 0 : if( FD_UNLIKELY( err ) ) return err;
3527 0 : return 0;
3528 0 : }
3529 0 : int fd_compact_vote_state_update_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3530 0 : *total_sz += sizeof(fd_compact_vote_state_update_switch_t);
3531 0 : void const * start_data = ctx->data;
3532 0 : int err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
3533 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3534 0 : ctx->data = start_data;
3535 0 : return err;
3536 0 : }
3537 0 : static void fd_compact_vote_state_update_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3538 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)struct_mem;
3539 0 : fd_compact_vote_state_update_decode_inner( &self->compact_vote_state_update, alloc_mem, ctx );
3540 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3541 0 : }
3542 0 : void * fd_compact_vote_state_update_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3543 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)mem;
3544 0 : fd_compact_vote_state_update_switch_new( self );
3545 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_switch_t);
3546 0 : void * * alloc_mem = &alloc_region;
3547 0 : fd_compact_vote_state_update_switch_decode_inner( mem, alloc_mem, ctx );
3548 0 : return self;
3549 0 : }
3550 0 : void fd_compact_vote_state_update_switch_new(fd_compact_vote_state_update_switch_t * self) {
3551 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_switch_t) );
3552 0 : fd_compact_vote_state_update_new( &self->compact_vote_state_update );
3553 0 : fd_hash_new( &self->hash );
3554 0 : }
3555 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 ) {
3556 0 : (void) varint;
3557 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_vote_state_update_switch", level++, 0 );
3558 0 : fd_compact_vote_state_update_walk( w, &self->compact_vote_state_update, fun, "compact_vote_state_update", level, 0 );
3559 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3560 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_vote_state_update_switch", level--, 0 );
3561 0 : }
3562 0 : ulong fd_compact_vote_state_update_switch_size( fd_compact_vote_state_update_switch_t const * self ) {
3563 0 : ulong size = 0;
3564 0 : size += fd_compact_vote_state_update_size( &self->compact_vote_state_update );
3565 0 : size += fd_hash_size( &self->hash );
3566 0 : return size;
3567 0 : }
3568 :
3569 0 : int fd_compact_tower_sync_encode( fd_compact_tower_sync_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3570 0 : int err;
3571 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3572 0 : if( FD_UNLIKELY( err ) ) return err;
3573 0 : if( self->lockout_offsets ) {
3574 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
3575 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3576 0 : if( FD_UNLIKELY( err ) ) return err;
3577 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 ) ) {
3578 0 : fd_lockout_offset_t const * ele = deq_fd_lockout_offset_t_iter_ele_const( self->lockout_offsets, iter );
3579 0 : err = fd_lockout_offset_encode( ele, ctx );
3580 0 : if( FD_UNLIKELY( err ) ) return err;
3581 0 : }
3582 0 : } else {
3583 0 : ushort lockout_offsets_len = 0;
3584 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3585 0 : if( FD_UNLIKELY( err ) ) return err;
3586 0 : }
3587 0 : err = fd_hash_encode( &self->hash, ctx );
3588 0 : if( FD_UNLIKELY( err ) ) return err;
3589 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3590 0 : if( FD_UNLIKELY( err ) ) return err;
3591 0 : if( self->has_timestamp ) {
3592 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3593 0 : if( FD_UNLIKELY( err ) ) return err;
3594 0 : }
3595 0 : err = fd_hash_encode( &self->block_id, ctx );
3596 0 : if( FD_UNLIKELY( err ) ) return err;
3597 0 : return FD_BINCODE_SUCCESS;
3598 0 : }
3599 0 : static int fd_compact_tower_sync_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3600 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3601 0 : int err = 0;
3602 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3603 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3604 0 : ushort lockout_offsets_len;
3605 0 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
3606 0 : if( FD_UNLIKELY( err ) ) return err;
3607 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
3608 0 : *total_sz += deq_fd_lockout_offset_t_align() + deq_fd_lockout_offset_t_footprint( lockout_offsets_max );
3609 0 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
3610 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3611 0 : if( FD_UNLIKELY( err ) ) return err;
3612 0 : }
3613 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3614 0 : if( FD_UNLIKELY( err ) ) return err;
3615 0 : {
3616 0 : uchar o;
3617 0 : err = fd_bincode_bool_decode( &o, ctx );
3618 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3619 0 : if( o ) {
3620 0 : err = fd_bincode_int64_decode_footprint( ctx );
3621 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3622 0 : }
3623 0 : }
3624 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3625 0 : if( FD_UNLIKELY( err ) ) return err;
3626 0 : return 0;
3627 0 : }
3628 0 : int fd_compact_tower_sync_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3629 0 : *total_sz += sizeof(fd_compact_tower_sync_t);
3630 0 : void const * start_data = ctx->data;
3631 0 : int err = fd_compact_tower_sync_decode_footprint_inner( ctx, total_sz );
3632 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3633 0 : ctx->data = start_data;
3634 0 : return err;
3635 0 : }
3636 0 : static void fd_compact_tower_sync_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3637 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)struct_mem;
3638 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3639 0 : ushort lockout_offsets_len;
3640 0 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
3641 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
3642 0 : self->lockout_offsets = deq_fd_lockout_offset_t_join_new( alloc_mem, lockout_offsets_max );
3643 0 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
3644 0 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( self->lockout_offsets );
3645 0 : fd_lockout_offset_new( elem );
3646 0 : fd_lockout_offset_decode_inner( elem, alloc_mem, ctx );
3647 0 : }
3648 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3649 0 : {
3650 0 : uchar o;
3651 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3652 0 : self->has_timestamp = !!o;
3653 0 : if( o ) {
3654 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3655 0 : }
3656 0 : }
3657 0 : fd_hash_decode_inner( &self->block_id, alloc_mem, ctx );
3658 0 : }
3659 0 : void * fd_compact_tower_sync_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3660 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)mem;
3661 0 : fd_compact_tower_sync_new( self );
3662 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_tower_sync_t);
3663 0 : void * * alloc_mem = &alloc_region;
3664 0 : fd_compact_tower_sync_decode_inner( mem, alloc_mem, ctx );
3665 0 : return self;
3666 0 : }
3667 0 : void fd_compact_tower_sync_new(fd_compact_tower_sync_t * self) {
3668 0 : fd_memset( self, 0, sizeof(fd_compact_tower_sync_t) );
3669 0 : fd_hash_new( &self->hash );
3670 0 : fd_hash_new( &self->block_id );
3671 0 : }
3672 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 ) {
3673 0 : (void) varint;
3674 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compact_tower_sync", level++, 0 );
3675 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3676 :
3677 : /* Walk deque */
3678 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR, "lockout_offsets", level++, 0 );
3679 0 : if( self->lockout_offsets ) {
3680 0 : for( deq_fd_lockout_offset_t_iter_t iter = deq_fd_lockout_offset_t_iter_init( self->lockout_offsets );
3681 0 : !deq_fd_lockout_offset_t_iter_done( self->lockout_offsets, iter );
3682 0 : iter = deq_fd_lockout_offset_t_iter_next( self->lockout_offsets, iter ) ) {
3683 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
3684 0 : fd_lockout_offset_walk(w, ele, fun, "lockout_offsets", level, 0 );
3685 0 : }
3686 0 : }
3687 0 : fun( w, self->lockout_offsets, "lockout_offsets", FD_FLAMENCO_TYPE_ARR_END, "lockout_offsets", level--, 0 );
3688 : /* Done walking deque */
3689 :
3690 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3691 0 : if( !self->has_timestamp ) {
3692 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
3693 0 : } else {
3694 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
3695 0 : }
3696 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level, 0 );
3697 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compact_tower_sync", level--, 0 );
3698 0 : }
3699 0 : ulong fd_compact_tower_sync_size( fd_compact_tower_sync_t const * self ) {
3700 0 : ulong size = 0;
3701 0 : size += sizeof(ulong);
3702 0 : if( self->lockout_offsets ) {
3703 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
3704 0 : size += fd_bincode_compact_u16_size( &lockout_offsets_len );
3705 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 ) ) {
3706 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
3707 0 : size += fd_lockout_offset_size( ele );
3708 0 : }
3709 0 : } else {
3710 0 : size += 1;
3711 0 : }
3712 0 : size += fd_hash_size( &self->hash );
3713 0 : size += sizeof(char);
3714 0 : if( self->has_timestamp ) {
3715 0 : size += sizeof(long);
3716 0 : }
3717 0 : size += fd_hash_size( &self->block_id );
3718 0 : return size;
3719 0 : }
3720 :
3721 0 : void fd_tower_sync_new(fd_tower_sync_t * self) {
3722 0 : fd_memset( self, 0, sizeof(fd_tower_sync_t) );
3723 0 : fd_hash_new( &self->hash );
3724 0 : fd_hash_new( &self->block_id );
3725 0 : }
3726 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 ) {
3727 0 : (void) varint;
3728 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync", level++, 0 );
3729 :
3730 : /* Walk deque */
3731 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR, "lockouts", level++, 0 );
3732 0 : if( self->lockouts ) {
3733 0 : for( deq_fd_vote_lockout_t_iter_t iter = deq_fd_vote_lockout_t_iter_init( self->lockouts );
3734 0 : !deq_fd_vote_lockout_t_iter_done( self->lockouts, iter );
3735 0 : iter = deq_fd_vote_lockout_t_iter_next( self->lockouts, iter ) ) {
3736 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3737 0 : fd_vote_lockout_walk(w, ele, fun, "lockouts", level, 0 );
3738 0 : }
3739 0 : }
3740 0 : fun( w, self->lockouts, "lockouts", FD_FLAMENCO_TYPE_ARR_END, "lockouts", level--, 0 );
3741 : /* Done walking deque */
3742 :
3743 0 : fun( w, &self->lockouts_cnt, "lockouts_cnt", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3744 0 : if( !self->has_root ) {
3745 0 : fun( w, NULL, "root", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3746 0 : } else {
3747 0 : fun( w, &self->root, "root", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
3748 0 : }
3749 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3750 0 : if( !self->has_timestamp ) {
3751 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
3752 0 : } else {
3753 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
3754 0 : }
3755 0 : fd_hash_walk( w, &self->block_id, fun, "block_id", level, 0 );
3756 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync", level--, 0 );
3757 0 : }
3758 0 : ulong fd_tower_sync_size( fd_tower_sync_t const * self ) {
3759 0 : ulong size = 0;
3760 0 : if( self->lockouts ) {
3761 0 : size += sizeof(ulong);
3762 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 ) ) {
3763 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3764 0 : size += fd_vote_lockout_size( ele );
3765 0 : }
3766 0 : } else {
3767 0 : size += sizeof(ulong);
3768 0 : }
3769 0 : size += sizeof(ulong);
3770 0 : size += sizeof(char);
3771 0 : if( self->has_root ) {
3772 0 : size += sizeof(ulong);
3773 0 : }
3774 0 : size += fd_hash_size( &self->hash );
3775 0 : size += sizeof(char);
3776 0 : if( self->has_timestamp ) {
3777 0 : size += sizeof(long);
3778 0 : }
3779 0 : size += fd_hash_size( &self->block_id );
3780 0 : return size;
3781 0 : }
3782 :
3783 0 : int fd_tower_sync_switch_encode( fd_tower_sync_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3784 0 : int err;
3785 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
3786 0 : if( FD_UNLIKELY( err ) ) return err;
3787 0 : err = fd_hash_encode( &self->hash, ctx );
3788 0 : if( FD_UNLIKELY( err ) ) return err;
3789 0 : return FD_BINCODE_SUCCESS;
3790 0 : }
3791 0 : static int fd_tower_sync_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3792 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3793 0 : int err = 0;
3794 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
3795 0 : if( FD_UNLIKELY( err ) ) return err;
3796 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3797 0 : if( FD_UNLIKELY( err ) ) return err;
3798 0 : return 0;
3799 0 : }
3800 0 : int fd_tower_sync_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3801 0 : *total_sz += sizeof(fd_tower_sync_switch_t);
3802 0 : void const * start_data = ctx->data;
3803 0 : int err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
3804 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3805 0 : ctx->data = start_data;
3806 0 : return err;
3807 0 : }
3808 0 : static void fd_tower_sync_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3809 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)struct_mem;
3810 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
3811 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3812 0 : }
3813 0 : void * fd_tower_sync_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3814 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)mem;
3815 0 : fd_tower_sync_switch_new( self );
3816 0 : void * alloc_region = (uchar *)mem + sizeof(fd_tower_sync_switch_t);
3817 0 : void * * alloc_mem = &alloc_region;
3818 0 : fd_tower_sync_switch_decode_inner( mem, alloc_mem, ctx );
3819 0 : return self;
3820 0 : }
3821 0 : void fd_tower_sync_switch_new(fd_tower_sync_switch_t * self) {
3822 0 : fd_memset( self, 0, sizeof(fd_tower_sync_switch_t) );
3823 0 : fd_tower_sync_new( &self->tower_sync );
3824 0 : fd_hash_new( &self->hash );
3825 0 : }
3826 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 ) {
3827 0 : (void) varint;
3828 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_tower_sync_switch", level++, 0 );
3829 0 : fd_tower_sync_walk( w, &self->tower_sync, fun, "tower_sync", level, 0 );
3830 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
3831 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_tower_sync_switch", level--, 0 );
3832 0 : }
3833 0 : ulong fd_tower_sync_switch_size( fd_tower_sync_switch_t const * self ) {
3834 0 : ulong size = 0;
3835 0 : size += fd_tower_sync_size( &self->tower_sync );
3836 0 : size += fd_hash_size( &self->hash );
3837 0 : return size;
3838 0 : }
3839 :
3840 0 : int fd_slot_history_encode( fd_slot_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3841 0 : int err;
3842 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
3843 0 : if( FD_UNLIKELY( err ) ) return err;
3844 0 : if( self->has_bits ) {
3845 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
3846 0 : if( FD_UNLIKELY(err) ) return err;
3847 0 : if( self->bits_bitvec_len ) {
3848 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3849 0 : err = fd_bincode_uint64_encode( self->bits_bitvec[i], ctx );
3850 0 : }
3851 0 : }
3852 0 : if( FD_UNLIKELY( err ) ) return err;
3853 0 : }
3854 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
3855 0 : if( FD_UNLIKELY( err ) ) return err;
3856 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
3857 0 : if( FD_UNLIKELY( err ) ) return err;
3858 0 : return FD_BINCODE_SUCCESS;
3859 0 : }
3860 0 : int fd_slot_history_encode_global( fd_slot_history_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3861 0 : int err;
3862 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
3863 0 : if( FD_UNLIKELY( err ) ) return err;
3864 0 : if( self->has_bits ) {
3865 0 : if( FD_UNLIKELY( err ) ) return err;
3866 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
3867 0 : if( FD_UNLIKELY( err ) ) return err;
3868 0 : if( self->bits_bitvec_len ) {
3869 0 : uchar * bits_bitvec_laddr = (uchar*)self + self->bits_bitvec_offset;
3870 0 : ulong * bits_bitvec = (ulong *)bits_bitvec_laddr;
3871 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3872 0 : err = fd_bincode_uint64_encode( bits_bitvec[i], ctx );
3873 0 : if( FD_UNLIKELY( err ) ) return err;
3874 0 : }
3875 0 : }
3876 0 : if( FD_UNLIKELY( err ) ) return err;
3877 0 : }
3878 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
3879 0 : if( FD_UNLIKELY( err ) ) return err;
3880 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
3881 0 : if( FD_UNLIKELY( err ) ) return err;
3882 0 : return FD_BINCODE_SUCCESS;
3883 0 : }
3884 3 : static int fd_slot_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3885 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3886 3 : int err = 0;
3887 3 : {
3888 3 : uchar o;
3889 3 : ulong inner_len = 0UL;
3890 3 : err = fd_bincode_bool_decode( &o, ctx );
3891 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3892 3 : if( o ) {
3893 3 : ulong bits_bitvec_len;
3894 3 : err = fd_bincode_uint64_decode( &bits_bitvec_len, ctx );
3895 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3896 3 : if( bits_bitvec_len ) {
3897 3 : *total_sz += 8UL + sizeof(ulong)*bits_bitvec_len;
3898 49155 : for( ulong i=0; i < bits_bitvec_len; i++ ) {
3899 49152 : err = fd_bincode_uint64_decode_footprint( ctx );
3900 49152 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3901 49152 : }
3902 3 : }
3903 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3904 3 : inner_len = bits_bitvec_len;
3905 3 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
3906 3 : }
3907 3 : ulong len;
3908 3 : err = fd_bincode_uint64_decode( &len, ctx );
3909 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3910 3 : if( len > inner_len * sizeof(ulong) * 8UL ) return FD_BINCODE_ERR_ENCODING;
3911 3 : }
3912 3 : err = fd_bincode_uint64_decode_footprint( ctx );
3913 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3914 3 : return 0;
3915 3 : }
3916 3 : int fd_slot_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3917 3 : *total_sz += sizeof(fd_slot_history_t);
3918 3 : void const * start_data = ctx->data;
3919 3 : int err = fd_slot_history_decode_footprint_inner( ctx, total_sz );
3920 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3921 3 : ctx->data = start_data;
3922 3 : return err;
3923 3 : }
3924 0 : static void fd_slot_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3925 0 : fd_slot_history_t * self = (fd_slot_history_t *)struct_mem;
3926 0 : {
3927 0 : uchar o;
3928 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3929 0 : self->has_bits = !!o;
3930 0 : if( o ) {
3931 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
3932 0 : if( self->bits_bitvec_len ) {
3933 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3934 0 : self->bits_bitvec = *alloc_mem;
3935 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
3936 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3937 0 : fd_bincode_uint64_decode_unsafe( self->bits_bitvec + i, ctx );
3938 0 : }
3939 0 : } else
3940 0 : self->bits_bitvec = NULL;
3941 0 : } else {
3942 0 : self->bits_bitvec = NULL;
3943 0 : }
3944 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
3945 0 : }
3946 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
3947 0 : }
3948 0 : void * fd_slot_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3949 0 : fd_slot_history_t * self = (fd_slot_history_t *)mem;
3950 0 : fd_slot_history_new( self );
3951 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_t);
3952 0 : void * * alloc_mem = &alloc_region;
3953 0 : fd_slot_history_decode_inner( mem, alloc_mem, ctx );
3954 0 : return self;
3955 0 : }
3956 0 : static void fd_slot_history_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3957 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)struct_mem;
3958 0 : {
3959 0 : uchar o;
3960 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3961 0 : self->has_bits = !!o;
3962 0 : if( o ) {
3963 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
3964 0 : if( self->bits_bitvec_len ) {
3965 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3966 0 : self->bits_bitvec_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3967 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3968 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
3969 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3970 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
3971 0 : }
3972 0 : } else {
3973 0 : self->bits_bitvec_offset = 0UL;
3974 0 : }
3975 0 : }
3976 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
3977 0 : }
3978 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
3979 0 : }
3980 0 : void * fd_slot_history_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3981 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)mem;
3982 0 : fd_slot_history_new( (fd_slot_history_t *)self );
3983 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_global_t);
3984 0 : void * * alloc_mem = &alloc_region;
3985 0 : fd_slot_history_decode_inner_global( mem, alloc_mem, ctx );
3986 0 : return self;
3987 0 : }
3988 0 : void fd_slot_history_new(fd_slot_history_t * self) {
3989 0 : fd_memset( self, 0, sizeof(fd_slot_history_t) );
3990 0 : }
3991 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 ) {
3992 0 : (void) varint;
3993 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_history", level++, 0 );
3994 0 : if( !self->has_bits ) {
3995 0 : fun( w, NULL, "bits", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
3996 0 : } else {
3997 0 : if( self->bits_bitvec_len ) {
3998 0 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
3999 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ )
4000 0 : fun( w, self->bits_bitvec + i, "bits_bitvec", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4001 0 : fun( w, NULL, "bits_bitvec", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4002 0 : }
4003 0 : }
4004 0 : fun( w, &self->bits_len, "bits_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4005 0 : fun( w, &self->next_slot, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4006 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_history", level--, 0 );
4007 0 : }
4008 0 : ulong fd_slot_history_size( fd_slot_history_t const * self ) {
4009 0 : ulong size = 0;
4010 0 : size += sizeof(char);
4011 0 : if( self->has_bits ) {
4012 0 : do {
4013 0 : size += sizeof(ulong);
4014 0 : size += self->bits_bitvec_len * sizeof(ulong);
4015 0 : } while(0);
4016 0 : }
4017 0 : size += sizeof(ulong);
4018 0 : size += sizeof(ulong);
4019 0 : return size;
4020 0 : }
4021 :
4022 0 : ulong fd_slot_history_size_global( fd_slot_history_global_t const * self ) {
4023 0 : ulong size = 0;
4024 0 : do {
4025 0 : size += sizeof(char);
4026 0 : if( self->has_bits ) {
4027 0 : do {
4028 0 : size += sizeof(ulong);
4029 0 : ulong * bits_bitvec = self->bits_bitvec_offset ? (ulong *)fd_type_pun( (uchar *)self + self->bits_bitvec_offset ) : NULL;
4030 0 : size += self->bits_bitvec_len * sizeof(ulong);
4031 0 : } while(0);
4032 0 : }
4033 0 : } while(0);
4034 0 : size += sizeof(ulong);
4035 0 : return size;
4036 0 : }
4037 :
4038 0 : int fd_slot_hash_encode( fd_slot_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4039 0 : int err;
4040 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4041 0 : if( FD_UNLIKELY( err ) ) return err;
4042 0 : err = fd_hash_encode( &self->hash, ctx );
4043 0 : if( FD_UNLIKELY( err ) ) return err;
4044 0 : return FD_BINCODE_SUCCESS;
4045 0 : }
4046 0 : static inline int fd_slot_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4047 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4048 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
4049 0 : return 0;
4050 0 : }
4051 0 : static void fd_slot_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4052 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)struct_mem;
4053 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4054 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4055 0 : }
4056 0 : void * fd_slot_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4057 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)mem;
4058 0 : fd_slot_hash_new( self );
4059 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hash_t);
4060 0 : void * * alloc_mem = &alloc_region;
4061 0 : fd_slot_hash_decode_inner( mem, alloc_mem, ctx );
4062 0 : return self;
4063 0 : }
4064 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 ) {
4065 0 : (void) varint;
4066 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hash", level++, 0 );
4067 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4068 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
4069 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hash", level--, 0 );
4070 0 : }
4071 0 : int fd_slot_hashes_encode( fd_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4072 0 : int err;
4073 0 : if( self->hashes ) {
4074 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( self->hashes );
4075 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4076 0 : if( FD_UNLIKELY( err ) ) return err;
4077 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 ) ) {
4078 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( self->hashes, iter );
4079 0 : err = fd_slot_hash_encode( ele, ctx );
4080 0 : if( FD_UNLIKELY( err ) ) return err;
4081 0 : }
4082 0 : } else {
4083 0 : ulong hashes_len = 0;
4084 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4085 0 : if( FD_UNLIKELY( err ) ) return err;
4086 0 : }
4087 0 : return FD_BINCODE_SUCCESS;
4088 0 : }
4089 0 : int fd_slot_hashes_encode_global( fd_slot_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4090 0 : int err;
4091 0 : if( self->hashes_offset ) {
4092 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
4093 0 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join( hashes_laddr );
4094 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( hashes );
4095 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4096 0 : if( FD_UNLIKELY( err ) ) return err;
4097 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 ) ) {
4098 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( hashes, iter );
4099 0 : err = fd_slot_hash_encode( ele, ctx );
4100 0 : if( FD_UNLIKELY( err ) ) return err;
4101 0 : }
4102 0 : } else {
4103 0 : ulong hashes_len = 0;
4104 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4105 0 : if( FD_UNLIKELY( err ) ) return err;
4106 0 : }
4107 0 : return FD_BINCODE_SUCCESS;
4108 0 : }
4109 3 : static int fd_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4110 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4111 3 : int err = 0;
4112 3 : ulong hashes_len;
4113 3 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
4114 3 : if( FD_UNLIKELY( err ) ) return err;
4115 3 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
4116 3 : *total_sz += deq_fd_slot_hash_t_align() + deq_fd_slot_hash_t_footprint( hashes_max );
4117 3 : ulong hashes_sz;
4118 3 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
4119 3 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
4120 3 : if( FD_UNLIKELY( err ) ) return err;
4121 3 : return 0;
4122 3 : }
4123 3 : int fd_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4124 3 : *total_sz += sizeof(fd_slot_hashes_t);
4125 3 : void const * start_data = ctx->data;
4126 3 : int err = fd_slot_hashes_decode_footprint_inner( ctx, total_sz );
4127 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4128 3 : ctx->data = start_data;
4129 3 : return err;
4130 3 : }
4131 0 : static void fd_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4132 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)struct_mem;
4133 0 : ulong hashes_len;
4134 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4135 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
4136 0 : self->hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
4137 0 : for( ulong i=0; i < hashes_len; i++ ) {
4138 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( self->hashes );
4139 0 : fd_slot_hash_new( elem );
4140 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
4141 0 : }
4142 0 : }
4143 0 : void * fd_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4144 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)mem;
4145 0 : fd_slot_hashes_new( self );
4146 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_t);
4147 0 : void * * alloc_mem = &alloc_region;
4148 0 : fd_slot_hashes_decode_inner( mem, alloc_mem, ctx );
4149 0 : return self;
4150 0 : }
4151 0 : static void fd_slot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4152 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)struct_mem;
4153 0 : ulong hashes_len;
4154 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4155 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_slot_hash_t_align() );
4156 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
4157 0 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
4158 0 : for( ulong i=0; i < hashes_len; i++ ) {
4159 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( hashes );
4160 0 : fd_slot_hash_new( (fd_slot_hash_t*)fd_type_pun( elem ) );
4161 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
4162 0 : }
4163 0 : self->hashes_offset = (ulong)deq_fd_slot_hash_t_leave( hashes ) - (ulong)struct_mem;
4164 0 : }
4165 0 : void * fd_slot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4166 0 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)mem;
4167 0 : fd_slot_hashes_new( (fd_slot_hashes_t *)self );
4168 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_global_t);
4169 0 : void * * alloc_mem = &alloc_region;
4170 0 : fd_slot_hashes_decode_inner_global( mem, alloc_mem, ctx );
4171 0 : return self;
4172 0 : }
4173 0 : void fd_slot_hashes_new(fd_slot_hashes_t * self) {
4174 0 : fd_memset( self, 0, sizeof(fd_slot_hashes_t) );
4175 0 : }
4176 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 ) {
4177 0 : (void) varint;
4178 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_hashes", level++, 0 );
4179 :
4180 : /* Walk deque */
4181 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++, 0 );
4182 0 : if( self->hashes ) {
4183 0 : for( deq_fd_slot_hash_t_iter_t iter = deq_fd_slot_hash_t_iter_init( self->hashes );
4184 0 : !deq_fd_slot_hash_t_iter_done( self->hashes, iter );
4185 0 : iter = deq_fd_slot_hash_t_iter_next( self->hashes, iter ) ) {
4186 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
4187 0 : fd_slot_hash_walk(w, ele, fun, "hashes", level, 0 );
4188 0 : }
4189 0 : }
4190 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level--, 0 );
4191 : /* Done walking deque */
4192 :
4193 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_hashes", level--, 0 );
4194 0 : }
4195 0 : ulong fd_slot_hashes_size( fd_slot_hashes_t const * self ) {
4196 0 : ulong size = 0;
4197 0 : if( self->hashes ) {
4198 0 : size += sizeof(ulong);
4199 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 ) ) {
4200 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
4201 0 : size += fd_slot_hash_size( ele );
4202 0 : }
4203 0 : } else {
4204 0 : size += sizeof(ulong);
4205 0 : }
4206 0 : return size;
4207 0 : }
4208 :
4209 0 : ulong fd_slot_hashes_size_global( fd_slot_hashes_global_t const * self ) {
4210 0 : ulong size = 0;
4211 0 : if( self->hashes_offset!=0 ) {
4212 0 : fd_slot_hash_t * hashes = (fd_slot_hash_t *)deq_fd_slot_hash_t_join( fd_type_pun( (uchar *)self + self->hashes_offset ) );
4213 0 : size += sizeof(ulong);
4214 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 ) ) {
4215 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( hashes, iter );
4216 0 : size += fd_slot_hash_size( ele );
4217 0 : }
4218 0 : } else {
4219 0 : size += sizeof(ulong);
4220 0 : }
4221 0 : return size;
4222 0 : }
4223 :
4224 0 : int fd_block_block_hash_entry_encode( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4225 0 : int err;
4226 0 : err = fd_hash_encode( &self->blockhash, ctx );
4227 0 : if( FD_UNLIKELY( err ) ) return err;
4228 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
4229 0 : if( FD_UNLIKELY( err ) ) return err;
4230 0 : return FD_BINCODE_SUCCESS;
4231 0 : }
4232 0 : static inline int fd_block_block_hash_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4233 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4234 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
4235 0 : return 0;
4236 0 : }
4237 33975 : static void fd_block_block_hash_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4238 33975 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)struct_mem;
4239 33975 : fd_hash_decode_inner( &self->blockhash, alloc_mem, ctx );
4240 33975 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
4241 33975 : }
4242 0 : void * fd_block_block_hash_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4243 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)mem;
4244 0 : fd_block_block_hash_entry_new( self );
4245 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_block_hash_entry_t);
4246 0 : void * * alloc_mem = &alloc_region;
4247 0 : fd_block_block_hash_entry_decode_inner( mem, alloc_mem, ctx );
4248 0 : return self;
4249 0 : }
4250 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 ) {
4251 0 : (void) varint;
4252 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_block_block_hash_entry", level++, 0 );
4253 0 : fd_hash_walk( w, &self->blockhash, fun, "blockhash", level, 0 );
4254 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
4255 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_block_block_hash_entry", level--, 0 );
4256 0 : }
4257 0 : int fd_recent_block_hashes_encode( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4258 0 : int err;
4259 0 : if( self->hashes ) {
4260 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
4261 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4262 0 : if( FD_UNLIKELY( err ) ) return err;
4263 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 ) ) {
4264 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
4265 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
4266 0 : if( FD_UNLIKELY( err ) ) return err;
4267 0 : }
4268 0 : } else {
4269 0 : ulong hashes_len = 0;
4270 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4271 0 : if( FD_UNLIKELY( err ) ) return err;
4272 0 : }
4273 0 : return FD_BINCODE_SUCCESS;
4274 0 : }
4275 0 : int fd_recent_block_hashes_encode_global( fd_recent_block_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4276 0 : int err;
4277 0 : if( self->hashes_offset ) {
4278 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
4279 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join( hashes_laddr );
4280 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( hashes );
4281 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4282 0 : if( FD_UNLIKELY( err ) ) return err;
4283 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 ) ) {
4284 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( hashes, iter );
4285 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
4286 0 : if( FD_UNLIKELY( err ) ) return err;
4287 0 : }
4288 0 : } else {
4289 0 : ulong hashes_len = 0;
4290 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
4291 0 : if( FD_UNLIKELY( err ) ) return err;
4292 0 : }
4293 0 : return FD_BINCODE_SUCCESS;
4294 0 : }
4295 456 : static int fd_recent_block_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4296 456 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4297 456 : int err = 0;
4298 456 : ulong hashes_len;
4299 456 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
4300 456 : if( FD_UNLIKELY( err ) ) return err;
4301 456 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
4302 456 : *total_sz += deq_fd_block_block_hash_entry_t_align() + deq_fd_block_block_hash_entry_t_footprint( hashes_max );
4303 456 : ulong hashes_sz;
4304 456 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
4305 456 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
4306 456 : if( FD_UNLIKELY( err ) ) return err;
4307 456 : return 0;
4308 456 : }
4309 456 : int fd_recent_block_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4310 456 : *total_sz += sizeof(fd_recent_block_hashes_t);
4311 456 : void const * start_data = ctx->data;
4312 456 : int err = fd_recent_block_hashes_decode_footprint_inner( ctx, total_sz );
4313 456 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4314 456 : ctx->data = start_data;
4315 456 : return err;
4316 456 : }
4317 0 : static void fd_recent_block_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4318 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)struct_mem;
4319 0 : ulong hashes_len;
4320 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4321 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
4322 0 : self->hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
4323 0 : for( ulong i=0; i < hashes_len; i++ ) {
4324 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
4325 0 : fd_block_block_hash_entry_new( elem );
4326 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
4327 0 : }
4328 0 : }
4329 0 : void * fd_recent_block_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4330 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)mem;
4331 0 : fd_recent_block_hashes_new( self );
4332 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_t);
4333 0 : void * * alloc_mem = &alloc_region;
4334 0 : fd_recent_block_hashes_decode_inner( mem, alloc_mem, ctx );
4335 0 : return self;
4336 0 : }
4337 453 : static void fd_recent_block_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4338 453 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)struct_mem;
4339 453 : ulong hashes_len;
4340 453 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
4341 453 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_block_block_hash_entry_t_align() );
4342 453 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
4343 453 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
4344 34428 : for( ulong i=0; i < hashes_len; i++ ) {
4345 33975 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( hashes );
4346 33975 : fd_block_block_hash_entry_new( (fd_block_block_hash_entry_t*)fd_type_pun( elem ) );
4347 33975 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
4348 33975 : }
4349 453 : self->hashes_offset = (ulong)deq_fd_block_block_hash_entry_t_leave( hashes ) - (ulong)struct_mem;
4350 453 : }
4351 453 : void * fd_recent_block_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4352 453 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)mem;
4353 453 : fd_recent_block_hashes_new( (fd_recent_block_hashes_t *)self );
4354 453 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_global_t);
4355 453 : void * * alloc_mem = &alloc_region;
4356 453 : fd_recent_block_hashes_decode_inner_global( mem, alloc_mem, ctx );
4357 453 : return self;
4358 453 : }
4359 453 : void fd_recent_block_hashes_new(fd_recent_block_hashes_t * self) {
4360 453 : fd_memset( self, 0, sizeof(fd_recent_block_hashes_t) );
4361 453 : }
4362 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 ) {
4363 0 : (void) varint;
4364 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_recent_block_hashes", level++, 0 );
4365 :
4366 : /* Walk deque */
4367 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR, "hashes", level++, 0 );
4368 0 : if( self->hashes ) {
4369 0 : for( deq_fd_block_block_hash_entry_t_iter_t iter = deq_fd_block_block_hash_entry_t_iter_init( self->hashes );
4370 0 : !deq_fd_block_block_hash_entry_t_iter_done( self->hashes, iter );
4371 0 : iter = deq_fd_block_block_hash_entry_t_iter_next( self->hashes, iter ) ) {
4372 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
4373 0 : fd_block_block_hash_entry_walk(w, ele, fun, "hashes", level, 0 );
4374 0 : }
4375 0 : }
4376 0 : fun( w, self->hashes, "hashes", FD_FLAMENCO_TYPE_ARR_END, "hashes", level--, 0 );
4377 : /* Done walking deque */
4378 :
4379 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_recent_block_hashes", level--, 0 );
4380 0 : }
4381 0 : ulong fd_recent_block_hashes_size( fd_recent_block_hashes_t const * self ) {
4382 0 : ulong size = 0;
4383 0 : if( self->hashes ) {
4384 0 : size += sizeof(ulong);
4385 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 ) ) {
4386 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
4387 0 : size += fd_block_block_hash_entry_size( ele );
4388 0 : }
4389 0 : } else {
4390 0 : size += sizeof(ulong);
4391 0 : }
4392 0 : return size;
4393 0 : }
4394 :
4395 0 : ulong fd_recent_block_hashes_size_global( fd_recent_block_hashes_global_t const * self ) {
4396 0 : ulong size = 0;
4397 0 : if( self->hashes_offset!=0 ) {
4398 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 ) );
4399 0 : size += sizeof(ulong);
4400 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 ) ) {
4401 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( hashes, iter );
4402 0 : size += fd_block_block_hash_entry_size( ele );
4403 0 : }
4404 0 : } else {
4405 0 : size += sizeof(ulong);
4406 0 : }
4407 0 : return size;
4408 0 : }
4409 :
4410 0 : int fd_slot_meta_encode( fd_slot_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4411 0 : int err;
4412 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
4413 0 : if( FD_UNLIKELY( err ) ) return err;
4414 0 : err = fd_bincode_uint64_encode( self->consumed, ctx );
4415 0 : if( FD_UNLIKELY( err ) ) return err;
4416 0 : err = fd_bincode_uint64_encode( self->received, ctx );
4417 0 : if( FD_UNLIKELY( err ) ) return err;
4418 0 : err = fd_bincode_uint64_encode( (ulong)self->first_shred_timestamp, ctx );
4419 0 : if( FD_UNLIKELY( err ) ) return err;
4420 0 : err = fd_bincode_uint64_encode( self->last_index, ctx );
4421 0 : if( FD_UNLIKELY( err ) ) return err;
4422 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
4423 0 : if( FD_UNLIKELY( err ) ) return err;
4424 0 : err = fd_bincode_uint64_encode( self->next_slot_len, ctx );
4425 0 : if( FD_UNLIKELY(err) ) return err;
4426 0 : if( self->next_slot_len ) {
4427 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
4428 0 : err = fd_bincode_uint64_encode( self->next_slot[i], ctx );
4429 0 : }
4430 0 : }
4431 0 : err = fd_bincode_uint8_encode( (uchar)(self->is_connected), ctx );
4432 0 : if( FD_UNLIKELY( err ) ) return err;
4433 0 : return FD_BINCODE_SUCCESS;
4434 0 : }
4435 0 : static int fd_slot_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4436 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4437 0 : int err = 0;
4438 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4439 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4440 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4441 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4442 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4443 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4444 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4445 0 : if( FD_UNLIKELY( err ) ) return err;
4446 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4447 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4448 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4449 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4450 0 : ulong next_slot_len;
4451 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
4452 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4453 0 : if( next_slot_len ) {
4454 0 : *total_sz += 8UL + sizeof(ulong)*next_slot_len;
4455 0 : for( ulong i=0; i < next_slot_len; i++ ) {
4456 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4457 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4458 0 : }
4459 0 : }
4460 0 : err = fd_bincode_uint8_decode_footprint( ctx );
4461 0 : if( FD_UNLIKELY( err ) ) return err;
4462 0 : return 0;
4463 0 : }
4464 0 : int fd_slot_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4465 0 : *total_sz += sizeof(fd_slot_meta_t);
4466 0 : void const * start_data = ctx->data;
4467 0 : int err = fd_slot_meta_decode_footprint_inner( ctx, total_sz );
4468 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4469 0 : ctx->data = start_data;
4470 0 : return err;
4471 0 : }
4472 0 : static void fd_slot_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4473 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)struct_mem;
4474 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
4475 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
4476 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
4477 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
4478 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
4479 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
4480 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
4481 0 : if( self->next_slot_len ) {
4482 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
4483 0 : self->next_slot = *alloc_mem;
4484 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->next_slot_len;
4485 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
4486 0 : fd_bincode_uint64_decode_unsafe( self->next_slot + i, ctx );
4487 0 : }
4488 0 : } else
4489 0 : self->next_slot = NULL;
4490 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
4491 0 : }
4492 0 : void * fd_slot_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4493 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)mem;
4494 0 : fd_slot_meta_new( self );
4495 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_meta_t);
4496 0 : void * * alloc_mem = &alloc_region;
4497 0 : fd_slot_meta_decode_inner( mem, alloc_mem, ctx );
4498 0 : return self;
4499 0 : }
4500 0 : void fd_slot_meta_new(fd_slot_meta_t * self) {
4501 0 : fd_memset( self, 0, sizeof(fd_slot_meta_t) );
4502 0 : }
4503 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 ) {
4504 0 : (void) varint;
4505 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_slot_meta", level++, 0 );
4506 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4507 0 : fun( w, &self->consumed, "consumed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4508 0 : fun( w, &self->received, "received", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4509 0 : fun( w, &self->first_shred_timestamp, "first_shred_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
4510 0 : fun( w, &self->last_index, "last_index", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4511 0 : fun( w, &self->parent_slot, "parent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4512 0 : if( self->next_slot_len ) {
4513 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4514 0 : for( ulong i=0; i < self->next_slot_len; i++ )
4515 0 : fun( w, self->next_slot + i, "next_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4516 0 : fun( w, NULL, "next_slot", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4517 0 : }
4518 0 : fun( w, &self->is_connected, "is_connected", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
4519 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_slot_meta", level--, 0 );
4520 0 : }
4521 0 : ulong fd_slot_meta_size( fd_slot_meta_t const * self ) {
4522 0 : ulong size = 0;
4523 0 : size += sizeof(ulong);
4524 0 : size += sizeof(ulong);
4525 0 : size += sizeof(ulong);
4526 0 : size += sizeof(long);
4527 0 : size += sizeof(ulong);
4528 0 : size += sizeof(ulong);
4529 0 : do {
4530 0 : size += sizeof(ulong);
4531 0 : size += self->next_slot_len * sizeof(ulong);
4532 0 : } while(0);
4533 0 : size += sizeof(char);
4534 0 : return size;
4535 0 : }
4536 :
4537 0 : int fd_sysvar_fees_encode( fd_sysvar_fees_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4538 0 : int err;
4539 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
4540 0 : if( FD_UNLIKELY( err ) ) return err;
4541 0 : return FD_BINCODE_SUCCESS;
4542 0 : }
4543 0 : static inline int fd_sysvar_fees_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4544 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4545 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
4546 0 : return 0;
4547 0 : }
4548 0 : static void fd_sysvar_fees_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4549 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)struct_mem;
4550 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
4551 0 : }
4552 0 : void * fd_sysvar_fees_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4553 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)mem;
4554 0 : fd_sysvar_fees_new( self );
4555 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_fees_t);
4556 0 : void * * alloc_mem = &alloc_region;
4557 0 : fd_sysvar_fees_decode_inner( mem, alloc_mem, ctx );
4558 0 : return self;
4559 0 : }
4560 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 ) {
4561 0 : (void) varint;
4562 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_fees", level++, 0 );
4563 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
4564 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_fees", level--, 0 );
4565 0 : }
4566 0 : int fd_sysvar_epoch_rewards_encode( fd_sysvar_epoch_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4567 0 : int err;
4568 0 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
4569 0 : if( FD_UNLIKELY( err ) ) return err;
4570 0 : err = fd_bincode_uint64_encode( self->num_partitions, ctx );
4571 0 : if( FD_UNLIKELY( err ) ) return err;
4572 0 : err = fd_hash_encode( &self->parent_blockhash, ctx );
4573 0 : if( FD_UNLIKELY( err ) ) return err;
4574 0 : err = fd_bincode_uint128_encode( self->total_points, ctx );
4575 0 : if( FD_UNLIKELY( err ) ) return err;
4576 0 : err = fd_bincode_uint64_encode( self->total_rewards, ctx );
4577 0 : if( FD_UNLIKELY( err ) ) return err;
4578 0 : err = fd_bincode_uint64_encode( self->distributed_rewards, ctx );
4579 0 : if( FD_UNLIKELY( err ) ) return err;
4580 0 : err = fd_bincode_bool_encode( (uchar)(self->active), ctx );
4581 0 : if( FD_UNLIKELY( err ) ) return err;
4582 0 : return FD_BINCODE_SUCCESS;
4583 0 : }
4584 3 : static int fd_sysvar_epoch_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4585 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4586 3 : int err = 0;
4587 3 : err = fd_bincode_uint64_decode_footprint( ctx );
4588 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4589 3 : err = fd_bincode_uint64_decode_footprint( ctx );
4590 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4591 3 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4592 3 : if( FD_UNLIKELY( err ) ) return err;
4593 3 : err = fd_bincode_uint128_decode_footprint( ctx );
4594 3 : if( FD_UNLIKELY( err ) ) return err;
4595 3 : err = fd_bincode_uint64_decode_footprint( ctx );
4596 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4597 3 : err = fd_bincode_uint64_decode_footprint( ctx );
4598 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4599 3 : err = fd_bincode_bool_decode_footprint( ctx );
4600 3 : if( FD_UNLIKELY( err ) ) return err;
4601 3 : return 0;
4602 3 : }
4603 3 : int fd_sysvar_epoch_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4604 3 : *total_sz += sizeof(fd_sysvar_epoch_rewards_t);
4605 3 : void const * start_data = ctx->data;
4606 3 : int err = fd_sysvar_epoch_rewards_decode_footprint_inner( ctx, total_sz );
4607 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4608 3 : ctx->data = start_data;
4609 3 : return err;
4610 3 : }
4611 0 : static void fd_sysvar_epoch_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4612 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)struct_mem;
4613 0 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
4614 0 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
4615 0 : fd_hash_decode_inner( &self->parent_blockhash, alloc_mem, ctx );
4616 0 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
4617 0 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
4618 0 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
4619 0 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
4620 0 : }
4621 0 : void * fd_sysvar_epoch_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4622 0 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)mem;
4623 0 : fd_sysvar_epoch_rewards_new( self );
4624 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_epoch_rewards_t);
4625 0 : void * * alloc_mem = &alloc_region;
4626 0 : fd_sysvar_epoch_rewards_decode_inner( mem, alloc_mem, ctx );
4627 0 : return self;
4628 0 : }
4629 0 : void fd_sysvar_epoch_rewards_new(fd_sysvar_epoch_rewards_t * self) {
4630 0 : fd_memset( self, 0, sizeof(fd_sysvar_epoch_rewards_t) );
4631 0 : fd_hash_new( &self->parent_blockhash );
4632 0 : }
4633 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 ) {
4634 0 : (void) varint;
4635 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_sysvar_epoch_rewards", level++, 0 );
4636 0 : fun( w, &self->distribution_starting_block_height, "distribution_starting_block_height", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4637 0 : fun( w, &self->num_partitions, "num_partitions", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4638 0 : fd_hash_walk( w, &self->parent_blockhash, fun, "parent_blockhash", level, 0 );
4639 0 : fun( w, &self->total_points, "total_points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
4640 0 : fun( w, &self->total_rewards, "total_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4641 0 : fun( w, &self->distributed_rewards, "distributed_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4642 0 : fun( w, &self->active, "active", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
4643 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_sysvar_epoch_rewards", level--, 0 );
4644 0 : }
4645 0 : int fd_config_keys_pair_encode( fd_config_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4646 0 : int err;
4647 0 : err = fd_pubkey_encode( &self->key, ctx );
4648 0 : if( FD_UNLIKELY( err ) ) return err;
4649 0 : err = fd_bincode_bool_encode( (uchar)(self->signer), ctx );
4650 0 : if( FD_UNLIKELY( err ) ) return err;
4651 0 : return FD_BINCODE_SUCCESS;
4652 0 : }
4653 0 : static int fd_config_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4654 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4655 0 : int err = 0;
4656 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4657 0 : if( FD_UNLIKELY( err ) ) return err;
4658 0 : err = fd_bincode_bool_decode_footprint( ctx );
4659 0 : if( FD_UNLIKELY( err ) ) return err;
4660 0 : return 0;
4661 0 : }
4662 0 : int fd_config_keys_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4663 0 : *total_sz += sizeof(fd_config_keys_pair_t);
4664 0 : void const * start_data = ctx->data;
4665 0 : int err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
4666 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4667 0 : ctx->data = start_data;
4668 0 : return err;
4669 0 : }
4670 0 : static void fd_config_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4671 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)struct_mem;
4672 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
4673 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
4674 0 : }
4675 0 : void * fd_config_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4676 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)mem;
4677 0 : fd_config_keys_pair_new( self );
4678 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_pair_t);
4679 0 : void * * alloc_mem = &alloc_region;
4680 0 : fd_config_keys_pair_decode_inner( mem, alloc_mem, ctx );
4681 0 : return self;
4682 0 : }
4683 0 : void fd_config_keys_pair_new(fd_config_keys_pair_t * self) {
4684 0 : fd_memset( self, 0, sizeof(fd_config_keys_pair_t) );
4685 0 : fd_pubkey_new( &self->key );
4686 0 : }
4687 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 ) {
4688 0 : (void) varint;
4689 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys_pair", level++, 0 );
4690 0 : fd_pubkey_walk( w, &self->key, fun, "key", level, 0 );
4691 0 : fun( w, &self->signer, "signer", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
4692 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys_pair", level--, 0 );
4693 0 : }
4694 12 : int fd_stake_config_encode( fd_stake_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4695 12 : int err;
4696 12 : err = fd_bincode_compact_u16_encode( &self->config_keys_len, ctx );
4697 12 : if( FD_UNLIKELY(err) ) return err;
4698 12 : if( self->config_keys_len ) {
4699 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
4700 0 : err = fd_config_keys_pair_encode( self->config_keys + i, ctx );
4701 0 : if( FD_UNLIKELY( err ) ) return err;
4702 0 : }
4703 0 : }
4704 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
4705 12 : if( FD_UNLIKELY( err ) ) return err;
4706 12 : err = fd_bincode_uint8_encode( (uchar)(self->slash_penalty), ctx );
4707 12 : if( FD_UNLIKELY( err ) ) return err;
4708 12 : return FD_BINCODE_SUCCESS;
4709 12 : }
4710 0 : static int fd_stake_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4711 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4712 0 : int err = 0;
4713 0 : ushort config_keys_len;
4714 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
4715 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4716 0 : if( config_keys_len ) {
4717 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*config_keys_len;
4718 0 : for( ulong i=0; i < config_keys_len; i++ ) {
4719 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
4720 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4721 0 : }
4722 0 : }
4723 0 : err = fd_bincode_double_decode_footprint( ctx );
4724 0 : if( FD_UNLIKELY( err ) ) return err;
4725 0 : err = fd_bincode_uint8_decode_footprint( ctx );
4726 0 : if( FD_UNLIKELY( err ) ) return err;
4727 0 : return 0;
4728 0 : }
4729 0 : int fd_stake_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4730 0 : *total_sz += sizeof(fd_stake_config_t);
4731 0 : void const * start_data = ctx->data;
4732 0 : int err = fd_stake_config_decode_footprint_inner( ctx, total_sz );
4733 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4734 0 : ctx->data = start_data;
4735 0 : return err;
4736 0 : }
4737 0 : static void fd_stake_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4738 0 : fd_stake_config_t * self = (fd_stake_config_t *)struct_mem;
4739 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
4740 0 : if( self->config_keys_len ) {
4741 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
4742 0 : self->config_keys = *alloc_mem;
4743 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->config_keys_len;
4744 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
4745 0 : fd_config_keys_pair_new( self->config_keys + i );
4746 0 : fd_config_keys_pair_decode_inner( self->config_keys + i, alloc_mem, ctx );
4747 0 : }
4748 0 : } else
4749 0 : self->config_keys = NULL;
4750 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
4751 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
4752 0 : }
4753 0 : void * fd_stake_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4754 0 : fd_stake_config_t * self = (fd_stake_config_t *)mem;
4755 0 : fd_stake_config_new( self );
4756 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_config_t);
4757 0 : void * * alloc_mem = &alloc_region;
4758 0 : fd_stake_config_decode_inner( mem, alloc_mem, ctx );
4759 0 : return self;
4760 0 : }
4761 0 : void fd_stake_config_new(fd_stake_config_t * self) {
4762 0 : fd_memset( self, 0, sizeof(fd_stake_config_t) );
4763 0 : }
4764 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 ) {
4765 0 : (void) varint;
4766 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_config", level++, 0 );
4767 0 : fun( w, &self->config_keys_len, "config_keys_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
4768 0 : if( self->config_keys_len ) {
4769 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
4770 0 : for( ulong i=0; i < self->config_keys_len; i++ )
4771 0 : fd_config_keys_pair_walk(w, self->config_keys + i, fun, "config_keys_pair", level, 0 );
4772 0 : fun( w, NULL, "config_keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
4773 0 : }
4774 0 : fun( w, &self->warmup_cooldown_rate, "warmup_cooldown_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
4775 0 : fun( w, &self->slash_penalty, "slash_penalty", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
4776 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_config", level--, 0 );
4777 0 : }
4778 0 : ulong fd_stake_config_size( fd_stake_config_t const * self ) {
4779 0 : ulong size = 0;
4780 0 : do {
4781 0 : ushort tmp = (ushort)self->config_keys_len;
4782 0 : size += fd_bincode_compact_u16_size( &tmp );
4783 0 : for( ulong i=0; i < self->config_keys_len; i++ )
4784 0 : size += fd_config_keys_pair_size( self->config_keys + i );
4785 0 : } while(0);
4786 0 : size += sizeof(double);
4787 0 : size += sizeof(char);
4788 0 : return size;
4789 0 : }
4790 :
4791 0 : FD_FN_PURE uchar fd_cluster_type_is_Testnet(fd_cluster_type_t const * self) {
4792 0 : return self->discriminant == 0;
4793 0 : }
4794 0 : FD_FN_PURE uchar fd_cluster_type_is_MainnetBeta(fd_cluster_type_t const * self) {
4795 0 : return self->discriminant == 1;
4796 0 : }
4797 0 : FD_FN_PURE uchar fd_cluster_type_is_Devnet(fd_cluster_type_t const * self) {
4798 0 : return self->discriminant == 2;
4799 0 : }
4800 0 : FD_FN_PURE uchar fd_cluster_type_is_Development(fd_cluster_type_t const * self) {
4801 0 : return self->discriminant == 3;
4802 0 : }
4803 0 : int fd_cluster_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4804 0 : int err;
4805 0 : switch (discriminant) {
4806 0 : case 0: {
4807 0 : return FD_BINCODE_SUCCESS;
4808 0 : }
4809 0 : case 1: {
4810 0 : return FD_BINCODE_SUCCESS;
4811 0 : }
4812 0 : case 2: {
4813 0 : return FD_BINCODE_SUCCESS;
4814 0 : }
4815 0 : case 3: {
4816 0 : return FD_BINCODE_SUCCESS;
4817 0 : }
4818 0 : default: return FD_BINCODE_ERR_ENCODING;
4819 0 : }
4820 0 : }
4821 0 : static int fd_cluster_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4822 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4823 0 : uint discriminant = 0;
4824 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4825 0 : if( FD_UNLIKELY( err ) ) return err;
4826 0 : return fd_cluster_type_inner_decode_footprint( discriminant, ctx, total_sz );
4827 0 : }
4828 0 : int fd_cluster_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4829 0 : *total_sz += sizeof(fd_cluster_type_t);
4830 0 : void const * start_data = ctx->data;
4831 0 : int err = fd_cluster_type_decode_footprint_inner( ctx, total_sz );
4832 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4833 0 : ctx->data = start_data;
4834 0 : return err;
4835 0 : }
4836 0 : static void fd_cluster_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4837 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)struct_mem;
4838 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4839 0 : }
4840 0 : void * fd_cluster_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4841 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)mem;
4842 0 : fd_cluster_type_new( self );
4843 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_type_t);
4844 0 : void * * alloc_mem = &alloc_region;
4845 0 : fd_cluster_type_decode_inner( mem, alloc_mem, ctx );
4846 0 : return self;
4847 0 : }
4848 :
4849 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 ) {
4850 0 : (void) varint;
4851 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_cluster_type", level++, 0);
4852 0 : switch( self->discriminant ) {
4853 0 : case 0: {
4854 0 : fun( w, self, "Testnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
4855 0 : break;
4856 0 : }
4857 0 : case 1: {
4858 0 : fun( w, self, "MainnetBeta", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
4859 0 : break;
4860 0 : }
4861 0 : case 2: {
4862 0 : fun( w, self, "Devnet", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
4863 0 : break;
4864 0 : }
4865 0 : case 3: {
4866 0 : fun( w, self, "Development", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
4867 0 : break;
4868 0 : }
4869 0 : }
4870 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_cluster_type", level--, 0 );
4871 0 : }
4872 0 : ulong fd_cluster_type_size( fd_cluster_type_t const * self ) {
4873 0 : ulong size = 0;
4874 0 : size += sizeof(uint);
4875 0 : switch (self->discriminant) {
4876 0 : }
4877 0 : return size;
4878 0 : }
4879 :
4880 0 : int fd_cluster_type_encode( fd_cluster_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4881 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4882 0 : if( FD_UNLIKELY( err ) ) return err;
4883 0 : return err;
4884 0 : }
4885 :
4886 0 : int fd_cluster_version_encode( fd_cluster_version_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4887 0 : int err;
4888 0 : err = fd_bincode_uint32_encode( self->major, ctx );
4889 0 : if( FD_UNLIKELY( err ) ) return err;
4890 0 : err = fd_bincode_uint32_encode( self->minor, ctx );
4891 0 : if( FD_UNLIKELY( err ) ) return err;
4892 0 : err = fd_bincode_uint32_encode( self->patch, ctx );
4893 0 : if( FD_UNLIKELY( err ) ) return err;
4894 0 : return FD_BINCODE_SUCCESS;
4895 0 : }
4896 0 : static inline int fd_cluster_version_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4897 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4898 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
4899 0 : return 0;
4900 0 : }
4901 0 : static void fd_cluster_version_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4902 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)struct_mem;
4903 0 : fd_bincode_uint32_decode_unsafe( &self->major, ctx );
4904 0 : fd_bincode_uint32_decode_unsafe( &self->minor, ctx );
4905 0 : fd_bincode_uint32_decode_unsafe( &self->patch, ctx );
4906 0 : }
4907 0 : void * fd_cluster_version_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4908 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)mem;
4909 0 : fd_cluster_version_new( self );
4910 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_version_t);
4911 0 : void * * alloc_mem = &alloc_region;
4912 0 : fd_cluster_version_decode_inner( mem, alloc_mem, ctx );
4913 0 : return self;
4914 0 : }
4915 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 ) {
4916 0 : (void) varint;
4917 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_cluster_version", level++, 0 );
4918 0 : fun( w, &self->major, "major", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
4919 0 : fun( w, &self->minor, "minor", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
4920 0 : fun( w, &self->patch, "patch", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
4921 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_cluster_version", level--, 0 );
4922 0 : }
4923 0 : int fd_stake_reward_encode( fd_stake_reward_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4924 0 : int err;
4925 0 : err = fd_pubkey_encode( &self->stake_pubkey, ctx );
4926 0 : if( FD_UNLIKELY( err ) ) return err;
4927 0 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
4928 0 : if( FD_UNLIKELY( err ) ) return err;
4929 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
4930 0 : if( FD_UNLIKELY( err ) ) return err;
4931 0 : err = fd_bincode_uint8_encode( (uchar)(self->valid), ctx );
4932 0 : if( FD_UNLIKELY( err ) ) return err;
4933 0 : return FD_BINCODE_SUCCESS;
4934 0 : }
4935 0 : static inline int fd_stake_reward_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4936 0 : if( (ulong)ctx->data + 49UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4937 0 : ctx->data = (void *)( (ulong)ctx->data + 49UL );
4938 0 : return 0;
4939 0 : }
4940 0 : static void fd_stake_reward_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4941 0 : fd_stake_reward_t * self = (fd_stake_reward_t *)struct_mem;
4942 0 : fd_pubkey_decode_inner( &self->stake_pubkey, alloc_mem, ctx );
4943 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
4944 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
4945 0 : fd_bincode_uint8_decode_unsafe( &self->valid, ctx );
4946 0 : }
4947 0 : void * fd_stake_reward_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4948 0 : fd_stake_reward_t * self = (fd_stake_reward_t *)mem;
4949 0 : fd_stake_reward_new( self );
4950 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_reward_t);
4951 0 : void * * alloc_mem = &alloc_region;
4952 0 : fd_stake_reward_decode_inner( mem, alloc_mem, ctx );
4953 0 : return self;
4954 0 : }
4955 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 ) {
4956 0 : (void) varint;
4957 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_reward", level++, 0 );
4958 0 : fd_pubkey_walk( w, &self->stake_pubkey, fun, "stake_pubkey", level, 0 );
4959 0 : fun( w, &self->credits_observed, "credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4960 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
4961 0 : fun( w, &self->valid, "valid", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
4962 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_reward", level--, 0 );
4963 0 : }
4964 0 : int fd_partitioned_rewards_calculation_encode( fd_partitioned_rewards_calculation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4965 0 : int err;
4966 0 : err = fd_bincode_uint128_encode( self->validator_points, ctx );
4967 0 : if( FD_UNLIKELY( err ) ) return err;
4968 0 : err = fd_bincode_uint64_encode( self->old_vote_balance_and_staked, ctx );
4969 0 : if( FD_UNLIKELY( err ) ) return err;
4970 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
4971 0 : if( FD_UNLIKELY( err ) ) return err;
4972 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
4973 0 : if( FD_UNLIKELY( err ) ) return err;
4974 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
4975 0 : if( FD_UNLIKELY( err ) ) return err;
4976 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
4977 0 : if( FD_UNLIKELY( err ) ) return err;
4978 0 : err = fd_bincode_uint64_encode( self->capitalization, ctx );
4979 0 : if( FD_UNLIKELY( err ) ) return err;
4980 0 : return FD_BINCODE_SUCCESS;
4981 0 : }
4982 0 : static inline int fd_partitioned_rewards_calculation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4983 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4984 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
4985 0 : return 0;
4986 0 : }
4987 0 : static void fd_partitioned_rewards_calculation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4988 0 : fd_partitioned_rewards_calculation_t * self = (fd_partitioned_rewards_calculation_t *)struct_mem;
4989 0 : fd_bincode_uint128_decode_unsafe( &self->validator_points, ctx );
4990 0 : fd_bincode_uint64_decode_unsafe( &self->old_vote_balance_and_staked, ctx );
4991 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
4992 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
4993 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
4994 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
4995 0 : fd_bincode_uint64_decode_unsafe( &self->capitalization, ctx );
4996 0 : }
4997 0 : void * fd_partitioned_rewards_calculation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4998 0 : fd_partitioned_rewards_calculation_t * self = (fd_partitioned_rewards_calculation_t *)mem;
4999 0 : fd_partitioned_rewards_calculation_new( self );
5000 0 : void * alloc_region = (uchar *)mem + sizeof(fd_partitioned_rewards_calculation_t);
5001 0 : void * * alloc_mem = &alloc_region;
5002 0 : fd_partitioned_rewards_calculation_decode_inner( mem, alloc_mem, ctx );
5003 0 : return self;
5004 0 : }
5005 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 ) {
5006 0 : (void) varint;
5007 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_partitioned_rewards_calculation", level++, 0 );
5008 0 : fun( w, &self->validator_points, "validator_points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
5009 0 : fun( w, &self->old_vote_balance_and_staked, "old_vote_balance_and_staked", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5010 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5011 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
5012 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
5013 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
5014 0 : fun( w, &self->capitalization, "capitalization", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5015 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_partitioned_rewards_calculation", level--, 0 );
5016 0 : }
5017 0 : int fd_prev_epoch_inflation_rewards_encode( fd_prev_epoch_inflation_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5018 0 : int err;
5019 0 : err = fd_bincode_uint64_encode( self->validator_rewards, ctx );
5020 0 : if( FD_UNLIKELY( err ) ) return err;
5021 0 : err = fd_bincode_double_encode( self->prev_epoch_duration_in_years, ctx );
5022 0 : if( FD_UNLIKELY( err ) ) return err;
5023 0 : err = fd_bincode_double_encode( self->validator_rate, ctx );
5024 0 : if( FD_UNLIKELY( err ) ) return err;
5025 0 : err = fd_bincode_double_encode( self->foundation_rate, ctx );
5026 0 : if( FD_UNLIKELY( err ) ) return err;
5027 0 : return FD_BINCODE_SUCCESS;
5028 0 : }
5029 0 : static inline int fd_prev_epoch_inflation_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5030 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5031 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
5032 0 : return 0;
5033 0 : }
5034 0 : static void fd_prev_epoch_inflation_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5035 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)struct_mem;
5036 0 : fd_bincode_uint64_decode_unsafe( &self->validator_rewards, ctx );
5037 0 : fd_bincode_double_decode_unsafe( &self->prev_epoch_duration_in_years, ctx );
5038 0 : fd_bincode_double_decode_unsafe( &self->validator_rate, ctx );
5039 0 : fd_bincode_double_decode_unsafe( &self->foundation_rate, ctx );
5040 0 : }
5041 0 : void * fd_prev_epoch_inflation_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5042 0 : fd_prev_epoch_inflation_rewards_t * self = (fd_prev_epoch_inflation_rewards_t *)mem;
5043 0 : fd_prev_epoch_inflation_rewards_new( self );
5044 0 : void * alloc_region = (uchar *)mem + sizeof(fd_prev_epoch_inflation_rewards_t);
5045 0 : void * * alloc_mem = &alloc_region;
5046 0 : fd_prev_epoch_inflation_rewards_decode_inner( mem, alloc_mem, ctx );
5047 0 : return self;
5048 0 : }
5049 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 ) {
5050 0 : (void) varint;
5051 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_prev_epoch_inflation_rewards", level++, 0 );
5052 0 : fun( w, &self->validator_rewards, "validator_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5053 0 : fun( w, &self->prev_epoch_duration_in_years, "prev_epoch_duration_in_years", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
5054 0 : fun( w, &self->validator_rate, "validator_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
5055 0 : fun( w, &self->foundation_rate, "foundation_rate", FD_FLAMENCO_TYPE_DOUBLE, "double", level, 0 );
5056 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_prev_epoch_inflation_rewards", level--, 0 );
5057 0 : }
5058 0 : int fd_vote_encode( fd_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5059 0 : int err;
5060 0 : if( self->slots ) {
5061 0 : ulong slots_len = deq_ulong_cnt( self->slots );
5062 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
5063 0 : if( FD_UNLIKELY( err ) ) return err;
5064 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 ) ) {
5065 0 : ulong const * ele = deq_ulong_iter_ele_const( self->slots, iter );
5066 0 : err = fd_bincode_uint64_encode( ele[0], ctx );
5067 0 : }
5068 0 : } else {
5069 0 : ulong slots_len = 0;
5070 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
5071 0 : if( FD_UNLIKELY( err ) ) return err;
5072 0 : }
5073 0 : err = fd_hash_encode( &self->hash, ctx );
5074 0 : if( FD_UNLIKELY( err ) ) return err;
5075 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
5076 0 : if( FD_UNLIKELY( err ) ) return err;
5077 0 : if( self->has_timestamp ) {
5078 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
5079 0 : if( FD_UNLIKELY( err ) ) return err;
5080 0 : }
5081 0 : return FD_BINCODE_SUCCESS;
5082 0 : }
5083 0 : static int fd_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5084 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5085 0 : int err = 0;
5086 0 : ulong slots_len;
5087 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
5088 0 : if( FD_UNLIKELY( err ) ) return err;
5089 0 : ulong slots_max = slots_len == 0 ? 1 : slots_len;
5090 0 : *total_sz += deq_ulong_align() + deq_ulong_footprint( slots_max ) ;
5091 0 : ulong slots_sz;
5092 0 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
5093 0 : err = fd_bincode_bytes_decode_footprint( slots_sz, ctx );
5094 0 : if( FD_UNLIKELY( err ) ) return err;
5095 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
5096 0 : if( FD_UNLIKELY( err ) ) return err;
5097 0 : {
5098 0 : uchar o;
5099 0 : err = fd_bincode_bool_decode( &o, ctx );
5100 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5101 0 : if( o ) {
5102 0 : err = fd_bincode_int64_decode_footprint( ctx );
5103 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5104 0 : }
5105 0 : }
5106 0 : return 0;
5107 0 : }
5108 0 : int fd_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5109 0 : *total_sz += sizeof(fd_vote_t);
5110 0 : void const * start_data = ctx->data;
5111 0 : int err = fd_vote_decode_footprint_inner( ctx, total_sz );
5112 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5113 0 : ctx->data = start_data;
5114 0 : return err;
5115 0 : }
5116 0 : static void fd_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5117 0 : fd_vote_t * self = (fd_vote_t *)struct_mem;
5118 0 : ulong slots_len;
5119 0 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
5120 0 : self->slots = deq_ulong_join_new( alloc_mem, slots_len );
5121 0 : for( ulong i=0; i < slots_len; i++ ) {
5122 0 : ulong * elem = deq_ulong_push_tail_nocopy( self->slots );
5123 0 : fd_bincode_uint64_decode_unsafe( elem, ctx );
5124 0 : }
5125 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
5126 0 : {
5127 0 : uchar o;
5128 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
5129 0 : self->has_timestamp = !!o;
5130 0 : if( o ) {
5131 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
5132 0 : }
5133 0 : }
5134 0 : }
5135 0 : void * fd_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5136 0 : fd_vote_t * self = (fd_vote_t *)mem;
5137 0 : fd_vote_new( self );
5138 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_t);
5139 0 : void * * alloc_mem = &alloc_region;
5140 0 : fd_vote_decode_inner( mem, alloc_mem, ctx );
5141 0 : return self;
5142 0 : }
5143 0 : void fd_vote_new(fd_vote_t * self) {
5144 0 : fd_memset( self, 0, sizeof(fd_vote_t) );
5145 0 : fd_hash_new( &self->hash );
5146 0 : }
5147 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 ) {
5148 0 : (void) varint;
5149 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote", level++, 0 );
5150 :
5151 : /* Walk deque */
5152 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR, "slots", level++, 0 );
5153 0 : if( self->slots ) {
5154 0 : for( deq_ulong_iter_t iter = deq_ulong_iter_init( self->slots );
5155 0 : !deq_ulong_iter_done( self->slots, iter );
5156 0 : iter = deq_ulong_iter_next( self->slots, iter ) ) {
5157 0 : ulong * ele = deq_ulong_iter_ele( self->slots, iter );
5158 0 : fun(w, ele, "ele", FD_FLAMENCO_TYPE_ULONG, "long", level, 0 );
5159 0 : }
5160 0 : }
5161 0 : fun( w, self->slots, "slots", FD_FLAMENCO_TYPE_ARR_END, "slots", level--, 0 );
5162 : /* Done walking deque */
5163 :
5164 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
5165 0 : if( !self->has_timestamp ) {
5166 0 : fun( w, NULL, "timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
5167 0 : } else {
5168 0 : fun( w, &self->timestamp, "timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
5169 0 : }
5170 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote", level--, 0 );
5171 0 : }
5172 0 : ulong fd_vote_size( fd_vote_t const * self ) {
5173 0 : ulong size = 0;
5174 0 : if( self->slots ) {
5175 0 : size += sizeof(ulong);
5176 0 : ulong slots_len = deq_ulong_cnt(self->slots);
5177 0 : size += slots_len * sizeof(ulong);
5178 0 : } else {
5179 0 : size += sizeof(ulong);
5180 0 : }
5181 0 : size += fd_hash_size( &self->hash );
5182 0 : size += sizeof(char);
5183 0 : if( self->has_timestamp ) {
5184 0 : size += sizeof(long);
5185 0 : }
5186 0 : return size;
5187 0 : }
5188 :
5189 0 : int fd_vote_init_encode( fd_vote_init_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5190 0 : int err;
5191 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
5192 0 : if( FD_UNLIKELY( err ) ) return err;
5193 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
5194 0 : if( FD_UNLIKELY( err ) ) return err;
5195 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
5196 0 : if( FD_UNLIKELY( err ) ) return err;
5197 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
5198 0 : if( FD_UNLIKELY( err ) ) return err;
5199 0 : return FD_BINCODE_SUCCESS;
5200 0 : }
5201 0 : static inline int fd_vote_init_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5202 0 : if( (ulong)ctx->data + 97UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5203 0 : ctx->data = (void *)( (ulong)ctx->data + 97UL );
5204 0 : return 0;
5205 0 : }
5206 0 : static void fd_vote_init_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5207 0 : fd_vote_init_t * self = (fd_vote_init_t *)struct_mem;
5208 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
5209 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
5210 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
5211 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
5212 0 : }
5213 0 : void * fd_vote_init_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5214 0 : fd_vote_init_t * self = (fd_vote_init_t *)mem;
5215 0 : fd_vote_init_new( self );
5216 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_t);
5217 0 : void * * alloc_mem = &alloc_region;
5218 0 : fd_vote_init_decode_inner( mem, alloc_mem, ctx );
5219 0 : return self;
5220 0 : }
5221 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 ) {
5222 0 : (void) varint;
5223 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_init", level++, 0 );
5224 0 : fd_pubkey_walk( w, &self->node_pubkey, fun, "node_pubkey", level, 0 );
5225 0 : fd_pubkey_walk( w, &self->authorized_voter, fun, "authorized_voter", level, 0 );
5226 0 : fd_pubkey_walk( w, &self->authorized_withdrawer, fun, "authorized_withdrawer", level, 0 );
5227 0 : fun( w, &self->commission, "commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5228 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_init", level--, 0 );
5229 0 : }
5230 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter(fd_vote_authorize_t const * self) {
5231 0 : return self->discriminant == 0;
5232 0 : }
5233 0 : FD_FN_PURE uchar fd_vote_authorize_is_withdrawer(fd_vote_authorize_t const * self) {
5234 0 : return self->discriminant == 1;
5235 0 : }
5236 0 : int fd_vote_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5237 0 : int err;
5238 0 : switch (discriminant) {
5239 0 : case 0: {
5240 0 : return FD_BINCODE_SUCCESS;
5241 0 : }
5242 0 : case 1: {
5243 0 : return FD_BINCODE_SUCCESS;
5244 0 : }
5245 0 : default: return FD_BINCODE_ERR_ENCODING;
5246 0 : }
5247 0 : }
5248 0 : static int fd_vote_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5249 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5250 0 : uint discriminant = 0;
5251 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
5252 0 : if( FD_UNLIKELY( err ) ) return err;
5253 0 : return fd_vote_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
5254 0 : }
5255 0 : int fd_vote_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5256 0 : *total_sz += sizeof(fd_vote_authorize_t);
5257 0 : void const * start_data = ctx->data;
5258 0 : int err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
5259 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5260 0 : ctx->data = start_data;
5261 0 : return err;
5262 0 : }
5263 0 : static void fd_vote_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5264 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)struct_mem;
5265 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5266 0 : }
5267 0 : void * fd_vote_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5268 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)mem;
5269 0 : fd_vote_authorize_new( self );
5270 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_t);
5271 0 : void * * alloc_mem = &alloc_region;
5272 0 : fd_vote_authorize_decode_inner( mem, alloc_mem, ctx );
5273 0 : return self;
5274 0 : }
5275 :
5276 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 ) {
5277 0 : (void) varint;
5278 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_authorize", level++, 0);
5279 0 : switch( self->discriminant ) {
5280 0 : case 0: {
5281 0 : fun( w, self, "voter", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5282 0 : break;
5283 0 : }
5284 0 : case 1: {
5285 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5286 0 : break;
5287 0 : }
5288 0 : }
5289 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_authorize", level--, 0 );
5290 0 : }
5291 0 : ulong fd_vote_authorize_size( fd_vote_authorize_t const * self ) {
5292 0 : ulong size = 0;
5293 0 : size += sizeof(uint);
5294 0 : switch (self->discriminant) {
5295 0 : }
5296 0 : return size;
5297 0 : }
5298 :
5299 0 : int fd_vote_authorize_encode( fd_vote_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5300 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
5301 0 : if( FD_UNLIKELY( err ) ) return err;
5302 0 : return err;
5303 0 : }
5304 :
5305 0 : int fd_vote_authorize_pubkey_encode( fd_vote_authorize_pubkey_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5306 0 : int err;
5307 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
5308 0 : if( FD_UNLIKELY( err ) ) return err;
5309 0 : err = fd_vote_authorize_encode( &self->vote_authorize, ctx );
5310 0 : if( FD_UNLIKELY( err ) ) return err;
5311 0 : return FD_BINCODE_SUCCESS;
5312 0 : }
5313 0 : static int fd_vote_authorize_pubkey_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5314 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5315 0 : int err = 0;
5316 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5317 0 : if( FD_UNLIKELY( err ) ) return err;
5318 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
5319 0 : if( FD_UNLIKELY( err ) ) return err;
5320 0 : return 0;
5321 0 : }
5322 0 : int fd_vote_authorize_pubkey_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5323 0 : *total_sz += sizeof(fd_vote_authorize_pubkey_t);
5324 0 : void const * start_data = ctx->data;
5325 0 : int err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
5326 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5327 0 : ctx->data = start_data;
5328 0 : return err;
5329 0 : }
5330 0 : static void fd_vote_authorize_pubkey_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5331 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)struct_mem;
5332 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
5333 0 : fd_vote_authorize_decode_inner( &self->vote_authorize, alloc_mem, ctx );
5334 0 : }
5335 0 : void * fd_vote_authorize_pubkey_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5336 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)mem;
5337 0 : fd_vote_authorize_pubkey_new( self );
5338 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_pubkey_t);
5339 0 : void * * alloc_mem = &alloc_region;
5340 0 : fd_vote_authorize_pubkey_decode_inner( mem, alloc_mem, ctx );
5341 0 : return self;
5342 0 : }
5343 0 : void fd_vote_authorize_pubkey_new(fd_vote_authorize_pubkey_t * self) {
5344 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_pubkey_t) );
5345 0 : fd_pubkey_new( &self->pubkey );
5346 0 : fd_vote_authorize_new( &self->vote_authorize );
5347 0 : }
5348 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 ) {
5349 0 : (void) varint;
5350 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_pubkey", level++, 0 );
5351 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
5352 0 : fd_vote_authorize_walk( w, &self->vote_authorize, fun, "vote_authorize", level, 0 );
5353 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_pubkey", level--, 0 );
5354 0 : }
5355 0 : int fd_vote_switch_encode( fd_vote_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5356 0 : int err;
5357 0 : err = fd_vote_encode( &self->vote, ctx );
5358 0 : if( FD_UNLIKELY( err ) ) return err;
5359 0 : err = fd_hash_encode( &self->hash, ctx );
5360 0 : if( FD_UNLIKELY( err ) ) return err;
5361 0 : return FD_BINCODE_SUCCESS;
5362 0 : }
5363 0 : static int fd_vote_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5364 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5365 0 : int err = 0;
5366 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
5367 0 : if( FD_UNLIKELY( err ) ) return err;
5368 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
5369 0 : if( FD_UNLIKELY( err ) ) return err;
5370 0 : return 0;
5371 0 : }
5372 0 : int fd_vote_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5373 0 : *total_sz += sizeof(fd_vote_switch_t);
5374 0 : void const * start_data = ctx->data;
5375 0 : int err = fd_vote_switch_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_vote_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5381 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)struct_mem;
5382 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
5383 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
5384 0 : }
5385 0 : void * fd_vote_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5386 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)mem;
5387 0 : fd_vote_switch_new( self );
5388 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_switch_t);
5389 0 : void * * alloc_mem = &alloc_region;
5390 0 : fd_vote_switch_decode_inner( mem, alloc_mem, ctx );
5391 0 : return self;
5392 0 : }
5393 0 : void fd_vote_switch_new(fd_vote_switch_t * self) {
5394 0 : fd_memset( self, 0, sizeof(fd_vote_switch_t) );
5395 0 : fd_vote_new( &self->vote );
5396 0 : fd_hash_new( &self->hash );
5397 0 : }
5398 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 ) {
5399 0 : (void) varint;
5400 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_switch", level++, 0 );
5401 0 : fd_vote_walk( w, &self->vote, fun, "vote", level, 0 );
5402 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
5403 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_switch", level--, 0 );
5404 0 : }
5405 0 : ulong fd_vote_switch_size( fd_vote_switch_t const * self ) {
5406 0 : ulong size = 0;
5407 0 : size += fd_vote_size( &self->vote );
5408 0 : size += fd_hash_size( &self->hash );
5409 0 : return size;
5410 0 : }
5411 :
5412 0 : int fd_update_vote_state_switch_encode( fd_update_vote_state_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5413 0 : int err;
5414 0 : err = fd_vote_state_update_encode( &self->vote_state_update, ctx );
5415 0 : if( FD_UNLIKELY( err ) ) return err;
5416 0 : err = fd_hash_encode( &self->hash, ctx );
5417 0 : if( FD_UNLIKELY( err ) ) return err;
5418 0 : return FD_BINCODE_SUCCESS;
5419 0 : }
5420 0 : static int fd_update_vote_state_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5421 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5422 0 : int err = 0;
5423 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
5424 0 : if( FD_UNLIKELY( err ) ) return err;
5425 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
5426 0 : if( FD_UNLIKELY( err ) ) return err;
5427 0 : return 0;
5428 0 : }
5429 0 : int fd_update_vote_state_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5430 0 : *total_sz += sizeof(fd_update_vote_state_switch_t);
5431 0 : void const * start_data = ctx->data;
5432 0 : int err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
5433 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5434 0 : ctx->data = start_data;
5435 0 : return err;
5436 0 : }
5437 0 : static void fd_update_vote_state_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5438 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)struct_mem;
5439 0 : fd_vote_state_update_decode_inner( &self->vote_state_update, alloc_mem, ctx );
5440 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
5441 0 : }
5442 0 : void * fd_update_vote_state_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5443 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)mem;
5444 0 : fd_update_vote_state_switch_new( self );
5445 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_vote_state_switch_t);
5446 0 : void * * alloc_mem = &alloc_region;
5447 0 : fd_update_vote_state_switch_decode_inner( mem, alloc_mem, ctx );
5448 0 : return self;
5449 0 : }
5450 0 : void fd_update_vote_state_switch_new(fd_update_vote_state_switch_t * self) {
5451 0 : fd_memset( self, 0, sizeof(fd_update_vote_state_switch_t) );
5452 0 : fd_vote_state_update_new( &self->vote_state_update );
5453 0 : fd_hash_new( &self->hash );
5454 0 : }
5455 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 ) {
5456 0 : (void) varint;
5457 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_update_vote_state_switch", level++, 0 );
5458 0 : fd_vote_state_update_walk( w, &self->vote_state_update, fun, "vote_state_update", level, 0 );
5459 0 : fd_hash_walk( w, &self->hash, fun, "hash", level, 0 );
5460 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_update_vote_state_switch", level--, 0 );
5461 0 : }
5462 0 : ulong fd_update_vote_state_switch_size( fd_update_vote_state_switch_t const * self ) {
5463 0 : ulong size = 0;
5464 0 : size += fd_vote_state_update_size( &self->vote_state_update );
5465 0 : size += fd_hash_size( &self->hash );
5466 0 : return size;
5467 0 : }
5468 :
5469 0 : int fd_vote_authorize_with_seed_args_encode( fd_vote_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5470 0 : int err;
5471 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
5472 0 : if( FD_UNLIKELY( err ) ) return err;
5473 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
5474 0 : if( FD_UNLIKELY( err ) ) return err;
5475 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
5476 0 : if( FD_UNLIKELY(err) ) return err;
5477 0 : if( self->current_authority_derived_key_seed_len ) {
5478 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
5479 0 : if( FD_UNLIKELY( err ) ) return err;
5480 0 : }
5481 0 : err = fd_pubkey_encode( &self->new_authority, ctx );
5482 0 : if( FD_UNLIKELY( err ) ) return err;
5483 0 : return FD_BINCODE_SUCCESS;
5484 0 : }
5485 0 : static int fd_vote_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5486 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5487 0 : int err = 0;
5488 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
5489 0 : if( FD_UNLIKELY( err ) ) return err;
5490 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5491 0 : if( FD_UNLIKELY( err ) ) return err;
5492 0 : ulong current_authority_derived_key_seed_len;
5493 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
5494 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5495 0 : *total_sz += current_authority_derived_key_seed_len;
5496 0 : if( current_authority_derived_key_seed_len ) {
5497 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
5498 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5499 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
5500 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5501 0 : }
5502 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5503 0 : if( FD_UNLIKELY( err ) ) return err;
5504 0 : return 0;
5505 0 : }
5506 0 : int fd_vote_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5507 0 : *total_sz += sizeof(fd_vote_authorize_with_seed_args_t);
5508 0 : void const * start_data = ctx->data;
5509 0 : int err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
5510 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5511 0 : ctx->data = start_data;
5512 0 : return err;
5513 0 : }
5514 0 : static void fd_vote_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5515 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)struct_mem;
5516 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
5517 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
5518 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
5519 0 : if( self->current_authority_derived_key_seed_len ) {
5520 0 : self->current_authority_derived_key_seed = *alloc_mem;
5521 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
5522 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
5523 0 : } else
5524 0 : self->current_authority_derived_key_seed = NULL;
5525 0 : fd_pubkey_decode_inner( &self->new_authority, alloc_mem, ctx );
5526 0 : }
5527 0 : void * fd_vote_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5528 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)mem;
5529 0 : fd_vote_authorize_with_seed_args_new( self );
5530 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_with_seed_args_t);
5531 0 : void * * alloc_mem = &alloc_region;
5532 0 : fd_vote_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
5533 0 : return self;
5534 0 : }
5535 0 : void fd_vote_authorize_with_seed_args_new(fd_vote_authorize_with_seed_args_t * self) {
5536 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_with_seed_args_t) );
5537 0 : fd_vote_authorize_new( &self->authorization_type );
5538 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
5539 0 : fd_pubkey_new( &self->new_authority );
5540 0 : }
5541 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 ) {
5542 0 : (void) varint;
5543 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_with_seed_args", level++, 0 );
5544 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level, 0 );
5545 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level, 0 );
5546 0 : if( self->current_authority_derived_key_seed_len ) {
5547 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
5548 0 : for( ulong i=0; i < self->current_authority_derived_key_seed_len; i++ )
5549 0 : fun( w, self->current_authority_derived_key_seed + i, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5550 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
5551 0 : }
5552 0 : fd_pubkey_walk( w, &self->new_authority, fun, "new_authority", level, 0 );
5553 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_with_seed_args", level--, 0 );
5554 0 : }
5555 0 : ulong fd_vote_authorize_with_seed_args_size( fd_vote_authorize_with_seed_args_t const * self ) {
5556 0 : ulong size = 0;
5557 0 : size += fd_vote_authorize_size( &self->authorization_type );
5558 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
5559 0 : do {
5560 0 : size += sizeof(ulong);
5561 0 : size += self->current_authority_derived_key_seed_len;
5562 0 : } while(0);
5563 0 : size += fd_pubkey_size( &self->new_authority );
5564 0 : return size;
5565 0 : }
5566 :
5567 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 ) {
5568 0 : int err;
5569 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
5570 0 : if( FD_UNLIKELY( err ) ) return err;
5571 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
5572 0 : if( FD_UNLIKELY( err ) ) return err;
5573 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
5574 0 : if( FD_UNLIKELY(err) ) return err;
5575 0 : if( self->current_authority_derived_key_seed_len ) {
5576 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
5577 0 : if( FD_UNLIKELY( err ) ) return err;
5578 0 : }
5579 0 : return FD_BINCODE_SUCCESS;
5580 0 : }
5581 0 : static int fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5582 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5583 0 : int err = 0;
5584 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
5585 0 : if( FD_UNLIKELY( err ) ) return err;
5586 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5587 0 : if( FD_UNLIKELY( err ) ) return err;
5588 0 : ulong current_authority_derived_key_seed_len;
5589 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
5590 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5591 0 : *total_sz += current_authority_derived_key_seed_len;
5592 0 : if( current_authority_derived_key_seed_len ) {
5593 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
5594 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5595 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
5596 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5597 0 : }
5598 0 : return 0;
5599 0 : }
5600 0 : int fd_vote_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5601 0 : *total_sz += sizeof(fd_vote_authorize_checked_with_seed_args_t);
5602 0 : void const * start_data = ctx->data;
5603 0 : int err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
5604 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5605 0 : ctx->data = start_data;
5606 0 : return err;
5607 0 : }
5608 0 : static void fd_vote_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5609 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)struct_mem;
5610 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
5611 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
5612 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
5613 0 : if( self->current_authority_derived_key_seed_len ) {
5614 0 : self->current_authority_derived_key_seed = *alloc_mem;
5615 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
5616 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
5617 0 : } else
5618 0 : self->current_authority_derived_key_seed = NULL;
5619 0 : }
5620 0 : void * fd_vote_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5621 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)mem;
5622 0 : fd_vote_authorize_checked_with_seed_args_new( self );
5623 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_checked_with_seed_args_t);
5624 0 : void * * alloc_mem = &alloc_region;
5625 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
5626 0 : return self;
5627 0 : }
5628 0 : void fd_vote_authorize_checked_with_seed_args_new(fd_vote_authorize_checked_with_seed_args_t * self) {
5629 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_checked_with_seed_args_t) );
5630 0 : fd_vote_authorize_new( &self->authorization_type );
5631 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
5632 0 : }
5633 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 ) {
5634 0 : (void) varint;
5635 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_vote_authorize_checked_with_seed_args", level++, 0 );
5636 0 : fd_vote_authorize_walk( w, &self->authorization_type, fun, "authorization_type", level, 0 );
5637 0 : fd_pubkey_walk( w, &self->current_authority_derived_key_owner, fun, "current_authority_derived_key_owner", level, 0 );
5638 0 : if( self->current_authority_derived_key_seed_len ) {
5639 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
5640 0 : for( ulong i=0; i < self->current_authority_derived_key_seed_len; i++ )
5641 0 : fun( w, self->current_authority_derived_key_seed + i, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5642 0 : fun( w, NULL, "current_authority_derived_key_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
5643 0 : }
5644 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_vote_authorize_checked_with_seed_args", level--, 0 );
5645 0 : }
5646 0 : ulong fd_vote_authorize_checked_with_seed_args_size( fd_vote_authorize_checked_with_seed_args_t const * self ) {
5647 0 : ulong size = 0;
5648 0 : size += fd_vote_authorize_size( &self->authorization_type );
5649 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
5650 0 : do {
5651 0 : size += sizeof(ulong);
5652 0 : size += self->current_authority_derived_key_seed_len;
5653 0 : } while(0);
5654 0 : return size;
5655 0 : }
5656 :
5657 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account(fd_vote_instruction_t const * self) {
5658 0 : return self->discriminant == 0;
5659 0 : }
5660 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize(fd_vote_instruction_t const * self) {
5661 0 : return self->discriminant == 1;
5662 0 : }
5663 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote(fd_vote_instruction_t const * self) {
5664 0 : return self->discriminant == 2;
5665 0 : }
5666 0 : FD_FN_PURE uchar fd_vote_instruction_is_withdraw(fd_vote_instruction_t const * self) {
5667 0 : return self->discriminant == 3;
5668 0 : }
5669 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_validator_identity(fd_vote_instruction_t const * self) {
5670 0 : return self->discriminant == 4;
5671 0 : }
5672 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission(fd_vote_instruction_t const * self) {
5673 0 : return self->discriminant == 5;
5674 0 : }
5675 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote_switch(fd_vote_instruction_t const * self) {
5676 0 : return self->discriminant == 6;
5677 0 : }
5678 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked(fd_vote_instruction_t const * self) {
5679 0 : return self->discriminant == 7;
5680 0 : }
5681 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state(fd_vote_instruction_t const * self) {
5682 0 : return self->discriminant == 8;
5683 0 : }
5684 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state_switch(fd_vote_instruction_t const * self) {
5685 0 : return self->discriminant == 9;
5686 0 : }
5687 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_with_seed(fd_vote_instruction_t const * self) {
5688 0 : return self->discriminant == 10;
5689 0 : }
5690 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked_with_seed(fd_vote_instruction_t const * self) {
5691 0 : return self->discriminant == 11;
5692 0 : }
5693 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state(fd_vote_instruction_t const * self) {
5694 0 : return self->discriminant == 12;
5695 0 : }
5696 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state_switch(fd_vote_instruction_t const * self) {
5697 0 : return self->discriminant == 13;
5698 0 : }
5699 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync(fd_vote_instruction_t const * self) {
5700 0 : return self->discriminant == 14;
5701 0 : }
5702 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync_switch(fd_vote_instruction_t const * self) {
5703 0 : return self->discriminant == 15;
5704 0 : }
5705 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant );
5706 0 : int fd_vote_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5707 0 : int err;
5708 0 : switch (discriminant) {
5709 0 : case 0: {
5710 0 : err = fd_vote_init_decode_footprint_inner( ctx, total_sz );
5711 0 : if( FD_UNLIKELY( err ) ) return err;
5712 0 : return FD_BINCODE_SUCCESS;
5713 0 : }
5714 0 : case 1: {
5715 0 : err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
5716 0 : if( FD_UNLIKELY( err ) ) return err;
5717 0 : return FD_BINCODE_SUCCESS;
5718 0 : }
5719 0 : case 2: {
5720 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
5721 0 : if( FD_UNLIKELY( err ) ) return err;
5722 0 : return FD_BINCODE_SUCCESS;
5723 0 : }
5724 0 : case 3: {
5725 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5726 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5727 0 : return FD_BINCODE_SUCCESS;
5728 0 : }
5729 0 : case 4: {
5730 0 : return FD_BINCODE_SUCCESS;
5731 0 : }
5732 0 : case 5: {
5733 0 : err = fd_bincode_uint8_decode_footprint( ctx );
5734 0 : if( FD_UNLIKELY( err ) ) return err;
5735 0 : return FD_BINCODE_SUCCESS;
5736 0 : }
5737 0 : case 6: {
5738 0 : err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
5739 0 : if( FD_UNLIKELY( err ) ) return err;
5740 0 : return FD_BINCODE_SUCCESS;
5741 0 : }
5742 0 : case 7: {
5743 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
5744 0 : if( FD_UNLIKELY( err ) ) return err;
5745 0 : return FD_BINCODE_SUCCESS;
5746 0 : }
5747 0 : case 8: {
5748 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
5749 0 : if( FD_UNLIKELY( err ) ) return err;
5750 0 : return FD_BINCODE_SUCCESS;
5751 0 : }
5752 0 : case 9: {
5753 0 : err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
5754 0 : if( FD_UNLIKELY( err ) ) return err;
5755 0 : return FD_BINCODE_SUCCESS;
5756 0 : }
5757 0 : case 10: {
5758 0 : err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
5759 0 : if( FD_UNLIKELY( err ) ) return err;
5760 0 : return FD_BINCODE_SUCCESS;
5761 0 : }
5762 0 : case 11: {
5763 0 : err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
5764 0 : if( FD_UNLIKELY( err ) ) return err;
5765 0 : return FD_BINCODE_SUCCESS;
5766 0 : }
5767 0 : case 12: {
5768 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
5769 0 : if( FD_UNLIKELY( err ) ) return err;
5770 0 : return FD_BINCODE_SUCCESS;
5771 0 : }
5772 0 : case 13: {
5773 0 : err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
5774 0 : if( FD_UNLIKELY( err ) ) return err;
5775 0 : return FD_BINCODE_SUCCESS;
5776 0 : }
5777 0 : case 14: {
5778 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
5779 0 : if( FD_UNLIKELY( err ) ) return err;
5780 0 : return FD_BINCODE_SUCCESS;
5781 0 : }
5782 0 : case 15: {
5783 0 : err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
5784 0 : if( FD_UNLIKELY( err ) ) return err;
5785 0 : return FD_BINCODE_SUCCESS;
5786 0 : }
5787 0 : default: return FD_BINCODE_ERR_ENCODING;
5788 0 : }
5789 0 : }
5790 0 : static int fd_vote_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5791 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5792 0 : uint discriminant = 0;
5793 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
5794 0 : if( FD_UNLIKELY( err ) ) return err;
5795 0 : return fd_vote_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
5796 0 : }
5797 0 : int fd_vote_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5798 0 : *total_sz += sizeof(fd_vote_instruction_t);
5799 0 : void const * start_data = ctx->data;
5800 0 : int err = fd_vote_instruction_decode_footprint_inner( ctx, total_sz );
5801 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5802 0 : ctx->data = start_data;
5803 0 : return err;
5804 0 : }
5805 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 ) {
5806 0 : switch (discriminant) {
5807 0 : case 0: {
5808 0 : fd_vote_init_decode_inner( &self->initialize_account, alloc_mem, ctx );
5809 0 : break;
5810 0 : }
5811 0 : case 1: {
5812 0 : fd_vote_authorize_pubkey_decode_inner( &self->authorize, alloc_mem, ctx );
5813 0 : break;
5814 0 : }
5815 0 : case 2: {
5816 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
5817 0 : break;
5818 0 : }
5819 0 : case 3: {
5820 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
5821 0 : break;
5822 0 : }
5823 0 : case 4: {
5824 0 : break;
5825 0 : }
5826 0 : case 5: {
5827 0 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
5828 0 : break;
5829 0 : }
5830 0 : case 6: {
5831 0 : fd_vote_switch_decode_inner( &self->vote_switch, alloc_mem, ctx );
5832 0 : break;
5833 0 : }
5834 0 : case 7: {
5835 0 : fd_vote_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
5836 0 : break;
5837 0 : }
5838 0 : case 8: {
5839 0 : fd_vote_state_update_decode_inner( &self->update_vote_state, alloc_mem, ctx );
5840 0 : break;
5841 0 : }
5842 0 : case 9: {
5843 0 : fd_update_vote_state_switch_decode_inner( &self->update_vote_state_switch, alloc_mem, ctx );
5844 0 : break;
5845 0 : }
5846 0 : case 10: {
5847 0 : fd_vote_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
5848 0 : break;
5849 0 : }
5850 0 : case 11: {
5851 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
5852 0 : break;
5853 0 : }
5854 0 : case 12: {
5855 0 : fd_compact_vote_state_update_decode_inner( &self->compact_update_vote_state, alloc_mem, ctx );
5856 0 : break;
5857 0 : }
5858 0 : case 13: {
5859 0 : fd_compact_vote_state_update_switch_decode_inner( &self->compact_update_vote_state_switch, alloc_mem, ctx );
5860 0 : break;
5861 0 : }
5862 0 : case 14: {
5863 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
5864 0 : break;
5865 0 : }
5866 0 : case 15: {
5867 0 : fd_tower_sync_switch_decode_inner( &self->tower_sync_switch, alloc_mem, ctx );
5868 0 : break;
5869 0 : }
5870 0 : }
5871 0 : }
5872 0 : static void fd_vote_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5873 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)struct_mem;
5874 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5875 0 : fd_vote_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
5876 0 : }
5877 0 : void * fd_vote_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5878 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)mem;
5879 0 : fd_vote_instruction_new( self );
5880 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_instruction_t);
5881 0 : void * * alloc_mem = &alloc_region;
5882 0 : fd_vote_instruction_decode_inner( mem, alloc_mem, ctx );
5883 0 : return self;
5884 0 : }
5885 0 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant ) {
5886 0 : switch( discriminant ) {
5887 0 : case 0: {
5888 0 : fd_vote_init_new( &self->initialize_account );
5889 0 : break;
5890 0 : }
5891 0 : case 1: {
5892 0 : fd_vote_authorize_pubkey_new( &self->authorize );
5893 0 : break;
5894 0 : }
5895 0 : case 2: {
5896 0 : fd_vote_new( &self->vote );
5897 0 : break;
5898 0 : }
5899 0 : case 3: {
5900 0 : break;
5901 0 : }
5902 0 : case 4: {
5903 0 : break;
5904 0 : }
5905 0 : case 5: {
5906 0 : break;
5907 0 : }
5908 0 : case 6: {
5909 0 : fd_vote_switch_new( &self->vote_switch );
5910 0 : break;
5911 0 : }
5912 0 : case 7: {
5913 0 : fd_vote_authorize_new( &self->authorize_checked );
5914 0 : break;
5915 0 : }
5916 0 : case 8: {
5917 0 : fd_vote_state_update_new( &self->update_vote_state );
5918 0 : break;
5919 0 : }
5920 0 : case 9: {
5921 0 : fd_update_vote_state_switch_new( &self->update_vote_state_switch );
5922 0 : break;
5923 0 : }
5924 0 : case 10: {
5925 0 : fd_vote_authorize_with_seed_args_new( &self->authorize_with_seed );
5926 0 : break;
5927 0 : }
5928 0 : case 11: {
5929 0 : fd_vote_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
5930 0 : break;
5931 0 : }
5932 0 : case 12: {
5933 0 : fd_compact_vote_state_update_new( &self->compact_update_vote_state );
5934 0 : break;
5935 0 : }
5936 0 : case 13: {
5937 0 : fd_compact_vote_state_update_switch_new( &self->compact_update_vote_state_switch );
5938 0 : break;
5939 0 : }
5940 0 : case 14: {
5941 0 : fd_tower_sync_new( &self->tower_sync );
5942 0 : break;
5943 0 : }
5944 0 : case 15: {
5945 0 : fd_tower_sync_switch_new( &self->tower_sync_switch );
5946 0 : break;
5947 0 : }
5948 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
5949 0 : }
5950 0 : }
5951 0 : void fd_vote_instruction_new_disc( fd_vote_instruction_t * self, uint discriminant ) {
5952 0 : self->discriminant = discriminant;
5953 0 : fd_vote_instruction_inner_new( &self->inner, self->discriminant );
5954 0 : }
5955 0 : void fd_vote_instruction_new( fd_vote_instruction_t * self ) {
5956 0 : fd_memset( self, 0, sizeof(fd_vote_instruction_t) );
5957 0 : fd_vote_instruction_new_disc( self, UINT_MAX );
5958 0 : }
5959 :
5960 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 ) {
5961 0 : (void) varint;
5962 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_vote_instruction", level++, 0);
5963 0 : switch( self->discriminant ) {
5964 0 : case 0: {
5965 0 : fun( w, self, "initialize_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5966 0 : fd_vote_init_walk( w, &self->inner.initialize_account, fun, "initialize_account", level, 0 );
5967 0 : break;
5968 0 : }
5969 0 : case 1: {
5970 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5971 0 : fd_vote_authorize_pubkey_walk( w, &self->inner.authorize, fun, "authorize", level, 0 );
5972 0 : break;
5973 0 : }
5974 0 : case 2: {
5975 0 : fun( w, self, "vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5976 0 : fd_vote_walk( w, &self->inner.vote, fun, "vote", level, 0 );
5977 0 : break;
5978 0 : }
5979 0 : case 3: {
5980 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5981 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
5982 0 : break;
5983 0 : }
5984 0 : case 4: {
5985 0 : fun( w, self, "update_validator_identity", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5986 0 : break;
5987 0 : }
5988 0 : case 5: {
5989 0 : fun( w, self, "update_commission", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5990 0 : fun( w, &self->inner.update_commission, "update_commission", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
5991 0 : break;
5992 0 : }
5993 0 : case 6: {
5994 0 : fun( w, self, "vote_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
5995 0 : fd_vote_switch_walk( w, &self->inner.vote_switch, fun, "vote_switch", level, 0 );
5996 0 : break;
5997 0 : }
5998 0 : case 7: {
5999 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6000 0 : fd_vote_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level, 0 );
6001 0 : break;
6002 0 : }
6003 0 : case 8: {
6004 0 : fun( w, self, "update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6005 0 : fd_vote_state_update_walk( w, &self->inner.update_vote_state, fun, "update_vote_state", level, 0 );
6006 0 : break;
6007 0 : }
6008 0 : case 9: {
6009 0 : fun( w, self, "update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6010 0 : fd_update_vote_state_switch_walk( w, &self->inner.update_vote_state_switch, fun, "update_vote_state_switch", level, 0 );
6011 0 : break;
6012 0 : }
6013 0 : case 10: {
6014 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6015 0 : fd_vote_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level, 0 );
6016 0 : break;
6017 0 : }
6018 0 : case 11: {
6019 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6020 0 : fd_vote_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level, 0 );
6021 0 : break;
6022 0 : }
6023 0 : case 12: {
6024 0 : fun( w, self, "compact_update_vote_state", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6025 0 : fd_compact_vote_state_update_walk( w, &self->inner.compact_update_vote_state, fun, "compact_update_vote_state", level, 0 );
6026 0 : break;
6027 0 : }
6028 0 : case 13: {
6029 0 : fun( w, self, "compact_update_vote_state_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6030 0 : fd_compact_vote_state_update_switch_walk( w, &self->inner.compact_update_vote_state_switch, fun, "compact_update_vote_state_switch", level, 0 );
6031 0 : break;
6032 0 : }
6033 0 : case 14: {
6034 0 : fun( w, self, "tower_sync", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6035 0 : fd_tower_sync_walk( w, &self->inner.tower_sync, fun, "tower_sync", level, 0 );
6036 0 : break;
6037 0 : }
6038 0 : case 15: {
6039 0 : fun( w, self, "tower_sync_switch", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6040 0 : fd_tower_sync_switch_walk( w, &self->inner.tower_sync_switch, fun, "tower_sync_switch", level, 0 );
6041 0 : break;
6042 0 : }
6043 0 : }
6044 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_vote_instruction", level--, 0 );
6045 0 : }
6046 0 : ulong fd_vote_instruction_size( fd_vote_instruction_t const * self ) {
6047 0 : ulong size = 0;
6048 0 : size += sizeof(uint);
6049 0 : switch (self->discriminant) {
6050 0 : case 0: {
6051 0 : size += fd_vote_init_size( &self->inner.initialize_account );
6052 0 : break;
6053 0 : }
6054 0 : case 1: {
6055 0 : size += fd_vote_authorize_pubkey_size( &self->inner.authorize );
6056 0 : break;
6057 0 : }
6058 0 : case 2: {
6059 0 : size += fd_vote_size( &self->inner.vote );
6060 0 : break;
6061 0 : }
6062 0 : case 3: {
6063 0 : size += sizeof(ulong);
6064 0 : break;
6065 0 : }
6066 0 : case 5: {
6067 0 : size += sizeof(char);
6068 0 : break;
6069 0 : }
6070 0 : case 6: {
6071 0 : size += fd_vote_switch_size( &self->inner.vote_switch );
6072 0 : break;
6073 0 : }
6074 0 : case 7: {
6075 0 : size += fd_vote_authorize_size( &self->inner.authorize_checked );
6076 0 : break;
6077 0 : }
6078 0 : case 8: {
6079 0 : size += fd_vote_state_update_size( &self->inner.update_vote_state );
6080 0 : break;
6081 0 : }
6082 0 : case 9: {
6083 0 : size += fd_update_vote_state_switch_size( &self->inner.update_vote_state_switch );
6084 0 : break;
6085 0 : }
6086 0 : case 10: {
6087 0 : size += fd_vote_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
6088 0 : break;
6089 0 : }
6090 0 : case 11: {
6091 0 : size += fd_vote_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
6092 0 : break;
6093 0 : }
6094 0 : case 12: {
6095 0 : size += fd_compact_vote_state_update_size( &self->inner.compact_update_vote_state );
6096 0 : break;
6097 0 : }
6098 0 : case 13: {
6099 0 : size += fd_compact_vote_state_update_switch_size( &self->inner.compact_update_vote_state_switch );
6100 0 : break;
6101 0 : }
6102 0 : case 14: {
6103 0 : size += fd_tower_sync_size( &self->inner.tower_sync );
6104 0 : break;
6105 0 : }
6106 0 : case 15: {
6107 0 : size += fd_tower_sync_switch_size( &self->inner.tower_sync_switch );
6108 0 : break;
6109 0 : }
6110 0 : }
6111 0 : return size;
6112 0 : }
6113 :
6114 0 : int fd_vote_instruction_inner_encode( fd_vote_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6115 0 : int err;
6116 0 : switch (discriminant) {
6117 0 : case 0: {
6118 0 : err = fd_vote_init_encode( &self->initialize_account, ctx );
6119 0 : if( FD_UNLIKELY( err ) ) return err;
6120 0 : break;
6121 0 : }
6122 0 : case 1: {
6123 0 : err = fd_vote_authorize_pubkey_encode( &self->authorize, ctx );
6124 0 : if( FD_UNLIKELY( err ) ) return err;
6125 0 : break;
6126 0 : }
6127 0 : case 2: {
6128 0 : err = fd_vote_encode( &self->vote, ctx );
6129 0 : if( FD_UNLIKELY( err ) ) return err;
6130 0 : break;
6131 0 : }
6132 0 : case 3: {
6133 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
6134 0 : if( FD_UNLIKELY( err ) ) return err;
6135 0 : break;
6136 0 : }
6137 0 : case 5: {
6138 0 : err = fd_bincode_uint8_encode( (uchar)(self->update_commission), ctx );
6139 0 : if( FD_UNLIKELY( err ) ) return err;
6140 0 : break;
6141 0 : }
6142 0 : case 6: {
6143 0 : err = fd_vote_switch_encode( &self->vote_switch, ctx );
6144 0 : if( FD_UNLIKELY( err ) ) return err;
6145 0 : break;
6146 0 : }
6147 0 : case 7: {
6148 0 : err = fd_vote_authorize_encode( &self->authorize_checked, ctx );
6149 0 : if( FD_UNLIKELY( err ) ) return err;
6150 0 : break;
6151 0 : }
6152 0 : case 8: {
6153 0 : err = fd_vote_state_update_encode( &self->update_vote_state, ctx );
6154 0 : if( FD_UNLIKELY( err ) ) return err;
6155 0 : break;
6156 0 : }
6157 0 : case 9: {
6158 0 : err = fd_update_vote_state_switch_encode( &self->update_vote_state_switch, ctx );
6159 0 : if( FD_UNLIKELY( err ) ) return err;
6160 0 : break;
6161 0 : }
6162 0 : case 10: {
6163 0 : err = fd_vote_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
6164 0 : if( FD_UNLIKELY( err ) ) return err;
6165 0 : break;
6166 0 : }
6167 0 : case 11: {
6168 0 : err = fd_vote_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
6169 0 : if( FD_UNLIKELY( err ) ) return err;
6170 0 : break;
6171 0 : }
6172 0 : case 12: {
6173 0 : err = fd_compact_vote_state_update_encode( &self->compact_update_vote_state, ctx );
6174 0 : if( FD_UNLIKELY( err ) ) return err;
6175 0 : break;
6176 0 : }
6177 0 : case 13: {
6178 0 : err = fd_compact_vote_state_update_switch_encode( &self->compact_update_vote_state_switch, ctx );
6179 0 : if( FD_UNLIKELY( err ) ) return err;
6180 0 : break;
6181 0 : }
6182 0 : case 14: {
6183 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
6184 0 : if( FD_UNLIKELY( err ) ) return err;
6185 0 : break;
6186 0 : }
6187 0 : case 15: {
6188 0 : err = fd_tower_sync_switch_encode( &self->tower_sync_switch, ctx );
6189 0 : if( FD_UNLIKELY( err ) ) return err;
6190 0 : break;
6191 0 : }
6192 0 : }
6193 0 : return FD_BINCODE_SUCCESS;
6194 0 : }
6195 0 : int fd_vote_instruction_encode( fd_vote_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6196 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6197 0 : if( FD_UNLIKELY( err ) ) return err;
6198 0 : return fd_vote_instruction_inner_encode( &self->inner, self->discriminant, ctx );
6199 0 : }
6200 :
6201 0 : int fd_system_program_instruction_create_account_encode( fd_system_program_instruction_create_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6202 0 : int err;
6203 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
6204 0 : if( FD_UNLIKELY( err ) ) return err;
6205 0 : err = fd_bincode_uint64_encode( self->space, ctx );
6206 0 : if( FD_UNLIKELY( err ) ) return err;
6207 0 : err = fd_pubkey_encode( &self->owner, ctx );
6208 0 : if( FD_UNLIKELY( err ) ) return err;
6209 0 : return FD_BINCODE_SUCCESS;
6210 0 : }
6211 0 : static inline int fd_system_program_instruction_create_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6212 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6213 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
6214 0 : return 0;
6215 0 : }
6216 0 : static void fd_system_program_instruction_create_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6217 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)struct_mem;
6218 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
6219 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
6220 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
6221 0 : }
6222 0 : void * fd_system_program_instruction_create_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6223 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)mem;
6224 0 : fd_system_program_instruction_create_account_new( self );
6225 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_t);
6226 0 : void * * alloc_mem = &alloc_region;
6227 0 : fd_system_program_instruction_create_account_decode_inner( mem, alloc_mem, ctx );
6228 0 : return self;
6229 0 : }
6230 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 ) {
6231 0 : (void) varint;
6232 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account", level++, 0 );
6233 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6234 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6235 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
6236 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account", level--, 0 );
6237 0 : }
6238 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 ) {
6239 0 : int err;
6240 0 : err = fd_pubkey_encode( &self->base, ctx );
6241 0 : if( FD_UNLIKELY( err ) ) return err;
6242 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
6243 0 : if( FD_UNLIKELY(err) ) return err;
6244 0 : if( self->seed_len ) {
6245 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
6246 0 : if( FD_UNLIKELY( err ) ) return err;
6247 0 : }
6248 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
6249 0 : if( FD_UNLIKELY( err ) ) return err;
6250 0 : err = fd_bincode_uint64_encode( self->space, ctx );
6251 0 : if( FD_UNLIKELY( err ) ) return err;
6252 0 : err = fd_pubkey_encode( &self->owner, ctx );
6253 0 : if( FD_UNLIKELY( err ) ) return err;
6254 0 : return FD_BINCODE_SUCCESS;
6255 0 : }
6256 0 : static int fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6257 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6258 0 : int err = 0;
6259 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6260 0 : if( FD_UNLIKELY( err ) ) return err;
6261 0 : ulong seed_len;
6262 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
6263 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6264 0 : *total_sz += seed_len;
6265 0 : if( seed_len ) {
6266 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
6267 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6268 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
6269 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6270 0 : }
6271 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6272 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6273 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6274 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6275 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6276 0 : if( FD_UNLIKELY( err ) ) return err;
6277 0 : return 0;
6278 0 : }
6279 0 : int fd_system_program_instruction_create_account_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6280 0 : *total_sz += sizeof(fd_system_program_instruction_create_account_with_seed_t);
6281 0 : void const * start_data = ctx->data;
6282 0 : int err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
6283 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6284 0 : ctx->data = start_data;
6285 0 : return err;
6286 0 : }
6287 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 ) {
6288 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)struct_mem;
6289 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
6290 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
6291 0 : if( self->seed_len ) {
6292 0 : self->seed = *alloc_mem;
6293 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
6294 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
6295 0 : } else
6296 0 : self->seed = NULL;
6297 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
6298 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
6299 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
6300 0 : }
6301 0 : void * fd_system_program_instruction_create_account_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6302 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)mem;
6303 0 : fd_system_program_instruction_create_account_with_seed_new( self );
6304 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_with_seed_t);
6305 0 : void * * alloc_mem = &alloc_region;
6306 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( mem, alloc_mem, ctx );
6307 0 : return self;
6308 0 : }
6309 0 : void fd_system_program_instruction_create_account_with_seed_new(fd_system_program_instruction_create_account_with_seed_t * self) {
6310 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_with_seed_t) );
6311 0 : fd_pubkey_new( &self->base );
6312 0 : fd_pubkey_new( &self->owner );
6313 0 : }
6314 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 ) {
6315 0 : (void) varint;
6316 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_create_account_with_seed", level++, 0 );
6317 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
6318 0 : if( self->seed_len ) {
6319 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
6320 0 : for( ulong i=0; i < self->seed_len; i++ )
6321 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
6322 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
6323 0 : }
6324 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6325 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6326 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
6327 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_create_account_with_seed", level--, 0 );
6328 0 : }
6329 0 : ulong fd_system_program_instruction_create_account_with_seed_size( fd_system_program_instruction_create_account_with_seed_t const * self ) {
6330 0 : ulong size = 0;
6331 0 : size += fd_pubkey_size( &self->base );
6332 0 : do {
6333 0 : size += sizeof(ulong);
6334 0 : size += self->seed_len;
6335 0 : } while(0);
6336 0 : size += sizeof(ulong);
6337 0 : size += sizeof(ulong);
6338 0 : size += fd_pubkey_size( &self->owner );
6339 0 : return size;
6340 0 : }
6341 :
6342 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 ) {
6343 0 : int err;
6344 0 : err = fd_pubkey_encode( &self->base, ctx );
6345 0 : if( FD_UNLIKELY( err ) ) return err;
6346 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
6347 0 : if( FD_UNLIKELY(err) ) return err;
6348 0 : if( self->seed_len ) {
6349 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
6350 0 : if( FD_UNLIKELY( err ) ) return err;
6351 0 : }
6352 0 : err = fd_bincode_uint64_encode( self->space, ctx );
6353 0 : if( FD_UNLIKELY( err ) ) return err;
6354 0 : err = fd_pubkey_encode( &self->owner, ctx );
6355 0 : if( FD_UNLIKELY( err ) ) return err;
6356 0 : return FD_BINCODE_SUCCESS;
6357 0 : }
6358 0 : static int fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6359 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6360 0 : int err = 0;
6361 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6362 0 : if( FD_UNLIKELY( err ) ) return err;
6363 0 : ulong seed_len;
6364 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
6365 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6366 0 : *total_sz += seed_len;
6367 0 : if( seed_len ) {
6368 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
6369 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6370 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
6371 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6372 0 : }
6373 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6374 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6375 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6376 0 : if( FD_UNLIKELY( err ) ) return err;
6377 0 : return 0;
6378 0 : }
6379 0 : int fd_system_program_instruction_allocate_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6380 0 : *total_sz += sizeof(fd_system_program_instruction_allocate_with_seed_t);
6381 0 : void const * start_data = ctx->data;
6382 0 : int err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
6383 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6384 0 : ctx->data = start_data;
6385 0 : return err;
6386 0 : }
6387 0 : static void fd_system_program_instruction_allocate_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6388 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)struct_mem;
6389 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
6390 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
6391 0 : if( self->seed_len ) {
6392 0 : self->seed = *alloc_mem;
6393 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
6394 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
6395 0 : } else
6396 0 : self->seed = NULL;
6397 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
6398 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
6399 0 : }
6400 0 : void * fd_system_program_instruction_allocate_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6401 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)mem;
6402 0 : fd_system_program_instruction_allocate_with_seed_new( self );
6403 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_allocate_with_seed_t);
6404 0 : void * * alloc_mem = &alloc_region;
6405 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( mem, alloc_mem, ctx );
6406 0 : return self;
6407 0 : }
6408 0 : void fd_system_program_instruction_allocate_with_seed_new(fd_system_program_instruction_allocate_with_seed_t * self) {
6409 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_allocate_with_seed_t) );
6410 0 : fd_pubkey_new( &self->base );
6411 0 : fd_pubkey_new( &self->owner );
6412 0 : }
6413 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 ) {
6414 0 : (void) varint;
6415 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_allocate_with_seed", level++, 0 );
6416 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
6417 0 : if( self->seed_len ) {
6418 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
6419 0 : for( ulong i=0; i < self->seed_len; i++ )
6420 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
6421 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
6422 0 : }
6423 0 : fun( w, &self->space, "space", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6424 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
6425 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_allocate_with_seed", level--, 0 );
6426 0 : }
6427 0 : ulong fd_system_program_instruction_allocate_with_seed_size( fd_system_program_instruction_allocate_with_seed_t const * self ) {
6428 0 : ulong size = 0;
6429 0 : size += fd_pubkey_size( &self->base );
6430 0 : do {
6431 0 : size += sizeof(ulong);
6432 0 : size += self->seed_len;
6433 0 : } while(0);
6434 0 : size += sizeof(ulong);
6435 0 : size += fd_pubkey_size( &self->owner );
6436 0 : return size;
6437 0 : }
6438 :
6439 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 ) {
6440 0 : int err;
6441 0 : err = fd_pubkey_encode( &self->base, ctx );
6442 0 : if( FD_UNLIKELY( err ) ) return err;
6443 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
6444 0 : if( FD_UNLIKELY(err) ) return err;
6445 0 : if( self->seed_len ) {
6446 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
6447 0 : if( FD_UNLIKELY( err ) ) return err;
6448 0 : }
6449 0 : err = fd_pubkey_encode( &self->owner, ctx );
6450 0 : if( FD_UNLIKELY( err ) ) return err;
6451 0 : return FD_BINCODE_SUCCESS;
6452 0 : }
6453 0 : static int fd_system_program_instruction_assign_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6454 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6455 0 : int err = 0;
6456 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6457 0 : if( FD_UNLIKELY( err ) ) return err;
6458 0 : ulong seed_len;
6459 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
6460 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6461 0 : *total_sz += seed_len;
6462 0 : if( seed_len ) {
6463 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
6464 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6465 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
6466 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6467 0 : }
6468 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6469 0 : if( FD_UNLIKELY( err ) ) return err;
6470 0 : return 0;
6471 0 : }
6472 0 : int fd_system_program_instruction_assign_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6473 0 : *total_sz += sizeof(fd_system_program_instruction_assign_with_seed_t);
6474 0 : void const * start_data = ctx->data;
6475 0 : int err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
6476 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6477 0 : ctx->data = start_data;
6478 0 : return err;
6479 0 : }
6480 0 : static void fd_system_program_instruction_assign_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6481 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)struct_mem;
6482 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
6483 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
6484 0 : if( self->seed_len ) {
6485 0 : self->seed = *alloc_mem;
6486 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
6487 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
6488 0 : } else
6489 0 : self->seed = NULL;
6490 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
6491 0 : }
6492 0 : void * fd_system_program_instruction_assign_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6493 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)mem;
6494 0 : fd_system_program_instruction_assign_with_seed_new( self );
6495 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_assign_with_seed_t);
6496 0 : void * * alloc_mem = &alloc_region;
6497 0 : fd_system_program_instruction_assign_with_seed_decode_inner( mem, alloc_mem, ctx );
6498 0 : return self;
6499 0 : }
6500 0 : void fd_system_program_instruction_assign_with_seed_new(fd_system_program_instruction_assign_with_seed_t * self) {
6501 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_assign_with_seed_t) );
6502 0 : fd_pubkey_new( &self->base );
6503 0 : fd_pubkey_new( &self->owner );
6504 0 : }
6505 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 ) {
6506 0 : (void) varint;
6507 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_assign_with_seed", level++, 0 );
6508 0 : fd_pubkey_walk( w, &self->base, fun, "base", level, 0 );
6509 0 : if( self->seed_len ) {
6510 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
6511 0 : for( ulong i=0; i < self->seed_len; i++ )
6512 0 : fun( w, self->seed + i, "seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
6513 0 : fun( w, NULL, "seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
6514 0 : }
6515 0 : fd_pubkey_walk( w, &self->owner, fun, "owner", level, 0 );
6516 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_assign_with_seed", level--, 0 );
6517 0 : }
6518 0 : ulong fd_system_program_instruction_assign_with_seed_size( fd_system_program_instruction_assign_with_seed_t const * self ) {
6519 0 : ulong size = 0;
6520 0 : size += fd_pubkey_size( &self->base );
6521 0 : do {
6522 0 : size += sizeof(ulong);
6523 0 : size += self->seed_len;
6524 0 : } while(0);
6525 0 : size += fd_pubkey_size( &self->owner );
6526 0 : return size;
6527 0 : }
6528 :
6529 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 ) {
6530 0 : int err;
6531 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
6532 0 : if( FD_UNLIKELY( err ) ) return err;
6533 0 : err = fd_bincode_uint64_encode( self->from_seed_len, ctx );
6534 0 : if( FD_UNLIKELY(err) ) return err;
6535 0 : if( self->from_seed_len ) {
6536 0 : err = fd_bincode_bytes_encode( self->from_seed, self->from_seed_len, ctx );
6537 0 : if( FD_UNLIKELY( err ) ) return err;
6538 0 : }
6539 0 : err = fd_pubkey_encode( &self->from_owner, ctx );
6540 0 : if( FD_UNLIKELY( err ) ) return err;
6541 0 : return FD_BINCODE_SUCCESS;
6542 0 : }
6543 0 : static int fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6544 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6545 0 : int err = 0;
6546 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6547 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6548 0 : ulong from_seed_len;
6549 0 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
6550 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6551 0 : *total_sz += from_seed_len;
6552 0 : if( from_seed_len ) {
6553 0 : err = fd_bincode_bytes_decode_footprint( from_seed_len, ctx );
6554 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6555 0 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
6556 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6557 0 : }
6558 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6559 0 : if( FD_UNLIKELY( err ) ) return err;
6560 0 : return 0;
6561 0 : }
6562 0 : int fd_system_program_instruction_transfer_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6563 0 : *total_sz += sizeof(fd_system_program_instruction_transfer_with_seed_t);
6564 0 : void const * start_data = ctx->data;
6565 0 : int err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
6566 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6567 0 : ctx->data = start_data;
6568 0 : return err;
6569 0 : }
6570 0 : static void fd_system_program_instruction_transfer_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6571 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)struct_mem;
6572 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
6573 0 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
6574 0 : if( self->from_seed_len ) {
6575 0 : self->from_seed = *alloc_mem;
6576 0 : fd_bincode_bytes_decode_unsafe( self->from_seed, self->from_seed_len, ctx );
6577 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->from_seed_len;
6578 0 : } else
6579 0 : self->from_seed = NULL;
6580 0 : fd_pubkey_decode_inner( &self->from_owner, alloc_mem, ctx );
6581 0 : }
6582 0 : void * fd_system_program_instruction_transfer_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6583 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)mem;
6584 0 : fd_system_program_instruction_transfer_with_seed_new( self );
6585 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_transfer_with_seed_t);
6586 0 : void * * alloc_mem = &alloc_region;
6587 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( mem, alloc_mem, ctx );
6588 0 : return self;
6589 0 : }
6590 0 : void fd_system_program_instruction_transfer_with_seed_new(fd_system_program_instruction_transfer_with_seed_t * self) {
6591 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_transfer_with_seed_t) );
6592 0 : fd_pubkey_new( &self->from_owner );
6593 0 : }
6594 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 ) {
6595 0 : (void) varint;
6596 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_system_program_instruction_transfer_with_seed", level++, 0 );
6597 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6598 0 : if( self->from_seed_len ) {
6599 0 : fun( w, NULL, "from_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
6600 0 : for( ulong i=0; i < self->from_seed_len; i++ )
6601 0 : fun( w, self->from_seed + i, "from_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
6602 0 : fun( w, NULL, "from_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
6603 0 : }
6604 0 : fd_pubkey_walk( w, &self->from_owner, fun, "from_owner", level, 0 );
6605 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_system_program_instruction_transfer_with_seed", level--, 0 );
6606 0 : }
6607 0 : ulong fd_system_program_instruction_transfer_with_seed_size( fd_system_program_instruction_transfer_with_seed_t const * self ) {
6608 0 : ulong size = 0;
6609 0 : size += sizeof(ulong);
6610 0 : do {
6611 0 : size += sizeof(ulong);
6612 0 : size += self->from_seed_len;
6613 0 : } while(0);
6614 0 : size += fd_pubkey_size( &self->from_owner );
6615 0 : return size;
6616 0 : }
6617 :
6618 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account(fd_system_program_instruction_t const * self) {
6619 0 : return self->discriminant == 0;
6620 0 : }
6621 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign(fd_system_program_instruction_t const * self) {
6622 0 : return self->discriminant == 1;
6623 0 : }
6624 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer(fd_system_program_instruction_t const * self) {
6625 0 : return self->discriminant == 2;
6626 0 : }
6627 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_with_seed(fd_system_program_instruction_t const * self) {
6628 0 : return self->discriminant == 3;
6629 0 : }
6630 0 : FD_FN_PURE uchar fd_system_program_instruction_is_advance_nonce_account(fd_system_program_instruction_t const * self) {
6631 0 : return self->discriminant == 4;
6632 0 : }
6633 0 : FD_FN_PURE uchar fd_system_program_instruction_is_withdraw_nonce_account(fd_system_program_instruction_t const * self) {
6634 0 : return self->discriminant == 5;
6635 0 : }
6636 0 : FD_FN_PURE uchar fd_system_program_instruction_is_initialize_nonce_account(fd_system_program_instruction_t const * self) {
6637 0 : return self->discriminant == 6;
6638 0 : }
6639 0 : FD_FN_PURE uchar fd_system_program_instruction_is_authorize_nonce_account(fd_system_program_instruction_t const * self) {
6640 0 : return self->discriminant == 7;
6641 0 : }
6642 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate(fd_system_program_instruction_t const * self) {
6643 0 : return self->discriminant == 8;
6644 0 : }
6645 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate_with_seed(fd_system_program_instruction_t const * self) {
6646 0 : return self->discriminant == 9;
6647 0 : }
6648 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign_with_seed(fd_system_program_instruction_t const * self) {
6649 0 : return self->discriminant == 10;
6650 0 : }
6651 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer_with_seed(fd_system_program_instruction_t const * self) {
6652 0 : return self->discriminant == 11;
6653 0 : }
6654 0 : FD_FN_PURE uchar fd_system_program_instruction_is_upgrade_nonce_account(fd_system_program_instruction_t const * self) {
6655 0 : return self->discriminant == 12;
6656 0 : }
6657 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant );
6658 0 : int fd_system_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6659 0 : int err;
6660 0 : switch (discriminant) {
6661 0 : case 0: {
6662 0 : err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
6663 0 : if( FD_UNLIKELY( err ) ) return err;
6664 0 : return FD_BINCODE_SUCCESS;
6665 0 : }
6666 0 : case 1: {
6667 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6668 0 : if( FD_UNLIKELY( err ) ) return err;
6669 0 : return FD_BINCODE_SUCCESS;
6670 0 : }
6671 0 : case 2: {
6672 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6673 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6674 0 : return FD_BINCODE_SUCCESS;
6675 0 : }
6676 0 : case 3: {
6677 0 : err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
6678 0 : if( FD_UNLIKELY( err ) ) return err;
6679 0 : return FD_BINCODE_SUCCESS;
6680 0 : }
6681 0 : case 4: {
6682 0 : return FD_BINCODE_SUCCESS;
6683 0 : }
6684 0 : case 5: {
6685 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6686 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6687 0 : return FD_BINCODE_SUCCESS;
6688 0 : }
6689 0 : case 6: {
6690 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6691 0 : if( FD_UNLIKELY( err ) ) return err;
6692 0 : return FD_BINCODE_SUCCESS;
6693 0 : }
6694 0 : case 7: {
6695 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6696 0 : if( FD_UNLIKELY( err ) ) return err;
6697 0 : return FD_BINCODE_SUCCESS;
6698 0 : }
6699 0 : case 8: {
6700 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6701 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6702 0 : return FD_BINCODE_SUCCESS;
6703 0 : }
6704 0 : case 9: {
6705 0 : err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
6706 0 : if( FD_UNLIKELY( err ) ) return err;
6707 0 : return FD_BINCODE_SUCCESS;
6708 0 : }
6709 0 : case 10: {
6710 0 : err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
6711 0 : if( FD_UNLIKELY( err ) ) return err;
6712 0 : return FD_BINCODE_SUCCESS;
6713 0 : }
6714 0 : case 11: {
6715 0 : err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
6716 0 : if( FD_UNLIKELY( err ) ) return err;
6717 0 : return FD_BINCODE_SUCCESS;
6718 0 : }
6719 0 : case 12: {
6720 0 : return FD_BINCODE_SUCCESS;
6721 0 : }
6722 0 : default: return FD_BINCODE_ERR_ENCODING;
6723 0 : }
6724 0 : }
6725 0 : static int fd_system_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6726 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6727 0 : uint discriminant = 0;
6728 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6729 0 : if( FD_UNLIKELY( err ) ) return err;
6730 0 : return fd_system_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
6731 0 : }
6732 0 : int fd_system_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6733 0 : *total_sz += sizeof(fd_system_program_instruction_t);
6734 0 : void const * start_data = ctx->data;
6735 0 : int err = fd_system_program_instruction_decode_footprint_inner( ctx, total_sz );
6736 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6737 0 : ctx->data = start_data;
6738 0 : return err;
6739 0 : }
6740 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 ) {
6741 0 : switch (discriminant) {
6742 0 : case 0: {
6743 0 : fd_system_program_instruction_create_account_decode_inner( &self->create_account, alloc_mem, ctx );
6744 0 : break;
6745 0 : }
6746 0 : case 1: {
6747 0 : fd_pubkey_decode_inner( &self->assign, alloc_mem, ctx );
6748 0 : break;
6749 0 : }
6750 0 : case 2: {
6751 0 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
6752 0 : break;
6753 0 : }
6754 0 : case 3: {
6755 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( &self->create_account_with_seed, alloc_mem, ctx );
6756 0 : break;
6757 0 : }
6758 0 : case 4: {
6759 0 : break;
6760 0 : }
6761 0 : case 5: {
6762 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
6763 0 : break;
6764 0 : }
6765 0 : case 6: {
6766 0 : fd_pubkey_decode_inner( &self->initialize_nonce_account, alloc_mem, ctx );
6767 0 : break;
6768 0 : }
6769 0 : case 7: {
6770 0 : fd_pubkey_decode_inner( &self->authorize_nonce_account, alloc_mem, ctx );
6771 0 : break;
6772 0 : }
6773 0 : case 8: {
6774 0 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
6775 0 : break;
6776 0 : }
6777 0 : case 9: {
6778 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( &self->allocate_with_seed, alloc_mem, ctx );
6779 0 : break;
6780 0 : }
6781 0 : case 10: {
6782 0 : fd_system_program_instruction_assign_with_seed_decode_inner( &self->assign_with_seed, alloc_mem, ctx );
6783 0 : break;
6784 0 : }
6785 0 : case 11: {
6786 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( &self->transfer_with_seed, alloc_mem, ctx );
6787 0 : break;
6788 0 : }
6789 0 : case 12: {
6790 0 : break;
6791 0 : }
6792 0 : }
6793 0 : }
6794 0 : static void fd_system_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6795 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)struct_mem;
6796 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6797 0 : fd_system_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
6798 0 : }
6799 0 : void * fd_system_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6800 0 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)mem;
6801 0 : fd_system_program_instruction_new( self );
6802 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_t);
6803 0 : void * * alloc_mem = &alloc_region;
6804 0 : fd_system_program_instruction_decode_inner( mem, alloc_mem, ctx );
6805 0 : return self;
6806 0 : }
6807 0 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant ) {
6808 0 : switch( discriminant ) {
6809 0 : case 0: {
6810 0 : fd_system_program_instruction_create_account_new( &self->create_account );
6811 0 : break;
6812 0 : }
6813 0 : case 1: {
6814 0 : fd_pubkey_new( &self->assign );
6815 0 : break;
6816 0 : }
6817 0 : case 2: {
6818 0 : break;
6819 0 : }
6820 0 : case 3: {
6821 0 : fd_system_program_instruction_create_account_with_seed_new( &self->create_account_with_seed );
6822 0 : break;
6823 0 : }
6824 0 : case 4: {
6825 0 : break;
6826 0 : }
6827 0 : case 5: {
6828 0 : break;
6829 0 : }
6830 0 : case 6: {
6831 0 : fd_pubkey_new( &self->initialize_nonce_account );
6832 0 : break;
6833 0 : }
6834 0 : case 7: {
6835 0 : fd_pubkey_new( &self->authorize_nonce_account );
6836 0 : break;
6837 0 : }
6838 0 : case 8: {
6839 0 : break;
6840 0 : }
6841 0 : case 9: {
6842 0 : fd_system_program_instruction_allocate_with_seed_new( &self->allocate_with_seed );
6843 0 : break;
6844 0 : }
6845 0 : case 10: {
6846 0 : fd_system_program_instruction_assign_with_seed_new( &self->assign_with_seed );
6847 0 : break;
6848 0 : }
6849 0 : case 11: {
6850 0 : fd_system_program_instruction_transfer_with_seed_new( &self->transfer_with_seed );
6851 0 : break;
6852 0 : }
6853 0 : case 12: {
6854 0 : break;
6855 0 : }
6856 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
6857 0 : }
6858 0 : }
6859 0 : void fd_system_program_instruction_new_disc( fd_system_program_instruction_t * self, uint discriminant ) {
6860 0 : self->discriminant = discriminant;
6861 0 : fd_system_program_instruction_inner_new( &self->inner, self->discriminant );
6862 0 : }
6863 0 : void fd_system_program_instruction_new( fd_system_program_instruction_t * self ) {
6864 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_t) );
6865 0 : fd_system_program_instruction_new_disc( self, UINT_MAX );
6866 0 : }
6867 :
6868 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 ) {
6869 0 : (void) varint;
6870 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_system_program_instruction", level++, 0);
6871 0 : switch( self->discriminant ) {
6872 0 : case 0: {
6873 0 : fun( w, self, "create_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6874 0 : fd_system_program_instruction_create_account_walk( w, &self->inner.create_account, fun, "create_account", level, 0 );
6875 0 : break;
6876 0 : }
6877 0 : case 1: {
6878 0 : fun( w, self, "assign", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6879 0 : fd_pubkey_walk( w, &self->inner.assign, fun, "assign", level, 0 );
6880 0 : break;
6881 0 : }
6882 0 : case 2: {
6883 0 : fun( w, self, "transfer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6884 0 : fun( w, &self->inner.transfer, "transfer", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6885 0 : break;
6886 0 : }
6887 0 : case 3: {
6888 0 : fun( w, self, "create_account_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6889 0 : fd_system_program_instruction_create_account_with_seed_walk( w, &self->inner.create_account_with_seed, fun, "create_account_with_seed", level, 0 );
6890 0 : break;
6891 0 : }
6892 0 : case 4: {
6893 0 : fun( w, self, "advance_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6894 0 : break;
6895 0 : }
6896 0 : case 5: {
6897 0 : fun( w, self, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6898 0 : fun( w, &self->inner.withdraw_nonce_account, "withdraw_nonce_account", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6899 0 : break;
6900 0 : }
6901 0 : case 6: {
6902 0 : fun( w, self, "initialize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6903 0 : fd_pubkey_walk( w, &self->inner.initialize_nonce_account, fun, "initialize_nonce_account", level, 0 );
6904 0 : break;
6905 0 : }
6906 0 : case 7: {
6907 0 : fun( w, self, "authorize_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6908 0 : fd_pubkey_walk( w, &self->inner.authorize_nonce_account, fun, "authorize_nonce_account", level, 0 );
6909 0 : break;
6910 0 : }
6911 0 : case 8: {
6912 0 : fun( w, self, "allocate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6913 0 : fun( w, &self->inner.allocate, "allocate", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
6914 0 : break;
6915 0 : }
6916 0 : case 9: {
6917 0 : fun( w, self, "allocate_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6918 0 : fd_system_program_instruction_allocate_with_seed_walk( w, &self->inner.allocate_with_seed, fun, "allocate_with_seed", level, 0 );
6919 0 : break;
6920 0 : }
6921 0 : case 10: {
6922 0 : fun( w, self, "assign_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6923 0 : fd_system_program_instruction_assign_with_seed_walk( w, &self->inner.assign_with_seed, fun, "assign_with_seed", level, 0 );
6924 0 : break;
6925 0 : }
6926 0 : case 11: {
6927 0 : fun( w, self, "transfer_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6928 0 : fd_system_program_instruction_transfer_with_seed_walk( w, &self->inner.transfer_with_seed, fun, "transfer_with_seed", level, 0 );
6929 0 : break;
6930 0 : }
6931 0 : case 12: {
6932 0 : fun( w, self, "upgrade_nonce_account", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
6933 0 : break;
6934 0 : }
6935 0 : }
6936 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_system_program_instruction", level--, 0 );
6937 0 : }
6938 0 : ulong fd_system_program_instruction_size( fd_system_program_instruction_t const * self ) {
6939 0 : ulong size = 0;
6940 0 : size += sizeof(uint);
6941 0 : switch (self->discriminant) {
6942 0 : case 0: {
6943 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account );
6944 0 : break;
6945 0 : }
6946 0 : case 1: {
6947 0 : size += fd_pubkey_size( &self->inner.assign );
6948 0 : break;
6949 0 : }
6950 0 : case 2: {
6951 0 : size += sizeof(ulong);
6952 0 : break;
6953 0 : }
6954 0 : case 3: {
6955 0 : size += fd_system_program_instruction_create_account_with_seed_size( &self->inner.create_account_with_seed );
6956 0 : break;
6957 0 : }
6958 0 : case 5: {
6959 0 : size += sizeof(ulong);
6960 0 : break;
6961 0 : }
6962 0 : case 6: {
6963 0 : size += fd_pubkey_size( &self->inner.initialize_nonce_account );
6964 0 : break;
6965 0 : }
6966 0 : case 7: {
6967 0 : size += fd_pubkey_size( &self->inner.authorize_nonce_account );
6968 0 : break;
6969 0 : }
6970 0 : case 8: {
6971 0 : size += sizeof(ulong);
6972 0 : break;
6973 0 : }
6974 0 : case 9: {
6975 0 : size += fd_system_program_instruction_allocate_with_seed_size( &self->inner.allocate_with_seed );
6976 0 : break;
6977 0 : }
6978 0 : case 10: {
6979 0 : size += fd_system_program_instruction_assign_with_seed_size( &self->inner.assign_with_seed );
6980 0 : break;
6981 0 : }
6982 0 : case 11: {
6983 0 : size += fd_system_program_instruction_transfer_with_seed_size( &self->inner.transfer_with_seed );
6984 0 : break;
6985 0 : }
6986 0 : }
6987 0 : return size;
6988 0 : }
6989 :
6990 0 : int fd_system_program_instruction_inner_encode( fd_system_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6991 0 : int err;
6992 0 : switch (discriminant) {
6993 0 : case 0: {
6994 0 : err = fd_system_program_instruction_create_account_encode( &self->create_account, ctx );
6995 0 : if( FD_UNLIKELY( err ) ) return err;
6996 0 : break;
6997 0 : }
6998 0 : case 1: {
6999 0 : err = fd_pubkey_encode( &self->assign, ctx );
7000 0 : if( FD_UNLIKELY( err ) ) return err;
7001 0 : break;
7002 0 : }
7003 0 : case 2: {
7004 0 : err = fd_bincode_uint64_encode( self->transfer, ctx );
7005 0 : if( FD_UNLIKELY( err ) ) return err;
7006 0 : break;
7007 0 : }
7008 0 : case 3: {
7009 0 : err = fd_system_program_instruction_create_account_with_seed_encode( &self->create_account_with_seed, ctx );
7010 0 : if( FD_UNLIKELY( err ) ) return err;
7011 0 : break;
7012 0 : }
7013 0 : case 5: {
7014 0 : err = fd_bincode_uint64_encode( self->withdraw_nonce_account, ctx );
7015 0 : if( FD_UNLIKELY( err ) ) return err;
7016 0 : break;
7017 0 : }
7018 0 : case 6: {
7019 0 : err = fd_pubkey_encode( &self->initialize_nonce_account, ctx );
7020 0 : if( FD_UNLIKELY( err ) ) return err;
7021 0 : break;
7022 0 : }
7023 0 : case 7: {
7024 0 : err = fd_pubkey_encode( &self->authorize_nonce_account, ctx );
7025 0 : if( FD_UNLIKELY( err ) ) return err;
7026 0 : break;
7027 0 : }
7028 0 : case 8: {
7029 0 : err = fd_bincode_uint64_encode( self->allocate, ctx );
7030 0 : if( FD_UNLIKELY( err ) ) return err;
7031 0 : break;
7032 0 : }
7033 0 : case 9: {
7034 0 : err = fd_system_program_instruction_allocate_with_seed_encode( &self->allocate_with_seed, ctx );
7035 0 : if( FD_UNLIKELY( err ) ) return err;
7036 0 : break;
7037 0 : }
7038 0 : case 10: {
7039 0 : err = fd_system_program_instruction_assign_with_seed_encode( &self->assign_with_seed, ctx );
7040 0 : if( FD_UNLIKELY( err ) ) return err;
7041 0 : break;
7042 0 : }
7043 0 : case 11: {
7044 0 : err = fd_system_program_instruction_transfer_with_seed_encode( &self->transfer_with_seed, ctx );
7045 0 : if( FD_UNLIKELY( err ) ) return err;
7046 0 : break;
7047 0 : }
7048 0 : }
7049 0 : return FD_BINCODE_SUCCESS;
7050 0 : }
7051 0 : int fd_system_program_instruction_encode( fd_system_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7052 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7053 0 : if( FD_UNLIKELY( err ) ) return err;
7054 0 : return fd_system_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7055 0 : }
7056 :
7057 12 : int fd_stake_authorized_encode( fd_stake_authorized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7058 12 : int err;
7059 12 : err = fd_pubkey_encode( &self->staker, ctx );
7060 12 : if( FD_UNLIKELY( err ) ) return err;
7061 12 : err = fd_pubkey_encode( &self->withdrawer, ctx );
7062 12 : if( FD_UNLIKELY( err ) ) return err;
7063 12 : return FD_BINCODE_SUCCESS;
7064 12 : }
7065 0 : static inline int fd_stake_authorized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7066 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7067 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
7068 0 : return 0;
7069 0 : }
7070 0 : static void fd_stake_authorized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7071 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)struct_mem;
7072 0 : fd_pubkey_decode_inner( &self->staker, alloc_mem, ctx );
7073 0 : fd_pubkey_decode_inner( &self->withdrawer, alloc_mem, ctx );
7074 0 : }
7075 0 : void * fd_stake_authorized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7076 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)mem;
7077 0 : fd_stake_authorized_new( self );
7078 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorized_t);
7079 0 : void * * alloc_mem = &alloc_region;
7080 0 : fd_stake_authorized_decode_inner( mem, alloc_mem, ctx );
7081 0 : return self;
7082 0 : }
7083 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 ) {
7084 0 : (void) varint;
7085 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_authorized", level++, 0 );
7086 0 : fd_pubkey_walk( w, &self->staker, fun, "staker", level, 0 );
7087 0 : fd_pubkey_walk( w, &self->withdrawer, fun, "withdrawer", level, 0 );
7088 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_authorized", level--, 0 );
7089 0 : }
7090 12 : int fd_stake_lockup_encode( fd_stake_lockup_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7091 12 : int err;
7092 12 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
7093 12 : if( FD_UNLIKELY( err ) ) return err;
7094 12 : err = fd_bincode_uint64_encode( self->epoch, ctx );
7095 12 : if( FD_UNLIKELY( err ) ) return err;
7096 12 : err = fd_pubkey_encode( &self->custodian, ctx );
7097 12 : if( FD_UNLIKELY( err ) ) return err;
7098 12 : return FD_BINCODE_SUCCESS;
7099 12 : }
7100 0 : static inline int fd_stake_lockup_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7101 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7102 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
7103 0 : return 0;
7104 0 : }
7105 0 : static void fd_stake_lockup_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7106 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)struct_mem;
7107 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
7108 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
7109 0 : fd_pubkey_decode_inner( &self->custodian, alloc_mem, ctx );
7110 0 : }
7111 0 : void * fd_stake_lockup_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7112 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)mem;
7113 0 : fd_stake_lockup_new( self );
7114 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_t);
7115 0 : void * * alloc_mem = &alloc_region;
7116 0 : fd_stake_lockup_decode_inner( mem, alloc_mem, ctx );
7117 0 : return self;
7118 0 : }
7119 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 ) {
7120 0 : (void) varint;
7121 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup", level++, 0 );
7122 0 : fun( w, &self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
7123 0 : fun( w, &self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7124 0 : fd_pubkey_walk( w, &self->custodian, fun, "custodian", level, 0 );
7125 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup", level--, 0 );
7126 0 : }
7127 0 : int fd_stake_instruction_initialize_encode( fd_stake_instruction_initialize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7128 0 : int err;
7129 0 : err = fd_stake_authorized_encode( &self->authorized, ctx );
7130 0 : if( FD_UNLIKELY( err ) ) return err;
7131 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
7132 0 : if( FD_UNLIKELY( err ) ) return err;
7133 0 : return FD_BINCODE_SUCCESS;
7134 0 : }
7135 0 : static inline int fd_stake_instruction_initialize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7136 0 : if( (ulong)ctx->data + 112UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7137 0 : ctx->data = (void *)( (ulong)ctx->data + 112UL );
7138 0 : return 0;
7139 0 : }
7140 0 : static void fd_stake_instruction_initialize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7141 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)struct_mem;
7142 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
7143 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
7144 0 : }
7145 0 : void * fd_stake_instruction_initialize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7146 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)mem;
7147 0 : fd_stake_instruction_initialize_new( self );
7148 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_initialize_t);
7149 0 : void * * alloc_mem = &alloc_region;
7150 0 : fd_stake_instruction_initialize_decode_inner( mem, alloc_mem, ctx );
7151 0 : return self;
7152 0 : }
7153 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 ) {
7154 0 : (void) varint;
7155 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_initialize", level++, 0 );
7156 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level, 0 );
7157 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
7158 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_initialize", level--, 0 );
7159 0 : }
7160 0 : int fd_stake_lockup_custodian_args_encode( fd_stake_lockup_custodian_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7161 0 : int err;
7162 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
7163 0 : if( FD_UNLIKELY( err ) ) return err;
7164 0 : err = fd_sol_sysvar_clock_encode( &self->clock, ctx );
7165 0 : if( FD_UNLIKELY( err ) ) return err;
7166 0 : if( self->custodian != NULL ) {
7167 0 : err = fd_bincode_bool_encode( 1, ctx );
7168 0 : if( FD_UNLIKELY( err ) ) return err;
7169 0 : err = fd_pubkey_encode( self->custodian, ctx );
7170 0 : if( FD_UNLIKELY( err ) ) return err;
7171 0 : } else {
7172 0 : err = fd_bincode_bool_encode( 0, ctx );
7173 0 : if( FD_UNLIKELY( err ) ) return err;
7174 0 : }
7175 0 : return FD_BINCODE_SUCCESS;
7176 0 : }
7177 0 : static int fd_stake_lockup_custodian_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7178 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7179 0 : int err = 0;
7180 0 : err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
7181 0 : if( FD_UNLIKELY( err ) ) return err;
7182 0 : err = fd_sol_sysvar_clock_decode_footprint_inner( ctx, total_sz );
7183 0 : if( FD_UNLIKELY( err ) ) return err;
7184 0 : {
7185 0 : uchar o;
7186 0 : err = fd_bincode_bool_decode( &o, ctx );
7187 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7188 0 : if( o ) {
7189 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
7190 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7191 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7192 0 : }
7193 0 : }
7194 0 : return 0;
7195 0 : }
7196 0 : int fd_stake_lockup_custodian_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7197 0 : *total_sz += sizeof(fd_stake_lockup_custodian_args_t);
7198 0 : void const * start_data = ctx->data;
7199 0 : int err = fd_stake_lockup_custodian_args_decode_footprint_inner( ctx, total_sz );
7200 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7201 0 : ctx->data = start_data;
7202 0 : return err;
7203 0 : }
7204 0 : static void fd_stake_lockup_custodian_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7205 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)struct_mem;
7206 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
7207 0 : fd_sol_sysvar_clock_decode_inner( &self->clock, alloc_mem, ctx );
7208 0 : {
7209 0 : uchar o;
7210 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7211 0 : if( o ) {
7212 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
7213 0 : self->custodian = *alloc_mem;
7214 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
7215 0 : fd_pubkey_new( self->custodian );
7216 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
7217 0 : } else {
7218 0 : self->custodian = NULL;
7219 0 : }
7220 0 : }
7221 0 : }
7222 0 : void * fd_stake_lockup_custodian_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7223 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)mem;
7224 0 : fd_stake_lockup_custodian_args_new( self );
7225 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_custodian_args_t);
7226 0 : void * * alloc_mem = &alloc_region;
7227 0 : fd_stake_lockup_custodian_args_decode_inner( mem, alloc_mem, ctx );
7228 0 : return self;
7229 0 : }
7230 0 : void fd_stake_lockup_custodian_args_new(fd_stake_lockup_custodian_args_t * self) {
7231 0 : fd_memset( self, 0, sizeof(fd_stake_lockup_custodian_args_t) );
7232 0 : fd_stake_lockup_new( &self->lockup );
7233 0 : fd_sol_sysvar_clock_new( &self->clock );
7234 0 : }
7235 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 ) {
7236 0 : (void) varint;
7237 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_lockup_custodian_args", level++, 0 );
7238 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
7239 0 : fd_sol_sysvar_clock_walk( w, &self->clock, fun, "clock", level, 0 );
7240 0 : if( !self->custodian ) {
7241 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
7242 0 : } else {
7243 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level, 0 );
7244 0 : }
7245 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_lockup_custodian_args", level--, 0 );
7246 0 : }
7247 0 : ulong fd_stake_lockup_custodian_args_size( fd_stake_lockup_custodian_args_t const * self ) {
7248 0 : ulong size = 0;
7249 0 : size += fd_stake_lockup_size( &self->lockup );
7250 0 : size += fd_sol_sysvar_clock_size( &self->clock );
7251 0 : size += sizeof(char);
7252 0 : if( NULL != self->custodian ) {
7253 0 : size += fd_pubkey_size( self->custodian );
7254 0 : }
7255 0 : return size;
7256 0 : }
7257 :
7258 0 : FD_FN_PURE uchar fd_stake_authorize_is_staker(fd_stake_authorize_t const * self) {
7259 0 : return self->discriminant == 0;
7260 0 : }
7261 0 : FD_FN_PURE uchar fd_stake_authorize_is_withdrawer(fd_stake_authorize_t const * self) {
7262 0 : return self->discriminant == 1;
7263 0 : }
7264 0 : int fd_stake_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7265 0 : int err;
7266 0 : switch (discriminant) {
7267 0 : case 0: {
7268 0 : return FD_BINCODE_SUCCESS;
7269 0 : }
7270 0 : case 1: {
7271 0 : return FD_BINCODE_SUCCESS;
7272 0 : }
7273 0 : default: return FD_BINCODE_ERR_ENCODING;
7274 0 : }
7275 0 : }
7276 0 : static int fd_stake_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7277 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7278 0 : uint discriminant = 0;
7279 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7280 0 : if( FD_UNLIKELY( err ) ) return err;
7281 0 : return fd_stake_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
7282 0 : }
7283 0 : int fd_stake_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7284 0 : *total_sz += sizeof(fd_stake_authorize_t);
7285 0 : void const * start_data = ctx->data;
7286 0 : int err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
7287 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7288 0 : ctx->data = start_data;
7289 0 : return err;
7290 0 : }
7291 0 : static void fd_stake_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7292 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)struct_mem;
7293 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7294 0 : }
7295 0 : void * fd_stake_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7296 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)mem;
7297 0 : fd_stake_authorize_new( self );
7298 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorize_t);
7299 0 : void * * alloc_mem = &alloc_region;
7300 0 : fd_stake_authorize_decode_inner( mem, alloc_mem, ctx );
7301 0 : return self;
7302 0 : }
7303 :
7304 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 ) {
7305 0 : (void) varint;
7306 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_authorize", level++, 0);
7307 0 : switch( self->discriminant ) {
7308 0 : case 0: {
7309 0 : fun( w, self, "staker", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7310 0 : break;
7311 0 : }
7312 0 : case 1: {
7313 0 : fun( w, self, "withdrawer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
7314 0 : break;
7315 0 : }
7316 0 : }
7317 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_authorize", level--, 0 );
7318 0 : }
7319 0 : ulong fd_stake_authorize_size( fd_stake_authorize_t const * self ) {
7320 0 : ulong size = 0;
7321 0 : size += sizeof(uint);
7322 0 : switch (self->discriminant) {
7323 0 : }
7324 0 : return size;
7325 0 : }
7326 :
7327 0 : int fd_stake_authorize_encode( fd_stake_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7328 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7329 0 : if( FD_UNLIKELY( err ) ) return err;
7330 0 : return err;
7331 0 : }
7332 :
7333 0 : int fd_stake_instruction_authorize_encode( fd_stake_instruction_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7334 0 : int err;
7335 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
7336 0 : if( FD_UNLIKELY( err ) ) return err;
7337 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
7338 0 : if( FD_UNLIKELY( err ) ) return err;
7339 0 : return FD_BINCODE_SUCCESS;
7340 0 : }
7341 0 : static int fd_stake_instruction_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7342 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7343 0 : int err = 0;
7344 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7345 0 : if( FD_UNLIKELY( err ) ) return err;
7346 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
7347 0 : if( FD_UNLIKELY( err ) ) return err;
7348 0 : return 0;
7349 0 : }
7350 0 : int fd_stake_instruction_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7351 0 : *total_sz += sizeof(fd_stake_instruction_authorize_t);
7352 0 : void const * start_data = ctx->data;
7353 0 : int err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
7354 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7355 0 : ctx->data = start_data;
7356 0 : return err;
7357 0 : }
7358 0 : static void fd_stake_instruction_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7359 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)struct_mem;
7360 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
7361 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
7362 0 : }
7363 0 : void * fd_stake_instruction_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7364 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)mem;
7365 0 : fd_stake_instruction_authorize_new( self );
7366 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_authorize_t);
7367 0 : void * * alloc_mem = &alloc_region;
7368 0 : fd_stake_instruction_authorize_decode_inner( mem, alloc_mem, ctx );
7369 0 : return self;
7370 0 : }
7371 0 : void fd_stake_instruction_authorize_new(fd_stake_instruction_authorize_t * self) {
7372 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_authorize_t) );
7373 0 : fd_pubkey_new( &self->pubkey );
7374 0 : fd_stake_authorize_new( &self->stake_authorize );
7375 0 : }
7376 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 ) {
7377 0 : (void) varint;
7378 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_instruction_authorize", level++, 0 );
7379 0 : fd_pubkey_walk( w, &self->pubkey, fun, "pubkey", level, 0 );
7380 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
7381 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_instruction_authorize", level--, 0 );
7382 0 : }
7383 0 : int fd_authorize_with_seed_args_encode( fd_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7384 0 : int err;
7385 0 : err = fd_pubkey_encode( &self->new_authorized_pubkey, ctx );
7386 0 : if( FD_UNLIKELY( err ) ) return err;
7387 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
7388 0 : if( FD_UNLIKELY( err ) ) return err;
7389 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
7390 0 : if( FD_UNLIKELY(err) ) return err;
7391 0 : if( self->authority_seed_len ) {
7392 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
7393 0 : if( FD_UNLIKELY( err ) ) return err;
7394 0 : }
7395 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
7396 0 : if( FD_UNLIKELY( err ) ) return err;
7397 0 : return FD_BINCODE_SUCCESS;
7398 0 : }
7399 0 : static int fd_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7400 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7401 0 : int err = 0;
7402 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7403 0 : if( FD_UNLIKELY( err ) ) return err;
7404 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
7405 0 : if( FD_UNLIKELY( err ) ) return err;
7406 0 : ulong authority_seed_len;
7407 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
7408 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7409 0 : *total_sz += authority_seed_len;
7410 0 : if( authority_seed_len ) {
7411 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
7412 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7413 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
7414 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7415 0 : }
7416 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7417 0 : if( FD_UNLIKELY( err ) ) return err;
7418 0 : return 0;
7419 0 : }
7420 0 : int fd_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7421 0 : *total_sz += sizeof(fd_authorize_with_seed_args_t);
7422 0 : void const * start_data = ctx->data;
7423 0 : int err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
7424 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7425 0 : ctx->data = start_data;
7426 0 : return err;
7427 0 : }
7428 0 : static void fd_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7429 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)struct_mem;
7430 0 : fd_pubkey_decode_inner( &self->new_authorized_pubkey, alloc_mem, ctx );
7431 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
7432 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
7433 0 : if( self->authority_seed_len ) {
7434 0 : self->authority_seed = *alloc_mem;
7435 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
7436 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
7437 0 : } else
7438 0 : self->authority_seed = NULL;
7439 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
7440 0 : }
7441 0 : void * fd_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7442 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)mem;
7443 0 : fd_authorize_with_seed_args_new( self );
7444 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_with_seed_args_t);
7445 0 : void * * alloc_mem = &alloc_region;
7446 0 : fd_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
7447 0 : return self;
7448 0 : }
7449 0 : void fd_authorize_with_seed_args_new(fd_authorize_with_seed_args_t * self) {
7450 0 : fd_memset( self, 0, sizeof(fd_authorize_with_seed_args_t) );
7451 0 : fd_pubkey_new( &self->new_authorized_pubkey );
7452 0 : fd_stake_authorize_new( &self->stake_authorize );
7453 0 : fd_pubkey_new( &self->authority_owner );
7454 0 : }
7455 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 ) {
7456 0 : (void) varint;
7457 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_with_seed_args", level++, 0 );
7458 0 : fd_pubkey_walk( w, &self->new_authorized_pubkey, fun, "new_authorized_pubkey", level, 0 );
7459 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
7460 0 : if( self->authority_seed_len ) {
7461 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
7462 0 : for( ulong i=0; i < self->authority_seed_len; i++ )
7463 0 : fun( w, self->authority_seed + i, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7464 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
7465 0 : }
7466 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level, 0 );
7467 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_with_seed_args", level--, 0 );
7468 0 : }
7469 0 : ulong fd_authorize_with_seed_args_size( fd_authorize_with_seed_args_t const * self ) {
7470 0 : ulong size = 0;
7471 0 : size += fd_pubkey_size( &self->new_authorized_pubkey );
7472 0 : size += fd_stake_authorize_size( &self->stake_authorize );
7473 0 : do {
7474 0 : size += sizeof(ulong);
7475 0 : size += self->authority_seed_len;
7476 0 : } while(0);
7477 0 : size += fd_pubkey_size( &self->authority_owner );
7478 0 : return size;
7479 0 : }
7480 :
7481 0 : int fd_authorize_checked_with_seed_args_encode( fd_authorize_checked_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7482 0 : int err;
7483 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
7484 0 : if( FD_UNLIKELY( err ) ) return err;
7485 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
7486 0 : if( FD_UNLIKELY(err) ) return err;
7487 0 : if( self->authority_seed_len ) {
7488 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
7489 0 : if( FD_UNLIKELY( err ) ) return err;
7490 0 : }
7491 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
7492 0 : if( FD_UNLIKELY( err ) ) return err;
7493 0 : return FD_BINCODE_SUCCESS;
7494 0 : }
7495 0 : static int fd_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7496 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7497 0 : int err = 0;
7498 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
7499 0 : if( FD_UNLIKELY( err ) ) return err;
7500 0 : ulong authority_seed_len;
7501 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
7502 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7503 0 : *total_sz += authority_seed_len;
7504 0 : if( authority_seed_len ) {
7505 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
7506 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7507 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
7508 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7509 0 : }
7510 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7511 0 : if( FD_UNLIKELY( err ) ) return err;
7512 0 : return 0;
7513 0 : }
7514 0 : int fd_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7515 0 : *total_sz += sizeof(fd_authorize_checked_with_seed_args_t);
7516 0 : void const * start_data = ctx->data;
7517 0 : int err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
7518 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7519 0 : ctx->data = start_data;
7520 0 : return err;
7521 0 : }
7522 0 : static void fd_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7523 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)struct_mem;
7524 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
7525 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
7526 0 : if( self->authority_seed_len ) {
7527 0 : self->authority_seed = *alloc_mem;
7528 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
7529 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
7530 0 : } else
7531 0 : self->authority_seed = NULL;
7532 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
7533 0 : }
7534 0 : void * fd_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7535 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)mem;
7536 0 : fd_authorize_checked_with_seed_args_new( self );
7537 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_checked_with_seed_args_t);
7538 0 : void * * alloc_mem = &alloc_region;
7539 0 : fd_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
7540 0 : return self;
7541 0 : }
7542 0 : void fd_authorize_checked_with_seed_args_new(fd_authorize_checked_with_seed_args_t * self) {
7543 0 : fd_memset( self, 0, sizeof(fd_authorize_checked_with_seed_args_t) );
7544 0 : fd_stake_authorize_new( &self->stake_authorize );
7545 0 : fd_pubkey_new( &self->authority_owner );
7546 0 : }
7547 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 ) {
7548 0 : (void) varint;
7549 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_authorize_checked_with_seed_args", level++, 0 );
7550 0 : fd_stake_authorize_walk( w, &self->stake_authorize, fun, "stake_authorize", level, 0 );
7551 0 : if( self->authority_seed_len ) {
7552 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
7553 0 : for( ulong i=0; i < self->authority_seed_len; i++ )
7554 0 : fun( w, self->authority_seed + i, "authority_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
7555 0 : fun( w, NULL, "authority_seed", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
7556 0 : }
7557 0 : fd_pubkey_walk( w, &self->authority_owner, fun, "authority_owner", level, 0 );
7558 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_authorize_checked_with_seed_args", level--, 0 );
7559 0 : }
7560 0 : ulong fd_authorize_checked_with_seed_args_size( fd_authorize_checked_with_seed_args_t const * self ) {
7561 0 : ulong size = 0;
7562 0 : size += fd_stake_authorize_size( &self->stake_authorize );
7563 0 : do {
7564 0 : size += sizeof(ulong);
7565 0 : size += self->authority_seed_len;
7566 0 : } while(0);
7567 0 : size += fd_pubkey_size( &self->authority_owner );
7568 0 : return size;
7569 0 : }
7570 :
7571 0 : int fd_lockup_checked_args_encode( fd_lockup_checked_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7572 0 : int err;
7573 0 : if( self->unix_timestamp != NULL ) {
7574 0 : err = fd_bincode_bool_encode( 1, ctx );
7575 0 : if( FD_UNLIKELY( err ) ) return err;
7576 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
7577 0 : if( FD_UNLIKELY( err ) ) return err;
7578 0 : } else {
7579 0 : err = fd_bincode_bool_encode( 0, ctx );
7580 0 : if( FD_UNLIKELY( err ) ) return err;
7581 0 : }
7582 0 : if( self->epoch != NULL ) {
7583 0 : err = fd_bincode_bool_encode( 1, ctx );
7584 0 : if( FD_UNLIKELY( err ) ) return err;
7585 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
7586 0 : if( FD_UNLIKELY( err ) ) return err;
7587 0 : } else {
7588 0 : err = fd_bincode_bool_encode( 0, ctx );
7589 0 : if( FD_UNLIKELY( err ) ) return err;
7590 0 : }
7591 0 : return FD_BINCODE_SUCCESS;
7592 0 : }
7593 0 : static int fd_lockup_checked_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7594 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7595 0 : int err = 0;
7596 0 : {
7597 0 : uchar o;
7598 0 : err = fd_bincode_bool_decode( &o, ctx );
7599 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7600 0 : if( o ) {
7601 0 : *total_sz += 8UL + sizeof(long);
7602 0 : err = fd_bincode_int64_decode_footprint( ctx );
7603 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7604 0 : }
7605 0 : }
7606 0 : {
7607 0 : uchar o;
7608 0 : err = fd_bincode_bool_decode( &o, ctx );
7609 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7610 0 : if( o ) {
7611 0 : *total_sz += 8UL + sizeof(ulong);
7612 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7613 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7614 0 : }
7615 0 : }
7616 0 : return 0;
7617 0 : }
7618 0 : int fd_lockup_checked_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7619 0 : *total_sz += sizeof(fd_lockup_checked_args_t);
7620 0 : void const * start_data = ctx->data;
7621 0 : int err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
7622 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7623 0 : ctx->data = start_data;
7624 0 : return err;
7625 0 : }
7626 0 : static void fd_lockup_checked_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7627 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)struct_mem;
7628 0 : {
7629 0 : uchar o;
7630 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7631 0 : if( o ) {
7632 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
7633 0 : self->unix_timestamp = *alloc_mem;
7634 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
7635 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
7636 0 : } else {
7637 0 : self->unix_timestamp = NULL;
7638 0 : }
7639 0 : }
7640 0 : {
7641 0 : uchar o;
7642 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7643 0 : if( o ) {
7644 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
7645 0 : self->epoch = *alloc_mem;
7646 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
7647 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
7648 0 : } else {
7649 0 : self->epoch = NULL;
7650 0 : }
7651 0 : }
7652 0 : }
7653 0 : void * fd_lockup_checked_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7654 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)mem;
7655 0 : fd_lockup_checked_args_new( self );
7656 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_checked_args_t);
7657 0 : void * * alloc_mem = &alloc_region;
7658 0 : fd_lockup_checked_args_decode_inner( mem, alloc_mem, ctx );
7659 0 : return self;
7660 0 : }
7661 0 : void fd_lockup_checked_args_new(fd_lockup_checked_args_t * self) {
7662 0 : fd_memset( self, 0, sizeof(fd_lockup_checked_args_t) );
7663 0 : }
7664 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 ) {
7665 0 : (void) varint;
7666 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_checked_args", level++, 0 );
7667 0 : if( !self->unix_timestamp ) {
7668 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
7669 0 : } else {
7670 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
7671 0 : }
7672 0 : if( !self->epoch ) {
7673 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
7674 0 : } else {
7675 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7676 0 : }
7677 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_checked_args", level--, 0 );
7678 0 : }
7679 0 : ulong fd_lockup_checked_args_size( fd_lockup_checked_args_t const * self ) {
7680 0 : ulong size = 0;
7681 0 : size += sizeof(char);
7682 0 : if( NULL != self->unix_timestamp ) {
7683 0 : size += sizeof(long);
7684 0 : }
7685 0 : size += sizeof(char);
7686 0 : if( NULL != self->epoch ) {
7687 0 : size += sizeof(ulong);
7688 0 : }
7689 0 : return size;
7690 0 : }
7691 :
7692 0 : int fd_lockup_args_encode( fd_lockup_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7693 0 : int err;
7694 0 : if( self->unix_timestamp != NULL ) {
7695 0 : err = fd_bincode_bool_encode( 1, ctx );
7696 0 : if( FD_UNLIKELY( err ) ) return err;
7697 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
7698 0 : if( FD_UNLIKELY( err ) ) return err;
7699 0 : } else {
7700 0 : err = fd_bincode_bool_encode( 0, ctx );
7701 0 : if( FD_UNLIKELY( err ) ) return err;
7702 0 : }
7703 0 : if( self->epoch != NULL ) {
7704 0 : err = fd_bincode_bool_encode( 1, ctx );
7705 0 : if( FD_UNLIKELY( err ) ) return err;
7706 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
7707 0 : if( FD_UNLIKELY( err ) ) return err;
7708 0 : } else {
7709 0 : err = fd_bincode_bool_encode( 0, ctx );
7710 0 : if( FD_UNLIKELY( err ) ) return err;
7711 0 : }
7712 0 : if( self->custodian != NULL ) {
7713 0 : err = fd_bincode_bool_encode( 1, ctx );
7714 0 : if( FD_UNLIKELY( err ) ) return err;
7715 0 : err = fd_pubkey_encode( self->custodian, ctx );
7716 0 : if( FD_UNLIKELY( err ) ) return err;
7717 0 : } else {
7718 0 : err = fd_bincode_bool_encode( 0, ctx );
7719 0 : if( FD_UNLIKELY( err ) ) return err;
7720 0 : }
7721 0 : return FD_BINCODE_SUCCESS;
7722 0 : }
7723 0 : static int fd_lockup_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7724 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7725 0 : int err = 0;
7726 0 : {
7727 0 : uchar o;
7728 0 : err = fd_bincode_bool_decode( &o, ctx );
7729 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7730 0 : if( o ) {
7731 0 : *total_sz += 8UL + sizeof(long);
7732 0 : err = fd_bincode_int64_decode_footprint( ctx );
7733 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7734 0 : }
7735 0 : }
7736 0 : {
7737 0 : uchar o;
7738 0 : err = fd_bincode_bool_decode( &o, ctx );
7739 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7740 0 : if( o ) {
7741 0 : *total_sz += 8UL + sizeof(ulong);
7742 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7743 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7744 0 : }
7745 0 : }
7746 0 : {
7747 0 : uchar o;
7748 0 : err = fd_bincode_bool_decode( &o, ctx );
7749 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7750 0 : if( o ) {
7751 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
7752 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7753 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7754 0 : }
7755 0 : }
7756 0 : return 0;
7757 0 : }
7758 0 : int fd_lockup_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7759 0 : *total_sz += sizeof(fd_lockup_args_t);
7760 0 : void const * start_data = ctx->data;
7761 0 : int err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
7762 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7763 0 : ctx->data = start_data;
7764 0 : return err;
7765 0 : }
7766 0 : static void fd_lockup_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7767 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)struct_mem;
7768 0 : {
7769 0 : uchar o;
7770 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7771 0 : if( o ) {
7772 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
7773 0 : self->unix_timestamp = *alloc_mem;
7774 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
7775 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
7776 0 : } else {
7777 0 : self->unix_timestamp = NULL;
7778 0 : }
7779 0 : }
7780 0 : {
7781 0 : uchar o;
7782 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7783 0 : if( o ) {
7784 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
7785 0 : self->epoch = *alloc_mem;
7786 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
7787 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
7788 0 : } else {
7789 0 : self->epoch = NULL;
7790 0 : }
7791 0 : }
7792 0 : {
7793 0 : uchar o;
7794 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
7795 0 : if( o ) {
7796 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
7797 0 : self->custodian = *alloc_mem;
7798 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
7799 0 : fd_pubkey_new( self->custodian );
7800 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
7801 0 : } else {
7802 0 : self->custodian = NULL;
7803 0 : }
7804 0 : }
7805 0 : }
7806 0 : void * fd_lockup_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7807 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)mem;
7808 0 : fd_lockup_args_new( self );
7809 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_args_t);
7810 0 : void * * alloc_mem = &alloc_region;
7811 0 : fd_lockup_args_decode_inner( mem, alloc_mem, ctx );
7812 0 : return self;
7813 0 : }
7814 0 : void fd_lockup_args_new(fd_lockup_args_t * self) {
7815 0 : fd_memset( self, 0, sizeof(fd_lockup_args_t) );
7816 0 : }
7817 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 ) {
7818 0 : (void) varint;
7819 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lockup_args", level++, 0 );
7820 0 : if( !self->unix_timestamp ) {
7821 0 : fun( w, NULL, "unix_timestamp", FD_FLAMENCO_TYPE_NULL, "long", level, 0 );
7822 0 : } else {
7823 0 : fun( w, self->unix_timestamp, "unix_timestamp", FD_FLAMENCO_TYPE_SLONG, "long", level, 0 );
7824 0 : }
7825 0 : if( !self->epoch ) {
7826 0 : fun( w, NULL, "epoch", FD_FLAMENCO_TYPE_NULL, "ulong", level, 0 );
7827 0 : } else {
7828 0 : fun( w, self->epoch, "epoch", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
7829 0 : }
7830 0 : if( !self->custodian ) {
7831 0 : fun( w, NULL, "custodian", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
7832 0 : } else {
7833 0 : fd_pubkey_walk( w, self->custodian, fun, "custodian", level, 0 );
7834 0 : }
7835 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lockup_args", level--, 0 );
7836 0 : }
7837 0 : ulong fd_lockup_args_size( fd_lockup_args_t const * self ) {
7838 0 : ulong size = 0;
7839 0 : size += sizeof(char);
7840 0 : if( NULL != self->unix_timestamp ) {
7841 0 : size += sizeof(long);
7842 0 : }
7843 0 : size += sizeof(char);
7844 0 : if( NULL != self->epoch ) {
7845 0 : size += sizeof(ulong);
7846 0 : }
7847 0 : size += sizeof(char);
7848 0 : if( NULL != self->custodian ) {
7849 0 : size += fd_pubkey_size( self->custodian );
7850 0 : }
7851 0 : return size;
7852 0 : }
7853 :
7854 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize(fd_stake_instruction_t const * self) {
7855 0 : return self->discriminant == 0;
7856 0 : }
7857 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize(fd_stake_instruction_t const * self) {
7858 0 : return self->discriminant == 1;
7859 0 : }
7860 0 : FD_FN_PURE uchar fd_stake_instruction_is_delegate_stake(fd_stake_instruction_t const * self) {
7861 0 : return self->discriminant == 2;
7862 0 : }
7863 0 : FD_FN_PURE uchar fd_stake_instruction_is_split(fd_stake_instruction_t const * self) {
7864 0 : return self->discriminant == 3;
7865 0 : }
7866 0 : FD_FN_PURE uchar fd_stake_instruction_is_withdraw(fd_stake_instruction_t const * self) {
7867 0 : return self->discriminant == 4;
7868 0 : }
7869 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate(fd_stake_instruction_t const * self) {
7870 0 : return self->discriminant == 5;
7871 0 : }
7872 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup(fd_stake_instruction_t const * self) {
7873 0 : return self->discriminant == 6;
7874 0 : }
7875 0 : FD_FN_PURE uchar fd_stake_instruction_is_merge(fd_stake_instruction_t const * self) {
7876 0 : return self->discriminant == 7;
7877 0 : }
7878 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_with_seed(fd_stake_instruction_t const * self) {
7879 0 : return self->discriminant == 8;
7880 0 : }
7881 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize_checked(fd_stake_instruction_t const * self) {
7882 0 : return self->discriminant == 9;
7883 0 : }
7884 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked(fd_stake_instruction_t const * self) {
7885 0 : return self->discriminant == 10;
7886 0 : }
7887 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked_with_seed(fd_stake_instruction_t const * self) {
7888 0 : return self->discriminant == 11;
7889 0 : }
7890 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup_checked(fd_stake_instruction_t const * self) {
7891 0 : return self->discriminant == 12;
7892 0 : }
7893 0 : FD_FN_PURE uchar fd_stake_instruction_is_get_minimum_delegation(fd_stake_instruction_t const * self) {
7894 0 : return self->discriminant == 13;
7895 0 : }
7896 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate_delinquent(fd_stake_instruction_t const * self) {
7897 0 : return self->discriminant == 14;
7898 0 : }
7899 0 : FD_FN_PURE uchar fd_stake_instruction_is_redelegate(fd_stake_instruction_t const * self) {
7900 0 : return self->discriminant == 15;
7901 0 : }
7902 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_stake(fd_stake_instruction_t const * self) {
7903 0 : return self->discriminant == 16;
7904 0 : }
7905 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_lamports(fd_stake_instruction_t const * self) {
7906 0 : return self->discriminant == 17;
7907 0 : }
7908 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant );
7909 0 : int fd_stake_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7910 0 : int err;
7911 0 : switch (discriminant) {
7912 0 : case 0: {
7913 0 : err = fd_stake_instruction_initialize_decode_footprint_inner( ctx, total_sz );
7914 0 : if( FD_UNLIKELY( err ) ) return err;
7915 0 : return FD_BINCODE_SUCCESS;
7916 0 : }
7917 0 : case 1: {
7918 0 : err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
7919 0 : if( FD_UNLIKELY( err ) ) return err;
7920 0 : return FD_BINCODE_SUCCESS;
7921 0 : }
7922 0 : case 2: {
7923 0 : return FD_BINCODE_SUCCESS;
7924 0 : }
7925 0 : case 3: {
7926 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7927 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7928 0 : return FD_BINCODE_SUCCESS;
7929 0 : }
7930 0 : case 4: {
7931 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7932 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7933 0 : return FD_BINCODE_SUCCESS;
7934 0 : }
7935 0 : case 5: {
7936 0 : return FD_BINCODE_SUCCESS;
7937 0 : }
7938 0 : case 6: {
7939 0 : err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
7940 0 : if( FD_UNLIKELY( err ) ) return err;
7941 0 : return FD_BINCODE_SUCCESS;
7942 0 : }
7943 0 : case 7: {
7944 0 : return FD_BINCODE_SUCCESS;
7945 0 : }
7946 0 : case 8: {
7947 0 : err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
7948 0 : if( FD_UNLIKELY( err ) ) return err;
7949 0 : return FD_BINCODE_SUCCESS;
7950 0 : }
7951 0 : case 9: {
7952 0 : return FD_BINCODE_SUCCESS;
7953 0 : }
7954 0 : case 10: {
7955 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
7956 0 : if( FD_UNLIKELY( err ) ) return err;
7957 0 : return FD_BINCODE_SUCCESS;
7958 0 : }
7959 0 : case 11: {
7960 0 : err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
7961 0 : if( FD_UNLIKELY( err ) ) return err;
7962 0 : return FD_BINCODE_SUCCESS;
7963 0 : }
7964 0 : case 12: {
7965 0 : err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
7966 0 : if( FD_UNLIKELY( err ) ) return err;
7967 0 : return FD_BINCODE_SUCCESS;
7968 0 : }
7969 0 : case 13: {
7970 0 : return FD_BINCODE_SUCCESS;
7971 0 : }
7972 0 : case 14: {
7973 0 : return FD_BINCODE_SUCCESS;
7974 0 : }
7975 0 : case 15: {
7976 0 : return FD_BINCODE_SUCCESS;
7977 0 : }
7978 0 : case 16: {
7979 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7980 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7981 0 : return FD_BINCODE_SUCCESS;
7982 0 : }
7983 0 : case 17: {
7984 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7985 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7986 0 : return FD_BINCODE_SUCCESS;
7987 0 : }
7988 0 : default: return FD_BINCODE_ERR_ENCODING;
7989 0 : }
7990 0 : }
7991 0 : static int fd_stake_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7992 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7993 0 : uint discriminant = 0;
7994 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7995 0 : if( FD_UNLIKELY( err ) ) return err;
7996 0 : return fd_stake_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
7997 0 : }
7998 0 : int fd_stake_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7999 0 : *total_sz += sizeof(fd_stake_instruction_t);
8000 0 : void const * start_data = ctx->data;
8001 0 : int err = fd_stake_instruction_decode_footprint_inner( ctx, total_sz );
8002 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8003 0 : ctx->data = start_data;
8004 0 : return err;
8005 0 : }
8006 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 ) {
8007 0 : switch (discriminant) {
8008 0 : case 0: {
8009 0 : fd_stake_instruction_initialize_decode_inner( &self->initialize, alloc_mem, ctx );
8010 0 : break;
8011 0 : }
8012 0 : case 1: {
8013 0 : fd_stake_instruction_authorize_decode_inner( &self->authorize, alloc_mem, ctx );
8014 0 : break;
8015 0 : }
8016 0 : case 2: {
8017 0 : break;
8018 0 : }
8019 0 : case 3: {
8020 0 : fd_bincode_uint64_decode_unsafe( &self->split, ctx );
8021 0 : break;
8022 0 : }
8023 0 : case 4: {
8024 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
8025 0 : break;
8026 0 : }
8027 0 : case 5: {
8028 0 : break;
8029 0 : }
8030 0 : case 6: {
8031 0 : fd_lockup_args_decode_inner( &self->set_lockup, alloc_mem, ctx );
8032 0 : break;
8033 0 : }
8034 0 : case 7: {
8035 0 : break;
8036 0 : }
8037 0 : case 8: {
8038 0 : fd_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
8039 0 : break;
8040 0 : }
8041 0 : case 9: {
8042 0 : break;
8043 0 : }
8044 0 : case 10: {
8045 0 : fd_stake_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
8046 0 : break;
8047 0 : }
8048 0 : case 11: {
8049 0 : fd_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
8050 0 : break;
8051 0 : }
8052 0 : case 12: {
8053 0 : fd_lockup_checked_args_decode_inner( &self->set_lockup_checked, alloc_mem, ctx );
8054 0 : break;
8055 0 : }
8056 0 : case 13: {
8057 0 : break;
8058 0 : }
8059 0 : case 14: {
8060 0 : break;
8061 0 : }
8062 0 : case 15: {
8063 0 : break;
8064 0 : }
8065 0 : case 16: {
8066 0 : fd_bincode_uint64_decode_unsafe( &self->move_stake, ctx );
8067 0 : break;
8068 0 : }
8069 0 : case 17: {
8070 0 : fd_bincode_uint64_decode_unsafe( &self->move_lamports, ctx );
8071 0 : break;
8072 0 : }
8073 0 : }
8074 0 : }
8075 0 : static void fd_stake_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8076 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)struct_mem;
8077 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8078 0 : fd_stake_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8079 0 : }
8080 0 : void * fd_stake_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8081 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)mem;
8082 0 : fd_stake_instruction_new( self );
8083 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_t);
8084 0 : void * * alloc_mem = &alloc_region;
8085 0 : fd_stake_instruction_decode_inner( mem, alloc_mem, ctx );
8086 0 : return self;
8087 0 : }
8088 0 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant ) {
8089 0 : switch( discriminant ) {
8090 0 : case 0: {
8091 0 : fd_stake_instruction_initialize_new( &self->initialize );
8092 0 : break;
8093 0 : }
8094 0 : case 1: {
8095 0 : fd_stake_instruction_authorize_new( &self->authorize );
8096 0 : break;
8097 0 : }
8098 0 : case 2: {
8099 0 : break;
8100 0 : }
8101 0 : case 3: {
8102 0 : break;
8103 0 : }
8104 0 : case 4: {
8105 0 : break;
8106 0 : }
8107 0 : case 5: {
8108 0 : break;
8109 0 : }
8110 0 : case 6: {
8111 0 : fd_lockup_args_new( &self->set_lockup );
8112 0 : break;
8113 0 : }
8114 0 : case 7: {
8115 0 : break;
8116 0 : }
8117 0 : case 8: {
8118 0 : fd_authorize_with_seed_args_new( &self->authorize_with_seed );
8119 0 : break;
8120 0 : }
8121 0 : case 9: {
8122 0 : break;
8123 0 : }
8124 0 : case 10: {
8125 0 : fd_stake_authorize_new( &self->authorize_checked );
8126 0 : break;
8127 0 : }
8128 0 : case 11: {
8129 0 : fd_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
8130 0 : break;
8131 0 : }
8132 0 : case 12: {
8133 0 : fd_lockup_checked_args_new( &self->set_lockup_checked );
8134 0 : break;
8135 0 : }
8136 0 : case 13: {
8137 0 : break;
8138 0 : }
8139 0 : case 14: {
8140 0 : break;
8141 0 : }
8142 0 : case 15: {
8143 0 : break;
8144 0 : }
8145 0 : case 16: {
8146 0 : break;
8147 0 : }
8148 0 : case 17: {
8149 0 : break;
8150 0 : }
8151 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8152 0 : }
8153 0 : }
8154 0 : void fd_stake_instruction_new_disc( fd_stake_instruction_t * self, uint discriminant ) {
8155 0 : self->discriminant = discriminant;
8156 0 : fd_stake_instruction_inner_new( &self->inner, self->discriminant );
8157 0 : }
8158 0 : void fd_stake_instruction_new( fd_stake_instruction_t * self ) {
8159 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_t) );
8160 0 : fd_stake_instruction_new_disc( self, UINT_MAX );
8161 0 : }
8162 :
8163 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 ) {
8164 0 : (void) varint;
8165 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_instruction", level++, 0);
8166 0 : switch( self->discriminant ) {
8167 0 : case 0: {
8168 0 : fun( w, self, "initialize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8169 0 : fd_stake_instruction_initialize_walk( w, &self->inner.initialize, fun, "initialize", level, 0 );
8170 0 : break;
8171 0 : }
8172 0 : case 1: {
8173 0 : fun( w, self, "authorize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8174 0 : fd_stake_instruction_authorize_walk( w, &self->inner.authorize, fun, "authorize", level, 0 );
8175 0 : break;
8176 0 : }
8177 0 : case 2: {
8178 0 : fun( w, self, "delegate_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8179 0 : break;
8180 0 : }
8181 0 : case 3: {
8182 0 : fun( w, self, "split", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8183 0 : fun( w, &self->inner.split, "split", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8184 0 : break;
8185 0 : }
8186 0 : case 4: {
8187 0 : fun( w, self, "withdraw", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8188 0 : fun( w, &self->inner.withdraw, "withdraw", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8189 0 : break;
8190 0 : }
8191 0 : case 5: {
8192 0 : fun( w, self, "deactivate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8193 0 : break;
8194 0 : }
8195 0 : case 6: {
8196 0 : fun( w, self, "set_lockup", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8197 0 : fd_lockup_args_walk( w, &self->inner.set_lockup, fun, "set_lockup", level, 0 );
8198 0 : break;
8199 0 : }
8200 0 : case 7: {
8201 0 : fun( w, self, "merge", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8202 0 : break;
8203 0 : }
8204 0 : case 8: {
8205 0 : fun( w, self, "authorize_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8206 0 : fd_authorize_with_seed_args_walk( w, &self->inner.authorize_with_seed, fun, "authorize_with_seed", level, 0 );
8207 0 : break;
8208 0 : }
8209 0 : case 9: {
8210 0 : fun( w, self, "initialize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8211 0 : break;
8212 0 : }
8213 0 : case 10: {
8214 0 : fun( w, self, "authorize_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8215 0 : fd_stake_authorize_walk( w, &self->inner.authorize_checked, fun, "authorize_checked", level, 0 );
8216 0 : break;
8217 0 : }
8218 0 : case 11: {
8219 0 : fun( w, self, "authorize_checked_with_seed", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8220 0 : fd_authorize_checked_with_seed_args_walk( w, &self->inner.authorize_checked_with_seed, fun, "authorize_checked_with_seed", level, 0 );
8221 0 : break;
8222 0 : }
8223 0 : case 12: {
8224 0 : fun( w, self, "set_lockup_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8225 0 : fd_lockup_checked_args_walk( w, &self->inner.set_lockup_checked, fun, "set_lockup_checked", level, 0 );
8226 0 : break;
8227 0 : }
8228 0 : case 13: {
8229 0 : fun( w, self, "get_minimum_delegation", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8230 0 : break;
8231 0 : }
8232 0 : case 14: {
8233 0 : fun( w, self, "deactivate_delinquent", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8234 0 : break;
8235 0 : }
8236 0 : case 15: {
8237 0 : fun( w, self, "redelegate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8238 0 : break;
8239 0 : }
8240 0 : case 16: {
8241 0 : fun( w, self, "move_stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8242 0 : fun( w, &self->inner.move_stake, "move_stake", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8243 0 : break;
8244 0 : }
8245 0 : case 17: {
8246 0 : fun( w, self, "move_lamports", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8247 0 : fun( w, &self->inner.move_lamports, "move_lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8248 0 : break;
8249 0 : }
8250 0 : }
8251 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_instruction", level--, 0 );
8252 0 : }
8253 0 : ulong fd_stake_instruction_size( fd_stake_instruction_t const * self ) {
8254 0 : ulong size = 0;
8255 0 : size += sizeof(uint);
8256 0 : switch (self->discriminant) {
8257 0 : case 0: {
8258 0 : size += fd_stake_instruction_initialize_size( &self->inner.initialize );
8259 0 : break;
8260 0 : }
8261 0 : case 1: {
8262 0 : size += fd_stake_instruction_authorize_size( &self->inner.authorize );
8263 0 : break;
8264 0 : }
8265 0 : case 3: {
8266 0 : size += sizeof(ulong);
8267 0 : break;
8268 0 : }
8269 0 : case 4: {
8270 0 : size += sizeof(ulong);
8271 0 : break;
8272 0 : }
8273 0 : case 6: {
8274 0 : size += fd_lockup_args_size( &self->inner.set_lockup );
8275 0 : break;
8276 0 : }
8277 0 : case 8: {
8278 0 : size += fd_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
8279 0 : break;
8280 0 : }
8281 0 : case 10: {
8282 0 : size += fd_stake_authorize_size( &self->inner.authorize_checked );
8283 0 : break;
8284 0 : }
8285 0 : case 11: {
8286 0 : size += fd_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
8287 0 : break;
8288 0 : }
8289 0 : case 12: {
8290 0 : size += fd_lockup_checked_args_size( &self->inner.set_lockup_checked );
8291 0 : break;
8292 0 : }
8293 0 : case 16: {
8294 0 : size += sizeof(ulong);
8295 0 : break;
8296 0 : }
8297 0 : case 17: {
8298 0 : size += sizeof(ulong);
8299 0 : break;
8300 0 : }
8301 0 : }
8302 0 : return size;
8303 0 : }
8304 :
8305 0 : int fd_stake_instruction_inner_encode( fd_stake_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
8306 0 : int err;
8307 0 : switch (discriminant) {
8308 0 : case 0: {
8309 0 : err = fd_stake_instruction_initialize_encode( &self->initialize, ctx );
8310 0 : if( FD_UNLIKELY( err ) ) return err;
8311 0 : break;
8312 0 : }
8313 0 : case 1: {
8314 0 : err = fd_stake_instruction_authorize_encode( &self->authorize, ctx );
8315 0 : if( FD_UNLIKELY( err ) ) return err;
8316 0 : break;
8317 0 : }
8318 0 : case 3: {
8319 0 : err = fd_bincode_uint64_encode( self->split, ctx );
8320 0 : if( FD_UNLIKELY( err ) ) return err;
8321 0 : break;
8322 0 : }
8323 0 : case 4: {
8324 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
8325 0 : if( FD_UNLIKELY( err ) ) return err;
8326 0 : break;
8327 0 : }
8328 0 : case 6: {
8329 0 : err = fd_lockup_args_encode( &self->set_lockup, ctx );
8330 0 : if( FD_UNLIKELY( err ) ) return err;
8331 0 : break;
8332 0 : }
8333 0 : case 8: {
8334 0 : err = fd_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
8335 0 : if( FD_UNLIKELY( err ) ) return err;
8336 0 : break;
8337 0 : }
8338 0 : case 10: {
8339 0 : err = fd_stake_authorize_encode( &self->authorize_checked, ctx );
8340 0 : if( FD_UNLIKELY( err ) ) return err;
8341 0 : break;
8342 0 : }
8343 0 : case 11: {
8344 0 : err = fd_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
8345 0 : if( FD_UNLIKELY( err ) ) return err;
8346 0 : break;
8347 0 : }
8348 0 : case 12: {
8349 0 : err = fd_lockup_checked_args_encode( &self->set_lockup_checked, ctx );
8350 0 : if( FD_UNLIKELY( err ) ) return err;
8351 0 : break;
8352 0 : }
8353 0 : case 16: {
8354 0 : err = fd_bincode_uint64_encode( self->move_stake, ctx );
8355 0 : if( FD_UNLIKELY( err ) ) return err;
8356 0 : break;
8357 0 : }
8358 0 : case 17: {
8359 0 : err = fd_bincode_uint64_encode( self->move_lamports, ctx );
8360 0 : if( FD_UNLIKELY( err ) ) return err;
8361 0 : break;
8362 0 : }
8363 0 : }
8364 0 : return FD_BINCODE_SUCCESS;
8365 0 : }
8366 0 : int fd_stake_instruction_encode( fd_stake_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8367 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8368 0 : if( FD_UNLIKELY( err ) ) return err;
8369 0 : return fd_stake_instruction_inner_encode( &self->inner, self->discriminant, ctx );
8370 0 : }
8371 :
8372 12 : int fd_stake_meta_encode( fd_stake_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8373 12 : int err;
8374 12 : err = fd_bincode_uint64_encode( self->rent_exempt_reserve, ctx );
8375 12 : if( FD_UNLIKELY( err ) ) return err;
8376 12 : err = fd_stake_authorized_encode( &self->authorized, ctx );
8377 12 : if( FD_UNLIKELY( err ) ) return err;
8378 12 : err = fd_stake_lockup_encode( &self->lockup, ctx );
8379 12 : if( FD_UNLIKELY( err ) ) return err;
8380 12 : return FD_BINCODE_SUCCESS;
8381 12 : }
8382 0 : static inline int fd_stake_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8383 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8384 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
8385 0 : return 0;
8386 0 : }
8387 0 : static void fd_stake_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8388 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)struct_mem;
8389 0 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
8390 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
8391 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
8392 0 : }
8393 0 : void * fd_stake_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8394 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)mem;
8395 0 : fd_stake_meta_new( self );
8396 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_meta_t);
8397 0 : void * * alloc_mem = &alloc_region;
8398 0 : fd_stake_meta_decode_inner( mem, alloc_mem, ctx );
8399 0 : return self;
8400 0 : }
8401 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 ) {
8402 0 : (void) varint;
8403 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_meta", level++, 0 );
8404 0 : fun( w, &self->rent_exempt_reserve, "rent_exempt_reserve", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
8405 0 : fd_stake_authorized_walk( w, &self->authorized, fun, "authorized", level, 0 );
8406 0 : fd_stake_lockup_walk( w, &self->lockup, fun, "lockup", level, 0 );
8407 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_meta", level--, 0 );
8408 0 : }
8409 12 : int fd_stake_flags_encode( fd_stake_flags_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8410 12 : int err;
8411 12 : err = fd_bincode_uint8_encode( (uchar)(self->bits), ctx );
8412 12 : if( FD_UNLIKELY( err ) ) return err;
8413 12 : return FD_BINCODE_SUCCESS;
8414 12 : }
8415 0 : static inline int fd_stake_flags_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8416 0 : if( (ulong)ctx->data + 1UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8417 0 : ctx->data = (void *)( (ulong)ctx->data + 1UL );
8418 0 : return 0;
8419 0 : }
8420 0 : static void fd_stake_flags_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8421 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)struct_mem;
8422 0 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
8423 0 : }
8424 0 : void * fd_stake_flags_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8425 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)mem;
8426 0 : fd_stake_flags_new( self );
8427 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_flags_t);
8428 0 : void * * alloc_mem = &alloc_region;
8429 0 : fd_stake_flags_decode_inner( mem, alloc_mem, ctx );
8430 0 : return self;
8431 0 : }
8432 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 ) {
8433 0 : (void) varint;
8434 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_flags", level++, 0 );
8435 0 : fun( w, &self->bits, "bits", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
8436 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_flags", level--, 0 );
8437 0 : }
8438 0 : int fd_stake_state_v2_initialized_encode( fd_stake_state_v2_initialized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8439 0 : int err;
8440 0 : err = fd_stake_meta_encode( &self->meta, ctx );
8441 0 : if( FD_UNLIKELY( err ) ) return err;
8442 0 : return FD_BINCODE_SUCCESS;
8443 0 : }
8444 0 : static inline int fd_stake_state_v2_initialized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8445 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8446 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
8447 0 : return 0;
8448 0 : }
8449 0 : static void fd_stake_state_v2_initialized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8450 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)struct_mem;
8451 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
8452 0 : }
8453 0 : void * fd_stake_state_v2_initialized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8454 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)mem;
8455 0 : fd_stake_state_v2_initialized_new( self );
8456 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_initialized_t);
8457 0 : void * * alloc_mem = &alloc_region;
8458 0 : fd_stake_state_v2_initialized_decode_inner( mem, alloc_mem, ctx );
8459 0 : return self;
8460 0 : }
8461 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 ) {
8462 0 : (void) varint;
8463 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_initialized", level++, 0 );
8464 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level, 0 );
8465 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_initialized", level--, 0 );
8466 0 : }
8467 12 : int fd_stake_state_v2_stake_encode( fd_stake_state_v2_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8468 12 : int err;
8469 12 : err = fd_stake_meta_encode( &self->meta, ctx );
8470 12 : if( FD_UNLIKELY( err ) ) return err;
8471 12 : err = fd_stake_encode( &self->stake, ctx );
8472 12 : if( FD_UNLIKELY( err ) ) return err;
8473 12 : err = fd_stake_flags_encode( &self->stake_flags, ctx );
8474 12 : if( FD_UNLIKELY( err ) ) return err;
8475 12 : return FD_BINCODE_SUCCESS;
8476 12 : }
8477 0 : static inline int fd_stake_state_v2_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8478 0 : if( (ulong)ctx->data + 193UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8479 0 : ctx->data = (void *)( (ulong)ctx->data + 193UL );
8480 0 : return 0;
8481 0 : }
8482 0 : static void fd_stake_state_v2_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8483 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)struct_mem;
8484 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
8485 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
8486 0 : fd_stake_flags_decode_inner( &self->stake_flags, alloc_mem, ctx );
8487 0 : }
8488 0 : void * fd_stake_state_v2_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8489 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)mem;
8490 0 : fd_stake_state_v2_stake_new( self );
8491 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_stake_t);
8492 0 : void * * alloc_mem = &alloc_region;
8493 0 : fd_stake_state_v2_stake_decode_inner( mem, alloc_mem, ctx );
8494 0 : return self;
8495 0 : }
8496 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 ) {
8497 0 : (void) varint;
8498 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_stake_state_v2_stake", level++, 0 );
8499 0 : fd_stake_meta_walk( w, &self->meta, fun, "meta", level, 0 );
8500 0 : fd_stake_walk( w, &self->stake, fun, "stake", level, 0 );
8501 0 : fd_stake_flags_walk( w, &self->stake_flags, fun, "stake_flags", level, 0 );
8502 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_stake_state_v2_stake", level--, 0 );
8503 0 : }
8504 0 : FD_FN_PURE uchar fd_stake_state_v2_is_uninitialized(fd_stake_state_v2_t const * self) {
8505 0 : return self->discriminant == 0;
8506 0 : }
8507 0 : FD_FN_PURE uchar fd_stake_state_v2_is_initialized(fd_stake_state_v2_t const * self) {
8508 0 : return self->discriminant == 1;
8509 0 : }
8510 0 : FD_FN_PURE uchar fd_stake_state_v2_is_stake(fd_stake_state_v2_t const * self) {
8511 0 : return self->discriminant == 2;
8512 0 : }
8513 0 : FD_FN_PURE uchar fd_stake_state_v2_is_rewards_pool(fd_stake_state_v2_t const * self) {
8514 0 : return self->discriminant == 3;
8515 0 : }
8516 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant );
8517 0 : int fd_stake_state_v2_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8518 0 : int err;
8519 0 : switch (discriminant) {
8520 0 : case 0: {
8521 0 : return FD_BINCODE_SUCCESS;
8522 0 : }
8523 0 : case 1: {
8524 0 : err = fd_stake_state_v2_initialized_decode_footprint_inner( ctx, total_sz );
8525 0 : if( FD_UNLIKELY( err ) ) return err;
8526 0 : return FD_BINCODE_SUCCESS;
8527 0 : }
8528 0 : case 2: {
8529 0 : err = fd_stake_state_v2_stake_decode_footprint_inner( ctx, total_sz );
8530 0 : if( FD_UNLIKELY( err ) ) return err;
8531 0 : return FD_BINCODE_SUCCESS;
8532 0 : }
8533 0 : case 3: {
8534 0 : return FD_BINCODE_SUCCESS;
8535 0 : }
8536 0 : default: return FD_BINCODE_ERR_ENCODING;
8537 0 : }
8538 0 : }
8539 0 : static int fd_stake_state_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8540 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8541 0 : uint discriminant = 0;
8542 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8543 0 : if( FD_UNLIKELY( err ) ) return err;
8544 0 : return fd_stake_state_v2_inner_decode_footprint( discriminant, ctx, total_sz );
8545 0 : }
8546 0 : int fd_stake_state_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8547 0 : *total_sz += sizeof(fd_stake_state_v2_t);
8548 0 : void const * start_data = ctx->data;
8549 0 : int err = fd_stake_state_v2_decode_footprint_inner( ctx, total_sz );
8550 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8551 0 : ctx->data = start_data;
8552 0 : return err;
8553 0 : }
8554 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 ) {
8555 0 : switch (discriminant) {
8556 0 : case 0: {
8557 0 : break;
8558 0 : }
8559 0 : case 1: {
8560 0 : fd_stake_state_v2_initialized_decode_inner( &self->initialized, alloc_mem, ctx );
8561 0 : break;
8562 0 : }
8563 0 : case 2: {
8564 0 : fd_stake_state_v2_stake_decode_inner( &self->stake, alloc_mem, ctx );
8565 0 : break;
8566 0 : }
8567 0 : case 3: {
8568 0 : break;
8569 0 : }
8570 0 : }
8571 0 : }
8572 0 : static void fd_stake_state_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8573 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)struct_mem;
8574 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8575 0 : fd_stake_state_v2_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8576 0 : }
8577 0 : void * fd_stake_state_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8578 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)mem;
8579 0 : fd_stake_state_v2_new( self );
8580 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_t);
8581 0 : void * * alloc_mem = &alloc_region;
8582 0 : fd_stake_state_v2_decode_inner( mem, alloc_mem, ctx );
8583 0 : return self;
8584 0 : }
8585 12 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant ) {
8586 12 : switch( discriminant ) {
8587 0 : case 0: {
8588 0 : break;
8589 0 : }
8590 0 : case 1: {
8591 0 : fd_stake_state_v2_initialized_new( &self->initialized );
8592 0 : break;
8593 0 : }
8594 12 : case 2: {
8595 12 : fd_stake_state_v2_stake_new( &self->stake );
8596 12 : break;
8597 0 : }
8598 0 : case 3: {
8599 0 : break;
8600 0 : }
8601 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8602 12 : }
8603 12 : }
8604 12 : void fd_stake_state_v2_new_disc( fd_stake_state_v2_t * self, uint discriminant ) {
8605 12 : self->discriminant = discriminant;
8606 12 : fd_stake_state_v2_inner_new( &self->inner, self->discriminant );
8607 12 : }
8608 0 : void fd_stake_state_v2_new( fd_stake_state_v2_t * self ) {
8609 0 : fd_memset( self, 0, sizeof(fd_stake_state_v2_t) );
8610 0 : fd_stake_state_v2_new_disc( self, UINT_MAX );
8611 0 : }
8612 :
8613 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 ) {
8614 0 : (void) varint;
8615 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_stake_state_v2", level++, 0);
8616 0 : switch( self->discriminant ) {
8617 0 : case 0: {
8618 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8619 0 : break;
8620 0 : }
8621 0 : case 1: {
8622 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8623 0 : fd_stake_state_v2_initialized_walk( w, &self->inner.initialized, fun, "initialized", level, 0 );
8624 0 : break;
8625 0 : }
8626 0 : case 2: {
8627 0 : fun( w, self, "stake", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8628 0 : fd_stake_state_v2_stake_walk( w, &self->inner.stake, fun, "stake", level, 0 );
8629 0 : break;
8630 0 : }
8631 0 : case 3: {
8632 0 : fun( w, self, "rewards_pool", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8633 0 : break;
8634 0 : }
8635 0 : }
8636 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_stake_state_v2", level--, 0 );
8637 0 : }
8638 0 : ulong fd_stake_state_v2_size( fd_stake_state_v2_t const * self ) {
8639 0 : ulong size = 0;
8640 0 : size += sizeof(uint);
8641 0 : switch (self->discriminant) {
8642 0 : case 1: {
8643 0 : size += fd_stake_state_v2_initialized_size( &self->inner.initialized );
8644 0 : break;
8645 0 : }
8646 0 : case 2: {
8647 0 : size += fd_stake_state_v2_stake_size( &self->inner.stake );
8648 0 : break;
8649 0 : }
8650 0 : }
8651 0 : return size;
8652 0 : }
8653 :
8654 12 : int fd_stake_state_v2_inner_encode( fd_stake_state_v2_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
8655 12 : int err;
8656 12 : switch (discriminant) {
8657 0 : case 1: {
8658 0 : err = fd_stake_state_v2_initialized_encode( &self->initialized, ctx );
8659 0 : if( FD_UNLIKELY( err ) ) return err;
8660 0 : break;
8661 0 : }
8662 12 : case 2: {
8663 12 : err = fd_stake_state_v2_stake_encode( &self->stake, ctx );
8664 12 : if( FD_UNLIKELY( err ) ) return err;
8665 12 : break;
8666 12 : }
8667 12 : }
8668 12 : return FD_BINCODE_SUCCESS;
8669 12 : }
8670 12 : int fd_stake_state_v2_encode( fd_stake_state_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8671 12 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8672 12 : if( FD_UNLIKELY( err ) ) return err;
8673 12 : return fd_stake_state_v2_inner_encode( &self->inner, self->discriminant, ctx );
8674 12 : }
8675 :
8676 0 : int fd_nonce_data_encode( fd_nonce_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8677 0 : int err;
8678 0 : err = fd_pubkey_encode( &self->authority, ctx );
8679 0 : if( FD_UNLIKELY( err ) ) return err;
8680 0 : err = fd_hash_encode( &self->durable_nonce, ctx );
8681 0 : if( FD_UNLIKELY( err ) ) return err;
8682 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
8683 0 : if( FD_UNLIKELY( err ) ) return err;
8684 0 : return FD_BINCODE_SUCCESS;
8685 0 : }
8686 0 : static inline int fd_nonce_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8687 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8688 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
8689 0 : return 0;
8690 0 : }
8691 0 : static void fd_nonce_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8692 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)struct_mem;
8693 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
8694 0 : fd_hash_decode_inner( &self->durable_nonce, alloc_mem, ctx );
8695 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
8696 0 : }
8697 0 : void * fd_nonce_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8698 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)mem;
8699 0 : fd_nonce_data_new( self );
8700 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_data_t);
8701 0 : void * * alloc_mem = &alloc_region;
8702 0 : fd_nonce_data_decode_inner( mem, alloc_mem, ctx );
8703 0 : return self;
8704 0 : }
8705 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 ) {
8706 0 : (void) varint;
8707 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_nonce_data", level++, 0 );
8708 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level, 0 );
8709 0 : fd_hash_walk( w, &self->durable_nonce, fun, "durable_nonce", level, 0 );
8710 0 : fd_fee_calculator_walk( w, &self->fee_calculator, fun, "fee_calculator", level, 0 );
8711 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_nonce_data", level--, 0 );
8712 0 : }
8713 0 : FD_FN_PURE uchar fd_nonce_state_is_uninitialized(fd_nonce_state_t const * self) {
8714 0 : return self->discriminant == 0;
8715 0 : }
8716 0 : FD_FN_PURE uchar fd_nonce_state_is_initialized(fd_nonce_state_t const * self) {
8717 0 : return self->discriminant == 1;
8718 0 : }
8719 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant );
8720 0 : int fd_nonce_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8721 0 : int err;
8722 0 : switch (discriminant) {
8723 0 : case 0: {
8724 0 : return FD_BINCODE_SUCCESS;
8725 0 : }
8726 0 : case 1: {
8727 0 : err = fd_nonce_data_decode_footprint_inner( ctx, total_sz );
8728 0 : if( FD_UNLIKELY( err ) ) return err;
8729 0 : return FD_BINCODE_SUCCESS;
8730 0 : }
8731 0 : default: return FD_BINCODE_ERR_ENCODING;
8732 0 : }
8733 0 : }
8734 0 : static int fd_nonce_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8735 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8736 0 : uint discriminant = 0;
8737 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8738 0 : if( FD_UNLIKELY( err ) ) return err;
8739 0 : return fd_nonce_state_inner_decode_footprint( discriminant, ctx, total_sz );
8740 0 : }
8741 0 : int fd_nonce_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8742 0 : *total_sz += sizeof(fd_nonce_state_t);
8743 0 : void const * start_data = ctx->data;
8744 0 : int err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
8745 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8746 0 : ctx->data = start_data;
8747 0 : return err;
8748 0 : }
8749 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 ) {
8750 0 : switch (discriminant) {
8751 0 : case 0: {
8752 0 : break;
8753 0 : }
8754 0 : case 1: {
8755 0 : fd_nonce_data_decode_inner( &self->initialized, alloc_mem, ctx );
8756 0 : break;
8757 0 : }
8758 0 : }
8759 0 : }
8760 0 : static void fd_nonce_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8761 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)struct_mem;
8762 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8763 0 : fd_nonce_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8764 0 : }
8765 0 : void * fd_nonce_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8766 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)mem;
8767 0 : fd_nonce_state_new( self );
8768 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_t);
8769 0 : void * * alloc_mem = &alloc_region;
8770 0 : fd_nonce_state_decode_inner( mem, alloc_mem, ctx );
8771 0 : return self;
8772 0 : }
8773 0 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant ) {
8774 0 : switch( discriminant ) {
8775 0 : case 0: {
8776 0 : break;
8777 0 : }
8778 0 : case 1: {
8779 0 : fd_nonce_data_new( &self->initialized );
8780 0 : break;
8781 0 : }
8782 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8783 0 : }
8784 0 : }
8785 0 : void fd_nonce_state_new_disc( fd_nonce_state_t * self, uint discriminant ) {
8786 0 : self->discriminant = discriminant;
8787 0 : fd_nonce_state_inner_new( &self->inner, self->discriminant );
8788 0 : }
8789 0 : void fd_nonce_state_new( fd_nonce_state_t * self ) {
8790 0 : fd_memset( self, 0, sizeof(fd_nonce_state_t) );
8791 0 : fd_nonce_state_new_disc( self, UINT_MAX );
8792 0 : }
8793 :
8794 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 ) {
8795 0 : (void) varint;
8796 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state", level++, 0);
8797 0 : switch( self->discriminant ) {
8798 0 : case 0: {
8799 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8800 0 : break;
8801 0 : }
8802 0 : case 1: {
8803 0 : fun( w, self, "initialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8804 0 : fd_nonce_data_walk( w, &self->inner.initialized, fun, "initialized", level, 0 );
8805 0 : break;
8806 0 : }
8807 0 : }
8808 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state", level--, 0 );
8809 0 : }
8810 0 : ulong fd_nonce_state_size( fd_nonce_state_t const * self ) {
8811 0 : ulong size = 0;
8812 0 : size += sizeof(uint);
8813 0 : switch (self->discriminant) {
8814 0 : case 1: {
8815 0 : size += fd_nonce_data_size( &self->inner.initialized );
8816 0 : break;
8817 0 : }
8818 0 : }
8819 0 : return size;
8820 0 : }
8821 :
8822 0 : int fd_nonce_state_inner_encode( fd_nonce_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
8823 0 : int err;
8824 0 : switch (discriminant) {
8825 0 : case 1: {
8826 0 : err = fd_nonce_data_encode( &self->initialized, ctx );
8827 0 : if( FD_UNLIKELY( err ) ) return err;
8828 0 : break;
8829 0 : }
8830 0 : }
8831 0 : return FD_BINCODE_SUCCESS;
8832 0 : }
8833 0 : int fd_nonce_state_encode( fd_nonce_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8834 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8835 0 : if( FD_UNLIKELY( err ) ) return err;
8836 0 : return fd_nonce_state_inner_encode( &self->inner, self->discriminant, ctx );
8837 0 : }
8838 :
8839 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_legacy(fd_nonce_state_versions_t const * self) {
8840 0 : return self->discriminant == 0;
8841 0 : }
8842 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_current(fd_nonce_state_versions_t const * self) {
8843 0 : return self->discriminant == 1;
8844 0 : }
8845 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant );
8846 0 : int fd_nonce_state_versions_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8847 0 : int err;
8848 0 : switch (discriminant) {
8849 0 : case 0: {
8850 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
8851 0 : if( FD_UNLIKELY( err ) ) return err;
8852 0 : return FD_BINCODE_SUCCESS;
8853 0 : }
8854 0 : case 1: {
8855 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
8856 0 : if( FD_UNLIKELY( err ) ) return err;
8857 0 : return FD_BINCODE_SUCCESS;
8858 0 : }
8859 0 : default: return FD_BINCODE_ERR_ENCODING;
8860 0 : }
8861 0 : }
8862 0 : static int fd_nonce_state_versions_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8863 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8864 0 : uint discriminant = 0;
8865 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8866 0 : if( FD_UNLIKELY( err ) ) return err;
8867 0 : return fd_nonce_state_versions_inner_decode_footprint( discriminant, ctx, total_sz );
8868 0 : }
8869 0 : int fd_nonce_state_versions_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8870 0 : *total_sz += sizeof(fd_nonce_state_versions_t);
8871 0 : void const * start_data = ctx->data;
8872 0 : int err = fd_nonce_state_versions_decode_footprint_inner( ctx, total_sz );
8873 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8874 0 : ctx->data = start_data;
8875 0 : return err;
8876 0 : }
8877 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 ) {
8878 0 : switch (discriminant) {
8879 0 : case 0: {
8880 0 : fd_nonce_state_decode_inner( &self->legacy, alloc_mem, ctx );
8881 0 : break;
8882 0 : }
8883 0 : case 1: {
8884 0 : fd_nonce_state_decode_inner( &self->current, alloc_mem, ctx );
8885 0 : break;
8886 0 : }
8887 0 : }
8888 0 : }
8889 0 : static void fd_nonce_state_versions_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8890 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)struct_mem;
8891 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8892 0 : fd_nonce_state_versions_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8893 0 : }
8894 0 : void * fd_nonce_state_versions_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8895 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)mem;
8896 0 : fd_nonce_state_versions_new( self );
8897 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_versions_t);
8898 0 : void * * alloc_mem = &alloc_region;
8899 0 : fd_nonce_state_versions_decode_inner( mem, alloc_mem, ctx );
8900 0 : return self;
8901 0 : }
8902 0 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
8903 0 : switch( discriminant ) {
8904 0 : case 0: {
8905 0 : fd_nonce_state_new( &self->legacy );
8906 0 : break;
8907 0 : }
8908 0 : case 1: {
8909 0 : fd_nonce_state_new( &self->current );
8910 0 : break;
8911 0 : }
8912 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8913 0 : }
8914 0 : }
8915 0 : void fd_nonce_state_versions_new_disc( fd_nonce_state_versions_t * self, uint discriminant ) {
8916 0 : self->discriminant = discriminant;
8917 0 : fd_nonce_state_versions_inner_new( &self->inner, self->discriminant );
8918 0 : }
8919 0 : void fd_nonce_state_versions_new( fd_nonce_state_versions_t * self ) {
8920 0 : fd_memset( self, 0, sizeof(fd_nonce_state_versions_t) );
8921 0 : fd_nonce_state_versions_new_disc( self, UINT_MAX );
8922 0 : }
8923 :
8924 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 ) {
8925 0 : (void) varint;
8926 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_nonce_state_versions", level++, 0);
8927 0 : switch( self->discriminant ) {
8928 0 : case 0: {
8929 0 : fun( w, self, "legacy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8930 0 : fd_nonce_state_walk( w, &self->inner.legacy, fun, "legacy", level, 0 );
8931 0 : break;
8932 0 : }
8933 0 : case 1: {
8934 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
8935 0 : fd_nonce_state_walk( w, &self->inner.current, fun, "current", level, 0 );
8936 0 : break;
8937 0 : }
8938 0 : }
8939 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_nonce_state_versions", level--, 0 );
8940 0 : }
8941 0 : ulong fd_nonce_state_versions_size( fd_nonce_state_versions_t const * self ) {
8942 0 : ulong size = 0;
8943 0 : size += sizeof(uint);
8944 0 : switch (self->discriminant) {
8945 0 : case 0: {
8946 0 : size += fd_nonce_state_size( &self->inner.legacy );
8947 0 : break;
8948 0 : }
8949 0 : case 1: {
8950 0 : size += fd_nonce_state_size( &self->inner.current );
8951 0 : break;
8952 0 : }
8953 0 : }
8954 0 : return size;
8955 0 : }
8956 :
8957 0 : int fd_nonce_state_versions_inner_encode( fd_nonce_state_versions_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
8958 0 : int err;
8959 0 : switch (discriminant) {
8960 0 : case 0: {
8961 0 : err = fd_nonce_state_encode( &self->legacy, ctx );
8962 0 : if( FD_UNLIKELY( err ) ) return err;
8963 0 : break;
8964 0 : }
8965 0 : case 1: {
8966 0 : err = fd_nonce_state_encode( &self->current, ctx );
8967 0 : if( FD_UNLIKELY( err ) ) return err;
8968 0 : break;
8969 0 : }
8970 0 : }
8971 0 : return FD_BINCODE_SUCCESS;
8972 0 : }
8973 0 : int fd_nonce_state_versions_encode( fd_nonce_state_versions_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8974 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8975 0 : if( FD_UNLIKELY( err ) ) return err;
8976 0 : return fd_nonce_state_versions_inner_encode( &self->inner, self->discriminant, ctx );
8977 0 : }
8978 :
8979 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 ) {
8980 0 : int err;
8981 0 : err = fd_bincode_uint32_encode( self->units, ctx );
8982 0 : if( FD_UNLIKELY( err ) ) return err;
8983 0 : err = fd_bincode_uint32_encode( self->additional_fee, ctx );
8984 0 : if( FD_UNLIKELY( err ) ) return err;
8985 0 : return FD_BINCODE_SUCCESS;
8986 0 : }
8987 0 : static inline int fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8988 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8989 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
8990 0 : return 0;
8991 0 : }
8992 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 ) {
8993 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)struct_mem;
8994 0 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
8995 0 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
8996 0 : }
8997 0 : void * fd_compute_budget_program_instruction_request_units_deprecated_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8998 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)mem;
8999 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( self );
9000 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t);
9001 0 : void * * alloc_mem = &alloc_region;
9002 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( mem, alloc_mem, ctx );
9003 0 : return self;
9004 0 : }
9005 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 ) {
9006 0 : (void) varint;
9007 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_compute_budget_program_instruction_request_units_deprecated", level++, 0 );
9008 0 : fun( w, &self->units, "units", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9009 0 : fun( w, &self->additional_fee, "additional_fee", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9010 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_compute_budget_program_instruction_request_units_deprecated", level--, 0 );
9011 0 : }
9012 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_units_deprecated(fd_compute_budget_program_instruction_t const * self) {
9013 0 : return self->discriminant == 0;
9014 0 : }
9015 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_heap_frame(fd_compute_budget_program_instruction_t const * self) {
9016 0 : return self->discriminant == 1;
9017 0 : }
9018 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_limit(fd_compute_budget_program_instruction_t const * self) {
9019 0 : return self->discriminant == 2;
9020 0 : }
9021 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_price(fd_compute_budget_program_instruction_t const * self) {
9022 0 : return self->discriminant == 3;
9023 0 : }
9024 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) {
9025 0 : return self->discriminant == 4;
9026 0 : }
9027 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant );
9028 0 : int fd_compute_budget_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9029 0 : int err;
9030 0 : switch (discriminant) {
9031 0 : case 0: {
9032 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( ctx, total_sz );
9033 0 : if( FD_UNLIKELY( err ) ) return err;
9034 0 : return FD_BINCODE_SUCCESS;
9035 0 : }
9036 0 : case 1: {
9037 0 : err = fd_bincode_uint32_decode_footprint( ctx );
9038 0 : if( FD_UNLIKELY( err ) ) return err;
9039 0 : return FD_BINCODE_SUCCESS;
9040 0 : }
9041 0 : case 2: {
9042 0 : err = fd_bincode_uint32_decode_footprint( ctx );
9043 0 : if( FD_UNLIKELY( err ) ) return err;
9044 0 : return FD_BINCODE_SUCCESS;
9045 0 : }
9046 0 : case 3: {
9047 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9048 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9049 0 : return FD_BINCODE_SUCCESS;
9050 0 : }
9051 0 : case 4: {
9052 0 : err = fd_bincode_uint32_decode_footprint( ctx );
9053 0 : if( FD_UNLIKELY( err ) ) return err;
9054 0 : return FD_BINCODE_SUCCESS;
9055 0 : }
9056 0 : default: return FD_BINCODE_ERR_ENCODING;
9057 0 : }
9058 0 : }
9059 0 : static int fd_compute_budget_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9060 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9061 0 : ushort discriminant = 0;
9062 0 : int err = fd_bincode_compact_u16_decode( &discriminant, ctx );
9063 0 : if( FD_UNLIKELY( err ) ) return err;
9064 0 : return fd_compute_budget_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
9065 0 : }
9066 0 : int fd_compute_budget_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9067 0 : *total_sz += sizeof(fd_compute_budget_program_instruction_t);
9068 0 : void const * start_data = ctx->data;
9069 0 : int err = fd_compute_budget_program_instruction_decode_footprint_inner( ctx, total_sz );
9070 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9071 0 : ctx->data = start_data;
9072 0 : return err;
9073 0 : }
9074 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 ) {
9075 0 : switch (discriminant) {
9076 0 : case 0: {
9077 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( &self->request_units_deprecated, alloc_mem, ctx );
9078 0 : break;
9079 0 : }
9080 0 : case 1: {
9081 0 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
9082 0 : break;
9083 0 : }
9084 0 : case 2: {
9085 0 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
9086 0 : break;
9087 0 : }
9088 0 : case 3: {
9089 0 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
9090 0 : break;
9091 0 : }
9092 0 : case 4: {
9093 0 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
9094 0 : break;
9095 0 : }
9096 0 : }
9097 0 : }
9098 0 : static void fd_compute_budget_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9099 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)struct_mem;
9100 0 : ushort tmp = 0;
9101 0 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
9102 0 : self->discriminant = tmp;
9103 0 : fd_compute_budget_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9104 0 : }
9105 0 : void * fd_compute_budget_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9106 0 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)mem;
9107 0 : fd_compute_budget_program_instruction_new( self );
9108 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_t);
9109 0 : void * * alloc_mem = &alloc_region;
9110 0 : fd_compute_budget_program_instruction_decode_inner( mem, alloc_mem, ctx );
9111 0 : return self;
9112 0 : }
9113 0 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
9114 0 : switch( discriminant ) {
9115 0 : case 0: {
9116 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( &self->request_units_deprecated );
9117 0 : break;
9118 0 : }
9119 0 : case 1: {
9120 0 : break;
9121 0 : }
9122 0 : case 2: {
9123 0 : break;
9124 0 : }
9125 0 : case 3: {
9126 0 : break;
9127 0 : }
9128 0 : case 4: {
9129 0 : break;
9130 0 : }
9131 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9132 0 : }
9133 0 : }
9134 0 : void fd_compute_budget_program_instruction_new_disc( fd_compute_budget_program_instruction_t * self, uint discriminant ) {
9135 0 : self->discriminant = discriminant;
9136 0 : fd_compute_budget_program_instruction_inner_new( &self->inner, self->discriminant );
9137 0 : }
9138 0 : void fd_compute_budget_program_instruction_new( fd_compute_budget_program_instruction_t * self ) {
9139 0 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_t) );
9140 0 : fd_compute_budget_program_instruction_new_disc( self, UINT_MAX );
9141 0 : }
9142 :
9143 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 ) {
9144 0 : (void) varint;
9145 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_compute_budget_program_instruction", level++, 0);
9146 0 : switch( self->discriminant ) {
9147 0 : case 0: {
9148 0 : fun( w, self, "request_units_deprecated", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9149 0 : fd_compute_budget_program_instruction_request_units_deprecated_walk( w, &self->inner.request_units_deprecated, fun, "request_units_deprecated", level, 0 );
9150 0 : break;
9151 0 : }
9152 0 : case 1: {
9153 0 : fun( w, self, "request_heap_frame", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9154 0 : fun( w, &self->inner.request_heap_frame, "request_heap_frame", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9155 0 : break;
9156 0 : }
9157 0 : case 2: {
9158 0 : fun( w, self, "set_compute_unit_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9159 0 : fun( w, &self->inner.set_compute_unit_limit, "set_compute_unit_limit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9160 0 : break;
9161 0 : }
9162 0 : case 3: {
9163 0 : fun( w, self, "set_compute_unit_price", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9164 0 : fun( w, &self->inner.set_compute_unit_price, "set_compute_unit_price", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
9165 0 : break;
9166 0 : }
9167 0 : case 4: {
9168 0 : fun( w, self, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9169 0 : fun( w, &self->inner.set_loaded_accounts_data_size_limit, "set_loaded_accounts_data_size_limit", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9170 0 : break;
9171 0 : }
9172 0 : }
9173 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_compute_budget_program_instruction", level--, 0 );
9174 0 : }
9175 0 : ulong fd_compute_budget_program_instruction_size( fd_compute_budget_program_instruction_t const * self ) {
9176 0 : ulong size = 0;
9177 0 : size += sizeof(uint);
9178 0 : switch (self->discriminant) {
9179 0 : case 0: {
9180 0 : size += fd_compute_budget_program_instruction_request_units_deprecated_size( &self->inner.request_units_deprecated );
9181 0 : break;
9182 0 : }
9183 0 : case 1: {
9184 0 : size += sizeof(uint);
9185 0 : break;
9186 0 : }
9187 0 : case 2: {
9188 0 : size += sizeof(uint);
9189 0 : break;
9190 0 : }
9191 0 : case 3: {
9192 0 : size += sizeof(ulong);
9193 0 : break;
9194 0 : }
9195 0 : case 4: {
9196 0 : size += sizeof(uint);
9197 0 : break;
9198 0 : }
9199 0 : }
9200 0 : return size;
9201 0 : }
9202 :
9203 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 ) {
9204 0 : int err;
9205 0 : switch (discriminant) {
9206 0 : case 0: {
9207 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_encode( &self->request_units_deprecated, ctx );
9208 0 : if( FD_UNLIKELY( err ) ) return err;
9209 0 : break;
9210 0 : }
9211 0 : case 1: {
9212 0 : err = fd_bincode_uint32_encode( self->request_heap_frame, ctx );
9213 0 : if( FD_UNLIKELY( err ) ) return err;
9214 0 : break;
9215 0 : }
9216 0 : case 2: {
9217 0 : err = fd_bincode_uint32_encode( self->set_compute_unit_limit, ctx );
9218 0 : if( FD_UNLIKELY( err ) ) return err;
9219 0 : break;
9220 0 : }
9221 0 : case 3: {
9222 0 : err = fd_bincode_uint64_encode( self->set_compute_unit_price, ctx );
9223 0 : if( FD_UNLIKELY( err ) ) return err;
9224 0 : break;
9225 0 : }
9226 0 : case 4: {
9227 0 : err = fd_bincode_uint32_encode( self->set_loaded_accounts_data_size_limit, ctx );
9228 0 : if( FD_UNLIKELY( err ) ) return err;
9229 0 : break;
9230 0 : }
9231 0 : }
9232 0 : return FD_BINCODE_SUCCESS;
9233 0 : }
9234 0 : int fd_compute_budget_program_instruction_encode( fd_compute_budget_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9235 0 : ushort discriminant = (ushort) self->discriminant;
9236 0 : int err = fd_bincode_compact_u16_encode( &discriminant, ctx );
9237 0 : if( FD_UNLIKELY( err ) ) return err;
9238 0 : return fd_compute_budget_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
9239 0 : }
9240 :
9241 0 : int fd_config_keys_encode( fd_config_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9242 0 : int err;
9243 0 : err = fd_bincode_compact_u16_encode( &self->keys_len, ctx );
9244 0 : if( FD_UNLIKELY(err) ) return err;
9245 0 : if( self->keys_len ) {
9246 0 : for( ulong i=0; i < self->keys_len; i++ ) {
9247 0 : err = fd_config_keys_pair_encode( self->keys + i, ctx );
9248 0 : if( FD_UNLIKELY( err ) ) return err;
9249 0 : }
9250 0 : }
9251 0 : return FD_BINCODE_SUCCESS;
9252 0 : }
9253 0 : static int fd_config_keys_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9254 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9255 0 : int err = 0;
9256 0 : ushort keys_len;
9257 0 : err = fd_bincode_compact_u16_decode( &keys_len, ctx );
9258 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9259 0 : if( keys_len ) {
9260 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*keys_len;
9261 0 : for( ulong i=0; i < keys_len; i++ ) {
9262 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
9263 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9264 0 : }
9265 0 : }
9266 0 : return 0;
9267 0 : }
9268 0 : int fd_config_keys_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9269 0 : *total_sz += sizeof(fd_config_keys_t);
9270 0 : void const * start_data = ctx->data;
9271 0 : int err = fd_config_keys_decode_footprint_inner( ctx, total_sz );
9272 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9273 0 : ctx->data = start_data;
9274 0 : return err;
9275 0 : }
9276 0 : static void fd_config_keys_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9277 0 : fd_config_keys_t * self = (fd_config_keys_t *)struct_mem;
9278 0 : fd_bincode_compact_u16_decode_unsafe( &self->keys_len, ctx );
9279 0 : if( self->keys_len ) {
9280 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
9281 0 : self->keys = *alloc_mem;
9282 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->keys_len;
9283 0 : for( ulong i=0; i < self->keys_len; i++ ) {
9284 0 : fd_config_keys_pair_new( self->keys + i );
9285 0 : fd_config_keys_pair_decode_inner( self->keys + i, alloc_mem, ctx );
9286 0 : }
9287 0 : } else
9288 0 : self->keys = NULL;
9289 0 : }
9290 0 : void * fd_config_keys_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9291 0 : fd_config_keys_t * self = (fd_config_keys_t *)mem;
9292 0 : fd_config_keys_new( self );
9293 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_t);
9294 0 : void * * alloc_mem = &alloc_region;
9295 0 : fd_config_keys_decode_inner( mem, alloc_mem, ctx );
9296 0 : return self;
9297 0 : }
9298 0 : void fd_config_keys_new(fd_config_keys_t * self) {
9299 0 : fd_memset( self, 0, sizeof(fd_config_keys_t) );
9300 0 : }
9301 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 ) {
9302 0 : (void) varint;
9303 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_config_keys", level++, 0 );
9304 0 : fun( w, &self->keys_len, "keys_len", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 1 );
9305 0 : if( self->keys_len ) {
9306 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9307 0 : for( ulong i=0; i < self->keys_len; i++ )
9308 0 : fd_config_keys_pair_walk(w, self->keys + i, fun, "config_keys_pair", level, 0 );
9309 0 : fun( w, NULL, "keys", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9310 0 : }
9311 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_config_keys", level--, 0 );
9312 0 : }
9313 0 : ulong fd_config_keys_size( fd_config_keys_t const * self ) {
9314 0 : ulong size = 0;
9315 0 : do {
9316 0 : ushort tmp = (ushort)self->keys_len;
9317 0 : size += fd_bincode_compact_u16_size( &tmp );
9318 0 : for( ulong i=0; i < self->keys_len; i++ )
9319 0 : size += fd_config_keys_pair_size( self->keys + i );
9320 0 : } while(0);
9321 0 : return size;
9322 0 : }
9323 :
9324 0 : int fd_bpf_loader_program_instruction_write_encode( fd_bpf_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9325 0 : int err;
9326 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
9327 0 : if( FD_UNLIKELY( err ) ) return err;
9328 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
9329 0 : if( FD_UNLIKELY(err) ) return err;
9330 0 : if( self->bytes_len ) {
9331 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
9332 0 : if( FD_UNLIKELY( err ) ) return err;
9333 0 : }
9334 0 : return FD_BINCODE_SUCCESS;
9335 0 : }
9336 0 : static int fd_bpf_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9337 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9338 0 : int err = 0;
9339 0 : err = fd_bincode_uint32_decode_footprint( ctx );
9340 0 : if( FD_UNLIKELY( err ) ) return err;
9341 0 : ulong bytes_len;
9342 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
9343 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9344 0 : if( bytes_len ) {
9345 0 : *total_sz += 8UL + bytes_len;
9346 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
9347 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9348 0 : }
9349 0 : return 0;
9350 0 : }
9351 0 : int fd_bpf_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9352 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_write_t);
9353 0 : void const * start_data = ctx->data;
9354 0 : int err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
9355 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9356 0 : ctx->data = start_data;
9357 0 : return err;
9358 0 : }
9359 0 : static void fd_bpf_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9360 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)struct_mem;
9361 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
9362 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
9363 0 : if( self->bytes_len ) {
9364 0 : self->bytes = *alloc_mem;
9365 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
9366 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
9367 0 : } else
9368 0 : self->bytes = NULL;
9369 0 : }
9370 0 : void * fd_bpf_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9371 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)mem;
9372 0 : fd_bpf_loader_program_instruction_write_new( self );
9373 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_write_t);
9374 0 : void * * alloc_mem = &alloc_region;
9375 0 : fd_bpf_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
9376 0 : return self;
9377 0 : }
9378 0 : void fd_bpf_loader_program_instruction_write_new(fd_bpf_loader_program_instruction_write_t * self) {
9379 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_write_t) );
9380 0 : }
9381 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 ) {
9382 0 : (void) varint;
9383 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_loader_program_instruction_write", level++, 0 );
9384 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9385 0 : if( self->bytes_len ) {
9386 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9387 0 : for( ulong i=0; i < self->bytes_len; i++ )
9388 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9389 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9390 0 : }
9391 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_loader_program_instruction_write", level--, 0 );
9392 0 : }
9393 0 : ulong fd_bpf_loader_program_instruction_write_size( fd_bpf_loader_program_instruction_write_t const * self ) {
9394 0 : ulong size = 0;
9395 0 : size += sizeof(uint);
9396 0 : do {
9397 0 : size += sizeof(ulong);
9398 0 : size += self->bytes_len;
9399 0 : } while(0);
9400 0 : return size;
9401 0 : }
9402 :
9403 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_write(fd_bpf_loader_program_instruction_t const * self) {
9404 0 : return self->discriminant == 0;
9405 0 : }
9406 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_finalize(fd_bpf_loader_program_instruction_t const * self) {
9407 0 : return self->discriminant == 1;
9408 0 : }
9409 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant );
9410 0 : int fd_bpf_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9411 0 : int err;
9412 0 : switch (discriminant) {
9413 0 : case 0: {
9414 0 : err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
9415 0 : if( FD_UNLIKELY( err ) ) return err;
9416 0 : return FD_BINCODE_SUCCESS;
9417 0 : }
9418 0 : case 1: {
9419 0 : return FD_BINCODE_SUCCESS;
9420 0 : }
9421 0 : default: return FD_BINCODE_ERR_ENCODING;
9422 0 : }
9423 0 : }
9424 0 : static int fd_bpf_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9425 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9426 0 : uint discriminant = 0;
9427 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9428 0 : if( FD_UNLIKELY( err ) ) return err;
9429 0 : return fd_bpf_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
9430 0 : }
9431 0 : int fd_bpf_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9432 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_t);
9433 0 : void const * start_data = ctx->data;
9434 0 : int err = fd_bpf_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
9435 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9436 0 : ctx->data = start_data;
9437 0 : return err;
9438 0 : }
9439 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 ) {
9440 0 : switch (discriminant) {
9441 0 : case 0: {
9442 0 : fd_bpf_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
9443 0 : break;
9444 0 : }
9445 0 : case 1: {
9446 0 : break;
9447 0 : }
9448 0 : }
9449 0 : }
9450 0 : static void fd_bpf_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9451 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)struct_mem;
9452 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9453 0 : fd_bpf_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9454 0 : }
9455 0 : void * fd_bpf_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9456 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)mem;
9457 0 : fd_bpf_loader_program_instruction_new( self );
9458 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_t);
9459 0 : void * * alloc_mem = &alloc_region;
9460 0 : fd_bpf_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
9461 0 : return self;
9462 0 : }
9463 0 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
9464 0 : switch( discriminant ) {
9465 0 : case 0: {
9466 0 : fd_bpf_loader_program_instruction_write_new( &self->write );
9467 0 : break;
9468 0 : }
9469 0 : case 1: {
9470 0 : break;
9471 0 : }
9472 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9473 0 : }
9474 0 : }
9475 0 : void fd_bpf_loader_program_instruction_new_disc( fd_bpf_loader_program_instruction_t * self, uint discriminant ) {
9476 0 : self->discriminant = discriminant;
9477 0 : fd_bpf_loader_program_instruction_inner_new( &self->inner, self->discriminant );
9478 0 : }
9479 0 : void fd_bpf_loader_program_instruction_new( fd_bpf_loader_program_instruction_t * self ) {
9480 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_t) );
9481 0 : fd_bpf_loader_program_instruction_new_disc( self, UINT_MAX );
9482 0 : }
9483 :
9484 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 ) {
9485 0 : (void) varint;
9486 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_loader_program_instruction", level++, 0);
9487 0 : switch( self->discriminant ) {
9488 0 : case 0: {
9489 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9490 0 : fd_bpf_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
9491 0 : break;
9492 0 : }
9493 0 : case 1: {
9494 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9495 0 : break;
9496 0 : }
9497 0 : }
9498 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_loader_program_instruction", level--, 0 );
9499 0 : }
9500 0 : ulong fd_bpf_loader_program_instruction_size( fd_bpf_loader_program_instruction_t const * self ) {
9501 0 : ulong size = 0;
9502 0 : size += sizeof(uint);
9503 0 : switch (self->discriminant) {
9504 0 : case 0: {
9505 0 : size += fd_bpf_loader_program_instruction_write_size( &self->inner.write );
9506 0 : break;
9507 0 : }
9508 0 : }
9509 0 : return size;
9510 0 : }
9511 :
9512 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 ) {
9513 0 : int err;
9514 0 : switch (discriminant) {
9515 0 : case 0: {
9516 0 : err = fd_bpf_loader_program_instruction_write_encode( &self->write, ctx );
9517 0 : if( FD_UNLIKELY( err ) ) return err;
9518 0 : break;
9519 0 : }
9520 0 : }
9521 0 : return FD_BINCODE_SUCCESS;
9522 0 : }
9523 0 : int fd_bpf_loader_program_instruction_encode( fd_bpf_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9524 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9525 0 : if( FD_UNLIKELY( err ) ) return err;
9526 0 : return fd_bpf_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
9527 0 : }
9528 :
9529 0 : int fd_loader_v4_program_instruction_write_encode( fd_loader_v4_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9530 0 : int err;
9531 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
9532 0 : if( FD_UNLIKELY( err ) ) return err;
9533 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
9534 0 : if( FD_UNLIKELY(err) ) return err;
9535 0 : if( self->bytes_len ) {
9536 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
9537 0 : if( FD_UNLIKELY( err ) ) return err;
9538 0 : }
9539 0 : return FD_BINCODE_SUCCESS;
9540 0 : }
9541 0 : static int fd_loader_v4_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9542 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9543 0 : int err = 0;
9544 0 : err = fd_bincode_uint32_decode_footprint( ctx );
9545 0 : if( FD_UNLIKELY( err ) ) return err;
9546 0 : ulong bytes_len;
9547 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
9548 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9549 0 : if( bytes_len ) {
9550 0 : *total_sz += 8UL + bytes_len;
9551 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
9552 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9553 0 : }
9554 0 : return 0;
9555 0 : }
9556 0 : int fd_loader_v4_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9557 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_write_t);
9558 0 : void const * start_data = ctx->data;
9559 0 : int err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
9560 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9561 0 : ctx->data = start_data;
9562 0 : return err;
9563 0 : }
9564 0 : static void fd_loader_v4_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9565 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)struct_mem;
9566 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
9567 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
9568 0 : if( self->bytes_len ) {
9569 0 : self->bytes = *alloc_mem;
9570 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
9571 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
9572 0 : } else
9573 0 : self->bytes = NULL;
9574 0 : }
9575 0 : void * fd_loader_v4_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9576 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)mem;
9577 0 : fd_loader_v4_program_instruction_write_new( self );
9578 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_write_t);
9579 0 : void * * alloc_mem = &alloc_region;
9580 0 : fd_loader_v4_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
9581 0 : return self;
9582 0 : }
9583 0 : void fd_loader_v4_program_instruction_write_new(fd_loader_v4_program_instruction_write_t * self) {
9584 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_write_t) );
9585 0 : }
9586 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 ) {
9587 0 : (void) varint;
9588 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_write", level++, 0 );
9589 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9590 0 : if( self->bytes_len ) {
9591 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9592 0 : for( ulong i=0; i < self->bytes_len; i++ )
9593 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9594 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9595 0 : }
9596 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_write", level--, 0 );
9597 0 : }
9598 0 : ulong fd_loader_v4_program_instruction_write_size( fd_loader_v4_program_instruction_write_t const * self ) {
9599 0 : ulong size = 0;
9600 0 : size += sizeof(uint);
9601 0 : do {
9602 0 : size += sizeof(ulong);
9603 0 : size += self->bytes_len;
9604 0 : } while(0);
9605 0 : return size;
9606 0 : }
9607 :
9608 0 : int fd_loader_v4_program_instruction_copy_encode( fd_loader_v4_program_instruction_copy_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9609 0 : int err;
9610 0 : err = fd_bincode_uint32_encode( self->destination_offset, ctx );
9611 0 : if( FD_UNLIKELY( err ) ) return err;
9612 0 : err = fd_bincode_uint32_encode( self->source_offset, ctx );
9613 0 : if( FD_UNLIKELY( err ) ) return err;
9614 0 : err = fd_bincode_uint32_encode( self->length, ctx );
9615 0 : if( FD_UNLIKELY( err ) ) return err;
9616 0 : return FD_BINCODE_SUCCESS;
9617 0 : }
9618 0 : static inline int fd_loader_v4_program_instruction_copy_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9619 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9620 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
9621 0 : return 0;
9622 0 : }
9623 0 : static void fd_loader_v4_program_instruction_copy_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9624 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)struct_mem;
9625 0 : fd_bincode_uint32_decode_unsafe( &self->destination_offset, ctx );
9626 0 : fd_bincode_uint32_decode_unsafe( &self->source_offset, ctx );
9627 0 : fd_bincode_uint32_decode_unsafe( &self->length, ctx );
9628 0 : }
9629 0 : void * fd_loader_v4_program_instruction_copy_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9630 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)mem;
9631 0 : fd_loader_v4_program_instruction_copy_new( self );
9632 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_copy_t);
9633 0 : void * * alloc_mem = &alloc_region;
9634 0 : fd_loader_v4_program_instruction_copy_decode_inner( mem, alloc_mem, ctx );
9635 0 : return self;
9636 0 : }
9637 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 ) {
9638 0 : (void) varint;
9639 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_copy", level++, 0 );
9640 0 : fun( w, &self->destination_offset, "destination_offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9641 0 : fun( w, &self->source_offset, "source_offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9642 0 : fun( w, &self->length, "length", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9643 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_copy", level--, 0 );
9644 0 : }
9645 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 ) {
9646 0 : int err;
9647 0 : err = fd_bincode_uint32_encode( self->new_size, ctx );
9648 0 : if( FD_UNLIKELY( err ) ) return err;
9649 0 : return FD_BINCODE_SUCCESS;
9650 0 : }
9651 0 : static inline int fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9652 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9653 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
9654 0 : return 0;
9655 0 : }
9656 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 ) {
9657 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)struct_mem;
9658 0 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
9659 0 : }
9660 0 : void * fd_loader_v4_program_instruction_set_program_length_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9661 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)mem;
9662 0 : fd_loader_v4_program_instruction_set_program_length_new( self );
9663 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_set_program_length_t);
9664 0 : void * * alloc_mem = &alloc_region;
9665 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( mem, alloc_mem, ctx );
9666 0 : return self;
9667 0 : }
9668 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 ) {
9669 0 : (void) varint;
9670 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_program_instruction_set_program_length", level++, 0 );
9671 0 : fun( w, &self->new_size, "new_size", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9672 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_program_instruction_set_program_length", level--, 0 );
9673 0 : }
9674 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_write(fd_loader_v4_program_instruction_t const * self) {
9675 0 : return self->discriminant == 0;
9676 0 : }
9677 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_copy(fd_loader_v4_program_instruction_t const * self) {
9678 0 : return self->discriminant == 1;
9679 0 : }
9680 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_set_program_length(fd_loader_v4_program_instruction_t const * self) {
9681 0 : return self->discriminant == 2;
9682 0 : }
9683 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_deploy(fd_loader_v4_program_instruction_t const * self) {
9684 0 : return self->discriminant == 3;
9685 0 : }
9686 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_retract(fd_loader_v4_program_instruction_t const * self) {
9687 0 : return self->discriminant == 4;
9688 0 : }
9689 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_transfer_authority(fd_loader_v4_program_instruction_t const * self) {
9690 0 : return self->discriminant == 5;
9691 0 : }
9692 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_finalize(fd_loader_v4_program_instruction_t const * self) {
9693 0 : return self->discriminant == 6;
9694 0 : }
9695 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant );
9696 0 : int fd_loader_v4_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9697 0 : int err;
9698 0 : switch (discriminant) {
9699 0 : case 0: {
9700 0 : err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
9701 0 : if( FD_UNLIKELY( err ) ) return err;
9702 0 : return FD_BINCODE_SUCCESS;
9703 0 : }
9704 0 : case 1: {
9705 0 : err = fd_loader_v4_program_instruction_copy_decode_footprint_inner( ctx, total_sz );
9706 0 : if( FD_UNLIKELY( err ) ) return err;
9707 0 : return FD_BINCODE_SUCCESS;
9708 0 : }
9709 0 : case 2: {
9710 0 : err = fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( ctx, total_sz );
9711 0 : if( FD_UNLIKELY( err ) ) return err;
9712 0 : return FD_BINCODE_SUCCESS;
9713 0 : }
9714 0 : case 3: {
9715 0 : return FD_BINCODE_SUCCESS;
9716 0 : }
9717 0 : case 4: {
9718 0 : return FD_BINCODE_SUCCESS;
9719 0 : }
9720 0 : case 5: {
9721 0 : return FD_BINCODE_SUCCESS;
9722 0 : }
9723 0 : case 6: {
9724 0 : return FD_BINCODE_SUCCESS;
9725 0 : }
9726 0 : default: return FD_BINCODE_ERR_ENCODING;
9727 0 : }
9728 0 : }
9729 0 : static int fd_loader_v4_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9730 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9731 0 : uint discriminant = 0;
9732 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9733 0 : if( FD_UNLIKELY( err ) ) return err;
9734 0 : return fd_loader_v4_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
9735 0 : }
9736 0 : int fd_loader_v4_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9737 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_t);
9738 0 : void const * start_data = ctx->data;
9739 0 : int err = fd_loader_v4_program_instruction_decode_footprint_inner( ctx, total_sz );
9740 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9741 0 : ctx->data = start_data;
9742 0 : return err;
9743 0 : }
9744 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 ) {
9745 0 : switch (discriminant) {
9746 0 : case 0: {
9747 0 : fd_loader_v4_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
9748 0 : break;
9749 0 : }
9750 0 : case 1: {
9751 0 : fd_loader_v4_program_instruction_copy_decode_inner( &self->copy, alloc_mem, ctx );
9752 0 : break;
9753 0 : }
9754 0 : case 2: {
9755 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( &self->set_program_length, alloc_mem, ctx );
9756 0 : break;
9757 0 : }
9758 0 : case 3: {
9759 0 : break;
9760 0 : }
9761 0 : case 4: {
9762 0 : break;
9763 0 : }
9764 0 : case 5: {
9765 0 : break;
9766 0 : }
9767 0 : case 6: {
9768 0 : break;
9769 0 : }
9770 0 : }
9771 0 : }
9772 0 : static void fd_loader_v4_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9773 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)struct_mem;
9774 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9775 0 : fd_loader_v4_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9776 0 : }
9777 0 : void * fd_loader_v4_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9778 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)mem;
9779 0 : fd_loader_v4_program_instruction_new( self );
9780 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_t);
9781 0 : void * * alloc_mem = &alloc_region;
9782 0 : fd_loader_v4_program_instruction_decode_inner( mem, alloc_mem, ctx );
9783 0 : return self;
9784 0 : }
9785 0 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
9786 0 : switch( discriminant ) {
9787 0 : case 0: {
9788 0 : fd_loader_v4_program_instruction_write_new( &self->write );
9789 0 : break;
9790 0 : }
9791 0 : case 1: {
9792 0 : fd_loader_v4_program_instruction_copy_new( &self->copy );
9793 0 : break;
9794 0 : }
9795 0 : case 2: {
9796 0 : fd_loader_v4_program_instruction_set_program_length_new( &self->set_program_length );
9797 0 : break;
9798 0 : }
9799 0 : case 3: {
9800 0 : break;
9801 0 : }
9802 0 : case 4: {
9803 0 : break;
9804 0 : }
9805 0 : case 5: {
9806 0 : break;
9807 0 : }
9808 0 : case 6: {
9809 0 : break;
9810 0 : }
9811 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9812 0 : }
9813 0 : }
9814 0 : void fd_loader_v4_program_instruction_new_disc( fd_loader_v4_program_instruction_t * self, uint discriminant ) {
9815 0 : self->discriminant = discriminant;
9816 0 : fd_loader_v4_program_instruction_inner_new( &self->inner, self->discriminant );
9817 0 : }
9818 0 : void fd_loader_v4_program_instruction_new( fd_loader_v4_program_instruction_t * self ) {
9819 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_t) );
9820 0 : fd_loader_v4_program_instruction_new_disc( self, UINT_MAX );
9821 0 : }
9822 :
9823 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 ) {
9824 0 : (void) varint;
9825 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_loader_v4_program_instruction", level++, 0);
9826 0 : switch( self->discriminant ) {
9827 0 : case 0: {
9828 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9829 0 : fd_loader_v4_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
9830 0 : break;
9831 0 : }
9832 0 : case 1: {
9833 0 : fun( w, self, "copy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9834 0 : fd_loader_v4_program_instruction_copy_walk( w, &self->inner.copy, fun, "copy", level, 0 );
9835 0 : break;
9836 0 : }
9837 0 : case 2: {
9838 0 : fun( w, self, "set_program_length", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9839 0 : fd_loader_v4_program_instruction_set_program_length_walk( w, &self->inner.set_program_length, fun, "set_program_length", level, 0 );
9840 0 : break;
9841 0 : }
9842 0 : case 3: {
9843 0 : fun( w, self, "deploy", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9844 0 : break;
9845 0 : }
9846 0 : case 4: {
9847 0 : fun( w, self, "retract", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9848 0 : break;
9849 0 : }
9850 0 : case 5: {
9851 0 : fun( w, self, "transfer_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9852 0 : break;
9853 0 : }
9854 0 : case 6: {
9855 0 : fun( w, self, "finalize", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
9856 0 : break;
9857 0 : }
9858 0 : }
9859 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_loader_v4_program_instruction", level--, 0 );
9860 0 : }
9861 0 : ulong fd_loader_v4_program_instruction_size( fd_loader_v4_program_instruction_t const * self ) {
9862 0 : ulong size = 0;
9863 0 : size += sizeof(uint);
9864 0 : switch (self->discriminant) {
9865 0 : case 0: {
9866 0 : size += fd_loader_v4_program_instruction_write_size( &self->inner.write );
9867 0 : break;
9868 0 : }
9869 0 : case 1: {
9870 0 : size += fd_loader_v4_program_instruction_copy_size( &self->inner.copy );
9871 0 : break;
9872 0 : }
9873 0 : case 2: {
9874 0 : size += fd_loader_v4_program_instruction_set_program_length_size( &self->inner.set_program_length );
9875 0 : break;
9876 0 : }
9877 0 : }
9878 0 : return size;
9879 0 : }
9880 :
9881 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 ) {
9882 0 : int err;
9883 0 : switch (discriminant) {
9884 0 : case 0: {
9885 0 : err = fd_loader_v4_program_instruction_write_encode( &self->write, ctx );
9886 0 : if( FD_UNLIKELY( err ) ) return err;
9887 0 : break;
9888 0 : }
9889 0 : case 1: {
9890 0 : err = fd_loader_v4_program_instruction_copy_encode( &self->copy, ctx );
9891 0 : if( FD_UNLIKELY( err ) ) return err;
9892 0 : break;
9893 0 : }
9894 0 : case 2: {
9895 0 : err = fd_loader_v4_program_instruction_set_program_length_encode( &self->set_program_length, ctx );
9896 0 : if( FD_UNLIKELY( err ) ) return err;
9897 0 : break;
9898 0 : }
9899 0 : }
9900 0 : return FD_BINCODE_SUCCESS;
9901 0 : }
9902 0 : int fd_loader_v4_program_instruction_encode( fd_loader_v4_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9903 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9904 0 : if( FD_UNLIKELY( err ) ) return err;
9905 0 : return fd_loader_v4_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
9906 0 : }
9907 :
9908 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 ) {
9909 0 : int err;
9910 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
9911 0 : if( FD_UNLIKELY( err ) ) return err;
9912 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
9913 0 : if( FD_UNLIKELY(err) ) return err;
9914 0 : if( self->bytes_len ) {
9915 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
9916 0 : if( FD_UNLIKELY( err ) ) return err;
9917 0 : }
9918 0 : return FD_BINCODE_SUCCESS;
9919 0 : }
9920 0 : static int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9921 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9922 0 : int err = 0;
9923 0 : err = fd_bincode_uint32_decode_footprint( ctx );
9924 0 : if( FD_UNLIKELY( err ) ) return err;
9925 0 : ulong bytes_len;
9926 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
9927 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9928 0 : if( bytes_len ) {
9929 0 : *total_sz += 8UL + bytes_len;
9930 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
9931 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9932 0 : }
9933 0 : return 0;
9934 0 : }
9935 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9936 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
9937 0 : void const * start_data = ctx->data;
9938 0 : int err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
9939 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9940 0 : ctx->data = start_data;
9941 0 : return err;
9942 0 : }
9943 0 : static void fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9944 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)struct_mem;
9945 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
9946 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
9947 0 : if( self->bytes_len ) {
9948 0 : self->bytes = *alloc_mem;
9949 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
9950 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
9951 0 : } else
9952 0 : self->bytes = NULL;
9953 0 : }
9954 0 : void * fd_bpf_upgradeable_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9955 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)mem;
9956 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( self );
9957 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
9958 0 : void * * alloc_mem = &alloc_region;
9959 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
9960 0 : return self;
9961 0 : }
9962 0 : void fd_bpf_upgradeable_loader_program_instruction_write_new(fd_bpf_upgradeable_loader_program_instruction_write_t * self) {
9963 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t) );
9964 0 : }
9965 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 ) {
9966 0 : (void) varint;
9967 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_write", level++, 0 );
9968 0 : fun( w, &self->offset, "offset", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
9969 0 : if( self->bytes_len ) {
9970 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
9971 0 : for( ulong i=0; i < self->bytes_len; i++ )
9972 0 : fun( w, self->bytes + i, "bytes", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
9973 0 : fun( w, NULL, "bytes", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
9974 0 : }
9975 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_write", level--, 0 );
9976 0 : }
9977 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_size( fd_bpf_upgradeable_loader_program_instruction_write_t const * self ) {
9978 0 : ulong size = 0;
9979 0 : size += sizeof(uint);
9980 0 : do {
9981 0 : size += sizeof(ulong);
9982 0 : size += self->bytes_len;
9983 0 : } while(0);
9984 0 : return size;
9985 0 : }
9986 :
9987 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 ) {
9988 0 : int err;
9989 0 : err = fd_bincode_uint64_encode( self->max_data_len, ctx );
9990 0 : if( FD_UNLIKELY( err ) ) return err;
9991 0 : return FD_BINCODE_SUCCESS;
9992 0 : }
9993 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 ) {
9994 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9995 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
9996 0 : return 0;
9997 0 : }
9998 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 ) {
9999 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;
10000 0 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
10001 0 : }
10002 0 : void * fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10003 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;
10004 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( self );
10005 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t);
10006 0 : void * * alloc_mem = &alloc_region;
10007 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( mem, alloc_mem, ctx );
10008 0 : return self;
10009 0 : }
10010 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 ) {
10011 0 : (void) varint;
10012 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level++, 0 );
10013 0 : fun( w, &self->max_data_len, "max_data_len", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10014 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len", level--, 0 );
10015 0 : }
10016 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 ) {
10017 0 : int err;
10018 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
10019 0 : if( FD_UNLIKELY( err ) ) return err;
10020 0 : return FD_BINCODE_SUCCESS;
10021 0 : }
10022 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10023 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10024 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
10025 0 : return 0;
10026 0 : }
10027 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 ) {
10028 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)struct_mem;
10029 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
10030 0 : }
10031 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10032 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)mem;
10033 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( self );
10034 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t);
10035 0 : void * * alloc_mem = &alloc_region;
10036 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( mem, alloc_mem, ctx );
10037 0 : return self;
10038 0 : }
10039 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 ) {
10040 0 : (void) varint;
10041 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level++, 0 );
10042 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10043 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program", level--, 0 );
10044 0 : }
10045 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 ) {
10046 0 : int err;
10047 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
10048 0 : if( FD_UNLIKELY( err ) ) return err;
10049 0 : return FD_BINCODE_SUCCESS;
10050 0 : }
10051 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 ) {
10052 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10053 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
10054 0 : return 0;
10055 0 : }
10056 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 ) {
10057 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)struct_mem;
10058 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
10059 0 : }
10060 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10061 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)mem;
10062 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( self );
10063 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t);
10064 0 : void * * alloc_mem = &alloc_region;
10065 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( mem, alloc_mem, ctx );
10066 0 : return self;
10067 0 : }
10068 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 ) {
10069 0 : (void) varint;
10070 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_program_instruction_extend_program_checked", level++, 0 );
10071 0 : fun( w, &self->additional_bytes, "additional_bytes", FD_FLAMENCO_TYPE_UINT, "uint", level, 0 );
10072 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_program_instruction_extend_program_checked", level--, 0 );
10073 0 : }
10074 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_initialize_buffer(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
10075 0 : return self->discriminant == 0;
10076 0 : }
10077 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_write(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
10078 0 : return self->discriminant == 1;
10079 0 : }
10080 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) {
10081 0 : return self->discriminant == 2;
10082 0 : }
10083 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_upgrade(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
10084 0 : return self->discriminant == 3;
10085 0 : }
10086 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
10087 0 : return self->discriminant == 4;
10088 0 : }
10089 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_close(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
10090 0 : return self->discriminant == 5;
10091 0 : }
10092 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
10093 0 : return self->discriminant == 6;
10094 0 : }
10095 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
10096 0 : return self->discriminant == 7;
10097 0 : }
10098 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_migrate(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
10099 0 : return self->discriminant == 8;
10100 0 : }
10101 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
10102 0 : return self->discriminant == 9;
10103 0 : }
10104 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant );
10105 0 : int fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10106 0 : int err;
10107 0 : switch (discriminant) {
10108 0 : case 0: {
10109 0 : return FD_BINCODE_SUCCESS;
10110 0 : }
10111 0 : case 1: {
10112 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
10113 0 : if( FD_UNLIKELY( err ) ) return err;
10114 0 : return FD_BINCODE_SUCCESS;
10115 0 : }
10116 0 : case 2: {
10117 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( ctx, total_sz );
10118 0 : if( FD_UNLIKELY( err ) ) return err;
10119 0 : return FD_BINCODE_SUCCESS;
10120 0 : }
10121 0 : case 3: {
10122 0 : return FD_BINCODE_SUCCESS;
10123 0 : }
10124 0 : case 4: {
10125 0 : return FD_BINCODE_SUCCESS;
10126 0 : }
10127 0 : case 5: {
10128 0 : return FD_BINCODE_SUCCESS;
10129 0 : }
10130 0 : case 6: {
10131 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( ctx, total_sz );
10132 0 : if( FD_UNLIKELY( err ) ) return err;
10133 0 : return FD_BINCODE_SUCCESS;
10134 0 : }
10135 0 : case 7: {
10136 0 : return FD_BINCODE_SUCCESS;
10137 0 : }
10138 0 : case 8: {
10139 0 : return FD_BINCODE_SUCCESS;
10140 0 : }
10141 0 : case 9: {
10142 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_footprint_inner( ctx, total_sz );
10143 0 : if( FD_UNLIKELY( err ) ) return err;
10144 0 : return FD_BINCODE_SUCCESS;
10145 0 : }
10146 0 : default: return FD_BINCODE_ERR_ENCODING;
10147 0 : }
10148 0 : }
10149 0 : static int fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10150 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10151 0 : uint discriminant = 0;
10152 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10153 0 : if( FD_UNLIKELY( err ) ) return err;
10154 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
10155 0 : }
10156 0 : int fd_bpf_upgradeable_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10157 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
10158 0 : void const * start_data = ctx->data;
10159 0 : int err = fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
10160 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10161 0 : ctx->data = start_data;
10162 0 : return err;
10163 0 : }
10164 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 ) {
10165 0 : switch (discriminant) {
10166 0 : case 0: {
10167 0 : break;
10168 0 : }
10169 0 : case 1: {
10170 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
10171 0 : break;
10172 0 : }
10173 0 : case 2: {
10174 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( &self->deploy_with_max_data_len, alloc_mem, ctx );
10175 0 : break;
10176 0 : }
10177 0 : case 3: {
10178 0 : break;
10179 0 : }
10180 0 : case 4: {
10181 0 : break;
10182 0 : }
10183 0 : case 5: {
10184 0 : break;
10185 0 : }
10186 0 : case 6: {
10187 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( &self->extend_program, alloc_mem, ctx );
10188 0 : break;
10189 0 : }
10190 0 : case 7: {
10191 0 : break;
10192 0 : }
10193 0 : case 8: {
10194 0 : break;
10195 0 : }
10196 0 : case 9: {
10197 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( &self->extend_program_checked, alloc_mem, ctx );
10198 0 : break;
10199 0 : }
10200 0 : }
10201 0 : }
10202 0 : static void fd_bpf_upgradeable_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10203 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)struct_mem;
10204 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10205 0 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10206 0 : }
10207 0 : void * fd_bpf_upgradeable_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10208 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)mem;
10209 0 : fd_bpf_upgradeable_loader_program_instruction_new( self );
10210 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
10211 0 : void * * alloc_mem = &alloc_region;
10212 0 : fd_bpf_upgradeable_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
10213 0 : return self;
10214 0 : }
10215 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
10216 0 : switch( discriminant ) {
10217 0 : case 0: {
10218 0 : break;
10219 0 : }
10220 0 : case 1: {
10221 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( &self->write );
10222 0 : break;
10223 0 : }
10224 0 : case 2: {
10225 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( &self->deploy_with_max_data_len );
10226 0 : break;
10227 0 : }
10228 0 : case 3: {
10229 0 : break;
10230 0 : }
10231 0 : case 4: {
10232 0 : break;
10233 0 : }
10234 0 : case 5: {
10235 0 : break;
10236 0 : }
10237 0 : case 6: {
10238 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( &self->extend_program );
10239 0 : break;
10240 0 : }
10241 0 : case 7: {
10242 0 : break;
10243 0 : }
10244 0 : case 8: {
10245 0 : break;
10246 0 : }
10247 0 : case 9: {
10248 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( &self->extend_program_checked );
10249 0 : break;
10250 0 : }
10251 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10252 0 : }
10253 0 : }
10254 0 : void fd_bpf_upgradeable_loader_program_instruction_new_disc( fd_bpf_upgradeable_loader_program_instruction_t * self, uint discriminant ) {
10255 0 : self->discriminant = discriminant;
10256 0 : fd_bpf_upgradeable_loader_program_instruction_inner_new( &self->inner, self->discriminant );
10257 0 : }
10258 0 : void fd_bpf_upgradeable_loader_program_instruction_new( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
10259 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_t) );
10260 0 : fd_bpf_upgradeable_loader_program_instruction_new_disc( self, UINT_MAX );
10261 0 : }
10262 :
10263 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 ) {
10264 0 : (void) varint;
10265 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_program_instruction", level++, 0);
10266 0 : switch( self->discriminant ) {
10267 0 : case 0: {
10268 0 : fun( w, self, "initialize_buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10269 0 : break;
10270 0 : }
10271 0 : case 1: {
10272 0 : fun( w, self, "write", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10273 0 : fd_bpf_upgradeable_loader_program_instruction_write_walk( w, &self->inner.write, fun, "write", level, 0 );
10274 0 : break;
10275 0 : }
10276 0 : case 2: {
10277 0 : fun( w, self, "deploy_with_max_data_len", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10278 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 );
10279 0 : break;
10280 0 : }
10281 0 : case 3: {
10282 0 : fun( w, self, "upgrade", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10283 0 : break;
10284 0 : }
10285 0 : case 4: {
10286 0 : fun( w, self, "set_authority", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10287 0 : break;
10288 0 : }
10289 0 : case 5: {
10290 0 : fun( w, self, "close", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10291 0 : break;
10292 0 : }
10293 0 : case 6: {
10294 0 : fun( w, self, "extend_program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10295 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_walk( w, &self->inner.extend_program, fun, "extend_program", level, 0 );
10296 0 : break;
10297 0 : }
10298 0 : case 7: {
10299 0 : fun( w, self, "set_authority_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10300 0 : break;
10301 0 : }
10302 0 : case 8: {
10303 0 : fun( w, self, "migrate", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10304 0 : break;
10305 0 : }
10306 0 : case 9: {
10307 0 : fun( w, self, "extend_program_checked", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10308 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_walk( w, &self->inner.extend_program_checked, fun, "extend_program_checked", level, 0 );
10309 0 : break;
10310 0 : }
10311 0 : }
10312 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_program_instruction", level--, 0 );
10313 0 : }
10314 0 : ulong fd_bpf_upgradeable_loader_program_instruction_size( fd_bpf_upgradeable_loader_program_instruction_t const * self ) {
10315 0 : ulong size = 0;
10316 0 : size += sizeof(uint);
10317 0 : switch (self->discriminant) {
10318 0 : case 1: {
10319 0 : size += fd_bpf_upgradeable_loader_program_instruction_write_size( &self->inner.write );
10320 0 : break;
10321 0 : }
10322 0 : case 2: {
10323 0 : size += fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( &self->inner.deploy_with_max_data_len );
10324 0 : break;
10325 0 : }
10326 0 : case 6: {
10327 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_size( &self->inner.extend_program );
10328 0 : break;
10329 0 : }
10330 0 : case 9: {
10331 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_size( &self->inner.extend_program_checked );
10332 0 : break;
10333 0 : }
10334 0 : }
10335 0 : return size;
10336 0 : }
10337 :
10338 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 ) {
10339 0 : int err;
10340 0 : switch (discriminant) {
10341 0 : case 1: {
10342 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_encode( &self->write, ctx );
10343 0 : if( FD_UNLIKELY( err ) ) return err;
10344 0 : break;
10345 0 : }
10346 0 : case 2: {
10347 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( &self->deploy_with_max_data_len, ctx );
10348 0 : if( FD_UNLIKELY( err ) ) return err;
10349 0 : break;
10350 0 : }
10351 0 : case 6: {
10352 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( &self->extend_program, ctx );
10353 0 : if( FD_UNLIKELY( err ) ) return err;
10354 0 : break;
10355 0 : }
10356 0 : case 9: {
10357 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_encode( &self->extend_program_checked, ctx );
10358 0 : if( FD_UNLIKELY( err ) ) return err;
10359 0 : break;
10360 0 : }
10361 0 : }
10362 0 : return FD_BINCODE_SUCCESS;
10363 0 : }
10364 0 : int fd_bpf_upgradeable_loader_program_instruction_encode( fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10365 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10366 0 : if( FD_UNLIKELY( err ) ) return err;
10367 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
10368 0 : }
10369 :
10370 0 : int fd_bpf_upgradeable_loader_state_buffer_encode( fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10371 0 : int err;
10372 0 : err = fd_bincode_bool_encode( self->has_authority_address, ctx );
10373 0 : if( FD_UNLIKELY( err ) ) return err;
10374 0 : if( self->has_authority_address ) {
10375 0 : err = fd_pubkey_encode( &self->authority_address, ctx );
10376 0 : if( FD_UNLIKELY( err ) ) return err;
10377 0 : }
10378 0 : return FD_BINCODE_SUCCESS;
10379 0 : }
10380 0 : static int fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10381 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10382 0 : int err = 0;
10383 0 : {
10384 0 : uchar o;
10385 0 : err = fd_bincode_bool_decode( &o, ctx );
10386 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10387 0 : if( o ) {
10388 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
10389 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10390 0 : }
10391 0 : }
10392 0 : return 0;
10393 0 : }
10394 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10395 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
10396 0 : void const * start_data = ctx->data;
10397 0 : int err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
10398 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10399 0 : ctx->data = start_data;
10400 0 : return err;
10401 0 : }
10402 0 : static void fd_bpf_upgradeable_loader_state_buffer_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10403 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)struct_mem;
10404 0 : {
10405 0 : uchar o;
10406 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10407 0 : self->has_authority_address = !!o;
10408 0 : if( o ) {
10409 0 : fd_pubkey_new( &self->authority_address );
10410 0 : fd_pubkey_decode_inner( &self->authority_address, alloc_mem, ctx );
10411 0 : }
10412 0 : }
10413 0 : }
10414 0 : void * fd_bpf_upgradeable_loader_state_buffer_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10415 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)mem;
10416 0 : fd_bpf_upgradeable_loader_state_buffer_new( self );
10417 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
10418 0 : void * * alloc_mem = &alloc_region;
10419 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( mem, alloc_mem, ctx );
10420 0 : return self;
10421 0 : }
10422 0 : void fd_bpf_upgradeable_loader_state_buffer_new(fd_bpf_upgradeable_loader_state_buffer_t * self) {
10423 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_buffer_t) );
10424 0 : }
10425 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 ) {
10426 0 : (void) varint;
10427 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_buffer", level++, 0 );
10428 0 : if( !self->has_authority_address ) {
10429 0 : fun( w, NULL, "authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
10430 0 : } else {
10431 0 : fd_pubkey_walk( w, &self->authority_address, fun, "authority_address", level, 0 );
10432 0 : }
10433 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_buffer", level--, 0 );
10434 0 : }
10435 0 : ulong fd_bpf_upgradeable_loader_state_buffer_size( fd_bpf_upgradeable_loader_state_buffer_t const * self ) {
10436 0 : ulong size = 0;
10437 0 : size += sizeof(char);
10438 0 : if( self->has_authority_address ) {
10439 0 : size += fd_pubkey_size( &self->authority_address );
10440 0 : }
10441 0 : return size;
10442 0 : }
10443 :
10444 0 : int fd_bpf_upgradeable_loader_state_program_encode( fd_bpf_upgradeable_loader_state_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10445 0 : int err;
10446 0 : err = fd_pubkey_encode( &self->programdata_address, ctx );
10447 0 : if( FD_UNLIKELY( err ) ) return err;
10448 0 : return FD_BINCODE_SUCCESS;
10449 0 : }
10450 0 : static inline int fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10451 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10452 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
10453 0 : return 0;
10454 0 : }
10455 0 : static void fd_bpf_upgradeable_loader_state_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10456 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)struct_mem;
10457 0 : fd_pubkey_decode_inner( &self->programdata_address, alloc_mem, ctx );
10458 0 : }
10459 0 : void * fd_bpf_upgradeable_loader_state_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10460 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)mem;
10461 0 : fd_bpf_upgradeable_loader_state_program_new( self );
10462 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_t);
10463 0 : void * * alloc_mem = &alloc_region;
10464 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( mem, alloc_mem, ctx );
10465 0 : return self;
10466 0 : }
10467 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 ) {
10468 0 : (void) varint;
10469 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program", level++, 0 );
10470 0 : fd_pubkey_walk( w, &self->programdata_address, fun, "programdata_address", level, 0 );
10471 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program", level--, 0 );
10472 0 : }
10473 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 ) {
10474 0 : int err;
10475 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
10476 0 : if( FD_UNLIKELY( err ) ) return err;
10477 0 : err = fd_bincode_bool_encode( self->has_upgrade_authority_address, ctx );
10478 0 : if( FD_UNLIKELY( err ) ) return err;
10479 0 : if( self->has_upgrade_authority_address ) {
10480 0 : err = fd_pubkey_encode( &self->upgrade_authority_address, ctx );
10481 0 : if( FD_UNLIKELY( err ) ) return err;
10482 0 : }
10483 0 : return FD_BINCODE_SUCCESS;
10484 0 : }
10485 0 : static int fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10486 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10487 0 : int err = 0;
10488 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10489 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10490 0 : {
10491 0 : uchar o;
10492 0 : err = fd_bincode_bool_decode( &o, ctx );
10493 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10494 0 : if( o ) {
10495 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
10496 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10497 0 : }
10498 0 : }
10499 0 : return 0;
10500 0 : }
10501 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10502 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
10503 0 : void const * start_data = ctx->data;
10504 0 : int err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
10505 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10506 0 : ctx->data = start_data;
10507 0 : return err;
10508 0 : }
10509 0 : static void fd_bpf_upgradeable_loader_state_program_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10510 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)struct_mem;
10511 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
10512 0 : {
10513 0 : uchar o;
10514 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10515 0 : self->has_upgrade_authority_address = !!o;
10516 0 : if( o ) {
10517 0 : fd_pubkey_new( &self->upgrade_authority_address );
10518 0 : fd_pubkey_decode_inner( &self->upgrade_authority_address, alloc_mem, ctx );
10519 0 : }
10520 0 : }
10521 0 : }
10522 0 : void * fd_bpf_upgradeable_loader_state_program_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10523 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)mem;
10524 0 : fd_bpf_upgradeable_loader_state_program_data_new( self );
10525 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
10526 0 : void * * alloc_mem = &alloc_region;
10527 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( mem, alloc_mem, ctx );
10528 0 : return self;
10529 0 : }
10530 0 : void fd_bpf_upgradeable_loader_state_program_data_new(fd_bpf_upgradeable_loader_state_program_data_t * self) {
10531 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_data_t) );
10532 0 : }
10533 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 ) {
10534 0 : (void) varint;
10535 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_bpf_upgradeable_loader_state_program_data", level++, 0 );
10536 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10537 0 : if( !self->has_upgrade_authority_address ) {
10538 0 : fun( w, NULL, "upgrade_authority_address", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
10539 0 : } else {
10540 0 : fd_pubkey_walk( w, &self->upgrade_authority_address, fun, "upgrade_authority_address", level, 0 );
10541 0 : }
10542 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_bpf_upgradeable_loader_state_program_data", level--, 0 );
10543 0 : }
10544 0 : ulong fd_bpf_upgradeable_loader_state_program_data_size( fd_bpf_upgradeable_loader_state_program_data_t const * self ) {
10545 0 : ulong size = 0;
10546 0 : size += sizeof(ulong);
10547 0 : size += sizeof(char);
10548 0 : if( self->has_upgrade_authority_address ) {
10549 0 : size += fd_pubkey_size( &self->upgrade_authority_address );
10550 0 : }
10551 0 : return size;
10552 0 : }
10553 :
10554 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_uninitialized(fd_bpf_upgradeable_loader_state_t const * self) {
10555 0 : return self->discriminant == 0;
10556 0 : }
10557 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_buffer(fd_bpf_upgradeable_loader_state_t const * self) {
10558 0 : return self->discriminant == 1;
10559 0 : }
10560 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program(fd_bpf_upgradeable_loader_state_t const * self) {
10561 0 : return self->discriminant == 2;
10562 0 : }
10563 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program_data(fd_bpf_upgradeable_loader_state_t const * self) {
10564 0 : return self->discriminant == 3;
10565 0 : }
10566 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant );
10567 0 : int fd_bpf_upgradeable_loader_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10568 0 : int err;
10569 0 : switch (discriminant) {
10570 0 : case 0: {
10571 0 : return FD_BINCODE_SUCCESS;
10572 0 : }
10573 0 : case 1: {
10574 0 : err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
10575 0 : if( FD_UNLIKELY( err ) ) return err;
10576 0 : return FD_BINCODE_SUCCESS;
10577 0 : }
10578 0 : case 2: {
10579 0 : err = fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( ctx, total_sz );
10580 0 : if( FD_UNLIKELY( err ) ) return err;
10581 0 : return FD_BINCODE_SUCCESS;
10582 0 : }
10583 0 : case 3: {
10584 0 : err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
10585 0 : if( FD_UNLIKELY( err ) ) return err;
10586 0 : return FD_BINCODE_SUCCESS;
10587 0 : }
10588 0 : default: return FD_BINCODE_ERR_ENCODING;
10589 0 : }
10590 0 : }
10591 0 : static int fd_bpf_upgradeable_loader_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10592 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10593 0 : uint discriminant = 0;
10594 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10595 0 : if( FD_UNLIKELY( err ) ) return err;
10596 0 : return fd_bpf_upgradeable_loader_state_inner_decode_footprint( discriminant, ctx, total_sz );
10597 0 : }
10598 0 : int fd_bpf_upgradeable_loader_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10599 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_t);
10600 0 : void const * start_data = ctx->data;
10601 0 : int err = fd_bpf_upgradeable_loader_state_decode_footprint_inner( ctx, total_sz );
10602 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10603 0 : ctx->data = start_data;
10604 0 : return err;
10605 0 : }
10606 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 ) {
10607 0 : switch (discriminant) {
10608 0 : case 0: {
10609 0 : break;
10610 0 : }
10611 0 : case 1: {
10612 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( &self->buffer, alloc_mem, ctx );
10613 0 : break;
10614 0 : }
10615 0 : case 2: {
10616 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( &self->program, alloc_mem, ctx );
10617 0 : break;
10618 0 : }
10619 0 : case 3: {
10620 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( &self->program_data, alloc_mem, ctx );
10621 0 : break;
10622 0 : }
10623 0 : }
10624 0 : }
10625 0 : static void fd_bpf_upgradeable_loader_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10626 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)struct_mem;
10627 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10628 0 : fd_bpf_upgradeable_loader_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10629 0 : }
10630 0 : void * fd_bpf_upgradeable_loader_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10631 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)mem;
10632 0 : fd_bpf_upgradeable_loader_state_new( self );
10633 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_t);
10634 0 : void * * alloc_mem = &alloc_region;
10635 0 : fd_bpf_upgradeable_loader_state_decode_inner( mem, alloc_mem, ctx );
10636 0 : return self;
10637 0 : }
10638 0 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
10639 0 : switch( discriminant ) {
10640 0 : case 0: {
10641 0 : break;
10642 0 : }
10643 0 : case 1: {
10644 0 : fd_bpf_upgradeable_loader_state_buffer_new( &self->buffer );
10645 0 : break;
10646 0 : }
10647 0 : case 2: {
10648 0 : fd_bpf_upgradeable_loader_state_program_new( &self->program );
10649 0 : break;
10650 0 : }
10651 0 : case 3: {
10652 0 : fd_bpf_upgradeable_loader_state_program_data_new( &self->program_data );
10653 0 : break;
10654 0 : }
10655 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10656 0 : }
10657 0 : }
10658 0 : void fd_bpf_upgradeable_loader_state_new_disc( fd_bpf_upgradeable_loader_state_t * self, uint discriminant ) {
10659 0 : self->discriminant = discriminant;
10660 0 : fd_bpf_upgradeable_loader_state_inner_new( &self->inner, self->discriminant );
10661 0 : }
10662 0 : void fd_bpf_upgradeable_loader_state_new( fd_bpf_upgradeable_loader_state_t * self ) {
10663 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_t) );
10664 0 : fd_bpf_upgradeable_loader_state_new_disc( self, UINT_MAX );
10665 0 : }
10666 :
10667 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 ) {
10668 0 : (void) varint;
10669 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_bpf_upgradeable_loader_state", level++, 0);
10670 0 : switch( self->discriminant ) {
10671 0 : case 0: {
10672 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10673 0 : break;
10674 0 : }
10675 0 : case 1: {
10676 0 : fun( w, self, "buffer", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10677 0 : fd_bpf_upgradeable_loader_state_buffer_walk( w, &self->inner.buffer, fun, "buffer", level, 0 );
10678 0 : break;
10679 0 : }
10680 0 : case 2: {
10681 0 : fun( w, self, "program", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10682 0 : fd_bpf_upgradeable_loader_state_program_walk( w, &self->inner.program, fun, "program", level, 0 );
10683 0 : break;
10684 0 : }
10685 0 : case 3: {
10686 0 : fun( w, self, "program_data", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10687 0 : fd_bpf_upgradeable_loader_state_program_data_walk( w, &self->inner.program_data, fun, "program_data", level, 0 );
10688 0 : break;
10689 0 : }
10690 0 : }
10691 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_bpf_upgradeable_loader_state", level--, 0 );
10692 0 : }
10693 0 : ulong fd_bpf_upgradeable_loader_state_size( fd_bpf_upgradeable_loader_state_t const * self ) {
10694 0 : ulong size = 0;
10695 0 : size += sizeof(uint);
10696 0 : switch (self->discriminant) {
10697 0 : case 1: {
10698 0 : size += fd_bpf_upgradeable_loader_state_buffer_size( &self->inner.buffer );
10699 0 : break;
10700 0 : }
10701 0 : case 2: {
10702 0 : size += fd_bpf_upgradeable_loader_state_program_size( &self->inner.program );
10703 0 : break;
10704 0 : }
10705 0 : case 3: {
10706 0 : size += fd_bpf_upgradeable_loader_state_program_data_size( &self->inner.program_data );
10707 0 : break;
10708 0 : }
10709 0 : }
10710 0 : return size;
10711 0 : }
10712 :
10713 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 ) {
10714 0 : int err;
10715 0 : switch (discriminant) {
10716 0 : case 1: {
10717 0 : err = fd_bpf_upgradeable_loader_state_buffer_encode( &self->buffer, ctx );
10718 0 : if( FD_UNLIKELY( err ) ) return err;
10719 0 : break;
10720 0 : }
10721 0 : case 2: {
10722 0 : err = fd_bpf_upgradeable_loader_state_program_encode( &self->program, ctx );
10723 0 : if( FD_UNLIKELY( err ) ) return err;
10724 0 : break;
10725 0 : }
10726 0 : case 3: {
10727 0 : err = fd_bpf_upgradeable_loader_state_program_data_encode( &self->program_data, ctx );
10728 0 : if( FD_UNLIKELY( err ) ) return err;
10729 0 : break;
10730 0 : }
10731 0 : }
10732 0 : return FD_BINCODE_SUCCESS;
10733 0 : }
10734 0 : int fd_bpf_upgradeable_loader_state_encode( fd_bpf_upgradeable_loader_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10735 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10736 0 : if( FD_UNLIKELY( err ) ) return err;
10737 0 : return fd_bpf_upgradeable_loader_state_inner_encode( &self->inner, self->discriminant, ctx );
10738 0 : }
10739 :
10740 0 : int fd_loader_v4_state_encode( fd_loader_v4_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10741 0 : int err;
10742 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
10743 0 : if( FD_UNLIKELY( err ) ) return err;
10744 0 : err = fd_pubkey_encode( &self->authority_address_or_next_version, ctx );
10745 0 : if( FD_UNLIKELY( err ) ) return err;
10746 0 : err = fd_bincode_uint64_encode( self->status, ctx );
10747 0 : if( FD_UNLIKELY( err ) ) return err;
10748 0 : return FD_BINCODE_SUCCESS;
10749 0 : }
10750 0 : static inline int fd_loader_v4_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10751 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10752 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
10753 0 : return 0;
10754 0 : }
10755 0 : static void fd_loader_v4_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10756 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)struct_mem;
10757 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
10758 0 : fd_pubkey_decode_inner( &self->authority_address_or_next_version, alloc_mem, ctx );
10759 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
10760 0 : }
10761 0 : void * fd_loader_v4_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10762 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)mem;
10763 0 : fd_loader_v4_state_new( self );
10764 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_state_t);
10765 0 : void * * alloc_mem = &alloc_region;
10766 0 : fd_loader_v4_state_decode_inner( mem, alloc_mem, ctx );
10767 0 : return self;
10768 0 : }
10769 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 ) {
10770 0 : (void) varint;
10771 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_loader_v4_state", level++, 0 );
10772 0 : fun( w, &self->slot, "slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10773 0 : fd_pubkey_walk( w, &self->authority_address_or_next_version, fun, "authority_address_or_next_version", level, 0 );
10774 0 : fun( w, &self->status, "status", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
10775 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_loader_v4_state", level--, 0 );
10776 0 : }
10777 0 : int fd_frozen_hash_status_encode( fd_frozen_hash_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10778 0 : int err;
10779 0 : err = fd_hash_encode( &self->frozen_hash, ctx );
10780 0 : if( FD_UNLIKELY( err ) ) return err;
10781 0 : err = fd_bincode_bool_encode( (uchar)(self->is_duplicate_confirmed), ctx );
10782 0 : if( FD_UNLIKELY( err ) ) return err;
10783 0 : return FD_BINCODE_SUCCESS;
10784 0 : }
10785 0 : static int fd_frozen_hash_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10786 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10787 0 : int err = 0;
10788 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
10789 0 : if( FD_UNLIKELY( err ) ) return err;
10790 0 : err = fd_bincode_bool_decode_footprint( ctx );
10791 0 : if( FD_UNLIKELY( err ) ) return err;
10792 0 : return 0;
10793 0 : }
10794 0 : int fd_frozen_hash_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10795 0 : *total_sz += sizeof(fd_frozen_hash_status_t);
10796 0 : void const * start_data = ctx->data;
10797 0 : int err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
10798 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10799 0 : ctx->data = start_data;
10800 0 : return err;
10801 0 : }
10802 0 : static void fd_frozen_hash_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10803 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)struct_mem;
10804 0 : fd_hash_decode_inner( &self->frozen_hash, alloc_mem, ctx );
10805 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
10806 0 : }
10807 0 : void * fd_frozen_hash_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10808 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)mem;
10809 0 : fd_frozen_hash_status_new( self );
10810 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_status_t);
10811 0 : void * * alloc_mem = &alloc_region;
10812 0 : fd_frozen_hash_status_decode_inner( mem, alloc_mem, ctx );
10813 0 : return self;
10814 0 : }
10815 0 : void fd_frozen_hash_status_new(fd_frozen_hash_status_t * self) {
10816 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_status_t) );
10817 0 : fd_hash_new( &self->frozen_hash );
10818 0 : }
10819 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 ) {
10820 0 : (void) varint;
10821 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_frozen_hash_status", level++, 0 );
10822 0 : fd_hash_walk( w, &self->frozen_hash, fun, "frozen_hash", level, 0 );
10823 0 : fun( w, &self->is_duplicate_confirmed, "is_duplicate_confirmed", FD_FLAMENCO_TYPE_BOOL, "bool", level, 0 );
10824 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_frozen_hash_status", level--, 0 );
10825 0 : }
10826 0 : FD_FN_PURE uchar fd_frozen_hash_versioned_is_current(fd_frozen_hash_versioned_t const * self) {
10827 0 : return self->discriminant == 0;
10828 0 : }
10829 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant );
10830 0 : int fd_frozen_hash_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10831 0 : int err;
10832 0 : switch (discriminant) {
10833 0 : case 0: {
10834 0 : err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
10835 0 : if( FD_UNLIKELY( err ) ) return err;
10836 0 : return FD_BINCODE_SUCCESS;
10837 0 : }
10838 0 : default: return FD_BINCODE_ERR_ENCODING;
10839 0 : }
10840 0 : }
10841 0 : static int fd_frozen_hash_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10842 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10843 0 : uint discriminant = 0;
10844 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
10845 0 : if( FD_UNLIKELY( err ) ) return err;
10846 0 : return fd_frozen_hash_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
10847 0 : }
10848 0 : int fd_frozen_hash_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10849 0 : *total_sz += sizeof(fd_frozen_hash_versioned_t);
10850 0 : void const * start_data = ctx->data;
10851 0 : int err = fd_frozen_hash_versioned_decode_footprint_inner( ctx, total_sz );
10852 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10853 0 : ctx->data = start_data;
10854 0 : return err;
10855 0 : }
10856 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 ) {
10857 0 : switch (discriminant) {
10858 0 : case 0: {
10859 0 : fd_frozen_hash_status_decode_inner( &self->current, alloc_mem, ctx );
10860 0 : break;
10861 0 : }
10862 0 : }
10863 0 : }
10864 0 : static void fd_frozen_hash_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10865 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)struct_mem;
10866 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
10867 0 : fd_frozen_hash_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
10868 0 : }
10869 0 : void * fd_frozen_hash_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
10870 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)mem;
10871 0 : fd_frozen_hash_versioned_new( self );
10872 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_versioned_t);
10873 0 : void * * alloc_mem = &alloc_region;
10874 0 : fd_frozen_hash_versioned_decode_inner( mem, alloc_mem, ctx );
10875 0 : return self;
10876 0 : }
10877 0 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
10878 0 : switch( discriminant ) {
10879 0 : case 0: {
10880 0 : fd_frozen_hash_status_new( &self->current );
10881 0 : break;
10882 0 : }
10883 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
10884 0 : }
10885 0 : }
10886 0 : void fd_frozen_hash_versioned_new_disc( fd_frozen_hash_versioned_t * self, uint discriminant ) {
10887 0 : self->discriminant = discriminant;
10888 0 : fd_frozen_hash_versioned_inner_new( &self->inner, self->discriminant );
10889 0 : }
10890 0 : void fd_frozen_hash_versioned_new( fd_frozen_hash_versioned_t * self ) {
10891 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_versioned_t) );
10892 0 : fd_frozen_hash_versioned_new_disc( self, UINT_MAX );
10893 0 : }
10894 :
10895 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 ) {
10896 0 : (void) varint;
10897 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_frozen_hash_versioned", level++, 0);
10898 0 : switch( self->discriminant ) {
10899 0 : case 0: {
10900 0 : fun( w, self, "current", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
10901 0 : fd_frozen_hash_status_walk( w, &self->inner.current, fun, "current", level, 0 );
10902 0 : break;
10903 0 : }
10904 0 : }
10905 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_frozen_hash_versioned", level--, 0 );
10906 0 : }
10907 0 : ulong fd_frozen_hash_versioned_size( fd_frozen_hash_versioned_t const * self ) {
10908 0 : ulong size = 0;
10909 0 : size += sizeof(uint);
10910 0 : switch (self->discriminant) {
10911 0 : case 0: {
10912 0 : size += fd_frozen_hash_status_size( &self->inner.current );
10913 0 : break;
10914 0 : }
10915 0 : }
10916 0 : return size;
10917 0 : }
10918 :
10919 0 : int fd_frozen_hash_versioned_inner_encode( fd_frozen_hash_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
10920 0 : int err;
10921 0 : switch (discriminant) {
10922 0 : case 0: {
10923 0 : err = fd_frozen_hash_status_encode( &self->current, ctx );
10924 0 : if( FD_UNLIKELY( err ) ) return err;
10925 0 : break;
10926 0 : }
10927 0 : }
10928 0 : return FD_BINCODE_SUCCESS;
10929 0 : }
10930 0 : int fd_frozen_hash_versioned_encode( fd_frozen_hash_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10931 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
10932 0 : if( FD_UNLIKELY( err ) ) return err;
10933 0 : return fd_frozen_hash_versioned_inner_encode( &self->inner, self->discriminant, ctx );
10934 0 : }
10935 :
10936 0 : int fd_lookup_table_meta_encode( fd_lookup_table_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
10937 0 : int err;
10938 0 : err = fd_bincode_uint64_encode( self->deactivation_slot, ctx );
10939 0 : if( FD_UNLIKELY( err ) ) return err;
10940 0 : err = fd_bincode_uint64_encode( self->last_extended_slot, ctx );
10941 0 : if( FD_UNLIKELY( err ) ) return err;
10942 0 : err = fd_bincode_uint8_encode( (uchar)(self->last_extended_slot_start_index), ctx );
10943 0 : if( FD_UNLIKELY( err ) ) return err;
10944 0 : err = fd_bincode_bool_encode( self->has_authority, ctx );
10945 0 : if( FD_UNLIKELY( err ) ) return err;
10946 0 : if( self->has_authority ) {
10947 0 : err = fd_pubkey_encode( &self->authority, ctx );
10948 0 : if( FD_UNLIKELY( err ) ) return err;
10949 0 : }
10950 0 : err = fd_bincode_uint16_encode( self->_padding, ctx );
10951 0 : if( FD_UNLIKELY( err ) ) return err;
10952 0 : return FD_BINCODE_SUCCESS;
10953 0 : }
10954 0 : static int fd_lookup_table_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10955 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10956 0 : int err = 0;
10957 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10958 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10959 0 : err = fd_bincode_uint64_decode_footprint( ctx );
10960 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10961 0 : err = fd_bincode_uint8_decode_footprint( ctx );
10962 0 : if( FD_UNLIKELY( err ) ) return err;
10963 0 : {
10964 0 : uchar o;
10965 0 : err = fd_bincode_bool_decode( &o, ctx );
10966 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10967 0 : if( o ) {
10968 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
10969 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10970 0 : }
10971 0 : }
10972 0 : err = fd_bincode_uint16_decode_footprint( ctx );
10973 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
10974 0 : return 0;
10975 0 : }
10976 0 : int fd_lookup_table_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
10977 0 : *total_sz += sizeof(fd_lookup_table_meta_t);
10978 0 : void const * start_data = ctx->data;
10979 0 : int err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
10980 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
10981 0 : ctx->data = start_data;
10982 0 : return err;
10983 0 : }
10984 0 : static void fd_lookup_table_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
10985 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)struct_mem;
10986 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
10987 0 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
10988 0 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
10989 0 : {
10990 0 : uchar o;
10991 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
10992 0 : self->has_authority = !!o;
10993 0 : if( o ) {
10994 0 : fd_pubkey_new( &self->authority );
10995 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
10996 0 : }
10997 0 : }
10998 0 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
10999 0 : }
11000 0 : void * fd_lookup_table_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11001 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)mem;
11002 0 : fd_lookup_table_meta_new( self );
11003 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lookup_table_meta_t);
11004 0 : void * * alloc_mem = &alloc_region;
11005 0 : fd_lookup_table_meta_decode_inner( mem, alloc_mem, ctx );
11006 0 : return self;
11007 0 : }
11008 0 : void fd_lookup_table_meta_new(fd_lookup_table_meta_t * self) {
11009 0 : fd_memset( self, 0, sizeof(fd_lookup_table_meta_t) );
11010 0 : }
11011 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 ) {
11012 0 : (void) varint;
11013 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_lookup_table_meta", level++, 0 );
11014 0 : fun( w, &self->deactivation_slot, "deactivation_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11015 0 : fun( w, &self->last_extended_slot, "last_extended_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11016 0 : fun( w, &self->last_extended_slot_start_index, "last_extended_slot_start_index", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11017 0 : if( !self->has_authority ) {
11018 0 : fun( w, NULL, "authority", FD_FLAMENCO_TYPE_NULL, "pubkey", level, 0 );
11019 0 : } else {
11020 0 : fd_pubkey_walk( w, &self->authority, fun, "authority", level, 0 );
11021 0 : }
11022 0 : fun( w, &self->_padding, "_padding", FD_FLAMENCO_TYPE_USHORT, "ushort", level, 0 );
11023 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_lookup_table_meta", level--, 0 );
11024 0 : }
11025 0 : ulong fd_lookup_table_meta_size( fd_lookup_table_meta_t const * self ) {
11026 0 : ulong size = 0;
11027 0 : size += sizeof(ulong);
11028 0 : size += sizeof(ulong);
11029 0 : size += sizeof(char);
11030 0 : size += sizeof(char);
11031 0 : if( self->has_authority ) {
11032 0 : size += fd_pubkey_size( &self->authority );
11033 0 : }
11034 0 : size += sizeof(ushort);
11035 0 : return size;
11036 0 : }
11037 :
11038 0 : int fd_address_lookup_table_encode( fd_address_lookup_table_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11039 0 : int err;
11040 0 : err = fd_lookup_table_meta_encode( &self->meta, ctx );
11041 0 : if( FD_UNLIKELY( err ) ) return err;
11042 0 : return FD_BINCODE_SUCCESS;
11043 0 : }
11044 0 : static int fd_address_lookup_table_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11045 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11046 0 : int err = 0;
11047 0 : err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
11048 0 : if( FD_UNLIKELY( err ) ) return err;
11049 0 : return 0;
11050 0 : }
11051 0 : int fd_address_lookup_table_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11052 0 : *total_sz += sizeof(fd_address_lookup_table_t);
11053 0 : void const * start_data = ctx->data;
11054 0 : int err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
11055 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11056 0 : ctx->data = start_data;
11057 0 : return err;
11058 0 : }
11059 0 : static void fd_address_lookup_table_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11060 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)struct_mem;
11061 0 : fd_lookup_table_meta_decode_inner( &self->meta, alloc_mem, ctx );
11062 0 : }
11063 0 : void * fd_address_lookup_table_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11064 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)mem;
11065 0 : fd_address_lookup_table_new( self );
11066 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_t);
11067 0 : void * * alloc_mem = &alloc_region;
11068 0 : fd_address_lookup_table_decode_inner( mem, alloc_mem, ctx );
11069 0 : return self;
11070 0 : }
11071 0 : void fd_address_lookup_table_new(fd_address_lookup_table_t * self) {
11072 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_t) );
11073 0 : fd_lookup_table_meta_new( &self->meta );
11074 0 : }
11075 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 ) {
11076 0 : (void) varint;
11077 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_address_lookup_table", level++, 0 );
11078 0 : fd_lookup_table_meta_walk( w, &self->meta, fun, "meta", level, 0 );
11079 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_address_lookup_table", level--, 0 );
11080 0 : }
11081 0 : ulong fd_address_lookup_table_size( fd_address_lookup_table_t const * self ) {
11082 0 : ulong size = 0;
11083 0 : size += fd_lookup_table_meta_size( &self->meta );
11084 0 : return size;
11085 0 : }
11086 :
11087 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_uninitialized(fd_address_lookup_table_state_t const * self) {
11088 0 : return self->discriminant == 0;
11089 0 : }
11090 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_lookup_table(fd_address_lookup_table_state_t const * self) {
11091 0 : return self->discriminant == 1;
11092 0 : }
11093 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant );
11094 0 : int fd_address_lookup_table_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11095 0 : int err;
11096 0 : switch (discriminant) {
11097 0 : case 0: {
11098 0 : return FD_BINCODE_SUCCESS;
11099 0 : }
11100 0 : case 1: {
11101 0 : err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
11102 0 : if( FD_UNLIKELY( err ) ) return err;
11103 0 : return FD_BINCODE_SUCCESS;
11104 0 : }
11105 0 : default: return FD_BINCODE_ERR_ENCODING;
11106 0 : }
11107 0 : }
11108 0 : static int fd_address_lookup_table_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11109 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11110 0 : uint discriminant = 0;
11111 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11112 0 : if( FD_UNLIKELY( err ) ) return err;
11113 0 : return fd_address_lookup_table_state_inner_decode_footprint( discriminant, ctx, total_sz );
11114 0 : }
11115 0 : int fd_address_lookup_table_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11116 0 : *total_sz += sizeof(fd_address_lookup_table_state_t);
11117 0 : void const * start_data = ctx->data;
11118 0 : int err = fd_address_lookup_table_state_decode_footprint_inner( ctx, total_sz );
11119 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11120 0 : ctx->data = start_data;
11121 0 : return err;
11122 0 : }
11123 0 : static void fd_address_lookup_table_state_inner_decode_inner( fd_address_lookup_table_state_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
11124 0 : switch (discriminant) {
11125 0 : case 0: {
11126 0 : break;
11127 0 : }
11128 0 : case 1: {
11129 0 : fd_address_lookup_table_decode_inner( &self->lookup_table, alloc_mem, ctx );
11130 0 : break;
11131 0 : }
11132 0 : }
11133 0 : }
11134 0 : static void fd_address_lookup_table_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11135 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)struct_mem;
11136 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11137 0 : fd_address_lookup_table_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11138 0 : }
11139 0 : void * fd_address_lookup_table_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11140 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)mem;
11141 0 : fd_address_lookup_table_state_new( self );
11142 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_state_t);
11143 0 : void * * alloc_mem = &alloc_region;
11144 0 : fd_address_lookup_table_state_decode_inner( mem, alloc_mem, ctx );
11145 0 : return self;
11146 0 : }
11147 0 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
11148 0 : switch( discriminant ) {
11149 0 : case 0: {
11150 0 : break;
11151 0 : }
11152 0 : case 1: {
11153 0 : fd_address_lookup_table_new( &self->lookup_table );
11154 0 : break;
11155 0 : }
11156 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11157 0 : }
11158 0 : }
11159 0 : void fd_address_lookup_table_state_new_disc( fd_address_lookup_table_state_t * self, uint discriminant ) {
11160 0 : self->discriminant = discriminant;
11161 0 : fd_address_lookup_table_state_inner_new( &self->inner, self->discriminant );
11162 0 : }
11163 0 : void fd_address_lookup_table_state_new( fd_address_lookup_table_state_t * self ) {
11164 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_state_t) );
11165 0 : fd_address_lookup_table_state_new_disc( self, UINT_MAX );
11166 0 : }
11167 :
11168 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 ) {
11169 0 : (void) varint;
11170 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_address_lookup_table_state", level++, 0);
11171 0 : switch( self->discriminant ) {
11172 0 : case 0: {
11173 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11174 0 : break;
11175 0 : }
11176 0 : case 1: {
11177 0 : fun( w, self, "lookup_table", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11178 0 : fd_address_lookup_table_walk( w, &self->inner.lookup_table, fun, "lookup_table", level, 0 );
11179 0 : break;
11180 0 : }
11181 0 : }
11182 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_address_lookup_table_state", level--, 0 );
11183 0 : }
11184 0 : ulong fd_address_lookup_table_state_size( fd_address_lookup_table_state_t const * self ) {
11185 0 : ulong size = 0;
11186 0 : size += sizeof(uint);
11187 0 : switch (self->discriminant) {
11188 0 : case 1: {
11189 0 : size += fd_address_lookup_table_size( &self->inner.lookup_table );
11190 0 : break;
11191 0 : }
11192 0 : }
11193 0 : return size;
11194 0 : }
11195 :
11196 0 : int fd_address_lookup_table_state_inner_encode( fd_address_lookup_table_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
11197 0 : int err;
11198 0 : switch (discriminant) {
11199 0 : case 1: {
11200 0 : err = fd_address_lookup_table_encode( &self->lookup_table, ctx );
11201 0 : if( FD_UNLIKELY( err ) ) return err;
11202 0 : break;
11203 0 : }
11204 0 : }
11205 0 : return FD_BINCODE_SUCCESS;
11206 0 : }
11207 0 : int fd_address_lookup_table_state_encode( fd_address_lookup_table_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11208 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11209 0 : if( FD_UNLIKELY( err ) ) return err;
11210 0 : return fd_address_lookup_table_state_inner_encode( &self->inner, self->discriminant, ctx );
11211 0 : }
11212 :
11213 0 : int fd_addrlut_create_encode( fd_addrlut_create_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11214 0 : int err;
11215 0 : err = fd_bincode_uint64_encode( self->recent_slot, ctx );
11216 0 : if( FD_UNLIKELY( err ) ) return err;
11217 0 : err = fd_bincode_uint8_encode( (uchar)(self->bump_seed), ctx );
11218 0 : if( FD_UNLIKELY( err ) ) return err;
11219 0 : return FD_BINCODE_SUCCESS;
11220 0 : }
11221 0 : static inline int fd_addrlut_create_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11222 0 : if( (ulong)ctx->data + 9UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11223 0 : ctx->data = (void *)( (ulong)ctx->data + 9UL );
11224 0 : return 0;
11225 0 : }
11226 0 : static void fd_addrlut_create_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11227 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)struct_mem;
11228 0 : fd_bincode_uint64_decode_unsafe( &self->recent_slot, ctx );
11229 0 : fd_bincode_uint8_decode_unsafe( &self->bump_seed, ctx );
11230 0 : }
11231 0 : void * fd_addrlut_create_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11232 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)mem;
11233 0 : fd_addrlut_create_new( self );
11234 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_create_t);
11235 0 : void * * alloc_mem = &alloc_region;
11236 0 : fd_addrlut_create_decode_inner( mem, alloc_mem, ctx );
11237 0 : return self;
11238 0 : }
11239 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 ) {
11240 0 : (void) varint;
11241 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_create", level++, 0 );
11242 0 : fun( w, &self->recent_slot, "recent_slot", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11243 0 : fun( w, &self->bump_seed, "bump_seed", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11244 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_create", level--, 0 );
11245 0 : }
11246 0 : int fd_addrlut_extend_encode( fd_addrlut_extend_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11247 0 : int err;
11248 0 : err = fd_bincode_uint64_encode( self->new_addrs_len, ctx );
11249 0 : if( FD_UNLIKELY(err) ) return err;
11250 0 : if( self->new_addrs_len ) {
11251 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
11252 0 : err = fd_pubkey_encode( self->new_addrs + i, ctx );
11253 0 : if( FD_UNLIKELY( err ) ) return err;
11254 0 : }
11255 0 : }
11256 0 : return FD_BINCODE_SUCCESS;
11257 0 : }
11258 0 : static int fd_addrlut_extend_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11259 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11260 0 : int err = 0;
11261 0 : ulong new_addrs_len;
11262 0 : err = fd_bincode_uint64_decode( &new_addrs_len, ctx );
11263 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11264 0 : if( new_addrs_len ) {
11265 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*new_addrs_len;
11266 0 : for( ulong i=0; i < new_addrs_len; i++ ) {
11267 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
11268 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
11269 0 : }
11270 0 : }
11271 0 : return 0;
11272 0 : }
11273 0 : int fd_addrlut_extend_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11274 0 : *total_sz += sizeof(fd_addrlut_extend_t);
11275 0 : void const * start_data = ctx->data;
11276 0 : int err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
11277 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11278 0 : ctx->data = start_data;
11279 0 : return err;
11280 0 : }
11281 0 : static void fd_addrlut_extend_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11282 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)struct_mem;
11283 0 : fd_bincode_uint64_decode_unsafe( &self->new_addrs_len, ctx );
11284 0 : if( self->new_addrs_len ) {
11285 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
11286 0 : self->new_addrs = *alloc_mem;
11287 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->new_addrs_len;
11288 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
11289 0 : fd_pubkey_new( self->new_addrs + i );
11290 0 : fd_pubkey_decode_inner( self->new_addrs + i, alloc_mem, ctx );
11291 0 : }
11292 0 : } else
11293 0 : self->new_addrs = NULL;
11294 0 : }
11295 0 : void * fd_addrlut_extend_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11296 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)mem;
11297 0 : fd_addrlut_extend_new( self );
11298 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_extend_t);
11299 0 : void * * alloc_mem = &alloc_region;
11300 0 : fd_addrlut_extend_decode_inner( mem, alloc_mem, ctx );
11301 0 : return self;
11302 0 : }
11303 0 : void fd_addrlut_extend_new(fd_addrlut_extend_t * self) {
11304 0 : fd_memset( self, 0, sizeof(fd_addrlut_extend_t) );
11305 0 : }
11306 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 ) {
11307 0 : (void) varint;
11308 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_addrlut_extend", level++, 0 );
11309 0 : if( self->new_addrs_len ) {
11310 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR, "array", level++, 0 );
11311 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
11312 0 : fd_pubkey_walk(w, self->new_addrs + i, fun, "pubkey", level, 0 );
11313 0 : fun( w, NULL, "new_addrs", FD_FLAMENCO_TYPE_ARR_END, "array", level--, 0 );
11314 0 : }
11315 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_addrlut_extend", level--, 0 );
11316 0 : }
11317 0 : ulong fd_addrlut_extend_size( fd_addrlut_extend_t const * self ) {
11318 0 : ulong size = 0;
11319 0 : do {
11320 0 : size += sizeof(ulong);
11321 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
11322 0 : size += fd_pubkey_size( self->new_addrs + i );
11323 0 : } while(0);
11324 0 : return size;
11325 0 : }
11326 :
11327 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_create_lut(fd_addrlut_instruction_t const * self) {
11328 0 : return self->discriminant == 0;
11329 0 : }
11330 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_freeze_lut(fd_addrlut_instruction_t const * self) {
11331 0 : return self->discriminant == 1;
11332 0 : }
11333 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_extend_lut(fd_addrlut_instruction_t const * self) {
11334 0 : return self->discriminant == 2;
11335 0 : }
11336 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_deactivate_lut(fd_addrlut_instruction_t const * self) {
11337 0 : return self->discriminant == 3;
11338 0 : }
11339 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_close_lut(fd_addrlut_instruction_t const * self) {
11340 0 : return self->discriminant == 4;
11341 0 : }
11342 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant );
11343 0 : int fd_addrlut_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11344 0 : int err;
11345 0 : switch (discriminant) {
11346 0 : case 0: {
11347 0 : err = fd_addrlut_create_decode_footprint_inner( ctx, total_sz );
11348 0 : if( FD_UNLIKELY( err ) ) return err;
11349 0 : return FD_BINCODE_SUCCESS;
11350 0 : }
11351 0 : case 1: {
11352 0 : return FD_BINCODE_SUCCESS;
11353 0 : }
11354 0 : case 2: {
11355 0 : err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
11356 0 : if( FD_UNLIKELY( err ) ) return err;
11357 0 : return FD_BINCODE_SUCCESS;
11358 0 : }
11359 0 : case 3: {
11360 0 : return FD_BINCODE_SUCCESS;
11361 0 : }
11362 0 : case 4: {
11363 0 : return FD_BINCODE_SUCCESS;
11364 0 : }
11365 0 : default: return FD_BINCODE_ERR_ENCODING;
11366 0 : }
11367 0 : }
11368 0 : static int fd_addrlut_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11369 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11370 0 : uint discriminant = 0;
11371 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11372 0 : if( FD_UNLIKELY( err ) ) return err;
11373 0 : return fd_addrlut_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
11374 0 : }
11375 0 : int fd_addrlut_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11376 0 : *total_sz += sizeof(fd_addrlut_instruction_t);
11377 0 : void const * start_data = ctx->data;
11378 0 : int err = fd_addrlut_instruction_decode_footprint_inner( ctx, total_sz );
11379 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11380 0 : ctx->data = start_data;
11381 0 : return err;
11382 0 : }
11383 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 ) {
11384 0 : switch (discriminant) {
11385 0 : case 0: {
11386 0 : fd_addrlut_create_decode_inner( &self->create_lut, alloc_mem, ctx );
11387 0 : break;
11388 0 : }
11389 0 : case 1: {
11390 0 : break;
11391 0 : }
11392 0 : case 2: {
11393 0 : fd_addrlut_extend_decode_inner( &self->extend_lut, alloc_mem, ctx );
11394 0 : break;
11395 0 : }
11396 0 : case 3: {
11397 0 : break;
11398 0 : }
11399 0 : case 4: {
11400 0 : break;
11401 0 : }
11402 0 : }
11403 0 : }
11404 0 : static void fd_addrlut_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11405 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)struct_mem;
11406 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11407 0 : fd_addrlut_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11408 0 : }
11409 0 : void * fd_addrlut_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11410 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)mem;
11411 0 : fd_addrlut_instruction_new( self );
11412 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_instruction_t);
11413 0 : void * * alloc_mem = &alloc_region;
11414 0 : fd_addrlut_instruction_decode_inner( mem, alloc_mem, ctx );
11415 0 : return self;
11416 0 : }
11417 0 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant ) {
11418 0 : switch( discriminant ) {
11419 0 : case 0: {
11420 0 : fd_addrlut_create_new( &self->create_lut );
11421 0 : break;
11422 0 : }
11423 0 : case 1: {
11424 0 : break;
11425 0 : }
11426 0 : case 2: {
11427 0 : fd_addrlut_extend_new( &self->extend_lut );
11428 0 : break;
11429 0 : }
11430 0 : case 3: {
11431 0 : break;
11432 0 : }
11433 0 : case 4: {
11434 0 : break;
11435 0 : }
11436 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11437 0 : }
11438 0 : }
11439 0 : void fd_addrlut_instruction_new_disc( fd_addrlut_instruction_t * self, uint discriminant ) {
11440 0 : self->discriminant = discriminant;
11441 0 : fd_addrlut_instruction_inner_new( &self->inner, self->discriminant );
11442 0 : }
11443 0 : void fd_addrlut_instruction_new( fd_addrlut_instruction_t * self ) {
11444 0 : fd_memset( self, 0, sizeof(fd_addrlut_instruction_t) );
11445 0 : fd_addrlut_instruction_new_disc( self, UINT_MAX );
11446 0 : }
11447 :
11448 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 ) {
11449 0 : (void) varint;
11450 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_addrlut_instruction", level++, 0);
11451 0 : switch( self->discriminant ) {
11452 0 : case 0: {
11453 0 : fun( w, self, "create_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11454 0 : fd_addrlut_create_walk( w, &self->inner.create_lut, fun, "create_lut", level, 0 );
11455 0 : break;
11456 0 : }
11457 0 : case 1: {
11458 0 : fun( w, self, "freeze_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11459 0 : break;
11460 0 : }
11461 0 : case 2: {
11462 0 : fun( w, self, "extend_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11463 0 : fd_addrlut_extend_walk( w, &self->inner.extend_lut, fun, "extend_lut", level, 0 );
11464 0 : break;
11465 0 : }
11466 0 : case 3: {
11467 0 : fun( w, self, "deactivate_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11468 0 : break;
11469 0 : }
11470 0 : case 4: {
11471 0 : fun( w, self, "close_lut", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11472 0 : break;
11473 0 : }
11474 0 : }
11475 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_addrlut_instruction", level--, 0 );
11476 0 : }
11477 0 : ulong fd_addrlut_instruction_size( fd_addrlut_instruction_t const * self ) {
11478 0 : ulong size = 0;
11479 0 : size += sizeof(uint);
11480 0 : switch (self->discriminant) {
11481 0 : case 0: {
11482 0 : size += fd_addrlut_create_size( &self->inner.create_lut );
11483 0 : break;
11484 0 : }
11485 0 : case 2: {
11486 0 : size += fd_addrlut_extend_size( &self->inner.extend_lut );
11487 0 : break;
11488 0 : }
11489 0 : }
11490 0 : return size;
11491 0 : }
11492 :
11493 0 : int fd_addrlut_instruction_inner_encode( fd_addrlut_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
11494 0 : int err;
11495 0 : switch (discriminant) {
11496 0 : case 0: {
11497 0 : err = fd_addrlut_create_encode( &self->create_lut, ctx );
11498 0 : if( FD_UNLIKELY( err ) ) return err;
11499 0 : break;
11500 0 : }
11501 0 : case 2: {
11502 0 : err = fd_addrlut_extend_encode( &self->extend_lut, ctx );
11503 0 : if( FD_UNLIKELY( err ) ) return err;
11504 0 : break;
11505 0 : }
11506 0 : }
11507 0 : return FD_BINCODE_SUCCESS;
11508 0 : }
11509 0 : int fd_addrlut_instruction_encode( fd_addrlut_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11510 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11511 0 : if( FD_UNLIKELY( err ) ) return err;
11512 0 : return fd_addrlut_instruction_inner_encode( &self->inner, self->discriminant, ctx );
11513 0 : }
11514 :
11515 0 : int fd_calculated_stake_points_encode( fd_calculated_stake_points_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11516 0 : int err;
11517 0 : err = fd_bincode_uint128_encode( self->points, ctx );
11518 0 : if( FD_UNLIKELY( err ) ) return err;
11519 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
11520 0 : if( FD_UNLIKELY( err ) ) return err;
11521 0 : err = fd_bincode_uint8_encode( (uchar)(self->force_credits_update_with_skipped_reward), ctx );
11522 0 : if( FD_UNLIKELY( err ) ) return err;
11523 0 : return FD_BINCODE_SUCCESS;
11524 0 : }
11525 0 : static inline int fd_calculated_stake_points_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11526 0 : if( (ulong)ctx->data + 25UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11527 0 : ctx->data = (void *)( (ulong)ctx->data + 25UL );
11528 0 : return 0;
11529 0 : }
11530 0 : static void fd_calculated_stake_points_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11531 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)struct_mem;
11532 0 : fd_bincode_uint128_decode_unsafe( &self->points, ctx );
11533 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
11534 0 : fd_bincode_uint8_decode_unsafe( &self->force_credits_update_with_skipped_reward, ctx );
11535 0 : }
11536 0 : void * fd_calculated_stake_points_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11537 0 : fd_calculated_stake_points_t * self = (fd_calculated_stake_points_t *)mem;
11538 0 : fd_calculated_stake_points_new( self );
11539 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_points_t);
11540 0 : void * * alloc_mem = &alloc_region;
11541 0 : fd_calculated_stake_points_decode_inner( mem, alloc_mem, ctx );
11542 0 : return self;
11543 0 : }
11544 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 ) {
11545 0 : (void) varint;
11546 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_points", level++, 0 );
11547 0 : fun( w, &self->points, "points", FD_FLAMENCO_TYPE_UINT128, "uint128", level, 0 );
11548 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11549 0 : fun( w, &self->force_credits_update_with_skipped_reward, "force_credits_update_with_skipped_reward", FD_FLAMENCO_TYPE_UCHAR, "uchar", level, 0 );
11550 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_points", level--, 0 );
11551 0 : }
11552 0 : int fd_calculated_stake_rewards_encode( fd_calculated_stake_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11553 0 : int err;
11554 0 : err = fd_bincode_uint64_encode( self->staker_rewards, ctx );
11555 0 : if( FD_UNLIKELY( err ) ) return err;
11556 0 : err = fd_bincode_uint64_encode( self->voter_rewards, ctx );
11557 0 : if( FD_UNLIKELY( err ) ) return err;
11558 0 : err = fd_bincode_uint64_encode( self->new_credits_observed, ctx );
11559 0 : if( FD_UNLIKELY( err ) ) return err;
11560 0 : return FD_BINCODE_SUCCESS;
11561 0 : }
11562 0 : static inline int fd_calculated_stake_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11563 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11564 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
11565 0 : return 0;
11566 0 : }
11567 0 : static void fd_calculated_stake_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11568 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)struct_mem;
11569 0 : fd_bincode_uint64_decode_unsafe( &self->staker_rewards, ctx );
11570 0 : fd_bincode_uint64_decode_unsafe( &self->voter_rewards, ctx );
11571 0 : fd_bincode_uint64_decode_unsafe( &self->new_credits_observed, ctx );
11572 0 : }
11573 0 : void * fd_calculated_stake_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11574 0 : fd_calculated_stake_rewards_t * self = (fd_calculated_stake_rewards_t *)mem;
11575 0 : fd_calculated_stake_rewards_new( self );
11576 0 : void * alloc_region = (uchar *)mem + sizeof(fd_calculated_stake_rewards_t);
11577 0 : void * * alloc_mem = &alloc_region;
11578 0 : fd_calculated_stake_rewards_decode_inner( mem, alloc_mem, ctx );
11579 0 : return self;
11580 0 : }
11581 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 ) {
11582 0 : (void) varint;
11583 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_calculated_stake_rewards", level++, 0 );
11584 0 : fun( w, &self->staker_rewards, "staker_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11585 0 : fun( w, &self->voter_rewards, "voter_rewards", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11586 0 : fun( w, &self->new_credits_observed, "new_credits_observed", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11587 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_calculated_stake_rewards", level--, 0 );
11588 0 : }
11589 0 : int fd_usage_cost_details_encode( fd_usage_cost_details_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11590 0 : int err;
11591 0 : err = fd_bincode_uint64_encode( self->signature_cost, ctx );
11592 0 : if( FD_UNLIKELY( err ) ) return err;
11593 0 : err = fd_bincode_uint64_encode( self->write_lock_cost, ctx );
11594 0 : if( FD_UNLIKELY( err ) ) return err;
11595 0 : err = fd_bincode_uint64_encode( self->data_bytes_cost, ctx );
11596 0 : if( FD_UNLIKELY( err ) ) return err;
11597 0 : err = fd_bincode_uint64_encode( self->programs_execution_cost, ctx );
11598 0 : if( FD_UNLIKELY( err ) ) return err;
11599 0 : err = fd_bincode_uint64_encode( self->loaded_accounts_data_size_cost, ctx );
11600 0 : if( FD_UNLIKELY( err ) ) return err;
11601 0 : err = fd_bincode_uint64_encode( self->allocated_accounts_data_size, ctx );
11602 0 : if( FD_UNLIKELY( err ) ) return err;
11603 0 : return FD_BINCODE_SUCCESS;
11604 0 : }
11605 0 : static inline int fd_usage_cost_details_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11606 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11607 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
11608 0 : return 0;
11609 0 : }
11610 0 : static void fd_usage_cost_details_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11611 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)struct_mem;
11612 0 : fd_bincode_uint64_decode_unsafe( &self->signature_cost, ctx );
11613 0 : fd_bincode_uint64_decode_unsafe( &self->write_lock_cost, ctx );
11614 0 : fd_bincode_uint64_decode_unsafe( &self->data_bytes_cost, ctx );
11615 0 : fd_bincode_uint64_decode_unsafe( &self->programs_execution_cost, ctx );
11616 0 : fd_bincode_uint64_decode_unsafe( &self->loaded_accounts_data_size_cost, ctx );
11617 0 : fd_bincode_uint64_decode_unsafe( &self->allocated_accounts_data_size, ctx );
11618 0 : }
11619 0 : void * fd_usage_cost_details_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11620 0 : fd_usage_cost_details_t * self = (fd_usage_cost_details_t *)mem;
11621 0 : fd_usage_cost_details_new( self );
11622 0 : void * alloc_region = (uchar *)mem + sizeof(fd_usage_cost_details_t);
11623 0 : void * * alloc_mem = &alloc_region;
11624 0 : fd_usage_cost_details_decode_inner( mem, alloc_mem, ctx );
11625 0 : return self;
11626 0 : }
11627 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 ) {
11628 0 : (void) varint;
11629 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_usage_cost_details", level++, 0 );
11630 0 : fun( w, &self->signature_cost, "signature_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11631 0 : fun( w, &self->write_lock_cost, "write_lock_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11632 0 : fun( w, &self->data_bytes_cost, "data_bytes_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11633 0 : fun( w, &self->programs_execution_cost, "programs_execution_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11634 0 : fun( w, &self->loaded_accounts_data_size_cost, "loaded_accounts_data_size_cost", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11635 0 : fun( w, &self->allocated_accounts_data_size, "allocated_accounts_data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11636 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_usage_cost_details", level--, 0 );
11637 0 : }
11638 0 : FD_FN_PURE uchar fd_transaction_cost_is_simple_vote(fd_transaction_cost_t const * self) {
11639 0 : return self->discriminant == 0;
11640 0 : }
11641 0 : FD_FN_PURE uchar fd_transaction_cost_is_transaction(fd_transaction_cost_t const * self) {
11642 0 : return self->discriminant == 1;
11643 0 : }
11644 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant );
11645 0 : int fd_transaction_cost_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11646 0 : int err;
11647 0 : switch (discriminant) {
11648 0 : case 0: {
11649 0 : return FD_BINCODE_SUCCESS;
11650 0 : }
11651 0 : case 1: {
11652 0 : err = fd_usage_cost_details_decode_footprint_inner( ctx, total_sz );
11653 0 : if( FD_UNLIKELY( err ) ) return err;
11654 0 : return FD_BINCODE_SUCCESS;
11655 0 : }
11656 0 : default: return FD_BINCODE_ERR_ENCODING;
11657 0 : }
11658 0 : }
11659 0 : static int fd_transaction_cost_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11660 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11661 0 : uint discriminant = 0;
11662 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11663 0 : if( FD_UNLIKELY( err ) ) return err;
11664 0 : return fd_transaction_cost_inner_decode_footprint( discriminant, ctx, total_sz );
11665 0 : }
11666 0 : int fd_transaction_cost_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11667 0 : *total_sz += sizeof(fd_transaction_cost_t);
11668 0 : void const * start_data = ctx->data;
11669 0 : int err = fd_transaction_cost_decode_footprint_inner( ctx, total_sz );
11670 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11671 0 : ctx->data = start_data;
11672 0 : return err;
11673 0 : }
11674 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 ) {
11675 0 : switch (discriminant) {
11676 0 : case 0: {
11677 0 : break;
11678 0 : }
11679 0 : case 1: {
11680 0 : fd_usage_cost_details_decode_inner( &self->transaction, alloc_mem, ctx );
11681 0 : break;
11682 0 : }
11683 0 : }
11684 0 : }
11685 0 : static void fd_transaction_cost_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11686 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)struct_mem;
11687 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11688 0 : fd_transaction_cost_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11689 0 : }
11690 0 : void * fd_transaction_cost_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11691 0 : fd_transaction_cost_t * self = (fd_transaction_cost_t *)mem;
11692 0 : fd_transaction_cost_new( self );
11693 0 : void * alloc_region = (uchar *)mem + sizeof(fd_transaction_cost_t);
11694 0 : void * * alloc_mem = &alloc_region;
11695 0 : fd_transaction_cost_decode_inner( mem, alloc_mem, ctx );
11696 0 : return self;
11697 0 : }
11698 0 : void fd_transaction_cost_inner_new( fd_transaction_cost_inner_t * self, uint discriminant ) {
11699 0 : switch( discriminant ) {
11700 0 : case 0: {
11701 0 : break;
11702 0 : }
11703 0 : case 1: {
11704 0 : fd_usage_cost_details_new( &self->transaction );
11705 0 : break;
11706 0 : }
11707 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11708 0 : }
11709 0 : }
11710 0 : void fd_transaction_cost_new_disc( fd_transaction_cost_t * self, uint discriminant ) {
11711 0 : self->discriminant = discriminant;
11712 0 : fd_transaction_cost_inner_new( &self->inner, self->discriminant );
11713 0 : }
11714 0 : void fd_transaction_cost_new( fd_transaction_cost_t * self ) {
11715 0 : fd_memset( self, 0, sizeof(fd_transaction_cost_t) );
11716 0 : fd_transaction_cost_new_disc( self, UINT_MAX );
11717 0 : }
11718 :
11719 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 ) {
11720 0 : (void) varint;
11721 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_transaction_cost", level++, 0);
11722 0 : switch( self->discriminant ) {
11723 0 : case 0: {
11724 0 : fun( w, self, "simple_vote", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11725 0 : break;
11726 0 : }
11727 0 : case 1: {
11728 0 : fun( w, self, "transaction", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11729 0 : fd_usage_cost_details_walk( w, &self->inner.transaction, fun, "transaction", level, 0 );
11730 0 : break;
11731 0 : }
11732 0 : }
11733 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_transaction_cost", level--, 0 );
11734 0 : }
11735 0 : ulong fd_transaction_cost_size( fd_transaction_cost_t const * self ) {
11736 0 : ulong size = 0;
11737 0 : size += sizeof(uint);
11738 0 : switch (self->discriminant) {
11739 0 : case 1: {
11740 0 : size += fd_usage_cost_details_size( &self->inner.transaction );
11741 0 : break;
11742 0 : }
11743 0 : }
11744 0 : return size;
11745 0 : }
11746 :
11747 0 : int fd_transaction_cost_inner_encode( fd_transaction_cost_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
11748 0 : int err;
11749 0 : switch (discriminant) {
11750 0 : case 1: {
11751 0 : err = fd_usage_cost_details_encode( &self->transaction, ctx );
11752 0 : if( FD_UNLIKELY( err ) ) return err;
11753 0 : break;
11754 0 : }
11755 0 : }
11756 0 : return FD_BINCODE_SUCCESS;
11757 0 : }
11758 0 : int fd_transaction_cost_encode( fd_transaction_cost_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11759 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11760 0 : if( FD_UNLIKELY( err ) ) return err;
11761 0 : return fd_transaction_cost_inner_encode( &self->inner, self->discriminant, ctx );
11762 0 : }
11763 :
11764 0 : int fd_rent_paying_encode( fd_rent_paying_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11765 0 : int err;
11766 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
11767 0 : if( FD_UNLIKELY( err ) ) return err;
11768 0 : err = fd_bincode_uint64_encode( self->data_size, ctx );
11769 0 : if( FD_UNLIKELY( err ) ) return err;
11770 0 : return FD_BINCODE_SUCCESS;
11771 0 : }
11772 0 : static inline int fd_rent_paying_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11773 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11774 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
11775 0 : return 0;
11776 0 : }
11777 0 : static void fd_rent_paying_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11778 0 : fd_rent_paying_t * self = (fd_rent_paying_t *)struct_mem;
11779 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
11780 0 : fd_bincode_uint64_decode_unsafe( &self->data_size, ctx );
11781 0 : }
11782 0 : void * fd_rent_paying_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11783 0 : fd_rent_paying_t * self = (fd_rent_paying_t *)mem;
11784 0 : fd_rent_paying_new( self );
11785 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_paying_t);
11786 0 : void * * alloc_mem = &alloc_region;
11787 0 : fd_rent_paying_decode_inner( mem, alloc_mem, ctx );
11788 0 : return self;
11789 0 : }
11790 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 ) {
11791 0 : (void) varint;
11792 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP, "fd_rent_paying", level++, 0 );
11793 0 : fun( w, &self->lamports, "lamports", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11794 0 : fun( w, &self->data_size, "data_size", FD_FLAMENCO_TYPE_ULONG, "ulong", level, 0 );
11795 0 : fun( w, self, name, FD_FLAMENCO_TYPE_MAP_END, "fd_rent_paying", level--, 0 );
11796 0 : }
11797 0 : FD_FN_PURE uchar fd_rent_state_is_uninitialized(fd_rent_state_t const * self) {
11798 0 : return self->discriminant == 0;
11799 0 : }
11800 0 : FD_FN_PURE uchar fd_rent_state_is_rent_paying(fd_rent_state_t const * self) {
11801 0 : return self->discriminant == 1;
11802 0 : }
11803 0 : FD_FN_PURE uchar fd_rent_state_is_rent_exempt(fd_rent_state_t const * self) {
11804 0 : return self->discriminant == 2;
11805 0 : }
11806 : void fd_rent_state_inner_new( fd_rent_state_inner_t * self, uint discriminant );
11807 0 : int fd_rent_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11808 0 : int err;
11809 0 : switch (discriminant) {
11810 0 : case 0: {
11811 0 : return FD_BINCODE_SUCCESS;
11812 0 : }
11813 0 : case 1: {
11814 0 : err = fd_rent_paying_decode_footprint_inner( ctx, total_sz );
11815 0 : if( FD_UNLIKELY( err ) ) return err;
11816 0 : return FD_BINCODE_SUCCESS;
11817 0 : }
11818 0 : case 2: {
11819 0 : return FD_BINCODE_SUCCESS;
11820 0 : }
11821 0 : default: return FD_BINCODE_ERR_ENCODING;
11822 0 : }
11823 0 : }
11824 0 : static int fd_rent_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11825 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11826 0 : uint discriminant = 0;
11827 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
11828 0 : if( FD_UNLIKELY( err ) ) return err;
11829 0 : return fd_rent_state_inner_decode_footprint( discriminant, ctx, total_sz );
11830 0 : }
11831 0 : int fd_rent_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
11832 0 : *total_sz += sizeof(fd_rent_state_t);
11833 0 : void const * start_data = ctx->data;
11834 0 : int err = fd_rent_state_decode_footprint_inner( ctx, total_sz );
11835 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
11836 0 : ctx->data = start_data;
11837 0 : return err;
11838 0 : }
11839 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 ) {
11840 0 : switch (discriminant) {
11841 0 : case 0: {
11842 0 : break;
11843 0 : }
11844 0 : case 1: {
11845 0 : fd_rent_paying_decode_inner( &self->rent_paying, alloc_mem, ctx );
11846 0 : break;
11847 0 : }
11848 0 : case 2: {
11849 0 : break;
11850 0 : }
11851 0 : }
11852 0 : }
11853 0 : static void fd_rent_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
11854 0 : fd_rent_state_t * self = (fd_rent_state_t *)struct_mem;
11855 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
11856 0 : fd_rent_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
11857 0 : }
11858 0 : void * fd_rent_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
11859 0 : fd_rent_state_t * self = (fd_rent_state_t *)mem;
11860 0 : fd_rent_state_new( self );
11861 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_state_t);
11862 0 : void * * alloc_mem = &alloc_region;
11863 0 : fd_rent_state_decode_inner( mem, alloc_mem, ctx );
11864 0 : return self;
11865 0 : }
11866 0 : void fd_rent_state_inner_new( fd_rent_state_inner_t * self, uint discriminant ) {
11867 0 : switch( discriminant ) {
11868 0 : case 0: {
11869 0 : break;
11870 0 : }
11871 0 : case 1: {
11872 0 : fd_rent_paying_new( &self->rent_paying );
11873 0 : break;
11874 0 : }
11875 0 : case 2: {
11876 0 : break;
11877 0 : }
11878 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
11879 0 : }
11880 0 : }
11881 0 : void fd_rent_state_new_disc( fd_rent_state_t * self, uint discriminant ) {
11882 0 : self->discriminant = discriminant;
11883 0 : fd_rent_state_inner_new( &self->inner, self->discriminant );
11884 0 : }
11885 0 : void fd_rent_state_new( fd_rent_state_t * self ) {
11886 0 : fd_memset( self, 0, sizeof(fd_rent_state_t) );
11887 0 : fd_rent_state_new_disc( self, UINT_MAX );
11888 0 : }
11889 :
11890 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 ) {
11891 0 : (void) varint;
11892 0 : fun(w, self, name, FD_FLAMENCO_TYPE_ENUM, "fd_rent_state", level++, 0);
11893 0 : switch( self->discriminant ) {
11894 0 : case 0: {
11895 0 : fun( w, self, "uninitialized", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11896 0 : break;
11897 0 : }
11898 0 : case 1: {
11899 0 : fun( w, self, "rent_paying", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11900 0 : fd_rent_paying_walk( w, &self->inner.rent_paying, fun, "rent_paying", level, 0 );
11901 0 : break;
11902 0 : }
11903 0 : case 2: {
11904 0 : fun( w, self, "rent_exempt", FD_FLAMENCO_TYPE_ENUM_DISC, "discriminant", level, 0 );
11905 0 : break;
11906 0 : }
11907 0 : }
11908 0 : fun( w, self, name, FD_FLAMENCO_TYPE_ENUM_END, "fd_rent_state", level--, 0 );
11909 0 : }
11910 0 : ulong fd_rent_state_size( fd_rent_state_t const * self ) {
11911 0 : ulong size = 0;
11912 0 : size += sizeof(uint);
11913 0 : switch (self->discriminant) {
11914 0 : case 1: {
11915 0 : size += fd_rent_paying_size( &self->inner.rent_paying );
11916 0 : break;
11917 0 : }
11918 0 : }
11919 0 : return size;
11920 0 : }
11921 :
11922 0 : int fd_rent_state_inner_encode( fd_rent_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
11923 0 : int err;
11924 0 : switch (discriminant) {
11925 0 : case 1: {
11926 0 : err = fd_rent_paying_encode( &self->rent_paying, ctx );
11927 0 : if( FD_UNLIKELY( err ) ) return err;
11928 0 : break;
11929 0 : }
11930 0 : }
11931 0 : return FD_BINCODE_SUCCESS;
11932 0 : }
11933 0 : int fd_rent_state_encode( fd_rent_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
11934 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
11935 0 : if( FD_UNLIKELY( err ) ) return err;
11936 0 : return fd_rent_state_inner_encode( &self->inner, self->discriminant, ctx );
11937 0 : }
11938 :
11939 : #include "fd_types_custom.c"
|