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 712 : int fd_fee_calculator_encode( fd_fee_calculator_t const * self, fd_bincode_encode_ctx_t * ctx ) {
12 712 : int err;
13 712 : err = fd_bincode_uint64_encode( self->lamports_per_signature, ctx );
14 712 : if( FD_UNLIKELY( err ) ) return err;
15 712 : return FD_BINCODE_SUCCESS;
16 712 : }
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 3755446 : static void fd_fee_calculator_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
23 3755446 : fd_fee_calculator_t * self = (fd_fee_calculator_t *)struct_mem;
24 3755446 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_signature, ctx );
25 3755446 : }
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 0 : int fd_fee_rate_governor_encode( fd_fee_rate_governor_t const * self, fd_bincode_encode_ctx_t * ctx ) {
35 0 : int err;
36 0 : err = fd_bincode_uint64_encode( self->target_lamports_per_signature, ctx );
37 0 : if( FD_UNLIKELY( err ) ) return err;
38 0 : err = fd_bincode_uint64_encode( self->target_signatures_per_slot, ctx );
39 0 : if( FD_UNLIKELY( err ) ) return err;
40 0 : err = fd_bincode_uint64_encode( self->min_lamports_per_signature, ctx );
41 0 : if( FD_UNLIKELY( err ) ) return err;
42 0 : err = fd_bincode_uint64_encode( self->max_lamports_per_signature, ctx );
43 0 : if( FD_UNLIKELY( err ) ) return err;
44 0 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
45 0 : if( FD_UNLIKELY( err ) ) return err;
46 0 : return FD_BINCODE_SUCCESS;
47 0 : }
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 0 : int fd_inflation_encode( fd_inflation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
215 0 : int err;
216 0 : err = fd_bincode_double_encode( self->initial, ctx );
217 0 : if( FD_UNLIKELY( err ) ) return err;
218 0 : err = fd_bincode_double_encode( self->terminal, ctx );
219 0 : if( FD_UNLIKELY( err ) ) return err;
220 0 : err = fd_bincode_double_encode( self->taper, ctx );
221 0 : if( FD_UNLIKELY( err ) ) return err;
222 0 : err = fd_bincode_double_encode( self->foundation, ctx );
223 0 : if( FD_UNLIKELY( err ) ) return err;
224 0 : err = fd_bincode_double_encode( self->foundation_term, ctx );
225 0 : if( FD_UNLIKELY( err ) ) return err;
226 0 : err = fd_bincode_double_encode( self->unused, ctx );
227 0 : if( FD_UNLIKELY( err ) ) return err;
228 0 : return FD_BINCODE_SUCCESS;
229 0 : }
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 0 : int fd_rent_encode( fd_rent_t const * self, fd_bincode_encode_ctx_t * ctx ) {
253 0 : int err;
254 0 : err = fd_bincode_uint64_encode( self->lamports_per_uint8_year, ctx );
255 0 : if( FD_UNLIKELY( err ) ) return err;
256 0 : err = fd_bincode_double_encode( self->exemption_threshold, ctx );
257 0 : if( FD_UNLIKELY( err ) ) return err;
258 0 : err = fd_bincode_uint8_encode( (uchar)(self->burn_percent), ctx );
259 0 : if( FD_UNLIKELY( err ) ) return err;
260 0 : return FD_BINCODE_SUCCESS;
261 0 : }
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 30461 : static void fd_rent_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
268 30461 : fd_rent_t * self = (fd_rent_t *)struct_mem;
269 30461 : fd_bincode_uint64_decode_unsafe( &self->lamports_per_uint8_year, ctx );
270 30461 : fd_bincode_double_decode_unsafe( &self->exemption_threshold, ctx );
271 30461 : fd_bincode_uint8_decode_unsafe( &self->burn_percent, ctx );
272 30461 : }
273 30469 : void * fd_rent_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
274 30469 : fd_rent_t * self = (fd_rent_t *)mem;
275 30469 : fd_rent_new( self );
276 30469 : void * alloc_region = (uchar *)mem + sizeof(fd_rent_t);
277 30469 : void * * alloc_mem = &alloc_region;
278 30469 : fd_rent_decode_inner( mem, alloc_mem, ctx );
279 30469 : return self;
280 30469 : }
281 0 : int fd_epoch_schedule_encode( fd_epoch_schedule_t const * self, fd_bincode_encode_ctx_t * ctx ) {
282 0 : int err;
283 0 : err = fd_bincode_uint64_encode( self->slots_per_epoch, ctx );
284 0 : if( FD_UNLIKELY( err ) ) return err;
285 0 : err = fd_bincode_uint64_encode( self->leader_schedule_slot_offset, ctx );
286 0 : if( FD_UNLIKELY( err ) ) return err;
287 0 : err = fd_bincode_bool_encode( (uchar)(self->warmup), ctx );
288 0 : if( FD_UNLIKELY( err ) ) return err;
289 0 : err = fd_bincode_uint64_encode( self->first_normal_epoch, ctx );
290 0 : if( FD_UNLIKELY( err ) ) return err;
291 0 : err = fd_bincode_uint64_encode( self->first_normal_slot, ctx );
292 0 : if( FD_UNLIKELY( err ) ) return err;
293 0 : return FD_BINCODE_SUCCESS;
294 0 : }
295 30462 : static int fd_epoch_schedule_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
296 30462 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
297 30462 : int err = 0;
298 30462 : err = fd_bincode_uint64_decode_footprint( ctx );
299 30462 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
300 30462 : err = fd_bincode_uint64_decode_footprint( ctx );
301 30462 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
302 30462 : err = fd_bincode_bool_decode_footprint( ctx );
303 30462 : if( FD_UNLIKELY( err ) ) return err;
304 30462 : err = fd_bincode_uint64_decode_footprint( ctx );
305 30462 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
306 30462 : err = fd_bincode_uint64_decode_footprint( ctx );
307 30462 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
308 30462 : return 0;
309 30462 : }
310 30466 : int fd_epoch_schedule_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
311 30466 : *total_sz += sizeof(fd_epoch_schedule_t);
312 30466 : void const * start_data = ctx->data;
313 30466 : int err = fd_epoch_schedule_decode_footprint_inner( ctx, total_sz );
314 30466 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
315 30466 : ctx->data = start_data;
316 30466 : return err;
317 30466 : }
318 30462 : static void fd_epoch_schedule_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
319 30462 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)struct_mem;
320 30462 : fd_bincode_uint64_decode_unsafe( &self->slots_per_epoch, ctx );
321 30462 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_slot_offset, ctx );
322 30462 : fd_bincode_bool_decode_unsafe( &self->warmup, ctx );
323 30462 : fd_bincode_uint64_decode_unsafe( &self->first_normal_epoch, ctx );
324 30462 : fd_bincode_uint64_decode_unsafe( &self->first_normal_slot, ctx );
325 30462 : }
326 30461 : void * fd_epoch_schedule_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
327 30461 : fd_epoch_schedule_t * self = (fd_epoch_schedule_t *)mem;
328 30461 : fd_epoch_schedule_new( self );
329 30461 : void * alloc_region = (uchar *)mem + sizeof(fd_epoch_schedule_t);
330 30461 : void * * alloc_mem = &alloc_region;
331 30461 : fd_epoch_schedule_decode_inner( mem, alloc_mem, ctx );
332 30461 : return self;
333 30461 : }
334 30462 : void fd_epoch_schedule_new(fd_epoch_schedule_t * self) {
335 30462 : fd_memset( self, 0, sizeof(fd_epoch_schedule_t) );
336 30462 : }
337 13 : int fd_stake_history_entry_encode( fd_stake_history_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
338 13 : int err;
339 13 : err = fd_bincode_uint64_encode( self->effective, ctx );
340 13 : if( FD_UNLIKELY( err ) ) return err;
341 13 : err = fd_bincode_uint64_encode( self->activating, ctx );
342 13 : if( FD_UNLIKELY( err ) ) return err;
343 13 : err = fd_bincode_uint64_encode( self->deactivating, ctx );
344 13 : if( FD_UNLIKELY( err ) ) return err;
345 13 : return FD_BINCODE_SUCCESS;
346 13 : }
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 1692109 : static void fd_stake_history_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
353 1692109 : fd_stake_history_entry_t * self = (fd_stake_history_entry_t *)struct_mem;
354 1692109 : fd_bincode_uint64_decode_unsafe( &self->effective, ctx );
355 1692109 : fd_bincode_uint64_decode_unsafe( &self->activating, ctx );
356 1692109 : fd_bincode_uint64_decode_unsafe( &self->deactivating, ctx );
357 1692109 : }
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 13 : int fd_epoch_stake_history_entry_pair_encode( fd_epoch_stake_history_entry_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
367 13 : int err;
368 13 : err = fd_bincode_uint64_encode( self->epoch, ctx );
369 13 : if( FD_UNLIKELY( err ) ) return err;
370 13 : err = fd_stake_history_entry_encode( &self->entry, ctx );
371 13 : if( FD_UNLIKELY( err ) ) return err;
372 13 : return FD_BINCODE_SUCCESS;
373 13 : }
374 1723041 : static inline int fd_epoch_stake_history_entry_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
375 1723041 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
376 1722976 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
377 1722976 : return 0;
378 1723041 : }
379 1692062 : static void fd_epoch_stake_history_entry_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
380 1692062 : fd_epoch_stake_history_entry_pair_t * self = (fd_epoch_stake_history_entry_pair_t *)struct_mem;
381 1692062 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
382 1692062 : fd_stake_history_entry_decode_inner( &self->entry, alloc_mem, ctx );
383 1692062 : }
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 2 : int fd_stake_history_encode( fd_stake_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
393 2 : int err;
394 2 : err = fd_bincode_uint64_encode( self->fd_stake_history_len, ctx );
395 2 : if( FD_UNLIKELY(err) ) return err;
396 2 : if( FD_UNLIKELY( 0 == self->fd_stake_history_len ) ) return FD_BINCODE_SUCCESS;
397 15 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
398 13 : ulong idx = ( i + self->fd_stake_history_offset ) & (512 - 1);
399 13 : err = fd_epoch_stake_history_entry_pair_encode( self->fd_stake_history + idx, ctx );
400 13 : if( FD_UNLIKELY( err ) ) return err;
401 13 : }
402 2 : return FD_BINCODE_SUCCESS;
403 2 : }
404 11824 : static int fd_stake_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
405 11824 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
406 11807 : int err = 0;
407 11807 : ulong fd_stake_history_len;
408 11807 : err = fd_bincode_uint64_decode( &fd_stake_history_len, ctx );
409 11807 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
410 11807 : if( fd_stake_history_len ) {
411 1732926 : for( ulong i=0; i < fd_stake_history_len; i++ ) {
412 1723052 : err = fd_epoch_stake_history_entry_pair_decode_footprint_inner( ctx, total_sz );
413 1723052 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
414 1723052 : }
415 9939 : }
416 11742 : return 0;
417 11807 : }
418 11824 : int fd_stake_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
419 11824 : *total_sz += sizeof(fd_stake_history_t);
420 11824 : void const * start_data = ctx->data;
421 11824 : int err = fd_stake_history_decode_footprint_inner( ctx, total_sz );
422 11824 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
423 11824 : ctx->data = start_data;
424 11824 : return err;
425 11824 : }
426 11743 : static void fd_stake_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
427 11743 : fd_stake_history_t * self = (fd_stake_history_t *)struct_mem;
428 11743 : fd_bincode_uint64_decode_unsafe( &self->fd_stake_history_len, ctx );
429 11743 : self->fd_stake_history_size = 512;
430 11743 : self->fd_stake_history_offset = 0;
431 1703847 : for( ulong i=0; i<self->fd_stake_history_len; i++ ) {
432 1692104 : fd_epoch_stake_history_entry_pair_decode_inner( self->fd_stake_history + i, alloc_mem, ctx );
433 1692104 : }
434 11743 : }
435 11743 : void * fd_stake_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
436 11743 : fd_stake_history_t * self = (fd_stake_history_t *)mem;
437 11743 : fd_stake_history_new( self );
438 11743 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_history_t);
439 11743 : void * * alloc_mem = &alloc_region;
440 11743 : fd_stake_history_decode_inner( mem, alloc_mem, ctx );
441 11743 : return self;
442 11743 : }
443 11743 : void fd_stake_history_new(fd_stake_history_t * self) {
444 11743 : fd_memset( self, 0, sizeof(fd_stake_history_t) );
445 11743 : self->fd_stake_history_size = 512;
446 5975198 : for( ulong i=0; i<512; i++ )
447 5963455 : fd_epoch_stake_history_entry_pair_new( self->fd_stake_history + i );
448 11743 : }
449 0 : int fd_solana_account_encode( fd_solana_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
450 0 : int err;
451 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
452 0 : if( FD_UNLIKELY( err ) ) return err;
453 0 : err = fd_bincode_uint64_encode( self->data_len, ctx );
454 0 : if( FD_UNLIKELY(err) ) return err;
455 0 : if( self->data_len ) {
456 0 : err = fd_bincode_bytes_encode( self->data, self->data_len, ctx );
457 0 : if( FD_UNLIKELY( err ) ) return err;
458 0 : }
459 0 : err = fd_pubkey_encode( &self->owner, ctx );
460 0 : if( FD_UNLIKELY( err ) ) return err;
461 0 : err = fd_bincode_bool_encode( (uchar)(self->executable), ctx );
462 0 : if( FD_UNLIKELY( err ) ) return err;
463 0 : err = fd_bincode_uint64_encode( self->rent_epoch, ctx );
464 0 : if( FD_UNLIKELY( err ) ) return err;
465 0 : return FD_BINCODE_SUCCESS;
466 0 : }
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 2 : int fd_delegation_encode( fd_delegation_t const * self, fd_bincode_encode_ctx_t * ctx ) {
592 2 : int err;
593 2 : err = fd_pubkey_encode( &self->voter_pubkey, ctx );
594 2 : if( FD_UNLIKELY( err ) ) return err;
595 2 : err = fd_bincode_uint64_encode( self->stake, ctx );
596 2 : if( FD_UNLIKELY( err ) ) return err;
597 2 : err = fd_bincode_uint64_encode( self->activation_epoch, ctx );
598 2 : if( FD_UNLIKELY( err ) ) return err;
599 2 : err = fd_bincode_uint64_encode( self->deactivation_epoch, ctx );
600 2 : if( FD_UNLIKELY( err ) ) return err;
601 2 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
602 2 : if( FD_UNLIKELY( err ) ) return err;
603 2 : return FD_BINCODE_SUCCESS;
604 2 : }
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 301 : static void fd_delegation_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
611 301 : fd_delegation_t * self = (fd_delegation_t *)struct_mem;
612 301 : fd_pubkey_decode_inner( &self->voter_pubkey, alloc_mem, ctx );
613 301 : fd_bincode_uint64_decode_unsafe( &self->stake, ctx );
614 301 : fd_bincode_uint64_decode_unsafe( &self->activation_epoch, ctx );
615 301 : fd_bincode_uint64_decode_unsafe( &self->deactivation_epoch, ctx );
616 301 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
617 301 : }
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 2 : int fd_stake_encode( fd_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
627 2 : int err;
628 2 : err = fd_delegation_encode( &self->delegation, ctx );
629 2 : if( FD_UNLIKELY( err ) ) return err;
630 2 : err = fd_bincode_uint64_encode( self->credits_observed, ctx );
631 2 : if( FD_UNLIKELY( err ) ) return err;
632 2 : return FD_BINCODE_SUCCESS;
633 2 : }
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 301 : static void fd_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
640 301 : fd_stake_t * self = (fd_stake_t *)struct_mem;
641 301 : fd_delegation_decode_inner( &self->delegation, alloc_mem, ctx );
642 301 : fd_bincode_uint64_decode_unsafe( &self->credits_observed, ctx );
643 301 : }
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 0 : int fd_rust_duration_encode( fd_rust_duration_t const * self, fd_bincode_encode_ctx_t * ctx ) {
653 0 : int err;
654 0 : err = fd_bincode_uint64_encode( self->seconds, ctx );
655 0 : if( FD_UNLIKELY( err ) ) return err;
656 0 : err = fd_bincode_uint32_encode( self->nanoseconds, ctx );
657 0 : if( FD_UNLIKELY( err ) ) return err;
658 0 : return FD_BINCODE_SUCCESS;
659 0 : }
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 0 : int fd_poh_config_encode( fd_poh_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
683 0 : int err;
684 0 : err = fd_rust_duration_encode( &self->target_tick_duration, ctx );
685 0 : if( FD_UNLIKELY( err ) ) return err;
686 0 : err = fd_bincode_bool_encode( self->has_target_tick_count, ctx );
687 0 : if( FD_UNLIKELY( err ) ) return err;
688 0 : 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 0 : err = fd_bincode_bool_encode( self->has_hashes_per_tick, ctx );
693 0 : if( FD_UNLIKELY( err ) ) return err;
694 0 : 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 0 : return FD_BINCODE_SUCCESS;
699 0 : }
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 0 : void fd_poh_config_new(fd_poh_config_t * self) {
808 0 : fd_memset( self, 0, sizeof(fd_poh_config_t) );
809 0 : fd_rust_duration_new( &self->target_tick_duration );
810 0 : }
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 0 : int fd_pubkey_account_pair_encode( fd_pubkey_account_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
954 0 : int err;
955 0 : err = fd_pubkey_encode( &self->key, ctx );
956 0 : if( FD_UNLIKELY( err ) ) return err;
957 0 : err = fd_solana_account_encode( &self->account, ctx );
958 0 : if( FD_UNLIKELY( err ) ) return err;
959 0 : return FD_BINCODE_SUCCESS;
960 0 : }
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 0 : int fd_genesis_solana_encode( fd_genesis_solana_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1032 0 : int err;
1033 0 : err = fd_bincode_uint64_encode( self->creation_time, ctx );
1034 0 : if( FD_UNLIKELY( err ) ) return err;
1035 0 : err = fd_bincode_uint64_encode( self->accounts_len, ctx );
1036 0 : if( FD_UNLIKELY(err) ) return err;
1037 0 : if( self->accounts_len ) {
1038 0 : for( ulong i=0; i < self->accounts_len; i++ ) {
1039 0 : err = fd_pubkey_account_pair_encode( self->accounts + i, ctx );
1040 0 : if( FD_UNLIKELY( err ) ) return err;
1041 0 : }
1042 0 : }
1043 0 : err = fd_bincode_uint64_encode( self->native_instruction_processors_len, ctx );
1044 0 : if( FD_UNLIKELY(err) ) return err;
1045 0 : 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 0 : err = fd_bincode_uint64_encode( self->rewards_pools_len, ctx );
1052 0 : if( FD_UNLIKELY(err) ) return err;
1053 0 : 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 0 : err = fd_bincode_uint64_encode( self->ticks_per_slot, ctx );
1060 0 : if( FD_UNLIKELY( err ) ) return err;
1061 0 : err = fd_bincode_uint64_encode( self->unused, ctx );
1062 0 : if( FD_UNLIKELY( err ) ) return err;
1063 0 : err = fd_poh_config_encode( &self->poh_config, ctx );
1064 0 : if( FD_UNLIKELY( err ) ) return err;
1065 0 : err = fd_bincode_uint64_encode( self->__backwards_compat_with_v0_23, ctx );
1066 0 : if( FD_UNLIKELY( err ) ) return err;
1067 0 : err = fd_fee_rate_governor_encode( &self->fee_rate_governor, ctx );
1068 0 : if( FD_UNLIKELY( err ) ) return err;
1069 0 : err = fd_rent_encode( &self->rent, ctx );
1070 0 : if( FD_UNLIKELY( err ) ) return err;
1071 0 : err = fd_inflation_encode( &self->inflation, ctx );
1072 0 : if( FD_UNLIKELY( err ) ) return err;
1073 0 : err = fd_epoch_schedule_encode( &self->epoch_schedule, ctx );
1074 0 : if( FD_UNLIKELY( err ) ) return err;
1075 0 : err = fd_bincode_uint32_encode( self->cluster_type, ctx );
1076 0 : if( FD_UNLIKELY( err ) ) return err;
1077 0 : return FD_BINCODE_SUCCESS;
1078 0 : }
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 0 : void fd_genesis_solana_new(fd_genesis_solana_t * self) {
1311 0 : fd_memset( self, 0, sizeof(fd_genesis_solana_t) );
1312 0 : fd_poh_config_new( &self->poh_config );
1313 0 : fd_fee_rate_governor_new( &self->fee_rate_governor );
1314 0 : fd_rent_new( &self->rent );
1315 0 : fd_inflation_new( &self->inflation );
1316 0 : fd_epoch_schedule_new( &self->epoch_schedule );
1317 0 : }
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 299 : int fd_sol_sysvar_clock_encode( fd_sol_sysvar_clock_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1382 299 : int err;
1383 299 : err = fd_bincode_uint64_encode( self->slot, ctx );
1384 299 : if( FD_UNLIKELY( err ) ) return err;
1385 299 : err = fd_bincode_uint64_encode( (ulong)self->epoch_start_timestamp, ctx );
1386 299 : if( FD_UNLIKELY( err ) ) return err;
1387 299 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1388 299 : if( FD_UNLIKELY( err ) ) return err;
1389 299 : err = fd_bincode_uint64_encode( self->leader_schedule_epoch, ctx );
1390 299 : if( FD_UNLIKELY( err ) ) return err;
1391 299 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
1392 299 : if( FD_UNLIKELY( err ) ) return err;
1393 299 : return FD_BINCODE_SUCCESS;
1394 299 : }
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 30752 : static void fd_sol_sysvar_clock_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1401 30752 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)struct_mem;
1402 30752 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1403 30752 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->epoch_start_timestamp, ctx );
1404 30752 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1405 30752 : fd_bincode_uint64_decode_unsafe( &self->leader_schedule_epoch, ctx );
1406 30752 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
1407 30752 : }
1408 30754 : void * fd_sol_sysvar_clock_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1409 30754 : fd_sol_sysvar_clock_t * self = (fd_sol_sysvar_clock_t *)mem;
1410 30754 : fd_sol_sysvar_clock_new( self );
1411 30754 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_clock_t);
1412 30754 : void * * alloc_mem = &alloc_region;
1413 30754 : fd_sol_sysvar_clock_decode_inner( mem, alloc_mem, ctx );
1414 30754 : return self;
1415 30754 : }
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 30762 : static void fd_sol_sysvar_last_restart_slot_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1428 30762 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)struct_mem;
1429 30762 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1430 30762 : }
1431 30766 : void * fd_sol_sysvar_last_restart_slot_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1432 30766 : fd_sol_sysvar_last_restart_slot_t * self = (fd_sol_sysvar_last_restart_slot_t *)mem;
1433 30766 : fd_sol_sysvar_last_restart_slot_new( self );
1434 30766 : void * alloc_region = (uchar *)mem + sizeof(fd_sol_sysvar_last_restart_slot_t);
1435 30766 : void * * alloc_mem = &alloc_region;
1436 30766 : fd_sol_sysvar_last_restart_slot_decode_inner( mem, alloc_mem, ctx );
1437 30766 : return self;
1438 30766 : }
1439 9692 : int fd_vote_lockout_encode( fd_vote_lockout_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1440 9692 : int err;
1441 9692 : err = fd_bincode_uint64_encode( self->slot, ctx );
1442 9692 : if( FD_UNLIKELY( err ) ) return err;
1443 9692 : err = fd_bincode_uint32_encode( self->confirmation_count, ctx );
1444 9692 : if( FD_UNLIKELY( err ) ) return err;
1445 9692 : return FD_BINCODE_SUCCESS;
1446 9692 : }
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 15160 : static void fd_vote_lockout_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1453 15160 : fd_vote_lockout_t * self = (fd_vote_lockout_t *)struct_mem;
1454 15160 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1455 15160 : fd_bincode_uint32_decode_unsafe( &self->confirmation_count, ctx );
1456 15160 : }
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 21659 : static int fd_lockout_offset_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1474 21659 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1475 21648 : int err = 0;
1476 21648 : err = fd_bincode_varint_decode_footprint( ctx );
1477 21648 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1478 21602 : err = fd_bincode_uint8_decode_footprint( ctx );
1479 21602 : if( FD_UNLIKELY( err ) ) return err;
1480 21594 : return 0;
1481 21602 : }
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 23073 : static void fd_lockout_offset_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1491 23073 : fd_lockout_offset_t * self = (fd_lockout_offset_t *)struct_mem;
1492 23073 : fd_bincode_varint_decode_unsafe( &self->offset, ctx );
1493 23073 : fd_bincode_uint8_decode_unsafe( &self->confirmation_count, ctx );
1494 23073 : }
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 1435 : void fd_lockout_offset_new(fd_lockout_offset_t * self) {
1504 1435 : fd_memset( self, 0, sizeof(fd_lockout_offset_t) );
1505 1435 : }
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 659 : int fd_vote_authorized_voter_encode( fd_vote_authorized_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1514 659 : int err;
1515 659 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1516 659 : if( FD_UNLIKELY( err ) ) return err;
1517 659 : err = fd_pubkey_encode( &self->pubkey, ctx );
1518 659 : if( FD_UNLIKELY( err ) ) return err;
1519 659 : return FD_BINCODE_SUCCESS;
1520 659 : }
1521 6914 : static inline int fd_vote_authorized_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1522 6914 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1523 6851 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
1524 6851 : return 0;
1525 6914 : }
1526 784 : static void fd_vote_authorized_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1527 784 : fd_vote_authorized_voter_t * self = (fd_vote_authorized_voter_t *)struct_mem;
1528 784 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1529 784 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1530 784 : }
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 1600 : int fd_vote_prior_voter_encode( fd_vote_prior_voter_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1540 1600 : int err;
1541 1600 : err = fd_pubkey_encode( &self->pubkey, ctx );
1542 1600 : if( FD_UNLIKELY( err ) ) return err;
1543 1600 : err = fd_bincode_uint64_encode( self->epoch_start, ctx );
1544 1600 : if( FD_UNLIKELY( err ) ) return err;
1545 1600 : err = fd_bincode_uint64_encode( self->epoch_end, ctx );
1546 1600 : if( FD_UNLIKELY( err ) ) return err;
1547 1600 : return FD_BINCODE_SUCCESS;
1548 1600 : }
1549 8880 : static inline int fd_vote_prior_voter_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1550 8880 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1551 8762 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
1552 8762 : return 0;
1553 8880 : }
1554 5504 : static void fd_vote_prior_voter_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1555 5504 : fd_vote_prior_voter_t * self = (fd_vote_prior_voter_t *)struct_mem;
1556 5504 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
1557 5504 : fd_bincode_uint64_decode_unsafe( &self->epoch_start, ctx );
1558 5504 : fd_bincode_uint64_decode_unsafe( &self->epoch_end, ctx );
1559 5504 : }
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 2754 : int fd_vote_epoch_credits_encode( fd_vote_epoch_credits_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1569 2754 : int err;
1570 2754 : err = fd_bincode_uint64_encode( self->epoch, ctx );
1571 2754 : if( FD_UNLIKELY( err ) ) return err;
1572 2754 : err = fd_bincode_uint64_encode( self->credits, ctx );
1573 2754 : if( FD_UNLIKELY( err ) ) return err;
1574 2754 : err = fd_bincode_uint64_encode( self->prev_credits, ctx );
1575 2754 : if( FD_UNLIKELY( err ) ) return err;
1576 2754 : return FD_BINCODE_SUCCESS;
1577 2754 : }
1578 0 : static inline int fd_vote_epoch_credits_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1579 0 : if( (ulong)ctx->data + 24UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1580 0 : ctx->data = (void *)( (ulong)ctx->data + 24UL );
1581 0 : return 0;
1582 0 : }
1583 4136 : static void fd_vote_epoch_credits_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1584 4136 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)struct_mem;
1585 4136 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
1586 4136 : fd_bincode_uint64_decode_unsafe( &self->credits, ctx );
1587 4136 : fd_bincode_uint64_decode_unsafe( &self->prev_credits, ctx );
1588 4136 : }
1589 0 : void * fd_vote_epoch_credits_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1590 0 : fd_vote_epoch_credits_t * self = (fd_vote_epoch_credits_t *)mem;
1591 0 : fd_vote_epoch_credits_new( self );
1592 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_epoch_credits_t);
1593 0 : void * * alloc_mem = &alloc_region;
1594 0 : fd_vote_epoch_credits_decode_inner( mem, alloc_mem, ctx );
1595 0 : return self;
1596 0 : }
1597 349 : int fd_vote_block_timestamp_encode( fd_vote_block_timestamp_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1598 349 : int err;
1599 349 : err = fd_bincode_uint64_encode( self->slot, ctx );
1600 349 : if( FD_UNLIKELY( err ) ) return err;
1601 349 : err = fd_bincode_uint64_encode( (ulong)self->timestamp, ctx );
1602 349 : if( FD_UNLIKELY( err ) ) return err;
1603 349 : return FD_BINCODE_SUCCESS;
1604 349 : }
1605 1080 : static inline int fd_vote_block_timestamp_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1606 1080 : if( (ulong)ctx->data + 16UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1607 1069 : ctx->data = (void *)( (ulong)ctx->data + 16UL );
1608 1069 : return 0;
1609 1080 : }
1610 472 : static void fd_vote_block_timestamp_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1611 472 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)struct_mem;
1612 472 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
1613 472 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->timestamp, ctx );
1614 472 : }
1615 0 : void * fd_vote_block_timestamp_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1616 0 : fd_vote_block_timestamp_t * self = (fd_vote_block_timestamp_t *)mem;
1617 0 : fd_vote_block_timestamp_new( self );
1618 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_block_timestamp_t);
1619 0 : void * * alloc_mem = &alloc_region;
1620 0 : fd_vote_block_timestamp_decode_inner( mem, alloc_mem, ctx );
1621 0 : return self;
1622 0 : }
1623 50 : int fd_vote_prior_voters_encode( fd_vote_prior_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1624 50 : int err;
1625 1650 : for( ulong i=0; i<32; i++ ) {
1626 1600 : err = fd_vote_prior_voter_encode( self->buf + i, ctx );
1627 1600 : if( FD_UNLIKELY( err ) ) return err;
1628 1600 : }
1629 50 : err = fd_bincode_uint64_encode( self->idx, ctx );
1630 50 : if( FD_UNLIKELY( err ) ) return err;
1631 50 : err = fd_bincode_bool_encode( (uchar)(self->is_empty), ctx );
1632 50 : if( FD_UNLIKELY( err ) ) return err;
1633 50 : return FD_BINCODE_SUCCESS;
1634 50 : }
1635 335 : static int fd_vote_prior_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1636 335 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1637 335 : int err = 0;
1638 9097 : for( ulong i=0; i<32; i++ ) {
1639 8880 : err = fd_vote_prior_voter_decode_footprint_inner( ctx, total_sz );
1640 8880 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1641 8880 : }
1642 217 : err = fd_bincode_uint64_decode_footprint( ctx );
1643 217 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1644 212 : err = fd_bincode_bool_decode_footprint( ctx );
1645 212 : if( FD_UNLIKELY( err ) ) return err;
1646 198 : return 0;
1647 212 : }
1648 0 : int fd_vote_prior_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1649 0 : *total_sz += sizeof(fd_vote_prior_voters_t);
1650 0 : void const * start_data = ctx->data;
1651 0 : int err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
1652 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1653 0 : ctx->data = start_data;
1654 0 : return err;
1655 0 : }
1656 172 : static void fd_vote_prior_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1657 172 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)struct_mem;
1658 5676 : for( ulong i=0; i<32; i++ ) {
1659 5504 : fd_vote_prior_voter_decode_inner( self->buf + i, alloc_mem, ctx );
1660 5504 : }
1661 172 : fd_bincode_uint64_decode_unsafe( &self->idx, ctx );
1662 172 : fd_bincode_bool_decode_unsafe( &self->is_empty, ctx );
1663 172 : }
1664 0 : void * fd_vote_prior_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1665 0 : fd_vote_prior_voters_t * self = (fd_vote_prior_voters_t *)mem;
1666 0 : fd_vote_prior_voters_new( self );
1667 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_prior_voters_t);
1668 0 : void * * alloc_mem = &alloc_region;
1669 0 : fd_vote_prior_voters_decode_inner( mem, alloc_mem, ctx );
1670 0 : return self;
1671 0 : }
1672 24 : void fd_vote_prior_voters_new(fd_vote_prior_voters_t * self) {
1673 24 : fd_memset( self, 0, sizeof(fd_vote_prior_voters_t) );
1674 792 : for( ulong i=0; i<32; i++ )
1675 768 : fd_vote_prior_voter_new( self->buf + i );
1676 24 : }
1677 9651 : int fd_landed_vote_encode( fd_landed_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1678 9651 : int err;
1679 9651 : err = fd_bincode_uint8_encode( (uchar)(self->latency), ctx );
1680 9651 : if( FD_UNLIKELY( err ) ) return err;
1681 9651 : err = fd_vote_lockout_encode( &self->lockout, ctx );
1682 9651 : if( FD_UNLIKELY( err ) ) return err;
1683 9651 : return FD_BINCODE_SUCCESS;
1684 9651 : }
1685 0 : static inline int fd_landed_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1686 0 : if( (ulong)ctx->data + 13UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1687 0 : ctx->data = (void *)( (ulong)ctx->data + 13UL );
1688 0 : return 0;
1689 0 : }
1690 10097 : static void fd_landed_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1691 10097 : fd_landed_vote_t * self = (fd_landed_vote_t *)struct_mem;
1692 10097 : fd_bincode_uint8_decode_unsafe( &self->latency, ctx );
1693 10097 : fd_vote_lockout_decode_inner( &self->lockout, alloc_mem, ctx );
1694 10097 : }
1695 0 : void * fd_landed_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1696 0 : fd_landed_vote_t * self = (fd_landed_vote_t *)mem;
1697 0 : fd_landed_vote_new( self );
1698 0 : void * alloc_region = (uchar *)mem + sizeof(fd_landed_vote_t);
1699 0 : void * * alloc_mem = &alloc_region;
1700 0 : fd_landed_vote_decode_inner( mem, alloc_mem, ctx );
1701 0 : return self;
1702 0 : }
1703 0 : int fd_bls_pubkey_compressed_encode( fd_bls_pubkey_compressed_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1704 0 : int err;
1705 0 : err = fd_bincode_bytes_encode( self->buf, 48, ctx );
1706 0 : if( FD_UNLIKELY( err ) ) return err;
1707 0 : return FD_BINCODE_SUCCESS;
1708 0 : }
1709 0 : static inline int fd_bls_pubkey_compressed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1710 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1711 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
1712 0 : return 0;
1713 0 : }
1714 0 : static void fd_bls_pubkey_compressed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1715 0 : fd_bls_pubkey_compressed_t * self = (fd_bls_pubkey_compressed_t *)struct_mem;
1716 0 : fd_bincode_bytes_decode_unsafe( self->buf, 48, ctx );
1717 0 : }
1718 0 : void * fd_bls_pubkey_compressed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1719 0 : fd_bls_pubkey_compressed_t * self = (fd_bls_pubkey_compressed_t *)mem;
1720 0 : fd_bls_pubkey_compressed_new( self );
1721 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bls_pubkey_compressed_t);
1722 0 : void * * alloc_mem = &alloc_region;
1723 0 : fd_bls_pubkey_compressed_decode_inner( mem, alloc_mem, ctx );
1724 0 : return self;
1725 0 : }
1726 0 : int fd_bls_proof_of_possession_encode( fd_bls_proof_of_possession_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1727 0 : int err;
1728 0 : err = fd_bincode_bytes_encode( self->buf, 96, ctx );
1729 0 : if( FD_UNLIKELY( err ) ) return err;
1730 0 : return FD_BINCODE_SUCCESS;
1731 0 : }
1732 0 : static inline int fd_bls_proof_of_possession_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1733 0 : if( (ulong)ctx->data + 96UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1734 0 : ctx->data = (void *)( (ulong)ctx->data + 96UL );
1735 0 : return 0;
1736 0 : }
1737 0 : static void fd_bls_proof_of_possession_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1738 0 : fd_bls_proof_of_possession_t * self = (fd_bls_proof_of_possession_t *)struct_mem;
1739 0 : fd_bincode_bytes_decode_unsafe( self->buf, 96, ctx );
1740 0 : }
1741 0 : void * fd_bls_proof_of_possession_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1742 0 : fd_bls_proof_of_possession_t * self = (fd_bls_proof_of_possession_t *)mem;
1743 0 : fd_bls_proof_of_possession_new( self );
1744 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bls_proof_of_possession_t);
1745 0 : void * * alloc_mem = &alloc_region;
1746 0 : fd_bls_proof_of_possession_decode_inner( mem, alloc_mem, ctx );
1747 0 : return self;
1748 0 : }
1749 350 : int fd_vote_authorized_voters_encode( fd_vote_authorized_voters_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1750 350 : int err;
1751 350 : if( self->treap ) {
1752 346 : ulong fd_vote_authorized_voters_len = fd_vote_authorized_voters_treap_ele_cnt( self->treap );
1753 346 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
1754 346 : if( FD_UNLIKELY( err ) ) return err;
1755 346 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
1756 1005 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
1757 659 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
1758 659 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
1759 659 : err = fd_vote_authorized_voter_encode( ele, ctx );
1760 659 : if( FD_UNLIKELY( err ) ) return err;
1761 659 : }
1762 346 : } else {
1763 4 : ulong fd_vote_authorized_voters_len = 0;
1764 4 : err = fd_bincode_uint64_encode( fd_vote_authorized_voters_len, ctx );
1765 4 : if( FD_UNLIKELY( err ) ) return err;
1766 4 : }
1767 350 : return FD_BINCODE_SUCCESS;
1768 350 : }
1769 1300 : static int fd_vote_authorized_voters_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1770 1300 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1771 1300 : int err = 0;
1772 1300 : ulong fd_vote_authorized_voters_treap_len;
1773 1300 : err = fd_bincode_uint64_decode( &fd_vote_authorized_voters_treap_len, ctx );
1774 1300 : if( FD_UNLIKELY( err ) ) return err;
1775 1295 : 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 );
1776 1295 : *total_sz += fd_vote_authorized_voters_pool_align() + fd_vote_authorized_voters_pool_footprint( fd_vote_authorized_voters_treap_max );
1777 1295 : *total_sz += fd_vote_authorized_voters_treap_align() + fd_vote_authorized_voters_treap_footprint( fd_vote_authorized_voters_treap_max );
1778 8146 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
1779 6914 : err = fd_vote_authorized_voter_decode_footprint_inner( ctx, total_sz );
1780 6914 : if( FD_UNLIKELY ( err ) ) return err;
1781 6914 : }
1782 1232 : return 0;
1783 1295 : }
1784 0 : int fd_vote_authorized_voters_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1785 0 : *total_sz += sizeof(fd_vote_authorized_voters_t);
1786 0 : void const * start_data = ctx->data;
1787 0 : int err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
1788 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1789 0 : ctx->data = start_data;
1790 0 : return err;
1791 0 : }
1792 472 : static void fd_vote_authorized_voters_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1793 472 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)struct_mem;
1794 472 : ulong fd_vote_authorized_voters_treap_len;
1795 472 : fd_bincode_uint64_decode_unsafe( &fd_vote_authorized_voters_treap_len, ctx );
1796 472 : ulong fd_vote_authorized_voters_treap_max = fd_ulong_max( fd_vote_authorized_voters_treap_len, FD_VOTE_AUTHORIZED_VOTERS_MIN );
1797 472 : self->pool = fd_vote_authorized_voters_pool_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
1798 472 : self->treap = fd_vote_authorized_voters_treap_join_new( alloc_mem, fd_vote_authorized_voters_treap_max );
1799 1256 : for( ulong i=0; i < fd_vote_authorized_voters_treap_len; i++ ) {
1800 784 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_pool_ele_acquire( self->pool );
1801 784 : fd_vote_authorized_voter_new( ele );
1802 784 : fd_vote_authorized_voter_decode_inner( ele, alloc_mem, ctx );
1803 784 : fd_vote_authorized_voter_t * repeated_entry = fd_vote_authorized_voters_treap_ele_query( self->treap, ele->epoch, self->pool );
1804 784 : if( repeated_entry ) {
1805 1 : fd_vote_authorized_voters_treap_ele_remove( self->treap, repeated_entry, self->pool ); // Remove the element before inserting it back to avoid duplication
1806 1 : fd_vote_authorized_voters_pool_ele_release( self->pool, repeated_entry );
1807 1 : }
1808 784 : fd_vote_authorized_voters_treap_ele_insert( self->treap, ele, self->pool ); /* this cannot fail */
1809 784 : }
1810 472 : }
1811 0 : void * fd_vote_authorized_voters_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1812 0 : fd_vote_authorized_voters_t * self = (fd_vote_authorized_voters_t *)mem;
1813 0 : fd_vote_authorized_voters_new( self );
1814 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorized_voters_t);
1815 0 : void * * alloc_mem = &alloc_region;
1816 0 : fd_vote_authorized_voters_decode_inner( mem, alloc_mem, ctx );
1817 0 : return self;
1818 0 : }
1819 24 : void fd_vote_authorized_voters_new(fd_vote_authorized_voters_t * self) {
1820 24 : fd_memset( self, 0, sizeof(fd_vote_authorized_voters_t) );
1821 24 : }
1822 352 : ulong fd_vote_authorized_voters_size( fd_vote_authorized_voters_t const * self ) {
1823 352 : ulong size = 0;
1824 352 : size += sizeof(ulong);
1825 352 : if( self->treap ) {
1826 348 : for( fd_vote_authorized_voters_treap_fwd_iter_t iter = fd_vote_authorized_voters_treap_fwd_iter_init( self->treap, self->pool );
1827 1012 : !fd_vote_authorized_voters_treap_fwd_iter_done( iter );
1828 664 : iter = fd_vote_authorized_voters_treap_fwd_iter_next( iter, self->pool ) ) {
1829 664 : fd_vote_authorized_voter_t * ele = fd_vote_authorized_voters_treap_fwd_iter_ele( iter, self->pool );
1830 664 : size += fd_vote_authorized_voter_size( ele );
1831 664 : }
1832 348 : }
1833 352 : return size;
1834 352 : }
1835 :
1836 5 : int fd_vote_state_1_14_11_encode( fd_vote_state_1_14_11_t const * self, fd_bincode_encode_ctx_t * ctx ) {
1837 5 : int err;
1838 5 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
1839 5 : if( FD_UNLIKELY( err ) ) return err;
1840 5 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
1841 5 : if( FD_UNLIKELY( err ) ) return err;
1842 5 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
1843 5 : if( FD_UNLIKELY( err ) ) return err;
1844 5 : if( self->votes ) {
1845 5 : ulong votes_len = deq_fd_vote_lockout_t_cnt( self->votes );
1846 5 : err = fd_bincode_uint64_encode( votes_len, ctx );
1847 5 : if( FD_UNLIKELY( err ) ) return err;
1848 46 : 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 ) ) {
1849 41 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->votes, iter );
1850 41 : err = fd_vote_lockout_encode( ele, ctx );
1851 41 : if( FD_UNLIKELY( err ) ) return err;
1852 41 : }
1853 5 : } else {
1854 0 : ulong votes_len = 0;
1855 0 : err = fd_bincode_uint64_encode( votes_len, ctx );
1856 0 : if( FD_UNLIKELY( err ) ) return err;
1857 0 : }
1858 5 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
1859 5 : if( FD_UNLIKELY( err ) ) return err;
1860 5 : if( self->has_root_slot ) {
1861 2 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
1862 2 : if( FD_UNLIKELY( err ) ) return err;
1863 2 : }
1864 5 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
1865 5 : if( FD_UNLIKELY( err ) ) return err;
1866 5 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
1867 5 : if( FD_UNLIKELY( err ) ) return err;
1868 5 : if( self->epoch_credits ) {
1869 5 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
1870 5 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
1871 5 : if( FD_UNLIKELY( err ) ) return err;
1872 138 : 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 ) ) {
1873 133 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
1874 133 : err = fd_vote_epoch_credits_encode( ele, ctx );
1875 133 : if( FD_UNLIKELY( err ) ) return err;
1876 133 : }
1877 5 : } else {
1878 0 : ulong epoch_credits_len = 0;
1879 0 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
1880 0 : if( FD_UNLIKELY( err ) ) return err;
1881 0 : }
1882 5 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
1883 5 : if( FD_UNLIKELY( err ) ) return err;
1884 5 : return FD_BINCODE_SUCCESS;
1885 5 : }
1886 204 : static int fd_vote_state_1_14_11_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1887 204 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1888 204 : int err = 0;
1889 204 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1890 204 : if( FD_UNLIKELY( err ) ) return err;
1891 201 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
1892 201 : if( FD_UNLIKELY( err ) ) return err;
1893 195 : err = fd_bincode_uint8_decode_footprint( ctx );
1894 195 : if( FD_UNLIKELY( err ) ) return err;
1895 193 : ulong votes_len;
1896 193 : err = fd_bincode_uint64_decode( &votes_len, ctx );
1897 193 : if( FD_UNLIKELY( err ) ) return err;
1898 190 : ulong votes_max = fd_ulong_max( votes_len, 32 );
1899 190 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( votes_max );
1900 190 : ulong votes_sz;
1901 190 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 12, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
1902 186 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
1903 186 : if( FD_UNLIKELY( err ) ) return err;
1904 183 : {
1905 183 : uchar o;
1906 183 : err = fd_bincode_bool_decode( &o, ctx );
1907 183 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1908 176 : if( o ) {
1909 80 : err = fd_bincode_uint64_decode_footprint( ctx );
1910 80 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
1911 80 : }
1912 176 : }
1913 174 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
1914 174 : if( FD_UNLIKELY( err ) ) return err;
1915 153 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
1916 153 : if( FD_UNLIKELY( err ) ) return err;
1917 82 : ulong epoch_credits_len;
1918 82 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
1919 82 : if( FD_UNLIKELY( err ) ) return err;
1920 79 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
1921 79 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
1922 79 : ulong epoch_credits_sz;
1923 79 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
1924 77 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
1925 77 : if( FD_UNLIKELY( err ) ) return err;
1926 75 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
1927 75 : if( FD_UNLIKELY( err ) ) return err;
1928 70 : return 0;
1929 75 : }
1930 0 : int fd_vote_state_1_14_11_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
1931 0 : *total_sz += sizeof(fd_vote_state_1_14_11_t);
1932 0 : void const * start_data = ctx->data;
1933 0 : int err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
1934 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
1935 0 : ctx->data = start_data;
1936 0 : return err;
1937 0 : }
1938 70 : static void fd_vote_state_1_14_11_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
1939 70 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)struct_mem;
1940 70 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
1941 70 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
1942 70 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
1943 70 : ulong votes_len;
1944 70 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
1945 70 : ulong votes_max = fd_ulong_max( votes_len, 32 );
1946 70 : self->votes = deq_fd_vote_lockout_t_join_new( alloc_mem, votes_max );
1947 1280 : for( ulong i=0; i < votes_len; i++ ) {
1948 1210 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->votes );
1949 1210 : fd_vote_lockout_new( elem );
1950 1210 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
1951 1210 : }
1952 70 : {
1953 70 : uchar o;
1954 70 : fd_bincode_bool_decode_unsafe( &o, ctx );
1955 70 : self->has_root_slot = !!o;
1956 70 : if( o ) {
1957 44 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
1958 44 : }
1959 70 : }
1960 70 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
1961 70 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
1962 70 : ulong epoch_credits_len;
1963 70 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
1964 70 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
1965 70 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
1966 1097 : for( ulong i=0; i < epoch_credits_len; i++ ) {
1967 1027 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
1968 1027 : fd_vote_epoch_credits_new( elem );
1969 1027 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
1970 1027 : }
1971 70 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
1972 70 : }
1973 0 : void * fd_vote_state_1_14_11_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
1974 0 : fd_vote_state_1_14_11_t * self = (fd_vote_state_1_14_11_t *)mem;
1975 0 : fd_vote_state_1_14_11_new( self );
1976 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_1_14_11_t);
1977 0 : void * * alloc_mem = &alloc_region;
1978 0 : fd_vote_state_1_14_11_decode_inner( mem, alloc_mem, ctx );
1979 0 : return self;
1980 0 : }
1981 17 : void fd_vote_state_1_14_11_new(fd_vote_state_1_14_11_t * self) {
1982 17 : fd_memset( self, 0, sizeof(fd_vote_state_1_14_11_t) );
1983 17 : fd_pubkey_new( &self->node_pubkey );
1984 17 : fd_pubkey_new( &self->authorized_withdrawer );
1985 17 : fd_vote_authorized_voters_new( &self->authorized_voters );
1986 17 : fd_vote_prior_voters_new( &self->prior_voters );
1987 17 : fd_vote_block_timestamp_new( &self->last_timestamp );
1988 17 : }
1989 7 : ulong fd_vote_state_1_14_11_size( fd_vote_state_1_14_11_t const * self ) {
1990 7 : ulong size = 0;
1991 7 : size += fd_pubkey_size( &self->node_pubkey );
1992 7 : size += fd_pubkey_size( &self->authorized_withdrawer );
1993 7 : size += sizeof(char);
1994 7 : if( self->votes ) {
1995 7 : size += sizeof(ulong);
1996 63 : 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 ) ) {
1997 56 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->votes, iter );
1998 56 : size += fd_vote_lockout_size( ele );
1999 56 : }
2000 7 : } else {
2001 0 : size += sizeof(ulong);
2002 0 : }
2003 7 : size += sizeof(char);
2004 7 : if( self->has_root_slot ) {
2005 2 : size += sizeof(ulong);
2006 2 : }
2007 7 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2008 7 : size += fd_vote_prior_voters_size( &self->prior_voters );
2009 7 : if( self->epoch_credits ) {
2010 7 : size += sizeof(ulong);
2011 151 : 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 ) ) {
2012 144 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2013 144 : size += fd_vote_epoch_credits_size( ele );
2014 144 : }
2015 7 : } else {
2016 0 : size += sizeof(ulong);
2017 0 : }
2018 7 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2019 7 : return size;
2020 7 : }
2021 :
2022 45 : int fd_vote_state_v3_encode( fd_vote_state_v3_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2023 45 : int err;
2024 45 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2025 45 : if( FD_UNLIKELY( err ) ) return err;
2026 45 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2027 45 : if( FD_UNLIKELY( err ) ) return err;
2028 45 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
2029 45 : if( FD_UNLIKELY( err ) ) return err;
2030 45 : if( self->votes ) {
2031 39 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
2032 39 : err = fd_bincode_uint64_encode( votes_len, ctx );
2033 39 : if( FD_UNLIKELY( err ) ) return err;
2034 418 : 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 ) ) {
2035 379 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
2036 379 : err = fd_landed_vote_encode( ele, ctx );
2037 379 : if( FD_UNLIKELY( err ) ) return err;
2038 379 : }
2039 39 : } else {
2040 6 : ulong votes_len = 0;
2041 6 : err = fd_bincode_uint64_encode( votes_len, ctx );
2042 6 : if( FD_UNLIKELY( err ) ) return err;
2043 6 : }
2044 45 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2045 45 : if( FD_UNLIKELY( err ) ) return err;
2046 45 : if( self->has_root_slot ) {
2047 12 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2048 12 : if( FD_UNLIKELY( err ) ) return err;
2049 12 : }
2050 45 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2051 45 : if( FD_UNLIKELY( err ) ) return err;
2052 45 : err = fd_vote_prior_voters_encode( &self->prior_voters, ctx );
2053 45 : if( FD_UNLIKELY( err ) ) return err;
2054 45 : if( self->epoch_credits ) {
2055 39 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2056 39 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2057 39 : if( FD_UNLIKELY( err ) ) return err;
2058 520 : 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 ) ) {
2059 481 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2060 481 : err = fd_vote_epoch_credits_encode( ele, ctx );
2061 481 : if( FD_UNLIKELY( err ) ) return err;
2062 481 : }
2063 39 : } else {
2064 6 : ulong epoch_credits_len = 0;
2065 6 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2066 6 : if( FD_UNLIKELY( err ) ) return err;
2067 6 : }
2068 45 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2069 45 : if( FD_UNLIKELY( err ) ) return err;
2070 45 : return FD_BINCODE_SUCCESS;
2071 45 : }
2072 269 : static int fd_vote_state_v3_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2073 269 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2074 269 : int err = 0;
2075 269 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2076 269 : if( FD_UNLIKELY( err ) ) return err;
2077 260 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2078 260 : if( FD_UNLIKELY( err ) ) return err;
2079 256 : err = fd_bincode_uint8_decode_footprint( ctx );
2080 256 : if( FD_UNLIKELY( err ) ) return err;
2081 253 : ulong votes_len;
2082 253 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2083 253 : if( FD_UNLIKELY( err ) ) return err;
2084 251 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2085 251 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
2086 251 : ulong votes_sz;
2087 251 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2088 239 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2089 239 : if( FD_UNLIKELY( err ) ) return err;
2090 238 : {
2091 238 : uchar o;
2092 238 : err = fd_bincode_bool_decode( &o, ctx );
2093 238 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2094 232 : if( o ) {
2095 66 : err = fd_bincode_uint64_decode_footprint( ctx );
2096 66 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2097 66 : }
2098 232 : }
2099 229 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2100 229 : if( FD_UNLIKELY( err ) ) return err;
2101 182 : err = fd_vote_prior_voters_decode_footprint_inner( ctx, total_sz );
2102 182 : if( FD_UNLIKELY( err ) ) return err;
2103 116 : ulong epoch_credits_len;
2104 116 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2105 116 : if( FD_UNLIKELY( err ) ) return err;
2106 113 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2107 113 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2108 113 : ulong epoch_credits_sz;
2109 113 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2110 111 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2111 111 : if( FD_UNLIKELY( err ) ) return err;
2112 108 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2113 108 : if( FD_UNLIKELY( err ) ) return err;
2114 102 : return 0;
2115 108 : }
2116 0 : int fd_vote_state_v3_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2117 0 : *total_sz += sizeof(fd_vote_state_v3_t);
2118 0 : void const * start_data = ctx->data;
2119 0 : int err = fd_vote_state_v3_decode_footprint_inner( ctx, total_sz );
2120 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2121 0 : ctx->data = start_data;
2122 0 : return err;
2123 0 : }
2124 102 : static void fd_vote_state_v3_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2125 102 : fd_vote_state_v3_t * self = (fd_vote_state_v3_t *)struct_mem;
2126 102 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2127 102 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2128 102 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
2129 102 : ulong votes_len;
2130 102 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2131 102 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2132 102 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
2133 899 : for( ulong i=0; i < votes_len; i++ ) {
2134 797 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
2135 797 : fd_landed_vote_new( elem );
2136 797 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
2137 797 : }
2138 102 : {
2139 102 : uchar o;
2140 102 : fd_bincode_bool_decode_unsafe( &o, ctx );
2141 102 : self->has_root_slot = !!o;
2142 102 : if( o ) {
2143 27 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2144 27 : }
2145 102 : }
2146 102 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2147 102 : fd_vote_prior_voters_decode_inner( &self->prior_voters, alloc_mem, ctx );
2148 102 : ulong epoch_credits_len;
2149 102 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2150 102 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2151 102 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2152 1078 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2153 976 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2154 976 : fd_vote_epoch_credits_new( elem );
2155 976 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2156 976 : }
2157 102 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2158 102 : }
2159 0 : void * fd_vote_state_v3_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2160 0 : fd_vote_state_v3_t * self = (fd_vote_state_v3_t *)mem;
2161 0 : fd_vote_state_v3_new( self );
2162 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_v3_t);
2163 0 : void * * alloc_mem = &alloc_region;
2164 0 : fd_vote_state_v3_decode_inner( mem, alloc_mem, ctx );
2165 0 : return self;
2166 0 : }
2167 7 : void fd_vote_state_v3_new(fd_vote_state_v3_t * self) {
2168 7 : fd_memset( self, 0, sizeof(fd_vote_state_v3_t) );
2169 7 : fd_pubkey_new( &self->node_pubkey );
2170 7 : fd_pubkey_new( &self->authorized_withdrawer );
2171 7 : fd_vote_authorized_voters_new( &self->authorized_voters );
2172 7 : fd_vote_prior_voters_new( &self->prior_voters );
2173 7 : fd_vote_block_timestamp_new( &self->last_timestamp );
2174 7 : }
2175 45 : ulong fd_vote_state_v3_size( fd_vote_state_v3_t const * self ) {
2176 45 : ulong size = 0;
2177 45 : size += fd_pubkey_size( &self->node_pubkey );
2178 45 : size += fd_pubkey_size( &self->authorized_withdrawer );
2179 45 : size += sizeof(char);
2180 45 : if( self->votes ) {
2181 39 : size += sizeof(ulong);
2182 418 : 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 ) ) {
2183 379 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
2184 379 : size += fd_landed_vote_size( ele );
2185 379 : }
2186 39 : } else {
2187 6 : size += sizeof(ulong);
2188 6 : }
2189 45 : size += sizeof(char);
2190 45 : if( self->has_root_slot ) {
2191 12 : size += sizeof(ulong);
2192 12 : }
2193 45 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2194 45 : size += fd_vote_prior_voters_size( &self->prior_voters );
2195 45 : if( self->epoch_credits ) {
2196 39 : size += sizeof(ulong);
2197 520 : 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 ) ) {
2198 481 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2199 481 : size += fd_vote_epoch_credits_size( ele );
2200 481 : }
2201 39 : } else {
2202 6 : size += sizeof(ulong);
2203 6 : }
2204 45 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2205 45 : return size;
2206 45 : }
2207 :
2208 299 : int fd_vote_state_v4_encode( fd_vote_state_v4_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2209 299 : int err;
2210 299 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
2211 299 : if( FD_UNLIKELY( err ) ) return err;
2212 299 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
2213 299 : if( FD_UNLIKELY( err ) ) return err;
2214 299 : err = fd_pubkey_encode( &self->inflation_rewards_collector, ctx );
2215 299 : if( FD_UNLIKELY( err ) ) return err;
2216 299 : err = fd_pubkey_encode( &self->block_revenue_collector, ctx );
2217 299 : if( FD_UNLIKELY( err ) ) return err;
2218 299 : err = fd_bincode_uint16_encode( self->inflation_rewards_commission_bps, ctx );
2219 299 : if( FD_UNLIKELY( err ) ) return err;
2220 299 : err = fd_bincode_uint16_encode( self->block_revenue_commission_bps, ctx );
2221 299 : if( FD_UNLIKELY( err ) ) return err;
2222 299 : err = fd_bincode_uint64_encode( self->pending_delegator_rewards, ctx );
2223 299 : if( FD_UNLIKELY( err ) ) return err;
2224 299 : err = fd_bincode_bool_encode( self->has_bls_pubkey_compressed, ctx );
2225 299 : if( FD_UNLIKELY( err ) ) return err;
2226 299 : if( self->has_bls_pubkey_compressed ) {
2227 0 : err = fd_bls_pubkey_compressed_encode( &self->bls_pubkey_compressed, ctx );
2228 0 : if( FD_UNLIKELY( err ) ) return err;
2229 0 : }
2230 300 : if( self->votes ) {
2231 300 : ulong votes_len = deq_fd_landed_vote_t_cnt( self->votes );
2232 300 : err = fd_bincode_uint64_encode( votes_len, ctx );
2233 300 : if( FD_UNLIKELY( err ) ) return err;
2234 9572 : 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 ) ) {
2235 9272 : fd_landed_vote_t const * ele = deq_fd_landed_vote_t_iter_ele_const( self->votes, iter );
2236 9272 : err = fd_landed_vote_encode( ele, ctx );
2237 9272 : if( FD_UNLIKELY( err ) ) return err;
2238 9272 : }
2239 >1844*10^16 : } else {
2240 >1844*10^16 : ulong votes_len = 0;
2241 >1844*10^16 : err = fd_bincode_uint64_encode( votes_len, ctx );
2242 >1844*10^16 : if( FD_UNLIKELY( err ) ) return err;
2243 >1844*10^16 : }
2244 299 : err = fd_bincode_bool_encode( self->has_root_slot, ctx );
2245 299 : if( FD_UNLIKELY( err ) ) return err;
2246 300 : if( self->has_root_slot ) {
2247 300 : err = fd_bincode_uint64_encode( self->root_slot, ctx );
2248 300 : if( FD_UNLIKELY( err ) ) return err;
2249 300 : }
2250 299 : err = fd_vote_authorized_voters_encode( &self->authorized_voters, ctx );
2251 299 : if( FD_UNLIKELY( err ) ) return err;
2252 300 : if( self->epoch_credits ) {
2253 300 : ulong epoch_credits_len = deq_fd_vote_epoch_credits_t_cnt( self->epoch_credits );
2254 300 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2255 300 : if( FD_UNLIKELY( err ) ) return err;
2256 2440 : 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 ) ) {
2257 2140 : fd_vote_epoch_credits_t const * ele = deq_fd_vote_epoch_credits_t_iter_ele_const( self->epoch_credits, iter );
2258 2140 : err = fd_vote_epoch_credits_encode( ele, ctx );
2259 2140 : if( FD_UNLIKELY( err ) ) return err;
2260 2140 : }
2261 >1844*10^16 : } else {
2262 >1844*10^16 : ulong epoch_credits_len = 0;
2263 >1844*10^16 : err = fd_bincode_uint64_encode( epoch_credits_len, ctx );
2264 >1844*10^16 : if( FD_UNLIKELY( err ) ) return err;
2265 >1844*10^16 : }
2266 299 : err = fd_vote_block_timestamp_encode( &self->last_timestamp, ctx );
2267 299 : if( FD_UNLIKELY( err ) ) return err;
2268 299 : return FD_BINCODE_SUCCESS;
2269 299 : }
2270 899 : static int fd_vote_state_v4_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2271 899 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2272 899 : int err = 0;
2273 899 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2274 899 : if( FD_UNLIKELY( err ) ) return err;
2275 897 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2276 897 : if( FD_UNLIKELY( err ) ) return err;
2277 897 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2278 897 : if( FD_UNLIKELY( err ) ) return err;
2279 897 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
2280 897 : if( FD_UNLIKELY( err ) ) return err;
2281 897 : err = fd_bincode_uint16_decode_footprint( ctx );
2282 897 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2283 897 : err = fd_bincode_uint16_decode_footprint( ctx );
2284 897 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2285 897 : err = fd_bincode_uint64_decode_footprint( ctx );
2286 897 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2287 897 : {
2288 897 : uchar o;
2289 897 : err = fd_bincode_bool_decode( &o, ctx );
2290 897 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2291 897 : if( o ) {
2292 0 : err = fd_bls_pubkey_compressed_decode_footprint_inner( ctx, total_sz );
2293 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2294 0 : }
2295 897 : }
2296 897 : ulong votes_len;
2297 897 : err = fd_bincode_uint64_decode( &votes_len, ctx );
2298 897 : if( FD_UNLIKELY( err ) ) return err;
2299 897 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2300 897 : *total_sz += deq_fd_landed_vote_t_align() + deq_fd_landed_vote_t_footprint( votes_max );
2301 897 : ulong votes_sz;
2302 897 : if( FD_UNLIKELY( __builtin_umull_overflow( votes_len, 13, &votes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2303 897 : err = fd_bincode_bytes_decode_footprint( votes_sz, ctx );
2304 897 : if( FD_UNLIKELY( err ) ) return err;
2305 897 : {
2306 897 : uchar o;
2307 897 : err = fd_bincode_bool_decode( &o, ctx );
2308 897 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2309 897 : if( o ) {
2310 897 : err = fd_bincode_uint64_decode_footprint( ctx );
2311 897 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2312 897 : }
2313 897 : }
2314 897 : err = fd_vote_authorized_voters_decode_footprint_inner( ctx, total_sz );
2315 897 : if( FD_UNLIKELY( err ) ) return err;
2316 897 : ulong epoch_credits_len;
2317 897 : err = fd_bincode_uint64_decode( &epoch_credits_len, ctx );
2318 897 : if( FD_UNLIKELY( err ) ) return err;
2319 897 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2320 897 : *total_sz += deq_fd_vote_epoch_credits_t_align() + deq_fd_vote_epoch_credits_t_footprint( epoch_credits_max );
2321 897 : ulong epoch_credits_sz;
2322 897 : if( FD_UNLIKELY( __builtin_umull_overflow( epoch_credits_len, 24, &epoch_credits_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2323 897 : err = fd_bincode_bytes_decode_footprint( epoch_credits_sz, ctx );
2324 897 : if( FD_UNLIKELY( err ) ) return err;
2325 897 : err = fd_vote_block_timestamp_decode_footprint_inner( ctx, total_sz );
2326 897 : if( FD_UNLIKELY( err ) ) return err;
2327 897 : return 0;
2328 897 : }
2329 0 : int fd_vote_state_v4_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2330 0 : *total_sz += sizeof(fd_vote_state_v4_t);
2331 0 : void const * start_data = ctx->data;
2332 0 : int err = fd_vote_state_v4_decode_footprint_inner( ctx, total_sz );
2333 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2334 0 : ctx->data = start_data;
2335 0 : return err;
2336 0 : }
2337 301 : static void fd_vote_state_v4_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2338 301 : fd_vote_state_v4_t * self = (fd_vote_state_v4_t *)struct_mem;
2339 301 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
2340 301 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
2341 301 : fd_pubkey_decode_inner( &self->inflation_rewards_collector, alloc_mem, ctx );
2342 301 : fd_pubkey_decode_inner( &self->block_revenue_collector, alloc_mem, ctx );
2343 301 : fd_bincode_uint16_decode_unsafe( &self->inflation_rewards_commission_bps, ctx );
2344 301 : fd_bincode_uint16_decode_unsafe( &self->block_revenue_commission_bps, ctx );
2345 301 : fd_bincode_uint64_decode_unsafe( &self->pending_delegator_rewards, ctx );
2346 301 : {
2347 301 : uchar o;
2348 301 : fd_bincode_bool_decode_unsafe( &o, ctx );
2349 301 : self->has_bls_pubkey_compressed = !!o;
2350 301 : if( o ) {
2351 0 : fd_bls_pubkey_compressed_new( &self->bls_pubkey_compressed );
2352 0 : fd_bls_pubkey_compressed_decode_inner( &self->bls_pubkey_compressed, alloc_mem, ctx );
2353 0 : }
2354 301 : }
2355 301 : ulong votes_len;
2356 301 : fd_bincode_uint64_decode_unsafe( &votes_len, ctx );
2357 301 : ulong votes_max = fd_ulong_max( votes_len, 32 );
2358 301 : self->votes = deq_fd_landed_vote_t_join_new( alloc_mem, votes_max );
2359 9603 : for( ulong i=0; i < votes_len; i++ ) {
2360 9302 : fd_landed_vote_t * elem = deq_fd_landed_vote_t_push_tail_nocopy( self->votes );
2361 9302 : fd_landed_vote_new( elem );
2362 9302 : fd_landed_vote_decode_inner( elem, alloc_mem, ctx );
2363 9302 : }
2364 301 : {
2365 301 : uchar o;
2366 301 : fd_bincode_bool_decode_unsafe( &o, ctx );
2367 301 : self->has_root_slot = !!o;
2368 301 : if( o ) {
2369 300 : fd_bincode_uint64_decode_unsafe( &self->root_slot, ctx );
2370 300 : }
2371 301 : }
2372 301 : fd_vote_authorized_voters_decode_inner( &self->authorized_voters, alloc_mem, ctx );
2373 301 : ulong epoch_credits_len;
2374 301 : fd_bincode_uint64_decode_unsafe( &epoch_credits_len, ctx );
2375 301 : ulong epoch_credits_max = fd_ulong_max( epoch_credits_len, 64 );
2376 301 : self->epoch_credits = deq_fd_vote_epoch_credits_t_join_new( alloc_mem, epoch_credits_max );
2377 2434 : for( ulong i=0; i < epoch_credits_len; i++ ) {
2378 2133 : fd_vote_epoch_credits_t * elem = deq_fd_vote_epoch_credits_t_push_tail_nocopy( self->epoch_credits );
2379 2133 : fd_vote_epoch_credits_new( elem );
2380 2133 : fd_vote_epoch_credits_decode_inner( elem, alloc_mem, ctx );
2381 2133 : }
2382 301 : fd_vote_block_timestamp_decode_inner( &self->last_timestamp, alloc_mem, ctx );
2383 301 : }
2384 0 : void * fd_vote_state_v4_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2385 0 : fd_vote_state_v4_t * self = (fd_vote_state_v4_t *)mem;
2386 0 : fd_vote_state_v4_new( self );
2387 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_v4_t);
2388 0 : void * * alloc_mem = &alloc_region;
2389 0 : fd_vote_state_v4_decode_inner( mem, alloc_mem, ctx );
2390 0 : return self;
2391 0 : }
2392 0 : void fd_vote_state_v4_new(fd_vote_state_v4_t * self) {
2393 0 : fd_memset( self, 0, sizeof(fd_vote_state_v4_t) );
2394 0 : fd_pubkey_new( &self->node_pubkey );
2395 0 : fd_pubkey_new( &self->authorized_withdrawer );
2396 0 : fd_pubkey_new( &self->inflation_rewards_collector );
2397 0 : fd_pubkey_new( &self->block_revenue_collector );
2398 0 : fd_vote_authorized_voters_new( &self->authorized_voters );
2399 0 : fd_vote_block_timestamp_new( &self->last_timestamp );
2400 0 : }
2401 300 : ulong fd_vote_state_v4_size( fd_vote_state_v4_t const * self ) {
2402 300 : ulong size = 0;
2403 300 : size += fd_pubkey_size( &self->node_pubkey );
2404 300 : size += fd_pubkey_size( &self->authorized_withdrawer );
2405 300 : size += fd_pubkey_size( &self->inflation_rewards_collector );
2406 300 : size += fd_pubkey_size( &self->block_revenue_collector );
2407 300 : size += sizeof(ushort);
2408 300 : size += sizeof(ushort);
2409 300 : size += sizeof(ulong);
2410 300 : size += sizeof(char);
2411 300 : if( self->has_bls_pubkey_compressed ) {
2412 0 : size += fd_bls_pubkey_compressed_size( &self->bls_pubkey_compressed );
2413 0 : }
2414 300 : if( self->votes ) {
2415 300 : size += sizeof(ulong);
2416 9600 : 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 ) ) {
2417 9300 : fd_landed_vote_t * ele = deq_fd_landed_vote_t_iter_ele( self->votes, iter );
2418 9300 : size += fd_landed_vote_size( ele );
2419 9300 : }
2420 300 : } else {
2421 0 : size += sizeof(ulong);
2422 0 : }
2423 300 : size += sizeof(char);
2424 300 : if( self->has_root_slot ) {
2425 300 : size += sizeof(ulong);
2426 300 : }
2427 300 : size += fd_vote_authorized_voters_size( &self->authorized_voters );
2428 300 : if( self->epoch_credits ) {
2429 300 : size += sizeof(ulong);
2430 2445 : 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 ) ) {
2431 2145 : fd_vote_epoch_credits_t * ele = deq_fd_vote_epoch_credits_t_iter_ele( self->epoch_credits, iter );
2432 2145 : size += fd_vote_epoch_credits_size( ele );
2433 2145 : }
2434 300 : } else {
2435 0 : size += sizeof(ulong);
2436 0 : }
2437 300 : size += fd_vote_block_timestamp_size( &self->last_timestamp );
2438 300 : return size;
2439 300 : }
2440 :
2441 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_uninitialized(fd_vote_state_versioned_t const * self) {
2442 0 : return self->discriminant == 0;
2443 0 : }
2444 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v1_14_11(fd_vote_state_versioned_t const * self) {
2445 0 : return self->discriminant == 1;
2446 0 : }
2447 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v3(fd_vote_state_versioned_t const * self) {
2448 0 : return self->discriminant == 2;
2449 0 : }
2450 0 : FD_FN_PURE uchar fd_vote_state_versioned_is_v4(fd_vote_state_versioned_t const * self) {
2451 0 : return self->discriminant == 3;
2452 0 : }
2453 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant );
2454 1908 : int fd_vote_state_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2455 1908 : int err;
2456 1908 : switch (discriminant) {
2457 405 : case 0: {
2458 405 : return FD_BINCODE_SUCCESS;
2459 0 : }
2460 204 : case 1: {
2461 204 : err = fd_vote_state_1_14_11_decode_footprint_inner( ctx, total_sz );
2462 204 : if( FD_UNLIKELY( err ) ) return err;
2463 70 : return FD_BINCODE_SUCCESS;
2464 204 : }
2465 269 : case 2: {
2466 269 : err = fd_vote_state_v3_decode_footprint_inner( ctx, total_sz );
2467 269 : if( FD_UNLIKELY( err ) ) return err;
2468 102 : return FD_BINCODE_SUCCESS;
2469 269 : }
2470 899 : case 3: {
2471 899 : err = fd_vote_state_v4_decode_footprint_inner( ctx, total_sz );
2472 899 : if( FD_UNLIKELY( err ) ) return err;
2473 897 : return FD_BINCODE_SUCCESS;
2474 899 : }
2475 131 : default: return FD_BINCODE_ERR_ENCODING;
2476 1908 : }
2477 1908 : }
2478 1922 : static int fd_vote_state_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2479 1922 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2480 1908 : uint discriminant = 0;
2481 1908 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
2482 1908 : if( FD_UNLIKELY( err ) ) return err;
2483 1908 : return fd_vote_state_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
2484 1908 : }
2485 1324 : int fd_vote_state_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2486 1324 : *total_sz += sizeof(fd_vote_state_versioned_t);
2487 1324 : void const * start_data = ctx->data;
2488 1324 : int err = fd_vote_state_versioned_decode_footprint_inner( ctx, total_sz );
2489 1324 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2490 1324 : ctx->data = start_data;
2491 1324 : return err;
2492 1324 : }
2493 598 : int fd_vote_state_versioned_seek_end( fd_bincode_decode_ctx_t * ctx ) {
2494 598 : ulong total_sz;
2495 598 : int err = fd_vote_state_versioned_decode_footprint_inner( ctx, &total_sz );
2496 598 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2497 598 : return err;
2498 598 : }
2499 878 : 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 ) {
2500 878 : switch (discriminant) {
2501 405 : case 0: {
2502 405 : break;
2503 0 : }
2504 70 : case 1: {
2505 70 : fd_vote_state_1_14_11_decode_inner( &self->v1_14_11, alloc_mem, ctx );
2506 70 : break;
2507 0 : }
2508 102 : case 2: {
2509 102 : fd_vote_state_v3_decode_inner( &self->v3, alloc_mem, ctx );
2510 102 : break;
2511 0 : }
2512 301 : case 3: {
2513 301 : fd_vote_state_v4_decode_inner( &self->v4, alloc_mem, ctx );
2514 301 : break;
2515 0 : }
2516 878 : }
2517 878 : }
2518 878 : static void fd_vote_state_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2519 878 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)struct_mem;
2520 878 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
2521 878 : fd_vote_state_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
2522 878 : }
2523 878 : void * fd_vote_state_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2524 878 : fd_vote_state_versioned_t * self = (fd_vote_state_versioned_t *)mem;
2525 878 : fd_vote_state_versioned_new( self );
2526 878 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_versioned_t);
2527 878 : void * * alloc_mem = &alloc_region;
2528 878 : fd_vote_state_versioned_decode_inner( mem, alloc_mem, ctx );
2529 878 : return self;
2530 878 : }
2531 904 : void fd_vote_state_versioned_inner_new( fd_vote_state_versioned_inner_t * self, uint discriminant ) {
2532 904 : switch( discriminant ) {
2533 0 : case 0: {
2534 0 : break;
2535 0 : }
2536 17 : case 1: {
2537 17 : fd_vote_state_1_14_11_new( &self->v1_14_11 );
2538 17 : break;
2539 0 : }
2540 7 : case 2: {
2541 7 : fd_vote_state_v3_new( &self->v3 );
2542 7 : break;
2543 0 : }
2544 0 : case 3: {
2545 0 : fd_vote_state_v4_new( &self->v4 );
2546 0 : break;
2547 0 : }
2548 880 : default: break; // FD_LOG_ERR(( "unhandled type"));
2549 904 : }
2550 904 : }
2551 904 : void fd_vote_state_versioned_new_disc( fd_vote_state_versioned_t * self, uint discriminant ) {
2552 904 : self->discriminant = discriminant;
2553 904 : fd_vote_state_versioned_inner_new( &self->inner, self->discriminant );
2554 904 : }
2555 880 : void fd_vote_state_versioned_new( fd_vote_state_versioned_t * self ) {
2556 880 : fd_memset( self, 0, sizeof(fd_vote_state_versioned_t) );
2557 880 : fd_vote_state_versioned_new_disc( self, UINT_MAX );
2558 880 : }
2559 :
2560 352 : ulong fd_vote_state_versioned_size( fd_vote_state_versioned_t const * self ) {
2561 352 : ulong size = 0;
2562 352 : size += sizeof(uint);
2563 352 : switch (self->discriminant) {
2564 7 : case 1: {
2565 7 : size += fd_vote_state_1_14_11_size( &self->inner.v1_14_11 );
2566 7 : break;
2567 0 : }
2568 45 : case 2: {
2569 45 : size += fd_vote_state_v3_size( &self->inner.v3 );
2570 45 : break;
2571 0 : }
2572 300 : case 3: {
2573 300 : size += fd_vote_state_v4_size( &self->inner.v4 );
2574 300 : break;
2575 0 : }
2576 352 : }
2577 352 : return size;
2578 352 : }
2579 :
2580 349 : int fd_vote_state_versioned_inner_encode( fd_vote_state_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
2581 349 : int err;
2582 349 : switch (discriminant) {
2583 5 : case 1: {
2584 5 : err = fd_vote_state_1_14_11_encode( &self->v1_14_11, ctx );
2585 5 : if( FD_UNLIKELY( err ) ) return err;
2586 5 : break;
2587 5 : }
2588 45 : case 2: {
2589 45 : err = fd_vote_state_v3_encode( &self->v3, ctx );
2590 45 : if( FD_UNLIKELY( err ) ) return err;
2591 45 : break;
2592 45 : }
2593 299 : case 3: {
2594 299 : err = fd_vote_state_v4_encode( &self->v4, ctx );
2595 299 : if( FD_UNLIKELY( err ) ) return err;
2596 299 : break;
2597 299 : }
2598 349 : }
2599 350 : return FD_BINCODE_SUCCESS;
2600 349 : }
2601 350 : int fd_vote_state_versioned_encode( fd_vote_state_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2602 350 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
2603 350 : if( FD_UNLIKELY( err ) ) return err;
2604 350 : return fd_vote_state_versioned_inner_encode( &self->inner, self->discriminant, ctx );
2605 350 : }
2606 :
2607 0 : int fd_vote_state_update_encode( fd_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2608 0 : int err;
2609 0 : if( self->lockouts ) {
2610 0 : ulong lockouts_len = deq_fd_vote_lockout_t_cnt( self->lockouts );
2611 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
2612 0 : if( FD_UNLIKELY( err ) ) return err;
2613 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 ) ) {
2614 0 : fd_vote_lockout_t const * ele = deq_fd_vote_lockout_t_iter_ele_const( self->lockouts, iter );
2615 0 : err = fd_vote_lockout_encode( ele, ctx );
2616 0 : if( FD_UNLIKELY( err ) ) return err;
2617 0 : }
2618 0 : } else {
2619 0 : ulong lockouts_len = 0;
2620 0 : err = fd_bincode_uint64_encode( lockouts_len, ctx );
2621 0 : if( FD_UNLIKELY( err ) ) return err;
2622 0 : }
2623 0 : err = fd_bincode_bool_encode( self->has_root, ctx );
2624 0 : if( FD_UNLIKELY( err ) ) return err;
2625 0 : if( self->has_root ) {
2626 0 : err = fd_bincode_uint64_encode( self->root, ctx );
2627 0 : if( FD_UNLIKELY( err ) ) return err;
2628 0 : }
2629 0 : err = fd_hash_encode( &self->hash, ctx );
2630 0 : if( FD_UNLIKELY( err ) ) return err;
2631 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
2632 0 : if( FD_UNLIKELY( err ) ) return err;
2633 0 : if( self->has_timestamp ) {
2634 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
2635 0 : if( FD_UNLIKELY( err ) ) return err;
2636 0 : }
2637 0 : return FD_BINCODE_SUCCESS;
2638 0 : }
2639 220 : static int fd_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2640 220 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2641 220 : int err = 0;
2642 220 : ulong lockouts_len;
2643 220 : err = fd_bincode_uint64_decode( &lockouts_len, ctx );
2644 220 : if( FD_UNLIKELY( err ) ) return err;
2645 220 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
2646 220 : *total_sz += deq_fd_vote_lockout_t_align() + deq_fd_vote_lockout_t_footprint( lockouts_max );
2647 220 : ulong lockouts_sz;
2648 220 : if( FD_UNLIKELY( __builtin_umull_overflow( lockouts_len, 12, &lockouts_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
2649 219 : err = fd_bincode_bytes_decode_footprint( lockouts_sz, ctx );
2650 219 : if( FD_UNLIKELY( err ) ) return err;
2651 216 : {
2652 216 : uchar o;
2653 216 : err = fd_bincode_bool_decode( &o, ctx );
2654 216 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2655 212 : if( o ) {
2656 112 : err = fd_bincode_uint64_decode_footprint( ctx );
2657 112 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2658 112 : }
2659 212 : }
2660 208 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
2661 208 : if( FD_UNLIKELY( err ) ) return err;
2662 207 : {
2663 207 : uchar o;
2664 207 : err = fd_bincode_bool_decode( &o, ctx );
2665 207 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2666 202 : if( o ) {
2667 91 : err = fd_bincode_int64_decode_footprint( ctx );
2668 91 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2669 91 : }
2670 202 : }
2671 198 : return 0;
2672 202 : }
2673 0 : int fd_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2674 0 : *total_sz += sizeof(fd_vote_state_update_t);
2675 0 : void const * start_data = ctx->data;
2676 0 : int err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
2677 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2678 0 : ctx->data = start_data;
2679 0 : return err;
2680 0 : }
2681 196 : static void fd_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2682 196 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)struct_mem;
2683 196 : ulong lockouts_len;
2684 196 : fd_bincode_uint64_decode_unsafe( &lockouts_len, ctx );
2685 196 : ulong lockouts_max = fd_ulong_max( lockouts_len, 32 );
2686 196 : self->lockouts = deq_fd_vote_lockout_t_join_new( alloc_mem, lockouts_max );
2687 4047 : for( ulong i=0; i < lockouts_len; i++ ) {
2688 3851 : fd_vote_lockout_t * elem = deq_fd_vote_lockout_t_push_tail_nocopy( self->lockouts );
2689 3851 : fd_vote_lockout_new( elem );
2690 3851 : fd_vote_lockout_decode_inner( elem, alloc_mem, ctx );
2691 3851 : }
2692 196 : {
2693 196 : uchar o;
2694 196 : fd_bincode_bool_decode_unsafe( &o, ctx );
2695 196 : self->has_root = !!o;
2696 196 : if( o ) {
2697 102 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
2698 102 : }
2699 196 : }
2700 196 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
2701 196 : {
2702 196 : uchar o;
2703 196 : fd_bincode_bool_decode_unsafe( &o, ctx );
2704 196 : self->has_timestamp = !!o;
2705 196 : if( o ) {
2706 87 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
2707 87 : }
2708 196 : }
2709 196 : }
2710 0 : void * fd_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2711 0 : fd_vote_state_update_t * self = (fd_vote_state_update_t *)mem;
2712 0 : fd_vote_state_update_new( self );
2713 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_state_update_t);
2714 0 : void * * alloc_mem = &alloc_region;
2715 0 : fd_vote_state_update_decode_inner( mem, alloc_mem, ctx );
2716 0 : return self;
2717 0 : }
2718 1 : void fd_vote_state_update_new(fd_vote_state_update_t * self) {
2719 1 : fd_memset( self, 0, sizeof(fd_vote_state_update_t) );
2720 1 : fd_hash_new( &self->hash );
2721 1 : }
2722 0 : ulong fd_vote_state_update_size( fd_vote_state_update_t const * self ) {
2723 0 : ulong size = 0;
2724 0 : if( self->lockouts ) {
2725 0 : size += sizeof(ulong);
2726 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 ) ) {
2727 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
2728 0 : size += fd_vote_lockout_size( ele );
2729 0 : }
2730 0 : } else {
2731 0 : size += sizeof(ulong);
2732 0 : }
2733 0 : size += sizeof(char);
2734 0 : if( self->has_root ) {
2735 0 : size += sizeof(ulong);
2736 0 : }
2737 0 : size += fd_hash_size( &self->hash );
2738 0 : size += sizeof(char);
2739 0 : if( self->has_timestamp ) {
2740 0 : size += sizeof(long);
2741 0 : }
2742 0 : return size;
2743 0 : }
2744 :
2745 0 : int fd_compact_vote_state_update_encode( fd_compact_vote_state_update_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2746 0 : int err;
2747 0 : err = fd_bincode_uint64_encode( self->root, ctx );
2748 0 : if( FD_UNLIKELY( err ) ) return err;
2749 0 : err = fd_bincode_compact_u16_encode( &self->lockouts_len, ctx );
2750 0 : if( FD_UNLIKELY(err) ) return err;
2751 0 : if( self->lockouts_len ) {
2752 0 : for( ulong i=0; i < self->lockouts_len; i++ ) {
2753 0 : err = fd_lockout_offset_encode( self->lockouts + i, ctx );
2754 0 : if( FD_UNLIKELY( err ) ) return err;
2755 0 : }
2756 0 : }
2757 0 : err = fd_hash_encode( &self->hash, ctx );
2758 0 : if( FD_UNLIKELY( err ) ) return err;
2759 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
2760 0 : if( FD_UNLIKELY( err ) ) return err;
2761 0 : if( self->has_timestamp ) {
2762 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
2763 0 : if( FD_UNLIKELY( err ) ) return err;
2764 0 : }
2765 0 : return FD_BINCODE_SUCCESS;
2766 0 : }
2767 218 : static int fd_compact_vote_state_update_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2768 218 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2769 217 : int err = 0;
2770 217 : err = fd_bincode_uint64_decode_footprint( ctx );
2771 217 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2772 217 : ushort lockouts_len;
2773 217 : err = fd_bincode_compact_u16_decode( &lockouts_len, ctx );
2774 217 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2775 209 : if( lockouts_len ) {
2776 187 : *total_sz += FD_LOCKOUT_OFFSET_ALIGN + sizeof(fd_lockout_offset_t)*lockouts_len;
2777 9969 : for( ulong i=0; i < lockouts_len; i++ ) {
2778 9812 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
2779 9812 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2780 9812 : }
2781 187 : }
2782 179 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
2783 179 : if( FD_UNLIKELY( err ) ) return err;
2784 178 : {
2785 178 : uchar o;
2786 178 : err = fd_bincode_bool_decode( &o, ctx );
2787 178 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2788 94 : if( o ) {
2789 33 : err = fd_bincode_int64_decode_footprint( ctx );
2790 33 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2791 33 : }
2792 94 : }
2793 92 : return 0;
2794 94 : }
2795 0 : int fd_compact_vote_state_update_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2796 0 : *total_sz += sizeof(fd_compact_vote_state_update_t);
2797 0 : void const * start_data = ctx->data;
2798 0 : int err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
2799 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2800 0 : ctx->data = start_data;
2801 0 : return err;
2802 0 : }
2803 90 : static void fd_compact_vote_state_update_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2804 90 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)struct_mem;
2805 90 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
2806 90 : fd_bincode_compact_u16_decode_unsafe( &self->lockouts_len, ctx );
2807 90 : if( self->lockouts_len ) {
2808 79 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_LOCKOUT_OFFSET_ALIGN );
2809 79 : self->lockouts = *alloc_mem;
2810 79 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_lockout_offset_t)*self->lockouts_len;
2811 1514 : for( ulong i=0; i < self->lockouts_len; i++ ) {
2812 1435 : fd_lockout_offset_new( self->lockouts + i );
2813 1435 : fd_lockout_offset_decode_inner( self->lockouts + i, alloc_mem, ctx );
2814 1435 : }
2815 79 : } else
2816 11 : self->lockouts = NULL;
2817 90 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
2818 90 : {
2819 90 : uchar o;
2820 90 : fd_bincode_bool_decode_unsafe( &o, ctx );
2821 90 : self->has_timestamp = !!o;
2822 90 : if( o ) {
2823 31 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
2824 31 : }
2825 90 : }
2826 90 : }
2827 0 : void * fd_compact_vote_state_update_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2828 0 : fd_compact_vote_state_update_t * self = (fd_compact_vote_state_update_t *)mem;
2829 0 : fd_compact_vote_state_update_new( self );
2830 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_t);
2831 0 : void * * alloc_mem = &alloc_region;
2832 0 : fd_compact_vote_state_update_decode_inner( mem, alloc_mem, ctx );
2833 0 : return self;
2834 0 : }
2835 0 : void fd_compact_vote_state_update_new(fd_compact_vote_state_update_t * self) {
2836 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_t) );
2837 0 : fd_hash_new( &self->hash );
2838 0 : }
2839 0 : ulong fd_compact_vote_state_update_size( fd_compact_vote_state_update_t const * self ) {
2840 0 : ulong size = 0;
2841 0 : size += sizeof(ulong);
2842 0 : do {
2843 0 : ushort tmp = (ushort)self->lockouts_len;
2844 0 : size += fd_bincode_compact_u16_size( &tmp );
2845 0 : for( ulong i=0; i < self->lockouts_len; i++ )
2846 0 : size += fd_lockout_offset_size( self->lockouts + i );
2847 0 : } while(0);
2848 0 : size += fd_hash_size( &self->hash );
2849 0 : size += sizeof(char);
2850 0 : if( self->has_timestamp ) {
2851 0 : size += sizeof(long);
2852 0 : }
2853 0 : return size;
2854 0 : }
2855 :
2856 0 : int fd_compact_vote_state_update_switch_encode( fd_compact_vote_state_update_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2857 0 : int err;
2858 0 : err = fd_compact_vote_state_update_encode( &self->compact_vote_state_update, ctx );
2859 0 : if( FD_UNLIKELY( err ) ) return err;
2860 0 : err = fd_hash_encode( &self->hash, ctx );
2861 0 : if( FD_UNLIKELY( err ) ) return err;
2862 0 : return FD_BINCODE_SUCCESS;
2863 0 : }
2864 83 : static int fd_compact_vote_state_update_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2865 83 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2866 83 : int err = 0;
2867 83 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
2868 83 : if( FD_UNLIKELY( err ) ) return err;
2869 32 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
2870 32 : if( FD_UNLIKELY( err ) ) return err;
2871 30 : return 0;
2872 32 : }
2873 0 : int fd_compact_vote_state_update_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2874 0 : *total_sz += sizeof(fd_compact_vote_state_update_switch_t);
2875 0 : void const * start_data = ctx->data;
2876 0 : int err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
2877 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2878 0 : ctx->data = start_data;
2879 0 : return err;
2880 0 : }
2881 30 : static void fd_compact_vote_state_update_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2882 30 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)struct_mem;
2883 30 : fd_compact_vote_state_update_decode_inner( &self->compact_vote_state_update, alloc_mem, ctx );
2884 30 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
2885 30 : }
2886 0 : void * fd_compact_vote_state_update_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2887 0 : fd_compact_vote_state_update_switch_t * self = (fd_compact_vote_state_update_switch_t *)mem;
2888 0 : fd_compact_vote_state_update_switch_new( self );
2889 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_vote_state_update_switch_t);
2890 0 : void * * alloc_mem = &alloc_region;
2891 0 : fd_compact_vote_state_update_switch_decode_inner( mem, alloc_mem, ctx );
2892 0 : return self;
2893 0 : }
2894 0 : void fd_compact_vote_state_update_switch_new(fd_compact_vote_state_update_switch_t * self) {
2895 0 : fd_memset( self, 0, sizeof(fd_compact_vote_state_update_switch_t) );
2896 0 : fd_compact_vote_state_update_new( &self->compact_vote_state_update );
2897 0 : fd_hash_new( &self->hash );
2898 0 : }
2899 0 : ulong fd_compact_vote_state_update_switch_size( fd_compact_vote_state_update_switch_t const * self ) {
2900 0 : ulong size = 0;
2901 0 : size += fd_compact_vote_state_update_size( &self->compact_vote_state_update );
2902 0 : size += fd_hash_size( &self->hash );
2903 0 : return size;
2904 0 : }
2905 :
2906 0 : int fd_compact_tower_sync_encode( fd_compact_tower_sync_t const * self, fd_bincode_encode_ctx_t * ctx ) {
2907 0 : int err;
2908 0 : err = fd_bincode_uint64_encode( self->root, ctx );
2909 0 : if( FD_UNLIKELY( err ) ) return err;
2910 0 : if( self->lockout_offsets ) {
2911 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
2912 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
2913 0 : if( FD_UNLIKELY( err ) ) return err;
2914 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 ) ) {
2915 0 : fd_lockout_offset_t const * ele = deq_fd_lockout_offset_t_iter_ele_const( self->lockout_offsets, iter );
2916 0 : err = fd_lockout_offset_encode( ele, ctx );
2917 0 : if( FD_UNLIKELY( err ) ) return err;
2918 0 : }
2919 0 : } else {
2920 0 : ushort lockout_offsets_len = 0;
2921 0 : err = fd_bincode_compact_u16_encode( &lockout_offsets_len, ctx );
2922 0 : if( FD_UNLIKELY( err ) ) return err;
2923 0 : }
2924 0 : err = fd_hash_encode( &self->hash, ctx );
2925 0 : if( FD_UNLIKELY( err ) ) return err;
2926 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
2927 0 : if( FD_UNLIKELY( err ) ) return err;
2928 0 : if( self->has_timestamp ) {
2929 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
2930 0 : if( FD_UNLIKELY( err ) ) return err;
2931 0 : }
2932 0 : err = fd_hash_encode( &self->block_id, ctx );
2933 0 : if( FD_UNLIKELY( err ) ) return err;
2934 0 : return FD_BINCODE_SUCCESS;
2935 0 : }
2936 0 : static int fd_compact_tower_sync_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2937 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2938 0 : int err = 0;
2939 0 : err = fd_bincode_uint64_decode_footprint( ctx );
2940 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2941 0 : ushort lockout_offsets_len;
2942 0 : err = fd_bincode_compact_u16_decode( &lockout_offsets_len, ctx );
2943 0 : if( FD_UNLIKELY( err ) ) return err;
2944 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
2945 0 : *total_sz += deq_fd_lockout_offset_t_align() + deq_fd_lockout_offset_t_footprint( lockout_offsets_max );
2946 0 : for( ulong i = 0; i < lockout_offsets_len; ++i ) {
2947 0 : err = fd_lockout_offset_decode_footprint_inner( ctx, total_sz );
2948 0 : if( FD_UNLIKELY( err ) ) return err;
2949 0 : }
2950 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
2951 0 : if( FD_UNLIKELY( err ) ) return err;
2952 0 : {
2953 0 : uchar o;
2954 0 : err = fd_bincode_bool_decode( &o, ctx );
2955 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2956 0 : if( o ) {
2957 0 : err = fd_bincode_int64_decode_footprint( ctx );
2958 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
2959 0 : }
2960 0 : }
2961 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
2962 0 : if( FD_UNLIKELY( err ) ) return err;
2963 0 : return 0;
2964 0 : }
2965 0 : int fd_compact_tower_sync_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
2966 0 : *total_sz += sizeof(fd_compact_tower_sync_t);
2967 0 : void const * start_data = ctx->data;
2968 0 : int err = fd_compact_tower_sync_decode_footprint_inner( ctx, total_sz );
2969 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
2970 0 : ctx->data = start_data;
2971 0 : return err;
2972 0 : }
2973 0 : static void fd_compact_tower_sync_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
2974 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)struct_mem;
2975 0 : fd_bincode_uint64_decode_unsafe( &self->root, ctx );
2976 0 : ushort lockout_offsets_len;
2977 0 : fd_bincode_compact_u16_decode_unsafe( &lockout_offsets_len, ctx );
2978 0 : ulong lockout_offsets_max = fd_ulong_max( lockout_offsets_len, 32 );
2979 0 : self->lockout_offsets = deq_fd_lockout_offset_t_join_new( alloc_mem, lockout_offsets_max );
2980 0 : for( ulong i=0; i < lockout_offsets_len; i++ ) {
2981 0 : fd_lockout_offset_t * elem = deq_fd_lockout_offset_t_push_tail_nocopy( self->lockout_offsets );
2982 0 : fd_lockout_offset_new( elem );
2983 0 : fd_lockout_offset_decode_inner( elem, alloc_mem, ctx );
2984 0 : }
2985 0 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
2986 0 : {
2987 0 : uchar o;
2988 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
2989 0 : self->has_timestamp = !!o;
2990 0 : if( o ) {
2991 0 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
2992 0 : }
2993 0 : }
2994 0 : fd_hash_decode_inner( &self->block_id, alloc_mem, ctx );
2995 0 : }
2996 0 : void * fd_compact_tower_sync_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
2997 0 : fd_compact_tower_sync_t * self = (fd_compact_tower_sync_t *)mem;
2998 0 : fd_compact_tower_sync_new( self );
2999 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compact_tower_sync_t);
3000 0 : void * * alloc_mem = &alloc_region;
3001 0 : fd_compact_tower_sync_decode_inner( mem, alloc_mem, ctx );
3002 0 : return self;
3003 0 : }
3004 0 : void fd_compact_tower_sync_new(fd_compact_tower_sync_t * self) {
3005 0 : fd_memset( self, 0, sizeof(fd_compact_tower_sync_t) );
3006 0 : fd_hash_new( &self->hash );
3007 0 : fd_hash_new( &self->block_id );
3008 0 : }
3009 0 : ulong fd_compact_tower_sync_size( fd_compact_tower_sync_t const * self ) {
3010 0 : ulong size = 0;
3011 0 : size += sizeof(ulong);
3012 0 : if( self->lockout_offsets ) {
3013 0 : ushort lockout_offsets_len = (ushort)deq_fd_lockout_offset_t_cnt( self->lockout_offsets );
3014 0 : size += fd_bincode_compact_u16_size( &lockout_offsets_len );
3015 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 ) ) {
3016 0 : fd_lockout_offset_t * ele = deq_fd_lockout_offset_t_iter_ele( self->lockout_offsets, iter );
3017 0 : size += fd_lockout_offset_size( ele );
3018 0 : }
3019 0 : } else {
3020 0 : size += 1;
3021 0 : }
3022 0 : size += fd_hash_size( &self->hash );
3023 0 : size += sizeof(char);
3024 0 : if( self->has_timestamp ) {
3025 0 : size += sizeof(long);
3026 0 : }
3027 0 : size += fd_hash_size( &self->block_id );
3028 0 : return size;
3029 0 : }
3030 :
3031 0 : void fd_tower_sync_new(fd_tower_sync_t * self) {
3032 0 : fd_memset( self, 0, sizeof(fd_tower_sync_t) );
3033 0 : fd_hash_new( &self->hash );
3034 0 : fd_hash_new( &self->block_id );
3035 0 : }
3036 0 : ulong fd_tower_sync_size( fd_tower_sync_t const * self ) {
3037 0 : ulong size = 0;
3038 0 : if( self->lockouts ) {
3039 0 : size += sizeof(ulong);
3040 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 ) ) {
3041 0 : fd_vote_lockout_t * ele = deq_fd_vote_lockout_t_iter_ele( self->lockouts, iter );
3042 0 : size += fd_vote_lockout_size( ele );
3043 0 : }
3044 0 : } else {
3045 0 : size += sizeof(ulong);
3046 0 : }
3047 0 : size += sizeof(ulong);
3048 0 : size += sizeof(char);
3049 0 : if( self->has_root ) {
3050 0 : size += sizeof(ulong);
3051 0 : }
3052 0 : size += fd_hash_size( &self->hash );
3053 0 : size += sizeof(char);
3054 0 : if( self->has_timestamp ) {
3055 0 : size += sizeof(long);
3056 0 : }
3057 0 : size += fd_hash_size( &self->block_id );
3058 0 : return size;
3059 0 : }
3060 :
3061 0 : int fd_tower_sync_switch_encode( fd_tower_sync_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3062 0 : int err;
3063 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
3064 0 : if( FD_UNLIKELY( err ) ) return err;
3065 0 : err = fd_hash_encode( &self->hash, ctx );
3066 0 : if( FD_UNLIKELY( err ) ) return err;
3067 0 : return FD_BINCODE_SUCCESS;
3068 0 : }
3069 87 : static int fd_tower_sync_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3070 87 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3071 87 : int err = 0;
3072 87 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
3073 87 : if( FD_UNLIKELY( err ) ) return err;
3074 13 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3075 13 : if( FD_UNLIKELY( err ) ) return err;
3076 10 : return 0;
3077 13 : }
3078 0 : int fd_tower_sync_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3079 0 : *total_sz += sizeof(fd_tower_sync_switch_t);
3080 0 : void const * start_data = ctx->data;
3081 0 : int err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
3082 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3083 0 : ctx->data = start_data;
3084 0 : return err;
3085 0 : }
3086 10 : static void fd_tower_sync_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3087 10 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)struct_mem;
3088 10 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
3089 10 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3090 10 : }
3091 0 : void * fd_tower_sync_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3092 0 : fd_tower_sync_switch_t * self = (fd_tower_sync_switch_t *)mem;
3093 0 : fd_tower_sync_switch_new( self );
3094 0 : void * alloc_region = (uchar *)mem + sizeof(fd_tower_sync_switch_t);
3095 0 : void * * alloc_mem = &alloc_region;
3096 0 : fd_tower_sync_switch_decode_inner( mem, alloc_mem, ctx );
3097 0 : return self;
3098 0 : }
3099 0 : void fd_tower_sync_switch_new(fd_tower_sync_switch_t * self) {
3100 0 : fd_memset( self, 0, sizeof(fd_tower_sync_switch_t) );
3101 0 : fd_tower_sync_new( &self->tower_sync );
3102 0 : fd_hash_new( &self->hash );
3103 0 : }
3104 0 : ulong fd_tower_sync_switch_size( fd_tower_sync_switch_t const * self ) {
3105 0 : ulong size = 0;
3106 0 : size += fd_tower_sync_size( &self->tower_sync );
3107 0 : size += fd_hash_size( &self->hash );
3108 0 : return size;
3109 0 : }
3110 :
3111 0 : int fd_slot_history_encode( fd_slot_history_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3112 0 : int err;
3113 0 : err = fd_bincode_bool_encode( self->has_bits, ctx );
3114 0 : if( FD_UNLIKELY( err ) ) return err;
3115 0 : if( self->has_bits ) {
3116 0 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
3117 0 : if( FD_UNLIKELY(err) ) return err;
3118 0 : if( self->bits_bitvec_len ) {
3119 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3120 0 : err = fd_bincode_uint64_encode( self->bits_bitvec[i], ctx );
3121 0 : }
3122 0 : }
3123 0 : if( FD_UNLIKELY( err ) ) return err;
3124 0 : }
3125 0 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
3126 0 : if( FD_UNLIKELY( err ) ) return err;
3127 0 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
3128 0 : if( FD_UNLIKELY( err ) ) return err;
3129 0 : return FD_BINCODE_SUCCESS;
3130 0 : }
3131 299 : int fd_slot_history_encode_global( fd_slot_history_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3132 299 : int err;
3133 299 : err = fd_bincode_bool_encode( self->has_bits, ctx );
3134 299 : if( FD_UNLIKELY( err ) ) return err;
3135 299 : if( self->has_bits ) {
3136 299 : if( FD_UNLIKELY( err ) ) return err;
3137 299 : err = fd_bincode_uint64_encode( self->bits_bitvec_len, ctx );
3138 299 : if( FD_UNLIKELY( err ) ) return err;
3139 299 : if( self->bits_bitvec_len ) {
3140 299 : uchar * bits_bitvec_laddr = (uchar*)self + self->bits_bitvec_offset;
3141 299 : ulong * bits_bitvec = (ulong *)bits_bitvec_laddr;
3142 4845448 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3143 4845149 : err = fd_bincode_uint64_encode( bits_bitvec[i], ctx );
3144 4845149 : if( FD_UNLIKELY( err ) ) return err;
3145 4845149 : }
3146 299 : }
3147 299 : if( FD_UNLIKELY( err ) ) return err;
3148 299 : }
3149 299 : err = fd_bincode_uint64_encode( self->bits_len, ctx );
3150 299 : if( FD_UNLIKELY( err ) ) return err;
3151 299 : err = fd_bincode_uint64_encode( self->next_slot, ctx );
3152 299 : if( FD_UNLIKELY( err ) ) return err;
3153 299 : return FD_BINCODE_SUCCESS;
3154 299 : }
3155 3845 : static int fd_slot_history_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3156 3845 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3157 2829 : int err = 0;
3158 2829 : {
3159 2829 : uchar o;
3160 2829 : ulong inner_len = 0UL;
3161 2829 : err = fd_bincode_bool_decode( &o, ctx );
3162 2829 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3163 1059 : if( o ) {
3164 1028 : ulong bits_bitvec_len;
3165 1028 : err = fd_bincode_uint64_decode( &bits_bitvec_len, ctx );
3166 1028 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3167 1025 : if( bits_bitvec_len ) {
3168 1025 : *total_sz += 8UL + sizeof(ulong)*bits_bitvec_len;
3169 12729474 : for( ulong i=0; i < bits_bitvec_len; i++ ) {
3170 12728450 : err = fd_bincode_uint64_decode_footprint( ctx );
3171 12728450 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3172 12728450 : }
3173 1025 : }
3174 1024 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3175 1024 : inner_len = bits_bitvec_len;
3176 1024 : if( inner_len==0 ) return FD_BINCODE_ERR_ENCODING;
3177 1024 : }
3178 1055 : ulong len;
3179 1055 : err = fd_bincode_uint64_decode( &len, ctx );
3180 1055 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3181 1037 : if( len > inner_len * sizeof(ulong) * 8UL ) return FD_BINCODE_ERR_ENCODING;
3182 1037 : }
3183 1025 : err = fd_bincode_uint64_decode_footprint( ctx );
3184 1025 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3185 1025 : return 0;
3186 1025 : }
3187 3845 : int fd_slot_history_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3188 3845 : *total_sz += sizeof(fd_slot_history_t);
3189 3845 : void const * start_data = ctx->data;
3190 3845 : int err = fd_slot_history_decode_footprint_inner( ctx, total_sz );
3191 3845 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3192 3845 : ctx->data = start_data;
3193 3845 : return err;
3194 3845 : }
3195 0 : static void fd_slot_history_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3196 0 : fd_slot_history_t * self = (fd_slot_history_t *)struct_mem;
3197 0 : {
3198 0 : uchar o;
3199 0 : fd_bincode_bool_decode_unsafe( &o, ctx );
3200 0 : self->has_bits = !!o;
3201 0 : if( o ) {
3202 0 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
3203 0 : if( self->bits_bitvec_len ) {
3204 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3205 0 : self->bits_bitvec = *alloc_mem;
3206 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
3207 0 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3208 0 : fd_bincode_uint64_decode_unsafe( self->bits_bitvec + i, ctx );
3209 0 : }
3210 0 : } else
3211 0 : self->bits_bitvec = NULL;
3212 0 : } else {
3213 0 : self->bits_bitvec = NULL;
3214 0 : }
3215 0 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
3216 0 : }
3217 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
3218 0 : }
3219 0 : void * fd_slot_history_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3220 0 : fd_slot_history_t * self = (fd_slot_history_t *)mem;
3221 0 : fd_slot_history_new( self );
3222 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_t);
3223 0 : void * * alloc_mem = &alloc_region;
3224 0 : fd_slot_history_decode_inner( mem, alloc_mem, ctx );
3225 0 : return self;
3226 0 : }
3227 1324 : static void fd_slot_history_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3228 1324 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)struct_mem;
3229 1324 : {
3230 1324 : uchar o;
3231 1324 : fd_bincode_bool_decode_unsafe( &o, ctx );
3232 1324 : self->has_bits = !!o;
3233 1324 : if( o ) {
3234 1323 : fd_bincode_uint64_decode_unsafe( &self->bits_bitvec_len, ctx );
3235 1323 : if( self->bits_bitvec_len ) {
3236 1323 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3237 1323 : self->bits_bitvec_offset = (ulong)*alloc_mem - (ulong)struct_mem;
3238 1323 : uchar * cur_mem = (uchar *)(*alloc_mem);
3239 1323 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->bits_bitvec_len;
3240 17289514 : for( ulong i=0; i < self->bits_bitvec_len; i++ ) {
3241 17288191 : fd_bincode_uint64_decode_unsafe( (ulong*)(cur_mem + sizeof(ulong) * i), ctx );
3242 17288191 : }
3243 1323 : } else {
3244 0 : self->bits_bitvec_offset = 0UL;
3245 0 : }
3246 1323 : }
3247 1324 : fd_bincode_uint64_decode_unsafe( &self->bits_len, ctx );
3248 1324 : }
3249 1324 : fd_bincode_uint64_decode_unsafe( &self->next_slot, ctx );
3250 1324 : }
3251 1324 : void * fd_slot_history_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3252 1324 : fd_slot_history_global_t * self = (fd_slot_history_global_t *)mem;
3253 1324 : fd_slot_history_new( (fd_slot_history_t *)self );
3254 1324 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_history_global_t);
3255 1324 : void * * alloc_mem = &alloc_region;
3256 1324 : fd_slot_history_decode_inner_global( mem, alloc_mem, ctx );
3257 1324 : return self;
3258 1324 : }
3259 1324 : void fd_slot_history_new(fd_slot_history_t * self) {
3260 1324 : fd_memset( self, 0, sizeof(fd_slot_history_t) );
3261 1324 : }
3262 0 : ulong fd_slot_history_size( fd_slot_history_t const * self ) {
3263 0 : ulong size = 0;
3264 0 : size += sizeof(char);
3265 0 : if( self->has_bits ) {
3266 0 : do {
3267 0 : size += sizeof(ulong);
3268 0 : size += self->bits_bitvec_len * sizeof(ulong);
3269 0 : } while(0);
3270 0 : }
3271 0 : size += sizeof(ulong);
3272 0 : size += sizeof(ulong);
3273 0 : return size;
3274 0 : }
3275 :
3276 0 : ulong fd_slot_history_size_global( fd_slot_history_global_t const * self ) {
3277 0 : ulong size = 0;
3278 0 : do {
3279 0 : size += sizeof(char);
3280 0 : if( self->has_bits ) {
3281 0 : do {
3282 0 : size += sizeof(ulong);
3283 0 : ulong * bits_bitvec = self->bits_bitvec_offset ? (ulong *)fd_type_pun( (uchar *)self + self->bits_bitvec_offset ) : NULL;
3284 0 : size += self->bits_bitvec_len * sizeof(ulong);
3285 0 : } while(0);
3286 0 : }
3287 0 : } while(0);
3288 0 : size += sizeof(ulong);
3289 0 : return size;
3290 0 : }
3291 :
3292 151232 : int fd_slot_hash_encode( fd_slot_hash_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3293 151232 : int err;
3294 151232 : err = fd_bincode_uint64_encode( self->slot, ctx );
3295 151232 : if( FD_UNLIKELY( err ) ) return err;
3296 151232 : err = fd_hash_encode( &self->hash, ctx );
3297 151232 : if( FD_UNLIKELY( err ) ) return err;
3298 151232 : return FD_BINCODE_SUCCESS;
3299 151232 : }
3300 0 : static inline int fd_slot_hash_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3301 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3302 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
3303 0 : return 0;
3304 0 : }
3305 1594533 : static void fd_slot_hash_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3306 1594533 : fd_slot_hash_t * self = (fd_slot_hash_t *)struct_mem;
3307 1594533 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
3308 1594533 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
3309 1594533 : }
3310 0 : void * fd_slot_hash_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3311 0 : fd_slot_hash_t * self = (fd_slot_hash_t *)mem;
3312 0 : fd_slot_hash_new( self );
3313 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hash_t);
3314 0 : void * * alloc_mem = &alloc_region;
3315 0 : fd_slot_hash_decode_inner( mem, alloc_mem, ctx );
3316 0 : return self;
3317 0 : }
3318 0 : int fd_slot_hashes_encode( fd_slot_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3319 0 : int err;
3320 0 : if( self->hashes ) {
3321 0 : ulong hashes_len = deq_fd_slot_hash_t_cnt( self->hashes );
3322 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3323 0 : if( FD_UNLIKELY( err ) ) return err;
3324 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 ) ) {
3325 0 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( self->hashes, iter );
3326 0 : err = fd_slot_hash_encode( ele, ctx );
3327 0 : if( FD_UNLIKELY( err ) ) return err;
3328 0 : }
3329 0 : } else {
3330 0 : ulong hashes_len = 0;
3331 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3332 0 : if( FD_UNLIKELY( err ) ) return err;
3333 0 : }
3334 0 : return FD_BINCODE_SUCCESS;
3335 0 : }
3336 299 : int fd_slot_hashes_encode_global( fd_slot_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3337 299 : int err;
3338 299 : if( self->hashes_offset ) {
3339 299 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
3340 299 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join( hashes_laddr );
3341 299 : ulong hashes_len = deq_fd_slot_hash_t_cnt( hashes );
3342 299 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3343 299 : if( FD_UNLIKELY( err ) ) return err;
3344 151554 : 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 ) ) {
3345 151255 : fd_slot_hash_t const * ele = deq_fd_slot_hash_t_iter_ele_const( hashes, iter );
3346 151255 : err = fd_slot_hash_encode( ele, ctx );
3347 151255 : if( FD_UNLIKELY( err ) ) return err;
3348 151255 : }
3349 299 : } else {
3350 0 : ulong hashes_len = 0;
3351 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3352 0 : if( FD_UNLIKELY( err ) ) return err;
3353 0 : }
3354 299 : return FD_BINCODE_SUCCESS;
3355 299 : }
3356 30440 : static int fd_slot_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3357 30440 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3358 30440 : int err = 0;
3359 30440 : ulong hashes_len;
3360 30440 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
3361 30440 : if( FD_UNLIKELY( err ) ) return err;
3362 30440 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
3363 30440 : *total_sz += deq_fd_slot_hash_t_align() + deq_fd_slot_hash_t_footprint( hashes_max );
3364 30440 : ulong hashes_sz;
3365 30440 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3366 30402 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
3367 30402 : if( FD_UNLIKELY( err ) ) return err;
3368 30393 : return 0;
3369 30402 : }
3370 30460 : int fd_slot_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3371 30460 : *total_sz += sizeof(fd_slot_hashes_t);
3372 30460 : void const * start_data = ctx->data;
3373 30460 : int err = fd_slot_hashes_decode_footprint_inner( ctx, total_sz );
3374 30460 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3375 30460 : ctx->data = start_data;
3376 30460 : return err;
3377 30460 : }
3378 0 : static void fd_slot_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3379 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)struct_mem;
3380 0 : ulong hashes_len;
3381 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3382 0 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
3383 0 : self->hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
3384 0 : for( ulong i=0; i < hashes_len; i++ ) {
3385 0 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( self->hashes );
3386 0 : fd_slot_hash_new( elem );
3387 0 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
3388 0 : }
3389 0 : }
3390 0 : void * fd_slot_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3391 0 : fd_slot_hashes_t * self = (fd_slot_hashes_t *)mem;
3392 0 : fd_slot_hashes_new( self );
3393 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_t);
3394 0 : void * * alloc_mem = &alloc_region;
3395 0 : fd_slot_hashes_decode_inner( mem, alloc_mem, ctx );
3396 0 : return self;
3397 0 : }
3398 30701 : static void fd_slot_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3399 30701 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)struct_mem;
3400 30701 : ulong hashes_len;
3401 30701 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3402 30701 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_slot_hash_t_align() );
3403 30701 : ulong hashes_max = fd_ulong_max( hashes_len, 512 );
3404 30701 : fd_slot_hash_t * hashes = deq_fd_slot_hash_t_join_new( alloc_mem, hashes_max );
3405 1625360 : for( ulong i=0; i < hashes_len; i++ ) {
3406 1594659 : fd_slot_hash_t * elem = deq_fd_slot_hash_t_push_tail_nocopy( hashes );
3407 1594659 : fd_slot_hash_new( (fd_slot_hash_t*)fd_type_pun( elem ) );
3408 1594659 : fd_slot_hash_decode_inner( elem, alloc_mem, ctx );
3409 1594659 : }
3410 30701 : self->hashes_offset = (ulong)deq_fd_slot_hash_t_leave( hashes ) - (ulong)struct_mem;
3411 30701 : }
3412 30695 : void * fd_slot_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3413 30695 : fd_slot_hashes_global_t * self = (fd_slot_hashes_global_t *)mem;
3414 30695 : fd_slot_hashes_new( (fd_slot_hashes_t *)self );
3415 30695 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_hashes_global_t);
3416 30695 : void * * alloc_mem = &alloc_region;
3417 30695 : fd_slot_hashes_decode_inner_global( mem, alloc_mem, ctx );
3418 30695 : return self;
3419 30695 : }
3420 30695 : void fd_slot_hashes_new(fd_slot_hashes_t * self) {
3421 30695 : fd_memset( self, 0, sizeof(fd_slot_hashes_t) );
3422 30695 : }
3423 0 : ulong fd_slot_hashes_size( fd_slot_hashes_t const * self ) {
3424 0 : ulong size = 0;
3425 0 : if( self->hashes ) {
3426 0 : size += sizeof(ulong);
3427 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 ) ) {
3428 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( self->hashes, iter );
3429 0 : size += fd_slot_hash_size( ele );
3430 0 : }
3431 0 : } else {
3432 0 : size += sizeof(ulong);
3433 0 : }
3434 0 : return size;
3435 0 : }
3436 :
3437 0 : ulong fd_slot_hashes_size_global( fd_slot_hashes_global_t const * self ) {
3438 0 : ulong size = 0;
3439 0 : if( self->hashes_offset!=0 ) {
3440 0 : fd_slot_hash_t * hashes = (fd_slot_hash_t *)deq_fd_slot_hash_t_join( fd_type_pun( (uchar *)self + self->hashes_offset ) );
3441 0 : size += sizeof(ulong);
3442 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 ) ) {
3443 0 : fd_slot_hash_t * ele = deq_fd_slot_hash_t_iter_ele( hashes, iter );
3444 0 : size += fd_slot_hash_size( ele );
3445 0 : }
3446 0 : } else {
3447 0 : size += sizeof(ulong);
3448 0 : }
3449 0 : return size;
3450 0 : }
3451 :
3452 0 : int fd_block_block_hash_entry_encode( fd_block_block_hash_entry_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3453 0 : int err;
3454 0 : err = fd_hash_encode( &self->blockhash, ctx );
3455 0 : if( FD_UNLIKELY( err ) ) return err;
3456 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
3457 0 : if( FD_UNLIKELY( err ) ) return err;
3458 0 : return FD_BINCODE_SUCCESS;
3459 0 : }
3460 0 : static inline int fd_block_block_hash_entry_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3461 0 : if( (ulong)ctx->data + 40UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3462 0 : ctx->data = (void *)( (ulong)ctx->data + 40UL );
3463 0 : return 0;
3464 0 : }
3465 3754636 : static void fd_block_block_hash_entry_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3466 3754636 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)struct_mem;
3467 3754636 : fd_hash_decode_inner( &self->blockhash, alloc_mem, ctx );
3468 3754636 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
3469 3754636 : }
3470 0 : void * fd_block_block_hash_entry_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3471 0 : fd_block_block_hash_entry_t * self = (fd_block_block_hash_entry_t *)mem;
3472 0 : fd_block_block_hash_entry_new( self );
3473 0 : void * alloc_region = (uchar *)mem + sizeof(fd_block_block_hash_entry_t);
3474 0 : void * * alloc_mem = &alloc_region;
3475 0 : fd_block_block_hash_entry_decode_inner( mem, alloc_mem, ctx );
3476 0 : return self;
3477 0 : }
3478 0 : int fd_recent_block_hashes_encode( fd_recent_block_hashes_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3479 0 : int err;
3480 0 : if( self->hashes ) {
3481 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( self->hashes );
3482 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3483 0 : if( FD_UNLIKELY( err ) ) return err;
3484 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 ) ) {
3485 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( self->hashes, iter );
3486 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
3487 0 : if( FD_UNLIKELY( err ) ) return err;
3488 0 : }
3489 0 : } else {
3490 0 : ulong hashes_len = 0;
3491 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3492 0 : if( FD_UNLIKELY( err ) ) return err;
3493 0 : }
3494 0 : return FD_BINCODE_SUCCESS;
3495 0 : }
3496 0 : int fd_recent_block_hashes_encode_global( fd_recent_block_hashes_global_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3497 0 : int err;
3498 0 : if( self->hashes_offset ) {
3499 0 : uchar * hashes_laddr = (uchar*)self + self->hashes_offset;
3500 0 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join( hashes_laddr );
3501 0 : ulong hashes_len = deq_fd_block_block_hash_entry_t_cnt( hashes );
3502 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3503 0 : if( FD_UNLIKELY( err ) ) return err;
3504 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 ) ) {
3505 0 : fd_block_block_hash_entry_t const * ele = deq_fd_block_block_hash_entry_t_iter_ele_const( hashes, iter );
3506 0 : err = fd_block_block_hash_entry_encode( ele, ctx );
3507 0 : if( FD_UNLIKELY( err ) ) return err;
3508 0 : }
3509 0 : } else {
3510 0 : ulong hashes_len = 0;
3511 0 : err = fd_bincode_uint64_encode( hashes_len, ctx );
3512 0 : if( FD_UNLIKELY( err ) ) return err;
3513 0 : }
3514 0 : return FD_BINCODE_SUCCESS;
3515 0 : }
3516 26898 : static int fd_recent_block_hashes_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3517 26898 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3518 26898 : int err = 0;
3519 26898 : ulong hashes_len;
3520 26898 : err = fd_bincode_uint64_decode( &hashes_len, ctx );
3521 26898 : if( FD_UNLIKELY( err ) ) return err;
3522 26898 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
3523 26898 : *total_sz += deq_fd_block_block_hash_entry_t_align() + deq_fd_block_block_hash_entry_t_footprint( hashes_max );
3524 26898 : ulong hashes_sz;
3525 26898 : if( FD_UNLIKELY( __builtin_umull_overflow( hashes_len, 40, &hashes_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
3526 26898 : err = fd_bincode_bytes_decode_footprint( hashes_sz, ctx );
3527 26898 : if( FD_UNLIKELY( err ) ) return err;
3528 26898 : return 0;
3529 26898 : }
3530 26922 : int fd_recent_block_hashes_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3531 26922 : *total_sz += sizeof(fd_recent_block_hashes_t);
3532 26922 : void const * start_data = ctx->data;
3533 26922 : int err = fd_recent_block_hashes_decode_footprint_inner( ctx, total_sz );
3534 26922 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3535 26922 : ctx->data = start_data;
3536 26922 : return err;
3537 26922 : }
3538 0 : static void fd_recent_block_hashes_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3539 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)struct_mem;
3540 0 : ulong hashes_len;
3541 0 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3542 0 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
3543 0 : self->hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
3544 0 : for( ulong i=0; i < hashes_len; i++ ) {
3545 0 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( self->hashes );
3546 0 : fd_block_block_hash_entry_new( elem );
3547 0 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
3548 0 : }
3549 0 : }
3550 0 : void * fd_recent_block_hashes_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3551 0 : fd_recent_block_hashes_t * self = (fd_recent_block_hashes_t *)mem;
3552 0 : fd_recent_block_hashes_new( self );
3553 0 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_t);
3554 0 : void * * alloc_mem = &alloc_region;
3555 0 : fd_recent_block_hashes_decode_inner( mem, alloc_mem, ctx );
3556 0 : return self;
3557 0 : }
3558 26906 : static void fd_recent_block_hashes_decode_inner_global( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3559 26906 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)struct_mem;
3560 26906 : ulong hashes_len;
3561 26906 : fd_bincode_uint64_decode_unsafe( &hashes_len, ctx );
3562 26906 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)*alloc_mem, deq_fd_block_block_hash_entry_t_align() );
3563 26906 : ulong hashes_max = fd_ulong_max( hashes_len, 151 );
3564 26906 : fd_block_block_hash_entry_t * hashes = deq_fd_block_block_hash_entry_t_join_new( alloc_mem, hashes_max );
3565 3781583 : for( ulong i=0; i < hashes_len; i++ ) {
3566 3754677 : fd_block_block_hash_entry_t * elem = deq_fd_block_block_hash_entry_t_push_tail_nocopy( hashes );
3567 3754677 : fd_block_block_hash_entry_new( (fd_block_block_hash_entry_t*)fd_type_pun( elem ) );
3568 3754677 : fd_block_block_hash_entry_decode_inner( elem, alloc_mem, ctx );
3569 3754677 : }
3570 26906 : self->hashes_offset = (ulong)deq_fd_block_block_hash_entry_t_leave( hashes ) - (ulong)struct_mem;
3571 26906 : }
3572 26906 : void * fd_recent_block_hashes_decode_global( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3573 26906 : fd_recent_block_hashes_global_t * self = (fd_recent_block_hashes_global_t *)mem;
3574 26906 : fd_recent_block_hashes_new( (fd_recent_block_hashes_t *)self );
3575 26906 : void * alloc_region = (uchar *)mem + sizeof(fd_recent_block_hashes_global_t);
3576 26906 : void * * alloc_mem = &alloc_region;
3577 26906 : fd_recent_block_hashes_decode_inner_global( mem, alloc_mem, ctx );
3578 26906 : return self;
3579 26906 : }
3580 26909 : void fd_recent_block_hashes_new(fd_recent_block_hashes_t * self) {
3581 26909 : fd_memset( self, 0, sizeof(fd_recent_block_hashes_t) );
3582 26909 : }
3583 0 : ulong fd_recent_block_hashes_size( fd_recent_block_hashes_t const * self ) {
3584 0 : ulong size = 0;
3585 0 : if( self->hashes ) {
3586 0 : size += sizeof(ulong);
3587 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 ) ) {
3588 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( self->hashes, iter );
3589 0 : size += fd_block_block_hash_entry_size( ele );
3590 0 : }
3591 0 : } else {
3592 0 : size += sizeof(ulong);
3593 0 : }
3594 0 : return size;
3595 0 : }
3596 :
3597 0 : ulong fd_recent_block_hashes_size_global( fd_recent_block_hashes_global_t const * self ) {
3598 0 : ulong size = 0;
3599 0 : if( self->hashes_offset!=0 ) {
3600 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 ) );
3601 0 : size += sizeof(ulong);
3602 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 ) ) {
3603 0 : fd_block_block_hash_entry_t * ele = deq_fd_block_block_hash_entry_t_iter_ele( hashes, iter );
3604 0 : size += fd_block_block_hash_entry_size( ele );
3605 0 : }
3606 0 : } else {
3607 0 : size += sizeof(ulong);
3608 0 : }
3609 0 : return size;
3610 0 : }
3611 :
3612 0 : int fd_slot_meta_encode( fd_slot_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3613 0 : int err;
3614 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
3615 0 : if( FD_UNLIKELY( err ) ) return err;
3616 0 : err = fd_bincode_uint64_encode( self->consumed, ctx );
3617 0 : if( FD_UNLIKELY( err ) ) return err;
3618 0 : err = fd_bincode_uint64_encode( self->received, ctx );
3619 0 : if( FD_UNLIKELY( err ) ) return err;
3620 0 : err = fd_bincode_uint64_encode( (ulong)self->first_shred_timestamp, ctx );
3621 0 : if( FD_UNLIKELY( err ) ) return err;
3622 0 : err = fd_bincode_uint64_encode( self->last_index, ctx );
3623 0 : if( FD_UNLIKELY( err ) ) return err;
3624 0 : err = fd_bincode_uint64_encode( self->parent_slot, ctx );
3625 0 : if( FD_UNLIKELY( err ) ) return err;
3626 0 : err = fd_bincode_uint64_encode( self->next_slot_len, ctx );
3627 0 : if( FD_UNLIKELY(err) ) return err;
3628 0 : if( self->next_slot_len ) {
3629 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
3630 0 : err = fd_bincode_uint64_encode( self->next_slot[i], ctx );
3631 0 : }
3632 0 : }
3633 0 : err = fd_bincode_uint8_encode( (uchar)(self->is_connected), ctx );
3634 0 : if( FD_UNLIKELY( err ) ) return err;
3635 0 : return FD_BINCODE_SUCCESS;
3636 0 : }
3637 0 : static int fd_slot_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3638 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3639 0 : int err = 0;
3640 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3641 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3642 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3643 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3644 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3645 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3646 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3647 0 : if( FD_UNLIKELY( err ) ) return err;
3648 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3649 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3650 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3651 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3652 0 : ulong next_slot_len;
3653 0 : err = fd_bincode_uint64_decode( &next_slot_len, ctx );
3654 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3655 0 : if( next_slot_len ) {
3656 0 : *total_sz += 8UL + sizeof(ulong)*next_slot_len;
3657 0 : for( ulong i=0; i < next_slot_len; i++ ) {
3658 0 : err = fd_bincode_uint64_decode_footprint( ctx );
3659 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3660 0 : }
3661 0 : }
3662 0 : err = fd_bincode_uint8_decode_footprint( ctx );
3663 0 : if( FD_UNLIKELY( err ) ) return err;
3664 0 : return 0;
3665 0 : }
3666 0 : int fd_slot_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3667 0 : *total_sz += sizeof(fd_slot_meta_t);
3668 0 : void const * start_data = ctx->data;
3669 0 : int err = fd_slot_meta_decode_footprint_inner( ctx, total_sz );
3670 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3671 0 : ctx->data = start_data;
3672 0 : return err;
3673 0 : }
3674 0 : static void fd_slot_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3675 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)struct_mem;
3676 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
3677 0 : fd_bincode_uint64_decode_unsafe( &self->consumed, ctx );
3678 0 : fd_bincode_uint64_decode_unsafe( &self->received, ctx );
3679 0 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->first_shred_timestamp, ctx );
3680 0 : fd_bincode_uint64_decode_unsafe( &self->last_index, ctx );
3681 0 : fd_bincode_uint64_decode_unsafe( &self->parent_slot, ctx );
3682 0 : fd_bincode_uint64_decode_unsafe( &self->next_slot_len, ctx );
3683 0 : if( self->next_slot_len ) {
3684 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), 8UL );
3685 0 : self->next_slot = *alloc_mem;
3686 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(ulong)*self->next_slot_len;
3687 0 : for( ulong i=0; i < self->next_slot_len; i++ ) {
3688 0 : fd_bincode_uint64_decode_unsafe( self->next_slot + i, ctx );
3689 0 : }
3690 0 : } else
3691 0 : self->next_slot = NULL;
3692 0 : fd_bincode_uint8_decode_unsafe( &self->is_connected, ctx );
3693 0 : }
3694 0 : void * fd_slot_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3695 0 : fd_slot_meta_t * self = (fd_slot_meta_t *)mem;
3696 0 : fd_slot_meta_new( self );
3697 0 : void * alloc_region = (uchar *)mem + sizeof(fd_slot_meta_t);
3698 0 : void * * alloc_mem = &alloc_region;
3699 0 : fd_slot_meta_decode_inner( mem, alloc_mem, ctx );
3700 0 : return self;
3701 0 : }
3702 0 : void fd_slot_meta_new(fd_slot_meta_t * self) {
3703 0 : fd_memset( self, 0, sizeof(fd_slot_meta_t) );
3704 0 : }
3705 0 : ulong fd_slot_meta_size( fd_slot_meta_t const * self ) {
3706 0 : ulong size = 0;
3707 0 : size += sizeof(ulong);
3708 0 : size += sizeof(ulong);
3709 0 : size += sizeof(ulong);
3710 0 : size += sizeof(long);
3711 0 : size += sizeof(ulong);
3712 0 : size += sizeof(ulong);
3713 0 : do {
3714 0 : size += sizeof(ulong);
3715 0 : size += self->next_slot_len * sizeof(ulong);
3716 0 : } while(0);
3717 0 : size += sizeof(char);
3718 0 : return size;
3719 0 : }
3720 :
3721 0 : int fd_sysvar_fees_encode( fd_sysvar_fees_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3722 0 : int err;
3723 0 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
3724 0 : if( FD_UNLIKELY( err ) ) return err;
3725 0 : return FD_BINCODE_SUCCESS;
3726 0 : }
3727 0 : static inline int fd_sysvar_fees_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3728 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3729 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
3730 0 : return 0;
3731 0 : }
3732 0 : static void fd_sysvar_fees_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3733 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)struct_mem;
3734 0 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
3735 0 : }
3736 0 : void * fd_sysvar_fees_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3737 0 : fd_sysvar_fees_t * self = (fd_sysvar_fees_t *)mem;
3738 0 : fd_sysvar_fees_new( self );
3739 0 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_fees_t);
3740 0 : void * * alloc_mem = &alloc_region;
3741 0 : fd_sysvar_fees_decode_inner( mem, alloc_mem, ctx );
3742 0 : return self;
3743 0 : }
3744 6 : int fd_sysvar_epoch_rewards_encode( fd_sysvar_epoch_rewards_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3745 6 : int err;
3746 6 : err = fd_bincode_uint64_encode( self->distribution_starting_block_height, ctx );
3747 6 : if( FD_UNLIKELY( err ) ) return err;
3748 6 : err = fd_bincode_uint64_encode( self->num_partitions, ctx );
3749 6 : if( FD_UNLIKELY( err ) ) return err;
3750 6 : err = fd_hash_encode( &self->parent_blockhash, ctx );
3751 6 : if( FD_UNLIKELY( err ) ) return err;
3752 6 : err = fd_bincode_uint128_encode( self->total_points, ctx );
3753 6 : if( FD_UNLIKELY( err ) ) return err;
3754 6 : err = fd_bincode_uint64_encode( self->total_rewards, ctx );
3755 6 : if( FD_UNLIKELY( err ) ) return err;
3756 6 : err = fd_bincode_uint64_encode( self->distributed_rewards, ctx );
3757 6 : if( FD_UNLIKELY( err ) ) return err;
3758 6 : err = fd_bincode_bool_encode( (uchar)(self->active), ctx );
3759 6 : if( FD_UNLIKELY( err ) ) return err;
3760 6 : return FD_BINCODE_SUCCESS;
3761 6 : }
3762 4598 : static int fd_sysvar_epoch_rewards_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3763 4598 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3764 4587 : int err = 0;
3765 4587 : err = fd_bincode_uint64_decode_footprint( ctx );
3766 4587 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3767 4586 : err = fd_bincode_uint64_decode_footprint( ctx );
3768 4586 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3769 4583 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
3770 4583 : if( FD_UNLIKELY( err ) ) return err;
3771 4494 : err = fd_bincode_uint128_decode_footprint( ctx );
3772 4494 : if( FD_UNLIKELY( err ) ) return err;
3773 4493 : err = fd_bincode_uint64_decode_footprint( ctx );
3774 4493 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3775 4491 : err = fd_bincode_uint64_decode_footprint( ctx );
3776 4491 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3777 4490 : err = fd_bincode_bool_decode_footprint( ctx );
3778 4490 : if( FD_UNLIKELY( err ) ) return err;
3779 4478 : return 0;
3780 4490 : }
3781 4598 : int fd_sysvar_epoch_rewards_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3782 4598 : *total_sz += sizeof(fd_sysvar_epoch_rewards_t);
3783 4598 : void const * start_data = ctx->data;
3784 4598 : int err = fd_sysvar_epoch_rewards_decode_footprint_inner( ctx, total_sz );
3785 4598 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3786 4598 : ctx->data = start_data;
3787 4598 : return err;
3788 4598 : }
3789 4479 : static void fd_sysvar_epoch_rewards_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3790 4479 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)struct_mem;
3791 4479 : fd_bincode_uint64_decode_unsafe( &self->distribution_starting_block_height, ctx );
3792 4479 : fd_bincode_uint64_decode_unsafe( &self->num_partitions, ctx );
3793 4479 : fd_hash_decode_inner( &self->parent_blockhash, alloc_mem, ctx );
3794 4479 : fd_bincode_uint128_decode_unsafe( &self->total_points, ctx );
3795 4479 : fd_bincode_uint64_decode_unsafe( &self->total_rewards, ctx );
3796 4479 : fd_bincode_uint64_decode_unsafe( &self->distributed_rewards, ctx );
3797 4479 : fd_bincode_bool_decode_unsafe( &self->active, ctx );
3798 4479 : }
3799 4479 : void * fd_sysvar_epoch_rewards_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3800 4479 : fd_sysvar_epoch_rewards_t * self = (fd_sysvar_epoch_rewards_t *)mem;
3801 4479 : fd_sysvar_epoch_rewards_new( self );
3802 4479 : void * alloc_region = (uchar *)mem + sizeof(fd_sysvar_epoch_rewards_t);
3803 4479 : void * * alloc_mem = &alloc_region;
3804 4479 : fd_sysvar_epoch_rewards_decode_inner( mem, alloc_mem, ctx );
3805 4479 : return self;
3806 4479 : }
3807 4479 : void fd_sysvar_epoch_rewards_new(fd_sysvar_epoch_rewards_t * self) {
3808 4479 : fd_memset( self, 0, sizeof(fd_sysvar_epoch_rewards_t) );
3809 4479 : fd_hash_new( &self->parent_blockhash );
3810 4479 : }
3811 0 : int fd_config_keys_pair_encode( fd_config_keys_pair_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3812 0 : int err;
3813 0 : err = fd_pubkey_encode( &self->key, ctx );
3814 0 : if( FD_UNLIKELY( err ) ) return err;
3815 0 : err = fd_bincode_bool_encode( (uchar)(self->signer), ctx );
3816 0 : if( FD_UNLIKELY( err ) ) return err;
3817 0 : return FD_BINCODE_SUCCESS;
3818 0 : }
3819 0 : static int fd_config_keys_pair_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3820 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3821 0 : int err = 0;
3822 0 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
3823 0 : if( FD_UNLIKELY( err ) ) return err;
3824 0 : err = fd_bincode_bool_decode_footprint( ctx );
3825 0 : if( FD_UNLIKELY( err ) ) return err;
3826 0 : return 0;
3827 0 : }
3828 0 : int fd_config_keys_pair_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3829 0 : *total_sz += sizeof(fd_config_keys_pair_t);
3830 0 : void const * start_data = ctx->data;
3831 0 : int err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
3832 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3833 0 : ctx->data = start_data;
3834 0 : return err;
3835 0 : }
3836 0 : static void fd_config_keys_pair_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3837 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)struct_mem;
3838 0 : fd_pubkey_decode_inner( &self->key, alloc_mem, ctx );
3839 0 : fd_bincode_bool_decode_unsafe( &self->signer, ctx );
3840 0 : }
3841 0 : void * fd_config_keys_pair_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3842 0 : fd_config_keys_pair_t * self = (fd_config_keys_pair_t *)mem;
3843 0 : fd_config_keys_pair_new( self );
3844 0 : void * alloc_region = (uchar *)mem + sizeof(fd_config_keys_pair_t);
3845 0 : void * * alloc_mem = &alloc_region;
3846 0 : fd_config_keys_pair_decode_inner( mem, alloc_mem, ctx );
3847 0 : return self;
3848 0 : }
3849 0 : void fd_config_keys_pair_new(fd_config_keys_pair_t * self) {
3850 0 : fd_memset( self, 0, sizeof(fd_config_keys_pair_t) );
3851 0 : fd_pubkey_new( &self->key );
3852 0 : }
3853 0 : int fd_stake_config_encode( fd_stake_config_t const * self, fd_bincode_encode_ctx_t * ctx ) {
3854 0 : int err;
3855 0 : err = fd_bincode_compact_u16_encode( &self->config_keys_len, ctx );
3856 0 : if( FD_UNLIKELY(err) ) return err;
3857 0 : if( self->config_keys_len ) {
3858 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
3859 0 : err = fd_config_keys_pair_encode( self->config_keys + i, ctx );
3860 0 : if( FD_UNLIKELY( err ) ) return err;
3861 0 : }
3862 0 : }
3863 0 : err = fd_bincode_double_encode( self->warmup_cooldown_rate, ctx );
3864 0 : if( FD_UNLIKELY( err ) ) return err;
3865 0 : err = fd_bincode_uint8_encode( (uchar)(self->slash_penalty), ctx );
3866 0 : if( FD_UNLIKELY( err ) ) return err;
3867 0 : return FD_BINCODE_SUCCESS;
3868 0 : }
3869 0 : static int fd_stake_config_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3870 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3871 0 : int err = 0;
3872 0 : ushort config_keys_len;
3873 0 : err = fd_bincode_compact_u16_decode( &config_keys_len, ctx );
3874 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3875 0 : if( config_keys_len ) {
3876 0 : *total_sz += FD_CONFIG_KEYS_PAIR_ALIGN + sizeof(fd_config_keys_pair_t)*config_keys_len;
3877 0 : for( ulong i=0; i < config_keys_len; i++ ) {
3878 0 : err = fd_config_keys_pair_decode_footprint_inner( ctx, total_sz );
3879 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
3880 0 : }
3881 0 : }
3882 0 : err = fd_bincode_double_decode_footprint( ctx );
3883 0 : if( FD_UNLIKELY( err ) ) return err;
3884 0 : err = fd_bincode_uint8_decode_footprint( ctx );
3885 0 : if( FD_UNLIKELY( err ) ) return err;
3886 0 : return 0;
3887 0 : }
3888 0 : int fd_stake_config_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3889 0 : *total_sz += sizeof(fd_stake_config_t);
3890 0 : void const * start_data = ctx->data;
3891 0 : int err = fd_stake_config_decode_footprint_inner( ctx, total_sz );
3892 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3893 0 : ctx->data = start_data;
3894 0 : return err;
3895 0 : }
3896 0 : static void fd_stake_config_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3897 0 : fd_stake_config_t * self = (fd_stake_config_t *)struct_mem;
3898 0 : fd_bincode_compact_u16_decode_unsafe( &self->config_keys_len, ctx );
3899 0 : if( self->config_keys_len ) {
3900 0 : *alloc_mem = (void*)fd_ulong_align_up( (ulong)(*alloc_mem), FD_CONFIG_KEYS_PAIR_ALIGN );
3901 0 : self->config_keys = *alloc_mem;
3902 0 : *alloc_mem = (uchar *)(*alloc_mem) + sizeof(fd_config_keys_pair_t)*self->config_keys_len;
3903 0 : for( ulong i=0; i < self->config_keys_len; i++ ) {
3904 0 : fd_config_keys_pair_new( self->config_keys + i );
3905 0 : fd_config_keys_pair_decode_inner( self->config_keys + i, alloc_mem, ctx );
3906 0 : }
3907 0 : } else
3908 0 : self->config_keys = NULL;
3909 0 : fd_bincode_double_decode_unsafe( &self->warmup_cooldown_rate, ctx );
3910 0 : fd_bincode_uint8_decode_unsafe( &self->slash_penalty, ctx );
3911 0 : }
3912 0 : void * fd_stake_config_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3913 0 : fd_stake_config_t * self = (fd_stake_config_t *)mem;
3914 0 : fd_stake_config_new( self );
3915 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_config_t);
3916 0 : void * * alloc_mem = &alloc_region;
3917 0 : fd_stake_config_decode_inner( mem, alloc_mem, ctx );
3918 0 : return self;
3919 0 : }
3920 0 : void fd_stake_config_new(fd_stake_config_t * self) {
3921 0 : fd_memset( self, 0, sizeof(fd_stake_config_t) );
3922 0 : }
3923 0 : ulong fd_stake_config_size( fd_stake_config_t const * self ) {
3924 0 : ulong size = 0;
3925 0 : do {
3926 0 : ushort tmp = (ushort)self->config_keys_len;
3927 0 : size += fd_bincode_compact_u16_size( &tmp );
3928 0 : for( ulong i=0; i < self->config_keys_len; i++ )
3929 0 : size += fd_config_keys_pair_size( self->config_keys + i );
3930 0 : } while(0);
3931 0 : size += sizeof(double);
3932 0 : size += sizeof(char);
3933 0 : return size;
3934 0 : }
3935 :
3936 0 : FD_FN_PURE uchar fd_cluster_type_is_Testnet(fd_cluster_type_t const * self) {
3937 0 : return self->discriminant == 0;
3938 0 : }
3939 0 : FD_FN_PURE uchar fd_cluster_type_is_MainnetBeta(fd_cluster_type_t const * self) {
3940 0 : return self->discriminant == 1;
3941 0 : }
3942 0 : FD_FN_PURE uchar fd_cluster_type_is_Devnet(fd_cluster_type_t const * self) {
3943 0 : return self->discriminant == 2;
3944 0 : }
3945 0 : FD_FN_PURE uchar fd_cluster_type_is_Development(fd_cluster_type_t const * self) {
3946 0 : return self->discriminant == 3;
3947 0 : }
3948 0 : int fd_cluster_type_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3949 0 : int err;
3950 0 : switch (discriminant) {
3951 0 : case 0: {
3952 0 : return FD_BINCODE_SUCCESS;
3953 0 : }
3954 0 : case 1: {
3955 0 : return FD_BINCODE_SUCCESS;
3956 0 : }
3957 0 : case 2: {
3958 0 : return FD_BINCODE_SUCCESS;
3959 0 : }
3960 0 : case 3: {
3961 0 : return FD_BINCODE_SUCCESS;
3962 0 : }
3963 0 : default: return FD_BINCODE_ERR_ENCODING;
3964 0 : }
3965 0 : }
3966 0 : static int fd_cluster_type_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3967 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3968 0 : uint discriminant = 0;
3969 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
3970 0 : if( FD_UNLIKELY( err ) ) return err;
3971 0 : return fd_cluster_type_inner_decode_footprint( discriminant, ctx, total_sz );
3972 0 : }
3973 0 : int fd_cluster_type_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
3974 0 : *total_sz += sizeof(fd_cluster_type_t);
3975 0 : void const * start_data = ctx->data;
3976 0 : int err = fd_cluster_type_decode_footprint_inner( ctx, total_sz );
3977 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
3978 0 : ctx->data = start_data;
3979 0 : return err;
3980 0 : }
3981 0 : static void fd_cluster_type_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
3982 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)struct_mem;
3983 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
3984 0 : }
3985 0 : void * fd_cluster_type_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
3986 0 : fd_cluster_type_t * self = (fd_cluster_type_t *)mem;
3987 0 : fd_cluster_type_new( self );
3988 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_type_t);
3989 0 : void * * alloc_mem = &alloc_region;
3990 0 : fd_cluster_type_decode_inner( mem, alloc_mem, ctx );
3991 0 : return self;
3992 0 : }
3993 :
3994 0 : ulong fd_cluster_type_size( fd_cluster_type_t const * self ) {
3995 0 : ulong size = 0;
3996 0 : size += sizeof(uint);
3997 0 : switch (self->discriminant) {
3998 0 : }
3999 0 : return size;
4000 0 : }
4001 :
4002 0 : int fd_cluster_type_encode( fd_cluster_type_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4003 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4004 0 : if( FD_UNLIKELY( err ) ) return err;
4005 0 : return err;
4006 0 : }
4007 :
4008 0 : int fd_cluster_version_encode( fd_cluster_version_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4009 0 : int err;
4010 0 : err = fd_bincode_uint32_encode( self->major, ctx );
4011 0 : if( FD_UNLIKELY( err ) ) return err;
4012 0 : err = fd_bincode_uint32_encode( self->minor, ctx );
4013 0 : if( FD_UNLIKELY( err ) ) return err;
4014 0 : err = fd_bincode_uint32_encode( self->patch, ctx );
4015 0 : if( FD_UNLIKELY( err ) ) return err;
4016 0 : return FD_BINCODE_SUCCESS;
4017 0 : }
4018 0 : static inline int fd_cluster_version_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4019 0 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4020 0 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
4021 0 : return 0;
4022 0 : }
4023 0 : static void fd_cluster_version_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4024 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)struct_mem;
4025 0 : fd_bincode_uint32_decode_unsafe( &self->major, ctx );
4026 0 : fd_bincode_uint32_decode_unsafe( &self->minor, ctx );
4027 0 : fd_bincode_uint32_decode_unsafe( &self->patch, ctx );
4028 0 : }
4029 0 : void * fd_cluster_version_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4030 0 : fd_cluster_version_t * self = (fd_cluster_version_t *)mem;
4031 0 : fd_cluster_version_new( self );
4032 0 : void * alloc_region = (uchar *)mem + sizeof(fd_cluster_version_t);
4033 0 : void * * alloc_mem = &alloc_region;
4034 0 : fd_cluster_version_decode_inner( mem, alloc_mem, ctx );
4035 0 : return self;
4036 0 : }
4037 0 : int fd_vote_encode( fd_vote_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4038 0 : int err;
4039 0 : if( self->slots ) {
4040 0 : ulong slots_len = deq_ulong_cnt( self->slots );
4041 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
4042 0 : if( FD_UNLIKELY( err ) ) return err;
4043 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 ) ) {
4044 0 : ulong const * ele = deq_ulong_iter_ele_const( self->slots, iter );
4045 0 : err = fd_bincode_uint64_encode( ele[0], ctx );
4046 0 : }
4047 0 : } else {
4048 0 : ulong slots_len = 0;
4049 0 : err = fd_bincode_uint64_encode( slots_len, ctx );
4050 0 : if( FD_UNLIKELY( err ) ) return err;
4051 0 : }
4052 0 : err = fd_hash_encode( &self->hash, ctx );
4053 0 : if( FD_UNLIKELY( err ) ) return err;
4054 0 : err = fd_bincode_bool_encode( self->has_timestamp, ctx );
4055 0 : if( FD_UNLIKELY( err ) ) return err;
4056 0 : if( self->has_timestamp ) {
4057 0 : err = fd_bincode_int64_encode( self->timestamp, ctx );
4058 0 : if( FD_UNLIKELY( err ) ) return err;
4059 0 : }
4060 0 : return FD_BINCODE_SUCCESS;
4061 0 : }
4062 202 : static int fd_vote_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4063 202 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4064 201 : int err = 0;
4065 201 : ulong slots_len;
4066 201 : err = fd_bincode_uint64_decode( &slots_len, ctx );
4067 201 : if( FD_UNLIKELY( err ) ) return err;
4068 201 : ulong slots_max = slots_len == 0 ? 1 : slots_len;
4069 201 : *total_sz += deq_ulong_align() + deq_ulong_footprint( slots_max ) ;
4070 201 : ulong slots_sz;
4071 201 : if( FD_UNLIKELY( __builtin_umull_overflow( slots_len, 8, &slots_sz ) ) ) return FD_BINCODE_ERR_UNDERFLOW;
4072 198 : err = fd_bincode_bytes_decode_footprint( slots_sz, ctx );
4073 198 : if( FD_UNLIKELY( err ) ) return err;
4074 195 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4075 195 : if( FD_UNLIKELY( err ) ) return err;
4076 194 : {
4077 194 : uchar o;
4078 194 : err = fd_bincode_bool_decode( &o, ctx );
4079 194 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4080 189 : if( o ) {
4081 87 : err = fd_bincode_int64_decode_footprint( ctx );
4082 87 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4083 87 : }
4084 189 : }
4085 185 : return 0;
4086 189 : }
4087 0 : int fd_vote_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4088 0 : *total_sz += sizeof(fd_vote_t);
4089 0 : void const * start_data = ctx->data;
4090 0 : int err = fd_vote_decode_footprint_inner( ctx, total_sz );
4091 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4092 0 : ctx->data = start_data;
4093 0 : return err;
4094 0 : }
4095 184 : static void fd_vote_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4096 184 : fd_vote_t * self = (fd_vote_t *)struct_mem;
4097 184 : ulong slots_len;
4098 184 : fd_bincode_uint64_decode_unsafe( &slots_len, ctx );
4099 184 : self->slots = deq_ulong_join_new( alloc_mem, slots_len );
4100 2981 : for( ulong i=0; i < slots_len; i++ ) {
4101 2797 : ulong * elem = deq_ulong_push_tail_nocopy( self->slots );
4102 2797 : fd_bincode_uint64_decode_unsafe( elem, ctx );
4103 2797 : }
4104 184 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4105 184 : {
4106 184 : uchar o;
4107 184 : fd_bincode_bool_decode_unsafe( &o, ctx );
4108 184 : self->has_timestamp = !!o;
4109 184 : if( o ) {
4110 83 : fd_bincode_int64_decode_unsafe( &self->timestamp, ctx );
4111 83 : }
4112 184 : }
4113 184 : }
4114 0 : void * fd_vote_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4115 0 : fd_vote_t * self = (fd_vote_t *)mem;
4116 0 : fd_vote_new( self );
4117 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_t);
4118 0 : void * * alloc_mem = &alloc_region;
4119 0 : fd_vote_decode_inner( mem, alloc_mem, ctx );
4120 0 : return self;
4121 0 : }
4122 0 : void fd_vote_new(fd_vote_t * self) {
4123 0 : fd_memset( self, 0, sizeof(fd_vote_t) );
4124 0 : fd_hash_new( &self->hash );
4125 0 : }
4126 0 : ulong fd_vote_size( fd_vote_t const * self ) {
4127 0 : ulong size = 0;
4128 0 : if( self->slots ) {
4129 0 : size += sizeof(ulong);
4130 0 : ulong slots_len = deq_ulong_cnt(self->slots);
4131 0 : size += slots_len * sizeof(ulong);
4132 0 : } else {
4133 0 : size += sizeof(ulong);
4134 0 : }
4135 0 : size += fd_hash_size( &self->hash );
4136 0 : size += sizeof(char);
4137 0 : if( self->has_timestamp ) {
4138 0 : size += sizeof(long);
4139 0 : }
4140 0 : return size;
4141 0 : }
4142 :
4143 0 : int fd_vote_init_encode( fd_vote_init_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4144 0 : int err;
4145 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
4146 0 : if( FD_UNLIKELY( err ) ) return err;
4147 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
4148 0 : if( FD_UNLIKELY( err ) ) return err;
4149 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
4150 0 : if( FD_UNLIKELY( err ) ) return err;
4151 0 : err = fd_bincode_uint8_encode( (uchar)(self->commission), ctx );
4152 0 : if( FD_UNLIKELY( err ) ) return err;
4153 0 : return FD_BINCODE_SUCCESS;
4154 0 : }
4155 65 : static inline int fd_vote_init_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4156 65 : if( (ulong)ctx->data + 97UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4157 25 : ctx->data = (void *)( (ulong)ctx->data + 97UL );
4158 25 : return 0;
4159 65 : }
4160 25 : static void fd_vote_init_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4161 25 : fd_vote_init_t * self = (fd_vote_init_t *)struct_mem;
4162 25 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
4163 25 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
4164 25 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
4165 25 : fd_bincode_uint8_decode_unsafe( &self->commission, ctx );
4166 25 : }
4167 0 : void * fd_vote_init_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4168 0 : fd_vote_init_t * self = (fd_vote_init_t *)mem;
4169 0 : fd_vote_init_new( self );
4170 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_t);
4171 0 : void * * alloc_mem = &alloc_region;
4172 0 : fd_vote_init_decode_inner( mem, alloc_mem, ctx );
4173 0 : return self;
4174 0 : }
4175 0 : int fd_vote_init_v2_encode( fd_vote_init_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4176 0 : int err;
4177 0 : err = fd_pubkey_encode( &self->node_pubkey, ctx );
4178 0 : if( FD_UNLIKELY( err ) ) return err;
4179 0 : err = fd_pubkey_encode( &self->authorized_voter, ctx );
4180 0 : if( FD_UNLIKELY( err ) ) return err;
4181 0 : err = fd_bls_pubkey_compressed_encode( &self->authorized_voter_bls_pubkey, ctx );
4182 0 : if( FD_UNLIKELY( err ) ) return err;
4183 0 : err = fd_bls_proof_of_possession_encode( &self->authorized_voter_bls_proof_of_possession, ctx );
4184 0 : if( FD_UNLIKELY( err ) ) return err;
4185 0 : err = fd_pubkey_encode( &self->authorized_withdrawer, ctx );
4186 0 : if( FD_UNLIKELY( err ) ) return err;
4187 0 : err = fd_bincode_uint16_encode( self->inflation_rewards_commission_bps, ctx );
4188 0 : if( FD_UNLIKELY( err ) ) return err;
4189 0 : err = fd_pubkey_encode( &self->inflation_rewards_collector, ctx );
4190 0 : if( FD_UNLIKELY( err ) ) return err;
4191 0 : err = fd_bincode_uint16_encode( self->block_revenue_commission_bps, ctx );
4192 0 : if( FD_UNLIKELY( err ) ) return err;
4193 0 : err = fd_pubkey_encode( &self->block_revenue_collector, ctx );
4194 0 : if( FD_UNLIKELY( err ) ) return err;
4195 0 : return FD_BINCODE_SUCCESS;
4196 0 : }
4197 0 : static inline int fd_vote_init_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4198 0 : if( (ulong)ctx->data + 308UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4199 0 : ctx->data = (void *)( (ulong)ctx->data + 308UL );
4200 0 : return 0;
4201 0 : }
4202 0 : static void fd_vote_init_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4203 0 : fd_vote_init_v2_t * self = (fd_vote_init_v2_t *)struct_mem;
4204 0 : fd_pubkey_decode_inner( &self->node_pubkey, alloc_mem, ctx );
4205 0 : fd_pubkey_decode_inner( &self->authorized_voter, alloc_mem, ctx );
4206 0 : fd_bls_pubkey_compressed_decode_inner( &self->authorized_voter_bls_pubkey, alloc_mem, ctx );
4207 0 : fd_bls_proof_of_possession_decode_inner( &self->authorized_voter_bls_proof_of_possession, alloc_mem, ctx );
4208 0 : fd_pubkey_decode_inner( &self->authorized_withdrawer, alloc_mem, ctx );
4209 0 : fd_bincode_uint16_decode_unsafe( &self->inflation_rewards_commission_bps, ctx );
4210 0 : fd_pubkey_decode_inner( &self->inflation_rewards_collector, alloc_mem, ctx );
4211 0 : fd_bincode_uint16_decode_unsafe( &self->block_revenue_commission_bps, ctx );
4212 0 : fd_pubkey_decode_inner( &self->block_revenue_collector, alloc_mem, ctx );
4213 0 : }
4214 0 : void * fd_vote_init_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4215 0 : fd_vote_init_v2_t * self = (fd_vote_init_v2_t *)mem;
4216 0 : fd_vote_init_v2_new( self );
4217 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_init_v2_t);
4218 0 : void * * alloc_mem = &alloc_region;
4219 0 : fd_vote_init_v2_decode_inner( mem, alloc_mem, ctx );
4220 0 : return self;
4221 0 : }
4222 0 : int fd_voter_with_bls_args_encode( fd_voter_with_bls_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4223 0 : int err;
4224 0 : err = fd_bls_pubkey_compressed_encode( &self->bls_pubkey, ctx );
4225 0 : if( FD_UNLIKELY( err ) ) return err;
4226 0 : err = fd_bls_proof_of_possession_encode( &self->bls_proof_of_possession, ctx );
4227 0 : if( FD_UNLIKELY( err ) ) return err;
4228 0 : return FD_BINCODE_SUCCESS;
4229 0 : }
4230 0 : static inline int fd_voter_with_bls_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4231 0 : if( (ulong)ctx->data + 144UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4232 0 : ctx->data = (void *)( (ulong)ctx->data + 144UL );
4233 0 : return 0;
4234 0 : }
4235 0 : static void fd_voter_with_bls_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4236 0 : fd_voter_with_bls_args_t * self = (fd_voter_with_bls_args_t *)struct_mem;
4237 0 : fd_bls_pubkey_compressed_decode_inner( &self->bls_pubkey, alloc_mem, ctx );
4238 0 : fd_bls_proof_of_possession_decode_inner( &self->bls_proof_of_possession, alloc_mem, ctx );
4239 0 : }
4240 0 : void * fd_voter_with_bls_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4241 0 : fd_voter_with_bls_args_t * self = (fd_voter_with_bls_args_t *)mem;
4242 0 : fd_voter_with_bls_args_new( self );
4243 0 : void * alloc_region = (uchar *)mem + sizeof(fd_voter_with_bls_args_t);
4244 0 : void * * alloc_mem = &alloc_region;
4245 0 : fd_voter_with_bls_args_decode_inner( mem, alloc_mem, ctx );
4246 0 : return self;
4247 0 : }
4248 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter(fd_vote_authorize_t const * self) {
4249 0 : return self->discriminant == 0;
4250 0 : }
4251 0 : FD_FN_PURE uchar fd_vote_authorize_is_withdrawer(fd_vote_authorize_t const * self) {
4252 0 : return self->discriminant == 1;
4253 0 : }
4254 0 : FD_FN_PURE uchar fd_vote_authorize_is_voter_with_bls(fd_vote_authorize_t const * self) {
4255 0 : return self->discriminant == 2;
4256 0 : }
4257 : void fd_vote_authorize_inner_new( fd_vote_authorize_inner_t * self, uint discriminant );
4258 498 : int fd_vote_authorize_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4259 498 : int err;
4260 498 : switch (discriminant) {
4261 276 : case 0: {
4262 276 : return FD_BINCODE_SUCCESS;
4263 0 : }
4264 214 : case 1: {
4265 214 : return FD_BINCODE_SUCCESS;
4266 0 : }
4267 0 : case 2: {
4268 0 : err = fd_voter_with_bls_args_decode_footprint_inner( ctx, total_sz );
4269 0 : if( FD_UNLIKELY( err ) ) return err;
4270 0 : return FD_BINCODE_SUCCESS;
4271 0 : }
4272 8 : default: return FD_BINCODE_ERR_ENCODING;
4273 498 : }
4274 498 : }
4275 500 : static int fd_vote_authorize_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4276 500 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4277 500 : uint discriminant = 0;
4278 500 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4279 500 : if( FD_UNLIKELY( err ) ) return err;
4280 498 : return fd_vote_authorize_inner_decode_footprint( discriminant, ctx, total_sz );
4281 500 : }
4282 0 : int fd_vote_authorize_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4283 0 : *total_sz += sizeof(fd_vote_authorize_t);
4284 0 : void const * start_data = ctx->data;
4285 0 : int err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4286 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4287 0 : ctx->data = start_data;
4288 0 : return err;
4289 0 : }
4290 363 : 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 ) {
4291 363 : switch (discriminant) {
4292 205 : case 0: {
4293 205 : break;
4294 0 : }
4295 158 : case 1: {
4296 158 : break;
4297 0 : }
4298 0 : case 2: {
4299 0 : fd_voter_with_bls_args_decode_inner( &self->voter_with_bls, alloc_mem, ctx );
4300 0 : break;
4301 0 : }
4302 363 : }
4303 363 : }
4304 363 : static void fd_vote_authorize_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4305 363 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)struct_mem;
4306 363 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4307 363 : fd_vote_authorize_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
4308 363 : }
4309 0 : void * fd_vote_authorize_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4310 0 : fd_vote_authorize_t * self = (fd_vote_authorize_t *)mem;
4311 0 : fd_vote_authorize_new( self );
4312 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_t);
4313 0 : void * * alloc_mem = &alloc_region;
4314 0 : fd_vote_authorize_decode_inner( mem, alloc_mem, ctx );
4315 0 : return self;
4316 0 : }
4317 0 : void fd_vote_authorize_inner_new( fd_vote_authorize_inner_t * self, uint discriminant ) {
4318 0 : switch( discriminant ) {
4319 0 : case 0: {
4320 0 : break;
4321 0 : }
4322 0 : case 1: {
4323 0 : break;
4324 0 : }
4325 0 : case 2: {
4326 0 : fd_voter_with_bls_args_new( &self->voter_with_bls );
4327 0 : break;
4328 0 : }
4329 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
4330 0 : }
4331 0 : }
4332 0 : void fd_vote_authorize_new_disc( fd_vote_authorize_t * self, uint discriminant ) {
4333 0 : self->discriminant = discriminant;
4334 0 : fd_vote_authorize_inner_new( &self->inner, self->discriminant );
4335 0 : }
4336 0 : void fd_vote_authorize_new( fd_vote_authorize_t * self ) {
4337 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_t) );
4338 0 : fd_vote_authorize_new_disc( self, UINT_MAX );
4339 0 : }
4340 :
4341 0 : ulong fd_vote_authorize_size( fd_vote_authorize_t const * self ) {
4342 0 : ulong size = 0;
4343 0 : size += sizeof(uint);
4344 0 : switch (self->discriminant) {
4345 0 : case 2: {
4346 0 : size += fd_voter_with_bls_args_size( &self->inner.voter_with_bls );
4347 0 : break;
4348 0 : }
4349 0 : }
4350 0 : return size;
4351 0 : }
4352 :
4353 0 : int fd_vote_authorize_inner_encode( fd_vote_authorize_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
4354 0 : int err;
4355 0 : switch (discriminant) {
4356 0 : case 2: {
4357 0 : err = fd_voter_with_bls_args_encode( &self->voter_with_bls, ctx );
4358 0 : if( FD_UNLIKELY( err ) ) return err;
4359 0 : break;
4360 0 : }
4361 0 : }
4362 0 : return FD_BINCODE_SUCCESS;
4363 0 : }
4364 0 : int fd_vote_authorize_encode( fd_vote_authorize_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4365 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4366 0 : if( FD_UNLIKELY( err ) ) return err;
4367 0 : return fd_vote_authorize_inner_encode( &self->inner, self->discriminant, ctx );
4368 0 : }
4369 :
4370 0 : int fd_vote_authorize_pubkey_encode( fd_vote_authorize_pubkey_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4371 0 : int err;
4372 0 : err = fd_pubkey_encode( &self->pubkey, ctx );
4373 0 : if( FD_UNLIKELY( err ) ) return err;
4374 0 : err = fd_vote_authorize_encode( &self->vote_authorize, ctx );
4375 0 : if( FD_UNLIKELY( err ) ) return err;
4376 0 : return FD_BINCODE_SUCCESS;
4377 0 : }
4378 144 : static int fd_vote_authorize_pubkey_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4379 144 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4380 144 : int err = 0;
4381 144 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4382 144 : if( FD_UNLIKELY( err ) ) return err;
4383 135 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4384 135 : if( FD_UNLIKELY( err ) ) return err;
4385 131 : return 0;
4386 135 : }
4387 0 : int fd_vote_authorize_pubkey_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4388 0 : *total_sz += sizeof(fd_vote_authorize_pubkey_t);
4389 0 : void const * start_data = ctx->data;
4390 0 : int err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
4391 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4392 0 : ctx->data = start_data;
4393 0 : return err;
4394 0 : }
4395 131 : static void fd_vote_authorize_pubkey_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4396 131 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)struct_mem;
4397 131 : fd_pubkey_decode_inner( &self->pubkey, alloc_mem, ctx );
4398 131 : fd_vote_authorize_decode_inner( &self->vote_authorize, alloc_mem, ctx );
4399 131 : }
4400 0 : void * fd_vote_authorize_pubkey_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4401 0 : fd_vote_authorize_pubkey_t * self = (fd_vote_authorize_pubkey_t *)mem;
4402 0 : fd_vote_authorize_pubkey_new( self );
4403 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_pubkey_t);
4404 0 : void * * alloc_mem = &alloc_region;
4405 0 : fd_vote_authorize_pubkey_decode_inner( mem, alloc_mem, ctx );
4406 0 : return self;
4407 0 : }
4408 0 : void fd_vote_authorize_pubkey_new(fd_vote_authorize_pubkey_t * self) {
4409 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_pubkey_t) );
4410 0 : fd_pubkey_new( &self->pubkey );
4411 0 : fd_vote_authorize_new( &self->vote_authorize );
4412 0 : }
4413 0 : ulong fd_vote_authorize_pubkey_size( fd_vote_authorize_pubkey_t const * self ) {
4414 0 : ulong size = 0;
4415 0 : size += fd_pubkey_size( &self->pubkey );
4416 0 : size += fd_vote_authorize_size( &self->vote_authorize );
4417 0 : return size;
4418 0 : }
4419 :
4420 0 : int fd_vote_switch_encode( fd_vote_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4421 0 : int err;
4422 0 : err = fd_vote_encode( &self->vote, ctx );
4423 0 : if( FD_UNLIKELY( err ) ) return err;
4424 0 : err = fd_hash_encode( &self->hash, ctx );
4425 0 : if( FD_UNLIKELY( err ) ) return err;
4426 0 : return FD_BINCODE_SUCCESS;
4427 0 : }
4428 92 : static int fd_vote_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4429 92 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4430 91 : int err = 0;
4431 91 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
4432 91 : if( FD_UNLIKELY( err ) ) return err;
4433 83 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4434 83 : if( FD_UNLIKELY( err ) ) return err;
4435 82 : return 0;
4436 83 : }
4437 0 : int fd_vote_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4438 0 : *total_sz += sizeof(fd_vote_switch_t);
4439 0 : void const * start_data = ctx->data;
4440 0 : int err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
4441 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4442 0 : ctx->data = start_data;
4443 0 : return err;
4444 0 : }
4445 82 : static void fd_vote_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4446 82 : fd_vote_switch_t * self = (fd_vote_switch_t *)struct_mem;
4447 82 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
4448 82 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4449 82 : }
4450 0 : void * fd_vote_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4451 0 : fd_vote_switch_t * self = (fd_vote_switch_t *)mem;
4452 0 : fd_vote_switch_new( self );
4453 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_switch_t);
4454 0 : void * * alloc_mem = &alloc_region;
4455 0 : fd_vote_switch_decode_inner( mem, alloc_mem, ctx );
4456 0 : return self;
4457 0 : }
4458 0 : void fd_vote_switch_new(fd_vote_switch_t * self) {
4459 0 : fd_memset( self, 0, sizeof(fd_vote_switch_t) );
4460 0 : fd_vote_new( &self->vote );
4461 0 : fd_hash_new( &self->hash );
4462 0 : }
4463 0 : ulong fd_vote_switch_size( fd_vote_switch_t const * self ) {
4464 0 : ulong size = 0;
4465 0 : size += fd_vote_size( &self->vote );
4466 0 : size += fd_hash_size( &self->hash );
4467 0 : return size;
4468 0 : }
4469 :
4470 0 : int fd_update_vote_state_switch_encode( fd_update_vote_state_switch_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4471 0 : int err;
4472 0 : err = fd_vote_state_update_encode( &self->vote_state_update, ctx );
4473 0 : if( FD_UNLIKELY( err ) ) return err;
4474 0 : err = fd_hash_encode( &self->hash, ctx );
4475 0 : if( FD_UNLIKELY( err ) ) return err;
4476 0 : return FD_BINCODE_SUCCESS;
4477 0 : }
4478 96 : static int fd_update_vote_state_switch_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4479 96 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4480 96 : int err = 0;
4481 96 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
4482 96 : if( FD_UNLIKELY( err ) ) return err;
4483 84 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
4484 84 : if( FD_UNLIKELY( err ) ) return err;
4485 82 : return 0;
4486 84 : }
4487 0 : int fd_update_vote_state_switch_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4488 0 : *total_sz += sizeof(fd_update_vote_state_switch_t);
4489 0 : void const * start_data = ctx->data;
4490 0 : int err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
4491 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4492 0 : ctx->data = start_data;
4493 0 : return err;
4494 0 : }
4495 82 : static void fd_update_vote_state_switch_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4496 82 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)struct_mem;
4497 82 : fd_vote_state_update_decode_inner( &self->vote_state_update, alloc_mem, ctx );
4498 82 : fd_hash_decode_inner( &self->hash, alloc_mem, ctx );
4499 82 : }
4500 0 : void * fd_update_vote_state_switch_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4501 0 : fd_update_vote_state_switch_t * self = (fd_update_vote_state_switch_t *)mem;
4502 0 : fd_update_vote_state_switch_new( self );
4503 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_vote_state_switch_t);
4504 0 : void * * alloc_mem = &alloc_region;
4505 0 : fd_update_vote_state_switch_decode_inner( mem, alloc_mem, ctx );
4506 0 : return self;
4507 0 : }
4508 0 : void fd_update_vote_state_switch_new(fd_update_vote_state_switch_t * self) {
4509 0 : fd_memset( self, 0, sizeof(fd_update_vote_state_switch_t) );
4510 0 : fd_vote_state_update_new( &self->vote_state_update );
4511 0 : fd_hash_new( &self->hash );
4512 0 : }
4513 0 : ulong fd_update_vote_state_switch_size( fd_update_vote_state_switch_t const * self ) {
4514 0 : ulong size = 0;
4515 0 : size += fd_vote_state_update_size( &self->vote_state_update );
4516 0 : size += fd_hash_size( &self->hash );
4517 0 : return size;
4518 0 : }
4519 :
4520 0 : int fd_vote_authorize_with_seed_args_encode( fd_vote_authorize_with_seed_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4521 0 : int err;
4522 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
4523 0 : if( FD_UNLIKELY( err ) ) return err;
4524 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
4525 0 : if( FD_UNLIKELY( err ) ) return err;
4526 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
4527 0 : if( FD_UNLIKELY(err) ) return err;
4528 0 : if( self->current_authority_derived_key_seed_len ) {
4529 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4530 0 : if( FD_UNLIKELY( err ) ) return err;
4531 0 : }
4532 0 : err = fd_pubkey_encode( &self->new_authority, ctx );
4533 0 : if( FD_UNLIKELY( err ) ) return err;
4534 0 : return FD_BINCODE_SUCCESS;
4535 0 : }
4536 91 : static int fd_vote_authorize_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4537 91 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4538 91 : int err = 0;
4539 91 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4540 91 : if( FD_UNLIKELY( err ) ) return err;
4541 88 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4542 88 : if( FD_UNLIKELY( err ) ) return err;
4543 85 : ulong current_authority_derived_key_seed_len;
4544 85 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
4545 85 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4546 84 : *total_sz += current_authority_derived_key_seed_len;
4547 84 : if( current_authority_derived_key_seed_len ) {
4548 76 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
4549 76 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4550 75 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
4551 75 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4552 75 : }
4553 43 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4554 43 : if( FD_UNLIKELY( err ) ) return err;
4555 42 : return 0;
4556 43 : }
4557 0 : int fd_vote_authorize_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4558 0 : *total_sz += sizeof(fd_vote_authorize_with_seed_args_t);
4559 0 : void const * start_data = ctx->data;
4560 0 : int err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
4561 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4562 0 : ctx->data = start_data;
4563 0 : return err;
4564 0 : }
4565 42 : static void fd_vote_authorize_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4566 42 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)struct_mem;
4567 42 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
4568 42 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
4569 42 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
4570 42 : if( self->current_authority_derived_key_seed_len ) {
4571 35 : self->current_authority_derived_key_seed = *alloc_mem;
4572 35 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4573 35 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
4574 35 : } else
4575 7 : self->current_authority_derived_key_seed = NULL;
4576 42 : fd_pubkey_decode_inner( &self->new_authority, alloc_mem, ctx );
4577 42 : }
4578 0 : void * fd_vote_authorize_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4579 0 : fd_vote_authorize_with_seed_args_t * self = (fd_vote_authorize_with_seed_args_t *)mem;
4580 0 : fd_vote_authorize_with_seed_args_new( self );
4581 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_with_seed_args_t);
4582 0 : void * * alloc_mem = &alloc_region;
4583 0 : fd_vote_authorize_with_seed_args_decode_inner( mem, alloc_mem, ctx );
4584 0 : return self;
4585 0 : }
4586 0 : void fd_vote_authorize_with_seed_args_new(fd_vote_authorize_with_seed_args_t * self) {
4587 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_with_seed_args_t) );
4588 0 : fd_vote_authorize_new( &self->authorization_type );
4589 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
4590 0 : fd_pubkey_new( &self->new_authority );
4591 0 : }
4592 0 : ulong fd_vote_authorize_with_seed_args_size( fd_vote_authorize_with_seed_args_t const * self ) {
4593 0 : ulong size = 0;
4594 0 : size += fd_vote_authorize_size( &self->authorization_type );
4595 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
4596 0 : do {
4597 0 : size += sizeof(ulong);
4598 0 : size += self->current_authority_derived_key_seed_len;
4599 0 : } while(0);
4600 0 : size += fd_pubkey_size( &self->new_authority );
4601 0 : return size;
4602 0 : }
4603 :
4604 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 ) {
4605 0 : int err;
4606 0 : err = fd_vote_authorize_encode( &self->authorization_type, ctx );
4607 0 : if( FD_UNLIKELY( err ) ) return err;
4608 0 : err = fd_pubkey_encode( &self->current_authority_derived_key_owner, ctx );
4609 0 : if( FD_UNLIKELY( err ) ) return err;
4610 0 : err = fd_bincode_uint64_encode( self->current_authority_derived_key_seed_len, ctx );
4611 0 : if( FD_UNLIKELY(err) ) return err;
4612 0 : if( self->current_authority_derived_key_seed_len ) {
4613 0 : err = fd_bincode_bytes_encode( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4614 0 : if( FD_UNLIKELY( err ) ) return err;
4615 0 : }
4616 0 : return FD_BINCODE_SUCCESS;
4617 0 : }
4618 111 : static int fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4619 111 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4620 111 : int err = 0;
4621 111 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4622 111 : if( FD_UNLIKELY( err ) ) return err;
4623 110 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
4624 110 : if( FD_UNLIKELY( err ) ) return err;
4625 110 : ulong current_authority_derived_key_seed_len;
4626 110 : err = fd_bincode_uint64_decode( ¤t_authority_derived_key_seed_len, ctx );
4627 110 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4628 109 : *total_sz += current_authority_derived_key_seed_len;
4629 109 : if( current_authority_derived_key_seed_len ) {
4630 99 : err = fd_bincode_bytes_decode_footprint( current_authority_derived_key_seed_len, ctx );
4631 99 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4632 84 : err = !fd_utf8_verify( (char const *) ctx->data - current_authority_derived_key_seed_len, current_authority_derived_key_seed_len );
4633 84 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4634 84 : }
4635 29 : return 0;
4636 109 : }
4637 0 : int fd_vote_authorize_checked_with_seed_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4638 0 : *total_sz += sizeof(fd_vote_authorize_checked_with_seed_args_t);
4639 0 : void const * start_data = ctx->data;
4640 0 : int err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
4641 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4642 0 : ctx->data = start_data;
4643 0 : return err;
4644 0 : }
4645 29 : static void fd_vote_authorize_checked_with_seed_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4646 29 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)struct_mem;
4647 29 : fd_vote_authorize_decode_inner( &self->authorization_type, alloc_mem, ctx );
4648 29 : fd_pubkey_decode_inner( &self->current_authority_derived_key_owner, alloc_mem, ctx );
4649 29 : fd_bincode_uint64_decode_unsafe( &self->current_authority_derived_key_seed_len, ctx );
4650 29 : if( self->current_authority_derived_key_seed_len ) {
4651 19 : self->current_authority_derived_key_seed = *alloc_mem;
4652 19 : fd_bincode_bytes_decode_unsafe( self->current_authority_derived_key_seed, self->current_authority_derived_key_seed_len, ctx );
4653 19 : *alloc_mem = (uchar *)(*alloc_mem) + self->current_authority_derived_key_seed_len;
4654 19 : } else
4655 10 : self->current_authority_derived_key_seed = NULL;
4656 29 : }
4657 0 : void * fd_vote_authorize_checked_with_seed_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4658 0 : fd_vote_authorize_checked_with_seed_args_t * self = (fd_vote_authorize_checked_with_seed_args_t *)mem;
4659 0 : fd_vote_authorize_checked_with_seed_args_new( self );
4660 0 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_authorize_checked_with_seed_args_t);
4661 0 : void * * alloc_mem = &alloc_region;
4662 0 : fd_vote_authorize_checked_with_seed_args_decode_inner( mem, alloc_mem, ctx );
4663 0 : return self;
4664 0 : }
4665 0 : void fd_vote_authorize_checked_with_seed_args_new(fd_vote_authorize_checked_with_seed_args_t * self) {
4666 0 : fd_memset( self, 0, sizeof(fd_vote_authorize_checked_with_seed_args_t) );
4667 0 : fd_vote_authorize_new( &self->authorization_type );
4668 0 : fd_pubkey_new( &self->current_authority_derived_key_owner );
4669 0 : }
4670 0 : ulong fd_vote_authorize_checked_with_seed_args_size( fd_vote_authorize_checked_with_seed_args_t const * self ) {
4671 0 : ulong size = 0;
4672 0 : size += fd_vote_authorize_size( &self->authorization_type );
4673 0 : size += fd_pubkey_size( &self->current_authority_derived_key_owner );
4674 0 : do {
4675 0 : size += sizeof(ulong);
4676 0 : size += self->current_authority_derived_key_seed_len;
4677 0 : } while(0);
4678 0 : return size;
4679 0 : }
4680 :
4681 0 : FD_FN_PURE uchar fd_commission_kind_is_inflation_rewards(fd_commission_kind_t const * self) {
4682 0 : return self->discriminant == 0;
4683 0 : }
4684 0 : FD_FN_PURE uchar fd_commission_kind_is_block_revenue(fd_commission_kind_t const * self) {
4685 0 : return self->discriminant == 1;
4686 0 : }
4687 0 : int fd_commission_kind_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4688 0 : int err;
4689 0 : switch (discriminant) {
4690 0 : case 0: {
4691 0 : return FD_BINCODE_SUCCESS;
4692 0 : }
4693 0 : case 1: {
4694 0 : return FD_BINCODE_SUCCESS;
4695 0 : }
4696 0 : default: return FD_BINCODE_ERR_ENCODING;
4697 0 : }
4698 0 : }
4699 0 : static int fd_commission_kind_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4700 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4701 0 : uint discriminant = 0;
4702 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4703 0 : if( FD_UNLIKELY( err ) ) return err;
4704 0 : return fd_commission_kind_inner_decode_footprint( discriminant, ctx, total_sz );
4705 0 : }
4706 0 : int fd_commission_kind_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4707 0 : *total_sz += sizeof(fd_commission_kind_t);
4708 0 : void const * start_data = ctx->data;
4709 0 : int err = fd_commission_kind_decode_footprint_inner( ctx, total_sz );
4710 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4711 0 : ctx->data = start_data;
4712 0 : return err;
4713 0 : }
4714 0 : static void fd_commission_kind_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4715 0 : fd_commission_kind_t * self = (fd_commission_kind_t *)struct_mem;
4716 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
4717 0 : }
4718 0 : void * fd_commission_kind_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4719 0 : fd_commission_kind_t * self = (fd_commission_kind_t *)mem;
4720 0 : fd_commission_kind_new( self );
4721 0 : void * alloc_region = (uchar *)mem + sizeof(fd_commission_kind_t);
4722 0 : void * * alloc_mem = &alloc_region;
4723 0 : fd_commission_kind_decode_inner( mem, alloc_mem, ctx );
4724 0 : return self;
4725 0 : }
4726 :
4727 0 : ulong fd_commission_kind_size( fd_commission_kind_t const * self ) {
4728 0 : ulong size = 0;
4729 0 : size += sizeof(uint);
4730 0 : switch (self->discriminant) {
4731 0 : }
4732 0 : return size;
4733 0 : }
4734 :
4735 0 : int fd_commission_kind_encode( fd_commission_kind_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4736 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
4737 0 : if( FD_UNLIKELY( err ) ) return err;
4738 0 : return err;
4739 0 : }
4740 :
4741 0 : int fd_update_commission_bps_args_encode( fd_update_commission_bps_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4742 0 : int err;
4743 0 : err = fd_bincode_uint16_encode( self->commission_bps, ctx );
4744 0 : if( FD_UNLIKELY( err ) ) return err;
4745 0 : err = fd_commission_kind_encode( &self->kind, ctx );
4746 0 : if( FD_UNLIKELY( err ) ) return err;
4747 0 : return FD_BINCODE_SUCCESS;
4748 0 : }
4749 0 : static int fd_update_commission_bps_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4750 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4751 0 : int err = 0;
4752 0 : err = fd_bincode_uint16_decode_footprint( ctx );
4753 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4754 0 : err = fd_commission_kind_decode_footprint_inner( ctx, total_sz );
4755 0 : if( FD_UNLIKELY( err ) ) return err;
4756 0 : return 0;
4757 0 : }
4758 0 : int fd_update_commission_bps_args_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4759 0 : *total_sz += sizeof(fd_update_commission_bps_args_t);
4760 0 : void const * start_data = ctx->data;
4761 0 : int err = fd_update_commission_bps_args_decode_footprint_inner( ctx, total_sz );
4762 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4763 0 : ctx->data = start_data;
4764 0 : return err;
4765 0 : }
4766 0 : static void fd_update_commission_bps_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4767 0 : fd_update_commission_bps_args_t * self = (fd_update_commission_bps_args_t *)struct_mem;
4768 0 : fd_bincode_uint16_decode_unsafe( &self->commission_bps, ctx );
4769 0 : fd_commission_kind_decode_inner( &self->kind, alloc_mem, ctx );
4770 0 : }
4771 0 : void * fd_update_commission_bps_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4772 0 : fd_update_commission_bps_args_t * self = (fd_update_commission_bps_args_t *)mem;
4773 0 : fd_update_commission_bps_args_new( self );
4774 0 : void * alloc_region = (uchar *)mem + sizeof(fd_update_commission_bps_args_t);
4775 0 : void * * alloc_mem = &alloc_region;
4776 0 : fd_update_commission_bps_args_decode_inner( mem, alloc_mem, ctx );
4777 0 : return self;
4778 0 : }
4779 0 : void fd_update_commission_bps_args_new(fd_update_commission_bps_args_t * self) {
4780 0 : fd_memset( self, 0, sizeof(fd_update_commission_bps_args_t) );
4781 0 : fd_commission_kind_new( &self->kind );
4782 0 : }
4783 0 : int fd_deposit_delegator_rewards_args_encode( fd_deposit_delegator_rewards_args_t const * self, fd_bincode_encode_ctx_t * ctx ) {
4784 0 : int err;
4785 0 : err = fd_bincode_uint64_encode( self->deposit, ctx );
4786 0 : if( FD_UNLIKELY( err ) ) return err;
4787 0 : return FD_BINCODE_SUCCESS;
4788 0 : }
4789 0 : static inline int fd_deposit_delegator_rewards_args_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4790 0 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4791 0 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
4792 0 : return 0;
4793 0 : }
4794 0 : static void fd_deposit_delegator_rewards_args_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
4795 0 : fd_deposit_delegator_rewards_args_t * self = (fd_deposit_delegator_rewards_args_t *)struct_mem;
4796 0 : fd_bincode_uint64_decode_unsafe( &self->deposit, ctx );
4797 0 : }
4798 0 : void * fd_deposit_delegator_rewards_args_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
4799 0 : fd_deposit_delegator_rewards_args_t * self = (fd_deposit_delegator_rewards_args_t *)mem;
4800 0 : fd_deposit_delegator_rewards_args_new( self );
4801 0 : void * alloc_region = (uchar *)mem + sizeof(fd_deposit_delegator_rewards_args_t);
4802 0 : void * * alloc_mem = &alloc_region;
4803 0 : fd_deposit_delegator_rewards_args_decode_inner( mem, alloc_mem, ctx );
4804 0 : return self;
4805 0 : }
4806 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account(fd_vote_instruction_t const * self) {
4807 0 : return self->discriminant == 0;
4808 0 : }
4809 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize(fd_vote_instruction_t const * self) {
4810 0 : return self->discriminant == 1;
4811 0 : }
4812 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote(fd_vote_instruction_t const * self) {
4813 0 : return self->discriminant == 2;
4814 0 : }
4815 0 : FD_FN_PURE uchar fd_vote_instruction_is_withdraw(fd_vote_instruction_t const * self) {
4816 0 : return self->discriminant == 3;
4817 0 : }
4818 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_validator_identity(fd_vote_instruction_t const * self) {
4819 0 : return self->discriminant == 4;
4820 0 : }
4821 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission(fd_vote_instruction_t const * self) {
4822 0 : return self->discriminant == 5;
4823 0 : }
4824 0 : FD_FN_PURE uchar fd_vote_instruction_is_vote_switch(fd_vote_instruction_t const * self) {
4825 0 : return self->discriminant == 6;
4826 0 : }
4827 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked(fd_vote_instruction_t const * self) {
4828 0 : return self->discriminant == 7;
4829 0 : }
4830 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state(fd_vote_instruction_t const * self) {
4831 0 : return self->discriminant == 8;
4832 0 : }
4833 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_vote_state_switch(fd_vote_instruction_t const * self) {
4834 0 : return self->discriminant == 9;
4835 0 : }
4836 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_with_seed(fd_vote_instruction_t const * self) {
4837 0 : return self->discriminant == 10;
4838 0 : }
4839 0 : FD_FN_PURE uchar fd_vote_instruction_is_authorize_checked_with_seed(fd_vote_instruction_t const * self) {
4840 0 : return self->discriminant == 11;
4841 0 : }
4842 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state(fd_vote_instruction_t const * self) {
4843 0 : return self->discriminant == 12;
4844 0 : }
4845 0 : FD_FN_PURE uchar fd_vote_instruction_is_compact_update_vote_state_switch(fd_vote_instruction_t const * self) {
4846 0 : return self->discriminant == 13;
4847 0 : }
4848 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync(fd_vote_instruction_t const * self) {
4849 0 : return self->discriminant == 14;
4850 0 : }
4851 0 : FD_FN_PURE uchar fd_vote_instruction_is_tower_sync_switch(fd_vote_instruction_t const * self) {
4852 0 : return self->discriminant == 15;
4853 0 : }
4854 0 : FD_FN_PURE uchar fd_vote_instruction_is_initialize_account_v2(fd_vote_instruction_t const * self) {
4855 0 : return self->discriminant == 16;
4856 0 : }
4857 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission_collector(fd_vote_instruction_t const * self) {
4858 0 : return self->discriminant == 17;
4859 0 : }
4860 0 : FD_FN_PURE uchar fd_vote_instruction_is_update_commission_bps(fd_vote_instruction_t const * self) {
4861 0 : return self->discriminant == 18;
4862 0 : }
4863 0 : FD_FN_PURE uchar fd_vote_instruction_is_deposit_delegator_rewards(fd_vote_instruction_t const * self) {
4864 0 : return self->discriminant == 19;
4865 0 : }
4866 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant );
4867 2488 : int fd_vote_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4868 2488 : int err;
4869 2488 : switch (discriminant) {
4870 65 : case 0: {
4871 65 : err = fd_vote_init_decode_footprint_inner( ctx, total_sz );
4872 65 : if( FD_UNLIKELY( err ) ) return err;
4873 25 : return FD_BINCODE_SUCCESS;
4874 65 : }
4875 144 : case 1: {
4876 144 : err = fd_vote_authorize_pubkey_decode_footprint_inner( ctx, total_sz );
4877 144 : if( FD_UNLIKELY( err ) ) return err;
4878 131 : return FD_BINCODE_SUCCESS;
4879 144 : }
4880 111 : case 2: {
4881 111 : err = fd_vote_decode_footprint_inner( ctx, total_sz );
4882 111 : if( FD_UNLIKELY( err ) ) return err;
4883 102 : return FD_BINCODE_SUCCESS;
4884 111 : }
4885 190 : case 3: {
4886 190 : err = fd_bincode_uint64_decode_footprint( ctx );
4887 190 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
4888 189 : return FD_BINCODE_SUCCESS;
4889 190 : }
4890 224 : case 4: {
4891 224 : return FD_BINCODE_SUCCESS;
4892 190 : }
4893 317 : case 5: {
4894 317 : err = fd_bincode_uint8_decode_footprint( ctx );
4895 317 : if( FD_UNLIKELY( err ) ) return err;
4896 315 : return FD_BINCODE_SUCCESS;
4897 317 : }
4898 92 : case 6: {
4899 92 : err = fd_vote_switch_decode_footprint_inner( ctx, total_sz );
4900 92 : if( FD_UNLIKELY( err ) ) return err;
4901 82 : return FD_BINCODE_SUCCESS;
4902 92 : }
4903 163 : case 7: {
4904 163 : err = fd_vote_authorize_decode_footprint_inner( ctx, total_sz );
4905 163 : if( FD_UNLIKELY( err ) ) return err;
4906 161 : return FD_BINCODE_SUCCESS;
4907 163 : }
4908 124 : case 8: {
4909 124 : err = fd_vote_state_update_decode_footprint_inner( ctx, total_sz );
4910 124 : if( FD_UNLIKELY( err ) ) return err;
4911 114 : return FD_BINCODE_SUCCESS;
4912 124 : }
4913 96 : case 9: {
4914 96 : err = fd_update_vote_state_switch_decode_footprint_inner( ctx, total_sz );
4915 96 : if( FD_UNLIKELY( err ) ) return err;
4916 82 : return FD_BINCODE_SUCCESS;
4917 96 : }
4918 91 : case 10: {
4919 91 : err = fd_vote_authorize_with_seed_args_decode_footprint_inner( ctx, total_sz );
4920 91 : if( FD_UNLIKELY( err ) ) return err;
4921 42 : return FD_BINCODE_SUCCESS;
4922 91 : }
4923 111 : case 11: {
4924 111 : err = fd_vote_authorize_checked_with_seed_args_decode_footprint_inner( ctx, total_sz );
4925 111 : if( FD_UNLIKELY( err ) ) return err;
4926 29 : return FD_BINCODE_SUCCESS;
4927 111 : }
4928 135 : case 12: {
4929 135 : err = fd_compact_vote_state_update_decode_footprint_inner( ctx, total_sz );
4930 135 : if( FD_UNLIKELY( err ) ) return err;
4931 60 : return FD_BINCODE_SUCCESS;
4932 135 : }
4933 83 : case 13: {
4934 83 : err = fd_compact_vote_state_update_switch_decode_footprint_inner( ctx, total_sz );
4935 83 : if( FD_UNLIKELY( err ) ) return err;
4936 30 : return FD_BINCODE_SUCCESS;
4937 83 : }
4938 375 : case 14: {
4939 375 : err = fd_tower_sync_decode_footprint_inner( ctx, total_sz );
4940 375 : if( FD_UNLIKELY( err ) ) return err;
4941 324 : return FD_BINCODE_SUCCESS;
4942 375 : }
4943 87 : case 15: {
4944 87 : err = fd_tower_sync_switch_decode_footprint_inner( ctx, total_sz );
4945 87 : if( FD_UNLIKELY( err ) ) return err;
4946 10 : return FD_BINCODE_SUCCESS;
4947 87 : }
4948 0 : case 16: {
4949 0 : err = fd_vote_init_v2_decode_footprint_inner( ctx, total_sz );
4950 0 : if( FD_UNLIKELY( err ) ) return err;
4951 0 : return FD_BINCODE_SUCCESS;
4952 0 : }
4953 0 : case 17: {
4954 0 : err = fd_commission_kind_decode_footprint_inner( ctx, total_sz );
4955 0 : if( FD_UNLIKELY( err ) ) return err;
4956 0 : return FD_BINCODE_SUCCESS;
4957 0 : }
4958 0 : case 18: {
4959 0 : err = fd_update_commission_bps_args_decode_footprint_inner( ctx, total_sz );
4960 0 : if( FD_UNLIKELY( err ) ) return err;
4961 0 : return FD_BINCODE_SUCCESS;
4962 0 : }
4963 0 : case 19: {
4964 0 : err = fd_deposit_delegator_rewards_args_decode_footprint_inner( ctx, total_sz );
4965 0 : if( FD_UNLIKELY( err ) ) return err;
4966 0 : return FD_BINCODE_SUCCESS;
4967 0 : }
4968 82 : default: return FD_BINCODE_ERR_ENCODING;
4969 2488 : }
4970 2488 : }
4971 2503 : static int fd_vote_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4972 2503 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4973 2498 : uint discriminant = 0;
4974 2498 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
4975 2498 : if( FD_UNLIKELY( err ) ) return err;
4976 2488 : return fd_vote_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
4977 2498 : }
4978 2503 : int fd_vote_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
4979 2503 : *total_sz += sizeof(fd_vote_instruction_t);
4980 2503 : void const * start_data = ctx->data;
4981 2503 : int err = fd_vote_instruction_decode_footprint_inner( ctx, total_sz );
4982 2503 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
4983 2503 : ctx->data = start_data;
4984 2503 : return err;
4985 2503 : }
4986 1919 : 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 ) {
4987 1919 : switch (discriminant) {
4988 25 : case 0: {
4989 25 : fd_vote_init_decode_inner( &self->initialize_account, alloc_mem, ctx );
4990 25 : break;
4991 0 : }
4992 131 : case 1: {
4993 131 : fd_vote_authorize_pubkey_decode_inner( &self->authorize, alloc_mem, ctx );
4994 131 : break;
4995 0 : }
4996 102 : case 2: {
4997 102 : fd_vote_decode_inner( &self->vote, alloc_mem, ctx );
4998 102 : break;
4999 0 : }
5000 189 : case 3: {
5001 189 : fd_bincode_uint64_decode_unsafe( &self->withdraw, ctx );
5002 189 : break;
5003 0 : }
5004 224 : case 4: {
5005 224 : break;
5006 0 : }
5007 315 : case 5: {
5008 315 : fd_bincode_uint8_decode_unsafe( &self->update_commission, ctx );
5009 315 : break;
5010 0 : }
5011 82 : case 6: {
5012 82 : fd_vote_switch_decode_inner( &self->vote_switch, alloc_mem, ctx );
5013 82 : break;
5014 0 : }
5015 161 : case 7: {
5016 161 : fd_vote_authorize_decode_inner( &self->authorize_checked, alloc_mem, ctx );
5017 161 : break;
5018 0 : }
5019 114 : case 8: {
5020 114 : fd_vote_state_update_decode_inner( &self->update_vote_state, alloc_mem, ctx );
5021 114 : break;
5022 0 : }
5023 82 : case 9: {
5024 82 : fd_update_vote_state_switch_decode_inner( &self->update_vote_state_switch, alloc_mem, ctx );
5025 82 : break;
5026 0 : }
5027 42 : case 10: {
5028 42 : fd_vote_authorize_with_seed_args_decode_inner( &self->authorize_with_seed, alloc_mem, ctx );
5029 42 : break;
5030 0 : }
5031 29 : case 11: {
5032 29 : fd_vote_authorize_checked_with_seed_args_decode_inner( &self->authorize_checked_with_seed, alloc_mem, ctx );
5033 29 : break;
5034 0 : }
5035 60 : case 12: {
5036 60 : fd_compact_vote_state_update_decode_inner( &self->compact_update_vote_state, alloc_mem, ctx );
5037 60 : break;
5038 0 : }
5039 30 : case 13: {
5040 30 : fd_compact_vote_state_update_switch_decode_inner( &self->compact_update_vote_state_switch, alloc_mem, ctx );
5041 30 : break;
5042 0 : }
5043 323 : case 14: {
5044 323 : fd_tower_sync_decode_inner( &self->tower_sync, alloc_mem, ctx );
5045 323 : break;
5046 0 : }
5047 10 : case 15: {
5048 10 : fd_tower_sync_switch_decode_inner( &self->tower_sync_switch, alloc_mem, ctx );
5049 10 : break;
5050 0 : }
5051 0 : case 16: {
5052 0 : fd_vote_init_v2_decode_inner( &self->initialize_account_v2, alloc_mem, ctx );
5053 0 : break;
5054 0 : }
5055 0 : case 17: {
5056 0 : fd_commission_kind_decode_inner( &self->update_commission_collector, alloc_mem, ctx );
5057 0 : break;
5058 0 : }
5059 0 : case 18: {
5060 0 : fd_update_commission_bps_args_decode_inner( &self->update_commission_bps, alloc_mem, ctx );
5061 0 : break;
5062 0 : }
5063 0 : case 19: {
5064 0 : fd_deposit_delegator_rewards_args_decode_inner( &self->deposit_delegator_rewards, alloc_mem, ctx );
5065 0 : break;
5066 0 : }
5067 1919 : }
5068 1919 : }
5069 1919 : static void fd_vote_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5070 1919 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)struct_mem;
5071 1919 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5072 1919 : fd_vote_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
5073 1919 : }
5074 1919 : void * fd_vote_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5075 1919 : fd_vote_instruction_t * self = (fd_vote_instruction_t *)mem;
5076 1919 : fd_vote_instruction_new( self );
5077 1919 : void * alloc_region = (uchar *)mem + sizeof(fd_vote_instruction_t);
5078 1919 : void * * alloc_mem = &alloc_region;
5079 1919 : fd_vote_instruction_decode_inner( mem, alloc_mem, ctx );
5080 1919 : return self;
5081 1919 : }
5082 1919 : void fd_vote_instruction_inner_new( fd_vote_instruction_inner_t * self, uint discriminant ) {
5083 1919 : switch( discriminant ) {
5084 0 : case 0: {
5085 0 : fd_vote_init_new( &self->initialize_account );
5086 0 : break;
5087 0 : }
5088 0 : case 1: {
5089 0 : fd_vote_authorize_pubkey_new( &self->authorize );
5090 0 : break;
5091 0 : }
5092 0 : case 2: {
5093 0 : fd_vote_new( &self->vote );
5094 0 : break;
5095 0 : }
5096 0 : case 3: {
5097 0 : break;
5098 0 : }
5099 0 : case 4: {
5100 0 : break;
5101 0 : }
5102 0 : case 5: {
5103 0 : break;
5104 0 : }
5105 0 : case 6: {
5106 0 : fd_vote_switch_new( &self->vote_switch );
5107 0 : break;
5108 0 : }
5109 0 : case 7: {
5110 0 : fd_vote_authorize_new( &self->authorize_checked );
5111 0 : break;
5112 0 : }
5113 0 : case 8: {
5114 0 : fd_vote_state_update_new( &self->update_vote_state );
5115 0 : break;
5116 0 : }
5117 0 : case 9: {
5118 0 : fd_update_vote_state_switch_new( &self->update_vote_state_switch );
5119 0 : break;
5120 0 : }
5121 0 : case 10: {
5122 0 : fd_vote_authorize_with_seed_args_new( &self->authorize_with_seed );
5123 0 : break;
5124 0 : }
5125 0 : case 11: {
5126 0 : fd_vote_authorize_checked_with_seed_args_new( &self->authorize_checked_with_seed );
5127 0 : break;
5128 0 : }
5129 0 : case 12: {
5130 0 : fd_compact_vote_state_update_new( &self->compact_update_vote_state );
5131 0 : break;
5132 0 : }
5133 0 : case 13: {
5134 0 : fd_compact_vote_state_update_switch_new( &self->compact_update_vote_state_switch );
5135 0 : break;
5136 0 : }
5137 0 : case 14: {
5138 0 : fd_tower_sync_new( &self->tower_sync );
5139 0 : break;
5140 0 : }
5141 0 : case 15: {
5142 0 : fd_tower_sync_switch_new( &self->tower_sync_switch );
5143 0 : break;
5144 0 : }
5145 0 : case 16: {
5146 0 : fd_vote_init_v2_new( &self->initialize_account_v2 );
5147 0 : break;
5148 0 : }
5149 0 : case 17: {
5150 0 : fd_commission_kind_new( &self->update_commission_collector );
5151 0 : break;
5152 0 : }
5153 0 : case 18: {
5154 0 : fd_update_commission_bps_args_new( &self->update_commission_bps );
5155 0 : break;
5156 0 : }
5157 0 : case 19: {
5158 0 : fd_deposit_delegator_rewards_args_new( &self->deposit_delegator_rewards );
5159 0 : break;
5160 0 : }
5161 1919 : default: break; // FD_LOG_ERR(( "unhandled type"));
5162 1919 : }
5163 1919 : }
5164 1919 : void fd_vote_instruction_new_disc( fd_vote_instruction_t * self, uint discriminant ) {
5165 1919 : self->discriminant = discriminant;
5166 1919 : fd_vote_instruction_inner_new( &self->inner, self->discriminant );
5167 1919 : }
5168 1919 : void fd_vote_instruction_new( fd_vote_instruction_t * self ) {
5169 1919 : fd_memset( self, 0, sizeof(fd_vote_instruction_t) );
5170 1919 : fd_vote_instruction_new_disc( self, UINT_MAX );
5171 1919 : }
5172 :
5173 0 : ulong fd_vote_instruction_size( fd_vote_instruction_t const * self ) {
5174 0 : ulong size = 0;
5175 0 : size += sizeof(uint);
5176 0 : switch (self->discriminant) {
5177 0 : case 0: {
5178 0 : size += fd_vote_init_size( &self->inner.initialize_account );
5179 0 : break;
5180 0 : }
5181 0 : case 1: {
5182 0 : size += fd_vote_authorize_pubkey_size( &self->inner.authorize );
5183 0 : break;
5184 0 : }
5185 0 : case 2: {
5186 0 : size += fd_vote_size( &self->inner.vote );
5187 0 : break;
5188 0 : }
5189 0 : case 3: {
5190 0 : size += sizeof(ulong);
5191 0 : break;
5192 0 : }
5193 0 : case 5: {
5194 0 : size += sizeof(char);
5195 0 : break;
5196 0 : }
5197 0 : case 6: {
5198 0 : size += fd_vote_switch_size( &self->inner.vote_switch );
5199 0 : break;
5200 0 : }
5201 0 : case 7: {
5202 0 : size += fd_vote_authorize_size( &self->inner.authorize_checked );
5203 0 : break;
5204 0 : }
5205 0 : case 8: {
5206 0 : size += fd_vote_state_update_size( &self->inner.update_vote_state );
5207 0 : break;
5208 0 : }
5209 0 : case 9: {
5210 0 : size += fd_update_vote_state_switch_size( &self->inner.update_vote_state_switch );
5211 0 : break;
5212 0 : }
5213 0 : case 10: {
5214 0 : size += fd_vote_authorize_with_seed_args_size( &self->inner.authorize_with_seed );
5215 0 : break;
5216 0 : }
5217 0 : case 11: {
5218 0 : size += fd_vote_authorize_checked_with_seed_args_size( &self->inner.authorize_checked_with_seed );
5219 0 : break;
5220 0 : }
5221 0 : case 12: {
5222 0 : size += fd_compact_vote_state_update_size( &self->inner.compact_update_vote_state );
5223 0 : break;
5224 0 : }
5225 0 : case 13: {
5226 0 : size += fd_compact_vote_state_update_switch_size( &self->inner.compact_update_vote_state_switch );
5227 0 : break;
5228 0 : }
5229 0 : case 14: {
5230 0 : size += fd_tower_sync_size( &self->inner.tower_sync );
5231 0 : break;
5232 0 : }
5233 0 : case 15: {
5234 0 : size += fd_tower_sync_switch_size( &self->inner.tower_sync_switch );
5235 0 : break;
5236 0 : }
5237 0 : case 16: {
5238 0 : size += fd_vote_init_v2_size( &self->inner.initialize_account_v2 );
5239 0 : break;
5240 0 : }
5241 0 : case 17: {
5242 0 : size += fd_commission_kind_size( &self->inner.update_commission_collector );
5243 0 : break;
5244 0 : }
5245 0 : case 18: {
5246 0 : size += fd_update_commission_bps_args_size( &self->inner.update_commission_bps );
5247 0 : break;
5248 0 : }
5249 0 : case 19: {
5250 0 : size += fd_deposit_delegator_rewards_args_size( &self->inner.deposit_delegator_rewards );
5251 0 : break;
5252 0 : }
5253 0 : }
5254 0 : return size;
5255 0 : }
5256 :
5257 0 : int fd_vote_instruction_inner_encode( fd_vote_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
5258 0 : int err;
5259 0 : switch (discriminant) {
5260 0 : case 0: {
5261 0 : err = fd_vote_init_encode( &self->initialize_account, ctx );
5262 0 : if( FD_UNLIKELY( err ) ) return err;
5263 0 : break;
5264 0 : }
5265 0 : case 1: {
5266 0 : err = fd_vote_authorize_pubkey_encode( &self->authorize, ctx );
5267 0 : if( FD_UNLIKELY( err ) ) return err;
5268 0 : break;
5269 0 : }
5270 0 : case 2: {
5271 0 : err = fd_vote_encode( &self->vote, ctx );
5272 0 : if( FD_UNLIKELY( err ) ) return err;
5273 0 : break;
5274 0 : }
5275 0 : case 3: {
5276 0 : err = fd_bincode_uint64_encode( self->withdraw, ctx );
5277 0 : if( FD_UNLIKELY( err ) ) return err;
5278 0 : break;
5279 0 : }
5280 0 : case 5: {
5281 0 : err = fd_bincode_uint8_encode( (uchar)(self->update_commission), ctx );
5282 0 : if( FD_UNLIKELY( err ) ) return err;
5283 0 : break;
5284 0 : }
5285 0 : case 6: {
5286 0 : err = fd_vote_switch_encode( &self->vote_switch, ctx );
5287 0 : if( FD_UNLIKELY( err ) ) return err;
5288 0 : break;
5289 0 : }
5290 0 : case 7: {
5291 0 : err = fd_vote_authorize_encode( &self->authorize_checked, ctx );
5292 0 : if( FD_UNLIKELY( err ) ) return err;
5293 0 : break;
5294 0 : }
5295 0 : case 8: {
5296 0 : err = fd_vote_state_update_encode( &self->update_vote_state, ctx );
5297 0 : if( FD_UNLIKELY( err ) ) return err;
5298 0 : break;
5299 0 : }
5300 0 : case 9: {
5301 0 : err = fd_update_vote_state_switch_encode( &self->update_vote_state_switch, ctx );
5302 0 : if( FD_UNLIKELY( err ) ) return err;
5303 0 : break;
5304 0 : }
5305 0 : case 10: {
5306 0 : err = fd_vote_authorize_with_seed_args_encode( &self->authorize_with_seed, ctx );
5307 0 : if( FD_UNLIKELY( err ) ) return err;
5308 0 : break;
5309 0 : }
5310 0 : case 11: {
5311 0 : err = fd_vote_authorize_checked_with_seed_args_encode( &self->authorize_checked_with_seed, ctx );
5312 0 : if( FD_UNLIKELY( err ) ) return err;
5313 0 : break;
5314 0 : }
5315 0 : case 12: {
5316 0 : err = fd_compact_vote_state_update_encode( &self->compact_update_vote_state, ctx );
5317 0 : if( FD_UNLIKELY( err ) ) return err;
5318 0 : break;
5319 0 : }
5320 0 : case 13: {
5321 0 : err = fd_compact_vote_state_update_switch_encode( &self->compact_update_vote_state_switch, ctx );
5322 0 : if( FD_UNLIKELY( err ) ) return err;
5323 0 : break;
5324 0 : }
5325 0 : case 14: {
5326 0 : err = fd_tower_sync_encode( &self->tower_sync, ctx );
5327 0 : if( FD_UNLIKELY( err ) ) return err;
5328 0 : break;
5329 0 : }
5330 0 : case 15: {
5331 0 : err = fd_tower_sync_switch_encode( &self->tower_sync_switch, ctx );
5332 0 : if( FD_UNLIKELY( err ) ) return err;
5333 0 : break;
5334 0 : }
5335 0 : case 16: {
5336 0 : err = fd_vote_init_v2_encode( &self->initialize_account_v2, ctx );
5337 0 : if( FD_UNLIKELY( err ) ) return err;
5338 0 : break;
5339 0 : }
5340 0 : case 17: {
5341 0 : err = fd_commission_kind_encode( &self->update_commission_collector, ctx );
5342 0 : if( FD_UNLIKELY( err ) ) return err;
5343 0 : break;
5344 0 : }
5345 0 : case 18: {
5346 0 : err = fd_update_commission_bps_args_encode( &self->update_commission_bps, ctx );
5347 0 : if( FD_UNLIKELY( err ) ) return err;
5348 0 : break;
5349 0 : }
5350 0 : case 19: {
5351 0 : err = fd_deposit_delegator_rewards_args_encode( &self->deposit_delegator_rewards, ctx );
5352 0 : if( FD_UNLIKELY( err ) ) return err;
5353 0 : break;
5354 0 : }
5355 0 : }
5356 0 : return FD_BINCODE_SUCCESS;
5357 0 : }
5358 0 : int fd_vote_instruction_encode( fd_vote_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5359 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
5360 0 : if( FD_UNLIKELY( err ) ) return err;
5361 0 : return fd_vote_instruction_inner_encode( &self->inner, self->discriminant, ctx );
5362 0 : }
5363 :
5364 0 : int fd_system_program_instruction_create_account_encode( fd_system_program_instruction_create_account_t const * self, fd_bincode_encode_ctx_t * ctx ) {
5365 0 : int err;
5366 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5367 0 : if( FD_UNLIKELY( err ) ) return err;
5368 0 : err = fd_bincode_uint64_encode( self->space, ctx );
5369 0 : if( FD_UNLIKELY( err ) ) return err;
5370 0 : err = fd_pubkey_encode( &self->owner, ctx );
5371 0 : if( FD_UNLIKELY( err ) ) return err;
5372 0 : return FD_BINCODE_SUCCESS;
5373 0 : }
5374 354 : static inline int fd_system_program_instruction_create_account_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5375 354 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5376 224 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
5377 224 : return 0;
5378 354 : }
5379 224 : static void fd_system_program_instruction_create_account_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5380 224 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)struct_mem;
5381 224 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5382 224 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
5383 224 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5384 224 : }
5385 0 : void * fd_system_program_instruction_create_account_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5386 0 : fd_system_program_instruction_create_account_t * self = (fd_system_program_instruction_create_account_t *)mem;
5387 0 : fd_system_program_instruction_create_account_new( self );
5388 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_t);
5389 0 : void * * alloc_mem = &alloc_region;
5390 0 : fd_system_program_instruction_create_account_decode_inner( mem, alloc_mem, ctx );
5391 0 : return self;
5392 0 : }
5393 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 ) {
5394 0 : int err;
5395 0 : err = fd_pubkey_encode( &self->base, ctx );
5396 0 : if( FD_UNLIKELY( err ) ) return err;
5397 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
5398 0 : if( FD_UNLIKELY(err) ) return err;
5399 0 : if( self->seed_len ) {
5400 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
5401 0 : if( FD_UNLIKELY( err ) ) return err;
5402 0 : }
5403 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5404 0 : if( FD_UNLIKELY( err ) ) return err;
5405 0 : err = fd_bincode_uint64_encode( self->space, ctx );
5406 0 : if( FD_UNLIKELY( err ) ) return err;
5407 0 : err = fd_pubkey_encode( &self->owner, ctx );
5408 0 : if( FD_UNLIKELY( err ) ) return err;
5409 0 : return FD_BINCODE_SUCCESS;
5410 0 : }
5411 579 : static int fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5412 579 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5413 577 : int err = 0;
5414 577 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5415 577 : if( FD_UNLIKELY( err ) ) return err;
5416 572 : ulong seed_len;
5417 572 : err = fd_bincode_uint64_decode( &seed_len, ctx );
5418 572 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5419 568 : *total_sz += seed_len;
5420 568 : if( seed_len ) {
5421 551 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
5422 551 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5423 536 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
5424 536 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5425 536 : }
5426 530 : err = fd_bincode_uint64_decode_footprint( ctx );
5427 530 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5428 526 : err = fd_bincode_uint64_decode_footprint( ctx );
5429 526 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5430 522 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5431 522 : if( FD_UNLIKELY( err ) ) return err;
5432 518 : return 0;
5433 522 : }
5434 0 : int fd_system_program_instruction_create_account_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5435 0 : *total_sz += sizeof(fd_system_program_instruction_create_account_with_seed_t);
5436 0 : void const * start_data = ctx->data;
5437 0 : int err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
5438 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5439 0 : ctx->data = start_data;
5440 0 : return err;
5441 0 : }
5442 518 : static void fd_system_program_instruction_create_account_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5443 518 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)struct_mem;
5444 518 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
5445 518 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
5446 518 : if( self->seed_len ) {
5447 503 : self->seed = *alloc_mem;
5448 503 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
5449 503 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
5450 503 : } else
5451 15 : self->seed = NULL;
5452 518 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5453 518 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
5454 518 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5455 518 : }
5456 0 : void * fd_system_program_instruction_create_account_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5457 0 : fd_system_program_instruction_create_account_with_seed_t * self = (fd_system_program_instruction_create_account_with_seed_t *)mem;
5458 0 : fd_system_program_instruction_create_account_with_seed_new( self );
5459 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_create_account_with_seed_t);
5460 0 : void * * alloc_mem = &alloc_region;
5461 0 : fd_system_program_instruction_create_account_with_seed_decode_inner( mem, alloc_mem, ctx );
5462 0 : return self;
5463 0 : }
5464 0 : void fd_system_program_instruction_create_account_with_seed_new(fd_system_program_instruction_create_account_with_seed_t * self) {
5465 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_create_account_with_seed_t) );
5466 0 : fd_pubkey_new( &self->base );
5467 0 : fd_pubkey_new( &self->owner );
5468 0 : }
5469 0 : ulong fd_system_program_instruction_create_account_with_seed_size( fd_system_program_instruction_create_account_with_seed_t const * self ) {
5470 0 : ulong size = 0;
5471 0 : size += fd_pubkey_size( &self->base );
5472 0 : do {
5473 0 : size += sizeof(ulong);
5474 0 : size += self->seed_len;
5475 0 : } while(0);
5476 0 : size += sizeof(ulong);
5477 0 : size += sizeof(ulong);
5478 0 : size += fd_pubkey_size( &self->owner );
5479 0 : return size;
5480 0 : }
5481 :
5482 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 ) {
5483 0 : int err;
5484 0 : err = fd_pubkey_encode( &self->base, ctx );
5485 0 : if( FD_UNLIKELY( err ) ) return err;
5486 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
5487 0 : if( FD_UNLIKELY(err) ) return err;
5488 0 : if( self->seed_len ) {
5489 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
5490 0 : if( FD_UNLIKELY( err ) ) return err;
5491 0 : }
5492 0 : err = fd_bincode_uint64_encode( self->space, ctx );
5493 0 : if( FD_UNLIKELY( err ) ) return err;
5494 0 : err = fd_pubkey_encode( &self->owner, ctx );
5495 0 : if( FD_UNLIKELY( err ) ) return err;
5496 0 : return FD_BINCODE_SUCCESS;
5497 0 : }
5498 257 : static int fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5499 257 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5500 255 : int err = 0;
5501 255 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5502 255 : if( FD_UNLIKELY( err ) ) return err;
5503 252 : ulong seed_len;
5504 252 : err = fd_bincode_uint64_decode( &seed_len, ctx );
5505 252 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5506 248 : *total_sz += seed_len;
5507 248 : if( seed_len ) {
5508 219 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
5509 219 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5510 213 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
5511 213 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5512 213 : }
5513 232 : err = fd_bincode_uint64_decode_footprint( ctx );
5514 232 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5515 228 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5516 228 : if( FD_UNLIKELY( err ) ) return err;
5517 221 : return 0;
5518 228 : }
5519 0 : int fd_system_program_instruction_allocate_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5520 0 : *total_sz += sizeof(fd_system_program_instruction_allocate_with_seed_t);
5521 0 : void const * start_data = ctx->data;
5522 0 : int err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
5523 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5524 0 : ctx->data = start_data;
5525 0 : return err;
5526 0 : }
5527 221 : static void fd_system_program_instruction_allocate_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5528 221 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)struct_mem;
5529 221 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
5530 221 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
5531 221 : if( self->seed_len ) {
5532 193 : self->seed = *alloc_mem;
5533 193 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
5534 193 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
5535 193 : } else
5536 28 : self->seed = NULL;
5537 221 : fd_bincode_uint64_decode_unsafe( &self->space, ctx );
5538 221 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5539 221 : }
5540 0 : void * fd_system_program_instruction_allocate_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5541 0 : fd_system_program_instruction_allocate_with_seed_t * self = (fd_system_program_instruction_allocate_with_seed_t *)mem;
5542 0 : fd_system_program_instruction_allocate_with_seed_new( self );
5543 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_allocate_with_seed_t);
5544 0 : void * * alloc_mem = &alloc_region;
5545 0 : fd_system_program_instruction_allocate_with_seed_decode_inner( mem, alloc_mem, ctx );
5546 0 : return self;
5547 0 : }
5548 0 : void fd_system_program_instruction_allocate_with_seed_new(fd_system_program_instruction_allocate_with_seed_t * self) {
5549 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_allocate_with_seed_t) );
5550 0 : fd_pubkey_new( &self->base );
5551 0 : fd_pubkey_new( &self->owner );
5552 0 : }
5553 0 : ulong fd_system_program_instruction_allocate_with_seed_size( fd_system_program_instruction_allocate_with_seed_t const * self ) {
5554 0 : ulong size = 0;
5555 0 : size += fd_pubkey_size( &self->base );
5556 0 : do {
5557 0 : size += sizeof(ulong);
5558 0 : size += self->seed_len;
5559 0 : } while(0);
5560 0 : size += sizeof(ulong);
5561 0 : size += fd_pubkey_size( &self->owner );
5562 0 : return size;
5563 0 : }
5564 :
5565 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 ) {
5566 0 : int err;
5567 0 : err = fd_pubkey_encode( &self->base, ctx );
5568 0 : if( FD_UNLIKELY( err ) ) return err;
5569 0 : err = fd_bincode_uint64_encode( self->seed_len, ctx );
5570 0 : if( FD_UNLIKELY(err) ) return err;
5571 0 : if( self->seed_len ) {
5572 0 : err = fd_bincode_bytes_encode( self->seed, self->seed_len, ctx );
5573 0 : if( FD_UNLIKELY( err ) ) return err;
5574 0 : }
5575 0 : err = fd_pubkey_encode( &self->owner, ctx );
5576 0 : if( FD_UNLIKELY( err ) ) return err;
5577 0 : return FD_BINCODE_SUCCESS;
5578 0 : }
5579 239 : static int fd_system_program_instruction_assign_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5580 239 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5581 238 : int err = 0;
5582 238 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5583 238 : if( FD_UNLIKELY( err ) ) return err;
5584 235 : ulong seed_len;
5585 235 : err = fd_bincode_uint64_decode( &seed_len, ctx );
5586 235 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5587 231 : *total_sz += seed_len;
5588 231 : if( seed_len ) {
5589 226 : err = fd_bincode_bytes_decode_footprint( seed_len, ctx );
5590 226 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5591 219 : err = !fd_utf8_verify( (char const *) ctx->data - seed_len, seed_len );
5592 219 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5593 219 : }
5594 215 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5595 215 : if( FD_UNLIKELY( err ) ) return err;
5596 211 : return 0;
5597 215 : }
5598 0 : int fd_system_program_instruction_assign_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5599 0 : *total_sz += sizeof(fd_system_program_instruction_assign_with_seed_t);
5600 0 : void const * start_data = ctx->data;
5601 0 : int err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
5602 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5603 0 : ctx->data = start_data;
5604 0 : return err;
5605 0 : }
5606 211 : static void fd_system_program_instruction_assign_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5607 211 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)struct_mem;
5608 211 : fd_pubkey_decode_inner( &self->base, alloc_mem, ctx );
5609 211 : fd_bincode_uint64_decode_unsafe( &self->seed_len, ctx );
5610 211 : if( self->seed_len ) {
5611 206 : self->seed = *alloc_mem;
5612 206 : fd_bincode_bytes_decode_unsafe( self->seed, self->seed_len, ctx );
5613 206 : *alloc_mem = (uchar *)(*alloc_mem) + self->seed_len;
5614 206 : } else
5615 5 : self->seed = NULL;
5616 211 : fd_pubkey_decode_inner( &self->owner, alloc_mem, ctx );
5617 211 : }
5618 0 : void * fd_system_program_instruction_assign_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5619 0 : fd_system_program_instruction_assign_with_seed_t * self = (fd_system_program_instruction_assign_with_seed_t *)mem;
5620 0 : fd_system_program_instruction_assign_with_seed_new( self );
5621 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_assign_with_seed_t);
5622 0 : void * * alloc_mem = &alloc_region;
5623 0 : fd_system_program_instruction_assign_with_seed_decode_inner( mem, alloc_mem, ctx );
5624 0 : return self;
5625 0 : }
5626 0 : void fd_system_program_instruction_assign_with_seed_new(fd_system_program_instruction_assign_with_seed_t * self) {
5627 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_assign_with_seed_t) );
5628 0 : fd_pubkey_new( &self->base );
5629 0 : fd_pubkey_new( &self->owner );
5630 0 : }
5631 0 : ulong fd_system_program_instruction_assign_with_seed_size( fd_system_program_instruction_assign_with_seed_t const * self ) {
5632 0 : ulong size = 0;
5633 0 : size += fd_pubkey_size( &self->base );
5634 0 : do {
5635 0 : size += sizeof(ulong);
5636 0 : size += self->seed_len;
5637 0 : } while(0);
5638 0 : size += fd_pubkey_size( &self->owner );
5639 0 : return size;
5640 0 : }
5641 :
5642 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 ) {
5643 0 : int err;
5644 0 : err = fd_bincode_uint64_encode( self->lamports, ctx );
5645 0 : if( FD_UNLIKELY( err ) ) return err;
5646 0 : err = fd_bincode_uint64_encode( self->from_seed_len, ctx );
5647 0 : if( FD_UNLIKELY(err) ) return err;
5648 0 : if( self->from_seed_len ) {
5649 0 : err = fd_bincode_bytes_encode( self->from_seed, self->from_seed_len, ctx );
5650 0 : if( FD_UNLIKELY( err ) ) return err;
5651 0 : }
5652 0 : err = fd_pubkey_encode( &self->from_owner, ctx );
5653 0 : if( FD_UNLIKELY( err ) ) return err;
5654 0 : return FD_BINCODE_SUCCESS;
5655 0 : }
5656 457 : static int fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5657 457 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5658 454 : int err = 0;
5659 454 : err = fd_bincode_uint64_decode_footprint( ctx );
5660 454 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5661 452 : ulong from_seed_len;
5662 452 : err = fd_bincode_uint64_decode( &from_seed_len, ctx );
5663 452 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5664 449 : *total_sz += from_seed_len;
5665 449 : if( from_seed_len ) {
5666 441 : err = fd_bincode_bytes_decode_footprint( from_seed_len, ctx );
5667 441 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5668 423 : err = !fd_utf8_verify( (char const *) ctx->data - from_seed_len, from_seed_len );
5669 423 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5670 423 : }
5671 424 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5672 424 : if( FD_UNLIKELY( err ) ) return err;
5673 415 : return 0;
5674 424 : }
5675 0 : int fd_system_program_instruction_transfer_with_seed_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5676 0 : *total_sz += sizeof(fd_system_program_instruction_transfer_with_seed_t);
5677 0 : void const * start_data = ctx->data;
5678 0 : int err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
5679 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5680 0 : ctx->data = start_data;
5681 0 : return err;
5682 0 : }
5683 415 : static void fd_system_program_instruction_transfer_with_seed_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5684 415 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)struct_mem;
5685 415 : fd_bincode_uint64_decode_unsafe( &self->lamports, ctx );
5686 415 : fd_bincode_uint64_decode_unsafe( &self->from_seed_len, ctx );
5687 415 : if( self->from_seed_len ) {
5688 408 : self->from_seed = *alloc_mem;
5689 408 : fd_bincode_bytes_decode_unsafe( self->from_seed, self->from_seed_len, ctx );
5690 408 : *alloc_mem = (uchar *)(*alloc_mem) + self->from_seed_len;
5691 408 : } else
5692 7 : self->from_seed = NULL;
5693 415 : fd_pubkey_decode_inner( &self->from_owner, alloc_mem, ctx );
5694 415 : }
5695 0 : void * fd_system_program_instruction_transfer_with_seed_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5696 0 : fd_system_program_instruction_transfer_with_seed_t * self = (fd_system_program_instruction_transfer_with_seed_t *)mem;
5697 0 : fd_system_program_instruction_transfer_with_seed_new( self );
5698 0 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_transfer_with_seed_t);
5699 0 : void * * alloc_mem = &alloc_region;
5700 0 : fd_system_program_instruction_transfer_with_seed_decode_inner( mem, alloc_mem, ctx );
5701 0 : return self;
5702 0 : }
5703 0 : void fd_system_program_instruction_transfer_with_seed_new(fd_system_program_instruction_transfer_with_seed_t * self) {
5704 0 : fd_memset( self, 0, sizeof(fd_system_program_instruction_transfer_with_seed_t) );
5705 0 : fd_pubkey_new( &self->from_owner );
5706 0 : }
5707 0 : ulong fd_system_program_instruction_transfer_with_seed_size( fd_system_program_instruction_transfer_with_seed_t const * self ) {
5708 0 : ulong size = 0;
5709 0 : size += sizeof(ulong);
5710 0 : do {
5711 0 : size += sizeof(ulong);
5712 0 : size += self->from_seed_len;
5713 0 : } while(0);
5714 0 : size += fd_pubkey_size( &self->from_owner );
5715 0 : return size;
5716 0 : }
5717 :
5718 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account(fd_system_program_instruction_t const * self) {
5719 0 : return self->discriminant == 0;
5720 0 : }
5721 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign(fd_system_program_instruction_t const * self) {
5722 0 : return self->discriminant == 1;
5723 0 : }
5724 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer(fd_system_program_instruction_t const * self) {
5725 0 : return self->discriminant == 2;
5726 0 : }
5727 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_with_seed(fd_system_program_instruction_t const * self) {
5728 0 : return self->discriminant == 3;
5729 0 : }
5730 0 : FD_FN_PURE uchar fd_system_program_instruction_is_advance_nonce_account(fd_system_program_instruction_t const * self) {
5731 0 : return self->discriminant == 4;
5732 0 : }
5733 0 : FD_FN_PURE uchar fd_system_program_instruction_is_withdraw_nonce_account(fd_system_program_instruction_t const * self) {
5734 0 : return self->discriminant == 5;
5735 0 : }
5736 0 : FD_FN_PURE uchar fd_system_program_instruction_is_initialize_nonce_account(fd_system_program_instruction_t const * self) {
5737 0 : return self->discriminant == 6;
5738 0 : }
5739 0 : FD_FN_PURE uchar fd_system_program_instruction_is_authorize_nonce_account(fd_system_program_instruction_t const * self) {
5740 0 : return self->discriminant == 7;
5741 0 : }
5742 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate(fd_system_program_instruction_t const * self) {
5743 0 : return self->discriminant == 8;
5744 0 : }
5745 0 : FD_FN_PURE uchar fd_system_program_instruction_is_allocate_with_seed(fd_system_program_instruction_t const * self) {
5746 0 : return self->discriminant == 9;
5747 0 : }
5748 0 : FD_FN_PURE uchar fd_system_program_instruction_is_assign_with_seed(fd_system_program_instruction_t const * self) {
5749 0 : return self->discriminant == 10;
5750 0 : }
5751 0 : FD_FN_PURE uchar fd_system_program_instruction_is_transfer_with_seed(fd_system_program_instruction_t const * self) {
5752 0 : return self->discriminant == 11;
5753 0 : }
5754 0 : FD_FN_PURE uchar fd_system_program_instruction_is_upgrade_nonce_account(fd_system_program_instruction_t const * self) {
5755 0 : return self->discriminant == 12;
5756 0 : }
5757 0 : FD_FN_PURE uchar fd_system_program_instruction_is_create_account_allow_prefund(fd_system_program_instruction_t const * self) {
5758 0 : return self->discriminant == 13;
5759 0 : }
5760 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant );
5761 5692 : int fd_system_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5762 5692 : int err;
5763 5692 : switch (discriminant) {
5764 354 : case 0: {
5765 354 : err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
5766 354 : if( FD_UNLIKELY( err ) ) return err;
5767 224 : return FD_BINCODE_SUCCESS;
5768 354 : }
5769 325 : case 1: {
5770 325 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5771 325 : if( FD_UNLIKELY( err ) ) return err;
5772 283 : return FD_BINCODE_SUCCESS;
5773 325 : }
5774 257 : case 2: {
5775 257 : err = fd_bincode_uint64_decode_footprint( ctx );
5776 257 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5777 250 : return FD_BINCODE_SUCCESS;
5778 257 : }
5779 579 : case 3: {
5780 579 : err = fd_system_program_instruction_create_account_with_seed_decode_footprint_inner( ctx, total_sz );
5781 579 : if( FD_UNLIKELY( err ) ) return err;
5782 518 : return FD_BINCODE_SUCCESS;
5783 579 : }
5784 878 : case 4: {
5785 878 : return FD_BINCODE_SUCCESS;
5786 579 : }
5787 458 : case 5: {
5788 458 : err = fd_bincode_uint64_decode_footprint( ctx );
5789 458 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5790 452 : return FD_BINCODE_SUCCESS;
5791 458 : }
5792 196 : case 6: {
5793 196 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5794 196 : if( FD_UNLIKELY( err ) ) return err;
5795 193 : return FD_BINCODE_SUCCESS;
5796 196 : }
5797 439 : case 7: {
5798 439 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
5799 439 : if( FD_UNLIKELY( err ) ) return err;
5800 427 : return FD_BINCODE_SUCCESS;
5801 439 : }
5802 372 : case 8: {
5803 372 : err = fd_bincode_uint64_decode_footprint( ctx );
5804 372 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
5805 368 : return FD_BINCODE_SUCCESS;
5806 372 : }
5807 257 : case 9: {
5808 257 : err = fd_system_program_instruction_allocate_with_seed_decode_footprint_inner( ctx, total_sz );
5809 257 : if( FD_UNLIKELY( err ) ) return err;
5810 221 : return FD_BINCODE_SUCCESS;
5811 257 : }
5812 239 : case 10: {
5813 239 : err = fd_system_program_instruction_assign_with_seed_decode_footprint_inner( ctx, total_sz );
5814 239 : if( FD_UNLIKELY( err ) ) return err;
5815 211 : return FD_BINCODE_SUCCESS;
5816 239 : }
5817 457 : case 11: {
5818 457 : err = fd_system_program_instruction_transfer_with_seed_decode_footprint_inner( ctx, total_sz );
5819 457 : if( FD_UNLIKELY( err ) ) return err;
5820 415 : return FD_BINCODE_SUCCESS;
5821 457 : }
5822 204 : case 12: {
5823 204 : return FD_BINCODE_SUCCESS;
5824 457 : }
5825 0 : case 13: {
5826 0 : err = fd_system_program_instruction_create_account_decode_footprint_inner( ctx, total_sz );
5827 0 : if( FD_UNLIKELY( err ) ) return err;
5828 0 : return FD_BINCODE_SUCCESS;
5829 0 : }
5830 682 : default: return FD_BINCODE_ERR_ENCODING;
5831 5692 : }
5832 5692 : }
5833 5973 : static int fd_system_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5834 5973 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5835 5701 : uint discriminant = 0;
5836 5701 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
5837 5701 : if( FD_UNLIKELY( err ) ) return err;
5838 5688 : return fd_system_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
5839 5701 : }
5840 5974 : int fd_system_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
5841 5974 : *total_sz += sizeof(fd_system_program_instruction_t);
5842 5974 : void const * start_data = ctx->data;
5843 5974 : int err = fd_system_program_instruction_decode_footprint_inner( ctx, total_sz );
5844 5974 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
5845 5974 : ctx->data = start_data;
5846 5974 : return err;
5847 5974 : }
5848 4642 : 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 ) {
5849 4642 : switch (discriminant) {
5850 224 : case 0: {
5851 224 : fd_system_program_instruction_create_account_decode_inner( &self->create_account, alloc_mem, ctx );
5852 224 : break;
5853 0 : }
5854 283 : case 1: {
5855 283 : fd_pubkey_decode_inner( &self->assign, alloc_mem, ctx );
5856 283 : break;
5857 0 : }
5858 250 : case 2: {
5859 250 : fd_bincode_uint64_decode_unsafe( &self->transfer, ctx );
5860 250 : break;
5861 0 : }
5862 518 : case 3: {
5863 518 : fd_system_program_instruction_create_account_with_seed_decode_inner( &self->create_account_with_seed, alloc_mem, ctx );
5864 518 : break;
5865 0 : }
5866 878 : case 4: {
5867 878 : break;
5868 0 : }
5869 452 : case 5: {
5870 452 : fd_bincode_uint64_decode_unsafe( &self->withdraw_nonce_account, ctx );
5871 452 : break;
5872 0 : }
5873 194 : case 6: {
5874 194 : fd_pubkey_decode_inner( &self->initialize_nonce_account, alloc_mem, ctx );
5875 194 : break;
5876 0 : }
5877 427 : case 7: {
5878 427 : fd_pubkey_decode_inner( &self->authorize_nonce_account, alloc_mem, ctx );
5879 427 : break;
5880 0 : }
5881 368 : case 8: {
5882 368 : fd_bincode_uint64_decode_unsafe( &self->allocate, ctx );
5883 368 : break;
5884 0 : }
5885 221 : case 9: {
5886 221 : fd_system_program_instruction_allocate_with_seed_decode_inner( &self->allocate_with_seed, alloc_mem, ctx );
5887 221 : break;
5888 0 : }
5889 211 : case 10: {
5890 211 : fd_system_program_instruction_assign_with_seed_decode_inner( &self->assign_with_seed, alloc_mem, ctx );
5891 211 : break;
5892 0 : }
5893 415 : case 11: {
5894 415 : fd_system_program_instruction_transfer_with_seed_decode_inner( &self->transfer_with_seed, alloc_mem, ctx );
5895 415 : break;
5896 0 : }
5897 204 : case 12: {
5898 204 : break;
5899 0 : }
5900 0 : case 13: {
5901 0 : fd_system_program_instruction_create_account_decode_inner( &self->create_account_allow_prefund, alloc_mem, ctx );
5902 0 : break;
5903 0 : }
5904 4642 : }
5905 4642 : }
5906 4642 : static void fd_system_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
5907 4642 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)struct_mem;
5908 4642 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
5909 4642 : fd_system_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
5910 4642 : }
5911 4643 : void * fd_system_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
5912 4643 : fd_system_program_instruction_t * self = (fd_system_program_instruction_t *)mem;
5913 4643 : fd_system_program_instruction_new( self );
5914 4643 : void * alloc_region = (uchar *)mem + sizeof(fd_system_program_instruction_t);
5915 4643 : void * * alloc_mem = &alloc_region;
5916 4643 : fd_system_program_instruction_decode_inner( mem, alloc_mem, ctx );
5917 4643 : return self;
5918 4643 : }
5919 4642 : void fd_system_program_instruction_inner_new( fd_system_program_instruction_inner_t * self, uint discriminant ) {
5920 4642 : switch( discriminant ) {
5921 0 : case 0: {
5922 0 : fd_system_program_instruction_create_account_new( &self->create_account );
5923 0 : break;
5924 0 : }
5925 0 : case 1: {
5926 0 : fd_pubkey_new( &self->assign );
5927 0 : break;
5928 0 : }
5929 0 : case 2: {
5930 0 : break;
5931 0 : }
5932 0 : case 3: {
5933 0 : fd_system_program_instruction_create_account_with_seed_new( &self->create_account_with_seed );
5934 0 : break;
5935 0 : }
5936 0 : case 4: {
5937 0 : break;
5938 0 : }
5939 0 : case 5: {
5940 0 : break;
5941 0 : }
5942 0 : case 6: {
5943 0 : fd_pubkey_new( &self->initialize_nonce_account );
5944 0 : break;
5945 0 : }
5946 0 : case 7: {
5947 0 : fd_pubkey_new( &self->authorize_nonce_account );
5948 0 : break;
5949 0 : }
5950 0 : case 8: {
5951 0 : break;
5952 0 : }
5953 0 : case 9: {
5954 0 : fd_system_program_instruction_allocate_with_seed_new( &self->allocate_with_seed );
5955 0 : break;
5956 0 : }
5957 0 : case 10: {
5958 0 : fd_system_program_instruction_assign_with_seed_new( &self->assign_with_seed );
5959 0 : break;
5960 0 : }
5961 0 : case 11: {
5962 0 : fd_system_program_instruction_transfer_with_seed_new( &self->transfer_with_seed );
5963 0 : break;
5964 0 : }
5965 0 : case 12: {
5966 0 : break;
5967 0 : }
5968 0 : case 13: {
5969 0 : fd_system_program_instruction_create_account_new( &self->create_account_allow_prefund );
5970 0 : break;
5971 0 : }
5972 4643 : default: break; // FD_LOG_ERR(( "unhandled type"));
5973 4642 : }
5974 4642 : }
5975 4643 : void fd_system_program_instruction_new_disc( fd_system_program_instruction_t * self, uint discriminant ) {
5976 4643 : self->discriminant = discriminant;
5977 4643 : fd_system_program_instruction_inner_new( &self->inner, self->discriminant );
5978 4643 : }
5979 4643 : void fd_system_program_instruction_new( fd_system_program_instruction_t * self ) {
5980 4643 : fd_memset( self, 0, sizeof(fd_system_program_instruction_t) );
5981 4643 : fd_system_program_instruction_new_disc( self, UINT_MAX );
5982 4643 : }
5983 :
5984 0 : ulong fd_system_program_instruction_size( fd_system_program_instruction_t const * self ) {
5985 0 : ulong size = 0;
5986 0 : size += sizeof(uint);
5987 0 : switch (self->discriminant) {
5988 0 : case 0: {
5989 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account );
5990 0 : break;
5991 0 : }
5992 0 : case 1: {
5993 0 : size += fd_pubkey_size( &self->inner.assign );
5994 0 : break;
5995 0 : }
5996 0 : case 2: {
5997 0 : size += sizeof(ulong);
5998 0 : break;
5999 0 : }
6000 0 : case 3: {
6001 0 : size += fd_system_program_instruction_create_account_with_seed_size( &self->inner.create_account_with_seed );
6002 0 : break;
6003 0 : }
6004 0 : case 5: {
6005 0 : size += sizeof(ulong);
6006 0 : break;
6007 0 : }
6008 0 : case 6: {
6009 0 : size += fd_pubkey_size( &self->inner.initialize_nonce_account );
6010 0 : break;
6011 0 : }
6012 0 : case 7: {
6013 0 : size += fd_pubkey_size( &self->inner.authorize_nonce_account );
6014 0 : break;
6015 0 : }
6016 0 : case 8: {
6017 0 : size += sizeof(ulong);
6018 0 : break;
6019 0 : }
6020 0 : case 9: {
6021 0 : size += fd_system_program_instruction_allocate_with_seed_size( &self->inner.allocate_with_seed );
6022 0 : break;
6023 0 : }
6024 0 : case 10: {
6025 0 : size += fd_system_program_instruction_assign_with_seed_size( &self->inner.assign_with_seed );
6026 0 : break;
6027 0 : }
6028 0 : case 11: {
6029 0 : size += fd_system_program_instruction_transfer_with_seed_size( &self->inner.transfer_with_seed );
6030 0 : break;
6031 0 : }
6032 0 : case 13: {
6033 0 : size += fd_system_program_instruction_create_account_size( &self->inner.create_account_allow_prefund );
6034 0 : break;
6035 0 : }
6036 0 : }
6037 0 : return size;
6038 0 : }
6039 :
6040 0 : int fd_system_program_instruction_inner_encode( fd_system_program_instruction_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6041 0 : int err;
6042 0 : switch (discriminant) {
6043 0 : case 0: {
6044 0 : err = fd_system_program_instruction_create_account_encode( &self->create_account, ctx );
6045 0 : if( FD_UNLIKELY( err ) ) return err;
6046 0 : break;
6047 0 : }
6048 0 : case 1: {
6049 0 : err = fd_pubkey_encode( &self->assign, ctx );
6050 0 : if( FD_UNLIKELY( err ) ) return err;
6051 0 : break;
6052 0 : }
6053 0 : case 2: {
6054 0 : err = fd_bincode_uint64_encode( self->transfer, ctx );
6055 0 : if( FD_UNLIKELY( err ) ) return err;
6056 0 : break;
6057 0 : }
6058 0 : case 3: {
6059 0 : err = fd_system_program_instruction_create_account_with_seed_encode( &self->create_account_with_seed, ctx );
6060 0 : if( FD_UNLIKELY( err ) ) return err;
6061 0 : break;
6062 0 : }
6063 0 : case 5: {
6064 0 : err = fd_bincode_uint64_encode( self->withdraw_nonce_account, ctx );
6065 0 : if( FD_UNLIKELY( err ) ) return err;
6066 0 : break;
6067 0 : }
6068 0 : case 6: {
6069 0 : err = fd_pubkey_encode( &self->initialize_nonce_account, ctx );
6070 0 : if( FD_UNLIKELY( err ) ) return err;
6071 0 : break;
6072 0 : }
6073 0 : case 7: {
6074 0 : err = fd_pubkey_encode( &self->authorize_nonce_account, ctx );
6075 0 : if( FD_UNLIKELY( err ) ) return err;
6076 0 : break;
6077 0 : }
6078 0 : case 8: {
6079 0 : err = fd_bincode_uint64_encode( self->allocate, ctx );
6080 0 : if( FD_UNLIKELY( err ) ) return err;
6081 0 : break;
6082 0 : }
6083 0 : case 9: {
6084 0 : err = fd_system_program_instruction_allocate_with_seed_encode( &self->allocate_with_seed, ctx );
6085 0 : if( FD_UNLIKELY( err ) ) return err;
6086 0 : break;
6087 0 : }
6088 0 : case 10: {
6089 0 : err = fd_system_program_instruction_assign_with_seed_encode( &self->assign_with_seed, ctx );
6090 0 : if( FD_UNLIKELY( err ) ) return err;
6091 0 : break;
6092 0 : }
6093 0 : case 11: {
6094 0 : err = fd_system_program_instruction_transfer_with_seed_encode( &self->transfer_with_seed, ctx );
6095 0 : if( FD_UNLIKELY( err ) ) return err;
6096 0 : break;
6097 0 : }
6098 0 : case 13: {
6099 0 : err = fd_system_program_instruction_create_account_encode( &self->create_account_allow_prefund, ctx );
6100 0 : if( FD_UNLIKELY( err ) ) return err;
6101 0 : break;
6102 0 : }
6103 0 : }
6104 0 : return FD_BINCODE_SUCCESS;
6105 0 : }
6106 0 : int fd_system_program_instruction_encode( fd_system_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6107 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6108 0 : if( FD_UNLIKELY( err ) ) return err;
6109 0 : return fd_system_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
6110 0 : }
6111 :
6112 2 : int fd_stake_authorized_encode( fd_stake_authorized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6113 2 : int err;
6114 2 : err = fd_pubkey_encode( &self->staker, ctx );
6115 2 : if( FD_UNLIKELY( err ) ) return err;
6116 2 : err = fd_pubkey_encode( &self->withdrawer, ctx );
6117 2 : if( FD_UNLIKELY( err ) ) return err;
6118 2 : return FD_BINCODE_SUCCESS;
6119 2 : }
6120 0 : static inline int fd_stake_authorized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6121 0 : if( (ulong)ctx->data + 64UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6122 0 : ctx->data = (void *)( (ulong)ctx->data + 64UL );
6123 0 : return 0;
6124 0 : }
6125 301 : static void fd_stake_authorized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6126 301 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)struct_mem;
6127 301 : fd_pubkey_decode_inner( &self->staker, alloc_mem, ctx );
6128 301 : fd_pubkey_decode_inner( &self->withdrawer, alloc_mem, ctx );
6129 301 : }
6130 0 : void * fd_stake_authorized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6131 0 : fd_stake_authorized_t * self = (fd_stake_authorized_t *)mem;
6132 0 : fd_stake_authorized_new( self );
6133 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_authorized_t);
6134 0 : void * * alloc_mem = &alloc_region;
6135 0 : fd_stake_authorized_decode_inner( mem, alloc_mem, ctx );
6136 0 : return self;
6137 0 : }
6138 2 : int fd_stake_lockup_encode( fd_stake_lockup_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6139 2 : int err;
6140 2 : err = fd_bincode_uint64_encode( (ulong)self->unix_timestamp, ctx );
6141 2 : if( FD_UNLIKELY( err ) ) return err;
6142 2 : err = fd_bincode_uint64_encode( self->epoch, ctx );
6143 2 : if( FD_UNLIKELY( err ) ) return err;
6144 2 : err = fd_pubkey_encode( &self->custodian, ctx );
6145 2 : if( FD_UNLIKELY( err ) ) return err;
6146 2 : return FD_BINCODE_SUCCESS;
6147 2 : }
6148 0 : static inline int fd_stake_lockup_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6149 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6150 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
6151 0 : return 0;
6152 0 : }
6153 301 : static void fd_stake_lockup_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6154 301 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)struct_mem;
6155 301 : fd_bincode_uint64_decode_unsafe( (ulong *) &self->unix_timestamp, ctx );
6156 301 : fd_bincode_uint64_decode_unsafe( &self->epoch, ctx );
6157 301 : fd_pubkey_decode_inner( &self->custodian, alloc_mem, ctx );
6158 301 : }
6159 0 : void * fd_stake_lockup_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6160 0 : fd_stake_lockup_t * self = (fd_stake_lockup_t *)mem;
6161 0 : fd_stake_lockup_new( self );
6162 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_lockup_t);
6163 0 : void * * alloc_mem = &alloc_region;
6164 0 : fd_stake_lockup_decode_inner( mem, alloc_mem, ctx );
6165 0 : return self;
6166 0 : }
6167 2 : int fd_stake_meta_encode( fd_stake_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6168 2 : int err;
6169 2 : err = fd_bincode_uint64_encode( self->rent_exempt_reserve, ctx );
6170 2 : if( FD_UNLIKELY( err ) ) return err;
6171 2 : err = fd_stake_authorized_encode( &self->authorized, ctx );
6172 2 : if( FD_UNLIKELY( err ) ) return err;
6173 2 : err = fd_stake_lockup_encode( &self->lockup, ctx );
6174 2 : if( FD_UNLIKELY( err ) ) return err;
6175 2 : return FD_BINCODE_SUCCESS;
6176 2 : }
6177 0 : static inline int fd_stake_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6178 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6179 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
6180 0 : return 0;
6181 0 : }
6182 301 : static void fd_stake_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6183 301 : fd_stake_meta_t * self = (fd_stake_meta_t *)struct_mem;
6184 301 : fd_bincode_uint64_decode_unsafe( &self->rent_exempt_reserve, ctx );
6185 301 : fd_stake_authorized_decode_inner( &self->authorized, alloc_mem, ctx );
6186 301 : fd_stake_lockup_decode_inner( &self->lockup, alloc_mem, ctx );
6187 301 : }
6188 0 : void * fd_stake_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6189 0 : fd_stake_meta_t * self = (fd_stake_meta_t *)mem;
6190 0 : fd_stake_meta_new( self );
6191 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_meta_t);
6192 0 : void * * alloc_mem = &alloc_region;
6193 0 : fd_stake_meta_decode_inner( mem, alloc_mem, ctx );
6194 0 : return self;
6195 0 : }
6196 2 : int fd_stake_flags_encode( fd_stake_flags_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6197 2 : int err;
6198 2 : err = fd_bincode_uint8_encode( (uchar)(self->bits), ctx );
6199 2 : if( FD_UNLIKELY( err ) ) return err;
6200 2 : return FD_BINCODE_SUCCESS;
6201 2 : }
6202 0 : static inline int fd_stake_flags_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6203 0 : if( (ulong)ctx->data + 1UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6204 0 : ctx->data = (void *)( (ulong)ctx->data + 1UL );
6205 0 : return 0;
6206 0 : }
6207 300 : static void fd_stake_flags_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6208 300 : fd_stake_flags_t * self = (fd_stake_flags_t *)struct_mem;
6209 300 : fd_bincode_uint8_decode_unsafe( &self->bits, ctx );
6210 300 : }
6211 0 : void * fd_stake_flags_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6212 0 : fd_stake_flags_t * self = (fd_stake_flags_t *)mem;
6213 0 : fd_stake_flags_new( self );
6214 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_flags_t);
6215 0 : void * * alloc_mem = &alloc_region;
6216 0 : fd_stake_flags_decode_inner( mem, alloc_mem, ctx );
6217 0 : return self;
6218 0 : }
6219 0 : int fd_stake_state_v2_initialized_encode( fd_stake_state_v2_initialized_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6220 0 : int err;
6221 0 : err = fd_stake_meta_encode( &self->meta, ctx );
6222 0 : if( FD_UNLIKELY( err ) ) return err;
6223 0 : return FD_BINCODE_SUCCESS;
6224 0 : }
6225 0 : static inline int fd_stake_state_v2_initialized_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6226 0 : if( (ulong)ctx->data + 120UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6227 0 : ctx->data = (void *)( (ulong)ctx->data + 120UL );
6228 0 : return 0;
6229 0 : }
6230 0 : static void fd_stake_state_v2_initialized_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6231 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)struct_mem;
6232 0 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
6233 0 : }
6234 0 : void * fd_stake_state_v2_initialized_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6235 0 : fd_stake_state_v2_initialized_t * self = (fd_stake_state_v2_initialized_t *)mem;
6236 0 : fd_stake_state_v2_initialized_new( self );
6237 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_initialized_t);
6238 0 : void * * alloc_mem = &alloc_region;
6239 0 : fd_stake_state_v2_initialized_decode_inner( mem, alloc_mem, ctx );
6240 0 : return self;
6241 0 : }
6242 2 : int fd_stake_state_v2_stake_encode( fd_stake_state_v2_stake_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6243 2 : int err;
6244 2 : err = fd_stake_meta_encode( &self->meta, ctx );
6245 2 : if( FD_UNLIKELY( err ) ) return err;
6246 2 : err = fd_stake_encode( &self->stake, ctx );
6247 2 : if( FD_UNLIKELY( err ) ) return err;
6248 2 : err = fd_stake_flags_encode( &self->stake_flags, ctx );
6249 2 : if( FD_UNLIKELY( err ) ) return err;
6250 2 : return FD_BINCODE_SUCCESS;
6251 2 : }
6252 301 : static inline int fd_stake_state_v2_stake_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6253 301 : if( (ulong)ctx->data + 193UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6254 301 : ctx->data = (void *)( (ulong)ctx->data + 193UL );
6255 301 : return 0;
6256 301 : }
6257 301 : static void fd_stake_state_v2_stake_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6258 301 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)struct_mem;
6259 301 : fd_stake_meta_decode_inner( &self->meta, alloc_mem, ctx );
6260 301 : fd_stake_decode_inner( &self->stake, alloc_mem, ctx );
6261 301 : fd_stake_flags_decode_inner( &self->stake_flags, alloc_mem, ctx );
6262 301 : }
6263 0 : void * fd_stake_state_v2_stake_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6264 0 : fd_stake_state_v2_stake_t * self = (fd_stake_state_v2_stake_t *)mem;
6265 0 : fd_stake_state_v2_stake_new( self );
6266 0 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_stake_t);
6267 0 : void * * alloc_mem = &alloc_region;
6268 0 : fd_stake_state_v2_stake_decode_inner( mem, alloc_mem, ctx );
6269 0 : return self;
6270 0 : }
6271 0 : FD_FN_PURE uchar fd_stake_state_v2_is_uninitialized(fd_stake_state_v2_t const * self) {
6272 0 : return self->discriminant == 0;
6273 0 : }
6274 0 : FD_FN_PURE uchar fd_stake_state_v2_is_initialized(fd_stake_state_v2_t const * self) {
6275 0 : return self->discriminant == 1;
6276 0 : }
6277 301 : FD_FN_PURE uchar fd_stake_state_v2_is_stake(fd_stake_state_v2_t const * self) {
6278 301 : return self->discriminant == 2;
6279 301 : }
6280 0 : FD_FN_PURE uchar fd_stake_state_v2_is_rewards_pool(fd_stake_state_v2_t const * self) {
6281 0 : return self->discriminant == 3;
6282 0 : }
6283 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant );
6284 301 : int fd_stake_state_v2_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6285 301 : int err;
6286 301 : switch (discriminant) {
6287 0 : case 0: {
6288 0 : return FD_BINCODE_SUCCESS;
6289 0 : }
6290 0 : case 1: {
6291 0 : err = fd_stake_state_v2_initialized_decode_footprint_inner( ctx, total_sz );
6292 0 : if( FD_UNLIKELY( err ) ) return err;
6293 0 : return FD_BINCODE_SUCCESS;
6294 0 : }
6295 301 : case 2: {
6296 301 : err = fd_stake_state_v2_stake_decode_footprint_inner( ctx, total_sz );
6297 301 : if( FD_UNLIKELY( err ) ) return err;
6298 301 : return FD_BINCODE_SUCCESS;
6299 301 : }
6300 0 : case 3: {
6301 0 : return FD_BINCODE_SUCCESS;
6302 301 : }
6303 0 : default: return FD_BINCODE_ERR_ENCODING;
6304 301 : }
6305 301 : }
6306 301 : static int fd_stake_state_v2_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6307 301 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6308 301 : uint discriminant = 0;
6309 301 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6310 301 : if( FD_UNLIKELY( err ) ) return err;
6311 301 : return fd_stake_state_v2_inner_decode_footprint( discriminant, ctx, total_sz );
6312 301 : }
6313 301 : int fd_stake_state_v2_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6314 301 : *total_sz += sizeof(fd_stake_state_v2_t);
6315 301 : void const * start_data = ctx->data;
6316 301 : int err = fd_stake_state_v2_decode_footprint_inner( ctx, total_sz );
6317 301 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6318 301 : ctx->data = start_data;
6319 301 : return err;
6320 301 : }
6321 301 : 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 ) {
6322 301 : switch (discriminant) {
6323 0 : case 0: {
6324 0 : break;
6325 0 : }
6326 0 : case 1: {
6327 0 : fd_stake_state_v2_initialized_decode_inner( &self->initialized, alloc_mem, ctx );
6328 0 : break;
6329 0 : }
6330 301 : case 2: {
6331 301 : fd_stake_state_v2_stake_decode_inner( &self->stake, alloc_mem, ctx );
6332 301 : break;
6333 0 : }
6334 0 : case 3: {
6335 0 : break;
6336 0 : }
6337 301 : }
6338 301 : }
6339 301 : static void fd_stake_state_v2_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6340 301 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)struct_mem;
6341 301 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6342 301 : fd_stake_state_v2_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
6343 301 : }
6344 301 : void * fd_stake_state_v2_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6345 301 : fd_stake_state_v2_t * self = (fd_stake_state_v2_t *)mem;
6346 301 : fd_stake_state_v2_new( self );
6347 301 : void * alloc_region = (uchar *)mem + sizeof(fd_stake_state_v2_t);
6348 301 : void * * alloc_mem = &alloc_region;
6349 301 : fd_stake_state_v2_decode_inner( mem, alloc_mem, ctx );
6350 301 : return self;
6351 301 : }
6352 301 : void fd_stake_state_v2_inner_new( fd_stake_state_v2_inner_t * self, uint discriminant ) {
6353 301 : switch( discriminant ) {
6354 0 : case 0: {
6355 0 : break;
6356 0 : }
6357 0 : case 1: {
6358 0 : fd_stake_state_v2_initialized_new( &self->initialized );
6359 0 : break;
6360 0 : }
6361 0 : case 2: {
6362 0 : fd_stake_state_v2_stake_new( &self->stake );
6363 0 : break;
6364 0 : }
6365 0 : case 3: {
6366 0 : break;
6367 0 : }
6368 301 : default: break; // FD_LOG_ERR(( "unhandled type"));
6369 301 : }
6370 301 : }
6371 301 : void fd_stake_state_v2_new_disc( fd_stake_state_v2_t * self, uint discriminant ) {
6372 301 : self->discriminant = discriminant;
6373 301 : fd_stake_state_v2_inner_new( &self->inner, self->discriminant );
6374 301 : }
6375 301 : void fd_stake_state_v2_new( fd_stake_state_v2_t * self ) {
6376 301 : fd_memset( self, 0, sizeof(fd_stake_state_v2_t) );
6377 301 : fd_stake_state_v2_new_disc( self, UINT_MAX );
6378 301 : }
6379 :
6380 0 : ulong fd_stake_state_v2_size( fd_stake_state_v2_t const * self ) {
6381 0 : ulong size = 0;
6382 0 : size += sizeof(uint);
6383 0 : switch (self->discriminant) {
6384 0 : case 1: {
6385 0 : size += fd_stake_state_v2_initialized_size( &self->inner.initialized );
6386 0 : break;
6387 0 : }
6388 0 : case 2: {
6389 0 : size += fd_stake_state_v2_stake_size( &self->inner.stake );
6390 0 : break;
6391 0 : }
6392 0 : }
6393 0 : return size;
6394 0 : }
6395 :
6396 2 : int fd_stake_state_v2_inner_encode( fd_stake_state_v2_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6397 2 : int err;
6398 2 : switch (discriminant) {
6399 0 : case 1: {
6400 0 : err = fd_stake_state_v2_initialized_encode( &self->initialized, ctx );
6401 0 : if( FD_UNLIKELY( err ) ) return err;
6402 0 : break;
6403 0 : }
6404 2 : case 2: {
6405 2 : err = fd_stake_state_v2_stake_encode( &self->stake, ctx );
6406 2 : if( FD_UNLIKELY( err ) ) return err;
6407 2 : break;
6408 2 : }
6409 2 : }
6410 2 : return FD_BINCODE_SUCCESS;
6411 2 : }
6412 2 : int fd_stake_state_v2_encode( fd_stake_state_v2_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6413 2 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6414 2 : if( FD_UNLIKELY( err ) ) return err;
6415 2 : return fd_stake_state_v2_inner_encode( &self->inner, self->discriminant, ctx );
6416 2 : }
6417 :
6418 712 : int fd_nonce_data_encode( fd_nonce_data_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6419 712 : int err;
6420 712 : err = fd_pubkey_encode( &self->authority, ctx );
6421 712 : if( FD_UNLIKELY( err ) ) return err;
6422 712 : err = fd_hash_encode( &self->durable_nonce, ctx );
6423 712 : if( FD_UNLIKELY( err ) ) return err;
6424 712 : err = fd_fee_calculator_encode( &self->fee_calculator, ctx );
6425 712 : if( FD_UNLIKELY( err ) ) return err;
6426 712 : return FD_BINCODE_SUCCESS;
6427 712 : }
6428 960 : static inline int fd_nonce_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6429 960 : if( (ulong)ctx->data + 72UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6430 818 : ctx->data = (void *)( (ulong)ctx->data + 72UL );
6431 818 : return 0;
6432 960 : }
6433 817 : static void fd_nonce_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6434 817 : fd_nonce_data_t * self = (fd_nonce_data_t *)struct_mem;
6435 817 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
6436 817 : fd_hash_decode_inner( &self->durable_nonce, alloc_mem, ctx );
6437 817 : fd_fee_calculator_decode_inner( &self->fee_calculator, alloc_mem, ctx );
6438 817 : }
6439 0 : void * fd_nonce_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6440 0 : fd_nonce_data_t * self = (fd_nonce_data_t *)mem;
6441 0 : fd_nonce_data_new( self );
6442 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_data_t);
6443 0 : void * * alloc_mem = &alloc_region;
6444 0 : fd_nonce_data_decode_inner( mem, alloc_mem, ctx );
6445 0 : return self;
6446 0 : }
6447 336 : FD_FN_PURE uchar fd_nonce_state_is_uninitialized(fd_nonce_state_t const * self) {
6448 336 : return self->discriminant == 0;
6449 336 : }
6450 23 : FD_FN_PURE uchar fd_nonce_state_is_initialized(fd_nonce_state_t const * self) {
6451 23 : return self->discriminant == 1;
6452 23 : }
6453 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant );
6454 1170 : int fd_nonce_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6455 1170 : int err;
6456 1170 : switch (discriminant) {
6457 168 : case 0: {
6458 168 : return FD_BINCODE_SUCCESS;
6459 0 : }
6460 960 : case 1: {
6461 960 : err = fd_nonce_data_decode_footprint_inner( ctx, total_sz );
6462 960 : if( FD_UNLIKELY( err ) ) return err;
6463 818 : return FD_BINCODE_SUCCESS;
6464 960 : }
6465 42 : default: return FD_BINCODE_ERR_ENCODING;
6466 1170 : }
6467 1170 : }
6468 1182 : static int fd_nonce_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6469 1182 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6470 1172 : uint discriminant = 0;
6471 1172 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6472 1172 : if( FD_UNLIKELY( err ) ) return err;
6473 1170 : return fd_nonce_state_inner_decode_footprint( discriminant, ctx, total_sz );
6474 1172 : }
6475 0 : int fd_nonce_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6476 0 : *total_sz += sizeof(fd_nonce_state_t);
6477 0 : void const * start_data = ctx->data;
6478 0 : int err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
6479 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6480 0 : ctx->data = start_data;
6481 0 : return err;
6482 0 : }
6483 985 : 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 ) {
6484 985 : switch (discriminant) {
6485 168 : case 0: {
6486 168 : break;
6487 0 : }
6488 817 : case 1: {
6489 817 : fd_nonce_data_decode_inner( &self->initialized, alloc_mem, ctx );
6490 817 : break;
6491 0 : }
6492 985 : }
6493 985 : }
6494 985 : static void fd_nonce_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6495 985 : fd_nonce_state_t * self = (fd_nonce_state_t *)struct_mem;
6496 985 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6497 985 : fd_nonce_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
6498 985 : }
6499 0 : void * fd_nonce_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6500 0 : fd_nonce_state_t * self = (fd_nonce_state_t *)mem;
6501 0 : fd_nonce_state_new( self );
6502 0 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_t);
6503 0 : void * * alloc_mem = &alloc_region;
6504 0 : fd_nonce_state_decode_inner( mem, alloc_mem, ctx );
6505 0 : return self;
6506 0 : }
6507 0 : void fd_nonce_state_inner_new( fd_nonce_state_inner_t * self, uint discriminant ) {
6508 0 : switch( discriminant ) {
6509 0 : case 0: {
6510 0 : break;
6511 0 : }
6512 0 : case 1: {
6513 0 : fd_nonce_data_new( &self->initialized );
6514 0 : break;
6515 0 : }
6516 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
6517 0 : }
6518 0 : }
6519 0 : void fd_nonce_state_new_disc( fd_nonce_state_t * self, uint discriminant ) {
6520 0 : self->discriminant = discriminant;
6521 0 : fd_nonce_state_inner_new( &self->inner, self->discriminant );
6522 0 : }
6523 0 : void fd_nonce_state_new( fd_nonce_state_t * self ) {
6524 0 : fd_memset( self, 0, sizeof(fd_nonce_state_t) );
6525 0 : fd_nonce_state_new_disc( self, UINT_MAX );
6526 0 : }
6527 :
6528 1054 : ulong fd_nonce_state_size( fd_nonce_state_t const * self ) {
6529 1054 : ulong size = 0;
6530 1054 : size += sizeof(uint);
6531 1054 : switch (self->discriminant) {
6532 1042 : case 1: {
6533 1042 : size += fd_nonce_data_size( &self->inner.initialized );
6534 1042 : break;
6535 0 : }
6536 1054 : }
6537 1054 : return size;
6538 1054 : }
6539 :
6540 724 : int fd_nonce_state_inner_encode( fd_nonce_state_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6541 724 : int err;
6542 724 : switch (discriminant) {
6543 712 : case 1: {
6544 712 : err = fd_nonce_data_encode( &self->initialized, ctx );
6545 712 : if( FD_UNLIKELY( err ) ) return err;
6546 712 : break;
6547 712 : }
6548 724 : }
6549 724 : return FD_BINCODE_SUCCESS;
6550 724 : }
6551 724 : int fd_nonce_state_encode( fd_nonce_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6552 724 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6553 724 : if( FD_UNLIKELY( err ) ) return err;
6554 724 : return fd_nonce_state_inner_encode( &self->inner, self->discriminant, ctx );
6555 724 : }
6556 :
6557 337 : FD_FN_PURE uchar fd_nonce_state_versions_is_legacy(fd_nonce_state_versions_t const * self) {
6558 337 : return self->discriminant == 0;
6559 337 : }
6560 23 : FD_FN_PURE uchar fd_nonce_state_versions_is_current(fd_nonce_state_versions_t const * self) {
6561 23 : return self->discriminant == 1;
6562 23 : }
6563 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant );
6564 1327 : int fd_nonce_state_versions_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6565 1327 : int err;
6566 1327 : switch (discriminant) {
6567 346 : case 0: {
6568 346 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
6569 346 : if( FD_UNLIKELY( err ) ) return err;
6570 259 : return FD_BINCODE_SUCCESS;
6571 346 : }
6572 836 : case 1: {
6573 836 : err = fd_nonce_state_decode_footprint_inner( ctx, total_sz );
6574 836 : if( FD_UNLIKELY( err ) ) return err;
6575 727 : return FD_BINCODE_SUCCESS;
6576 836 : }
6577 146 : default: return FD_BINCODE_ERR_ENCODING;
6578 1327 : }
6579 1327 : }
6580 1346 : static int fd_nonce_state_versions_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6581 1346 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6582 1327 : uint discriminant = 0;
6583 1327 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6584 1327 : if( FD_UNLIKELY( err ) ) return err;
6585 1327 : return fd_nonce_state_versions_inner_decode_footprint( discriminant, ctx, total_sz );
6586 1327 : }
6587 1346 : int fd_nonce_state_versions_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6588 1346 : *total_sz += sizeof(fd_nonce_state_versions_t);
6589 1346 : void const * start_data = ctx->data;
6590 1346 : int err = fd_nonce_state_versions_decode_footprint_inner( ctx, total_sz );
6591 1346 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6592 1346 : ctx->data = start_data;
6593 1346 : return err;
6594 1346 : }
6595 985 : 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 ) {
6596 985 : switch (discriminant) {
6597 259 : case 0: {
6598 259 : fd_nonce_state_decode_inner( &self->legacy, alloc_mem, ctx );
6599 259 : break;
6600 0 : }
6601 727 : case 1: {
6602 727 : fd_nonce_state_decode_inner( &self->current, alloc_mem, ctx );
6603 727 : break;
6604 0 : }
6605 985 : }
6606 985 : }
6607 985 : static void fd_nonce_state_versions_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6608 985 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)struct_mem;
6609 985 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
6610 985 : fd_nonce_state_versions_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
6611 985 : }
6612 985 : void * fd_nonce_state_versions_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6613 985 : fd_nonce_state_versions_t * self = (fd_nonce_state_versions_t *)mem;
6614 985 : fd_nonce_state_versions_new( self );
6615 985 : void * alloc_region = (uchar *)mem + sizeof(fd_nonce_state_versions_t);
6616 985 : void * * alloc_mem = &alloc_region;
6617 985 : fd_nonce_state_versions_decode_inner( mem, alloc_mem, ctx );
6618 985 : return self;
6619 985 : }
6620 985 : void fd_nonce_state_versions_inner_new( fd_nonce_state_versions_inner_t * self, uint discriminant ) {
6621 985 : switch( discriminant ) {
6622 0 : case 0: {
6623 0 : fd_nonce_state_new( &self->legacy );
6624 0 : break;
6625 0 : }
6626 0 : case 1: {
6627 0 : fd_nonce_state_new( &self->current );
6628 0 : break;
6629 0 : }
6630 985 : default: break; // FD_LOG_ERR(( "unhandled type"));
6631 985 : }
6632 985 : }
6633 985 : void fd_nonce_state_versions_new_disc( fd_nonce_state_versions_t * self, uint discriminant ) {
6634 985 : self->discriminant = discriminant;
6635 985 : fd_nonce_state_versions_inner_new( &self->inner, self->discriminant );
6636 985 : }
6637 985 : void fd_nonce_state_versions_new( fd_nonce_state_versions_t * self ) {
6638 985 : fd_memset( self, 0, sizeof(fd_nonce_state_versions_t) );
6639 985 : fd_nonce_state_versions_new_disc( self, UINT_MAX );
6640 985 : }
6641 :
6642 1054 : ulong fd_nonce_state_versions_size( fd_nonce_state_versions_t const * self ) {
6643 1054 : ulong size = 0;
6644 1054 : size += sizeof(uint);
6645 1054 : switch (self->discriminant) {
6646 31 : case 0: {
6647 31 : size += fd_nonce_state_size( &self->inner.legacy );
6648 31 : break;
6649 0 : }
6650 1023 : case 1: {
6651 1023 : size += fd_nonce_state_size( &self->inner.current );
6652 1023 : break;
6653 0 : }
6654 1054 : }
6655 1054 : return size;
6656 1054 : }
6657 :
6658 724 : int fd_nonce_state_versions_inner_encode( fd_nonce_state_versions_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
6659 724 : int err;
6660 724 : switch (discriminant) {
6661 31 : case 0: {
6662 31 : err = fd_nonce_state_encode( &self->legacy, ctx );
6663 31 : if( FD_UNLIKELY( err ) ) return err;
6664 31 : break;
6665 31 : }
6666 693 : case 1: {
6667 693 : err = fd_nonce_state_encode( &self->current, ctx );
6668 693 : if( FD_UNLIKELY( err ) ) return err;
6669 693 : break;
6670 693 : }
6671 724 : }
6672 724 : return FD_BINCODE_SUCCESS;
6673 724 : }
6674 724 : int fd_nonce_state_versions_encode( fd_nonce_state_versions_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6675 724 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
6676 724 : if( FD_UNLIKELY( err ) ) return err;
6677 724 : return fd_nonce_state_versions_inner_encode( &self->inner, self->discriminant, ctx );
6678 724 : }
6679 :
6680 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 ) {
6681 0 : int err;
6682 0 : err = fd_bincode_uint32_encode( self->units, ctx );
6683 0 : if( FD_UNLIKELY( err ) ) return err;
6684 0 : err = fd_bincode_uint32_encode( self->additional_fee, ctx );
6685 0 : if( FD_UNLIKELY( err ) ) return err;
6686 0 : return FD_BINCODE_SUCCESS;
6687 0 : }
6688 4 : static inline int fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6689 4 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6690 2 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
6691 2 : return 0;
6692 4 : }
6693 2 : static void fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6694 2 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)struct_mem;
6695 2 : fd_bincode_uint32_decode_unsafe( &self->units, ctx );
6696 2 : fd_bincode_uint32_decode_unsafe( &self->additional_fee, ctx );
6697 2 : }
6698 0 : void * fd_compute_budget_program_instruction_request_units_deprecated_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6699 0 : fd_compute_budget_program_instruction_request_units_deprecated_t * self = (fd_compute_budget_program_instruction_request_units_deprecated_t *)mem;
6700 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( self );
6701 0 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_request_units_deprecated_t);
6702 0 : void * * alloc_mem = &alloc_region;
6703 0 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( mem, alloc_mem, ctx );
6704 0 : return self;
6705 0 : }
6706 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_units_deprecated(fd_compute_budget_program_instruction_t const * self) {
6707 0 : return self->discriminant == 0;
6708 0 : }
6709 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_request_heap_frame(fd_compute_budget_program_instruction_t const * self) {
6710 0 : return self->discriminant == 1;
6711 0 : }
6712 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_limit(fd_compute_budget_program_instruction_t const * self) {
6713 0 : return self->discriminant == 2;
6714 0 : }
6715 0 : FD_FN_PURE uchar fd_compute_budget_program_instruction_is_set_compute_unit_price(fd_compute_budget_program_instruction_t const * self) {
6716 0 : return self->discriminant == 3;
6717 0 : }
6718 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) {
6719 0 : return self->discriminant == 4;
6720 0 : }
6721 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant );
6722 621 : int fd_compute_budget_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6723 621 : int err;
6724 621 : switch (discriminant) {
6725 4 : case 0: {
6726 4 : err = fd_compute_budget_program_instruction_request_units_deprecated_decode_footprint_inner( ctx, total_sz );
6727 4 : if( FD_UNLIKELY( err ) ) return err;
6728 2 : return FD_BINCODE_SUCCESS;
6729 4 : }
6730 249 : case 1: {
6731 249 : err = fd_bincode_uint32_decode_footprint( ctx );
6732 249 : if( FD_UNLIKELY( err ) ) return err;
6733 249 : return FD_BINCODE_SUCCESS;
6734 249 : }
6735 115 : case 2: {
6736 115 : err = fd_bincode_uint32_decode_footprint( ctx );
6737 115 : if( FD_UNLIKELY( err ) ) return err;
6738 115 : return FD_BINCODE_SUCCESS;
6739 115 : }
6740 120 : case 3: {
6741 120 : err = fd_bincode_uint64_decode_footprint( ctx );
6742 120 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6743 120 : return FD_BINCODE_SUCCESS;
6744 120 : }
6745 114 : case 4: {
6746 114 : err = fd_bincode_uint32_decode_footprint( ctx );
6747 114 : if( FD_UNLIKELY( err ) ) return err;
6748 113 : return FD_BINCODE_SUCCESS;
6749 114 : }
6750 19 : default: return FD_BINCODE_ERR_ENCODING;
6751 621 : }
6752 621 : }
6753 629 : static int fd_compute_budget_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6754 629 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6755 627 : ushort discriminant = 0;
6756 627 : int err = fd_bincode_compact_u16_decode( &discriminant, ctx );
6757 627 : if( FD_UNLIKELY( err ) ) return err;
6758 621 : return fd_compute_budget_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
6759 627 : }
6760 629 : int fd_compute_budget_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6761 629 : *total_sz += sizeof(fd_compute_budget_program_instruction_t);
6762 629 : void const * start_data = ctx->data;
6763 629 : int err = fd_compute_budget_program_instruction_decode_footprint_inner( ctx, total_sz );
6764 629 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6765 629 : ctx->data = start_data;
6766 629 : return err;
6767 629 : }
6768 599 : 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 ) {
6769 599 : switch (discriminant) {
6770 2 : case 0: {
6771 2 : fd_compute_budget_program_instruction_request_units_deprecated_decode_inner( &self->request_units_deprecated, alloc_mem, ctx );
6772 2 : break;
6773 0 : }
6774 249 : case 1: {
6775 249 : fd_bincode_uint32_decode_unsafe( &self->request_heap_frame, ctx );
6776 249 : break;
6777 0 : }
6778 115 : case 2: {
6779 115 : fd_bincode_uint32_decode_unsafe( &self->set_compute_unit_limit, ctx );
6780 115 : break;
6781 0 : }
6782 120 : case 3: {
6783 120 : fd_bincode_uint64_decode_unsafe( &self->set_compute_unit_price, ctx );
6784 120 : break;
6785 0 : }
6786 113 : case 4: {
6787 113 : fd_bincode_uint32_decode_unsafe( &self->set_loaded_accounts_data_size_limit, ctx );
6788 113 : break;
6789 0 : }
6790 599 : }
6791 599 : }
6792 599 : static void fd_compute_budget_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6793 599 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)struct_mem;
6794 599 : ushort tmp = 0;
6795 599 : fd_bincode_compact_u16_decode_unsafe( &tmp, ctx );
6796 599 : self->discriminant = tmp;
6797 599 : fd_compute_budget_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
6798 599 : }
6799 599 : void * fd_compute_budget_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6800 599 : fd_compute_budget_program_instruction_t * self = (fd_compute_budget_program_instruction_t *)mem;
6801 599 : fd_compute_budget_program_instruction_new( self );
6802 599 : void * alloc_region = (uchar *)mem + sizeof(fd_compute_budget_program_instruction_t);
6803 599 : void * * alloc_mem = &alloc_region;
6804 599 : fd_compute_budget_program_instruction_decode_inner( mem, alloc_mem, ctx );
6805 599 : return self;
6806 599 : }
6807 599 : void fd_compute_budget_program_instruction_inner_new( fd_compute_budget_program_instruction_inner_t * self, uint discriminant ) {
6808 599 : switch( discriminant ) {
6809 0 : case 0: {
6810 0 : fd_compute_budget_program_instruction_request_units_deprecated_new( &self->request_units_deprecated );
6811 0 : break;
6812 0 : }
6813 0 : case 1: {
6814 0 : break;
6815 0 : }
6816 0 : case 2: {
6817 0 : break;
6818 0 : }
6819 0 : case 3: {
6820 0 : break;
6821 0 : }
6822 0 : case 4: {
6823 0 : break;
6824 0 : }
6825 599 : default: break; // FD_LOG_ERR(( "unhandled type"));
6826 599 : }
6827 599 : }
6828 599 : void fd_compute_budget_program_instruction_new_disc( fd_compute_budget_program_instruction_t * self, uint discriminant ) {
6829 599 : self->discriminant = discriminant;
6830 599 : fd_compute_budget_program_instruction_inner_new( &self->inner, self->discriminant );
6831 599 : }
6832 599 : void fd_compute_budget_program_instruction_new( fd_compute_budget_program_instruction_t * self ) {
6833 599 : fd_memset( self, 0, sizeof(fd_compute_budget_program_instruction_t) );
6834 599 : fd_compute_budget_program_instruction_new_disc( self, UINT_MAX );
6835 599 : }
6836 :
6837 0 : ulong fd_compute_budget_program_instruction_size( fd_compute_budget_program_instruction_t const * self ) {
6838 0 : ulong size = 0;
6839 0 : size += sizeof(uint);
6840 0 : switch (self->discriminant) {
6841 0 : case 0: {
6842 0 : size += fd_compute_budget_program_instruction_request_units_deprecated_size( &self->inner.request_units_deprecated );
6843 0 : break;
6844 0 : }
6845 0 : case 1: {
6846 0 : size += sizeof(uint);
6847 0 : break;
6848 0 : }
6849 0 : case 2: {
6850 0 : size += sizeof(uint);
6851 0 : break;
6852 0 : }
6853 0 : case 3: {
6854 0 : size += sizeof(ulong);
6855 0 : break;
6856 0 : }
6857 0 : case 4: {
6858 0 : size += sizeof(uint);
6859 0 : break;
6860 0 : }
6861 0 : }
6862 0 : return size;
6863 0 : }
6864 :
6865 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 ) {
6866 0 : int err;
6867 0 : switch (discriminant) {
6868 0 : case 0: {
6869 0 : err = fd_compute_budget_program_instruction_request_units_deprecated_encode( &self->request_units_deprecated, ctx );
6870 0 : if( FD_UNLIKELY( err ) ) return err;
6871 0 : break;
6872 0 : }
6873 0 : case 1: {
6874 0 : err = fd_bincode_uint32_encode( self->request_heap_frame, ctx );
6875 0 : if( FD_UNLIKELY( err ) ) return err;
6876 0 : break;
6877 0 : }
6878 0 : case 2: {
6879 0 : err = fd_bincode_uint32_encode( self->set_compute_unit_limit, ctx );
6880 0 : if( FD_UNLIKELY( err ) ) return err;
6881 0 : break;
6882 0 : }
6883 0 : case 3: {
6884 0 : err = fd_bincode_uint64_encode( self->set_compute_unit_price, ctx );
6885 0 : if( FD_UNLIKELY( err ) ) return err;
6886 0 : break;
6887 0 : }
6888 0 : case 4: {
6889 0 : err = fd_bincode_uint32_encode( self->set_loaded_accounts_data_size_limit, ctx );
6890 0 : if( FD_UNLIKELY( err ) ) return err;
6891 0 : break;
6892 0 : }
6893 0 : }
6894 0 : return FD_BINCODE_SUCCESS;
6895 0 : }
6896 0 : int fd_compute_budget_program_instruction_encode( fd_compute_budget_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6897 0 : ushort discriminant = (ushort) self->discriminant;
6898 0 : int err = fd_bincode_compact_u16_encode( &discriminant, ctx );
6899 0 : if( FD_UNLIKELY( err ) ) return err;
6900 0 : return fd_compute_budget_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
6901 0 : }
6902 :
6903 0 : int fd_bpf_loader_program_instruction_write_encode( fd_bpf_loader_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
6904 0 : int err;
6905 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
6906 0 : if( FD_UNLIKELY( err ) ) return err;
6907 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
6908 0 : if( FD_UNLIKELY(err) ) return err;
6909 0 : if( self->bytes_len ) {
6910 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
6911 0 : if( FD_UNLIKELY( err ) ) return err;
6912 0 : }
6913 0 : return FD_BINCODE_SUCCESS;
6914 0 : }
6915 0 : static int fd_bpf_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6916 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6917 0 : int err = 0;
6918 0 : err = fd_bincode_uint32_decode_footprint( ctx );
6919 0 : if( FD_UNLIKELY( err ) ) return err;
6920 0 : ulong bytes_len;
6921 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
6922 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6923 0 : if( bytes_len ) {
6924 0 : *total_sz += 8UL + bytes_len;
6925 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
6926 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
6927 0 : }
6928 0 : return 0;
6929 0 : }
6930 0 : int fd_bpf_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6931 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_write_t);
6932 0 : void const * start_data = ctx->data;
6933 0 : int err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
6934 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6935 0 : ctx->data = start_data;
6936 0 : return err;
6937 0 : }
6938 0 : static void fd_bpf_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
6939 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)struct_mem;
6940 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
6941 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
6942 0 : if( self->bytes_len ) {
6943 0 : self->bytes = *alloc_mem;
6944 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
6945 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
6946 0 : } else
6947 0 : self->bytes = NULL;
6948 0 : }
6949 0 : void * fd_bpf_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
6950 0 : fd_bpf_loader_program_instruction_write_t * self = (fd_bpf_loader_program_instruction_write_t *)mem;
6951 0 : fd_bpf_loader_program_instruction_write_new( self );
6952 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_write_t);
6953 0 : void * * alloc_mem = &alloc_region;
6954 0 : fd_bpf_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
6955 0 : return self;
6956 0 : }
6957 0 : void fd_bpf_loader_program_instruction_write_new(fd_bpf_loader_program_instruction_write_t * self) {
6958 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_write_t) );
6959 0 : }
6960 0 : ulong fd_bpf_loader_program_instruction_write_size( fd_bpf_loader_program_instruction_write_t const * self ) {
6961 0 : ulong size = 0;
6962 0 : size += sizeof(uint);
6963 0 : do {
6964 0 : size += sizeof(ulong);
6965 0 : size += self->bytes_len;
6966 0 : } while(0);
6967 0 : return size;
6968 0 : }
6969 :
6970 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_write(fd_bpf_loader_program_instruction_t const * self) {
6971 0 : return self->discriminant == 0;
6972 0 : }
6973 0 : FD_FN_PURE uchar fd_bpf_loader_program_instruction_is_finalize(fd_bpf_loader_program_instruction_t const * self) {
6974 0 : return self->discriminant == 1;
6975 0 : }
6976 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant );
6977 0 : int fd_bpf_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6978 0 : int err;
6979 0 : switch (discriminant) {
6980 0 : case 0: {
6981 0 : err = fd_bpf_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
6982 0 : if( FD_UNLIKELY( err ) ) return err;
6983 0 : return FD_BINCODE_SUCCESS;
6984 0 : }
6985 0 : case 1: {
6986 0 : return FD_BINCODE_SUCCESS;
6987 0 : }
6988 0 : default: return FD_BINCODE_ERR_ENCODING;
6989 0 : }
6990 0 : }
6991 0 : static int fd_bpf_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6992 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
6993 0 : uint discriminant = 0;
6994 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
6995 0 : if( FD_UNLIKELY( err ) ) return err;
6996 0 : return fd_bpf_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
6997 0 : }
6998 0 : int fd_bpf_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
6999 0 : *total_sz += sizeof(fd_bpf_loader_program_instruction_t);
7000 0 : void const * start_data = ctx->data;
7001 0 : int err = fd_bpf_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
7002 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7003 0 : ctx->data = start_data;
7004 0 : return err;
7005 0 : }
7006 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 ) {
7007 0 : switch (discriminant) {
7008 0 : case 0: {
7009 0 : fd_bpf_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
7010 0 : break;
7011 0 : }
7012 0 : case 1: {
7013 0 : break;
7014 0 : }
7015 0 : }
7016 0 : }
7017 0 : static void fd_bpf_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7018 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)struct_mem;
7019 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7020 0 : fd_bpf_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7021 0 : }
7022 0 : void * fd_bpf_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7023 0 : fd_bpf_loader_program_instruction_t * self = (fd_bpf_loader_program_instruction_t *)mem;
7024 0 : fd_bpf_loader_program_instruction_new( self );
7025 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_loader_program_instruction_t);
7026 0 : void * * alloc_mem = &alloc_region;
7027 0 : fd_bpf_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
7028 0 : return self;
7029 0 : }
7030 0 : void fd_bpf_loader_program_instruction_inner_new( fd_bpf_loader_program_instruction_inner_t * self, uint discriminant ) {
7031 0 : switch( discriminant ) {
7032 0 : case 0: {
7033 0 : fd_bpf_loader_program_instruction_write_new( &self->write );
7034 0 : break;
7035 0 : }
7036 0 : case 1: {
7037 0 : break;
7038 0 : }
7039 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
7040 0 : }
7041 0 : }
7042 0 : void fd_bpf_loader_program_instruction_new_disc( fd_bpf_loader_program_instruction_t * self, uint discriminant ) {
7043 0 : self->discriminant = discriminant;
7044 0 : fd_bpf_loader_program_instruction_inner_new( &self->inner, self->discriminant );
7045 0 : }
7046 0 : void fd_bpf_loader_program_instruction_new( fd_bpf_loader_program_instruction_t * self ) {
7047 0 : fd_memset( self, 0, sizeof(fd_bpf_loader_program_instruction_t) );
7048 0 : fd_bpf_loader_program_instruction_new_disc( self, UINT_MAX );
7049 0 : }
7050 :
7051 0 : ulong fd_bpf_loader_program_instruction_size( fd_bpf_loader_program_instruction_t const * self ) {
7052 0 : ulong size = 0;
7053 0 : size += sizeof(uint);
7054 0 : switch (self->discriminant) {
7055 0 : case 0: {
7056 0 : size += fd_bpf_loader_program_instruction_write_size( &self->inner.write );
7057 0 : break;
7058 0 : }
7059 0 : }
7060 0 : return size;
7061 0 : }
7062 :
7063 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 ) {
7064 0 : int err;
7065 0 : switch (discriminant) {
7066 0 : case 0: {
7067 0 : err = fd_bpf_loader_program_instruction_write_encode( &self->write, ctx );
7068 0 : if( FD_UNLIKELY( err ) ) return err;
7069 0 : break;
7070 0 : }
7071 0 : }
7072 0 : return FD_BINCODE_SUCCESS;
7073 0 : }
7074 0 : int fd_bpf_loader_program_instruction_encode( fd_bpf_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7075 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7076 0 : if( FD_UNLIKELY( err ) ) return err;
7077 0 : return fd_bpf_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7078 0 : }
7079 :
7080 0 : int fd_loader_v4_program_instruction_write_encode( fd_loader_v4_program_instruction_write_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7081 0 : int err;
7082 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
7083 0 : if( FD_UNLIKELY( err ) ) return err;
7084 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
7085 0 : if( FD_UNLIKELY(err) ) return err;
7086 0 : if( self->bytes_len ) {
7087 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
7088 0 : if( FD_UNLIKELY( err ) ) return err;
7089 0 : }
7090 0 : return FD_BINCODE_SUCCESS;
7091 0 : }
7092 0 : static int fd_loader_v4_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7093 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7094 0 : int err = 0;
7095 0 : err = fd_bincode_uint32_decode_footprint( ctx );
7096 0 : if( FD_UNLIKELY( err ) ) return err;
7097 0 : ulong bytes_len;
7098 0 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
7099 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7100 0 : if( bytes_len ) {
7101 0 : *total_sz += 8UL + bytes_len;
7102 0 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
7103 0 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7104 0 : }
7105 0 : return 0;
7106 0 : }
7107 0 : int fd_loader_v4_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7108 0 : *total_sz += sizeof(fd_loader_v4_program_instruction_write_t);
7109 0 : void const * start_data = ctx->data;
7110 0 : int err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
7111 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7112 0 : ctx->data = start_data;
7113 0 : return err;
7114 0 : }
7115 0 : static void fd_loader_v4_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7116 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)struct_mem;
7117 0 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
7118 0 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
7119 0 : if( self->bytes_len ) {
7120 0 : self->bytes = *alloc_mem;
7121 0 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
7122 0 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
7123 0 : } else
7124 0 : self->bytes = NULL;
7125 0 : }
7126 0 : void * fd_loader_v4_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7127 0 : fd_loader_v4_program_instruction_write_t * self = (fd_loader_v4_program_instruction_write_t *)mem;
7128 0 : fd_loader_v4_program_instruction_write_new( self );
7129 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_write_t);
7130 0 : void * * alloc_mem = &alloc_region;
7131 0 : fd_loader_v4_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
7132 0 : return self;
7133 0 : }
7134 0 : void fd_loader_v4_program_instruction_write_new(fd_loader_v4_program_instruction_write_t * self) {
7135 0 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_write_t) );
7136 0 : }
7137 0 : ulong fd_loader_v4_program_instruction_write_size( fd_loader_v4_program_instruction_write_t const * self ) {
7138 0 : ulong size = 0;
7139 0 : size += sizeof(uint);
7140 0 : do {
7141 0 : size += sizeof(ulong);
7142 0 : size += self->bytes_len;
7143 0 : } while(0);
7144 0 : return size;
7145 0 : }
7146 :
7147 0 : int fd_loader_v4_program_instruction_copy_encode( fd_loader_v4_program_instruction_copy_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7148 0 : int err;
7149 0 : err = fd_bincode_uint32_encode( self->destination_offset, ctx );
7150 0 : if( FD_UNLIKELY( err ) ) return err;
7151 0 : err = fd_bincode_uint32_encode( self->source_offset, ctx );
7152 0 : if( FD_UNLIKELY( err ) ) return err;
7153 0 : err = fd_bincode_uint32_encode( self->length, ctx );
7154 0 : if( FD_UNLIKELY( err ) ) return err;
7155 0 : return FD_BINCODE_SUCCESS;
7156 0 : }
7157 2 : static inline int fd_loader_v4_program_instruction_copy_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7158 2 : if( (ulong)ctx->data + 12UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7159 2 : ctx->data = (void *)( (ulong)ctx->data + 12UL );
7160 2 : return 0;
7161 2 : }
7162 2 : static void fd_loader_v4_program_instruction_copy_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7163 2 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)struct_mem;
7164 2 : fd_bincode_uint32_decode_unsafe( &self->destination_offset, ctx );
7165 2 : fd_bincode_uint32_decode_unsafe( &self->source_offset, ctx );
7166 2 : fd_bincode_uint32_decode_unsafe( &self->length, ctx );
7167 2 : }
7168 0 : void * fd_loader_v4_program_instruction_copy_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7169 0 : fd_loader_v4_program_instruction_copy_t * self = (fd_loader_v4_program_instruction_copy_t *)mem;
7170 0 : fd_loader_v4_program_instruction_copy_new( self );
7171 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_copy_t);
7172 0 : void * * alloc_mem = &alloc_region;
7173 0 : fd_loader_v4_program_instruction_copy_decode_inner( mem, alloc_mem, ctx );
7174 0 : return self;
7175 0 : }
7176 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 ) {
7177 0 : int err;
7178 0 : err = fd_bincode_uint32_encode( self->new_size, ctx );
7179 0 : if( FD_UNLIKELY( err ) ) return err;
7180 0 : return FD_BINCODE_SUCCESS;
7181 0 : }
7182 11 : static inline int fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7183 11 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7184 11 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
7185 11 : return 0;
7186 11 : }
7187 11 : static void fd_loader_v4_program_instruction_set_program_length_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7188 11 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)struct_mem;
7189 11 : fd_bincode_uint32_decode_unsafe( &self->new_size, ctx );
7190 11 : }
7191 0 : void * fd_loader_v4_program_instruction_set_program_length_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7192 0 : fd_loader_v4_program_instruction_set_program_length_t * self = (fd_loader_v4_program_instruction_set_program_length_t *)mem;
7193 0 : fd_loader_v4_program_instruction_set_program_length_new( self );
7194 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_set_program_length_t);
7195 0 : void * * alloc_mem = &alloc_region;
7196 0 : fd_loader_v4_program_instruction_set_program_length_decode_inner( mem, alloc_mem, ctx );
7197 0 : return self;
7198 0 : }
7199 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_write(fd_loader_v4_program_instruction_t const * self) {
7200 0 : return self->discriminant == 0;
7201 0 : }
7202 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_copy(fd_loader_v4_program_instruction_t const * self) {
7203 0 : return self->discriminant == 1;
7204 0 : }
7205 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_set_program_length(fd_loader_v4_program_instruction_t const * self) {
7206 0 : return self->discriminant == 2;
7207 0 : }
7208 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_deploy(fd_loader_v4_program_instruction_t const * self) {
7209 0 : return self->discriminant == 3;
7210 0 : }
7211 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_retract(fd_loader_v4_program_instruction_t const * self) {
7212 0 : return self->discriminant == 4;
7213 0 : }
7214 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_transfer_authority(fd_loader_v4_program_instruction_t const * self) {
7215 0 : return self->discriminant == 5;
7216 0 : }
7217 0 : FD_FN_PURE uchar fd_loader_v4_program_instruction_is_finalize(fd_loader_v4_program_instruction_t const * self) {
7218 0 : return self->discriminant == 6;
7219 0 : }
7220 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant );
7221 16 : int fd_loader_v4_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7222 16 : int err;
7223 16 : switch (discriminant) {
7224 0 : case 0: {
7225 0 : err = fd_loader_v4_program_instruction_write_decode_footprint_inner( ctx, total_sz );
7226 0 : if( FD_UNLIKELY( err ) ) return err;
7227 0 : return FD_BINCODE_SUCCESS;
7228 0 : }
7229 2 : case 1: {
7230 2 : err = fd_loader_v4_program_instruction_copy_decode_footprint_inner( ctx, total_sz );
7231 2 : if( FD_UNLIKELY( err ) ) return err;
7232 2 : return FD_BINCODE_SUCCESS;
7233 2 : }
7234 11 : case 2: {
7235 11 : err = fd_loader_v4_program_instruction_set_program_length_decode_footprint_inner( ctx, total_sz );
7236 11 : if( FD_UNLIKELY( err ) ) return err;
7237 11 : return FD_BINCODE_SUCCESS;
7238 11 : }
7239 1 : case 3: {
7240 1 : return FD_BINCODE_SUCCESS;
7241 11 : }
7242 0 : case 4: {
7243 0 : return FD_BINCODE_SUCCESS;
7244 11 : }
7245 0 : case 5: {
7246 0 : return FD_BINCODE_SUCCESS;
7247 11 : }
7248 2 : case 6: {
7249 2 : return FD_BINCODE_SUCCESS;
7250 11 : }
7251 0 : default: return FD_BINCODE_ERR_ENCODING;
7252 16 : }
7253 16 : }
7254 16 : static int fd_loader_v4_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7255 16 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7256 16 : uint discriminant = 0;
7257 16 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7258 16 : if( FD_UNLIKELY( err ) ) return err;
7259 16 : return fd_loader_v4_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
7260 16 : }
7261 16 : int fd_loader_v4_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7262 16 : *total_sz += sizeof(fd_loader_v4_program_instruction_t);
7263 16 : void const * start_data = ctx->data;
7264 16 : int err = fd_loader_v4_program_instruction_decode_footprint_inner( ctx, total_sz );
7265 16 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7266 16 : ctx->data = start_data;
7267 16 : return err;
7268 16 : }
7269 16 : 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 ) {
7270 16 : switch (discriminant) {
7271 0 : case 0: {
7272 0 : fd_loader_v4_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
7273 0 : break;
7274 0 : }
7275 2 : case 1: {
7276 2 : fd_loader_v4_program_instruction_copy_decode_inner( &self->copy, alloc_mem, ctx );
7277 2 : break;
7278 0 : }
7279 11 : case 2: {
7280 11 : fd_loader_v4_program_instruction_set_program_length_decode_inner( &self->set_program_length, alloc_mem, ctx );
7281 11 : break;
7282 0 : }
7283 1 : case 3: {
7284 1 : break;
7285 0 : }
7286 0 : case 4: {
7287 0 : break;
7288 0 : }
7289 0 : case 5: {
7290 0 : break;
7291 0 : }
7292 2 : case 6: {
7293 2 : break;
7294 0 : }
7295 16 : }
7296 16 : }
7297 16 : static void fd_loader_v4_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7298 16 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)struct_mem;
7299 16 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7300 16 : fd_loader_v4_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7301 16 : }
7302 16 : void * fd_loader_v4_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7303 16 : fd_loader_v4_program_instruction_t * self = (fd_loader_v4_program_instruction_t *)mem;
7304 16 : fd_loader_v4_program_instruction_new( self );
7305 16 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_program_instruction_t);
7306 16 : void * * alloc_mem = &alloc_region;
7307 16 : fd_loader_v4_program_instruction_decode_inner( mem, alloc_mem, ctx );
7308 16 : return self;
7309 16 : }
7310 16 : void fd_loader_v4_program_instruction_inner_new( fd_loader_v4_program_instruction_inner_t * self, uint discriminant ) {
7311 16 : switch( discriminant ) {
7312 0 : case 0: {
7313 0 : fd_loader_v4_program_instruction_write_new( &self->write );
7314 0 : break;
7315 0 : }
7316 0 : case 1: {
7317 0 : fd_loader_v4_program_instruction_copy_new( &self->copy );
7318 0 : break;
7319 0 : }
7320 0 : case 2: {
7321 0 : fd_loader_v4_program_instruction_set_program_length_new( &self->set_program_length );
7322 0 : break;
7323 0 : }
7324 0 : case 3: {
7325 0 : break;
7326 0 : }
7327 0 : case 4: {
7328 0 : break;
7329 0 : }
7330 0 : case 5: {
7331 0 : break;
7332 0 : }
7333 0 : case 6: {
7334 0 : break;
7335 0 : }
7336 16 : default: break; // FD_LOG_ERR(( "unhandled type"));
7337 16 : }
7338 16 : }
7339 16 : void fd_loader_v4_program_instruction_new_disc( fd_loader_v4_program_instruction_t * self, uint discriminant ) {
7340 16 : self->discriminant = discriminant;
7341 16 : fd_loader_v4_program_instruction_inner_new( &self->inner, self->discriminant );
7342 16 : }
7343 16 : void fd_loader_v4_program_instruction_new( fd_loader_v4_program_instruction_t * self ) {
7344 16 : fd_memset( self, 0, sizeof(fd_loader_v4_program_instruction_t) );
7345 16 : fd_loader_v4_program_instruction_new_disc( self, UINT_MAX );
7346 16 : }
7347 :
7348 0 : ulong fd_loader_v4_program_instruction_size( fd_loader_v4_program_instruction_t const * self ) {
7349 0 : ulong size = 0;
7350 0 : size += sizeof(uint);
7351 0 : switch (self->discriminant) {
7352 0 : case 0: {
7353 0 : size += fd_loader_v4_program_instruction_write_size( &self->inner.write );
7354 0 : break;
7355 0 : }
7356 0 : case 1: {
7357 0 : size += fd_loader_v4_program_instruction_copy_size( &self->inner.copy );
7358 0 : break;
7359 0 : }
7360 0 : case 2: {
7361 0 : size += fd_loader_v4_program_instruction_set_program_length_size( &self->inner.set_program_length );
7362 0 : break;
7363 0 : }
7364 0 : }
7365 0 : return size;
7366 0 : }
7367 :
7368 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 ) {
7369 0 : int err;
7370 0 : switch (discriminant) {
7371 0 : case 0: {
7372 0 : err = fd_loader_v4_program_instruction_write_encode( &self->write, ctx );
7373 0 : if( FD_UNLIKELY( err ) ) return err;
7374 0 : break;
7375 0 : }
7376 0 : case 1: {
7377 0 : err = fd_loader_v4_program_instruction_copy_encode( &self->copy, ctx );
7378 0 : if( FD_UNLIKELY( err ) ) return err;
7379 0 : break;
7380 0 : }
7381 0 : case 2: {
7382 0 : err = fd_loader_v4_program_instruction_set_program_length_encode( &self->set_program_length, ctx );
7383 0 : if( FD_UNLIKELY( err ) ) return err;
7384 0 : break;
7385 0 : }
7386 0 : }
7387 0 : return FD_BINCODE_SUCCESS;
7388 0 : }
7389 0 : int fd_loader_v4_program_instruction_encode( fd_loader_v4_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7390 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7391 0 : if( FD_UNLIKELY( err ) ) return err;
7392 0 : return fd_loader_v4_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7393 0 : }
7394 :
7395 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 ) {
7396 0 : int err;
7397 0 : err = fd_bincode_uint32_encode( self->offset, ctx );
7398 0 : if( FD_UNLIKELY( err ) ) return err;
7399 0 : err = fd_bincode_uint64_encode( self->bytes_len, ctx );
7400 0 : if( FD_UNLIKELY(err) ) return err;
7401 0 : if( self->bytes_len ) {
7402 0 : err = fd_bincode_bytes_encode( self->bytes, self->bytes_len, ctx );
7403 0 : if( FD_UNLIKELY( err ) ) return err;
7404 0 : }
7405 0 : return FD_BINCODE_SUCCESS;
7406 0 : }
7407 18 : static int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7408 18 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7409 18 : int err = 0;
7410 18 : err = fd_bincode_uint32_decode_footprint( ctx );
7411 18 : if( FD_UNLIKELY( err ) ) return err;
7412 18 : ulong bytes_len;
7413 18 : err = fd_bincode_uint64_decode( &bytes_len, ctx );
7414 18 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7415 18 : if( bytes_len ) {
7416 16 : *total_sz += 8UL + bytes_len;
7417 16 : err = fd_bincode_bytes_decode_footprint( bytes_len, ctx );
7418 16 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7419 16 : }
7420 17 : return 0;
7421 18 : }
7422 0 : int fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7423 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
7424 0 : void const * start_data = ctx->data;
7425 0 : int err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
7426 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7427 0 : ctx->data = start_data;
7428 0 : return err;
7429 0 : }
7430 17 : static void fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7431 17 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)struct_mem;
7432 17 : fd_bincode_uint32_decode_unsafe( &self->offset, ctx );
7433 17 : fd_bincode_uint64_decode_unsafe( &self->bytes_len, ctx );
7434 17 : if( self->bytes_len ) {
7435 15 : self->bytes = *alloc_mem;
7436 15 : fd_bincode_bytes_decode_unsafe( self->bytes, self->bytes_len, ctx );
7437 15 : *alloc_mem = (uchar *)(*alloc_mem) + self->bytes_len;
7438 15 : } else
7439 2 : self->bytes = NULL;
7440 17 : }
7441 0 : void * fd_bpf_upgradeable_loader_program_instruction_write_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7442 0 : fd_bpf_upgradeable_loader_program_instruction_write_t * self = (fd_bpf_upgradeable_loader_program_instruction_write_t *)mem;
7443 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( self );
7444 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t);
7445 0 : void * * alloc_mem = &alloc_region;
7446 0 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( mem, alloc_mem, ctx );
7447 0 : return self;
7448 0 : }
7449 0 : void fd_bpf_upgradeable_loader_program_instruction_write_new(fd_bpf_upgradeable_loader_program_instruction_write_t * self) {
7450 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_write_t) );
7451 0 : }
7452 0 : ulong fd_bpf_upgradeable_loader_program_instruction_write_size( fd_bpf_upgradeable_loader_program_instruction_write_t const * self ) {
7453 0 : ulong size = 0;
7454 0 : size += sizeof(uint);
7455 0 : do {
7456 0 : size += sizeof(ulong);
7457 0 : size += self->bytes_len;
7458 0 : } while(0);
7459 0 : return size;
7460 0 : }
7461 :
7462 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 ) {
7463 0 : int err;
7464 0 : err = fd_bincode_uint64_encode( self->max_data_len, ctx );
7465 0 : if( FD_UNLIKELY( err ) ) return err;
7466 0 : return FD_BINCODE_SUCCESS;
7467 0 : }
7468 80 : 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 ) {
7469 80 : if( (ulong)ctx->data + 8UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7470 80 : ctx->data = (void *)( (ulong)ctx->data + 8UL );
7471 80 : return 0;
7472 80 : }
7473 80 : 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 ) {
7474 80 : 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;
7475 80 : fd_bincode_uint64_decode_unsafe( &self->max_data_len, ctx );
7476 80 : }
7477 0 : void * fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7478 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;
7479 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( self );
7480 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_t);
7481 0 : void * * alloc_mem = &alloc_region;
7482 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( mem, alloc_mem, ctx );
7483 0 : return self;
7484 0 : }
7485 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 ) {
7486 0 : int err;
7487 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
7488 0 : if( FD_UNLIKELY( err ) ) return err;
7489 0 : return FD_BINCODE_SUCCESS;
7490 0 : }
7491 94 : static inline int fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7492 94 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7493 94 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
7494 94 : return 0;
7495 94 : }
7496 94 : static void fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7497 94 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)struct_mem;
7498 94 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
7499 94 : }
7500 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7501 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_t *)mem;
7502 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( self );
7503 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_t);
7504 0 : void * * alloc_mem = &alloc_region;
7505 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( mem, alloc_mem, ctx );
7506 0 : return self;
7507 0 : }
7508 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 ) {
7509 0 : int err;
7510 0 : err = fd_bincode_uint32_encode( self->additional_bytes, ctx );
7511 0 : if( FD_UNLIKELY( err ) ) return err;
7512 0 : return FD_BINCODE_SUCCESS;
7513 0 : }
7514 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 ) {
7515 0 : if( (ulong)ctx->data + 4UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7516 0 : ctx->data = (void *)( (ulong)ctx->data + 4UL );
7517 0 : return 0;
7518 0 : }
7519 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 ) {
7520 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)struct_mem;
7521 0 : fd_bincode_uint32_decode_unsafe( &self->additional_bytes, ctx );
7522 0 : }
7523 0 : void * fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7524 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t * self = (fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t *)mem;
7525 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( self );
7526 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_t);
7527 0 : void * * alloc_mem = &alloc_region;
7528 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( mem, alloc_mem, ctx );
7529 0 : return self;
7530 0 : }
7531 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_initialize_buffer(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
7532 0 : return self->discriminant == 0;
7533 0 : }
7534 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_write(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
7535 0 : return self->discriminant == 1;
7536 0 : }
7537 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) {
7538 0 : return self->discriminant == 2;
7539 0 : }
7540 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_upgrade(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
7541 0 : return self->discriminant == 3;
7542 0 : }
7543 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
7544 0 : return self->discriminant == 4;
7545 0 : }
7546 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_close(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
7547 0 : return self->discriminant == 5;
7548 0 : }
7549 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
7550 0 : return self->discriminant == 6;
7551 0 : }
7552 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_set_authority_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
7553 0 : return self->discriminant == 7;
7554 0 : }
7555 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_migrate(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
7556 0 : return self->discriminant == 8;
7557 0 : }
7558 0 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_program_instruction_is_extend_program_checked(fd_bpf_upgradeable_loader_program_instruction_t const * self) {
7559 0 : return self->discriminant == 9;
7560 0 : }
7561 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant );
7562 761 : int fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7563 761 : int err;
7564 761 : switch (discriminant) {
7565 12 : case 0: {
7566 12 : return FD_BINCODE_SUCCESS;
7567 0 : }
7568 18 : case 1: {
7569 18 : err = fd_bpf_upgradeable_loader_program_instruction_write_decode_footprint_inner( ctx, total_sz );
7570 18 : if( FD_UNLIKELY( err ) ) return err;
7571 17 : return FD_BINCODE_SUCCESS;
7572 18 : }
7573 80 : case 2: {
7574 80 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_footprint_inner( ctx, total_sz );
7575 80 : if( FD_UNLIKELY( err ) ) return err;
7576 80 : return FD_BINCODE_SUCCESS;
7577 80 : }
7578 217 : case 3: {
7579 217 : return FD_BINCODE_SUCCESS;
7580 80 : }
7581 6 : case 4: {
7582 6 : return FD_BINCODE_SUCCESS;
7583 80 : }
7584 17 : case 5: {
7585 17 : return FD_BINCODE_SUCCESS;
7586 80 : }
7587 94 : case 6: {
7588 94 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_footprint_inner( ctx, total_sz );
7589 94 : if( FD_UNLIKELY( err ) ) return err;
7590 94 : return FD_BINCODE_SUCCESS;
7591 94 : }
7592 14 : case 7: {
7593 14 : return FD_BINCODE_SUCCESS;
7594 94 : }
7595 305 : case 8: {
7596 305 : return FD_BINCODE_SUCCESS;
7597 94 : }
7598 0 : case 9: {
7599 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_footprint_inner( ctx, total_sz );
7600 0 : if( FD_UNLIKELY( err ) ) return err;
7601 0 : return FD_BINCODE_SUCCESS;
7602 0 : }
7603 0 : default: return FD_BINCODE_ERR_ENCODING;
7604 761 : }
7605 761 : }
7606 761 : static int fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7607 761 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7608 759 : uint discriminant = 0;
7609 759 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7610 759 : if( FD_UNLIKELY( err ) ) return err;
7611 759 : return fd_bpf_upgradeable_loader_program_instruction_inner_decode_footprint( discriminant, ctx, total_sz );
7612 759 : }
7613 765 : int fd_bpf_upgradeable_loader_program_instruction_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7614 765 : *total_sz += sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
7615 765 : void const * start_data = ctx->data;
7616 765 : int err = fd_bpf_upgradeable_loader_program_instruction_decode_footprint_inner( ctx, total_sz );
7617 765 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7618 765 : ctx->data = start_data;
7619 765 : return err;
7620 765 : }
7621 760 : 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 ) {
7622 760 : switch (discriminant) {
7623 12 : case 0: {
7624 12 : break;
7625 0 : }
7626 17 : case 1: {
7627 17 : fd_bpf_upgradeable_loader_program_instruction_write_decode_inner( &self->write, alloc_mem, ctx );
7628 17 : break;
7629 0 : }
7630 80 : case 2: {
7631 80 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_decode_inner( &self->deploy_with_max_data_len, alloc_mem, ctx );
7632 80 : break;
7633 0 : }
7634 217 : case 3: {
7635 217 : break;
7636 0 : }
7637 6 : case 4: {
7638 6 : break;
7639 0 : }
7640 17 : case 5: {
7641 17 : break;
7642 0 : }
7643 94 : case 6: {
7644 94 : fd_bpf_upgradeable_loader_program_instruction_extend_program_decode_inner( &self->extend_program, alloc_mem, ctx );
7645 94 : break;
7646 0 : }
7647 14 : case 7: {
7648 14 : break;
7649 0 : }
7650 305 : case 8: {
7651 305 : break;
7652 0 : }
7653 0 : case 9: {
7654 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_decode_inner( &self->extend_program_checked, alloc_mem, ctx );
7655 0 : break;
7656 0 : }
7657 760 : }
7658 760 : }
7659 761 : static void fd_bpf_upgradeable_loader_program_instruction_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7660 761 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)struct_mem;
7661 761 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
7662 761 : fd_bpf_upgradeable_loader_program_instruction_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
7663 761 : }
7664 762 : void * fd_bpf_upgradeable_loader_program_instruction_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7665 762 : fd_bpf_upgradeable_loader_program_instruction_t * self = (fd_bpf_upgradeable_loader_program_instruction_t *)mem;
7666 762 : fd_bpf_upgradeable_loader_program_instruction_new( self );
7667 762 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_program_instruction_t);
7668 762 : void * * alloc_mem = &alloc_region;
7669 762 : fd_bpf_upgradeable_loader_program_instruction_decode_inner( mem, alloc_mem, ctx );
7670 762 : return self;
7671 762 : }
7672 761 : void fd_bpf_upgradeable_loader_program_instruction_inner_new( fd_bpf_upgradeable_loader_program_instruction_inner_t * self, uint discriminant ) {
7673 761 : switch( discriminant ) {
7674 0 : case 0: {
7675 0 : break;
7676 0 : }
7677 0 : case 1: {
7678 0 : fd_bpf_upgradeable_loader_program_instruction_write_new( &self->write );
7679 0 : break;
7680 0 : }
7681 0 : case 2: {
7682 0 : fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_new( &self->deploy_with_max_data_len );
7683 0 : break;
7684 0 : }
7685 0 : case 3: {
7686 0 : break;
7687 0 : }
7688 0 : case 4: {
7689 0 : break;
7690 0 : }
7691 0 : case 5: {
7692 0 : break;
7693 0 : }
7694 0 : case 6: {
7695 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_new( &self->extend_program );
7696 0 : break;
7697 0 : }
7698 0 : case 7: {
7699 0 : break;
7700 0 : }
7701 0 : case 8: {
7702 0 : break;
7703 0 : }
7704 0 : case 9: {
7705 0 : fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_new( &self->extend_program_checked );
7706 0 : break;
7707 0 : }
7708 761 : default: break; // FD_LOG_ERR(( "unhandled type"));
7709 761 : }
7710 761 : }
7711 761 : void fd_bpf_upgradeable_loader_program_instruction_new_disc( fd_bpf_upgradeable_loader_program_instruction_t * self, uint discriminant ) {
7712 761 : self->discriminant = discriminant;
7713 761 : fd_bpf_upgradeable_loader_program_instruction_inner_new( &self->inner, self->discriminant );
7714 761 : }
7715 762 : void fd_bpf_upgradeable_loader_program_instruction_new( fd_bpf_upgradeable_loader_program_instruction_t * self ) {
7716 762 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_program_instruction_t) );
7717 762 : fd_bpf_upgradeable_loader_program_instruction_new_disc( self, UINT_MAX );
7718 762 : }
7719 :
7720 0 : ulong fd_bpf_upgradeable_loader_program_instruction_size( fd_bpf_upgradeable_loader_program_instruction_t const * self ) {
7721 0 : ulong size = 0;
7722 0 : size += sizeof(uint);
7723 0 : switch (self->discriminant) {
7724 0 : case 1: {
7725 0 : size += fd_bpf_upgradeable_loader_program_instruction_write_size( &self->inner.write );
7726 0 : break;
7727 0 : }
7728 0 : case 2: {
7729 0 : size += fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_size( &self->inner.deploy_with_max_data_len );
7730 0 : break;
7731 0 : }
7732 0 : case 6: {
7733 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_size( &self->inner.extend_program );
7734 0 : break;
7735 0 : }
7736 0 : case 9: {
7737 0 : size += fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_size( &self->inner.extend_program_checked );
7738 0 : break;
7739 0 : }
7740 0 : }
7741 0 : return size;
7742 0 : }
7743 :
7744 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 ) {
7745 0 : int err;
7746 0 : switch (discriminant) {
7747 0 : case 1: {
7748 0 : err = fd_bpf_upgradeable_loader_program_instruction_write_encode( &self->write, ctx );
7749 0 : if( FD_UNLIKELY( err ) ) return err;
7750 0 : break;
7751 0 : }
7752 0 : case 2: {
7753 0 : err = fd_bpf_upgradeable_loader_program_instruction_deploy_with_max_data_len_encode( &self->deploy_with_max_data_len, ctx );
7754 0 : if( FD_UNLIKELY( err ) ) return err;
7755 0 : break;
7756 0 : }
7757 0 : case 6: {
7758 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_encode( &self->extend_program, ctx );
7759 0 : if( FD_UNLIKELY( err ) ) return err;
7760 0 : break;
7761 0 : }
7762 0 : case 9: {
7763 0 : err = fd_bpf_upgradeable_loader_program_instruction_extend_program_checked_encode( &self->extend_program_checked, ctx );
7764 0 : if( FD_UNLIKELY( err ) ) return err;
7765 0 : break;
7766 0 : }
7767 0 : }
7768 0 : return FD_BINCODE_SUCCESS;
7769 0 : }
7770 0 : int fd_bpf_upgradeable_loader_program_instruction_encode( fd_bpf_upgradeable_loader_program_instruction_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7771 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
7772 0 : if( FD_UNLIKELY( err ) ) return err;
7773 0 : return fd_bpf_upgradeable_loader_program_instruction_inner_encode( &self->inner, self->discriminant, ctx );
7774 0 : }
7775 :
7776 12 : int fd_bpf_upgradeable_loader_state_buffer_encode( fd_bpf_upgradeable_loader_state_buffer_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7777 12 : int err;
7778 12 : err = fd_bincode_bool_encode( self->has_authority_address, ctx );
7779 12 : if( FD_UNLIKELY( err ) ) return err;
7780 12 : if( self->has_authority_address ) {
7781 12 : err = fd_pubkey_encode( &self->authority_address, ctx );
7782 12 : if( FD_UNLIKELY( err ) ) return err;
7783 12 : }
7784 12 : return FD_BINCODE_SUCCESS;
7785 12 : }
7786 2461 : static int fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7787 2461 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7788 2365 : int err = 0;
7789 2365 : {
7790 2365 : uchar o;
7791 2365 : err = fd_bincode_bool_decode( &o, ctx );
7792 2365 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7793 925 : if( o ) {
7794 428 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7795 428 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7796 428 : }
7797 925 : }
7798 765 : return 0;
7799 925 : }
7800 0 : int fd_bpf_upgradeable_loader_state_buffer_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7801 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
7802 0 : void const * start_data = ctx->data;
7803 0 : int err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
7804 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7805 0 : ctx->data = start_data;
7806 0 : return err;
7807 0 : }
7808 765 : static void fd_bpf_upgradeable_loader_state_buffer_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7809 765 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)struct_mem;
7810 765 : {
7811 765 : uchar o;
7812 765 : fd_bincode_bool_decode_unsafe( &o, ctx );
7813 765 : self->has_authority_address = !!o;
7814 765 : if( o ) {
7815 268 : fd_pubkey_new( &self->authority_address );
7816 268 : fd_pubkey_decode_inner( &self->authority_address, alloc_mem, ctx );
7817 268 : }
7818 765 : }
7819 765 : }
7820 0 : void * fd_bpf_upgradeable_loader_state_buffer_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7821 0 : fd_bpf_upgradeable_loader_state_buffer_t * self = (fd_bpf_upgradeable_loader_state_buffer_t *)mem;
7822 0 : fd_bpf_upgradeable_loader_state_buffer_new( self );
7823 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_buffer_t);
7824 0 : void * * alloc_mem = &alloc_region;
7825 0 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( mem, alloc_mem, ctx );
7826 0 : return self;
7827 0 : }
7828 0 : void fd_bpf_upgradeable_loader_state_buffer_new(fd_bpf_upgradeable_loader_state_buffer_t * self) {
7829 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_buffer_t) );
7830 0 : }
7831 12 : ulong fd_bpf_upgradeable_loader_state_buffer_size( fd_bpf_upgradeable_loader_state_buffer_t const * self ) {
7832 12 : ulong size = 0;
7833 12 : size += sizeof(char);
7834 12 : if( self->has_authority_address ) {
7835 12 : size += fd_pubkey_size( &self->authority_address );
7836 12 : }
7837 12 : return size;
7838 12 : }
7839 :
7840 0 : int fd_bpf_upgradeable_loader_state_program_encode( fd_bpf_upgradeable_loader_state_program_t const * self, fd_bincode_encode_ctx_t * ctx ) {
7841 0 : int err;
7842 0 : err = fd_pubkey_encode( &self->programdata_address, ctx );
7843 0 : if( FD_UNLIKELY( err ) ) return err;
7844 0 : return FD_BINCODE_SUCCESS;
7845 0 : }
7846 24005 : static inline int fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7847 24005 : if( (ulong)ctx->data + 32UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7848 22274 : ctx->data = (void *)( (ulong)ctx->data + 32UL );
7849 22274 : return 0;
7850 24005 : }
7851 22277 : static void fd_bpf_upgradeable_loader_state_program_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7852 22277 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)struct_mem;
7853 22277 : fd_pubkey_decode_inner( &self->programdata_address, alloc_mem, ctx );
7854 22277 : }
7855 0 : void * fd_bpf_upgradeable_loader_state_program_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7856 0 : fd_bpf_upgradeable_loader_state_program_t * self = (fd_bpf_upgradeable_loader_state_program_t *)mem;
7857 0 : fd_bpf_upgradeable_loader_state_program_new( self );
7858 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_t);
7859 0 : void * * alloc_mem = &alloc_region;
7860 0 : fd_bpf_upgradeable_loader_state_program_decode_inner( mem, alloc_mem, ctx );
7861 0 : return self;
7862 0 : }
7863 11 : 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 ) {
7864 11 : int err;
7865 11 : err = fd_bincode_uint64_encode( self->slot, ctx );
7866 11 : if( FD_UNLIKELY( err ) ) return err;
7867 11 : err = fd_bincode_bool_encode( self->has_upgrade_authority_address, ctx );
7868 11 : if( FD_UNLIKELY( err ) ) return err;
7869 11 : if( self->has_upgrade_authority_address ) {
7870 11 : err = fd_pubkey_encode( &self->upgrade_authority_address, ctx );
7871 11 : if( FD_UNLIKELY( err ) ) return err;
7872 11 : }
7873 11 : return FD_BINCODE_SUCCESS;
7874 11 : }
7875 17518 : static int fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7876 17518 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7877 17503 : int err = 0;
7878 17503 : err = fd_bincode_uint64_decode_footprint( ctx );
7879 17503 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7880 17415 : {
7881 17415 : uchar o;
7882 17415 : err = fd_bincode_bool_decode( &o, ctx );
7883 17415 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7884 17094 : if( o ) {
7885 1796 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
7886 1796 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
7887 1796 : }
7888 17094 : }
7889 16898 : return 0;
7890 17094 : }
7891 0 : int fd_bpf_upgradeable_loader_state_program_data_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7892 0 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
7893 0 : void const * start_data = ctx->data;
7894 0 : int err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
7895 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7896 0 : ctx->data = start_data;
7897 0 : return err;
7898 0 : }
7899 16880 : static void fd_bpf_upgradeable_loader_state_program_data_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
7900 16880 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)struct_mem;
7901 16880 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
7902 16880 : {
7903 16880 : uchar o;
7904 16880 : fd_bincode_bool_decode_unsafe( &o, ctx );
7905 16880 : self->has_upgrade_authority_address = !!o;
7906 16880 : if( o ) {
7907 1592 : fd_pubkey_new( &self->upgrade_authority_address );
7908 1592 : fd_pubkey_decode_inner( &self->upgrade_authority_address, alloc_mem, ctx );
7909 1592 : }
7910 16880 : }
7911 16880 : }
7912 0 : void * fd_bpf_upgradeable_loader_state_program_data_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
7913 0 : fd_bpf_upgradeable_loader_state_program_data_t * self = (fd_bpf_upgradeable_loader_state_program_data_t *)mem;
7914 0 : fd_bpf_upgradeable_loader_state_program_data_new( self );
7915 0 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_program_data_t);
7916 0 : void * * alloc_mem = &alloc_region;
7917 0 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( mem, alloc_mem, ctx );
7918 0 : return self;
7919 0 : }
7920 0 : void fd_bpf_upgradeable_loader_state_program_data_new(fd_bpf_upgradeable_loader_state_program_data_t * self) {
7921 0 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_program_data_t) );
7922 0 : }
7923 11 : ulong fd_bpf_upgradeable_loader_state_program_data_size( fd_bpf_upgradeable_loader_state_program_data_t const * self ) {
7924 11 : ulong size = 0;
7925 11 : size += sizeof(ulong);
7926 11 : size += sizeof(char);
7927 11 : if( self->has_upgrade_authority_address ) {
7928 11 : size += fd_pubkey_size( &self->upgrade_authority_address );
7929 11 : }
7930 11 : return size;
7931 11 : }
7932 :
7933 106 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_uninitialized(fd_bpf_upgradeable_loader_state_t const * self) {
7934 106 : return self->discriminant == 0;
7935 106 : }
7936 28 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_buffer(fd_bpf_upgradeable_loader_state_t const * self) {
7937 28 : return self->discriminant == 1;
7938 28 : }
7939 38044 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program(fd_bpf_upgradeable_loader_state_t const * self) {
7940 38044 : return self->discriminant == 2;
7941 38044 : }
7942 7282 : FD_FN_PURE uchar fd_bpf_upgradeable_loader_state_is_program_data(fd_bpf_upgradeable_loader_state_t const * self) {
7943 7282 : return self->discriminant == 3;
7944 7282 : }
7945 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant );
7946 52883 : int fd_bpf_upgradeable_loader_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7947 52883 : int err;
7948 52883 : switch (discriminant) {
7949 5511 : case 0: {
7950 5511 : return FD_BINCODE_SUCCESS;
7951 0 : }
7952 2461 : case 1: {
7953 2461 : err = fd_bpf_upgradeable_loader_state_buffer_decode_footprint_inner( ctx, total_sz );
7954 2461 : if( FD_UNLIKELY( err ) ) return err;
7955 765 : return FD_BINCODE_SUCCESS;
7956 2461 : }
7957 24006 : case 2: {
7958 24006 : err = fd_bpf_upgradeable_loader_state_program_decode_footprint_inner( ctx, total_sz );
7959 24006 : if( FD_UNLIKELY( err ) ) return err;
7960 22275 : return FD_BINCODE_SUCCESS;
7961 24006 : }
7962 17519 : case 3: {
7963 17519 : err = fd_bpf_upgradeable_loader_state_program_data_decode_footprint_inner( ctx, total_sz );
7964 17519 : if( FD_UNLIKELY( err ) ) return err;
7965 16899 : return FD_BINCODE_SUCCESS;
7966 17519 : }
7967 3424 : default: return FD_BINCODE_ERR_ENCODING;
7968 52883 : }
7969 52883 : }
7970 56772 : static int fd_bpf_upgradeable_loader_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7971 56772 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7972 53425 : uint discriminant = 0;
7973 53425 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
7974 53425 : if( FD_UNLIKELY( err ) ) return err;
7975 52889 : return fd_bpf_upgradeable_loader_state_inner_decode_footprint( discriminant, ctx, total_sz );
7976 53425 : }
7977 56767 : int fd_bpf_upgradeable_loader_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
7978 56767 : *total_sz += sizeof(fd_bpf_upgradeable_loader_state_t);
7979 56767 : void const * start_data = ctx->data;
7980 56767 : int err = fd_bpf_upgradeable_loader_state_decode_footprint_inner( ctx, total_sz );
7981 56767 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
7982 56767 : ctx->data = start_data;
7983 56767 : return err;
7984 56767 : }
7985 45418 : 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 ) {
7986 45418 : switch (discriminant) {
7987 5517 : case 0: {
7988 5517 : break;
7989 0 : }
7990 765 : case 1: {
7991 765 : fd_bpf_upgradeable_loader_state_buffer_decode_inner( &self->buffer, alloc_mem, ctx );
7992 765 : break;
7993 0 : }
7994 22277 : case 2: {
7995 22277 : fd_bpf_upgradeable_loader_state_program_decode_inner( &self->program, alloc_mem, ctx );
7996 22277 : break;
7997 0 : }
7998 16878 : case 3: {
7999 16878 : fd_bpf_upgradeable_loader_state_program_data_decode_inner( &self->program_data, alloc_mem, ctx );
8000 16878 : break;
8001 0 : }
8002 45418 : }
8003 45418 : }
8004 45421 : static void fd_bpf_upgradeable_loader_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8005 45421 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)struct_mem;
8006 45421 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8007 45421 : fd_bpf_upgradeable_loader_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8008 45421 : }
8009 45421 : void * fd_bpf_upgradeable_loader_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8010 45421 : fd_bpf_upgradeable_loader_state_t * self = (fd_bpf_upgradeable_loader_state_t *)mem;
8011 45421 : fd_bpf_upgradeable_loader_state_new( self );
8012 45421 : void * alloc_region = (uchar *)mem + sizeof(fd_bpf_upgradeable_loader_state_t);
8013 45421 : void * * alloc_mem = &alloc_region;
8014 45421 : fd_bpf_upgradeable_loader_state_decode_inner( mem, alloc_mem, ctx );
8015 45421 : return self;
8016 45421 : }
8017 45420 : void fd_bpf_upgradeable_loader_state_inner_new( fd_bpf_upgradeable_loader_state_inner_t * self, uint discriminant ) {
8018 45420 : switch( discriminant ) {
8019 0 : case 0: {
8020 0 : break;
8021 0 : }
8022 0 : case 1: {
8023 0 : fd_bpf_upgradeable_loader_state_buffer_new( &self->buffer );
8024 0 : break;
8025 0 : }
8026 0 : case 2: {
8027 0 : fd_bpf_upgradeable_loader_state_program_new( &self->program );
8028 0 : break;
8029 0 : }
8030 0 : case 3: {
8031 0 : fd_bpf_upgradeable_loader_state_program_data_new( &self->program_data );
8032 0 : break;
8033 0 : }
8034 45420 : default: break; // FD_LOG_ERR(( "unhandled type"));
8035 45420 : }
8036 45420 : }
8037 45419 : void fd_bpf_upgradeable_loader_state_new_disc( fd_bpf_upgradeable_loader_state_t * self, uint discriminant ) {
8038 45419 : self->discriminant = discriminant;
8039 45419 : fd_bpf_upgradeable_loader_state_inner_new( &self->inner, self->discriminant );
8040 45419 : }
8041 45417 : void fd_bpf_upgradeable_loader_state_new( fd_bpf_upgradeable_loader_state_t * self ) {
8042 45417 : fd_memset( self, 0, sizeof(fd_bpf_upgradeable_loader_state_t) );
8043 45417 : fd_bpf_upgradeable_loader_state_new_disc( self, UINT_MAX );
8044 45417 : }
8045 :
8046 23 : ulong fd_bpf_upgradeable_loader_state_size( fd_bpf_upgradeable_loader_state_t const * self ) {
8047 23 : ulong size = 0;
8048 23 : size += sizeof(uint);
8049 23 : switch (self->discriminant) {
8050 12 : case 1: {
8051 12 : size += fd_bpf_upgradeable_loader_state_buffer_size( &self->inner.buffer );
8052 12 : break;
8053 0 : }
8054 0 : case 2: {
8055 0 : size += fd_bpf_upgradeable_loader_state_program_size( &self->inner.program );
8056 0 : break;
8057 0 : }
8058 11 : case 3: {
8059 11 : size += fd_bpf_upgradeable_loader_state_program_data_size( &self->inner.program_data );
8060 11 : break;
8061 0 : }
8062 23 : }
8063 23 : return size;
8064 23 : }
8065 :
8066 23 : 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 ) {
8067 23 : int err;
8068 23 : switch (discriminant) {
8069 12 : case 1: {
8070 12 : err = fd_bpf_upgradeable_loader_state_buffer_encode( &self->buffer, ctx );
8071 12 : if( FD_UNLIKELY( err ) ) return err;
8072 12 : break;
8073 12 : }
8074 12 : case 2: {
8075 0 : err = fd_bpf_upgradeable_loader_state_program_encode( &self->program, ctx );
8076 0 : if( FD_UNLIKELY( err ) ) return err;
8077 0 : break;
8078 0 : }
8079 11 : case 3: {
8080 11 : err = fd_bpf_upgradeable_loader_state_program_data_encode( &self->program_data, ctx );
8081 11 : if( FD_UNLIKELY( err ) ) return err;
8082 11 : break;
8083 11 : }
8084 23 : }
8085 23 : return FD_BINCODE_SUCCESS;
8086 23 : }
8087 23 : int fd_bpf_upgradeable_loader_state_encode( fd_bpf_upgradeable_loader_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8088 23 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8089 23 : if( FD_UNLIKELY( err ) ) return err;
8090 23 : return fd_bpf_upgradeable_loader_state_inner_encode( &self->inner, self->discriminant, ctx );
8091 23 : }
8092 :
8093 0 : int fd_loader_v4_state_encode( fd_loader_v4_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8094 0 : int err;
8095 0 : err = fd_bincode_uint64_encode( self->slot, ctx );
8096 0 : if( FD_UNLIKELY( err ) ) return err;
8097 0 : err = fd_pubkey_encode( &self->authority_address_or_next_version, ctx );
8098 0 : if( FD_UNLIKELY( err ) ) return err;
8099 0 : err = fd_bincode_uint64_encode( self->status, ctx );
8100 0 : if( FD_UNLIKELY( err ) ) return err;
8101 0 : return FD_BINCODE_SUCCESS;
8102 0 : }
8103 0 : static inline int fd_loader_v4_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8104 0 : if( (ulong)ctx->data + 48UL > (ulong)ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8105 0 : ctx->data = (void *)( (ulong)ctx->data + 48UL );
8106 0 : return 0;
8107 0 : }
8108 0 : static void fd_loader_v4_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8109 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)struct_mem;
8110 0 : fd_bincode_uint64_decode_unsafe( &self->slot, ctx );
8111 0 : fd_pubkey_decode_inner( &self->authority_address_or_next_version, alloc_mem, ctx );
8112 0 : fd_bincode_uint64_decode_unsafe( &self->status, ctx );
8113 0 : }
8114 0 : void * fd_loader_v4_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8115 0 : fd_loader_v4_state_t * self = (fd_loader_v4_state_t *)mem;
8116 0 : fd_loader_v4_state_new( self );
8117 0 : void * alloc_region = (uchar *)mem + sizeof(fd_loader_v4_state_t);
8118 0 : void * * alloc_mem = &alloc_region;
8119 0 : fd_loader_v4_state_decode_inner( mem, alloc_mem, ctx );
8120 0 : return self;
8121 0 : }
8122 0 : int fd_frozen_hash_status_encode( fd_frozen_hash_status_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8123 0 : int err;
8124 0 : err = fd_hash_encode( &self->frozen_hash, ctx );
8125 0 : if( FD_UNLIKELY( err ) ) return err;
8126 0 : err = fd_bincode_bool_encode( (uchar)(self->is_duplicate_confirmed), ctx );
8127 0 : if( FD_UNLIKELY( err ) ) return err;
8128 0 : return FD_BINCODE_SUCCESS;
8129 0 : }
8130 0 : static int fd_frozen_hash_status_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8131 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8132 0 : int err = 0;
8133 0 : err = fd_hash_decode_footprint_inner( ctx, total_sz );
8134 0 : if( FD_UNLIKELY( err ) ) return err;
8135 0 : err = fd_bincode_bool_decode_footprint( ctx );
8136 0 : if( FD_UNLIKELY( err ) ) return err;
8137 0 : return 0;
8138 0 : }
8139 0 : int fd_frozen_hash_status_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8140 0 : *total_sz += sizeof(fd_frozen_hash_status_t);
8141 0 : void const * start_data = ctx->data;
8142 0 : int err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
8143 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8144 0 : ctx->data = start_data;
8145 0 : return err;
8146 0 : }
8147 0 : static void fd_frozen_hash_status_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8148 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)struct_mem;
8149 0 : fd_hash_decode_inner( &self->frozen_hash, alloc_mem, ctx );
8150 0 : fd_bincode_bool_decode_unsafe( &self->is_duplicate_confirmed, ctx );
8151 0 : }
8152 0 : void * fd_frozen_hash_status_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8153 0 : fd_frozen_hash_status_t * self = (fd_frozen_hash_status_t *)mem;
8154 0 : fd_frozen_hash_status_new( self );
8155 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_status_t);
8156 0 : void * * alloc_mem = &alloc_region;
8157 0 : fd_frozen_hash_status_decode_inner( mem, alloc_mem, ctx );
8158 0 : return self;
8159 0 : }
8160 0 : void fd_frozen_hash_status_new(fd_frozen_hash_status_t * self) {
8161 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_status_t) );
8162 0 : fd_hash_new( &self->frozen_hash );
8163 0 : }
8164 0 : FD_FN_PURE uchar fd_frozen_hash_versioned_is_current(fd_frozen_hash_versioned_t const * self) {
8165 0 : return self->discriminant == 0;
8166 0 : }
8167 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant );
8168 0 : int fd_frozen_hash_versioned_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8169 0 : int err;
8170 0 : switch (discriminant) {
8171 0 : case 0: {
8172 0 : err = fd_frozen_hash_status_decode_footprint_inner( ctx, total_sz );
8173 0 : if( FD_UNLIKELY( err ) ) return err;
8174 0 : return FD_BINCODE_SUCCESS;
8175 0 : }
8176 0 : default: return FD_BINCODE_ERR_ENCODING;
8177 0 : }
8178 0 : }
8179 0 : static int fd_frozen_hash_versioned_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8180 0 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8181 0 : uint discriminant = 0;
8182 0 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8183 0 : if( FD_UNLIKELY( err ) ) return err;
8184 0 : return fd_frozen_hash_versioned_inner_decode_footprint( discriminant, ctx, total_sz );
8185 0 : }
8186 0 : int fd_frozen_hash_versioned_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8187 0 : *total_sz += sizeof(fd_frozen_hash_versioned_t);
8188 0 : void const * start_data = ctx->data;
8189 0 : int err = fd_frozen_hash_versioned_decode_footprint_inner( ctx, total_sz );
8190 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8191 0 : ctx->data = start_data;
8192 0 : return err;
8193 0 : }
8194 0 : static void fd_frozen_hash_versioned_inner_decode_inner( fd_frozen_hash_versioned_inner_t * self, void * * alloc_mem, uint discriminant, fd_bincode_decode_ctx_t * ctx ) {
8195 0 : switch (discriminant) {
8196 0 : case 0: {
8197 0 : fd_frozen_hash_status_decode_inner( &self->current, alloc_mem, ctx );
8198 0 : break;
8199 0 : }
8200 0 : }
8201 0 : }
8202 0 : static void fd_frozen_hash_versioned_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8203 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)struct_mem;
8204 0 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8205 0 : fd_frozen_hash_versioned_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8206 0 : }
8207 0 : void * fd_frozen_hash_versioned_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8208 0 : fd_frozen_hash_versioned_t * self = (fd_frozen_hash_versioned_t *)mem;
8209 0 : fd_frozen_hash_versioned_new( self );
8210 0 : void * alloc_region = (uchar *)mem + sizeof(fd_frozen_hash_versioned_t);
8211 0 : void * * alloc_mem = &alloc_region;
8212 0 : fd_frozen_hash_versioned_decode_inner( mem, alloc_mem, ctx );
8213 0 : return self;
8214 0 : }
8215 0 : void fd_frozen_hash_versioned_inner_new( fd_frozen_hash_versioned_inner_t * self, uint discriminant ) {
8216 0 : switch( discriminant ) {
8217 0 : case 0: {
8218 0 : fd_frozen_hash_status_new( &self->current );
8219 0 : break;
8220 0 : }
8221 0 : default: break; // FD_LOG_ERR(( "unhandled type"));
8222 0 : }
8223 0 : }
8224 0 : void fd_frozen_hash_versioned_new_disc( fd_frozen_hash_versioned_t * self, uint discriminant ) {
8225 0 : self->discriminant = discriminant;
8226 0 : fd_frozen_hash_versioned_inner_new( &self->inner, self->discriminant );
8227 0 : }
8228 0 : void fd_frozen_hash_versioned_new( fd_frozen_hash_versioned_t * self ) {
8229 0 : fd_memset( self, 0, sizeof(fd_frozen_hash_versioned_t) );
8230 0 : fd_frozen_hash_versioned_new_disc( self, UINT_MAX );
8231 0 : }
8232 :
8233 0 : ulong fd_frozen_hash_versioned_size( fd_frozen_hash_versioned_t const * self ) {
8234 0 : ulong size = 0;
8235 0 : size += sizeof(uint);
8236 0 : switch (self->discriminant) {
8237 0 : case 0: {
8238 0 : size += fd_frozen_hash_status_size( &self->inner.current );
8239 0 : break;
8240 0 : }
8241 0 : }
8242 0 : return size;
8243 0 : }
8244 :
8245 0 : int fd_frozen_hash_versioned_inner_encode( fd_frozen_hash_versioned_inner_t const * self, uint discriminant, fd_bincode_encode_ctx_t * ctx ) {
8246 0 : int err;
8247 0 : switch (discriminant) {
8248 0 : case 0: {
8249 0 : err = fd_frozen_hash_status_encode( &self->current, ctx );
8250 0 : if( FD_UNLIKELY( err ) ) return err;
8251 0 : break;
8252 0 : }
8253 0 : }
8254 0 : return FD_BINCODE_SUCCESS;
8255 0 : }
8256 0 : int fd_frozen_hash_versioned_encode( fd_frozen_hash_versioned_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8257 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8258 0 : if( FD_UNLIKELY( err ) ) return err;
8259 0 : return fd_frozen_hash_versioned_inner_encode( &self->inner, self->discriminant, ctx );
8260 0 : }
8261 :
8262 0 : int fd_lookup_table_meta_encode( fd_lookup_table_meta_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8263 0 : int err;
8264 0 : err = fd_bincode_uint64_encode( self->deactivation_slot, ctx );
8265 0 : if( FD_UNLIKELY( err ) ) return err;
8266 0 : err = fd_bincode_uint64_encode( self->last_extended_slot, ctx );
8267 0 : if( FD_UNLIKELY( err ) ) return err;
8268 0 : err = fd_bincode_uint8_encode( (uchar)(self->last_extended_slot_start_index), ctx );
8269 0 : if( FD_UNLIKELY( err ) ) return err;
8270 0 : err = fd_bincode_bool_encode( self->has_authority, ctx );
8271 0 : if( FD_UNLIKELY( err ) ) return err;
8272 0 : if( self->has_authority ) {
8273 0 : err = fd_pubkey_encode( &self->authority, ctx );
8274 0 : if( FD_UNLIKELY( err ) ) return err;
8275 0 : }
8276 0 : err = fd_bincode_uint16_encode( self->_padding, ctx );
8277 0 : if( FD_UNLIKELY( err ) ) return err;
8278 0 : return FD_BINCODE_SUCCESS;
8279 0 : }
8280 2515 : static int fd_lookup_table_meta_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8281 2515 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8282 2515 : int err = 0;
8283 2515 : err = fd_bincode_uint64_decode_footprint( ctx );
8284 2515 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8285 2515 : err = fd_bincode_uint64_decode_footprint( ctx );
8286 2515 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8287 2515 : err = fd_bincode_uint8_decode_footprint( ctx );
8288 2515 : if( FD_UNLIKELY( err ) ) return err;
8289 2515 : {
8290 2515 : uchar o;
8291 2515 : err = fd_bincode_bool_decode( &o, ctx );
8292 2515 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8293 2514 : if( o ) {
8294 1300 : err = fd_pubkey_decode_footprint_inner( ctx, total_sz );
8295 1300 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8296 1300 : }
8297 2514 : }
8298 2514 : err = fd_bincode_uint16_decode_footprint( ctx );
8299 2514 : if( FD_UNLIKELY( err!=FD_BINCODE_SUCCESS ) ) return err;
8300 2514 : return 0;
8301 2514 : }
8302 0 : int fd_lookup_table_meta_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8303 0 : *total_sz += sizeof(fd_lookup_table_meta_t);
8304 0 : void const * start_data = ctx->data;
8305 0 : int err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
8306 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8307 0 : ctx->data = start_data;
8308 0 : return err;
8309 0 : }
8310 2514 : static void fd_lookup_table_meta_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8311 2514 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)struct_mem;
8312 2514 : fd_bincode_uint64_decode_unsafe( &self->deactivation_slot, ctx );
8313 2514 : fd_bincode_uint64_decode_unsafe( &self->last_extended_slot, ctx );
8314 2514 : fd_bincode_uint8_decode_unsafe( &self->last_extended_slot_start_index, ctx );
8315 2514 : {
8316 2514 : uchar o;
8317 2514 : fd_bincode_bool_decode_unsafe( &o, ctx );
8318 2514 : self->has_authority = !!o;
8319 2514 : if( o ) {
8320 1300 : fd_pubkey_new( &self->authority );
8321 1300 : fd_pubkey_decode_inner( &self->authority, alloc_mem, ctx );
8322 1300 : }
8323 2514 : }
8324 2514 : fd_bincode_uint16_decode_unsafe( &self->_padding, ctx );
8325 2514 : }
8326 0 : void * fd_lookup_table_meta_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8327 0 : fd_lookup_table_meta_t * self = (fd_lookup_table_meta_t *)mem;
8328 0 : fd_lookup_table_meta_new( self );
8329 0 : void * alloc_region = (uchar *)mem + sizeof(fd_lookup_table_meta_t);
8330 0 : void * * alloc_mem = &alloc_region;
8331 0 : fd_lookup_table_meta_decode_inner( mem, alloc_mem, ctx );
8332 0 : return self;
8333 0 : }
8334 0 : void fd_lookup_table_meta_new(fd_lookup_table_meta_t * self) {
8335 0 : fd_memset( self, 0, sizeof(fd_lookup_table_meta_t) );
8336 0 : }
8337 0 : ulong fd_lookup_table_meta_size( fd_lookup_table_meta_t const * self ) {
8338 0 : ulong size = 0;
8339 0 : size += sizeof(ulong);
8340 0 : size += sizeof(ulong);
8341 0 : size += sizeof(char);
8342 0 : size += sizeof(char);
8343 0 : if( self->has_authority ) {
8344 0 : size += fd_pubkey_size( &self->authority );
8345 0 : }
8346 0 : size += sizeof(ushort);
8347 0 : return size;
8348 0 : }
8349 :
8350 0 : int fd_address_lookup_table_encode( fd_address_lookup_table_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8351 0 : int err;
8352 0 : err = fd_lookup_table_meta_encode( &self->meta, ctx );
8353 0 : if( FD_UNLIKELY( err ) ) return err;
8354 0 : return FD_BINCODE_SUCCESS;
8355 0 : }
8356 2515 : static int fd_address_lookup_table_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8357 2515 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8358 2515 : int err = 0;
8359 2515 : err = fd_lookup_table_meta_decode_footprint_inner( ctx, total_sz );
8360 2515 : if( FD_UNLIKELY( err ) ) return err;
8361 2514 : return 0;
8362 2515 : }
8363 0 : int fd_address_lookup_table_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8364 0 : *total_sz += sizeof(fd_address_lookup_table_t);
8365 0 : void const * start_data = ctx->data;
8366 0 : int err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
8367 0 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8368 0 : ctx->data = start_data;
8369 0 : return err;
8370 0 : }
8371 2514 : static void fd_address_lookup_table_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8372 2514 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)struct_mem;
8373 2514 : fd_lookup_table_meta_decode_inner( &self->meta, alloc_mem, ctx );
8374 2514 : }
8375 0 : void * fd_address_lookup_table_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8376 0 : fd_address_lookup_table_t * self = (fd_address_lookup_table_t *)mem;
8377 0 : fd_address_lookup_table_new( self );
8378 0 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_t);
8379 0 : void * * alloc_mem = &alloc_region;
8380 0 : fd_address_lookup_table_decode_inner( mem, alloc_mem, ctx );
8381 0 : return self;
8382 0 : }
8383 0 : void fd_address_lookup_table_new(fd_address_lookup_table_t * self) {
8384 0 : fd_memset( self, 0, sizeof(fd_address_lookup_table_t) );
8385 0 : fd_lookup_table_meta_new( &self->meta );
8386 0 : }
8387 0 : ulong fd_address_lookup_table_size( fd_address_lookup_table_t const * self ) {
8388 0 : ulong size = 0;
8389 0 : size += fd_lookup_table_meta_size( &self->meta );
8390 0 : return size;
8391 0 : }
8392 :
8393 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_uninitialized(fd_address_lookup_table_state_t const * self) {
8394 0 : return self->discriminant == 0;
8395 0 : }
8396 0 : FD_FN_PURE uchar fd_address_lookup_table_state_is_lookup_table(fd_address_lookup_table_state_t const * self) {
8397 0 : return self->discriminant == 1;
8398 0 : }
8399 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant );
8400 2517 : int fd_address_lookup_table_state_inner_decode_footprint( uint discriminant, fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8401 2517 : int err;
8402 2517 : switch (discriminant) {
8403 1 : case 0: {
8404 1 : return FD_BINCODE_SUCCESS;
8405 0 : }
8406 2515 : case 1: {
8407 2515 : err = fd_address_lookup_table_decode_footprint_inner( ctx, total_sz );
8408 2515 : if( FD_UNLIKELY( err ) ) return err;
8409 2514 : return FD_BINCODE_SUCCESS;
8410 2515 : }
8411 1 : default: return FD_BINCODE_ERR_ENCODING;
8412 2517 : }
8413 2517 : }
8414 2517 : static int fd_address_lookup_table_state_decode_footprint_inner( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8415 2517 : if( ctx->data>=ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8416 2517 : uint discriminant = 0;
8417 2517 : int err = fd_bincode_uint32_decode( &discriminant, ctx );
8418 2517 : if( FD_UNLIKELY( err ) ) return err;
8419 2517 : return fd_address_lookup_table_state_inner_decode_footprint( discriminant, ctx, total_sz );
8420 2517 : }
8421 2517 : int fd_address_lookup_table_state_decode_footprint( fd_bincode_decode_ctx_t * ctx, ulong * total_sz ) {
8422 2517 : *total_sz += sizeof(fd_address_lookup_table_state_t);
8423 2517 : void const * start_data = ctx->data;
8424 2517 : int err = fd_address_lookup_table_state_decode_footprint_inner( ctx, total_sz );
8425 2517 : if( ctx->data>ctx->dataend ) { return FD_BINCODE_ERR_OVERFLOW; };
8426 2517 : ctx->data = start_data;
8427 2517 : return err;
8428 2517 : }
8429 2515 : 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 ) {
8430 2515 : switch (discriminant) {
8431 1 : case 0: {
8432 1 : break;
8433 0 : }
8434 2514 : case 1: {
8435 2514 : fd_address_lookup_table_decode_inner( &self->lookup_table, alloc_mem, ctx );
8436 2514 : break;
8437 0 : }
8438 2515 : }
8439 2515 : }
8440 2515 : static void fd_address_lookup_table_state_decode_inner( void * struct_mem, void * * alloc_mem, fd_bincode_decode_ctx_t * ctx ) {
8441 2515 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)struct_mem;
8442 2515 : fd_bincode_uint32_decode_unsafe( &self->discriminant, ctx );
8443 2515 : fd_address_lookup_table_state_inner_decode_inner( &self->inner, alloc_mem, self->discriminant, ctx );
8444 2515 : }
8445 2515 : void * fd_address_lookup_table_state_decode( void * mem, fd_bincode_decode_ctx_t * ctx ) {
8446 2515 : fd_address_lookup_table_state_t * self = (fd_address_lookup_table_state_t *)mem;
8447 2515 : fd_address_lookup_table_state_new( self );
8448 2515 : void * alloc_region = (uchar *)mem + sizeof(fd_address_lookup_table_state_t);
8449 2515 : void * * alloc_mem = &alloc_region;
8450 2515 : fd_address_lookup_table_state_decode_inner( mem, alloc_mem, ctx );
8451 2515 : return self;
8452 2515 : }
8453 2515 : void fd_address_lookup_table_state_inner_new( fd_address_lookup_table_state_inner_t * self, uint discriminant ) {
8454 2515 : switch( discriminant ) {
8455 0 : case 0: {
8456 0 : break;
8457 0 : }
8458 0 : case 1: {
8459 0 : fd_address_lookup_table_new( &self->lookup_table );
8460 0 : break;
8461 0 : }
8462 2515 : default: break; // FD_LOG_ERR(( "unhandled type"));
8463 2515 : }
8464 2515 : }
8465 2515 : void fd_address_lookup_table_state_new_disc( fd_address_lookup_table_state_t * self, uint discriminant ) {
8466 2515 : self->discriminant = discriminant;
8467 2515 : fd_address_lookup_table_state_inner_new( &self->inner, self->discriminant );
8468 2515 : }
8469 2515 : void fd_address_lookup_table_state_new( fd_address_lookup_table_state_t * self ) {
8470 2515 : fd_memset( self, 0, sizeof(fd_address_lookup_table_state_t) );
8471 2515 : fd_address_lookup_table_state_new_disc( self, UINT_MAX );
8472 2515 : }
8473 :
8474 0 : ulong fd_address_lookup_table_state_size( fd_address_lookup_table_state_t const * self ) {
8475 0 : ulong size = 0;
8476 0 : size += sizeof(uint);
8477 0 : switch (self->discriminant) {
8478 0 : case 1: {
8479 0 : size += fd_address_lookup_table_size( &self->inner.lookup_table );
8480 0 : break;
8481 0 : }
8482 0 : }
8483 0 : return size;
8484 0 : }
8485 :
8486 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 ) {
8487 0 : int err;
8488 0 : switch (discriminant) {
8489 0 : case 1: {
8490 0 : err = fd_address_lookup_table_encode( &self->lookup_table, ctx );
8491 0 : if( FD_UNLIKELY( err ) ) return err;
8492 0 : break;
8493 0 : }
8494 0 : }
8495 0 : return FD_BINCODE_SUCCESS;
8496 0 : }
8497 0 : int fd_address_lookup_table_state_encode( fd_address_lookup_table_state_t const * self, fd_bincode_encode_ctx_t * ctx ) {
8498 0 : int err = fd_bincode_uint32_encode( self->discriminant, ctx );
8499 0 : if( FD_UNLIKELY( err ) ) return err;
8500 0 : return fd_address_lookup_table_state_inner_encode( &self->inner, self->discriminant, ctx );
8501 0 : }
8502 :
8503 : #include "fd_types_custom.c"
|