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 0 : int fd_feature_encode( fd_feature_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12 0 : int err;
13 0 : err = fd_bincode_bool_encode( self->has_activated_at, ctx );
14 0 : if( FD_UNLIKELY( err ) ) return err;
15 0 : if( self->has_activated_at ) {
16 0 : err = fd_bincode_uint64_encode( self->activated_at, ctx );
17 0 : if( FD_UNLIKELY( err ) ) return err;
18 0 : }
19 0 : return FD_BINCODE_SUCCESS;
20 0 : }
21 0 : static int fd_feature_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
22 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
23 0 : int err = 0;
24 0 : {
25 0 : uchar o;
26 0 : err = fd_bincode_bool_decode( &o, ctx );
27 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
28 0 : if( o ) {
29 0 : err = fd_bincode_uint64_decode_footprint( ctx );
30 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
31 0 : }
32 0 : }
33 0 : return 0;
34 0 : }
35 0 : int fd_feature_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
36 0 : *total_sz += sizeof(fd_feature_t);
37 0 : void const * start_data = ctx->data;
38 0 : int err = fd_feature_decode_footprint_inner( ctx, total_sz );
39 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
40 0 : ctx->data = start_data;
41 0 : return err;
42 0 : }
43 0 : static void fd_feature_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
44 0 : fd_feature_t * self = (fd_feature_t *)struct_mem;
45 0 : {
46 0 : uchar o;
47 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
48 0 : self->has_activated_at = !!o;
49 0 : if( o ) {
50 0 : fd_bincode_uint64_decode_unsafe( &self->activated_at, ctx );
51 0 : }
52 0 : }
53 0 : }
54 0 : void * fd_feature_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
55 0 : fd_feature_t * self = (fd_feature_t *)mem;
56 0 : fd_feature_new( self );
57 0 : void * alloc_region = (uchar *)mem + sizeof(fd_feature_t);
58 0 : void * * alloc_mem = &alloc_region;
59 0 : fd_feature_decode_inner( mem, alloc_mem, ctx );
60 0 : return self;
61 0 : }
62 0 : void fd_feature_new(fd_feature_t * self) {
63 0 : fd_memset( self, 0, sizeof(fd_feature_t) );
64 0 : }
65 0 : ulong fd_feature_size( fd_feature_t const * self ) {
66 0 : ulong size = 0;
67 0 : size += sizeof(char);
68 0 : if( self->has_activated_at ) {
69 0 : size += sizeof(ulong);
70 0 : }
71 0 : return size;
72 0 : }
73 :
74 0 : int fd_fee_calculator_encode( fd_fee_calculator_t const * self, fd_bincode_encode_ctx_t * ctx ) {
75 0 : int err;
76 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
77 0 : if( FD_UNLIKELY( err ) ) return err;
78 0 : return FD_BINCODE_SUCCESS;
79 0 : }
80 0 : static inline int fd_fee_calculator_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
81 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
82 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
83 0 : return 0;
84 0 : }
85 33975 : static void fd_fee_calculator_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
86 33975 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)struct_mem;
87 33975 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
88 33975 : }
89 0 : void * fd_fee_calculator_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
90 0 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)mem;
91 0 : fd_fee_calculator_new( self );
92 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_calculator_t);
93 0 : void * * alloc_mem = &alloc_region;
94 0 : fd_fee_calculator_decode_inner( mem, alloc_mem, ctx );
95 0 : return self;
96 0 : }
97 9 : int fd_fee_rate_governor_encode( fd_fee_rate_governor_t const * self, fd_bincode_encode_ctx_t * ctx ) {
98 9 : int err;
99 9 : err = fd_bincode_uint64_encode( self->target_lamports_per_signature, ctx );
100 9 : if( FD_UNLIKELY( err ) ) return err;
101 9 : err = fd_bincode_uint64_encode( self->target_signatures_per_slot, ctx );
102 9 : if( FD_UNLIKELY( err ) ) return err;
103 9 : err = fd_bincode_uint64_encode( self->min_lamports_per_signature, ctx );
104 9 : if( FD_UNLIKELY( err ) ) return err;
105 9 : err = fd_bincode_uint64_encode( self->max_lamports_per_signature, ctx );
106 9 : if( FD_UNLIKELY( err ) ) return err;
107 9 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
108 9 : if( FD_UNLIKELY( err ) ) return err;
109 9 : return FD_BINCODE_SUCCESS;
110 9 : }
111 0 : static inline int fd_fee_rate_governor_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
112 0 : if( (ulong)ctx->data + 33UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
113 0 : ctx->data = (void *)( (ulong)ctx->data + 33UL );
114 0 : return 0;
115 0 : }
116 0 : static void fd_fee_rate_governor_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
117 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)struct_mem;
118 0 : fd_bincode_uint64_decode_unsafe( &self->target_lamports_per_signature, ctx );
119 0 : fd_bincode_uint64_decode_unsafe( &self->target_signatures_per_slot, ctx );
120 0 : fd_bincode_uint64_decode_unsafe( &self->min_lamports_per_signature, ctx );
121 0 : fd_bincode_uint64_decode_unsafe( &self->max_lamports_per_signature, ctx );
122 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
123 0 : }
124 0 : void * fd_fee_rate_governor_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
125 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)mem;
126 0 : fd_fee_rate_governor_new( self );
127 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_rate_governor_t);
128 0 : void * * alloc_mem = &alloc_region;
129 0 : fd_fee_rate_governor_decode_inner( mem, alloc_mem, ctx );
130 0 : return self;
131 0 : }
132 0 : int fd_slot_pair_encode( fd_slot_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
133 0 : int err;
134 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
135 0 : if( FD_UNLIKELY( err ) ) return err;
136 0 : err = fd_bincode_uint64_encode( self->val, ctx );
137 0 : if( FD_UNLIKELY( err ) ) return err;
138 0 : return FD_BINCODE_SUCCESS;
139 0 : }
140 0 : static inline int fd_slot_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
141 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
142 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
143 0 : return 0;
144 0 : }
145 0 : static void fd_slot_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
146 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)struct_mem;
147 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
148 0 : fd_bincode_uint64_decode_unsafe( &self->val, ctx );
149 0 : }
150 0 : void * fd_slot_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
151 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)mem;
152 0 : fd_slot_pair_new( self );
153 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_pair_t);
154 0 : void * * alloc_mem = &alloc_region;
155 0 : fd_slot_pair_decode_inner( mem, alloc_mem, ctx );
156 0 : return self;
157 0 : }
158 0 : int fd_hard_forks_encode( fd_hard_forks_t const * self, fd_bincode_encode_ctx_t * ctx ) {
159 0 : int err;
160 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
161 0 : if( FD_UNLIKELY(err) ) return err;
162 0 : if( self->hard_forks_len ) {
163 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
164 0 : err = fd_slot_pair_encode( self->hard_forks + i, ctx );
165 0 : if( FD_UNLIKELY( err ) ) return err;
166 0 : }
167 0 : }
168 0 : return FD_BINCODE_SUCCESS;
169 0 : }
170 0 : int fd_hard_forks_encode_global( fd_hard_forks_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
171 0 : int err;
172 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
173 0 : if( FD_UNLIKELY( err ) ) return err;
174 0 : if( self->hard_forks_len ) {
175 0 : uchar * hard_forks_laddr = (uchar*)self + self->hard_forks_offset;
176 0 : fd_slot_pair_t * hard_forks = (fd_slot_pair_t *)hard_forks_laddr;
177 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
178 0 : err = fd_slot_pair_encode( &hard_forks[i], ctx );
179 0 : if( FD_UNLIKELY( err ) ) return err;
180 0 : }
181 0 : }
182 0 : return FD_BINCODE_SUCCESS;
183 0 : }
184 0 : static int fd_hard_forks_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
185 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
186 0 : int err = 0;
187 0 : ulong hard_forks_len;
188 0 : err = fd_bincode_uint64_decode( &hard_forks_len, ctx );
189 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
190 0 : if( hard_forks_len ) {
191 0 : *total_sz += FD_SLOT_PAIR_ALIGN + sizeof(fd_slot_pair_t)*hard_forks_len;
192 0 : for( ulong i=0; i < hard_forks_len; i++ ) {
193 0 : err = fd_slot_pair_decode_footprint_inner( ctx, total_sz );
194 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
195 0 : }
196 0 : }
197 0 : return 0;
198 0 : }
199 0 : int fd_hard_forks_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
200 0 : *total_sz += sizeof(fd_hard_forks_t);
201 0 : void const * start_data = ctx->data;
202 0 : int err = fd_hard_forks_decode_footprint_inner( ctx, total_sz );
203 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
204 0 : ctx->data = start_data;
205 0 : return err;
206 0 : }
207 0 : static void fd_hard_forks_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
208 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)struct_mem;
209 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
210 0 : if( self->hard_forks_len ) {
211 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
212 0 : self->hard_forks = *alloc_mem;
213 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
214 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
215 0 : fd_slot_pair_new( self->hard_forks + i );
216 0 : fd_slot_pair_decode_inner( self->hard_forks + i, alloc_mem, ctx );
217 0 : }
218 0 : } else
219 0 : self->hard_forks = NULL;
220 0 : }
221 0 : void * fd_hard_forks_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
222 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)mem;
223 0 : fd_hard_forks_new( self );
224 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_t);
225 0 : void * * alloc_mem = &alloc_region;
226 0 : fd_hard_forks_decode_inner( mem, alloc_mem, ctx );
227 0 : return self;
228 0 : }
229 0 : static void fd_hard_forks_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
230 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)struct_mem;
231 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
232 0 : if( self->hard_forks_len ) {
233 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
234 0 : self->hard_forks_offset = (ulong)*alloc_mem - (ulong)struct_mem;
235 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
236 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
237 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
238 0 : fd_slot_pair_new( (fd_slot_pair_t *)fd_type_pun(cur_mem + sizeof(fd_slot_pair_t) * i) );
239 0 : fd_slot_pair_decode_inner( cur_mem + sizeof(fd_slot_pair_t) * i, alloc_mem, ctx );
240 0 : }
241 0 : } else {
242 0 : self->hard_forks_offset = 0UL;
243 0 : }
244 0 : }
245 0 : void * fd_hard_forks_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
246 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)mem;
247 0 : fd_hard_forks_new( (fd_hard_forks_t *)self );
248 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_global_t);
249 0 : void * * alloc_mem = &alloc_region;
250 0 : fd_hard_forks_decode_inner_global( mem, alloc_mem, ctx );
251 0 : return self;
252 0 : }
253 0 : void fd_hard_forks_new(fd_hard_forks_t * self) {
254 0 : fd_memset( self, 0, sizeof(fd_hard_forks_t) );
255 0 : }
256 0 : ulong fd_hard_forks_size( fd_hard_forks_t const * self ) {
257 0 : ulong size = 0;
258 0 : do {
259 0 : size += sizeof(ulong);
260 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
261 0 : size += fd_slot_pair_size( self->hard_forks + i );
262 0 : } while(0);
263 0 : return size;
264 0 : }
265 :
266 0 : ulong fd_hard_forks_size_global( fd_hard_forks_global_t const * self ) {
267 0 : ulong size = 0;
268 0 : do {
269 0 : size += sizeof(ulong);
270 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;
271 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
272 0 : size += fd_slot_pair_size( hard_forks + i );
273 0 : } while(0);
274 0 : return size;
275 0 : }
276 :
277 9 : int fd_inflation_encode( fd_inflation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
278 9 : int err;
279 9 : err = fd_bincode_double_encode( self->initial, ctx );
280 9 : if( FD_UNLIKELY( err ) ) return err;
281 9 : err = fd_bincode_double_encode( self->terminal, ctx );
282 9 : if( FD_UNLIKELY( err ) ) return err;
283 9 : err = fd_bincode_double_encode( self->taper, ctx );
284 9 : if( FD_UNLIKELY( err ) ) return err;
285 9 : err = fd_bincode_double_encode( self->foundation, ctx );
286 9 : if( FD_UNLIKELY( err ) ) return err;
287 9 : err = fd_bincode_double_encode( self->foundation_term, ctx );
288 9 : if( FD_UNLIKELY( err ) ) return err;
289 9 : err = fd_bincode_double_encode( self->unused, ctx );
290 9 : if( FD_UNLIKELY( err ) ) return err;
291 9 : return FD_BINCODE_SUCCESS;
292 9 : }
293 0 : static inline int fd_inflation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
294 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
295 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
296 0 : return 0;
297 0 : }
298 0 : static void fd_inflation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
299 0 : fd_inflation_t * self = (fd_inflation_t *)struct_mem;
300 0 : fd_bincode_double_decode_unsafe( &self->initial, ctx );
301 0 : fd_bincode_double_decode_unsafe( &self->terminal, ctx );
302 0 : fd_bincode_double_decode_unsafe( &self->taper, ctx );
303 0 : fd_bincode_double_decode_unsafe( &self->foundation, ctx );
304 0 : fd_bincode_double_decode_unsafe( &self->foundation_term, ctx );
305 0 : fd_bincode_double_decode_unsafe( &self->unused, ctx );
306 0 : }
307 0 : void * fd_inflation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
308 0 : fd_inflation_t * self = (fd_inflation_t *)mem;
309 0 : fd_inflation_new( self );
310 0 : void * alloc_region = (uchar *)mem + sizeof(fd_inflation_t);
311 0 : void * * alloc_mem = &alloc_region;
312 0 : fd_inflation_decode_inner( mem, alloc_mem, ctx );
313 0 : return self;
314 0 : }
315 21 : int fd_rent_encode( fd_rent_t const * self, fd_bincode_encode_ctx_t * ctx ) {
316 21 : int err;
317 21 : err = fd_bincode_uint64_encode( self->lamports_per_uint8_year, ctx );
318 21 : if( FD_UNLIKELY( err ) ) return err;
319 21 : err = fd_bincode_double_encode( self->exemption_threshold, ctx );
320 21 : if( FD_UNLIKELY( err ) ) return err;
321 21 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
322 21 : if( FD_UNLIKELY( err ) ) return err;
323 21 : return FD_BINCODE_SUCCESS;
324 21 : }
325 0 : static inline int fd_rent_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
326 0 : if( (ulong)ctx->data + 17UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
327 0 : ctx->data = (void *)( (ulong)ctx->data + 17UL );
328 0 : return 0;
329 0 : }
330 39 : static void fd_rent_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
331 39 : fd_rent_t * self = (fd_rent_t *)struct_mem;
332 39 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
333 39 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
334 39 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
335 39 : }
336 39 : void * fd_rent_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
337 39 : fd_rent_t * self = (fd_rent_t *)mem;
338 39 : fd_rent_new( self );
339 39 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_t);
340 39 : void * * alloc_mem = &alloc_region;
341 39 : fd_rent_decode_inner( mem, alloc_mem, ctx );
342 39 : return self;
343 39 : }
344 18 : int fd_epoch_schedule_encode( fd_epoch_schedule_t const * self, fd_bincode_encode_ctx_t * ctx ) {
345 18 : int err;
346 18 : err = fd_bincode_uint64_encode( self->slots_per_epoch, ctx );
347 18 : if( FD_UNLIKELY( err ) ) return err;
348 18 : err = fd_bincode_uint64_encode( self->leader_schedule_slot_offset, ctx );
349 18 : if( FD_UNLIKELY( err ) ) return err;
350 18 : err = fd_bincode_bool_encode( (uchar)(self->warmup), ctx );
351 18 : if( FD_UNLIKELY( err ) ) return err;
352 18 : err = fd_bincode_uint64_encode( self->first_normal_epoch, ctx );
353 18 : if( FD_UNLIKELY( err ) ) return err;
354 18 : err = fd_bincode_uint64_encode( self->first_normal_slot, ctx );
355 18 : if( FD_UNLIKELY( err ) ) return err;
356 18 : return FD_BINCODE_SUCCESS;
357 18 : }
358 30 : static int fd_epoch_schedule_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
359 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
360 30 : int err = 0;
361 30 : err = fd_bincode_uint64_decode_footprint( ctx );
362 30 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
363 30 : err = fd_bincode_uint64_decode_footprint( ctx );
364 30 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
365 30 : err = fd_bincode_bool_decode_footprint( ctx );
366 30 : if( FD_UNLIKELY( err ) ) return err;
367 30 : err = fd_bincode_uint64_decode_footprint( ctx );
368 30 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
369 30 : err = fd_bincode_uint64_decode_footprint( ctx );
370 30 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
371 30 : return 0;
372 30 : }
373 30 : int fd_epoch_schedule_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
374 30 : *total_sz += sizeof(fd_epoch_schedule_t);
375 30 : void const * start_data = ctx->data;
376 30 : int err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
377 30 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
378 30 : ctx->data = start_data;
379 30 : return err;
380 30 : }
381 27 : static void fd_epoch_schedule_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
382 27 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)struct_mem;
383 27 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
384 27 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
385 27 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
386 27 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
387 27 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
388 27 : }
389 27 : void * fd_epoch_schedule_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
390 27 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)mem;
391 27 : fd_epoch_schedule_new( self );
392 27 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_schedule_t);
393 27 : void * * alloc_mem = &alloc_region;
394 27 : fd_epoch_schedule_decode_inner( mem, alloc_mem, ctx );
395 27 : return self;
396 27 : }
397 39 : void fd_epoch_schedule_new(fd_epoch_schedule_t * self) {
398 39 : fd_memset( self, 0, sizeof(fd_epoch_schedule_t) );
399 39 : }
400 27 : int fd_stake_history_entry_encode( fd_stake_history_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
401 27 : int err;
402 27 : err = fd_bincode_uint64_encode( self->effective, ctx );
403 27 : if( FD_UNLIKELY( err ) ) return err;
404 27 : err = fd_bincode_uint64_encode( self->activating, ctx );
405 27 : if( FD_UNLIKELY( err ) ) return err;
406 27 : err = fd_bincode_uint64_encode( self->deactivating, ctx );
407 27 : if( FD_UNLIKELY( err ) ) return err;
408 27 : return FD_BINCODE_SUCCESS;
409 27 : }
410 0 : static inline int fd_stake_history_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
411 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
412 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
413 0 : return 0;
414 0 : }
415 102 : static void fd_stake_history_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
416 102 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)struct_mem;
417 102 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
418 102 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
419 102 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
420 102 : }
421 0 : void * fd_stake_history_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
422 0 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)mem;
423 0 : fd_stake_history_entry_new( self );
424 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_entry_t);
425 0 : void * * alloc_mem = &alloc_region;
426 0 : fd_stake_history_entry_decode_inner( mem, alloc_mem, ctx );
427 0 : return self;
428 0 : }
429 27 : int fd_epoch_stake_history_entry_pair_encode( fd_epoch_stake_history_entry_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
430 27 : int err;
431 27 : err = fd_bincode_uint64_encode( self->epoch, ctx );
432 27 : if( FD_UNLIKELY( err ) ) return err;
433 27 : err = fd_stake_history_entry_encode( &self->entry, ctx );
434 27 : if( FD_UNLIKELY( err ) ) return err;
435 27 : return FD_BINCODE_SUCCESS;
436 27 : }
437 1638 : static inline int fd_epoch_stake_history_entry_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
438 1638 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
439 1638 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
440 1638 : return 0;
441 1638 : }
442 102 : static void fd_epoch_stake_history_entry_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
443 102 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)struct_mem;
444 102 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
445 102 : fd_stake_history_entry_decode_inner( &self->entry, alloc_mem, ctx );
446 102 : }
447 0 : void * fd_epoch_stake_history_entry_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
448 0 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)mem;
449 0 : fd_epoch_stake_history_entry_pair_new( self );
450 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_stake_history_entry_pair_t);
451 0 : void * * alloc_mem = &alloc_region;
452 0 : fd_epoch_stake_history_entry_pair_decode_inner( mem, alloc_mem, ctx );
453 0 : return self;
454 0 : }
455 27 : int fd_stake_history_encode( fd_stake_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
456 27 : int err;
457 27 : err = fd_bincode_uint64_encode( self->fd_stake_history_len, ctx );
458 27 : if( FD_UNLIKELY(err) ) return err;
459 27 : if( FD_UNLIKELY( 0 == self->fd_stake_history_len ) ) return FD_BINCODE_SUCCESS;
460 42 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
461 27 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
462 27 : err = fd_epoch_stake_history_entry_pair_encode( self->fd_stake_history + idx, ctx );
463 27 : if( FD_UNLIKELY( err ) ) return err;
464 27 : }
465 15 : return FD_BINCODE_SUCCESS;
466 15 : }
467 78 : static int fd_stake_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
468 78 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
469 78 : int err = 0;
470 78 : ulong fd_stake_history_len;
471 78 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
472 78 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
473 78 : if( fd_stake_history_len ) {
474 1701 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
475 1638 : err = fd_epoch_stake_history_entry_pair_decode_footprint_inner( ctx, total_sz );
476 1638 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
477 1638 : }
478 63 : }
479 78 : return 0;
480 78 : }
481 78 : int fd_stake_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
482 78 : *total_sz += sizeof(fd_stake_history_t);
483 78 : void const * start_data = ctx->data;
484 78 : int err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
485 78 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
486 78 : ctx->data = start_data;
487 78 : return err;
488 78 : }
489 75 : static void fd_stake_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
490 75 : fd_stake_history_t * self = (fd_stake_history_t *)struct_mem;
491 75 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
492 75 : self->fd_stake_history_size = 512;
493 75 : self->fd_stake_history_offset = 0;
494 177 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
495 102 : fd_epoch_stake_history_entry_pair_decode_inner( self->fd_stake_history + i, alloc_mem, ctx );
496 102 : }
497 75 : }
498 75 : void * fd_stake_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
499 75 : fd_stake_history_t * self = (fd_stake_history_t *)mem;
500 75 : fd_stake_history_new( self );
501 75 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_t);
502 75 : void * * alloc_mem = &alloc_region;
503 75 : fd_stake_history_decode_inner( mem, alloc_mem, ctx );
504 75 : return self;
505 75 : }
506 87 : void fd_stake_history_new(fd_stake_history_t * self) {
507 87 : fd_memset( self, 0, sizeof(fd_stake_history_t) );
508 87 : self->fd_stake_history_size = 512;
509 44631 : for( ulong i=0; i<512; i++ )
510 44544 : fd_epoch_stake_history_entry_pair_new( self->fd_stake_history + i );
511 87 : }
512 144 : int fd_solana_account_encode( fd_solana_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
513 144 : int err;
514 144 : err = fd_bincode_uint64_encode( self->lamports, ctx );
515 144 : if( FD_UNLIKELY( err ) ) return err;
516 144 : err = fd_bincode_uint64_encode( self->data_len, ctx );
517 144 : if( FD_UNLIKELY(err) ) return err;
518 144 : if( self->data_len ) {
519 30 : err = fd_bincode_bytes_encode( self->data, self->data_len, ctx );
520 30 : if( FD_UNLIKELY( err ) ) return err;
521 30 : }
522 144 : err = fd_pubkey_encode( &self->owner, ctx );
523 144 : if( FD_UNLIKELY( err ) ) return err;
524 144 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
525 144 : if( FD_UNLIKELY( err ) ) return err;
526 144 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
527 144 : if( FD_UNLIKELY( err ) ) return err;
528 144 : return FD_BINCODE_SUCCESS;
529 144 : }
530 0 : int fd_solana_account_encode_global( fd_solana_account_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
531 0 : int err;
532 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
533 0 : if( FD_UNLIKELY( err ) ) return err;
534 0 : err = fd_bincode_uint64_encode( self->data_len, ctx );
535 0 : if( FD_UNLIKELY( err ) ) return err;
536 0 : if( self->data_len ) {
537 0 : uchar * data_laddr = (uchar*)self + self->data_offset;
538 0 : err = fd_bincode_bytes_encode( data_laddr, self->data_len, ctx );
539 0 : if( FD_UNLIKELY( err ) ) return err;
540 0 : }
541 0 : err = fd_pubkey_encode( &self->owner, ctx );
542 0 : if( FD_UNLIKELY( err ) ) return err;
543 0 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
544 0 : if( FD_UNLIKELY( err ) ) return err;
545 0 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
546 0 : if( FD_UNLIKELY( err ) ) return err;
547 0 : return FD_BINCODE_SUCCESS;
548 0 : }
549 0 : static int fd_solana_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
550 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
551 0 : int err = 0;
552 0 : err = fd_bincode_uint64_decode_footprint( ctx );
553 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
554 0 : ulong data_len;
555 0 : err = fd_bincode_uint64_decode( &data_len, ctx );
556 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
557 0 : if( data_len ) {
558 0 : *total_sz += 8UL + data_len;
559 0 : err = fd_bincode_bytes_decode_footprint( data_len, ctx );
560 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
561 0 : }
562 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
563 0 : if( FD_UNLIKELY( err ) ) return err;
564 0 : err = fd_bincode_bool_decode_footprint( ctx );
565 0 : if( FD_UNLIKELY( err ) ) return err;
566 0 : err = fd_bincode_uint64_decode_footprint( ctx );
567 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
568 0 : return 0;
569 0 : }
570 0 : int fd_solana_account_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
571 0 : *total_sz += sizeof(fd_solana_account_t);
572 0 : void const * start_data = ctx->data;
573 0 : int err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
574 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
575 0 : ctx->data = start_data;
576 0 : return err;
577 0 : }
578 0 : static void fd_solana_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
579 0 : fd_solana_account_t * self = (fd_solana_account_t *)struct_mem;
580 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
581 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
582 0 : if( self->data_len ) {
583 0 : self->data = *alloc_mem;
584 0 : fd_bincode_bytes_decode_unsafe( self->data, self->data_len, ctx );
585 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
586 0 : } else
587 0 : self->data = NULL;
588 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
589 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
590 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
591 0 : }
592 0 : void * fd_solana_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
593 0 : fd_solana_account_t * self = (fd_solana_account_t *)mem;
594 0 : fd_solana_account_new( self );
595 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_t);
596 0 : void * * alloc_mem = &alloc_region;
597 0 : fd_solana_account_decode_inner( mem, alloc_mem, ctx );
598 0 : return self;
599 0 : }
600 0 : static void fd_solana_account_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
601 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)struct_mem;
602 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
603 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
604 0 : if( self->data_len ) {
605 0 : self->data_offset = (ulong)*alloc_mem - (ulong)struct_mem;
606 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->data_len, ctx );
607 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
608 0 : } else {
609 0 : self->data_offset = 0UL;
610 0 : }
611 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
612 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
613 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
614 0 : }
615 0 : void * fd_solana_account_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
616 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)mem;
617 0 : fd_solana_account_new( (fd_solana_account_t *)self );
618 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_global_t);
619 0 : void * * alloc_mem = &alloc_region;
620 0 : fd_solana_account_decode_inner_global( mem, alloc_mem, ctx );
621 0 : return self;
622 0 : }
623 0 : void fd_solana_account_new(fd_solana_account_t * self) {
624 0 : fd_memset( self, 0, sizeof(fd_solana_account_t) );
625 0 : fd_pubkey_new( &self->owner );
626 0 : }
627 0 : ulong fd_solana_account_size( fd_solana_account_t const * self ) {
628 0 : ulong size = 0;
629 0 : size += sizeof(ulong);
630 0 : do {
631 0 : size += sizeof(ulong);
632 0 : size += self->data_len;
633 0 : } while(0);
634 0 : size += fd_pubkey_size( &self->owner );
635 0 : size += sizeof(char);
636 0 : size += sizeof(ulong);
637 0 : return size;
638 0 : }
639 :
640 0 : ulong fd_solana_account_size_global( fd_solana_account_global_t const * self ) {
641 0 : ulong size = 0;
642 0 : size += sizeof(ulong);
643 0 : do {
644 0 : size += sizeof(ulong);
645 0 : uchar * data = self->data_offset ? (uchar *)fd_type_pun( (uchar *)self + self->data_offset ) : NULL;
646 0 : size += self->data_len;
647 0 : } while(0);
648 0 : size += fd_pubkey_size( &self->owner );
649 0 : size += sizeof(char);
650 0 : size += sizeof(ulong);
651 0 : return size;
652 0 : }
653 :
654 12 : int fd_delegation_encode( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
655 12 : int err;
656 12 : err = fd_pubkey_encode( &self->voter_pubkey, ctx );
657 12 : if( FD_UNLIKELY( err ) ) return err;
658 12 : err = fd_bincode_uint64_encode( self->stake, ctx );
659 12 : if( FD_UNLIKELY( err ) ) return err;
660 12 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
661 12 : if( FD_UNLIKELY( err ) ) return err;
662 12 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
663 12 : if( FD_UNLIKELY( err ) ) return err;
664 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
665 12 : if( FD_UNLIKELY( err ) ) return err;
666 12 : return FD_BINCODE_SUCCESS;
667 12 : }
668 0 : static inline int fd_delegation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
669 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
670 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
671 0 : return 0;
672 0 : }
673 0 : static void fd_delegation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
674 0 : fd_delegation_t * self = (fd_delegation_t *)struct_mem;
675 0 : fd_pubkey_decode_inner( &self->voter_pubkey, alloc_mem, ctx );
676 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
677 0 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
678 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
679 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
680 0 : }
681 0 : void * fd_delegation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
682 0 : fd_delegation_t * self = (fd_delegation_t *)mem;
683 0 : fd_delegation_new( self );
684 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_t);
685 0 : void * * alloc_mem = &alloc_region;
686 0 : fd_delegation_decode_inner( mem, alloc_mem, ctx );
687 0 : return self;
688 0 : }
689 12 : int fd_stake_encode( fd_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
690 12 : int err;
691 12 : err = fd_delegation_encode( &self->delegation, ctx );
692 12 : if( FD_UNLIKELY( err ) ) return err;
693 12 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
694 12 : if( FD_UNLIKELY( err ) ) return err;
695 12 : return FD_BINCODE_SUCCESS;
696 12 : }
697 0 : static inline int fd_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
698 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
699 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
700 0 : return 0;
701 0 : }
702 0 : static void fd_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
703 0 : fd_stake_t * self = (fd_stake_t *)struct_mem;
704 0 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
705 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
706 0 : }
707 0 : void * fd_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
708 0 : fd_stake_t * self = (fd_stake_t *)mem;
709 0 : fd_stake_new( self );
710 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_t);
711 0 : void * * alloc_mem = &alloc_region;
712 0 : fd_stake_decode_inner( mem, alloc_mem, ctx );
713 0 : return self;
714 0 : }
715 9 : int fd_rust_duration_encode( fd_rust_duration_t const * self, fd_bincode_encode_ctx_t * ctx ) {
716 9 : int err;
717 9 : err = fd_bincode_uint64_encode( self->seconds, ctx );
718 9 : if( FD_UNLIKELY( err ) ) return err;
719 9 : err = fd_bincode_uint32_encode( self->nanoseconds, ctx );
720 9 : if( FD_UNLIKELY( err ) ) return err;
721 9 : return FD_BINCODE_SUCCESS;
722 9 : }
723 0 : static inline int fd_rust_duration_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
724 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
725 0 : int err = fd_rust_duration_footprint_validator( ctx );
726 0 : if( FD_UNLIKELY( err != FD_BINCODE_SUCCESS ) )
727 0 : return err;
728 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
729 0 : return 0;
730 0 : }
731 0 : static void fd_rust_duration_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
732 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)struct_mem;
733 0 : fd_bincode_uint64_decode_unsafe( &self->seconds, ctx );
734 0 : fd_bincode_uint32_decode_unsafe( &self->nanoseconds, ctx );
735 0 : fd_rust_duration_normalize( self );
736 0 : }
737 0 : void * fd_rust_duration_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
738 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)mem;
739 0 : fd_rust_duration_new( self );
740 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rust_duration_t);
741 0 : void * * alloc_mem = &alloc_region;
742 0 : fd_rust_duration_decode_inner( mem, alloc_mem, ctx );
743 0 : return self;
744 0 : }
745 9 : int fd_poh_config_encode( fd_poh_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
746 9 : int err;
747 9 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
748 9 : if( FD_UNLIKELY( err ) ) return err;
749 9 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
750 9 : if( FD_UNLIKELY( err ) ) return err;
751 9 : if( self->has_target_tick_count ) {
752 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
753 0 : if( FD_UNLIKELY( err ) ) return err;
754 0 : }
755 9 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
756 9 : if( FD_UNLIKELY( err ) ) return err;
757 9 : if( self->has_hashes_per_tick ) {
758 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
759 0 : if( FD_UNLIKELY( err ) ) return err;
760 0 : }
761 9 : return FD_BINCODE_SUCCESS;
762 9 : }
763 0 : int fd_poh_config_encode_global( fd_poh_config_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
764 0 : int err;
765 0 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
766 0 : if( FD_UNLIKELY( err ) ) return err;
767 0 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
768 0 : if( FD_UNLIKELY( err ) ) return err;
769 0 : if( self->has_target_tick_count ) {
770 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
771 0 : if( FD_UNLIKELY( err ) ) return err;
772 0 : }
773 0 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
774 0 : if( FD_UNLIKELY( err ) ) return err;
775 0 : if( self->has_hashes_per_tick ) {
776 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
777 0 : if( FD_UNLIKELY( err ) ) return err;
778 0 : }
779 0 : return FD_BINCODE_SUCCESS;
780 0 : }
781 0 : static int fd_poh_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
782 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
783 0 : int err = 0;
784 0 : err = fd_rust_duration_decode_footprint_inner( ctx, total_sz );
785 0 : if( FD_UNLIKELY( err ) ) return err;
786 0 : {
787 0 : uchar o;
788 0 : err = fd_bincode_bool_decode( &o, ctx );
789 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
790 0 : if( o ) {
791 0 : err = fd_bincode_uint64_decode_footprint( ctx );
792 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
793 0 : }
794 0 : }
795 0 : {
796 0 : uchar o;
797 0 : err = fd_bincode_bool_decode( &o, ctx );
798 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
799 0 : if( o ) {
800 0 : err = fd_bincode_uint64_decode_footprint( ctx );
801 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
802 0 : }
803 0 : }
804 0 : return 0;
805 0 : }
806 0 : int fd_poh_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
807 0 : *total_sz += sizeof(fd_poh_config_t);
808 0 : void const * start_data = ctx->data;
809 0 : int err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
810 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
811 0 : ctx->data = start_data;
812 0 : return err;
813 0 : }
814 0 : static void fd_poh_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
815 0 : fd_poh_config_t * self = (fd_poh_config_t *)struct_mem;
816 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
817 0 : {
818 0 : uchar o;
819 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
820 0 : self->has_target_tick_count = !!o;
821 0 : if( o ) {
822 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
823 0 : }
824 0 : }
825 0 : {
826 0 : uchar o;
827 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
828 0 : self->has_hashes_per_tick = !!o;
829 0 : if( o ) {
830 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
831 0 : }
832 0 : }
833 0 : }
834 0 : void * fd_poh_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
835 0 : fd_poh_config_t * self = (fd_poh_config_t *)mem;
836 0 : fd_poh_config_new( self );
837 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_t);
838 0 : void * * alloc_mem = &alloc_region;
839 0 : fd_poh_config_decode_inner( mem, alloc_mem, ctx );
840 0 : return self;
841 0 : }
842 0 : static void fd_poh_config_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
843 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)struct_mem;
844 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
845 0 : {
846 0 : uchar o;
847 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
848 0 : self->has_target_tick_count = !!o;
849 0 : if( o ) {
850 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
851 0 : }
852 0 : }
853 0 : {
854 0 : uchar o;
855 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
856 0 : self->has_hashes_per_tick = !!o;
857 0 : if( o ) {
858 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
859 0 : }
860 0 : }
861 0 : }
862 0 : void * fd_poh_config_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
863 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)mem;
864 0 : fd_poh_config_new( (fd_poh_config_t *)self );
865 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_global_t);
866 0 : void * * alloc_mem = &alloc_region;
867 0 : fd_poh_config_decode_inner_global( mem, alloc_mem, ctx );
868 0 : return self;
869 0 : }
870 12 : void fd_poh_config_new(fd_poh_config_t * self) {
871 12 : fd_memset( self, 0, sizeof(fd_poh_config_t) );
872 12 : fd_rust_duration_new( &self->target_tick_duration );
873 12 : }
874 0 : ulong fd_poh_config_size( fd_poh_config_t const * self ) {
875 0 : ulong size = 0;
876 0 : size += fd_rust_duration_size( &self->target_tick_duration );
877 0 : size += sizeof(char);
878 0 : if( self->has_target_tick_count ) {
879 0 : size += sizeof(ulong);
880 0 : }
881 0 : size += sizeof(char);
882 0 : if( self->has_hashes_per_tick ) {
883 0 : size += sizeof(ulong);
884 0 : }
885 0 : return size;
886 0 : }
887 :
888 0 : ulong fd_poh_config_size_global( fd_poh_config_global_t const * self ) {
889 0 : ulong size = 0;
890 0 : size += fd_rust_duration_size( &self->target_tick_duration );
891 0 : size += sizeof(char);
892 0 : if( self->has_target_tick_count ) {
893 0 : size += sizeof(ulong);
894 0 : }
895 0 : size += sizeof(char);
896 0 : if( self->has_hashes_per_tick ) {
897 0 : size += sizeof(ulong);
898 0 : }
899 0 : return size;
900 0 : }
901 :
902 0 : int fd_string_pubkey_pair_encode( fd_string_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
903 0 : int err;
904 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
905 0 : if( FD_UNLIKELY(err) ) return err;
906 0 : if( self->string_len ) {
907 0 : err = fd_bincode_bytes_encode( self->string, self->string_len, ctx );
908 0 : if( FD_UNLIKELY( err ) ) return err;
909 0 : }
910 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
911 0 : if( FD_UNLIKELY( err ) ) return err;
912 0 : return FD_BINCODE_SUCCESS;
913 0 : }
914 0 : int fd_string_pubkey_pair_encode_global( fd_string_pubkey_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
915 0 : int err;
916 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
917 0 : if( FD_UNLIKELY( err ) ) return err;
918 0 : if( self->string_len ) {
919 0 : uchar * string_laddr = (uchar*)self + self->string_offset;
920 0 : err = fd_bincode_bytes_encode( string_laddr, self->string_len, ctx );
921 0 : if( FD_UNLIKELY( err ) ) return err;
922 0 : }
923 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
924 0 : if( FD_UNLIKELY( err ) ) return err;
925 0 : return FD_BINCODE_SUCCESS;
926 0 : }
927 0 : static int fd_string_pubkey_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
928 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
929 0 : int err = 0;
930 0 : ulong string_len;
931 0 : err = fd_bincode_uint64_decode( &string_len, ctx );
932 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
933 0 : *total_sz += string_len;
934 0 : if( string_len ) {
935 0 : err = fd_bincode_bytes_decode_footprint( string_len, ctx );
936 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
937 0 : err = !fd_utf8_verify( (char const *) ctx->data - string_len, string_len );
938 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
939 0 : }
940 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
941 0 : if( FD_UNLIKELY( err ) ) return err;
942 0 : return 0;
943 0 : }
944 0 : int fd_string_pubkey_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
945 0 : *total_sz += sizeof(fd_string_pubkey_pair_t);
946 0 : void const * start_data = ctx->data;
947 0 : int err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
948 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
949 0 : ctx->data = start_data;
950 0 : return err;
951 0 : }
952 0 : static void fd_string_pubkey_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
953 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)struct_mem;
954 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
955 0 : if( self->string_len ) {
956 0 : self->string = *alloc_mem;
957 0 : fd_bincode_bytes_decode_unsafe( self->string, self->string_len, ctx );
958 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
959 0 : } else
960 0 : self->string = NULL;
961 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
962 0 : }
963 0 : void * fd_string_pubkey_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
964 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)mem;
965 0 : fd_string_pubkey_pair_new( self );
966 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_t);
967 0 : void * * alloc_mem = &alloc_region;
968 0 : fd_string_pubkey_pair_decode_inner( mem, alloc_mem, ctx );
969 0 : return self;
970 0 : }
971 0 : static void fd_string_pubkey_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
972 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)struct_mem;
973 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
974 0 : if( self->string_len ) {
975 0 : self->string_offset = (ulong)*alloc_mem - (ulong)struct_mem;
976 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->string_len, ctx );
977 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
978 0 : } else {
979 0 : self->string_offset = 0UL;
980 0 : }
981 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
982 0 : }
983 0 : void * fd_string_pubkey_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
984 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)mem;
985 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)self );
986 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_global_t);
987 0 : void * * alloc_mem = &alloc_region;
988 0 : fd_string_pubkey_pair_decode_inner_global( mem, alloc_mem, ctx );
989 0 : return self;
990 0 : }
991 0 : void fd_string_pubkey_pair_new(fd_string_pubkey_pair_t * self) {
992 0 : fd_memset( self, 0, sizeof(fd_string_pubkey_pair_t) );
993 0 : fd_pubkey_new( &self->pubkey );
994 0 : }
995 0 : ulong fd_string_pubkey_pair_size( fd_string_pubkey_pair_t const * self ) {
996 0 : ulong size = 0;
997 0 : do {
998 0 : size += sizeof(ulong);
999 0 : size += self->string_len;
1000 0 : } while(0);
1001 0 : size += fd_pubkey_size( &self->pubkey );
1002 0 : return size;
1003 0 : }
1004 :
1005 0 : ulong fd_string_pubkey_pair_size_global( fd_string_pubkey_pair_global_t const * self ) {
1006 0 : ulong size = 0;
1007 0 : do {
1008 0 : size += sizeof(ulong);
1009 0 : uchar * string = self->string_offset ? (uchar *)fd_type_pun( (uchar *)self + self->string_offset ) : NULL;
1010 0 : size += self->string_len;
1011 0 : } while(0);
1012 0 : size += fd_pubkey_size( &self->pubkey );
1013 0 : return size;
1014 0 : }
1015 :
1016 144 : int fd_pubkey_account_pair_encode( fd_pubkey_account_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1017 144 : int err;
1018 144 : err = fd_pubkey_encode( &self->key, ctx );
1019 144 : if( FD_UNLIKELY( err ) ) return err;
1020 144 : err = fd_solana_account_encode( &self->account, ctx );
1021 144 : if( FD_UNLIKELY( err ) ) return err;
1022 144 : return FD_BINCODE_SUCCESS;
1023 144 : }
1024 0 : int fd_pubkey_account_pair_encode_global( fd_pubkey_account_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1025 0 : int err;
1026 0 : err = fd_pubkey_encode( &self->key, ctx );
1027 0 : if( FD_UNLIKELY( err ) ) return err;
1028 0 : err = fd_solana_account_encode_global( &self->account, ctx );
1029 0 : if( FD_UNLIKELY( err ) ) return err;
1030 0 : return FD_BINCODE_SUCCESS;
1031 0 : }
1032 0 : static int fd_pubkey_account_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1033 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1034 0 : int err = 0;
1035 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1036 0 : if( FD_UNLIKELY( err ) ) return err;
1037 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
1038 0 : if( FD_UNLIKELY( err ) ) return err;
1039 0 : return 0;
1040 0 : }
1041 0 : int fd_pubkey_account_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1042 0 : *total_sz += sizeof(fd_pubkey_account_pair_t);
1043 0 : void const * start_data = ctx->data;
1044 0 : int err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1045 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1046 0 : ctx->data = start_data;
1047 0 : return err;
1048 0 : }
1049 0 : static void fd_pubkey_account_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1050 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)struct_mem;
1051 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1052 0 : fd_solana_account_decode_inner( &self->account, alloc_mem, ctx );
1053 0 : }
1054 0 : void * fd_pubkey_account_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1055 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)mem;
1056 0 : fd_pubkey_account_pair_new( self );
1057 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_t);
1058 0 : void * * alloc_mem = &alloc_region;
1059 0 : fd_pubkey_account_pair_decode_inner( mem, alloc_mem, ctx );
1060 0 : return self;
1061 0 : }
1062 0 : static void fd_pubkey_account_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1063 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)struct_mem;
1064 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1065 0 : fd_solana_account_decode_inner_global( &self->account, alloc_mem, ctx );
1066 0 : }
1067 0 : void * fd_pubkey_account_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1068 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)mem;
1069 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)self );
1070 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_global_t);
1071 0 : void * * alloc_mem = &alloc_region;
1072 0 : fd_pubkey_account_pair_decode_inner_global( mem, alloc_mem, ctx );
1073 0 : return self;
1074 0 : }
1075 0 : void fd_pubkey_account_pair_new(fd_pubkey_account_pair_t * self) {
1076 0 : fd_memset( self, 0, sizeof(fd_pubkey_account_pair_t) );
1077 0 : fd_pubkey_new( &self->key );
1078 0 : fd_solana_account_new( &self->account );
1079 0 : }
1080 0 : ulong fd_pubkey_account_pair_size( fd_pubkey_account_pair_t const * self ) {
1081 0 : ulong size = 0;
1082 0 : size += fd_pubkey_size( &self->key );
1083 0 : size += fd_solana_account_size( &self->account );
1084 0 : return size;
1085 0 : }
1086 :
1087 0 : ulong fd_pubkey_account_pair_size_global( fd_pubkey_account_pair_global_t const * self ) {
1088 0 : ulong size = 0;
1089 0 : size += fd_pubkey_size( &self->key );
1090 0 : size += fd_solana_account_size_global( &self->account );
1091 0 : return size;
1092 0 : }
1093 :
1094 12 : int fd_genesis_solana_encode( fd_genesis_solana_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1095 12 : int err;
1096 12 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1097 12 : if( FD_UNLIKELY( err ) ) return err;
1098 9 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1099 9 : if( FD_UNLIKELY(err) ) return err;
1100 9 : if( self->accounts_len ) {
1101 153 : for( ulong i=0; i < self->accounts_len; i++ ) {
1102 144 : err = fd_pubkey_account_pair_encode( self->accounts + i, ctx );
1103 144 : if( FD_UNLIKELY( err ) ) return err;
1104 144 : }
1105 9 : }
1106 9 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1107 9 : if( FD_UNLIKELY(err) ) return err;
1108 9 : if( self->native_instruction_processors_len ) {
1109 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1110 0 : err = fd_string_pubkey_pair_encode( self->native_instruction_processors + i, ctx );
1111 0 : if( FD_UNLIKELY( err ) ) return err;
1112 0 : }
1113 0 : }
1114 9 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1115 9 : if( FD_UNLIKELY(err) ) return err;
1116 9 : if( self->rewards_pools_len ) {
1117 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1118 0 : err = fd_pubkey_account_pair_encode( self->rewards_pools + i, ctx );
1119 0 : if( FD_UNLIKELY( err ) ) return err;
1120 0 : }
1121 0 : }
1122 9 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1123 9 : if( FD_UNLIKELY( err ) ) return err;
1124 9 : err = fd_bincode_uint64_encode( self->unused, ctx );
1125 9 : if( FD_UNLIKELY( err ) ) return err;
1126 9 : err = fd_poh_config_encode( &self->poh_config, ctx );
1127 9 : if( FD_UNLIKELY( err ) ) return err;
1128 9 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1129 9 : if( FD_UNLIKELY( err ) ) return err;
1130 9 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1131 9 : if( FD_UNLIKELY( err ) ) return err;
1132 9 : err = fd_rent_encode( &self->rent, ctx );
1133 9 : if( FD_UNLIKELY( err ) ) return err;
1134 9 : err = fd_inflation_encode( &self->inflation, ctx );
1135 9 : if( FD_UNLIKELY( err ) ) return err;
1136 9 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1137 9 : if( FD_UNLIKELY( err ) ) return err;
1138 9 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1139 9 : if( FD_UNLIKELY( err ) ) return err;
1140 9 : return FD_BINCODE_SUCCESS;
1141 9 : }
1142 0 : int fd_genesis_solana_encode_global( fd_genesis_solana_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1143 0 : int err;
1144 0 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1145 0 : if( FD_UNLIKELY( err ) ) return err;
1146 0 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1147 0 : if( FD_UNLIKELY( err ) ) return err;
1148 0 : if( self->accounts_len ) {
1149 0 : uchar * accounts_laddr = (uchar*)self + self->accounts_offset;
1150 0 : fd_pubkey_account_pair_global_t * accounts = (fd_pubkey_account_pair_global_t *)accounts_laddr;
1151 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1152 0 : err = fd_pubkey_account_pair_encode_global( &accounts[i], ctx );
1153 0 : if( FD_UNLIKELY( err ) ) return err;
1154 0 : }
1155 0 : }
1156 0 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1157 0 : if( FD_UNLIKELY( err ) ) return err;
1158 0 : if( self->native_instruction_processors_len ) {
1159 0 : uchar * native_instruction_processors_laddr = (uchar*)self + self->native_instruction_processors_offset;
1160 0 : fd_string_pubkey_pair_global_t * native_instruction_processors = (fd_string_pubkey_pair_global_t *)native_instruction_processors_laddr;
1161 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1162 0 : err = fd_string_pubkey_pair_encode_global( &native_instruction_processors[i], ctx );
1163 0 : if( FD_UNLIKELY( err ) ) return err;
1164 0 : }
1165 0 : }
1166 0 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1167 0 : if( FD_UNLIKELY( err ) ) return err;
1168 0 : if( self->rewards_pools_len ) {
1169 0 : uchar * rewards_pools_laddr = (uchar*)self + self->rewards_pools_offset;
1170 0 : fd_pubkey_account_pair_global_t * rewards_pools = (fd_pubkey_account_pair_global_t *)rewards_pools_laddr;
1171 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1172 0 : err = fd_pubkey_account_pair_encode_global( &rewards_pools[i], ctx );
1173 0 : if( FD_UNLIKELY( err ) ) return err;
1174 0 : }
1175 0 : }
1176 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1177 0 : if( FD_UNLIKELY( err ) ) return err;
1178 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
1179 0 : if( FD_UNLIKELY( err ) ) return err;
1180 0 : err = fd_poh_config_encode_global( &self->poh_config, ctx );
1181 0 : if( FD_UNLIKELY( err ) ) return err;
1182 0 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1183 0 : if( FD_UNLIKELY( err ) ) return err;
1184 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1185 0 : if( FD_UNLIKELY( err ) ) return err;
1186 0 : err = fd_rent_encode( &self->rent, ctx );
1187 0 : if( FD_UNLIKELY( err ) ) return err;
1188 0 : err = fd_inflation_encode( &self->inflation, ctx );
1189 0 : if( FD_UNLIKELY( err ) ) return err;
1190 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1191 0 : if( FD_UNLIKELY( err ) ) return err;
1192 0 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1193 0 : if( FD_UNLIKELY( err ) ) return err;
1194 0 : return FD_BINCODE_SUCCESS;
1195 0 : }
1196 0 : static int fd_genesis_solana_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1197 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1198 0 : int err = 0;
1199 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1200 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1201 0 : ulong accounts_len;
1202 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
1203 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1204 0 : if( accounts_len ) {
1205 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*accounts_len;
1206 0 : for( ulong i=0; i < accounts_len; i++ ) {
1207 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1208 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1209 0 : }
1210 0 : }
1211 0 : ulong native_instruction_processors_len;
1212 0 : err = fd_bincode_uint64_decode( &native_instruction_processors_len, ctx );
1213 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1214 0 : if( native_instruction_processors_len ) {
1215 0 : *total_sz += FD_STRING_PUBKEY_PAIR_ALIGN + sizeof(fd_string_pubkey_pair_t)*native_instruction_processors_len;
1216 0 : for( ulong i=0; i < native_instruction_processors_len; i++ ) {
1217 0 : err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
1218 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1219 0 : }
1220 0 : }
1221 0 : ulong rewards_pools_len;
1222 0 : err = fd_bincode_uint64_decode( &rewards_pools_len, ctx );
1223 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1224 0 : if( rewards_pools_len ) {
1225 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*rewards_pools_len;
1226 0 : for( ulong i=0; i < rewards_pools_len; i++ ) {
1227 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1228 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1229 0 : }
1230 0 : }
1231 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1232 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1233 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1234 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1235 0 : err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
1236 0 : if( FD_UNLIKELY( err ) ) return err;
1237 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1238 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1239 0 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
1240 0 : if( FD_UNLIKELY( err ) ) return err;
1241 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
1242 0 : if( FD_UNLIKELY( err ) ) return err;
1243 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
1244 0 : if( FD_UNLIKELY( err ) ) return err;
1245 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
1246 0 : if( FD_UNLIKELY( err ) ) return err;
1247 0 : err = fd_bincode_uint32_decode_footprint( ctx );
1248 0 : if( FD_UNLIKELY( err ) ) return err;
1249 0 : return 0;
1250 0 : }
1251 0 : int fd_genesis_solana_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1252 0 : *total_sz += sizeof(fd_genesis_solana_t);
1253 0 : void const * start_data = ctx->data;
1254 0 : int err = fd_genesis_solana_decode_footprint_inner( ctx, total_sz );
1255 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1256 0 : ctx->data = start_data;
1257 0 : return err;
1258 0 : }
1259 0 : static void fd_genesis_solana_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1260 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)struct_mem;
1261 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1262 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1263 0 : if( self->accounts_len ) {
1264 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1265 0 : self->accounts = *alloc_mem;
1266 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1267 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1268 0 : fd_pubkey_account_pair_new( self->accounts + i );
1269 0 : fd_pubkey_account_pair_decode_inner( self->accounts + i, alloc_mem, ctx );
1270 0 : }
1271 0 : } else
1272 0 : self->accounts = NULL;
1273 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1274 0 : if( self->native_instruction_processors_len ) {
1275 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1276 0 : self->native_instruction_processors = *alloc_mem;
1277 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1278 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1279 0 : fd_string_pubkey_pair_new( self->native_instruction_processors + i );
1280 0 : fd_string_pubkey_pair_decode_inner( self->native_instruction_processors + i, alloc_mem, ctx );
1281 0 : }
1282 0 : } else
1283 0 : self->native_instruction_processors = NULL;
1284 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
1285 0 : if( self->rewards_pools_len ) {
1286 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1287 0 : self->rewards_pools = *alloc_mem;
1288 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
1289 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1290 0 : fd_pubkey_account_pair_new( self->rewards_pools + i );
1291 0 : fd_pubkey_account_pair_decode_inner( self->rewards_pools + i, alloc_mem, ctx );
1292 0 : }
1293 0 : } else
1294 0 : self->rewards_pools = NULL;
1295 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
1296 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
1297 0 : fd_poh_config_decode_inner( &self->poh_config, alloc_mem, ctx );
1298 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
1299 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
1300 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1301 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
1302 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1303 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
1304 0 : }
1305 0 : void * fd_genesis_solana_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1306 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)mem;
1307 0 : fd_genesis_solana_new( self );
1308 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_t);
1309 0 : void * * alloc_mem = &alloc_region;
1310 0 : fd_genesis_solana_decode_inner( mem, alloc_mem, ctx );
1311 0 : return self;
1312 0 : }
1313 0 : static void fd_genesis_solana_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1314 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)struct_mem;
1315 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1316 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1317 0 : if( self->accounts_len ) {
1318 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1319 0 : self->accounts_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1320 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1321 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1322 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1323 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
1324 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
1325 0 : }
1326 0 : } else {
1327 0 : self->accounts_offset = 0UL;
1328 0 : }
1329 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1330 0 : if( self->native_instruction_processors_len ) {
1331 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1332 0 : self->native_instruction_processors_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1333 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1334 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1335 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1336 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)fd_type_pun(cur_mem + sizeof(fd_string_pubkey_pair_t) * i) );
1337 0 : fd_string_pubkey_pair_decode_inner_global( cur_mem + sizeof(fd_string_pubkey_pair_t) * i, alloc_mem, ctx );
1338 0 : }
1339 0 : } else {
1340 0 : self->native_instruction_processors_offset = 0UL;
1341 0 : }
1342 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
1343 0 : if( self->rewards_pools_len ) {
1344 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1345 0 : self->rewards_pools_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1346 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1347 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
1348 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1349 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
1350 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
1351 0 : }
1352 0 : } else {
1353 0 : self->rewards_pools_offset = 0UL;
1354 0 : }
1355 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
1356 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
1357 0 : fd_poh_config_decode_inner_global( &self->poh_config, alloc_mem, ctx );
1358 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
1359 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
1360 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1361 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
1362 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1363 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
1364 0 : }
1365 0 : void * fd_genesis_solana_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1366 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)mem;
1367 0 : fd_genesis_solana_new( (fd_genesis_solana_t *)self );
1368 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_global_t);
1369 0 : void * * alloc_mem = &alloc_region;
1370 0 : fd_genesis_solana_decode_inner_global( mem, alloc_mem, ctx );
1371 0 : return self;
1372 0 : }
1373 12 : void fd_genesis_solana_new(fd_genesis_solana_t * self) {
1374 12 : fd_memset( self, 0, sizeof(fd_genesis_solana_t) );
1375 12 : fd_poh_config_new( &self->poh_config );
1376 12 : fd_fee_rate_governor_new( &self->fee_rate_governor );
1377 12 : fd_rent_new( &self->rent );
1378 12 : fd_inflation_new( &self->inflation );
1379 12 : fd_epoch_schedule_new( &self->epoch_schedule );
1380 12 : }
1381 0 : ulong fd_genesis_solana_size( fd_genesis_solana_t const * self ) {
1382 0 : ulong size = 0;
1383 0 : size += sizeof(ulong);
1384 0 : do {
1385 0 : size += sizeof(ulong);
1386 0 : for( ulong i=0; i < self->accounts_len; i++ )
1387 0 : size += fd_pubkey_account_pair_size( self->accounts + i );
1388 0 : } while(0);
1389 0 : do {
1390 0 : size += sizeof(ulong);
1391 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
1392 0 : size += fd_string_pubkey_pair_size( self->native_instruction_processors + i );
1393 0 : } while(0);
1394 0 : do {
1395 0 : size += sizeof(ulong);
1396 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
1397 0 : size += fd_pubkey_account_pair_size( self->rewards_pools + i );
1398 0 : } while(0);
1399 0 : size += sizeof(ulong);
1400 0 : size += sizeof(ulong);
1401 0 : size += fd_poh_config_size( &self->poh_config );
1402 0 : size += sizeof(ulong);
1403 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
1404 0 : size += fd_rent_size( &self->rent );
1405 0 : size += fd_inflation_size( &self->inflation );
1406 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
1407 0 : size += sizeof(uint);
1408 0 : return size;
1409 0 : }
1410 :
1411 0 : ulong fd_genesis_solana_size_global( fd_genesis_solana_global_t const * self ) {
1412 0 : ulong size = 0;
1413 0 : size += sizeof(ulong);
1414 0 : do {
1415 0 : size += sizeof(ulong);
1416 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;
1417 0 : for( ulong i=0; i < self->accounts_len; i++ )
1418 0 : size += fd_pubkey_account_pair_size_global( accounts + i );
1419 0 : } while(0);
1420 0 : do {
1421 0 : size += sizeof(ulong);
1422 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;
1423 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
1424 0 : size += fd_string_pubkey_pair_size_global( native_instruction_processors + i );
1425 0 : } while(0);
1426 0 : do {
1427 0 : size += sizeof(ulong);
1428 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;
1429 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
1430 0 : size += fd_pubkey_account_pair_size_global( rewards_pools + i );
1431 0 : } while(0);
1432 0 : size += sizeof(ulong);
1433 0 : size += sizeof(ulong);
1434 0 : size += fd_poh_config_size_global( &self->poh_config );
1435 0 : size += sizeof(ulong);
1436 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
1437 0 : size += fd_rent_size( &self->rent );
1438 0 : size += fd_inflation_size( &self->inflation );
1439 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
1440 0 : size += sizeof(uint);
1441 0 : return size;
1442 0 : }
1443 :
1444 36 : int fd_sol_sysvar_clock_encode( fd_sol_sysvar_clock_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1445 36 : int err;
1446 36 : err = fd_bincode_uint64_encode( self->slot, ctx );
1447 36 : if( FD_UNLIKELY( err ) ) return err;
1448 36 : err = fd_bincode_uint64_encode( (ulong)self->epoch_start_timestamp, ctx );
1449 36 : if( FD_UNLIKELY( err ) ) return err;
1450 36 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1451 36 : if( FD_UNLIKELY( err ) ) return err;
1452 36 : err = fd_bincode_uint64_encode( self->leader_schedule_epoch, ctx );
1453 36 : if( FD_UNLIKELY( err ) ) return err;
1454 36 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
1455 36 : if( FD_UNLIKELY( err ) ) return err;
1456 36 : return FD_BINCODE_SUCCESS;
1457 36 : }
1458 0 : static inline int fd_sol_sysvar_clock_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1459 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1460 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
1461 0 : return 0;
1462 0 : }
1463 57 : static void fd_sol_sysvar_clock_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1464 57 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)struct_mem;
1465 57 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1466 57 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
1467 57 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1468 57 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
1469 57 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
1470 57 : }
1471 57 : void * fd_sol_sysvar_clock_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1472 57 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)mem;
1473 57 : fd_sol_sysvar_clock_new( self );
1474 57 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_clock_t);
1475 57 : void * * alloc_mem = &alloc_region;
1476 57 : fd_sol_sysvar_clock_decode_inner( mem, alloc_mem, ctx );
1477 57 : return self;
1478 57 : }
1479 0 : int fd_sol_sysvar_last_restart_slot_encode( fd_sol_sysvar_last_restart_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1480 0 : int err;
1481 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1482 0 : if( FD_UNLIKELY( err ) ) return err;
1483 0 : return FD_BINCODE_SUCCESS;
1484 0 : }
1485 0 : static inline int fd_sol_sysvar_last_restart_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1486 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1487 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
1488 0 : return 0;
1489 0 : }
1490 0 : static void fd_sol_sysvar_last_restart_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1491 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)struct_mem;
1492 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1493 0 : }
1494 0 : void * fd_sol_sysvar_last_restart_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1495 0 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)mem;
1496 0 : fd_sol_sysvar_last_restart_slot_new( self );
1497 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_last_restart_slot_t);
1498 0 : void * * alloc_mem = &alloc_region;
1499 0 : fd_sol_sysvar_last_restart_slot_decode_inner( mem, alloc_mem, ctx );
1500 0 : return self;
1501 0 : }
1502 0 : int fd_vote_lockout_encode( fd_vote_lockout_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1503 0 : int err;
1504 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1505 0 : if( FD_UNLIKELY( err ) ) return err;
1506 0 : err = fd_bincode_uint32_encode( self->confirmation_count, ctx );
1507 0 : if( FD_UNLIKELY( err ) ) return err;
1508 0 : return FD_BINCODE_SUCCESS;
1509 0 : }
1510 0 : static inline int fd_vote_lockout_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1511 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1512 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
1513 0 : return 0;
1514 0 : }
1515 0 : static void fd_vote_lockout_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1516 0 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)struct_mem;
1517 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1518 0 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
1519 0 : }
1520 0 : void * fd_vote_lockout_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1521 0 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)mem;
1522 0 : fd_vote_lockout_new( self );
1523 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_lockout_t);
1524 0 : void * * alloc_mem = &alloc_region;
1525 0 : fd_vote_lockout_decode_inner( mem, alloc_mem, ctx );
1526 0 : return self;
1527 0 : }
1528 0 : int fd_lockout_offset_encode( fd_lockout_offset_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1529 0 : int err;
1530 0 : err = fd_bincode_varint_encode( self->offset, ctx );
1531 0 : if( FD_UNLIKELY( err ) ) return err;
1532 0 : err = fd_bincode_uint8_encode( (uchar)(self->confirmation_count), ctx );
1533 0 : if( FD_UNLIKELY( err ) ) return err;
1534 0 : return FD_BINCODE_SUCCESS;
1535 0 : }
1536 0 : static int fd_lockout_offset_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1537 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1538 0 : int err = 0;
1539 0 : err = fd_bincode_varint_decode_footprint( ctx );
1540 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1541 0 : err = fd_bincode_uint8_decode_footprint( ctx );
1542 0 : if( FD_UNLIKELY( err ) ) return err;
1543 0 : return 0;
1544 0 : }
1545 0 : int fd_lockout_offset_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1546 0 : *total_sz += sizeof(fd_lockout_offset_t);
1547 0 : void const * start_data = ctx->data;
1548 0 : int err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
1549 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1550 0 : ctx->data = start_data;
1551 0 : return err;
1552 0 : }
1553 0 : static void fd_lockout_offset_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1554 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)struct_mem;
1555 0 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
1556 0 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
1557 0 : }
1558 0 : void * fd_lockout_offset_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1559 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)mem;
1560 0 : fd_lockout_offset_new( self );
1561 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockout_offset_t);
1562 0 : void * * alloc_mem = &alloc_region;
1563 0 : fd_lockout_offset_decode_inner( mem, alloc_mem, ctx );
1564 0 : return self;
1565 0 : }
1566 0 : void fd_lockout_offset_new(fd_lockout_offset_t * self) {
1567 0 : fd_memset( self, 0, sizeof(fd_lockout_offset_t) );
1568 0 : }
1569 0 : ulong fd_lockout_offset_size( fd_lockout_offset_t const * self ) {
1570 0 : ulong size = 0;
1571 0 : size += fd_bincode_varint_size( self->offset );
1572 0 : size += sizeof(char);
1573 0 : return size;
1574 0 : }
1575 :
1576 12 : int fd_vote_authorized_voter_encode( fd_vote_authorized_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1577 12 : int err;
1578 12 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1579 12 : if( FD_UNLIKELY( err ) ) return err;
1580 12 : err = fd_pubkey_encode( &self->pubkey, ctx );
1581 12 : if( FD_UNLIKELY( err ) ) return err;
1582 12 : return FD_BINCODE_SUCCESS;
1583 12 : }
1584 0 : static inline int fd_vote_authorized_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1585 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1586 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
1587 0 : return 0;
1588 0 : }
1589 0 : static void fd_vote_authorized_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1590 0 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)struct_mem;
1591 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1592 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1593 0 : }
1594 0 : void * fd_vote_authorized_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1595 0 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)mem;
1596 0 : fd_vote_authorized_voter_new( self );
1597 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voter_t);
1598 0 : void * * alloc_mem = &alloc_region;
1599 0 : fd_vote_authorized_voter_decode_inner( mem, alloc_mem, ctx );
1600 0 : return self;
1601 0 : }
1602 384 : int fd_vote_prior_voter_encode( fd_vote_prior_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1603 384 : int err;
1604 384 : err = fd_pubkey_encode( &self->pubkey, ctx );
1605 384 : if( FD_UNLIKELY( err ) ) return err;
1606 384 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
1607 384 : if( FD_UNLIKELY( err ) ) return err;
1608 384 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
1609 384 : if( FD_UNLIKELY( err ) ) return err;
1610 384 : return FD_BINCODE_SUCCESS;
1611 384 : }
1612 0 : static inline int fd_vote_prior_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1613 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1614 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
1615 0 : return 0;
1616 0 : }
1617 0 : static void fd_vote_prior_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1618 0 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)struct_mem;
1619 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1620 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
1621 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
1622 0 : }
1623 0 : void * fd_vote_prior_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1624 0 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)mem;
1625 0 : fd_vote_prior_voter_new( self );
1626 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_t);
1627 0 : void * * alloc_mem = &alloc_region;
1628 0 : fd_vote_prior_voter_decode_inner( mem, alloc_mem, ctx );
1629 0 : return self;
1630 0 : }
1631 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 ) {
1632 0 : int err;
1633 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
1634 0 : if( FD_UNLIKELY( err ) ) return err;
1635 0 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
1636 0 : if( FD_UNLIKELY( err ) ) return err;
1637 0 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
1638 0 : if( FD_UNLIKELY( err ) ) return err;
1639 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1640 0 : if( FD_UNLIKELY( err ) ) return err;
1641 0 : return FD_BINCODE_SUCCESS;
1642 0 : }
1643 0 : static inline int fd_vote_prior_voter_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1644 0 : if( (ulong)ctx->data + 56UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1645 0 : ctx->data = (void *)( (ulong)ctx->data + 56UL );
1646 0 : return 0;
1647 0 : }
1648 0 : static void fd_vote_prior_voter_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1649 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)struct_mem;
1650 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1651 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
1652 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
1653 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1654 0 : }
1655 0 : void * fd_vote_prior_voter_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1656 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)mem;
1657 0 : fd_vote_prior_voter_0_23_5_new( self );
1658 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_0_23_5_t);
1659 0 : void * * alloc_mem = &alloc_region;
1660 0 : fd_vote_prior_voter_0_23_5_decode_inner( mem, alloc_mem, ctx );
1661 0 : return self;
1662 0 : }
1663 0 : int fd_vote_epoch_credits_encode( fd_vote_epoch_credits_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1664 0 : int err;
1665 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1666 0 : if( FD_UNLIKELY( err ) ) return err;
1667 0 : err = fd_bincode_uint64_encode( self->credits, ctx );
1668 0 : if( FD_UNLIKELY( err ) ) return err;
1669 0 : err = fd_bincode_uint64_encode( self->prev_credits, ctx );
1670 0 : if( FD_UNLIKELY( err ) ) return err;
1671 0 : return FD_BINCODE_SUCCESS;
1672 0 : }
1673 0 : static inline int fd_vote_epoch_credits_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1674 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1675 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
1676 0 : return 0;
1677 0 : }
1678 0 : static void fd_vote_epoch_credits_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1679 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)struct_mem;
1680 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1681 0 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
1682 0 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
1683 0 : }
1684 0 : void * fd_vote_epoch_credits_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1685 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)mem;
1686 0 : fd_vote_epoch_credits_new( self );
1687 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_epoch_credits_t);
1688 0 : void * * alloc_mem = &alloc_region;
1689 0 : fd_vote_epoch_credits_decode_inner( mem, alloc_mem, ctx );
1690 0 : return self;
1691 0 : }
1692 12 : int fd_vote_block_timestamp_encode( fd_vote_block_timestamp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1693 12 : int err;
1694 12 : err = fd_bincode_uint64_encode( self->slot, ctx );
1695 12 : if( FD_UNLIKELY( err ) ) return err;
1696 12 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
1697 12 : if( FD_UNLIKELY( err ) ) return err;
1698 12 : return FD_BINCODE_SUCCESS;
1699 12 : }
1700 0 : static inline int fd_vote_block_timestamp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1701 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1702 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
1703 0 : return 0;
1704 0 : }
1705 0 : static void fd_vote_block_timestamp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1706 0 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)struct_mem;
1707 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1708 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
1709 0 : }
1710 0 : void * fd_vote_block_timestamp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1711 0 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)mem;
1712 0 : fd_vote_block_timestamp_new( self );
1713 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_block_timestamp_t);
1714 0 : void * * alloc_mem = &alloc_region;
1715 0 : fd_vote_block_timestamp_decode_inner( mem, alloc_mem, ctx );
1716 0 : return self;
1717 0 : }
1718 12 : int fd_vote_prior_voters_encode( fd_vote_prior_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1719 12 : int err;
1720 396 : for( ulong i=0; i<32; i++ ) {
1721 384 : err = fd_vote_prior_voter_encode( self->buf + i, ctx );
1722 384 : if( FD_UNLIKELY( err ) ) return err;
1723 384 : }
1724 12 : err = fd_bincode_uint64_encode( self->idx, ctx );
1725 12 : if( FD_UNLIKELY( err ) ) return err;
1726 12 : err = fd_bincode_bool_encode( (uchar)(self->is_empty), ctx );
1727 12 : if( FD_UNLIKELY( err ) ) return err;
1728 12 : return FD_BINCODE_SUCCESS;
1729 12 : }
1730 0 : static int fd_vote_prior_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1731 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1732 0 : int err = 0;
1733 0 : for( ulong i=0; i<32; i++ ) {
1734 0 : err = fd_vote_prior_voter_decode_footprint_inner( ctx, total_sz );
1735 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1736 0 : }
1737 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1738 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1739 0 : err = fd_bincode_bool_decode_footprint( ctx );
1740 0 : if( FD_UNLIKELY( err ) ) return err;
1741 0 : return 0;
1742 0 : }
1743 0 : int fd_vote_prior_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1744 0 : *total_sz += sizeof(fd_vote_prior_voters_t);
1745 0 : void const * start_data = ctx->data;
1746 0 : int err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
1747 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1748 0 : ctx->data = start_data;
1749 0 : return err;
1750 0 : }
1751 0 : static void fd_vote_prior_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1752 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)struct_mem;
1753 0 : for( ulong i=0; i<32; i++ ) {
1754 0 : fd_vote_prior_voter_decode_inner( self->buf + i, alloc_mem, ctx );
1755 0 : }
1756 0 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
1757 0 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
1758 0 : }
1759 0 : void * fd_vote_prior_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1760 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)mem;
1761 0 : fd_vote_prior_voters_new( self );
1762 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_t);
1763 0 : void * * alloc_mem = &alloc_region;
1764 0 : fd_vote_prior_voters_decode_inner( mem, alloc_mem, ctx );
1765 0 : return self;
1766 0 : }
1767 12 : void fd_vote_prior_voters_new(fd_vote_prior_voters_t * self) {
1768 12 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_t) );
1769 396 : for( ulong i=0; i<32; i++ )
1770 384 : fd_vote_prior_voter_new( self->buf + i );
1771 12 : }
1772 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 ) {
1773 0 : int err;
1774 0 : for( ulong i=0; i<32; i++ ) {
1775 0 : err = fd_vote_prior_voter_0_23_5_encode( self->buf + i, ctx );
1776 0 : if( FD_UNLIKELY( err ) ) return err;
1777 0 : }
1778 0 : err = fd_bincode_uint64_encode( self->idx, ctx );
1779 0 : if( FD_UNLIKELY( err ) ) return err;
1780 0 : return FD_BINCODE_SUCCESS;
1781 0 : }
1782 0 : static inline int fd_vote_prior_voters_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1783 0 : if( (ulong)ctx->data + 1800UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1784 0 : ctx->data = (void *)( (ulong)ctx->data + 1800UL );
1785 0 : return 0;
1786 0 : }
1787 0 : static void fd_vote_prior_voters_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1788 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)struct_mem;
1789 0 : for( ulong i=0; i<32; i++ ) {
1790 0 : fd_vote_prior_voter_0_23_5_decode_inner( self->buf + i, alloc_mem, ctx );
1791 0 : }
1792 0 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
1793 0 : }
1794 0 : void * fd_vote_prior_voters_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1795 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)mem;
1796 0 : fd_vote_prior_voters_0_23_5_new( self );
1797 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_0_23_5_t);
1798 0 : void * * alloc_mem = &alloc_region;
1799 0 : fd_vote_prior_voters_0_23_5_decode_inner( mem, alloc_mem, ctx );
1800 0 : return self;
1801 0 : }
1802 0 : int fd_landed_vote_encode( fd_landed_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1803 0 : int err;
1804 0 : err = fd_bincode_uint8_encode( (uchar)(self->latency), ctx );
1805 0 : if( FD_UNLIKELY( err ) ) return err;
1806 0 : err = fd_vote_lockout_encode( &self->lockout, ctx );
1807 0 : if( FD_UNLIKELY( err ) ) return err;
1808 0 : return FD_BINCODE_SUCCESS;
1809 0 : }
1810 0 : static inline int fd_landed_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1811 0 : if( (ulong)ctx->data + 13UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1812 0 : ctx->data = (void *)( (ulong)ctx->data + 13UL );
1813 0 : return 0;
1814 0 : }
1815 0 : static void fd_landed_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1816 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)struct_mem;
1817 0 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
1818 0 : fd_vote_lockout_decode_inner( &self->lockout, alloc_mem, ctx );
1819 0 : }
1820 0 : void * fd_landed_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1821 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)mem;
1822 0 : fd_landed_vote_new( self );
1823 0 : void * alloc_region = (uchar *)mem + sizeof(fd_landed_vote_t);
1824 0 : void * * alloc_mem = &alloc_region;
1825 0 : fd_landed_vote_decode_inner( mem, alloc_mem, ctx );
1826 0 : return self;
1827 0 : }
1828 0 : int fd_bls_pubkey_compressed_encode( fd_bls_pubkey_compressed_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1829 0 : int err;
1830 0 : err = fd_bincode_bytes_encode( self->buf, 48, ctx );
1831 0 : if( FD_UNLIKELY( err ) ) return err;
1832 0 : return FD_BINCODE_SUCCESS;
1833 0 : }
1834 0 : static inline int fd_bls_pubkey_compressed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1835 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1836 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
1837 0 : return 0;
1838 0 : }
1839 0 : static void fd_bls_pubkey_compressed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1840 0 : fd_bls_pubkey_compressed_t * self = (fd_bls_pubkey_compressed_t *)struct_mem;
1841 0 : fd_bincode_bytes_decode_unsafe( self->buf, 48, ctx );
1842 0 : }
1843 0 : void * fd_bls_pubkey_compressed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1844 0 : fd_bls_pubkey_compressed_t * self = (fd_bls_pubkey_compressed_t *)mem;
1845 0 : fd_bls_pubkey_compressed_new( self );
1846 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bls_pubkey_compressed_t);
1847 0 : void * * alloc_mem = &alloc_region;
1848 0 : fd_bls_pubkey_compressed_decode_inner( mem, alloc_mem, ctx );
1849 0 : return self;
1850 0 : }
1851 0 : int fd_vote_state_0_23_5_encode( fd_vote_state_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1852 0 : int err;
1853 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
1854 0 : if( FD_UNLIKELY( err ) ) return err;
1855 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
1856 0 : if( FD_UNLIKELY( err ) ) return err;
1857 0 : err = fd_bincode_uint64_encode( self->authorized_voter_epoch, ctx );
1858 0 : if( FD_UNLIKELY( err ) ) return err;
1859 0 : err = fd_vote_prior_voters_0_23_5_encode( &self->prior_voters, ctx );
1860 0 : if( FD_UNLIKELY( err ) ) return err;
1861 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
1862 0 : if( FD_UNLIKELY( err ) ) return err;
1863 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
1864 0 : if( FD_UNLIKELY( err ) ) return err;
1865 0 : if( self->votes ) {
1866 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
1867 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
1868 0 : if( FD_UNLIKELY( err ) ) return err;
1869 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 ) ) {
1870 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
1871 0 : err = fd_vote_lockout_encode( ele, ctx );
1872 0 : if( FD_UNLIKELY( err ) ) return err;
1873 0 : }
1874 0 : } else {
1875 0 : ulong votes_len = 0;
1876 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
1877 0 : if( FD_UNLIKELY( err ) ) return err;
1878 0 : }
1879 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
1880 0 : if( FD_UNLIKELY( err ) ) return err;
1881 0 : if( self->has_root_slot ) {
1882 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
1883 0 : if( FD_UNLIKELY( err ) ) return err;
1884 0 : }
1885 0 : if( self->epoch_credits ) {
1886 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
1887 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
1888 0 : if( FD_UNLIKELY( err ) ) return err;
1889 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 ) ) {
1890 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
1891 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
1892 0 : if( FD_UNLIKELY( err ) ) return err;
1893 0 : }
1894 0 : } else {
1895 0 : ulong epoch_credits_len = 0;
1896 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
1897 0 : if( FD_UNLIKELY( err ) ) return err;
1898 0 : }
1899 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
1900 0 : if( FD_UNLIKELY( err ) ) return err;
1901 0 : return FD_BINCODE_SUCCESS;
1902 0 : }
1903 0 : static int fd_vote_state_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1904 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1905 0 : int err = 0;
1906 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1907 0 : if( FD_UNLIKELY( err ) ) return err;
1908 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1909 0 : if( FD_UNLIKELY( err ) ) return err;
1910 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1911 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1912 0 : err = fd_vote_prior_voters_0_23_5_decode_footprint_inner( ctx, total_sz );
1913 0 : if( FD_UNLIKELY( err ) ) return err;
1914 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1915 0 : if( FD_UNLIKELY( err ) ) return err;
1916 0 : err = fd_bincode_uint8_decode_footprint( ctx );
1917 0 : if( FD_UNLIKELY( err ) ) return err;
1918 0 : ulong votes_len;
1919 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
1920 0 : if( FD_UNLIKELY( err ) ) return err;
1921 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
1922 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
1923 0 : ulong votes_sz;
1924 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
1925 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
1926 0 : if( FD_UNLIKELY( err ) ) return err;
1927 0 : {
1928 0 : uchar o;
1929 0 : err = fd_bincode_bool_decode( &o, ctx );
1930 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1931 0 : if( o ) {
1932 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1933 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1934 0 : }
1935 0 : }
1936 0 : ulong epoch_credits_len;
1937 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
1938 0 : if( FD_UNLIKELY( err ) ) return err;
1939 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
1940 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
1941 0 : ulong epoch_credits_sz;
1942 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
1943 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
1944 0 : if( FD_UNLIKELY( err ) ) return err;
1945 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
1946 0 : if( FD_UNLIKELY( err ) ) return err;
1947 0 : return 0;
1948 0 : }
1949 0 : int fd_vote_state_0_23_5_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1950 0 : *total_sz += sizeof(fd_vote_state_0_23_5_t);
1951 0 : void const * start_data = ctx->data;
1952 0 : int err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
1953 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1954 0 : ctx->data = start_data;
1955 0 : return err;
1956 0 : }
1957 0 : static void fd_vote_state_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1958 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)struct_mem;
1959 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
1960 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
1961 0 : fd_bincode_uint64_decode_unsafe( &self->authorized_voter_epoch, ctx );
1962 0 : fd_vote_prior_voters_0_23_5_decode_inner( &self->prior_voters, alloc_mem, ctx );
1963 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
1964 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
1965 0 : ulong votes_len;
1966 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
1967 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
1968 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
1969 0 : for( ulong i=0; i < votes_len; i++ ) {
1970 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
1971 0 : fd_vote_lockout_new( elem );
1972 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
1973 0 : }
1974 0 : {
1975 0 : uchar o;
1976 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
1977 0 : self->has_root_slot = !!o;
1978 0 : if( o ) {
1979 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
1980 0 : }
1981 0 : }
1982 0 : ulong epoch_credits_len;
1983 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
1984 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
1985 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
1986 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
1987 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
1988 0 : fd_vote_epoch_credits_new( elem );
1989 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
1990 0 : }
1991 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
1992 0 : }
1993 0 : void * fd_vote_state_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1994 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)mem;
1995 0 : fd_vote_state_0_23_5_new( self );
1996 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_0_23_5_t);
1997 0 : void * * alloc_mem = &alloc_region;
1998 0 : fd_vote_state_0_23_5_decode_inner( mem, alloc_mem, ctx );
1999 0 : return self;
2000 0 : }
2001 0 : void fd_vote_state_0_23_5_new(fd_vote_state_0_23_5_t * self) {
2002 0 : fd_memset( self, 0, sizeof(fd_vote_state_0_23_5_t) );
2003 0 : fd_pubkey_new( &self->node_pubkey );
2004 0 : fd_pubkey_new( &self->authorized_voter );
2005 0 : fd_vote_prior_voters_0_23_5_new( &self->prior_voters );
2006 0 : fd_pubkey_new( &self->authorized_withdrawer );
2007 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2008 0 : }
2009 0 : ulong fd_vote_state_0_23_5_size( fd_vote_state_0_23_5_t const * self ) {
2010 0 : ulong size = 0;
2011 0 : size += fd_pubkey_size( &self->node_pubkey );
2012 0 : size += fd_pubkey_size( &self->authorized_voter );
2013 0 : size += sizeof(ulong);
2014 0 : size += fd_vote_prior_voters_0_23_5_size( &self->prior_voters );
2015 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
2016 0 : size += sizeof(char);
2017 0 : if( self->votes ) {
2018 0 : size += sizeof(ulong);
2019 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 ) ) {
2020 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2021 0 : size += fd_vote_lockout_size( ele );
2022 0 : }
2023 0 : } else {
2024 0 : size += sizeof(ulong);
2025 0 : }
2026 0 : size += sizeof(char);
2027 0 : if( self->has_root_slot ) {
2028 0 : size += sizeof(ulong);
2029 0 : }
2030 0 : if( self->epoch_credits ) {
2031 0 : size += sizeof(ulong);
2032 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 ) ) {
2033 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2034 0 : size += fd_vote_epoch_credits_size( ele );
2035 0 : }
2036 0 : } else {
2037 0 : size += sizeof(ulong);
2038 0 : }
2039 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2040 0 : return size;
2041 0 : }
2042 :
2043 12 : int fd_vote_authorized_voters_encode( fd_vote_authorized_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2044 12 : int err;
2045 12 : if( self->treap ) {
2046 12 : ulong fd_vote_authorized_voters_len = fd_vote_authorized_voters_treap_ele_cnt( self->treap );
2047 12 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2048 12 : if( FD_UNLIKELY( err ) ) return err;
2049 12 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2050 24 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2051 12 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2052 12 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2053 12 : err = fd_vote_authorized_voter_encode( ele, ctx );
2054 12 : if( FD_UNLIKELY( err ) ) return err;
2055 12 : }
2056 12 : } else {
2057 0 : ulong fd_vote_authorized_voters_len = 0;
2058 0 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2059 0 : if( FD_UNLIKELY( err ) ) return err;
2060 0 : }
2061 12 : return FD_BINCODE_SUCCESS;
2062 12 : }
2063 0 : static int fd_vote_authorized_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2064 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2065 0 : int err = 0;
2066 0 : ulong fd_vote_authorized_voters_treap_len;
2067 0 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
2068 0 : if( FD_UNLIKELY( err ) ) return err;
2069 0 : 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 );
2070 0 : *total_sz += fd_vote_authorized_voters_pool_align() + fd_vote_authorized_voters_pool_footprint( fd_vote_authorized_voters_treap_max );
2071 0 : *total_sz += fd_vote_authorized_voters_treap_align() + fd_vote_authorized_voters_treap_footprint( fd_vote_authorized_voters_treap_max );
2072 0 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2073 0 : err = fd_vote_authorized_voter_decode_footprint_inner( ctx, total_sz );
2074 0 : if( FD_UNLIKELY ( err ) ) return err;
2075 0 : }
2076 0 : return 0;
2077 0 : }
2078 0 : int fd_vote_authorized_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2079 0 : *total_sz += sizeof(fd_vote_authorized_voters_t);
2080 0 : void const * start_data = ctx->data;
2081 0 : int err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2082 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2083 0 : ctx->data = start_data;
2084 0 : return err;
2085 0 : }
2086 0 : static void fd_vote_authorized_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2087 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)struct_mem;
2088 0 : ulong fd_vote_authorized_voters_treap_len;
2089 0 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
2090 0 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
2091 0 : self->pool = fd_vote_authorized_voters_pool_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2092 0 : self->treap = fd_vote_authorized_voters_treap_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2093 0 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2094 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( self->pool );
2095 0 : fd_vote_authorized_voter_new( ele );
2096 0 : fd_vote_authorized_voter_decode_inner( ele, alloc_mem, ctx );
2097 0 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( self->treap, ele->epoch, self->pool );
2098 0 : if( repeated_entry ) {
2099 0 : fd_vote_authorized_voters_treap_ele_remove( self->treap, repeated_entry, self->pool ); // Remove the element before inserting it back to avoid duplication
2100 0 : fd_vote_authorized_voters_pool_ele_release( self->pool, repeated_entry );
2101 0 : }
2102 0 : fd_vote_authorized_voters_treap_ele_insert( self->treap, ele, self->pool ); /* this cannot fail */
2103 0 : }
2104 0 : }
2105 0 : void * fd_vote_authorized_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2106 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)mem;
2107 0 : fd_vote_authorized_voters_new( self );
2108 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voters_t);
2109 0 : void * * alloc_mem = &alloc_region;
2110 0 : fd_vote_authorized_voters_decode_inner( mem, alloc_mem, ctx );
2111 0 : return self;
2112 0 : }
2113 12 : void fd_vote_authorized_voters_new(fd_vote_authorized_voters_t * self) {
2114 12 : fd_memset( self, 0, sizeof(fd_vote_authorized_voters_t) );
2115 12 : }
2116 0 : ulong fd_vote_authorized_voters_size( fd_vote_authorized_voters_t const * self ) {
2117 0 : ulong size = 0;
2118 0 : size += sizeof(ulong);
2119 0 : if( self->treap ) {
2120 0 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2121 0 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2122 0 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2123 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2124 0 : size += fd_vote_authorized_voter_size( ele );
2125 0 : }
2126 0 : }
2127 0 : return size;
2128 0 : }
2129 :
2130 0 : int fd_vote_state_1_14_11_encode( fd_vote_state_1_14_11_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2131 0 : int err;
2132 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2133 0 : if( FD_UNLIKELY( err ) ) return err;
2134 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2135 0 : if( FD_UNLIKELY( err ) ) return err;
2136 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2137 0 : if( FD_UNLIKELY( err ) ) return err;
2138 0 : if( self->votes ) {
2139 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
2140 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2141 0 : if( FD_UNLIKELY( err ) ) return err;
2142 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 ) ) {
2143 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
2144 0 : err = fd_vote_lockout_encode( ele, ctx );
2145 0 : if( FD_UNLIKELY( err ) ) return err;
2146 0 : }
2147 0 : } else {
2148 0 : ulong votes_len = 0;
2149 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2150 0 : if( FD_UNLIKELY( err ) ) return err;
2151 0 : }
2152 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2153 0 : if( FD_UNLIKELY( err ) ) return err;
2154 0 : if( self->has_root_slot ) {
2155 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2156 0 : if( FD_UNLIKELY( err ) ) return err;
2157 0 : }
2158 0 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2159 0 : if( FD_UNLIKELY( err ) ) return err;
2160 0 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
2161 0 : if( FD_UNLIKELY( err ) ) return err;
2162 0 : if( self->epoch_credits ) {
2163 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2164 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2165 0 : if( FD_UNLIKELY( err ) ) return err;
2166 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 ) ) {
2167 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2168 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2169 0 : if( FD_UNLIKELY( err ) ) return err;
2170 0 : }
2171 0 : } else {
2172 0 : ulong epoch_credits_len = 0;
2173 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2174 0 : if( FD_UNLIKELY( err ) ) return err;
2175 0 : }
2176 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2177 0 : if( FD_UNLIKELY( err ) ) return err;
2178 0 : return FD_BINCODE_SUCCESS;
2179 0 : }
2180 0 : static int fd_vote_state_1_14_11_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2181 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2182 0 : int err = 0;
2183 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2184 0 : if( FD_UNLIKELY( err ) ) return err;
2185 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2186 0 : if( FD_UNLIKELY( err ) ) return err;
2187 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2188 0 : if( FD_UNLIKELY( err ) ) return err;
2189 0 : ulong votes_len;
2190 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2191 0 : if( FD_UNLIKELY( err ) ) return err;
2192 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2193 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
2194 0 : ulong votes_sz;
2195 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2196 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2197 0 : if( FD_UNLIKELY( err ) ) return err;
2198 0 : {
2199 0 : uchar o;
2200 0 : err = fd_bincode_bool_decode( &o, ctx );
2201 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2202 0 : if( o ) {
2203 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2204 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2205 0 : }
2206 0 : }
2207 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2208 0 : if( FD_UNLIKELY( err ) ) return err;
2209 0 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2210 0 : if( FD_UNLIKELY( err ) ) return err;
2211 0 : ulong epoch_credits_len;
2212 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2213 0 : if( FD_UNLIKELY( err ) ) return err;
2214 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2215 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2216 0 : ulong epoch_credits_sz;
2217 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2218 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2219 0 : if( FD_UNLIKELY( err ) ) return err;
2220 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2221 0 : if( FD_UNLIKELY( err ) ) return err;
2222 0 : return 0;
2223 0 : }
2224 0 : int fd_vote_state_1_14_11_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2225 0 : *total_sz += sizeof(fd_vote_state_1_14_11_t);
2226 0 : void const * start_data = ctx->data;
2227 0 : int err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
2228 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2229 0 : ctx->data = start_data;
2230 0 : return err;
2231 0 : }
2232 0 : static void fd_vote_state_1_14_11_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2233 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)struct_mem;
2234 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2235 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2236 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2237 0 : ulong votes_len;
2238 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2239 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2240 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
2241 0 : for( ulong i=0; i < votes_len; i++ ) {
2242 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
2243 0 : fd_vote_lockout_new( elem );
2244 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
2245 0 : }
2246 0 : {
2247 0 : uchar o;
2248 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2249 0 : self->has_root_slot = !!o;
2250 0 : if( o ) {
2251 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2252 0 : }
2253 0 : }
2254 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2255 0 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
2256 0 : ulong epoch_credits_len;
2257 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2258 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2259 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2260 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2261 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2262 0 : fd_vote_epoch_credits_new( elem );
2263 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2264 0 : }
2265 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2266 0 : }
2267 0 : void * fd_vote_state_1_14_11_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2268 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)mem;
2269 0 : fd_vote_state_1_14_11_new( self );
2270 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_1_14_11_t);
2271 0 : void * * alloc_mem = &alloc_region;
2272 0 : fd_vote_state_1_14_11_decode_inner( mem, alloc_mem, ctx );
2273 0 : return self;
2274 0 : }
2275 0 : void fd_vote_state_1_14_11_new(fd_vote_state_1_14_11_t * self) {
2276 0 : fd_memset( self, 0, sizeof(fd_vote_state_1_14_11_t) );
2277 0 : fd_pubkey_new( &self->node_pubkey );
2278 0 : fd_pubkey_new( &self->authorized_withdrawer );
2279 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
2280 0 : fd_vote_prior_voters_new( &self->prior_voters );
2281 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2282 0 : }
2283 0 : ulong fd_vote_state_1_14_11_size( fd_vote_state_1_14_11_t const * self ) {
2284 0 : ulong size = 0;
2285 0 : size += fd_pubkey_size( &self->node_pubkey );
2286 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
2287 0 : size += sizeof(char);
2288 0 : if( self->votes ) {
2289 0 : size += sizeof(ulong);
2290 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 ) ) {
2291 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2292 0 : size += fd_vote_lockout_size( ele );
2293 0 : }
2294 0 : } else {
2295 0 : size += sizeof(ulong);
2296 0 : }
2297 0 : size += sizeof(char);
2298 0 : if( self->has_root_slot ) {
2299 0 : size += sizeof(ulong);
2300 0 : }
2301 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2302 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
2303 0 : if( self->epoch_credits ) {
2304 0 : size += sizeof(ulong);
2305 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 ) ) {
2306 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2307 0 : size += fd_vote_epoch_credits_size( ele );
2308 0 : }
2309 0 : } else {
2310 0 : size += sizeof(ulong);
2311 0 : }
2312 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2313 0 : return size;
2314 0 : }
2315 :
2316 12 : int fd_vote_state_v3_encode( fd_vote_state_v3_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2317 12 : int err;
2318 12 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2319 12 : if( FD_UNLIKELY( err ) ) return err;
2320 12 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2321 12 : if( FD_UNLIKELY( err ) ) return err;
2322 12 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2323 12 : if( FD_UNLIKELY( err ) ) return err;
2324 12 : if( self->votes ) {
2325 0 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
2326 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2327 0 : if( FD_UNLIKELY( err ) ) return err;
2328 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 ) ) {
2329 0 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
2330 0 : err = fd_landed_vote_encode( ele, ctx );
2331 0 : if( FD_UNLIKELY( err ) ) return err;
2332 0 : }
2333 12 : } else {
2334 12 : ulong votes_len = 0;
2335 12 : err = fd_bincode_uint64_encode( votes_len, ctx );
2336 12 : if( FD_UNLIKELY( err ) ) return err;
2337 12 : }
2338 12 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2339 12 : if( FD_UNLIKELY( err ) ) return err;
2340 12 : if( self->has_root_slot ) {
2341 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2342 0 : if( FD_UNLIKELY( err ) ) return err;
2343 0 : }
2344 12 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2345 12 : if( FD_UNLIKELY( err ) ) return err;
2346 12 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
2347 12 : if( FD_UNLIKELY( err ) ) return err;
2348 12 : if( self->epoch_credits ) {
2349 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2350 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2351 0 : if( FD_UNLIKELY( err ) ) return err;
2352 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 ) ) {
2353 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2354 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2355 0 : if( FD_UNLIKELY( err ) ) return err;
2356 0 : }
2357 12 : } else {
2358 12 : ulong epoch_credits_len = 0;
2359 12 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2360 12 : if( FD_UNLIKELY( err ) ) return err;
2361 12 : }
2362 12 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2363 12 : if( FD_UNLIKELY( err ) ) return err;
2364 12 : return FD_BINCODE_SUCCESS;
2365 12 : }
2366 0 : static int fd_vote_state_v3_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2367 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2368 0 : int err = 0;
2369 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2370 0 : if( FD_UNLIKELY( err ) ) return err;
2371 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2372 0 : if( FD_UNLIKELY( err ) ) return err;
2373 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2374 0 : if( FD_UNLIKELY( err ) ) return err;
2375 0 : ulong votes_len;
2376 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2377 0 : if( FD_UNLIKELY( err ) ) return err;
2378 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2379 0 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
2380 0 : ulong votes_sz;
2381 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2382 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2383 0 : if( FD_UNLIKELY( err ) ) return err;
2384 0 : {
2385 0 : uchar o;
2386 0 : err = fd_bincode_bool_decode( &o, ctx );
2387 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2388 0 : if( o ) {
2389 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2390 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2391 0 : }
2392 0 : }
2393 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2394 0 : if( FD_UNLIKELY( err ) ) return err;
2395 0 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2396 0 : if( FD_UNLIKELY( err ) ) return err;
2397 0 : ulong epoch_credits_len;
2398 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2399 0 : if( FD_UNLIKELY( err ) ) return err;
2400 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2401 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2402 0 : ulong epoch_credits_sz;
2403 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2404 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2405 0 : if( FD_UNLIKELY( err ) ) return err;
2406 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2407 0 : if( FD_UNLIKELY( err ) ) return err;
2408 0 : return 0;
2409 0 : }
2410 0 : int fd_vote_state_v3_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2411 0 : *total_sz += sizeof(fd_vote_state_v3_t);
2412 0 : void const * start_data = ctx->data;
2413 0 : int err = fd_vote_state_v3_decode_footprint_inner( ctx, total_sz );
2414 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2415 0 : ctx->data = start_data;
2416 0 : return err;
2417 0 : }
2418 0 : static void fd_vote_state_v3_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2419 0 : fd_vote_state_v3_t * self = (fd_vote_state_v3_t *)struct_mem;
2420 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2421 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2422 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2423 0 : ulong votes_len;
2424 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2425 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2426 0 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
2427 0 : for( ulong i=0; i < votes_len; i++ ) {
2428 0 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
2429 0 : fd_landed_vote_new( elem );
2430 0 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
2431 0 : }
2432 0 : {
2433 0 : uchar o;
2434 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2435 0 : self->has_root_slot = !!o;
2436 0 : if( o ) {
2437 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2438 0 : }
2439 0 : }
2440 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2441 0 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
2442 0 : ulong epoch_credits_len;
2443 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2444 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2445 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2446 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2447 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2448 0 : fd_vote_epoch_credits_new( elem );
2449 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2450 0 : }
2451 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2452 0 : }
2453 0 : void * fd_vote_state_v3_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2454 0 : fd_vote_state_v3_t * self = (fd_vote_state_v3_t *)mem;
2455 0 : fd_vote_state_v3_new( self );
2456 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_v3_t);
2457 0 : void * * alloc_mem = &alloc_region;
2458 0 : fd_vote_state_v3_decode_inner( mem, alloc_mem, ctx );
2459 0 : return self;
2460 0 : }
2461 12 : void fd_vote_state_v3_new(fd_vote_state_v3_t * self) {
2462 12 : fd_memset( self, 0, sizeof(fd_vote_state_v3_t) );
2463 12 : fd_pubkey_new( &self->node_pubkey );
2464 12 : fd_pubkey_new( &self->authorized_withdrawer );
2465 12 : fd_vote_authorized_voters_new( &self->authorized_voters );
2466 12 : fd_vote_prior_voters_new( &self->prior_voters );
2467 12 : fd_vote_block_timestamp_new( &self->last_timestamp );
2468 12 : }
2469 0 : ulong fd_vote_state_v3_size( fd_vote_state_v3_t const * self ) {
2470 0 : ulong size = 0;
2471 0 : size += fd_pubkey_size( &self->node_pubkey );
2472 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
2473 0 : size += sizeof(char);
2474 0 : if( self->votes ) {
2475 0 : size += sizeof(ulong);
2476 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 ) ) {
2477 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
2478 0 : size += fd_landed_vote_size( ele );
2479 0 : }
2480 0 : } else {
2481 0 : size += sizeof(ulong);
2482 0 : }
2483 0 : size += sizeof(char);
2484 0 : if( self->has_root_slot ) {
2485 0 : size += sizeof(ulong);
2486 0 : }
2487 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2488 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
2489 0 : if( self->epoch_credits ) {
2490 0 : size += sizeof(ulong);
2491 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 ) ) {
2492 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2493 0 : size += fd_vote_epoch_credits_size( ele );
2494 0 : }
2495 0 : } else {
2496 0 : size += sizeof(ulong);
2497 0 : }
2498 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2499 0 : return size;
2500 0 : }
2501 :
2502 0 : int fd_vote_state_v4_encode( fd_vote_state_v4_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2503 0 : int err;
2504 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2505 0 : if( FD_UNLIKELY( err ) ) return err;
2506 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2507 0 : if( FD_UNLIKELY( err ) ) return err;
2508 0 : err = fd_pubkey_encode( &self->inflation_rewards_collector, ctx );
2509 0 : if( FD_UNLIKELY( err ) ) return err;
2510 0 : err = fd_pubkey_encode( &self->block_revenue_collector, ctx );
2511 0 : if( FD_UNLIKELY( err ) ) return err;
2512 0 : err = fd_bincode_uint16_encode( self->inflation_rewards_commission_bps, ctx );
2513 0 : if( FD_UNLIKELY( err ) ) return err;
2514 0 : err = fd_bincode_uint16_encode( self->block_revenue_commission_bps, ctx );
2515 0 : if( FD_UNLIKELY( err ) ) return err;
2516 0 : err = fd_bincode_uint64_encode( self->pending_delegator_rewards, ctx );
2517 0 : if( FD_UNLIKELY( err ) ) return err;
2518 0 : err = fd_bincode_bool_encode( self->has_bls_pubkey_compressed, ctx );
2519 0 : if( FD_UNLIKELY( err ) ) return err;
2520 0 : if( self->has_bls_pubkey_compressed ) {
2521 0 : err = fd_bls_pubkey_compressed_encode( &self->bls_pubkey_compressed, ctx );
2522 0 : if( FD_UNLIKELY( err ) ) return err;
2523 0 : }
2524 0 : if( self->votes ) {
2525 0 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
2526 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2527 0 : if( FD_UNLIKELY( err ) ) return err;
2528 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 ) ) {
2529 0 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
2530 0 : err = fd_landed_vote_encode( ele, ctx );
2531 0 : if( FD_UNLIKELY( err ) ) return err;
2532 0 : }
2533 0 : } else {
2534 0 : ulong votes_len = 0;
2535 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2536 0 : if( FD_UNLIKELY( err ) ) return err;
2537 0 : }
2538 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2539 0 : if( FD_UNLIKELY( err ) ) return err;
2540 0 : if( self->has_root_slot ) {
2541 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2542 0 : if( FD_UNLIKELY( err ) ) return err;
2543 0 : }
2544 0 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2545 0 : if( FD_UNLIKELY( err ) ) return err;
2546 0 : if( self->epoch_credits ) {
2547 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2548 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2549 0 : if( FD_UNLIKELY( err ) ) return err;
2550 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 ) ) {
2551 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2552 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2553 0 : if( FD_UNLIKELY( err ) ) return err;
2554 0 : }
2555 0 : } else {
2556 0 : ulong epoch_credits_len = 0;
2557 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2558 0 : if( FD_UNLIKELY( err ) ) return err;
2559 0 : }
2560 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2561 0 : if( FD_UNLIKELY( err ) ) return err;
2562 0 : return FD_BINCODE_SUCCESS;
2563 0 : }
2564 0 : static int fd_vote_state_v4_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2565 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2566 0 : int err = 0;
2567 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2568 0 : if( FD_UNLIKELY( err ) ) return err;
2569 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2570 0 : if( FD_UNLIKELY( err ) ) return err;
2571 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2572 0 : if( FD_UNLIKELY( err ) ) return err;
2573 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2574 0 : if( FD_UNLIKELY( err ) ) return err;
2575 0 : err = fd_bincode_uint16_decode_footprint( ctx );
2576 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2577 0 : err = fd_bincode_uint16_decode_footprint( ctx );
2578 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2579 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2580 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2581 0 : {
2582 0 : uchar o;
2583 0 : err = fd_bincode_bool_decode( &o, ctx );
2584 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2585 0 : if( o ) {
2586 0 : err = fd_bls_pubkey_compressed_decode_footprint_inner( ctx, total_sz );
2587 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2588 0 : }
2589 0 : }
2590 0 : ulong votes_len;
2591 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2592 0 : if( FD_UNLIKELY( err ) ) return err;
2593 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2594 0 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
2595 0 : ulong votes_sz;
2596 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2597 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2598 0 : if( FD_UNLIKELY( err ) ) return err;
2599 0 : {
2600 0 : uchar o;
2601 0 : err = fd_bincode_bool_decode( &o, ctx );
2602 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2603 0 : if( o ) {
2604 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2605 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2606 0 : }
2607 0 : }
2608 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2609 0 : if( FD_UNLIKELY( err ) ) return err;
2610 0 : ulong epoch_credits_len;
2611 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2612 0 : if( FD_UNLIKELY( err ) ) return err;
2613 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2614 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2615 0 : ulong epoch_credits_sz;
2616 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2617 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2618 0 : if( FD_UNLIKELY( err ) ) return err;
2619 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2620 0 : if( FD_UNLIKELY( err ) ) return err;
2621 0 : return 0;
2622 0 : }
2623 0 : int fd_vote_state_v4_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2624 0 : *total_sz += sizeof(fd_vote_state_v4_t);
2625 0 : void const * start_data = ctx->data;
2626 0 : int err = fd_vote_state_v4_decode_footprint_inner( ctx, total_sz );
2627 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2628 0 : ctx->data = start_data;
2629 0 : return err;
2630 0 : }
2631 0 : static void fd_vote_state_v4_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2632 0 : fd_vote_state_v4_t * self = (fd_vote_state_v4_t *)struct_mem;
2633 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2634 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2635 0 : fd_pubkey_decode_inner( &self->inflation_rewards_collector, alloc_mem, ctx );
2636 0 : fd_pubkey_decode_inner( &self->block_revenue_collector, alloc_mem, ctx );
2637 0 : fd_bincode_uint16_decode_unsafe( &self->inflation_rewards_commission_bps, ctx );
2638 0 : fd_bincode_uint16_decode_unsafe( &self->block_revenue_commission_bps, ctx );
2639 0 : fd_bincode_uint64_decode_unsafe( &self->pending_delegator_rewards, ctx );
2640 0 : {
2641 0 : uchar o;
2642 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2643 0 : self->has_bls_pubkey_compressed = !!o;
2644 0 : if( o ) {
2645 0 : fd_bls_pubkey_compressed_new( &self->bls_pubkey_compressed );
2646 0 : fd_bls_pubkey_compressed_decode_inner( &self->bls_pubkey_compressed, alloc_mem, ctx );
2647 0 : }
2648 0 : }
2649 0 : ulong votes_len;
2650 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2651 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2652 0 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
2653 0 : for( ulong i=0; i < votes_len; i++ ) {
2654 0 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
2655 0 : fd_landed_vote_new( elem );
2656 0 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
2657 0 : }
2658 0 : {
2659 0 : uchar o;
2660 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2661 0 : self->has_root_slot = !!o;
2662 0 : if( o ) {
2663 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2664 0 : }
2665 0 : }
2666 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2667 0 : ulong epoch_credits_len;
2668 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2669 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2670 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2671 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2672 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2673 0 : fd_vote_epoch_credits_new( elem );
2674 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2675 0 : }
2676 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2677 0 : }
2678 0 : void * fd_vote_state_v4_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2679 0 : fd_vote_state_v4_t * self = (fd_vote_state_v4_t *)mem;
2680 0 : fd_vote_state_v4_new( self );
2681 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_v4_t);
2682 0 : void * * alloc_mem = &alloc_region;
2683 0 : fd_vote_state_v4_decode_inner( mem, alloc_mem, ctx );
2684 0 : return self;
2685 0 : }
2686 0 : void fd_vote_state_v4_new(fd_vote_state_v4_t * self) {
2687 0 : fd_memset( self, 0, sizeof(fd_vote_state_v4_t) );
2688 0 : fd_pubkey_new( &self->node_pubkey );
2689 0 : fd_pubkey_new( &self->authorized_withdrawer );
2690 0 : fd_pubkey_new( &self->inflation_rewards_collector );
2691 0 : fd_pubkey_new( &self->block_revenue_collector );
2692 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
2693 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2694 0 : }
2695 0 : ulong fd_vote_state_v4_size( fd_vote_state_v4_t const * self ) {
2696 0 : ulong size = 0;
2697 0 : size += fd_pubkey_size( &self->node_pubkey );
2698 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
2699 0 : size += fd_pubkey_size( &self->inflation_rewards_collector );
2700 0 : size += fd_pubkey_size( &self->block_revenue_collector );
2701 0 : size += sizeof(ushort);
2702 0 : size += sizeof(ushort);
2703 0 : size += sizeof(ulong);
2704 0 : size += sizeof(char);
2705 0 : if( self->has_bls_pubkey_compressed ) {
2706 0 : size += fd_bls_pubkey_compressed_size( &self->bls_pubkey_compressed );
2707 0 : }
2708 0 : if( self->votes ) {
2709 0 : size += sizeof(ulong);
2710 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 ) ) {
2711 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
2712 0 : size += fd_landed_vote_size( ele );
2713 0 : }
2714 0 : } else {
2715 0 : size += sizeof(ulong);
2716 0 : }
2717 0 : size += sizeof(char);
2718 0 : if( self->has_root_slot ) {
2719 0 : size += sizeof(ulong);
2720 0 : }
2721 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2722 0 : if( self->epoch_credits ) {
2723 0 : size += sizeof(ulong);
2724 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 ) ) {
2725 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2726 0 : size += fd_vote_epoch_credits_size( ele );
2727 0 : }
2728 0 : } else {
2729 0 : size += sizeof(ulong);
2730 0 : }
2731 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2732 0 : return size;
2733 0 : }
2734 :
2735 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v0_23_5(fd_vote_state_versioned_t const * self) {
2736 0 : return self->discriminant == 0;
2737 0 : }
2738 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v1_14_11(fd_vote_state_versioned_t const * self) {
2739 0 : return self->discriminant == 1;
2740 0 : }
2741 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v3(fd_vote_state_versioned_t const * self) {
2742 0 : return self->discriminant == 2;
2743 0 : }
2744 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v4(fd_vote_state_versioned_t const * self) {
2745 0 : return self->discriminant == 3;
2746 0 : }
2747 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant );
2748 0 : int fd_vote_state_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2749 0 : int err;
2750 0 : switch (discriminant) {
2751 0 : case 0: {
2752 0 : err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
2753 0 : if( FD_UNLIKELY( err ) ) return err;
2754 0 : return FD_BINCODE_SUCCESS;
2755 0 : }
2756 0 : case 1: {
2757 0 : err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
2758 0 : if( FD_UNLIKELY( err ) ) return err;
2759 0 : return FD_BINCODE_SUCCESS;
2760 0 : }
2761 0 : case 2: {
2762 0 : err = fd_vote_state_v3_decode_footprint_inner( ctx, total_sz );
2763 0 : if( FD_UNLIKELY( err ) ) return err;
2764 0 : return FD_BINCODE_SUCCESS;
2765 0 : }
2766 0 : case 3: {
2767 0 : err = fd_vote_state_v4_decode_footprint_inner( ctx, total_sz );
2768 0 : if( FD_UNLIKELY( err ) ) return err;
2769 0 : return FD_BINCODE_SUCCESS;
2770 0 : }
2771 0 : default: return FD_BINCODE_ERR_ENCODING;
2772 0 : }
2773 0 : }
2774 0 : static int fd_vote_state_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2775 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2776 0 : uint discriminant = 0;
2777 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
2778 0 : if( FD_UNLIKELY( err ) ) return err;
2779 0 : return fd_vote_state_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
2780 0 : }
2781 0 : int fd_vote_state_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2782 0 : *total_sz += sizeof(fd_vote_state_versioned_t);
2783 0 : void const * start_data = ctx->data;
2784 0 : int err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
2785 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2786 0 : ctx->data = start_data;
2787 0 : return err;
2788 0 : }
2789 0 : 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 ) {
2790 0 : switch (discriminant) {
2791 0 : case 0: {
2792 0 : fd_vote_state_0_23_5_decode_inner( &self->v0_23_5, alloc_mem, ctx );
2793 0 : break;
2794 0 : }
2795 0 : case 1: {
2796 0 : fd_vote_state_1_14_11_decode_inner( &self->v1_14_11, alloc_mem, ctx );
2797 0 : break;
2798 0 : }
2799 0 : case 2: {
2800 0 : fd_vote_state_v3_decode_inner( &self->v3, alloc_mem, ctx );
2801 0 : break;
2802 0 : }
2803 0 : case 3: {
2804 0 : fd_vote_state_v4_decode_inner( &self->v4, alloc_mem, ctx );
2805 0 : break;
2806 0 : }
2807 0 : }
2808 0 : }
2809 0 : static void fd_vote_state_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2810 0 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)struct_mem;
2811 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
2812 0 : fd_vote_state_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
2813 0 : }
2814 0 : void * fd_vote_state_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2815 0 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)mem;
2816 0 : fd_vote_state_versioned_new( self );
2817 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_versioned_t);
2818 0 : void * * alloc_mem = &alloc_region;
2819 0 : fd_vote_state_versioned_decode_inner( mem, alloc_mem, ctx );
2820 0 : return self;
2821 0 : }
2822 12 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
2823 12 : switch( discriminant ) {
2824 0 : case 0: {
2825 0 : fd_vote_state_0_23_5_new( &self->v0_23_5 );
2826 0 : break;
2827 0 : }
2828 0 : case 1: {
2829 0 : fd_vote_state_1_14_11_new( &self->v1_14_11 );
2830 0 : break;
2831 0 : }
2832 12 : case 2: {
2833 12 : fd_vote_state_v3_new( &self->v3 );
2834 12 : break;
2835 0 : }
2836 0 : case 3: {
2837 0 : fd_vote_state_v4_new( &self->v4 );
2838 0 : break;
2839 0 : }
2840 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
2841 12 : }
2842 12 : }
2843 12 : void fd_vote_state_versioned_new_disc( fd_vote_state_versioned_t * self, uint discriminant ) {
2844 12 : self->discriminant = discriminant;
2845 12 : fd_vote_state_versioned_inner_new( &self->inner, self->discriminant );
2846 12 : }
2847 0 : void fd_vote_state_versioned_new( fd_vote_state_versioned_t * self ) {
2848 0 : fd_memset( self, 0, sizeof(fd_vote_state_versioned_t) );
2849 0 : fd_vote_state_versioned_new_disc( self, UINT_MAX );
2850 0 : }
2851 :
2852 0 : ulong fd_vote_state_versioned_size( fd_vote_state_versioned_t const * self ) {
2853 0 : ulong size = 0;
2854 0 : size += sizeof(uint);
2855 0 : switch (self->discriminant) {
2856 0 : case 0: {
2857 0 : size += fd_vote_state_0_23_5_size( &self->inner.v0_23_5 );
2858 0 : break;
2859 0 : }
2860 0 : case 1: {
2861 0 : size += fd_vote_state_1_14_11_size( &self->inner.v1_14_11 );
2862 0 : break;
2863 0 : }
2864 0 : case 2: {
2865 0 : size += fd_vote_state_v3_size( &self->inner.v3 );
2866 0 : break;
2867 0 : }
2868 0 : case 3: {
2869 0 : size += fd_vote_state_v4_size( &self->inner.v4 );
2870 0 : break;
2871 0 : }
2872 0 : }
2873 0 : return size;
2874 0 : }
2875 :
2876 12 : int fd_vote_state_versioned_inner_encode( fd_vote_state_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
2877 12 : int err;
2878 12 : switch (discriminant) {
2879 0 : case 0: {
2880 0 : err = fd_vote_state_0_23_5_encode( &self->v0_23_5, ctx );
2881 0 : if( FD_UNLIKELY( err ) ) return err;
2882 0 : break;
2883 0 : }
2884 0 : case 1: {
2885 0 : err = fd_vote_state_1_14_11_encode( &self->v1_14_11, ctx );
2886 0 : if( FD_UNLIKELY( err ) ) return err;
2887 0 : break;
2888 0 : }
2889 12 : case 2: {
2890 12 : err = fd_vote_state_v3_encode( &self->v3, ctx );
2891 12 : if( FD_UNLIKELY( err ) ) return err;
2892 12 : break;
2893 12 : }
2894 12 : case 3: {
2895 0 : err = fd_vote_state_v4_encode( &self->v4, ctx );
2896 0 : if( FD_UNLIKELY( err ) ) return err;
2897 0 : break;
2898 0 : }
2899 12 : }
2900 12 : return FD_BINCODE_SUCCESS;
2901 12 : }
2902 12 : int fd_vote_state_versioned_encode( fd_vote_state_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2903 12 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
2904 12 : if( FD_UNLIKELY( err ) ) return err;
2905 12 : return fd_vote_state_versioned_inner_encode( &self->inner, self->discriminant, ctx );
2906 12 : }
2907 :
2908 0 : int fd_vote_state_update_encode( fd_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2909 0 : int err;
2910 0 : if( self->lockouts ) {
2911 0 : ulong lockouts_len = deq_fd_vote_lockout_t_cnt( self->lockouts );
2912 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
2913 0 : if( FD_UNLIKELY( err ) ) return err;
2914 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 ) ) {
2915 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->lockouts, iter );
2916 0 : err = fd_vote_lockout_encode( ele, ctx );
2917 0 : if( FD_UNLIKELY( err ) ) return err;
2918 0 : }
2919 0 : } else {
2920 0 : ulong lockouts_len = 0;
2921 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
2922 0 : if( FD_UNLIKELY( err ) ) return err;
2923 0 : }
2924 0 : err = fd_bincode_bool_encode( self->has_root, ctx );
2925 0 : if( FD_UNLIKELY( err ) ) return err;
2926 0 : if( self->has_root ) {
2927 0 : err = fd_bincode_uint64_encode( self->root, ctx );
2928 0 : if( FD_UNLIKELY( err ) ) return err;
2929 0 : }
2930 0 : err = fd_hash_encode( &self->hash, ctx );
2931 0 : if( FD_UNLIKELY( err ) ) return err;
2932 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
2933 0 : if( FD_UNLIKELY( err ) ) return err;
2934 0 : if( self->has_timestamp ) {
2935 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
2936 0 : if( FD_UNLIKELY( err ) ) return err;
2937 0 : }
2938 0 : return FD_BINCODE_SUCCESS;
2939 0 : }
2940 0 : static int fd_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2941 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2942 0 : int err = 0;
2943 0 : ulong lockouts_len;
2944 0 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
2945 0 : if( FD_UNLIKELY( err ) ) return err;
2946 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
2947 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( lockouts_max );
2948 0 : ulong lockouts_sz;
2949 0 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2950 0 : err = fd_bincode_bytes_decode_footprint( lockouts_sz, ctx );
2951 0 : if( FD_UNLIKELY( err ) ) return err;
2952 0 : {
2953 0 : uchar o;
2954 0 : err = fd_bincode_bool_decode( &o, ctx );
2955 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2956 0 : if( o ) {
2957 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2958 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2959 0 : }
2960 0 : }
2961 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
2962 0 : if( FD_UNLIKELY( err ) ) return err;
2963 0 : {
2964 0 : uchar o;
2965 0 : err = fd_bincode_bool_decode( &o, ctx );
2966 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2967 0 : if( o ) {
2968 0 : err = fd_bincode_int64_decode_footprint( ctx );
2969 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2970 0 : }
2971 0 : }
2972 0 : return 0;
2973 0 : }
2974 0 : int fd_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2975 0 : *total_sz += sizeof(fd_vote_state_update_t);
2976 0 : void const * start_data = ctx->data;
2977 0 : int err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
2978 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2979 0 : ctx->data = start_data;
2980 0 : return err;
2981 0 : }
2982 0 : static void fd_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2983 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)struct_mem;
2984 0 : ulong lockouts_len;
2985 0 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
2986 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
2987 0 : self->lockouts = deq_fd_vote_lockout_t_join_new( alloc_mem, lockouts_max );
2988 0 : for( ulong i=0; i < lockouts_len; i++ ) {
2989 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->lockouts );
2990 0 : fd_vote_lockout_new( elem );
2991 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
2992 0 : }
2993 0 : {
2994 0 : uchar o;
2995 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2996 0 : self->has_root = !!o;
2997 0 : if( o ) {
2998 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
2999 0 : }
3000 0 : }
3001 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3002 0 : {
3003 0 : uchar o;
3004 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3005 0 : self->has_timestamp = !!o;
3006 0 : if( o ) {
3007 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3008 0 : }
3009 0 : }
3010 0 : }
3011 0 : void * fd_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3012 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)mem;
3013 0 : fd_vote_state_update_new( self );
3014 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_update_t);
3015 0 : void * * alloc_mem = &alloc_region;
3016 0 : fd_vote_state_update_decode_inner( mem, alloc_mem, ctx );
3017 0 : return self;
3018 0 : }
3019 0 : void fd_vote_state_update_new(fd_vote_state_update_t * self) {
3020 0 : fd_memset( self, 0, sizeof(fd_vote_state_update_t) );
3021 0 : fd_hash_new( &self->hash );
3022 0 : }
3023 0 : ulong fd_vote_state_update_size( fd_vote_state_update_t const * self ) {
3024 0 : ulong size = 0;
3025 0 : if( self->lockouts ) {
3026 0 : size += sizeof(ulong);
3027 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 ) ) {
3028 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3029 0 : size += fd_vote_lockout_size( ele );
3030 0 : }
3031 0 : } else {
3032 0 : size += sizeof(ulong);
3033 0 : }
3034 0 : size += sizeof(char);
3035 0 : if( self->has_root ) {
3036 0 : size += sizeof(ulong);
3037 0 : }
3038 0 : size += fd_hash_size( &self->hash );
3039 0 : size += sizeof(char);
3040 0 : if( self->has_timestamp ) {
3041 0 : size += sizeof(long);
3042 0 : }
3043 0 : return size;
3044 0 : }
3045 :
3046 0 : int fd_compact_vote_state_update_encode( fd_compact_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3047 0 : int err;
3048 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3049 0 : if( FD_UNLIKELY( err ) ) return err;
3050 0 : err = fd_bincode_compact_u16_encode( &self->lockouts_len, ctx );
3051 0 : if( FD_UNLIKELY(err) ) return err;
3052 0 : if( self->lockouts_len ) {
3053 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3054 0 : err = fd_lockout_offset_encode( self->lockouts + i, ctx );
3055 0 : if( FD_UNLIKELY( err ) ) return err;
3056 0 : }
3057 0 : }
3058 0 : err = fd_hash_encode( &self->hash, ctx );
3059 0 : if( FD_UNLIKELY( err ) ) return err;
3060 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3061 0 : if( FD_UNLIKELY( err ) ) return err;
3062 0 : if( self->has_timestamp ) {
3063 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3064 0 : if( FD_UNLIKELY( err ) ) return err;
3065 0 : }
3066 0 : return FD_BINCODE_SUCCESS;
3067 0 : }
3068 0 : static int fd_compact_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3069 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3070 0 : int err = 0;
3071 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3072 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3073 0 : ushort lockouts_len;
3074 0 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
3075 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3076 0 : if( lockouts_len ) {
3077 0 : *total_sz += FD_LOCKOUT_OFFSET_ALIGN + sizeof(fd_lockout_offset_t)*lockouts_len;
3078 0 : for( ulong i=0; i < lockouts_len; i++ ) {
3079 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3080 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3081 0 : }
3082 0 : }
3083 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3084 0 : if( FD_UNLIKELY( err ) ) return err;
3085 0 : {
3086 0 : uchar o;
3087 0 : err = fd_bincode_bool_decode( &o, ctx );
3088 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3089 0 : if( o ) {
3090 0 : err = fd_bincode_int64_decode_footprint( ctx );
3091 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3092 0 : }
3093 0 : }
3094 0 : return 0;
3095 0 : }
3096 0 : int fd_compact_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3097 0 : *total_sz += sizeof(fd_compact_vote_state_update_t);
3098 0 : void const * start_data = ctx->data;
3099 0 : int err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3100 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3101 0 : ctx->data = start_data;
3102 0 : return err;
3103 0 : }
3104 0 : static void fd_compact_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3105 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)struct_mem;
3106 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3107 0 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
3108 0 : if( self->lockouts_len ) {
3109 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_LOCKOUT_OFFSET_ALIGN );
3110 0 : self->lockouts = *alloc_mem;
3111 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_lockout_offset_t)*self->lockouts_len;
3112 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3113 0 : fd_lockout_offset_new( self->lockouts + i );
3114 0 : fd_lockout_offset_decode_inner( self->lockouts + i, alloc_mem, ctx );
3115 0 : }
3116 0 : } else
3117 0 : self->lockouts = NULL;
3118 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3119 0 : {
3120 0 : uchar o;
3121 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3122 0 : self->has_timestamp = !!o;
3123 0 : if( o ) {
3124 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3125 0 : }
3126 0 : }
3127 0 : }
3128 0 : void * fd_compact_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3129 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)mem;
3130 0 : fd_compact_vote_state_update_new( self );
3131 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_t);
3132 0 : void * * alloc_mem = &alloc_region;
3133 0 : fd_compact_vote_state_update_decode_inner( mem, alloc_mem, ctx );
3134 0 : return self;
3135 0 : }
3136 0 : void fd_compact_vote_state_update_new(fd_compact_vote_state_update_t * self) {
3137 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_t) );
3138 0 : fd_hash_new( &self->hash );
3139 0 : }
3140 0 : ulong fd_compact_vote_state_update_size( fd_compact_vote_state_update_t const * self ) {
3141 0 : ulong size = 0;
3142 0 : size += sizeof(ulong);
3143 0 : do {
3144 0 : ushort tmp = (ushort)self->lockouts_len;
3145 0 : size += fd_bincode_compact_u16_size( &tmp );
3146 0 : for( ulong i=0; i < self->lockouts_len; i++ )
3147 0 : size += fd_lockout_offset_size( self->lockouts + i );
3148 0 : } while(0);
3149 0 : size += fd_hash_size( &self->hash );
3150 0 : size += sizeof(char);
3151 0 : if( self->has_timestamp ) {
3152 0 : size += sizeof(long);
3153 0 : }
3154 0 : return size;
3155 0 : }
3156 :
3157 0 : int fd_compact_vote_state_update_switch_encode( fd_compact_vote_state_update_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3158 0 : int err;
3159 0 : err = fd_compact_vote_state_update_encode( &self->compact_vote_state_update, ctx );
3160 0 : if( FD_UNLIKELY( err ) ) return err;
3161 0 : err = fd_hash_encode( &self->hash, ctx );
3162 0 : if( FD_UNLIKELY( err ) ) return err;
3163 0 : return FD_BINCODE_SUCCESS;
3164 0 : }
3165 0 : static int fd_compact_vote_state_update_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3166 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3167 0 : int err = 0;
3168 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3169 0 : if( FD_UNLIKELY( err ) ) return err;
3170 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3171 0 : if( FD_UNLIKELY( err ) ) return err;
3172 0 : return 0;
3173 0 : }
3174 0 : int fd_compact_vote_state_update_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3175 0 : *total_sz += sizeof(fd_compact_vote_state_update_switch_t);
3176 0 : void const * start_data = ctx->data;
3177 0 : int err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
3178 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3179 0 : ctx->data = start_data;
3180 0 : return err;
3181 0 : }
3182 0 : static void fd_compact_vote_state_update_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3183 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)struct_mem;
3184 0 : fd_compact_vote_state_update_decode_inner( &self->compact_vote_state_update, alloc_mem, ctx );
3185 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3186 0 : }
3187 0 : void * fd_compact_vote_state_update_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3188 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)mem;
3189 0 : fd_compact_vote_state_update_switch_new( self );
3190 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_switch_t);
3191 0 : void * * alloc_mem = &alloc_region;
3192 0 : fd_compact_vote_state_update_switch_decode_inner( mem, alloc_mem, ctx );
3193 0 : return self;
3194 0 : }
3195 0 : void fd_compact_vote_state_update_switch_new(fd_compact_vote_state_update_switch_t * self) {
3196 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_switch_t) );
3197 0 : fd_compact_vote_state_update_new( &self->compact_vote_state_update );
3198 0 : fd_hash_new( &self->hash );
3199 0 : }
3200 0 : ulong fd_compact_vote_state_update_switch_size( fd_compact_vote_state_update_switch_t const * self ) {
3201 0 : ulong size = 0;
3202 0 : size += fd_compact_vote_state_update_size( &self->compact_vote_state_update );
3203 0 : size += fd_hash_size( &self->hash );
3204 0 : return size;
3205 0 : }
3206 :
3207 0 : int fd_compact_tower_sync_encode( fd_compact_tower_sync_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3208 0 : int err;
3209 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3210 0 : if( FD_UNLIKELY( err ) ) return err;
3211 0 : if( self->lockout_offsets ) {
3212 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
3213 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3214 0 : if( FD_UNLIKELY( err ) ) return err;
3215 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 ) ) {
3216 0 : fd_lockout_offset_t const * ele = deq_fd_lockout_offset_t_iter_ele_const( self->lockout_offsets, iter );
3217 0 : err = fd_lockout_offset_encode( ele, ctx );
3218 0 : if( FD_UNLIKELY( err ) ) return err;
3219 0 : }
3220 0 : } else {
3221 0 : ushort lockout_offsets_len = 0;
3222 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3223 0 : if( FD_UNLIKELY( err ) ) return err;
3224 0 : }
3225 0 : err = fd_hash_encode( &self->hash, ctx );
3226 0 : if( FD_UNLIKELY( err ) ) return err;
3227 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3228 0 : if( FD_UNLIKELY( err ) ) return err;
3229 0 : if( self->has_timestamp ) {
3230 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3231 0 : if( FD_UNLIKELY( err ) ) return err;
3232 0 : }
3233 0 : err = fd_hash_encode( &self->block_id, ctx );
3234 0 : if( FD_UNLIKELY( err ) ) return err;
3235 0 : return FD_BINCODE_SUCCESS;
3236 0 : }
3237 0 : static int fd_compact_tower_sync_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3238 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3239 0 : int err = 0;
3240 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3241 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3242 0 : ushort lockout_offsets_len;
3243 0 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
3244 0 : if( FD_UNLIKELY( err ) ) return err;
3245 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
3246 0 : *total_sz += deq_fd_lockout_offset_t_align() + deq_fd_lockout_offset_t_footprint( lockout_offsets_max );
3247 0 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
3248 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3249 0 : if( FD_UNLIKELY( err ) ) return err;
3250 0 : }
3251 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3252 0 : if( FD_UNLIKELY( err ) ) return err;
3253 0 : {
3254 0 : uchar o;
3255 0 : err = fd_bincode_bool_decode( &o, ctx );
3256 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3257 0 : if( o ) {
3258 0 : err = fd_bincode_int64_decode_footprint( ctx );
3259 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3260 0 : }
3261 0 : }
3262 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3263 0 : if( FD_UNLIKELY( err ) ) return err;
3264 0 : return 0;
3265 0 : }
3266 0 : int fd_compact_tower_sync_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3267 0 : *total_sz += sizeof(fd_compact_tower_sync_t);
3268 0 : void const * start_data = ctx->data;
3269 0 : int err = fd_compact_tower_sync_decode_footprint_inner( ctx, total_sz );
3270 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3271 0 : ctx->data = start_data;
3272 0 : return err;
3273 0 : }
3274 0 : static void fd_compact_tower_sync_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3275 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)struct_mem;
3276 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3277 0 : ushort lockout_offsets_len;
3278 0 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
3279 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
3280 0 : self->lockout_offsets = deq_fd_lockout_offset_t_join_new( alloc_mem, lockout_offsets_max );
3281 0 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
3282 0 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( self->lockout_offsets );
3283 0 : fd_lockout_offset_new( elem );
3284 0 : fd_lockout_offset_decode_inner( elem, alloc_mem, ctx );
3285 0 : }
3286 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3287 0 : {
3288 0 : uchar o;
3289 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3290 0 : self->has_timestamp = !!o;
3291 0 : if( o ) {
3292 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3293 0 : }
3294 0 : }
3295 0 : fd_hash_decode_inner( &self->block_id, alloc_mem, ctx );
3296 0 : }
3297 0 : void * fd_compact_tower_sync_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3298 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)mem;
3299 0 : fd_compact_tower_sync_new( self );
3300 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_tower_sync_t);
3301 0 : void * * alloc_mem = &alloc_region;
3302 0 : fd_compact_tower_sync_decode_inner( mem, alloc_mem, ctx );
3303 0 : return self;
3304 0 : }
3305 0 : void fd_compact_tower_sync_new(fd_compact_tower_sync_t * self) {
3306 0 : fd_memset( self, 0, sizeof(fd_compact_tower_sync_t) );
3307 0 : fd_hash_new( &self->hash );
3308 0 : fd_hash_new( &self->block_id );
3309 0 : }
3310 0 : ulong fd_compact_tower_sync_size( fd_compact_tower_sync_t const * self ) {
3311 0 : ulong size = 0;
3312 0 : size += sizeof(ulong);
3313 0 : if( self->lockout_offsets ) {
3314 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
3315 0 : size += fd_bincode_compact_u16_size( &lockout_offsets_len );
3316 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 ) ) {
3317 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
3318 0 : size += fd_lockout_offset_size( ele );
3319 0 : }
3320 0 : } else {
3321 0 : size += 1;
3322 0 : }
3323 0 : size += fd_hash_size( &self->hash );
3324 0 : size += sizeof(char);
3325 0 : if( self->has_timestamp ) {
3326 0 : size += sizeof(long);
3327 0 : }
3328 0 : size += fd_hash_size( &self->block_id );
3329 0 : return size;
3330 0 : }
3331 :
3332 0 : void fd_tower_sync_new(fd_tower_sync_t * self) {
3333 0 : fd_memset( self, 0, sizeof(fd_tower_sync_t) );
3334 0 : fd_hash_new( &self->hash );
3335 0 : fd_hash_new( &self->block_id );
3336 0 : }
3337 0 : ulong fd_tower_sync_size( fd_tower_sync_t const * self ) {
3338 0 : ulong size = 0;
3339 0 : if( self->lockouts ) {
3340 0 : size += sizeof(ulong);
3341 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 ) ) {
3342 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3343 0 : size += fd_vote_lockout_size( ele );
3344 0 : }
3345 0 : } else {
3346 0 : size += sizeof(ulong);
3347 0 : }
3348 0 : size += sizeof(ulong);
3349 0 : size += sizeof(char);
3350 0 : if( self->has_root ) {
3351 0 : size += sizeof(ulong);
3352 0 : }
3353 0 : size += fd_hash_size( &self->hash );
3354 0 : size += sizeof(char);
3355 0 : if( self->has_timestamp ) {
3356 0 : size += sizeof(long);
3357 0 : }
3358 0 : size += fd_hash_size( &self->block_id );
3359 0 : return size;
3360 0 : }
3361 :
3362 0 : int fd_tower_sync_switch_encode( fd_tower_sync_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3363 0 : int err;
3364 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
3365 0 : if( FD_UNLIKELY( err ) ) return err;
3366 0 : err = fd_hash_encode( &self->hash, ctx );
3367 0 : if( FD_UNLIKELY( err ) ) return err;
3368 0 : return FD_BINCODE_SUCCESS;
3369 0 : }
3370 0 : static int fd_tower_sync_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3371 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3372 0 : int err = 0;
3373 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
3374 0 : if( FD_UNLIKELY( err ) ) return err;
3375 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3376 0 : if( FD_UNLIKELY( err ) ) return err;
3377 0 : return 0;
3378 0 : }
3379 0 : int fd_tower_sync_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3380 0 : *total_sz += sizeof(fd_tower_sync_switch_t);
3381 0 : void const * start_data = ctx->data;
3382 0 : int err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
3383 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3384 0 : ctx->data = start_data;
3385 0 : return err;
3386 0 : }
3387 0 : static void fd_tower_sync_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3388 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)struct_mem;
3389 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
3390 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3391 0 : }
3392 0 : void * fd_tower_sync_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3393 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)mem;
3394 0 : fd_tower_sync_switch_new( self );
3395 0 : void * alloc_region = (uchar *)mem + sizeof(fd_tower_sync_switch_t);
3396 0 : void * * alloc_mem = &alloc_region;
3397 0 : fd_tower_sync_switch_decode_inner( mem, alloc_mem, ctx );
3398 0 : return self;
3399 0 : }
3400 0 : void fd_tower_sync_switch_new(fd_tower_sync_switch_t * self) {
3401 0 : fd_memset( self, 0, sizeof(fd_tower_sync_switch_t) );
3402 0 : fd_tower_sync_new( &self->tower_sync );
3403 0 : fd_hash_new( &self->hash );
3404 0 : }
3405 0 : ulong fd_tower_sync_switch_size( fd_tower_sync_switch_t const * self ) {
3406 0 : ulong size = 0;
3407 0 : size += fd_tower_sync_size( &self->tower_sync );
3408 0 : size += fd_hash_size( &self->hash );
3409 0 : return size;
3410 0 : }
3411 :
3412 0 : int fd_slot_history_encode( fd_slot_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3413 0 : int err;
3414 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
3415 0 : if( FD_UNLIKELY( err ) ) return err;
3416 0 : if( self->has_bits ) {
3417 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
3418 0 : if( FD_UNLIKELY(err) ) return err;
3419 0 : if( self->bits_bitvec_len ) {
3420 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3421 0 : err = fd_bincode_uint64_encode( self->bits_bitvec[i], ctx );
3422 0 : }
3423 0 : }
3424 0 : if( FD_UNLIKELY( err ) ) return err;
3425 0 : }
3426 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
3427 0 : if( FD_UNLIKELY( err ) ) return err;
3428 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
3429 0 : if( FD_UNLIKELY( err ) ) return err;
3430 0 : return FD_BINCODE_SUCCESS;
3431 0 : }
3432 0 : int fd_slot_history_encode_global( fd_slot_history_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3433 0 : int err;
3434 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
3435 0 : if( FD_UNLIKELY( err ) ) return err;
3436 0 : if( self->has_bits ) {
3437 0 : if( FD_UNLIKELY( err ) ) return err;
3438 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
3439 0 : if( FD_UNLIKELY( err ) ) return err;
3440 0 : if( self->bits_bitvec_len ) {
3441 0 : uchar * bits_bitvec_laddr = (uchar*)self + self->bits_bitvec_offset;
3442 0 : ulong * bits_bitvec = (ulong *)bits_bitvec_laddr;
3443 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3444 0 : err = fd_bincode_uint64_encode( bits_bitvec[i], ctx );
3445 0 : if( FD_UNLIKELY( err ) ) return err;
3446 0 : }
3447 0 : }
3448 0 : if( FD_UNLIKELY( err ) ) return err;
3449 0 : }
3450 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
3451 0 : if( FD_UNLIKELY( err ) ) return err;
3452 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
3453 0 : if( FD_UNLIKELY( err ) ) return err;
3454 0 : return FD_BINCODE_SUCCESS;
3455 0 : }
3456 3 : static int fd_slot_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3457 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3458 3 : int err = 0;
3459 3 : {
3460 3 : uchar o;
3461 3 : ulong inner_len = 0UL;
3462 3 : err = fd_bincode_bool_decode( &o, ctx );
3463 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3464 3 : if( o ) {
3465 3 : ulong bits_bitvec_len;
3466 3 : err = fd_bincode_uint64_decode( &bits_bitvec_len, ctx );
3467 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3468 3 : if( bits_bitvec_len ) {
3469 3 : *total_sz += 8UL + sizeof(ulong)*bits_bitvec_len;
3470 49155 : for( ulong i=0; i < bits_bitvec_len; i++ ) {
3471 49152 : err = fd_bincode_uint64_decode_footprint( ctx );
3472 49152 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3473 49152 : }
3474 3 : }
3475 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3476 3 : inner_len = bits_bitvec_len;
3477 3 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
3478 3 : }
3479 3 : ulong len;
3480 3 : err = fd_bincode_uint64_decode( &len, ctx );
3481 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3482 3 : if( len > inner_len * sizeof(ulong) * 8UL ) return FD_BINCODE_ERR_ENCODING;
3483 3 : }
3484 3 : err = fd_bincode_uint64_decode_footprint( ctx );
3485 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3486 3 : return 0;
3487 3 : }
3488 3 : int fd_slot_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3489 3 : *total_sz += sizeof(fd_slot_history_t);
3490 3 : void const * start_data = ctx->data;
3491 3 : int err = fd_slot_history_decode_footprint_inner( ctx, total_sz );
3492 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3493 3 : ctx->data = start_data;
3494 3 : return err;
3495 3 : }
3496 0 : static void fd_slot_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3497 0 : fd_slot_history_t * self = (fd_slot_history_t *)struct_mem;
3498 0 : {
3499 0 : uchar o;
3500 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3501 0 : self->has_bits = !!o;
3502 0 : if( o ) {
3503 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
3504 0 : if( self->bits_bitvec_len ) {
3505 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3506 0 : self->bits_bitvec = *alloc_mem;
3507 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
3508 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3509 0 : fd_bincode_uint64_decode_unsafe( self->bits_bitvec + i, ctx );
3510 0 : }
3511 0 : } else
3512 0 : self->bits_bitvec = NULL;
3513 0 : } else {
3514 0 : self->bits_bitvec = NULL;
3515 0 : }
3516 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
3517 0 : }
3518 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
3519 0 : }
3520 0 : void * fd_slot_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3521 0 : fd_slot_history_t * self = (fd_slot_history_t *)mem;
3522 0 : fd_slot_history_new( self );
3523 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_t);
3524 0 : void * * alloc_mem = &alloc_region;
3525 0 : fd_slot_history_decode_inner( mem, alloc_mem, ctx );
3526 0 : return self;
3527 0 : }
3528 0 : static void fd_slot_history_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3529 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)struct_mem;
3530 0 : {
3531 0 : uchar o;
3532 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3533 0 : self->has_bits = !!o;
3534 0 : if( o ) {
3535 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
3536 0 : if( self->bits_bitvec_len ) {
3537 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3538 0 : self->bits_bitvec_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3539 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3540 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
3541 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3542 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
3543 0 : }
3544 0 : } else {
3545 0 : self->bits_bitvec_offset = 0UL;
3546 0 : }
3547 0 : }
3548 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
3549 0 : }
3550 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
3551 0 : }
3552 0 : void * fd_slot_history_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3553 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)mem;
3554 0 : fd_slot_history_new( (fd_slot_history_t *)self );
3555 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_global_t);
3556 0 : void * * alloc_mem = &alloc_region;
3557 0 : fd_slot_history_decode_inner_global( mem, alloc_mem, ctx );
3558 0 : return self;
3559 0 : }
3560 0 : void fd_slot_history_new(fd_slot_history_t * self) {
3561 0 : fd_memset( self, 0, sizeof(fd_slot_history_t) );
3562 0 : }
3563 0 : ulong fd_slot_history_size( fd_slot_history_t const * self ) {
3564 0 : ulong size = 0;
3565 0 : size += sizeof(char);
3566 0 : if( self->has_bits ) {
3567 0 : do {
3568 0 : size += sizeof(ulong);
3569 0 : size += self->bits_bitvec_len * sizeof(ulong);
3570 0 : } while(0);
3571 0 : }
3572 0 : size += sizeof(ulong);
3573 0 : size += sizeof(ulong);
3574 0 : return size;
3575 0 : }
3576 :
3577 0 : ulong fd_slot_history_size_global( fd_slot_history_global_t const * self ) {
3578 0 : ulong size = 0;
3579 0 : do {
3580 0 : size += sizeof(char);
3581 0 : if( self->has_bits ) {
3582 0 : do {
3583 0 : size += sizeof(ulong);
3584 0 : ulong * bits_bitvec = self->bits_bitvec_offset ? (ulong *)fd_type_pun( (uchar *)self + self->bits_bitvec_offset ) : NULL;
3585 0 : size += self->bits_bitvec_len * sizeof(ulong);
3586 0 : } while(0);
3587 0 : }
3588 0 : } while(0);
3589 0 : size += sizeof(ulong);
3590 0 : return size;
3591 0 : }
3592 :
3593 135 : int fd_slot_hash_encode( fd_slot_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3594 135 : int err;
3595 135 : err = fd_bincode_uint64_encode( self->slot, ctx );
3596 135 : if( FD_UNLIKELY( err ) ) return err;
3597 135 : err = fd_hash_encode( &self->hash, ctx );
3598 135 : if( FD_UNLIKELY( err ) ) return err;
3599 135 : return FD_BINCODE_SUCCESS;
3600 135 : }
3601 0 : static inline int fd_slot_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3602 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3603 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
3604 0 : return 0;
3605 0 : }
3606 243 : static void fd_slot_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3607 243 : fd_slot_hash_t * self = (fd_slot_hash_t *)struct_mem;
3608 243 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
3609 243 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3610 243 : }
3611 0 : void * fd_slot_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3612 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)mem;
3613 0 : fd_slot_hash_new( self );
3614 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hash_t);
3615 0 : void * * alloc_mem = &alloc_region;
3616 0 : fd_slot_hash_decode_inner( mem, alloc_mem, ctx );
3617 0 : return self;
3618 0 : }
3619 0 : int fd_slot_hashes_encode( fd_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3620 0 : int err;
3621 0 : if( self->hashes ) {
3622 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( self->hashes );
3623 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3624 0 : if( FD_UNLIKELY( err ) ) return err;
3625 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 ) ) {
3626 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( self->hashes, iter );
3627 0 : err = fd_slot_hash_encode( ele, ctx );
3628 0 : if( FD_UNLIKELY( err ) ) return err;
3629 0 : }
3630 0 : } else {
3631 0 : ulong hashes_len = 0;
3632 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3633 0 : if( FD_UNLIKELY( err ) ) return err;
3634 0 : }
3635 0 : return FD_BINCODE_SUCCESS;
3636 0 : }
3637 27 : int fd_slot_hashes_encode_global( fd_slot_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3638 27 : int err;
3639 27 : if( self->hashes_offset ) {
3640 27 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
3641 27 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join( hashes_laddr );
3642 27 : ulong hashes_len = deq_fd_slot_hash_t_cnt( hashes );
3643 27 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3644 27 : if( FD_UNLIKELY( err ) ) return err;
3645 162 : 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 ) ) {
3646 135 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( hashes, iter );
3647 135 : err = fd_slot_hash_encode( ele, ctx );
3648 135 : if( FD_UNLIKELY( err ) ) return err;
3649 135 : }
3650 27 : } else {
3651 0 : ulong hashes_len = 0;
3652 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3653 0 : if( FD_UNLIKELY( err ) ) return err;
3654 0 : }
3655 27 : return FD_BINCODE_SUCCESS;
3656 27 : }
3657 30 : static int fd_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3658 30 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3659 30 : int err = 0;
3660 30 : ulong hashes_len;
3661 30 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
3662 30 : if( FD_UNLIKELY( err ) ) return err;
3663 30 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
3664 30 : *total_sz += deq_fd_slot_hash_t_align() + deq_fd_slot_hash_t_footprint( hashes_max );
3665 30 : ulong hashes_sz;
3666 30 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3667 30 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
3668 30 : if( FD_UNLIKELY( err ) ) return err;
3669 30 : return 0;
3670 30 : }
3671 30 : int fd_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3672 30 : *total_sz += sizeof(fd_slot_hashes_t);
3673 30 : void const * start_data = ctx->data;
3674 30 : int err = fd_slot_hashes_decode_footprint_inner( ctx, total_sz );
3675 30 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3676 30 : ctx->data = start_data;
3677 30 : return err;
3678 30 : }
3679 0 : static void fd_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3680 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)struct_mem;
3681 0 : ulong hashes_len;
3682 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3683 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
3684 0 : self->hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
3685 0 : for( ulong i=0; i < hashes_len; i++ ) {
3686 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( self->hashes );
3687 0 : fd_slot_hash_new( elem );
3688 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
3689 0 : }
3690 0 : }
3691 0 : void * fd_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3692 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)mem;
3693 0 : fd_slot_hashes_new( self );
3694 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_t);
3695 0 : void * * alloc_mem = &alloc_region;
3696 0 : fd_slot_hashes_decode_inner( mem, alloc_mem, ctx );
3697 0 : return self;
3698 0 : }
3699 51 : static void fd_slot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3700 51 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)struct_mem;
3701 51 : ulong hashes_len;
3702 51 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3703 51 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_slot_hash_t_align() );
3704 51 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
3705 51 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
3706 294 : for( ulong i=0; i < hashes_len; i++ ) {
3707 243 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( hashes );
3708 243 : fd_slot_hash_new( (fd_slot_hash_t*)fd_type_pun( elem ) );
3709 243 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
3710 243 : }
3711 51 : self->hashes_offset = (ulong)deq_fd_slot_hash_t_leave( hashes ) - (ulong)struct_mem;
3712 51 : }
3713 51 : void * fd_slot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3714 51 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)mem;
3715 51 : fd_slot_hashes_new( (fd_slot_hashes_t *)self );
3716 51 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_global_t);
3717 51 : void * * alloc_mem = &alloc_region;
3718 51 : fd_slot_hashes_decode_inner_global( mem, alloc_mem, ctx );
3719 51 : return self;
3720 51 : }
3721 51 : void fd_slot_hashes_new(fd_slot_hashes_t * self) {
3722 51 : fd_memset( self, 0, sizeof(fd_slot_hashes_t) );
3723 51 : }
3724 0 : ulong fd_slot_hashes_size( fd_slot_hashes_t const * self ) {
3725 0 : ulong size = 0;
3726 0 : if( self->hashes ) {
3727 0 : size += sizeof(ulong);
3728 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 ) ) {
3729 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
3730 0 : size += fd_slot_hash_size( ele );
3731 0 : }
3732 0 : } else {
3733 0 : size += sizeof(ulong);
3734 0 : }
3735 0 : return size;
3736 0 : }
3737 :
3738 0 : ulong fd_slot_hashes_size_global( fd_slot_hashes_global_t const * self ) {
3739 0 : ulong size = 0;
3740 0 : if( self->hashes_offset!=0 ) {
3741 0 : fd_slot_hash_t * hashes = (fd_slot_hash_t *)deq_fd_slot_hash_t_join( fd_type_pun( (uchar *)self + self->hashes_offset ) );
3742 0 : size += sizeof(ulong);
3743 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 ) ) {
3744 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( hashes, iter );
3745 0 : size += fd_slot_hash_size( ele );
3746 0 : }
3747 0 : } else {
3748 0 : size += sizeof(ulong);
3749 0 : }
3750 0 : return size;
3751 0 : }
3752 :
3753 0 : int fd_block_block_hash_entry_encode( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3754 0 : int err;
3755 0 : err = fd_hash_encode( &self->blockhash, ctx );
3756 0 : if( FD_UNLIKELY( err ) ) return err;
3757 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
3758 0 : if( FD_UNLIKELY( err ) ) return err;
3759 0 : return FD_BINCODE_SUCCESS;
3760 0 : }
3761 0 : static inline int fd_block_block_hash_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3762 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3763 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
3764 0 : return 0;
3765 0 : }
3766 33975 : static void fd_block_block_hash_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3767 33975 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)struct_mem;
3768 33975 : fd_hash_decode_inner( &self->blockhash, alloc_mem, ctx );
3769 33975 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
3770 33975 : }
3771 0 : void * fd_block_block_hash_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3772 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)mem;
3773 0 : fd_block_block_hash_entry_new( self );
3774 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_block_hash_entry_t);
3775 0 : void * * alloc_mem = &alloc_region;
3776 0 : fd_block_block_hash_entry_decode_inner( mem, alloc_mem, ctx );
3777 0 : return self;
3778 0 : }
3779 0 : int fd_recent_block_hashes_encode( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3780 0 : int err;
3781 0 : if( self->hashes ) {
3782 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
3783 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3784 0 : if( FD_UNLIKELY( err ) ) return err;
3785 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 ) ) {
3786 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
3787 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
3788 0 : if( FD_UNLIKELY( err ) ) return err;
3789 0 : }
3790 0 : } else {
3791 0 : ulong hashes_len = 0;
3792 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3793 0 : if( FD_UNLIKELY( err ) ) return err;
3794 0 : }
3795 0 : return FD_BINCODE_SUCCESS;
3796 0 : }
3797 0 : int fd_recent_block_hashes_encode_global( fd_recent_block_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3798 0 : int err;
3799 0 : if( self->hashes_offset ) {
3800 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
3801 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join( hashes_laddr );
3802 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( hashes );
3803 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3804 0 : if( FD_UNLIKELY( err ) ) return err;
3805 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 ) ) {
3806 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( hashes, iter );
3807 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
3808 0 : if( FD_UNLIKELY( err ) ) return err;
3809 0 : }
3810 0 : } else {
3811 0 : ulong hashes_len = 0;
3812 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3813 0 : if( FD_UNLIKELY( err ) ) return err;
3814 0 : }
3815 0 : return FD_BINCODE_SUCCESS;
3816 0 : }
3817 456 : static int fd_recent_block_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3818 456 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3819 456 : int err = 0;
3820 456 : ulong hashes_len;
3821 456 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
3822 456 : if( FD_UNLIKELY( err ) ) return err;
3823 456 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
3824 456 : *total_sz += deq_fd_block_block_hash_entry_t_align() + deq_fd_block_block_hash_entry_t_footprint( hashes_max );
3825 456 : ulong hashes_sz;
3826 456 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3827 456 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
3828 456 : if( FD_UNLIKELY( err ) ) return err;
3829 456 : return 0;
3830 456 : }
3831 456 : int fd_recent_block_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3832 456 : *total_sz += sizeof(fd_recent_block_hashes_t);
3833 456 : void const * start_data = ctx->data;
3834 456 : int err = fd_recent_block_hashes_decode_footprint_inner( ctx, total_sz );
3835 456 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3836 456 : ctx->data = start_data;
3837 456 : return err;
3838 456 : }
3839 0 : static void fd_recent_block_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3840 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)struct_mem;
3841 0 : ulong hashes_len;
3842 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3843 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
3844 0 : self->hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
3845 0 : for( ulong i=0; i < hashes_len; i++ ) {
3846 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
3847 0 : fd_block_block_hash_entry_new( elem );
3848 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
3849 0 : }
3850 0 : }
3851 0 : void * fd_recent_block_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3852 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)mem;
3853 0 : fd_recent_block_hashes_new( self );
3854 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_t);
3855 0 : void * * alloc_mem = &alloc_region;
3856 0 : fd_recent_block_hashes_decode_inner( mem, alloc_mem, ctx );
3857 0 : return self;
3858 0 : }
3859 453 : static void fd_recent_block_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3860 453 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)struct_mem;
3861 453 : ulong hashes_len;
3862 453 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3863 453 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_block_block_hash_entry_t_align() );
3864 453 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
3865 453 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
3866 34428 : for( ulong i=0; i < hashes_len; i++ ) {
3867 33975 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( hashes );
3868 33975 : fd_block_block_hash_entry_new( (fd_block_block_hash_entry_t*)fd_type_pun( elem ) );
3869 33975 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
3870 33975 : }
3871 453 : self->hashes_offset = (ulong)deq_fd_block_block_hash_entry_t_leave( hashes ) - (ulong)struct_mem;
3872 453 : }
3873 453 : void * fd_recent_block_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3874 453 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)mem;
3875 453 : fd_recent_block_hashes_new( (fd_recent_block_hashes_t *)self );
3876 453 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_global_t);
3877 453 : void * * alloc_mem = &alloc_region;
3878 453 : fd_recent_block_hashes_decode_inner_global( mem, alloc_mem, ctx );
3879 453 : return self;
3880 453 : }
3881 453 : void fd_recent_block_hashes_new(fd_recent_block_hashes_t * self) {
3882 453 : fd_memset( self, 0, sizeof(fd_recent_block_hashes_t) );
3883 453 : }
3884 0 : ulong fd_recent_block_hashes_size( fd_recent_block_hashes_t const * self ) {
3885 0 : ulong size = 0;
3886 0 : if( self->hashes ) {
3887 0 : size += sizeof(ulong);
3888 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 ) ) {
3889 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
3890 0 : size += fd_block_block_hash_entry_size( ele );
3891 0 : }
3892 0 : } else {
3893 0 : size += sizeof(ulong);
3894 0 : }
3895 0 : return size;
3896 0 : }
3897 :
3898 0 : ulong fd_recent_block_hashes_size_global( fd_recent_block_hashes_global_t const * self ) {
3899 0 : ulong size = 0;
3900 0 : if( self->hashes_offset!=0 ) {
3901 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 ) );
3902 0 : size += sizeof(ulong);
3903 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 ) ) {
3904 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( hashes, iter );
3905 0 : size += fd_block_block_hash_entry_size( ele );
3906 0 : }
3907 0 : } else {
3908 0 : size += sizeof(ulong);
3909 0 : }
3910 0 : return size;
3911 0 : }
3912 :
3913 0 : int fd_slot_meta_encode( fd_slot_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3914 0 : int err;
3915 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
3916 0 : if( FD_UNLIKELY( err ) ) return err;
3917 0 : err = fd_bincode_uint64_encode( self->consumed, ctx );
3918 0 : if( FD_UNLIKELY( err ) ) return err;
3919 0 : err = fd_bincode_uint64_encode( self->received, ctx );
3920 0 : if( FD_UNLIKELY( err ) ) return err;
3921 0 : err = fd_bincode_uint64_encode( (ulong)self->first_shred_timestamp, ctx );
3922 0 : if( FD_UNLIKELY( err ) ) return err;
3923 0 : err = fd_bincode_uint64_encode( self->last_index, ctx );
3924 0 : if( FD_UNLIKELY( err ) ) return err;
3925 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
3926 0 : if( FD_UNLIKELY( err ) ) return err;
3927 0 : err = fd_bincode_uint64_encode( self->next_slot_len, ctx );
3928 0 : if( FD_UNLIKELY(err) ) return err;
3929 0 : if( self->next_slot_len ) {
3930 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
3931 0 : err = fd_bincode_uint64_encode( self->next_slot[i], ctx );
3932 0 : }
3933 0 : }
3934 0 : err = fd_bincode_uint8_encode( (uchar)(self->is_connected), ctx );
3935 0 : if( FD_UNLIKELY( err ) ) return err;
3936 0 : return FD_BINCODE_SUCCESS;
3937 0 : }
3938 0 : static int fd_slot_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3939 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3940 0 : int err = 0;
3941 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3942 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3943 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3944 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3945 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3946 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3947 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3948 0 : if( FD_UNLIKELY( err ) ) return err;
3949 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3950 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3951 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3952 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3953 0 : ulong next_slot_len;
3954 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
3955 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3956 0 : if( next_slot_len ) {
3957 0 : *total_sz += 8UL + sizeof(ulong)*next_slot_len;
3958 0 : for( ulong i=0; i < next_slot_len; i++ ) {
3959 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3960 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3961 0 : }
3962 0 : }
3963 0 : err = fd_bincode_uint8_decode_footprint( ctx );
3964 0 : if( FD_UNLIKELY( err ) ) return err;
3965 0 : return 0;
3966 0 : }
3967 0 : int fd_slot_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3968 0 : *total_sz += sizeof(fd_slot_meta_t);
3969 0 : void const * start_data = ctx->data;
3970 0 : int err = fd_slot_meta_decode_footprint_inner( ctx, total_sz );
3971 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3972 0 : ctx->data = start_data;
3973 0 : return err;
3974 0 : }
3975 0 : static void fd_slot_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3976 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)struct_mem;
3977 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
3978 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
3979 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
3980 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
3981 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
3982 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
3983 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
3984 0 : if( self->next_slot_len ) {
3985 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3986 0 : self->next_slot = *alloc_mem;
3987 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->next_slot_len;
3988 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
3989 0 : fd_bincode_uint64_decode_unsafe( self->next_slot + i, ctx );
3990 0 : }
3991 0 : } else
3992 0 : self->next_slot = NULL;
3993 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
3994 0 : }
3995 0 : void * fd_slot_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3996 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)mem;
3997 0 : fd_slot_meta_new( self );
3998 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_meta_t);
3999 0 : void * * alloc_mem = &alloc_region;
4000 0 : fd_slot_meta_decode_inner( mem, alloc_mem, ctx );
4001 0 : return self;
4002 0 : }
4003 0 : void fd_slot_meta_new(fd_slot_meta_t * self) {
4004 0 : fd_memset( self, 0, sizeof(fd_slot_meta_t) );
4005 0 : }
4006 0 : ulong fd_slot_meta_size( fd_slot_meta_t const * self ) {
4007 0 : ulong size = 0;
4008 0 : size += sizeof(ulong);
4009 0 : size += sizeof(ulong);
4010 0 : size += sizeof(ulong);
4011 0 : size += sizeof(long);
4012 0 : size += sizeof(ulong);
4013 0 : size += sizeof(ulong);
4014 0 : do {
4015 0 : size += sizeof(ulong);
4016 0 : size += self->next_slot_len * sizeof(ulong);
4017 0 : } while(0);
4018 0 : size += sizeof(char);
4019 0 : return size;
4020 0 : }
4021 :
4022 0 : int fd_sysvar_fees_encode( fd_sysvar_fees_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4023 0 : int err;
4024 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
4025 0 : if( FD_UNLIKELY( err ) ) return err;
4026 0 : return FD_BINCODE_SUCCESS;
4027 0 : }
4028 0 : static inline int fd_sysvar_fees_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4029 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4030 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
4031 0 : return 0;
4032 0 : }
4033 0 : static void fd_sysvar_fees_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4034 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)struct_mem;
4035 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
4036 0 : }
4037 0 : void * fd_sysvar_fees_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4038 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)mem;
4039 0 : fd_sysvar_fees_new( self );
4040 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_fees_t);
4041 0 : void * * alloc_mem = &alloc_region;
4042 0 : fd_sysvar_fees_decode_inner( mem, alloc_mem, ctx );
4043 0 : return self;
4044 0 : }
4045 9 : int fd_sysvar_epoch_rewards_encode( fd_sysvar_epoch_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4046 9 : int err;
4047 9 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
4048 9 : if( FD_UNLIKELY( err ) ) return err;
4049 9 : err = fd_bincode_uint64_encode( self->num_partitions, ctx );
4050 9 : if( FD_UNLIKELY( err ) ) return err;
4051 9 : err = fd_hash_encode( &self->parent_blockhash, ctx );
4052 9 : if( FD_UNLIKELY( err ) ) return err;
4053 9 : err = fd_bincode_uint128_encode( self->total_points, ctx );
4054 9 : if( FD_UNLIKELY( err ) ) return err;
4055 9 : err = fd_bincode_uint64_encode( self->total_rewards, ctx );
4056 9 : if( FD_UNLIKELY( err ) ) return err;
4057 9 : err = fd_bincode_uint64_encode( self->distributed_rewards, ctx );
4058 9 : if( FD_UNLIKELY( err ) ) return err;
4059 9 : err = fd_bincode_bool_encode( (uchar)(self->active), ctx );
4060 9 : if( FD_UNLIKELY( err ) ) return err;
4061 9 : return FD_BINCODE_SUCCESS;
4062 9 : }
4063 24 : static int fd_sysvar_epoch_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4064 24 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4065 24 : int err = 0;
4066 24 : err = fd_bincode_uint64_decode_footprint( ctx );
4067 24 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4068 24 : err = fd_bincode_uint64_decode_footprint( ctx );
4069 24 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4070 24 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4071 24 : if( FD_UNLIKELY( err ) ) return err;
4072 24 : err = fd_bincode_uint128_decode_footprint( ctx );
4073 24 : if( FD_UNLIKELY( err ) ) return err;
4074 24 : err = fd_bincode_uint64_decode_footprint( ctx );
4075 24 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4076 24 : err = fd_bincode_uint64_decode_footprint( ctx );
4077 24 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4078 24 : err = fd_bincode_bool_decode_footprint( ctx );
4079 24 : if( FD_UNLIKELY( err ) ) return err;
4080 24 : return 0;
4081 24 : }
4082 24 : int fd_sysvar_epoch_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4083 24 : *total_sz += sizeof(fd_sysvar_epoch_rewards_t);
4084 24 : void const * start_data = ctx->data;
4085 24 : int err = fd_sysvar_epoch_rewards_decode_footprint_inner( ctx, total_sz );
4086 24 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4087 24 : ctx->data = start_data;
4088 24 : return err;
4089 24 : }
4090 21 : static void fd_sysvar_epoch_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4091 21 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)struct_mem;
4092 21 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
4093 21 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
4094 21 : fd_hash_decode_inner( &self->parent_blockhash, alloc_mem, ctx );
4095 21 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
4096 21 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
4097 21 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
4098 21 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
4099 21 : }
4100 21 : void * fd_sysvar_epoch_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4101 21 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)mem;
4102 21 : fd_sysvar_epoch_rewards_new( self );
4103 21 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_epoch_rewards_t);
4104 21 : void * * alloc_mem = &alloc_region;
4105 21 : fd_sysvar_epoch_rewards_decode_inner( mem, alloc_mem, ctx );
4106 21 : return self;
4107 21 : }
4108 21 : void fd_sysvar_epoch_rewards_new(fd_sysvar_epoch_rewards_t * self) {
4109 21 : fd_memset( self, 0, sizeof(fd_sysvar_epoch_rewards_t) );
4110 21 : fd_hash_new( &self->parent_blockhash );
4111 21 : }
4112 0 : int fd_config_keys_pair_encode( fd_config_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4113 0 : int err;
4114 0 : err = fd_pubkey_encode( &self->key, ctx );
4115 0 : if( FD_UNLIKELY( err ) ) return err;
4116 0 : err = fd_bincode_bool_encode( (uchar)(self->signer), ctx );
4117 0 : if( FD_UNLIKELY( err ) ) return err;
4118 0 : return FD_BINCODE_SUCCESS;
4119 0 : }
4120 0 : static int fd_config_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4121 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4122 0 : int err = 0;
4123 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4124 0 : if( FD_UNLIKELY( err ) ) return err;
4125 0 : err = fd_bincode_bool_decode_footprint( ctx );
4126 0 : if( FD_UNLIKELY( err ) ) return err;
4127 0 : return 0;
4128 0 : }
4129 0 : int fd_config_keys_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4130 0 : *total_sz += sizeof(fd_config_keys_pair_t);
4131 0 : void const * start_data = ctx->data;
4132 0 : int err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
4133 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4134 0 : ctx->data = start_data;
4135 0 : return err;
4136 0 : }
4137 0 : static void fd_config_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4138 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)struct_mem;
4139 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
4140 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
4141 0 : }
4142 0 : void * fd_config_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4143 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)mem;
4144 0 : fd_config_keys_pair_new( self );
4145 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_pair_t);
4146 0 : void * * alloc_mem = &alloc_region;
4147 0 : fd_config_keys_pair_decode_inner( mem, alloc_mem, ctx );
4148 0 : return self;
4149 0 : }
4150 0 : void fd_config_keys_pair_new(fd_config_keys_pair_t * self) {
4151 0 : fd_memset( self, 0, sizeof(fd_config_keys_pair_t) );
4152 0 : fd_pubkey_new( &self->key );
4153 0 : }
4154 12 : int fd_stake_config_encode( fd_stake_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4155 12 : int err;
4156 12 : err = fd_bincode_compact_u16_encode( &self->config_keys_len, ctx );
4157 12 : if( FD_UNLIKELY(err) ) return err;
4158 12 : if( self->config_keys_len ) {
4159 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
4160 0 : err = fd_config_keys_pair_encode( self->config_keys + i, ctx );
4161 0 : if( FD_UNLIKELY( err ) ) return err;
4162 0 : }
4163 0 : }
4164 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
4165 12 : if( FD_UNLIKELY( err ) ) return err;
4166 12 : err = fd_bincode_uint8_encode( (uchar)(self->slash_penalty), ctx );
4167 12 : if( FD_UNLIKELY( err ) ) return err;
4168 12 : return FD_BINCODE_SUCCESS;
4169 12 : }
4170 0 : static int fd_stake_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4171 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4172 0 : int err = 0;
4173 0 : ushort config_keys_len;
4174 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
4175 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4176 0 : if( config_keys_len ) {
4177 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*config_keys_len;
4178 0 : for( ulong i=0; i < config_keys_len; i++ ) {
4179 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
4180 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4181 0 : }
4182 0 : }
4183 0 : err = fd_bincode_double_decode_footprint( ctx );
4184 0 : if( FD_UNLIKELY( err ) ) return err;
4185 0 : err = fd_bincode_uint8_decode_footprint( ctx );
4186 0 : if( FD_UNLIKELY( err ) ) return err;
4187 0 : return 0;
4188 0 : }
4189 0 : int fd_stake_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4190 0 : *total_sz += sizeof(fd_stake_config_t);
4191 0 : void const * start_data = ctx->data;
4192 0 : int err = fd_stake_config_decode_footprint_inner( ctx, total_sz );
4193 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4194 0 : ctx->data = start_data;
4195 0 : return err;
4196 0 : }
4197 0 : static void fd_stake_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4198 0 : fd_stake_config_t * self = (fd_stake_config_t *)struct_mem;
4199 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
4200 0 : if( self->config_keys_len ) {
4201 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
4202 0 : self->config_keys = *alloc_mem;
4203 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->config_keys_len;
4204 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
4205 0 : fd_config_keys_pair_new( self->config_keys + i );
4206 0 : fd_config_keys_pair_decode_inner( self->config_keys + i, alloc_mem, ctx );
4207 0 : }
4208 0 : } else
4209 0 : self->config_keys = NULL;
4210 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
4211 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
4212 0 : }
4213 0 : void * fd_stake_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4214 0 : fd_stake_config_t * self = (fd_stake_config_t *)mem;
4215 0 : fd_stake_config_new( self );
4216 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_config_t);
4217 0 : void * * alloc_mem = &alloc_region;
4218 0 : fd_stake_config_decode_inner( mem, alloc_mem, ctx );
4219 0 : return self;
4220 0 : }
4221 0 : void fd_stake_config_new(fd_stake_config_t * self) {
4222 0 : fd_memset( self, 0, sizeof(fd_stake_config_t) );
4223 0 : }
4224 0 : ulong fd_stake_config_size( fd_stake_config_t const * self ) {
4225 0 : ulong size = 0;
4226 0 : do {
4227 0 : ushort tmp = (ushort)self->config_keys_len;
4228 0 : size += fd_bincode_compact_u16_size( &tmp );
4229 0 : for( ulong i=0; i < self->config_keys_len; i++ )
4230 0 : size += fd_config_keys_pair_size( self->config_keys + i );
4231 0 : } while(0);
4232 0 : size += sizeof(double);
4233 0 : size += sizeof(char);
4234 0 : return size;
4235 0 : }
4236 :
4237 0 : FD_FN_PURE uchar fd_cluster_type_is_Testnet(fd_cluster_type_t const * self) {
4238 0 : return self->discriminant == 0;
4239 0 : }
4240 0 : FD_FN_PURE uchar fd_cluster_type_is_MainnetBeta(fd_cluster_type_t const * self) {
4241 0 : return self->discriminant == 1;
4242 0 : }
4243 0 : FD_FN_PURE uchar fd_cluster_type_is_Devnet(fd_cluster_type_t const * self) {
4244 0 : return self->discriminant == 2;
4245 0 : }
4246 0 : FD_FN_PURE uchar fd_cluster_type_is_Development(fd_cluster_type_t const * self) {
4247 0 : return self->discriminant == 3;
4248 0 : }
4249 0 : int fd_cluster_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4250 0 : int err;
4251 0 : switch (discriminant) {
4252 0 : case 0: {
4253 0 : return FD_BINCODE_SUCCESS;
4254 0 : }
4255 0 : case 1: {
4256 0 : return FD_BINCODE_SUCCESS;
4257 0 : }
4258 0 : case 2: {
4259 0 : return FD_BINCODE_SUCCESS;
4260 0 : }
4261 0 : case 3: {
4262 0 : return FD_BINCODE_SUCCESS;
4263 0 : }
4264 0 : default: return FD_BINCODE_ERR_ENCODING;
4265 0 : }
4266 0 : }
4267 0 : static int fd_cluster_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4268 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4269 0 : uint discriminant = 0;
4270 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4271 0 : if( FD_UNLIKELY( err ) ) return err;
4272 0 : return fd_cluster_type_inner_decode_footprint( discriminant, ctx, total_sz );
4273 0 : }
4274 0 : int fd_cluster_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4275 0 : *total_sz += sizeof(fd_cluster_type_t);
4276 0 : void const * start_data = ctx->data;
4277 0 : int err = fd_cluster_type_decode_footprint_inner( ctx, total_sz );
4278 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4279 0 : ctx->data = start_data;
4280 0 : return err;
4281 0 : }
4282 0 : static void fd_cluster_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4283 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)struct_mem;
4284 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4285 0 : }
4286 0 : void * fd_cluster_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4287 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)mem;
4288 0 : fd_cluster_type_new( self );
4289 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_type_t);
4290 0 : void * * alloc_mem = &alloc_region;
4291 0 : fd_cluster_type_decode_inner( mem, alloc_mem, ctx );
4292 0 : return self;
4293 0 : }
4294 :
4295 0 : ulong fd_cluster_type_size( fd_cluster_type_t const * self ) {
4296 0 : ulong size = 0;
4297 0 : size += sizeof(uint);
4298 0 : switch (self->discriminant) {
4299 0 : }
4300 0 : return size;
4301 0 : }
4302 :
4303 0 : int fd_cluster_type_encode( fd_cluster_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4304 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4305 0 : if( FD_UNLIKELY( err ) ) return err;
4306 0 : return err;
4307 0 : }
4308 :
4309 0 : int fd_cluster_version_encode( fd_cluster_version_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4310 0 : int err;
4311 0 : err = fd_bincode_uint32_encode( self->major, ctx );
4312 0 : if( FD_UNLIKELY( err ) ) return err;
4313 0 : err = fd_bincode_uint32_encode( self->minor, ctx );
4314 0 : if( FD_UNLIKELY( err ) ) return err;
4315 0 : err = fd_bincode_uint32_encode( self->patch, ctx );
4316 0 : if( FD_UNLIKELY( err ) ) return err;
4317 0 : return FD_BINCODE_SUCCESS;
4318 0 : }
4319 0 : static inline int fd_cluster_version_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4320 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4321 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
4322 0 : return 0;
4323 0 : }
4324 0 : static void fd_cluster_version_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4325 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)struct_mem;
4326 0 : fd_bincode_uint32_decode_unsafe( &self->major, ctx );
4327 0 : fd_bincode_uint32_decode_unsafe( &self->minor, ctx );
4328 0 : fd_bincode_uint32_decode_unsafe( &self->patch, ctx );
4329 0 : }
4330 0 : void * fd_cluster_version_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4331 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)mem;
4332 0 : fd_cluster_version_new( self );
4333 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_version_t);
4334 0 : void * * alloc_mem = &alloc_region;
4335 0 : fd_cluster_version_decode_inner( mem, alloc_mem, ctx );
4336 0 : return self;
4337 0 : }
4338 0 : int fd_vote_encode( fd_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4339 0 : int err;
4340 0 : if( self->slots ) {
4341 0 : ulong slots_len = deq_ulong_cnt( self->slots );
4342 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
4343 0 : if( FD_UNLIKELY( err ) ) return err;
4344 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 ) ) {
4345 0 : ulong const * ele = deq_ulong_iter_ele_const( self->slots, iter );
4346 0 : err = fd_bincode_uint64_encode( ele[0], ctx );
4347 0 : }
4348 0 : } else {
4349 0 : ulong slots_len = 0;
4350 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
4351 0 : if( FD_UNLIKELY( err ) ) return err;
4352 0 : }
4353 0 : err = fd_hash_encode( &self->hash, ctx );
4354 0 : if( FD_UNLIKELY( err ) ) return err;
4355 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
4356 0 : if( FD_UNLIKELY( err ) ) return err;
4357 0 : if( self->has_timestamp ) {
4358 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
4359 0 : if( FD_UNLIKELY( err ) ) return err;
4360 0 : }
4361 0 : return FD_BINCODE_SUCCESS;
4362 0 : }
4363 0 : static int fd_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4364 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4365 0 : int err = 0;
4366 0 : ulong slots_len;
4367 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
4368 0 : if( FD_UNLIKELY( err ) ) return err;
4369 0 : ulong slots_max = slots_len == 0 ? 1 : slots_len;
4370 0 : *total_sz += deq_ulong_align() + deq_ulong_footprint( slots_max ) ;
4371 0 : ulong slots_sz;
4372 0 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
4373 0 : err = fd_bincode_bytes_decode_footprint( slots_sz, ctx );
4374 0 : if( FD_UNLIKELY( err ) ) return err;
4375 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4376 0 : if( FD_UNLIKELY( err ) ) return err;
4377 0 : {
4378 0 : uchar o;
4379 0 : err = fd_bincode_bool_decode( &o, ctx );
4380 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4381 0 : if( o ) {
4382 0 : err = fd_bincode_int64_decode_footprint( ctx );
4383 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4384 0 : }
4385 0 : }
4386 0 : return 0;
4387 0 : }
4388 0 : int fd_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4389 0 : *total_sz += sizeof(fd_vote_t);
4390 0 : void const * start_data = ctx->data;
4391 0 : int err = fd_vote_decode_footprint_inner( ctx, total_sz );
4392 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4393 0 : ctx->data = start_data;
4394 0 : return err;
4395 0 : }
4396 0 : static void fd_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4397 0 : fd_vote_t * self = (fd_vote_t *)struct_mem;
4398 0 : ulong slots_len;
4399 0 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
4400 0 : self->slots = deq_ulong_join_new( alloc_mem, slots_len );
4401 0 : for( ulong i=0; i < slots_len; i++ ) {
4402 0 : ulong * elem = deq_ulong_push_tail_nocopy( self->slots );
4403 0 : fd_bincode_uint64_decode_unsafe( elem, ctx );
4404 0 : }
4405 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4406 0 : {
4407 0 : uchar o;
4408 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
4409 0 : self->has_timestamp = !!o;
4410 0 : if( o ) {
4411 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
4412 0 : }
4413 0 : }
4414 0 : }
4415 0 : void * fd_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4416 0 : fd_vote_t * self = (fd_vote_t *)mem;
4417 0 : fd_vote_new( self );
4418 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_t);
4419 0 : void * * alloc_mem = &alloc_region;
4420 0 : fd_vote_decode_inner( mem, alloc_mem, ctx );
4421 0 : return self;
4422 0 : }
4423 0 : void fd_vote_new(fd_vote_t * self) {
4424 0 : fd_memset( self, 0, sizeof(fd_vote_t) );
4425 0 : fd_hash_new( &self->hash );
4426 0 : }
4427 0 : ulong fd_vote_size( fd_vote_t const * self ) {
4428 0 : ulong size = 0;
4429 0 : if( self->slots ) {
4430 0 : size += sizeof(ulong);
4431 0 : ulong slots_len = deq_ulong_cnt(self->slots);
4432 0 : size += slots_len * sizeof(ulong);
4433 0 : } else {
4434 0 : size += sizeof(ulong);
4435 0 : }
4436 0 : size += fd_hash_size( &self->hash );
4437 0 : size += sizeof(char);
4438 0 : if( self->has_timestamp ) {
4439 0 : size += sizeof(long);
4440 0 : }
4441 0 : return size;
4442 0 : }
4443 :
4444 0 : int fd_vote_init_encode( fd_vote_init_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4445 0 : int err;
4446 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
4447 0 : if( FD_UNLIKELY( err ) ) return err;
4448 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
4449 0 : if( FD_UNLIKELY( err ) ) return err;
4450 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
4451 0 : if( FD_UNLIKELY( err ) ) return err;
4452 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
4453 0 : if( FD_UNLIKELY( err ) ) return err;
4454 0 : return FD_BINCODE_SUCCESS;
4455 0 : }
4456 0 : static inline int fd_vote_init_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4457 0 : if( (ulong)ctx->data + 97UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4458 0 : ctx->data = (void *)( (ulong)ctx->data + 97UL );
4459 0 : return 0;
4460 0 : }
4461 0 : static void fd_vote_init_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4462 0 : fd_vote_init_t * self = (fd_vote_init_t *)struct_mem;
4463 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
4464 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
4465 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
4466 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
4467 0 : }
4468 0 : void * fd_vote_init_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4469 0 : fd_vote_init_t * self = (fd_vote_init_t *)mem;
4470 0 : fd_vote_init_new( self );
4471 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_t);
4472 0 : void * * alloc_mem = &alloc_region;
4473 0 : fd_vote_init_decode_inner( mem, alloc_mem, ctx );
4474 0 : return self;
4475 0 : }
4476 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter(fd_vote_authorize_t const * self) {
4477 0 : return self->discriminant == 0;
4478 0 : }
4479 0 : FD_FN_PURE uchar fd_vote_authorize_is_withdrawer(fd_vote_authorize_t const * self) {
4480 0 : return self->discriminant == 1;
4481 0 : }
4482 0 : int fd_vote_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4483 0 : int err;
4484 0 : switch (discriminant) {
4485 0 : case 0: {
4486 0 : return FD_BINCODE_SUCCESS;
4487 0 : }
4488 0 : case 1: {
4489 0 : return FD_BINCODE_SUCCESS;
4490 0 : }
4491 0 : default: return FD_BINCODE_ERR_ENCODING;
4492 0 : }
4493 0 : }
4494 0 : static int fd_vote_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4495 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4496 0 : uint discriminant = 0;
4497 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4498 0 : if( FD_UNLIKELY( err ) ) return err;
4499 0 : return fd_vote_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
4500 0 : }
4501 0 : int fd_vote_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4502 0 : *total_sz += sizeof(fd_vote_authorize_t);
4503 0 : void const * start_data = ctx->data;
4504 0 : int err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4505 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4506 0 : ctx->data = start_data;
4507 0 : return err;
4508 0 : }
4509 0 : static void fd_vote_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4510 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)struct_mem;
4511 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4512 0 : }
4513 0 : void * fd_vote_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4514 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)mem;
4515 0 : fd_vote_authorize_new( self );
4516 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_t);
4517 0 : void * * alloc_mem = &alloc_region;
4518 0 : fd_vote_authorize_decode_inner( mem, alloc_mem, ctx );
4519 0 : return self;
4520 0 : }
4521 :
4522 0 : ulong fd_vote_authorize_size( fd_vote_authorize_t const * self ) {
4523 0 : ulong size = 0;
4524 0 : size += sizeof(uint);
4525 0 : switch (self->discriminant) {
4526 0 : }
4527 0 : return size;
4528 0 : }
4529 :
4530 0 : int fd_vote_authorize_encode( fd_vote_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4531 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4532 0 : if( FD_UNLIKELY( err ) ) return err;
4533 0 : return err;
4534 0 : }
4535 :
4536 0 : int fd_vote_authorize_pubkey_encode( fd_vote_authorize_pubkey_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4537 0 : int err;
4538 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
4539 0 : if( FD_UNLIKELY( err ) ) return err;
4540 0 : err = fd_vote_authorize_encode( &self->vote_authorize, ctx );
4541 0 : if( FD_UNLIKELY( err ) ) return err;
4542 0 : return FD_BINCODE_SUCCESS;
4543 0 : }
4544 0 : static int fd_vote_authorize_pubkey_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4545 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4546 0 : int err = 0;
4547 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4548 0 : if( FD_UNLIKELY( err ) ) return err;
4549 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4550 0 : if( FD_UNLIKELY( err ) ) return err;
4551 0 : return 0;
4552 0 : }
4553 0 : int fd_vote_authorize_pubkey_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4554 0 : *total_sz += sizeof(fd_vote_authorize_pubkey_t);
4555 0 : void const * start_data = ctx->data;
4556 0 : int err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
4557 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4558 0 : ctx->data = start_data;
4559 0 : return err;
4560 0 : }
4561 0 : static void fd_vote_authorize_pubkey_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4562 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)struct_mem;
4563 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
4564 0 : fd_vote_authorize_decode_inner( &self->vote_authorize, alloc_mem, ctx );
4565 0 : }
4566 0 : void * fd_vote_authorize_pubkey_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4567 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)mem;
4568 0 : fd_vote_authorize_pubkey_new( self );
4569 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_pubkey_t);
4570 0 : void * * alloc_mem = &alloc_region;
4571 0 : fd_vote_authorize_pubkey_decode_inner( mem, alloc_mem, ctx );
4572 0 : return self;
4573 0 : }
4574 0 : void fd_vote_authorize_pubkey_new(fd_vote_authorize_pubkey_t * self) {
4575 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_pubkey_t) );
4576 0 : fd_pubkey_new( &self->pubkey );
4577 0 : fd_vote_authorize_new( &self->vote_authorize );
4578 0 : }
4579 0 : int fd_vote_switch_encode( fd_vote_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4580 0 : int err;
4581 0 : err = fd_vote_encode( &self->vote, ctx );
4582 0 : if( FD_UNLIKELY( err ) ) return err;
4583 0 : err = fd_hash_encode( &self->hash, ctx );
4584 0 : if( FD_UNLIKELY( err ) ) return err;
4585 0 : return FD_BINCODE_SUCCESS;
4586 0 : }
4587 0 : static int fd_vote_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4588 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4589 0 : int err = 0;
4590 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
4591 0 : if( FD_UNLIKELY( err ) ) return err;
4592 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4593 0 : if( FD_UNLIKELY( err ) ) return err;
4594 0 : return 0;
4595 0 : }
4596 0 : int fd_vote_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4597 0 : *total_sz += sizeof(fd_vote_switch_t);
4598 0 : void const * start_data = ctx->data;
4599 0 : int err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
4600 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4601 0 : ctx->data = start_data;
4602 0 : return err;
4603 0 : }
4604 0 : static void fd_vote_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4605 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)struct_mem;
4606 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
4607 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4608 0 : }
4609 0 : void * fd_vote_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4610 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)mem;
4611 0 : fd_vote_switch_new( self );
4612 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_switch_t);
4613 0 : void * * alloc_mem = &alloc_region;
4614 0 : fd_vote_switch_decode_inner( mem, alloc_mem, ctx );
4615 0 : return self;
4616 0 : }
4617 0 : void fd_vote_switch_new(fd_vote_switch_t * self) {
4618 0 : fd_memset( self, 0, sizeof(fd_vote_switch_t) );
4619 0 : fd_vote_new( &self->vote );
4620 0 : fd_hash_new( &self->hash );
4621 0 : }
4622 0 : ulong fd_vote_switch_size( fd_vote_switch_t const * self ) {
4623 0 : ulong size = 0;
4624 0 : size += fd_vote_size( &self->vote );
4625 0 : size += fd_hash_size( &self->hash );
4626 0 : return size;
4627 0 : }
4628 :
4629 0 : int fd_update_vote_state_switch_encode( fd_update_vote_state_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4630 0 : int err;
4631 0 : err = fd_vote_state_update_encode( &self->vote_state_update, ctx );
4632 0 : if( FD_UNLIKELY( err ) ) return err;
4633 0 : err = fd_hash_encode( &self->hash, ctx );
4634 0 : if( FD_UNLIKELY( err ) ) return err;
4635 0 : return FD_BINCODE_SUCCESS;
4636 0 : }
4637 0 : static int fd_update_vote_state_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4638 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4639 0 : int err = 0;
4640 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
4641 0 : if( FD_UNLIKELY( err ) ) return err;
4642 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4643 0 : if( FD_UNLIKELY( err ) ) return err;
4644 0 : return 0;
4645 0 : }
4646 0 : int fd_update_vote_state_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4647 0 : *total_sz += sizeof(fd_update_vote_state_switch_t);
4648 0 : void const * start_data = ctx->data;
4649 0 : int err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
4650 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4651 0 : ctx->data = start_data;
4652 0 : return err;
4653 0 : }
4654 0 : static void fd_update_vote_state_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4655 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)struct_mem;
4656 0 : fd_vote_state_update_decode_inner( &self->vote_state_update, alloc_mem, ctx );
4657 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4658 0 : }
4659 0 : void * fd_update_vote_state_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4660 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)mem;
4661 0 : fd_update_vote_state_switch_new( self );
4662 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_vote_state_switch_t);
4663 0 : void * * alloc_mem = &alloc_region;
4664 0 : fd_update_vote_state_switch_decode_inner( mem, alloc_mem, ctx );
4665 0 : return self;
4666 0 : }
4667 0 : void fd_update_vote_state_switch_new(fd_update_vote_state_switch_t * self) {
4668 0 : fd_memset( self, 0, sizeof(fd_update_vote_state_switch_t) );
4669 0 : fd_vote_state_update_new( &self->vote_state_update );
4670 0 : fd_hash_new( &self->hash );
4671 0 : }
4672 0 : ulong fd_update_vote_state_switch_size( fd_update_vote_state_switch_t const * self ) {
4673 0 : ulong size = 0;
4674 0 : size += fd_vote_state_update_size( &self->vote_state_update );
4675 0 : size += fd_hash_size( &self->hash );
4676 0 : return size;
4677 0 : }
4678 :
4679 0 : int fd_vote_authorize_with_seed_args_encode( fd_vote_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4680 0 : int err;
4681 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
4682 0 : if( FD_UNLIKELY( err ) ) return err;
4683 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
4684 0 : if( FD_UNLIKELY( err ) ) return err;
4685 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
4686 0 : if( FD_UNLIKELY(err) ) return err;
4687 0 : if( self->current_authority_derived_key_seed_len ) {
4688 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4689 0 : if( FD_UNLIKELY( err ) ) return err;
4690 0 : }
4691 0 : err = fd_pubkey_encode( &self->new_authority, ctx );
4692 0 : if( FD_UNLIKELY( err ) ) return err;
4693 0 : return FD_BINCODE_SUCCESS;
4694 0 : }
4695 0 : static int fd_vote_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4696 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4697 0 : int err = 0;
4698 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4699 0 : if( FD_UNLIKELY( err ) ) return err;
4700 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4701 0 : if( FD_UNLIKELY( err ) ) return err;
4702 0 : ulong current_authority_derived_key_seed_len;
4703 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
4704 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4705 0 : *total_sz += current_authority_derived_key_seed_len;
4706 0 : if( current_authority_derived_key_seed_len ) {
4707 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
4708 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4709 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
4710 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4711 0 : }
4712 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4713 0 : if( FD_UNLIKELY( err ) ) return err;
4714 0 : return 0;
4715 0 : }
4716 0 : int fd_vote_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4717 0 : *total_sz += sizeof(fd_vote_authorize_with_seed_args_t);
4718 0 : void const * start_data = ctx->data;
4719 0 : int err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
4720 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4721 0 : ctx->data = start_data;
4722 0 : return err;
4723 0 : }
4724 0 : static void fd_vote_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4725 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)struct_mem;
4726 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
4727 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
4728 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
4729 0 : if( self->current_authority_derived_key_seed_len ) {
4730 0 : self->current_authority_derived_key_seed = *alloc_mem;
4731 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4732 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
4733 0 : } else
4734 0 : self->current_authority_derived_key_seed = NULL;
4735 0 : fd_pubkey_decode_inner( &self->new_authority, alloc_mem, ctx );
4736 0 : }
4737 0 : void * fd_vote_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4738 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)mem;
4739 0 : fd_vote_authorize_with_seed_args_new( self );
4740 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_with_seed_args_t);
4741 0 : void * * alloc_mem = &alloc_region;
4742 0 : fd_vote_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
4743 0 : return self;
4744 0 : }
4745 0 : void fd_vote_authorize_with_seed_args_new(fd_vote_authorize_with_seed_args_t * self) {
4746 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_with_seed_args_t) );
4747 0 : fd_vote_authorize_new( &self->authorization_type );
4748 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
4749 0 : fd_pubkey_new( &self->new_authority );
4750 0 : }
4751 0 : ulong fd_vote_authorize_with_seed_args_size( fd_vote_authorize_with_seed_args_t const * self ) {
4752 0 : ulong size = 0;
4753 0 : size += fd_vote_authorize_size( &self->authorization_type );
4754 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
4755 0 : do {
4756 0 : size += sizeof(ulong);
4757 0 : size += self->current_authority_derived_key_seed_len;
4758 0 : } while(0);
4759 0 : size += fd_pubkey_size( &self->new_authority );
4760 0 : return size;
4761 0 : }
4762 :
4763 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 ) {
4764 0 : int err;
4765 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
4766 0 : if( FD_UNLIKELY( err ) ) return err;
4767 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
4768 0 : if( FD_UNLIKELY( err ) ) return err;
4769 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
4770 0 : if( FD_UNLIKELY(err) ) return err;
4771 0 : if( self->current_authority_derived_key_seed_len ) {
4772 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4773 0 : if( FD_UNLIKELY( err ) ) return err;
4774 0 : }
4775 0 : return FD_BINCODE_SUCCESS;
4776 0 : }
4777 0 : static int fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4778 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4779 0 : int err = 0;
4780 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4781 0 : if( FD_UNLIKELY( err ) ) return err;
4782 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4783 0 : if( FD_UNLIKELY( err ) ) return err;
4784 0 : ulong current_authority_derived_key_seed_len;
4785 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
4786 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4787 0 : *total_sz += current_authority_derived_key_seed_len;
4788 0 : if( current_authority_derived_key_seed_len ) {
4789 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
4790 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4791 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
4792 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4793 0 : }
4794 0 : return 0;
4795 0 : }
4796 0 : int fd_vote_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4797 0 : *total_sz += sizeof(fd_vote_authorize_checked_with_seed_args_t);
4798 0 : void const * start_data = ctx->data;
4799 0 : int err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
4800 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4801 0 : ctx->data = start_data;
4802 0 : return err;
4803 0 : }
4804 0 : static void fd_vote_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4805 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)struct_mem;
4806 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
4807 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
4808 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
4809 0 : if( self->current_authority_derived_key_seed_len ) {
4810 0 : self->current_authority_derived_key_seed = *alloc_mem;
4811 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4812 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
4813 0 : } else
4814 0 : self->current_authority_derived_key_seed = NULL;
4815 0 : }
4816 0 : void * fd_vote_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4817 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)mem;
4818 0 : fd_vote_authorize_checked_with_seed_args_new( self );
4819 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_checked_with_seed_args_t);
4820 0 : void * * alloc_mem = &alloc_region;
4821 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
4822 0 : return self;
4823 0 : }
4824 0 : void fd_vote_authorize_checked_with_seed_args_new(fd_vote_authorize_checked_with_seed_args_t * self) {
4825 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_checked_with_seed_args_t) );
4826 0 : fd_vote_authorize_new( &self->authorization_type );
4827 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
4828 0 : }
4829 0 : ulong fd_vote_authorize_checked_with_seed_args_size( fd_vote_authorize_checked_with_seed_args_t const * self ) {
4830 0 : ulong size = 0;
4831 0 : size += fd_vote_authorize_size( &self->authorization_type );
4832 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
4833 0 : do {
4834 0 : size += sizeof(ulong);
4835 0 : size += self->current_authority_derived_key_seed_len;
4836 0 : } while(0);
4837 0 : return size;
4838 0 : }
4839 :
4840 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account(fd_vote_instruction_t const * self) {
4841 0 : return self->discriminant == 0;
4842 0 : }
4843 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize(fd_vote_instruction_t const * self) {
4844 0 : return self->discriminant == 1;
4845 0 : }
4846 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote(fd_vote_instruction_t const * self) {
4847 0 : return self->discriminant == 2;
4848 0 : }
4849 0 : FD_FN_PURE uchar fd_vote_instruction_is_withdraw(fd_vote_instruction_t const * self) {
4850 0 : return self->discriminant == 3;
4851 0 : }
4852 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_validator_identity(fd_vote_instruction_t const * self) {
4853 0 : return self->discriminant == 4;
4854 0 : }
4855 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission(fd_vote_instruction_t const * self) {
4856 0 : return self->discriminant == 5;
4857 0 : }
4858 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote_switch(fd_vote_instruction_t const * self) {
4859 0 : return self->discriminant == 6;
4860 0 : }
4861 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked(fd_vote_instruction_t const * self) {
4862 0 : return self->discriminant == 7;
4863 0 : }
4864 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state(fd_vote_instruction_t const * self) {
4865 0 : return self->discriminant == 8;
4866 0 : }
4867 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state_switch(fd_vote_instruction_t const * self) {
4868 0 : return self->discriminant == 9;
4869 0 : }
4870 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_with_seed(fd_vote_instruction_t const * self) {
4871 0 : return self->discriminant == 10;
4872 0 : }
4873 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked_with_seed(fd_vote_instruction_t const * self) {
4874 0 : return self->discriminant == 11;
4875 0 : }
4876 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state(fd_vote_instruction_t const * self) {
4877 0 : return self->discriminant == 12;
4878 0 : }
4879 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state_switch(fd_vote_instruction_t const * self) {
4880 0 : return self->discriminant == 13;
4881 0 : }
4882 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync(fd_vote_instruction_t const * self) {
4883 0 : return self->discriminant == 14;
4884 0 : }
4885 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync_switch(fd_vote_instruction_t const * self) {
4886 0 : return self->discriminant == 15;
4887 0 : }
4888 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant );
4889 0 : int fd_vote_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4890 0 : int err;
4891 0 : switch (discriminant) {
4892 0 : case 0: {
4893 0 : err = fd_vote_init_decode_footprint_inner( ctx, total_sz );
4894 0 : if( FD_UNLIKELY( err ) ) return err;
4895 0 : return FD_BINCODE_SUCCESS;
4896 0 : }
4897 0 : case 1: {
4898 0 : err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
4899 0 : if( FD_UNLIKELY( err ) ) return err;
4900 0 : return FD_BINCODE_SUCCESS;
4901 0 : }
4902 0 : case 2: {
4903 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
4904 0 : if( FD_UNLIKELY( err ) ) return err;
4905 0 : return FD_BINCODE_SUCCESS;
4906 0 : }
4907 0 : case 3: {
4908 0 : err = fd_bincode_uint64_decode_footprint( ctx );
4909 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4910 0 : return FD_BINCODE_SUCCESS;
4911 0 : }
4912 0 : case 4: {
4913 0 : return FD_BINCODE_SUCCESS;
4914 0 : }
4915 0 : case 5: {
4916 0 : err = fd_bincode_uint8_decode_footprint( ctx );
4917 0 : if( FD_UNLIKELY( err ) ) return err;
4918 0 : return FD_BINCODE_SUCCESS;
4919 0 : }
4920 0 : case 6: {
4921 0 : err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
4922 0 : if( FD_UNLIKELY( err ) ) return err;
4923 0 : return FD_BINCODE_SUCCESS;
4924 0 : }
4925 0 : case 7: {
4926 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4927 0 : if( FD_UNLIKELY( err ) ) return err;
4928 0 : return FD_BINCODE_SUCCESS;
4929 0 : }
4930 0 : case 8: {
4931 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
4932 0 : if( FD_UNLIKELY( err ) ) return err;
4933 0 : return FD_BINCODE_SUCCESS;
4934 0 : }
4935 0 : case 9: {
4936 0 : err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
4937 0 : if( FD_UNLIKELY( err ) ) return err;
4938 0 : return FD_BINCODE_SUCCESS;
4939 0 : }
4940 0 : case 10: {
4941 0 : err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
4942 0 : if( FD_UNLIKELY( err ) ) return err;
4943 0 : return FD_BINCODE_SUCCESS;
4944 0 : }
4945 0 : case 11: {
4946 0 : err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
4947 0 : if( FD_UNLIKELY( err ) ) return err;
4948 0 : return FD_BINCODE_SUCCESS;
4949 0 : }
4950 0 : case 12: {
4951 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
4952 0 : if( FD_UNLIKELY( err ) ) return err;
4953 0 : return FD_BINCODE_SUCCESS;
4954 0 : }
4955 0 : case 13: {
4956 0 : err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
4957 0 : if( FD_UNLIKELY( err ) ) return err;
4958 0 : return FD_BINCODE_SUCCESS;
4959 0 : }
4960 0 : case 14: {
4961 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
4962 0 : if( FD_UNLIKELY( err ) ) return err;
4963 0 : return FD_BINCODE_SUCCESS;
4964 0 : }
4965 0 : case 15: {
4966 0 : err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
4967 0 : if( FD_UNLIKELY( err ) ) return err;
4968 0 : return FD_BINCODE_SUCCESS;
4969 0 : }
4970 0 : default: return FD_BINCODE_ERR_ENCODING;
4971 0 : }
4972 0 : }
4973 0 : static int fd_vote_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4974 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4975 0 : uint discriminant = 0;
4976 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4977 0 : if( FD_UNLIKELY( err ) ) return err;
4978 0 : return fd_vote_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
4979 0 : }
4980 0 : int fd_vote_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4981 0 : *total_sz += sizeof(fd_vote_instruction_t);
4982 0 : void const * start_data = ctx->data;
4983 0 : int err = fd_vote_instruction_decode_footprint_inner( ctx, total_sz );
4984 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4985 0 : ctx->data = start_data;
4986 0 : return err;
4987 0 : }
4988 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 ) {
4989 0 : switch (discriminant) {
4990 0 : case 0: {
4991 0 : fd_vote_init_decode_inner( &self->initialize_account, alloc_mem, ctx );
4992 0 : break;
4993 0 : }
4994 0 : case 1: {
4995 0 : fd_vote_authorize_pubkey_decode_inner( &self->authorize, alloc_mem, ctx );
4996 0 : break;
4997 0 : }
4998 0 : case 2: {
4999 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
5000 0 : break;
5001 0 : }
5002 0 : case 3: {
5003 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
5004 0 : break;
5005 0 : }
5006 0 : case 4: {
5007 0 : break;
5008 0 : }
5009 0 : case 5: {
5010 0 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
5011 0 : break;
5012 0 : }
5013 0 : case 6: {
5014 0 : fd_vote_switch_decode_inner( &self->vote_switch, alloc_mem, ctx );
5015 0 : break;
5016 0 : }
5017 0 : case 7: {
5018 0 : fd_vote_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
5019 0 : break;
5020 0 : }
5021 0 : case 8: {
5022 0 : fd_vote_state_update_decode_inner( &self->update_vote_state, alloc_mem, ctx );
5023 0 : break;
5024 0 : }
5025 0 : case 9: {
5026 0 : fd_update_vote_state_switch_decode_inner( &self->update_vote_state_switch, alloc_mem, ctx );
5027 0 : break;
5028 0 : }
5029 0 : case 10: {
5030 0 : fd_vote_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
5031 0 : break;
5032 0 : }
5033 0 : case 11: {
5034 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
5035 0 : break;
5036 0 : }
5037 0 : case 12: {
5038 0 : fd_compact_vote_state_update_decode_inner( &self->compact_update_vote_state, alloc_mem, ctx );
5039 0 : break;
5040 0 : }
5041 0 : case 13: {
5042 0 : fd_compact_vote_state_update_switch_decode_inner( &self->compact_update_vote_state_switch, alloc_mem, ctx );
5043 0 : break;
5044 0 : }
5045 0 : case 14: {
5046 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
5047 0 : break;
5048 0 : }
5049 0 : case 15: {
5050 0 : fd_tower_sync_switch_decode_inner( &self->tower_sync_switch, alloc_mem, ctx );
5051 0 : break;
5052 0 : }
5053 0 : }
5054 0 : }
5055 0 : static void fd_vote_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5056 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)struct_mem;
5057 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5058 0 : fd_vote_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
5059 0 : }
5060 0 : void * fd_vote_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5061 0 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)mem;
5062 0 : fd_vote_instruction_new( self );
5063 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_instruction_t);
5064 0 : void * * alloc_mem = &alloc_region;
5065 0 : fd_vote_instruction_decode_inner( mem, alloc_mem, ctx );
5066 0 : return self;
5067 0 : }
5068 0 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant ) {
5069 0 : switch( discriminant ) {
5070 0 : case 0: {
5071 0 : fd_vote_init_new( &self->initialize_account );
5072 0 : break;
5073 0 : }
5074 0 : case 1: {
5075 0 : fd_vote_authorize_pubkey_new( &self->authorize );
5076 0 : break;
5077 0 : }
5078 0 : case 2: {
5079 0 : fd_vote_new( &self->vote );
5080 0 : break;
5081 0 : }
5082 0 : case 3: {
5083 0 : break;
5084 0 : }
5085 0 : case 4: {
5086 0 : break;
5087 0 : }
5088 0 : case 5: {
5089 0 : break;
5090 0 : }
5091 0 : case 6: {
5092 0 : fd_vote_switch_new( &self->vote_switch );
5093 0 : break;
5094 0 : }
5095 0 : case 7: {
5096 0 : fd_vote_authorize_new( &self->authorize_checked );
5097 0 : break;
5098 0 : }
5099 0 : case 8: {
5100 0 : fd_vote_state_update_new( &self->update_vote_state );
5101 0 : break;
5102 0 : }
5103 0 : case 9: {
5104 0 : fd_update_vote_state_switch_new( &self->update_vote_state_switch );
5105 0 : break;
5106 0 : }
5107 0 : case 10: {
5108 0 : fd_vote_authorize_with_seed_args_new( &self->authorize_with_seed );
5109 0 : break;
5110 0 : }
5111 0 : case 11: {
5112 0 : fd_vote_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
5113 0 : break;
5114 0 : }
5115 0 : case 12: {
5116 0 : fd_compact_vote_state_update_new( &self->compact_update_vote_state );
5117 0 : break;
5118 0 : }
5119 0 : case 13: {
5120 0 : fd_compact_vote_state_update_switch_new( &self->compact_update_vote_state_switch );
5121 0 : break;
5122 0 : }
5123 0 : case 14: {
5124 0 : fd_tower_sync_new( &self->tower_sync );
5125 0 : break;
5126 0 : }
5127 0 : case 15: {
5128 0 : fd_tower_sync_switch_new( &self->tower_sync_switch );
5129 0 : break;
5130 0 : }
5131 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
5132 0 : }
5133 0 : }
5134 0 : void fd_vote_instruction_new_disc( fd_vote_instruction_t * self, uint discriminant ) {
5135 0 : self->discriminant = discriminant;
5136 0 : fd_vote_instruction_inner_new( &self->inner, self->discriminant );
5137 0 : }
5138 0 : void fd_vote_instruction_new( fd_vote_instruction_t * self ) {
5139 0 : fd_memset( self, 0, sizeof(fd_vote_instruction_t) );
5140 0 : fd_vote_instruction_new_disc( self, UINT_MAX );
5141 0 : }
5142 :
5143 0 : ulong fd_vote_instruction_size( fd_vote_instruction_t const * self ) {
5144 0 : ulong size = 0;
5145 0 : size += sizeof(uint);
5146 0 : switch (self->discriminant) {
5147 0 : case 0: {
5148 0 : size += fd_vote_init_size( &self->inner.initialize_account );
5149 0 : break;
5150 0 : }
5151 0 : case 1: {
5152 0 : size += fd_vote_authorize_pubkey_size( &self->inner.authorize );
5153 0 : break;
5154 0 : }
5155 0 : case 2: {
5156 0 : size += fd_vote_size( &self->inner.vote );
5157 0 : break;
5158 0 : }
5159 0 : case 3: {
5160 0 : size += sizeof(ulong);
5161 0 : break;
5162 0 : }
5163 0 : case 5: {
5164 0 : size += sizeof(char);
5165 0 : break;
5166 0 : }
5167 0 : case 6: {
5168 0 : size += fd_vote_switch_size( &self->inner.vote_switch );
5169 0 : break;
5170 0 : }
5171 0 : case 7: {
5172 0 : size += fd_vote_authorize_size( &self->inner.authorize_checked );
5173 0 : break;
5174 0 : }
5175 0 : case 8: {
5176 0 : size += fd_vote_state_update_size( &self->inner.update_vote_state );
5177 0 : break;
5178 0 : }
5179 0 : case 9: {
5180 0 : size += fd_update_vote_state_switch_size( &self->inner.update_vote_state_switch );
5181 0 : break;
5182 0 : }
5183 0 : case 10: {
5184 0 : size += fd_vote_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
5185 0 : break;
5186 0 : }
5187 0 : case 11: {
5188 0 : size += fd_vote_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
5189 0 : break;
5190 0 : }
5191 0 : case 12: {
5192 0 : size += fd_compact_vote_state_update_size( &self->inner.compact_update_vote_state );
5193 0 : break;
5194 0 : }
5195 0 : case 13: {
5196 0 : size += fd_compact_vote_state_update_switch_size( &self->inner.compact_update_vote_state_switch );
5197 0 : break;
5198 0 : }
5199 0 : case 14: {
5200 0 : size += fd_tower_sync_size( &self->inner.tower_sync );
5201 0 : break;
5202 0 : }
5203 0 : case 15: {
5204 0 : size += fd_tower_sync_switch_size( &self->inner.tower_sync_switch );
5205 0 : break;
5206 0 : }
5207 0 : }
5208 0 : return size;
5209 0 : }
5210 :
5211 0 : int fd_vote_instruction_inner_encode( fd_vote_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
5212 0 : int err;
5213 0 : switch (discriminant) {
5214 0 : case 0: {
5215 0 : err = fd_vote_init_encode( &self->initialize_account, ctx );
5216 0 : if( FD_UNLIKELY( err ) ) return err;
5217 0 : break;
5218 0 : }
5219 0 : case 1: {
5220 0 : err = fd_vote_authorize_pubkey_encode( &self->authorize, ctx );
5221 0 : if( FD_UNLIKELY( err ) ) return err;
5222 0 : break;
5223 0 : }
5224 0 : case 2: {
5225 0 : err = fd_vote_encode( &self->vote, ctx );
5226 0 : if( FD_UNLIKELY( err ) ) return err;
5227 0 : break;
5228 0 : }
5229 0 : case 3: {
5230 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
5231 0 : if( FD_UNLIKELY( err ) ) return err;
5232 0 : break;
5233 0 : }
5234 0 : case 5: {
5235 0 : err = fd_bincode_uint8_encode( (uchar)(self->update_commission), ctx );
5236 0 : if( FD_UNLIKELY( err ) ) return err;
5237 0 : break;
5238 0 : }
5239 0 : case 6: {
5240 0 : err = fd_vote_switch_encode( &self->vote_switch, ctx );
5241 0 : if( FD_UNLIKELY( err ) ) return err;
5242 0 : break;
5243 0 : }
5244 0 : case 7: {
5245 0 : err = fd_vote_authorize_encode( &self->authorize_checked, ctx );
5246 0 : if( FD_UNLIKELY( err ) ) return err;
5247 0 : break;
5248 0 : }
5249 0 : case 8: {
5250 0 : err = fd_vote_state_update_encode( &self->update_vote_state, ctx );
5251 0 : if( FD_UNLIKELY( err ) ) return err;
5252 0 : break;
5253 0 : }
5254 0 : case 9: {
5255 0 : err = fd_update_vote_state_switch_encode( &self->update_vote_state_switch, ctx );
5256 0 : if( FD_UNLIKELY( err ) ) return err;
5257 0 : break;
5258 0 : }
5259 0 : case 10: {
5260 0 : err = fd_vote_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
5261 0 : if( FD_UNLIKELY( err ) ) return err;
5262 0 : break;
5263 0 : }
5264 0 : case 11: {
5265 0 : err = fd_vote_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
5266 0 : if( FD_UNLIKELY( err ) ) return err;
5267 0 : break;
5268 0 : }
5269 0 : case 12: {
5270 0 : err = fd_compact_vote_state_update_encode( &self->compact_update_vote_state, ctx );
5271 0 : if( FD_UNLIKELY( err ) ) return err;
5272 0 : break;
5273 0 : }
5274 0 : case 13: {
5275 0 : err = fd_compact_vote_state_update_switch_encode( &self->compact_update_vote_state_switch, ctx );
5276 0 : if( FD_UNLIKELY( err ) ) return err;
5277 0 : break;
5278 0 : }
5279 0 : case 14: {
5280 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
5281 0 : if( FD_UNLIKELY( err ) ) return err;
5282 0 : break;
5283 0 : }
5284 0 : case 15: {
5285 0 : err = fd_tower_sync_switch_encode( &self->tower_sync_switch, ctx );
5286 0 : if( FD_UNLIKELY( err ) ) return err;
5287 0 : break;
5288 0 : }
5289 0 : }
5290 0 : return FD_BINCODE_SUCCESS;
5291 0 : }
5292 0 : int fd_vote_instruction_encode( fd_vote_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5293 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
5294 0 : if( FD_UNLIKELY( err ) ) return err;
5295 0 : return fd_vote_instruction_inner_encode( &self->inner, self->discriminant, ctx );
5296 0 : }
5297 :
5298 0 : int fd_system_program_instruction_create_account_encode( fd_system_program_instruction_create_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5299 0 : int err;
5300 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5301 0 : if( FD_UNLIKELY( err ) ) return err;
5302 0 : err = fd_bincode_uint64_encode( self->space, ctx );
5303 0 : if( FD_UNLIKELY( err ) ) return err;
5304 0 : err = fd_pubkey_encode( &self->owner, ctx );
5305 0 : if( FD_UNLIKELY( err ) ) return err;
5306 0 : return FD_BINCODE_SUCCESS;
5307 0 : }
5308 0 : static inline int fd_system_program_instruction_create_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5309 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5310 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
5311 0 : return 0;
5312 0 : }
5313 0 : static void fd_system_program_instruction_create_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5314 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)struct_mem;
5315 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5316 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
5317 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5318 0 : }
5319 0 : void * fd_system_program_instruction_create_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5320 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)mem;
5321 0 : fd_system_program_instruction_create_account_new( self );
5322 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_t);
5323 0 : void * * alloc_mem = &alloc_region;
5324 0 : fd_system_program_instruction_create_account_decode_inner( mem, alloc_mem, ctx );
5325 0 : return self;
5326 0 : }
5327 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 ) {
5328 0 : int err;
5329 0 : err = fd_pubkey_encode( &self->base, ctx );
5330 0 : if( FD_UNLIKELY( err ) ) return err;
5331 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
5332 0 : if( FD_UNLIKELY(err) ) return err;
5333 0 : if( self->seed_len ) {
5334 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
5335 0 : if( FD_UNLIKELY( err ) ) return err;
5336 0 : }
5337 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5338 0 : if( FD_UNLIKELY( err ) ) return err;
5339 0 : err = fd_bincode_uint64_encode( self->space, ctx );
5340 0 : if( FD_UNLIKELY( err ) ) return err;
5341 0 : err = fd_pubkey_encode( &self->owner, ctx );
5342 0 : if( FD_UNLIKELY( err ) ) return err;
5343 0 : return FD_BINCODE_SUCCESS;
5344 0 : }
5345 0 : static int fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5346 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5347 0 : int err = 0;
5348 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5349 0 : if( FD_UNLIKELY( err ) ) return err;
5350 0 : ulong seed_len;
5351 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
5352 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5353 0 : *total_sz += seed_len;
5354 0 : if( seed_len ) {
5355 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
5356 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5357 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
5358 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5359 0 : }
5360 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5361 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5362 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5363 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5364 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5365 0 : if( FD_UNLIKELY( err ) ) return err;
5366 0 : return 0;
5367 0 : }
5368 0 : int fd_system_program_instruction_create_account_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5369 0 : *total_sz += sizeof(fd_system_program_instruction_create_account_with_seed_t);
5370 0 : void const * start_data = ctx->data;
5371 0 : int err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
5372 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5373 0 : ctx->data = start_data;
5374 0 : return err;
5375 0 : }
5376 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 ) {
5377 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)struct_mem;
5378 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
5379 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
5380 0 : if( self->seed_len ) {
5381 0 : self->seed = *alloc_mem;
5382 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
5383 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
5384 0 : } else
5385 0 : self->seed = NULL;
5386 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5387 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
5388 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5389 0 : }
5390 0 : void * fd_system_program_instruction_create_account_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5391 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)mem;
5392 0 : fd_system_program_instruction_create_account_with_seed_new( self );
5393 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_with_seed_t);
5394 0 : void * * alloc_mem = &alloc_region;
5395 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( mem, alloc_mem, ctx );
5396 0 : return self;
5397 0 : }
5398 0 : void fd_system_program_instruction_create_account_with_seed_new(fd_system_program_instruction_create_account_with_seed_t * self) {
5399 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_with_seed_t) );
5400 0 : fd_pubkey_new( &self->base );
5401 0 : fd_pubkey_new( &self->owner );
5402 0 : }
5403 0 : ulong fd_system_program_instruction_create_account_with_seed_size( fd_system_program_instruction_create_account_with_seed_t const * self ) {
5404 0 : ulong size = 0;
5405 0 : size += fd_pubkey_size( &self->base );
5406 0 : do {
5407 0 : size += sizeof(ulong);
5408 0 : size += self->seed_len;
5409 0 : } while(0);
5410 0 : size += sizeof(ulong);
5411 0 : size += sizeof(ulong);
5412 0 : size += fd_pubkey_size( &self->owner );
5413 0 : return size;
5414 0 : }
5415 :
5416 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 ) {
5417 0 : int err;
5418 0 : err = fd_pubkey_encode( &self->base, ctx );
5419 0 : if( FD_UNLIKELY( err ) ) return err;
5420 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
5421 0 : if( FD_UNLIKELY(err) ) return err;
5422 0 : if( self->seed_len ) {
5423 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
5424 0 : if( FD_UNLIKELY( err ) ) return err;
5425 0 : }
5426 0 : err = fd_bincode_uint64_encode( self->space, ctx );
5427 0 : if( FD_UNLIKELY( err ) ) return err;
5428 0 : err = fd_pubkey_encode( &self->owner, ctx );
5429 0 : if( FD_UNLIKELY( err ) ) return err;
5430 0 : return FD_BINCODE_SUCCESS;
5431 0 : }
5432 0 : static int fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5433 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5434 0 : int err = 0;
5435 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5436 0 : if( FD_UNLIKELY( err ) ) return err;
5437 0 : ulong seed_len;
5438 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
5439 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5440 0 : *total_sz += seed_len;
5441 0 : if( seed_len ) {
5442 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
5443 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5444 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
5445 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5446 0 : }
5447 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5448 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5449 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5450 0 : if( FD_UNLIKELY( err ) ) return err;
5451 0 : return 0;
5452 0 : }
5453 0 : int fd_system_program_instruction_allocate_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5454 0 : *total_sz += sizeof(fd_system_program_instruction_allocate_with_seed_t);
5455 0 : void const * start_data = ctx->data;
5456 0 : int err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
5457 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5458 0 : ctx->data = start_data;
5459 0 : return err;
5460 0 : }
5461 0 : static void fd_system_program_instruction_allocate_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5462 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)struct_mem;
5463 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
5464 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
5465 0 : if( self->seed_len ) {
5466 0 : self->seed = *alloc_mem;
5467 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
5468 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
5469 0 : } else
5470 0 : self->seed = NULL;
5471 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
5472 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5473 0 : }
5474 0 : void * fd_system_program_instruction_allocate_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5475 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)mem;
5476 0 : fd_system_program_instruction_allocate_with_seed_new( self );
5477 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_allocate_with_seed_t);
5478 0 : void * * alloc_mem = &alloc_region;
5479 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( mem, alloc_mem, ctx );
5480 0 : return self;
5481 0 : }
5482 0 : void fd_system_program_instruction_allocate_with_seed_new(fd_system_program_instruction_allocate_with_seed_t * self) {
5483 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_allocate_with_seed_t) );
5484 0 : fd_pubkey_new( &self->base );
5485 0 : fd_pubkey_new( &self->owner );
5486 0 : }
5487 0 : ulong fd_system_program_instruction_allocate_with_seed_size( fd_system_program_instruction_allocate_with_seed_t const * self ) {
5488 0 : ulong size = 0;
5489 0 : size += fd_pubkey_size( &self->base );
5490 0 : do {
5491 0 : size += sizeof(ulong);
5492 0 : size += self->seed_len;
5493 0 : } while(0);
5494 0 : size += sizeof(ulong);
5495 0 : size += fd_pubkey_size( &self->owner );
5496 0 : return size;
5497 0 : }
5498 :
5499 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 ) {
5500 0 : int err;
5501 0 : err = fd_pubkey_encode( &self->base, ctx );
5502 0 : if( FD_UNLIKELY( err ) ) return err;
5503 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
5504 0 : if( FD_UNLIKELY(err) ) return err;
5505 0 : if( self->seed_len ) {
5506 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
5507 0 : if( FD_UNLIKELY( err ) ) return err;
5508 0 : }
5509 0 : err = fd_pubkey_encode( &self->owner, ctx );
5510 0 : if( FD_UNLIKELY( err ) ) return err;
5511 0 : return FD_BINCODE_SUCCESS;
5512 0 : }
5513 0 : static int fd_system_program_instruction_assign_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5514 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5515 0 : int err = 0;
5516 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5517 0 : if( FD_UNLIKELY( err ) ) return err;
5518 0 : ulong seed_len;
5519 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
5520 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5521 0 : *total_sz += seed_len;
5522 0 : if( seed_len ) {
5523 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
5524 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5525 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
5526 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5527 0 : }
5528 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5529 0 : if( FD_UNLIKELY( err ) ) return err;
5530 0 : return 0;
5531 0 : }
5532 0 : int fd_system_program_instruction_assign_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5533 0 : *total_sz += sizeof(fd_system_program_instruction_assign_with_seed_t);
5534 0 : void const * start_data = ctx->data;
5535 0 : int err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
5536 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5537 0 : ctx->data = start_data;
5538 0 : return err;
5539 0 : }
5540 0 : static void fd_system_program_instruction_assign_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5541 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)struct_mem;
5542 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
5543 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
5544 0 : if( self->seed_len ) {
5545 0 : self->seed = *alloc_mem;
5546 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
5547 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
5548 0 : } else
5549 0 : self->seed = NULL;
5550 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5551 0 : }
5552 0 : void * fd_system_program_instruction_assign_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5553 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)mem;
5554 0 : fd_system_program_instruction_assign_with_seed_new( self );
5555 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_assign_with_seed_t);
5556 0 : void * * alloc_mem = &alloc_region;
5557 0 : fd_system_program_instruction_assign_with_seed_decode_inner( mem, alloc_mem, ctx );
5558 0 : return self;
5559 0 : }
5560 0 : void fd_system_program_instruction_assign_with_seed_new(fd_system_program_instruction_assign_with_seed_t * self) {
5561 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_assign_with_seed_t) );
5562 0 : fd_pubkey_new( &self->base );
5563 0 : fd_pubkey_new( &self->owner );
5564 0 : }
5565 0 : ulong fd_system_program_instruction_assign_with_seed_size( fd_system_program_instruction_assign_with_seed_t const * self ) {
5566 0 : ulong size = 0;
5567 0 : size += fd_pubkey_size( &self->base );
5568 0 : do {
5569 0 : size += sizeof(ulong);
5570 0 : size += self->seed_len;
5571 0 : } while(0);
5572 0 : size += fd_pubkey_size( &self->owner );
5573 0 : return size;
5574 0 : }
5575 :
5576 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 ) {
5577 0 : int err;
5578 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5579 0 : if( FD_UNLIKELY( err ) ) return err;
5580 0 : err = fd_bincode_uint64_encode( self->from_seed_len, ctx );
5581 0 : if( FD_UNLIKELY(err) ) return err;
5582 0 : if( self->from_seed_len ) {
5583 0 : err = fd_bincode_bytes_encode( self->from_seed, self->from_seed_len, ctx );
5584 0 : if( FD_UNLIKELY( err ) ) return err;
5585 0 : }
5586 0 : err = fd_pubkey_encode( &self->from_owner, ctx );
5587 0 : if( FD_UNLIKELY( err ) ) return err;
5588 0 : return FD_BINCODE_SUCCESS;
5589 0 : }
5590 0 : static int fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5591 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5592 0 : int err = 0;
5593 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5594 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5595 0 : ulong from_seed_len;
5596 0 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
5597 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5598 0 : *total_sz += from_seed_len;
5599 0 : if( from_seed_len ) {
5600 0 : err = fd_bincode_bytes_decode_footprint( from_seed_len, ctx );
5601 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5602 0 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
5603 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5604 0 : }
5605 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5606 0 : if( FD_UNLIKELY( err ) ) return err;
5607 0 : return 0;
5608 0 : }
5609 0 : int fd_system_program_instruction_transfer_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5610 0 : *total_sz += sizeof(fd_system_program_instruction_transfer_with_seed_t);
5611 0 : void const * start_data = ctx->data;
5612 0 : int err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
5613 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5614 0 : ctx->data = start_data;
5615 0 : return err;
5616 0 : }
5617 0 : static void fd_system_program_instruction_transfer_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5618 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)struct_mem;
5619 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5620 0 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
5621 0 : if( self->from_seed_len ) {
5622 0 : self->from_seed = *alloc_mem;
5623 0 : fd_bincode_bytes_decode_unsafe( self->from_seed, self->from_seed_len, ctx );
5624 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->from_seed_len;
5625 0 : } else
5626 0 : self->from_seed = NULL;
5627 0 : fd_pubkey_decode_inner( &self->from_owner, alloc_mem, ctx );
5628 0 : }
5629 0 : void * fd_system_program_instruction_transfer_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5630 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)mem;
5631 0 : fd_system_program_instruction_transfer_with_seed_new( self );
5632 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_transfer_with_seed_t);
5633 0 : void * * alloc_mem = &alloc_region;
5634 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( mem, alloc_mem, ctx );
5635 0 : return self;
5636 0 : }
5637 0 : void fd_system_program_instruction_transfer_with_seed_new(fd_system_program_instruction_transfer_with_seed_t * self) {
5638 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_transfer_with_seed_t) );
5639 0 : fd_pubkey_new( &self->from_owner );
5640 0 : }
5641 0 : ulong fd_system_program_instruction_transfer_with_seed_size( fd_system_program_instruction_transfer_with_seed_t const * self ) {
5642 0 : ulong size = 0;
5643 0 : size += sizeof(ulong);
5644 0 : do {
5645 0 : size += sizeof(ulong);
5646 0 : size += self->from_seed_len;
5647 0 : } while(0);
5648 0 : size += fd_pubkey_size( &self->from_owner );
5649 0 : return size;
5650 0 : }
5651 :
5652 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account(fd_system_program_instruction_t const * self) {
5653 0 : return self->discriminant == 0;
5654 0 : }
5655 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign(fd_system_program_instruction_t const * self) {
5656 0 : return self->discriminant == 1;
5657 0 : }
5658 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer(fd_system_program_instruction_t const * self) {
5659 0 : return self->discriminant == 2;
5660 0 : }
5661 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_with_seed(fd_system_program_instruction_t const * self) {
5662 0 : return self->discriminant == 3;
5663 0 : }
5664 0 : FD_FN_PURE uchar fd_system_program_instruction_is_advance_nonce_account(fd_system_program_instruction_t const * self) {
5665 0 : return self->discriminant == 4;
5666 0 : }
5667 0 : FD_FN_PURE uchar fd_system_program_instruction_is_withdraw_nonce_account(fd_system_program_instruction_t const * self) {
5668 0 : return self->discriminant == 5;
5669 0 : }
5670 0 : FD_FN_PURE uchar fd_system_program_instruction_is_initialize_nonce_account(fd_system_program_instruction_t const * self) {
5671 0 : return self->discriminant == 6;
5672 0 : }
5673 0 : FD_FN_PURE uchar fd_system_program_instruction_is_authorize_nonce_account(fd_system_program_instruction_t const * self) {
5674 0 : return self->discriminant == 7;
5675 0 : }
5676 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate(fd_system_program_instruction_t const * self) {
5677 0 : return self->discriminant == 8;
5678 0 : }
5679 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate_with_seed(fd_system_program_instruction_t const * self) {
5680 0 : return self->discriminant == 9;
5681 0 : }
5682 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign_with_seed(fd_system_program_instruction_t const * self) {
5683 0 : return self->discriminant == 10;
5684 0 : }
5685 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer_with_seed(fd_system_program_instruction_t const * self) {
5686 0 : return self->discriminant == 11;
5687 0 : }
5688 0 : FD_FN_PURE uchar fd_system_program_instruction_is_upgrade_nonce_account(fd_system_program_instruction_t const * self) {
5689 0 : return self->discriminant == 12;
5690 0 : }
5691 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant );
5692 24 : int fd_system_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5693 24 : int err;
5694 24 : switch (discriminant) {
5695 0 : case 0: {
5696 0 : err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
5697 0 : if( FD_UNLIKELY( err ) ) return err;
5698 0 : return FD_BINCODE_SUCCESS;
5699 0 : }
5700 0 : case 1: {
5701 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5702 0 : if( FD_UNLIKELY( err ) ) return err;
5703 0 : return FD_BINCODE_SUCCESS;
5704 0 : }
5705 24 : case 2: {
5706 24 : err = fd_bincode_uint64_decode_footprint( ctx );
5707 24 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5708 24 : return FD_BINCODE_SUCCESS;
5709 24 : }
5710 0 : case 3: {
5711 0 : err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
5712 0 : if( FD_UNLIKELY( err ) ) return err;
5713 0 : return FD_BINCODE_SUCCESS;
5714 0 : }
5715 0 : case 4: {
5716 0 : return FD_BINCODE_SUCCESS;
5717 0 : }
5718 0 : case 5: {
5719 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5720 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5721 0 : return FD_BINCODE_SUCCESS;
5722 0 : }
5723 0 : case 6: {
5724 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5725 0 : if( FD_UNLIKELY( err ) ) return err;
5726 0 : return FD_BINCODE_SUCCESS;
5727 0 : }
5728 0 : case 7: {
5729 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5730 0 : if( FD_UNLIKELY( err ) ) return err;
5731 0 : return FD_BINCODE_SUCCESS;
5732 0 : }
5733 0 : case 8: {
5734 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5735 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5736 0 : return FD_BINCODE_SUCCESS;
5737 0 : }
5738 0 : case 9: {
5739 0 : err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
5740 0 : if( FD_UNLIKELY( err ) ) return err;
5741 0 : return FD_BINCODE_SUCCESS;
5742 0 : }
5743 0 : case 10: {
5744 0 : err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
5745 0 : if( FD_UNLIKELY( err ) ) return err;
5746 0 : return FD_BINCODE_SUCCESS;
5747 0 : }
5748 0 : case 11: {
5749 0 : err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
5750 0 : if( FD_UNLIKELY( err ) ) return err;
5751 0 : return FD_BINCODE_SUCCESS;
5752 0 : }
5753 0 : case 12: {
5754 0 : return FD_BINCODE_SUCCESS;
5755 0 : }
5756 0 : default: return FD_BINCODE_ERR_ENCODING;
5757 24 : }
5758 24 : }
5759 24 : static int fd_system_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5760 24 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5761 24 : uint discriminant = 0;
5762 24 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
5763 24 : if( FD_UNLIKELY( err ) ) return err;
5764 24 : return fd_system_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
5765 24 : }
5766 24 : int fd_system_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5767 24 : *total_sz += sizeof(fd_system_program_instruction_t);
5768 24 : void const * start_data = ctx->data;
5769 24 : int err = fd_system_program_instruction_decode_footprint_inner( ctx, total_sz );
5770 24 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5771 24 : ctx->data = start_data;
5772 24 : return err;
5773 24 : }
5774 24 : 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 ) {
5775 24 : switch (discriminant) {
5776 0 : case 0: {
5777 0 : fd_system_program_instruction_create_account_decode_inner( &self->create_account, alloc_mem, ctx );
5778 0 : break;
5779 0 : }
5780 0 : case 1: {
5781 0 : fd_pubkey_decode_inner( &self->assign, alloc_mem, ctx );
5782 0 : break;
5783 0 : }
5784 24 : case 2: {
5785 24 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
5786 24 : break;
5787 0 : }
5788 0 : case 3: {
5789 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( &self->create_account_with_seed, alloc_mem, ctx );
5790 0 : break;
5791 0 : }
5792 0 : case 4: {
5793 0 : break;
5794 0 : }
5795 0 : case 5: {
5796 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
5797 0 : break;
5798 0 : }
5799 0 : case 6: {
5800 0 : fd_pubkey_decode_inner( &self->initialize_nonce_account, alloc_mem, ctx );
5801 0 : break;
5802 0 : }
5803 0 : case 7: {
5804 0 : fd_pubkey_decode_inner( &self->authorize_nonce_account, alloc_mem, ctx );
5805 0 : break;
5806 0 : }
5807 0 : case 8: {
5808 0 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
5809 0 : break;
5810 0 : }
5811 0 : case 9: {
5812 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( &self->allocate_with_seed, alloc_mem, ctx );
5813 0 : break;
5814 0 : }
5815 0 : case 10: {
5816 0 : fd_system_program_instruction_assign_with_seed_decode_inner( &self->assign_with_seed, alloc_mem, ctx );
5817 0 : break;
5818 0 : }
5819 0 : case 11: {
5820 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( &self->transfer_with_seed, alloc_mem, ctx );
5821 0 : break;
5822 0 : }
5823 0 : case 12: {
5824 0 : break;
5825 0 : }
5826 24 : }
5827 24 : }
5828 24 : static void fd_system_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5829 24 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)struct_mem;
5830 24 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5831 24 : fd_system_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
5832 24 : }
5833 24 : void * fd_system_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5834 24 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)mem;
5835 24 : fd_system_program_instruction_new( self );
5836 24 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_t);
5837 24 : void * * alloc_mem = &alloc_region;
5838 24 : fd_system_program_instruction_decode_inner( mem, alloc_mem, ctx );
5839 24 : return self;
5840 24 : }
5841 24 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant ) {
5842 24 : switch( discriminant ) {
5843 0 : case 0: {
5844 0 : fd_system_program_instruction_create_account_new( &self->create_account );
5845 0 : break;
5846 0 : }
5847 0 : case 1: {
5848 0 : fd_pubkey_new( &self->assign );
5849 0 : break;
5850 0 : }
5851 0 : case 2: {
5852 0 : break;
5853 0 : }
5854 0 : case 3: {
5855 0 : fd_system_program_instruction_create_account_with_seed_new( &self->create_account_with_seed );
5856 0 : break;
5857 0 : }
5858 0 : case 4: {
5859 0 : break;
5860 0 : }
5861 0 : case 5: {
5862 0 : break;
5863 0 : }
5864 0 : case 6: {
5865 0 : fd_pubkey_new( &self->initialize_nonce_account );
5866 0 : break;
5867 0 : }
5868 0 : case 7: {
5869 0 : fd_pubkey_new( &self->authorize_nonce_account );
5870 0 : break;
5871 0 : }
5872 0 : case 8: {
5873 0 : break;
5874 0 : }
5875 0 : case 9: {
5876 0 : fd_system_program_instruction_allocate_with_seed_new( &self->allocate_with_seed );
5877 0 : break;
5878 0 : }
5879 0 : case 10: {
5880 0 : fd_system_program_instruction_assign_with_seed_new( &self->assign_with_seed );
5881 0 : break;
5882 0 : }
5883 0 : case 11: {
5884 0 : fd_system_program_instruction_transfer_with_seed_new( &self->transfer_with_seed );
5885 0 : break;
5886 0 : }
5887 0 : case 12: {
5888 0 : break;
5889 0 : }
5890 24 : default: break; // FD_LOG_ERR(( "unhandled type"));
5891 24 : }
5892 24 : }
5893 24 : void fd_system_program_instruction_new_disc( fd_system_program_instruction_t * self, uint discriminant ) {
5894 24 : self->discriminant = discriminant;
5895 24 : fd_system_program_instruction_inner_new( &self->inner, self->discriminant );
5896 24 : }
5897 24 : void fd_system_program_instruction_new( fd_system_program_instruction_t * self ) {
5898 24 : fd_memset( self, 0, sizeof(fd_system_program_instruction_t) );
5899 24 : fd_system_program_instruction_new_disc( self, UINT_MAX );
5900 24 : }
5901 :
5902 0 : ulong fd_system_program_instruction_size( fd_system_program_instruction_t const * self ) {
5903 0 : ulong size = 0;
5904 0 : size += sizeof(uint);
5905 0 : switch (self->discriminant) {
5906 0 : case 0: {
5907 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account );
5908 0 : break;
5909 0 : }
5910 0 : case 1: {
5911 0 : size += fd_pubkey_size( &self->inner.assign );
5912 0 : break;
5913 0 : }
5914 0 : case 2: {
5915 0 : size += sizeof(ulong);
5916 0 : break;
5917 0 : }
5918 0 : case 3: {
5919 0 : size += fd_system_program_instruction_create_account_with_seed_size( &self->inner.create_account_with_seed );
5920 0 : break;
5921 0 : }
5922 0 : case 5: {
5923 0 : size += sizeof(ulong);
5924 0 : break;
5925 0 : }
5926 0 : case 6: {
5927 0 : size += fd_pubkey_size( &self->inner.initialize_nonce_account );
5928 0 : break;
5929 0 : }
5930 0 : case 7: {
5931 0 : size += fd_pubkey_size( &self->inner.authorize_nonce_account );
5932 0 : break;
5933 0 : }
5934 0 : case 8: {
5935 0 : size += sizeof(ulong);
5936 0 : break;
5937 0 : }
5938 0 : case 9: {
5939 0 : size += fd_system_program_instruction_allocate_with_seed_size( &self->inner.allocate_with_seed );
5940 0 : break;
5941 0 : }
5942 0 : case 10: {
5943 0 : size += fd_system_program_instruction_assign_with_seed_size( &self->inner.assign_with_seed );
5944 0 : break;
5945 0 : }
5946 0 : case 11: {
5947 0 : size += fd_system_program_instruction_transfer_with_seed_size( &self->inner.transfer_with_seed );
5948 0 : break;
5949 0 : }
5950 0 : }
5951 0 : return size;
5952 0 : }
5953 :
5954 0 : int fd_system_program_instruction_inner_encode( fd_system_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
5955 0 : int err;
5956 0 : switch (discriminant) {
5957 0 : case 0: {
5958 0 : err = fd_system_program_instruction_create_account_encode( &self->create_account, ctx );
5959 0 : if( FD_UNLIKELY( err ) ) return err;
5960 0 : break;
5961 0 : }
5962 0 : case 1: {
5963 0 : err = fd_pubkey_encode( &self->assign, ctx );
5964 0 : if( FD_UNLIKELY( err ) ) return err;
5965 0 : break;
5966 0 : }
5967 0 : case 2: {
5968 0 : err = fd_bincode_uint64_encode( self->transfer, ctx );
5969 0 : if( FD_UNLIKELY( err ) ) return err;
5970 0 : break;
5971 0 : }
5972 0 : case 3: {
5973 0 : err = fd_system_program_instruction_create_account_with_seed_encode( &self->create_account_with_seed, ctx );
5974 0 : if( FD_UNLIKELY( err ) ) return err;
5975 0 : break;
5976 0 : }
5977 0 : case 5: {
5978 0 : err = fd_bincode_uint64_encode( self->withdraw_nonce_account, ctx );
5979 0 : if( FD_UNLIKELY( err ) ) return err;
5980 0 : break;
5981 0 : }
5982 0 : case 6: {
5983 0 : err = fd_pubkey_encode( &self->initialize_nonce_account, ctx );
5984 0 : if( FD_UNLIKELY( err ) ) return err;
5985 0 : break;
5986 0 : }
5987 0 : case 7: {
5988 0 : err = fd_pubkey_encode( &self->authorize_nonce_account, ctx );
5989 0 : if( FD_UNLIKELY( err ) ) return err;
5990 0 : break;
5991 0 : }
5992 0 : case 8: {
5993 0 : err = fd_bincode_uint64_encode( self->allocate, ctx );
5994 0 : if( FD_UNLIKELY( err ) ) return err;
5995 0 : break;
5996 0 : }
5997 0 : case 9: {
5998 0 : err = fd_system_program_instruction_allocate_with_seed_encode( &self->allocate_with_seed, ctx );
5999 0 : if( FD_UNLIKELY( err ) ) return err;
6000 0 : break;
6001 0 : }
6002 0 : case 10: {
6003 0 : err = fd_system_program_instruction_assign_with_seed_encode( &self->assign_with_seed, ctx );
6004 0 : if( FD_UNLIKELY( err ) ) return err;
6005 0 : break;
6006 0 : }
6007 0 : case 11: {
6008 0 : err = fd_system_program_instruction_transfer_with_seed_encode( &self->transfer_with_seed, ctx );
6009 0 : if( FD_UNLIKELY( err ) ) return err;
6010 0 : break;
6011 0 : }
6012 0 : }
6013 0 : return FD_BINCODE_SUCCESS;
6014 0 : }
6015 0 : int fd_system_program_instruction_encode( fd_system_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6016 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6017 0 : if( FD_UNLIKELY( err ) ) return err;
6018 0 : return fd_system_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
6019 0 : }
6020 :
6021 12 : int fd_stake_authorized_encode( fd_stake_authorized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6022 12 : int err;
6023 12 : err = fd_pubkey_encode( &self->staker, ctx );
6024 12 : if( FD_UNLIKELY( err ) ) return err;
6025 12 : err = fd_pubkey_encode( &self->withdrawer, ctx );
6026 12 : if( FD_UNLIKELY( err ) ) return err;
6027 12 : return FD_BINCODE_SUCCESS;
6028 12 : }
6029 0 : static inline int fd_stake_authorized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6030 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6031 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
6032 0 : return 0;
6033 0 : }
6034 0 : static void fd_stake_authorized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6035 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)struct_mem;
6036 0 : fd_pubkey_decode_inner( &self->staker, alloc_mem, ctx );
6037 0 : fd_pubkey_decode_inner( &self->withdrawer, alloc_mem, ctx );
6038 0 : }
6039 0 : void * fd_stake_authorized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6040 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)mem;
6041 0 : fd_stake_authorized_new( self );
6042 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorized_t);
6043 0 : void * * alloc_mem = &alloc_region;
6044 0 : fd_stake_authorized_decode_inner( mem, alloc_mem, ctx );
6045 0 : return self;
6046 0 : }
6047 12 : int fd_stake_lockup_encode( fd_stake_lockup_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6048 12 : int err;
6049 12 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
6050 12 : if( FD_UNLIKELY( err ) ) return err;
6051 12 : err = fd_bincode_uint64_encode( self->epoch, ctx );
6052 12 : if( FD_UNLIKELY( err ) ) return err;
6053 12 : err = fd_pubkey_encode( &self->custodian, ctx );
6054 12 : if( FD_UNLIKELY( err ) ) return err;
6055 12 : return FD_BINCODE_SUCCESS;
6056 12 : }
6057 0 : static inline int fd_stake_lockup_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6058 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6059 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
6060 0 : return 0;
6061 0 : }
6062 0 : static void fd_stake_lockup_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6063 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)struct_mem;
6064 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
6065 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6066 0 : fd_pubkey_decode_inner( &self->custodian, alloc_mem, ctx );
6067 0 : }
6068 0 : void * fd_stake_lockup_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6069 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)mem;
6070 0 : fd_stake_lockup_new( self );
6071 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_t);
6072 0 : void * * alloc_mem = &alloc_region;
6073 0 : fd_stake_lockup_decode_inner( mem, alloc_mem, ctx );
6074 0 : return self;
6075 0 : }
6076 0 : int fd_stake_instruction_initialize_encode( fd_stake_instruction_initialize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6077 0 : int err;
6078 0 : err = fd_stake_authorized_encode( &self->authorized, ctx );
6079 0 : if( FD_UNLIKELY( err ) ) return err;
6080 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
6081 0 : if( FD_UNLIKELY( err ) ) return err;
6082 0 : return FD_BINCODE_SUCCESS;
6083 0 : }
6084 0 : static inline int fd_stake_instruction_initialize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6085 0 : if( (ulong)ctx->data + 112UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6086 0 : ctx->data = (void *)( (ulong)ctx->data + 112UL );
6087 0 : return 0;
6088 0 : }
6089 0 : static void fd_stake_instruction_initialize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6090 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)struct_mem;
6091 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
6092 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
6093 0 : }
6094 0 : void * fd_stake_instruction_initialize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6095 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)mem;
6096 0 : fd_stake_instruction_initialize_new( self );
6097 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_initialize_t);
6098 0 : void * * alloc_mem = &alloc_region;
6099 0 : fd_stake_instruction_initialize_decode_inner( mem, alloc_mem, ctx );
6100 0 : return self;
6101 0 : }
6102 0 : int fd_stake_lockup_custodian_args_encode( fd_stake_lockup_custodian_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6103 0 : int err;
6104 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
6105 0 : if( FD_UNLIKELY( err ) ) return err;
6106 0 : err = fd_sol_sysvar_clock_encode( &self->clock, ctx );
6107 0 : if( FD_UNLIKELY( err ) ) return err;
6108 0 : if( self->custodian != NULL ) {
6109 0 : err = fd_bincode_bool_encode( 1, ctx );
6110 0 : if( FD_UNLIKELY( err ) ) return err;
6111 0 : err = fd_pubkey_encode( self->custodian, ctx );
6112 0 : if( FD_UNLIKELY( err ) ) return err;
6113 0 : } else {
6114 0 : err = fd_bincode_bool_encode( 0, ctx );
6115 0 : if( FD_UNLIKELY( err ) ) return err;
6116 0 : }
6117 0 : return FD_BINCODE_SUCCESS;
6118 0 : }
6119 0 : static int fd_stake_lockup_custodian_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6120 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6121 0 : int err = 0;
6122 0 : err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
6123 0 : if( FD_UNLIKELY( err ) ) return err;
6124 0 : err = fd_sol_sysvar_clock_decode_footprint_inner( ctx, total_sz );
6125 0 : if( FD_UNLIKELY( err ) ) return err;
6126 0 : {
6127 0 : uchar o;
6128 0 : err = fd_bincode_bool_decode( &o, ctx );
6129 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6130 0 : if( o ) {
6131 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
6132 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6133 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6134 0 : }
6135 0 : }
6136 0 : return 0;
6137 0 : }
6138 0 : int fd_stake_lockup_custodian_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6139 0 : *total_sz += sizeof(fd_stake_lockup_custodian_args_t);
6140 0 : void const * start_data = ctx->data;
6141 0 : int err = fd_stake_lockup_custodian_args_decode_footprint_inner( ctx, total_sz );
6142 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6143 0 : ctx->data = start_data;
6144 0 : return err;
6145 0 : }
6146 0 : static void fd_stake_lockup_custodian_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6147 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)struct_mem;
6148 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
6149 0 : fd_sol_sysvar_clock_decode_inner( &self->clock, alloc_mem, ctx );
6150 0 : {
6151 0 : uchar o;
6152 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6153 0 : if( o ) {
6154 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
6155 0 : self->custodian = *alloc_mem;
6156 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
6157 0 : fd_pubkey_new( self->custodian );
6158 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
6159 0 : } else {
6160 0 : self->custodian = NULL;
6161 0 : }
6162 0 : }
6163 0 : }
6164 0 : void * fd_stake_lockup_custodian_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6165 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)mem;
6166 0 : fd_stake_lockup_custodian_args_new( self );
6167 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_custodian_args_t);
6168 0 : void * * alloc_mem = &alloc_region;
6169 0 : fd_stake_lockup_custodian_args_decode_inner( mem, alloc_mem, ctx );
6170 0 : return self;
6171 0 : }
6172 0 : void fd_stake_lockup_custodian_args_new(fd_stake_lockup_custodian_args_t * self) {
6173 0 : fd_memset( self, 0, sizeof(fd_stake_lockup_custodian_args_t) );
6174 0 : fd_stake_lockup_new( &self->lockup );
6175 0 : fd_sol_sysvar_clock_new( &self->clock );
6176 0 : }
6177 0 : ulong fd_stake_lockup_custodian_args_size( fd_stake_lockup_custodian_args_t const * self ) {
6178 0 : ulong size = 0;
6179 0 : size += fd_stake_lockup_size( &self->lockup );
6180 0 : size += fd_sol_sysvar_clock_size( &self->clock );
6181 0 : size += sizeof(char);
6182 0 : if( NULL != self->custodian ) {
6183 0 : size += fd_pubkey_size( self->custodian );
6184 0 : }
6185 0 : return size;
6186 0 : }
6187 :
6188 0 : FD_FN_PURE uchar fd_stake_authorize_is_staker(fd_stake_authorize_t const * self) {
6189 0 : return self->discriminant == 0;
6190 0 : }
6191 0 : FD_FN_PURE uchar fd_stake_authorize_is_withdrawer(fd_stake_authorize_t const * self) {
6192 0 : return self->discriminant == 1;
6193 0 : }
6194 0 : int fd_stake_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6195 0 : int err;
6196 0 : switch (discriminant) {
6197 0 : case 0: {
6198 0 : return FD_BINCODE_SUCCESS;
6199 0 : }
6200 0 : case 1: {
6201 0 : return FD_BINCODE_SUCCESS;
6202 0 : }
6203 0 : default: return FD_BINCODE_ERR_ENCODING;
6204 0 : }
6205 0 : }
6206 0 : static int fd_stake_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6207 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6208 0 : uint discriminant = 0;
6209 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6210 0 : if( FD_UNLIKELY( err ) ) return err;
6211 0 : return fd_stake_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
6212 0 : }
6213 0 : int fd_stake_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6214 0 : *total_sz += sizeof(fd_stake_authorize_t);
6215 0 : void const * start_data = ctx->data;
6216 0 : int err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6217 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6218 0 : ctx->data = start_data;
6219 0 : return err;
6220 0 : }
6221 0 : static void fd_stake_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6222 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)struct_mem;
6223 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6224 0 : }
6225 0 : void * fd_stake_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6226 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)mem;
6227 0 : fd_stake_authorize_new( self );
6228 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorize_t);
6229 0 : void * * alloc_mem = &alloc_region;
6230 0 : fd_stake_authorize_decode_inner( mem, alloc_mem, ctx );
6231 0 : return self;
6232 0 : }
6233 :
6234 0 : ulong fd_stake_authorize_size( fd_stake_authorize_t const * self ) {
6235 0 : ulong size = 0;
6236 0 : size += sizeof(uint);
6237 0 : switch (self->discriminant) {
6238 0 : }
6239 0 : return size;
6240 0 : }
6241 :
6242 0 : int fd_stake_authorize_encode( fd_stake_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6243 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6244 0 : if( FD_UNLIKELY( err ) ) return err;
6245 0 : return err;
6246 0 : }
6247 :
6248 0 : int fd_stake_instruction_authorize_encode( fd_stake_instruction_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6249 0 : int err;
6250 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
6251 0 : if( FD_UNLIKELY( err ) ) return err;
6252 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
6253 0 : if( FD_UNLIKELY( err ) ) return err;
6254 0 : return FD_BINCODE_SUCCESS;
6255 0 : }
6256 0 : static int fd_stake_instruction_authorize_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 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6262 0 : if( FD_UNLIKELY( err ) ) return err;
6263 0 : return 0;
6264 0 : }
6265 0 : int fd_stake_instruction_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6266 0 : *total_sz += sizeof(fd_stake_instruction_authorize_t);
6267 0 : void const * start_data = ctx->data;
6268 0 : int err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
6269 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6270 0 : ctx->data = start_data;
6271 0 : return err;
6272 0 : }
6273 0 : static void fd_stake_instruction_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6274 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)struct_mem;
6275 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
6276 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
6277 0 : }
6278 0 : void * fd_stake_instruction_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6279 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)mem;
6280 0 : fd_stake_instruction_authorize_new( self );
6281 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_authorize_t);
6282 0 : void * * alloc_mem = &alloc_region;
6283 0 : fd_stake_instruction_authorize_decode_inner( mem, alloc_mem, ctx );
6284 0 : return self;
6285 0 : }
6286 0 : void fd_stake_instruction_authorize_new(fd_stake_instruction_authorize_t * self) {
6287 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_authorize_t) );
6288 0 : fd_pubkey_new( &self->pubkey );
6289 0 : fd_stake_authorize_new( &self->stake_authorize );
6290 0 : }
6291 0 : int fd_authorize_with_seed_args_encode( fd_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6292 0 : int err;
6293 0 : err = fd_pubkey_encode( &self->new_authorized_pubkey, ctx );
6294 0 : if( FD_UNLIKELY( err ) ) return err;
6295 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
6296 0 : if( FD_UNLIKELY( err ) ) return err;
6297 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
6298 0 : if( FD_UNLIKELY(err) ) return err;
6299 0 : if( self->authority_seed_len ) {
6300 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
6301 0 : if( FD_UNLIKELY( err ) ) return err;
6302 0 : }
6303 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
6304 0 : if( FD_UNLIKELY( err ) ) return err;
6305 0 : return FD_BINCODE_SUCCESS;
6306 0 : }
6307 0 : static int fd_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6308 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6309 0 : int err = 0;
6310 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6311 0 : if( FD_UNLIKELY( err ) ) return err;
6312 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6313 0 : if( FD_UNLIKELY( err ) ) return err;
6314 0 : ulong authority_seed_len;
6315 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
6316 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6317 0 : *total_sz += authority_seed_len;
6318 0 : if( authority_seed_len ) {
6319 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
6320 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6321 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
6322 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6323 0 : }
6324 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6325 0 : if( FD_UNLIKELY( err ) ) return err;
6326 0 : return 0;
6327 0 : }
6328 0 : int fd_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6329 0 : *total_sz += sizeof(fd_authorize_with_seed_args_t);
6330 0 : void const * start_data = ctx->data;
6331 0 : int err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
6332 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6333 0 : ctx->data = start_data;
6334 0 : return err;
6335 0 : }
6336 0 : static void fd_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6337 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)struct_mem;
6338 0 : fd_pubkey_decode_inner( &self->new_authorized_pubkey, alloc_mem, ctx );
6339 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
6340 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
6341 0 : if( self->authority_seed_len ) {
6342 0 : self->authority_seed = *alloc_mem;
6343 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
6344 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
6345 0 : } else
6346 0 : self->authority_seed = NULL;
6347 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
6348 0 : }
6349 0 : void * fd_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6350 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)mem;
6351 0 : fd_authorize_with_seed_args_new( self );
6352 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_with_seed_args_t);
6353 0 : void * * alloc_mem = &alloc_region;
6354 0 : fd_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
6355 0 : return self;
6356 0 : }
6357 0 : void fd_authorize_with_seed_args_new(fd_authorize_with_seed_args_t * self) {
6358 0 : fd_memset( self, 0, sizeof(fd_authorize_with_seed_args_t) );
6359 0 : fd_pubkey_new( &self->new_authorized_pubkey );
6360 0 : fd_stake_authorize_new( &self->stake_authorize );
6361 0 : fd_pubkey_new( &self->authority_owner );
6362 0 : }
6363 0 : ulong fd_authorize_with_seed_args_size( fd_authorize_with_seed_args_t const * self ) {
6364 0 : ulong size = 0;
6365 0 : size += fd_pubkey_size( &self->new_authorized_pubkey );
6366 0 : size += fd_stake_authorize_size( &self->stake_authorize );
6367 0 : do {
6368 0 : size += sizeof(ulong);
6369 0 : size += self->authority_seed_len;
6370 0 : } while(0);
6371 0 : size += fd_pubkey_size( &self->authority_owner );
6372 0 : return size;
6373 0 : }
6374 :
6375 0 : int fd_authorize_checked_with_seed_args_encode( fd_authorize_checked_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6376 0 : int err;
6377 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
6378 0 : if( FD_UNLIKELY( err ) ) return err;
6379 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
6380 0 : if( FD_UNLIKELY(err) ) return err;
6381 0 : if( self->authority_seed_len ) {
6382 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
6383 0 : if( FD_UNLIKELY( err ) ) return err;
6384 0 : }
6385 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
6386 0 : if( FD_UNLIKELY( err ) ) return err;
6387 0 : return FD_BINCODE_SUCCESS;
6388 0 : }
6389 0 : static int fd_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6390 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6391 0 : int err = 0;
6392 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6393 0 : if( FD_UNLIKELY( err ) ) return err;
6394 0 : ulong authority_seed_len;
6395 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
6396 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6397 0 : *total_sz += authority_seed_len;
6398 0 : if( authority_seed_len ) {
6399 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
6400 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6401 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
6402 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6403 0 : }
6404 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6405 0 : if( FD_UNLIKELY( err ) ) return err;
6406 0 : return 0;
6407 0 : }
6408 0 : int fd_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6409 0 : *total_sz += sizeof(fd_authorize_checked_with_seed_args_t);
6410 0 : void const * start_data = ctx->data;
6411 0 : int err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
6412 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6413 0 : ctx->data = start_data;
6414 0 : return err;
6415 0 : }
6416 0 : static void fd_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6417 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)struct_mem;
6418 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
6419 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
6420 0 : if( self->authority_seed_len ) {
6421 0 : self->authority_seed = *alloc_mem;
6422 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
6423 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
6424 0 : } else
6425 0 : self->authority_seed = NULL;
6426 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
6427 0 : }
6428 0 : void * fd_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6429 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)mem;
6430 0 : fd_authorize_checked_with_seed_args_new( self );
6431 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_checked_with_seed_args_t);
6432 0 : void * * alloc_mem = &alloc_region;
6433 0 : fd_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
6434 0 : return self;
6435 0 : }
6436 0 : void fd_authorize_checked_with_seed_args_new(fd_authorize_checked_with_seed_args_t * self) {
6437 0 : fd_memset( self, 0, sizeof(fd_authorize_checked_with_seed_args_t) );
6438 0 : fd_stake_authorize_new( &self->stake_authorize );
6439 0 : fd_pubkey_new( &self->authority_owner );
6440 0 : }
6441 0 : ulong fd_authorize_checked_with_seed_args_size( fd_authorize_checked_with_seed_args_t const * self ) {
6442 0 : ulong size = 0;
6443 0 : size += fd_stake_authorize_size( &self->stake_authorize );
6444 0 : do {
6445 0 : size += sizeof(ulong);
6446 0 : size += self->authority_seed_len;
6447 0 : } while(0);
6448 0 : size += fd_pubkey_size( &self->authority_owner );
6449 0 : return size;
6450 0 : }
6451 :
6452 0 : int fd_lockup_checked_args_encode( fd_lockup_checked_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6453 0 : int err;
6454 0 : if( self->unix_timestamp != NULL ) {
6455 0 : err = fd_bincode_bool_encode( 1, ctx );
6456 0 : if( FD_UNLIKELY( err ) ) return err;
6457 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
6458 0 : if( FD_UNLIKELY( err ) ) return err;
6459 0 : } else {
6460 0 : err = fd_bincode_bool_encode( 0, ctx );
6461 0 : if( FD_UNLIKELY( err ) ) return err;
6462 0 : }
6463 0 : if( self->epoch != NULL ) {
6464 0 : err = fd_bincode_bool_encode( 1, ctx );
6465 0 : if( FD_UNLIKELY( err ) ) return err;
6466 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
6467 0 : if( FD_UNLIKELY( err ) ) return err;
6468 0 : } else {
6469 0 : err = fd_bincode_bool_encode( 0, ctx );
6470 0 : if( FD_UNLIKELY( err ) ) return err;
6471 0 : }
6472 0 : return FD_BINCODE_SUCCESS;
6473 0 : }
6474 0 : static int fd_lockup_checked_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6475 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6476 0 : int err = 0;
6477 0 : {
6478 0 : uchar o;
6479 0 : err = fd_bincode_bool_decode( &o, ctx );
6480 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6481 0 : if( o ) {
6482 0 : *total_sz += 8UL + sizeof(long);
6483 0 : err = fd_bincode_int64_decode_footprint( ctx );
6484 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6485 0 : }
6486 0 : }
6487 0 : {
6488 0 : uchar o;
6489 0 : err = fd_bincode_bool_decode( &o, ctx );
6490 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6491 0 : if( o ) {
6492 0 : *total_sz += 8UL + sizeof(ulong);
6493 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6494 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6495 0 : }
6496 0 : }
6497 0 : return 0;
6498 0 : }
6499 0 : int fd_lockup_checked_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6500 0 : *total_sz += sizeof(fd_lockup_checked_args_t);
6501 0 : void const * start_data = ctx->data;
6502 0 : int err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
6503 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6504 0 : ctx->data = start_data;
6505 0 : return err;
6506 0 : }
6507 0 : static void fd_lockup_checked_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6508 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)struct_mem;
6509 0 : {
6510 0 : uchar o;
6511 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6512 0 : if( o ) {
6513 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
6514 0 : self->unix_timestamp = *alloc_mem;
6515 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
6516 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
6517 0 : } else {
6518 0 : self->unix_timestamp = NULL;
6519 0 : }
6520 0 : }
6521 0 : {
6522 0 : uchar o;
6523 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6524 0 : if( o ) {
6525 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
6526 0 : self->epoch = *alloc_mem;
6527 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
6528 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
6529 0 : } else {
6530 0 : self->epoch = NULL;
6531 0 : }
6532 0 : }
6533 0 : }
6534 0 : void * fd_lockup_checked_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6535 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)mem;
6536 0 : fd_lockup_checked_args_new( self );
6537 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_checked_args_t);
6538 0 : void * * alloc_mem = &alloc_region;
6539 0 : fd_lockup_checked_args_decode_inner( mem, alloc_mem, ctx );
6540 0 : return self;
6541 0 : }
6542 0 : void fd_lockup_checked_args_new(fd_lockup_checked_args_t * self) {
6543 0 : fd_memset( self, 0, sizeof(fd_lockup_checked_args_t) );
6544 0 : }
6545 0 : ulong fd_lockup_checked_args_size( fd_lockup_checked_args_t const * self ) {
6546 0 : ulong size = 0;
6547 0 : size += sizeof(char);
6548 0 : if( NULL != self->unix_timestamp ) {
6549 0 : size += sizeof(long);
6550 0 : }
6551 0 : size += sizeof(char);
6552 0 : if( NULL != self->epoch ) {
6553 0 : size += sizeof(ulong);
6554 0 : }
6555 0 : return size;
6556 0 : }
6557 :
6558 0 : int fd_lockup_args_encode( fd_lockup_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6559 0 : int err;
6560 0 : if( self->unix_timestamp != NULL ) {
6561 0 : err = fd_bincode_bool_encode( 1, ctx );
6562 0 : if( FD_UNLIKELY( err ) ) return err;
6563 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
6564 0 : if( FD_UNLIKELY( err ) ) return err;
6565 0 : } else {
6566 0 : err = fd_bincode_bool_encode( 0, ctx );
6567 0 : if( FD_UNLIKELY( err ) ) return err;
6568 0 : }
6569 0 : if( self->epoch != NULL ) {
6570 0 : err = fd_bincode_bool_encode( 1, ctx );
6571 0 : if( FD_UNLIKELY( err ) ) return err;
6572 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
6573 0 : if( FD_UNLIKELY( err ) ) return err;
6574 0 : } else {
6575 0 : err = fd_bincode_bool_encode( 0, ctx );
6576 0 : if( FD_UNLIKELY( err ) ) return err;
6577 0 : }
6578 0 : if( self->custodian != NULL ) {
6579 0 : err = fd_bincode_bool_encode( 1, ctx );
6580 0 : if( FD_UNLIKELY( err ) ) return err;
6581 0 : err = fd_pubkey_encode( self->custodian, ctx );
6582 0 : if( FD_UNLIKELY( err ) ) return err;
6583 0 : } else {
6584 0 : err = fd_bincode_bool_encode( 0, ctx );
6585 0 : if( FD_UNLIKELY( err ) ) return err;
6586 0 : }
6587 0 : return FD_BINCODE_SUCCESS;
6588 0 : }
6589 0 : static int fd_lockup_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6590 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6591 0 : int err = 0;
6592 0 : {
6593 0 : uchar o;
6594 0 : err = fd_bincode_bool_decode( &o, ctx );
6595 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6596 0 : if( o ) {
6597 0 : *total_sz += 8UL + sizeof(long);
6598 0 : err = fd_bincode_int64_decode_footprint( ctx );
6599 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6600 0 : }
6601 0 : }
6602 0 : {
6603 0 : uchar o;
6604 0 : err = fd_bincode_bool_decode( &o, ctx );
6605 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6606 0 : if( o ) {
6607 0 : *total_sz += 8UL + sizeof(ulong);
6608 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6609 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6610 0 : }
6611 0 : }
6612 0 : {
6613 0 : uchar o;
6614 0 : err = fd_bincode_bool_decode( &o, ctx );
6615 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6616 0 : if( o ) {
6617 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
6618 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6619 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6620 0 : }
6621 0 : }
6622 0 : return 0;
6623 0 : }
6624 0 : int fd_lockup_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6625 0 : *total_sz += sizeof(fd_lockup_args_t);
6626 0 : void const * start_data = ctx->data;
6627 0 : int err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
6628 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6629 0 : ctx->data = start_data;
6630 0 : return err;
6631 0 : }
6632 0 : static void fd_lockup_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6633 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)struct_mem;
6634 0 : {
6635 0 : uchar o;
6636 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6637 0 : if( o ) {
6638 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
6639 0 : self->unix_timestamp = *alloc_mem;
6640 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
6641 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
6642 0 : } else {
6643 0 : self->unix_timestamp = NULL;
6644 0 : }
6645 0 : }
6646 0 : {
6647 0 : uchar o;
6648 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6649 0 : if( o ) {
6650 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
6651 0 : self->epoch = *alloc_mem;
6652 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
6653 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
6654 0 : } else {
6655 0 : self->epoch = NULL;
6656 0 : }
6657 0 : }
6658 0 : {
6659 0 : uchar o;
6660 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6661 0 : if( o ) {
6662 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
6663 0 : self->custodian = *alloc_mem;
6664 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
6665 0 : fd_pubkey_new( self->custodian );
6666 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
6667 0 : } else {
6668 0 : self->custodian = NULL;
6669 0 : }
6670 0 : }
6671 0 : }
6672 0 : void * fd_lockup_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6673 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)mem;
6674 0 : fd_lockup_args_new( self );
6675 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_args_t);
6676 0 : void * * alloc_mem = &alloc_region;
6677 0 : fd_lockup_args_decode_inner( mem, alloc_mem, ctx );
6678 0 : return self;
6679 0 : }
6680 0 : void fd_lockup_args_new(fd_lockup_args_t * self) {
6681 0 : fd_memset( self, 0, sizeof(fd_lockup_args_t) );
6682 0 : }
6683 0 : ulong fd_lockup_args_size( fd_lockup_args_t const * self ) {
6684 0 : ulong size = 0;
6685 0 : size += sizeof(char);
6686 0 : if( NULL != self->unix_timestamp ) {
6687 0 : size += sizeof(long);
6688 0 : }
6689 0 : size += sizeof(char);
6690 0 : if( NULL != self->epoch ) {
6691 0 : size += sizeof(ulong);
6692 0 : }
6693 0 : size += sizeof(char);
6694 0 : if( NULL != self->custodian ) {
6695 0 : size += fd_pubkey_size( self->custodian );
6696 0 : }
6697 0 : return size;
6698 0 : }
6699 :
6700 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize(fd_stake_instruction_t const * self) {
6701 0 : return self->discriminant == 0;
6702 0 : }
6703 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize(fd_stake_instruction_t const * self) {
6704 0 : return self->discriminant == 1;
6705 0 : }
6706 0 : FD_FN_PURE uchar fd_stake_instruction_is_delegate_stake(fd_stake_instruction_t const * self) {
6707 0 : return self->discriminant == 2;
6708 0 : }
6709 0 : FD_FN_PURE uchar fd_stake_instruction_is_split(fd_stake_instruction_t const * self) {
6710 0 : return self->discriminant == 3;
6711 0 : }
6712 0 : FD_FN_PURE uchar fd_stake_instruction_is_withdraw(fd_stake_instruction_t const * self) {
6713 0 : return self->discriminant == 4;
6714 0 : }
6715 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate(fd_stake_instruction_t const * self) {
6716 0 : return self->discriminant == 5;
6717 0 : }
6718 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup(fd_stake_instruction_t const * self) {
6719 0 : return self->discriminant == 6;
6720 0 : }
6721 0 : FD_FN_PURE uchar fd_stake_instruction_is_merge(fd_stake_instruction_t const * self) {
6722 0 : return self->discriminant == 7;
6723 0 : }
6724 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_with_seed(fd_stake_instruction_t const * self) {
6725 0 : return self->discriminant == 8;
6726 0 : }
6727 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize_checked(fd_stake_instruction_t const * self) {
6728 0 : return self->discriminant == 9;
6729 0 : }
6730 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked(fd_stake_instruction_t const * self) {
6731 0 : return self->discriminant == 10;
6732 0 : }
6733 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked_with_seed(fd_stake_instruction_t const * self) {
6734 0 : return self->discriminant == 11;
6735 0 : }
6736 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup_checked(fd_stake_instruction_t const * self) {
6737 0 : return self->discriminant == 12;
6738 0 : }
6739 0 : FD_FN_PURE uchar fd_stake_instruction_is_get_minimum_delegation(fd_stake_instruction_t const * self) {
6740 0 : return self->discriminant == 13;
6741 0 : }
6742 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate_delinquent(fd_stake_instruction_t const * self) {
6743 0 : return self->discriminant == 14;
6744 0 : }
6745 0 : FD_FN_PURE uchar fd_stake_instruction_is_redelegate(fd_stake_instruction_t const * self) {
6746 0 : return self->discriminant == 15;
6747 0 : }
6748 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_stake(fd_stake_instruction_t const * self) {
6749 0 : return self->discriminant == 16;
6750 0 : }
6751 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_lamports(fd_stake_instruction_t const * self) {
6752 0 : return self->discriminant == 17;
6753 0 : }
6754 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant );
6755 0 : int fd_stake_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6756 0 : int err;
6757 0 : switch (discriminant) {
6758 0 : case 0: {
6759 0 : err = fd_stake_instruction_initialize_decode_footprint_inner( ctx, total_sz );
6760 0 : if( FD_UNLIKELY( err ) ) return err;
6761 0 : return FD_BINCODE_SUCCESS;
6762 0 : }
6763 0 : case 1: {
6764 0 : err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
6765 0 : if( FD_UNLIKELY( err ) ) return err;
6766 0 : return FD_BINCODE_SUCCESS;
6767 0 : }
6768 0 : case 2: {
6769 0 : return FD_BINCODE_SUCCESS;
6770 0 : }
6771 0 : case 3: {
6772 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6773 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6774 0 : return FD_BINCODE_SUCCESS;
6775 0 : }
6776 0 : case 4: {
6777 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6778 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6779 0 : return FD_BINCODE_SUCCESS;
6780 0 : }
6781 0 : case 5: {
6782 0 : return FD_BINCODE_SUCCESS;
6783 0 : }
6784 0 : case 6: {
6785 0 : err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
6786 0 : if( FD_UNLIKELY( err ) ) return err;
6787 0 : return FD_BINCODE_SUCCESS;
6788 0 : }
6789 0 : case 7: {
6790 0 : return FD_BINCODE_SUCCESS;
6791 0 : }
6792 0 : case 8: {
6793 0 : err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
6794 0 : if( FD_UNLIKELY( err ) ) return err;
6795 0 : return FD_BINCODE_SUCCESS;
6796 0 : }
6797 0 : case 9: {
6798 0 : return FD_BINCODE_SUCCESS;
6799 0 : }
6800 0 : case 10: {
6801 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6802 0 : if( FD_UNLIKELY( err ) ) return err;
6803 0 : return FD_BINCODE_SUCCESS;
6804 0 : }
6805 0 : case 11: {
6806 0 : err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
6807 0 : if( FD_UNLIKELY( err ) ) return err;
6808 0 : return FD_BINCODE_SUCCESS;
6809 0 : }
6810 0 : case 12: {
6811 0 : err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
6812 0 : if( FD_UNLIKELY( err ) ) return err;
6813 0 : return FD_BINCODE_SUCCESS;
6814 0 : }
6815 0 : case 13: {
6816 0 : return FD_BINCODE_SUCCESS;
6817 0 : }
6818 0 : case 14: {
6819 0 : return FD_BINCODE_SUCCESS;
6820 0 : }
6821 0 : case 15: {
6822 0 : return FD_BINCODE_SUCCESS;
6823 0 : }
6824 0 : case 16: {
6825 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6826 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6827 0 : return FD_BINCODE_SUCCESS;
6828 0 : }
6829 0 : case 17: {
6830 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6831 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6832 0 : return FD_BINCODE_SUCCESS;
6833 0 : }
6834 0 : default: return FD_BINCODE_ERR_ENCODING;
6835 0 : }
6836 0 : }
6837 0 : static int fd_stake_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6838 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6839 0 : uint discriminant = 0;
6840 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6841 0 : if( FD_UNLIKELY( err ) ) return err;
6842 0 : return fd_stake_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
6843 0 : }
6844 0 : int fd_stake_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6845 0 : *total_sz += sizeof(fd_stake_instruction_t);
6846 0 : void const * start_data = ctx->data;
6847 0 : int err = fd_stake_instruction_decode_footprint_inner( ctx, total_sz );
6848 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6849 0 : ctx->data = start_data;
6850 0 : return err;
6851 0 : }
6852 0 : static void fd_stake_instruction_inner_decode_inner( fd_stake_instruction_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
6853 0 : switch (discriminant) {
6854 0 : case 0: {
6855 0 : fd_stake_instruction_initialize_decode_inner( &self->initialize, alloc_mem, ctx );
6856 0 : break;
6857 0 : }
6858 0 : case 1: {
6859 0 : fd_stake_instruction_authorize_decode_inner( &self->authorize, alloc_mem, ctx );
6860 0 : break;
6861 0 : }
6862 0 : case 2: {
6863 0 : break;
6864 0 : }
6865 0 : case 3: {
6866 0 : fd_bincode_uint64_decode_unsafe( &self->split, ctx );
6867 0 : break;
6868 0 : }
6869 0 : case 4: {
6870 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
6871 0 : break;
6872 0 : }
6873 0 : case 5: {
6874 0 : break;
6875 0 : }
6876 0 : case 6: {
6877 0 : fd_lockup_args_decode_inner( &self->set_lockup, alloc_mem, ctx );
6878 0 : break;
6879 0 : }
6880 0 : case 7: {
6881 0 : break;
6882 0 : }
6883 0 : case 8: {
6884 0 : fd_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
6885 0 : break;
6886 0 : }
6887 0 : case 9: {
6888 0 : break;
6889 0 : }
6890 0 : case 10: {
6891 0 : fd_stake_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
6892 0 : break;
6893 0 : }
6894 0 : case 11: {
6895 0 : fd_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
6896 0 : break;
6897 0 : }
6898 0 : case 12: {
6899 0 : fd_lockup_checked_args_decode_inner( &self->set_lockup_checked, alloc_mem, ctx );
6900 0 : break;
6901 0 : }
6902 0 : case 13: {
6903 0 : break;
6904 0 : }
6905 0 : case 14: {
6906 0 : break;
6907 0 : }
6908 0 : case 15: {
6909 0 : break;
6910 0 : }
6911 0 : case 16: {
6912 0 : fd_bincode_uint64_decode_unsafe( &self->move_stake, ctx );
6913 0 : break;
6914 0 : }
6915 0 : case 17: {
6916 0 : fd_bincode_uint64_decode_unsafe( &self->move_lamports, ctx );
6917 0 : break;
6918 0 : }
6919 0 : }
6920 0 : }
6921 0 : static void fd_stake_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6922 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)struct_mem;
6923 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6924 0 : fd_stake_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
6925 0 : }
6926 0 : void * fd_stake_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6927 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)mem;
6928 0 : fd_stake_instruction_new( self );
6929 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_t);
6930 0 : void * * alloc_mem = &alloc_region;
6931 0 : fd_stake_instruction_decode_inner( mem, alloc_mem, ctx );
6932 0 : return self;
6933 0 : }
6934 0 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant ) {
6935 0 : switch( discriminant ) {
6936 0 : case 0: {
6937 0 : fd_stake_instruction_initialize_new( &self->initialize );
6938 0 : break;
6939 0 : }
6940 0 : case 1: {
6941 0 : fd_stake_instruction_authorize_new( &self->authorize );
6942 0 : break;
6943 0 : }
6944 0 : case 2: {
6945 0 : break;
6946 0 : }
6947 0 : case 3: {
6948 0 : break;
6949 0 : }
6950 0 : case 4: {
6951 0 : break;
6952 0 : }
6953 0 : case 5: {
6954 0 : break;
6955 0 : }
6956 0 : case 6: {
6957 0 : fd_lockup_args_new( &self->set_lockup );
6958 0 : break;
6959 0 : }
6960 0 : case 7: {
6961 0 : break;
6962 0 : }
6963 0 : case 8: {
6964 0 : fd_authorize_with_seed_args_new( &self->authorize_with_seed );
6965 0 : break;
6966 0 : }
6967 0 : case 9: {
6968 0 : break;
6969 0 : }
6970 0 : case 10: {
6971 0 : fd_stake_authorize_new( &self->authorize_checked );
6972 0 : break;
6973 0 : }
6974 0 : case 11: {
6975 0 : fd_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
6976 0 : break;
6977 0 : }
6978 0 : case 12: {
6979 0 : fd_lockup_checked_args_new( &self->set_lockup_checked );
6980 0 : break;
6981 0 : }
6982 0 : case 13: {
6983 0 : break;
6984 0 : }
6985 0 : case 14: {
6986 0 : break;
6987 0 : }
6988 0 : case 15: {
6989 0 : break;
6990 0 : }
6991 0 : case 16: {
6992 0 : break;
6993 0 : }
6994 0 : case 17: {
6995 0 : break;
6996 0 : }
6997 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
6998 0 : }
6999 0 : }
7000 0 : void fd_stake_instruction_new_disc( fd_stake_instruction_t * self, uint discriminant ) {
7001 0 : self->discriminant = discriminant;
7002 0 : fd_stake_instruction_inner_new( &self->inner, self->discriminant );
7003 0 : }
7004 0 : void fd_stake_instruction_new( fd_stake_instruction_t * self ) {
7005 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_t) );
7006 0 : fd_stake_instruction_new_disc( self, UINT_MAX );
7007 0 : }
7008 :
7009 0 : ulong fd_stake_instruction_size( fd_stake_instruction_t const * self ) {
7010 0 : ulong size = 0;
7011 0 : size += sizeof(uint);
7012 0 : switch (self->discriminant) {
7013 0 : case 0: {
7014 0 : size += fd_stake_instruction_initialize_size( &self->inner.initialize );
7015 0 : break;
7016 0 : }
7017 0 : case 1: {
7018 0 : size += fd_stake_instruction_authorize_size( &self->inner.authorize );
7019 0 : break;
7020 0 : }
7021 0 : case 3: {
7022 0 : size += sizeof(ulong);
7023 0 : break;
7024 0 : }
7025 0 : case 4: {
7026 0 : size += sizeof(ulong);
7027 0 : break;
7028 0 : }
7029 0 : case 6: {
7030 0 : size += fd_lockup_args_size( &self->inner.set_lockup );
7031 0 : break;
7032 0 : }
7033 0 : case 8: {
7034 0 : size += fd_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
7035 0 : break;
7036 0 : }
7037 0 : case 10: {
7038 0 : size += fd_stake_authorize_size( &self->inner.authorize_checked );
7039 0 : break;
7040 0 : }
7041 0 : case 11: {
7042 0 : size += fd_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
7043 0 : break;
7044 0 : }
7045 0 : case 12: {
7046 0 : size += fd_lockup_checked_args_size( &self->inner.set_lockup_checked );
7047 0 : break;
7048 0 : }
7049 0 : case 16: {
7050 0 : size += sizeof(ulong);
7051 0 : break;
7052 0 : }
7053 0 : case 17: {
7054 0 : size += sizeof(ulong);
7055 0 : break;
7056 0 : }
7057 0 : }
7058 0 : return size;
7059 0 : }
7060 :
7061 0 : int fd_stake_instruction_inner_encode( fd_stake_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7062 0 : int err;
7063 0 : switch (discriminant) {
7064 0 : case 0: {
7065 0 : err = fd_stake_instruction_initialize_encode( &self->initialize, ctx );
7066 0 : if( FD_UNLIKELY( err ) ) return err;
7067 0 : break;
7068 0 : }
7069 0 : case 1: {
7070 0 : err = fd_stake_instruction_authorize_encode( &self->authorize, ctx );
7071 0 : if( FD_UNLIKELY( err ) ) return err;
7072 0 : break;
7073 0 : }
7074 0 : case 3: {
7075 0 : err = fd_bincode_uint64_encode( self->split, ctx );
7076 0 : if( FD_UNLIKELY( err ) ) return err;
7077 0 : break;
7078 0 : }
7079 0 : case 4: {
7080 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
7081 0 : if( FD_UNLIKELY( err ) ) return err;
7082 0 : break;
7083 0 : }
7084 0 : case 6: {
7085 0 : err = fd_lockup_args_encode( &self->set_lockup, ctx );
7086 0 : if( FD_UNLIKELY( err ) ) return err;
7087 0 : break;
7088 0 : }
7089 0 : case 8: {
7090 0 : err = fd_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
7091 0 : if( FD_UNLIKELY( err ) ) return err;
7092 0 : break;
7093 0 : }
7094 0 : case 10: {
7095 0 : err = fd_stake_authorize_encode( &self->authorize_checked, ctx );
7096 0 : if( FD_UNLIKELY( err ) ) return err;
7097 0 : break;
7098 0 : }
7099 0 : case 11: {
7100 0 : err = fd_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
7101 0 : if( FD_UNLIKELY( err ) ) return err;
7102 0 : break;
7103 0 : }
7104 0 : case 12: {
7105 0 : err = fd_lockup_checked_args_encode( &self->set_lockup_checked, ctx );
7106 0 : if( FD_UNLIKELY( err ) ) return err;
7107 0 : break;
7108 0 : }
7109 0 : case 16: {
7110 0 : err = fd_bincode_uint64_encode( self->move_stake, ctx );
7111 0 : if( FD_UNLIKELY( err ) ) return err;
7112 0 : break;
7113 0 : }
7114 0 : case 17: {
7115 0 : err = fd_bincode_uint64_encode( self->move_lamports, ctx );
7116 0 : if( FD_UNLIKELY( err ) ) return err;
7117 0 : break;
7118 0 : }
7119 0 : }
7120 0 : return FD_BINCODE_SUCCESS;
7121 0 : }
7122 0 : int fd_stake_instruction_encode( fd_stake_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7123 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7124 0 : if( FD_UNLIKELY( err ) ) return err;
7125 0 : return fd_stake_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7126 0 : }
7127 :
7128 12 : int fd_stake_meta_encode( fd_stake_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7129 12 : int err;
7130 12 : err = fd_bincode_uint64_encode( self->rent_exempt_reserve, ctx );
7131 12 : if( FD_UNLIKELY( err ) ) return err;
7132 12 : err = fd_stake_authorized_encode( &self->authorized, ctx );
7133 12 : if( FD_UNLIKELY( err ) ) return err;
7134 12 : err = fd_stake_lockup_encode( &self->lockup, ctx );
7135 12 : if( FD_UNLIKELY( err ) ) return err;
7136 12 : return FD_BINCODE_SUCCESS;
7137 12 : }
7138 0 : static inline int fd_stake_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7139 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7140 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
7141 0 : return 0;
7142 0 : }
7143 0 : static void fd_stake_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7144 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)struct_mem;
7145 0 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
7146 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
7147 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
7148 0 : }
7149 0 : void * fd_stake_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7150 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)mem;
7151 0 : fd_stake_meta_new( self );
7152 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_meta_t);
7153 0 : void * * alloc_mem = &alloc_region;
7154 0 : fd_stake_meta_decode_inner( mem, alloc_mem, ctx );
7155 0 : return self;
7156 0 : }
7157 12 : int fd_stake_flags_encode( fd_stake_flags_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7158 12 : int err;
7159 12 : err = fd_bincode_uint8_encode( (uchar)(self->bits), ctx );
7160 12 : if( FD_UNLIKELY( err ) ) return err;
7161 12 : return FD_BINCODE_SUCCESS;
7162 12 : }
7163 0 : static inline int fd_stake_flags_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7164 0 : if( (ulong)ctx->data + 1UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7165 0 : ctx->data = (void *)( (ulong)ctx->data + 1UL );
7166 0 : return 0;
7167 0 : }
7168 0 : static void fd_stake_flags_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7169 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)struct_mem;
7170 0 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
7171 0 : }
7172 0 : void * fd_stake_flags_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7173 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)mem;
7174 0 : fd_stake_flags_new( self );
7175 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_flags_t);
7176 0 : void * * alloc_mem = &alloc_region;
7177 0 : fd_stake_flags_decode_inner( mem, alloc_mem, ctx );
7178 0 : return self;
7179 0 : }
7180 0 : int fd_stake_state_v2_initialized_encode( fd_stake_state_v2_initialized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7181 0 : int err;
7182 0 : err = fd_stake_meta_encode( &self->meta, ctx );
7183 0 : if( FD_UNLIKELY( err ) ) return err;
7184 0 : return FD_BINCODE_SUCCESS;
7185 0 : }
7186 0 : static inline int fd_stake_state_v2_initialized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7187 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7188 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
7189 0 : return 0;
7190 0 : }
7191 0 : static void fd_stake_state_v2_initialized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7192 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)struct_mem;
7193 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
7194 0 : }
7195 0 : void * fd_stake_state_v2_initialized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7196 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)mem;
7197 0 : fd_stake_state_v2_initialized_new( self );
7198 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_initialized_t);
7199 0 : void * * alloc_mem = &alloc_region;
7200 0 : fd_stake_state_v2_initialized_decode_inner( mem, alloc_mem, ctx );
7201 0 : return self;
7202 0 : }
7203 12 : int fd_stake_state_v2_stake_encode( fd_stake_state_v2_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7204 12 : int err;
7205 12 : err = fd_stake_meta_encode( &self->meta, ctx );
7206 12 : if( FD_UNLIKELY( err ) ) return err;
7207 12 : err = fd_stake_encode( &self->stake, ctx );
7208 12 : if( FD_UNLIKELY( err ) ) return err;
7209 12 : err = fd_stake_flags_encode( &self->stake_flags, ctx );
7210 12 : if( FD_UNLIKELY( err ) ) return err;
7211 12 : return FD_BINCODE_SUCCESS;
7212 12 : }
7213 0 : static inline int fd_stake_state_v2_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7214 0 : if( (ulong)ctx->data + 193UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7215 0 : ctx->data = (void *)( (ulong)ctx->data + 193UL );
7216 0 : return 0;
7217 0 : }
7218 0 : static void fd_stake_state_v2_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7219 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)struct_mem;
7220 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
7221 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
7222 0 : fd_stake_flags_decode_inner( &self->stake_flags, alloc_mem, ctx );
7223 0 : }
7224 0 : void * fd_stake_state_v2_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7225 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)mem;
7226 0 : fd_stake_state_v2_stake_new( self );
7227 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_stake_t);
7228 0 : void * * alloc_mem = &alloc_region;
7229 0 : fd_stake_state_v2_stake_decode_inner( mem, alloc_mem, ctx );
7230 0 : return self;
7231 0 : }
7232 0 : FD_FN_PURE uchar fd_stake_state_v2_is_uninitialized(fd_stake_state_v2_t const * self) {
7233 0 : return self->discriminant == 0;
7234 0 : }
7235 0 : FD_FN_PURE uchar fd_stake_state_v2_is_initialized(fd_stake_state_v2_t const * self) {
7236 0 : return self->discriminant == 1;
7237 0 : }
7238 0 : FD_FN_PURE uchar fd_stake_state_v2_is_stake(fd_stake_state_v2_t const * self) {
7239 0 : return self->discriminant == 2;
7240 0 : }
7241 0 : FD_FN_PURE uchar fd_stake_state_v2_is_rewards_pool(fd_stake_state_v2_t const * self) {
7242 0 : return self->discriminant == 3;
7243 0 : }
7244 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant );
7245 0 : int fd_stake_state_v2_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7246 0 : int err;
7247 0 : switch (discriminant) {
7248 0 : case 0: {
7249 0 : return FD_BINCODE_SUCCESS;
7250 0 : }
7251 0 : case 1: {
7252 0 : err = fd_stake_state_v2_initialized_decode_footprint_inner( ctx, total_sz );
7253 0 : if( FD_UNLIKELY( err ) ) return err;
7254 0 : return FD_BINCODE_SUCCESS;
7255 0 : }
7256 0 : case 2: {
7257 0 : err = fd_stake_state_v2_stake_decode_footprint_inner( ctx, total_sz );
7258 0 : if( FD_UNLIKELY( err ) ) return err;
7259 0 : return FD_BINCODE_SUCCESS;
7260 0 : }
7261 0 : case 3: {
7262 0 : return FD_BINCODE_SUCCESS;
7263 0 : }
7264 0 : default: return FD_BINCODE_ERR_ENCODING;
7265 0 : }
7266 0 : }
7267 0 : static int fd_stake_state_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7268 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7269 0 : uint discriminant = 0;
7270 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7271 0 : if( FD_UNLIKELY( err ) ) return err;
7272 0 : return fd_stake_state_v2_inner_decode_footprint( discriminant, ctx, total_sz );
7273 0 : }
7274 0 : int fd_stake_state_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7275 0 : *total_sz += sizeof(fd_stake_state_v2_t);
7276 0 : void const * start_data = ctx->data;
7277 0 : int err = fd_stake_state_v2_decode_footprint_inner( ctx, total_sz );
7278 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7279 0 : ctx->data = start_data;
7280 0 : return err;
7281 0 : }
7282 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 ) {
7283 0 : switch (discriminant) {
7284 0 : case 0: {
7285 0 : break;
7286 0 : }
7287 0 : case 1: {
7288 0 : fd_stake_state_v2_initialized_decode_inner( &self->initialized, alloc_mem, ctx );
7289 0 : break;
7290 0 : }
7291 0 : case 2: {
7292 0 : fd_stake_state_v2_stake_decode_inner( &self->stake, alloc_mem, ctx );
7293 0 : break;
7294 0 : }
7295 0 : case 3: {
7296 0 : break;
7297 0 : }
7298 0 : }
7299 0 : }
7300 0 : static void fd_stake_state_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7301 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)struct_mem;
7302 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7303 0 : fd_stake_state_v2_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7304 0 : }
7305 0 : void * fd_stake_state_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7306 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)mem;
7307 0 : fd_stake_state_v2_new( self );
7308 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_t);
7309 0 : void * * alloc_mem = &alloc_region;
7310 0 : fd_stake_state_v2_decode_inner( mem, alloc_mem, ctx );
7311 0 : return self;
7312 0 : }
7313 12 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant ) {
7314 12 : switch( discriminant ) {
7315 0 : case 0: {
7316 0 : break;
7317 0 : }
7318 0 : case 1: {
7319 0 : fd_stake_state_v2_initialized_new( &self->initialized );
7320 0 : break;
7321 0 : }
7322 12 : case 2: {
7323 12 : fd_stake_state_v2_stake_new( &self->stake );
7324 12 : break;
7325 0 : }
7326 0 : case 3: {
7327 0 : break;
7328 0 : }
7329 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7330 12 : }
7331 12 : }
7332 12 : void fd_stake_state_v2_new_disc( fd_stake_state_v2_t * self, uint discriminant ) {
7333 12 : self->discriminant = discriminant;
7334 12 : fd_stake_state_v2_inner_new( &self->inner, self->discriminant );
7335 12 : }
7336 0 : void fd_stake_state_v2_new( fd_stake_state_v2_t * self ) {
7337 0 : fd_memset( self, 0, sizeof(fd_stake_state_v2_t) );
7338 0 : fd_stake_state_v2_new_disc( self, UINT_MAX );
7339 0 : }
7340 :
7341 0 : ulong fd_stake_state_v2_size( fd_stake_state_v2_t const * self ) {
7342 0 : ulong size = 0;
7343 0 : size += sizeof(uint);
7344 0 : switch (self->discriminant) {
7345 0 : case 1: {
7346 0 : size += fd_stake_state_v2_initialized_size( &self->inner.initialized );
7347 0 : break;
7348 0 : }
7349 0 : case 2: {
7350 0 : size += fd_stake_state_v2_stake_size( &self->inner.stake );
7351 0 : break;
7352 0 : }
7353 0 : }
7354 0 : return size;
7355 0 : }
7356 :
7357 12 : int fd_stake_state_v2_inner_encode( fd_stake_state_v2_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7358 12 : int err;
7359 12 : switch (discriminant) {
7360 0 : case 1: {
7361 0 : err = fd_stake_state_v2_initialized_encode( &self->initialized, ctx );
7362 0 : if( FD_UNLIKELY( err ) ) return err;
7363 0 : break;
7364 0 : }
7365 12 : case 2: {
7366 12 : err = fd_stake_state_v2_stake_encode( &self->stake, ctx );
7367 12 : if( FD_UNLIKELY( err ) ) return err;
7368 12 : break;
7369 12 : }
7370 12 : }
7371 12 : return FD_BINCODE_SUCCESS;
7372 12 : }
7373 12 : int fd_stake_state_v2_encode( fd_stake_state_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7374 12 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7375 12 : if( FD_UNLIKELY( err ) ) return err;
7376 12 : return fd_stake_state_v2_inner_encode( &self->inner, self->discriminant, ctx );
7377 12 : }
7378 :
7379 0 : int fd_nonce_data_encode( fd_nonce_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7380 0 : int err;
7381 0 : err = fd_pubkey_encode( &self->authority, ctx );
7382 0 : if( FD_UNLIKELY( err ) ) return err;
7383 0 : err = fd_hash_encode( &self->durable_nonce, ctx );
7384 0 : if( FD_UNLIKELY( err ) ) return err;
7385 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
7386 0 : if( FD_UNLIKELY( err ) ) return err;
7387 0 : return FD_BINCODE_SUCCESS;
7388 0 : }
7389 0 : static inline int fd_nonce_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7390 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7391 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
7392 0 : return 0;
7393 0 : }
7394 0 : static void fd_nonce_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7395 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)struct_mem;
7396 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
7397 0 : fd_hash_decode_inner( &self->durable_nonce, alloc_mem, ctx );
7398 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
7399 0 : }
7400 0 : void * fd_nonce_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7401 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)mem;
7402 0 : fd_nonce_data_new( self );
7403 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_data_t);
7404 0 : void * * alloc_mem = &alloc_region;
7405 0 : fd_nonce_data_decode_inner( mem, alloc_mem, ctx );
7406 0 : return self;
7407 0 : }
7408 0 : FD_FN_PURE uchar fd_nonce_state_is_uninitialized(fd_nonce_state_t const * self) {
7409 0 : return self->discriminant == 0;
7410 0 : }
7411 0 : FD_FN_PURE uchar fd_nonce_state_is_initialized(fd_nonce_state_t const * self) {
7412 0 : return self->discriminant == 1;
7413 0 : }
7414 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant );
7415 0 : int fd_nonce_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7416 0 : int err;
7417 0 : switch (discriminant) {
7418 0 : case 0: {
7419 0 : return FD_BINCODE_SUCCESS;
7420 0 : }
7421 0 : case 1: {
7422 0 : err = fd_nonce_data_decode_footprint_inner( ctx, total_sz );
7423 0 : if( FD_UNLIKELY( err ) ) return err;
7424 0 : return FD_BINCODE_SUCCESS;
7425 0 : }
7426 0 : default: return FD_BINCODE_ERR_ENCODING;
7427 0 : }
7428 0 : }
7429 0 : static int fd_nonce_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7430 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7431 0 : uint discriminant = 0;
7432 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7433 0 : if( FD_UNLIKELY( err ) ) return err;
7434 0 : return fd_nonce_state_inner_decode_footprint( discriminant, ctx, total_sz );
7435 0 : }
7436 0 : int fd_nonce_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7437 0 : *total_sz += sizeof(fd_nonce_state_t);
7438 0 : void const * start_data = ctx->data;
7439 0 : int err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
7440 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7441 0 : ctx->data = start_data;
7442 0 : return err;
7443 0 : }
7444 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 ) {
7445 0 : switch (discriminant) {
7446 0 : case 0: {
7447 0 : break;
7448 0 : }
7449 0 : case 1: {
7450 0 : fd_nonce_data_decode_inner( &self->initialized, alloc_mem, ctx );
7451 0 : break;
7452 0 : }
7453 0 : }
7454 0 : }
7455 0 : static void fd_nonce_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7456 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)struct_mem;
7457 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7458 0 : fd_nonce_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7459 0 : }
7460 0 : void * fd_nonce_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7461 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)mem;
7462 0 : fd_nonce_state_new( self );
7463 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_t);
7464 0 : void * * alloc_mem = &alloc_region;
7465 0 : fd_nonce_state_decode_inner( mem, alloc_mem, ctx );
7466 0 : return self;
7467 0 : }
7468 0 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant ) {
7469 0 : switch( discriminant ) {
7470 0 : case 0: {
7471 0 : break;
7472 0 : }
7473 0 : case 1: {
7474 0 : fd_nonce_data_new( &self->initialized );
7475 0 : break;
7476 0 : }
7477 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7478 0 : }
7479 0 : }
7480 0 : void fd_nonce_state_new_disc( fd_nonce_state_t * self, uint discriminant ) {
7481 0 : self->discriminant = discriminant;
7482 0 : fd_nonce_state_inner_new( &self->inner, self->discriminant );
7483 0 : }
7484 0 : void fd_nonce_state_new( fd_nonce_state_t * self ) {
7485 0 : fd_memset( self, 0, sizeof(fd_nonce_state_t) );
7486 0 : fd_nonce_state_new_disc( self, UINT_MAX );
7487 0 : }
7488 :
7489 0 : ulong fd_nonce_state_size( fd_nonce_state_t const * self ) {
7490 0 : ulong size = 0;
7491 0 : size += sizeof(uint);
7492 0 : switch (self->discriminant) {
7493 0 : case 1: {
7494 0 : size += fd_nonce_data_size( &self->inner.initialized );
7495 0 : break;
7496 0 : }
7497 0 : }
7498 0 : return size;
7499 0 : }
7500 :
7501 0 : int fd_nonce_state_inner_encode( fd_nonce_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7502 0 : int err;
7503 0 : switch (discriminant) {
7504 0 : case 1: {
7505 0 : err = fd_nonce_data_encode( &self->initialized, ctx );
7506 0 : if( FD_UNLIKELY( err ) ) return err;
7507 0 : break;
7508 0 : }
7509 0 : }
7510 0 : return FD_BINCODE_SUCCESS;
7511 0 : }
7512 0 : int fd_nonce_state_encode( fd_nonce_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7513 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7514 0 : if( FD_UNLIKELY( err ) ) return err;
7515 0 : return fd_nonce_state_inner_encode( &self->inner, self->discriminant, ctx );
7516 0 : }
7517 :
7518 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_legacy(fd_nonce_state_versions_t const * self) {
7519 0 : return self->discriminant == 0;
7520 0 : }
7521 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_current(fd_nonce_state_versions_t const * self) {
7522 0 : return self->discriminant == 1;
7523 0 : }
7524 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant );
7525 0 : int fd_nonce_state_versions_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7526 0 : int err;
7527 0 : switch (discriminant) {
7528 0 : case 0: {
7529 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
7530 0 : if( FD_UNLIKELY( err ) ) return err;
7531 0 : return FD_BINCODE_SUCCESS;
7532 0 : }
7533 0 : case 1: {
7534 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
7535 0 : if( FD_UNLIKELY( err ) ) return err;
7536 0 : return FD_BINCODE_SUCCESS;
7537 0 : }
7538 0 : default: return FD_BINCODE_ERR_ENCODING;
7539 0 : }
7540 0 : }
7541 0 : static int fd_nonce_state_versions_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7542 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7543 0 : uint discriminant = 0;
7544 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7545 0 : if( FD_UNLIKELY( err ) ) return err;
7546 0 : return fd_nonce_state_versions_inner_decode_footprint( discriminant, ctx, total_sz );
7547 0 : }
7548 0 : int fd_nonce_state_versions_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7549 0 : *total_sz += sizeof(fd_nonce_state_versions_t);
7550 0 : void const * start_data = ctx->data;
7551 0 : int err = fd_nonce_state_versions_decode_footprint_inner( ctx, total_sz );
7552 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7553 0 : ctx->data = start_data;
7554 0 : return err;
7555 0 : }
7556 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 ) {
7557 0 : switch (discriminant) {
7558 0 : case 0: {
7559 0 : fd_nonce_state_decode_inner( &self->legacy, alloc_mem, ctx );
7560 0 : break;
7561 0 : }
7562 0 : case 1: {
7563 0 : fd_nonce_state_decode_inner( &self->current, alloc_mem, ctx );
7564 0 : break;
7565 0 : }
7566 0 : }
7567 0 : }
7568 0 : static void fd_nonce_state_versions_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7569 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)struct_mem;
7570 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7571 0 : fd_nonce_state_versions_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7572 0 : }
7573 0 : void * fd_nonce_state_versions_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7574 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)mem;
7575 0 : fd_nonce_state_versions_new( self );
7576 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_versions_t);
7577 0 : void * * alloc_mem = &alloc_region;
7578 0 : fd_nonce_state_versions_decode_inner( mem, alloc_mem, ctx );
7579 0 : return self;
7580 0 : }
7581 0 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
7582 0 : switch( discriminant ) {
7583 0 : case 0: {
7584 0 : fd_nonce_state_new( &self->legacy );
7585 0 : break;
7586 0 : }
7587 0 : case 1: {
7588 0 : fd_nonce_state_new( &self->current );
7589 0 : break;
7590 0 : }
7591 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7592 0 : }
7593 0 : }
7594 0 : void fd_nonce_state_versions_new_disc( fd_nonce_state_versions_t * self, uint discriminant ) {
7595 0 : self->discriminant = discriminant;
7596 0 : fd_nonce_state_versions_inner_new( &self->inner, self->discriminant );
7597 0 : }
7598 0 : void fd_nonce_state_versions_new( fd_nonce_state_versions_t * self ) {
7599 0 : fd_memset( self, 0, sizeof(fd_nonce_state_versions_t) );
7600 0 : fd_nonce_state_versions_new_disc( self, UINT_MAX );
7601 0 : }
7602 :
7603 0 : ulong fd_nonce_state_versions_size( fd_nonce_state_versions_t const * self ) {
7604 0 : ulong size = 0;
7605 0 : size += sizeof(uint);
7606 0 : switch (self->discriminant) {
7607 0 : case 0: {
7608 0 : size += fd_nonce_state_size( &self->inner.legacy );
7609 0 : break;
7610 0 : }
7611 0 : case 1: {
7612 0 : size += fd_nonce_state_size( &self->inner.current );
7613 0 : break;
7614 0 : }
7615 0 : }
7616 0 : return size;
7617 0 : }
7618 :
7619 0 : int fd_nonce_state_versions_inner_encode( fd_nonce_state_versions_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7620 0 : int err;
7621 0 : switch (discriminant) {
7622 0 : case 0: {
7623 0 : err = fd_nonce_state_encode( &self->legacy, ctx );
7624 0 : if( FD_UNLIKELY( err ) ) return err;
7625 0 : break;
7626 0 : }
7627 0 : case 1: {
7628 0 : err = fd_nonce_state_encode( &self->current, ctx );
7629 0 : if( FD_UNLIKELY( err ) ) return err;
7630 0 : break;
7631 0 : }
7632 0 : }
7633 0 : return FD_BINCODE_SUCCESS;
7634 0 : }
7635 0 : int fd_nonce_state_versions_encode( fd_nonce_state_versions_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7636 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7637 0 : if( FD_UNLIKELY( err ) ) return err;
7638 0 : return fd_nonce_state_versions_inner_encode( &self->inner, self->discriminant, ctx );
7639 0 : }
7640 :
7641 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 ) {
7642 0 : int err;
7643 0 : err = fd_bincode_uint32_encode( self->units, ctx );
7644 0 : if( FD_UNLIKELY( err ) ) return err;
7645 0 : err = fd_bincode_uint32_encode( self->additional_fee, ctx );
7646 0 : if( FD_UNLIKELY( err ) ) return err;
7647 0 : return FD_BINCODE_SUCCESS;
7648 0 : }
7649 0 : static inline int fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7650 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7651 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
7652 0 : return 0;
7653 0 : }
7654 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 ) {
7655 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)struct_mem;
7656 0 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
7657 0 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
7658 0 : }
7659 0 : void * fd_compute_budget_program_instruction_request_units_deprecated_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7660 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)mem;
7661 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( self );
7662 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t);
7663 0 : void * * alloc_mem = &alloc_region;
7664 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( mem, alloc_mem, ctx );
7665 0 : return self;
7666 0 : }
7667 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_units_deprecated(fd_compute_budget_program_instruction_t const * self) {
7668 0 : return self->discriminant == 0;
7669 0 : }
7670 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_heap_frame(fd_compute_budget_program_instruction_t const * self) {
7671 0 : return self->discriminant == 1;
7672 0 : }
7673 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_limit(fd_compute_budget_program_instruction_t const * self) {
7674 0 : return self->discriminant == 2;
7675 0 : }
7676 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_price(fd_compute_budget_program_instruction_t const * self) {
7677 0 : return self->discriminant == 3;
7678 0 : }
7679 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) {
7680 0 : return self->discriminant == 4;
7681 0 : }
7682 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant );
7683 6 : int fd_compute_budget_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7684 6 : int err;
7685 6 : switch (discriminant) {
7686 0 : case 0: {
7687 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( ctx, total_sz );
7688 0 : if( FD_UNLIKELY( err ) ) return err;
7689 0 : return FD_BINCODE_SUCCESS;
7690 0 : }
7691 0 : case 1: {
7692 0 : err = fd_bincode_uint32_decode_footprint( ctx );
7693 0 : if( FD_UNLIKELY( err ) ) return err;
7694 0 : return FD_BINCODE_SUCCESS;
7695 0 : }
7696 6 : case 2: {
7697 6 : err = fd_bincode_uint32_decode_footprint( ctx );
7698 6 : if( FD_UNLIKELY( err ) ) return err;
7699 6 : return FD_BINCODE_SUCCESS;
7700 6 : }
7701 0 : case 3: {
7702 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7703 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7704 0 : return FD_BINCODE_SUCCESS;
7705 0 : }
7706 0 : case 4: {
7707 0 : err = fd_bincode_uint32_decode_footprint( ctx );
7708 0 : if( FD_UNLIKELY( err ) ) return err;
7709 0 : return FD_BINCODE_SUCCESS;
7710 0 : }
7711 0 : default: return FD_BINCODE_ERR_ENCODING;
7712 6 : }
7713 6 : }
7714 6 : static int fd_compute_budget_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7715 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7716 6 : ushort discriminant = 0;
7717 6 : int err = fd_bincode_compact_u16_decode( &discriminant, ctx );
7718 6 : if( FD_UNLIKELY( err ) ) return err;
7719 6 : return fd_compute_budget_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
7720 6 : }
7721 6 : int fd_compute_budget_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7722 6 : *total_sz += sizeof(fd_compute_budget_program_instruction_t);
7723 6 : void const * start_data = ctx->data;
7724 6 : int err = fd_compute_budget_program_instruction_decode_footprint_inner( ctx, total_sz );
7725 6 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7726 6 : ctx->data = start_data;
7727 6 : return err;
7728 6 : }
7729 6 : 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 ) {
7730 6 : switch (discriminant) {
7731 0 : case 0: {
7732 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( &self->request_units_deprecated, alloc_mem, ctx );
7733 0 : break;
7734 0 : }
7735 0 : case 1: {
7736 0 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
7737 0 : break;
7738 0 : }
7739 6 : case 2: {
7740 6 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
7741 6 : break;
7742 0 : }
7743 0 : case 3: {
7744 0 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
7745 0 : break;
7746 0 : }
7747 0 : case 4: {
7748 0 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
7749 0 : break;
7750 0 : }
7751 6 : }
7752 6 : }
7753 6 : static void fd_compute_budget_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7754 6 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)struct_mem;
7755 6 : ushort tmp = 0;
7756 6 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
7757 6 : self->discriminant = tmp;
7758 6 : fd_compute_budget_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7759 6 : }
7760 6 : void * fd_compute_budget_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7761 6 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)mem;
7762 6 : fd_compute_budget_program_instruction_new( self );
7763 6 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_t);
7764 6 : void * * alloc_mem = &alloc_region;
7765 6 : fd_compute_budget_program_instruction_decode_inner( mem, alloc_mem, ctx );
7766 6 : return self;
7767 6 : }
7768 6 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
7769 6 : switch( discriminant ) {
7770 0 : case 0: {
7771 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( &self->request_units_deprecated );
7772 0 : break;
7773 0 : }
7774 0 : case 1: {
7775 0 : break;
7776 0 : }
7777 0 : case 2: {
7778 0 : break;
7779 0 : }
7780 0 : case 3: {
7781 0 : break;
7782 0 : }
7783 0 : case 4: {
7784 0 : break;
7785 0 : }
7786 6 : default: break; // FD_LOG_ERR(( "unhandled type"));
7787 6 : }
7788 6 : }
7789 6 : void fd_compute_budget_program_instruction_new_disc( fd_compute_budget_program_instruction_t * self, uint discriminant ) {
7790 6 : self->discriminant = discriminant;
7791 6 : fd_compute_budget_program_instruction_inner_new( &self->inner, self->discriminant );
7792 6 : }
7793 6 : void fd_compute_budget_program_instruction_new( fd_compute_budget_program_instruction_t * self ) {
7794 6 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_t) );
7795 6 : fd_compute_budget_program_instruction_new_disc( self, UINT_MAX );
7796 6 : }
7797 :
7798 0 : ulong fd_compute_budget_program_instruction_size( fd_compute_budget_program_instruction_t const * self ) {
7799 0 : ulong size = 0;
7800 0 : size += sizeof(uint);
7801 0 : switch (self->discriminant) {
7802 0 : case 0: {
7803 0 : size += fd_compute_budget_program_instruction_request_units_deprecated_size( &self->inner.request_units_deprecated );
7804 0 : break;
7805 0 : }
7806 0 : case 1: {
7807 0 : size += sizeof(uint);
7808 0 : break;
7809 0 : }
7810 0 : case 2: {
7811 0 : size += sizeof(uint);
7812 0 : break;
7813 0 : }
7814 0 : case 3: {
7815 0 : size += sizeof(ulong);
7816 0 : break;
7817 0 : }
7818 0 : case 4: {
7819 0 : size += sizeof(uint);
7820 0 : break;
7821 0 : }
7822 0 : }
7823 0 : return size;
7824 0 : }
7825 :
7826 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 ) {
7827 0 : int err;
7828 0 : switch (discriminant) {
7829 0 : case 0: {
7830 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_encode( &self->request_units_deprecated, ctx );
7831 0 : if( FD_UNLIKELY( err ) ) return err;
7832 0 : break;
7833 0 : }
7834 0 : case 1: {
7835 0 : err = fd_bincode_uint32_encode( self->request_heap_frame, ctx );
7836 0 : if( FD_UNLIKELY( err ) ) return err;
7837 0 : break;
7838 0 : }
7839 0 : case 2: {
7840 0 : err = fd_bincode_uint32_encode( self->set_compute_unit_limit, ctx );
7841 0 : if( FD_UNLIKELY( err ) ) return err;
7842 0 : break;
7843 0 : }
7844 0 : case 3: {
7845 0 : err = fd_bincode_uint64_encode( self->set_compute_unit_price, ctx );
7846 0 : if( FD_UNLIKELY( err ) ) return err;
7847 0 : break;
7848 0 : }
7849 0 : case 4: {
7850 0 : err = fd_bincode_uint32_encode( self->set_loaded_accounts_data_size_limit, ctx );
7851 0 : if( FD_UNLIKELY( err ) ) return err;
7852 0 : break;
7853 0 : }
7854 0 : }
7855 0 : return FD_BINCODE_SUCCESS;
7856 0 : }
7857 0 : int fd_compute_budget_program_instruction_encode( fd_compute_budget_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7858 0 : ushort discriminant = (ushort) self->discriminant;
7859 0 : int err = fd_bincode_compact_u16_encode( &discriminant, ctx );
7860 0 : if( FD_UNLIKELY( err ) ) return err;
7861 0 : return fd_compute_budget_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7862 0 : }
7863 :
7864 0 : int fd_config_keys_encode( fd_config_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7865 0 : int err;
7866 0 : err = fd_bincode_compact_u16_encode( &self->keys_len, ctx );
7867 0 : if( FD_UNLIKELY(err) ) return err;
7868 0 : if( self->keys_len ) {
7869 0 : for( ulong i=0; i < self->keys_len; i++ ) {
7870 0 : err = fd_config_keys_pair_encode( self->keys + i, ctx );
7871 0 : if( FD_UNLIKELY( err ) ) return err;
7872 0 : }
7873 0 : }
7874 0 : return FD_BINCODE_SUCCESS;
7875 0 : }
7876 0 : static int fd_config_keys_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7877 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7878 0 : int err = 0;
7879 0 : ushort keys_len;
7880 0 : err = fd_bincode_compact_u16_decode( &keys_len, ctx );
7881 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7882 0 : if( keys_len ) {
7883 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*keys_len;
7884 0 : for( ulong i=0; i < keys_len; i++ ) {
7885 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
7886 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7887 0 : }
7888 0 : }
7889 0 : return 0;
7890 0 : }
7891 0 : int fd_config_keys_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7892 0 : *total_sz += sizeof(fd_config_keys_t);
7893 0 : void const * start_data = ctx->data;
7894 0 : int err = fd_config_keys_decode_footprint_inner( ctx, total_sz );
7895 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7896 0 : ctx->data = start_data;
7897 0 : return err;
7898 0 : }
7899 0 : static void fd_config_keys_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7900 0 : fd_config_keys_t * self = (fd_config_keys_t *)struct_mem;
7901 0 : fd_bincode_compact_u16_decode_unsafe( &self->keys_len, ctx );
7902 0 : if( self->keys_len ) {
7903 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
7904 0 : self->keys = *alloc_mem;
7905 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->keys_len;
7906 0 : for( ulong i=0; i < self->keys_len; i++ ) {
7907 0 : fd_config_keys_pair_new( self->keys + i );
7908 0 : fd_config_keys_pair_decode_inner( self->keys + i, alloc_mem, ctx );
7909 0 : }
7910 0 : } else
7911 0 : self->keys = NULL;
7912 0 : }
7913 0 : void * fd_config_keys_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7914 0 : fd_config_keys_t * self = (fd_config_keys_t *)mem;
7915 0 : fd_config_keys_new( self );
7916 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_t);
7917 0 : void * * alloc_mem = &alloc_region;
7918 0 : fd_config_keys_decode_inner( mem, alloc_mem, ctx );
7919 0 : return self;
7920 0 : }
7921 0 : void fd_config_keys_new(fd_config_keys_t * self) {
7922 0 : fd_memset( self, 0, sizeof(fd_config_keys_t) );
7923 0 : }
7924 0 : ulong fd_config_keys_size( fd_config_keys_t const * self ) {
7925 0 : ulong size = 0;
7926 0 : do {
7927 0 : ushort tmp = (ushort)self->keys_len;
7928 0 : size += fd_bincode_compact_u16_size( &tmp );
7929 0 : for( ulong i=0; i < self->keys_len; i++ )
7930 0 : size += fd_config_keys_pair_size( self->keys + i );
7931 0 : } while(0);
7932 0 : return size;
7933 0 : }
7934 :
7935 0 : int fd_bpf_loader_program_instruction_write_encode( fd_bpf_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7936 0 : int err;
7937 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
7938 0 : if( FD_UNLIKELY( err ) ) return err;
7939 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
7940 0 : if( FD_UNLIKELY(err) ) return err;
7941 0 : if( self->bytes_len ) {
7942 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
7943 0 : if( FD_UNLIKELY( err ) ) return err;
7944 0 : }
7945 0 : return FD_BINCODE_SUCCESS;
7946 0 : }
7947 0 : static int fd_bpf_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7948 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7949 0 : int err = 0;
7950 0 : err = fd_bincode_uint32_decode_footprint( ctx );
7951 0 : if( FD_UNLIKELY( err ) ) return err;
7952 0 : ulong bytes_len;
7953 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
7954 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7955 0 : if( bytes_len ) {
7956 0 : *total_sz += 8UL + bytes_len;
7957 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
7958 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7959 0 : }
7960 0 : return 0;
7961 0 : }
7962 0 : int fd_bpf_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7963 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_write_t);
7964 0 : void const * start_data = ctx->data;
7965 0 : int err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
7966 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7967 0 : ctx->data = start_data;
7968 0 : return err;
7969 0 : }
7970 0 : static void fd_bpf_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7971 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)struct_mem;
7972 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
7973 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
7974 0 : if( self->bytes_len ) {
7975 0 : self->bytes = *alloc_mem;
7976 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
7977 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
7978 0 : } else
7979 0 : self->bytes = NULL;
7980 0 : }
7981 0 : void * fd_bpf_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7982 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)mem;
7983 0 : fd_bpf_loader_program_instruction_write_new( self );
7984 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_write_t);
7985 0 : void * * alloc_mem = &alloc_region;
7986 0 : fd_bpf_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
7987 0 : return self;
7988 0 : }
7989 0 : void fd_bpf_loader_program_instruction_write_new(fd_bpf_loader_program_instruction_write_t * self) {
7990 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_write_t) );
7991 0 : }
7992 0 : ulong fd_bpf_loader_program_instruction_write_size( fd_bpf_loader_program_instruction_write_t const * self ) {
7993 0 : ulong size = 0;
7994 0 : size += sizeof(uint);
7995 0 : do {
7996 0 : size += sizeof(ulong);
7997 0 : size += self->bytes_len;
7998 0 : } while(0);
7999 0 : return size;
8000 0 : }
8001 :
8002 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_write(fd_bpf_loader_program_instruction_t const * self) {
8003 0 : return self->discriminant == 0;
8004 0 : }
8005 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_finalize(fd_bpf_loader_program_instruction_t const * self) {
8006 0 : return self->discriminant == 1;
8007 0 : }
8008 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant );
8009 0 : int fd_bpf_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8010 0 : int err;
8011 0 : switch (discriminant) {
8012 0 : case 0: {
8013 0 : err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8014 0 : if( FD_UNLIKELY( err ) ) return err;
8015 0 : return FD_BINCODE_SUCCESS;
8016 0 : }
8017 0 : case 1: {
8018 0 : return FD_BINCODE_SUCCESS;
8019 0 : }
8020 0 : default: return FD_BINCODE_ERR_ENCODING;
8021 0 : }
8022 0 : }
8023 0 : static int fd_bpf_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8024 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8025 0 : uint discriminant = 0;
8026 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8027 0 : if( FD_UNLIKELY( err ) ) return err;
8028 0 : return fd_bpf_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
8029 0 : }
8030 0 : int fd_bpf_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8031 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_t);
8032 0 : void const * start_data = ctx->data;
8033 0 : int err = fd_bpf_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
8034 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8035 0 : ctx->data = start_data;
8036 0 : return err;
8037 0 : }
8038 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 ) {
8039 0 : switch (discriminant) {
8040 0 : case 0: {
8041 0 : fd_bpf_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
8042 0 : break;
8043 0 : }
8044 0 : case 1: {
8045 0 : break;
8046 0 : }
8047 0 : }
8048 0 : }
8049 0 : static void fd_bpf_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8050 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)struct_mem;
8051 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8052 0 : fd_bpf_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8053 0 : }
8054 0 : void * fd_bpf_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8055 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)mem;
8056 0 : fd_bpf_loader_program_instruction_new( self );
8057 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_t);
8058 0 : void * * alloc_mem = &alloc_region;
8059 0 : fd_bpf_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
8060 0 : return self;
8061 0 : }
8062 0 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
8063 0 : switch( discriminant ) {
8064 0 : case 0: {
8065 0 : fd_bpf_loader_program_instruction_write_new( &self->write );
8066 0 : break;
8067 0 : }
8068 0 : case 1: {
8069 0 : break;
8070 0 : }
8071 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8072 0 : }
8073 0 : }
8074 0 : void fd_bpf_loader_program_instruction_new_disc( fd_bpf_loader_program_instruction_t * self, uint discriminant ) {
8075 0 : self->discriminant = discriminant;
8076 0 : fd_bpf_loader_program_instruction_inner_new( &self->inner, self->discriminant );
8077 0 : }
8078 0 : void fd_bpf_loader_program_instruction_new( fd_bpf_loader_program_instruction_t * self ) {
8079 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_t) );
8080 0 : fd_bpf_loader_program_instruction_new_disc( self, UINT_MAX );
8081 0 : }
8082 :
8083 0 : ulong fd_bpf_loader_program_instruction_size( fd_bpf_loader_program_instruction_t const * self ) {
8084 0 : ulong size = 0;
8085 0 : size += sizeof(uint);
8086 0 : switch (self->discriminant) {
8087 0 : case 0: {
8088 0 : size += fd_bpf_loader_program_instruction_write_size( &self->inner.write );
8089 0 : break;
8090 0 : }
8091 0 : }
8092 0 : return size;
8093 0 : }
8094 :
8095 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 ) {
8096 0 : int err;
8097 0 : switch (discriminant) {
8098 0 : case 0: {
8099 0 : err = fd_bpf_loader_program_instruction_write_encode( &self->write, ctx );
8100 0 : if( FD_UNLIKELY( err ) ) return err;
8101 0 : break;
8102 0 : }
8103 0 : }
8104 0 : return FD_BINCODE_SUCCESS;
8105 0 : }
8106 0 : int fd_bpf_loader_program_instruction_encode( fd_bpf_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8107 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8108 0 : if( FD_UNLIKELY( err ) ) return err;
8109 0 : return fd_bpf_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
8110 0 : }
8111 :
8112 0 : int fd_loader_v4_program_instruction_write_encode( fd_loader_v4_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8113 0 : int err;
8114 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
8115 0 : if( FD_UNLIKELY( err ) ) return err;
8116 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
8117 0 : if( FD_UNLIKELY(err) ) return err;
8118 0 : if( self->bytes_len ) {
8119 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
8120 0 : if( FD_UNLIKELY( err ) ) return err;
8121 0 : }
8122 0 : return FD_BINCODE_SUCCESS;
8123 0 : }
8124 0 : static int fd_loader_v4_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8125 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8126 0 : int err = 0;
8127 0 : err = fd_bincode_uint32_decode_footprint( ctx );
8128 0 : if( FD_UNLIKELY( err ) ) return err;
8129 0 : ulong bytes_len;
8130 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
8131 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8132 0 : if( bytes_len ) {
8133 0 : *total_sz += 8UL + bytes_len;
8134 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
8135 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8136 0 : }
8137 0 : return 0;
8138 0 : }
8139 0 : int fd_loader_v4_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8140 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_write_t);
8141 0 : void const * start_data = ctx->data;
8142 0 : int err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8143 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8144 0 : ctx->data = start_data;
8145 0 : return err;
8146 0 : }
8147 0 : static void fd_loader_v4_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8148 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)struct_mem;
8149 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
8150 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
8151 0 : if( self->bytes_len ) {
8152 0 : self->bytes = *alloc_mem;
8153 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
8154 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
8155 0 : } else
8156 0 : self->bytes = NULL;
8157 0 : }
8158 0 : void * fd_loader_v4_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8159 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)mem;
8160 0 : fd_loader_v4_program_instruction_write_new( self );
8161 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_write_t);
8162 0 : void * * alloc_mem = &alloc_region;
8163 0 : fd_loader_v4_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
8164 0 : return self;
8165 0 : }
8166 0 : void fd_loader_v4_program_instruction_write_new(fd_loader_v4_program_instruction_write_t * self) {
8167 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_write_t) );
8168 0 : }
8169 0 : ulong fd_loader_v4_program_instruction_write_size( fd_loader_v4_program_instruction_write_t const * self ) {
8170 0 : ulong size = 0;
8171 0 : size += sizeof(uint);
8172 0 : do {
8173 0 : size += sizeof(ulong);
8174 0 : size += self->bytes_len;
8175 0 : } while(0);
8176 0 : return size;
8177 0 : }
8178 :
8179 0 : int fd_loader_v4_program_instruction_copy_encode( fd_loader_v4_program_instruction_copy_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8180 0 : int err;
8181 0 : err = fd_bincode_uint32_encode( self->destination_offset, ctx );
8182 0 : if( FD_UNLIKELY( err ) ) return err;
8183 0 : err = fd_bincode_uint32_encode( self->source_offset, ctx );
8184 0 : if( FD_UNLIKELY( err ) ) return err;
8185 0 : err = fd_bincode_uint32_encode( self->length, ctx );
8186 0 : if( FD_UNLIKELY( err ) ) return err;
8187 0 : return FD_BINCODE_SUCCESS;
8188 0 : }
8189 0 : static inline int fd_loader_v4_program_instruction_copy_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8190 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8191 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
8192 0 : return 0;
8193 0 : }
8194 0 : static void fd_loader_v4_program_instruction_copy_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8195 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)struct_mem;
8196 0 : fd_bincode_uint32_decode_unsafe( &self->destination_offset, ctx );
8197 0 : fd_bincode_uint32_decode_unsafe( &self->source_offset, ctx );
8198 0 : fd_bincode_uint32_decode_unsafe( &self->length, ctx );
8199 0 : }
8200 0 : void * fd_loader_v4_program_instruction_copy_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8201 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)mem;
8202 0 : fd_loader_v4_program_instruction_copy_new( self );
8203 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_copy_t);
8204 0 : void * * alloc_mem = &alloc_region;
8205 0 : fd_loader_v4_program_instruction_copy_decode_inner( mem, alloc_mem, ctx );
8206 0 : return self;
8207 0 : }
8208 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 ) {
8209 0 : int err;
8210 0 : err = fd_bincode_uint32_encode( self->new_size, ctx );
8211 0 : if( FD_UNLIKELY( err ) ) return err;
8212 0 : return FD_BINCODE_SUCCESS;
8213 0 : }
8214 0 : static inline int fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8215 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8216 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
8217 0 : return 0;
8218 0 : }
8219 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 ) {
8220 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)struct_mem;
8221 0 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
8222 0 : }
8223 0 : void * fd_loader_v4_program_instruction_set_program_length_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8224 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)mem;
8225 0 : fd_loader_v4_program_instruction_set_program_length_new( self );
8226 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_set_program_length_t);
8227 0 : void * * alloc_mem = &alloc_region;
8228 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( mem, alloc_mem, ctx );
8229 0 : return self;
8230 0 : }
8231 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_write(fd_loader_v4_program_instruction_t const * self) {
8232 0 : return self->discriminant == 0;
8233 0 : }
8234 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_copy(fd_loader_v4_program_instruction_t const * self) {
8235 0 : return self->discriminant == 1;
8236 0 : }
8237 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_set_program_length(fd_loader_v4_program_instruction_t const * self) {
8238 0 : return self->discriminant == 2;
8239 0 : }
8240 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_deploy(fd_loader_v4_program_instruction_t const * self) {
8241 0 : return self->discriminant == 3;
8242 0 : }
8243 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_retract(fd_loader_v4_program_instruction_t const * self) {
8244 0 : return self->discriminant == 4;
8245 0 : }
8246 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_transfer_authority(fd_loader_v4_program_instruction_t const * self) {
8247 0 : return self->discriminant == 5;
8248 0 : }
8249 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_finalize(fd_loader_v4_program_instruction_t const * self) {
8250 0 : return self->discriminant == 6;
8251 0 : }
8252 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant );
8253 0 : int fd_loader_v4_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8254 0 : int err;
8255 0 : switch (discriminant) {
8256 0 : case 0: {
8257 0 : err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8258 0 : if( FD_UNLIKELY( err ) ) return err;
8259 0 : return FD_BINCODE_SUCCESS;
8260 0 : }
8261 0 : case 1: {
8262 0 : err = fd_loader_v4_program_instruction_copy_decode_footprint_inner( ctx, total_sz );
8263 0 : if( FD_UNLIKELY( err ) ) return err;
8264 0 : return FD_BINCODE_SUCCESS;
8265 0 : }
8266 0 : case 2: {
8267 0 : err = fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( ctx, total_sz );
8268 0 : if( FD_UNLIKELY( err ) ) return err;
8269 0 : return FD_BINCODE_SUCCESS;
8270 0 : }
8271 0 : case 3: {
8272 0 : return FD_BINCODE_SUCCESS;
8273 0 : }
8274 0 : case 4: {
8275 0 : return FD_BINCODE_SUCCESS;
8276 0 : }
8277 0 : case 5: {
8278 0 : return FD_BINCODE_SUCCESS;
8279 0 : }
8280 0 : case 6: {
8281 0 : return FD_BINCODE_SUCCESS;
8282 0 : }
8283 0 : default: return FD_BINCODE_ERR_ENCODING;
8284 0 : }
8285 0 : }
8286 0 : static int fd_loader_v4_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8287 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8288 0 : uint discriminant = 0;
8289 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8290 0 : if( FD_UNLIKELY( err ) ) return err;
8291 0 : return fd_loader_v4_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
8292 0 : }
8293 0 : int fd_loader_v4_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8294 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_t);
8295 0 : void const * start_data = ctx->data;
8296 0 : int err = fd_loader_v4_program_instruction_decode_footprint_inner( ctx, total_sz );
8297 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8298 0 : ctx->data = start_data;
8299 0 : return err;
8300 0 : }
8301 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 ) {
8302 0 : switch (discriminant) {
8303 0 : case 0: {
8304 0 : fd_loader_v4_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
8305 0 : break;
8306 0 : }
8307 0 : case 1: {
8308 0 : fd_loader_v4_program_instruction_copy_decode_inner( &self->copy, alloc_mem, ctx );
8309 0 : break;
8310 0 : }
8311 0 : case 2: {
8312 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( &self->set_program_length, alloc_mem, ctx );
8313 0 : break;
8314 0 : }
8315 0 : case 3: {
8316 0 : break;
8317 0 : }
8318 0 : case 4: {
8319 0 : break;
8320 0 : }
8321 0 : case 5: {
8322 0 : break;
8323 0 : }
8324 0 : case 6: {
8325 0 : break;
8326 0 : }
8327 0 : }
8328 0 : }
8329 0 : static void fd_loader_v4_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8330 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)struct_mem;
8331 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8332 0 : fd_loader_v4_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8333 0 : }
8334 0 : void * fd_loader_v4_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8335 0 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)mem;
8336 0 : fd_loader_v4_program_instruction_new( self );
8337 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_t);
8338 0 : void * * alloc_mem = &alloc_region;
8339 0 : fd_loader_v4_program_instruction_decode_inner( mem, alloc_mem, ctx );
8340 0 : return self;
8341 0 : }
8342 0 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
8343 0 : switch( discriminant ) {
8344 0 : case 0: {
8345 0 : fd_loader_v4_program_instruction_write_new( &self->write );
8346 0 : break;
8347 0 : }
8348 0 : case 1: {
8349 0 : fd_loader_v4_program_instruction_copy_new( &self->copy );
8350 0 : break;
8351 0 : }
8352 0 : case 2: {
8353 0 : fd_loader_v4_program_instruction_set_program_length_new( &self->set_program_length );
8354 0 : break;
8355 0 : }
8356 0 : case 3: {
8357 0 : break;
8358 0 : }
8359 0 : case 4: {
8360 0 : break;
8361 0 : }
8362 0 : case 5: {
8363 0 : break;
8364 0 : }
8365 0 : case 6: {
8366 0 : break;
8367 0 : }
8368 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8369 0 : }
8370 0 : }
8371 0 : void fd_loader_v4_program_instruction_new_disc( fd_loader_v4_program_instruction_t * self, uint discriminant ) {
8372 0 : self->discriminant = discriminant;
8373 0 : fd_loader_v4_program_instruction_inner_new( &self->inner, self->discriminant );
8374 0 : }
8375 0 : void fd_loader_v4_program_instruction_new( fd_loader_v4_program_instruction_t * self ) {
8376 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_t) );
8377 0 : fd_loader_v4_program_instruction_new_disc( self, UINT_MAX );
8378 0 : }
8379 :
8380 0 : ulong fd_loader_v4_program_instruction_size( fd_loader_v4_program_instruction_t const * self ) {
8381 0 : ulong size = 0;
8382 0 : size += sizeof(uint);
8383 0 : switch (self->discriminant) {
8384 0 : case 0: {
8385 0 : size += fd_loader_v4_program_instruction_write_size( &self->inner.write );
8386 0 : break;
8387 0 : }
8388 0 : case 1: {
8389 0 : size += fd_loader_v4_program_instruction_copy_size( &self->inner.copy );
8390 0 : break;
8391 0 : }
8392 0 : case 2: {
8393 0 : size += fd_loader_v4_program_instruction_set_program_length_size( &self->inner.set_program_length );
8394 0 : break;
8395 0 : }
8396 0 : }
8397 0 : return size;
8398 0 : }
8399 :
8400 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 ) {
8401 0 : int err;
8402 0 : switch (discriminant) {
8403 0 : case 0: {
8404 0 : err = fd_loader_v4_program_instruction_write_encode( &self->write, ctx );
8405 0 : if( FD_UNLIKELY( err ) ) return err;
8406 0 : break;
8407 0 : }
8408 0 : case 1: {
8409 0 : err = fd_loader_v4_program_instruction_copy_encode( &self->copy, ctx );
8410 0 : if( FD_UNLIKELY( err ) ) return err;
8411 0 : break;
8412 0 : }
8413 0 : case 2: {
8414 0 : err = fd_loader_v4_program_instruction_set_program_length_encode( &self->set_program_length, ctx );
8415 0 : if( FD_UNLIKELY( err ) ) return err;
8416 0 : break;
8417 0 : }
8418 0 : }
8419 0 : return FD_BINCODE_SUCCESS;
8420 0 : }
8421 0 : int fd_loader_v4_program_instruction_encode( fd_loader_v4_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8422 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8423 0 : if( FD_UNLIKELY( err ) ) return err;
8424 0 : return fd_loader_v4_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
8425 0 : }
8426 :
8427 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 ) {
8428 0 : int err;
8429 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
8430 0 : if( FD_UNLIKELY( err ) ) return err;
8431 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
8432 0 : if( FD_UNLIKELY(err) ) return err;
8433 0 : if( self->bytes_len ) {
8434 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
8435 0 : if( FD_UNLIKELY( err ) ) return err;
8436 0 : }
8437 0 : return FD_BINCODE_SUCCESS;
8438 0 : }
8439 0 : static int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8440 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8441 0 : int err = 0;
8442 0 : err = fd_bincode_uint32_decode_footprint( ctx );
8443 0 : if( FD_UNLIKELY( err ) ) return err;
8444 0 : ulong bytes_len;
8445 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
8446 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8447 0 : if( bytes_len ) {
8448 0 : *total_sz += 8UL + bytes_len;
8449 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
8450 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8451 0 : }
8452 0 : return 0;
8453 0 : }
8454 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8455 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
8456 0 : void const * start_data = ctx->data;
8457 0 : int err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8458 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8459 0 : ctx->data = start_data;
8460 0 : return err;
8461 0 : }
8462 0 : static void fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8463 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)struct_mem;
8464 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
8465 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
8466 0 : if( self->bytes_len ) {
8467 0 : self->bytes = *alloc_mem;
8468 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
8469 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
8470 0 : } else
8471 0 : self->bytes = NULL;
8472 0 : }
8473 0 : void * fd_bpf_upgradeable_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8474 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)mem;
8475 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( self );
8476 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
8477 0 : void * * alloc_mem = &alloc_region;
8478 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
8479 0 : return self;
8480 0 : }
8481 0 : void fd_bpf_upgradeable_loader_program_instruction_write_new(fd_bpf_upgradeable_loader_program_instruction_write_t * self) {
8482 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t) );
8483 0 : }
8484 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_size( fd_bpf_upgradeable_loader_program_instruction_write_t const * self ) {
8485 0 : ulong size = 0;
8486 0 : size += sizeof(uint);
8487 0 : do {
8488 0 : size += sizeof(ulong);
8489 0 : size += self->bytes_len;
8490 0 : } while(0);
8491 0 : return size;
8492 0 : }
8493 :
8494 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 ) {
8495 0 : int err;
8496 0 : err = fd_bincode_uint64_encode( self->max_data_len, ctx );
8497 0 : if( FD_UNLIKELY( err ) ) return err;
8498 0 : return FD_BINCODE_SUCCESS;
8499 0 : }
8500 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 ) {
8501 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8502 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
8503 0 : return 0;
8504 0 : }
8505 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 ) {
8506 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;
8507 0 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
8508 0 : }
8509 0 : void * fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8510 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;
8511 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( self );
8512 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t);
8513 0 : void * * alloc_mem = &alloc_region;
8514 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( mem, alloc_mem, ctx );
8515 0 : return self;
8516 0 : }
8517 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 ) {
8518 0 : int err;
8519 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
8520 0 : if( FD_UNLIKELY( err ) ) return err;
8521 0 : return FD_BINCODE_SUCCESS;
8522 0 : }
8523 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8524 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8525 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
8526 0 : return 0;
8527 0 : }
8528 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 ) {
8529 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)struct_mem;
8530 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
8531 0 : }
8532 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8533 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)mem;
8534 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( self );
8535 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t);
8536 0 : void * * alloc_mem = &alloc_region;
8537 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( mem, alloc_mem, ctx );
8538 0 : return self;
8539 0 : }
8540 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 ) {
8541 0 : int err;
8542 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
8543 0 : if( FD_UNLIKELY( err ) ) return err;
8544 0 : return FD_BINCODE_SUCCESS;
8545 0 : }
8546 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 ) {
8547 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8548 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
8549 0 : return 0;
8550 0 : }
8551 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 ) {
8552 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)struct_mem;
8553 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
8554 0 : }
8555 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8556 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)mem;
8557 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( self );
8558 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t);
8559 0 : void * * alloc_mem = &alloc_region;
8560 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( mem, alloc_mem, ctx );
8561 0 : return self;
8562 0 : }
8563 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_initialize_buffer(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8564 0 : return self->discriminant == 0;
8565 0 : }
8566 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_write(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8567 0 : return self->discriminant == 1;
8568 0 : }
8569 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) {
8570 0 : return self->discriminant == 2;
8571 0 : }
8572 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_upgrade(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8573 0 : return self->discriminant == 3;
8574 0 : }
8575 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8576 0 : return self->discriminant == 4;
8577 0 : }
8578 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_close(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8579 0 : return self->discriminant == 5;
8580 0 : }
8581 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8582 0 : return self->discriminant == 6;
8583 0 : }
8584 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8585 0 : return self->discriminant == 7;
8586 0 : }
8587 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_migrate(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8588 0 : return self->discriminant == 8;
8589 0 : }
8590 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8591 0 : return self->discriminant == 9;
8592 0 : }
8593 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant );
8594 0 : int fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8595 0 : int err;
8596 0 : switch (discriminant) {
8597 0 : case 0: {
8598 0 : return FD_BINCODE_SUCCESS;
8599 0 : }
8600 0 : case 1: {
8601 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8602 0 : if( FD_UNLIKELY( err ) ) return err;
8603 0 : return FD_BINCODE_SUCCESS;
8604 0 : }
8605 0 : case 2: {
8606 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( ctx, total_sz );
8607 0 : if( FD_UNLIKELY( err ) ) return err;
8608 0 : return FD_BINCODE_SUCCESS;
8609 0 : }
8610 0 : case 3: {
8611 0 : return FD_BINCODE_SUCCESS;
8612 0 : }
8613 0 : case 4: {
8614 0 : return FD_BINCODE_SUCCESS;
8615 0 : }
8616 0 : case 5: {
8617 0 : return FD_BINCODE_SUCCESS;
8618 0 : }
8619 0 : case 6: {
8620 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( ctx, total_sz );
8621 0 : if( FD_UNLIKELY( err ) ) return err;
8622 0 : return FD_BINCODE_SUCCESS;
8623 0 : }
8624 0 : case 7: {
8625 0 : return FD_BINCODE_SUCCESS;
8626 0 : }
8627 0 : case 8: {
8628 0 : return FD_BINCODE_SUCCESS;
8629 0 : }
8630 0 : case 9: {
8631 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_footprint_inner( ctx, total_sz );
8632 0 : if( FD_UNLIKELY( err ) ) return err;
8633 0 : return FD_BINCODE_SUCCESS;
8634 0 : }
8635 0 : default: return FD_BINCODE_ERR_ENCODING;
8636 0 : }
8637 0 : }
8638 0 : static int fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8639 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8640 0 : uint discriminant = 0;
8641 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8642 0 : if( FD_UNLIKELY( err ) ) return err;
8643 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
8644 0 : }
8645 0 : int fd_bpf_upgradeable_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8646 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
8647 0 : void const * start_data = ctx->data;
8648 0 : int err = fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
8649 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8650 0 : ctx->data = start_data;
8651 0 : return err;
8652 0 : }
8653 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 ) {
8654 0 : switch (discriminant) {
8655 0 : case 0: {
8656 0 : break;
8657 0 : }
8658 0 : case 1: {
8659 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
8660 0 : break;
8661 0 : }
8662 0 : case 2: {
8663 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( &self->deploy_with_max_data_len, alloc_mem, ctx );
8664 0 : break;
8665 0 : }
8666 0 : case 3: {
8667 0 : break;
8668 0 : }
8669 0 : case 4: {
8670 0 : break;
8671 0 : }
8672 0 : case 5: {
8673 0 : break;
8674 0 : }
8675 0 : case 6: {
8676 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( &self->extend_program, alloc_mem, ctx );
8677 0 : break;
8678 0 : }
8679 0 : case 7: {
8680 0 : break;
8681 0 : }
8682 0 : case 8: {
8683 0 : break;
8684 0 : }
8685 0 : case 9: {
8686 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( &self->extend_program_checked, alloc_mem, ctx );
8687 0 : break;
8688 0 : }
8689 0 : }
8690 0 : }
8691 0 : static void fd_bpf_upgradeable_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8692 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)struct_mem;
8693 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8694 0 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8695 0 : }
8696 0 : void * fd_bpf_upgradeable_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8697 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)mem;
8698 0 : fd_bpf_upgradeable_loader_program_instruction_new( self );
8699 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
8700 0 : void * * alloc_mem = &alloc_region;
8701 0 : fd_bpf_upgradeable_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
8702 0 : return self;
8703 0 : }
8704 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
8705 0 : switch( discriminant ) {
8706 0 : case 0: {
8707 0 : break;
8708 0 : }
8709 0 : case 1: {
8710 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( &self->write );
8711 0 : break;
8712 0 : }
8713 0 : case 2: {
8714 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( &self->deploy_with_max_data_len );
8715 0 : break;
8716 0 : }
8717 0 : case 3: {
8718 0 : break;
8719 0 : }
8720 0 : case 4: {
8721 0 : break;
8722 0 : }
8723 0 : case 5: {
8724 0 : break;
8725 0 : }
8726 0 : case 6: {
8727 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( &self->extend_program );
8728 0 : break;
8729 0 : }
8730 0 : case 7: {
8731 0 : break;
8732 0 : }
8733 0 : case 8: {
8734 0 : break;
8735 0 : }
8736 0 : case 9: {
8737 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( &self->extend_program_checked );
8738 0 : break;
8739 0 : }
8740 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8741 0 : }
8742 0 : }
8743 0 : void fd_bpf_upgradeable_loader_program_instruction_new_disc( fd_bpf_upgradeable_loader_program_instruction_t * self, uint discriminant ) {
8744 0 : self->discriminant = discriminant;
8745 0 : fd_bpf_upgradeable_loader_program_instruction_inner_new( &self->inner, self->discriminant );
8746 0 : }
8747 0 : void fd_bpf_upgradeable_loader_program_instruction_new( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
8748 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_t) );
8749 0 : fd_bpf_upgradeable_loader_program_instruction_new_disc( self, UINT_MAX );
8750 0 : }
8751 :
8752 0 : ulong fd_bpf_upgradeable_loader_program_instruction_size( fd_bpf_upgradeable_loader_program_instruction_t const * self ) {
8753 0 : ulong size = 0;
8754 0 : size += sizeof(uint);
8755 0 : switch (self->discriminant) {
8756 0 : case 1: {
8757 0 : size += fd_bpf_upgradeable_loader_program_instruction_write_size( &self->inner.write );
8758 0 : break;
8759 0 : }
8760 0 : case 2: {
8761 0 : size += fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( &self->inner.deploy_with_max_data_len );
8762 0 : break;
8763 0 : }
8764 0 : case 6: {
8765 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_size( &self->inner.extend_program );
8766 0 : break;
8767 0 : }
8768 0 : case 9: {
8769 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_size( &self->inner.extend_program_checked );
8770 0 : break;
8771 0 : }
8772 0 : }
8773 0 : return size;
8774 0 : }
8775 :
8776 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 ) {
8777 0 : int err;
8778 0 : switch (discriminant) {
8779 0 : case 1: {
8780 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_encode( &self->write, ctx );
8781 0 : if( FD_UNLIKELY( err ) ) return err;
8782 0 : break;
8783 0 : }
8784 0 : case 2: {
8785 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( &self->deploy_with_max_data_len, ctx );
8786 0 : if( FD_UNLIKELY( err ) ) return err;
8787 0 : break;
8788 0 : }
8789 0 : case 6: {
8790 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( &self->extend_program, ctx );
8791 0 : if( FD_UNLIKELY( err ) ) return err;
8792 0 : break;
8793 0 : }
8794 0 : case 9: {
8795 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_encode( &self->extend_program_checked, ctx );
8796 0 : if( FD_UNLIKELY( err ) ) return err;
8797 0 : break;
8798 0 : }
8799 0 : }
8800 0 : return FD_BINCODE_SUCCESS;
8801 0 : }
8802 0 : int fd_bpf_upgradeable_loader_program_instruction_encode( fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8803 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8804 0 : if( FD_UNLIKELY( err ) ) return err;
8805 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
8806 0 : }
8807 :
8808 0 : int fd_bpf_upgradeable_loader_state_buffer_encode( fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8809 0 : int err;
8810 0 : err = fd_bincode_bool_encode( self->has_authority_address, ctx );
8811 0 : if( FD_UNLIKELY( err ) ) return err;
8812 0 : if( self->has_authority_address ) {
8813 0 : err = fd_pubkey_encode( &self->authority_address, ctx );
8814 0 : if( FD_UNLIKELY( err ) ) return err;
8815 0 : }
8816 0 : return FD_BINCODE_SUCCESS;
8817 0 : }
8818 0 : static int fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8819 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8820 0 : int err = 0;
8821 0 : {
8822 0 : uchar o;
8823 0 : err = fd_bincode_bool_decode( &o, ctx );
8824 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8825 0 : if( o ) {
8826 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8827 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8828 0 : }
8829 0 : }
8830 0 : return 0;
8831 0 : }
8832 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8833 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
8834 0 : void const * start_data = ctx->data;
8835 0 : int err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
8836 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8837 0 : ctx->data = start_data;
8838 0 : return err;
8839 0 : }
8840 0 : static void fd_bpf_upgradeable_loader_state_buffer_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8841 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)struct_mem;
8842 0 : {
8843 0 : uchar o;
8844 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8845 0 : self->has_authority_address = !!o;
8846 0 : if( o ) {
8847 0 : fd_pubkey_new( &self->authority_address );
8848 0 : fd_pubkey_decode_inner( &self->authority_address, alloc_mem, ctx );
8849 0 : }
8850 0 : }
8851 0 : }
8852 0 : void * fd_bpf_upgradeable_loader_state_buffer_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8853 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)mem;
8854 0 : fd_bpf_upgradeable_loader_state_buffer_new( self );
8855 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
8856 0 : void * * alloc_mem = &alloc_region;
8857 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( mem, alloc_mem, ctx );
8858 0 : return self;
8859 0 : }
8860 0 : void fd_bpf_upgradeable_loader_state_buffer_new(fd_bpf_upgradeable_loader_state_buffer_t * self) {
8861 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_buffer_t) );
8862 0 : }
8863 0 : ulong fd_bpf_upgradeable_loader_state_buffer_size( fd_bpf_upgradeable_loader_state_buffer_t const * self ) {
8864 0 : ulong size = 0;
8865 0 : size += sizeof(char);
8866 0 : if( self->has_authority_address ) {
8867 0 : size += fd_pubkey_size( &self->authority_address );
8868 0 : }
8869 0 : return size;
8870 0 : }
8871 :
8872 0 : int fd_bpf_upgradeable_loader_state_program_encode( fd_bpf_upgradeable_loader_state_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8873 0 : int err;
8874 0 : err = fd_pubkey_encode( &self->programdata_address, ctx );
8875 0 : if( FD_UNLIKELY( err ) ) return err;
8876 0 : return FD_BINCODE_SUCCESS;
8877 0 : }
8878 0 : static inline int fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8879 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8880 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
8881 0 : return 0;
8882 0 : }
8883 0 : static void fd_bpf_upgradeable_loader_state_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8884 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)struct_mem;
8885 0 : fd_pubkey_decode_inner( &self->programdata_address, alloc_mem, ctx );
8886 0 : }
8887 0 : void * fd_bpf_upgradeable_loader_state_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8888 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)mem;
8889 0 : fd_bpf_upgradeable_loader_state_program_new( self );
8890 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_t);
8891 0 : void * * alloc_mem = &alloc_region;
8892 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( mem, alloc_mem, ctx );
8893 0 : return self;
8894 0 : }
8895 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 ) {
8896 0 : int err;
8897 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
8898 0 : if( FD_UNLIKELY( err ) ) return err;
8899 0 : err = fd_bincode_bool_encode( self->has_upgrade_authority_address, ctx );
8900 0 : if( FD_UNLIKELY( err ) ) return err;
8901 0 : if( self->has_upgrade_authority_address ) {
8902 0 : err = fd_pubkey_encode( &self->upgrade_authority_address, ctx );
8903 0 : if( FD_UNLIKELY( err ) ) return err;
8904 0 : }
8905 0 : return FD_BINCODE_SUCCESS;
8906 0 : }
8907 0 : static int fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8908 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8909 0 : int err = 0;
8910 0 : err = fd_bincode_uint64_decode_footprint( ctx );
8911 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8912 0 : {
8913 0 : uchar o;
8914 0 : err = fd_bincode_bool_decode( &o, ctx );
8915 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8916 0 : if( o ) {
8917 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8918 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8919 0 : }
8920 0 : }
8921 0 : return 0;
8922 0 : }
8923 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8924 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
8925 0 : void const * start_data = ctx->data;
8926 0 : int err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
8927 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8928 0 : ctx->data = start_data;
8929 0 : return err;
8930 0 : }
8931 0 : static void fd_bpf_upgradeable_loader_state_program_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8932 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)struct_mem;
8933 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
8934 0 : {
8935 0 : uchar o;
8936 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8937 0 : self->has_upgrade_authority_address = !!o;
8938 0 : if( o ) {
8939 0 : fd_pubkey_new( &self->upgrade_authority_address );
8940 0 : fd_pubkey_decode_inner( &self->upgrade_authority_address, alloc_mem, ctx );
8941 0 : }
8942 0 : }
8943 0 : }
8944 0 : void * fd_bpf_upgradeable_loader_state_program_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8945 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)mem;
8946 0 : fd_bpf_upgradeable_loader_state_program_data_new( self );
8947 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
8948 0 : void * * alloc_mem = &alloc_region;
8949 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( mem, alloc_mem, ctx );
8950 0 : return self;
8951 0 : }
8952 0 : void fd_bpf_upgradeable_loader_state_program_data_new(fd_bpf_upgradeable_loader_state_program_data_t * self) {
8953 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_data_t) );
8954 0 : }
8955 0 : ulong fd_bpf_upgradeable_loader_state_program_data_size( fd_bpf_upgradeable_loader_state_program_data_t const * self ) {
8956 0 : ulong size = 0;
8957 0 : size += sizeof(ulong);
8958 0 : size += sizeof(char);
8959 0 : if( self->has_upgrade_authority_address ) {
8960 0 : size += fd_pubkey_size( &self->upgrade_authority_address );
8961 0 : }
8962 0 : return size;
8963 0 : }
8964 :
8965 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_uninitialized(fd_bpf_upgradeable_loader_state_t const * self) {
8966 0 : return self->discriminant == 0;
8967 0 : }
8968 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_buffer(fd_bpf_upgradeable_loader_state_t const * self) {
8969 0 : return self->discriminant == 1;
8970 0 : }
8971 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program(fd_bpf_upgradeable_loader_state_t const * self) {
8972 0 : return self->discriminant == 2;
8973 0 : }
8974 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program_data(fd_bpf_upgradeable_loader_state_t const * self) {
8975 0 : return self->discriminant == 3;
8976 0 : }
8977 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant );
8978 0 : int fd_bpf_upgradeable_loader_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8979 0 : int err;
8980 0 : switch (discriminant) {
8981 0 : case 0: {
8982 0 : return FD_BINCODE_SUCCESS;
8983 0 : }
8984 0 : case 1: {
8985 0 : err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
8986 0 : if( FD_UNLIKELY( err ) ) return err;
8987 0 : return FD_BINCODE_SUCCESS;
8988 0 : }
8989 0 : case 2: {
8990 0 : err = fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( ctx, total_sz );
8991 0 : if( FD_UNLIKELY( err ) ) return err;
8992 0 : return FD_BINCODE_SUCCESS;
8993 0 : }
8994 0 : case 3: {
8995 0 : err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
8996 0 : if( FD_UNLIKELY( err ) ) return err;
8997 0 : return FD_BINCODE_SUCCESS;
8998 0 : }
8999 0 : default: return FD_BINCODE_ERR_ENCODING;
9000 0 : }
9001 0 : }
9002 0 : static int fd_bpf_upgradeable_loader_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9003 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9004 0 : uint discriminant = 0;
9005 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9006 0 : if( FD_UNLIKELY( err ) ) return err;
9007 0 : return fd_bpf_upgradeable_loader_state_inner_decode_footprint( discriminant, ctx, total_sz );
9008 0 : }
9009 0 : int fd_bpf_upgradeable_loader_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9010 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_t);
9011 0 : void const * start_data = ctx->data;
9012 0 : int err = fd_bpf_upgradeable_loader_state_decode_footprint_inner( ctx, total_sz );
9013 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9014 0 : ctx->data = start_data;
9015 0 : return err;
9016 0 : }
9017 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 ) {
9018 0 : switch (discriminant) {
9019 0 : case 0: {
9020 0 : break;
9021 0 : }
9022 0 : case 1: {
9023 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( &self->buffer, alloc_mem, ctx );
9024 0 : break;
9025 0 : }
9026 0 : case 2: {
9027 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( &self->program, alloc_mem, ctx );
9028 0 : break;
9029 0 : }
9030 0 : case 3: {
9031 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( &self->program_data, alloc_mem, ctx );
9032 0 : break;
9033 0 : }
9034 0 : }
9035 0 : }
9036 0 : static void fd_bpf_upgradeable_loader_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9037 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)struct_mem;
9038 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9039 0 : fd_bpf_upgradeable_loader_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9040 0 : }
9041 0 : void * fd_bpf_upgradeable_loader_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9042 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)mem;
9043 0 : fd_bpf_upgradeable_loader_state_new( self );
9044 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_t);
9045 0 : void * * alloc_mem = &alloc_region;
9046 0 : fd_bpf_upgradeable_loader_state_decode_inner( mem, alloc_mem, ctx );
9047 0 : return self;
9048 0 : }
9049 0 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
9050 0 : switch( discriminant ) {
9051 0 : case 0: {
9052 0 : break;
9053 0 : }
9054 0 : case 1: {
9055 0 : fd_bpf_upgradeable_loader_state_buffer_new( &self->buffer );
9056 0 : break;
9057 0 : }
9058 0 : case 2: {
9059 0 : fd_bpf_upgradeable_loader_state_program_new( &self->program );
9060 0 : break;
9061 0 : }
9062 0 : case 3: {
9063 0 : fd_bpf_upgradeable_loader_state_program_data_new( &self->program_data );
9064 0 : break;
9065 0 : }
9066 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9067 0 : }
9068 0 : }
9069 0 : void fd_bpf_upgradeable_loader_state_new_disc( fd_bpf_upgradeable_loader_state_t * self, uint discriminant ) {
9070 0 : self->discriminant = discriminant;
9071 0 : fd_bpf_upgradeable_loader_state_inner_new( &self->inner, self->discriminant );
9072 0 : }
9073 0 : void fd_bpf_upgradeable_loader_state_new( fd_bpf_upgradeable_loader_state_t * self ) {
9074 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_t) );
9075 0 : fd_bpf_upgradeable_loader_state_new_disc( self, UINT_MAX );
9076 0 : }
9077 :
9078 0 : ulong fd_bpf_upgradeable_loader_state_size( fd_bpf_upgradeable_loader_state_t const * self ) {
9079 0 : ulong size = 0;
9080 0 : size += sizeof(uint);
9081 0 : switch (self->discriminant) {
9082 0 : case 1: {
9083 0 : size += fd_bpf_upgradeable_loader_state_buffer_size( &self->inner.buffer );
9084 0 : break;
9085 0 : }
9086 0 : case 2: {
9087 0 : size += fd_bpf_upgradeable_loader_state_program_size( &self->inner.program );
9088 0 : break;
9089 0 : }
9090 0 : case 3: {
9091 0 : size += fd_bpf_upgradeable_loader_state_program_data_size( &self->inner.program_data );
9092 0 : break;
9093 0 : }
9094 0 : }
9095 0 : return size;
9096 0 : }
9097 :
9098 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 ) {
9099 0 : int err;
9100 0 : switch (discriminant) {
9101 0 : case 1: {
9102 0 : err = fd_bpf_upgradeable_loader_state_buffer_encode( &self->buffer, ctx );
9103 0 : if( FD_UNLIKELY( err ) ) return err;
9104 0 : break;
9105 0 : }
9106 0 : case 2: {
9107 0 : err = fd_bpf_upgradeable_loader_state_program_encode( &self->program, ctx );
9108 0 : if( FD_UNLIKELY( err ) ) return err;
9109 0 : break;
9110 0 : }
9111 0 : case 3: {
9112 0 : err = fd_bpf_upgradeable_loader_state_program_data_encode( &self->program_data, ctx );
9113 0 : if( FD_UNLIKELY( err ) ) return err;
9114 0 : break;
9115 0 : }
9116 0 : }
9117 0 : return FD_BINCODE_SUCCESS;
9118 0 : }
9119 0 : int fd_bpf_upgradeable_loader_state_encode( fd_bpf_upgradeable_loader_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9120 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9121 0 : if( FD_UNLIKELY( err ) ) return err;
9122 0 : return fd_bpf_upgradeable_loader_state_inner_encode( &self->inner, self->discriminant, ctx );
9123 0 : }
9124 :
9125 0 : int fd_loader_v4_state_encode( fd_loader_v4_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9126 0 : int err;
9127 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
9128 0 : if( FD_UNLIKELY( err ) ) return err;
9129 0 : err = fd_pubkey_encode( &self->authority_address_or_next_version, ctx );
9130 0 : if( FD_UNLIKELY( err ) ) return err;
9131 0 : err = fd_bincode_uint64_encode( self->status, ctx );
9132 0 : if( FD_UNLIKELY( err ) ) return err;
9133 0 : return FD_BINCODE_SUCCESS;
9134 0 : }
9135 0 : static inline int fd_loader_v4_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9136 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9137 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
9138 0 : return 0;
9139 0 : }
9140 0 : static void fd_loader_v4_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9141 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)struct_mem;
9142 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
9143 0 : fd_pubkey_decode_inner( &self->authority_address_or_next_version, alloc_mem, ctx );
9144 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
9145 0 : }
9146 0 : void * fd_loader_v4_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9147 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)mem;
9148 0 : fd_loader_v4_state_new( self );
9149 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_state_t);
9150 0 : void * * alloc_mem = &alloc_region;
9151 0 : fd_loader_v4_state_decode_inner( mem, alloc_mem, ctx );
9152 0 : return self;
9153 0 : }
9154 0 : int fd_frozen_hash_status_encode( fd_frozen_hash_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9155 0 : int err;
9156 0 : err = fd_hash_encode( &self->frozen_hash, ctx );
9157 0 : if( FD_UNLIKELY( err ) ) return err;
9158 0 : err = fd_bincode_bool_encode( (uchar)(self->is_duplicate_confirmed), ctx );
9159 0 : if( FD_UNLIKELY( err ) ) return err;
9160 0 : return FD_BINCODE_SUCCESS;
9161 0 : }
9162 0 : static int fd_frozen_hash_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9163 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9164 0 : int err = 0;
9165 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
9166 0 : if( FD_UNLIKELY( err ) ) return err;
9167 0 : err = fd_bincode_bool_decode_footprint( ctx );
9168 0 : if( FD_UNLIKELY( err ) ) return err;
9169 0 : return 0;
9170 0 : }
9171 0 : int fd_frozen_hash_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9172 0 : *total_sz += sizeof(fd_frozen_hash_status_t);
9173 0 : void const * start_data = ctx->data;
9174 0 : int err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
9175 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9176 0 : ctx->data = start_data;
9177 0 : return err;
9178 0 : }
9179 0 : static void fd_frozen_hash_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9180 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)struct_mem;
9181 0 : fd_hash_decode_inner( &self->frozen_hash, alloc_mem, ctx );
9182 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
9183 0 : }
9184 0 : void * fd_frozen_hash_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9185 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)mem;
9186 0 : fd_frozen_hash_status_new( self );
9187 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_status_t);
9188 0 : void * * alloc_mem = &alloc_region;
9189 0 : fd_frozen_hash_status_decode_inner( mem, alloc_mem, ctx );
9190 0 : return self;
9191 0 : }
9192 0 : void fd_frozen_hash_status_new(fd_frozen_hash_status_t * self) {
9193 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_status_t) );
9194 0 : fd_hash_new( &self->frozen_hash );
9195 0 : }
9196 0 : FD_FN_PURE uchar fd_frozen_hash_versioned_is_current(fd_frozen_hash_versioned_t const * self) {
9197 0 : return self->discriminant == 0;
9198 0 : }
9199 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant );
9200 0 : int fd_frozen_hash_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9201 0 : int err;
9202 0 : switch (discriminant) {
9203 0 : case 0: {
9204 0 : err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
9205 0 : if( FD_UNLIKELY( err ) ) return err;
9206 0 : return FD_BINCODE_SUCCESS;
9207 0 : }
9208 0 : default: return FD_BINCODE_ERR_ENCODING;
9209 0 : }
9210 0 : }
9211 0 : static int fd_frozen_hash_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9212 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9213 0 : uint discriminant = 0;
9214 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9215 0 : if( FD_UNLIKELY( err ) ) return err;
9216 0 : return fd_frozen_hash_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
9217 0 : }
9218 0 : int fd_frozen_hash_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9219 0 : *total_sz += sizeof(fd_frozen_hash_versioned_t);
9220 0 : void const * start_data = ctx->data;
9221 0 : int err = fd_frozen_hash_versioned_decode_footprint_inner( ctx, total_sz );
9222 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9223 0 : ctx->data = start_data;
9224 0 : return err;
9225 0 : }
9226 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 ) {
9227 0 : switch (discriminant) {
9228 0 : case 0: {
9229 0 : fd_frozen_hash_status_decode_inner( &self->current, alloc_mem, ctx );
9230 0 : break;
9231 0 : }
9232 0 : }
9233 0 : }
9234 0 : static void fd_frozen_hash_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9235 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)struct_mem;
9236 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9237 0 : fd_frozen_hash_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9238 0 : }
9239 0 : void * fd_frozen_hash_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9240 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)mem;
9241 0 : fd_frozen_hash_versioned_new( self );
9242 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_versioned_t);
9243 0 : void * * alloc_mem = &alloc_region;
9244 0 : fd_frozen_hash_versioned_decode_inner( mem, alloc_mem, ctx );
9245 0 : return self;
9246 0 : }
9247 0 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
9248 0 : switch( discriminant ) {
9249 0 : case 0: {
9250 0 : fd_frozen_hash_status_new( &self->current );
9251 0 : break;
9252 0 : }
9253 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9254 0 : }
9255 0 : }
9256 0 : void fd_frozen_hash_versioned_new_disc( fd_frozen_hash_versioned_t * self, uint discriminant ) {
9257 0 : self->discriminant = discriminant;
9258 0 : fd_frozen_hash_versioned_inner_new( &self->inner, self->discriminant );
9259 0 : }
9260 0 : void fd_frozen_hash_versioned_new( fd_frozen_hash_versioned_t * self ) {
9261 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_versioned_t) );
9262 0 : fd_frozen_hash_versioned_new_disc( self, UINT_MAX );
9263 0 : }
9264 :
9265 0 : ulong fd_frozen_hash_versioned_size( fd_frozen_hash_versioned_t const * self ) {
9266 0 : ulong size = 0;
9267 0 : size += sizeof(uint);
9268 0 : switch (self->discriminant) {
9269 0 : case 0: {
9270 0 : size += fd_frozen_hash_status_size( &self->inner.current );
9271 0 : break;
9272 0 : }
9273 0 : }
9274 0 : return size;
9275 0 : }
9276 :
9277 0 : int fd_frozen_hash_versioned_inner_encode( fd_frozen_hash_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
9278 0 : int err;
9279 0 : switch (discriminant) {
9280 0 : case 0: {
9281 0 : err = fd_frozen_hash_status_encode( &self->current, ctx );
9282 0 : if( FD_UNLIKELY( err ) ) return err;
9283 0 : break;
9284 0 : }
9285 0 : }
9286 0 : return FD_BINCODE_SUCCESS;
9287 0 : }
9288 0 : int fd_frozen_hash_versioned_encode( fd_frozen_hash_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9289 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9290 0 : if( FD_UNLIKELY( err ) ) return err;
9291 0 : return fd_frozen_hash_versioned_inner_encode( &self->inner, self->discriminant, ctx );
9292 0 : }
9293 :
9294 0 : int fd_lookup_table_meta_encode( fd_lookup_table_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9295 0 : int err;
9296 0 : err = fd_bincode_uint64_encode( self->deactivation_slot, ctx );
9297 0 : if( FD_UNLIKELY( err ) ) return err;
9298 0 : err = fd_bincode_uint64_encode( self->last_extended_slot, ctx );
9299 0 : if( FD_UNLIKELY( err ) ) return err;
9300 0 : err = fd_bincode_uint8_encode( (uchar)(self->last_extended_slot_start_index), ctx );
9301 0 : if( FD_UNLIKELY( err ) ) return err;
9302 0 : err = fd_bincode_bool_encode( self->has_authority, ctx );
9303 0 : if( FD_UNLIKELY( err ) ) return err;
9304 0 : if( self->has_authority ) {
9305 0 : err = fd_pubkey_encode( &self->authority, ctx );
9306 0 : if( FD_UNLIKELY( err ) ) return err;
9307 0 : }
9308 0 : err = fd_bincode_uint16_encode( self->_padding, ctx );
9309 0 : if( FD_UNLIKELY( err ) ) return err;
9310 0 : return FD_BINCODE_SUCCESS;
9311 0 : }
9312 0 : static int fd_lookup_table_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9313 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9314 0 : int err = 0;
9315 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9316 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9317 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9318 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9319 0 : err = fd_bincode_uint8_decode_footprint( ctx );
9320 0 : if( FD_UNLIKELY( err ) ) return err;
9321 0 : {
9322 0 : uchar o;
9323 0 : err = fd_bincode_bool_decode( &o, ctx );
9324 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9325 0 : if( o ) {
9326 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9327 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9328 0 : }
9329 0 : }
9330 0 : err = fd_bincode_uint16_decode_footprint( ctx );
9331 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9332 0 : return 0;
9333 0 : }
9334 0 : int fd_lookup_table_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9335 0 : *total_sz += sizeof(fd_lookup_table_meta_t);
9336 0 : void const * start_data = ctx->data;
9337 0 : int err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
9338 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9339 0 : ctx->data = start_data;
9340 0 : return err;
9341 0 : }
9342 0 : static void fd_lookup_table_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9343 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)struct_mem;
9344 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
9345 0 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
9346 0 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
9347 0 : {
9348 0 : uchar o;
9349 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9350 0 : self->has_authority = !!o;
9351 0 : if( o ) {
9352 0 : fd_pubkey_new( &self->authority );
9353 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
9354 0 : }
9355 0 : }
9356 0 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
9357 0 : }
9358 0 : void * fd_lookup_table_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9359 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)mem;
9360 0 : fd_lookup_table_meta_new( self );
9361 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lookup_table_meta_t);
9362 0 : void * * alloc_mem = &alloc_region;
9363 0 : fd_lookup_table_meta_decode_inner( mem, alloc_mem, ctx );
9364 0 : return self;
9365 0 : }
9366 0 : void fd_lookup_table_meta_new(fd_lookup_table_meta_t * self) {
9367 0 : fd_memset( self, 0, sizeof(fd_lookup_table_meta_t) );
9368 0 : }
9369 0 : ulong fd_lookup_table_meta_size( fd_lookup_table_meta_t const * self ) {
9370 0 : ulong size = 0;
9371 0 : size += sizeof(ulong);
9372 0 : size += sizeof(ulong);
9373 0 : size += sizeof(char);
9374 0 : size += sizeof(char);
9375 0 : if( self->has_authority ) {
9376 0 : size += fd_pubkey_size( &self->authority );
9377 0 : }
9378 0 : size += sizeof(ushort);
9379 0 : return size;
9380 0 : }
9381 :
9382 0 : int fd_address_lookup_table_encode( fd_address_lookup_table_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9383 0 : int err;
9384 0 : err = fd_lookup_table_meta_encode( &self->meta, ctx );
9385 0 : if( FD_UNLIKELY( err ) ) return err;
9386 0 : return FD_BINCODE_SUCCESS;
9387 0 : }
9388 0 : static int fd_address_lookup_table_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9389 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9390 0 : int err = 0;
9391 0 : err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
9392 0 : if( FD_UNLIKELY( err ) ) return err;
9393 0 : return 0;
9394 0 : }
9395 0 : int fd_address_lookup_table_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9396 0 : *total_sz += sizeof(fd_address_lookup_table_t);
9397 0 : void const * start_data = ctx->data;
9398 0 : int err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
9399 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9400 0 : ctx->data = start_data;
9401 0 : return err;
9402 0 : }
9403 0 : static void fd_address_lookup_table_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9404 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)struct_mem;
9405 0 : fd_lookup_table_meta_decode_inner( &self->meta, alloc_mem, ctx );
9406 0 : }
9407 0 : void * fd_address_lookup_table_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9408 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)mem;
9409 0 : fd_address_lookup_table_new( self );
9410 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_t);
9411 0 : void * * alloc_mem = &alloc_region;
9412 0 : fd_address_lookup_table_decode_inner( mem, alloc_mem, ctx );
9413 0 : return self;
9414 0 : }
9415 0 : void fd_address_lookup_table_new(fd_address_lookup_table_t * self) {
9416 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_t) );
9417 0 : fd_lookup_table_meta_new( &self->meta );
9418 0 : }
9419 0 : ulong fd_address_lookup_table_size( fd_address_lookup_table_t const * self ) {
9420 0 : ulong size = 0;
9421 0 : size += fd_lookup_table_meta_size( &self->meta );
9422 0 : return size;
9423 0 : }
9424 :
9425 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_uninitialized(fd_address_lookup_table_state_t const * self) {
9426 0 : return self->discriminant == 0;
9427 0 : }
9428 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_lookup_table(fd_address_lookup_table_state_t const * self) {
9429 0 : return self->discriminant == 1;
9430 0 : }
9431 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant );
9432 0 : int fd_address_lookup_table_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9433 0 : int err;
9434 0 : switch (discriminant) {
9435 0 : case 0: {
9436 0 : return FD_BINCODE_SUCCESS;
9437 0 : }
9438 0 : case 1: {
9439 0 : err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
9440 0 : if( FD_UNLIKELY( err ) ) return err;
9441 0 : return FD_BINCODE_SUCCESS;
9442 0 : }
9443 0 : default: return FD_BINCODE_ERR_ENCODING;
9444 0 : }
9445 0 : }
9446 0 : static int fd_address_lookup_table_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9447 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9448 0 : uint discriminant = 0;
9449 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9450 0 : if( FD_UNLIKELY( err ) ) return err;
9451 0 : return fd_address_lookup_table_state_inner_decode_footprint( discriminant, ctx, total_sz );
9452 0 : }
9453 0 : int fd_address_lookup_table_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9454 0 : *total_sz += sizeof(fd_address_lookup_table_state_t);
9455 0 : void const * start_data = ctx->data;
9456 0 : int err = fd_address_lookup_table_state_decode_footprint_inner( ctx, total_sz );
9457 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9458 0 : ctx->data = start_data;
9459 0 : return err;
9460 0 : }
9461 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 ) {
9462 0 : switch (discriminant) {
9463 0 : case 0: {
9464 0 : break;
9465 0 : }
9466 0 : case 1: {
9467 0 : fd_address_lookup_table_decode_inner( &self->lookup_table, alloc_mem, ctx );
9468 0 : break;
9469 0 : }
9470 0 : }
9471 0 : }
9472 0 : static void fd_address_lookup_table_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9473 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)struct_mem;
9474 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9475 0 : fd_address_lookup_table_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9476 0 : }
9477 0 : void * fd_address_lookup_table_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9478 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)mem;
9479 0 : fd_address_lookup_table_state_new( self );
9480 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_state_t);
9481 0 : void * * alloc_mem = &alloc_region;
9482 0 : fd_address_lookup_table_state_decode_inner( mem, alloc_mem, ctx );
9483 0 : return self;
9484 0 : }
9485 0 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
9486 0 : switch( discriminant ) {
9487 0 : case 0: {
9488 0 : break;
9489 0 : }
9490 0 : case 1: {
9491 0 : fd_address_lookup_table_new( &self->lookup_table );
9492 0 : break;
9493 0 : }
9494 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9495 0 : }
9496 0 : }
9497 0 : void fd_address_lookup_table_state_new_disc( fd_address_lookup_table_state_t * self, uint discriminant ) {
9498 0 : self->discriminant = discriminant;
9499 0 : fd_address_lookup_table_state_inner_new( &self->inner, self->discriminant );
9500 0 : }
9501 0 : void fd_address_lookup_table_state_new( fd_address_lookup_table_state_t * self ) {
9502 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_state_t) );
9503 0 : fd_address_lookup_table_state_new_disc( self, UINT_MAX );
9504 0 : }
9505 :
9506 0 : ulong fd_address_lookup_table_state_size( fd_address_lookup_table_state_t const * self ) {
9507 0 : ulong size = 0;
9508 0 : size += sizeof(uint);
9509 0 : switch (self->discriminant) {
9510 0 : case 1: {
9511 0 : size += fd_address_lookup_table_size( &self->inner.lookup_table );
9512 0 : break;
9513 0 : }
9514 0 : }
9515 0 : return size;
9516 0 : }
9517 :
9518 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 ) {
9519 0 : int err;
9520 0 : switch (discriminant) {
9521 0 : case 1: {
9522 0 : err = fd_address_lookup_table_encode( &self->lookup_table, ctx );
9523 0 : if( FD_UNLIKELY( err ) ) return err;
9524 0 : break;
9525 0 : }
9526 0 : }
9527 0 : return FD_BINCODE_SUCCESS;
9528 0 : }
9529 0 : int fd_address_lookup_table_state_encode( fd_address_lookup_table_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9530 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9531 0 : if( FD_UNLIKELY( err ) ) return err;
9532 0 : return fd_address_lookup_table_state_inner_encode( &self->inner, self->discriminant, ctx );
9533 0 : }
9534 :
9535 0 : int fd_addrlut_create_encode( fd_addrlut_create_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9536 0 : int err;
9537 0 : err = fd_bincode_uint64_encode( self->recent_slot, ctx );
9538 0 : if( FD_UNLIKELY( err ) ) return err;
9539 0 : err = fd_bincode_uint8_encode( (uchar)(self->bump_seed), ctx );
9540 0 : if( FD_UNLIKELY( err ) ) return err;
9541 0 : return FD_BINCODE_SUCCESS;
9542 0 : }
9543 0 : static inline int fd_addrlut_create_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9544 0 : if( (ulong)ctx->data + 9UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9545 0 : ctx->data = (void *)( (ulong)ctx->data + 9UL );
9546 0 : return 0;
9547 0 : }
9548 0 : static void fd_addrlut_create_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9549 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)struct_mem;
9550 0 : fd_bincode_uint64_decode_unsafe( &self->recent_slot, ctx );
9551 0 : fd_bincode_uint8_decode_unsafe( &self->bump_seed, ctx );
9552 0 : }
9553 0 : void * fd_addrlut_create_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9554 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)mem;
9555 0 : fd_addrlut_create_new( self );
9556 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_create_t);
9557 0 : void * * alloc_mem = &alloc_region;
9558 0 : fd_addrlut_create_decode_inner( mem, alloc_mem, ctx );
9559 0 : return self;
9560 0 : }
9561 0 : int fd_addrlut_extend_encode( fd_addrlut_extend_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9562 0 : int err;
9563 0 : err = fd_bincode_uint64_encode( self->new_addrs_len, ctx );
9564 0 : if( FD_UNLIKELY(err) ) return err;
9565 0 : if( self->new_addrs_len ) {
9566 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
9567 0 : err = fd_pubkey_encode( self->new_addrs + i, ctx );
9568 0 : if( FD_UNLIKELY( err ) ) return err;
9569 0 : }
9570 0 : }
9571 0 : return FD_BINCODE_SUCCESS;
9572 0 : }
9573 0 : static int fd_addrlut_extend_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9574 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9575 0 : int err = 0;
9576 0 : ulong new_addrs_len;
9577 0 : err = fd_bincode_uint64_decode( &new_addrs_len, ctx );
9578 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9579 0 : if( new_addrs_len ) {
9580 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*new_addrs_len;
9581 0 : for( ulong i=0; i < new_addrs_len; i++ ) {
9582 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9583 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9584 0 : }
9585 0 : }
9586 0 : return 0;
9587 0 : }
9588 0 : int fd_addrlut_extend_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9589 0 : *total_sz += sizeof(fd_addrlut_extend_t);
9590 0 : void const * start_data = ctx->data;
9591 0 : int err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
9592 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9593 0 : ctx->data = start_data;
9594 0 : return err;
9595 0 : }
9596 0 : static void fd_addrlut_extend_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9597 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)struct_mem;
9598 0 : fd_bincode_uint64_decode_unsafe( &self->new_addrs_len, ctx );
9599 0 : if( self->new_addrs_len ) {
9600 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
9601 0 : self->new_addrs = *alloc_mem;
9602 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->new_addrs_len;
9603 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
9604 0 : fd_pubkey_new( self->new_addrs + i );
9605 0 : fd_pubkey_decode_inner( self->new_addrs + i, alloc_mem, ctx );
9606 0 : }
9607 0 : } else
9608 0 : self->new_addrs = NULL;
9609 0 : }
9610 0 : void * fd_addrlut_extend_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9611 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)mem;
9612 0 : fd_addrlut_extend_new( self );
9613 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_extend_t);
9614 0 : void * * alloc_mem = &alloc_region;
9615 0 : fd_addrlut_extend_decode_inner( mem, alloc_mem, ctx );
9616 0 : return self;
9617 0 : }
9618 0 : void fd_addrlut_extend_new(fd_addrlut_extend_t * self) {
9619 0 : fd_memset( self, 0, sizeof(fd_addrlut_extend_t) );
9620 0 : }
9621 0 : ulong fd_addrlut_extend_size( fd_addrlut_extend_t const * self ) {
9622 0 : ulong size = 0;
9623 0 : do {
9624 0 : size += sizeof(ulong);
9625 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
9626 0 : size += fd_pubkey_size( self->new_addrs + i );
9627 0 : } while(0);
9628 0 : return size;
9629 0 : }
9630 :
9631 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_create_lut(fd_addrlut_instruction_t const * self) {
9632 0 : return self->discriminant == 0;
9633 0 : }
9634 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_freeze_lut(fd_addrlut_instruction_t const * self) {
9635 0 : return self->discriminant == 1;
9636 0 : }
9637 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_extend_lut(fd_addrlut_instruction_t const * self) {
9638 0 : return self->discriminant == 2;
9639 0 : }
9640 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_deactivate_lut(fd_addrlut_instruction_t const * self) {
9641 0 : return self->discriminant == 3;
9642 0 : }
9643 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_close_lut(fd_addrlut_instruction_t const * self) {
9644 0 : return self->discriminant == 4;
9645 0 : }
9646 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant );
9647 0 : int fd_addrlut_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9648 0 : int err;
9649 0 : switch (discriminant) {
9650 0 : case 0: {
9651 0 : err = fd_addrlut_create_decode_footprint_inner( ctx, total_sz );
9652 0 : if( FD_UNLIKELY( err ) ) return err;
9653 0 : return FD_BINCODE_SUCCESS;
9654 0 : }
9655 0 : case 1: {
9656 0 : return FD_BINCODE_SUCCESS;
9657 0 : }
9658 0 : case 2: {
9659 0 : err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
9660 0 : if( FD_UNLIKELY( err ) ) return err;
9661 0 : return FD_BINCODE_SUCCESS;
9662 0 : }
9663 0 : case 3: {
9664 0 : return FD_BINCODE_SUCCESS;
9665 0 : }
9666 0 : case 4: {
9667 0 : return FD_BINCODE_SUCCESS;
9668 0 : }
9669 0 : default: return FD_BINCODE_ERR_ENCODING;
9670 0 : }
9671 0 : }
9672 0 : static int fd_addrlut_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9673 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9674 0 : uint discriminant = 0;
9675 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9676 0 : if( FD_UNLIKELY( err ) ) return err;
9677 0 : return fd_addrlut_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
9678 0 : }
9679 0 : int fd_addrlut_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9680 0 : *total_sz += sizeof(fd_addrlut_instruction_t);
9681 0 : void const * start_data = ctx->data;
9682 0 : int err = fd_addrlut_instruction_decode_footprint_inner( ctx, total_sz );
9683 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9684 0 : ctx->data = start_data;
9685 0 : return err;
9686 0 : }
9687 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 ) {
9688 0 : switch (discriminant) {
9689 0 : case 0: {
9690 0 : fd_addrlut_create_decode_inner( &self->create_lut, alloc_mem, ctx );
9691 0 : break;
9692 0 : }
9693 0 : case 1: {
9694 0 : break;
9695 0 : }
9696 0 : case 2: {
9697 0 : fd_addrlut_extend_decode_inner( &self->extend_lut, alloc_mem, ctx );
9698 0 : break;
9699 0 : }
9700 0 : case 3: {
9701 0 : break;
9702 0 : }
9703 0 : case 4: {
9704 0 : break;
9705 0 : }
9706 0 : }
9707 0 : }
9708 0 : static void fd_addrlut_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9709 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)struct_mem;
9710 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9711 0 : fd_addrlut_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9712 0 : }
9713 0 : void * fd_addrlut_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9714 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)mem;
9715 0 : fd_addrlut_instruction_new( self );
9716 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_instruction_t);
9717 0 : void * * alloc_mem = &alloc_region;
9718 0 : fd_addrlut_instruction_decode_inner( mem, alloc_mem, ctx );
9719 0 : return self;
9720 0 : }
9721 0 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant ) {
9722 0 : switch( discriminant ) {
9723 0 : case 0: {
9724 0 : fd_addrlut_create_new( &self->create_lut );
9725 0 : break;
9726 0 : }
9727 0 : case 1: {
9728 0 : break;
9729 0 : }
9730 0 : case 2: {
9731 0 : fd_addrlut_extend_new( &self->extend_lut );
9732 0 : break;
9733 0 : }
9734 0 : case 3: {
9735 0 : break;
9736 0 : }
9737 0 : case 4: {
9738 0 : break;
9739 0 : }
9740 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9741 0 : }
9742 0 : }
9743 0 : void fd_addrlut_instruction_new_disc( fd_addrlut_instruction_t * self, uint discriminant ) {
9744 0 : self->discriminant = discriminant;
9745 0 : fd_addrlut_instruction_inner_new( &self->inner, self->discriminant );
9746 0 : }
9747 0 : void fd_addrlut_instruction_new( fd_addrlut_instruction_t * self ) {
9748 0 : fd_memset( self, 0, sizeof(fd_addrlut_instruction_t) );
9749 0 : fd_addrlut_instruction_new_disc( self, UINT_MAX );
9750 0 : }
9751 :
9752 0 : ulong fd_addrlut_instruction_size( fd_addrlut_instruction_t const * self ) {
9753 0 : ulong size = 0;
9754 0 : size += sizeof(uint);
9755 0 : switch (self->discriminant) {
9756 0 : case 0: {
9757 0 : size += fd_addrlut_create_size( &self->inner.create_lut );
9758 0 : break;
9759 0 : }
9760 0 : case 2: {
9761 0 : size += fd_addrlut_extend_size( &self->inner.extend_lut );
9762 0 : break;
9763 0 : }
9764 0 : }
9765 0 : return size;
9766 0 : }
9767 :
9768 0 : int fd_addrlut_instruction_inner_encode( fd_addrlut_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
9769 0 : int err;
9770 0 : switch (discriminant) {
9771 0 : case 0: {
9772 0 : err = fd_addrlut_create_encode( &self->create_lut, ctx );
9773 0 : if( FD_UNLIKELY( err ) ) return err;
9774 0 : break;
9775 0 : }
9776 0 : case 2: {
9777 0 : err = fd_addrlut_extend_encode( &self->extend_lut, ctx );
9778 0 : if( FD_UNLIKELY( err ) ) return err;
9779 0 : break;
9780 0 : }
9781 0 : }
9782 0 : return FD_BINCODE_SUCCESS;
9783 0 : }
9784 0 : int fd_addrlut_instruction_encode( fd_addrlut_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9785 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9786 0 : if( FD_UNLIKELY( err ) ) return err;
9787 0 : return fd_addrlut_instruction_inner_encode( &self->inner, self->discriminant, ctx );
9788 0 : }
9789 :
9790 : #include "fd_types_custom.c"
|