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_fee_calculator_encode( fd_fee_calculator_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12 0 : int err;
13 0 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
14 0 : if( FD_UNLIKELY( err ) ) return err;
15 0 : return FD_BINCODE_SUCCESS;
16 0 : }
17 0 : static inline int fd_fee_calculator_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
18 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
19 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
20 0 : return 0;
21 0 : }
22 33975 : static void fd_fee_calculator_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23 33975 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)struct_mem;
24 33975 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
25 33975 : }
26 0 : void * fd_fee_calculator_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
27 0 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)mem;
28 0 : fd_fee_calculator_new( self );
29 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_calculator_t);
30 0 : void * * alloc_mem = &alloc_region;
31 0 : fd_fee_calculator_decode_inner( mem, alloc_mem, ctx );
32 0 : return self;
33 0 : }
34 9 : int fd_fee_rate_governor_encode( fd_fee_rate_governor_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35 9 : int err;
36 9 : err = fd_bincode_uint64_encode( self->target_lamports_per_signature, ctx );
37 9 : if( FD_UNLIKELY( err ) ) return err;
38 9 : err = fd_bincode_uint64_encode( self->target_signatures_per_slot, ctx );
39 9 : if( FD_UNLIKELY( err ) ) return err;
40 9 : err = fd_bincode_uint64_encode( self->min_lamports_per_signature, ctx );
41 9 : if( FD_UNLIKELY( err ) ) return err;
42 9 : err = fd_bincode_uint64_encode( self->max_lamports_per_signature, ctx );
43 9 : if( FD_UNLIKELY( err ) ) return err;
44 9 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
45 9 : if( FD_UNLIKELY( err ) ) return err;
46 9 : return FD_BINCODE_SUCCESS;
47 9 : }
48 0 : static inline int fd_fee_rate_governor_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
49 0 : if( (ulong)ctx->data + 33UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
50 0 : ctx->data = (void *)( (ulong)ctx->data + 33UL );
51 0 : return 0;
52 0 : }
53 0 : static void fd_fee_rate_governor_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
54 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)struct_mem;
55 0 : fd_bincode_uint64_decode_unsafe( &self->target_lamports_per_signature, ctx );
56 0 : fd_bincode_uint64_decode_unsafe( &self->target_signatures_per_slot, ctx );
57 0 : fd_bincode_uint64_decode_unsafe( &self->min_lamports_per_signature, ctx );
58 0 : fd_bincode_uint64_decode_unsafe( &self->max_lamports_per_signature, ctx );
59 0 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
60 0 : }
61 0 : void * fd_fee_rate_governor_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
62 0 : fd_fee_rate_governor_t * self = (fd_fee_rate_governor_t *)mem;
63 0 : fd_fee_rate_governor_new( self );
64 0 : void * alloc_region = (uchar *)mem + sizeof(fd_fee_rate_governor_t);
65 0 : void * * alloc_mem = &alloc_region;
66 0 : fd_fee_rate_governor_decode_inner( mem, alloc_mem, ctx );
67 0 : return self;
68 0 : }
69 0 : int fd_slot_pair_encode( fd_slot_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
70 0 : int err;
71 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
72 0 : if( FD_UNLIKELY( err ) ) return err;
73 0 : err = fd_bincode_uint64_encode( self->val, ctx );
74 0 : if( FD_UNLIKELY( err ) ) return err;
75 0 : return FD_BINCODE_SUCCESS;
76 0 : }
77 0 : static inline int fd_slot_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
78 0 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
79 0 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
80 0 : return 0;
81 0 : }
82 0 : static void fd_slot_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
83 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)struct_mem;
84 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
85 0 : fd_bincode_uint64_decode_unsafe( &self->val, ctx );
86 0 : }
87 0 : void * fd_slot_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
88 0 : fd_slot_pair_t * self = (fd_slot_pair_t *)mem;
89 0 : fd_slot_pair_new( self );
90 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_pair_t);
91 0 : void * * alloc_mem = &alloc_region;
92 0 : fd_slot_pair_decode_inner( mem, alloc_mem, ctx );
93 0 : return self;
94 0 : }
95 0 : int fd_hard_forks_encode( fd_hard_forks_t const * self, fd_bincode_encode_ctx_t * ctx ) {
96 0 : int err;
97 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
98 0 : if( FD_UNLIKELY(err) ) return err;
99 0 : if( self->hard_forks_len ) {
100 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
101 0 : err = fd_slot_pair_encode( self->hard_forks + i, ctx );
102 0 : if( FD_UNLIKELY( err ) ) return err;
103 0 : }
104 0 : }
105 0 : return FD_BINCODE_SUCCESS;
106 0 : }
107 0 : int fd_hard_forks_encode_global( fd_hard_forks_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
108 0 : int err;
109 0 : err = fd_bincode_uint64_encode( self->hard_forks_len, ctx );
110 0 : if( FD_UNLIKELY( err ) ) return err;
111 0 : if( self->hard_forks_len ) {
112 0 : uchar * hard_forks_laddr = (uchar*)self + self->hard_forks_offset;
113 0 : fd_slot_pair_t * hard_forks = (fd_slot_pair_t *)hard_forks_laddr;
114 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
115 0 : err = fd_slot_pair_encode( &hard_forks[i], ctx );
116 0 : if( FD_UNLIKELY( err ) ) return err;
117 0 : }
118 0 : }
119 0 : return FD_BINCODE_SUCCESS;
120 0 : }
121 0 : static int fd_hard_forks_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
122 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
123 0 : int err = 0;
124 0 : ulong hard_forks_len;
125 0 : err = fd_bincode_uint64_decode( &hard_forks_len, ctx );
126 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
127 0 : if( hard_forks_len ) {
128 0 : *total_sz += FD_SLOT_PAIR_ALIGN + sizeof(fd_slot_pair_t)*hard_forks_len;
129 0 : for( ulong i=0; i < hard_forks_len; i++ ) {
130 0 : err = fd_slot_pair_decode_footprint_inner( ctx, total_sz );
131 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
132 0 : }
133 0 : }
134 0 : return 0;
135 0 : }
136 0 : int fd_hard_forks_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
137 0 : *total_sz += sizeof(fd_hard_forks_t);
138 0 : void const * start_data = ctx->data;
139 0 : int err = fd_hard_forks_decode_footprint_inner( ctx, total_sz );
140 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
141 0 : ctx->data = start_data;
142 0 : return err;
143 0 : }
144 0 : static void fd_hard_forks_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
145 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)struct_mem;
146 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
147 0 : if( self->hard_forks_len ) {
148 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
149 0 : self->hard_forks = *alloc_mem;
150 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
151 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
152 0 : fd_slot_pair_new( self->hard_forks + i );
153 0 : fd_slot_pair_decode_inner( self->hard_forks + i, alloc_mem, ctx );
154 0 : }
155 0 : } else
156 0 : self->hard_forks = NULL;
157 0 : }
158 0 : void * fd_hard_forks_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
159 0 : fd_hard_forks_t * self = (fd_hard_forks_t *)mem;
160 0 : fd_hard_forks_new( self );
161 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_t);
162 0 : void * * alloc_mem = &alloc_region;
163 0 : fd_hard_forks_decode_inner( mem, alloc_mem, ctx );
164 0 : return self;
165 0 : }
166 0 : static void fd_hard_forks_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
167 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)struct_mem;
168 0 : fd_bincode_uint64_decode_unsafe( &self->hard_forks_len, ctx );
169 0 : if( self->hard_forks_len ) {
170 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_SLOT_PAIR_ALIGN );
171 0 : self->hard_forks_offset = (ulong)*alloc_mem - (ulong)struct_mem;
172 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
173 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_slot_pair_t)*self->hard_forks_len;
174 0 : for( ulong i=0; i < self->hard_forks_len; i++ ) {
175 0 : fd_slot_pair_new( (fd_slot_pair_t *)fd_type_pun(cur_mem + sizeof(fd_slot_pair_t) * i) );
176 0 : fd_slot_pair_decode_inner( cur_mem + sizeof(fd_slot_pair_t) * i, alloc_mem, ctx );
177 0 : }
178 0 : } else {
179 0 : self->hard_forks_offset = 0UL;
180 0 : }
181 0 : }
182 0 : void * fd_hard_forks_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
183 0 : fd_hard_forks_global_t * self = (fd_hard_forks_global_t *)mem;
184 0 : fd_hard_forks_new( (fd_hard_forks_t *)self );
185 0 : void * alloc_region = (uchar *)mem + sizeof(fd_hard_forks_global_t);
186 0 : void * * alloc_mem = &alloc_region;
187 0 : fd_hard_forks_decode_inner_global( mem, alloc_mem, ctx );
188 0 : return self;
189 0 : }
190 0 : void fd_hard_forks_new(fd_hard_forks_t * self) {
191 0 : fd_memset( self, 0, sizeof(fd_hard_forks_t) );
192 0 : }
193 0 : ulong fd_hard_forks_size( fd_hard_forks_t const * self ) {
194 0 : ulong size = 0;
195 0 : do {
196 0 : size += sizeof(ulong);
197 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
198 0 : size += fd_slot_pair_size( self->hard_forks + i );
199 0 : } while(0);
200 0 : return size;
201 0 : }
202 :
203 0 : ulong fd_hard_forks_size_global( fd_hard_forks_global_t const * self ) {
204 0 : ulong size = 0;
205 0 : do {
206 0 : size += sizeof(ulong);
207 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;
208 0 : for( ulong i=0; i < self->hard_forks_len; i++ )
209 0 : size += fd_slot_pair_size( hard_forks + i );
210 0 : } while(0);
211 0 : return size;
212 0 : }
213 :
214 9 : int fd_inflation_encode( fd_inflation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
215 9 : int err;
216 9 : err = fd_bincode_double_encode( self->initial, ctx );
217 9 : if( FD_UNLIKELY( err ) ) return err;
218 9 : err = fd_bincode_double_encode( self->terminal, ctx );
219 9 : if( FD_UNLIKELY( err ) ) return err;
220 9 : err = fd_bincode_double_encode( self->taper, ctx );
221 9 : if( FD_UNLIKELY( err ) ) return err;
222 9 : err = fd_bincode_double_encode( self->foundation, ctx );
223 9 : if( FD_UNLIKELY( err ) ) return err;
224 9 : err = fd_bincode_double_encode( self->foundation_term, ctx );
225 9 : if( FD_UNLIKELY( err ) ) return err;
226 9 : err = fd_bincode_double_encode( self->unused, ctx );
227 9 : if( FD_UNLIKELY( err ) ) return err;
228 9 : return FD_BINCODE_SUCCESS;
229 9 : }
230 0 : static inline int fd_inflation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
231 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
232 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
233 0 : return 0;
234 0 : }
235 0 : static void fd_inflation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
236 0 : fd_inflation_t * self = (fd_inflation_t *)struct_mem;
237 0 : fd_bincode_double_decode_unsafe( &self->initial, ctx );
238 0 : fd_bincode_double_decode_unsafe( &self->terminal, ctx );
239 0 : fd_bincode_double_decode_unsafe( &self->taper, ctx );
240 0 : fd_bincode_double_decode_unsafe( &self->foundation, ctx );
241 0 : fd_bincode_double_decode_unsafe( &self->foundation_term, ctx );
242 0 : fd_bincode_double_decode_unsafe( &self->unused, ctx );
243 0 : }
244 0 : void * fd_inflation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
245 0 : fd_inflation_t * self = (fd_inflation_t *)mem;
246 0 : fd_inflation_new( self );
247 0 : void * alloc_region = (uchar *)mem + sizeof(fd_inflation_t);
248 0 : void * * alloc_mem = &alloc_region;
249 0 : fd_inflation_decode_inner( mem, alloc_mem, ctx );
250 0 : return self;
251 0 : }
252 63 : int fd_rent_encode( fd_rent_t const * self, fd_bincode_encode_ctx_t * ctx ) {
253 63 : int err;
254 63 : err = fd_bincode_uint64_encode( self->lamports_per_uint8_year, ctx );
255 63 : if( FD_UNLIKELY( err ) ) return err;
256 63 : err = fd_bincode_double_encode( self->exemption_threshold, ctx );
257 63 : if( FD_UNLIKELY( err ) ) return err;
258 63 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
259 63 : if( FD_UNLIKELY( err ) ) return err;
260 63 : return FD_BINCODE_SUCCESS;
261 63 : }
262 0 : static inline int fd_rent_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
263 0 : if( (ulong)ctx->data + 17UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
264 0 : ctx->data = (void *)( (ulong)ctx->data + 17UL );
265 0 : return 0;
266 0 : }
267 72 : static void fd_rent_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
268 72 : fd_rent_t * self = (fd_rent_t *)struct_mem;
269 72 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
270 72 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
271 72 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
272 72 : }
273 72 : void * fd_rent_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
274 72 : fd_rent_t * self = (fd_rent_t *)mem;
275 72 : fd_rent_new( self );
276 72 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_t);
277 72 : void * * alloc_mem = &alloc_region;
278 72 : fd_rent_decode_inner( mem, alloc_mem, ctx );
279 72 : return self;
280 72 : }
281 60 : int fd_epoch_schedule_encode( fd_epoch_schedule_t const * self, fd_bincode_encode_ctx_t * ctx ) {
282 60 : int err;
283 60 : err = fd_bincode_uint64_encode( self->slots_per_epoch, ctx );
284 60 : if( FD_UNLIKELY( err ) ) return err;
285 60 : err = fd_bincode_uint64_encode( self->leader_schedule_slot_offset, ctx );
286 60 : if( FD_UNLIKELY( err ) ) return err;
287 60 : err = fd_bincode_bool_encode( (uchar)(self->warmup), ctx );
288 60 : if( FD_UNLIKELY( err ) ) return err;
289 60 : err = fd_bincode_uint64_encode( self->first_normal_epoch, ctx );
290 60 : if( FD_UNLIKELY( err ) ) return err;
291 60 : err = fd_bincode_uint64_encode( self->first_normal_slot, ctx );
292 60 : if( FD_UNLIKELY( err ) ) return err;
293 60 : return FD_BINCODE_SUCCESS;
294 60 : }
295 66 : static int fd_epoch_schedule_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
296 66 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
297 66 : int err = 0;
298 66 : err = fd_bincode_uint64_decode_footprint( ctx );
299 66 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
300 66 : err = fd_bincode_uint64_decode_footprint( ctx );
301 66 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
302 66 : err = fd_bincode_bool_decode_footprint( ctx );
303 66 : if( FD_UNLIKELY( err ) ) return err;
304 66 : err = fd_bincode_uint64_decode_footprint( ctx );
305 66 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
306 66 : err = fd_bincode_uint64_decode_footprint( ctx );
307 66 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
308 66 : return 0;
309 66 : }
310 66 : int fd_epoch_schedule_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
311 66 : *total_sz += sizeof(fd_epoch_schedule_t);
312 66 : void const * start_data = ctx->data;
313 66 : int err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
314 66 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
315 66 : ctx->data = start_data;
316 66 : return err;
317 66 : }
318 63 : static void fd_epoch_schedule_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
319 63 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)struct_mem;
320 63 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
321 63 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
322 63 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
323 63 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
324 63 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
325 63 : }
326 63 : void * fd_epoch_schedule_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
327 63 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)mem;
328 63 : fd_epoch_schedule_new( self );
329 63 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_schedule_t);
330 63 : void * * alloc_mem = &alloc_region;
331 63 : fd_epoch_schedule_decode_inner( mem, alloc_mem, ctx );
332 63 : return self;
333 63 : }
334 75 : void fd_epoch_schedule_new(fd_epoch_schedule_t * self) {
335 75 : fd_memset( self, 0, sizeof(fd_epoch_schedule_t) );
336 75 : }
337 63 : int fd_stake_history_entry_encode( fd_stake_history_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
338 63 : int err;
339 63 : err = fd_bincode_uint64_encode( self->effective, ctx );
340 63 : if( FD_UNLIKELY( err ) ) return err;
341 63 : err = fd_bincode_uint64_encode( self->activating, ctx );
342 63 : if( FD_UNLIKELY( err ) ) return err;
343 63 : err = fd_bincode_uint64_encode( self->deactivating, ctx );
344 63 : if( FD_UNLIKELY( err ) ) return err;
345 63 : return FD_BINCODE_SUCCESS;
346 63 : }
347 0 : static inline int fd_stake_history_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
348 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
349 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
350 0 : return 0;
351 0 : }
352 210 : static void fd_stake_history_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
353 210 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)struct_mem;
354 210 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
355 210 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
356 210 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
357 210 : }
358 0 : void * fd_stake_history_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
359 0 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)mem;
360 0 : fd_stake_history_entry_new( self );
361 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_entry_t);
362 0 : void * * alloc_mem = &alloc_region;
363 0 : fd_stake_history_entry_decode_inner( mem, alloc_mem, ctx );
364 0 : return self;
365 0 : }
366 63 : int fd_epoch_stake_history_entry_pair_encode( fd_epoch_stake_history_entry_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
367 63 : int err;
368 63 : err = fd_bincode_uint64_encode( self->epoch, ctx );
369 63 : if( FD_UNLIKELY( err ) ) return err;
370 63 : err = fd_stake_history_entry_encode( &self->entry, ctx );
371 63 : if( FD_UNLIKELY( err ) ) return err;
372 63 : return FD_BINCODE_SUCCESS;
373 63 : }
374 1746 : static inline int fd_epoch_stake_history_entry_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
375 1746 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
376 1746 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
377 1746 : return 0;
378 1746 : }
379 210 : static void fd_epoch_stake_history_entry_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
380 210 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)struct_mem;
381 210 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
382 210 : fd_stake_history_entry_decode_inner( &self->entry, alloc_mem, ctx );
383 210 : }
384 0 : void * fd_epoch_stake_history_entry_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
385 0 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)mem;
386 0 : fd_epoch_stake_history_entry_pair_new( self );
387 0 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_stake_history_entry_pair_t);
388 0 : void * * alloc_mem = &alloc_region;
389 0 : fd_epoch_stake_history_entry_pair_decode_inner( mem, alloc_mem, ctx );
390 0 : return self;
391 0 : }
392 105 : int fd_stake_history_encode( fd_stake_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
393 105 : int err;
394 105 : err = fd_bincode_uint64_encode( self->fd_stake_history_len, ctx );
395 105 : if( FD_UNLIKELY(err) ) return err;
396 105 : if( FD_UNLIKELY( 0 == self->fd_stake_history_len ) ) return FD_BINCODE_SUCCESS;
397 114 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
398 63 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
399 63 : err = fd_epoch_stake_history_entry_pair_encode( self->fd_stake_history + idx, ctx );
400 63 : if( FD_UNLIKELY( err ) ) return err;
401 63 : }
402 51 : return FD_BINCODE_SUCCESS;
403 51 : }
404 258 : static int fd_stake_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
405 258 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
406 258 : int err = 0;
407 258 : ulong fd_stake_history_len;
408 258 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
409 258 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
410 258 : if( fd_stake_history_len ) {
411 1917 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
412 1746 : err = fd_epoch_stake_history_entry_pair_decode_footprint_inner( ctx, total_sz );
413 1746 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
414 1746 : }
415 171 : }
416 258 : return 0;
417 258 : }
418 258 : int fd_stake_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
419 258 : *total_sz += sizeof(fd_stake_history_t);
420 258 : void const * start_data = ctx->data;
421 258 : int err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
422 258 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
423 258 : ctx->data = start_data;
424 258 : return err;
425 258 : }
426 255 : static void fd_stake_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
427 255 : fd_stake_history_t * self = (fd_stake_history_t *)struct_mem;
428 255 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
429 255 : self->fd_stake_history_size = 512;
430 255 : self->fd_stake_history_offset = 0;
431 465 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
432 210 : fd_epoch_stake_history_entry_pair_decode_inner( self->fd_stake_history + i, alloc_mem, ctx );
433 210 : }
434 255 : }
435 255 : void * fd_stake_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
436 255 : fd_stake_history_t * self = (fd_stake_history_t *)mem;
437 255 : fd_stake_history_new( self );
438 255 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_t);
439 255 : void * * alloc_mem = &alloc_region;
440 255 : fd_stake_history_decode_inner( mem, alloc_mem, ctx );
441 255 : return self;
442 255 : }
443 309 : void fd_stake_history_new(fd_stake_history_t * self) {
444 309 : fd_memset( self, 0, sizeof(fd_stake_history_t) );
445 309 : self->fd_stake_history_size = 512;
446 158517 : for( ulong i=0; i<512; i++ )
447 158208 : fd_epoch_stake_history_entry_pair_new( self->fd_stake_history + i );
448 309 : }
449 144 : int fd_solana_account_encode( fd_solana_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
450 144 : int err;
451 144 : err = fd_bincode_uint64_encode( self->lamports, ctx );
452 144 : if( FD_UNLIKELY( err ) ) return err;
453 144 : err = fd_bincode_uint64_encode( self->data_len, ctx );
454 144 : if( FD_UNLIKELY(err) ) return err;
455 144 : if( self->data_len ) {
456 30 : err = fd_bincode_bytes_encode( self->data, self->data_len, ctx );
457 30 : if( FD_UNLIKELY( err ) ) return err;
458 30 : }
459 144 : err = fd_pubkey_encode( &self->owner, ctx );
460 144 : if( FD_UNLIKELY( err ) ) return err;
461 144 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
462 144 : if( FD_UNLIKELY( err ) ) return err;
463 144 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
464 144 : if( FD_UNLIKELY( err ) ) return err;
465 144 : return FD_BINCODE_SUCCESS;
466 144 : }
467 0 : int fd_solana_account_encode_global( fd_solana_account_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
468 0 : int err;
469 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
470 0 : if( FD_UNLIKELY( err ) ) return err;
471 0 : err = fd_bincode_uint64_encode( self->data_len, ctx );
472 0 : if( FD_UNLIKELY( err ) ) return err;
473 0 : if( self->data_len ) {
474 0 : uchar * data_laddr = (uchar*)self + self->data_offset;
475 0 : err = fd_bincode_bytes_encode( data_laddr, self->data_len, ctx );
476 0 : if( FD_UNLIKELY( err ) ) return err;
477 0 : }
478 0 : err = fd_pubkey_encode( &self->owner, ctx );
479 0 : if( FD_UNLIKELY( err ) ) return err;
480 0 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
481 0 : if( FD_UNLIKELY( err ) ) return err;
482 0 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
483 0 : if( FD_UNLIKELY( err ) ) return err;
484 0 : return FD_BINCODE_SUCCESS;
485 0 : }
486 0 : static int fd_solana_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
487 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
488 0 : int err = 0;
489 0 : err = fd_bincode_uint64_decode_footprint( ctx );
490 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
491 0 : ulong data_len;
492 0 : err = fd_bincode_uint64_decode( &data_len, ctx );
493 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
494 0 : if( data_len ) {
495 0 : *total_sz += 8UL + data_len;
496 0 : err = fd_bincode_bytes_decode_footprint( data_len, ctx );
497 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
498 0 : }
499 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
500 0 : if( FD_UNLIKELY( err ) ) return err;
501 0 : err = fd_bincode_bool_decode_footprint( ctx );
502 0 : if( FD_UNLIKELY( err ) ) return err;
503 0 : err = fd_bincode_uint64_decode_footprint( ctx );
504 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
505 0 : return 0;
506 0 : }
507 0 : int fd_solana_account_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
508 0 : *total_sz += sizeof(fd_solana_account_t);
509 0 : void const * start_data = ctx->data;
510 0 : int err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
511 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
512 0 : ctx->data = start_data;
513 0 : return err;
514 0 : }
515 0 : static void fd_solana_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
516 0 : fd_solana_account_t * self = (fd_solana_account_t *)struct_mem;
517 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
518 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
519 0 : if( self->data_len ) {
520 0 : self->data = *alloc_mem;
521 0 : fd_bincode_bytes_decode_unsafe( self->data, self->data_len, ctx );
522 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
523 0 : } else
524 0 : self->data = NULL;
525 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
526 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
527 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
528 0 : }
529 0 : void * fd_solana_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
530 0 : fd_solana_account_t * self = (fd_solana_account_t *)mem;
531 0 : fd_solana_account_new( self );
532 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_t);
533 0 : void * * alloc_mem = &alloc_region;
534 0 : fd_solana_account_decode_inner( mem, alloc_mem, ctx );
535 0 : return self;
536 0 : }
537 0 : static void fd_solana_account_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
538 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)struct_mem;
539 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
540 0 : fd_bincode_uint64_decode_unsafe( &self->data_len, ctx );
541 0 : if( self->data_len ) {
542 0 : self->data_offset = (ulong)*alloc_mem - (ulong)struct_mem;
543 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->data_len, ctx );
544 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->data_len;
545 0 : } else {
546 0 : self->data_offset = 0UL;
547 0 : }
548 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
549 0 : fd_bincode_bool_decode_unsafe( &self->executable, ctx );
550 0 : fd_bincode_uint64_decode_unsafe( &self->rent_epoch, ctx );
551 0 : }
552 0 : void * fd_solana_account_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
553 0 : fd_solana_account_global_t * self = (fd_solana_account_global_t *)mem;
554 0 : fd_solana_account_new( (fd_solana_account_t *)self );
555 0 : void * alloc_region = (uchar *)mem + sizeof(fd_solana_account_global_t);
556 0 : void * * alloc_mem = &alloc_region;
557 0 : fd_solana_account_decode_inner_global( mem, alloc_mem, ctx );
558 0 : return self;
559 0 : }
560 0 : void fd_solana_account_new(fd_solana_account_t * self) {
561 0 : fd_memset( self, 0, sizeof(fd_solana_account_t) );
562 0 : fd_pubkey_new( &self->owner );
563 0 : }
564 0 : ulong fd_solana_account_size( fd_solana_account_t const * self ) {
565 0 : ulong size = 0;
566 0 : size += sizeof(ulong);
567 0 : do {
568 0 : size += sizeof(ulong);
569 0 : size += self->data_len;
570 0 : } while(0);
571 0 : size += fd_pubkey_size( &self->owner );
572 0 : size += sizeof(char);
573 0 : size += sizeof(ulong);
574 0 : return size;
575 0 : }
576 :
577 0 : ulong fd_solana_account_size_global( fd_solana_account_global_t const * self ) {
578 0 : ulong size = 0;
579 0 : size += sizeof(ulong);
580 0 : do {
581 0 : size += sizeof(ulong);
582 0 : uchar * data = self->data_offset ? (uchar *)fd_type_pun( (uchar *)self + self->data_offset ) : NULL;
583 0 : size += self->data_len;
584 0 : } while(0);
585 0 : size += fd_pubkey_size( &self->owner );
586 0 : size += sizeof(char);
587 0 : size += sizeof(ulong);
588 0 : return size;
589 0 : }
590 :
591 12 : int fd_delegation_encode( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
592 12 : int err;
593 12 : err = fd_pubkey_encode( &self->voter_pubkey, ctx );
594 12 : if( FD_UNLIKELY( err ) ) return err;
595 12 : err = fd_bincode_uint64_encode( self->stake, ctx );
596 12 : if( FD_UNLIKELY( err ) ) return err;
597 12 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
598 12 : if( FD_UNLIKELY( err ) ) return err;
599 12 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
600 12 : if( FD_UNLIKELY( err ) ) return err;
601 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
602 12 : if( FD_UNLIKELY( err ) ) return err;
603 12 : return FD_BINCODE_SUCCESS;
604 12 : }
605 0 : static inline int fd_delegation_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
606 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
607 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
608 0 : return 0;
609 0 : }
610 0 : static void fd_delegation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
611 0 : fd_delegation_t * self = (fd_delegation_t *)struct_mem;
612 0 : fd_pubkey_decode_inner( &self->voter_pubkey, alloc_mem, ctx );
613 0 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
614 0 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
615 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
616 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
617 0 : }
618 0 : void * fd_delegation_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
619 0 : fd_delegation_t * self = (fd_delegation_t *)mem;
620 0 : fd_delegation_new( self );
621 0 : void * alloc_region = (uchar *)mem + sizeof(fd_delegation_t);
622 0 : void * * alloc_mem = &alloc_region;
623 0 : fd_delegation_decode_inner( mem, alloc_mem, ctx );
624 0 : return self;
625 0 : }
626 12 : int fd_stake_encode( fd_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
627 12 : int err;
628 12 : err = fd_delegation_encode( &self->delegation, ctx );
629 12 : if( FD_UNLIKELY( err ) ) return err;
630 12 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
631 12 : if( FD_UNLIKELY( err ) ) return err;
632 12 : return FD_BINCODE_SUCCESS;
633 12 : }
634 0 : static inline int fd_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
635 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
636 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
637 0 : return 0;
638 0 : }
639 0 : static void fd_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
640 0 : fd_stake_t * self = (fd_stake_t *)struct_mem;
641 0 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
642 0 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
643 0 : }
644 0 : void * fd_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
645 0 : fd_stake_t * self = (fd_stake_t *)mem;
646 0 : fd_stake_new( self );
647 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_t);
648 0 : void * * alloc_mem = &alloc_region;
649 0 : fd_stake_decode_inner( mem, alloc_mem, ctx );
650 0 : return self;
651 0 : }
652 9 : int fd_rust_duration_encode( fd_rust_duration_t const * self, fd_bincode_encode_ctx_t * ctx ) {
653 9 : int err;
654 9 : err = fd_bincode_uint64_encode( self->seconds, ctx );
655 9 : if( FD_UNLIKELY( err ) ) return err;
656 9 : err = fd_bincode_uint32_encode( self->nanoseconds, ctx );
657 9 : if( FD_UNLIKELY( err ) ) return err;
658 9 : return FD_BINCODE_SUCCESS;
659 9 : }
660 0 : static inline int fd_rust_duration_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
661 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
662 0 : int err = fd_rust_duration_footprint_validator( ctx );
663 0 : if( FD_UNLIKELY( err != FD_BINCODE_SUCCESS ) )
664 0 : return err;
665 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
666 0 : return 0;
667 0 : }
668 0 : static void fd_rust_duration_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
669 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)struct_mem;
670 0 : fd_bincode_uint64_decode_unsafe( &self->seconds, ctx );
671 0 : fd_bincode_uint32_decode_unsafe( &self->nanoseconds, ctx );
672 0 : fd_rust_duration_normalize( self );
673 0 : }
674 0 : void * fd_rust_duration_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
675 0 : fd_rust_duration_t * self = (fd_rust_duration_t *)mem;
676 0 : fd_rust_duration_new( self );
677 0 : void * alloc_region = (uchar *)mem + sizeof(fd_rust_duration_t);
678 0 : void * * alloc_mem = &alloc_region;
679 0 : fd_rust_duration_decode_inner( mem, alloc_mem, ctx );
680 0 : return self;
681 0 : }
682 9 : int fd_poh_config_encode( fd_poh_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
683 9 : int err;
684 9 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
685 9 : if( FD_UNLIKELY( err ) ) return err;
686 9 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
687 9 : if( FD_UNLIKELY( err ) ) return err;
688 9 : if( self->has_target_tick_count ) {
689 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
690 0 : if( FD_UNLIKELY( err ) ) return err;
691 0 : }
692 9 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
693 9 : if( FD_UNLIKELY( err ) ) return err;
694 9 : if( self->has_hashes_per_tick ) {
695 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
696 0 : if( FD_UNLIKELY( err ) ) return err;
697 0 : }
698 9 : return FD_BINCODE_SUCCESS;
699 9 : }
700 0 : int fd_poh_config_encode_global( fd_poh_config_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
701 0 : int err;
702 0 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
703 0 : if( FD_UNLIKELY( err ) ) return err;
704 0 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
705 0 : if( FD_UNLIKELY( err ) ) return err;
706 0 : if( self->has_target_tick_count ) {
707 0 : err = fd_bincode_uint64_encode( self->target_tick_count, ctx );
708 0 : if( FD_UNLIKELY( err ) ) return err;
709 0 : }
710 0 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
711 0 : if( FD_UNLIKELY( err ) ) return err;
712 0 : if( self->has_hashes_per_tick ) {
713 0 : err = fd_bincode_uint64_encode( self->hashes_per_tick, ctx );
714 0 : if( FD_UNLIKELY( err ) ) return err;
715 0 : }
716 0 : return FD_BINCODE_SUCCESS;
717 0 : }
718 0 : static int fd_poh_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
719 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
720 0 : int err = 0;
721 0 : err = fd_rust_duration_decode_footprint_inner( ctx, total_sz );
722 0 : if( FD_UNLIKELY( err ) ) return err;
723 0 : {
724 0 : uchar o;
725 0 : err = fd_bincode_bool_decode( &o, ctx );
726 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
727 0 : if( o ) {
728 0 : err = fd_bincode_uint64_decode_footprint( ctx );
729 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
730 0 : }
731 0 : }
732 0 : {
733 0 : uchar o;
734 0 : err = fd_bincode_bool_decode( &o, ctx );
735 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
736 0 : if( o ) {
737 0 : err = fd_bincode_uint64_decode_footprint( ctx );
738 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
739 0 : }
740 0 : }
741 0 : return 0;
742 0 : }
743 0 : int fd_poh_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
744 0 : *total_sz += sizeof(fd_poh_config_t);
745 0 : void const * start_data = ctx->data;
746 0 : int err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
747 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
748 0 : ctx->data = start_data;
749 0 : return err;
750 0 : }
751 0 : static void fd_poh_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
752 0 : fd_poh_config_t * self = (fd_poh_config_t *)struct_mem;
753 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
754 0 : {
755 0 : uchar o;
756 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
757 0 : self->has_target_tick_count = !!o;
758 0 : if( o ) {
759 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
760 0 : }
761 0 : }
762 0 : {
763 0 : uchar o;
764 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
765 0 : self->has_hashes_per_tick = !!o;
766 0 : if( o ) {
767 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
768 0 : }
769 0 : }
770 0 : }
771 0 : void * fd_poh_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
772 0 : fd_poh_config_t * self = (fd_poh_config_t *)mem;
773 0 : fd_poh_config_new( self );
774 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_t);
775 0 : void * * alloc_mem = &alloc_region;
776 0 : fd_poh_config_decode_inner( mem, alloc_mem, ctx );
777 0 : return self;
778 0 : }
779 0 : static void fd_poh_config_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
780 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)struct_mem;
781 0 : fd_rust_duration_decode_inner( &self->target_tick_duration, alloc_mem, ctx );
782 0 : {
783 0 : uchar o;
784 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
785 0 : self->has_target_tick_count = !!o;
786 0 : if( o ) {
787 0 : fd_bincode_uint64_decode_unsafe( &self->target_tick_count, ctx );
788 0 : }
789 0 : }
790 0 : {
791 0 : uchar o;
792 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
793 0 : self->has_hashes_per_tick = !!o;
794 0 : if( o ) {
795 0 : fd_bincode_uint64_decode_unsafe( &self->hashes_per_tick, ctx );
796 0 : }
797 0 : }
798 0 : }
799 0 : void * fd_poh_config_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
800 0 : fd_poh_config_global_t * self = (fd_poh_config_global_t *)mem;
801 0 : fd_poh_config_new( (fd_poh_config_t *)self );
802 0 : void * alloc_region = (uchar *)mem + sizeof(fd_poh_config_global_t);
803 0 : void * * alloc_mem = &alloc_region;
804 0 : fd_poh_config_decode_inner_global( mem, alloc_mem, ctx );
805 0 : return self;
806 0 : }
807 12 : void fd_poh_config_new(fd_poh_config_t * self) {
808 12 : fd_memset( self, 0, sizeof(fd_poh_config_t) );
809 12 : fd_rust_duration_new( &self->target_tick_duration );
810 12 : }
811 0 : ulong fd_poh_config_size( fd_poh_config_t const * self ) {
812 0 : ulong size = 0;
813 0 : size += fd_rust_duration_size( &self->target_tick_duration );
814 0 : size += sizeof(char);
815 0 : if( self->has_target_tick_count ) {
816 0 : size += sizeof(ulong);
817 0 : }
818 0 : size += sizeof(char);
819 0 : if( self->has_hashes_per_tick ) {
820 0 : size += sizeof(ulong);
821 0 : }
822 0 : return size;
823 0 : }
824 :
825 0 : ulong fd_poh_config_size_global( fd_poh_config_global_t const * self ) {
826 0 : ulong size = 0;
827 0 : size += fd_rust_duration_size( &self->target_tick_duration );
828 0 : size += sizeof(char);
829 0 : if( self->has_target_tick_count ) {
830 0 : size += sizeof(ulong);
831 0 : }
832 0 : size += sizeof(char);
833 0 : if( self->has_hashes_per_tick ) {
834 0 : size += sizeof(ulong);
835 0 : }
836 0 : return size;
837 0 : }
838 :
839 0 : int fd_string_pubkey_pair_encode( fd_string_pubkey_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
840 0 : int err;
841 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
842 0 : if( FD_UNLIKELY(err) ) return err;
843 0 : if( self->string_len ) {
844 0 : err = fd_bincode_bytes_encode( self->string, self->string_len, ctx );
845 0 : if( FD_UNLIKELY( err ) ) return err;
846 0 : }
847 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
848 0 : if( FD_UNLIKELY( err ) ) return err;
849 0 : return FD_BINCODE_SUCCESS;
850 0 : }
851 0 : int fd_string_pubkey_pair_encode_global( fd_string_pubkey_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
852 0 : int err;
853 0 : err = fd_bincode_uint64_encode( self->string_len, ctx );
854 0 : if( FD_UNLIKELY( err ) ) return err;
855 0 : if( self->string_len ) {
856 0 : uchar * string_laddr = (uchar*)self + self->string_offset;
857 0 : err = fd_bincode_bytes_encode( string_laddr, self->string_len, ctx );
858 0 : if( FD_UNLIKELY( err ) ) return err;
859 0 : }
860 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
861 0 : if( FD_UNLIKELY( err ) ) return err;
862 0 : return FD_BINCODE_SUCCESS;
863 0 : }
864 0 : static int fd_string_pubkey_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
865 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
866 0 : int err = 0;
867 0 : ulong string_len;
868 0 : err = fd_bincode_uint64_decode( &string_len, ctx );
869 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
870 0 : *total_sz += string_len;
871 0 : if( string_len ) {
872 0 : err = fd_bincode_bytes_decode_footprint( string_len, ctx );
873 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
874 0 : err = !fd_utf8_verify( (char const *) ctx->data - string_len, string_len );
875 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
876 0 : }
877 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
878 0 : if( FD_UNLIKELY( err ) ) return err;
879 0 : return 0;
880 0 : }
881 0 : int fd_string_pubkey_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
882 0 : *total_sz += sizeof(fd_string_pubkey_pair_t);
883 0 : void const * start_data = ctx->data;
884 0 : int err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
885 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
886 0 : ctx->data = start_data;
887 0 : return err;
888 0 : }
889 0 : static void fd_string_pubkey_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
890 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)struct_mem;
891 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
892 0 : if( self->string_len ) {
893 0 : self->string = *alloc_mem;
894 0 : fd_bincode_bytes_decode_unsafe( self->string, self->string_len, ctx );
895 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
896 0 : } else
897 0 : self->string = NULL;
898 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
899 0 : }
900 0 : void * fd_string_pubkey_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
901 0 : fd_string_pubkey_pair_t * self = (fd_string_pubkey_pair_t *)mem;
902 0 : fd_string_pubkey_pair_new( self );
903 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_t);
904 0 : void * * alloc_mem = &alloc_region;
905 0 : fd_string_pubkey_pair_decode_inner( mem, alloc_mem, ctx );
906 0 : return self;
907 0 : }
908 0 : static void fd_string_pubkey_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
909 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)struct_mem;
910 0 : fd_bincode_uint64_decode_unsafe( &self->string_len, ctx );
911 0 : if( self->string_len ) {
912 0 : self->string_offset = (ulong)*alloc_mem - (ulong)struct_mem;
913 0 : fd_bincode_bytes_decode_unsafe( *alloc_mem, self->string_len, ctx );
914 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->string_len;
915 0 : } else {
916 0 : self->string_offset = 0UL;
917 0 : }
918 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
919 0 : }
920 0 : void * fd_string_pubkey_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
921 0 : fd_string_pubkey_pair_global_t * self = (fd_string_pubkey_pair_global_t *)mem;
922 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)self );
923 0 : void * alloc_region = (uchar *)mem + sizeof(fd_string_pubkey_pair_global_t);
924 0 : void * * alloc_mem = &alloc_region;
925 0 : fd_string_pubkey_pair_decode_inner_global( mem, alloc_mem, ctx );
926 0 : return self;
927 0 : }
928 0 : void fd_string_pubkey_pair_new(fd_string_pubkey_pair_t * self) {
929 0 : fd_memset( self, 0, sizeof(fd_string_pubkey_pair_t) );
930 0 : fd_pubkey_new( &self->pubkey );
931 0 : }
932 0 : ulong fd_string_pubkey_pair_size( fd_string_pubkey_pair_t const * self ) {
933 0 : ulong size = 0;
934 0 : do {
935 0 : size += sizeof(ulong);
936 0 : size += self->string_len;
937 0 : } while(0);
938 0 : size += fd_pubkey_size( &self->pubkey );
939 0 : return size;
940 0 : }
941 :
942 0 : ulong fd_string_pubkey_pair_size_global( fd_string_pubkey_pair_global_t const * self ) {
943 0 : ulong size = 0;
944 0 : do {
945 0 : size += sizeof(ulong);
946 0 : uchar * string = self->string_offset ? (uchar *)fd_type_pun( (uchar *)self + self->string_offset ) : NULL;
947 0 : size += self->string_len;
948 0 : } while(0);
949 0 : size += fd_pubkey_size( &self->pubkey );
950 0 : return size;
951 0 : }
952 :
953 144 : int fd_pubkey_account_pair_encode( fd_pubkey_account_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
954 144 : int err;
955 144 : err = fd_pubkey_encode( &self->key, ctx );
956 144 : if( FD_UNLIKELY( err ) ) return err;
957 144 : err = fd_solana_account_encode( &self->account, ctx );
958 144 : if( FD_UNLIKELY( err ) ) return err;
959 144 : return FD_BINCODE_SUCCESS;
960 144 : }
961 0 : int fd_pubkey_account_pair_encode_global( fd_pubkey_account_pair_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
962 0 : int err;
963 0 : err = fd_pubkey_encode( &self->key, ctx );
964 0 : if( FD_UNLIKELY( err ) ) return err;
965 0 : err = fd_solana_account_encode_global( &self->account, ctx );
966 0 : if( FD_UNLIKELY( err ) ) return err;
967 0 : return FD_BINCODE_SUCCESS;
968 0 : }
969 0 : static int fd_pubkey_account_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
970 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
971 0 : int err = 0;
972 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
973 0 : if( FD_UNLIKELY( err ) ) return err;
974 0 : err = fd_solana_account_decode_footprint_inner( ctx, total_sz );
975 0 : if( FD_UNLIKELY( err ) ) return err;
976 0 : return 0;
977 0 : }
978 0 : int fd_pubkey_account_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
979 0 : *total_sz += sizeof(fd_pubkey_account_pair_t);
980 0 : void const * start_data = ctx->data;
981 0 : int err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
982 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
983 0 : ctx->data = start_data;
984 0 : return err;
985 0 : }
986 0 : static void fd_pubkey_account_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
987 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)struct_mem;
988 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
989 0 : fd_solana_account_decode_inner( &self->account, alloc_mem, ctx );
990 0 : }
991 0 : void * fd_pubkey_account_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
992 0 : fd_pubkey_account_pair_t * self = (fd_pubkey_account_pair_t *)mem;
993 0 : fd_pubkey_account_pair_new( self );
994 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_t);
995 0 : void * * alloc_mem = &alloc_region;
996 0 : fd_pubkey_account_pair_decode_inner( mem, alloc_mem, ctx );
997 0 : return self;
998 0 : }
999 0 : static void fd_pubkey_account_pair_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1000 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)struct_mem;
1001 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
1002 0 : fd_solana_account_decode_inner_global( &self->account, alloc_mem, ctx );
1003 0 : }
1004 0 : void * fd_pubkey_account_pair_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1005 0 : fd_pubkey_account_pair_global_t * self = (fd_pubkey_account_pair_global_t *)mem;
1006 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)self );
1007 0 : void * alloc_region = (uchar *)mem + sizeof(fd_pubkey_account_pair_global_t);
1008 0 : void * * alloc_mem = &alloc_region;
1009 0 : fd_pubkey_account_pair_decode_inner_global( mem, alloc_mem, ctx );
1010 0 : return self;
1011 0 : }
1012 0 : void fd_pubkey_account_pair_new(fd_pubkey_account_pair_t * self) {
1013 0 : fd_memset( self, 0, sizeof(fd_pubkey_account_pair_t) );
1014 0 : fd_pubkey_new( &self->key );
1015 0 : fd_solana_account_new( &self->account );
1016 0 : }
1017 0 : ulong fd_pubkey_account_pair_size( fd_pubkey_account_pair_t const * self ) {
1018 0 : ulong size = 0;
1019 0 : size += fd_pubkey_size( &self->key );
1020 0 : size += fd_solana_account_size( &self->account );
1021 0 : return size;
1022 0 : }
1023 :
1024 0 : ulong fd_pubkey_account_pair_size_global( fd_pubkey_account_pair_global_t const * self ) {
1025 0 : ulong size = 0;
1026 0 : size += fd_pubkey_size( &self->key );
1027 0 : size += fd_solana_account_size_global( &self->account );
1028 0 : return size;
1029 0 : }
1030 :
1031 12 : int fd_genesis_solana_encode( fd_genesis_solana_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1032 12 : int err;
1033 12 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1034 12 : if( FD_UNLIKELY( err ) ) return err;
1035 9 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1036 9 : if( FD_UNLIKELY(err) ) return err;
1037 9 : if( self->accounts_len ) {
1038 153 : for( ulong i=0; i < self->accounts_len; i++ ) {
1039 144 : err = fd_pubkey_account_pair_encode( self->accounts + i, ctx );
1040 144 : if( FD_UNLIKELY( err ) ) return err;
1041 144 : }
1042 9 : }
1043 9 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1044 9 : if( FD_UNLIKELY(err) ) return err;
1045 9 : if( self->native_instruction_processors_len ) {
1046 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1047 0 : err = fd_string_pubkey_pair_encode( self->native_instruction_processors + i, ctx );
1048 0 : if( FD_UNLIKELY( err ) ) return err;
1049 0 : }
1050 0 : }
1051 9 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1052 9 : if( FD_UNLIKELY(err) ) return err;
1053 9 : if( self->rewards_pools_len ) {
1054 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1055 0 : err = fd_pubkey_account_pair_encode( self->rewards_pools + i, ctx );
1056 0 : if( FD_UNLIKELY( err ) ) return err;
1057 0 : }
1058 0 : }
1059 9 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1060 9 : if( FD_UNLIKELY( err ) ) return err;
1061 9 : err = fd_bincode_uint64_encode( self->unused, ctx );
1062 9 : if( FD_UNLIKELY( err ) ) return err;
1063 9 : err = fd_poh_config_encode( &self->poh_config, ctx );
1064 9 : if( FD_UNLIKELY( err ) ) return err;
1065 9 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1066 9 : if( FD_UNLIKELY( err ) ) return err;
1067 9 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1068 9 : if( FD_UNLIKELY( err ) ) return err;
1069 9 : err = fd_rent_encode( &self->rent, ctx );
1070 9 : if( FD_UNLIKELY( err ) ) return err;
1071 9 : err = fd_inflation_encode( &self->inflation, ctx );
1072 9 : if( FD_UNLIKELY( err ) ) return err;
1073 9 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1074 9 : if( FD_UNLIKELY( err ) ) return err;
1075 9 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1076 9 : if( FD_UNLIKELY( err ) ) return err;
1077 9 : return FD_BINCODE_SUCCESS;
1078 9 : }
1079 0 : int fd_genesis_solana_encode_global( fd_genesis_solana_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1080 0 : int err;
1081 0 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1082 0 : if( FD_UNLIKELY( err ) ) return err;
1083 0 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1084 0 : if( FD_UNLIKELY( err ) ) return err;
1085 0 : if( self->accounts_len ) {
1086 0 : uchar * accounts_laddr = (uchar*)self + self->accounts_offset;
1087 0 : fd_pubkey_account_pair_global_t * accounts = (fd_pubkey_account_pair_global_t *)accounts_laddr;
1088 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1089 0 : err = fd_pubkey_account_pair_encode_global( &accounts[i], ctx );
1090 0 : if( FD_UNLIKELY( err ) ) return err;
1091 0 : }
1092 0 : }
1093 0 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1094 0 : if( FD_UNLIKELY( err ) ) return err;
1095 0 : if( self->native_instruction_processors_len ) {
1096 0 : uchar * native_instruction_processors_laddr = (uchar*)self + self->native_instruction_processors_offset;
1097 0 : fd_string_pubkey_pair_global_t * native_instruction_processors = (fd_string_pubkey_pair_global_t *)native_instruction_processors_laddr;
1098 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1099 0 : err = fd_string_pubkey_pair_encode_global( &native_instruction_processors[i], ctx );
1100 0 : if( FD_UNLIKELY( err ) ) return err;
1101 0 : }
1102 0 : }
1103 0 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1104 0 : if( FD_UNLIKELY( err ) ) return err;
1105 0 : if( self->rewards_pools_len ) {
1106 0 : uchar * rewards_pools_laddr = (uchar*)self + self->rewards_pools_offset;
1107 0 : fd_pubkey_account_pair_global_t * rewards_pools = (fd_pubkey_account_pair_global_t *)rewards_pools_laddr;
1108 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1109 0 : err = fd_pubkey_account_pair_encode_global( &rewards_pools[i], ctx );
1110 0 : if( FD_UNLIKELY( err ) ) return err;
1111 0 : }
1112 0 : }
1113 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1114 0 : if( FD_UNLIKELY( err ) ) return err;
1115 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
1116 0 : if( FD_UNLIKELY( err ) ) return err;
1117 0 : err = fd_poh_config_encode_global( &self->poh_config, ctx );
1118 0 : if( FD_UNLIKELY( err ) ) return err;
1119 0 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1120 0 : if( FD_UNLIKELY( err ) ) return err;
1121 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1122 0 : if( FD_UNLIKELY( err ) ) return err;
1123 0 : err = fd_rent_encode( &self->rent, ctx );
1124 0 : if( FD_UNLIKELY( err ) ) return err;
1125 0 : err = fd_inflation_encode( &self->inflation, ctx );
1126 0 : if( FD_UNLIKELY( err ) ) return err;
1127 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1128 0 : if( FD_UNLIKELY( err ) ) return err;
1129 0 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1130 0 : if( FD_UNLIKELY( err ) ) return err;
1131 0 : return FD_BINCODE_SUCCESS;
1132 0 : }
1133 0 : static int fd_genesis_solana_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1134 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1135 0 : int err = 0;
1136 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1137 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1138 0 : ulong accounts_len;
1139 0 : err = fd_bincode_uint64_decode( &accounts_len, ctx );
1140 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1141 0 : if( accounts_len ) {
1142 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*accounts_len;
1143 0 : for( ulong i=0; i < accounts_len; i++ ) {
1144 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1145 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1146 0 : }
1147 0 : }
1148 0 : ulong native_instruction_processors_len;
1149 0 : err = fd_bincode_uint64_decode( &native_instruction_processors_len, ctx );
1150 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1151 0 : if( native_instruction_processors_len ) {
1152 0 : *total_sz += FD_STRING_PUBKEY_PAIR_ALIGN + sizeof(fd_string_pubkey_pair_t)*native_instruction_processors_len;
1153 0 : for( ulong i=0; i < native_instruction_processors_len; i++ ) {
1154 0 : err = fd_string_pubkey_pair_decode_footprint_inner( ctx, total_sz );
1155 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1156 0 : }
1157 0 : }
1158 0 : ulong rewards_pools_len;
1159 0 : err = fd_bincode_uint64_decode( &rewards_pools_len, ctx );
1160 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1161 0 : if( rewards_pools_len ) {
1162 0 : *total_sz += FD_PUBKEY_ACCOUNT_PAIR_ALIGN + sizeof(fd_pubkey_account_pair_t)*rewards_pools_len;
1163 0 : for( ulong i=0; i < rewards_pools_len; i++ ) {
1164 0 : err = fd_pubkey_account_pair_decode_footprint_inner( ctx, total_sz );
1165 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1166 0 : }
1167 0 : }
1168 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1169 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1170 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1171 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1172 0 : err = fd_poh_config_decode_footprint_inner( ctx, total_sz );
1173 0 : if( FD_UNLIKELY( err ) ) return err;
1174 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1175 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1176 0 : err = fd_fee_rate_governor_decode_footprint_inner( ctx, total_sz );
1177 0 : if( FD_UNLIKELY( err ) ) return err;
1178 0 : err = fd_rent_decode_footprint_inner( ctx, total_sz );
1179 0 : if( FD_UNLIKELY( err ) ) return err;
1180 0 : err = fd_inflation_decode_footprint_inner( ctx, total_sz );
1181 0 : if( FD_UNLIKELY( err ) ) return err;
1182 0 : err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
1183 0 : if( FD_UNLIKELY( err ) ) return err;
1184 0 : err = fd_bincode_uint32_decode_footprint( ctx );
1185 0 : if( FD_UNLIKELY( err ) ) return err;
1186 0 : return 0;
1187 0 : }
1188 0 : int fd_genesis_solana_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1189 0 : *total_sz += sizeof(fd_genesis_solana_t);
1190 0 : void const * start_data = ctx->data;
1191 0 : int err = fd_genesis_solana_decode_footprint_inner( ctx, total_sz );
1192 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1193 0 : ctx->data = start_data;
1194 0 : return err;
1195 0 : }
1196 0 : static void fd_genesis_solana_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1197 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)struct_mem;
1198 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1199 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1200 0 : if( self->accounts_len ) {
1201 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1202 0 : self->accounts = *alloc_mem;
1203 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1204 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1205 0 : fd_pubkey_account_pair_new( self->accounts + i );
1206 0 : fd_pubkey_account_pair_decode_inner( self->accounts + i, alloc_mem, ctx );
1207 0 : }
1208 0 : } else
1209 0 : self->accounts = NULL;
1210 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1211 0 : if( self->native_instruction_processors_len ) {
1212 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1213 0 : self->native_instruction_processors = *alloc_mem;
1214 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1215 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1216 0 : fd_string_pubkey_pair_new( self->native_instruction_processors + i );
1217 0 : fd_string_pubkey_pair_decode_inner( self->native_instruction_processors + i, alloc_mem, ctx );
1218 0 : }
1219 0 : } else
1220 0 : self->native_instruction_processors = NULL;
1221 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
1222 0 : if( self->rewards_pools_len ) {
1223 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1224 0 : self->rewards_pools = *alloc_mem;
1225 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
1226 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1227 0 : fd_pubkey_account_pair_new( self->rewards_pools + i );
1228 0 : fd_pubkey_account_pair_decode_inner( self->rewards_pools + i, alloc_mem, ctx );
1229 0 : }
1230 0 : } else
1231 0 : self->rewards_pools = NULL;
1232 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
1233 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
1234 0 : fd_poh_config_decode_inner( &self->poh_config, alloc_mem, ctx );
1235 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
1236 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
1237 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1238 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
1239 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1240 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
1241 0 : }
1242 0 : void * fd_genesis_solana_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1243 0 : fd_genesis_solana_t * self = (fd_genesis_solana_t *)mem;
1244 0 : fd_genesis_solana_new( self );
1245 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_t);
1246 0 : void * * alloc_mem = &alloc_region;
1247 0 : fd_genesis_solana_decode_inner( mem, alloc_mem, ctx );
1248 0 : return self;
1249 0 : }
1250 0 : static void fd_genesis_solana_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1251 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)struct_mem;
1252 0 : fd_bincode_uint64_decode_unsafe( &self->creation_time, ctx );
1253 0 : fd_bincode_uint64_decode_unsafe( &self->accounts_len, ctx );
1254 0 : if( self->accounts_len ) {
1255 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1256 0 : self->accounts_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1257 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1258 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->accounts_len;
1259 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1260 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
1261 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
1262 0 : }
1263 0 : } else {
1264 0 : self->accounts_offset = 0UL;
1265 0 : }
1266 0 : fd_bincode_uint64_decode_unsafe( &self->native_instruction_processors_len, ctx );
1267 0 : if( self->native_instruction_processors_len ) {
1268 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_STRING_PUBKEY_PAIR_ALIGN );
1269 0 : self->native_instruction_processors_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1270 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1271 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_string_pubkey_pair_t)*self->native_instruction_processors_len;
1272 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ ) {
1273 0 : fd_string_pubkey_pair_new( (fd_string_pubkey_pair_t *)fd_type_pun(cur_mem + sizeof(fd_string_pubkey_pair_t) * i) );
1274 0 : fd_string_pubkey_pair_decode_inner_global( cur_mem + sizeof(fd_string_pubkey_pair_t) * i, alloc_mem, ctx );
1275 0 : }
1276 0 : } else {
1277 0 : self->native_instruction_processors_offset = 0UL;
1278 0 : }
1279 0 : fd_bincode_uint64_decode_unsafe( &self->rewards_pools_len, ctx );
1280 0 : if( self->rewards_pools_len ) {
1281 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ACCOUNT_PAIR_ALIGN );
1282 0 : self->rewards_pools_offset = (ulong)*alloc_mem - (ulong)struct_mem;
1283 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
1284 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_account_pair_t)*self->rewards_pools_len;
1285 0 : for( ulong i=0; i < self->rewards_pools_len; i++ ) {
1286 0 : fd_pubkey_account_pair_new( (fd_pubkey_account_pair_t *)fd_type_pun(cur_mem + sizeof(fd_pubkey_account_pair_t) * i) );
1287 0 : fd_pubkey_account_pair_decode_inner_global( cur_mem + sizeof(fd_pubkey_account_pair_t) * i, alloc_mem, ctx );
1288 0 : }
1289 0 : } else {
1290 0 : self->rewards_pools_offset = 0UL;
1291 0 : }
1292 0 : fd_bincode_uint64_decode_unsafe( &self->ticks_per_slot, ctx );
1293 0 : fd_bincode_uint64_decode_unsafe( &self->unused, ctx );
1294 0 : fd_poh_config_decode_inner_global( &self->poh_config, alloc_mem, ctx );
1295 0 : fd_bincode_uint64_decode_unsafe( &self->__backwards_compat_with_v0_23, ctx );
1296 0 : fd_fee_rate_governor_decode_inner( &self->fee_rate_governor, alloc_mem, ctx );
1297 0 : fd_rent_decode_inner( &self->rent, alloc_mem, ctx );
1298 0 : fd_inflation_decode_inner( &self->inflation, alloc_mem, ctx );
1299 0 : fd_epoch_schedule_decode_inner( &self->epoch_schedule, alloc_mem, ctx );
1300 0 : fd_bincode_uint32_decode_unsafe( &self->cluster_type, ctx );
1301 0 : }
1302 0 : void * fd_genesis_solana_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1303 0 : fd_genesis_solana_global_t * self = (fd_genesis_solana_global_t *)mem;
1304 0 : fd_genesis_solana_new( (fd_genesis_solana_t *)self );
1305 0 : void * alloc_region = (uchar *)mem + sizeof(fd_genesis_solana_global_t);
1306 0 : void * * alloc_mem = &alloc_region;
1307 0 : fd_genesis_solana_decode_inner_global( mem, alloc_mem, ctx );
1308 0 : return self;
1309 0 : }
1310 12 : void fd_genesis_solana_new(fd_genesis_solana_t * self) {
1311 12 : fd_memset( self, 0, sizeof(fd_genesis_solana_t) );
1312 12 : fd_poh_config_new( &self->poh_config );
1313 12 : fd_fee_rate_governor_new( &self->fee_rate_governor );
1314 12 : fd_rent_new( &self->rent );
1315 12 : fd_inflation_new( &self->inflation );
1316 12 : fd_epoch_schedule_new( &self->epoch_schedule );
1317 12 : }
1318 0 : ulong fd_genesis_solana_size( fd_genesis_solana_t const * self ) {
1319 0 : ulong size = 0;
1320 0 : size += sizeof(ulong);
1321 0 : do {
1322 0 : size += sizeof(ulong);
1323 0 : for( ulong i=0; i < self->accounts_len; i++ )
1324 0 : size += fd_pubkey_account_pair_size( self->accounts + i );
1325 0 : } while(0);
1326 0 : do {
1327 0 : size += sizeof(ulong);
1328 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
1329 0 : size += fd_string_pubkey_pair_size( self->native_instruction_processors + i );
1330 0 : } while(0);
1331 0 : do {
1332 0 : size += sizeof(ulong);
1333 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
1334 0 : size += fd_pubkey_account_pair_size( self->rewards_pools + i );
1335 0 : } while(0);
1336 0 : size += sizeof(ulong);
1337 0 : size += sizeof(ulong);
1338 0 : size += fd_poh_config_size( &self->poh_config );
1339 0 : size += sizeof(ulong);
1340 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
1341 0 : size += fd_rent_size( &self->rent );
1342 0 : size += fd_inflation_size( &self->inflation );
1343 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
1344 0 : size += sizeof(uint);
1345 0 : return size;
1346 0 : }
1347 :
1348 0 : ulong fd_genesis_solana_size_global( fd_genesis_solana_global_t const * self ) {
1349 0 : ulong size = 0;
1350 0 : size += sizeof(ulong);
1351 0 : do {
1352 0 : size += sizeof(ulong);
1353 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;
1354 0 : for( ulong i=0; i < self->accounts_len; i++ )
1355 0 : size += fd_pubkey_account_pair_size_global( accounts + i );
1356 0 : } while(0);
1357 0 : do {
1358 0 : size += sizeof(ulong);
1359 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;
1360 0 : for( ulong i=0; i < self->native_instruction_processors_len; i++ )
1361 0 : size += fd_string_pubkey_pair_size_global( native_instruction_processors + i );
1362 0 : } while(0);
1363 0 : do {
1364 0 : size += sizeof(ulong);
1365 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;
1366 0 : for( ulong i=0; i < self->rewards_pools_len; i++ )
1367 0 : size += fd_pubkey_account_pair_size_global( rewards_pools + i );
1368 0 : } while(0);
1369 0 : size += sizeof(ulong);
1370 0 : size += sizeof(ulong);
1371 0 : size += fd_poh_config_size_global( &self->poh_config );
1372 0 : size += sizeof(ulong);
1373 0 : size += fd_fee_rate_governor_size( &self->fee_rate_governor );
1374 0 : size += fd_rent_size( &self->rent );
1375 0 : size += fd_inflation_size( &self->inflation );
1376 0 : size += fd_epoch_schedule_size( &self->epoch_schedule );
1377 0 : size += sizeof(uint);
1378 0 : return size;
1379 0 : }
1380 :
1381 114 : int fd_sol_sysvar_clock_encode( fd_sol_sysvar_clock_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1382 114 : int err;
1383 114 : err = fd_bincode_uint64_encode( self->slot, ctx );
1384 114 : if( FD_UNLIKELY( err ) ) return err;
1385 114 : err = fd_bincode_uint64_encode( (ulong)self->epoch_start_timestamp, ctx );
1386 114 : if( FD_UNLIKELY( err ) ) return err;
1387 114 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1388 114 : if( FD_UNLIKELY( err ) ) return err;
1389 114 : err = fd_bincode_uint64_encode( self->leader_schedule_epoch, ctx );
1390 114 : if( FD_UNLIKELY( err ) ) return err;
1391 114 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
1392 114 : if( FD_UNLIKELY( err ) ) return err;
1393 114 : return FD_BINCODE_SUCCESS;
1394 114 : }
1395 0 : static inline int fd_sol_sysvar_clock_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1396 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1397 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
1398 0 : return 0;
1399 0 : }
1400 129 : static void fd_sol_sysvar_clock_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1401 129 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)struct_mem;
1402 129 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1403 129 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
1404 129 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1405 129 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
1406 129 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
1407 129 : }
1408 129 : void * fd_sol_sysvar_clock_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1409 129 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)mem;
1410 129 : fd_sol_sysvar_clock_new( self );
1411 129 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_clock_t);
1412 129 : void * * alloc_mem = &alloc_region;
1413 129 : fd_sol_sysvar_clock_decode_inner( mem, alloc_mem, ctx );
1414 129 : return self;
1415 129 : }
1416 0 : int fd_sol_sysvar_last_restart_slot_encode( fd_sol_sysvar_last_restart_slot_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1417 0 : int err;
1418 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1419 0 : if( FD_UNLIKELY( err ) ) return err;
1420 0 : return FD_BINCODE_SUCCESS;
1421 0 : }
1422 0 : static inline int fd_sol_sysvar_last_restart_slot_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1423 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1424 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
1425 0 : return 0;
1426 0 : }
1427 27 : static void fd_sol_sysvar_last_restart_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1428 27 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)struct_mem;
1429 27 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1430 27 : }
1431 27 : void * fd_sol_sysvar_last_restart_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1432 27 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)mem;
1433 27 : fd_sol_sysvar_last_restart_slot_new( self );
1434 27 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_last_restart_slot_t);
1435 27 : void * * alloc_mem = &alloc_region;
1436 27 : fd_sol_sysvar_last_restart_slot_decode_inner( mem, alloc_mem, ctx );
1437 27 : return self;
1438 27 : }
1439 0 : int fd_vote_lockout_encode( fd_vote_lockout_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1440 0 : int err;
1441 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1442 0 : if( FD_UNLIKELY( err ) ) return err;
1443 0 : err = fd_bincode_uint32_encode( self->confirmation_count, ctx );
1444 0 : if( FD_UNLIKELY( err ) ) return err;
1445 0 : return FD_BINCODE_SUCCESS;
1446 0 : }
1447 0 : static inline int fd_vote_lockout_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1448 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1449 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
1450 0 : return 0;
1451 0 : }
1452 0 : static void fd_vote_lockout_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1453 0 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)struct_mem;
1454 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1455 0 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
1456 0 : }
1457 0 : void * fd_vote_lockout_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1458 0 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)mem;
1459 0 : fd_vote_lockout_new( self );
1460 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_lockout_t);
1461 0 : void * * alloc_mem = &alloc_region;
1462 0 : fd_vote_lockout_decode_inner( mem, alloc_mem, ctx );
1463 0 : return self;
1464 0 : }
1465 0 : int fd_lockout_offset_encode( fd_lockout_offset_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1466 0 : int err;
1467 0 : err = fd_bincode_varint_encode( self->offset, ctx );
1468 0 : if( FD_UNLIKELY( err ) ) return err;
1469 0 : err = fd_bincode_uint8_encode( (uchar)(self->confirmation_count), ctx );
1470 0 : if( FD_UNLIKELY( err ) ) return err;
1471 0 : return FD_BINCODE_SUCCESS;
1472 0 : }
1473 0 : static int fd_lockout_offset_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1474 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1475 0 : int err = 0;
1476 0 : err = fd_bincode_varint_decode_footprint( ctx );
1477 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1478 0 : err = fd_bincode_uint8_decode_footprint( ctx );
1479 0 : if( FD_UNLIKELY( err ) ) return err;
1480 0 : return 0;
1481 0 : }
1482 0 : int fd_lockout_offset_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1483 0 : *total_sz += sizeof(fd_lockout_offset_t);
1484 0 : void const * start_data = ctx->data;
1485 0 : int err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
1486 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1487 0 : ctx->data = start_data;
1488 0 : return err;
1489 0 : }
1490 0 : static void fd_lockout_offset_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1491 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)struct_mem;
1492 0 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
1493 0 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
1494 0 : }
1495 0 : void * fd_lockout_offset_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1496 0 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)mem;
1497 0 : fd_lockout_offset_new( self );
1498 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockout_offset_t);
1499 0 : void * * alloc_mem = &alloc_region;
1500 0 : fd_lockout_offset_decode_inner( mem, alloc_mem, ctx );
1501 0 : return self;
1502 0 : }
1503 0 : void fd_lockout_offset_new(fd_lockout_offset_t * self) {
1504 0 : fd_memset( self, 0, sizeof(fd_lockout_offset_t) );
1505 0 : }
1506 0 : ulong fd_lockout_offset_size( fd_lockout_offset_t const * self ) {
1507 0 : ulong size = 0;
1508 0 : size += fd_bincode_varint_size( self->offset );
1509 0 : size += sizeof(char);
1510 0 : return size;
1511 0 : }
1512 :
1513 18 : int fd_vote_authorized_voter_encode( fd_vote_authorized_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1514 18 : int err;
1515 18 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1516 18 : if( FD_UNLIKELY( err ) ) return err;
1517 18 : err = fd_pubkey_encode( &self->pubkey, ctx );
1518 18 : if( FD_UNLIKELY( err ) ) return err;
1519 18 : return FD_BINCODE_SUCCESS;
1520 18 : }
1521 0 : static inline int fd_vote_authorized_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1522 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1523 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
1524 0 : return 0;
1525 0 : }
1526 0 : static void fd_vote_authorized_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1527 0 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)struct_mem;
1528 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1529 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1530 0 : }
1531 0 : void * fd_vote_authorized_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1532 0 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)mem;
1533 0 : fd_vote_authorized_voter_new( self );
1534 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voter_t);
1535 0 : void * * alloc_mem = &alloc_region;
1536 0 : fd_vote_authorized_voter_decode_inner( mem, alloc_mem, ctx );
1537 0 : return self;
1538 0 : }
1539 480 : int fd_vote_prior_voter_encode( fd_vote_prior_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1540 480 : int err;
1541 480 : err = fd_pubkey_encode( &self->pubkey, ctx );
1542 480 : if( FD_UNLIKELY( err ) ) return err;
1543 480 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
1544 480 : if( FD_UNLIKELY( err ) ) return err;
1545 480 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
1546 480 : if( FD_UNLIKELY( err ) ) return err;
1547 480 : return FD_BINCODE_SUCCESS;
1548 480 : }
1549 0 : static inline int fd_vote_prior_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1550 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1551 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
1552 0 : return 0;
1553 0 : }
1554 0 : static void fd_vote_prior_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1555 0 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)struct_mem;
1556 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1557 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
1558 0 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
1559 0 : }
1560 0 : void * fd_vote_prior_voter_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1561 0 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)mem;
1562 0 : fd_vote_prior_voter_new( self );
1563 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_t);
1564 0 : void * * alloc_mem = &alloc_region;
1565 0 : fd_vote_prior_voter_decode_inner( mem, alloc_mem, ctx );
1566 0 : return self;
1567 0 : }
1568 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 ) {
1569 0 : int err;
1570 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
1571 0 : if( FD_UNLIKELY( err ) ) return err;
1572 0 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
1573 0 : if( FD_UNLIKELY( err ) ) return err;
1574 0 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
1575 0 : if( FD_UNLIKELY( err ) ) return err;
1576 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
1577 0 : if( FD_UNLIKELY( err ) ) return err;
1578 0 : return FD_BINCODE_SUCCESS;
1579 0 : }
1580 0 : static inline int fd_vote_prior_voter_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1581 0 : if( (ulong)ctx->data + 56UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1582 0 : ctx->data = (void *)( (ulong)ctx->data + 56UL );
1583 0 : return 0;
1584 0 : }
1585 288 : static void fd_vote_prior_voter_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1586 288 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)struct_mem;
1587 288 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1588 288 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
1589 288 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
1590 288 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1591 288 : }
1592 0 : void * fd_vote_prior_voter_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1593 0 : fd_vote_prior_voter_0_23_5_t * self = (fd_vote_prior_voter_0_23_5_t *)mem;
1594 0 : fd_vote_prior_voter_0_23_5_new( self );
1595 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voter_0_23_5_t);
1596 0 : void * * alloc_mem = &alloc_region;
1597 0 : fd_vote_prior_voter_0_23_5_decode_inner( mem, alloc_mem, ctx );
1598 0 : return self;
1599 0 : }
1600 0 : int fd_vote_epoch_credits_encode( fd_vote_epoch_credits_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1601 0 : int err;
1602 0 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1603 0 : if( FD_UNLIKELY( err ) ) return err;
1604 0 : err = fd_bincode_uint64_encode( self->credits, ctx );
1605 0 : if( FD_UNLIKELY( err ) ) return err;
1606 0 : err = fd_bincode_uint64_encode( self->prev_credits, ctx );
1607 0 : if( FD_UNLIKELY( err ) ) return err;
1608 0 : return FD_BINCODE_SUCCESS;
1609 0 : }
1610 0 : static inline int fd_vote_epoch_credits_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1611 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1612 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
1613 0 : return 0;
1614 0 : }
1615 0 : static void fd_vote_epoch_credits_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1616 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)struct_mem;
1617 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1618 0 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
1619 0 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
1620 0 : }
1621 0 : void * fd_vote_epoch_credits_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1622 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)mem;
1623 0 : fd_vote_epoch_credits_new( self );
1624 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_epoch_credits_t);
1625 0 : void * * alloc_mem = &alloc_region;
1626 0 : fd_vote_epoch_credits_decode_inner( mem, alloc_mem, ctx );
1627 0 : return self;
1628 0 : }
1629 18 : int fd_vote_block_timestamp_encode( fd_vote_block_timestamp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1630 18 : int err;
1631 18 : err = fd_bincode_uint64_encode( self->slot, ctx );
1632 18 : if( FD_UNLIKELY( err ) ) return err;
1633 18 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
1634 18 : if( FD_UNLIKELY( err ) ) return err;
1635 18 : return FD_BINCODE_SUCCESS;
1636 18 : }
1637 9 : static inline int fd_vote_block_timestamp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1638 9 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1639 9 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
1640 9 : return 0;
1641 9 : }
1642 9 : static void fd_vote_block_timestamp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1643 9 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)struct_mem;
1644 9 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1645 9 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
1646 9 : }
1647 0 : void * fd_vote_block_timestamp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1648 0 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)mem;
1649 0 : fd_vote_block_timestamp_new( self );
1650 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_block_timestamp_t);
1651 0 : void * * alloc_mem = &alloc_region;
1652 0 : fd_vote_block_timestamp_decode_inner( mem, alloc_mem, ctx );
1653 0 : return self;
1654 0 : }
1655 15 : int fd_vote_prior_voters_encode( fd_vote_prior_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1656 15 : int err;
1657 495 : for( ulong i=0; i<32; i++ ) {
1658 480 : err = fd_vote_prior_voter_encode( self->buf + i, ctx );
1659 480 : if( FD_UNLIKELY( err ) ) return err;
1660 480 : }
1661 15 : err = fd_bincode_uint64_encode( self->idx, ctx );
1662 15 : if( FD_UNLIKELY( err ) ) return err;
1663 15 : err = fd_bincode_bool_encode( (uchar)(self->is_empty), ctx );
1664 15 : if( FD_UNLIKELY( err ) ) return err;
1665 15 : return FD_BINCODE_SUCCESS;
1666 15 : }
1667 0 : static int fd_vote_prior_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1668 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1669 0 : int err = 0;
1670 0 : for( ulong i=0; i<32; i++ ) {
1671 0 : err = fd_vote_prior_voter_decode_footprint_inner( ctx, total_sz );
1672 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1673 0 : }
1674 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1675 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1676 0 : err = fd_bincode_bool_decode_footprint( ctx );
1677 0 : if( FD_UNLIKELY( err ) ) return err;
1678 0 : return 0;
1679 0 : }
1680 0 : int fd_vote_prior_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1681 0 : *total_sz += sizeof(fd_vote_prior_voters_t);
1682 0 : void const * start_data = ctx->data;
1683 0 : int err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
1684 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1685 0 : ctx->data = start_data;
1686 0 : return err;
1687 0 : }
1688 0 : static void fd_vote_prior_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1689 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)struct_mem;
1690 0 : for( ulong i=0; i<32; i++ ) {
1691 0 : fd_vote_prior_voter_decode_inner( self->buf + i, alloc_mem, ctx );
1692 0 : }
1693 0 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
1694 0 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
1695 0 : }
1696 0 : void * fd_vote_prior_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1697 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)mem;
1698 0 : fd_vote_prior_voters_new( self );
1699 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_t);
1700 0 : void * * alloc_mem = &alloc_region;
1701 0 : fd_vote_prior_voters_decode_inner( mem, alloc_mem, ctx );
1702 0 : return self;
1703 0 : }
1704 12 : void fd_vote_prior_voters_new(fd_vote_prior_voters_t * self) {
1705 12 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_t) );
1706 396 : for( ulong i=0; i<32; i++ )
1707 384 : fd_vote_prior_voter_new( self->buf + i );
1708 12 : }
1709 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 ) {
1710 0 : int err;
1711 0 : for( ulong i=0; i<32; i++ ) {
1712 0 : err = fd_vote_prior_voter_0_23_5_encode( self->buf + i, ctx );
1713 0 : if( FD_UNLIKELY( err ) ) return err;
1714 0 : }
1715 0 : err = fd_bincode_uint64_encode( self->idx, ctx );
1716 0 : if( FD_UNLIKELY( err ) ) return err;
1717 0 : return FD_BINCODE_SUCCESS;
1718 0 : }
1719 9 : static inline int fd_vote_prior_voters_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1720 9 : if( (ulong)ctx->data + 1800UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1721 9 : ctx->data = (void *)( (ulong)ctx->data + 1800UL );
1722 9 : return 0;
1723 9 : }
1724 9 : static void fd_vote_prior_voters_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1725 9 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)struct_mem;
1726 297 : for( ulong i=0; i<32; i++ ) {
1727 288 : fd_vote_prior_voter_0_23_5_decode_inner( self->buf + i, alloc_mem, ctx );
1728 288 : }
1729 9 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
1730 9 : }
1731 0 : void * fd_vote_prior_voters_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1732 0 : fd_vote_prior_voters_0_23_5_t * self = (fd_vote_prior_voters_0_23_5_t *)mem;
1733 0 : fd_vote_prior_voters_0_23_5_new( self );
1734 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_0_23_5_t);
1735 0 : void * * alloc_mem = &alloc_region;
1736 0 : fd_vote_prior_voters_0_23_5_decode_inner( mem, alloc_mem, ctx );
1737 0 : return self;
1738 0 : }
1739 0 : int fd_landed_vote_encode( fd_landed_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1740 0 : int err;
1741 0 : err = fd_bincode_uint8_encode( (uchar)(self->latency), ctx );
1742 0 : if( FD_UNLIKELY( err ) ) return err;
1743 0 : err = fd_vote_lockout_encode( &self->lockout, ctx );
1744 0 : if( FD_UNLIKELY( err ) ) return err;
1745 0 : return FD_BINCODE_SUCCESS;
1746 0 : }
1747 0 : static inline int fd_landed_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1748 0 : if( (ulong)ctx->data + 13UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1749 0 : ctx->data = (void *)( (ulong)ctx->data + 13UL );
1750 0 : return 0;
1751 0 : }
1752 0 : static void fd_landed_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1753 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)struct_mem;
1754 0 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
1755 0 : fd_vote_lockout_decode_inner( &self->lockout, alloc_mem, ctx );
1756 0 : }
1757 0 : void * fd_landed_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1758 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)mem;
1759 0 : fd_landed_vote_new( self );
1760 0 : void * alloc_region = (uchar *)mem + sizeof(fd_landed_vote_t);
1761 0 : void * * alloc_mem = &alloc_region;
1762 0 : fd_landed_vote_decode_inner( mem, alloc_mem, ctx );
1763 0 : return self;
1764 0 : }
1765 3 : int fd_bls_pubkey_compressed_encode( fd_bls_pubkey_compressed_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1766 3 : int err;
1767 3 : err = fd_bincode_bytes_encode( self->buf, 48, ctx );
1768 3 : if( FD_UNLIKELY( err ) ) return err;
1769 3 : return FD_BINCODE_SUCCESS;
1770 3 : }
1771 0 : static inline int fd_bls_pubkey_compressed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1772 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1773 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
1774 0 : return 0;
1775 0 : }
1776 9 : static void fd_bls_pubkey_compressed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1777 9 : fd_bls_pubkey_compressed_t * self = (fd_bls_pubkey_compressed_t *)struct_mem;
1778 9 : fd_bincode_bytes_decode_unsafe( self->buf, 48, ctx );
1779 9 : }
1780 0 : void * fd_bls_pubkey_compressed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1781 0 : fd_bls_pubkey_compressed_t * self = (fd_bls_pubkey_compressed_t *)mem;
1782 0 : fd_bls_pubkey_compressed_new( self );
1783 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bls_pubkey_compressed_t);
1784 0 : void * * alloc_mem = &alloc_region;
1785 0 : fd_bls_pubkey_compressed_decode_inner( mem, alloc_mem, ctx );
1786 0 : return self;
1787 0 : }
1788 0 : int fd_bls_proof_of_possession_encode( fd_bls_proof_of_possession_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1789 0 : int err;
1790 0 : err = fd_bincode_bytes_encode( self->buf, 96, ctx );
1791 0 : if( FD_UNLIKELY( err ) ) return err;
1792 0 : return FD_BINCODE_SUCCESS;
1793 0 : }
1794 0 : static inline int fd_bls_proof_of_possession_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1795 0 : if( (ulong)ctx->data + 96UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1796 0 : ctx->data = (void *)( (ulong)ctx->data + 96UL );
1797 0 : return 0;
1798 0 : }
1799 9 : static void fd_bls_proof_of_possession_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1800 9 : fd_bls_proof_of_possession_t * self = (fd_bls_proof_of_possession_t *)struct_mem;
1801 9 : fd_bincode_bytes_decode_unsafe( self->buf, 96, ctx );
1802 9 : }
1803 0 : void * fd_bls_proof_of_possession_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1804 0 : fd_bls_proof_of_possession_t * self = (fd_bls_proof_of_possession_t *)mem;
1805 0 : fd_bls_proof_of_possession_new( self );
1806 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bls_proof_of_possession_t);
1807 0 : void * * alloc_mem = &alloc_region;
1808 0 : fd_bls_proof_of_possession_decode_inner( mem, alloc_mem, ctx );
1809 0 : return self;
1810 0 : }
1811 0 : int fd_vote_state_0_23_5_encode( fd_vote_state_0_23_5_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1812 0 : int err;
1813 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
1814 0 : if( FD_UNLIKELY( err ) ) return err;
1815 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
1816 0 : if( FD_UNLIKELY( err ) ) return err;
1817 0 : err = fd_bincode_uint64_encode( self->authorized_voter_epoch, ctx );
1818 0 : if( FD_UNLIKELY( err ) ) return err;
1819 0 : err = fd_vote_prior_voters_0_23_5_encode( &self->prior_voters, ctx );
1820 0 : if( FD_UNLIKELY( err ) ) return err;
1821 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
1822 0 : if( FD_UNLIKELY( err ) ) return err;
1823 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
1824 0 : if( FD_UNLIKELY( err ) ) return err;
1825 0 : if( self->votes ) {
1826 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
1827 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
1828 0 : if( FD_UNLIKELY( err ) ) return err;
1829 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 ) ) {
1830 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
1831 0 : err = fd_vote_lockout_encode( ele, ctx );
1832 0 : if( FD_UNLIKELY( err ) ) return err;
1833 0 : }
1834 0 : } else {
1835 0 : ulong votes_len = 0;
1836 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
1837 0 : if( FD_UNLIKELY( err ) ) return err;
1838 0 : }
1839 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
1840 0 : if( FD_UNLIKELY( err ) ) return err;
1841 0 : if( self->has_root_slot ) {
1842 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
1843 0 : if( FD_UNLIKELY( err ) ) return err;
1844 0 : }
1845 0 : if( self->epoch_credits ) {
1846 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
1847 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
1848 0 : if( FD_UNLIKELY( err ) ) return err;
1849 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 ) ) {
1850 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
1851 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
1852 0 : if( FD_UNLIKELY( err ) ) return err;
1853 0 : }
1854 0 : } else {
1855 0 : ulong epoch_credits_len = 0;
1856 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
1857 0 : if( FD_UNLIKELY( err ) ) return err;
1858 0 : }
1859 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
1860 0 : if( FD_UNLIKELY( err ) ) return err;
1861 0 : return FD_BINCODE_SUCCESS;
1862 0 : }
1863 9 : static int fd_vote_state_0_23_5_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1864 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1865 9 : int err = 0;
1866 9 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1867 9 : if( FD_UNLIKELY( err ) ) return err;
1868 9 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1869 9 : if( FD_UNLIKELY( err ) ) return err;
1870 9 : err = fd_bincode_uint64_decode_footprint( ctx );
1871 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1872 9 : err = fd_vote_prior_voters_0_23_5_decode_footprint_inner( ctx, total_sz );
1873 9 : if( FD_UNLIKELY( err ) ) return err;
1874 9 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1875 9 : if( FD_UNLIKELY( err ) ) return err;
1876 9 : err = fd_bincode_uint8_decode_footprint( ctx );
1877 9 : if( FD_UNLIKELY( err ) ) return err;
1878 9 : ulong votes_len;
1879 9 : err = fd_bincode_uint64_decode( &votes_len, ctx );
1880 9 : if( FD_UNLIKELY( err ) ) return err;
1881 9 : ulong votes_max = fd_ulong_max( votes_len, 32 );
1882 9 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
1883 9 : ulong votes_sz;
1884 9 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
1885 9 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
1886 9 : if( FD_UNLIKELY( err ) ) return err;
1887 9 : {
1888 9 : uchar o;
1889 9 : err = fd_bincode_bool_decode( &o, ctx );
1890 9 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1891 9 : if( o ) {
1892 0 : err = fd_bincode_uint64_decode_footprint( ctx );
1893 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1894 0 : }
1895 9 : }
1896 9 : ulong epoch_credits_len;
1897 9 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
1898 9 : if( FD_UNLIKELY( err ) ) return err;
1899 9 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
1900 9 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
1901 9 : ulong epoch_credits_sz;
1902 9 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
1903 9 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
1904 9 : if( FD_UNLIKELY( err ) ) return err;
1905 9 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
1906 9 : if( FD_UNLIKELY( err ) ) return err;
1907 9 : return 0;
1908 9 : }
1909 0 : int fd_vote_state_0_23_5_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1910 0 : *total_sz += sizeof(fd_vote_state_0_23_5_t);
1911 0 : void const * start_data = ctx->data;
1912 0 : int err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
1913 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1914 0 : ctx->data = start_data;
1915 0 : return err;
1916 0 : }
1917 9 : static void fd_vote_state_0_23_5_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1918 9 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)struct_mem;
1919 9 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
1920 9 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
1921 9 : fd_bincode_uint64_decode_unsafe( &self->authorized_voter_epoch, ctx );
1922 9 : fd_vote_prior_voters_0_23_5_decode_inner( &self->prior_voters, alloc_mem, ctx );
1923 9 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
1924 9 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
1925 9 : ulong votes_len;
1926 9 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
1927 9 : ulong votes_max = fd_ulong_max( votes_len, 32 );
1928 9 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
1929 9 : for( ulong i=0; i < votes_len; i++ ) {
1930 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
1931 0 : fd_vote_lockout_new( elem );
1932 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
1933 0 : }
1934 9 : {
1935 9 : uchar o;
1936 9 : fd_bincode_bool_decode_unsafe( &o, ctx );
1937 9 : self->has_root_slot = !!o;
1938 9 : if( o ) {
1939 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
1940 0 : }
1941 9 : }
1942 9 : ulong epoch_credits_len;
1943 9 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
1944 9 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
1945 9 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
1946 9 : for( ulong i=0; i < epoch_credits_len; i++ ) {
1947 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
1948 0 : fd_vote_epoch_credits_new( elem );
1949 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
1950 0 : }
1951 9 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
1952 9 : }
1953 0 : void * fd_vote_state_0_23_5_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1954 0 : fd_vote_state_0_23_5_t * self = (fd_vote_state_0_23_5_t *)mem;
1955 0 : fd_vote_state_0_23_5_new( self );
1956 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_0_23_5_t);
1957 0 : void * * alloc_mem = &alloc_region;
1958 0 : fd_vote_state_0_23_5_decode_inner( mem, alloc_mem, ctx );
1959 0 : return self;
1960 0 : }
1961 0 : void fd_vote_state_0_23_5_new(fd_vote_state_0_23_5_t * self) {
1962 0 : fd_memset( self, 0, sizeof(fd_vote_state_0_23_5_t) );
1963 0 : fd_pubkey_new( &self->node_pubkey );
1964 0 : fd_pubkey_new( &self->authorized_voter );
1965 0 : fd_vote_prior_voters_0_23_5_new( &self->prior_voters );
1966 0 : fd_pubkey_new( &self->authorized_withdrawer );
1967 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
1968 0 : }
1969 0 : ulong fd_vote_state_0_23_5_size( fd_vote_state_0_23_5_t const * self ) {
1970 0 : ulong size = 0;
1971 0 : size += fd_pubkey_size( &self->node_pubkey );
1972 0 : size += fd_pubkey_size( &self->authorized_voter );
1973 0 : size += sizeof(ulong);
1974 0 : size += fd_vote_prior_voters_0_23_5_size( &self->prior_voters );
1975 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
1976 0 : size += sizeof(char);
1977 0 : if( self->votes ) {
1978 0 : size += sizeof(ulong);
1979 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 ) ) {
1980 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
1981 0 : size += fd_vote_lockout_size( ele );
1982 0 : }
1983 0 : } else {
1984 0 : size += sizeof(ulong);
1985 0 : }
1986 0 : size += sizeof(char);
1987 0 : if( self->has_root_slot ) {
1988 0 : size += sizeof(ulong);
1989 0 : }
1990 0 : if( self->epoch_credits ) {
1991 0 : size += sizeof(ulong);
1992 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 ) ) {
1993 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
1994 0 : size += fd_vote_epoch_credits_size( ele );
1995 0 : }
1996 0 : } else {
1997 0 : size += sizeof(ulong);
1998 0 : }
1999 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2000 0 : return size;
2001 0 : }
2002 :
2003 18 : int fd_vote_authorized_voters_encode( fd_vote_authorized_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2004 18 : int err;
2005 18 : if( self->treap ) {
2006 18 : ulong fd_vote_authorized_voters_len = fd_vote_authorized_voters_treap_ele_cnt( self->treap );
2007 18 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2008 18 : if( FD_UNLIKELY( err ) ) return err;
2009 18 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2010 36 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2011 18 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2012 18 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2013 18 : err = fd_vote_authorized_voter_encode( ele, ctx );
2014 18 : if( FD_UNLIKELY( err ) ) return err;
2015 18 : }
2016 18 : } else {
2017 0 : ulong fd_vote_authorized_voters_len = 0;
2018 0 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
2019 0 : if( FD_UNLIKELY( err ) ) return err;
2020 0 : }
2021 18 : return FD_BINCODE_SUCCESS;
2022 18 : }
2023 0 : static int fd_vote_authorized_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2024 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2025 0 : int err = 0;
2026 0 : ulong fd_vote_authorized_voters_treap_len;
2027 0 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
2028 0 : if( FD_UNLIKELY( err ) ) return err;
2029 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 );
2030 0 : *total_sz += fd_vote_authorized_voters_pool_align() + fd_vote_authorized_voters_pool_footprint( fd_vote_authorized_voters_treap_max );
2031 0 : *total_sz += fd_vote_authorized_voters_treap_align() + fd_vote_authorized_voters_treap_footprint( fd_vote_authorized_voters_treap_max );
2032 0 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2033 0 : err = fd_vote_authorized_voter_decode_footprint_inner( ctx, total_sz );
2034 0 : if( FD_UNLIKELY ( err ) ) return err;
2035 0 : }
2036 0 : return 0;
2037 0 : }
2038 0 : int fd_vote_authorized_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2039 0 : *total_sz += sizeof(fd_vote_authorized_voters_t);
2040 0 : void const * start_data = ctx->data;
2041 0 : int err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2042 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2043 0 : ctx->data = start_data;
2044 0 : return err;
2045 0 : }
2046 0 : static void fd_vote_authorized_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2047 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)struct_mem;
2048 0 : ulong fd_vote_authorized_voters_treap_len;
2049 0 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
2050 0 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
2051 0 : self->pool = fd_vote_authorized_voters_pool_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2052 0 : self->treap = fd_vote_authorized_voters_treap_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
2053 0 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
2054 0 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( self->pool );
2055 0 : fd_vote_authorized_voter_new( ele );
2056 0 : fd_vote_authorized_voter_decode_inner( ele, alloc_mem, ctx );
2057 0 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( self->treap, ele->epoch, self->pool );
2058 0 : if( repeated_entry ) {
2059 0 : fd_vote_authorized_voters_treap_ele_remove( self->treap, repeated_entry, self->pool ); // Remove the element before inserting it back to avoid duplication
2060 0 : fd_vote_authorized_voters_pool_ele_release( self->pool, repeated_entry );
2061 0 : }
2062 0 : fd_vote_authorized_voters_treap_ele_insert( self->treap, ele, self->pool ); /* this cannot fail */
2063 0 : }
2064 0 : }
2065 0 : void * fd_vote_authorized_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2066 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)mem;
2067 0 : fd_vote_authorized_voters_new( self );
2068 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voters_t);
2069 0 : void * * alloc_mem = &alloc_region;
2070 0 : fd_vote_authorized_voters_decode_inner( mem, alloc_mem, ctx );
2071 0 : return self;
2072 0 : }
2073 12 : void fd_vote_authorized_voters_new(fd_vote_authorized_voters_t * self) {
2074 12 : fd_memset( self, 0, sizeof(fd_vote_authorized_voters_t) );
2075 12 : }
2076 6 : ulong fd_vote_authorized_voters_size( fd_vote_authorized_voters_t const * self ) {
2077 6 : ulong size = 0;
2078 6 : size += sizeof(ulong);
2079 6 : if( self->treap ) {
2080 6 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
2081 12 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
2082 6 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
2083 6 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
2084 6 : size += fd_vote_authorized_voter_size( ele );
2085 6 : }
2086 6 : }
2087 6 : return size;
2088 6 : }
2089 :
2090 0 : int fd_vote_state_1_14_11_encode( fd_vote_state_1_14_11_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2091 0 : int err;
2092 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2093 0 : if( FD_UNLIKELY( err ) ) return err;
2094 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2095 0 : if( FD_UNLIKELY( err ) ) return err;
2096 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2097 0 : if( FD_UNLIKELY( err ) ) return err;
2098 0 : if( self->votes ) {
2099 0 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
2100 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2101 0 : if( FD_UNLIKELY( err ) ) return err;
2102 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 ) ) {
2103 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
2104 0 : err = fd_vote_lockout_encode( ele, ctx );
2105 0 : if( FD_UNLIKELY( err ) ) return err;
2106 0 : }
2107 0 : } else {
2108 0 : ulong votes_len = 0;
2109 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2110 0 : if( FD_UNLIKELY( err ) ) return err;
2111 0 : }
2112 0 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2113 0 : if( FD_UNLIKELY( err ) ) return err;
2114 0 : if( self->has_root_slot ) {
2115 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2116 0 : if( FD_UNLIKELY( err ) ) return err;
2117 0 : }
2118 0 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2119 0 : if( FD_UNLIKELY( err ) ) return err;
2120 0 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
2121 0 : if( FD_UNLIKELY( err ) ) return err;
2122 0 : if( self->epoch_credits ) {
2123 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2124 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2125 0 : if( FD_UNLIKELY( err ) ) return err;
2126 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 ) ) {
2127 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2128 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2129 0 : if( FD_UNLIKELY( err ) ) return err;
2130 0 : }
2131 0 : } else {
2132 0 : ulong epoch_credits_len = 0;
2133 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2134 0 : if( FD_UNLIKELY( err ) ) return err;
2135 0 : }
2136 0 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2137 0 : if( FD_UNLIKELY( err ) ) return err;
2138 0 : return FD_BINCODE_SUCCESS;
2139 0 : }
2140 0 : static int fd_vote_state_1_14_11_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2141 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2142 0 : int err = 0;
2143 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2144 0 : if( FD_UNLIKELY( err ) ) return err;
2145 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2146 0 : if( FD_UNLIKELY( err ) ) return err;
2147 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2148 0 : if( FD_UNLIKELY( err ) ) return err;
2149 0 : ulong votes_len;
2150 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2151 0 : if( FD_UNLIKELY( err ) ) return err;
2152 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2153 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
2154 0 : ulong votes_sz;
2155 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2156 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2157 0 : if( FD_UNLIKELY( err ) ) return err;
2158 0 : {
2159 0 : uchar o;
2160 0 : err = fd_bincode_bool_decode( &o, ctx );
2161 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2162 0 : if( o ) {
2163 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2164 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2165 0 : }
2166 0 : }
2167 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2168 0 : if( FD_UNLIKELY( err ) ) return err;
2169 0 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2170 0 : if( FD_UNLIKELY( err ) ) return err;
2171 0 : ulong epoch_credits_len;
2172 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2173 0 : if( FD_UNLIKELY( err ) ) return err;
2174 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2175 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2176 0 : ulong epoch_credits_sz;
2177 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2178 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2179 0 : if( FD_UNLIKELY( err ) ) return err;
2180 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2181 0 : if( FD_UNLIKELY( err ) ) return err;
2182 0 : return 0;
2183 0 : }
2184 0 : int fd_vote_state_1_14_11_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2185 0 : *total_sz += sizeof(fd_vote_state_1_14_11_t);
2186 0 : void const * start_data = ctx->data;
2187 0 : int err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
2188 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2189 0 : ctx->data = start_data;
2190 0 : return err;
2191 0 : }
2192 0 : static void fd_vote_state_1_14_11_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2193 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)struct_mem;
2194 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2195 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2196 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2197 0 : ulong votes_len;
2198 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2199 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2200 0 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
2201 0 : for( ulong i=0; i < votes_len; i++ ) {
2202 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
2203 0 : fd_vote_lockout_new( elem );
2204 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
2205 0 : }
2206 0 : {
2207 0 : uchar o;
2208 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2209 0 : self->has_root_slot = !!o;
2210 0 : if( o ) {
2211 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2212 0 : }
2213 0 : }
2214 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2215 0 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
2216 0 : ulong epoch_credits_len;
2217 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2218 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2219 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2220 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2221 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2222 0 : fd_vote_epoch_credits_new( elem );
2223 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2224 0 : }
2225 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2226 0 : }
2227 0 : void * fd_vote_state_1_14_11_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2228 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)mem;
2229 0 : fd_vote_state_1_14_11_new( self );
2230 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_1_14_11_t);
2231 0 : void * * alloc_mem = &alloc_region;
2232 0 : fd_vote_state_1_14_11_decode_inner( mem, alloc_mem, ctx );
2233 0 : return self;
2234 0 : }
2235 0 : void fd_vote_state_1_14_11_new(fd_vote_state_1_14_11_t * self) {
2236 0 : fd_memset( self, 0, sizeof(fd_vote_state_1_14_11_t) );
2237 0 : fd_pubkey_new( &self->node_pubkey );
2238 0 : fd_pubkey_new( &self->authorized_withdrawer );
2239 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
2240 0 : fd_vote_prior_voters_new( &self->prior_voters );
2241 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2242 0 : }
2243 0 : ulong fd_vote_state_1_14_11_size( fd_vote_state_1_14_11_t const * self ) {
2244 0 : ulong size = 0;
2245 0 : size += fd_pubkey_size( &self->node_pubkey );
2246 0 : size += fd_pubkey_size( &self->authorized_withdrawer );
2247 0 : size += sizeof(char);
2248 0 : if( self->votes ) {
2249 0 : size += sizeof(ulong);
2250 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 ) ) {
2251 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
2252 0 : size += fd_vote_lockout_size( ele );
2253 0 : }
2254 0 : } else {
2255 0 : size += sizeof(ulong);
2256 0 : }
2257 0 : size += sizeof(char);
2258 0 : if( self->has_root_slot ) {
2259 0 : size += sizeof(ulong);
2260 0 : }
2261 0 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2262 0 : size += fd_vote_prior_voters_size( &self->prior_voters );
2263 0 : if( self->epoch_credits ) {
2264 0 : size += sizeof(ulong);
2265 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 ) ) {
2266 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2267 0 : size += fd_vote_epoch_credits_size( ele );
2268 0 : }
2269 0 : } else {
2270 0 : size += sizeof(ulong);
2271 0 : }
2272 0 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2273 0 : return size;
2274 0 : }
2275 :
2276 15 : int fd_vote_state_v3_encode( fd_vote_state_v3_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2277 15 : int err;
2278 15 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2279 15 : if( FD_UNLIKELY( err ) ) return err;
2280 15 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2281 15 : if( FD_UNLIKELY( err ) ) return err;
2282 15 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2283 15 : if( FD_UNLIKELY( err ) ) return err;
2284 15 : if( self->votes ) {
2285 0 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
2286 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2287 0 : if( FD_UNLIKELY( err ) ) return err;
2288 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 ) ) {
2289 0 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
2290 0 : err = fd_landed_vote_encode( ele, ctx );
2291 0 : if( FD_UNLIKELY( err ) ) return err;
2292 0 : }
2293 15 : } else {
2294 15 : ulong votes_len = 0;
2295 15 : err = fd_bincode_uint64_encode( votes_len, ctx );
2296 15 : if( FD_UNLIKELY( err ) ) return err;
2297 15 : }
2298 15 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2299 15 : if( FD_UNLIKELY( err ) ) return err;
2300 15 : if( self->has_root_slot ) {
2301 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2302 0 : if( FD_UNLIKELY( err ) ) return err;
2303 0 : }
2304 15 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2305 15 : if( FD_UNLIKELY( err ) ) return err;
2306 15 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
2307 15 : if( FD_UNLIKELY( err ) ) return err;
2308 15 : if( self->epoch_credits ) {
2309 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2310 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2311 0 : if( FD_UNLIKELY( err ) ) return err;
2312 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 ) ) {
2313 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2314 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2315 0 : if( FD_UNLIKELY( err ) ) return err;
2316 0 : }
2317 15 : } else {
2318 15 : ulong epoch_credits_len = 0;
2319 15 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2320 15 : if( FD_UNLIKELY( err ) ) return err;
2321 15 : }
2322 15 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2323 15 : if( FD_UNLIKELY( err ) ) return err;
2324 15 : return FD_BINCODE_SUCCESS;
2325 15 : }
2326 0 : static int fd_vote_state_v3_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2327 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2328 0 : int err = 0;
2329 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2330 0 : if( FD_UNLIKELY( err ) ) return err;
2331 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2332 0 : if( FD_UNLIKELY( err ) ) return err;
2333 0 : err = fd_bincode_uint8_decode_footprint( ctx );
2334 0 : if( FD_UNLIKELY( err ) ) return err;
2335 0 : ulong votes_len;
2336 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2337 0 : if( FD_UNLIKELY( err ) ) return err;
2338 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2339 0 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
2340 0 : ulong votes_sz;
2341 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2342 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2343 0 : if( FD_UNLIKELY( err ) ) return err;
2344 0 : {
2345 0 : uchar o;
2346 0 : err = fd_bincode_bool_decode( &o, ctx );
2347 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2348 0 : if( o ) {
2349 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2350 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2351 0 : }
2352 0 : }
2353 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2354 0 : if( FD_UNLIKELY( err ) ) return err;
2355 0 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2356 0 : if( FD_UNLIKELY( err ) ) return err;
2357 0 : ulong epoch_credits_len;
2358 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2359 0 : if( FD_UNLIKELY( err ) ) return err;
2360 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2361 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2362 0 : ulong epoch_credits_sz;
2363 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2364 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2365 0 : if( FD_UNLIKELY( err ) ) return err;
2366 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2367 0 : if( FD_UNLIKELY( err ) ) return err;
2368 0 : return 0;
2369 0 : }
2370 0 : int fd_vote_state_v3_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2371 0 : *total_sz += sizeof(fd_vote_state_v3_t);
2372 0 : void const * start_data = ctx->data;
2373 0 : int err = fd_vote_state_v3_decode_footprint_inner( ctx, total_sz );
2374 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2375 0 : ctx->data = start_data;
2376 0 : return err;
2377 0 : }
2378 0 : static void fd_vote_state_v3_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2379 0 : fd_vote_state_v3_t * self = (fd_vote_state_v3_t *)struct_mem;
2380 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2381 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2382 0 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2383 0 : ulong votes_len;
2384 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2385 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2386 0 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
2387 0 : for( ulong i=0; i < votes_len; i++ ) {
2388 0 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
2389 0 : fd_landed_vote_new( elem );
2390 0 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
2391 0 : }
2392 0 : {
2393 0 : uchar o;
2394 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2395 0 : self->has_root_slot = !!o;
2396 0 : if( o ) {
2397 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2398 0 : }
2399 0 : }
2400 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2401 0 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
2402 0 : ulong epoch_credits_len;
2403 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2404 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2405 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2406 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2407 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2408 0 : fd_vote_epoch_credits_new( elem );
2409 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2410 0 : }
2411 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2412 0 : }
2413 0 : void * fd_vote_state_v3_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2414 0 : fd_vote_state_v3_t * self = (fd_vote_state_v3_t *)mem;
2415 0 : fd_vote_state_v3_new( self );
2416 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_v3_t);
2417 0 : void * * alloc_mem = &alloc_region;
2418 0 : fd_vote_state_v3_decode_inner( mem, alloc_mem, ctx );
2419 0 : return self;
2420 0 : }
2421 12 : void fd_vote_state_v3_new(fd_vote_state_v3_t * self) {
2422 12 : fd_memset( self, 0, sizeof(fd_vote_state_v3_t) );
2423 12 : fd_pubkey_new( &self->node_pubkey );
2424 12 : fd_pubkey_new( &self->authorized_withdrawer );
2425 12 : fd_vote_authorized_voters_new( &self->authorized_voters );
2426 12 : fd_vote_prior_voters_new( &self->prior_voters );
2427 12 : fd_vote_block_timestamp_new( &self->last_timestamp );
2428 12 : }
2429 3 : ulong fd_vote_state_v3_size( fd_vote_state_v3_t const * self ) {
2430 3 : ulong size = 0;
2431 3 : size += fd_pubkey_size( &self->node_pubkey );
2432 3 : size += fd_pubkey_size( &self->authorized_withdrawer );
2433 3 : size += sizeof(char);
2434 3 : if( self->votes ) {
2435 0 : size += sizeof(ulong);
2436 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 ) ) {
2437 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
2438 0 : size += fd_landed_vote_size( ele );
2439 0 : }
2440 3 : } else {
2441 3 : size += sizeof(ulong);
2442 3 : }
2443 3 : size += sizeof(char);
2444 3 : if( self->has_root_slot ) {
2445 0 : size += sizeof(ulong);
2446 0 : }
2447 3 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2448 3 : size += fd_vote_prior_voters_size( &self->prior_voters );
2449 3 : if( self->epoch_credits ) {
2450 0 : size += sizeof(ulong);
2451 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 ) ) {
2452 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2453 0 : size += fd_vote_epoch_credits_size( ele );
2454 0 : }
2455 3 : } else {
2456 3 : size += sizeof(ulong);
2457 3 : }
2458 3 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2459 3 : return size;
2460 3 : }
2461 :
2462 3 : int fd_vote_state_v4_encode( fd_vote_state_v4_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2463 3 : int err;
2464 3 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2465 3 : if( FD_UNLIKELY( err ) ) return err;
2466 3 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2467 3 : if( FD_UNLIKELY( err ) ) return err;
2468 3 : err = fd_pubkey_encode( &self->inflation_rewards_collector, ctx );
2469 3 : if( FD_UNLIKELY( err ) ) return err;
2470 3 : err = fd_pubkey_encode( &self->block_revenue_collector, ctx );
2471 3 : if( FD_UNLIKELY( err ) ) return err;
2472 3 : err = fd_bincode_uint16_encode( self->inflation_rewards_commission_bps, ctx );
2473 3 : if( FD_UNLIKELY( err ) ) return err;
2474 3 : err = fd_bincode_uint16_encode( self->block_revenue_commission_bps, ctx );
2475 3 : if( FD_UNLIKELY( err ) ) return err;
2476 3 : err = fd_bincode_uint64_encode( self->pending_delegator_rewards, ctx );
2477 3 : if( FD_UNLIKELY( err ) ) return err;
2478 3 : err = fd_bincode_bool_encode( self->has_bls_pubkey_compressed, ctx );
2479 3 : if( FD_UNLIKELY( err ) ) return err;
2480 3 : if( self->has_bls_pubkey_compressed ) {
2481 3 : err = fd_bls_pubkey_compressed_encode( &self->bls_pubkey_compressed, ctx );
2482 3 : if( FD_UNLIKELY( err ) ) return err;
2483 3 : }
2484 3 : if( self->votes ) {
2485 0 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
2486 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
2487 0 : if( FD_UNLIKELY( err ) ) return err;
2488 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 ) ) {
2489 0 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
2490 0 : err = fd_landed_vote_encode( ele, ctx );
2491 0 : if( FD_UNLIKELY( err ) ) return err;
2492 0 : }
2493 3 : } else {
2494 3 : ulong votes_len = 0;
2495 3 : err = fd_bincode_uint64_encode( votes_len, ctx );
2496 3 : if( FD_UNLIKELY( err ) ) return err;
2497 3 : }
2498 3 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2499 3 : if( FD_UNLIKELY( err ) ) return err;
2500 3 : if( self->has_root_slot ) {
2501 0 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2502 0 : if( FD_UNLIKELY( err ) ) return err;
2503 0 : }
2504 3 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2505 3 : if( FD_UNLIKELY( err ) ) return err;
2506 3 : if( self->epoch_credits ) {
2507 0 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2508 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2509 0 : if( FD_UNLIKELY( err ) ) return err;
2510 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 ) ) {
2511 0 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2512 0 : err = fd_vote_epoch_credits_encode( ele, ctx );
2513 0 : if( FD_UNLIKELY( err ) ) return err;
2514 0 : }
2515 3 : } else {
2516 3 : ulong epoch_credits_len = 0;
2517 3 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2518 3 : if( FD_UNLIKELY( err ) ) return err;
2519 3 : }
2520 3 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2521 3 : if( FD_UNLIKELY( err ) ) return err;
2522 3 : return FD_BINCODE_SUCCESS;
2523 3 : }
2524 0 : static int fd_vote_state_v4_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2525 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2526 0 : int err = 0;
2527 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2528 0 : if( FD_UNLIKELY( err ) ) return err;
2529 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2530 0 : if( FD_UNLIKELY( err ) ) return err;
2531 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2532 0 : if( FD_UNLIKELY( err ) ) return err;
2533 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2534 0 : if( FD_UNLIKELY( err ) ) return err;
2535 0 : err = fd_bincode_uint16_decode_footprint( ctx );
2536 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2537 0 : err = fd_bincode_uint16_decode_footprint( ctx );
2538 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2539 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2540 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2541 0 : {
2542 0 : uchar o;
2543 0 : err = fd_bincode_bool_decode( &o, ctx );
2544 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2545 0 : if( o ) {
2546 0 : err = fd_bls_pubkey_compressed_decode_footprint_inner( ctx, total_sz );
2547 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2548 0 : }
2549 0 : }
2550 0 : ulong votes_len;
2551 0 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2552 0 : if( FD_UNLIKELY( err ) ) return err;
2553 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2554 0 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
2555 0 : ulong votes_sz;
2556 0 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2557 0 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2558 0 : if( FD_UNLIKELY( err ) ) return err;
2559 0 : {
2560 0 : uchar o;
2561 0 : err = fd_bincode_bool_decode( &o, ctx );
2562 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2563 0 : if( o ) {
2564 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2565 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2566 0 : }
2567 0 : }
2568 0 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2569 0 : if( FD_UNLIKELY( err ) ) return err;
2570 0 : ulong epoch_credits_len;
2571 0 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2572 0 : if( FD_UNLIKELY( err ) ) return err;
2573 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2574 0 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2575 0 : ulong epoch_credits_sz;
2576 0 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2577 0 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2578 0 : if( FD_UNLIKELY( err ) ) return err;
2579 0 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2580 0 : if( FD_UNLIKELY( err ) ) return err;
2581 0 : return 0;
2582 0 : }
2583 0 : int fd_vote_state_v4_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2584 0 : *total_sz += sizeof(fd_vote_state_v4_t);
2585 0 : void const * start_data = ctx->data;
2586 0 : int err = fd_vote_state_v4_decode_footprint_inner( ctx, total_sz );
2587 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2588 0 : ctx->data = start_data;
2589 0 : return err;
2590 0 : }
2591 0 : static void fd_vote_state_v4_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2592 0 : fd_vote_state_v4_t * self = (fd_vote_state_v4_t *)struct_mem;
2593 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2594 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2595 0 : fd_pubkey_decode_inner( &self->inflation_rewards_collector, alloc_mem, ctx );
2596 0 : fd_pubkey_decode_inner( &self->block_revenue_collector, alloc_mem, ctx );
2597 0 : fd_bincode_uint16_decode_unsafe( &self->inflation_rewards_commission_bps, ctx );
2598 0 : fd_bincode_uint16_decode_unsafe( &self->block_revenue_commission_bps, ctx );
2599 0 : fd_bincode_uint64_decode_unsafe( &self->pending_delegator_rewards, ctx );
2600 0 : {
2601 0 : uchar o;
2602 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2603 0 : self->has_bls_pubkey_compressed = !!o;
2604 0 : if( o ) {
2605 0 : fd_bls_pubkey_compressed_new( &self->bls_pubkey_compressed );
2606 0 : fd_bls_pubkey_compressed_decode_inner( &self->bls_pubkey_compressed, alloc_mem, ctx );
2607 0 : }
2608 0 : }
2609 0 : ulong votes_len;
2610 0 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2611 0 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2612 0 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
2613 0 : for( ulong i=0; i < votes_len; i++ ) {
2614 0 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
2615 0 : fd_landed_vote_new( elem );
2616 0 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
2617 0 : }
2618 0 : {
2619 0 : uchar o;
2620 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2621 0 : self->has_root_slot = !!o;
2622 0 : if( o ) {
2623 0 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2624 0 : }
2625 0 : }
2626 0 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2627 0 : ulong epoch_credits_len;
2628 0 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2629 0 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2630 0 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2631 0 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2632 0 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2633 0 : fd_vote_epoch_credits_new( elem );
2634 0 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2635 0 : }
2636 0 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2637 0 : }
2638 0 : void * fd_vote_state_v4_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2639 0 : fd_vote_state_v4_t * self = (fd_vote_state_v4_t *)mem;
2640 0 : fd_vote_state_v4_new( self );
2641 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_v4_t);
2642 0 : void * * alloc_mem = &alloc_region;
2643 0 : fd_vote_state_v4_decode_inner( mem, alloc_mem, ctx );
2644 0 : return self;
2645 0 : }
2646 0 : void fd_vote_state_v4_new(fd_vote_state_v4_t * self) {
2647 0 : fd_memset( self, 0, sizeof(fd_vote_state_v4_t) );
2648 0 : fd_pubkey_new( &self->node_pubkey );
2649 0 : fd_pubkey_new( &self->authorized_withdrawer );
2650 0 : fd_pubkey_new( &self->inflation_rewards_collector );
2651 0 : fd_pubkey_new( &self->block_revenue_collector );
2652 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
2653 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2654 0 : }
2655 3 : ulong fd_vote_state_v4_size( fd_vote_state_v4_t const * self ) {
2656 3 : ulong size = 0;
2657 3 : size += fd_pubkey_size( &self->node_pubkey );
2658 3 : size += fd_pubkey_size( &self->authorized_withdrawer );
2659 3 : size += fd_pubkey_size( &self->inflation_rewards_collector );
2660 3 : size += fd_pubkey_size( &self->block_revenue_collector );
2661 3 : size += sizeof(ushort);
2662 3 : size += sizeof(ushort);
2663 3 : size += sizeof(ulong);
2664 3 : size += sizeof(char);
2665 3 : if( self->has_bls_pubkey_compressed ) {
2666 3 : size += fd_bls_pubkey_compressed_size( &self->bls_pubkey_compressed );
2667 3 : }
2668 3 : if( self->votes ) {
2669 0 : size += sizeof(ulong);
2670 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 ) ) {
2671 0 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
2672 0 : size += fd_landed_vote_size( ele );
2673 0 : }
2674 3 : } else {
2675 3 : size += sizeof(ulong);
2676 3 : }
2677 3 : size += sizeof(char);
2678 3 : if( self->has_root_slot ) {
2679 0 : size += sizeof(ulong);
2680 0 : }
2681 3 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2682 3 : if( self->epoch_credits ) {
2683 0 : size += sizeof(ulong);
2684 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 ) ) {
2685 0 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2686 0 : size += fd_vote_epoch_credits_size( ele );
2687 0 : }
2688 3 : } else {
2689 3 : size += sizeof(ulong);
2690 3 : }
2691 3 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2692 3 : return size;
2693 3 : }
2694 :
2695 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v0_23_5(fd_vote_state_versioned_t const * self) {
2696 0 : return self->discriminant == 0;
2697 0 : }
2698 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v1_14_11(fd_vote_state_versioned_t const * self) {
2699 0 : return self->discriminant == 1;
2700 0 : }
2701 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v3(fd_vote_state_versioned_t const * self) {
2702 0 : return self->discriminant == 2;
2703 0 : }
2704 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v4(fd_vote_state_versioned_t const * self) {
2705 0 : return self->discriminant == 3;
2706 0 : }
2707 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant );
2708 9 : int fd_vote_state_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2709 9 : int err;
2710 9 : switch (discriminant) {
2711 9 : case 0: {
2712 9 : err = fd_vote_state_0_23_5_decode_footprint_inner( ctx, total_sz );
2713 9 : if( FD_UNLIKELY( err ) ) return err;
2714 9 : return FD_BINCODE_SUCCESS;
2715 9 : }
2716 0 : case 1: {
2717 0 : err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
2718 0 : if( FD_UNLIKELY( err ) ) return err;
2719 0 : return FD_BINCODE_SUCCESS;
2720 0 : }
2721 0 : case 2: {
2722 0 : err = fd_vote_state_v3_decode_footprint_inner( ctx, total_sz );
2723 0 : if( FD_UNLIKELY( err ) ) return err;
2724 0 : return FD_BINCODE_SUCCESS;
2725 0 : }
2726 0 : case 3: {
2727 0 : err = fd_vote_state_v4_decode_footprint_inner( ctx, total_sz );
2728 0 : if( FD_UNLIKELY( err ) ) return err;
2729 0 : return FD_BINCODE_SUCCESS;
2730 0 : }
2731 0 : default: return FD_BINCODE_ERR_ENCODING;
2732 9 : }
2733 9 : }
2734 9 : static int fd_vote_state_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2735 9 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2736 9 : uint discriminant = 0;
2737 9 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
2738 9 : if( FD_UNLIKELY( err ) ) return err;
2739 9 : return fd_vote_state_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
2740 9 : }
2741 9 : int fd_vote_state_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2742 9 : *total_sz += sizeof(fd_vote_state_versioned_t);
2743 9 : void const * start_data = ctx->data;
2744 9 : int err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
2745 9 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2746 9 : ctx->data = start_data;
2747 9 : return err;
2748 9 : }
2749 9 : 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 ) {
2750 9 : switch (discriminant) {
2751 9 : case 0: {
2752 9 : fd_vote_state_0_23_5_decode_inner( &self->v0_23_5, alloc_mem, ctx );
2753 9 : break;
2754 0 : }
2755 0 : case 1: {
2756 0 : fd_vote_state_1_14_11_decode_inner( &self->v1_14_11, alloc_mem, ctx );
2757 0 : break;
2758 0 : }
2759 0 : case 2: {
2760 0 : fd_vote_state_v3_decode_inner( &self->v3, alloc_mem, ctx );
2761 0 : break;
2762 0 : }
2763 0 : case 3: {
2764 0 : fd_vote_state_v4_decode_inner( &self->v4, alloc_mem, ctx );
2765 0 : break;
2766 0 : }
2767 9 : }
2768 9 : }
2769 9 : static void fd_vote_state_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2770 9 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)struct_mem;
2771 9 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
2772 9 : fd_vote_state_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
2773 9 : }
2774 9 : void * fd_vote_state_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2775 9 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)mem;
2776 9 : fd_vote_state_versioned_new( self );
2777 9 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_versioned_t);
2778 9 : void * * alloc_mem = &alloc_region;
2779 9 : fd_vote_state_versioned_decode_inner( mem, alloc_mem, ctx );
2780 9 : return self;
2781 9 : }
2782 27 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
2783 27 : switch( discriminant ) {
2784 0 : case 0: {
2785 0 : fd_vote_state_0_23_5_new( &self->v0_23_5 );
2786 0 : break;
2787 0 : }
2788 0 : case 1: {
2789 0 : fd_vote_state_1_14_11_new( &self->v1_14_11 );
2790 0 : break;
2791 0 : }
2792 12 : case 2: {
2793 12 : fd_vote_state_v3_new( &self->v3 );
2794 12 : break;
2795 0 : }
2796 0 : case 3: {
2797 0 : fd_vote_state_v4_new( &self->v4 );
2798 0 : break;
2799 0 : }
2800 15 : default: break; // FD_LOG_ERR(( "unhandled type"));
2801 27 : }
2802 27 : }
2803 27 : void fd_vote_state_versioned_new_disc( fd_vote_state_versioned_t * self, uint discriminant ) {
2804 27 : self->discriminant = discriminant;
2805 27 : fd_vote_state_versioned_inner_new( &self->inner, self->discriminant );
2806 27 : }
2807 15 : void fd_vote_state_versioned_new( fd_vote_state_versioned_t * self ) {
2808 15 : fd_memset( self, 0, sizeof(fd_vote_state_versioned_t) );
2809 15 : fd_vote_state_versioned_new_disc( self, UINT_MAX );
2810 15 : }
2811 :
2812 6 : ulong fd_vote_state_versioned_size( fd_vote_state_versioned_t const * self ) {
2813 6 : ulong size = 0;
2814 6 : size += sizeof(uint);
2815 6 : switch (self->discriminant) {
2816 0 : case 0: {
2817 0 : size += fd_vote_state_0_23_5_size( &self->inner.v0_23_5 );
2818 0 : break;
2819 0 : }
2820 0 : case 1: {
2821 0 : size += fd_vote_state_1_14_11_size( &self->inner.v1_14_11 );
2822 0 : break;
2823 0 : }
2824 3 : case 2: {
2825 3 : size += fd_vote_state_v3_size( &self->inner.v3 );
2826 3 : break;
2827 0 : }
2828 3 : case 3: {
2829 3 : size += fd_vote_state_v4_size( &self->inner.v4 );
2830 3 : break;
2831 0 : }
2832 6 : }
2833 6 : return size;
2834 6 : }
2835 :
2836 18 : int fd_vote_state_versioned_inner_encode( fd_vote_state_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
2837 18 : int err;
2838 18 : switch (discriminant) {
2839 0 : case 0: {
2840 0 : err = fd_vote_state_0_23_5_encode( &self->v0_23_5, ctx );
2841 0 : if( FD_UNLIKELY( err ) ) return err;
2842 0 : break;
2843 0 : }
2844 0 : case 1: {
2845 0 : err = fd_vote_state_1_14_11_encode( &self->v1_14_11, ctx );
2846 0 : if( FD_UNLIKELY( err ) ) return err;
2847 0 : break;
2848 0 : }
2849 15 : case 2: {
2850 15 : err = fd_vote_state_v3_encode( &self->v3, ctx );
2851 15 : if( FD_UNLIKELY( err ) ) return err;
2852 15 : break;
2853 15 : }
2854 15 : case 3: {
2855 3 : err = fd_vote_state_v4_encode( &self->v4, ctx );
2856 3 : if( FD_UNLIKELY( err ) ) return err;
2857 3 : break;
2858 3 : }
2859 18 : }
2860 18 : return FD_BINCODE_SUCCESS;
2861 18 : }
2862 18 : int fd_vote_state_versioned_encode( fd_vote_state_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2863 18 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
2864 18 : if( FD_UNLIKELY( err ) ) return err;
2865 18 : return fd_vote_state_versioned_inner_encode( &self->inner, self->discriminant, ctx );
2866 18 : }
2867 :
2868 0 : int fd_vote_state_update_encode( fd_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2869 0 : int err;
2870 0 : if( self->lockouts ) {
2871 0 : ulong lockouts_len = deq_fd_vote_lockout_t_cnt( self->lockouts );
2872 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
2873 0 : if( FD_UNLIKELY( err ) ) return err;
2874 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 ) ) {
2875 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->lockouts, iter );
2876 0 : err = fd_vote_lockout_encode( ele, ctx );
2877 0 : if( FD_UNLIKELY( err ) ) return err;
2878 0 : }
2879 0 : } else {
2880 0 : ulong lockouts_len = 0;
2881 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
2882 0 : if( FD_UNLIKELY( err ) ) return err;
2883 0 : }
2884 0 : err = fd_bincode_bool_encode( self->has_root, ctx );
2885 0 : if( FD_UNLIKELY( err ) ) return err;
2886 0 : if( self->has_root ) {
2887 0 : err = fd_bincode_uint64_encode( self->root, ctx );
2888 0 : if( FD_UNLIKELY( err ) ) return err;
2889 0 : }
2890 0 : err = fd_hash_encode( &self->hash, ctx );
2891 0 : if( FD_UNLIKELY( err ) ) return err;
2892 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
2893 0 : if( FD_UNLIKELY( err ) ) return err;
2894 0 : if( self->has_timestamp ) {
2895 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
2896 0 : if( FD_UNLIKELY( err ) ) return err;
2897 0 : }
2898 0 : return FD_BINCODE_SUCCESS;
2899 0 : }
2900 0 : static int fd_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2901 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2902 0 : int err = 0;
2903 0 : ulong lockouts_len;
2904 0 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
2905 0 : if( FD_UNLIKELY( err ) ) return err;
2906 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
2907 0 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( lockouts_max );
2908 0 : ulong lockouts_sz;
2909 0 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2910 0 : err = fd_bincode_bytes_decode_footprint( lockouts_sz, ctx );
2911 0 : if( FD_UNLIKELY( err ) ) return err;
2912 0 : {
2913 0 : uchar o;
2914 0 : err = fd_bincode_bool_decode( &o, ctx );
2915 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2916 0 : if( o ) {
2917 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2918 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2919 0 : }
2920 0 : }
2921 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
2922 0 : if( FD_UNLIKELY( err ) ) return err;
2923 0 : {
2924 0 : uchar o;
2925 0 : err = fd_bincode_bool_decode( &o, ctx );
2926 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2927 0 : if( o ) {
2928 0 : err = fd_bincode_int64_decode_footprint( ctx );
2929 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2930 0 : }
2931 0 : }
2932 0 : return 0;
2933 0 : }
2934 0 : int fd_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2935 0 : *total_sz += sizeof(fd_vote_state_update_t);
2936 0 : void const * start_data = ctx->data;
2937 0 : int err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
2938 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2939 0 : ctx->data = start_data;
2940 0 : return err;
2941 0 : }
2942 0 : static void fd_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2943 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)struct_mem;
2944 0 : ulong lockouts_len;
2945 0 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
2946 0 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
2947 0 : self->lockouts = deq_fd_vote_lockout_t_join_new( alloc_mem, lockouts_max );
2948 0 : for( ulong i=0; i < lockouts_len; i++ ) {
2949 0 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->lockouts );
2950 0 : fd_vote_lockout_new( elem );
2951 0 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
2952 0 : }
2953 0 : {
2954 0 : uchar o;
2955 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2956 0 : self->has_root = !!o;
2957 0 : if( o ) {
2958 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
2959 0 : }
2960 0 : }
2961 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
2962 0 : {
2963 0 : uchar o;
2964 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2965 0 : self->has_timestamp = !!o;
2966 0 : if( o ) {
2967 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
2968 0 : }
2969 0 : }
2970 0 : }
2971 0 : void * fd_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2972 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)mem;
2973 0 : fd_vote_state_update_new( self );
2974 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_update_t);
2975 0 : void * * alloc_mem = &alloc_region;
2976 0 : fd_vote_state_update_decode_inner( mem, alloc_mem, ctx );
2977 0 : return self;
2978 0 : }
2979 0 : void fd_vote_state_update_new(fd_vote_state_update_t * self) {
2980 0 : fd_memset( self, 0, sizeof(fd_vote_state_update_t) );
2981 0 : fd_hash_new( &self->hash );
2982 0 : }
2983 0 : ulong fd_vote_state_update_size( fd_vote_state_update_t const * self ) {
2984 0 : ulong size = 0;
2985 0 : if( self->lockouts ) {
2986 0 : size += sizeof(ulong);
2987 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 ) ) {
2988 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
2989 0 : size += fd_vote_lockout_size( ele );
2990 0 : }
2991 0 : } else {
2992 0 : size += sizeof(ulong);
2993 0 : }
2994 0 : size += sizeof(char);
2995 0 : if( self->has_root ) {
2996 0 : size += sizeof(ulong);
2997 0 : }
2998 0 : size += fd_hash_size( &self->hash );
2999 0 : size += sizeof(char);
3000 0 : if( self->has_timestamp ) {
3001 0 : size += sizeof(long);
3002 0 : }
3003 0 : return size;
3004 0 : }
3005 :
3006 0 : int fd_compact_vote_state_update_encode( fd_compact_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3007 0 : int err;
3008 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3009 0 : if( FD_UNLIKELY( err ) ) return err;
3010 0 : err = fd_bincode_compact_u16_encode( &self->lockouts_len, ctx );
3011 0 : if( FD_UNLIKELY(err) ) return err;
3012 0 : if( self->lockouts_len ) {
3013 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3014 0 : err = fd_lockout_offset_encode( self->lockouts + i, ctx );
3015 0 : if( FD_UNLIKELY( err ) ) return err;
3016 0 : }
3017 0 : }
3018 0 : err = fd_hash_encode( &self->hash, ctx );
3019 0 : if( FD_UNLIKELY( err ) ) return err;
3020 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3021 0 : if( FD_UNLIKELY( err ) ) return err;
3022 0 : if( self->has_timestamp ) {
3023 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3024 0 : if( FD_UNLIKELY( err ) ) return err;
3025 0 : }
3026 0 : return FD_BINCODE_SUCCESS;
3027 0 : }
3028 0 : static int fd_compact_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3029 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3030 0 : int err = 0;
3031 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3032 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3033 0 : ushort lockouts_len;
3034 0 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
3035 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3036 0 : if( lockouts_len ) {
3037 0 : *total_sz += FD_LOCKOUT_OFFSET_ALIGN + sizeof(fd_lockout_offset_t)*lockouts_len;
3038 0 : for( ulong i=0; i < lockouts_len; i++ ) {
3039 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3040 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3041 0 : }
3042 0 : }
3043 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3044 0 : if( FD_UNLIKELY( err ) ) return err;
3045 0 : {
3046 0 : uchar o;
3047 0 : err = fd_bincode_bool_decode( &o, ctx );
3048 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3049 0 : if( o ) {
3050 0 : err = fd_bincode_int64_decode_footprint( ctx );
3051 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3052 0 : }
3053 0 : }
3054 0 : return 0;
3055 0 : }
3056 0 : int fd_compact_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3057 0 : *total_sz += sizeof(fd_compact_vote_state_update_t);
3058 0 : void const * start_data = ctx->data;
3059 0 : int err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3060 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3061 0 : ctx->data = start_data;
3062 0 : return err;
3063 0 : }
3064 0 : static void fd_compact_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3065 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)struct_mem;
3066 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3067 0 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
3068 0 : if( self->lockouts_len ) {
3069 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_LOCKOUT_OFFSET_ALIGN );
3070 0 : self->lockouts = *alloc_mem;
3071 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_lockout_offset_t)*self->lockouts_len;
3072 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
3073 0 : fd_lockout_offset_new( self->lockouts + i );
3074 0 : fd_lockout_offset_decode_inner( self->lockouts + i, alloc_mem, ctx );
3075 0 : }
3076 0 : } else
3077 0 : self->lockouts = NULL;
3078 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3079 0 : {
3080 0 : uchar o;
3081 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3082 0 : self->has_timestamp = !!o;
3083 0 : if( o ) {
3084 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3085 0 : }
3086 0 : }
3087 0 : }
3088 0 : void * fd_compact_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3089 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)mem;
3090 0 : fd_compact_vote_state_update_new( self );
3091 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_t);
3092 0 : void * * alloc_mem = &alloc_region;
3093 0 : fd_compact_vote_state_update_decode_inner( mem, alloc_mem, ctx );
3094 0 : return self;
3095 0 : }
3096 0 : void fd_compact_vote_state_update_new(fd_compact_vote_state_update_t * self) {
3097 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_t) );
3098 0 : fd_hash_new( &self->hash );
3099 0 : }
3100 0 : ulong fd_compact_vote_state_update_size( fd_compact_vote_state_update_t const * self ) {
3101 0 : ulong size = 0;
3102 0 : size += sizeof(ulong);
3103 0 : do {
3104 0 : ushort tmp = (ushort)self->lockouts_len;
3105 0 : size += fd_bincode_compact_u16_size( &tmp );
3106 0 : for( ulong i=0; i < self->lockouts_len; i++ )
3107 0 : size += fd_lockout_offset_size( self->lockouts + i );
3108 0 : } while(0);
3109 0 : size += fd_hash_size( &self->hash );
3110 0 : size += sizeof(char);
3111 0 : if( self->has_timestamp ) {
3112 0 : size += sizeof(long);
3113 0 : }
3114 0 : return size;
3115 0 : }
3116 :
3117 0 : int fd_compact_vote_state_update_switch_encode( fd_compact_vote_state_update_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3118 0 : int err;
3119 0 : err = fd_compact_vote_state_update_encode( &self->compact_vote_state_update, ctx );
3120 0 : if( FD_UNLIKELY( err ) ) return err;
3121 0 : err = fd_hash_encode( &self->hash, ctx );
3122 0 : if( FD_UNLIKELY( err ) ) return err;
3123 0 : return FD_BINCODE_SUCCESS;
3124 0 : }
3125 0 : static int fd_compact_vote_state_update_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3126 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3127 0 : int err = 0;
3128 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
3129 0 : if( FD_UNLIKELY( err ) ) return err;
3130 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3131 0 : if( FD_UNLIKELY( err ) ) return err;
3132 0 : return 0;
3133 0 : }
3134 0 : int fd_compact_vote_state_update_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3135 0 : *total_sz += sizeof(fd_compact_vote_state_update_switch_t);
3136 0 : void const * start_data = ctx->data;
3137 0 : int err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
3138 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3139 0 : ctx->data = start_data;
3140 0 : return err;
3141 0 : }
3142 0 : static void fd_compact_vote_state_update_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3143 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)struct_mem;
3144 0 : fd_compact_vote_state_update_decode_inner( &self->compact_vote_state_update, alloc_mem, ctx );
3145 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3146 0 : }
3147 0 : void * fd_compact_vote_state_update_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3148 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)mem;
3149 0 : fd_compact_vote_state_update_switch_new( self );
3150 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_switch_t);
3151 0 : void * * alloc_mem = &alloc_region;
3152 0 : fd_compact_vote_state_update_switch_decode_inner( mem, alloc_mem, ctx );
3153 0 : return self;
3154 0 : }
3155 0 : void fd_compact_vote_state_update_switch_new(fd_compact_vote_state_update_switch_t * self) {
3156 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_switch_t) );
3157 0 : fd_compact_vote_state_update_new( &self->compact_vote_state_update );
3158 0 : fd_hash_new( &self->hash );
3159 0 : }
3160 0 : ulong fd_compact_vote_state_update_switch_size( fd_compact_vote_state_update_switch_t const * self ) {
3161 0 : ulong size = 0;
3162 0 : size += fd_compact_vote_state_update_size( &self->compact_vote_state_update );
3163 0 : size += fd_hash_size( &self->hash );
3164 0 : return size;
3165 0 : }
3166 :
3167 0 : int fd_compact_tower_sync_encode( fd_compact_tower_sync_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3168 0 : int err;
3169 0 : err = fd_bincode_uint64_encode( self->root, ctx );
3170 0 : if( FD_UNLIKELY( err ) ) return err;
3171 0 : if( self->lockout_offsets ) {
3172 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
3173 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3174 0 : if( FD_UNLIKELY( err ) ) return err;
3175 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 ) ) {
3176 0 : fd_lockout_offset_t const * ele = deq_fd_lockout_offset_t_iter_ele_const( self->lockout_offsets, iter );
3177 0 : err = fd_lockout_offset_encode( ele, ctx );
3178 0 : if( FD_UNLIKELY( err ) ) return err;
3179 0 : }
3180 0 : } else {
3181 0 : ushort lockout_offsets_len = 0;
3182 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
3183 0 : if( FD_UNLIKELY( err ) ) return err;
3184 0 : }
3185 0 : err = fd_hash_encode( &self->hash, ctx );
3186 0 : if( FD_UNLIKELY( err ) ) return err;
3187 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
3188 0 : if( FD_UNLIKELY( err ) ) return err;
3189 0 : if( self->has_timestamp ) {
3190 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
3191 0 : if( FD_UNLIKELY( err ) ) return err;
3192 0 : }
3193 0 : err = fd_hash_encode( &self->block_id, ctx );
3194 0 : if( FD_UNLIKELY( err ) ) return err;
3195 0 : return FD_BINCODE_SUCCESS;
3196 0 : }
3197 0 : static int fd_compact_tower_sync_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3198 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3199 0 : int err = 0;
3200 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3201 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3202 0 : ushort lockout_offsets_len;
3203 0 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
3204 0 : if( FD_UNLIKELY( err ) ) return err;
3205 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
3206 0 : *total_sz += deq_fd_lockout_offset_t_align() + deq_fd_lockout_offset_t_footprint( lockout_offsets_max );
3207 0 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
3208 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
3209 0 : if( FD_UNLIKELY( err ) ) return err;
3210 0 : }
3211 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3212 0 : if( FD_UNLIKELY( err ) ) return err;
3213 0 : {
3214 0 : uchar o;
3215 0 : err = fd_bincode_bool_decode( &o, ctx );
3216 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3217 0 : if( o ) {
3218 0 : err = fd_bincode_int64_decode_footprint( ctx );
3219 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3220 0 : }
3221 0 : }
3222 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3223 0 : if( FD_UNLIKELY( err ) ) return err;
3224 0 : return 0;
3225 0 : }
3226 0 : int fd_compact_tower_sync_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3227 0 : *total_sz += sizeof(fd_compact_tower_sync_t);
3228 0 : void const * start_data = ctx->data;
3229 0 : int err = fd_compact_tower_sync_decode_footprint_inner( ctx, total_sz );
3230 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3231 0 : ctx->data = start_data;
3232 0 : return err;
3233 0 : }
3234 0 : static void fd_compact_tower_sync_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3235 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)struct_mem;
3236 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
3237 0 : ushort lockout_offsets_len;
3238 0 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
3239 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
3240 0 : self->lockout_offsets = deq_fd_lockout_offset_t_join_new( alloc_mem, lockout_offsets_max );
3241 0 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
3242 0 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( self->lockout_offsets );
3243 0 : fd_lockout_offset_new( elem );
3244 0 : fd_lockout_offset_decode_inner( elem, alloc_mem, ctx );
3245 0 : }
3246 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3247 0 : {
3248 0 : uchar o;
3249 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3250 0 : self->has_timestamp = !!o;
3251 0 : if( o ) {
3252 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
3253 0 : }
3254 0 : }
3255 0 : fd_hash_decode_inner( &self->block_id, alloc_mem, ctx );
3256 0 : }
3257 0 : void * fd_compact_tower_sync_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3258 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)mem;
3259 0 : fd_compact_tower_sync_new( self );
3260 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_tower_sync_t);
3261 0 : void * * alloc_mem = &alloc_region;
3262 0 : fd_compact_tower_sync_decode_inner( mem, alloc_mem, ctx );
3263 0 : return self;
3264 0 : }
3265 0 : void fd_compact_tower_sync_new(fd_compact_tower_sync_t * self) {
3266 0 : fd_memset( self, 0, sizeof(fd_compact_tower_sync_t) );
3267 0 : fd_hash_new( &self->hash );
3268 0 : fd_hash_new( &self->block_id );
3269 0 : }
3270 0 : ulong fd_compact_tower_sync_size( fd_compact_tower_sync_t const * self ) {
3271 0 : ulong size = 0;
3272 0 : size += sizeof(ulong);
3273 0 : if( self->lockout_offsets ) {
3274 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
3275 0 : size += fd_bincode_compact_u16_size( &lockout_offsets_len );
3276 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 ) ) {
3277 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
3278 0 : size += fd_lockout_offset_size( ele );
3279 0 : }
3280 0 : } else {
3281 0 : size += 1;
3282 0 : }
3283 0 : size += fd_hash_size( &self->hash );
3284 0 : size += sizeof(char);
3285 0 : if( self->has_timestamp ) {
3286 0 : size += sizeof(long);
3287 0 : }
3288 0 : size += fd_hash_size( &self->block_id );
3289 0 : return size;
3290 0 : }
3291 :
3292 0 : void fd_tower_sync_new(fd_tower_sync_t * self) {
3293 0 : fd_memset( self, 0, sizeof(fd_tower_sync_t) );
3294 0 : fd_hash_new( &self->hash );
3295 0 : fd_hash_new( &self->block_id );
3296 0 : }
3297 0 : ulong fd_tower_sync_size( fd_tower_sync_t const * self ) {
3298 0 : ulong size = 0;
3299 0 : if( self->lockouts ) {
3300 0 : size += sizeof(ulong);
3301 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 ) ) {
3302 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3303 0 : size += fd_vote_lockout_size( ele );
3304 0 : }
3305 0 : } else {
3306 0 : size += sizeof(ulong);
3307 0 : }
3308 0 : size += sizeof(ulong);
3309 0 : size += sizeof(char);
3310 0 : if( self->has_root ) {
3311 0 : size += sizeof(ulong);
3312 0 : }
3313 0 : size += fd_hash_size( &self->hash );
3314 0 : size += sizeof(char);
3315 0 : if( self->has_timestamp ) {
3316 0 : size += sizeof(long);
3317 0 : }
3318 0 : size += fd_hash_size( &self->block_id );
3319 0 : return size;
3320 0 : }
3321 :
3322 0 : int fd_tower_sync_switch_encode( fd_tower_sync_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3323 0 : int err;
3324 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
3325 0 : if( FD_UNLIKELY( err ) ) return err;
3326 0 : err = fd_hash_encode( &self->hash, ctx );
3327 0 : if( FD_UNLIKELY( err ) ) return err;
3328 0 : return FD_BINCODE_SUCCESS;
3329 0 : }
3330 0 : static int fd_tower_sync_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3331 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3332 0 : int err = 0;
3333 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
3334 0 : if( FD_UNLIKELY( err ) ) return err;
3335 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3336 0 : if( FD_UNLIKELY( err ) ) return err;
3337 0 : return 0;
3338 0 : }
3339 0 : int fd_tower_sync_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3340 0 : *total_sz += sizeof(fd_tower_sync_switch_t);
3341 0 : void const * start_data = ctx->data;
3342 0 : int err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
3343 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3344 0 : ctx->data = start_data;
3345 0 : return err;
3346 0 : }
3347 0 : static void fd_tower_sync_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3348 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)struct_mem;
3349 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
3350 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3351 0 : }
3352 0 : void * fd_tower_sync_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3353 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)mem;
3354 0 : fd_tower_sync_switch_new( self );
3355 0 : void * alloc_region = (uchar *)mem + sizeof(fd_tower_sync_switch_t);
3356 0 : void * * alloc_mem = &alloc_region;
3357 0 : fd_tower_sync_switch_decode_inner( mem, alloc_mem, ctx );
3358 0 : return self;
3359 0 : }
3360 0 : void fd_tower_sync_switch_new(fd_tower_sync_switch_t * self) {
3361 0 : fd_memset( self, 0, sizeof(fd_tower_sync_switch_t) );
3362 0 : fd_tower_sync_new( &self->tower_sync );
3363 0 : fd_hash_new( &self->hash );
3364 0 : }
3365 0 : ulong fd_tower_sync_switch_size( fd_tower_sync_switch_t const * self ) {
3366 0 : ulong size = 0;
3367 0 : size += fd_tower_sync_size( &self->tower_sync );
3368 0 : size += fd_hash_size( &self->hash );
3369 0 : return size;
3370 0 : }
3371 :
3372 0 : int fd_slot_history_encode( fd_slot_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3373 0 : int err;
3374 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
3375 0 : if( FD_UNLIKELY( err ) ) return err;
3376 0 : if( self->has_bits ) {
3377 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
3378 0 : if( FD_UNLIKELY(err) ) return err;
3379 0 : if( self->bits_bitvec_len ) {
3380 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3381 0 : err = fd_bincode_uint64_encode( self->bits_bitvec[i], ctx );
3382 0 : }
3383 0 : }
3384 0 : if( FD_UNLIKELY( err ) ) return err;
3385 0 : }
3386 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
3387 0 : if( FD_UNLIKELY( err ) ) return err;
3388 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
3389 0 : if( FD_UNLIKELY( err ) ) return err;
3390 0 : return FD_BINCODE_SUCCESS;
3391 0 : }
3392 0 : int fd_slot_history_encode_global( fd_slot_history_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3393 0 : int err;
3394 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
3395 0 : if( FD_UNLIKELY( err ) ) return err;
3396 0 : if( self->has_bits ) {
3397 0 : if( FD_UNLIKELY( err ) ) return err;
3398 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
3399 0 : if( FD_UNLIKELY( err ) ) return err;
3400 0 : if( self->bits_bitvec_len ) {
3401 0 : uchar * bits_bitvec_laddr = (uchar*)self + self->bits_bitvec_offset;
3402 0 : ulong * bits_bitvec = (ulong *)bits_bitvec_laddr;
3403 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3404 0 : err = fd_bincode_uint64_encode( bits_bitvec[i], ctx );
3405 0 : if( FD_UNLIKELY( err ) ) return err;
3406 0 : }
3407 0 : }
3408 0 : if( FD_UNLIKELY( err ) ) return err;
3409 0 : }
3410 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
3411 0 : if( FD_UNLIKELY( err ) ) return err;
3412 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
3413 0 : if( FD_UNLIKELY( err ) ) return err;
3414 0 : return FD_BINCODE_SUCCESS;
3415 0 : }
3416 3 : static int fd_slot_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3417 3 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3418 3 : int err = 0;
3419 3 : {
3420 3 : uchar o;
3421 3 : ulong inner_len = 0UL;
3422 3 : err = fd_bincode_bool_decode( &o, ctx );
3423 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3424 3 : if( o ) {
3425 3 : ulong bits_bitvec_len;
3426 3 : err = fd_bincode_uint64_decode( &bits_bitvec_len, ctx );
3427 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3428 3 : if( bits_bitvec_len ) {
3429 3 : *total_sz += 8UL + sizeof(ulong)*bits_bitvec_len;
3430 49155 : for( ulong i=0; i < bits_bitvec_len; i++ ) {
3431 49152 : err = fd_bincode_uint64_decode_footprint( ctx );
3432 49152 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3433 49152 : }
3434 3 : }
3435 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3436 3 : inner_len = bits_bitvec_len;
3437 3 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
3438 3 : }
3439 3 : ulong len;
3440 3 : err = fd_bincode_uint64_decode( &len, ctx );
3441 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3442 3 : if( len > inner_len * sizeof(ulong) * 8UL ) return FD_BINCODE_ERR_ENCODING;
3443 3 : }
3444 3 : err = fd_bincode_uint64_decode_footprint( ctx );
3445 3 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3446 3 : return 0;
3447 3 : }
3448 3 : int fd_slot_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3449 3 : *total_sz += sizeof(fd_slot_history_t);
3450 3 : void const * start_data = ctx->data;
3451 3 : int err = fd_slot_history_decode_footprint_inner( ctx, total_sz );
3452 3 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3453 3 : ctx->data = start_data;
3454 3 : return err;
3455 3 : }
3456 0 : static void fd_slot_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3457 0 : fd_slot_history_t * self = (fd_slot_history_t *)struct_mem;
3458 0 : {
3459 0 : uchar o;
3460 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3461 0 : self->has_bits = !!o;
3462 0 : if( o ) {
3463 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
3464 0 : if( self->bits_bitvec_len ) {
3465 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3466 0 : self->bits_bitvec = *alloc_mem;
3467 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
3468 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3469 0 : fd_bincode_uint64_decode_unsafe( self->bits_bitvec + i, ctx );
3470 0 : }
3471 0 : } else
3472 0 : self->bits_bitvec = NULL;
3473 0 : } else {
3474 0 : self->bits_bitvec = NULL;
3475 0 : }
3476 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
3477 0 : }
3478 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
3479 0 : }
3480 0 : void * fd_slot_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3481 0 : fd_slot_history_t * self = (fd_slot_history_t *)mem;
3482 0 : fd_slot_history_new( self );
3483 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_t);
3484 0 : void * * alloc_mem = &alloc_region;
3485 0 : fd_slot_history_decode_inner( mem, alloc_mem, ctx );
3486 0 : return self;
3487 0 : }
3488 0 : static void fd_slot_history_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3489 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)struct_mem;
3490 0 : {
3491 0 : uchar o;
3492 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3493 0 : self->has_bits = !!o;
3494 0 : if( o ) {
3495 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
3496 0 : if( self->bits_bitvec_len ) {
3497 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3498 0 : self->bits_bitvec_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3499 0 : uchar * cur_mem = (uchar *)(*alloc_mem);
3500 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
3501 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3502 0 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
3503 0 : }
3504 0 : } else {
3505 0 : self->bits_bitvec_offset = 0UL;
3506 0 : }
3507 0 : }
3508 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
3509 0 : }
3510 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
3511 0 : }
3512 0 : void * fd_slot_history_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3513 0 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)mem;
3514 0 : fd_slot_history_new( (fd_slot_history_t *)self );
3515 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_global_t);
3516 0 : void * * alloc_mem = &alloc_region;
3517 0 : fd_slot_history_decode_inner_global( mem, alloc_mem, ctx );
3518 0 : return self;
3519 0 : }
3520 0 : void fd_slot_history_new(fd_slot_history_t * self) {
3521 0 : fd_memset( self, 0, sizeof(fd_slot_history_t) );
3522 0 : }
3523 0 : ulong fd_slot_history_size( fd_slot_history_t const * self ) {
3524 0 : ulong size = 0;
3525 0 : size += sizeof(char);
3526 0 : if( self->has_bits ) {
3527 0 : do {
3528 0 : size += sizeof(ulong);
3529 0 : size += self->bits_bitvec_len * sizeof(ulong);
3530 0 : } while(0);
3531 0 : }
3532 0 : size += sizeof(ulong);
3533 0 : size += sizeof(ulong);
3534 0 : return size;
3535 0 : }
3536 :
3537 0 : ulong fd_slot_history_size_global( fd_slot_history_global_t const * self ) {
3538 0 : ulong size = 0;
3539 0 : do {
3540 0 : size += sizeof(char);
3541 0 : if( self->has_bits ) {
3542 0 : do {
3543 0 : size += sizeof(ulong);
3544 0 : ulong * bits_bitvec = self->bits_bitvec_offset ? (ulong *)fd_type_pun( (uchar *)self + self->bits_bitvec_offset ) : NULL;
3545 0 : size += self->bits_bitvec_len * sizeof(ulong);
3546 0 : } while(0);
3547 0 : }
3548 0 : } while(0);
3549 0 : size += sizeof(ulong);
3550 0 : return size;
3551 0 : }
3552 :
3553 171 : int fd_slot_hash_encode( fd_slot_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3554 171 : int err;
3555 171 : err = fd_bincode_uint64_encode( self->slot, ctx );
3556 171 : if( FD_UNLIKELY( err ) ) return err;
3557 171 : err = fd_hash_encode( &self->hash, ctx );
3558 171 : if( FD_UNLIKELY( err ) ) return err;
3559 171 : return FD_BINCODE_SUCCESS;
3560 171 : }
3561 0 : static inline int fd_slot_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3562 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3563 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
3564 0 : return 0;
3565 0 : }
3566 279 : static void fd_slot_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3567 279 : fd_slot_hash_t * self = (fd_slot_hash_t *)struct_mem;
3568 279 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
3569 279 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3570 279 : }
3571 0 : void * fd_slot_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3572 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)mem;
3573 0 : fd_slot_hash_new( self );
3574 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hash_t);
3575 0 : void * * alloc_mem = &alloc_region;
3576 0 : fd_slot_hash_decode_inner( mem, alloc_mem, ctx );
3577 0 : return self;
3578 0 : }
3579 0 : int fd_slot_hashes_encode( fd_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3580 0 : int err;
3581 0 : if( self->hashes ) {
3582 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( self->hashes );
3583 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3584 0 : if( FD_UNLIKELY( err ) ) return err;
3585 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 ) ) {
3586 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( self->hashes, iter );
3587 0 : err = fd_slot_hash_encode( ele, ctx );
3588 0 : if( FD_UNLIKELY( err ) ) return err;
3589 0 : }
3590 0 : } else {
3591 0 : ulong hashes_len = 0;
3592 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3593 0 : if( FD_UNLIKELY( err ) ) return err;
3594 0 : }
3595 0 : return FD_BINCODE_SUCCESS;
3596 0 : }
3597 63 : int fd_slot_hashes_encode_global( fd_slot_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3598 63 : int err;
3599 63 : if( self->hashes_offset ) {
3600 63 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
3601 63 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join( hashes_laddr );
3602 63 : ulong hashes_len = deq_fd_slot_hash_t_cnt( hashes );
3603 63 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3604 63 : if( FD_UNLIKELY( err ) ) return err;
3605 234 : 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 ) ) {
3606 171 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( hashes, iter );
3607 171 : err = fd_slot_hash_encode( ele, ctx );
3608 171 : if( FD_UNLIKELY( err ) ) return err;
3609 171 : }
3610 63 : } else {
3611 0 : ulong hashes_len = 0;
3612 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3613 0 : if( FD_UNLIKELY( err ) ) return err;
3614 0 : }
3615 63 : return FD_BINCODE_SUCCESS;
3616 63 : }
3617 66 : static int fd_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3618 66 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3619 66 : int err = 0;
3620 66 : ulong hashes_len;
3621 66 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
3622 66 : if( FD_UNLIKELY( err ) ) return err;
3623 66 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
3624 66 : *total_sz += deq_fd_slot_hash_t_align() + deq_fd_slot_hash_t_footprint( hashes_max );
3625 66 : ulong hashes_sz;
3626 66 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3627 66 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
3628 66 : if( FD_UNLIKELY( err ) ) return err;
3629 66 : return 0;
3630 66 : }
3631 66 : int fd_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3632 66 : *total_sz += sizeof(fd_slot_hashes_t);
3633 66 : void const * start_data = ctx->data;
3634 66 : int err = fd_slot_hashes_decode_footprint_inner( ctx, total_sz );
3635 66 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3636 66 : ctx->data = start_data;
3637 66 : return err;
3638 66 : }
3639 0 : static void fd_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3640 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)struct_mem;
3641 0 : ulong hashes_len;
3642 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3643 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
3644 0 : self->hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
3645 0 : for( ulong i=0; i < hashes_len; i++ ) {
3646 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( self->hashes );
3647 0 : fd_slot_hash_new( elem );
3648 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
3649 0 : }
3650 0 : }
3651 0 : void * fd_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3652 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)mem;
3653 0 : fd_slot_hashes_new( self );
3654 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_t);
3655 0 : void * * alloc_mem = &alloc_region;
3656 0 : fd_slot_hashes_decode_inner( mem, alloc_mem, ctx );
3657 0 : return self;
3658 0 : }
3659 87 : static void fd_slot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3660 87 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)struct_mem;
3661 87 : ulong hashes_len;
3662 87 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3663 87 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_slot_hash_t_align() );
3664 87 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
3665 87 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
3666 366 : for( ulong i=0; i < hashes_len; i++ ) {
3667 279 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( hashes );
3668 279 : fd_slot_hash_new( (fd_slot_hash_t*)fd_type_pun( elem ) );
3669 279 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
3670 279 : }
3671 87 : self->hashes_offset = (ulong)deq_fd_slot_hash_t_leave( hashes ) - (ulong)struct_mem;
3672 87 : }
3673 87 : void * fd_slot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3674 87 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)mem;
3675 87 : fd_slot_hashes_new( (fd_slot_hashes_t *)self );
3676 87 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_global_t);
3677 87 : void * * alloc_mem = &alloc_region;
3678 87 : fd_slot_hashes_decode_inner_global( mem, alloc_mem, ctx );
3679 87 : return self;
3680 87 : }
3681 87 : void fd_slot_hashes_new(fd_slot_hashes_t * self) {
3682 87 : fd_memset( self, 0, sizeof(fd_slot_hashes_t) );
3683 87 : }
3684 0 : ulong fd_slot_hashes_size( fd_slot_hashes_t const * self ) {
3685 0 : ulong size = 0;
3686 0 : if( self->hashes ) {
3687 0 : size += sizeof(ulong);
3688 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 ) ) {
3689 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
3690 0 : size += fd_slot_hash_size( ele );
3691 0 : }
3692 0 : } else {
3693 0 : size += sizeof(ulong);
3694 0 : }
3695 0 : return size;
3696 0 : }
3697 :
3698 0 : ulong fd_slot_hashes_size_global( fd_slot_hashes_global_t const * self ) {
3699 0 : ulong size = 0;
3700 0 : if( self->hashes_offset!=0 ) {
3701 0 : fd_slot_hash_t * hashes = (fd_slot_hash_t *)deq_fd_slot_hash_t_join( fd_type_pun( (uchar *)self + self->hashes_offset ) );
3702 0 : size += sizeof(ulong);
3703 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 ) ) {
3704 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( hashes, iter );
3705 0 : size += fd_slot_hash_size( ele );
3706 0 : }
3707 0 : } else {
3708 0 : size += sizeof(ulong);
3709 0 : }
3710 0 : return size;
3711 0 : }
3712 :
3713 0 : int fd_block_block_hash_entry_encode( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3714 0 : int err;
3715 0 : err = fd_hash_encode( &self->blockhash, ctx );
3716 0 : if( FD_UNLIKELY( err ) ) return err;
3717 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
3718 0 : if( FD_UNLIKELY( err ) ) return err;
3719 0 : return FD_BINCODE_SUCCESS;
3720 0 : }
3721 0 : static inline int fd_block_block_hash_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3722 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3723 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
3724 0 : return 0;
3725 0 : }
3726 33975 : static void fd_block_block_hash_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3727 33975 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)struct_mem;
3728 33975 : fd_hash_decode_inner( &self->blockhash, alloc_mem, ctx );
3729 33975 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
3730 33975 : }
3731 0 : void * fd_block_block_hash_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3732 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)mem;
3733 0 : fd_block_block_hash_entry_new( self );
3734 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_block_hash_entry_t);
3735 0 : void * * alloc_mem = &alloc_region;
3736 0 : fd_block_block_hash_entry_decode_inner( mem, alloc_mem, ctx );
3737 0 : return self;
3738 0 : }
3739 0 : int fd_recent_block_hashes_encode( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3740 0 : int err;
3741 0 : if( self->hashes ) {
3742 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
3743 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3744 0 : if( FD_UNLIKELY( err ) ) return err;
3745 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 ) ) {
3746 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
3747 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
3748 0 : if( FD_UNLIKELY( err ) ) return err;
3749 0 : }
3750 0 : } else {
3751 0 : ulong hashes_len = 0;
3752 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3753 0 : if( FD_UNLIKELY( err ) ) return err;
3754 0 : }
3755 0 : return FD_BINCODE_SUCCESS;
3756 0 : }
3757 0 : int fd_recent_block_hashes_encode_global( fd_recent_block_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3758 0 : int err;
3759 0 : if( self->hashes_offset ) {
3760 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
3761 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join( hashes_laddr );
3762 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( hashes );
3763 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3764 0 : if( FD_UNLIKELY( err ) ) return err;
3765 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 ) ) {
3766 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( hashes, iter );
3767 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
3768 0 : if( FD_UNLIKELY( err ) ) return err;
3769 0 : }
3770 0 : } else {
3771 0 : ulong hashes_len = 0;
3772 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3773 0 : if( FD_UNLIKELY( err ) ) return err;
3774 0 : }
3775 0 : return FD_BINCODE_SUCCESS;
3776 0 : }
3777 456 : static int fd_recent_block_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3778 456 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3779 456 : int err = 0;
3780 456 : ulong hashes_len;
3781 456 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
3782 456 : if( FD_UNLIKELY( err ) ) return err;
3783 456 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
3784 456 : *total_sz += deq_fd_block_block_hash_entry_t_align() + deq_fd_block_block_hash_entry_t_footprint( hashes_max );
3785 456 : ulong hashes_sz;
3786 456 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3787 456 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
3788 456 : if( FD_UNLIKELY( err ) ) return err;
3789 456 : return 0;
3790 456 : }
3791 456 : int fd_recent_block_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3792 456 : *total_sz += sizeof(fd_recent_block_hashes_t);
3793 456 : void const * start_data = ctx->data;
3794 456 : int err = fd_recent_block_hashes_decode_footprint_inner( ctx, total_sz );
3795 456 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3796 456 : ctx->data = start_data;
3797 456 : return err;
3798 456 : }
3799 0 : static void fd_recent_block_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3800 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)struct_mem;
3801 0 : ulong hashes_len;
3802 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3803 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
3804 0 : self->hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
3805 0 : for( ulong i=0; i < hashes_len; i++ ) {
3806 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
3807 0 : fd_block_block_hash_entry_new( elem );
3808 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
3809 0 : }
3810 0 : }
3811 0 : void * fd_recent_block_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3812 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)mem;
3813 0 : fd_recent_block_hashes_new( self );
3814 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_t);
3815 0 : void * * alloc_mem = &alloc_region;
3816 0 : fd_recent_block_hashes_decode_inner( mem, alloc_mem, ctx );
3817 0 : return self;
3818 0 : }
3819 453 : static void fd_recent_block_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3820 453 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)struct_mem;
3821 453 : ulong hashes_len;
3822 453 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3823 453 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_block_block_hash_entry_t_align() );
3824 453 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
3825 453 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
3826 34428 : for( ulong i=0; i < hashes_len; i++ ) {
3827 33975 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( hashes );
3828 33975 : fd_block_block_hash_entry_new( (fd_block_block_hash_entry_t*)fd_type_pun( elem ) );
3829 33975 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
3830 33975 : }
3831 453 : self->hashes_offset = (ulong)deq_fd_block_block_hash_entry_t_leave( hashes ) - (ulong)struct_mem;
3832 453 : }
3833 453 : void * fd_recent_block_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3834 453 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)mem;
3835 453 : fd_recent_block_hashes_new( (fd_recent_block_hashes_t *)self );
3836 453 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_global_t);
3837 453 : void * * alloc_mem = &alloc_region;
3838 453 : fd_recent_block_hashes_decode_inner_global( mem, alloc_mem, ctx );
3839 453 : return self;
3840 453 : }
3841 453 : void fd_recent_block_hashes_new(fd_recent_block_hashes_t * self) {
3842 453 : fd_memset( self, 0, sizeof(fd_recent_block_hashes_t) );
3843 453 : }
3844 0 : ulong fd_recent_block_hashes_size( fd_recent_block_hashes_t const * self ) {
3845 0 : ulong size = 0;
3846 0 : if( self->hashes ) {
3847 0 : size += sizeof(ulong);
3848 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 ) ) {
3849 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
3850 0 : size += fd_block_block_hash_entry_size( ele );
3851 0 : }
3852 0 : } else {
3853 0 : size += sizeof(ulong);
3854 0 : }
3855 0 : return size;
3856 0 : }
3857 :
3858 0 : ulong fd_recent_block_hashes_size_global( fd_recent_block_hashes_global_t const * self ) {
3859 0 : ulong size = 0;
3860 0 : if( self->hashes_offset!=0 ) {
3861 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 ) );
3862 0 : size += sizeof(ulong);
3863 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 ) ) {
3864 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( hashes, iter );
3865 0 : size += fd_block_block_hash_entry_size( ele );
3866 0 : }
3867 0 : } else {
3868 0 : size += sizeof(ulong);
3869 0 : }
3870 0 : return size;
3871 0 : }
3872 :
3873 0 : int fd_slot_meta_encode( fd_slot_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3874 0 : int err;
3875 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
3876 0 : if( FD_UNLIKELY( err ) ) return err;
3877 0 : err = fd_bincode_uint64_encode( self->consumed, ctx );
3878 0 : if( FD_UNLIKELY( err ) ) return err;
3879 0 : err = fd_bincode_uint64_encode( self->received, ctx );
3880 0 : if( FD_UNLIKELY( err ) ) return err;
3881 0 : err = fd_bincode_uint64_encode( (ulong)self->first_shred_timestamp, ctx );
3882 0 : if( FD_UNLIKELY( err ) ) return err;
3883 0 : err = fd_bincode_uint64_encode( self->last_index, ctx );
3884 0 : if( FD_UNLIKELY( err ) ) return err;
3885 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
3886 0 : if( FD_UNLIKELY( err ) ) return err;
3887 0 : err = fd_bincode_uint64_encode( self->next_slot_len, ctx );
3888 0 : if( FD_UNLIKELY(err) ) return err;
3889 0 : if( self->next_slot_len ) {
3890 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
3891 0 : err = fd_bincode_uint64_encode( self->next_slot[i], ctx );
3892 0 : }
3893 0 : }
3894 0 : err = fd_bincode_uint8_encode( (uchar)(self->is_connected), ctx );
3895 0 : if( FD_UNLIKELY( err ) ) return err;
3896 0 : return FD_BINCODE_SUCCESS;
3897 0 : }
3898 0 : static int fd_slot_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3899 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3900 0 : int err = 0;
3901 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3902 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3903 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3904 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3905 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3906 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3907 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3908 0 : if( FD_UNLIKELY( err ) ) return err;
3909 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3910 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3911 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3912 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3913 0 : ulong next_slot_len;
3914 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
3915 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3916 0 : if( next_slot_len ) {
3917 0 : *total_sz += 8UL + sizeof(ulong)*next_slot_len;
3918 0 : for( ulong i=0; i < next_slot_len; i++ ) {
3919 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3920 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3921 0 : }
3922 0 : }
3923 0 : err = fd_bincode_uint8_decode_footprint( ctx );
3924 0 : if( FD_UNLIKELY( err ) ) return err;
3925 0 : return 0;
3926 0 : }
3927 0 : int fd_slot_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3928 0 : *total_sz += sizeof(fd_slot_meta_t);
3929 0 : void const * start_data = ctx->data;
3930 0 : int err = fd_slot_meta_decode_footprint_inner( ctx, total_sz );
3931 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3932 0 : ctx->data = start_data;
3933 0 : return err;
3934 0 : }
3935 0 : static void fd_slot_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3936 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)struct_mem;
3937 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
3938 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
3939 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
3940 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
3941 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
3942 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
3943 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
3944 0 : if( self->next_slot_len ) {
3945 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3946 0 : self->next_slot = *alloc_mem;
3947 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->next_slot_len;
3948 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
3949 0 : fd_bincode_uint64_decode_unsafe( self->next_slot + i, ctx );
3950 0 : }
3951 0 : } else
3952 0 : self->next_slot = NULL;
3953 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
3954 0 : }
3955 0 : void * fd_slot_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3956 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)mem;
3957 0 : fd_slot_meta_new( self );
3958 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_meta_t);
3959 0 : void * * alloc_mem = &alloc_region;
3960 0 : fd_slot_meta_decode_inner( mem, alloc_mem, ctx );
3961 0 : return self;
3962 0 : }
3963 0 : void fd_slot_meta_new(fd_slot_meta_t * self) {
3964 0 : fd_memset( self, 0, sizeof(fd_slot_meta_t) );
3965 0 : }
3966 0 : ulong fd_slot_meta_size( fd_slot_meta_t const * self ) {
3967 0 : ulong size = 0;
3968 0 : size += sizeof(ulong);
3969 0 : size += sizeof(ulong);
3970 0 : size += sizeof(ulong);
3971 0 : size += sizeof(long);
3972 0 : size += sizeof(ulong);
3973 0 : size += sizeof(ulong);
3974 0 : do {
3975 0 : size += sizeof(ulong);
3976 0 : size += self->next_slot_len * sizeof(ulong);
3977 0 : } while(0);
3978 0 : size += sizeof(char);
3979 0 : return size;
3980 0 : }
3981 :
3982 0 : int fd_sysvar_fees_encode( fd_sysvar_fees_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3983 0 : int err;
3984 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
3985 0 : if( FD_UNLIKELY( err ) ) return err;
3986 0 : return FD_BINCODE_SUCCESS;
3987 0 : }
3988 0 : static inline int fd_sysvar_fees_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3989 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3990 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
3991 0 : return 0;
3992 0 : }
3993 0 : static void fd_sysvar_fees_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3994 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)struct_mem;
3995 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
3996 0 : }
3997 0 : void * fd_sysvar_fees_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3998 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)mem;
3999 0 : fd_sysvar_fees_new( self );
4000 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_fees_t);
4001 0 : void * * alloc_mem = &alloc_region;
4002 0 : fd_sysvar_fees_decode_inner( mem, alloc_mem, ctx );
4003 0 : return self;
4004 0 : }
4005 45 : int fd_sysvar_epoch_rewards_encode( fd_sysvar_epoch_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4006 45 : int err;
4007 45 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
4008 45 : if( FD_UNLIKELY( err ) ) return err;
4009 45 : err = fd_bincode_uint64_encode( self->num_partitions, ctx );
4010 45 : if( FD_UNLIKELY( err ) ) return err;
4011 45 : err = fd_hash_encode( &self->parent_blockhash, ctx );
4012 45 : if( FD_UNLIKELY( err ) ) return err;
4013 45 : err = fd_bincode_uint128_encode( self->total_points, ctx );
4014 45 : if( FD_UNLIKELY( err ) ) return err;
4015 45 : err = fd_bincode_uint64_encode( self->total_rewards, ctx );
4016 45 : if( FD_UNLIKELY( err ) ) return err;
4017 45 : err = fd_bincode_uint64_encode( self->distributed_rewards, ctx );
4018 45 : if( FD_UNLIKELY( err ) ) return err;
4019 45 : err = fd_bincode_bool_encode( (uchar)(self->active), ctx );
4020 45 : if( FD_UNLIKELY( err ) ) return err;
4021 45 : return FD_BINCODE_SUCCESS;
4022 45 : }
4023 60 : static int fd_sysvar_epoch_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4024 60 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4025 60 : int err = 0;
4026 60 : err = fd_bincode_uint64_decode_footprint( ctx );
4027 60 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4028 60 : err = fd_bincode_uint64_decode_footprint( ctx );
4029 60 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4030 60 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4031 60 : if( FD_UNLIKELY( err ) ) return err;
4032 60 : err = fd_bincode_uint128_decode_footprint( ctx );
4033 60 : if( FD_UNLIKELY( err ) ) return err;
4034 60 : err = fd_bincode_uint64_decode_footprint( ctx );
4035 60 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4036 60 : err = fd_bincode_uint64_decode_footprint( ctx );
4037 60 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4038 60 : err = fd_bincode_bool_decode_footprint( ctx );
4039 60 : if( FD_UNLIKELY( err ) ) return err;
4040 60 : return 0;
4041 60 : }
4042 60 : int fd_sysvar_epoch_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4043 60 : *total_sz += sizeof(fd_sysvar_epoch_rewards_t);
4044 60 : void const * start_data = ctx->data;
4045 60 : int err = fd_sysvar_epoch_rewards_decode_footprint_inner( ctx, total_sz );
4046 60 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4047 60 : ctx->data = start_data;
4048 60 : return err;
4049 60 : }
4050 57 : static void fd_sysvar_epoch_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4051 57 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)struct_mem;
4052 57 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
4053 57 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
4054 57 : fd_hash_decode_inner( &self->parent_blockhash, alloc_mem, ctx );
4055 57 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
4056 57 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
4057 57 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
4058 57 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
4059 57 : }
4060 57 : void * fd_sysvar_epoch_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4061 57 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)mem;
4062 57 : fd_sysvar_epoch_rewards_new( self );
4063 57 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_epoch_rewards_t);
4064 57 : void * * alloc_mem = &alloc_region;
4065 57 : fd_sysvar_epoch_rewards_decode_inner( mem, alloc_mem, ctx );
4066 57 : return self;
4067 57 : }
4068 57 : void fd_sysvar_epoch_rewards_new(fd_sysvar_epoch_rewards_t * self) {
4069 57 : fd_memset( self, 0, sizeof(fd_sysvar_epoch_rewards_t) );
4070 57 : fd_hash_new( &self->parent_blockhash );
4071 57 : }
4072 0 : int fd_config_keys_pair_encode( fd_config_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4073 0 : int err;
4074 0 : err = fd_pubkey_encode( &self->key, ctx );
4075 0 : if( FD_UNLIKELY( err ) ) return err;
4076 0 : err = fd_bincode_bool_encode( (uchar)(self->signer), ctx );
4077 0 : if( FD_UNLIKELY( err ) ) return err;
4078 0 : return FD_BINCODE_SUCCESS;
4079 0 : }
4080 0 : static int fd_config_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4081 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4082 0 : int err = 0;
4083 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4084 0 : if( FD_UNLIKELY( err ) ) return err;
4085 0 : err = fd_bincode_bool_decode_footprint( ctx );
4086 0 : if( FD_UNLIKELY( err ) ) return err;
4087 0 : return 0;
4088 0 : }
4089 0 : int fd_config_keys_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4090 0 : *total_sz += sizeof(fd_config_keys_pair_t);
4091 0 : void const * start_data = ctx->data;
4092 0 : int err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
4093 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4094 0 : ctx->data = start_data;
4095 0 : return err;
4096 0 : }
4097 0 : static void fd_config_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4098 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)struct_mem;
4099 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
4100 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
4101 0 : }
4102 0 : void * fd_config_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4103 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)mem;
4104 0 : fd_config_keys_pair_new( self );
4105 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_pair_t);
4106 0 : void * * alloc_mem = &alloc_region;
4107 0 : fd_config_keys_pair_decode_inner( mem, alloc_mem, ctx );
4108 0 : return self;
4109 0 : }
4110 0 : void fd_config_keys_pair_new(fd_config_keys_pair_t * self) {
4111 0 : fd_memset( self, 0, sizeof(fd_config_keys_pair_t) );
4112 0 : fd_pubkey_new( &self->key );
4113 0 : }
4114 12 : int fd_stake_config_encode( fd_stake_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4115 12 : int err;
4116 12 : err = fd_bincode_compact_u16_encode( &self->config_keys_len, ctx );
4117 12 : if( FD_UNLIKELY(err) ) return err;
4118 12 : if( self->config_keys_len ) {
4119 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
4120 0 : err = fd_config_keys_pair_encode( self->config_keys + i, ctx );
4121 0 : if( FD_UNLIKELY( err ) ) return err;
4122 0 : }
4123 0 : }
4124 12 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
4125 12 : if( FD_UNLIKELY( err ) ) return err;
4126 12 : err = fd_bincode_uint8_encode( (uchar)(self->slash_penalty), ctx );
4127 12 : if( FD_UNLIKELY( err ) ) return err;
4128 12 : return FD_BINCODE_SUCCESS;
4129 12 : }
4130 0 : static int fd_stake_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4131 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4132 0 : int err = 0;
4133 0 : ushort config_keys_len;
4134 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
4135 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4136 0 : if( config_keys_len ) {
4137 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*config_keys_len;
4138 0 : for( ulong i=0; i < config_keys_len; i++ ) {
4139 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
4140 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4141 0 : }
4142 0 : }
4143 0 : err = fd_bincode_double_decode_footprint( ctx );
4144 0 : if( FD_UNLIKELY( err ) ) return err;
4145 0 : err = fd_bincode_uint8_decode_footprint( ctx );
4146 0 : if( FD_UNLIKELY( err ) ) return err;
4147 0 : return 0;
4148 0 : }
4149 0 : int fd_stake_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4150 0 : *total_sz += sizeof(fd_stake_config_t);
4151 0 : void const * start_data = ctx->data;
4152 0 : int err = fd_stake_config_decode_footprint_inner( ctx, total_sz );
4153 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4154 0 : ctx->data = start_data;
4155 0 : return err;
4156 0 : }
4157 0 : static void fd_stake_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4158 0 : fd_stake_config_t * self = (fd_stake_config_t *)struct_mem;
4159 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
4160 0 : if( self->config_keys_len ) {
4161 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
4162 0 : self->config_keys = *alloc_mem;
4163 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->config_keys_len;
4164 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
4165 0 : fd_config_keys_pair_new( self->config_keys + i );
4166 0 : fd_config_keys_pair_decode_inner( self->config_keys + i, alloc_mem, ctx );
4167 0 : }
4168 0 : } else
4169 0 : self->config_keys = NULL;
4170 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
4171 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
4172 0 : }
4173 0 : void * fd_stake_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4174 0 : fd_stake_config_t * self = (fd_stake_config_t *)mem;
4175 0 : fd_stake_config_new( self );
4176 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_config_t);
4177 0 : void * * alloc_mem = &alloc_region;
4178 0 : fd_stake_config_decode_inner( mem, alloc_mem, ctx );
4179 0 : return self;
4180 0 : }
4181 0 : void fd_stake_config_new(fd_stake_config_t * self) {
4182 0 : fd_memset( self, 0, sizeof(fd_stake_config_t) );
4183 0 : }
4184 0 : ulong fd_stake_config_size( fd_stake_config_t const * self ) {
4185 0 : ulong size = 0;
4186 0 : do {
4187 0 : ushort tmp = (ushort)self->config_keys_len;
4188 0 : size += fd_bincode_compact_u16_size( &tmp );
4189 0 : for( ulong i=0; i < self->config_keys_len; i++ )
4190 0 : size += fd_config_keys_pair_size( self->config_keys + i );
4191 0 : } while(0);
4192 0 : size += sizeof(double);
4193 0 : size += sizeof(char);
4194 0 : return size;
4195 0 : }
4196 :
4197 0 : FD_FN_PURE uchar fd_cluster_type_is_Testnet(fd_cluster_type_t const * self) {
4198 0 : return self->discriminant == 0;
4199 0 : }
4200 0 : FD_FN_PURE uchar fd_cluster_type_is_MainnetBeta(fd_cluster_type_t const * self) {
4201 0 : return self->discriminant == 1;
4202 0 : }
4203 0 : FD_FN_PURE uchar fd_cluster_type_is_Devnet(fd_cluster_type_t const * self) {
4204 0 : return self->discriminant == 2;
4205 0 : }
4206 0 : FD_FN_PURE uchar fd_cluster_type_is_Development(fd_cluster_type_t const * self) {
4207 0 : return self->discriminant == 3;
4208 0 : }
4209 0 : int fd_cluster_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4210 0 : int err;
4211 0 : switch (discriminant) {
4212 0 : case 0: {
4213 0 : return FD_BINCODE_SUCCESS;
4214 0 : }
4215 0 : case 1: {
4216 0 : return FD_BINCODE_SUCCESS;
4217 0 : }
4218 0 : case 2: {
4219 0 : return FD_BINCODE_SUCCESS;
4220 0 : }
4221 0 : case 3: {
4222 0 : return FD_BINCODE_SUCCESS;
4223 0 : }
4224 0 : default: return FD_BINCODE_ERR_ENCODING;
4225 0 : }
4226 0 : }
4227 0 : static int fd_cluster_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4228 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4229 0 : uint discriminant = 0;
4230 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4231 0 : if( FD_UNLIKELY( err ) ) return err;
4232 0 : return fd_cluster_type_inner_decode_footprint( discriminant, ctx, total_sz );
4233 0 : }
4234 0 : int fd_cluster_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4235 0 : *total_sz += sizeof(fd_cluster_type_t);
4236 0 : void const * start_data = ctx->data;
4237 0 : int err = fd_cluster_type_decode_footprint_inner( ctx, total_sz );
4238 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4239 0 : ctx->data = start_data;
4240 0 : return err;
4241 0 : }
4242 0 : static void fd_cluster_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4243 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)struct_mem;
4244 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4245 0 : }
4246 0 : void * fd_cluster_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4247 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)mem;
4248 0 : fd_cluster_type_new( self );
4249 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_type_t);
4250 0 : void * * alloc_mem = &alloc_region;
4251 0 : fd_cluster_type_decode_inner( mem, alloc_mem, ctx );
4252 0 : return self;
4253 0 : }
4254 :
4255 0 : ulong fd_cluster_type_size( fd_cluster_type_t const * self ) {
4256 0 : ulong size = 0;
4257 0 : size += sizeof(uint);
4258 0 : switch (self->discriminant) {
4259 0 : }
4260 0 : return size;
4261 0 : }
4262 :
4263 0 : int fd_cluster_type_encode( fd_cluster_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4264 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4265 0 : if( FD_UNLIKELY( err ) ) return err;
4266 0 : return err;
4267 0 : }
4268 :
4269 0 : int fd_cluster_version_encode( fd_cluster_version_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4270 0 : int err;
4271 0 : err = fd_bincode_uint32_encode( self->major, ctx );
4272 0 : if( FD_UNLIKELY( err ) ) return err;
4273 0 : err = fd_bincode_uint32_encode( self->minor, ctx );
4274 0 : if( FD_UNLIKELY( err ) ) return err;
4275 0 : err = fd_bincode_uint32_encode( self->patch, ctx );
4276 0 : if( FD_UNLIKELY( err ) ) return err;
4277 0 : return FD_BINCODE_SUCCESS;
4278 0 : }
4279 0 : static inline int fd_cluster_version_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4280 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4281 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
4282 0 : return 0;
4283 0 : }
4284 0 : static void fd_cluster_version_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4285 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)struct_mem;
4286 0 : fd_bincode_uint32_decode_unsafe( &self->major, ctx );
4287 0 : fd_bincode_uint32_decode_unsafe( &self->minor, ctx );
4288 0 : fd_bincode_uint32_decode_unsafe( &self->patch, ctx );
4289 0 : }
4290 0 : void * fd_cluster_version_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4291 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)mem;
4292 0 : fd_cluster_version_new( self );
4293 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_version_t);
4294 0 : void * * alloc_mem = &alloc_region;
4295 0 : fd_cluster_version_decode_inner( mem, alloc_mem, ctx );
4296 0 : return self;
4297 0 : }
4298 0 : int fd_vote_encode( fd_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4299 0 : int err;
4300 0 : if( self->slots ) {
4301 0 : ulong slots_len = deq_ulong_cnt( self->slots );
4302 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
4303 0 : if( FD_UNLIKELY( err ) ) return err;
4304 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 ) ) {
4305 0 : ulong const * ele = deq_ulong_iter_ele_const( self->slots, iter );
4306 0 : err = fd_bincode_uint64_encode( ele[0], ctx );
4307 0 : }
4308 0 : } else {
4309 0 : ulong slots_len = 0;
4310 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
4311 0 : if( FD_UNLIKELY( err ) ) return err;
4312 0 : }
4313 0 : err = fd_hash_encode( &self->hash, ctx );
4314 0 : if( FD_UNLIKELY( err ) ) return err;
4315 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
4316 0 : if( FD_UNLIKELY( err ) ) return err;
4317 0 : if( self->has_timestamp ) {
4318 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
4319 0 : if( FD_UNLIKELY( err ) ) return err;
4320 0 : }
4321 0 : return FD_BINCODE_SUCCESS;
4322 0 : }
4323 0 : static int fd_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4324 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4325 0 : int err = 0;
4326 0 : ulong slots_len;
4327 0 : err = fd_bincode_uint64_decode( &slots_len, ctx );
4328 0 : if( FD_UNLIKELY( err ) ) return err;
4329 0 : ulong slots_max = slots_len == 0 ? 1 : slots_len;
4330 0 : *total_sz += deq_ulong_align() + deq_ulong_footprint( slots_max ) ;
4331 0 : ulong slots_sz;
4332 0 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
4333 0 : err = fd_bincode_bytes_decode_footprint( slots_sz, ctx );
4334 0 : if( FD_UNLIKELY( err ) ) return err;
4335 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4336 0 : if( FD_UNLIKELY( err ) ) return err;
4337 0 : {
4338 0 : uchar o;
4339 0 : err = fd_bincode_bool_decode( &o, ctx );
4340 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4341 0 : if( o ) {
4342 0 : err = fd_bincode_int64_decode_footprint( ctx );
4343 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4344 0 : }
4345 0 : }
4346 0 : return 0;
4347 0 : }
4348 0 : int fd_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4349 0 : *total_sz += sizeof(fd_vote_t);
4350 0 : void const * start_data = ctx->data;
4351 0 : int err = fd_vote_decode_footprint_inner( ctx, total_sz );
4352 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4353 0 : ctx->data = start_data;
4354 0 : return err;
4355 0 : }
4356 0 : static void fd_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4357 0 : fd_vote_t * self = (fd_vote_t *)struct_mem;
4358 0 : ulong slots_len;
4359 0 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
4360 0 : self->slots = deq_ulong_join_new( alloc_mem, slots_len );
4361 0 : for( ulong i=0; i < slots_len; i++ ) {
4362 0 : ulong * elem = deq_ulong_push_tail_nocopy( self->slots );
4363 0 : fd_bincode_uint64_decode_unsafe( elem, ctx );
4364 0 : }
4365 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4366 0 : {
4367 0 : uchar o;
4368 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
4369 0 : self->has_timestamp = !!o;
4370 0 : if( o ) {
4371 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
4372 0 : }
4373 0 : }
4374 0 : }
4375 0 : void * fd_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4376 0 : fd_vote_t * self = (fd_vote_t *)mem;
4377 0 : fd_vote_new( self );
4378 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_t);
4379 0 : void * * alloc_mem = &alloc_region;
4380 0 : fd_vote_decode_inner( mem, alloc_mem, ctx );
4381 0 : return self;
4382 0 : }
4383 0 : void fd_vote_new(fd_vote_t * self) {
4384 0 : fd_memset( self, 0, sizeof(fd_vote_t) );
4385 0 : fd_hash_new( &self->hash );
4386 0 : }
4387 0 : ulong fd_vote_size( fd_vote_t const * self ) {
4388 0 : ulong size = 0;
4389 0 : if( self->slots ) {
4390 0 : size += sizeof(ulong);
4391 0 : ulong slots_len = deq_ulong_cnt(self->slots);
4392 0 : size += slots_len * sizeof(ulong);
4393 0 : } else {
4394 0 : size += sizeof(ulong);
4395 0 : }
4396 0 : size += fd_hash_size( &self->hash );
4397 0 : size += sizeof(char);
4398 0 : if( self->has_timestamp ) {
4399 0 : size += sizeof(long);
4400 0 : }
4401 0 : return size;
4402 0 : }
4403 :
4404 0 : int fd_vote_init_encode( fd_vote_init_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4405 0 : int err;
4406 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
4407 0 : if( FD_UNLIKELY( err ) ) return err;
4408 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
4409 0 : if( FD_UNLIKELY( err ) ) return err;
4410 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
4411 0 : if( FD_UNLIKELY( err ) ) return err;
4412 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
4413 0 : if( FD_UNLIKELY( err ) ) return err;
4414 0 : return FD_BINCODE_SUCCESS;
4415 0 : }
4416 6 : static inline int fd_vote_init_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4417 6 : if( (ulong)ctx->data + 97UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4418 6 : ctx->data = (void *)( (ulong)ctx->data + 97UL );
4419 6 : return 0;
4420 6 : }
4421 6 : static void fd_vote_init_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4422 6 : fd_vote_init_t * self = (fd_vote_init_t *)struct_mem;
4423 6 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
4424 6 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
4425 6 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
4426 6 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
4427 6 : }
4428 0 : void * fd_vote_init_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4429 0 : fd_vote_init_t * self = (fd_vote_init_t *)mem;
4430 0 : fd_vote_init_new( self );
4431 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_t);
4432 0 : void * * alloc_mem = &alloc_region;
4433 0 : fd_vote_init_decode_inner( mem, alloc_mem, ctx );
4434 0 : return self;
4435 0 : }
4436 0 : int fd_vote_init_v2_encode( fd_vote_init_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4437 0 : int err;
4438 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
4439 0 : if( FD_UNLIKELY( err ) ) return err;
4440 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
4441 0 : if( FD_UNLIKELY( err ) ) return err;
4442 0 : err = fd_bls_pubkey_compressed_encode( &self->authorized_voter_bls_pubkey, ctx );
4443 0 : if( FD_UNLIKELY( err ) ) return err;
4444 0 : err = fd_bls_proof_of_possession_encode( &self->authorized_voter_bls_proof_of_possession, ctx );
4445 0 : if( FD_UNLIKELY( err ) ) return err;
4446 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
4447 0 : if( FD_UNLIKELY( err ) ) return err;
4448 0 : err = fd_bincode_uint16_encode( self->inflation_rewards_commission_bps, ctx );
4449 0 : if( FD_UNLIKELY( err ) ) return err;
4450 0 : err = fd_pubkey_encode( &self->inflation_rewards_collector, ctx );
4451 0 : if( FD_UNLIKELY( err ) ) return err;
4452 0 : err = fd_bincode_uint16_encode( self->block_revenue_commission_bps, ctx );
4453 0 : if( FD_UNLIKELY( err ) ) return err;
4454 0 : err = fd_pubkey_encode( &self->block_revenue_collector, ctx );
4455 0 : if( FD_UNLIKELY( err ) ) return err;
4456 0 : return FD_BINCODE_SUCCESS;
4457 0 : }
4458 9 : static inline int fd_vote_init_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4459 9 : if( (ulong)ctx->data + 308UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4460 9 : ctx->data = (void *)( (ulong)ctx->data + 308UL );
4461 9 : return 0;
4462 9 : }
4463 9 : static void fd_vote_init_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4464 9 : fd_vote_init_v2_t * self = (fd_vote_init_v2_t *)struct_mem;
4465 9 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
4466 9 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
4467 9 : fd_bls_pubkey_compressed_decode_inner( &self->authorized_voter_bls_pubkey, alloc_mem, ctx );
4468 9 : fd_bls_proof_of_possession_decode_inner( &self->authorized_voter_bls_proof_of_possession, alloc_mem, ctx );
4469 9 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
4470 9 : fd_bincode_uint16_decode_unsafe( &self->inflation_rewards_commission_bps, ctx );
4471 9 : fd_pubkey_decode_inner( &self->inflation_rewards_collector, alloc_mem, ctx );
4472 9 : fd_bincode_uint16_decode_unsafe( &self->block_revenue_commission_bps, ctx );
4473 9 : fd_pubkey_decode_inner( &self->block_revenue_collector, alloc_mem, ctx );
4474 9 : }
4475 0 : void * fd_vote_init_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4476 0 : fd_vote_init_v2_t * self = (fd_vote_init_v2_t *)mem;
4477 0 : fd_vote_init_v2_new( self );
4478 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_v2_t);
4479 0 : void * * alloc_mem = &alloc_region;
4480 0 : fd_vote_init_v2_decode_inner( mem, alloc_mem, ctx );
4481 0 : return self;
4482 0 : }
4483 0 : int fd_voter_with_bls_args_encode( fd_voter_with_bls_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4484 0 : int err;
4485 0 : err = fd_bls_pubkey_compressed_encode( &self->bls_pubkey, ctx );
4486 0 : if( FD_UNLIKELY( err ) ) return err;
4487 0 : err = fd_bls_proof_of_possession_encode( &self->bls_proof_of_possession, ctx );
4488 0 : if( FD_UNLIKELY( err ) ) return err;
4489 0 : return FD_BINCODE_SUCCESS;
4490 0 : }
4491 0 : static inline int fd_voter_with_bls_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4492 0 : if( (ulong)ctx->data + 144UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4493 0 : ctx->data = (void *)( (ulong)ctx->data + 144UL );
4494 0 : return 0;
4495 0 : }
4496 0 : static void fd_voter_with_bls_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4497 0 : fd_voter_with_bls_args_t * self = (fd_voter_with_bls_args_t *)struct_mem;
4498 0 : fd_bls_pubkey_compressed_decode_inner( &self->bls_pubkey, alloc_mem, ctx );
4499 0 : fd_bls_proof_of_possession_decode_inner( &self->bls_proof_of_possession, alloc_mem, ctx );
4500 0 : }
4501 0 : void * fd_voter_with_bls_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4502 0 : fd_voter_with_bls_args_t * self = (fd_voter_with_bls_args_t *)mem;
4503 0 : fd_voter_with_bls_args_new( self );
4504 0 : void * alloc_region = (uchar *)mem + sizeof(fd_voter_with_bls_args_t);
4505 0 : void * * alloc_mem = &alloc_region;
4506 0 : fd_voter_with_bls_args_decode_inner( mem, alloc_mem, ctx );
4507 0 : return self;
4508 0 : }
4509 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter(fd_vote_authorize_t const * self) {
4510 0 : return self->discriminant == 0;
4511 0 : }
4512 0 : FD_FN_PURE uchar fd_vote_authorize_is_withdrawer(fd_vote_authorize_t const * self) {
4513 0 : return self->discriminant == 1;
4514 0 : }
4515 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter_with_bls(fd_vote_authorize_t const * self) {
4516 0 : return self->discriminant == 2;
4517 0 : }
4518 : void fd_vote_authorize_inner_new( fd_vote_authorize_inner_t * self, uint discriminant );
4519 0 : int fd_vote_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4520 0 : int err;
4521 0 : switch (discriminant) {
4522 0 : case 0: {
4523 0 : return FD_BINCODE_SUCCESS;
4524 0 : }
4525 0 : case 1: {
4526 0 : return FD_BINCODE_SUCCESS;
4527 0 : }
4528 0 : case 2: {
4529 0 : err = fd_voter_with_bls_args_decode_footprint_inner( ctx, total_sz );
4530 0 : if( FD_UNLIKELY( err ) ) return err;
4531 0 : return FD_BINCODE_SUCCESS;
4532 0 : }
4533 0 : default: return FD_BINCODE_ERR_ENCODING;
4534 0 : }
4535 0 : }
4536 0 : static int fd_vote_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4537 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4538 0 : uint discriminant = 0;
4539 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4540 0 : if( FD_UNLIKELY( err ) ) return err;
4541 0 : return fd_vote_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
4542 0 : }
4543 0 : int fd_vote_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4544 0 : *total_sz += sizeof(fd_vote_authorize_t);
4545 0 : void const * start_data = ctx->data;
4546 0 : int err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4547 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4548 0 : ctx->data = start_data;
4549 0 : return err;
4550 0 : }
4551 0 : static void fd_vote_authorize_inner_decode_inner( fd_vote_authorize_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
4552 0 : switch (discriminant) {
4553 0 : case 0: {
4554 0 : break;
4555 0 : }
4556 0 : case 1: {
4557 0 : break;
4558 0 : }
4559 0 : case 2: {
4560 0 : fd_voter_with_bls_args_decode_inner( &self->voter_with_bls, alloc_mem, ctx );
4561 0 : break;
4562 0 : }
4563 0 : }
4564 0 : }
4565 0 : static void fd_vote_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4566 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)struct_mem;
4567 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4568 0 : fd_vote_authorize_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
4569 0 : }
4570 0 : void * fd_vote_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4571 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)mem;
4572 0 : fd_vote_authorize_new( self );
4573 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_t);
4574 0 : void * * alloc_mem = &alloc_region;
4575 0 : fd_vote_authorize_decode_inner( mem, alloc_mem, ctx );
4576 0 : return self;
4577 0 : }
4578 0 : void fd_vote_authorize_inner_new( fd_vote_authorize_inner_t * self, uint discriminant ) {
4579 0 : switch( discriminant ) {
4580 0 : case 0: {
4581 0 : break;
4582 0 : }
4583 0 : case 1: {
4584 0 : break;
4585 0 : }
4586 0 : case 2: {
4587 0 : fd_voter_with_bls_args_new( &self->voter_with_bls );
4588 0 : break;
4589 0 : }
4590 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
4591 0 : }
4592 0 : }
4593 0 : void fd_vote_authorize_new_disc( fd_vote_authorize_t * self, uint discriminant ) {
4594 0 : self->discriminant = discriminant;
4595 0 : fd_vote_authorize_inner_new( &self->inner, self->discriminant );
4596 0 : }
4597 0 : void fd_vote_authorize_new( fd_vote_authorize_t * self ) {
4598 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_t) );
4599 0 : fd_vote_authorize_new_disc( self, UINT_MAX );
4600 0 : }
4601 :
4602 0 : ulong fd_vote_authorize_size( fd_vote_authorize_t const * self ) {
4603 0 : ulong size = 0;
4604 0 : size += sizeof(uint);
4605 0 : switch (self->discriminant) {
4606 0 : case 2: {
4607 0 : size += fd_voter_with_bls_args_size( &self->inner.voter_with_bls );
4608 0 : break;
4609 0 : }
4610 0 : }
4611 0 : return size;
4612 0 : }
4613 :
4614 0 : int fd_vote_authorize_inner_encode( fd_vote_authorize_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
4615 0 : int err;
4616 0 : switch (discriminant) {
4617 0 : case 2: {
4618 0 : err = fd_voter_with_bls_args_encode( &self->voter_with_bls, ctx );
4619 0 : if( FD_UNLIKELY( err ) ) return err;
4620 0 : break;
4621 0 : }
4622 0 : }
4623 0 : return FD_BINCODE_SUCCESS;
4624 0 : }
4625 0 : int fd_vote_authorize_encode( fd_vote_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4626 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4627 0 : if( FD_UNLIKELY( err ) ) return err;
4628 0 : return fd_vote_authorize_inner_encode( &self->inner, self->discriminant, ctx );
4629 0 : }
4630 :
4631 0 : int fd_vote_authorize_pubkey_encode( fd_vote_authorize_pubkey_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4632 0 : int err;
4633 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
4634 0 : if( FD_UNLIKELY( err ) ) return err;
4635 0 : err = fd_vote_authorize_encode( &self->vote_authorize, ctx );
4636 0 : if( FD_UNLIKELY( err ) ) return err;
4637 0 : return FD_BINCODE_SUCCESS;
4638 0 : }
4639 0 : static int fd_vote_authorize_pubkey_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4640 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4641 0 : int err = 0;
4642 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4643 0 : if( FD_UNLIKELY( err ) ) return err;
4644 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4645 0 : if( FD_UNLIKELY( err ) ) return err;
4646 0 : return 0;
4647 0 : }
4648 0 : int fd_vote_authorize_pubkey_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4649 0 : *total_sz += sizeof(fd_vote_authorize_pubkey_t);
4650 0 : void const * start_data = ctx->data;
4651 0 : int err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
4652 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4653 0 : ctx->data = start_data;
4654 0 : return err;
4655 0 : }
4656 0 : static void fd_vote_authorize_pubkey_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4657 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)struct_mem;
4658 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
4659 0 : fd_vote_authorize_decode_inner( &self->vote_authorize, alloc_mem, ctx );
4660 0 : }
4661 0 : void * fd_vote_authorize_pubkey_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4662 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)mem;
4663 0 : fd_vote_authorize_pubkey_new( self );
4664 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_pubkey_t);
4665 0 : void * * alloc_mem = &alloc_region;
4666 0 : fd_vote_authorize_pubkey_decode_inner( mem, alloc_mem, ctx );
4667 0 : return self;
4668 0 : }
4669 0 : void fd_vote_authorize_pubkey_new(fd_vote_authorize_pubkey_t * self) {
4670 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_pubkey_t) );
4671 0 : fd_pubkey_new( &self->pubkey );
4672 0 : fd_vote_authorize_new( &self->vote_authorize );
4673 0 : }
4674 0 : ulong fd_vote_authorize_pubkey_size( fd_vote_authorize_pubkey_t const * self ) {
4675 0 : ulong size = 0;
4676 0 : size += fd_pubkey_size( &self->pubkey );
4677 0 : size += fd_vote_authorize_size( &self->vote_authorize );
4678 0 : return size;
4679 0 : }
4680 :
4681 0 : int fd_vote_switch_encode( fd_vote_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4682 0 : int err;
4683 0 : err = fd_vote_encode( &self->vote, ctx );
4684 0 : if( FD_UNLIKELY( err ) ) return err;
4685 0 : err = fd_hash_encode( &self->hash, ctx );
4686 0 : if( FD_UNLIKELY( err ) ) return err;
4687 0 : return FD_BINCODE_SUCCESS;
4688 0 : }
4689 0 : static int fd_vote_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4690 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4691 0 : int err = 0;
4692 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
4693 0 : if( FD_UNLIKELY( err ) ) return err;
4694 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4695 0 : if( FD_UNLIKELY( err ) ) return err;
4696 0 : return 0;
4697 0 : }
4698 0 : int fd_vote_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4699 0 : *total_sz += sizeof(fd_vote_switch_t);
4700 0 : void const * start_data = ctx->data;
4701 0 : int err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
4702 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4703 0 : ctx->data = start_data;
4704 0 : return err;
4705 0 : }
4706 0 : static void fd_vote_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4707 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)struct_mem;
4708 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
4709 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4710 0 : }
4711 0 : void * fd_vote_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4712 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)mem;
4713 0 : fd_vote_switch_new( self );
4714 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_switch_t);
4715 0 : void * * alloc_mem = &alloc_region;
4716 0 : fd_vote_switch_decode_inner( mem, alloc_mem, ctx );
4717 0 : return self;
4718 0 : }
4719 0 : void fd_vote_switch_new(fd_vote_switch_t * self) {
4720 0 : fd_memset( self, 0, sizeof(fd_vote_switch_t) );
4721 0 : fd_vote_new( &self->vote );
4722 0 : fd_hash_new( &self->hash );
4723 0 : }
4724 0 : ulong fd_vote_switch_size( fd_vote_switch_t const * self ) {
4725 0 : ulong size = 0;
4726 0 : size += fd_vote_size( &self->vote );
4727 0 : size += fd_hash_size( &self->hash );
4728 0 : return size;
4729 0 : }
4730 :
4731 0 : int fd_update_vote_state_switch_encode( fd_update_vote_state_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4732 0 : int err;
4733 0 : err = fd_vote_state_update_encode( &self->vote_state_update, ctx );
4734 0 : if( FD_UNLIKELY( err ) ) return err;
4735 0 : err = fd_hash_encode( &self->hash, ctx );
4736 0 : if( FD_UNLIKELY( err ) ) return err;
4737 0 : return FD_BINCODE_SUCCESS;
4738 0 : }
4739 0 : static int fd_update_vote_state_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4740 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4741 0 : int err = 0;
4742 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
4743 0 : if( FD_UNLIKELY( err ) ) return err;
4744 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4745 0 : if( FD_UNLIKELY( err ) ) return err;
4746 0 : return 0;
4747 0 : }
4748 0 : int fd_update_vote_state_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4749 0 : *total_sz += sizeof(fd_update_vote_state_switch_t);
4750 0 : void const * start_data = ctx->data;
4751 0 : int err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
4752 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4753 0 : ctx->data = start_data;
4754 0 : return err;
4755 0 : }
4756 0 : static void fd_update_vote_state_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4757 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)struct_mem;
4758 0 : fd_vote_state_update_decode_inner( &self->vote_state_update, alloc_mem, ctx );
4759 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4760 0 : }
4761 0 : void * fd_update_vote_state_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4762 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)mem;
4763 0 : fd_update_vote_state_switch_new( self );
4764 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_vote_state_switch_t);
4765 0 : void * * alloc_mem = &alloc_region;
4766 0 : fd_update_vote_state_switch_decode_inner( mem, alloc_mem, ctx );
4767 0 : return self;
4768 0 : }
4769 0 : void fd_update_vote_state_switch_new(fd_update_vote_state_switch_t * self) {
4770 0 : fd_memset( self, 0, sizeof(fd_update_vote_state_switch_t) );
4771 0 : fd_vote_state_update_new( &self->vote_state_update );
4772 0 : fd_hash_new( &self->hash );
4773 0 : }
4774 0 : ulong fd_update_vote_state_switch_size( fd_update_vote_state_switch_t const * self ) {
4775 0 : ulong size = 0;
4776 0 : size += fd_vote_state_update_size( &self->vote_state_update );
4777 0 : size += fd_hash_size( &self->hash );
4778 0 : return size;
4779 0 : }
4780 :
4781 0 : int fd_vote_authorize_with_seed_args_encode( fd_vote_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4782 0 : int err;
4783 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
4784 0 : if( FD_UNLIKELY( err ) ) return err;
4785 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
4786 0 : if( FD_UNLIKELY( err ) ) return err;
4787 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
4788 0 : if( FD_UNLIKELY(err) ) return err;
4789 0 : if( self->current_authority_derived_key_seed_len ) {
4790 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4791 0 : if( FD_UNLIKELY( err ) ) return err;
4792 0 : }
4793 0 : err = fd_pubkey_encode( &self->new_authority, ctx );
4794 0 : if( FD_UNLIKELY( err ) ) return err;
4795 0 : return FD_BINCODE_SUCCESS;
4796 0 : }
4797 0 : static int fd_vote_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4798 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4799 0 : int err = 0;
4800 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4801 0 : if( FD_UNLIKELY( err ) ) return err;
4802 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4803 0 : if( FD_UNLIKELY( err ) ) return err;
4804 0 : ulong current_authority_derived_key_seed_len;
4805 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
4806 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4807 0 : *total_sz += current_authority_derived_key_seed_len;
4808 0 : if( current_authority_derived_key_seed_len ) {
4809 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
4810 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4811 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
4812 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4813 0 : }
4814 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4815 0 : if( FD_UNLIKELY( err ) ) return err;
4816 0 : return 0;
4817 0 : }
4818 0 : int fd_vote_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4819 0 : *total_sz += sizeof(fd_vote_authorize_with_seed_args_t);
4820 0 : void const * start_data = ctx->data;
4821 0 : int err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
4822 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4823 0 : ctx->data = start_data;
4824 0 : return err;
4825 0 : }
4826 0 : static void fd_vote_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4827 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)struct_mem;
4828 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
4829 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
4830 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
4831 0 : if( self->current_authority_derived_key_seed_len ) {
4832 0 : self->current_authority_derived_key_seed = *alloc_mem;
4833 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4834 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
4835 0 : } else
4836 0 : self->current_authority_derived_key_seed = NULL;
4837 0 : fd_pubkey_decode_inner( &self->new_authority, alloc_mem, ctx );
4838 0 : }
4839 0 : void * fd_vote_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4840 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)mem;
4841 0 : fd_vote_authorize_with_seed_args_new( self );
4842 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_with_seed_args_t);
4843 0 : void * * alloc_mem = &alloc_region;
4844 0 : fd_vote_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
4845 0 : return self;
4846 0 : }
4847 0 : void fd_vote_authorize_with_seed_args_new(fd_vote_authorize_with_seed_args_t * self) {
4848 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_with_seed_args_t) );
4849 0 : fd_vote_authorize_new( &self->authorization_type );
4850 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
4851 0 : fd_pubkey_new( &self->new_authority );
4852 0 : }
4853 0 : ulong fd_vote_authorize_with_seed_args_size( fd_vote_authorize_with_seed_args_t const * self ) {
4854 0 : ulong size = 0;
4855 0 : size += fd_vote_authorize_size( &self->authorization_type );
4856 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
4857 0 : do {
4858 0 : size += sizeof(ulong);
4859 0 : size += self->current_authority_derived_key_seed_len;
4860 0 : } while(0);
4861 0 : size += fd_pubkey_size( &self->new_authority );
4862 0 : return size;
4863 0 : }
4864 :
4865 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 ) {
4866 0 : int err;
4867 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
4868 0 : if( FD_UNLIKELY( err ) ) return err;
4869 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
4870 0 : if( FD_UNLIKELY( err ) ) return err;
4871 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
4872 0 : if( FD_UNLIKELY(err) ) return err;
4873 0 : if( self->current_authority_derived_key_seed_len ) {
4874 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4875 0 : if( FD_UNLIKELY( err ) ) return err;
4876 0 : }
4877 0 : return FD_BINCODE_SUCCESS;
4878 0 : }
4879 0 : static int fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4880 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4881 0 : int err = 0;
4882 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4883 0 : if( FD_UNLIKELY( err ) ) return err;
4884 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4885 0 : if( FD_UNLIKELY( err ) ) return err;
4886 0 : ulong current_authority_derived_key_seed_len;
4887 0 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
4888 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4889 0 : *total_sz += current_authority_derived_key_seed_len;
4890 0 : if( current_authority_derived_key_seed_len ) {
4891 0 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
4892 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4893 0 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
4894 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4895 0 : }
4896 0 : return 0;
4897 0 : }
4898 0 : int fd_vote_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4899 0 : *total_sz += sizeof(fd_vote_authorize_checked_with_seed_args_t);
4900 0 : void const * start_data = ctx->data;
4901 0 : int err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
4902 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4903 0 : ctx->data = start_data;
4904 0 : return err;
4905 0 : }
4906 0 : static void fd_vote_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4907 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)struct_mem;
4908 0 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
4909 0 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
4910 0 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
4911 0 : if( self->current_authority_derived_key_seed_len ) {
4912 0 : self->current_authority_derived_key_seed = *alloc_mem;
4913 0 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4914 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
4915 0 : } else
4916 0 : self->current_authority_derived_key_seed = NULL;
4917 0 : }
4918 0 : void * fd_vote_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4919 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)mem;
4920 0 : fd_vote_authorize_checked_with_seed_args_new( self );
4921 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_checked_with_seed_args_t);
4922 0 : void * * alloc_mem = &alloc_region;
4923 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
4924 0 : return self;
4925 0 : }
4926 0 : void fd_vote_authorize_checked_with_seed_args_new(fd_vote_authorize_checked_with_seed_args_t * self) {
4927 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_checked_with_seed_args_t) );
4928 0 : fd_vote_authorize_new( &self->authorization_type );
4929 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
4930 0 : }
4931 0 : ulong fd_vote_authorize_checked_with_seed_args_size( fd_vote_authorize_checked_with_seed_args_t const * self ) {
4932 0 : ulong size = 0;
4933 0 : size += fd_vote_authorize_size( &self->authorization_type );
4934 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
4935 0 : do {
4936 0 : size += sizeof(ulong);
4937 0 : size += self->current_authority_derived_key_seed_len;
4938 0 : } while(0);
4939 0 : return size;
4940 0 : }
4941 :
4942 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account(fd_vote_instruction_t const * self) {
4943 0 : return self->discriminant == 0;
4944 0 : }
4945 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize(fd_vote_instruction_t const * self) {
4946 0 : return self->discriminant == 1;
4947 0 : }
4948 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote(fd_vote_instruction_t const * self) {
4949 0 : return self->discriminant == 2;
4950 0 : }
4951 0 : FD_FN_PURE uchar fd_vote_instruction_is_withdraw(fd_vote_instruction_t const * self) {
4952 0 : return self->discriminant == 3;
4953 0 : }
4954 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_validator_identity(fd_vote_instruction_t const * self) {
4955 0 : return self->discriminant == 4;
4956 0 : }
4957 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission(fd_vote_instruction_t const * self) {
4958 0 : return self->discriminant == 5;
4959 0 : }
4960 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote_switch(fd_vote_instruction_t const * self) {
4961 0 : return self->discriminant == 6;
4962 0 : }
4963 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked(fd_vote_instruction_t const * self) {
4964 0 : return self->discriminant == 7;
4965 0 : }
4966 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state(fd_vote_instruction_t const * self) {
4967 0 : return self->discriminant == 8;
4968 0 : }
4969 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state_switch(fd_vote_instruction_t const * self) {
4970 0 : return self->discriminant == 9;
4971 0 : }
4972 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_with_seed(fd_vote_instruction_t const * self) {
4973 0 : return self->discriminant == 10;
4974 0 : }
4975 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked_with_seed(fd_vote_instruction_t const * self) {
4976 0 : return self->discriminant == 11;
4977 0 : }
4978 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state(fd_vote_instruction_t const * self) {
4979 0 : return self->discriminant == 12;
4980 0 : }
4981 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state_switch(fd_vote_instruction_t const * self) {
4982 0 : return self->discriminant == 13;
4983 0 : }
4984 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync(fd_vote_instruction_t const * self) {
4985 0 : return self->discriminant == 14;
4986 0 : }
4987 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync_switch(fd_vote_instruction_t const * self) {
4988 0 : return self->discriminant == 15;
4989 0 : }
4990 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account_v2(fd_vote_instruction_t const * self) {
4991 0 : return self->discriminant == 16;
4992 0 : }
4993 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant );
4994 15 : int fd_vote_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4995 15 : int err;
4996 15 : switch (discriminant) {
4997 6 : case 0: {
4998 6 : err = fd_vote_init_decode_footprint_inner( ctx, total_sz );
4999 6 : if( FD_UNLIKELY( err ) ) return err;
5000 6 : return FD_BINCODE_SUCCESS;
5001 6 : }
5002 0 : case 1: {
5003 0 : err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
5004 0 : if( FD_UNLIKELY( err ) ) return err;
5005 0 : return FD_BINCODE_SUCCESS;
5006 0 : }
5007 0 : case 2: {
5008 0 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
5009 0 : if( FD_UNLIKELY( err ) ) return err;
5010 0 : return FD_BINCODE_SUCCESS;
5011 0 : }
5012 0 : case 3: {
5013 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5014 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5015 0 : return FD_BINCODE_SUCCESS;
5016 0 : }
5017 0 : case 4: {
5018 0 : return FD_BINCODE_SUCCESS;
5019 0 : }
5020 0 : case 5: {
5021 0 : err = fd_bincode_uint8_decode_footprint( ctx );
5022 0 : if( FD_UNLIKELY( err ) ) return err;
5023 0 : return FD_BINCODE_SUCCESS;
5024 0 : }
5025 0 : case 6: {
5026 0 : err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
5027 0 : if( FD_UNLIKELY( err ) ) return err;
5028 0 : return FD_BINCODE_SUCCESS;
5029 0 : }
5030 0 : case 7: {
5031 0 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
5032 0 : if( FD_UNLIKELY( err ) ) return err;
5033 0 : return FD_BINCODE_SUCCESS;
5034 0 : }
5035 0 : case 8: {
5036 0 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
5037 0 : if( FD_UNLIKELY( err ) ) return err;
5038 0 : return FD_BINCODE_SUCCESS;
5039 0 : }
5040 0 : case 9: {
5041 0 : err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
5042 0 : if( FD_UNLIKELY( err ) ) return err;
5043 0 : return FD_BINCODE_SUCCESS;
5044 0 : }
5045 0 : case 10: {
5046 0 : err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
5047 0 : if( FD_UNLIKELY( err ) ) return err;
5048 0 : return FD_BINCODE_SUCCESS;
5049 0 : }
5050 0 : case 11: {
5051 0 : err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
5052 0 : if( FD_UNLIKELY( err ) ) return err;
5053 0 : return FD_BINCODE_SUCCESS;
5054 0 : }
5055 0 : case 12: {
5056 0 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
5057 0 : if( FD_UNLIKELY( err ) ) return err;
5058 0 : return FD_BINCODE_SUCCESS;
5059 0 : }
5060 0 : case 13: {
5061 0 : err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
5062 0 : if( FD_UNLIKELY( err ) ) return err;
5063 0 : return FD_BINCODE_SUCCESS;
5064 0 : }
5065 0 : case 14: {
5066 0 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
5067 0 : if( FD_UNLIKELY( err ) ) return err;
5068 0 : return FD_BINCODE_SUCCESS;
5069 0 : }
5070 0 : case 15: {
5071 0 : err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
5072 0 : if( FD_UNLIKELY( err ) ) return err;
5073 0 : return FD_BINCODE_SUCCESS;
5074 0 : }
5075 9 : case 16: {
5076 9 : err = fd_vote_init_v2_decode_footprint_inner( ctx, total_sz );
5077 9 : if( FD_UNLIKELY( err ) ) return err;
5078 9 : return FD_BINCODE_SUCCESS;
5079 9 : }
5080 0 : default: return FD_BINCODE_ERR_ENCODING;
5081 15 : }
5082 15 : }
5083 15 : static int fd_vote_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5084 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5085 15 : uint discriminant = 0;
5086 15 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
5087 15 : if( FD_UNLIKELY( err ) ) return err;
5088 15 : return fd_vote_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
5089 15 : }
5090 15 : int fd_vote_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5091 15 : *total_sz += sizeof(fd_vote_instruction_t);
5092 15 : void const * start_data = ctx->data;
5093 15 : int err = fd_vote_instruction_decode_footprint_inner( ctx, total_sz );
5094 15 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5095 15 : ctx->data = start_data;
5096 15 : return err;
5097 15 : }
5098 15 : 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 ) {
5099 15 : switch (discriminant) {
5100 6 : case 0: {
5101 6 : fd_vote_init_decode_inner( &self->initialize_account, alloc_mem, ctx );
5102 6 : break;
5103 0 : }
5104 0 : case 1: {
5105 0 : fd_vote_authorize_pubkey_decode_inner( &self->authorize, alloc_mem, ctx );
5106 0 : break;
5107 0 : }
5108 0 : case 2: {
5109 0 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
5110 0 : break;
5111 0 : }
5112 0 : case 3: {
5113 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
5114 0 : break;
5115 0 : }
5116 0 : case 4: {
5117 0 : break;
5118 0 : }
5119 0 : case 5: {
5120 0 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
5121 0 : break;
5122 0 : }
5123 0 : case 6: {
5124 0 : fd_vote_switch_decode_inner( &self->vote_switch, alloc_mem, ctx );
5125 0 : break;
5126 0 : }
5127 0 : case 7: {
5128 0 : fd_vote_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
5129 0 : break;
5130 0 : }
5131 0 : case 8: {
5132 0 : fd_vote_state_update_decode_inner( &self->update_vote_state, alloc_mem, ctx );
5133 0 : break;
5134 0 : }
5135 0 : case 9: {
5136 0 : fd_update_vote_state_switch_decode_inner( &self->update_vote_state_switch, alloc_mem, ctx );
5137 0 : break;
5138 0 : }
5139 0 : case 10: {
5140 0 : fd_vote_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
5141 0 : break;
5142 0 : }
5143 0 : case 11: {
5144 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
5145 0 : break;
5146 0 : }
5147 0 : case 12: {
5148 0 : fd_compact_vote_state_update_decode_inner( &self->compact_update_vote_state, alloc_mem, ctx );
5149 0 : break;
5150 0 : }
5151 0 : case 13: {
5152 0 : fd_compact_vote_state_update_switch_decode_inner( &self->compact_update_vote_state_switch, alloc_mem, ctx );
5153 0 : break;
5154 0 : }
5155 0 : case 14: {
5156 0 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
5157 0 : break;
5158 0 : }
5159 0 : case 15: {
5160 0 : fd_tower_sync_switch_decode_inner( &self->tower_sync_switch, alloc_mem, ctx );
5161 0 : break;
5162 0 : }
5163 9 : case 16: {
5164 9 : fd_vote_init_v2_decode_inner( &self->initialize_account_v2, alloc_mem, ctx );
5165 9 : break;
5166 0 : }
5167 15 : }
5168 15 : }
5169 15 : static void fd_vote_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5170 15 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)struct_mem;
5171 15 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5172 15 : fd_vote_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
5173 15 : }
5174 15 : void * fd_vote_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5175 15 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)mem;
5176 15 : fd_vote_instruction_new( self );
5177 15 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_instruction_t);
5178 15 : void * * alloc_mem = &alloc_region;
5179 15 : fd_vote_instruction_decode_inner( mem, alloc_mem, ctx );
5180 15 : return self;
5181 15 : }
5182 15 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant ) {
5183 15 : switch( discriminant ) {
5184 0 : case 0: {
5185 0 : fd_vote_init_new( &self->initialize_account );
5186 0 : break;
5187 0 : }
5188 0 : case 1: {
5189 0 : fd_vote_authorize_pubkey_new( &self->authorize );
5190 0 : break;
5191 0 : }
5192 0 : case 2: {
5193 0 : fd_vote_new( &self->vote );
5194 0 : break;
5195 0 : }
5196 0 : case 3: {
5197 0 : break;
5198 0 : }
5199 0 : case 4: {
5200 0 : break;
5201 0 : }
5202 0 : case 5: {
5203 0 : break;
5204 0 : }
5205 0 : case 6: {
5206 0 : fd_vote_switch_new( &self->vote_switch );
5207 0 : break;
5208 0 : }
5209 0 : case 7: {
5210 0 : fd_vote_authorize_new( &self->authorize_checked );
5211 0 : break;
5212 0 : }
5213 0 : case 8: {
5214 0 : fd_vote_state_update_new( &self->update_vote_state );
5215 0 : break;
5216 0 : }
5217 0 : case 9: {
5218 0 : fd_update_vote_state_switch_new( &self->update_vote_state_switch );
5219 0 : break;
5220 0 : }
5221 0 : case 10: {
5222 0 : fd_vote_authorize_with_seed_args_new( &self->authorize_with_seed );
5223 0 : break;
5224 0 : }
5225 0 : case 11: {
5226 0 : fd_vote_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
5227 0 : break;
5228 0 : }
5229 0 : case 12: {
5230 0 : fd_compact_vote_state_update_new( &self->compact_update_vote_state );
5231 0 : break;
5232 0 : }
5233 0 : case 13: {
5234 0 : fd_compact_vote_state_update_switch_new( &self->compact_update_vote_state_switch );
5235 0 : break;
5236 0 : }
5237 0 : case 14: {
5238 0 : fd_tower_sync_new( &self->tower_sync );
5239 0 : break;
5240 0 : }
5241 0 : case 15: {
5242 0 : fd_tower_sync_switch_new( &self->tower_sync_switch );
5243 0 : break;
5244 0 : }
5245 0 : case 16: {
5246 0 : fd_vote_init_v2_new( &self->initialize_account_v2 );
5247 0 : break;
5248 0 : }
5249 15 : default: break; // FD_LOG_ERR(( "unhandled type"));
5250 15 : }
5251 15 : }
5252 15 : void fd_vote_instruction_new_disc( fd_vote_instruction_t * self, uint discriminant ) {
5253 15 : self->discriminant = discriminant;
5254 15 : fd_vote_instruction_inner_new( &self->inner, self->discriminant );
5255 15 : }
5256 15 : void fd_vote_instruction_new( fd_vote_instruction_t * self ) {
5257 15 : fd_memset( self, 0, sizeof(fd_vote_instruction_t) );
5258 15 : fd_vote_instruction_new_disc( self, UINT_MAX );
5259 15 : }
5260 :
5261 0 : ulong fd_vote_instruction_size( fd_vote_instruction_t const * self ) {
5262 0 : ulong size = 0;
5263 0 : size += sizeof(uint);
5264 0 : switch (self->discriminant) {
5265 0 : case 0: {
5266 0 : size += fd_vote_init_size( &self->inner.initialize_account );
5267 0 : break;
5268 0 : }
5269 0 : case 1: {
5270 0 : size += fd_vote_authorize_pubkey_size( &self->inner.authorize );
5271 0 : break;
5272 0 : }
5273 0 : case 2: {
5274 0 : size += fd_vote_size( &self->inner.vote );
5275 0 : break;
5276 0 : }
5277 0 : case 3: {
5278 0 : size += sizeof(ulong);
5279 0 : break;
5280 0 : }
5281 0 : case 5: {
5282 0 : size += sizeof(char);
5283 0 : break;
5284 0 : }
5285 0 : case 6: {
5286 0 : size += fd_vote_switch_size( &self->inner.vote_switch );
5287 0 : break;
5288 0 : }
5289 0 : case 7: {
5290 0 : size += fd_vote_authorize_size( &self->inner.authorize_checked );
5291 0 : break;
5292 0 : }
5293 0 : case 8: {
5294 0 : size += fd_vote_state_update_size( &self->inner.update_vote_state );
5295 0 : break;
5296 0 : }
5297 0 : case 9: {
5298 0 : size += fd_update_vote_state_switch_size( &self->inner.update_vote_state_switch );
5299 0 : break;
5300 0 : }
5301 0 : case 10: {
5302 0 : size += fd_vote_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
5303 0 : break;
5304 0 : }
5305 0 : case 11: {
5306 0 : size += fd_vote_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
5307 0 : break;
5308 0 : }
5309 0 : case 12: {
5310 0 : size += fd_compact_vote_state_update_size( &self->inner.compact_update_vote_state );
5311 0 : break;
5312 0 : }
5313 0 : case 13: {
5314 0 : size += fd_compact_vote_state_update_switch_size( &self->inner.compact_update_vote_state_switch );
5315 0 : break;
5316 0 : }
5317 0 : case 14: {
5318 0 : size += fd_tower_sync_size( &self->inner.tower_sync );
5319 0 : break;
5320 0 : }
5321 0 : case 15: {
5322 0 : size += fd_tower_sync_switch_size( &self->inner.tower_sync_switch );
5323 0 : break;
5324 0 : }
5325 0 : case 16: {
5326 0 : size += fd_vote_init_v2_size( &self->inner.initialize_account_v2 );
5327 0 : break;
5328 0 : }
5329 0 : }
5330 0 : return size;
5331 0 : }
5332 :
5333 0 : int fd_vote_instruction_inner_encode( fd_vote_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
5334 0 : int err;
5335 0 : switch (discriminant) {
5336 0 : case 0: {
5337 0 : err = fd_vote_init_encode( &self->initialize_account, ctx );
5338 0 : if( FD_UNLIKELY( err ) ) return err;
5339 0 : break;
5340 0 : }
5341 0 : case 1: {
5342 0 : err = fd_vote_authorize_pubkey_encode( &self->authorize, ctx );
5343 0 : if( FD_UNLIKELY( err ) ) return err;
5344 0 : break;
5345 0 : }
5346 0 : case 2: {
5347 0 : err = fd_vote_encode( &self->vote, ctx );
5348 0 : if( FD_UNLIKELY( err ) ) return err;
5349 0 : break;
5350 0 : }
5351 0 : case 3: {
5352 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
5353 0 : if( FD_UNLIKELY( err ) ) return err;
5354 0 : break;
5355 0 : }
5356 0 : case 5: {
5357 0 : err = fd_bincode_uint8_encode( (uchar)(self->update_commission), ctx );
5358 0 : if( FD_UNLIKELY( err ) ) return err;
5359 0 : break;
5360 0 : }
5361 0 : case 6: {
5362 0 : err = fd_vote_switch_encode( &self->vote_switch, ctx );
5363 0 : if( FD_UNLIKELY( err ) ) return err;
5364 0 : break;
5365 0 : }
5366 0 : case 7: {
5367 0 : err = fd_vote_authorize_encode( &self->authorize_checked, ctx );
5368 0 : if( FD_UNLIKELY( err ) ) return err;
5369 0 : break;
5370 0 : }
5371 0 : case 8: {
5372 0 : err = fd_vote_state_update_encode( &self->update_vote_state, ctx );
5373 0 : if( FD_UNLIKELY( err ) ) return err;
5374 0 : break;
5375 0 : }
5376 0 : case 9: {
5377 0 : err = fd_update_vote_state_switch_encode( &self->update_vote_state_switch, ctx );
5378 0 : if( FD_UNLIKELY( err ) ) return err;
5379 0 : break;
5380 0 : }
5381 0 : case 10: {
5382 0 : err = fd_vote_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
5383 0 : if( FD_UNLIKELY( err ) ) return err;
5384 0 : break;
5385 0 : }
5386 0 : case 11: {
5387 0 : err = fd_vote_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
5388 0 : if( FD_UNLIKELY( err ) ) return err;
5389 0 : break;
5390 0 : }
5391 0 : case 12: {
5392 0 : err = fd_compact_vote_state_update_encode( &self->compact_update_vote_state, ctx );
5393 0 : if( FD_UNLIKELY( err ) ) return err;
5394 0 : break;
5395 0 : }
5396 0 : case 13: {
5397 0 : err = fd_compact_vote_state_update_switch_encode( &self->compact_update_vote_state_switch, ctx );
5398 0 : if( FD_UNLIKELY( err ) ) return err;
5399 0 : break;
5400 0 : }
5401 0 : case 14: {
5402 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
5403 0 : if( FD_UNLIKELY( err ) ) return err;
5404 0 : break;
5405 0 : }
5406 0 : case 15: {
5407 0 : err = fd_tower_sync_switch_encode( &self->tower_sync_switch, ctx );
5408 0 : if( FD_UNLIKELY( err ) ) return err;
5409 0 : break;
5410 0 : }
5411 0 : case 16: {
5412 0 : err = fd_vote_init_v2_encode( &self->initialize_account_v2, ctx );
5413 0 : if( FD_UNLIKELY( err ) ) return err;
5414 0 : break;
5415 0 : }
5416 0 : }
5417 0 : return FD_BINCODE_SUCCESS;
5418 0 : }
5419 0 : int fd_vote_instruction_encode( fd_vote_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5420 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
5421 0 : if( FD_UNLIKELY( err ) ) return err;
5422 0 : return fd_vote_instruction_inner_encode( &self->inner, self->discriminant, ctx );
5423 0 : }
5424 :
5425 0 : int fd_system_program_instruction_create_account_encode( fd_system_program_instruction_create_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5426 0 : int err;
5427 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5428 0 : if( FD_UNLIKELY( err ) ) return err;
5429 0 : err = fd_bincode_uint64_encode( self->space, ctx );
5430 0 : if( FD_UNLIKELY( err ) ) return err;
5431 0 : err = fd_pubkey_encode( &self->owner, ctx );
5432 0 : if( FD_UNLIKELY( err ) ) return err;
5433 0 : return FD_BINCODE_SUCCESS;
5434 0 : }
5435 0 : static inline int fd_system_program_instruction_create_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5436 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5437 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
5438 0 : return 0;
5439 0 : }
5440 0 : static void fd_system_program_instruction_create_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5441 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)struct_mem;
5442 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5443 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
5444 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5445 0 : }
5446 0 : void * fd_system_program_instruction_create_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5447 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)mem;
5448 0 : fd_system_program_instruction_create_account_new( self );
5449 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_t);
5450 0 : void * * alloc_mem = &alloc_region;
5451 0 : fd_system_program_instruction_create_account_decode_inner( mem, alloc_mem, ctx );
5452 0 : return self;
5453 0 : }
5454 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 ) {
5455 0 : int err;
5456 0 : err = fd_pubkey_encode( &self->base, ctx );
5457 0 : if( FD_UNLIKELY( err ) ) return err;
5458 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
5459 0 : if( FD_UNLIKELY(err) ) return err;
5460 0 : if( self->seed_len ) {
5461 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
5462 0 : if( FD_UNLIKELY( err ) ) return err;
5463 0 : }
5464 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5465 0 : if( FD_UNLIKELY( err ) ) return err;
5466 0 : err = fd_bincode_uint64_encode( self->space, ctx );
5467 0 : if( FD_UNLIKELY( err ) ) return err;
5468 0 : err = fd_pubkey_encode( &self->owner, ctx );
5469 0 : if( FD_UNLIKELY( err ) ) return err;
5470 0 : return FD_BINCODE_SUCCESS;
5471 0 : }
5472 0 : static int fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5473 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5474 0 : int err = 0;
5475 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5476 0 : if( FD_UNLIKELY( err ) ) return err;
5477 0 : ulong seed_len;
5478 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
5479 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5480 0 : *total_sz += seed_len;
5481 0 : if( seed_len ) {
5482 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
5483 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5484 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
5485 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5486 0 : }
5487 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5488 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5489 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5490 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5491 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5492 0 : if( FD_UNLIKELY( err ) ) return err;
5493 0 : return 0;
5494 0 : }
5495 0 : int fd_system_program_instruction_create_account_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5496 0 : *total_sz += sizeof(fd_system_program_instruction_create_account_with_seed_t);
5497 0 : void const * start_data = ctx->data;
5498 0 : int err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
5499 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5500 0 : ctx->data = start_data;
5501 0 : return err;
5502 0 : }
5503 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 ) {
5504 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)struct_mem;
5505 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
5506 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
5507 0 : if( self->seed_len ) {
5508 0 : self->seed = *alloc_mem;
5509 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
5510 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
5511 0 : } else
5512 0 : self->seed = NULL;
5513 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5514 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
5515 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5516 0 : }
5517 0 : void * fd_system_program_instruction_create_account_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5518 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)mem;
5519 0 : fd_system_program_instruction_create_account_with_seed_new( self );
5520 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_with_seed_t);
5521 0 : void * * alloc_mem = &alloc_region;
5522 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( mem, alloc_mem, ctx );
5523 0 : return self;
5524 0 : }
5525 0 : void fd_system_program_instruction_create_account_with_seed_new(fd_system_program_instruction_create_account_with_seed_t * self) {
5526 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_with_seed_t) );
5527 0 : fd_pubkey_new( &self->base );
5528 0 : fd_pubkey_new( &self->owner );
5529 0 : }
5530 0 : ulong fd_system_program_instruction_create_account_with_seed_size( fd_system_program_instruction_create_account_with_seed_t const * self ) {
5531 0 : ulong size = 0;
5532 0 : size += fd_pubkey_size( &self->base );
5533 0 : do {
5534 0 : size += sizeof(ulong);
5535 0 : size += self->seed_len;
5536 0 : } while(0);
5537 0 : size += sizeof(ulong);
5538 0 : size += sizeof(ulong);
5539 0 : size += fd_pubkey_size( &self->owner );
5540 0 : return size;
5541 0 : }
5542 :
5543 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 ) {
5544 0 : int err;
5545 0 : err = fd_pubkey_encode( &self->base, ctx );
5546 0 : if( FD_UNLIKELY( err ) ) return err;
5547 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
5548 0 : if( FD_UNLIKELY(err) ) return err;
5549 0 : if( self->seed_len ) {
5550 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
5551 0 : if( FD_UNLIKELY( err ) ) return err;
5552 0 : }
5553 0 : err = fd_bincode_uint64_encode( self->space, ctx );
5554 0 : if( FD_UNLIKELY( err ) ) return err;
5555 0 : err = fd_pubkey_encode( &self->owner, ctx );
5556 0 : if( FD_UNLIKELY( err ) ) return err;
5557 0 : return FD_BINCODE_SUCCESS;
5558 0 : }
5559 0 : static int fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5560 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5561 0 : int err = 0;
5562 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5563 0 : if( FD_UNLIKELY( err ) ) return err;
5564 0 : ulong seed_len;
5565 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
5566 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5567 0 : *total_sz += seed_len;
5568 0 : if( seed_len ) {
5569 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
5570 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5571 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
5572 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5573 0 : }
5574 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5575 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5576 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5577 0 : if( FD_UNLIKELY( err ) ) return err;
5578 0 : return 0;
5579 0 : }
5580 0 : int fd_system_program_instruction_allocate_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5581 0 : *total_sz += sizeof(fd_system_program_instruction_allocate_with_seed_t);
5582 0 : void const * start_data = ctx->data;
5583 0 : int err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
5584 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5585 0 : ctx->data = start_data;
5586 0 : return err;
5587 0 : }
5588 0 : static void fd_system_program_instruction_allocate_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5589 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)struct_mem;
5590 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
5591 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
5592 0 : if( self->seed_len ) {
5593 0 : self->seed = *alloc_mem;
5594 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
5595 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
5596 0 : } else
5597 0 : self->seed = NULL;
5598 0 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
5599 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5600 0 : }
5601 0 : void * fd_system_program_instruction_allocate_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5602 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)mem;
5603 0 : fd_system_program_instruction_allocate_with_seed_new( self );
5604 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_allocate_with_seed_t);
5605 0 : void * * alloc_mem = &alloc_region;
5606 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( mem, alloc_mem, ctx );
5607 0 : return self;
5608 0 : }
5609 0 : void fd_system_program_instruction_allocate_with_seed_new(fd_system_program_instruction_allocate_with_seed_t * self) {
5610 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_allocate_with_seed_t) );
5611 0 : fd_pubkey_new( &self->base );
5612 0 : fd_pubkey_new( &self->owner );
5613 0 : }
5614 0 : ulong fd_system_program_instruction_allocate_with_seed_size( fd_system_program_instruction_allocate_with_seed_t const * self ) {
5615 0 : ulong size = 0;
5616 0 : size += fd_pubkey_size( &self->base );
5617 0 : do {
5618 0 : size += sizeof(ulong);
5619 0 : size += self->seed_len;
5620 0 : } while(0);
5621 0 : size += sizeof(ulong);
5622 0 : size += fd_pubkey_size( &self->owner );
5623 0 : return size;
5624 0 : }
5625 :
5626 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 ) {
5627 0 : int err;
5628 0 : err = fd_pubkey_encode( &self->base, ctx );
5629 0 : if( FD_UNLIKELY( err ) ) return err;
5630 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
5631 0 : if( FD_UNLIKELY(err) ) return err;
5632 0 : if( self->seed_len ) {
5633 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
5634 0 : if( FD_UNLIKELY( err ) ) return err;
5635 0 : }
5636 0 : err = fd_pubkey_encode( &self->owner, ctx );
5637 0 : if( FD_UNLIKELY( err ) ) return err;
5638 0 : return FD_BINCODE_SUCCESS;
5639 0 : }
5640 0 : static int fd_system_program_instruction_assign_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5641 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5642 0 : int err = 0;
5643 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5644 0 : if( FD_UNLIKELY( err ) ) return err;
5645 0 : ulong seed_len;
5646 0 : err = fd_bincode_uint64_decode( &seed_len, ctx );
5647 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5648 0 : *total_sz += seed_len;
5649 0 : if( seed_len ) {
5650 0 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
5651 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5652 0 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
5653 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5654 0 : }
5655 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5656 0 : if( FD_UNLIKELY( err ) ) return err;
5657 0 : return 0;
5658 0 : }
5659 0 : int fd_system_program_instruction_assign_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5660 0 : *total_sz += sizeof(fd_system_program_instruction_assign_with_seed_t);
5661 0 : void const * start_data = ctx->data;
5662 0 : int err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
5663 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5664 0 : ctx->data = start_data;
5665 0 : return err;
5666 0 : }
5667 0 : static void fd_system_program_instruction_assign_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5668 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)struct_mem;
5669 0 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
5670 0 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
5671 0 : if( self->seed_len ) {
5672 0 : self->seed = *alloc_mem;
5673 0 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
5674 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
5675 0 : } else
5676 0 : self->seed = NULL;
5677 0 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5678 0 : }
5679 0 : void * fd_system_program_instruction_assign_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5680 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)mem;
5681 0 : fd_system_program_instruction_assign_with_seed_new( self );
5682 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_assign_with_seed_t);
5683 0 : void * * alloc_mem = &alloc_region;
5684 0 : fd_system_program_instruction_assign_with_seed_decode_inner( mem, alloc_mem, ctx );
5685 0 : return self;
5686 0 : }
5687 0 : void fd_system_program_instruction_assign_with_seed_new(fd_system_program_instruction_assign_with_seed_t * self) {
5688 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_assign_with_seed_t) );
5689 0 : fd_pubkey_new( &self->base );
5690 0 : fd_pubkey_new( &self->owner );
5691 0 : }
5692 0 : ulong fd_system_program_instruction_assign_with_seed_size( fd_system_program_instruction_assign_with_seed_t const * self ) {
5693 0 : ulong size = 0;
5694 0 : size += fd_pubkey_size( &self->base );
5695 0 : do {
5696 0 : size += sizeof(ulong);
5697 0 : size += self->seed_len;
5698 0 : } while(0);
5699 0 : size += fd_pubkey_size( &self->owner );
5700 0 : return size;
5701 0 : }
5702 :
5703 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 ) {
5704 0 : int err;
5705 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5706 0 : if( FD_UNLIKELY( err ) ) return err;
5707 0 : err = fd_bincode_uint64_encode( self->from_seed_len, ctx );
5708 0 : if( FD_UNLIKELY(err) ) return err;
5709 0 : if( self->from_seed_len ) {
5710 0 : err = fd_bincode_bytes_encode( self->from_seed, self->from_seed_len, ctx );
5711 0 : if( FD_UNLIKELY( err ) ) return err;
5712 0 : }
5713 0 : err = fd_pubkey_encode( &self->from_owner, ctx );
5714 0 : if( FD_UNLIKELY( err ) ) return err;
5715 0 : return FD_BINCODE_SUCCESS;
5716 0 : }
5717 0 : static int fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5718 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5719 0 : int err = 0;
5720 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5721 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5722 0 : ulong from_seed_len;
5723 0 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
5724 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5725 0 : *total_sz += from_seed_len;
5726 0 : if( from_seed_len ) {
5727 0 : err = fd_bincode_bytes_decode_footprint( from_seed_len, ctx );
5728 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5729 0 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
5730 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5731 0 : }
5732 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5733 0 : if( FD_UNLIKELY( err ) ) return err;
5734 0 : return 0;
5735 0 : }
5736 0 : int fd_system_program_instruction_transfer_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5737 0 : *total_sz += sizeof(fd_system_program_instruction_transfer_with_seed_t);
5738 0 : void const * start_data = ctx->data;
5739 0 : int err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
5740 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5741 0 : ctx->data = start_data;
5742 0 : return err;
5743 0 : }
5744 0 : static void fd_system_program_instruction_transfer_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5745 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)struct_mem;
5746 0 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5747 0 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
5748 0 : if( self->from_seed_len ) {
5749 0 : self->from_seed = *alloc_mem;
5750 0 : fd_bincode_bytes_decode_unsafe( self->from_seed, self->from_seed_len, ctx );
5751 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->from_seed_len;
5752 0 : } else
5753 0 : self->from_seed = NULL;
5754 0 : fd_pubkey_decode_inner( &self->from_owner, alloc_mem, ctx );
5755 0 : }
5756 0 : void * fd_system_program_instruction_transfer_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5757 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)mem;
5758 0 : fd_system_program_instruction_transfer_with_seed_new( self );
5759 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_transfer_with_seed_t);
5760 0 : void * * alloc_mem = &alloc_region;
5761 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( mem, alloc_mem, ctx );
5762 0 : return self;
5763 0 : }
5764 0 : void fd_system_program_instruction_transfer_with_seed_new(fd_system_program_instruction_transfer_with_seed_t * self) {
5765 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_transfer_with_seed_t) );
5766 0 : fd_pubkey_new( &self->from_owner );
5767 0 : }
5768 0 : ulong fd_system_program_instruction_transfer_with_seed_size( fd_system_program_instruction_transfer_with_seed_t const * self ) {
5769 0 : ulong size = 0;
5770 0 : size += sizeof(ulong);
5771 0 : do {
5772 0 : size += sizeof(ulong);
5773 0 : size += self->from_seed_len;
5774 0 : } while(0);
5775 0 : size += fd_pubkey_size( &self->from_owner );
5776 0 : return size;
5777 0 : }
5778 :
5779 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account(fd_system_program_instruction_t const * self) {
5780 0 : return self->discriminant == 0;
5781 0 : }
5782 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign(fd_system_program_instruction_t const * self) {
5783 0 : return self->discriminant == 1;
5784 0 : }
5785 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer(fd_system_program_instruction_t const * self) {
5786 0 : return self->discriminant == 2;
5787 0 : }
5788 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_with_seed(fd_system_program_instruction_t const * self) {
5789 0 : return self->discriminant == 3;
5790 0 : }
5791 0 : FD_FN_PURE uchar fd_system_program_instruction_is_advance_nonce_account(fd_system_program_instruction_t const * self) {
5792 0 : return self->discriminant == 4;
5793 0 : }
5794 0 : FD_FN_PURE uchar fd_system_program_instruction_is_withdraw_nonce_account(fd_system_program_instruction_t const * self) {
5795 0 : return self->discriminant == 5;
5796 0 : }
5797 0 : FD_FN_PURE uchar fd_system_program_instruction_is_initialize_nonce_account(fd_system_program_instruction_t const * self) {
5798 0 : return self->discriminant == 6;
5799 0 : }
5800 0 : FD_FN_PURE uchar fd_system_program_instruction_is_authorize_nonce_account(fd_system_program_instruction_t const * self) {
5801 0 : return self->discriminant == 7;
5802 0 : }
5803 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate(fd_system_program_instruction_t const * self) {
5804 0 : return self->discriminant == 8;
5805 0 : }
5806 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate_with_seed(fd_system_program_instruction_t const * self) {
5807 0 : return self->discriminant == 9;
5808 0 : }
5809 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign_with_seed(fd_system_program_instruction_t const * self) {
5810 0 : return self->discriminant == 10;
5811 0 : }
5812 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer_with_seed(fd_system_program_instruction_t const * self) {
5813 0 : return self->discriminant == 11;
5814 0 : }
5815 0 : FD_FN_PURE uchar fd_system_program_instruction_is_upgrade_nonce_account(fd_system_program_instruction_t const * self) {
5816 0 : return self->discriminant == 12;
5817 0 : }
5818 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant );
5819 72 : int fd_system_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5820 72 : int err;
5821 72 : switch (discriminant) {
5822 0 : case 0: {
5823 0 : err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
5824 0 : if( FD_UNLIKELY( err ) ) return err;
5825 0 : return FD_BINCODE_SUCCESS;
5826 0 : }
5827 0 : case 1: {
5828 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5829 0 : if( FD_UNLIKELY( err ) ) return err;
5830 0 : return FD_BINCODE_SUCCESS;
5831 0 : }
5832 24 : case 2: {
5833 24 : err = fd_bincode_uint64_decode_footprint( ctx );
5834 24 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5835 24 : return FD_BINCODE_SUCCESS;
5836 24 : }
5837 0 : case 3: {
5838 0 : err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
5839 0 : if( FD_UNLIKELY( err ) ) return err;
5840 0 : return FD_BINCODE_SUCCESS;
5841 0 : }
5842 0 : case 4: {
5843 0 : return FD_BINCODE_SUCCESS;
5844 0 : }
5845 0 : case 5: {
5846 0 : err = fd_bincode_uint64_decode_footprint( ctx );
5847 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5848 0 : return FD_BINCODE_SUCCESS;
5849 0 : }
5850 0 : case 6: {
5851 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5852 0 : if( FD_UNLIKELY( err ) ) return err;
5853 0 : return FD_BINCODE_SUCCESS;
5854 0 : }
5855 0 : case 7: {
5856 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5857 0 : if( FD_UNLIKELY( err ) ) return err;
5858 0 : return FD_BINCODE_SUCCESS;
5859 0 : }
5860 48 : case 8: {
5861 48 : err = fd_bincode_uint64_decode_footprint( ctx );
5862 48 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5863 48 : return FD_BINCODE_SUCCESS;
5864 48 : }
5865 0 : case 9: {
5866 0 : err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
5867 0 : if( FD_UNLIKELY( err ) ) return err;
5868 0 : return FD_BINCODE_SUCCESS;
5869 0 : }
5870 0 : case 10: {
5871 0 : err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
5872 0 : if( FD_UNLIKELY( err ) ) return err;
5873 0 : return FD_BINCODE_SUCCESS;
5874 0 : }
5875 0 : case 11: {
5876 0 : err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
5877 0 : if( FD_UNLIKELY( err ) ) return err;
5878 0 : return FD_BINCODE_SUCCESS;
5879 0 : }
5880 0 : case 12: {
5881 0 : return FD_BINCODE_SUCCESS;
5882 0 : }
5883 0 : default: return FD_BINCODE_ERR_ENCODING;
5884 72 : }
5885 72 : }
5886 72 : static int fd_system_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5887 72 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5888 72 : uint discriminant = 0;
5889 72 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
5890 72 : if( FD_UNLIKELY( err ) ) return err;
5891 72 : return fd_system_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
5892 72 : }
5893 72 : int fd_system_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5894 72 : *total_sz += sizeof(fd_system_program_instruction_t);
5895 72 : void const * start_data = ctx->data;
5896 72 : int err = fd_system_program_instruction_decode_footprint_inner( ctx, total_sz );
5897 72 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5898 72 : ctx->data = start_data;
5899 72 : return err;
5900 72 : }
5901 72 : 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 ) {
5902 72 : switch (discriminant) {
5903 0 : case 0: {
5904 0 : fd_system_program_instruction_create_account_decode_inner( &self->create_account, alloc_mem, ctx );
5905 0 : break;
5906 0 : }
5907 0 : case 1: {
5908 0 : fd_pubkey_decode_inner( &self->assign, alloc_mem, ctx );
5909 0 : break;
5910 0 : }
5911 24 : case 2: {
5912 24 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
5913 24 : break;
5914 0 : }
5915 0 : case 3: {
5916 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( &self->create_account_with_seed, alloc_mem, ctx );
5917 0 : break;
5918 0 : }
5919 0 : case 4: {
5920 0 : break;
5921 0 : }
5922 0 : case 5: {
5923 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
5924 0 : break;
5925 0 : }
5926 0 : case 6: {
5927 0 : fd_pubkey_decode_inner( &self->initialize_nonce_account, alloc_mem, ctx );
5928 0 : break;
5929 0 : }
5930 0 : case 7: {
5931 0 : fd_pubkey_decode_inner( &self->authorize_nonce_account, alloc_mem, ctx );
5932 0 : break;
5933 0 : }
5934 48 : case 8: {
5935 48 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
5936 48 : break;
5937 0 : }
5938 0 : case 9: {
5939 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( &self->allocate_with_seed, alloc_mem, ctx );
5940 0 : break;
5941 0 : }
5942 0 : case 10: {
5943 0 : fd_system_program_instruction_assign_with_seed_decode_inner( &self->assign_with_seed, alloc_mem, ctx );
5944 0 : break;
5945 0 : }
5946 0 : case 11: {
5947 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( &self->transfer_with_seed, alloc_mem, ctx );
5948 0 : break;
5949 0 : }
5950 0 : case 12: {
5951 0 : break;
5952 0 : }
5953 72 : }
5954 72 : }
5955 72 : static void fd_system_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5956 72 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)struct_mem;
5957 72 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5958 72 : fd_system_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
5959 72 : }
5960 72 : void * fd_system_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5961 72 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)mem;
5962 72 : fd_system_program_instruction_new( self );
5963 72 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_t);
5964 72 : void * * alloc_mem = &alloc_region;
5965 72 : fd_system_program_instruction_decode_inner( mem, alloc_mem, ctx );
5966 72 : return self;
5967 72 : }
5968 72 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant ) {
5969 72 : switch( discriminant ) {
5970 0 : case 0: {
5971 0 : fd_system_program_instruction_create_account_new( &self->create_account );
5972 0 : break;
5973 0 : }
5974 0 : case 1: {
5975 0 : fd_pubkey_new( &self->assign );
5976 0 : break;
5977 0 : }
5978 0 : case 2: {
5979 0 : break;
5980 0 : }
5981 0 : case 3: {
5982 0 : fd_system_program_instruction_create_account_with_seed_new( &self->create_account_with_seed );
5983 0 : break;
5984 0 : }
5985 0 : case 4: {
5986 0 : break;
5987 0 : }
5988 0 : case 5: {
5989 0 : break;
5990 0 : }
5991 0 : case 6: {
5992 0 : fd_pubkey_new( &self->initialize_nonce_account );
5993 0 : break;
5994 0 : }
5995 0 : case 7: {
5996 0 : fd_pubkey_new( &self->authorize_nonce_account );
5997 0 : break;
5998 0 : }
5999 0 : case 8: {
6000 0 : break;
6001 0 : }
6002 0 : case 9: {
6003 0 : fd_system_program_instruction_allocate_with_seed_new( &self->allocate_with_seed );
6004 0 : break;
6005 0 : }
6006 0 : case 10: {
6007 0 : fd_system_program_instruction_assign_with_seed_new( &self->assign_with_seed );
6008 0 : break;
6009 0 : }
6010 0 : case 11: {
6011 0 : fd_system_program_instruction_transfer_with_seed_new( &self->transfer_with_seed );
6012 0 : break;
6013 0 : }
6014 0 : case 12: {
6015 0 : break;
6016 0 : }
6017 72 : default: break; // FD_LOG_ERR(( "unhandled type"));
6018 72 : }
6019 72 : }
6020 72 : void fd_system_program_instruction_new_disc( fd_system_program_instruction_t * self, uint discriminant ) {
6021 72 : self->discriminant = discriminant;
6022 72 : fd_system_program_instruction_inner_new( &self->inner, self->discriminant );
6023 72 : }
6024 72 : void fd_system_program_instruction_new( fd_system_program_instruction_t * self ) {
6025 72 : fd_memset( self, 0, sizeof(fd_system_program_instruction_t) );
6026 72 : fd_system_program_instruction_new_disc( self, UINT_MAX );
6027 72 : }
6028 :
6029 0 : ulong fd_system_program_instruction_size( fd_system_program_instruction_t const * self ) {
6030 0 : ulong size = 0;
6031 0 : size += sizeof(uint);
6032 0 : switch (self->discriminant) {
6033 0 : case 0: {
6034 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account );
6035 0 : break;
6036 0 : }
6037 0 : case 1: {
6038 0 : size += fd_pubkey_size( &self->inner.assign );
6039 0 : break;
6040 0 : }
6041 0 : case 2: {
6042 0 : size += sizeof(ulong);
6043 0 : break;
6044 0 : }
6045 0 : case 3: {
6046 0 : size += fd_system_program_instruction_create_account_with_seed_size( &self->inner.create_account_with_seed );
6047 0 : break;
6048 0 : }
6049 0 : case 5: {
6050 0 : size += sizeof(ulong);
6051 0 : break;
6052 0 : }
6053 0 : case 6: {
6054 0 : size += fd_pubkey_size( &self->inner.initialize_nonce_account );
6055 0 : break;
6056 0 : }
6057 0 : case 7: {
6058 0 : size += fd_pubkey_size( &self->inner.authorize_nonce_account );
6059 0 : break;
6060 0 : }
6061 0 : case 8: {
6062 0 : size += sizeof(ulong);
6063 0 : break;
6064 0 : }
6065 0 : case 9: {
6066 0 : size += fd_system_program_instruction_allocate_with_seed_size( &self->inner.allocate_with_seed );
6067 0 : break;
6068 0 : }
6069 0 : case 10: {
6070 0 : size += fd_system_program_instruction_assign_with_seed_size( &self->inner.assign_with_seed );
6071 0 : break;
6072 0 : }
6073 0 : case 11: {
6074 0 : size += fd_system_program_instruction_transfer_with_seed_size( &self->inner.transfer_with_seed );
6075 0 : break;
6076 0 : }
6077 0 : }
6078 0 : return size;
6079 0 : }
6080 :
6081 0 : int fd_system_program_instruction_inner_encode( fd_system_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6082 0 : int err;
6083 0 : switch (discriminant) {
6084 0 : case 0: {
6085 0 : err = fd_system_program_instruction_create_account_encode( &self->create_account, ctx );
6086 0 : if( FD_UNLIKELY( err ) ) return err;
6087 0 : break;
6088 0 : }
6089 0 : case 1: {
6090 0 : err = fd_pubkey_encode( &self->assign, ctx );
6091 0 : if( FD_UNLIKELY( err ) ) return err;
6092 0 : break;
6093 0 : }
6094 0 : case 2: {
6095 0 : err = fd_bincode_uint64_encode( self->transfer, ctx );
6096 0 : if( FD_UNLIKELY( err ) ) return err;
6097 0 : break;
6098 0 : }
6099 0 : case 3: {
6100 0 : err = fd_system_program_instruction_create_account_with_seed_encode( &self->create_account_with_seed, ctx );
6101 0 : if( FD_UNLIKELY( err ) ) return err;
6102 0 : break;
6103 0 : }
6104 0 : case 5: {
6105 0 : err = fd_bincode_uint64_encode( self->withdraw_nonce_account, ctx );
6106 0 : if( FD_UNLIKELY( err ) ) return err;
6107 0 : break;
6108 0 : }
6109 0 : case 6: {
6110 0 : err = fd_pubkey_encode( &self->initialize_nonce_account, ctx );
6111 0 : if( FD_UNLIKELY( err ) ) return err;
6112 0 : break;
6113 0 : }
6114 0 : case 7: {
6115 0 : err = fd_pubkey_encode( &self->authorize_nonce_account, ctx );
6116 0 : if( FD_UNLIKELY( err ) ) return err;
6117 0 : break;
6118 0 : }
6119 0 : case 8: {
6120 0 : err = fd_bincode_uint64_encode( self->allocate, ctx );
6121 0 : if( FD_UNLIKELY( err ) ) return err;
6122 0 : break;
6123 0 : }
6124 0 : case 9: {
6125 0 : err = fd_system_program_instruction_allocate_with_seed_encode( &self->allocate_with_seed, ctx );
6126 0 : if( FD_UNLIKELY( err ) ) return err;
6127 0 : break;
6128 0 : }
6129 0 : case 10: {
6130 0 : err = fd_system_program_instruction_assign_with_seed_encode( &self->assign_with_seed, ctx );
6131 0 : if( FD_UNLIKELY( err ) ) return err;
6132 0 : break;
6133 0 : }
6134 0 : case 11: {
6135 0 : err = fd_system_program_instruction_transfer_with_seed_encode( &self->transfer_with_seed, ctx );
6136 0 : if( FD_UNLIKELY( err ) ) return err;
6137 0 : break;
6138 0 : }
6139 0 : }
6140 0 : return FD_BINCODE_SUCCESS;
6141 0 : }
6142 0 : int fd_system_program_instruction_encode( fd_system_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6143 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6144 0 : if( FD_UNLIKELY( err ) ) return err;
6145 0 : return fd_system_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
6146 0 : }
6147 :
6148 12 : int fd_stake_authorized_encode( fd_stake_authorized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6149 12 : int err;
6150 12 : err = fd_pubkey_encode( &self->staker, ctx );
6151 12 : if( FD_UNLIKELY( err ) ) return err;
6152 12 : err = fd_pubkey_encode( &self->withdrawer, ctx );
6153 12 : if( FD_UNLIKELY( err ) ) return err;
6154 12 : return FD_BINCODE_SUCCESS;
6155 12 : }
6156 0 : static inline int fd_stake_authorized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6157 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6158 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
6159 0 : return 0;
6160 0 : }
6161 0 : static void fd_stake_authorized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6162 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)struct_mem;
6163 0 : fd_pubkey_decode_inner( &self->staker, alloc_mem, ctx );
6164 0 : fd_pubkey_decode_inner( &self->withdrawer, alloc_mem, ctx );
6165 0 : }
6166 0 : void * fd_stake_authorized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6167 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)mem;
6168 0 : fd_stake_authorized_new( self );
6169 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorized_t);
6170 0 : void * * alloc_mem = &alloc_region;
6171 0 : fd_stake_authorized_decode_inner( mem, alloc_mem, ctx );
6172 0 : return self;
6173 0 : }
6174 12 : int fd_stake_lockup_encode( fd_stake_lockup_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6175 12 : int err;
6176 12 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
6177 12 : if( FD_UNLIKELY( err ) ) return err;
6178 12 : err = fd_bincode_uint64_encode( self->epoch, ctx );
6179 12 : if( FD_UNLIKELY( err ) ) return err;
6180 12 : err = fd_pubkey_encode( &self->custodian, ctx );
6181 12 : if( FD_UNLIKELY( err ) ) return err;
6182 12 : return FD_BINCODE_SUCCESS;
6183 12 : }
6184 0 : static inline int fd_stake_lockup_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6185 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6186 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
6187 0 : return 0;
6188 0 : }
6189 0 : static void fd_stake_lockup_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6190 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)struct_mem;
6191 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
6192 0 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6193 0 : fd_pubkey_decode_inner( &self->custodian, alloc_mem, ctx );
6194 0 : }
6195 0 : void * fd_stake_lockup_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6196 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)mem;
6197 0 : fd_stake_lockup_new( self );
6198 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_t);
6199 0 : void * * alloc_mem = &alloc_region;
6200 0 : fd_stake_lockup_decode_inner( mem, alloc_mem, ctx );
6201 0 : return self;
6202 0 : }
6203 0 : int fd_stake_instruction_initialize_encode( fd_stake_instruction_initialize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6204 0 : int err;
6205 0 : err = fd_stake_authorized_encode( &self->authorized, ctx );
6206 0 : if( FD_UNLIKELY( err ) ) return err;
6207 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
6208 0 : if( FD_UNLIKELY( err ) ) return err;
6209 0 : return FD_BINCODE_SUCCESS;
6210 0 : }
6211 0 : static inline int fd_stake_instruction_initialize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6212 0 : if( (ulong)ctx->data + 112UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6213 0 : ctx->data = (void *)( (ulong)ctx->data + 112UL );
6214 0 : return 0;
6215 0 : }
6216 0 : static void fd_stake_instruction_initialize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6217 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)struct_mem;
6218 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
6219 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
6220 0 : }
6221 0 : void * fd_stake_instruction_initialize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6222 0 : fd_stake_instruction_initialize_t * self = (fd_stake_instruction_initialize_t *)mem;
6223 0 : fd_stake_instruction_initialize_new( self );
6224 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_initialize_t);
6225 0 : void * * alloc_mem = &alloc_region;
6226 0 : fd_stake_instruction_initialize_decode_inner( mem, alloc_mem, ctx );
6227 0 : return self;
6228 0 : }
6229 0 : int fd_stake_lockup_custodian_args_encode( fd_stake_lockup_custodian_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6230 0 : int err;
6231 0 : err = fd_stake_lockup_encode( &self->lockup, ctx );
6232 0 : if( FD_UNLIKELY( err ) ) return err;
6233 0 : err = fd_sol_sysvar_clock_encode( &self->clock, ctx );
6234 0 : if( FD_UNLIKELY( err ) ) return err;
6235 0 : if( self->custodian != NULL ) {
6236 0 : err = fd_bincode_bool_encode( 1, ctx );
6237 0 : if( FD_UNLIKELY( err ) ) return err;
6238 0 : err = fd_pubkey_encode( self->custodian, ctx );
6239 0 : if( FD_UNLIKELY( err ) ) return err;
6240 0 : } else {
6241 0 : err = fd_bincode_bool_encode( 0, ctx );
6242 0 : if( FD_UNLIKELY( err ) ) return err;
6243 0 : }
6244 0 : return FD_BINCODE_SUCCESS;
6245 0 : }
6246 0 : static int fd_stake_lockup_custodian_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6247 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6248 0 : int err = 0;
6249 0 : err = fd_stake_lockup_decode_footprint_inner( ctx, total_sz );
6250 0 : if( FD_UNLIKELY( err ) ) return err;
6251 0 : err = fd_sol_sysvar_clock_decode_footprint_inner( ctx, total_sz );
6252 0 : if( FD_UNLIKELY( err ) ) return err;
6253 0 : {
6254 0 : uchar o;
6255 0 : err = fd_bincode_bool_decode( &o, ctx );
6256 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6257 0 : if( o ) {
6258 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
6259 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6260 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6261 0 : }
6262 0 : }
6263 0 : return 0;
6264 0 : }
6265 0 : int fd_stake_lockup_custodian_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6266 0 : *total_sz += sizeof(fd_stake_lockup_custodian_args_t);
6267 0 : void const * start_data = ctx->data;
6268 0 : int err = fd_stake_lockup_custodian_args_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_lockup_custodian_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6274 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)struct_mem;
6275 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
6276 0 : fd_sol_sysvar_clock_decode_inner( &self->clock, alloc_mem, ctx );
6277 0 : {
6278 0 : uchar o;
6279 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6280 0 : if( o ) {
6281 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
6282 0 : self->custodian = *alloc_mem;
6283 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
6284 0 : fd_pubkey_new( self->custodian );
6285 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
6286 0 : } else {
6287 0 : self->custodian = NULL;
6288 0 : }
6289 0 : }
6290 0 : }
6291 0 : void * fd_stake_lockup_custodian_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6292 0 : fd_stake_lockup_custodian_args_t * self = (fd_stake_lockup_custodian_args_t *)mem;
6293 0 : fd_stake_lockup_custodian_args_new( self );
6294 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_custodian_args_t);
6295 0 : void * * alloc_mem = &alloc_region;
6296 0 : fd_stake_lockup_custodian_args_decode_inner( mem, alloc_mem, ctx );
6297 0 : return self;
6298 0 : }
6299 0 : void fd_stake_lockup_custodian_args_new(fd_stake_lockup_custodian_args_t * self) {
6300 0 : fd_memset( self, 0, sizeof(fd_stake_lockup_custodian_args_t) );
6301 0 : fd_stake_lockup_new( &self->lockup );
6302 0 : fd_sol_sysvar_clock_new( &self->clock );
6303 0 : }
6304 0 : ulong fd_stake_lockup_custodian_args_size( fd_stake_lockup_custodian_args_t const * self ) {
6305 0 : ulong size = 0;
6306 0 : size += fd_stake_lockup_size( &self->lockup );
6307 0 : size += fd_sol_sysvar_clock_size( &self->clock );
6308 0 : size += sizeof(char);
6309 0 : if( NULL != self->custodian ) {
6310 0 : size += fd_pubkey_size( self->custodian );
6311 0 : }
6312 0 : return size;
6313 0 : }
6314 :
6315 0 : FD_FN_PURE uchar fd_stake_authorize_is_staker(fd_stake_authorize_t const * self) {
6316 0 : return self->discriminant == 0;
6317 0 : }
6318 0 : FD_FN_PURE uchar fd_stake_authorize_is_withdrawer(fd_stake_authorize_t const * self) {
6319 0 : return self->discriminant == 1;
6320 0 : }
6321 0 : int fd_stake_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6322 0 : int err;
6323 0 : switch (discriminant) {
6324 0 : case 0: {
6325 0 : return FD_BINCODE_SUCCESS;
6326 0 : }
6327 0 : case 1: {
6328 0 : return FD_BINCODE_SUCCESS;
6329 0 : }
6330 0 : default: return FD_BINCODE_ERR_ENCODING;
6331 0 : }
6332 0 : }
6333 0 : static int fd_stake_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6334 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6335 0 : uint discriminant = 0;
6336 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6337 0 : if( FD_UNLIKELY( err ) ) return err;
6338 0 : return fd_stake_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
6339 0 : }
6340 0 : int fd_stake_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6341 0 : *total_sz += sizeof(fd_stake_authorize_t);
6342 0 : void const * start_data = ctx->data;
6343 0 : int err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6344 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6345 0 : ctx->data = start_data;
6346 0 : return err;
6347 0 : }
6348 0 : static void fd_stake_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6349 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)struct_mem;
6350 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6351 0 : }
6352 0 : void * fd_stake_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6353 0 : fd_stake_authorize_t * self = (fd_stake_authorize_t *)mem;
6354 0 : fd_stake_authorize_new( self );
6355 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorize_t);
6356 0 : void * * alloc_mem = &alloc_region;
6357 0 : fd_stake_authorize_decode_inner( mem, alloc_mem, ctx );
6358 0 : return self;
6359 0 : }
6360 :
6361 0 : ulong fd_stake_authorize_size( fd_stake_authorize_t const * self ) {
6362 0 : ulong size = 0;
6363 0 : size += sizeof(uint);
6364 0 : switch (self->discriminant) {
6365 0 : }
6366 0 : return size;
6367 0 : }
6368 :
6369 0 : int fd_stake_authorize_encode( fd_stake_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6370 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6371 0 : if( FD_UNLIKELY( err ) ) return err;
6372 0 : return err;
6373 0 : }
6374 :
6375 0 : int fd_stake_instruction_authorize_encode( fd_stake_instruction_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6376 0 : int err;
6377 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
6378 0 : if( FD_UNLIKELY( err ) ) return err;
6379 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
6380 0 : if( FD_UNLIKELY( err ) ) return err;
6381 0 : return FD_BINCODE_SUCCESS;
6382 0 : }
6383 0 : static int fd_stake_instruction_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6384 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6385 0 : int err = 0;
6386 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6387 0 : if( FD_UNLIKELY( err ) ) return err;
6388 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6389 0 : if( FD_UNLIKELY( err ) ) return err;
6390 0 : return 0;
6391 0 : }
6392 0 : int fd_stake_instruction_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6393 0 : *total_sz += sizeof(fd_stake_instruction_authorize_t);
6394 0 : void const * start_data = ctx->data;
6395 0 : int err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
6396 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6397 0 : ctx->data = start_data;
6398 0 : return err;
6399 0 : }
6400 0 : static void fd_stake_instruction_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6401 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)struct_mem;
6402 0 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
6403 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
6404 0 : }
6405 0 : void * fd_stake_instruction_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6406 0 : fd_stake_instruction_authorize_t * self = (fd_stake_instruction_authorize_t *)mem;
6407 0 : fd_stake_instruction_authorize_new( self );
6408 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_authorize_t);
6409 0 : void * * alloc_mem = &alloc_region;
6410 0 : fd_stake_instruction_authorize_decode_inner( mem, alloc_mem, ctx );
6411 0 : return self;
6412 0 : }
6413 0 : void fd_stake_instruction_authorize_new(fd_stake_instruction_authorize_t * self) {
6414 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_authorize_t) );
6415 0 : fd_pubkey_new( &self->pubkey );
6416 0 : fd_stake_authorize_new( &self->stake_authorize );
6417 0 : }
6418 0 : int fd_authorize_with_seed_args_encode( fd_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6419 0 : int err;
6420 0 : err = fd_pubkey_encode( &self->new_authorized_pubkey, ctx );
6421 0 : if( FD_UNLIKELY( err ) ) return err;
6422 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
6423 0 : if( FD_UNLIKELY( err ) ) return err;
6424 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
6425 0 : if( FD_UNLIKELY(err) ) return err;
6426 0 : if( self->authority_seed_len ) {
6427 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
6428 0 : if( FD_UNLIKELY( err ) ) return err;
6429 0 : }
6430 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
6431 0 : if( FD_UNLIKELY( err ) ) return err;
6432 0 : return FD_BINCODE_SUCCESS;
6433 0 : }
6434 0 : static int fd_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6435 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6436 0 : int err = 0;
6437 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6438 0 : if( FD_UNLIKELY( err ) ) return err;
6439 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6440 0 : if( FD_UNLIKELY( err ) ) return err;
6441 0 : ulong authority_seed_len;
6442 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
6443 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6444 0 : *total_sz += authority_seed_len;
6445 0 : if( authority_seed_len ) {
6446 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
6447 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6448 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
6449 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6450 0 : }
6451 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6452 0 : if( FD_UNLIKELY( err ) ) return err;
6453 0 : return 0;
6454 0 : }
6455 0 : int fd_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6456 0 : *total_sz += sizeof(fd_authorize_with_seed_args_t);
6457 0 : void const * start_data = ctx->data;
6458 0 : int err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
6459 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6460 0 : ctx->data = start_data;
6461 0 : return err;
6462 0 : }
6463 0 : static void fd_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6464 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)struct_mem;
6465 0 : fd_pubkey_decode_inner( &self->new_authorized_pubkey, alloc_mem, ctx );
6466 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
6467 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
6468 0 : if( self->authority_seed_len ) {
6469 0 : self->authority_seed = *alloc_mem;
6470 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
6471 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
6472 0 : } else
6473 0 : self->authority_seed = NULL;
6474 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
6475 0 : }
6476 0 : void * fd_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6477 0 : fd_authorize_with_seed_args_t * self = (fd_authorize_with_seed_args_t *)mem;
6478 0 : fd_authorize_with_seed_args_new( self );
6479 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_with_seed_args_t);
6480 0 : void * * alloc_mem = &alloc_region;
6481 0 : fd_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
6482 0 : return self;
6483 0 : }
6484 0 : void fd_authorize_with_seed_args_new(fd_authorize_with_seed_args_t * self) {
6485 0 : fd_memset( self, 0, sizeof(fd_authorize_with_seed_args_t) );
6486 0 : fd_pubkey_new( &self->new_authorized_pubkey );
6487 0 : fd_stake_authorize_new( &self->stake_authorize );
6488 0 : fd_pubkey_new( &self->authority_owner );
6489 0 : }
6490 0 : ulong fd_authorize_with_seed_args_size( fd_authorize_with_seed_args_t const * self ) {
6491 0 : ulong size = 0;
6492 0 : size += fd_pubkey_size( &self->new_authorized_pubkey );
6493 0 : size += fd_stake_authorize_size( &self->stake_authorize );
6494 0 : do {
6495 0 : size += sizeof(ulong);
6496 0 : size += self->authority_seed_len;
6497 0 : } while(0);
6498 0 : size += fd_pubkey_size( &self->authority_owner );
6499 0 : return size;
6500 0 : }
6501 :
6502 0 : int fd_authorize_checked_with_seed_args_encode( fd_authorize_checked_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6503 0 : int err;
6504 0 : err = fd_stake_authorize_encode( &self->stake_authorize, ctx );
6505 0 : if( FD_UNLIKELY( err ) ) return err;
6506 0 : err = fd_bincode_uint64_encode( self->authority_seed_len, ctx );
6507 0 : if( FD_UNLIKELY(err) ) return err;
6508 0 : if( self->authority_seed_len ) {
6509 0 : err = fd_bincode_bytes_encode( self->authority_seed, self->authority_seed_len, ctx );
6510 0 : if( FD_UNLIKELY( err ) ) return err;
6511 0 : }
6512 0 : err = fd_pubkey_encode( &self->authority_owner, ctx );
6513 0 : if( FD_UNLIKELY( err ) ) return err;
6514 0 : return FD_BINCODE_SUCCESS;
6515 0 : }
6516 0 : static int fd_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6517 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6518 0 : int err = 0;
6519 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6520 0 : if( FD_UNLIKELY( err ) ) return err;
6521 0 : ulong authority_seed_len;
6522 0 : err = fd_bincode_uint64_decode( &authority_seed_len, ctx );
6523 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6524 0 : *total_sz += authority_seed_len;
6525 0 : if( authority_seed_len ) {
6526 0 : err = fd_bincode_bytes_decode_footprint( authority_seed_len, ctx );
6527 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6528 0 : err = !fd_utf8_verify( (char const *) ctx->data - authority_seed_len, authority_seed_len );
6529 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6530 0 : }
6531 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6532 0 : if( FD_UNLIKELY( err ) ) return err;
6533 0 : return 0;
6534 0 : }
6535 0 : int fd_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6536 0 : *total_sz += sizeof(fd_authorize_checked_with_seed_args_t);
6537 0 : void const * start_data = ctx->data;
6538 0 : int err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
6539 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6540 0 : ctx->data = start_data;
6541 0 : return err;
6542 0 : }
6543 0 : static void fd_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6544 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)struct_mem;
6545 0 : fd_stake_authorize_decode_inner( &self->stake_authorize, alloc_mem, ctx );
6546 0 : fd_bincode_uint64_decode_unsafe( &self->authority_seed_len, ctx );
6547 0 : if( self->authority_seed_len ) {
6548 0 : self->authority_seed = *alloc_mem;
6549 0 : fd_bincode_bytes_decode_unsafe( self->authority_seed, self->authority_seed_len, ctx );
6550 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->authority_seed_len;
6551 0 : } else
6552 0 : self->authority_seed = NULL;
6553 0 : fd_pubkey_decode_inner( &self->authority_owner, alloc_mem, ctx );
6554 0 : }
6555 0 : void * fd_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6556 0 : fd_authorize_checked_with_seed_args_t * self = (fd_authorize_checked_with_seed_args_t *)mem;
6557 0 : fd_authorize_checked_with_seed_args_new( self );
6558 0 : void * alloc_region = (uchar *)mem + sizeof(fd_authorize_checked_with_seed_args_t);
6559 0 : void * * alloc_mem = &alloc_region;
6560 0 : fd_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
6561 0 : return self;
6562 0 : }
6563 0 : void fd_authorize_checked_with_seed_args_new(fd_authorize_checked_with_seed_args_t * self) {
6564 0 : fd_memset( self, 0, sizeof(fd_authorize_checked_with_seed_args_t) );
6565 0 : fd_stake_authorize_new( &self->stake_authorize );
6566 0 : fd_pubkey_new( &self->authority_owner );
6567 0 : }
6568 0 : ulong fd_authorize_checked_with_seed_args_size( fd_authorize_checked_with_seed_args_t const * self ) {
6569 0 : ulong size = 0;
6570 0 : size += fd_stake_authorize_size( &self->stake_authorize );
6571 0 : do {
6572 0 : size += sizeof(ulong);
6573 0 : size += self->authority_seed_len;
6574 0 : } while(0);
6575 0 : size += fd_pubkey_size( &self->authority_owner );
6576 0 : return size;
6577 0 : }
6578 :
6579 0 : int fd_lockup_checked_args_encode( fd_lockup_checked_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6580 0 : int err;
6581 0 : if( self->unix_timestamp != NULL ) {
6582 0 : err = fd_bincode_bool_encode( 1, ctx );
6583 0 : if( FD_UNLIKELY( err ) ) return err;
6584 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
6585 0 : if( FD_UNLIKELY( err ) ) return err;
6586 0 : } else {
6587 0 : err = fd_bincode_bool_encode( 0, ctx );
6588 0 : if( FD_UNLIKELY( err ) ) return err;
6589 0 : }
6590 0 : if( self->epoch != NULL ) {
6591 0 : err = fd_bincode_bool_encode( 1, ctx );
6592 0 : if( FD_UNLIKELY( err ) ) return err;
6593 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
6594 0 : if( FD_UNLIKELY( err ) ) return err;
6595 0 : } else {
6596 0 : err = fd_bincode_bool_encode( 0, ctx );
6597 0 : if( FD_UNLIKELY( err ) ) return err;
6598 0 : }
6599 0 : return FD_BINCODE_SUCCESS;
6600 0 : }
6601 0 : static int fd_lockup_checked_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6602 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6603 0 : int err = 0;
6604 0 : {
6605 0 : uchar o;
6606 0 : err = fd_bincode_bool_decode( &o, ctx );
6607 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6608 0 : if( o ) {
6609 0 : *total_sz += 8UL + sizeof(long);
6610 0 : err = fd_bincode_int64_decode_footprint( ctx );
6611 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6612 0 : }
6613 0 : }
6614 0 : {
6615 0 : uchar o;
6616 0 : err = fd_bincode_bool_decode( &o, ctx );
6617 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6618 0 : if( o ) {
6619 0 : *total_sz += 8UL + sizeof(ulong);
6620 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6621 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6622 0 : }
6623 0 : }
6624 0 : return 0;
6625 0 : }
6626 0 : int fd_lockup_checked_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6627 0 : *total_sz += sizeof(fd_lockup_checked_args_t);
6628 0 : void const * start_data = ctx->data;
6629 0 : int err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
6630 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6631 0 : ctx->data = start_data;
6632 0 : return err;
6633 0 : }
6634 0 : static void fd_lockup_checked_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6635 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)struct_mem;
6636 0 : {
6637 0 : uchar o;
6638 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6639 0 : if( o ) {
6640 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
6641 0 : self->unix_timestamp = *alloc_mem;
6642 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
6643 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
6644 0 : } else {
6645 0 : self->unix_timestamp = NULL;
6646 0 : }
6647 0 : }
6648 0 : {
6649 0 : uchar o;
6650 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6651 0 : if( o ) {
6652 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
6653 0 : self->epoch = *alloc_mem;
6654 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
6655 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
6656 0 : } else {
6657 0 : self->epoch = NULL;
6658 0 : }
6659 0 : }
6660 0 : }
6661 0 : void * fd_lockup_checked_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6662 0 : fd_lockup_checked_args_t * self = (fd_lockup_checked_args_t *)mem;
6663 0 : fd_lockup_checked_args_new( self );
6664 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_checked_args_t);
6665 0 : void * * alloc_mem = &alloc_region;
6666 0 : fd_lockup_checked_args_decode_inner( mem, alloc_mem, ctx );
6667 0 : return self;
6668 0 : }
6669 0 : void fd_lockup_checked_args_new(fd_lockup_checked_args_t * self) {
6670 0 : fd_memset( self, 0, sizeof(fd_lockup_checked_args_t) );
6671 0 : }
6672 0 : ulong fd_lockup_checked_args_size( fd_lockup_checked_args_t const * self ) {
6673 0 : ulong size = 0;
6674 0 : size += sizeof(char);
6675 0 : if( NULL != self->unix_timestamp ) {
6676 0 : size += sizeof(long);
6677 0 : }
6678 0 : size += sizeof(char);
6679 0 : if( NULL != self->epoch ) {
6680 0 : size += sizeof(ulong);
6681 0 : }
6682 0 : return size;
6683 0 : }
6684 :
6685 0 : int fd_lockup_args_encode( fd_lockup_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6686 0 : int err;
6687 0 : if( self->unix_timestamp != NULL ) {
6688 0 : err = fd_bincode_bool_encode( 1, ctx );
6689 0 : if( FD_UNLIKELY( err ) ) return err;
6690 0 : err = fd_bincode_int64_encode( self->unix_timestamp[0], ctx );
6691 0 : if( FD_UNLIKELY( err ) ) return err;
6692 0 : } else {
6693 0 : err = fd_bincode_bool_encode( 0, ctx );
6694 0 : if( FD_UNLIKELY( err ) ) return err;
6695 0 : }
6696 0 : if( self->epoch != NULL ) {
6697 0 : err = fd_bincode_bool_encode( 1, ctx );
6698 0 : if( FD_UNLIKELY( err ) ) return err;
6699 0 : err = fd_bincode_uint64_encode( self->epoch[0], ctx );
6700 0 : if( FD_UNLIKELY( err ) ) return err;
6701 0 : } else {
6702 0 : err = fd_bincode_bool_encode( 0, ctx );
6703 0 : if( FD_UNLIKELY( err ) ) return err;
6704 0 : }
6705 0 : if( self->custodian != NULL ) {
6706 0 : err = fd_bincode_bool_encode( 1, ctx );
6707 0 : if( FD_UNLIKELY( err ) ) return err;
6708 0 : err = fd_pubkey_encode( self->custodian, ctx );
6709 0 : if( FD_UNLIKELY( err ) ) return err;
6710 0 : } else {
6711 0 : err = fd_bincode_bool_encode( 0, ctx );
6712 0 : if( FD_UNLIKELY( err ) ) return err;
6713 0 : }
6714 0 : return FD_BINCODE_SUCCESS;
6715 0 : }
6716 0 : static int fd_lockup_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6717 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6718 0 : int err = 0;
6719 0 : {
6720 0 : uchar o;
6721 0 : err = fd_bincode_bool_decode( &o, ctx );
6722 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6723 0 : if( o ) {
6724 0 : *total_sz += 8UL + sizeof(long);
6725 0 : err = fd_bincode_int64_decode_footprint( ctx );
6726 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6727 0 : }
6728 0 : }
6729 0 : {
6730 0 : uchar o;
6731 0 : err = fd_bincode_bool_decode( &o, ctx );
6732 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6733 0 : if( o ) {
6734 0 : *total_sz += 8UL + sizeof(ulong);
6735 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6736 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6737 0 : }
6738 0 : }
6739 0 : {
6740 0 : uchar o;
6741 0 : err = fd_bincode_bool_decode( &o, ctx );
6742 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6743 0 : if( o ) {
6744 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t);
6745 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
6746 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6747 0 : }
6748 0 : }
6749 0 : return 0;
6750 0 : }
6751 0 : int fd_lockup_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6752 0 : *total_sz += sizeof(fd_lockup_args_t);
6753 0 : void const * start_data = ctx->data;
6754 0 : int err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
6755 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6756 0 : ctx->data = start_data;
6757 0 : return err;
6758 0 : }
6759 0 : static void fd_lockup_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6760 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)struct_mem;
6761 0 : {
6762 0 : uchar o;
6763 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6764 0 : if( o ) {
6765 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
6766 0 : self->unix_timestamp = *alloc_mem;
6767 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(long);
6768 0 : fd_bincode_int64_decode_unsafe( self->unix_timestamp, ctx );
6769 0 : } else {
6770 0 : self->unix_timestamp = NULL;
6771 0 : }
6772 0 : }
6773 0 : {
6774 0 : uchar o;
6775 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6776 0 : if( o ) {
6777 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, 8UL );
6778 0 : self->epoch = *alloc_mem;
6779 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(ulong);
6780 0 : fd_bincode_uint64_decode_unsafe( self->epoch, ctx );
6781 0 : } else {
6782 0 : self->epoch = NULL;
6783 0 : }
6784 0 : }
6785 0 : {
6786 0 : uchar o;
6787 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
6788 0 : if( o ) {
6789 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, FD_PUBKEY_ALIGN );
6790 0 : self->custodian = *alloc_mem;
6791 0 : *alloc_mem = (uchar *)*alloc_mem + sizeof(fd_pubkey_t);
6792 0 : fd_pubkey_new( self->custodian );
6793 0 : fd_pubkey_decode_inner( self->custodian, alloc_mem, ctx );
6794 0 : } else {
6795 0 : self->custodian = NULL;
6796 0 : }
6797 0 : }
6798 0 : }
6799 0 : void * fd_lockup_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6800 0 : fd_lockup_args_t * self = (fd_lockup_args_t *)mem;
6801 0 : fd_lockup_args_new( self );
6802 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lockup_args_t);
6803 0 : void * * alloc_mem = &alloc_region;
6804 0 : fd_lockup_args_decode_inner( mem, alloc_mem, ctx );
6805 0 : return self;
6806 0 : }
6807 0 : void fd_lockup_args_new(fd_lockup_args_t * self) {
6808 0 : fd_memset( self, 0, sizeof(fd_lockup_args_t) );
6809 0 : }
6810 0 : ulong fd_lockup_args_size( fd_lockup_args_t const * self ) {
6811 0 : ulong size = 0;
6812 0 : size += sizeof(char);
6813 0 : if( NULL != self->unix_timestamp ) {
6814 0 : size += sizeof(long);
6815 0 : }
6816 0 : size += sizeof(char);
6817 0 : if( NULL != self->epoch ) {
6818 0 : size += sizeof(ulong);
6819 0 : }
6820 0 : size += sizeof(char);
6821 0 : if( NULL != self->custodian ) {
6822 0 : size += fd_pubkey_size( self->custodian );
6823 0 : }
6824 0 : return size;
6825 0 : }
6826 :
6827 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize(fd_stake_instruction_t const * self) {
6828 0 : return self->discriminant == 0;
6829 0 : }
6830 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize(fd_stake_instruction_t const * self) {
6831 0 : return self->discriminant == 1;
6832 0 : }
6833 0 : FD_FN_PURE uchar fd_stake_instruction_is_delegate_stake(fd_stake_instruction_t const * self) {
6834 0 : return self->discriminant == 2;
6835 0 : }
6836 0 : FD_FN_PURE uchar fd_stake_instruction_is_split(fd_stake_instruction_t const * self) {
6837 0 : return self->discriminant == 3;
6838 0 : }
6839 0 : FD_FN_PURE uchar fd_stake_instruction_is_withdraw(fd_stake_instruction_t const * self) {
6840 0 : return self->discriminant == 4;
6841 0 : }
6842 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate(fd_stake_instruction_t const * self) {
6843 0 : return self->discriminant == 5;
6844 0 : }
6845 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup(fd_stake_instruction_t const * self) {
6846 0 : return self->discriminant == 6;
6847 0 : }
6848 0 : FD_FN_PURE uchar fd_stake_instruction_is_merge(fd_stake_instruction_t const * self) {
6849 0 : return self->discriminant == 7;
6850 0 : }
6851 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_with_seed(fd_stake_instruction_t const * self) {
6852 0 : return self->discriminant == 8;
6853 0 : }
6854 0 : FD_FN_PURE uchar fd_stake_instruction_is_initialize_checked(fd_stake_instruction_t const * self) {
6855 0 : return self->discriminant == 9;
6856 0 : }
6857 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked(fd_stake_instruction_t const * self) {
6858 0 : return self->discriminant == 10;
6859 0 : }
6860 0 : FD_FN_PURE uchar fd_stake_instruction_is_authorize_checked_with_seed(fd_stake_instruction_t const * self) {
6861 0 : return self->discriminant == 11;
6862 0 : }
6863 0 : FD_FN_PURE uchar fd_stake_instruction_is_set_lockup_checked(fd_stake_instruction_t const * self) {
6864 0 : return self->discriminant == 12;
6865 0 : }
6866 0 : FD_FN_PURE uchar fd_stake_instruction_is_get_minimum_delegation(fd_stake_instruction_t const * self) {
6867 0 : return self->discriminant == 13;
6868 0 : }
6869 0 : FD_FN_PURE uchar fd_stake_instruction_is_deactivate_delinquent(fd_stake_instruction_t const * self) {
6870 0 : return self->discriminant == 14;
6871 0 : }
6872 0 : FD_FN_PURE uchar fd_stake_instruction_is_redelegate(fd_stake_instruction_t const * self) {
6873 0 : return self->discriminant == 15;
6874 0 : }
6875 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_stake(fd_stake_instruction_t const * self) {
6876 0 : return self->discriminant == 16;
6877 0 : }
6878 0 : FD_FN_PURE uchar fd_stake_instruction_is_move_lamports(fd_stake_instruction_t const * self) {
6879 0 : return self->discriminant == 17;
6880 0 : }
6881 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant );
6882 0 : int fd_stake_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6883 0 : int err;
6884 0 : switch (discriminant) {
6885 0 : case 0: {
6886 0 : err = fd_stake_instruction_initialize_decode_footprint_inner( ctx, total_sz );
6887 0 : if( FD_UNLIKELY( err ) ) return err;
6888 0 : return FD_BINCODE_SUCCESS;
6889 0 : }
6890 0 : case 1: {
6891 0 : err = fd_stake_instruction_authorize_decode_footprint_inner( ctx, total_sz );
6892 0 : if( FD_UNLIKELY( err ) ) return err;
6893 0 : return FD_BINCODE_SUCCESS;
6894 0 : }
6895 0 : case 2: {
6896 0 : return FD_BINCODE_SUCCESS;
6897 0 : }
6898 0 : case 3: {
6899 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6900 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6901 0 : return FD_BINCODE_SUCCESS;
6902 0 : }
6903 0 : case 4: {
6904 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6905 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6906 0 : return FD_BINCODE_SUCCESS;
6907 0 : }
6908 0 : case 5: {
6909 0 : return FD_BINCODE_SUCCESS;
6910 0 : }
6911 0 : case 6: {
6912 0 : err = fd_lockup_args_decode_footprint_inner( ctx, total_sz );
6913 0 : if( FD_UNLIKELY( err ) ) return err;
6914 0 : return FD_BINCODE_SUCCESS;
6915 0 : }
6916 0 : case 7: {
6917 0 : return FD_BINCODE_SUCCESS;
6918 0 : }
6919 0 : case 8: {
6920 0 : err = fd_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
6921 0 : if( FD_UNLIKELY( err ) ) return err;
6922 0 : return FD_BINCODE_SUCCESS;
6923 0 : }
6924 0 : case 9: {
6925 0 : return FD_BINCODE_SUCCESS;
6926 0 : }
6927 0 : case 10: {
6928 0 : err = fd_stake_authorize_decode_footprint_inner( ctx, total_sz );
6929 0 : if( FD_UNLIKELY( err ) ) return err;
6930 0 : return FD_BINCODE_SUCCESS;
6931 0 : }
6932 0 : case 11: {
6933 0 : err = fd_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
6934 0 : if( FD_UNLIKELY( err ) ) return err;
6935 0 : return FD_BINCODE_SUCCESS;
6936 0 : }
6937 0 : case 12: {
6938 0 : err = fd_lockup_checked_args_decode_footprint_inner( ctx, total_sz );
6939 0 : if( FD_UNLIKELY( err ) ) return err;
6940 0 : return FD_BINCODE_SUCCESS;
6941 0 : }
6942 0 : case 13: {
6943 0 : return FD_BINCODE_SUCCESS;
6944 0 : }
6945 0 : case 14: {
6946 0 : return FD_BINCODE_SUCCESS;
6947 0 : }
6948 0 : case 15: {
6949 0 : return FD_BINCODE_SUCCESS;
6950 0 : }
6951 0 : case 16: {
6952 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6953 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6954 0 : return FD_BINCODE_SUCCESS;
6955 0 : }
6956 0 : case 17: {
6957 0 : err = fd_bincode_uint64_decode_footprint( ctx );
6958 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6959 0 : return FD_BINCODE_SUCCESS;
6960 0 : }
6961 0 : default: return FD_BINCODE_ERR_ENCODING;
6962 0 : }
6963 0 : }
6964 0 : static int fd_stake_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6965 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6966 0 : uint discriminant = 0;
6967 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6968 0 : if( FD_UNLIKELY( err ) ) return err;
6969 0 : return fd_stake_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
6970 0 : }
6971 0 : int fd_stake_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6972 0 : *total_sz += sizeof(fd_stake_instruction_t);
6973 0 : void const * start_data = ctx->data;
6974 0 : int err = fd_stake_instruction_decode_footprint_inner( ctx, total_sz );
6975 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6976 0 : ctx->data = start_data;
6977 0 : return err;
6978 0 : }
6979 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 ) {
6980 0 : switch (discriminant) {
6981 0 : case 0: {
6982 0 : fd_stake_instruction_initialize_decode_inner( &self->initialize, alloc_mem, ctx );
6983 0 : break;
6984 0 : }
6985 0 : case 1: {
6986 0 : fd_stake_instruction_authorize_decode_inner( &self->authorize, alloc_mem, ctx );
6987 0 : break;
6988 0 : }
6989 0 : case 2: {
6990 0 : break;
6991 0 : }
6992 0 : case 3: {
6993 0 : fd_bincode_uint64_decode_unsafe( &self->split, ctx );
6994 0 : break;
6995 0 : }
6996 0 : case 4: {
6997 0 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
6998 0 : break;
6999 0 : }
7000 0 : case 5: {
7001 0 : break;
7002 0 : }
7003 0 : case 6: {
7004 0 : fd_lockup_args_decode_inner( &self->set_lockup, alloc_mem, ctx );
7005 0 : break;
7006 0 : }
7007 0 : case 7: {
7008 0 : break;
7009 0 : }
7010 0 : case 8: {
7011 0 : fd_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
7012 0 : break;
7013 0 : }
7014 0 : case 9: {
7015 0 : break;
7016 0 : }
7017 0 : case 10: {
7018 0 : fd_stake_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
7019 0 : break;
7020 0 : }
7021 0 : case 11: {
7022 0 : fd_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
7023 0 : break;
7024 0 : }
7025 0 : case 12: {
7026 0 : fd_lockup_checked_args_decode_inner( &self->set_lockup_checked, alloc_mem, ctx );
7027 0 : break;
7028 0 : }
7029 0 : case 13: {
7030 0 : break;
7031 0 : }
7032 0 : case 14: {
7033 0 : break;
7034 0 : }
7035 0 : case 15: {
7036 0 : break;
7037 0 : }
7038 0 : case 16: {
7039 0 : fd_bincode_uint64_decode_unsafe( &self->move_stake, ctx );
7040 0 : break;
7041 0 : }
7042 0 : case 17: {
7043 0 : fd_bincode_uint64_decode_unsafe( &self->move_lamports, ctx );
7044 0 : break;
7045 0 : }
7046 0 : }
7047 0 : }
7048 0 : static void fd_stake_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7049 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)struct_mem;
7050 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7051 0 : fd_stake_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7052 0 : }
7053 0 : void * fd_stake_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7054 0 : fd_stake_instruction_t * self = (fd_stake_instruction_t *)mem;
7055 0 : fd_stake_instruction_new( self );
7056 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_instruction_t);
7057 0 : void * * alloc_mem = &alloc_region;
7058 0 : fd_stake_instruction_decode_inner( mem, alloc_mem, ctx );
7059 0 : return self;
7060 0 : }
7061 0 : void fd_stake_instruction_inner_new( fd_stake_instruction_inner_t * self, uint discriminant ) {
7062 0 : switch( discriminant ) {
7063 0 : case 0: {
7064 0 : fd_stake_instruction_initialize_new( &self->initialize );
7065 0 : break;
7066 0 : }
7067 0 : case 1: {
7068 0 : fd_stake_instruction_authorize_new( &self->authorize );
7069 0 : break;
7070 0 : }
7071 0 : case 2: {
7072 0 : break;
7073 0 : }
7074 0 : case 3: {
7075 0 : break;
7076 0 : }
7077 0 : case 4: {
7078 0 : break;
7079 0 : }
7080 0 : case 5: {
7081 0 : break;
7082 0 : }
7083 0 : case 6: {
7084 0 : fd_lockup_args_new( &self->set_lockup );
7085 0 : break;
7086 0 : }
7087 0 : case 7: {
7088 0 : break;
7089 0 : }
7090 0 : case 8: {
7091 0 : fd_authorize_with_seed_args_new( &self->authorize_with_seed );
7092 0 : break;
7093 0 : }
7094 0 : case 9: {
7095 0 : break;
7096 0 : }
7097 0 : case 10: {
7098 0 : fd_stake_authorize_new( &self->authorize_checked );
7099 0 : break;
7100 0 : }
7101 0 : case 11: {
7102 0 : fd_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
7103 0 : break;
7104 0 : }
7105 0 : case 12: {
7106 0 : fd_lockup_checked_args_new( &self->set_lockup_checked );
7107 0 : break;
7108 0 : }
7109 0 : case 13: {
7110 0 : break;
7111 0 : }
7112 0 : case 14: {
7113 0 : break;
7114 0 : }
7115 0 : case 15: {
7116 0 : break;
7117 0 : }
7118 0 : case 16: {
7119 0 : break;
7120 0 : }
7121 0 : case 17: {
7122 0 : break;
7123 0 : }
7124 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7125 0 : }
7126 0 : }
7127 0 : void fd_stake_instruction_new_disc( fd_stake_instruction_t * self, uint discriminant ) {
7128 0 : self->discriminant = discriminant;
7129 0 : fd_stake_instruction_inner_new( &self->inner, self->discriminant );
7130 0 : }
7131 0 : void fd_stake_instruction_new( fd_stake_instruction_t * self ) {
7132 0 : fd_memset( self, 0, sizeof(fd_stake_instruction_t) );
7133 0 : fd_stake_instruction_new_disc( self, UINT_MAX );
7134 0 : }
7135 :
7136 0 : ulong fd_stake_instruction_size( fd_stake_instruction_t const * self ) {
7137 0 : ulong size = 0;
7138 0 : size += sizeof(uint);
7139 0 : switch (self->discriminant) {
7140 0 : case 0: {
7141 0 : size += fd_stake_instruction_initialize_size( &self->inner.initialize );
7142 0 : break;
7143 0 : }
7144 0 : case 1: {
7145 0 : size += fd_stake_instruction_authorize_size( &self->inner.authorize );
7146 0 : break;
7147 0 : }
7148 0 : case 3: {
7149 0 : size += sizeof(ulong);
7150 0 : break;
7151 0 : }
7152 0 : case 4: {
7153 0 : size += sizeof(ulong);
7154 0 : break;
7155 0 : }
7156 0 : case 6: {
7157 0 : size += fd_lockup_args_size( &self->inner.set_lockup );
7158 0 : break;
7159 0 : }
7160 0 : case 8: {
7161 0 : size += fd_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
7162 0 : break;
7163 0 : }
7164 0 : case 10: {
7165 0 : size += fd_stake_authorize_size( &self->inner.authorize_checked );
7166 0 : break;
7167 0 : }
7168 0 : case 11: {
7169 0 : size += fd_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
7170 0 : break;
7171 0 : }
7172 0 : case 12: {
7173 0 : size += fd_lockup_checked_args_size( &self->inner.set_lockup_checked );
7174 0 : break;
7175 0 : }
7176 0 : case 16: {
7177 0 : size += sizeof(ulong);
7178 0 : break;
7179 0 : }
7180 0 : case 17: {
7181 0 : size += sizeof(ulong);
7182 0 : break;
7183 0 : }
7184 0 : }
7185 0 : return size;
7186 0 : }
7187 :
7188 0 : int fd_stake_instruction_inner_encode( fd_stake_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7189 0 : int err;
7190 0 : switch (discriminant) {
7191 0 : case 0: {
7192 0 : err = fd_stake_instruction_initialize_encode( &self->initialize, ctx );
7193 0 : if( FD_UNLIKELY( err ) ) return err;
7194 0 : break;
7195 0 : }
7196 0 : case 1: {
7197 0 : err = fd_stake_instruction_authorize_encode( &self->authorize, ctx );
7198 0 : if( FD_UNLIKELY( err ) ) return err;
7199 0 : break;
7200 0 : }
7201 0 : case 3: {
7202 0 : err = fd_bincode_uint64_encode( self->split, ctx );
7203 0 : if( FD_UNLIKELY( err ) ) return err;
7204 0 : break;
7205 0 : }
7206 0 : case 4: {
7207 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
7208 0 : if( FD_UNLIKELY( err ) ) return err;
7209 0 : break;
7210 0 : }
7211 0 : case 6: {
7212 0 : err = fd_lockup_args_encode( &self->set_lockup, ctx );
7213 0 : if( FD_UNLIKELY( err ) ) return err;
7214 0 : break;
7215 0 : }
7216 0 : case 8: {
7217 0 : err = fd_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
7218 0 : if( FD_UNLIKELY( err ) ) return err;
7219 0 : break;
7220 0 : }
7221 0 : case 10: {
7222 0 : err = fd_stake_authorize_encode( &self->authorize_checked, ctx );
7223 0 : if( FD_UNLIKELY( err ) ) return err;
7224 0 : break;
7225 0 : }
7226 0 : case 11: {
7227 0 : err = fd_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
7228 0 : if( FD_UNLIKELY( err ) ) return err;
7229 0 : break;
7230 0 : }
7231 0 : case 12: {
7232 0 : err = fd_lockup_checked_args_encode( &self->set_lockup_checked, ctx );
7233 0 : if( FD_UNLIKELY( err ) ) return err;
7234 0 : break;
7235 0 : }
7236 0 : case 16: {
7237 0 : err = fd_bincode_uint64_encode( self->move_stake, ctx );
7238 0 : if( FD_UNLIKELY( err ) ) return err;
7239 0 : break;
7240 0 : }
7241 0 : case 17: {
7242 0 : err = fd_bincode_uint64_encode( self->move_lamports, ctx );
7243 0 : if( FD_UNLIKELY( err ) ) return err;
7244 0 : break;
7245 0 : }
7246 0 : }
7247 0 : return FD_BINCODE_SUCCESS;
7248 0 : }
7249 0 : int fd_stake_instruction_encode( fd_stake_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7250 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7251 0 : if( FD_UNLIKELY( err ) ) return err;
7252 0 : return fd_stake_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7253 0 : }
7254 :
7255 12 : int fd_stake_meta_encode( fd_stake_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7256 12 : int err;
7257 12 : err = fd_bincode_uint64_encode( self->rent_exempt_reserve, ctx );
7258 12 : if( FD_UNLIKELY( err ) ) return err;
7259 12 : err = fd_stake_authorized_encode( &self->authorized, ctx );
7260 12 : if( FD_UNLIKELY( err ) ) return err;
7261 12 : err = fd_stake_lockup_encode( &self->lockup, ctx );
7262 12 : if( FD_UNLIKELY( err ) ) return err;
7263 12 : return FD_BINCODE_SUCCESS;
7264 12 : }
7265 0 : static inline int fd_stake_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7266 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7267 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
7268 0 : return 0;
7269 0 : }
7270 0 : static void fd_stake_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7271 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)struct_mem;
7272 0 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
7273 0 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
7274 0 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
7275 0 : }
7276 0 : void * fd_stake_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7277 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)mem;
7278 0 : fd_stake_meta_new( self );
7279 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_meta_t);
7280 0 : void * * alloc_mem = &alloc_region;
7281 0 : fd_stake_meta_decode_inner( mem, alloc_mem, ctx );
7282 0 : return self;
7283 0 : }
7284 12 : int fd_stake_flags_encode( fd_stake_flags_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7285 12 : int err;
7286 12 : err = fd_bincode_uint8_encode( (uchar)(self->bits), ctx );
7287 12 : if( FD_UNLIKELY( err ) ) return err;
7288 12 : return FD_BINCODE_SUCCESS;
7289 12 : }
7290 0 : static inline int fd_stake_flags_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7291 0 : if( (ulong)ctx->data + 1UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7292 0 : ctx->data = (void *)( (ulong)ctx->data + 1UL );
7293 0 : return 0;
7294 0 : }
7295 0 : static void fd_stake_flags_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7296 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)struct_mem;
7297 0 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
7298 0 : }
7299 0 : void * fd_stake_flags_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7300 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)mem;
7301 0 : fd_stake_flags_new( self );
7302 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_flags_t);
7303 0 : void * * alloc_mem = &alloc_region;
7304 0 : fd_stake_flags_decode_inner( mem, alloc_mem, ctx );
7305 0 : return self;
7306 0 : }
7307 0 : int fd_stake_state_v2_initialized_encode( fd_stake_state_v2_initialized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7308 0 : int err;
7309 0 : err = fd_stake_meta_encode( &self->meta, ctx );
7310 0 : if( FD_UNLIKELY( err ) ) return err;
7311 0 : return FD_BINCODE_SUCCESS;
7312 0 : }
7313 0 : static inline int fd_stake_state_v2_initialized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7314 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7315 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
7316 0 : return 0;
7317 0 : }
7318 0 : static void fd_stake_state_v2_initialized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7319 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)struct_mem;
7320 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
7321 0 : }
7322 0 : void * fd_stake_state_v2_initialized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7323 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)mem;
7324 0 : fd_stake_state_v2_initialized_new( self );
7325 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_initialized_t);
7326 0 : void * * alloc_mem = &alloc_region;
7327 0 : fd_stake_state_v2_initialized_decode_inner( mem, alloc_mem, ctx );
7328 0 : return self;
7329 0 : }
7330 12 : int fd_stake_state_v2_stake_encode( fd_stake_state_v2_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7331 12 : int err;
7332 12 : err = fd_stake_meta_encode( &self->meta, ctx );
7333 12 : if( FD_UNLIKELY( err ) ) return err;
7334 12 : err = fd_stake_encode( &self->stake, ctx );
7335 12 : if( FD_UNLIKELY( err ) ) return err;
7336 12 : err = fd_stake_flags_encode( &self->stake_flags, ctx );
7337 12 : if( FD_UNLIKELY( err ) ) return err;
7338 12 : return FD_BINCODE_SUCCESS;
7339 12 : }
7340 0 : static inline int fd_stake_state_v2_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7341 0 : if( (ulong)ctx->data + 193UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7342 0 : ctx->data = (void *)( (ulong)ctx->data + 193UL );
7343 0 : return 0;
7344 0 : }
7345 0 : static void fd_stake_state_v2_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7346 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)struct_mem;
7347 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
7348 0 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
7349 0 : fd_stake_flags_decode_inner( &self->stake_flags, alloc_mem, ctx );
7350 0 : }
7351 0 : void * fd_stake_state_v2_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7352 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)mem;
7353 0 : fd_stake_state_v2_stake_new( self );
7354 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_stake_t);
7355 0 : void * * alloc_mem = &alloc_region;
7356 0 : fd_stake_state_v2_stake_decode_inner( mem, alloc_mem, ctx );
7357 0 : return self;
7358 0 : }
7359 0 : FD_FN_PURE uchar fd_stake_state_v2_is_uninitialized(fd_stake_state_v2_t const * self) {
7360 0 : return self->discriminant == 0;
7361 0 : }
7362 0 : FD_FN_PURE uchar fd_stake_state_v2_is_initialized(fd_stake_state_v2_t const * self) {
7363 0 : return self->discriminant == 1;
7364 0 : }
7365 0 : FD_FN_PURE uchar fd_stake_state_v2_is_stake(fd_stake_state_v2_t const * self) {
7366 0 : return self->discriminant == 2;
7367 0 : }
7368 0 : FD_FN_PURE uchar fd_stake_state_v2_is_rewards_pool(fd_stake_state_v2_t const * self) {
7369 0 : return self->discriminant == 3;
7370 0 : }
7371 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant );
7372 0 : int fd_stake_state_v2_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7373 0 : int err;
7374 0 : switch (discriminant) {
7375 0 : case 0: {
7376 0 : return FD_BINCODE_SUCCESS;
7377 0 : }
7378 0 : case 1: {
7379 0 : err = fd_stake_state_v2_initialized_decode_footprint_inner( ctx, total_sz );
7380 0 : if( FD_UNLIKELY( err ) ) return err;
7381 0 : return FD_BINCODE_SUCCESS;
7382 0 : }
7383 0 : case 2: {
7384 0 : err = fd_stake_state_v2_stake_decode_footprint_inner( ctx, total_sz );
7385 0 : if( FD_UNLIKELY( err ) ) return err;
7386 0 : return FD_BINCODE_SUCCESS;
7387 0 : }
7388 0 : case 3: {
7389 0 : return FD_BINCODE_SUCCESS;
7390 0 : }
7391 0 : default: return FD_BINCODE_ERR_ENCODING;
7392 0 : }
7393 0 : }
7394 0 : static int fd_stake_state_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7395 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7396 0 : uint discriminant = 0;
7397 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7398 0 : if( FD_UNLIKELY( err ) ) return err;
7399 0 : return fd_stake_state_v2_inner_decode_footprint( discriminant, ctx, total_sz );
7400 0 : }
7401 0 : int fd_stake_state_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7402 0 : *total_sz += sizeof(fd_stake_state_v2_t);
7403 0 : void const * start_data = ctx->data;
7404 0 : int err = fd_stake_state_v2_decode_footprint_inner( ctx, total_sz );
7405 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7406 0 : ctx->data = start_data;
7407 0 : return err;
7408 0 : }
7409 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 ) {
7410 0 : switch (discriminant) {
7411 0 : case 0: {
7412 0 : break;
7413 0 : }
7414 0 : case 1: {
7415 0 : fd_stake_state_v2_initialized_decode_inner( &self->initialized, alloc_mem, ctx );
7416 0 : break;
7417 0 : }
7418 0 : case 2: {
7419 0 : fd_stake_state_v2_stake_decode_inner( &self->stake, alloc_mem, ctx );
7420 0 : break;
7421 0 : }
7422 0 : case 3: {
7423 0 : break;
7424 0 : }
7425 0 : }
7426 0 : }
7427 0 : static void fd_stake_state_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7428 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)struct_mem;
7429 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7430 0 : fd_stake_state_v2_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7431 0 : }
7432 0 : void * fd_stake_state_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7433 0 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)mem;
7434 0 : fd_stake_state_v2_new( self );
7435 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_t);
7436 0 : void * * alloc_mem = &alloc_region;
7437 0 : fd_stake_state_v2_decode_inner( mem, alloc_mem, ctx );
7438 0 : return self;
7439 0 : }
7440 12 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant ) {
7441 12 : switch( discriminant ) {
7442 0 : case 0: {
7443 0 : break;
7444 0 : }
7445 0 : case 1: {
7446 0 : fd_stake_state_v2_initialized_new( &self->initialized );
7447 0 : break;
7448 0 : }
7449 12 : case 2: {
7450 12 : fd_stake_state_v2_stake_new( &self->stake );
7451 12 : break;
7452 0 : }
7453 0 : case 3: {
7454 0 : break;
7455 0 : }
7456 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7457 12 : }
7458 12 : }
7459 12 : void fd_stake_state_v2_new_disc( fd_stake_state_v2_t * self, uint discriminant ) {
7460 12 : self->discriminant = discriminant;
7461 12 : fd_stake_state_v2_inner_new( &self->inner, self->discriminant );
7462 12 : }
7463 0 : void fd_stake_state_v2_new( fd_stake_state_v2_t * self ) {
7464 0 : fd_memset( self, 0, sizeof(fd_stake_state_v2_t) );
7465 0 : fd_stake_state_v2_new_disc( self, UINT_MAX );
7466 0 : }
7467 :
7468 0 : ulong fd_stake_state_v2_size( fd_stake_state_v2_t const * self ) {
7469 0 : ulong size = 0;
7470 0 : size += sizeof(uint);
7471 0 : switch (self->discriminant) {
7472 0 : case 1: {
7473 0 : size += fd_stake_state_v2_initialized_size( &self->inner.initialized );
7474 0 : break;
7475 0 : }
7476 0 : case 2: {
7477 0 : size += fd_stake_state_v2_stake_size( &self->inner.stake );
7478 0 : break;
7479 0 : }
7480 0 : }
7481 0 : return size;
7482 0 : }
7483 :
7484 12 : int fd_stake_state_v2_inner_encode( fd_stake_state_v2_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7485 12 : int err;
7486 12 : switch (discriminant) {
7487 0 : case 1: {
7488 0 : err = fd_stake_state_v2_initialized_encode( &self->initialized, ctx );
7489 0 : if( FD_UNLIKELY( err ) ) return err;
7490 0 : break;
7491 0 : }
7492 12 : case 2: {
7493 12 : err = fd_stake_state_v2_stake_encode( &self->stake, ctx );
7494 12 : if( FD_UNLIKELY( err ) ) return err;
7495 12 : break;
7496 12 : }
7497 12 : }
7498 12 : return FD_BINCODE_SUCCESS;
7499 12 : }
7500 12 : int fd_stake_state_v2_encode( fd_stake_state_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7501 12 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7502 12 : if( FD_UNLIKELY( err ) ) return err;
7503 12 : return fd_stake_state_v2_inner_encode( &self->inner, self->discriminant, ctx );
7504 12 : }
7505 :
7506 0 : int fd_nonce_data_encode( fd_nonce_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7507 0 : int err;
7508 0 : err = fd_pubkey_encode( &self->authority, ctx );
7509 0 : if( FD_UNLIKELY( err ) ) return err;
7510 0 : err = fd_hash_encode( &self->durable_nonce, ctx );
7511 0 : if( FD_UNLIKELY( err ) ) return err;
7512 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
7513 0 : if( FD_UNLIKELY( err ) ) return err;
7514 0 : return FD_BINCODE_SUCCESS;
7515 0 : }
7516 0 : static inline int fd_nonce_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7517 0 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7518 0 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
7519 0 : return 0;
7520 0 : }
7521 0 : static void fd_nonce_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7522 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)struct_mem;
7523 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
7524 0 : fd_hash_decode_inner( &self->durable_nonce, alloc_mem, ctx );
7525 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
7526 0 : }
7527 0 : void * fd_nonce_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7528 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)mem;
7529 0 : fd_nonce_data_new( self );
7530 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_data_t);
7531 0 : void * * alloc_mem = &alloc_region;
7532 0 : fd_nonce_data_decode_inner( mem, alloc_mem, ctx );
7533 0 : return self;
7534 0 : }
7535 0 : FD_FN_PURE uchar fd_nonce_state_is_uninitialized(fd_nonce_state_t const * self) {
7536 0 : return self->discriminant == 0;
7537 0 : }
7538 0 : FD_FN_PURE uchar fd_nonce_state_is_initialized(fd_nonce_state_t const * self) {
7539 0 : return self->discriminant == 1;
7540 0 : }
7541 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant );
7542 0 : int fd_nonce_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7543 0 : int err;
7544 0 : switch (discriminant) {
7545 0 : case 0: {
7546 0 : return FD_BINCODE_SUCCESS;
7547 0 : }
7548 0 : case 1: {
7549 0 : err = fd_nonce_data_decode_footprint_inner( ctx, total_sz );
7550 0 : if( FD_UNLIKELY( err ) ) return err;
7551 0 : return FD_BINCODE_SUCCESS;
7552 0 : }
7553 0 : default: return FD_BINCODE_ERR_ENCODING;
7554 0 : }
7555 0 : }
7556 0 : static int fd_nonce_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7557 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7558 0 : uint discriminant = 0;
7559 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7560 0 : if( FD_UNLIKELY( err ) ) return err;
7561 0 : return fd_nonce_state_inner_decode_footprint( discriminant, ctx, total_sz );
7562 0 : }
7563 0 : int fd_nonce_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7564 0 : *total_sz += sizeof(fd_nonce_state_t);
7565 0 : void const * start_data = ctx->data;
7566 0 : int err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
7567 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7568 0 : ctx->data = start_data;
7569 0 : return err;
7570 0 : }
7571 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 ) {
7572 0 : switch (discriminant) {
7573 0 : case 0: {
7574 0 : break;
7575 0 : }
7576 0 : case 1: {
7577 0 : fd_nonce_data_decode_inner( &self->initialized, alloc_mem, ctx );
7578 0 : break;
7579 0 : }
7580 0 : }
7581 0 : }
7582 0 : static void fd_nonce_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7583 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)struct_mem;
7584 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7585 0 : fd_nonce_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7586 0 : }
7587 0 : void * fd_nonce_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7588 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)mem;
7589 0 : fd_nonce_state_new( self );
7590 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_t);
7591 0 : void * * alloc_mem = &alloc_region;
7592 0 : fd_nonce_state_decode_inner( mem, alloc_mem, ctx );
7593 0 : return self;
7594 0 : }
7595 0 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant ) {
7596 0 : switch( discriminant ) {
7597 0 : case 0: {
7598 0 : break;
7599 0 : }
7600 0 : case 1: {
7601 0 : fd_nonce_data_new( &self->initialized );
7602 0 : break;
7603 0 : }
7604 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7605 0 : }
7606 0 : }
7607 0 : void fd_nonce_state_new_disc( fd_nonce_state_t * self, uint discriminant ) {
7608 0 : self->discriminant = discriminant;
7609 0 : fd_nonce_state_inner_new( &self->inner, self->discriminant );
7610 0 : }
7611 0 : void fd_nonce_state_new( fd_nonce_state_t * self ) {
7612 0 : fd_memset( self, 0, sizeof(fd_nonce_state_t) );
7613 0 : fd_nonce_state_new_disc( self, UINT_MAX );
7614 0 : }
7615 :
7616 0 : ulong fd_nonce_state_size( fd_nonce_state_t const * self ) {
7617 0 : ulong size = 0;
7618 0 : size += sizeof(uint);
7619 0 : switch (self->discriminant) {
7620 0 : case 1: {
7621 0 : size += fd_nonce_data_size( &self->inner.initialized );
7622 0 : break;
7623 0 : }
7624 0 : }
7625 0 : return size;
7626 0 : }
7627 :
7628 0 : int fd_nonce_state_inner_encode( fd_nonce_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7629 0 : int err;
7630 0 : switch (discriminant) {
7631 0 : case 1: {
7632 0 : err = fd_nonce_data_encode( &self->initialized, ctx );
7633 0 : if( FD_UNLIKELY( err ) ) return err;
7634 0 : break;
7635 0 : }
7636 0 : }
7637 0 : return FD_BINCODE_SUCCESS;
7638 0 : }
7639 0 : int fd_nonce_state_encode( fd_nonce_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7640 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7641 0 : if( FD_UNLIKELY( err ) ) return err;
7642 0 : return fd_nonce_state_inner_encode( &self->inner, self->discriminant, ctx );
7643 0 : }
7644 :
7645 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_legacy(fd_nonce_state_versions_t const * self) {
7646 0 : return self->discriminant == 0;
7647 0 : }
7648 0 : FD_FN_PURE uchar fd_nonce_state_versions_is_current(fd_nonce_state_versions_t const * self) {
7649 0 : return self->discriminant == 1;
7650 0 : }
7651 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant );
7652 0 : int fd_nonce_state_versions_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7653 0 : int err;
7654 0 : switch (discriminant) {
7655 0 : case 0: {
7656 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
7657 0 : if( FD_UNLIKELY( err ) ) return err;
7658 0 : return FD_BINCODE_SUCCESS;
7659 0 : }
7660 0 : case 1: {
7661 0 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
7662 0 : if( FD_UNLIKELY( err ) ) return err;
7663 0 : return FD_BINCODE_SUCCESS;
7664 0 : }
7665 0 : default: return FD_BINCODE_ERR_ENCODING;
7666 0 : }
7667 0 : }
7668 0 : static int fd_nonce_state_versions_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7669 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7670 0 : uint discriminant = 0;
7671 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7672 0 : if( FD_UNLIKELY( err ) ) return err;
7673 0 : return fd_nonce_state_versions_inner_decode_footprint( discriminant, ctx, total_sz );
7674 0 : }
7675 0 : int fd_nonce_state_versions_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7676 0 : *total_sz += sizeof(fd_nonce_state_versions_t);
7677 0 : void const * start_data = ctx->data;
7678 0 : int err = fd_nonce_state_versions_decode_footprint_inner( ctx, total_sz );
7679 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7680 0 : ctx->data = start_data;
7681 0 : return err;
7682 0 : }
7683 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 ) {
7684 0 : switch (discriminant) {
7685 0 : case 0: {
7686 0 : fd_nonce_state_decode_inner( &self->legacy, alloc_mem, ctx );
7687 0 : break;
7688 0 : }
7689 0 : case 1: {
7690 0 : fd_nonce_state_decode_inner( &self->current, alloc_mem, ctx );
7691 0 : break;
7692 0 : }
7693 0 : }
7694 0 : }
7695 0 : static void fd_nonce_state_versions_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7696 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)struct_mem;
7697 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7698 0 : fd_nonce_state_versions_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7699 0 : }
7700 0 : void * fd_nonce_state_versions_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7701 0 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)mem;
7702 0 : fd_nonce_state_versions_new( self );
7703 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_versions_t);
7704 0 : void * * alloc_mem = &alloc_region;
7705 0 : fd_nonce_state_versions_decode_inner( mem, alloc_mem, ctx );
7706 0 : return self;
7707 0 : }
7708 0 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
7709 0 : switch( discriminant ) {
7710 0 : case 0: {
7711 0 : fd_nonce_state_new( &self->legacy );
7712 0 : break;
7713 0 : }
7714 0 : case 1: {
7715 0 : fd_nonce_state_new( &self->current );
7716 0 : break;
7717 0 : }
7718 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7719 0 : }
7720 0 : }
7721 0 : void fd_nonce_state_versions_new_disc( fd_nonce_state_versions_t * self, uint discriminant ) {
7722 0 : self->discriminant = discriminant;
7723 0 : fd_nonce_state_versions_inner_new( &self->inner, self->discriminant );
7724 0 : }
7725 0 : void fd_nonce_state_versions_new( fd_nonce_state_versions_t * self ) {
7726 0 : fd_memset( self, 0, sizeof(fd_nonce_state_versions_t) );
7727 0 : fd_nonce_state_versions_new_disc( self, UINT_MAX );
7728 0 : }
7729 :
7730 0 : ulong fd_nonce_state_versions_size( fd_nonce_state_versions_t const * self ) {
7731 0 : ulong size = 0;
7732 0 : size += sizeof(uint);
7733 0 : switch (self->discriminant) {
7734 0 : case 0: {
7735 0 : size += fd_nonce_state_size( &self->inner.legacy );
7736 0 : break;
7737 0 : }
7738 0 : case 1: {
7739 0 : size += fd_nonce_state_size( &self->inner.current );
7740 0 : break;
7741 0 : }
7742 0 : }
7743 0 : return size;
7744 0 : }
7745 :
7746 0 : int fd_nonce_state_versions_inner_encode( fd_nonce_state_versions_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
7747 0 : int err;
7748 0 : switch (discriminant) {
7749 0 : case 0: {
7750 0 : err = fd_nonce_state_encode( &self->legacy, ctx );
7751 0 : if( FD_UNLIKELY( err ) ) return err;
7752 0 : break;
7753 0 : }
7754 0 : case 1: {
7755 0 : err = fd_nonce_state_encode( &self->current, ctx );
7756 0 : if( FD_UNLIKELY( err ) ) return err;
7757 0 : break;
7758 0 : }
7759 0 : }
7760 0 : return FD_BINCODE_SUCCESS;
7761 0 : }
7762 0 : int fd_nonce_state_versions_encode( fd_nonce_state_versions_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7763 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7764 0 : if( FD_UNLIKELY( err ) ) return err;
7765 0 : return fd_nonce_state_versions_inner_encode( &self->inner, self->discriminant, ctx );
7766 0 : }
7767 :
7768 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 ) {
7769 0 : int err;
7770 0 : err = fd_bincode_uint32_encode( self->units, ctx );
7771 0 : if( FD_UNLIKELY( err ) ) return err;
7772 0 : err = fd_bincode_uint32_encode( self->additional_fee, ctx );
7773 0 : if( FD_UNLIKELY( err ) ) return err;
7774 0 : return FD_BINCODE_SUCCESS;
7775 0 : }
7776 0 : static inline int fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7777 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7778 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
7779 0 : return 0;
7780 0 : }
7781 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 ) {
7782 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)struct_mem;
7783 0 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
7784 0 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
7785 0 : }
7786 0 : void * fd_compute_budget_program_instruction_request_units_deprecated_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7787 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)mem;
7788 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( self );
7789 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t);
7790 0 : void * * alloc_mem = &alloc_region;
7791 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( mem, alloc_mem, ctx );
7792 0 : return self;
7793 0 : }
7794 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_units_deprecated(fd_compute_budget_program_instruction_t const * self) {
7795 0 : return self->discriminant == 0;
7796 0 : }
7797 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_heap_frame(fd_compute_budget_program_instruction_t const * self) {
7798 0 : return self->discriminant == 1;
7799 0 : }
7800 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_limit(fd_compute_budget_program_instruction_t const * self) {
7801 0 : return self->discriminant == 2;
7802 0 : }
7803 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_price(fd_compute_budget_program_instruction_t const * self) {
7804 0 : return self->discriminant == 3;
7805 0 : }
7806 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) {
7807 0 : return self->discriminant == 4;
7808 0 : }
7809 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant );
7810 15 : int fd_compute_budget_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7811 15 : int err;
7812 15 : switch (discriminant) {
7813 0 : case 0: {
7814 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( ctx, total_sz );
7815 0 : if( FD_UNLIKELY( err ) ) return err;
7816 0 : return FD_BINCODE_SUCCESS;
7817 0 : }
7818 0 : case 1: {
7819 0 : err = fd_bincode_uint32_decode_footprint( ctx );
7820 0 : if( FD_UNLIKELY( err ) ) return err;
7821 0 : return FD_BINCODE_SUCCESS;
7822 0 : }
7823 15 : case 2: {
7824 15 : err = fd_bincode_uint32_decode_footprint( ctx );
7825 15 : if( FD_UNLIKELY( err ) ) return err;
7826 15 : return FD_BINCODE_SUCCESS;
7827 15 : }
7828 0 : case 3: {
7829 0 : err = fd_bincode_uint64_decode_footprint( ctx );
7830 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7831 0 : return FD_BINCODE_SUCCESS;
7832 0 : }
7833 0 : case 4: {
7834 0 : err = fd_bincode_uint32_decode_footprint( ctx );
7835 0 : if( FD_UNLIKELY( err ) ) return err;
7836 0 : return FD_BINCODE_SUCCESS;
7837 0 : }
7838 0 : default: return FD_BINCODE_ERR_ENCODING;
7839 15 : }
7840 15 : }
7841 15 : static int fd_compute_budget_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7842 15 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7843 15 : ushort discriminant = 0;
7844 15 : int err = fd_bincode_compact_u16_decode( &discriminant, ctx );
7845 15 : if( FD_UNLIKELY( err ) ) return err;
7846 15 : return fd_compute_budget_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
7847 15 : }
7848 15 : int fd_compute_budget_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7849 15 : *total_sz += sizeof(fd_compute_budget_program_instruction_t);
7850 15 : void const * start_data = ctx->data;
7851 15 : int err = fd_compute_budget_program_instruction_decode_footprint_inner( ctx, total_sz );
7852 15 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7853 15 : ctx->data = start_data;
7854 15 : return err;
7855 15 : }
7856 15 : 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 ) {
7857 15 : switch (discriminant) {
7858 0 : case 0: {
7859 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( &self->request_units_deprecated, alloc_mem, ctx );
7860 0 : break;
7861 0 : }
7862 0 : case 1: {
7863 0 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
7864 0 : break;
7865 0 : }
7866 15 : case 2: {
7867 15 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
7868 15 : break;
7869 0 : }
7870 0 : case 3: {
7871 0 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
7872 0 : break;
7873 0 : }
7874 0 : case 4: {
7875 0 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
7876 0 : break;
7877 0 : }
7878 15 : }
7879 15 : }
7880 15 : static void fd_compute_budget_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7881 15 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)struct_mem;
7882 15 : ushort tmp = 0;
7883 15 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
7884 15 : self->discriminant = tmp;
7885 15 : fd_compute_budget_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7886 15 : }
7887 15 : void * fd_compute_budget_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7888 15 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)mem;
7889 15 : fd_compute_budget_program_instruction_new( self );
7890 15 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_t);
7891 15 : void * * alloc_mem = &alloc_region;
7892 15 : fd_compute_budget_program_instruction_decode_inner( mem, alloc_mem, ctx );
7893 15 : return self;
7894 15 : }
7895 15 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
7896 15 : switch( discriminant ) {
7897 0 : case 0: {
7898 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( &self->request_units_deprecated );
7899 0 : break;
7900 0 : }
7901 0 : case 1: {
7902 0 : break;
7903 0 : }
7904 0 : case 2: {
7905 0 : break;
7906 0 : }
7907 0 : case 3: {
7908 0 : break;
7909 0 : }
7910 0 : case 4: {
7911 0 : break;
7912 0 : }
7913 15 : default: break; // FD_LOG_ERR(( "unhandled type"));
7914 15 : }
7915 15 : }
7916 15 : void fd_compute_budget_program_instruction_new_disc( fd_compute_budget_program_instruction_t * self, uint discriminant ) {
7917 15 : self->discriminant = discriminant;
7918 15 : fd_compute_budget_program_instruction_inner_new( &self->inner, self->discriminant );
7919 15 : }
7920 15 : void fd_compute_budget_program_instruction_new( fd_compute_budget_program_instruction_t * self ) {
7921 15 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_t) );
7922 15 : fd_compute_budget_program_instruction_new_disc( self, UINT_MAX );
7923 15 : }
7924 :
7925 0 : ulong fd_compute_budget_program_instruction_size( fd_compute_budget_program_instruction_t const * self ) {
7926 0 : ulong size = 0;
7927 0 : size += sizeof(uint);
7928 0 : switch (self->discriminant) {
7929 0 : case 0: {
7930 0 : size += fd_compute_budget_program_instruction_request_units_deprecated_size( &self->inner.request_units_deprecated );
7931 0 : break;
7932 0 : }
7933 0 : case 1: {
7934 0 : size += sizeof(uint);
7935 0 : break;
7936 0 : }
7937 0 : case 2: {
7938 0 : size += sizeof(uint);
7939 0 : break;
7940 0 : }
7941 0 : case 3: {
7942 0 : size += sizeof(ulong);
7943 0 : break;
7944 0 : }
7945 0 : case 4: {
7946 0 : size += sizeof(uint);
7947 0 : break;
7948 0 : }
7949 0 : }
7950 0 : return size;
7951 0 : }
7952 :
7953 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 ) {
7954 0 : int err;
7955 0 : switch (discriminant) {
7956 0 : case 0: {
7957 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_encode( &self->request_units_deprecated, ctx );
7958 0 : if( FD_UNLIKELY( err ) ) return err;
7959 0 : break;
7960 0 : }
7961 0 : case 1: {
7962 0 : err = fd_bincode_uint32_encode( self->request_heap_frame, ctx );
7963 0 : if( FD_UNLIKELY( err ) ) return err;
7964 0 : break;
7965 0 : }
7966 0 : case 2: {
7967 0 : err = fd_bincode_uint32_encode( self->set_compute_unit_limit, ctx );
7968 0 : if( FD_UNLIKELY( err ) ) return err;
7969 0 : break;
7970 0 : }
7971 0 : case 3: {
7972 0 : err = fd_bincode_uint64_encode( self->set_compute_unit_price, ctx );
7973 0 : if( FD_UNLIKELY( err ) ) return err;
7974 0 : break;
7975 0 : }
7976 0 : case 4: {
7977 0 : err = fd_bincode_uint32_encode( self->set_loaded_accounts_data_size_limit, ctx );
7978 0 : if( FD_UNLIKELY( err ) ) return err;
7979 0 : break;
7980 0 : }
7981 0 : }
7982 0 : return FD_BINCODE_SUCCESS;
7983 0 : }
7984 0 : int fd_compute_budget_program_instruction_encode( fd_compute_budget_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7985 0 : ushort discriminant = (ushort) self->discriminant;
7986 0 : int err = fd_bincode_compact_u16_encode( &discriminant, ctx );
7987 0 : if( FD_UNLIKELY( err ) ) return err;
7988 0 : return fd_compute_budget_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7989 0 : }
7990 :
7991 0 : int fd_config_keys_encode( fd_config_keys_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7992 0 : int err;
7993 0 : err = fd_bincode_compact_u16_encode( &self->keys_len, ctx );
7994 0 : if( FD_UNLIKELY(err) ) return err;
7995 0 : if( self->keys_len ) {
7996 0 : for( ulong i=0; i < self->keys_len; i++ ) {
7997 0 : err = fd_config_keys_pair_encode( self->keys + i, ctx );
7998 0 : if( FD_UNLIKELY( err ) ) return err;
7999 0 : }
8000 0 : }
8001 0 : return FD_BINCODE_SUCCESS;
8002 0 : }
8003 0 : static int fd_config_keys_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8004 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8005 0 : int err = 0;
8006 0 : ushort keys_len;
8007 0 : err = fd_bincode_compact_u16_decode( &keys_len, ctx );
8008 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8009 0 : if( keys_len ) {
8010 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*keys_len;
8011 0 : for( ulong i=0; i < keys_len; i++ ) {
8012 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
8013 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8014 0 : }
8015 0 : }
8016 0 : return 0;
8017 0 : }
8018 0 : int fd_config_keys_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8019 0 : *total_sz += sizeof(fd_config_keys_t);
8020 0 : void const * start_data = ctx->data;
8021 0 : int err = fd_config_keys_decode_footprint_inner( ctx, total_sz );
8022 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8023 0 : ctx->data = start_data;
8024 0 : return err;
8025 0 : }
8026 0 : static void fd_config_keys_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8027 0 : fd_config_keys_t * self = (fd_config_keys_t *)struct_mem;
8028 0 : fd_bincode_compact_u16_decode_unsafe( &self->keys_len, ctx );
8029 0 : if( self->keys_len ) {
8030 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
8031 0 : self->keys = *alloc_mem;
8032 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->keys_len;
8033 0 : for( ulong i=0; i < self->keys_len; i++ ) {
8034 0 : fd_config_keys_pair_new( self->keys + i );
8035 0 : fd_config_keys_pair_decode_inner( self->keys + i, alloc_mem, ctx );
8036 0 : }
8037 0 : } else
8038 0 : self->keys = NULL;
8039 0 : }
8040 0 : void * fd_config_keys_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8041 0 : fd_config_keys_t * self = (fd_config_keys_t *)mem;
8042 0 : fd_config_keys_new( self );
8043 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_t);
8044 0 : void * * alloc_mem = &alloc_region;
8045 0 : fd_config_keys_decode_inner( mem, alloc_mem, ctx );
8046 0 : return self;
8047 0 : }
8048 0 : void fd_config_keys_new(fd_config_keys_t * self) {
8049 0 : fd_memset( self, 0, sizeof(fd_config_keys_t) );
8050 0 : }
8051 0 : ulong fd_config_keys_size( fd_config_keys_t const * self ) {
8052 0 : ulong size = 0;
8053 0 : do {
8054 0 : ushort tmp = (ushort)self->keys_len;
8055 0 : size += fd_bincode_compact_u16_size( &tmp );
8056 0 : for( ulong i=0; i < self->keys_len; i++ )
8057 0 : size += fd_config_keys_pair_size( self->keys + i );
8058 0 : } while(0);
8059 0 : return size;
8060 0 : }
8061 :
8062 0 : int fd_bpf_loader_program_instruction_write_encode( fd_bpf_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8063 0 : int err;
8064 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
8065 0 : if( FD_UNLIKELY( err ) ) return err;
8066 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
8067 0 : if( FD_UNLIKELY(err) ) return err;
8068 0 : if( self->bytes_len ) {
8069 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
8070 0 : if( FD_UNLIKELY( err ) ) return err;
8071 0 : }
8072 0 : return FD_BINCODE_SUCCESS;
8073 0 : }
8074 0 : static int fd_bpf_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8075 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8076 0 : int err = 0;
8077 0 : err = fd_bincode_uint32_decode_footprint( ctx );
8078 0 : if( FD_UNLIKELY( err ) ) return err;
8079 0 : ulong bytes_len;
8080 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
8081 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8082 0 : if( bytes_len ) {
8083 0 : *total_sz += 8UL + bytes_len;
8084 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
8085 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8086 0 : }
8087 0 : return 0;
8088 0 : }
8089 0 : int fd_bpf_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8090 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_write_t);
8091 0 : void const * start_data = ctx->data;
8092 0 : int err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8093 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8094 0 : ctx->data = start_data;
8095 0 : return err;
8096 0 : }
8097 0 : static void fd_bpf_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8098 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)struct_mem;
8099 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
8100 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
8101 0 : if( self->bytes_len ) {
8102 0 : self->bytes = *alloc_mem;
8103 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
8104 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
8105 0 : } else
8106 0 : self->bytes = NULL;
8107 0 : }
8108 0 : void * fd_bpf_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8109 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)mem;
8110 0 : fd_bpf_loader_program_instruction_write_new( self );
8111 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_write_t);
8112 0 : void * * alloc_mem = &alloc_region;
8113 0 : fd_bpf_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
8114 0 : return self;
8115 0 : }
8116 0 : void fd_bpf_loader_program_instruction_write_new(fd_bpf_loader_program_instruction_write_t * self) {
8117 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_write_t) );
8118 0 : }
8119 0 : ulong fd_bpf_loader_program_instruction_write_size( fd_bpf_loader_program_instruction_write_t const * self ) {
8120 0 : ulong size = 0;
8121 0 : size += sizeof(uint);
8122 0 : do {
8123 0 : size += sizeof(ulong);
8124 0 : size += self->bytes_len;
8125 0 : } while(0);
8126 0 : return size;
8127 0 : }
8128 :
8129 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_write(fd_bpf_loader_program_instruction_t const * self) {
8130 0 : return self->discriminant == 0;
8131 0 : }
8132 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_finalize(fd_bpf_loader_program_instruction_t const * self) {
8133 0 : return self->discriminant == 1;
8134 0 : }
8135 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant );
8136 0 : int fd_bpf_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8137 0 : int err;
8138 0 : switch (discriminant) {
8139 0 : case 0: {
8140 0 : err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8141 0 : if( FD_UNLIKELY( err ) ) return err;
8142 0 : return FD_BINCODE_SUCCESS;
8143 0 : }
8144 0 : case 1: {
8145 0 : return FD_BINCODE_SUCCESS;
8146 0 : }
8147 0 : default: return FD_BINCODE_ERR_ENCODING;
8148 0 : }
8149 0 : }
8150 0 : static int fd_bpf_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8151 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8152 0 : uint discriminant = 0;
8153 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8154 0 : if( FD_UNLIKELY( err ) ) return err;
8155 0 : return fd_bpf_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
8156 0 : }
8157 0 : int fd_bpf_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8158 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_t);
8159 0 : void const * start_data = ctx->data;
8160 0 : int err = fd_bpf_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
8161 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8162 0 : ctx->data = start_data;
8163 0 : return err;
8164 0 : }
8165 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 ) {
8166 0 : switch (discriminant) {
8167 0 : case 0: {
8168 0 : fd_bpf_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
8169 0 : break;
8170 0 : }
8171 0 : case 1: {
8172 0 : break;
8173 0 : }
8174 0 : }
8175 0 : }
8176 0 : static void fd_bpf_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8177 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)struct_mem;
8178 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8179 0 : fd_bpf_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8180 0 : }
8181 0 : void * fd_bpf_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8182 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)mem;
8183 0 : fd_bpf_loader_program_instruction_new( self );
8184 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_t);
8185 0 : void * * alloc_mem = &alloc_region;
8186 0 : fd_bpf_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
8187 0 : return self;
8188 0 : }
8189 0 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
8190 0 : switch( discriminant ) {
8191 0 : case 0: {
8192 0 : fd_bpf_loader_program_instruction_write_new( &self->write );
8193 0 : break;
8194 0 : }
8195 0 : case 1: {
8196 0 : break;
8197 0 : }
8198 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8199 0 : }
8200 0 : }
8201 0 : void fd_bpf_loader_program_instruction_new_disc( fd_bpf_loader_program_instruction_t * self, uint discriminant ) {
8202 0 : self->discriminant = discriminant;
8203 0 : fd_bpf_loader_program_instruction_inner_new( &self->inner, self->discriminant );
8204 0 : }
8205 0 : void fd_bpf_loader_program_instruction_new( fd_bpf_loader_program_instruction_t * self ) {
8206 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_t) );
8207 0 : fd_bpf_loader_program_instruction_new_disc( self, UINT_MAX );
8208 0 : }
8209 :
8210 0 : ulong fd_bpf_loader_program_instruction_size( fd_bpf_loader_program_instruction_t const * self ) {
8211 0 : ulong size = 0;
8212 0 : size += sizeof(uint);
8213 0 : switch (self->discriminant) {
8214 0 : case 0: {
8215 0 : size += fd_bpf_loader_program_instruction_write_size( &self->inner.write );
8216 0 : break;
8217 0 : }
8218 0 : }
8219 0 : return size;
8220 0 : }
8221 :
8222 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 ) {
8223 0 : int err;
8224 0 : switch (discriminant) {
8225 0 : case 0: {
8226 0 : err = fd_bpf_loader_program_instruction_write_encode( &self->write, ctx );
8227 0 : if( FD_UNLIKELY( err ) ) return err;
8228 0 : break;
8229 0 : }
8230 0 : }
8231 0 : return FD_BINCODE_SUCCESS;
8232 0 : }
8233 0 : int fd_bpf_loader_program_instruction_encode( fd_bpf_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8234 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8235 0 : if( FD_UNLIKELY( err ) ) return err;
8236 0 : return fd_bpf_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
8237 0 : }
8238 :
8239 0 : int fd_loader_v4_program_instruction_write_encode( fd_loader_v4_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8240 0 : int err;
8241 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
8242 0 : if( FD_UNLIKELY( err ) ) return err;
8243 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
8244 0 : if( FD_UNLIKELY(err) ) return err;
8245 0 : if( self->bytes_len ) {
8246 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
8247 0 : if( FD_UNLIKELY( err ) ) return err;
8248 0 : }
8249 0 : return FD_BINCODE_SUCCESS;
8250 0 : }
8251 0 : static int fd_loader_v4_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8252 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8253 0 : int err = 0;
8254 0 : err = fd_bincode_uint32_decode_footprint( ctx );
8255 0 : if( FD_UNLIKELY( err ) ) return err;
8256 0 : ulong bytes_len;
8257 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
8258 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8259 0 : if( bytes_len ) {
8260 0 : *total_sz += 8UL + bytes_len;
8261 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
8262 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8263 0 : }
8264 0 : return 0;
8265 0 : }
8266 0 : int fd_loader_v4_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8267 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_write_t);
8268 0 : void const * start_data = ctx->data;
8269 0 : int err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8270 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8271 0 : ctx->data = start_data;
8272 0 : return err;
8273 0 : }
8274 0 : static void fd_loader_v4_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8275 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)struct_mem;
8276 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
8277 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
8278 0 : if( self->bytes_len ) {
8279 0 : self->bytes = *alloc_mem;
8280 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
8281 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
8282 0 : } else
8283 0 : self->bytes = NULL;
8284 0 : }
8285 0 : void * fd_loader_v4_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8286 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)mem;
8287 0 : fd_loader_v4_program_instruction_write_new( self );
8288 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_write_t);
8289 0 : void * * alloc_mem = &alloc_region;
8290 0 : fd_loader_v4_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
8291 0 : return self;
8292 0 : }
8293 0 : void fd_loader_v4_program_instruction_write_new(fd_loader_v4_program_instruction_write_t * self) {
8294 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_write_t) );
8295 0 : }
8296 0 : ulong fd_loader_v4_program_instruction_write_size( fd_loader_v4_program_instruction_write_t const * self ) {
8297 0 : ulong size = 0;
8298 0 : size += sizeof(uint);
8299 0 : do {
8300 0 : size += sizeof(ulong);
8301 0 : size += self->bytes_len;
8302 0 : } while(0);
8303 0 : return size;
8304 0 : }
8305 :
8306 0 : int fd_loader_v4_program_instruction_copy_encode( fd_loader_v4_program_instruction_copy_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8307 0 : int err;
8308 0 : err = fd_bincode_uint32_encode( self->destination_offset, ctx );
8309 0 : if( FD_UNLIKELY( err ) ) return err;
8310 0 : err = fd_bincode_uint32_encode( self->source_offset, ctx );
8311 0 : if( FD_UNLIKELY( err ) ) return err;
8312 0 : err = fd_bincode_uint32_encode( self->length, ctx );
8313 0 : if( FD_UNLIKELY( err ) ) return err;
8314 0 : return FD_BINCODE_SUCCESS;
8315 0 : }
8316 0 : static inline int fd_loader_v4_program_instruction_copy_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8317 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8318 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
8319 0 : return 0;
8320 0 : }
8321 0 : static void fd_loader_v4_program_instruction_copy_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8322 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)struct_mem;
8323 0 : fd_bincode_uint32_decode_unsafe( &self->destination_offset, ctx );
8324 0 : fd_bincode_uint32_decode_unsafe( &self->source_offset, ctx );
8325 0 : fd_bincode_uint32_decode_unsafe( &self->length, ctx );
8326 0 : }
8327 0 : void * fd_loader_v4_program_instruction_copy_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8328 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)mem;
8329 0 : fd_loader_v4_program_instruction_copy_new( self );
8330 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_copy_t);
8331 0 : void * * alloc_mem = &alloc_region;
8332 0 : fd_loader_v4_program_instruction_copy_decode_inner( mem, alloc_mem, ctx );
8333 0 : return self;
8334 0 : }
8335 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 ) {
8336 0 : int err;
8337 0 : err = fd_bincode_uint32_encode( self->new_size, ctx );
8338 0 : if( FD_UNLIKELY( err ) ) return err;
8339 0 : return FD_BINCODE_SUCCESS;
8340 0 : }
8341 6 : static inline int fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8342 6 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8343 6 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
8344 6 : return 0;
8345 6 : }
8346 6 : static void fd_loader_v4_program_instruction_set_program_length_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8347 6 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)struct_mem;
8348 6 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
8349 6 : }
8350 0 : void * fd_loader_v4_program_instruction_set_program_length_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8351 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)mem;
8352 0 : fd_loader_v4_program_instruction_set_program_length_new( self );
8353 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_set_program_length_t);
8354 0 : void * * alloc_mem = &alloc_region;
8355 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( mem, alloc_mem, ctx );
8356 0 : return self;
8357 0 : }
8358 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_write(fd_loader_v4_program_instruction_t const * self) {
8359 0 : return self->discriminant == 0;
8360 0 : }
8361 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_copy(fd_loader_v4_program_instruction_t const * self) {
8362 0 : return self->discriminant == 1;
8363 0 : }
8364 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_set_program_length(fd_loader_v4_program_instruction_t const * self) {
8365 0 : return self->discriminant == 2;
8366 0 : }
8367 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_deploy(fd_loader_v4_program_instruction_t const * self) {
8368 0 : return self->discriminant == 3;
8369 0 : }
8370 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_retract(fd_loader_v4_program_instruction_t const * self) {
8371 0 : return self->discriminant == 4;
8372 0 : }
8373 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_transfer_authority(fd_loader_v4_program_instruction_t const * self) {
8374 0 : return self->discriminant == 5;
8375 0 : }
8376 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_finalize(fd_loader_v4_program_instruction_t const * self) {
8377 0 : return self->discriminant == 6;
8378 0 : }
8379 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant );
8380 6 : int fd_loader_v4_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8381 6 : int err;
8382 6 : switch (discriminant) {
8383 0 : case 0: {
8384 0 : err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8385 0 : if( FD_UNLIKELY( err ) ) return err;
8386 0 : return FD_BINCODE_SUCCESS;
8387 0 : }
8388 0 : case 1: {
8389 0 : err = fd_loader_v4_program_instruction_copy_decode_footprint_inner( ctx, total_sz );
8390 0 : if( FD_UNLIKELY( err ) ) return err;
8391 0 : return FD_BINCODE_SUCCESS;
8392 0 : }
8393 6 : case 2: {
8394 6 : err = fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( ctx, total_sz );
8395 6 : if( FD_UNLIKELY( err ) ) return err;
8396 6 : return FD_BINCODE_SUCCESS;
8397 6 : }
8398 0 : case 3: {
8399 0 : return FD_BINCODE_SUCCESS;
8400 6 : }
8401 0 : case 4: {
8402 0 : return FD_BINCODE_SUCCESS;
8403 6 : }
8404 0 : case 5: {
8405 0 : return FD_BINCODE_SUCCESS;
8406 6 : }
8407 0 : case 6: {
8408 0 : return FD_BINCODE_SUCCESS;
8409 6 : }
8410 0 : default: return FD_BINCODE_ERR_ENCODING;
8411 6 : }
8412 6 : }
8413 6 : static int fd_loader_v4_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8414 6 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8415 6 : uint discriminant = 0;
8416 6 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8417 6 : if( FD_UNLIKELY( err ) ) return err;
8418 6 : return fd_loader_v4_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
8419 6 : }
8420 6 : int fd_loader_v4_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8421 6 : *total_sz += sizeof(fd_loader_v4_program_instruction_t);
8422 6 : void const * start_data = ctx->data;
8423 6 : int err = fd_loader_v4_program_instruction_decode_footprint_inner( ctx, total_sz );
8424 6 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8425 6 : ctx->data = start_data;
8426 6 : return err;
8427 6 : }
8428 6 : 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 ) {
8429 6 : switch (discriminant) {
8430 0 : case 0: {
8431 0 : fd_loader_v4_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
8432 0 : break;
8433 0 : }
8434 0 : case 1: {
8435 0 : fd_loader_v4_program_instruction_copy_decode_inner( &self->copy, alloc_mem, ctx );
8436 0 : break;
8437 0 : }
8438 6 : case 2: {
8439 6 : fd_loader_v4_program_instruction_set_program_length_decode_inner( &self->set_program_length, alloc_mem, ctx );
8440 6 : break;
8441 0 : }
8442 0 : case 3: {
8443 0 : break;
8444 0 : }
8445 0 : case 4: {
8446 0 : break;
8447 0 : }
8448 0 : case 5: {
8449 0 : break;
8450 0 : }
8451 0 : case 6: {
8452 0 : break;
8453 0 : }
8454 6 : }
8455 6 : }
8456 6 : static void fd_loader_v4_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8457 6 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)struct_mem;
8458 6 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8459 6 : fd_loader_v4_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8460 6 : }
8461 6 : void * fd_loader_v4_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8462 6 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)mem;
8463 6 : fd_loader_v4_program_instruction_new( self );
8464 6 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_t);
8465 6 : void * * alloc_mem = &alloc_region;
8466 6 : fd_loader_v4_program_instruction_decode_inner( mem, alloc_mem, ctx );
8467 6 : return self;
8468 6 : }
8469 6 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
8470 6 : switch( discriminant ) {
8471 0 : case 0: {
8472 0 : fd_loader_v4_program_instruction_write_new( &self->write );
8473 0 : break;
8474 0 : }
8475 0 : case 1: {
8476 0 : fd_loader_v4_program_instruction_copy_new( &self->copy );
8477 0 : break;
8478 0 : }
8479 0 : case 2: {
8480 0 : fd_loader_v4_program_instruction_set_program_length_new( &self->set_program_length );
8481 0 : break;
8482 0 : }
8483 0 : case 3: {
8484 0 : break;
8485 0 : }
8486 0 : case 4: {
8487 0 : break;
8488 0 : }
8489 0 : case 5: {
8490 0 : break;
8491 0 : }
8492 0 : case 6: {
8493 0 : break;
8494 0 : }
8495 6 : default: break; // FD_LOG_ERR(( "unhandled type"));
8496 6 : }
8497 6 : }
8498 6 : void fd_loader_v4_program_instruction_new_disc( fd_loader_v4_program_instruction_t * self, uint discriminant ) {
8499 6 : self->discriminant = discriminant;
8500 6 : fd_loader_v4_program_instruction_inner_new( &self->inner, self->discriminant );
8501 6 : }
8502 6 : void fd_loader_v4_program_instruction_new( fd_loader_v4_program_instruction_t * self ) {
8503 6 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_t) );
8504 6 : fd_loader_v4_program_instruction_new_disc( self, UINT_MAX );
8505 6 : }
8506 :
8507 0 : ulong fd_loader_v4_program_instruction_size( fd_loader_v4_program_instruction_t const * self ) {
8508 0 : ulong size = 0;
8509 0 : size += sizeof(uint);
8510 0 : switch (self->discriminant) {
8511 0 : case 0: {
8512 0 : size += fd_loader_v4_program_instruction_write_size( &self->inner.write );
8513 0 : break;
8514 0 : }
8515 0 : case 1: {
8516 0 : size += fd_loader_v4_program_instruction_copy_size( &self->inner.copy );
8517 0 : break;
8518 0 : }
8519 0 : case 2: {
8520 0 : size += fd_loader_v4_program_instruction_set_program_length_size( &self->inner.set_program_length );
8521 0 : break;
8522 0 : }
8523 0 : }
8524 0 : return size;
8525 0 : }
8526 :
8527 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 ) {
8528 0 : int err;
8529 0 : switch (discriminant) {
8530 0 : case 0: {
8531 0 : err = fd_loader_v4_program_instruction_write_encode( &self->write, ctx );
8532 0 : if( FD_UNLIKELY( err ) ) return err;
8533 0 : break;
8534 0 : }
8535 0 : case 1: {
8536 0 : err = fd_loader_v4_program_instruction_copy_encode( &self->copy, ctx );
8537 0 : if( FD_UNLIKELY( err ) ) return err;
8538 0 : break;
8539 0 : }
8540 0 : case 2: {
8541 0 : err = fd_loader_v4_program_instruction_set_program_length_encode( &self->set_program_length, ctx );
8542 0 : if( FD_UNLIKELY( err ) ) return err;
8543 0 : break;
8544 0 : }
8545 0 : }
8546 0 : return FD_BINCODE_SUCCESS;
8547 0 : }
8548 0 : int fd_loader_v4_program_instruction_encode( fd_loader_v4_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8549 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8550 0 : if( FD_UNLIKELY( err ) ) return err;
8551 0 : return fd_loader_v4_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
8552 0 : }
8553 :
8554 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 ) {
8555 0 : int err;
8556 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
8557 0 : if( FD_UNLIKELY( err ) ) return err;
8558 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
8559 0 : if( FD_UNLIKELY(err) ) return err;
8560 0 : if( self->bytes_len ) {
8561 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
8562 0 : if( FD_UNLIKELY( err ) ) return err;
8563 0 : }
8564 0 : return FD_BINCODE_SUCCESS;
8565 0 : }
8566 0 : static int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8567 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8568 0 : int err = 0;
8569 0 : err = fd_bincode_uint32_decode_footprint( ctx );
8570 0 : if( FD_UNLIKELY( err ) ) return err;
8571 0 : ulong bytes_len;
8572 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
8573 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8574 0 : if( bytes_len ) {
8575 0 : *total_sz += 8UL + bytes_len;
8576 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
8577 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8578 0 : }
8579 0 : return 0;
8580 0 : }
8581 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8582 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
8583 0 : void const * start_data = ctx->data;
8584 0 : int err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8585 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8586 0 : ctx->data = start_data;
8587 0 : return err;
8588 0 : }
8589 0 : static void fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8590 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)struct_mem;
8591 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
8592 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
8593 0 : if( self->bytes_len ) {
8594 0 : self->bytes = *alloc_mem;
8595 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
8596 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
8597 0 : } else
8598 0 : self->bytes = NULL;
8599 0 : }
8600 0 : void * fd_bpf_upgradeable_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8601 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)mem;
8602 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( self );
8603 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
8604 0 : void * * alloc_mem = &alloc_region;
8605 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
8606 0 : return self;
8607 0 : }
8608 0 : void fd_bpf_upgradeable_loader_program_instruction_write_new(fd_bpf_upgradeable_loader_program_instruction_write_t * self) {
8609 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t) );
8610 0 : }
8611 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_size( fd_bpf_upgradeable_loader_program_instruction_write_t const * self ) {
8612 0 : ulong size = 0;
8613 0 : size += sizeof(uint);
8614 0 : do {
8615 0 : size += sizeof(ulong);
8616 0 : size += self->bytes_len;
8617 0 : } while(0);
8618 0 : return size;
8619 0 : }
8620 :
8621 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 ) {
8622 0 : int err;
8623 0 : err = fd_bincode_uint64_encode( self->max_data_len, ctx );
8624 0 : if( FD_UNLIKELY( err ) ) return err;
8625 0 : return FD_BINCODE_SUCCESS;
8626 0 : }
8627 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 ) {
8628 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8629 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
8630 0 : return 0;
8631 0 : }
8632 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 ) {
8633 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;
8634 0 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
8635 0 : }
8636 0 : void * fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8637 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;
8638 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( self );
8639 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t);
8640 0 : void * * alloc_mem = &alloc_region;
8641 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( mem, alloc_mem, ctx );
8642 0 : return self;
8643 0 : }
8644 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 ) {
8645 0 : int err;
8646 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
8647 0 : if( FD_UNLIKELY( err ) ) return err;
8648 0 : return FD_BINCODE_SUCCESS;
8649 0 : }
8650 0 : static inline int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8651 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8652 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
8653 0 : return 0;
8654 0 : }
8655 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 ) {
8656 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)struct_mem;
8657 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
8658 0 : }
8659 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8660 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)mem;
8661 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( self );
8662 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t);
8663 0 : void * * alloc_mem = &alloc_region;
8664 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( mem, alloc_mem, ctx );
8665 0 : return self;
8666 0 : }
8667 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 ) {
8668 0 : int err;
8669 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
8670 0 : if( FD_UNLIKELY( err ) ) return err;
8671 0 : return FD_BINCODE_SUCCESS;
8672 0 : }
8673 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 ) {
8674 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8675 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
8676 0 : return 0;
8677 0 : }
8678 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 ) {
8679 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)struct_mem;
8680 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
8681 0 : }
8682 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8683 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)mem;
8684 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( self );
8685 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t);
8686 0 : void * * alloc_mem = &alloc_region;
8687 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( mem, alloc_mem, ctx );
8688 0 : return self;
8689 0 : }
8690 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_initialize_buffer(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8691 0 : return self->discriminant == 0;
8692 0 : }
8693 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_write(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8694 0 : return self->discriminant == 1;
8695 0 : }
8696 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) {
8697 0 : return self->discriminant == 2;
8698 0 : }
8699 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_upgrade(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8700 0 : return self->discriminant == 3;
8701 0 : }
8702 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8703 0 : return self->discriminant == 4;
8704 0 : }
8705 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_close(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8706 0 : return self->discriminant == 5;
8707 0 : }
8708 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8709 0 : return self->discriminant == 6;
8710 0 : }
8711 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8712 0 : return self->discriminant == 7;
8713 0 : }
8714 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_migrate(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8715 0 : return self->discriminant == 8;
8716 0 : }
8717 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
8718 0 : return self->discriminant == 9;
8719 0 : }
8720 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant );
8721 0 : int fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8722 0 : int err;
8723 0 : switch (discriminant) {
8724 0 : case 0: {
8725 0 : return FD_BINCODE_SUCCESS;
8726 0 : }
8727 0 : case 1: {
8728 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
8729 0 : if( FD_UNLIKELY( err ) ) return err;
8730 0 : return FD_BINCODE_SUCCESS;
8731 0 : }
8732 0 : case 2: {
8733 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( ctx, total_sz );
8734 0 : if( FD_UNLIKELY( err ) ) return err;
8735 0 : return FD_BINCODE_SUCCESS;
8736 0 : }
8737 0 : case 3: {
8738 0 : return FD_BINCODE_SUCCESS;
8739 0 : }
8740 0 : case 4: {
8741 0 : return FD_BINCODE_SUCCESS;
8742 0 : }
8743 0 : case 5: {
8744 0 : return FD_BINCODE_SUCCESS;
8745 0 : }
8746 0 : case 6: {
8747 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( ctx, total_sz );
8748 0 : if( FD_UNLIKELY( err ) ) return err;
8749 0 : return FD_BINCODE_SUCCESS;
8750 0 : }
8751 0 : case 7: {
8752 0 : return FD_BINCODE_SUCCESS;
8753 0 : }
8754 0 : case 8: {
8755 0 : return FD_BINCODE_SUCCESS;
8756 0 : }
8757 0 : case 9: {
8758 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_footprint_inner( ctx, total_sz );
8759 0 : if( FD_UNLIKELY( err ) ) return err;
8760 0 : return FD_BINCODE_SUCCESS;
8761 0 : }
8762 0 : default: return FD_BINCODE_ERR_ENCODING;
8763 0 : }
8764 0 : }
8765 0 : static int fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8766 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8767 0 : uint discriminant = 0;
8768 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8769 0 : if( FD_UNLIKELY( err ) ) return err;
8770 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
8771 0 : }
8772 0 : int fd_bpf_upgradeable_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8773 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
8774 0 : void const * start_data = ctx->data;
8775 0 : int err = fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
8776 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8777 0 : ctx->data = start_data;
8778 0 : return err;
8779 0 : }
8780 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 ) {
8781 0 : switch (discriminant) {
8782 0 : case 0: {
8783 0 : break;
8784 0 : }
8785 0 : case 1: {
8786 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
8787 0 : break;
8788 0 : }
8789 0 : case 2: {
8790 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( &self->deploy_with_max_data_len, alloc_mem, ctx );
8791 0 : break;
8792 0 : }
8793 0 : case 3: {
8794 0 : break;
8795 0 : }
8796 0 : case 4: {
8797 0 : break;
8798 0 : }
8799 0 : case 5: {
8800 0 : break;
8801 0 : }
8802 0 : case 6: {
8803 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( &self->extend_program, alloc_mem, ctx );
8804 0 : break;
8805 0 : }
8806 0 : case 7: {
8807 0 : break;
8808 0 : }
8809 0 : case 8: {
8810 0 : break;
8811 0 : }
8812 0 : case 9: {
8813 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( &self->extend_program_checked, alloc_mem, ctx );
8814 0 : break;
8815 0 : }
8816 0 : }
8817 0 : }
8818 0 : static void fd_bpf_upgradeable_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8819 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)struct_mem;
8820 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8821 0 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8822 0 : }
8823 0 : void * fd_bpf_upgradeable_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8824 0 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)mem;
8825 0 : fd_bpf_upgradeable_loader_program_instruction_new( self );
8826 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
8827 0 : void * * alloc_mem = &alloc_region;
8828 0 : fd_bpf_upgradeable_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
8829 0 : return self;
8830 0 : }
8831 0 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
8832 0 : switch( discriminant ) {
8833 0 : case 0: {
8834 0 : break;
8835 0 : }
8836 0 : case 1: {
8837 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( &self->write );
8838 0 : break;
8839 0 : }
8840 0 : case 2: {
8841 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( &self->deploy_with_max_data_len );
8842 0 : break;
8843 0 : }
8844 0 : case 3: {
8845 0 : break;
8846 0 : }
8847 0 : case 4: {
8848 0 : break;
8849 0 : }
8850 0 : case 5: {
8851 0 : break;
8852 0 : }
8853 0 : case 6: {
8854 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( &self->extend_program );
8855 0 : break;
8856 0 : }
8857 0 : case 7: {
8858 0 : break;
8859 0 : }
8860 0 : case 8: {
8861 0 : break;
8862 0 : }
8863 0 : case 9: {
8864 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( &self->extend_program_checked );
8865 0 : break;
8866 0 : }
8867 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8868 0 : }
8869 0 : }
8870 0 : void fd_bpf_upgradeable_loader_program_instruction_new_disc( fd_bpf_upgradeable_loader_program_instruction_t * self, uint discriminant ) {
8871 0 : self->discriminant = discriminant;
8872 0 : fd_bpf_upgradeable_loader_program_instruction_inner_new( &self->inner, self->discriminant );
8873 0 : }
8874 0 : void fd_bpf_upgradeable_loader_program_instruction_new( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
8875 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_t) );
8876 0 : fd_bpf_upgradeable_loader_program_instruction_new_disc( self, UINT_MAX );
8877 0 : }
8878 :
8879 0 : ulong fd_bpf_upgradeable_loader_program_instruction_size( fd_bpf_upgradeable_loader_program_instruction_t const * self ) {
8880 0 : ulong size = 0;
8881 0 : size += sizeof(uint);
8882 0 : switch (self->discriminant) {
8883 0 : case 1: {
8884 0 : size += fd_bpf_upgradeable_loader_program_instruction_write_size( &self->inner.write );
8885 0 : break;
8886 0 : }
8887 0 : case 2: {
8888 0 : size += fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( &self->inner.deploy_with_max_data_len );
8889 0 : break;
8890 0 : }
8891 0 : case 6: {
8892 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_size( &self->inner.extend_program );
8893 0 : break;
8894 0 : }
8895 0 : case 9: {
8896 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_size( &self->inner.extend_program_checked );
8897 0 : break;
8898 0 : }
8899 0 : }
8900 0 : return size;
8901 0 : }
8902 :
8903 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 ) {
8904 0 : int err;
8905 0 : switch (discriminant) {
8906 0 : case 1: {
8907 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_encode( &self->write, ctx );
8908 0 : if( FD_UNLIKELY( err ) ) return err;
8909 0 : break;
8910 0 : }
8911 0 : case 2: {
8912 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( &self->deploy_with_max_data_len, ctx );
8913 0 : if( FD_UNLIKELY( err ) ) return err;
8914 0 : break;
8915 0 : }
8916 0 : case 6: {
8917 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( &self->extend_program, ctx );
8918 0 : if( FD_UNLIKELY( err ) ) return err;
8919 0 : break;
8920 0 : }
8921 0 : case 9: {
8922 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_encode( &self->extend_program_checked, ctx );
8923 0 : if( FD_UNLIKELY( err ) ) return err;
8924 0 : break;
8925 0 : }
8926 0 : }
8927 0 : return FD_BINCODE_SUCCESS;
8928 0 : }
8929 0 : int fd_bpf_upgradeable_loader_program_instruction_encode( fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8930 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8931 0 : if( FD_UNLIKELY( err ) ) return err;
8932 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
8933 0 : }
8934 :
8935 0 : int fd_bpf_upgradeable_loader_state_buffer_encode( fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8936 0 : int err;
8937 0 : err = fd_bincode_bool_encode( self->has_authority_address, ctx );
8938 0 : if( FD_UNLIKELY( err ) ) return err;
8939 0 : if( self->has_authority_address ) {
8940 0 : err = fd_pubkey_encode( &self->authority_address, ctx );
8941 0 : if( FD_UNLIKELY( err ) ) return err;
8942 0 : }
8943 0 : return FD_BINCODE_SUCCESS;
8944 0 : }
8945 0 : static int fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8946 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8947 0 : int err = 0;
8948 0 : {
8949 0 : uchar o;
8950 0 : err = fd_bincode_bool_decode( &o, ctx );
8951 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8952 0 : if( o ) {
8953 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8954 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8955 0 : }
8956 0 : }
8957 0 : return 0;
8958 0 : }
8959 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8960 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
8961 0 : void const * start_data = ctx->data;
8962 0 : int err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
8963 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8964 0 : ctx->data = start_data;
8965 0 : return err;
8966 0 : }
8967 0 : static void fd_bpf_upgradeable_loader_state_buffer_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8968 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)struct_mem;
8969 0 : {
8970 0 : uchar o;
8971 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
8972 0 : self->has_authority_address = !!o;
8973 0 : if( o ) {
8974 0 : fd_pubkey_new( &self->authority_address );
8975 0 : fd_pubkey_decode_inner( &self->authority_address, alloc_mem, ctx );
8976 0 : }
8977 0 : }
8978 0 : }
8979 0 : void * fd_bpf_upgradeable_loader_state_buffer_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8980 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)mem;
8981 0 : fd_bpf_upgradeable_loader_state_buffer_new( self );
8982 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
8983 0 : void * * alloc_mem = &alloc_region;
8984 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( mem, alloc_mem, ctx );
8985 0 : return self;
8986 0 : }
8987 0 : void fd_bpf_upgradeable_loader_state_buffer_new(fd_bpf_upgradeable_loader_state_buffer_t * self) {
8988 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_buffer_t) );
8989 0 : }
8990 0 : ulong fd_bpf_upgradeable_loader_state_buffer_size( fd_bpf_upgradeable_loader_state_buffer_t const * self ) {
8991 0 : ulong size = 0;
8992 0 : size += sizeof(char);
8993 0 : if( self->has_authority_address ) {
8994 0 : size += fd_pubkey_size( &self->authority_address );
8995 0 : }
8996 0 : return size;
8997 0 : }
8998 :
8999 0 : int fd_bpf_upgradeable_loader_state_program_encode( fd_bpf_upgradeable_loader_state_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9000 0 : int err;
9001 0 : err = fd_pubkey_encode( &self->programdata_address, ctx );
9002 0 : if( FD_UNLIKELY( err ) ) return err;
9003 0 : return FD_BINCODE_SUCCESS;
9004 0 : }
9005 0 : static inline int fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9006 0 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9007 0 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
9008 0 : return 0;
9009 0 : }
9010 0 : static void fd_bpf_upgradeable_loader_state_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9011 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)struct_mem;
9012 0 : fd_pubkey_decode_inner( &self->programdata_address, alloc_mem, ctx );
9013 0 : }
9014 0 : void * fd_bpf_upgradeable_loader_state_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9015 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)mem;
9016 0 : fd_bpf_upgradeable_loader_state_program_new( self );
9017 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_t);
9018 0 : void * * alloc_mem = &alloc_region;
9019 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( mem, alloc_mem, ctx );
9020 0 : return self;
9021 0 : }
9022 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 ) {
9023 0 : int err;
9024 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
9025 0 : if( FD_UNLIKELY( err ) ) return err;
9026 0 : err = fd_bincode_bool_encode( self->has_upgrade_authority_address, ctx );
9027 0 : if( FD_UNLIKELY( err ) ) return err;
9028 0 : if( self->has_upgrade_authority_address ) {
9029 0 : err = fd_pubkey_encode( &self->upgrade_authority_address, ctx );
9030 0 : if( FD_UNLIKELY( err ) ) return err;
9031 0 : }
9032 0 : return FD_BINCODE_SUCCESS;
9033 0 : }
9034 0 : static int fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9035 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9036 0 : int err = 0;
9037 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9038 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9039 0 : {
9040 0 : uchar o;
9041 0 : err = fd_bincode_bool_decode( &o, ctx );
9042 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9043 0 : if( o ) {
9044 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9045 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9046 0 : }
9047 0 : }
9048 0 : return 0;
9049 0 : }
9050 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9051 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
9052 0 : void const * start_data = ctx->data;
9053 0 : int err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
9054 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9055 0 : ctx->data = start_data;
9056 0 : return err;
9057 0 : }
9058 0 : static void fd_bpf_upgradeable_loader_state_program_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9059 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)struct_mem;
9060 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
9061 0 : {
9062 0 : uchar o;
9063 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9064 0 : self->has_upgrade_authority_address = !!o;
9065 0 : if( o ) {
9066 0 : fd_pubkey_new( &self->upgrade_authority_address );
9067 0 : fd_pubkey_decode_inner( &self->upgrade_authority_address, alloc_mem, ctx );
9068 0 : }
9069 0 : }
9070 0 : }
9071 0 : void * fd_bpf_upgradeable_loader_state_program_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9072 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)mem;
9073 0 : fd_bpf_upgradeable_loader_state_program_data_new( self );
9074 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
9075 0 : void * * alloc_mem = &alloc_region;
9076 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( mem, alloc_mem, ctx );
9077 0 : return self;
9078 0 : }
9079 0 : void fd_bpf_upgradeable_loader_state_program_data_new(fd_bpf_upgradeable_loader_state_program_data_t * self) {
9080 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_data_t) );
9081 0 : }
9082 0 : ulong fd_bpf_upgradeable_loader_state_program_data_size( fd_bpf_upgradeable_loader_state_program_data_t const * self ) {
9083 0 : ulong size = 0;
9084 0 : size += sizeof(ulong);
9085 0 : size += sizeof(char);
9086 0 : if( self->has_upgrade_authority_address ) {
9087 0 : size += fd_pubkey_size( &self->upgrade_authority_address );
9088 0 : }
9089 0 : return size;
9090 0 : }
9091 :
9092 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_uninitialized(fd_bpf_upgradeable_loader_state_t const * self) {
9093 0 : return self->discriminant == 0;
9094 0 : }
9095 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_buffer(fd_bpf_upgradeable_loader_state_t const * self) {
9096 0 : return self->discriminant == 1;
9097 0 : }
9098 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program(fd_bpf_upgradeable_loader_state_t const * self) {
9099 0 : return self->discriminant == 2;
9100 0 : }
9101 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program_data(fd_bpf_upgradeable_loader_state_t const * self) {
9102 0 : return self->discriminant == 3;
9103 0 : }
9104 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant );
9105 0 : int fd_bpf_upgradeable_loader_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9106 0 : int err;
9107 0 : switch (discriminant) {
9108 0 : case 0: {
9109 0 : return FD_BINCODE_SUCCESS;
9110 0 : }
9111 0 : case 1: {
9112 0 : err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
9113 0 : if( FD_UNLIKELY( err ) ) return err;
9114 0 : return FD_BINCODE_SUCCESS;
9115 0 : }
9116 0 : case 2: {
9117 0 : err = fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( ctx, total_sz );
9118 0 : if( FD_UNLIKELY( err ) ) return err;
9119 0 : return FD_BINCODE_SUCCESS;
9120 0 : }
9121 0 : case 3: {
9122 0 : err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
9123 0 : if( FD_UNLIKELY( err ) ) return err;
9124 0 : return FD_BINCODE_SUCCESS;
9125 0 : }
9126 0 : default: return FD_BINCODE_ERR_ENCODING;
9127 0 : }
9128 0 : }
9129 0 : static int fd_bpf_upgradeable_loader_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9130 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9131 0 : uint discriminant = 0;
9132 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9133 0 : if( FD_UNLIKELY( err ) ) return err;
9134 0 : return fd_bpf_upgradeable_loader_state_inner_decode_footprint( discriminant, ctx, total_sz );
9135 0 : }
9136 0 : int fd_bpf_upgradeable_loader_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9137 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_t);
9138 0 : void const * start_data = ctx->data;
9139 0 : int err = fd_bpf_upgradeable_loader_state_decode_footprint_inner( ctx, total_sz );
9140 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9141 0 : ctx->data = start_data;
9142 0 : return err;
9143 0 : }
9144 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 ) {
9145 0 : switch (discriminant) {
9146 0 : case 0: {
9147 0 : break;
9148 0 : }
9149 0 : case 1: {
9150 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( &self->buffer, alloc_mem, ctx );
9151 0 : break;
9152 0 : }
9153 0 : case 2: {
9154 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( &self->program, alloc_mem, ctx );
9155 0 : break;
9156 0 : }
9157 0 : case 3: {
9158 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( &self->program_data, alloc_mem, ctx );
9159 0 : break;
9160 0 : }
9161 0 : }
9162 0 : }
9163 0 : static void fd_bpf_upgradeable_loader_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9164 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)struct_mem;
9165 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9166 0 : fd_bpf_upgradeable_loader_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9167 0 : }
9168 0 : void * fd_bpf_upgradeable_loader_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9169 0 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)mem;
9170 0 : fd_bpf_upgradeable_loader_state_new( self );
9171 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_t);
9172 0 : void * * alloc_mem = &alloc_region;
9173 0 : fd_bpf_upgradeable_loader_state_decode_inner( mem, alloc_mem, ctx );
9174 0 : return self;
9175 0 : }
9176 0 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
9177 0 : switch( discriminant ) {
9178 0 : case 0: {
9179 0 : break;
9180 0 : }
9181 0 : case 1: {
9182 0 : fd_bpf_upgradeable_loader_state_buffer_new( &self->buffer );
9183 0 : break;
9184 0 : }
9185 0 : case 2: {
9186 0 : fd_bpf_upgradeable_loader_state_program_new( &self->program );
9187 0 : break;
9188 0 : }
9189 0 : case 3: {
9190 0 : fd_bpf_upgradeable_loader_state_program_data_new( &self->program_data );
9191 0 : break;
9192 0 : }
9193 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9194 0 : }
9195 0 : }
9196 0 : void fd_bpf_upgradeable_loader_state_new_disc( fd_bpf_upgradeable_loader_state_t * self, uint discriminant ) {
9197 0 : self->discriminant = discriminant;
9198 0 : fd_bpf_upgradeable_loader_state_inner_new( &self->inner, self->discriminant );
9199 0 : }
9200 0 : void fd_bpf_upgradeable_loader_state_new( fd_bpf_upgradeable_loader_state_t * self ) {
9201 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_t) );
9202 0 : fd_bpf_upgradeable_loader_state_new_disc( self, UINT_MAX );
9203 0 : }
9204 :
9205 0 : ulong fd_bpf_upgradeable_loader_state_size( fd_bpf_upgradeable_loader_state_t const * self ) {
9206 0 : ulong size = 0;
9207 0 : size += sizeof(uint);
9208 0 : switch (self->discriminant) {
9209 0 : case 1: {
9210 0 : size += fd_bpf_upgradeable_loader_state_buffer_size( &self->inner.buffer );
9211 0 : break;
9212 0 : }
9213 0 : case 2: {
9214 0 : size += fd_bpf_upgradeable_loader_state_program_size( &self->inner.program );
9215 0 : break;
9216 0 : }
9217 0 : case 3: {
9218 0 : size += fd_bpf_upgradeable_loader_state_program_data_size( &self->inner.program_data );
9219 0 : break;
9220 0 : }
9221 0 : }
9222 0 : return size;
9223 0 : }
9224 :
9225 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 ) {
9226 0 : int err;
9227 0 : switch (discriminant) {
9228 0 : case 1: {
9229 0 : err = fd_bpf_upgradeable_loader_state_buffer_encode( &self->buffer, ctx );
9230 0 : if( FD_UNLIKELY( err ) ) return err;
9231 0 : break;
9232 0 : }
9233 0 : case 2: {
9234 0 : err = fd_bpf_upgradeable_loader_state_program_encode( &self->program, ctx );
9235 0 : if( FD_UNLIKELY( err ) ) return err;
9236 0 : break;
9237 0 : }
9238 0 : case 3: {
9239 0 : err = fd_bpf_upgradeable_loader_state_program_data_encode( &self->program_data, ctx );
9240 0 : if( FD_UNLIKELY( err ) ) return err;
9241 0 : break;
9242 0 : }
9243 0 : }
9244 0 : return FD_BINCODE_SUCCESS;
9245 0 : }
9246 0 : int fd_bpf_upgradeable_loader_state_encode( fd_bpf_upgradeable_loader_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9247 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9248 0 : if( FD_UNLIKELY( err ) ) return err;
9249 0 : return fd_bpf_upgradeable_loader_state_inner_encode( &self->inner, self->discriminant, ctx );
9250 0 : }
9251 :
9252 0 : int fd_loader_v4_state_encode( fd_loader_v4_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9253 0 : int err;
9254 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
9255 0 : if( FD_UNLIKELY( err ) ) return err;
9256 0 : err = fd_pubkey_encode( &self->authority_address_or_next_version, ctx );
9257 0 : if( FD_UNLIKELY( err ) ) return err;
9258 0 : err = fd_bincode_uint64_encode( self->status, ctx );
9259 0 : if( FD_UNLIKELY( err ) ) return err;
9260 0 : return FD_BINCODE_SUCCESS;
9261 0 : }
9262 0 : static inline int fd_loader_v4_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9263 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9264 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
9265 0 : return 0;
9266 0 : }
9267 0 : static void fd_loader_v4_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9268 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)struct_mem;
9269 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
9270 0 : fd_pubkey_decode_inner( &self->authority_address_or_next_version, alloc_mem, ctx );
9271 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
9272 0 : }
9273 0 : void * fd_loader_v4_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9274 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)mem;
9275 0 : fd_loader_v4_state_new( self );
9276 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_state_t);
9277 0 : void * * alloc_mem = &alloc_region;
9278 0 : fd_loader_v4_state_decode_inner( mem, alloc_mem, ctx );
9279 0 : return self;
9280 0 : }
9281 0 : int fd_frozen_hash_status_encode( fd_frozen_hash_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9282 0 : int err;
9283 0 : err = fd_hash_encode( &self->frozen_hash, ctx );
9284 0 : if( FD_UNLIKELY( err ) ) return err;
9285 0 : err = fd_bincode_bool_encode( (uchar)(self->is_duplicate_confirmed), ctx );
9286 0 : if( FD_UNLIKELY( err ) ) return err;
9287 0 : return FD_BINCODE_SUCCESS;
9288 0 : }
9289 0 : static int fd_frozen_hash_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9290 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9291 0 : int err = 0;
9292 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
9293 0 : if( FD_UNLIKELY( err ) ) return err;
9294 0 : err = fd_bincode_bool_decode_footprint( ctx );
9295 0 : if( FD_UNLIKELY( err ) ) return err;
9296 0 : return 0;
9297 0 : }
9298 0 : int fd_frozen_hash_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9299 0 : *total_sz += sizeof(fd_frozen_hash_status_t);
9300 0 : void const * start_data = ctx->data;
9301 0 : int err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
9302 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9303 0 : ctx->data = start_data;
9304 0 : return err;
9305 0 : }
9306 0 : static void fd_frozen_hash_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9307 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)struct_mem;
9308 0 : fd_hash_decode_inner( &self->frozen_hash, alloc_mem, ctx );
9309 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
9310 0 : }
9311 0 : void * fd_frozen_hash_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9312 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)mem;
9313 0 : fd_frozen_hash_status_new( self );
9314 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_status_t);
9315 0 : void * * alloc_mem = &alloc_region;
9316 0 : fd_frozen_hash_status_decode_inner( mem, alloc_mem, ctx );
9317 0 : return self;
9318 0 : }
9319 0 : void fd_frozen_hash_status_new(fd_frozen_hash_status_t * self) {
9320 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_status_t) );
9321 0 : fd_hash_new( &self->frozen_hash );
9322 0 : }
9323 0 : FD_FN_PURE uchar fd_frozen_hash_versioned_is_current(fd_frozen_hash_versioned_t const * self) {
9324 0 : return self->discriminant == 0;
9325 0 : }
9326 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant );
9327 0 : int fd_frozen_hash_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9328 0 : int err;
9329 0 : switch (discriminant) {
9330 0 : case 0: {
9331 0 : err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
9332 0 : if( FD_UNLIKELY( err ) ) return err;
9333 0 : return FD_BINCODE_SUCCESS;
9334 0 : }
9335 0 : default: return FD_BINCODE_ERR_ENCODING;
9336 0 : }
9337 0 : }
9338 0 : static int fd_frozen_hash_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9339 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9340 0 : uint discriminant = 0;
9341 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9342 0 : if( FD_UNLIKELY( err ) ) return err;
9343 0 : return fd_frozen_hash_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
9344 0 : }
9345 0 : int fd_frozen_hash_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9346 0 : *total_sz += sizeof(fd_frozen_hash_versioned_t);
9347 0 : void const * start_data = ctx->data;
9348 0 : int err = fd_frozen_hash_versioned_decode_footprint_inner( ctx, total_sz );
9349 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9350 0 : ctx->data = start_data;
9351 0 : return err;
9352 0 : }
9353 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 ) {
9354 0 : switch (discriminant) {
9355 0 : case 0: {
9356 0 : fd_frozen_hash_status_decode_inner( &self->current, alloc_mem, ctx );
9357 0 : break;
9358 0 : }
9359 0 : }
9360 0 : }
9361 0 : static void fd_frozen_hash_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9362 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)struct_mem;
9363 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9364 0 : fd_frozen_hash_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9365 0 : }
9366 0 : void * fd_frozen_hash_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9367 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)mem;
9368 0 : fd_frozen_hash_versioned_new( self );
9369 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_versioned_t);
9370 0 : void * * alloc_mem = &alloc_region;
9371 0 : fd_frozen_hash_versioned_decode_inner( mem, alloc_mem, ctx );
9372 0 : return self;
9373 0 : }
9374 0 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
9375 0 : switch( discriminant ) {
9376 0 : case 0: {
9377 0 : fd_frozen_hash_status_new( &self->current );
9378 0 : break;
9379 0 : }
9380 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9381 0 : }
9382 0 : }
9383 0 : void fd_frozen_hash_versioned_new_disc( fd_frozen_hash_versioned_t * self, uint discriminant ) {
9384 0 : self->discriminant = discriminant;
9385 0 : fd_frozen_hash_versioned_inner_new( &self->inner, self->discriminant );
9386 0 : }
9387 0 : void fd_frozen_hash_versioned_new( fd_frozen_hash_versioned_t * self ) {
9388 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_versioned_t) );
9389 0 : fd_frozen_hash_versioned_new_disc( self, UINT_MAX );
9390 0 : }
9391 :
9392 0 : ulong fd_frozen_hash_versioned_size( fd_frozen_hash_versioned_t const * self ) {
9393 0 : ulong size = 0;
9394 0 : size += sizeof(uint);
9395 0 : switch (self->discriminant) {
9396 0 : case 0: {
9397 0 : size += fd_frozen_hash_status_size( &self->inner.current );
9398 0 : break;
9399 0 : }
9400 0 : }
9401 0 : return size;
9402 0 : }
9403 :
9404 0 : int fd_frozen_hash_versioned_inner_encode( fd_frozen_hash_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
9405 0 : int err;
9406 0 : switch (discriminant) {
9407 0 : case 0: {
9408 0 : err = fd_frozen_hash_status_encode( &self->current, ctx );
9409 0 : if( FD_UNLIKELY( err ) ) return err;
9410 0 : break;
9411 0 : }
9412 0 : }
9413 0 : return FD_BINCODE_SUCCESS;
9414 0 : }
9415 0 : int fd_frozen_hash_versioned_encode( fd_frozen_hash_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9416 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9417 0 : if( FD_UNLIKELY( err ) ) return err;
9418 0 : return fd_frozen_hash_versioned_inner_encode( &self->inner, self->discriminant, ctx );
9419 0 : }
9420 :
9421 0 : int fd_lookup_table_meta_encode( fd_lookup_table_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9422 0 : int err;
9423 0 : err = fd_bincode_uint64_encode( self->deactivation_slot, ctx );
9424 0 : if( FD_UNLIKELY( err ) ) return err;
9425 0 : err = fd_bincode_uint64_encode( self->last_extended_slot, ctx );
9426 0 : if( FD_UNLIKELY( err ) ) return err;
9427 0 : err = fd_bincode_uint8_encode( (uchar)(self->last_extended_slot_start_index), ctx );
9428 0 : if( FD_UNLIKELY( err ) ) return err;
9429 0 : err = fd_bincode_bool_encode( self->has_authority, ctx );
9430 0 : if( FD_UNLIKELY( err ) ) return err;
9431 0 : if( self->has_authority ) {
9432 0 : err = fd_pubkey_encode( &self->authority, ctx );
9433 0 : if( FD_UNLIKELY( err ) ) return err;
9434 0 : }
9435 0 : err = fd_bincode_uint16_encode( self->_padding, ctx );
9436 0 : if( FD_UNLIKELY( err ) ) return err;
9437 0 : return FD_BINCODE_SUCCESS;
9438 0 : }
9439 0 : static int fd_lookup_table_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9440 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9441 0 : int err = 0;
9442 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9443 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9444 0 : err = fd_bincode_uint64_decode_footprint( ctx );
9445 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9446 0 : err = fd_bincode_uint8_decode_footprint( ctx );
9447 0 : if( FD_UNLIKELY( err ) ) return err;
9448 0 : {
9449 0 : uchar o;
9450 0 : err = fd_bincode_bool_decode( &o, ctx );
9451 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9452 0 : if( o ) {
9453 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9454 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9455 0 : }
9456 0 : }
9457 0 : err = fd_bincode_uint16_decode_footprint( ctx );
9458 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9459 0 : return 0;
9460 0 : }
9461 0 : int fd_lookup_table_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9462 0 : *total_sz += sizeof(fd_lookup_table_meta_t);
9463 0 : void const * start_data = ctx->data;
9464 0 : int err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
9465 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9466 0 : ctx->data = start_data;
9467 0 : return err;
9468 0 : }
9469 0 : static void fd_lookup_table_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9470 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)struct_mem;
9471 0 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
9472 0 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
9473 0 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
9474 0 : {
9475 0 : uchar o;
9476 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
9477 0 : self->has_authority = !!o;
9478 0 : if( o ) {
9479 0 : fd_pubkey_new( &self->authority );
9480 0 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
9481 0 : }
9482 0 : }
9483 0 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
9484 0 : }
9485 0 : void * fd_lookup_table_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9486 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)mem;
9487 0 : fd_lookup_table_meta_new( self );
9488 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lookup_table_meta_t);
9489 0 : void * * alloc_mem = &alloc_region;
9490 0 : fd_lookup_table_meta_decode_inner( mem, alloc_mem, ctx );
9491 0 : return self;
9492 0 : }
9493 0 : void fd_lookup_table_meta_new(fd_lookup_table_meta_t * self) {
9494 0 : fd_memset( self, 0, sizeof(fd_lookup_table_meta_t) );
9495 0 : }
9496 0 : ulong fd_lookup_table_meta_size( fd_lookup_table_meta_t const * self ) {
9497 0 : ulong size = 0;
9498 0 : size += sizeof(ulong);
9499 0 : size += sizeof(ulong);
9500 0 : size += sizeof(char);
9501 0 : size += sizeof(char);
9502 0 : if( self->has_authority ) {
9503 0 : size += fd_pubkey_size( &self->authority );
9504 0 : }
9505 0 : size += sizeof(ushort);
9506 0 : return size;
9507 0 : }
9508 :
9509 0 : int fd_address_lookup_table_encode( fd_address_lookup_table_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9510 0 : int err;
9511 0 : err = fd_lookup_table_meta_encode( &self->meta, ctx );
9512 0 : if( FD_UNLIKELY( err ) ) return err;
9513 0 : return FD_BINCODE_SUCCESS;
9514 0 : }
9515 0 : static int fd_address_lookup_table_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9516 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9517 0 : int err = 0;
9518 0 : err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
9519 0 : if( FD_UNLIKELY( err ) ) return err;
9520 0 : return 0;
9521 0 : }
9522 0 : int fd_address_lookup_table_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9523 0 : *total_sz += sizeof(fd_address_lookup_table_t);
9524 0 : void const * start_data = ctx->data;
9525 0 : int err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
9526 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9527 0 : ctx->data = start_data;
9528 0 : return err;
9529 0 : }
9530 0 : static void fd_address_lookup_table_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9531 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)struct_mem;
9532 0 : fd_lookup_table_meta_decode_inner( &self->meta, alloc_mem, ctx );
9533 0 : }
9534 0 : void * fd_address_lookup_table_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9535 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)mem;
9536 0 : fd_address_lookup_table_new( self );
9537 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_t);
9538 0 : void * * alloc_mem = &alloc_region;
9539 0 : fd_address_lookup_table_decode_inner( mem, alloc_mem, ctx );
9540 0 : return self;
9541 0 : }
9542 0 : void fd_address_lookup_table_new(fd_address_lookup_table_t * self) {
9543 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_t) );
9544 0 : fd_lookup_table_meta_new( &self->meta );
9545 0 : }
9546 0 : ulong fd_address_lookup_table_size( fd_address_lookup_table_t const * self ) {
9547 0 : ulong size = 0;
9548 0 : size += fd_lookup_table_meta_size( &self->meta );
9549 0 : return size;
9550 0 : }
9551 :
9552 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_uninitialized(fd_address_lookup_table_state_t const * self) {
9553 0 : return self->discriminant == 0;
9554 0 : }
9555 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_lookup_table(fd_address_lookup_table_state_t const * self) {
9556 0 : return self->discriminant == 1;
9557 0 : }
9558 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant );
9559 0 : int fd_address_lookup_table_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9560 0 : int err;
9561 0 : switch (discriminant) {
9562 0 : case 0: {
9563 0 : return FD_BINCODE_SUCCESS;
9564 0 : }
9565 0 : case 1: {
9566 0 : err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
9567 0 : if( FD_UNLIKELY( err ) ) return err;
9568 0 : return FD_BINCODE_SUCCESS;
9569 0 : }
9570 0 : default: return FD_BINCODE_ERR_ENCODING;
9571 0 : }
9572 0 : }
9573 0 : static int fd_address_lookup_table_state_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 : uint discriminant = 0;
9576 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9577 0 : if( FD_UNLIKELY( err ) ) return err;
9578 0 : return fd_address_lookup_table_state_inner_decode_footprint( discriminant, ctx, total_sz );
9579 0 : }
9580 0 : int fd_address_lookup_table_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9581 0 : *total_sz += sizeof(fd_address_lookup_table_state_t);
9582 0 : void const * start_data = ctx->data;
9583 0 : int err = fd_address_lookup_table_state_decode_footprint_inner( ctx, total_sz );
9584 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9585 0 : ctx->data = start_data;
9586 0 : return err;
9587 0 : }
9588 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 ) {
9589 0 : switch (discriminant) {
9590 0 : case 0: {
9591 0 : break;
9592 0 : }
9593 0 : case 1: {
9594 0 : fd_address_lookup_table_decode_inner( &self->lookup_table, alloc_mem, ctx );
9595 0 : break;
9596 0 : }
9597 0 : }
9598 0 : }
9599 0 : static void fd_address_lookup_table_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9600 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)struct_mem;
9601 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9602 0 : fd_address_lookup_table_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9603 0 : }
9604 0 : void * fd_address_lookup_table_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9605 0 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)mem;
9606 0 : fd_address_lookup_table_state_new( self );
9607 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_state_t);
9608 0 : void * * alloc_mem = &alloc_region;
9609 0 : fd_address_lookup_table_state_decode_inner( mem, alloc_mem, ctx );
9610 0 : return self;
9611 0 : }
9612 0 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
9613 0 : switch( discriminant ) {
9614 0 : case 0: {
9615 0 : break;
9616 0 : }
9617 0 : case 1: {
9618 0 : fd_address_lookup_table_new( &self->lookup_table );
9619 0 : break;
9620 0 : }
9621 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9622 0 : }
9623 0 : }
9624 0 : void fd_address_lookup_table_state_new_disc( fd_address_lookup_table_state_t * self, uint discriminant ) {
9625 0 : self->discriminant = discriminant;
9626 0 : fd_address_lookup_table_state_inner_new( &self->inner, self->discriminant );
9627 0 : }
9628 0 : void fd_address_lookup_table_state_new( fd_address_lookup_table_state_t * self ) {
9629 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_state_t) );
9630 0 : fd_address_lookup_table_state_new_disc( self, UINT_MAX );
9631 0 : }
9632 :
9633 0 : ulong fd_address_lookup_table_state_size( fd_address_lookup_table_state_t const * self ) {
9634 0 : ulong size = 0;
9635 0 : size += sizeof(uint);
9636 0 : switch (self->discriminant) {
9637 0 : case 1: {
9638 0 : size += fd_address_lookup_table_size( &self->inner.lookup_table );
9639 0 : break;
9640 0 : }
9641 0 : }
9642 0 : return size;
9643 0 : }
9644 :
9645 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 ) {
9646 0 : int err;
9647 0 : switch (discriminant) {
9648 0 : case 1: {
9649 0 : err = fd_address_lookup_table_encode( &self->lookup_table, ctx );
9650 0 : if( FD_UNLIKELY( err ) ) return err;
9651 0 : break;
9652 0 : }
9653 0 : }
9654 0 : return FD_BINCODE_SUCCESS;
9655 0 : }
9656 0 : int fd_address_lookup_table_state_encode( fd_address_lookup_table_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9657 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9658 0 : if( FD_UNLIKELY( err ) ) return err;
9659 0 : return fd_address_lookup_table_state_inner_encode( &self->inner, self->discriminant, ctx );
9660 0 : }
9661 :
9662 0 : int fd_addrlut_create_encode( fd_addrlut_create_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9663 0 : int err;
9664 0 : err = fd_bincode_uint64_encode( self->recent_slot, ctx );
9665 0 : if( FD_UNLIKELY( err ) ) return err;
9666 0 : err = fd_bincode_uint8_encode( (uchar)(self->bump_seed), ctx );
9667 0 : if( FD_UNLIKELY( err ) ) return err;
9668 0 : return FD_BINCODE_SUCCESS;
9669 0 : }
9670 0 : static inline int fd_addrlut_create_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9671 0 : if( (ulong)ctx->data + 9UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9672 0 : ctx->data = (void *)( (ulong)ctx->data + 9UL );
9673 0 : return 0;
9674 0 : }
9675 0 : static void fd_addrlut_create_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9676 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)struct_mem;
9677 0 : fd_bincode_uint64_decode_unsafe( &self->recent_slot, ctx );
9678 0 : fd_bincode_uint8_decode_unsafe( &self->bump_seed, ctx );
9679 0 : }
9680 0 : void * fd_addrlut_create_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9681 0 : fd_addrlut_create_t * self = (fd_addrlut_create_t *)mem;
9682 0 : fd_addrlut_create_new( self );
9683 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_create_t);
9684 0 : void * * alloc_mem = &alloc_region;
9685 0 : fd_addrlut_create_decode_inner( mem, alloc_mem, ctx );
9686 0 : return self;
9687 0 : }
9688 0 : int fd_addrlut_extend_encode( fd_addrlut_extend_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9689 0 : int err;
9690 0 : err = fd_bincode_uint64_encode( self->new_addrs_len, ctx );
9691 0 : if( FD_UNLIKELY(err) ) return err;
9692 0 : if( self->new_addrs_len ) {
9693 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
9694 0 : err = fd_pubkey_encode( self->new_addrs + i, ctx );
9695 0 : if( FD_UNLIKELY( err ) ) return err;
9696 0 : }
9697 0 : }
9698 0 : return FD_BINCODE_SUCCESS;
9699 0 : }
9700 0 : static int fd_addrlut_extend_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9701 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9702 0 : int err = 0;
9703 0 : ulong new_addrs_len;
9704 0 : err = fd_bincode_uint64_decode( &new_addrs_len, ctx );
9705 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9706 0 : if( new_addrs_len ) {
9707 0 : *total_sz += FD_PUBKEY_ALIGN + sizeof(fd_pubkey_t)*new_addrs_len;
9708 0 : for( ulong i=0; i < new_addrs_len; i++ ) {
9709 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
9710 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
9711 0 : }
9712 0 : }
9713 0 : return 0;
9714 0 : }
9715 0 : int fd_addrlut_extend_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9716 0 : *total_sz += sizeof(fd_addrlut_extend_t);
9717 0 : void const * start_data = ctx->data;
9718 0 : int err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
9719 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9720 0 : ctx->data = start_data;
9721 0 : return err;
9722 0 : }
9723 0 : static void fd_addrlut_extend_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9724 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)struct_mem;
9725 0 : fd_bincode_uint64_decode_unsafe( &self->new_addrs_len, ctx );
9726 0 : if( self->new_addrs_len ) {
9727 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_PUBKEY_ALIGN );
9728 0 : self->new_addrs = *alloc_mem;
9729 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_pubkey_t)*self->new_addrs_len;
9730 0 : for( ulong i=0; i < self->new_addrs_len; i++ ) {
9731 0 : fd_pubkey_new( self->new_addrs + i );
9732 0 : fd_pubkey_decode_inner( self->new_addrs + i, alloc_mem, ctx );
9733 0 : }
9734 0 : } else
9735 0 : self->new_addrs = NULL;
9736 0 : }
9737 0 : void * fd_addrlut_extend_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9738 0 : fd_addrlut_extend_t * self = (fd_addrlut_extend_t *)mem;
9739 0 : fd_addrlut_extend_new( self );
9740 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_extend_t);
9741 0 : void * * alloc_mem = &alloc_region;
9742 0 : fd_addrlut_extend_decode_inner( mem, alloc_mem, ctx );
9743 0 : return self;
9744 0 : }
9745 0 : void fd_addrlut_extend_new(fd_addrlut_extend_t * self) {
9746 0 : fd_memset( self, 0, sizeof(fd_addrlut_extend_t) );
9747 0 : }
9748 0 : ulong fd_addrlut_extend_size( fd_addrlut_extend_t const * self ) {
9749 0 : ulong size = 0;
9750 0 : do {
9751 0 : size += sizeof(ulong);
9752 0 : for( ulong i=0; i < self->new_addrs_len; i++ )
9753 0 : size += fd_pubkey_size( self->new_addrs + i );
9754 0 : } while(0);
9755 0 : return size;
9756 0 : }
9757 :
9758 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_create_lut(fd_addrlut_instruction_t const * self) {
9759 0 : return self->discriminant == 0;
9760 0 : }
9761 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_freeze_lut(fd_addrlut_instruction_t const * self) {
9762 0 : return self->discriminant == 1;
9763 0 : }
9764 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_extend_lut(fd_addrlut_instruction_t const * self) {
9765 0 : return self->discriminant == 2;
9766 0 : }
9767 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_deactivate_lut(fd_addrlut_instruction_t const * self) {
9768 0 : return self->discriminant == 3;
9769 0 : }
9770 0 : FD_FN_PURE uchar fd_addrlut_instruction_is_close_lut(fd_addrlut_instruction_t const * self) {
9771 0 : return self->discriminant == 4;
9772 0 : }
9773 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant );
9774 0 : int fd_addrlut_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9775 0 : int err;
9776 0 : switch (discriminant) {
9777 0 : case 0: {
9778 0 : err = fd_addrlut_create_decode_footprint_inner( ctx, total_sz );
9779 0 : if( FD_UNLIKELY( err ) ) return err;
9780 0 : return FD_BINCODE_SUCCESS;
9781 0 : }
9782 0 : case 1: {
9783 0 : return FD_BINCODE_SUCCESS;
9784 0 : }
9785 0 : case 2: {
9786 0 : err = fd_addrlut_extend_decode_footprint_inner( ctx, total_sz );
9787 0 : if( FD_UNLIKELY( err ) ) return err;
9788 0 : return FD_BINCODE_SUCCESS;
9789 0 : }
9790 0 : case 3: {
9791 0 : return FD_BINCODE_SUCCESS;
9792 0 : }
9793 0 : case 4: {
9794 0 : return FD_BINCODE_SUCCESS;
9795 0 : }
9796 0 : default: return FD_BINCODE_ERR_ENCODING;
9797 0 : }
9798 0 : }
9799 0 : static int fd_addrlut_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9800 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9801 0 : uint discriminant = 0;
9802 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
9803 0 : if( FD_UNLIKELY( err ) ) return err;
9804 0 : return fd_addrlut_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
9805 0 : }
9806 0 : int fd_addrlut_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
9807 0 : *total_sz += sizeof(fd_addrlut_instruction_t);
9808 0 : void const * start_data = ctx->data;
9809 0 : int err = fd_addrlut_instruction_decode_footprint_inner( ctx, total_sz );
9810 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
9811 0 : ctx->data = start_data;
9812 0 : return err;
9813 0 : }
9814 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 ) {
9815 0 : switch (discriminant) {
9816 0 : case 0: {
9817 0 : fd_addrlut_create_decode_inner( &self->create_lut, alloc_mem, ctx );
9818 0 : break;
9819 0 : }
9820 0 : case 1: {
9821 0 : break;
9822 0 : }
9823 0 : case 2: {
9824 0 : fd_addrlut_extend_decode_inner( &self->extend_lut, alloc_mem, ctx );
9825 0 : break;
9826 0 : }
9827 0 : case 3: {
9828 0 : break;
9829 0 : }
9830 0 : case 4: {
9831 0 : break;
9832 0 : }
9833 0 : }
9834 0 : }
9835 0 : static void fd_addrlut_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
9836 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)struct_mem;
9837 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
9838 0 : fd_addrlut_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
9839 0 : }
9840 0 : void * fd_addrlut_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
9841 0 : fd_addrlut_instruction_t * self = (fd_addrlut_instruction_t *)mem;
9842 0 : fd_addrlut_instruction_new( self );
9843 0 : void * alloc_region = (uchar *)mem + sizeof(fd_addrlut_instruction_t);
9844 0 : void * * alloc_mem = &alloc_region;
9845 0 : fd_addrlut_instruction_decode_inner( mem, alloc_mem, ctx );
9846 0 : return self;
9847 0 : }
9848 0 : void fd_addrlut_instruction_inner_new( fd_addrlut_instruction_inner_t * self, uint discriminant ) {
9849 0 : switch( discriminant ) {
9850 0 : case 0: {
9851 0 : fd_addrlut_create_new( &self->create_lut );
9852 0 : break;
9853 0 : }
9854 0 : case 1: {
9855 0 : break;
9856 0 : }
9857 0 : case 2: {
9858 0 : fd_addrlut_extend_new( &self->extend_lut );
9859 0 : break;
9860 0 : }
9861 0 : case 3: {
9862 0 : break;
9863 0 : }
9864 0 : case 4: {
9865 0 : break;
9866 0 : }
9867 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
9868 0 : }
9869 0 : }
9870 0 : void fd_addrlut_instruction_new_disc( fd_addrlut_instruction_t * self, uint discriminant ) {
9871 0 : self->discriminant = discriminant;
9872 0 : fd_addrlut_instruction_inner_new( &self->inner, self->discriminant );
9873 0 : }
9874 0 : void fd_addrlut_instruction_new( fd_addrlut_instruction_t * self ) {
9875 0 : fd_memset( self, 0, sizeof(fd_addrlut_instruction_t) );
9876 0 : fd_addrlut_instruction_new_disc( self, UINT_MAX );
9877 0 : }
9878 :
9879 0 : ulong fd_addrlut_instruction_size( fd_addrlut_instruction_t const * self ) {
9880 0 : ulong size = 0;
9881 0 : size += sizeof(uint);
9882 0 : switch (self->discriminant) {
9883 0 : case 0: {
9884 0 : size += fd_addrlut_create_size( &self->inner.create_lut );
9885 0 : break;
9886 0 : }
9887 0 : case 2: {
9888 0 : size += fd_addrlut_extend_size( &self->inner.extend_lut );
9889 0 : break;
9890 0 : }
9891 0 : }
9892 0 : return size;
9893 0 : }
9894 :
9895 0 : int fd_addrlut_instruction_inner_encode( fd_addrlut_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
9896 0 : int err;
9897 0 : switch (discriminant) {
9898 0 : case 0: {
9899 0 : err = fd_addrlut_create_encode( &self->create_lut, ctx );
9900 0 : if( FD_UNLIKELY( err ) ) return err;
9901 0 : break;
9902 0 : }
9903 0 : case 2: {
9904 0 : err = fd_addrlut_extend_encode( &self->extend_lut, ctx );
9905 0 : if( FD_UNLIKELY( err ) ) return err;
9906 0 : break;
9907 0 : }
9908 0 : }
9909 0 : return FD_BINCODE_SUCCESS;
9910 0 : }
9911 0 : int fd_addrlut_instruction_encode( fd_addrlut_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
9912 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
9913 0 : if( FD_UNLIKELY( err ) ) return err;
9914 0 : return fd_addrlut_instruction_inner_encode( &self->inner, self->discriminant, ctx );
9915 0 : }
9916 :
9917 : #include "fd_types_custom.c"
|